From 9a5522bbb18d5fd17155b1571e9c4c30cbc082b4 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 09:40:18 +0100 Subject: [PATCH] Deals belong to Sales: the intern sticks to the network, the sales desk signs deals for you, orbit ones too The NOC intern loses the sales order. Saves that had it load cleanly: sanitize drops the order, its log lines and its weekly tally, and an intern who was running it hands its switch and minimum to the sales desk (S.slAuto). With someone at the sales desk, the player can let them sign offers once a game day and decline the ones under a minimum (39-sales-auto.js), each in their own style: the engineer and the CEO sign after the #185 routing trial (one a day, a misfit waits a week), the shark signs every offer whose POPs are up, promises and commission included, and the CEO's declines are a handshake away. Orbit offers need room on their landing dish instead of a trial. Nobody at the desk (the default; the CEO is a choice, not a given): every deal is signed by hand. The sales desk runs before the intern's shift, so a deal signed today is in the loads the intern works from. The sheet shows the switch, the minimum and this week's and last week's tally; the NOC gets one notice a week. Orbit offers go through the desk too (99-pie-sales.js): they carry o.by, so commission, renewal haggles and each one's mark at renewal apply. The engineer only offers where the landing dish has 1.5x room on a well-served POP, and those customers renew like the nerds (0.5x leave). The shark rings airlines, cruise lines and the Mars mission first, at the biggest size that fits and 25% more, and half of them get a full-sky promise (REQS.skyfull: a crust at 90%) before there is one; they grumble down to 40 happiness and never cancel over the promise alone. The CEO plays every other golf game with the Founder: the biggest orbit deal that fits, Mars first, at 30% off; jitters cut his orbit prices by 0.4x the jitters and from 0.6 the Founder skips golf. Without a salesperson orbit offers are drawn exactly as before (the O7 balance save has nobody at the desk: payback unchanged, 7.0 years on seed 7, 7.5 on seed 11). Also: the scenario reference plays 'sales' as the CEO signing for you; the route fuzz leaves out the state and buttons of a standing order only main still has; the intern's on/off dials (paid peering, keep a spare) show their translated value in the shipped page instead of the raw label. --- CHANGELOG.md | 2 + docs/ARCHITECTURE.md | 4 +- scripts/lib/fuzz-page.js | 11 +- scripts/lib/route-fuzz.js | 13 +- scripts/lib/scenario-ref.js | 5 +- site/i18n/de.js | 28 +- site/i18n/es.js | 28 +- site/i18n/fr.js | 28 +- site/i18n/it.js | 28 +- site/i18n/pt.js | 28 +- src/agent/20-commands.js | 6 +- src/agent/30-docs.js | 5 +- src/game/60-features/38-sales-desk.js | 10 +- src/game/60-features/39-sales-auto.js | 41 +++ src/game/60-features/80-new-game.js | 2 +- src/game/60-features/90-automation.js | 2 +- src/game/60-features/95-standing-orders.js | 59 ++-- .../60-features/99-pie-orbit-customers.js | 11 +- src/game/60-features/99-pie-sales.js | 36 +++ src/game/80-simulation/60-requirements.js | 2 + src/game/88-days/10-day-tick.js | 4 + src/game/90-actions/52-sales.js | 3 + src/game/93-ui/58-sales-panel.js | 17 +- src/i18n/en.js | 28 +- tests/automation.test.js | 46 +-- tests/sales-auto.test.js | 275 ++++++++++++++++++ tests/sales-trial.test.js | 2 +- tests/standing-orders.test.js | 73 ++--- 28 files changed, 613 insertions(+), 184 deletions(-) create mode 100644 src/game/60-features/39-sales-auto.js create mode 100644 src/game/60-features/99-pie-sales.js create mode 100644 tests/sales-auto.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 79bc4e9..9b2a039 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ All notable changes to this project are documented here. The project follows - Pie Control has four tabs in one row that fits a phone: Traffic, Company, Launch and Dishes. The Founder's posts and your orbit books moved into the Company tab. - Your own subsea cables now land right on the city's dot, also in Fujairah, Dubai, Karachi, Barcelona, Osaka and other cities the map shifts slightly so they do not overlap (#305). - Starting a new network no longer leaves the last one's "New POP!" and money pop-ups frozen all over the map until a reload. +- Deals belong to Sales now: the NOC intern sticks to the network, and your salesperson can sign deals for you, orbit customers included. Open the sales desk in Deals, switch on Sign deals and pick a minimum below which offers are declined: the engineer signs only what your network can serve, the shark signs everything at once (promises and commission included), and the CEO signs what fits but now and then has already shaken hands on an offer you would have declined. If your intern used to handle sales, that setting moved to the sales desk; with nobody running sales you sign by hand, as before. +- Your salesperson now sells for your rocket company too. The engineer only sells where a pie dish has room to spare, and those customers stay longer; the shark goes after airlines and cruise lines at the biggest size and a quarter more, and promises half of them a full sky before you have one, so they grumble until you do; the CEO plays every other round of golf with the Founder and comes back with the biggest orbit deal that fits (the Mars mission first) at 30% off, unless the markets are jumpy, which costs him. ## [2.10.1] — 2026-11-05 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 255955b..77b2a1e 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -31,7 +31,7 @@ hoisted across files, and top-level statements run in path order. Find code by n | `30-networks/` | Other ASes (`NETS`), rival exchanges (`XIX`), the long tail, traffic shares (`NSH`) | | `40-progress/` | Customer types (`BIZ_T`), `LEVELS` and their requirements, `GOALS`; the per-save ruleset (`S.rules`, `rule()`, `PRESETS`, `chaosMul()`, `leadDays()`) | | `50-state.js` | The globals `S`, `R`, `UI`; `emptyR()` | -| `60-features/` | Banks and loans, scenarios and the weekly challenge, puzzles and the published weekly puzzle, conferences, the tutorial, traceroute, the share card, `newGame()`, the offer trial (`autoOffer()`), standing orders (`S.ops`, `opsDay()`, run from `dayTick()`), the sales desk (`S.sales`, `salesDay()`, `salesShape()` on new offers) | +| `60-features/` | Banks and loans, scenarios and the weekly challenge, puzzles and the published weekly puzzle, conferences, the tutorial, traceroute, the share card, `newGame()`, the offer trial (`autoOffer()`), standing orders (`S.ops`, `opsDay()`, run from `dayTick()`), the sales desk (`S.sales`, `salesDay()`, `salesShape()` on new offers, orbit ones through `pieSlShape()`; signing for you: `S.slAuto`, `slAutoDay()`) | | `70-rules/` | Formatting helpers and market rules: exchanges, PNIs, the peering desk (requests answered by policy), peering policy and snubs, DE-KICKS, sold-out routes, hot ports and the Tier 1/2/3 rank | | `80-simulation/` | Dijkstra, RouteScript, where a DDoS flood goes (`ddosLoad()`/`ddosAfter()`, called by `compute()`), `compute()`, monthly prices, `sanitize()`/`migrate()`, customer requirements, events, the customer lifecycle (contracts, renewals, the bandwidth market, why customers leave), geography pricing and latency, second sites and service | | `85-incidents/` | `addInc()`, DDoS attacks (targets, sizes, scoring, the NOC card) and scrubbing, `fireFailure()`, `clearInc()`, `fireEvent()`, the chaos monkey, cable ships (`50-cable-ships.js`: a subsea cut sends a club ship from its port along the cable routes; voyages in `S.fleet`, drawn by `96-map/88-cable-ships.js`) | @@ -117,6 +117,8 @@ never freezes the game. Then the NOC intern's standing orders (`opsDay()`), if one is hired: each order clicks the same `ACT` actions a player would, muted, within its monthly budget, and the shift recomputes once at the end, only if a job changed the network. An order that throws is paused; the day goes on. The NOC gets one notice a week. + Then the sales desk (`slAutoDay()`), if someone runs sales and the player lets them sign: deals are Sales', never + the intern's. Each salesperson signs in their own style (a routing trial a day, or the shark's sign-everything). 5. Updates customer mood, churn and new offers; IX members join; loans tick. 6. Every 30 days: bills the month (revenue minus costs) and checks for bankruptcy. 7. Checks goals, level, badges and scenario end conditions. diff --git a/scripts/lib/fuzz-page.js b/scripts/lib/fuzz-page.js index dc3646d..5b05a14 100644 --- a/scripts/lib/fuzz-page.js +++ b/scripts/lib/fuzz-page.js @@ -158,9 +158,14 @@ const parts = () => { const o = {}; if (!R) return o; for (const k of Object.keys(R)) o[k] = JSON.stringify(R[k]); o.fl = R.fl ? JSON.stringify(R.fl) : ''; return o; }; // A field only this checkout's game has (a new feature's state, on S or on its customers and offers) cannot match main // yet: the driver passes those (drop) and they are left out; every field both games have must still match. - const sKeys = () => ({ top: Object.keys(S), items: [...new Set([...(S.biz || []), ...(S.offers || [])].flatMap((x) => Object.keys(x)))] }); - const sDrop = (drop) => { if (!drop || (!drop.top.length && !drop.items.length)) return S; const o = {}; - for (const k of Object.keys(S)) if (!drop.top.includes(k)) o[k] = S[k]; + // The intern's state two levels deep (ops.on.sales, ops.wk.rev): a standing order one game has and the other retired. + const opsPaths = () => { const O = S.ops, out = []; if (!O || typeof O !== 'object') return out; + for (const k of Object.keys(O)) { out.push(k); const v = O[k]; if (v && typeof v === 'object' && !Array.isArray(v)) for (const j of Object.keys(v)) out.push(k + '.' + j); } return out; }; + const sKeys = () => ({ top: Object.keys(S), items: [...new Set([...(S.biz || []), ...(S.offers || [])].flatMap((x) => Object.keys(x)))], ops: opsPaths(), orders: typeof OPSK === 'object' ? Object.keys(OPSK) : [] }); + const opsDrop = (ops) => { const o = {}; for (const k of Object.keys(S.ops)) { if (ops.includes(k)) continue; const v = S.ops[k]; + if (v && typeof v === 'object' && !Array.isArray(v)) { const w = {}; for (const j of Object.keys(v)) if (!ops.includes(k + '.' + j)) w[j] = v[j]; o[k] = w; } else o[k] = v; } return o; }; + const sDrop = (drop) => { if (!drop || (!drop.top.length && !drop.items.length && !(drop.ops || []).length)) return S; const o = {}; + for (const k of Object.keys(S)) if (!drop.top.includes(k)) o[k] = k === 'ops' && S.ops && (drop.ops || []).length ? opsDrop(drop.ops) : S[k]; for (const k of ['biz', 'offers']) if (Array.isArray(o[k])) o[k] = o[k].map((x) => { const y = {}; for (const f of Object.keys(x)) if (!drop.items.includes(f)) y[f] = x[f]; return y; }); return o; }; const sDigest = (drop) => JSON.stringify(sDrop(drop)); diff --git a/scripts/lib/route-fuzz.js b/scripts/lib/route-fuzz.js index 164a8a7..dfca595 100644 --- a/scripts/lib/route-fuzz.js +++ b/scripts/lib/route-fuzz.js @@ -78,8 +78,10 @@ function playGame(pages, seed, opts = {}) { const [x, y] = both('check'); for (const k of ['a', 'b', 'c']) if (x[k] !== y[k]) { fail(where + ': routing (' + k + ') base vs head', { diff: firstDiff(base.call('parts'), head.call('parts')) }); return false; } if (y.b !== y.c) { fail(where + ': head cached vs uncached', { diff: 'R from the kept tables differs from a fresh route' }); return false; } - // Fields only this checkout's game has are left out on both sides (see sKeys in fuzz-page.js). - const [k1, k2] = both('sKeys'), drop = { top: k2.top.filter((k) => !k1.top.includes(k)), items: k2.items.filter((k) => !k1.items.includes(k)) }; + // Fields only this checkout's game has are left out on both sides (see sKeys in fuzz-page.js), and so is the state of a + // standing order only one of them has (one this checkout retired, or added). + const [k1, k2] = both('sKeys'), drop = { top: k2.top.filter((k) => !k1.top.includes(k)), items: k2.items.filter((k) => !k1.items.includes(k)), + ops: [...k1.ops.filter((k) => !k2.ops.includes(k)), ...k2.ops.filter((k) => !k1.ops.includes(k))] }; const [s1, s2] = both('sDigest', drop); if (s1 !== s2) { fail(where + ': game state S', { diff: firstDiff(base.call('sParts', drop), head.call('sParts', drop)) }); return false; } return true; @@ -102,8 +104,11 @@ function playGame(pages, seed, opts = {}) { // A screen's buttons on both pages; the same list or a divergence. // Buttons for actions main's page does not have (a new feature's) are left out: the driver only presses what both have. - let baseActs = null; - const screen = (w) => { const [a, b0] = both('screen', w); baseActs = baseActs || new Set(base.call('acts')); + // So are the switches and dials of a standing order this checkout retired (main's sheet still shows them). + let baseActs = null, retired = null; + const screen = (w) => { const [a0, b0] = both('screen', w); baseActs = baseActs || new Set(base.call('acts')); + if (!retired) { const [o1, o2] = both('sKeys'); retired = new Set(o1.orders.filter((k) => !o2.orders.includes(k))); } + const a = Array.isArray(a0) ? a0.filter((x) => !(/^ops/.test(x.act) && retired.has(x.args && x.args.k))) : a0; const b = Array.isArray(b0) ? b0.filter((x) => baseActs.has(x.act)) : b0; same('buttons of ' + JSON.stringify(w), a, b); return a || []; }; const press = (b, where) => { acts[b.act] = (acts[b.act] || 0) + 1; const [e1, e2] = both('press', b); same('press ' + where, e1, e2); note(where + ' ' + b.act + JSON.stringify(b.args) + (e1 ? ' !' + e1 : '')); }; // Answer whatever window opened, a few levels deep, then close it. diff --git a/scripts/lib/scenario-ref.js b/scripts/lib/scenario-ref.js index 7246bf6..da5da92 100644 --- a/scripts/lib/scenario-ref.js +++ b/scripts/lib/scenario-ref.js @@ -6,7 +6,7 @@ // A plan is a list of steps, each [op, ...args]: // ['bb', c] POP and broadband ['tr', c, tier] the cheapest transit there ['ix', c, tier] every exchange // ['pop', c] a POP only ['link', a, b, tier, cable] a wave (routers upgraded first, a swap a day) -// ['hire', orders, params] the NOC intern on standing orders, as soon as the level allows +// ['hire', orders, params] the NOC intern on standing orders, as soon as the level allows ('sales': the CEO signs deals) // ['wait', day] until that day ['served', g] until g Gbps are served ['prep', c, g] capacity for an event // ['scrub', c, tier] a scrubbing center ['pnis'] a PNI with every unreached network that takes one // ['pni', c, net, tier] one PNI with that network there ['last', c] transit there only as a last resort @@ -29,7 +29,8 @@ Q.link=(a,b,tier=1,via)=>{for(const c of [a,b])Q.pop(c);if(!S.pops[a]||!S.pops[b if(!waveOk(a,b,tier))return null;const n0=S.links.length;UI.via=via||null;UI.route=null;openLinkModal(a,b);ACT.buildLink({tier});closeModal();return S.links.length>n0;}; Q.hire=(orders,par)=>{Q.wantHire=[orders||['transit','routers','repair'],par||{}];return true;}; Q.hire0=(orders,par)=>{if(!opsCanHire()||!Q.can(20000))return false;if(!opsHired()){ACT.opsHire({id:'kevin'});closeModal();}if(!opsHired())return false; - for(const k of orders)if(!S.ops.on[k])ACT.opsToggle({k});for(const k in par)for(const [p,v] of Object.entries(par[k]))for(let i=0;i<8&&opsP(k,p)!==v;i++)ACT.opsParam({k,p});closeModal();return true;}; + // Deals are the sales desk's: 'sales' puts the CEO there (free, and he signs what the old sales order signed) and lets him sign. + for(const k of orders)if(k==='sales'){if(!slP()&&salesCanHire())ACT.salesHire({id:'ceo'});if(slP()&&!S.slAuto.on)ACT.salesAuto();}else if(!S.ops.on[k])ACT.opsToggle({k});for(const k in par)for(const [p,v] of Object.entries(par[k]))for(let i=0;i<8&&opsP(k,p)!==v;i++)ACT.opsParam({k,p});closeModal();return true;}; Q.pnis=(tier=0)=>{for(const n of NETS.filter(n=>!R.reachable[n.id]).sort((a,b)=>NSH[b.id]-NSH[a.id])){const b=pniBatch(n.id,tier);if(!b||!b.orders.length||!Q.can(b.cost))continue;ACT.pniAll({net:n.id,tier});}return true;}; Q.pni=(c,net,tier=0)=>{if(!S.pni.some(p=>p.city===c&&p.net===net))ACT.pni({city:c,net,tier});closeModal();return S.pni.some(p=>p.city===c&&p.net===net);}; Q.scrub=(c,tier=0)=>{ACT.buildScrub({city:c,tier});return true;}; diff --git a/site/i18n/de.js b/site/i18n/de.js index c39c736..2a9fa15 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3223,7 +3223,6 @@ "ops.kevin_from_the_night_shift":"Kevin von der Nachtschicht", "ops.l_broke":{"one":"stand beim Budget für {where} an","other":"stand bei {n} Aufträgen am Budget an ({where})"}, "ops.l_caches":{"one":"hat einen Gratis-Cache in {where} eingebaut","other":"hat {n} Gratis-Caches eingebaut ({where})"}, -"ops.l_decline":{"one":"hat ein Mini-Angebot abgelehnt","other":"hat {n} Mini-Angebote abgelehnt"}, "ops.l_decom":{"one":"hat eine kleine Wave auf {where} zurückgegeben","other":"hat {n} kleine Waves zurückgegeben ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"hat einen Kanal auf {where} aufgeschaltet","other":"hat {n} Kanäle aufgeschaltet ({where})"}, @@ -3235,7 +3234,6 @@ "ops.l_repair":{"one":"hat eine Reparatur beschleunigt","other":"hat {n} Reparaturen beschleunigt"}, "ops.l_routers":{"one":"hat Router in {where} aufgerüstet","other":"hat Router an {n} Orten aufgerüstet ({where})"}, "ops.l_rs":{"one":"hat sich einem Route Server angeschlossen","other":"hat sich {n} Route Servern angeschlossen"}, -"ops.l_sales":{"one":"hat einen Kunden unterschrieben","other":"hat {n} Kunden unterschrieben"}, "ops.l_snag":{"one":"ist bei {where} hängen geblieben und hat den Auftrag pausiert, bis du draufschaust","other":"ist bei {n} Aufträgen hängen geblieben ({where}) und hat sie pausiert, bis du draufschaust"}, "ops.l_transit":{"one":"hat Transit in {where} aufgestockt","other":"hat {n}-mal Transit aufgestockt ({where})"}, "ops.locked":"Das NOC stellt ab Kundenlevel {lv} Praktikanten ein.", @@ -3247,10 +3245,8 @@ "ops.mood_oops":"{name} ist heute sehr vorsichtig. Bitte niemand die Interface-Beschreibungen erwähnen.", "ops.mood_outage":"{name} beobachtet die Störungsgraphen und lädt die Statusseite neu. Sehr oft.", "ops.mood_quiet":"{name} liest in Ruhe RFCs. Die Graphen sind flach, genau wie es sein soll.", -"ops.mood_sales":"{name} läuft heute etwas aufrechter: In der eigenen Schicht hat jemand unterschrieben.", "ops.mood_snag":"{name} ist auf etwas Seltsames gestoßen, hat den Auftrag pausiert und dir einen Zettel hingeklebt.", "ops.mood_tracy":"Tracy ist drei Hops tief in einem Traceroute, bisher mit nur einem Sternchen.", -"ops.never":"nie", "ops.no_cap":"kein Limit", "ops.no_clock":"Keine Uhr, keine Schichten: Bei diesen Regeln gibt es keine Tage, an denen ein Praktikant arbeiten könnte.", "ops.o_caches":"Gratis-Caches annehmen", @@ -3269,18 +3265,14 @@ "ops.o_repair_d":"Für jeden Ausfall mit Eil-Reparatur zahlen, solange das Budget reicht.", "ops.o_routers":"Router voraus halten", "ops.o_routers_d":"Einen Router dazustellen oder auf die nächste Generation tauschen, wo ein zweiter Router den Traffic trägt, sobald Last oder Ports eine Grenze überschreiten.", -"ops.o_sales":"Vertrieb übernehmen", -"ops.o_sales_d":"Angebote unterschreiben, deren Anforderungen mit Kapazität übrig erfüllt sind, und die ablehnen, die sich nicht lohnen.", "ops.o_transit":"Transit-Reserve halten", "ops.o_transit_d":"Transit an jedem POP über einem Vielfachen seiner 30-Tage-Spitze halten: ein LAG-Member dazu oder eine Portgröße hoch.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Fertige Angebote annehmen", "ops.p_at":"Ab", "ops.p_g":"Ab", "ops.p_how":"Wie", "ops.p_keep":"Einen in Reserve", -"ops.p_min":"Ablehnen unter", "ops.p_paid":"Paid Peering", "ops.p_pick":"Optiken", "ops.p_prov":"Anbieter", @@ -3316,7 +3308,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Woche gesamt: {cost} einmalig, {mo}/Monat.", "ops.w_oops":{"one":"hat sich einmal kurz vertippt","other":"hat sich {n}-mal kurz vertippt"}, -"ops.w_sales":{"one":"hat einen Kunden gewonnen ({rev}/Monat)","other":"hat {n} Kunden gewonnen ({rev}/Monat)"}, "optic_counts.apply_price":"Übernehmen · {price}", "optic_counts.count_for_model":"Anzahl der {model}-Kanäle", "optic_counts.only_n_channels_free":"Auf dieser Glasfaser sind nur {n} Kanäle frei.", @@ -4083,6 +4074,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× 400G Alien Wave auf deiner Glasfaser {a}–{b}","other":"{n}× 400G Alien Waves auf deiner Glasfaser {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Braucht verlustarme Anbindung nach China", "requirements.one_way_latency_within_max_ms":"Einweg-Latenz höchstens {max} ms (aktuell beste: {best})", +"requirements.promised_a_full_sky":"Versprochen: ein voller Himmel, eine Kruste zu mindestens {p} im Orbit", "requirements.refuses_cogentle_transit_anywhere_on":"Duldet nirgends in deinem Netz Transit von Cogentle (lange Geschichte)", "requirements.their_ceo_hates_puns_please_do":"Ihr CEO hasst Wortspiele. Bitte erwähne die Netznamen nicht.", "requirements.two_data_centers_in_every_metro":"Zwei Rechenzentren in jeder Stadt, in der sie vertreten sind", @@ -4288,8 +4280,15 @@ "rules.your_pager_never_sleeps":"Dein Pager schläft nie.", "sales.ask_vp":"Beim Vorstand einen VP Sales beantragen · {cost}", "sales.at_desk":"{name} leitet den Vertrieb", +"sales.auto":"Unterschreibt Deals für dich", +"sales.auto_ceo":"{name} unterschreibt die Angebote, die dein Netz heute bedienen kann, ein Test am Tag. Er lehnt auch die unter deinem Minimum ab, nur hat er ab und zu schon eingeschlagen.", +"sales.auto_eng":"{name} unterschreibt die Angebote, die dein Netz heute bedienen kann, nachdem jedes erst im Netz ausprobiert wurde (eins am Tag), und lehnt die ab, die weniger als dein Minimum zahlen.", +"sales.auto_shark":"{name} unterschreibt jedes Angebot, sobald es reinkommt, mitsamt Versprechen, solange du die Provision zahlen kannst, und lehnt die ab, die weniger als dein Minimum zahlen.", +"sales.by_hand":"Niemand macht den Vertrieb, also unterschreibst du jeden Deal selbst. Stell jemanden ein, oder lass den CEO ran, und sie unterschreiben für dich.", "sales.ceo_d":"Kostenlos, und überzeugt davon. Alle paar Monate unterschreibt er auf dem Golfplatz einen Riesendeal mit 30 % Rabatt, oft mit einem Versprechen, das niemand geprüft hat, und ab und zu ein Angebot, das du abgelehnt hast. Hat Meinungen. Kann nicht entlassen werden.", "sales.ceo_golf":"Der CEO hat {name} auf dem Golfplatz unterschrieben: {bw} in {city} für {price}/Monat, 30 % unter Liste.", +"sales.ceo_golf_skip":"Der Gründer hat das Golf geschwänzt: Die Märkte sind zu nervös. Der CEO hat allein gespielt und im Orbit nichts unterschrieben.", +"sales.ceo_golf_sky":"Der CEO und der Gründer haben {name} auf dem Golfplatz unterschrieben: {bw} im Orbit über {city} für {price}/Monat, {p} unter Liste.", "sales.ceo_n":"Der CEO, der besser verkauft als alle", "sales.ceo_override":"Du hast {name} abgelehnt, aber der CEO hatte schon eingeschlagen. Jetzt sind sie Kunde.", "sales.ceo_promised":"Er hat auch versprochen: {req}.", @@ -4301,27 +4300,38 @@ "sales.ceo_say_napkin":"Ich habe den nächsten Deal auf einer Serviette kalkuliert. Die Technik kann die Details klären.", "sales.ceo_say_synergy":"Wir verkaufen keine Bandbreite, wir verkaufen Synergie. Schreibt das auf die Website.", "sales.ceo_says":"Der CEO: „{say}“", +"sales.ceo_sky":"Im Orbit: jede zweite Golfrunde spielt er mit dem Gründer, für den größten Orbit-Deal, der passt, mit 30 % Rabatt. Nervöse Märkte kosten ihn: niedrigere Orbit-Preise, und gar kein Golf, wenn sie sehr nervös sind.", "sales.ceo_took_over":"{name} hat den Vertrieb persönlich übernommen. Er ist sicher, dass er besser verkauft als alle.", "sales.commission":"{name} hat unterschrieben. Provision für den Hai: {cost}.", +"sales.decline_below":"Ablehnen unter", "sales.desk":"Vertrieb", "sales.eng_booked":"{name} hat dich für {conf} in {city} angemeldet ({cost}). Das Badge liegt schon bereit.", "sales.eng_d":"War Netzwerkingenieur und hat jetzt ein Badge von jeder NOG. Meldet dich zu jeder an (das Ticket zahlst du), bringt viele kleine und mittlere Deals, aber nie die richtig großen, und verkauft nur, was das Netz kann, also bleiben die Kunden. Die Nerds lieben Dave. Verhandelt schlecht.", "sales.eng_n":"Der Ingenieur, jetzt Salesdroide", "sales.eng_s":"Dave", +"sales.eng_sky":"Im Orbit: verkauft nur, wo die Landeschüssel noch reichlich Platz hat, und diese Kunden bleiben wie die Nerds.", "sales.fired":"{name} hat den Schreibtisch geräumt. Der Vertrieb ist frei.", "sales.hire_sales":"Vertrieb einstellen", "sales.hired":"{name} ist jetzt im Vertrieb. Rechne mit Deals in diesem Stil.", "sales.intro":"Eine Person leitet den Vertrieb. Jede holt Deals auf ihre Art, und die Kunden, die sie abschließt, erinnern sich daran, wenn ihr Vertrag ausläuft.", "sales.let_ceo":"Den CEO machen lassen", "sales.locked":"Der Vertrieb öffnet ab Kundenstufe {lv}.", +"sales.never":"nie", "sales.one_at_a_time":"Immer nur eine Person: Lass sie gehen, um jemand anderen einzustellen.", +"sales.p_sign":"Deals unterschreiben", "sales.pitch":"Eine Person im Vertrieb holt Deals auf ihre eigene Art. Such sie aus.", "sales.shark_d":"Holt die größten Deals zu einem Viertel mehr und kassiert einen Monat jedes Deals als Provision. Verkauft zu viel: Die Hälfte kommt mit einem Versprechen, das dein Netz noch nicht hält, und diese Kunden gehen früher. Ignoriert die Nerds: keine technischen Kunden, keine Meetings, und Peering-Desks wollen ein Viertel mehr Verkehr von dir. Gewinnt die meisten Verhandlungen.", "sales.shark_n":"Der Hai", "sales.shark_s":"Chad", +"sales.shark_sky":"Im Orbit: ruft zuerst Airlines und Kreuzfahrtreedereien an, in der größten Größe und zu einem Viertel mehr, und verspricht der Hälfte einen vollen Himmel, bevor du einen hast. Sie murren, bis es so weit ist.", "sales.vp_arrived":"Der VP Sales hat angefangen, und der CEO ist zurück bei der Strategie. Der Vertrieb ist frei: Stell jemanden ein.", "sales.vp_asked":"Der Vorstand hat zugestimmt, nach dem Mittagessen. Ein VP Sales fängt in {n} Tagen an; bis dahin verkauft der CEO weiter.", "sales.vp_coming":"Ein VP Sales übernimmt in {n} Tagen.", +"sales.w_anyway":{"one":"hat eins davon trotzdem unterschrieben","other":"hat {n} davon trotzdem unterschrieben"}, +"sales.w_declined":{"one":"hat ein Mini-Angebot abgelehnt","other":"hat {n} Mini-Angebote abgelehnt"}, +"sales.w_last":"Letzte Woche: {name} {list}.", +"sales.w_now":"Diese Woche: {name} {list}.", +"sales.w_signed":{"one":"hat einen Kunden gewonnen ({rev}/Monat)","other":"hat {n} Kunden gewonnen ({rev}/Monat)"}, "save.cash_in_the_bank":"{cash} auf der Bank", "save.import_failed_err":"Import fehlgeschlagen.
{err}", "save.load_name":"{name} laden?", diff --git a/site/i18n/es.js b/site/i18n/es.js index 0b95e12..f6070ac 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin, el del turno de noche", "ops.l_broke":{"one":"se paró en el presupuesto de {where}","other":"se paró en el presupuesto de {n} órdenes ({where})"}, "ops.l_caches":{"one":"montó una caché gratis en {where}","other":"montó {n} cachés gratis ({where})"}, -"ops.l_decline":{"one":"rechazó una oferta diminuta","other":"rechazó {n} ofertas diminutas"}, "ops.l_decom":{"one":"devolvió una wave pequeña en {where}","other":"devolvió {n} waves pequeñas ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"encendió un canal en {where}","other":"encendió {n} canales ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"aceleró una reparación","other":"aceleró {n} reparaciones"}, "ops.l_routers":{"one":"mejoró los routers en {where}","other":"mejoró los routers en {n} sitios ({where})"}, "ops.l_rs":{"one":"se unió a un route server","other":"se unió a {n} route servers"}, -"ops.l_sales":{"one":"firmó un cliente","other":"firmó {n} clientes"}, "ops.l_snag":{"one":"se atascó con {where} y la pausó hasta que le eches un vistazo","other":"se atascó con {n} órdenes ({where}) y las pausó hasta que les eches un vistazo"}, "ops.l_transit":{"one":"amplió el tránsito en {where}","other":"amplió el tránsito {n} veces ({where})"}, "ops.locked":"El NOC contrata becarios a partir del nivel de clientes {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} va con mucho cuidado hoy. Que nadie mencione las descripciones de las interfaces.", "ops.mood_outage":"{name} está mirando las gráficas de la avería y recargando la página de estado. Mucho.", "ops.mood_quiet":"{name} lee RFCs tranquilamente. Las gráficas están planas, como debe ser.", -"ops.mood_sales":"{name} camina un poco más erguido hoy: alguien firmó en su turno.", "ops.mood_snag":"{name} se topó con algo raro, pausó esa orden y te dejó un pósit.", "ops.mood_tracy":"Tracy va por el tercer salto de un traceroute, con solo un asterisco de momento.", -"ops.never":"nunca", "ops.no_cap":"sin límite", "ops.no_clock":"Sin reloj no hay turnos: con estas reglas no hay días en los que un becario pueda trabajar.", "ops.o_caches":"Aceptar cachés gratis", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Pagar la reparación urgente de cada caída que la tenga, mientras dure el presupuesto.", "ops.o_routers":"Routers por delante", "ops.o_routers_d":"Añadir un router, o pasar a la siguiente generación donde un segundo router lleve el tráfico, cuando la carga o los puertos pasen de un nivel.", -"ops.o_sales":"Llevar las ventas", -"ops.o_sales_d":"Firmar las ofertas cuyos requisitos se cumplen con capacidad de sobra y rechazar las que pagan demasiado poco.", "ops.o_transit":"Margen de tránsito", "ops.o_transit_d":"Mantener el tránsito de cada POP por encima de un múltiplo de su pico de 30 días: un miembro LAG más o un tamaño de puerto mayor.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Aceptar ofertas listas", "ops.p_at":"Por encima de", "ops.p_g":"Desde", "ops.p_how":"Cómo", "ops.p_keep":"Dejar uno de reserva", -"ops.p_min":"Rechazar por debajo de", "ops.p_paid":"Peering de pago", "ops.p_pick":"Ópticas", "ops.p_prov":"Proveedor", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Total de la semana: {cost} de entrada, {mo}/mes.", "ops.w_oops":{"one":"tuvo un pequeño despiste","other":"tuvo {n} pequeños despistes"}, -"ops.w_sales":{"one":"firmó un cliente ({rev}/mes)","other":"firmó {n} clientes ({rev}/mes)"}, "optic_counts.apply_price":"Aplicar · {price}", "optic_counts.count_for_model":"Número de canales {model}", "optic_counts.only_n_channels_free":"Solo quedan {n} canales libres en esta fibra.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× onda alien de 400G en tu fibra {a}–{b}","other":"{n}× ondas alien de 400G en tu fibra {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Necesita alcance a China con poca pérdida", "requirements.one_way_latency_within_max_ms":"Latencia en un sentido de máximo {max} ms (mejor ahora: {best})", +"requirements.promised_a_full_sky":"Prometió un cielo lleno: una corteza al menos al {p} en órbita", "requirements.refuses_cogentle_transit_anywhere_on":"Rechaza el tránsito de Cogentle en cualquier parte de tu red (larga historia)", "requirements.their_ceo_hates_puns_please_do":"Su CEO odia los juegos de palabras. Por favor, no menciones los nombres de las redes.", "requirements.two_data_centers_in_every_metro":"Dos centros de datos en cada área metropolitana que toquen", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"Tu busca no duerme nunca.", "sales.ask_vp":"Pedir al consejo un VP de Ventas · {cost}", "sales.at_desk":"{name} lleva las ventas", +"sales.auto":"Firma tratos por ti", +"sales.auto_ceo":"{name} firma las ofertas que tu red puede servir hoy, una prueba al día. También rechaza las que quedan bajo tu mínimo, aunque de vez en cuando ya había dado la mano.", +"sales.auto_eng":"{name} firma las ofertas que tu red puede servir hoy, después de probar cada una en la red (una al día), y rechaza las que pagan menos que tu mínimo.", +"sales.auto_shark":"{name} firma cada oferta en cuanto llega, con promesas y todo, mientras puedas pagar la comisión, y rechaza las que pagan menos que tu mínimo.", +"sales.by_hand":"Nadie lleva las ventas, así que firmas cada trato a mano. Contrata a un vendedor, o deja que lo lleve el CEO, y podrá firmar por ti.", "sales.ceo_d":"Gratis, y convencido. Cada par de meses firma un trato enorme en el campo de golf con un 30 % de descuento, a menudo con una promesa que nadie comprobó, y de vez en cuando firma una oferta que tú rechazaste. Tiene opiniones. No se le puede despedir.", "sales.ceo_golf":"El CEO firmó a {name} en el campo de golf: {bw} en {city} por {price}/mes, un 30 % por debajo de tarifa.", +"sales.ceo_golf_skip":"El Fundador se saltó el golf: los mercados están demasiado nerviosos. El CEO jugó solo y no firmó nada en órbita.", +"sales.ceo_golf_sky":"El CEO y el Fundador firmaron a {name} en el campo de golf: {bw} en órbita sobre {city} por {price}/mes, un {p} bajo tarifa.", "sales.ceo_n":"El CEO, que vende mejor que nadie", "sales.ceo_override":"Rechazaste a {name}, pero el CEO ya había dado la mano. Ahora son clientes.", "sales.ceo_promised":"También prometió: {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"He calculado el próximo trato en una servilleta. Ingeniería puede resolver los detalles.", "sales.ceo_say_synergy":"No vendemos ancho de banda, vendemos sinergia. Ponedlo en la web.", "sales.ceo_says":"El CEO: «{say}»", +"sales.ceo_sky":"En órbita: una de cada dos partidas de golf la juega con el Fundador, por el trato en órbita más grande que quepa, con un 30 % de descuento. Los mercados nerviosos le cuestan: precios más bajos en órbita, y nada de golf cuando están muy nerviosos.", "sales.ceo_took_over":"{name} se ha hecho cargo de las ventas en persona. Está seguro de que vende mejor que nadie.", "sales.commission":"{name} firmó. Comisión para el tiburón: {cost}.", +"sales.decline_below":"Rechazar por debajo de", "sales.desk":"Ventas", "sales.eng_booked":"{name} te apuntó a {conf} en {city} ({cost}). Ya tiene la acreditación.", "sales.eng_d":"Era ingeniero de redes y ahora tiene la acreditación de cada NOG. Te apunta a todas (la entrada la pagas tú), trae muchos tratos pequeños y medianos pero nunca los grandes de verdad, y solo vende lo que la red puede hacer, así que los clientes se quedan. Los nerds adoran a Dave. Negocia fatal.", "sales.eng_n":"El ingeniero convertido en vendedroide", "sales.eng_s":"Dave", +"sales.eng_sky":"En órbita: solo vende donde la antena de aterrizaje tiene margen de sobra, y esos clientes se quedan como los nerds.", "sales.fired":"{name} ha vaciado su mesa. Ventas está libre.", "sales.hire_sales":"Contratar ventas", "sales.hired":"{name} se unió a ventas. Espera tratos a su estilo.", "sales.intro":"Una persona lleva las ventas. Cada una trae tratos a su manera, y los clientes que firma lo recuerdan cuando les toca renovar.", "sales.let_ceo":"Dejar que lo lleve el CEO", "sales.locked":"Ventas se abre en el nivel de clientes {lv}.", +"sales.never":"nunca", "sales.one_at_a_time":"Solo una a la vez: despídela para contratar a otra.", +"sales.p_sign":"Firmar tratos", "sales.pitch":"Una persona de ventas trae tratos a su manera. Elige quién.", "sales.shark_d":"Consigue los tratos más grandes a un cuarto más, y se lleva un mes de cada trato de comisión. Vende de más: la mitad llega con una promesa que tu red aún no cumple, y esos clientes se van antes. Ignora a los nerds: nada de clientes técnicos ni de reuniones, y los equipos de peering te piden un cuarto más de tráfico. Gana casi todas las negociaciones.", "sales.shark_n":"El tiburón", "sales.shark_s":"Chad", +"sales.shark_sky":"En órbita: llama primero a aerolíneas y cruceros, al tamaño más grande y a un cuarto más, y a la mitad les promete un cielo lleno antes de que lo tengas. Refunfuñan hasta que lo tienes.", "sales.vp_arrived":"El VP de Ventas ya empezó, y el CEO ha vuelto a la estrategia. Ventas está libre: contrata a alguien.", "sales.vp_asked":"El consejo aceptó, después de comer. Un VP de Ventas empieza en {n} días; hasta entonces el CEO sigue vendiendo.", "sales.vp_coming":"Un VP de Ventas toma el relevo en {n} días.", +"sales.w_anyway":{"one":"firmó una de ellas igualmente","other":"firmó {n} de ellas igualmente"}, +"sales.w_declined":{"one":"rechazó una oferta diminuta","other":"rechazó {n} ofertas diminutas"}, +"sales.w_last":"La semana pasada {name} {list}.", +"sales.w_now":"Esta semana {name} {list}.", +"sales.w_signed":{"one":"firmó un cliente ({rev}/mes)","other":"firmó {n} clientes ({rev}/mes)"}, "save.cash_in_the_bank":"{cash} en el banco", "save.import_failed_err":"Falló la importación.
{err}", "save.load_name":"¿Cargar {name}?", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index b787b96..1941da6 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin de l'équipe de nuit", "ops.l_broke":{"one":"s'est arrêté au budget de {where}","other":"s'est arrêté au budget de {n} ordres ({where})"}, "ops.l_caches":{"one":"a installé un cache gratuit à {where}","other":"a installé {n} caches gratuits ({where})"}, -"ops.l_decline":{"one":"a refusé une offre minuscule","other":"a refusé {n} offres minuscules"}, "ops.l_decom":{"one":"a rendu une petite wave sur {where}","other":"a rendu {n} petites waves ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"a allumé un canal sur {where}","other":"a allumé {n} canaux ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"a accéléré une réparation","other":"a accéléré {n} réparations"}, "ops.l_routers":{"one":"a mis à niveau les routeurs à {where}","other":"a mis à niveau les routeurs à {n} endroits ({where})"}, "ops.l_rs":{"one":"a rejoint un route server","other":"a rejoint {n} route servers"}, -"ops.l_sales":{"one":"a signé un client","other":"a signé {n} clients"}, "ops.l_snag":{"one":"a calé sur {where} et l'a mis en pause en attendant que tu jettes un œil","other":"a calé sur {n} ordres ({where}) et les a mis en pause en attendant que tu jettes un œil"}, "ops.l_transit":{"one":"a renforcé le transit à {where}","other":"a renforcé le transit {n} fois ({where})"}, "ops.locked":"Le NOC recrute des stagiaires à partir du niveau clients {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} fait très attention aujourd'hui. Personne ne parle des descriptions d'interface.", "ops.mood_outage":"{name} surveille les graphes de la panne et rafraîchit la page de statut. Beaucoup.", "ops.mood_quiet":"{name} lit tranquillement des RFC. Les graphes sont plats, comme il se doit.", -"ops.mood_sales":"{name} marche un peu plus droit aujourd'hui : quelqu'un a signé pendant sa garde.", "ops.mood_snag":"{name} est tombé sur un truc bizarre, a mis cet ordre en pause et t'a laissé un post-it.", "ops.mood_tracy":"Tracy en est au troisième saut d'un traceroute, avec une seule étoile pour l'instant.", -"ops.never":"jamais", "ops.no_cap":"sans limite", "ops.no_clock":"Pas d'horloge, pas de service : avec ces règles, il n'y a pas de jours où un stagiaire pourrait travailler.", "ops.o_caches":"Accepter les caches gratuits", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Payer la réparation express de chaque panne qui en a une, tant que le budget suit.", "ops.o_routers":"Garder les routeurs en avance", "ops.o_routers_d":"Ajouter un routeur, ou passer à la génération suivante là où un second routeur porte le trafic, quand la charge ou les ports dépassent un seuil.", -"ops.o_sales":"Gérer les ventes", -"ops.o_sales_d":"Signer les offres dont les exigences sont remplies avec de la capacité en réserve, et refuser celles qui paient trop peu.", "ops.o_transit":"Garder de la marge de transit", "ops.o_transit_d":"Garder le transit de chaque POP au-dessus d'un multiple de son pic sur 30 jours : un membre LAG de plus, ou une taille de port au-dessus.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Accepter les offres prêtes", "ops.p_at":"Au-delà de", "ops.p_g":"À partir de", "ops.p_how":"Comment", "ops.p_keep":"En garder un de secours", -"ops.p_min":"Refuser sous", "ops.p_paid":"Peering payant", "ops.p_pick":"Optiques", "ops.p_prov":"Fournisseur", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Total de la semaine : {cost} d'entrée, {mo}/mois.", "ops.w_oops":{"one":"a fait une petite bourde","other":"a fait {n} petites bourdes"}, -"ops.w_sales":{"one":"a signé un client ({rev}/mois)","other":"a signé {n} clients ({rev}/mois)"}, "optic_counts.apply_price":"Appliquer · {price}", "optic_counts.count_for_model":"Nombre de canaux {model}", "optic_counts.only_n_channels_free":"Il ne reste que {n} canaux libres sur cette fibre.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× longueur d’onde alien 400G sur ta fibre {a}–{b}","other":"{n}× longueurs d’onde alien 400G sur ta fibre {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Veut un accès vers la Chine à faible perte", "requirements.one_way_latency_within_max_ms":"Latence aller simple sous {max} ms (meilleure actuelle : {best})", +"requirements.promised_a_full_sky":"Un ciel plein promis : une croûte à au moins {p} en orbite", "requirements.refuses_cogentle_transit_anywhere_on":"Refuse le transit Cogentle partout sur ton réseau (longue histoire)", "requirements.their_ceo_hates_puns_please_do":"Leur PDG déteste les jeux de mots. Merci de ne pas mentionner les noms des réseaux.", "requirements.two_data_centers_in_every_metro":"Deux datacenters dans chaque métropole qu’il touche", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"Ton bipeur ne dort jamais.", "sales.ask_vp":"Demander un VP Ventes au conseil · {cost}", "sales.at_desk":"{name} gère les ventes", +"sales.auto":"Signe les contrats pour vous", +"sales.auto_ceo":"{name} signe les offres que votre réseau peut servir aujourd'hui, un essai par jour. Il refuse aussi celles sous votre minimum, même si de temps en temps il a déjà topé.", +"sales.auto_eng":"{name} signe les offres que votre réseau peut servir aujourd'hui, après avoir essayé chacune sur le réseau (une par jour), et refuse celles qui paient moins que votre minimum.", +"sales.auto_shark":"{name} signe chaque offre dès qu'elle arrive, promesses comprises, tant que vous pouvez payer la commission, et refuse celles qui paient moins que votre minimum.", +"sales.by_hand":"Personne ne s'occupe des ventes, donc vous signez chaque contrat à la main. Embauchez un commercial, ou laissez faire le PDG, et il pourra signer pour vous.", "sales.ceo_d":"Gratuit, et convaincu. Tous les deux mois, il signe un énorme contrat sur le terrain de golf à -30 %, souvent avec une promesse que personne n'a vérifiée, et de temps en temps une offre que vous aviez refusée. A des avis sur tout. Impossible à licencier.", "sales.ceo_golf":"Le PDG a signé {name} sur le terrain de golf : {bw} à {city} pour {price}/mois, 30 % sous le tarif.", +"sales.ceo_golf_skip":"Le Fondateur a séché le golf : les marchés sont trop nerveux. Le PDG a joué seul et n'a rien signé en orbite.", +"sales.ceo_golf_sky":"Le PDG et le Fondateur ont signé {name} sur le terrain de golf : {bw} en orbite au-dessus de {city} pour {price}/mois, {p} sous le tarif.", "sales.ceo_n":"Le PDG, qui vend mieux que personne", "sales.ceo_override":"Vous avez refusé {name}, mais le PDG avait déjà topé. C'est maintenant un client.", "sales.ceo_promised":"Il a aussi promis : {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"J'ai chiffré le prochain contrat sur une serviette. L'ingénierie réglera les détails.", "sales.ceo_say_synergy":"Nous ne vendons pas de la bande passante, nous vendons de la synergie. Mettez ça sur le site.", "sales.ceo_says":"Le PDG : « {say} »", +"sales.ceo_sky":"En orbite : une partie de golf sur deux se joue avec le Fondateur, pour le plus gros contrat en orbite qui rentre, à -30 %. Les marchés nerveux lui coûtent : des prix plus bas en orbite, et pas de golf du tout quand ils sont très nerveux.", "sales.ceo_took_over":"{name} a pris les ventes en main personnellement. Il est sûr de vendre mieux que personne.", "sales.commission":"{name} a signé. Commission du requin : {cost}.", +"sales.decline_below":"Refuser sous", "sales.desk":"Service commercial", "sales.eng_booked":"{name} vous a inscrit à {conf} à {city} ({cost}). Le badge est déjà prêt.", "sales.eng_d":"Ancien ingénieur réseau, il a un badge de chaque NOG. Il vous inscrit à toutes (vous payez le billet), apporte beaucoup de petits et moyens contrats mais jamais les très gros, et ne vend que ce que le réseau sait faire : les clients restent. Les geeks adorent Dave. Il négocie mal.", "sales.eng_n":"L'ingénieur devenu commercial-droïde", "sales.eng_s":"Dave", +"sales.eng_sky":"En orbite : ne vend que là où l'antenne d'atterrissage a de la marge, et ces clients restent comme les geeks.", "sales.fired":"{name} a vidé son bureau. Le service commercial est libre.", "sales.hire_sales":"Recruter un commercial", "sales.hired":"{name} rejoint le service commercial. Attendez-vous à des contrats dans son style.", "sales.intro":"Une seule personne gère les ventes. Chacune apporte des contrats à sa façon, et les clients qu'elle signe s'en souviennent à l'échéance.", "sales.let_ceo":"Laisser le PDG s'en charger", "sales.locked":"Le service commercial ouvre au niveau clients {lv}.", +"sales.never":"jamais", "sales.one_at_a_time":"Une seule à la fois : laissez-la partir pour en recruter une autre.", +"sales.p_sign":"Signer les contrats", "sales.pitch":"Un commercial apporte des contrats à sa façon. Choisissez qui.", "sales.shark_d":"Décroche les plus gros contrats un quart plus cher, et prend un mois de chaque contrat en commission. Survend : la moitié arrive avec une promesse que votre réseau ne tient pas encore, et ces clients partent plus tôt. Ignore les geeks : pas de clients techniques, pas de NOG, et les équipes peering vous demandent un quart de trafic en plus. Gagne la plupart des négociations.", "sales.shark_n":"Le requin", "sales.shark_s":"Chad", +"sales.shark_sky":"En orbite : appelle d'abord les compagnies aériennes et les croisières, à la plus grande taille et un quart plus cher, et promet à la moitié un ciel plein avant que vous l'ayez. Ils râlent jusqu'à ce que ce soit le cas.", "sales.vp_arrived":"Le VP Ventes a pris son poste, et le PDG est retourné à la stratégie. Le service commercial est libre : recrutez quelqu'un.", "sales.vp_asked":"Le conseil a dit oui, après le déjeuner. Un VP Ventes arrive dans {n} jours ; d'ici là, le PDG continue de vendre.", "sales.vp_coming":"Un VP Ventes prend le relais dans {n} jours.", +"sales.w_anyway":{"one":"en a signé une quand même","other":"en a signé {n} quand même"}, +"sales.w_declined":{"one":"a refusé une offre minuscule","other":"a refusé {n} offres minuscules"}, +"sales.w_last":"La semaine dernière, {name} {list}.", +"sales.w_now":"Cette semaine, {name} {list}.", +"sales.w_signed":{"one":"a signé un client ({rev}/mois)","other":"a signé {n} clients ({rev}/mois)"}, "save.cash_in_the_bank":"{cash} en banque", "save.import_failed_err":"Échec de l’import.
{err}", "save.load_name":"Charger {name} ?", diff --git a/site/i18n/it.js b/site/i18n/it.js index 71b2ced..20cf0c8 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin del turno di notte", "ops.l_broke":{"one":"si è fermato al budget di {where}","other":"si è fermato al budget di {n} ordini ({where})"}, "ops.l_caches":{"one":"ha montato una cache gratuita a {where}","other":"ha montato {n} cache gratuite ({where})"}, -"ops.l_decline":{"one":"ha rifiutato un'offerta minuscola","other":"ha rifiutato {n} offerte minuscole"}, "ops.l_decom":{"one":"ha restituito una wave piccola su {where}","other":"ha restituito {n} wave piccole ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"ha acceso un canale su {where}","other":"ha acceso {n} canali ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"ha accelerato una riparazione","other":"ha accelerato {n} riparazioni"}, "ops.l_routers":{"one":"ha potenziato i router a {where}","other":"ha potenziato i router in {n} posti ({where})"}, "ops.l_rs":{"one":"si è unito a un route server","other":"si è unito a {n} route server"}, -"ops.l_sales":{"one":"ha firmato un cliente","other":"ha firmato {n} clienti"}, "ops.l_snag":{"one":"si è bloccato su {where} e l'ha messo in pausa finché non dai un'occhiata","other":"si è bloccato su {n} ordini ({where}) e li ha messi in pausa finché non dai un'occhiata"}, "ops.l_transit":{"one":"ha aumentato il transit a {where}","other":"ha aumentato il transit {n} volte ({where})"}, "ops.locked":"Il NOC assume stagisti dal livello clienti {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} oggi va con i piedi di piombo. Nessuno nomini le descrizioni delle interfacce.", "ops.mood_outage":"{name} guarda i grafici del guasto e ricarica la pagina di stato. Parecchio.", "ops.mood_quiet":"{name} legge RFC in santa pace. I grafici sono piatti, come devono essere.", -"ops.mood_sales":"{name} cammina un po' più dritto oggi: qualcuno ha firmato nel suo turno.", "ops.mood_snag":"{name} ha trovato qualcosa di strano, ha messo in pausa quell'ordine e ti ha lasciato un post-it.", "ops.mood_tracy":"Tracy è al terzo hop di un traceroute, con un solo asterisco per ora.", -"ops.never":"mai", "ops.no_cap":"nessun limite", "ops.no_clock":"Niente orologio, niente turni: con queste regole non ci sono giorni in cui uno stagista possa lavorare.", "ops.o_caches":"Accetta cache gratuite", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Paga la riparazione urgente di ogni guasto che ce l'ha, finché il budget regge.", "ops.o_routers":"Router sempre avanti", "ops.o_routers_d":"Aggiungi un router, o passa alla generazione successiva dove un secondo router regge il traffico, quando carico o porte superano una soglia.", -"ops.o_sales":"Gestisci le vendite", -"ops.o_sales_d":"Firma le offerte i cui requisiti sono soddisfatti con capacità in avanzo, e rifiuta quelle che pagano troppo poco.", "ops.o_transit":"Margine di transit", "ops.o_transit_d":"Tieni il transit di ogni POP sopra un multiplo del suo picco a 30 giorni: un membro LAG in più, o una porta più grande.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Accetta offerte pronte", "ops.p_at":"Oltre", "ops.p_g":"Da", "ops.p_how":"Come", "ops.p_keep":"Tienine uno di scorta", -"ops.p_min":"Rifiuta sotto", "ops.p_paid":"Peering a pagamento", "ops.p_pick":"Ottiche", "ops.p_prov":"Fornitore", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Totale della settimana: {cost} subito, {mo}/mese.", "ops.w_oops":{"one":"ha fatto un piccolo pasticcio","other":"ha fatto {n} piccoli pasticci"}, -"ops.w_sales":{"one":"ha firmato un cliente ({rev}/mese)","other":"ha firmato {n} clienti ({rev}/mese)"}, "optic_counts.apply_price":"Applica · {price}", "optic_counts.count_for_model":"Numero di canali {model}", "optic_counts.only_n_channels_free":"Su questa fibra sono liberi solo {n} canali.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× alien wave 400G sulla tua fibra {a}–{b}","other":"{n}× alien wave 400G sulla tua fibra {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Vuole raggiungere la Cina con poche perdite", "requirements.one_way_latency_within_max_ms":"Latenza di sola andata entro {max} ms (migliore ora: {best})", +"requirements.promised_a_full_sky":"Promesso un cielo pieno: una crosta almeno al {p} in orbita", "requirements.refuses_cogentle_transit_anywhere_on":"Rifiuta il transit Cogentle ovunque sulla tua rete (lunga storia)", "requirements.their_ceo_hates_puns_please_do":"Il loro CEO odia i giochi di parole. Per favore, non citare i nomi delle reti.", "requirements.two_data_centers_in_every_metro":"Due data center in ogni area metropolitana che tocca", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"Il tuo cercapersone non dorme mai.", "sales.ask_vp":"Chiedi al consiglio un VP vendite · {cost}", "sales.at_desk":"{name} gestisce le vendite", +"sales.auto":"Firma i contratti per te", +"sales.auto_ceo":"{name} firma le offerte che la tua rete può servire oggi, una prova al giorno. Rifiuta anche quelle sotto il tuo minimo, anche se ogni tanto ha già stretto la mano.", +"sales.auto_eng":"{name} firma le offerte che la tua rete può servire oggi, dopo averle provate sulla rete (una al giorno), e rifiuta quelle che pagano meno del tuo minimo.", +"sales.auto_shark":"{name} firma ogni offerta appena arriva, promesse comprese, finché puoi pagare la provvigione, e rifiuta quelle che pagano meno del tuo minimo.", +"sales.by_hand":"Nessuno si occupa delle vendite, quindi firmi ogni contratto a mano. Assumi un venditore, o lascia fare al CEO, e potrà firmare per te.", "sales.ceo_d":"Gratis, e convinto. Ogni paio di mesi firma un contratto enorme sul campo da golf con il 30% di sconto, spesso con una promessa che nessuno ha controllato, e ogni tanto firma un'offerta che avevi rifiutato. Ha opinioni. Non si può licenziare.", "sales.ceo_golf":"Il CEO ha firmato {name} sul campo da golf: {bw} a {city} per {price}/mese, il 30% sotto listino.", +"sales.ceo_golf_skip":"Il Fondatore ha saltato il golf: i mercati sono troppo nervosi. Il CEO ha giocato da solo e non ha firmato niente in orbita.", +"sales.ceo_golf_sky":"Il CEO e il Fondatore hanno firmato {name} sul campo da golf: {bw} in orbita sopra {city} per {price}/mese, il {p} sotto listino.", "sales.ceo_n":"Il CEO, che vende meglio di chiunque", "sales.ceo_override":"Hai rifiutato {name}, ma il CEO aveva già stretto la mano. Ora sono clienti.", "sales.ceo_promised":"Ha anche promesso: {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"Ho fatto il prezzo del prossimo contratto su un tovagliolo. L'ingegneria sistemerà i dettagli.", "sales.ceo_say_synergy":"Non vendiamo banda, vendiamo sinergia. Mettetelo sul sito.", "sales.ceo_says":"Il CEO: «{say}»", +"sales.ceo_sky":"In orbita: una partita di golf su due la gioca con il Fondatore, per il contratto in orbita più grande che ci sta, con il 30% di sconto. I mercati nervosi gli costano: prezzi in orbita più bassi, e niente golf quando sono molto nervosi.", "sales.ceo_took_over":"{name} ha preso in mano le vendite di persona. È sicuro di vendere meglio di chiunque.", "sales.commission":"{name} ha firmato. Provvigione per lo squalo: {cost}.", +"sales.decline_below":"Rifiuta sotto", "sales.desk":"Ufficio vendite", "sales.eng_booked":"{name} ti ha iscritto a {conf} a {city} ({cost}). Ha già il badge.", "sales.eng_d":"Era un ingegnere di rete e ora ha il badge di ogni NOG. Ti iscrive a tutti (il biglietto lo paghi tu), porta tanti contratti piccoli e medi ma mai quelli davvero grandi, e vende solo ciò che la rete sa fare, così i clienti restano. I nerd adorano Dave. Tratta male.", "sales.eng_n":"L'ingegnere diventato venditore-droide", "sales.eng_s":"Dave", +"sales.eng_sky":"In orbita: vende solo dove la parabola di atterraggio ha spazio d'avanzo, e quei clienti restano come i nerd.", "sales.fired":"{name} ha svuotato la scrivania. L'ufficio vendite è libero.", "sales.hire_sales":"Assumi un venditore", "sales.hired":"{name} è entrato nelle vendite. Aspettati contratti nel suo stile.", "sales.intro":"Una persona alla volta gestisce le vendite. Ognuna porta contratti a modo suo, e i clienti che firma se ne ricordano alla scadenza.", "sales.let_ceo":"Lascia fare al CEO", "sales.locked":"L'ufficio vendite apre al livello clienti {lv}.", +"sales.never":"mai", "sales.one_at_a_time":"Uno alla volta: lascialo andare per assumerne un altro.", +"sales.p_sign":"Firma contratti", "sales.pitch":"Un venditore porta contratti a modo suo. Scegli chi.", "sales.shark_d":"Porta i contratti più grandi a un quarto in più, e si prende un mese di ogni contratto come provvigione. Vende troppo: metà arriva con una promessa che la tua rete non mantiene ancora, e quei clienti se ne vanno prima. Ignora i nerd: niente clienti tecnici, niente incontri, e i peering desk ti chiedono un quarto di traffico in più. Vince quasi tutte le trattative.", "sales.shark_n":"Lo squalo", "sales.shark_s":"Chad", +"sales.shark_sky":"In orbita: chiama prima compagnie aeree e navi da crociera, alla taglia più grande e a un quarto in più, e a metà promette un cielo pieno prima che tu ce l'abbia. Brontolano finché non arriva.", "sales.vp_arrived":"Il VP vendite ha iniziato, e il CEO è tornato alla strategia. L'ufficio vendite è libero: assumi qualcuno.", "sales.vp_asked":"Il consiglio ha detto sì, dopo pranzo. Un VP vendite inizia tra {n} giorni; fino ad allora il CEO continua a vendere.", "sales.vp_coming":"Un VP vendite subentra tra {n} giorni.", +"sales.w_anyway":{"one":"ne ha firmata una lo stesso","other":"ne ha firmate {n} lo stesso"}, +"sales.w_declined":{"one":"ha rifiutato un'offerta minuscola","other":"ha rifiutato {n} offerte minuscole"}, +"sales.w_last":"La settimana scorsa {name} {list}.", +"sales.w_now":"Questa settimana {name} {list}.", +"sales.w_signed":{"one":"ha firmato un cliente ({rev}/mese)","other":"ha firmato {n} clienti ({rev}/mese)"}, "save.cash_in_the_bank":"{cash} in cassa", "save.import_failed_err":"Importazione fallita.
{err}", "save.load_name":"Caricare {name}?", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 1db0fd0..9c5555e 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin do turno da noite", "ops.l_broke":{"one":"parou no orçamento de {where}","other":"parou no orçamento de {n} ordens ({where})"}, "ops.l_caches":{"one":"instalou um cache grátis em {where}","other":"instalou {n} caches grátis ({where})"}, -"ops.l_decline":{"one":"recusou uma oferta minúscula","other":"recusou {n} ofertas minúsculas"}, "ops.l_decom":{"one":"devolveu uma wave pequena em {where}","other":"devolveu {n} waves pequenas ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"acendeu um canal em {where}","other":"acendeu {n} canais ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"acelerou um reparo","other":"acelerou {n} reparos"}, "ops.l_routers":{"one":"melhorou os roteadores em {where}","other":"melhorou os roteadores em {n} lugares ({where})"}, "ops.l_rs":{"one":"entrou em um route server","other":"entrou em {n} route servers"}, -"ops.l_sales":{"one":"fechou com um cliente","other":"fechou com {n} clientes"}, "ops.l_snag":{"one":"travou em {where} e pausou a ordem até você dar uma olhada","other":"travou em {n} ordens ({where}) e pausou-as até você dar uma olhada"}, "ops.l_transit":{"one":"reforçou o trânsito em {where}","other":"reforçou o trânsito {n} vezes ({where})"}, "ops.locked":"O NOC contrata estagiários a partir do nível de clientes {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} está tomando muito cuidado hoje. Ninguém fale das descrições das interfaces.", "ops.mood_outage":"{name} está olhando os gráficos da pane e recarregando a página de status. Muito.", "ops.mood_quiet":"{name} lê RFCs em paz. Os gráficos estão planos, como deve ser.", -"ops.mood_sales":"{name} está andando um pouco mais ereto hoje: alguém assinou no seu turno.", "ops.mood_snag":"{name} encontrou algo estranho, pausou essa ordem e deixou um post-it para você.", "ops.mood_tracy":"Tracy está no terceiro salto de um traceroute, com só um asterisco até agora.", -"ops.never":"nunca", "ops.no_cap":"sem limite", "ops.no_clock":"Sem relógio, sem turnos: com estas regras não há dias para um estagiário trabalhar.", "ops.o_caches":"Aceitar caches grátis", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Pagar o reparo urgente de cada queda que tenha um, enquanto o orçamento durar.", "ops.o_routers":"Roteadores à frente", "ops.o_routers_d":"Adicionar um roteador, ou trocar para a próxima geração onde um segundo roteador segura o tráfego, quando a carga ou as portas passarem de um nível.", -"ops.o_sales":"Cuidar das vendas", -"ops.o_sales_d":"Fechar as ofertas cujos requisitos estão atendidos com capacidade de sobra e recusar as que pagam pouco demais.", "ops.o_transit":"Folga de trânsito", "ops.o_transit_d":"Manter o trânsito de cada POP acima de um múltiplo do seu pico de 30 dias: mais um membro LAG, ou um tamanho de porta acima.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Aceitar ofertas prontas", "ops.p_at":"Acima de", "ops.p_g":"A partir de", "ops.p_how":"Como", "ops.p_keep":"Manter um de reserva", -"ops.p_min":"Recusar abaixo de", "ops.p_paid":"Peering pago", "ops.p_pick":"Ópticas", "ops.p_prov":"Provedor", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Total da semana: {cost} de entrada, {mo}/mês.", "ops.w_oops":{"one":"cometeu um pequeno deslize","other":"cometeu {n} pequenos deslizes"}, -"ops.w_sales":{"one":"assinou um cliente ({rev}/mês)","other":"assinou {n} clientes ({rev}/mês)"}, "optic_counts.apply_price":"Aplicar · {price}", "optic_counts.count_for_model":"Número de canais {model}", "optic_counts.only_n_channels_free":"Só há {n} canais livres nesta fibra.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× alien wave 400G na sua fibra {a}–{b}","other":"{n}× alien waves 400G na sua fibra {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Precisa chegar na China com pouca perda", "requirements.one_way_latency_within_max_ms":"Latência de ida até {max} ms (melhor agora: {best})", +"requirements.promised_a_full_sky":"Prometeu um céu cheio: uma crosta com pelo menos {p} em órbita", "requirements.refuses_cogentle_transit_anywhere_on":"Recusa transit da Cogentle em qualquer ponto da sua rede (longa história)", "requirements.their_ceo_hates_puns_please_do":"O CEO deles odeia trocadilhos. Por favor, não mencione os nomes das redes.", "requirements.two_data_centers_in_every_metro":"Dois data centers em toda metro que tocar", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"O seu pager nunca dorme.", "sales.ask_vp":"Pedir ao conselho um VP de Vendas · {cost}", "sales.at_desk":"{name} cuida das vendas", +"sales.auto":"Assina contratos por você", +"sales.auto_ceo":"{name} assina as ofertas que sua rede consegue atender hoje, um teste por dia. Ele também recusa as que ficam abaixo do seu mínimo, mas de vez em quando já apertou a mão.", +"sales.auto_eng":"{name} assina as ofertas que sua rede consegue atender hoje, depois de testar cada uma na rede (uma por dia), e recusa as que pagam menos que o seu mínimo.", +"sales.auto_shark":"{name} assina toda oferta assim que ela chega, com promessas e tudo, desde que você possa pagar a comissão, e recusa as que pagam menos que o seu mínimo.", +"sales.by_hand":"Ninguém cuida das vendas, então você assina cada contrato à mão. Contrate um vendedor, ou deixe o CEO cuidar, e ele pode assinar por você.", "sales.ceo_d":"De graça, e convicto. A cada dois meses fecha um contrato enorme no campo de golfe com 30% de desconto, muitas vezes com uma promessa que ninguém conferiu, e de vez em quando assina uma oferta que você recusou. Tem opiniões. Não pode ser demitido.", "sales.ceo_golf":"O CEO fechou com {name} no campo de golfe: {bw} em {city} por {price}/mês, 30% abaixo da tabela.", +"sales.ceo_golf_skip":"O Fundador faltou ao golfe: os mercados estão nervosos demais. O CEO jogou sozinho e não assinou nada em órbita.", +"sales.ceo_golf_sky":"O CEO e o Fundador fecharam com {name} no campo de golfe: {bw} em órbita sobre {city} por {price}/mês, {p} abaixo da tabela.", "sales.ceo_n":"O CEO, que vende melhor que ninguém", "sales.ceo_override":"Você recusou {name}, mas o CEO já tinha apertado a mão. Agora são clientes.", "sales.ceo_promised":"Ele também prometeu: {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"Fiz o preço do próximo contrato num guardanapo. A engenharia resolve os detalhes.", "sales.ceo_say_synergy":"Não vendemos banda, vendemos sinergia. Coloquem isso no site.", "sales.ceo_says":"O CEO: “{say}”", +"sales.ceo_sky":"Em órbita: metade das partidas de golfe é com o Fundador, pelo maior contrato em órbita que couber, com 30% de desconto. Mercados nervosos custam caro: preços menores em órbita, e nada de golfe quando estão muito nervosos.", "sales.ceo_took_over":"{name} assumiu as vendas pessoalmente. Tem certeza de que vende melhor que ninguém.", "sales.commission":"{name} assinou. Comissão do tubarão: {cost}.", +"sales.decline_below":"Recusar abaixo de", "sales.desk":"Vendas", "sales.eng_booked":"{name} inscreveu você no {conf} em {city} ({cost}). O crachá já está pronto.", "sales.eng_d":"Era engenheiro de redes e agora tem o crachá de cada NOG. Inscreve você em todas (o ingresso é por sua conta), traz muitos negócios pequenos e médios, mas nunca os realmente grandes, e só vende o que a rede consegue entregar, então os clientes ficam. Os nerds adoram o Dave. Negocia mal.", "sales.eng_n":"O engenheiro que virou vendedroide", "sales.eng_s":"Dave", +"sales.eng_sky":"Em órbita: só vende onde a antena de pouso tem folga, e esses clientes ficam como os nerds.", "sales.fired":"{name} esvaziou a mesa. Vendas está livre.", "sales.hire_sales":"Contratar vendas", "sales.hired":"{name} entrou em vendas. Espere negócios no estilo dele.", "sales.intro":"Uma pessoa por vez cuida das vendas. Cada uma traz negócios do seu jeito, e os clientes que ela fecha lembram disso quando o contrato vence.", "sales.let_ceo":"Deixar o CEO cuidar", "sales.locked":"Vendas abre no nível de clientes {lv}.", +"sales.never":"nunca", "sales.one_at_a_time":"Uma por vez: dispense para contratar outra.", +"sales.p_sign":"Assinar contratos", "sales.pitch":"Uma pessoa de vendas traz negócios do jeito dela. Escolha quem.", "sales.shark_d":"Fecha os maiores negócios por um quarto a mais, e leva um mês de cada contrato de comissão. Vende demais: metade chega com uma promessa que sua rede ainda não cumpre, e esses clientes saem mais cedo. Ignora os nerds: nada de clientes técnicos nem de encontros, e as equipes de peering pedem um quarto a mais de tráfego. Ganha quase todas as negociações.", "sales.shark_n":"O tubarão", "sales.shark_s":"Chad", +"sales.shark_sky":"Em órbita: liga primeiro para companhias aéreas e cruzeiros, no maior tamanho e por um quarto a mais, e promete a metade deles um céu cheio antes de você ter um. Eles reclamam até você ter.", "sales.vp_arrived":"O VP de Vendas começou, e o CEO voltou para a estratégia. Vendas está livre: contrate alguém.", "sales.vp_asked":"O conselho aprovou, depois do almoço. Um VP de Vendas começa em {n} dias; até lá o CEO continua vendendo.", "sales.vp_coming":"Um VP de Vendas assume em {n} dias.", +"sales.w_anyway":{"one":"assinou uma delas mesmo assim","other":"assinou {n} delas mesmo assim"}, +"sales.w_declined":{"one":"recusou uma oferta minúscula","other":"recusou {n} ofertas minúsculas"}, +"sales.w_last":"Semana passada {name} {list}.", +"sales.w_now":"Esta semana {name} {list}.", +"sales.w_signed":{"one":"assinou um cliente ({rev}/mês)","other":"assinou {n} clientes ({rev}/mês)"}, "save.cash_in_the_bank":"{cash} no banco", "save.import_failed_err":"Falha na importação.
{err}", "save.load_name":"Carregar {name}?", diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index 62cdc99..508872a 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -241,6 +241,10 @@ const API_CMD={ doc:'Let the salesperson go (not the CEO: ask the board for a VP of Sales instead).'}, salesVp:{args:[], doc:'With the CEO running sales: pay for a board meeting that brings a VP of Sales, who frees the desk a month later.'}, + salesAuto:{args:[],watch:['slAuto'], + doc:'With someone at the sales desk: switch automatic signing on or off. Once a game day they sign the offers that fit, in their own style: eng and ceo after a routing trial (one a day; an offer that did not fit waits a week), shark every offer whose POPs are up, promises and all, while the cash covers the commission. Orbit offers sign where the landing dish has room (the shark ignores that). Nobody at the desk: nothing is signed for you.'}, + salesMin:{args:[],watch:['slAuto'], + doc:'Step the minimum monthly value under which the sales desk declines offers: never, 2k, 5k, 10k, 25k, 50k. With the CEO, about one decline in three is signed anyway.'}, renewMatch:{args:[['id','entityId']],watch:['biz.#id'], doc:'Answer a renewal haggle (a customer with hag): renew at the price they asked. Unanswered, this happens on its own when the term ends.'}, renewMeet:{args:[['id','entityId']],watch:['biz.#id'], @@ -325,7 +329,7 @@ const API_CMD={ opsCap:{args:[['k','opsKey']],watch:['ops'], doc:'Step the monthly budget of an order that has one: 10k, 25k, 50k, 100k, 250k, no limit.'}, opsFloor:{args:[],watch:['ops'], - doc:'Step the floor under your cash that the intern keeps clear when signing customers: 0, 50k, 250k, 1M, 5M.'}, + doc:'Step the floor under your cash that the intern keeps clear when paying for jobs: 0, 50k, 250k, 1M, 5M.'}, opsPop:{args:[['k','opsPopKind'],['city','cityId']],watch:['ops'], doc:'Add or remove one POP as an exception to an order: the intern never touches the POPs you except.'}, opsTpl:{args:[['k','opsTplKey']],watch:['ops'], diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index d37b6e3..7644d07 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -35,7 +35,8 @@ const API_STATE_DOC={ nni:{type:'array',doc:'Fabric ports: city, provider, tier.'}, biz:{type:'array',doc:'Signed customers: type, cities, bandwidth, rate, mood, contract dates (te: the day the term ends, mk: the bandwidth market it was priced in, hag: an open renewal haggle {rate, until}).'}, offers:{type:'array',doc:'Pending customer offers, each expiring on a day (mk: the bandwidth market they were priced in; refN: the customer who referred them).'}, - sales:{type:'map',doc:'The sales desk: p (eng, shark, ceo or null), hired (day), vp (the day a VP of Sales takes over from the CEO), golf and say (the CEO\'s next golf deal and opinion). Offers and customers carry by: who brought or signed them.'}, + sales:{type:'map',doc:'The sales desk: p (eng, shark, ceo or null), hired (day), vp (the day a VP of Sales takes over from the CEO), golf and say (the CEO\'s next golf deal and opinion). Offers and customers carry by: who brought or signed them, orbit ones too (the shark\'s may carry the skyfull promise).'}, + slAuto:{type:'map',doc:'Deals the sales desk signs for you (only while someone runs sales): on (sign offers that fit), min (decline offers paying less a month; 0 never), wk (this week: w, p who was at the desk, n signed, rev their monthly revenue, x declined, y declined but signed anyway by the CEO) and rep (last week, the same).'}, cl:{type:'map',doc:'Customer lifecycle (#178): odd (the day of the last unusual departure) and mo, one entry a month of customers won, renewed, grown, haggling and lost by reason.'}, done:{type:'map',doc:'Goals landed, by goal id → day.'}, ach:{type:'map',doc:'Badges earned this game, by badge id → day.'}, @@ -57,7 +58,7 @@ const API_STATE_DOC={ ppol:{type:'string',doc:'Your published peering policy: open | selective | closed.'}, pdesk:{type:'map',doc:'This week\'s peering desk summary: sessions accepted and declined at which exchanges.'}, pdeskRep:{type:'map',doc:'Last week\'s peering desk summary, as the NOC log reported it.'}, - ops:{type:'map',doc:'The NOC intern: who is hired, each standing order\'s on/off switch and settings, the monthly budget and what it spent, per-POP exceptions, the new-POP template and the weekly log.'}, + ops:{type:'map',doc:'The NOC intern: who is hired, each standing order\'s on/off switch and settings (network work only: deals belong to the sales desk, slAuto), the monthly budget and what it spent, per-POP exceptions, the new-POP template and the weekly log.'}, core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'}, ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'}, popStd:{type:'map',doc:'The standard POP: router model and count new POPs start with, or null for none.'}, diff --git a/src/game/60-features/38-sales-desk.js b/src/game/60-features/38-sales-desk.js index 2e5e00e..ff2efd0 100644 --- a/src/game/60-features/38-sales-desk.js +++ b/src/game/60-features/38-sales-desk.js @@ -43,8 +43,9 @@ function salesShape(n0){const p=slP();if(!p)return;for(let i=S.offers.length-1;i // A promise nobody checked: a requirement this deal can have, that the network does not meet today. function salesPromise(o){const T=BIZ_T[o.type],pool=Object.keys(REQS).filter(k=>!(o.reqs||[]).includes(k)&&!REQS[k].only&&(!REQS[k].l2||T.l2)&&(!REQS[k].ip||!T.l2)&&reqCan(k,o)).sort(); const no=pool.filter(k=>{try{return !REQS[k].ok(o);}catch(e){return false;}});return no.length?no[Math.floor(slR('promise|'+slKey(o))*no.length)]:null;} -// Their mark at renewal: how much likelier the customers they signed are to leave. -function salesLeaveMul(b){if(b.by==='eng')return SALES_NERDS.includes(b.type)?0.5:0.75;if(b.by==='shark')return 1.5;if(b.by==='ceo')return 1.25;return 1;} +// Their mark at renewal: how much likelier the customers they signed are to leave. The engineer's orbit customers, sold +// only where a dish had room to spare, stay like the nerds do. +function salesLeaveMul(b){if(b.by==='eng')return SALES_NERDS.includes(b.type)||BIZ_T[b.type].orbit?0.5:0.75;if(b.by==='shark')return 1.5;if(b.by==='ceo')return 1.25;return 1;} // Haggles with whoever is at the desk now: how deep the discount they ask, and how often meeting halfway works. const salesAsk=()=>slP()==='eng'?0.72:0.8; const salesMeet=()=>({shark:0.9,eng:0.5,ceo:0.55})[slP()]||0.65; @@ -61,8 +62,9 @@ function salesDay(d){const L=S.sales;if(!L)return; if(p==='ceo'){if(!(L.golf>=d))L.golf=d+50+Math.floor(slR('golf|'+d)*30);else if(d===L.golf){salesGolf(d);L.golf=d+50+Math.floor(slR('golf|'+d)*30);} if(!(L.say>=d))L.say=d+20+Math.floor(slR('say|'+d)*15);else if(d===L.say){toast(tr('sales.ceo_says',{say:tr(SALES_SAY[Math.floor(slR('sayl|'+d)*SALES_SAY.length)])}),'');L.say=d+20+Math.floor(slR('say|'+d)*15);}}} // The golf course: the biggest internet customer this network can take, in its biggest city, at 30% off, signed on the spot. +// With a rocket company, every other game is with the Founder, and in orbit (pieGolf, 99-pie-sales.js). const SALES_GOLF=['metav','cgame','gpu','stream','isp','edu','host','dia']; -function salesGolf(d){const mine=Object.keys(S.pops).filter(c=>popUp(c)&&bizCity(c));if(!mine.length)return; +function salesGolf(d){if(pieGolf(d))return;const mine=Object.keys(S.pops).filter(c=>popUp(c)&&bizCity(c));if(!mine.length)return; const t=SALES_GOLF.find(x=>(BIZ_T[x].lv||1)<=lvl());if(!t)return;const T=BIZ_T[t],city=mine.sort((a,b)=>CITY[b].P-CITY[a].P||(a!S.usedNames.includes(n));const name=list.length?list[Math.floor(slR('golfn|'+d)*list.length)]:(T.names||BIZ_N)[0];useName(name); const o={id:uid(),city,city2:null,name,type:t,bw:T.opts[T.opts.length-1],rate:Math.round((CITY[city].au?T.rate*AU_ARPU:T.rate)*mkt()*0.7),reqs:[],exp:d+40}; @@ -74,4 +76,4 @@ function salesOverride(o){if(slP()!=='ceo'||!o||!bHas(o)||BIZ_T[o.type].event||s // Saves: who is at the desk, the VP on the way, the CEO's calendar; who brought each offer and signed each customer. function salesFix(s){const L=s.sales&&typeof s.sales==='object'&&!Array.isArray(s.sales)?s.sales:{},n=v=>Number.isInteger(v)&&v>=0&&v<1e7?v:null; s.sales={p:own(SALES,L.p)?L.p:null,hired:n(L.hired)||0,vp:L.p==='ceo'?n(L.vp):null,golf:n(L.golf),say:n(L.say)}; - for(const x of [...s.biz,...s.offers])if(x.by!==undefined&&!own(SALES,x.by))delete x.by;} + for(const x of [...s.biz,...s.offers])if(x.by!==undefined&&!own(SALES,x.by))delete x.by;slAutoFix(s);} diff --git a/src/game/60-features/39-sales-auto.js b/src/game/60-features/39-sales-auto.js new file mode 100644 index 0000000..11f3b81 --- /dev/null +++ b/src/game/60-features/39-sales-auto.js @@ -0,0 +1,41 @@ +/* ---------- The sales desk signs deals for you ---------- + Deals belong to Sales, not to the NOC intern. With someone at the desk, the player can let them sign offers once a + game day (S.slAuto.on) and decline the ones that pay less than a minimum (S.slAuto.min). How they sign is who they are: + - the engineer signs only what the network can serve: #185's trial (autoOffer, a full routing pass), at most + SL_TRIALS a day, and an offer that did not fit waits SL_RETRY days; + - the shark signs every offer whose POPs are up the moment it lands, promises and all: no trial, an unkept promise is + the customer's problem. The commission is paid as on any shark deal, so only while the cash covers it; + - the CEO signs like the engineer, and a decline is a handshake away (salesOverride: about one in three he signs anyway). + Orbit offers need no routing pass: the dish they land on (pieServe) must have room, except for the shark. + Nobody at the desk, nothing automatic: every deal is signed by hand. No random numbers are drawn here. */ +const SL_MINS=[0,2000,5000,10000,25000,50000],SL_TRIALS=1,SL_RETRY=7; +const slAutoNew=()=>({on:false,min:0,wk:null,rep:null}); +// Is the desk signing or declining anything today? +const slAutoOn=()=>!!(S&&S.slAuto&&slP()&&(S.slAuto.on||S.slAuto.min)); +// A week's tally: {w: week, p: who was at the desk, n: signed, rev: what they pay a month, x: declined, y: of those, signed anyway}. +function slWkOk(x){if(!x||typeof x!=='object'||Array.isArray(x)||!own(SALES,x.p))return null;const n=v=>int(v,0,1e6,0);return {w:n(x.w),p:x.p,n:n(x.n),rev:int(x.rev,0,1e10,0),x:n(x.x),y:n(x.y)};} +const slWkAny=x=>!!x&&(x.n>0||x.x>0); +function slAutoFix(s){const a=s.slAuto&&typeof s.slAuto==='object'&&!Array.isArray(s.slAuto)?s.slAuto:{}; + s.slAuto={on:a.on===true,min:SL_MINS.includes(a.min)?a.min:0,wk:slWkOk(a.wk),rep:slWkOk(a.rep)};} +// An old save whose intern ran the sales order: the same switch and minimum, now at the sales desk (they run once someone is there). +function slAutoFrom(s,on,p){if(!on||(s.slAuto&&typeof s.slAuto==='object'))return;s.slAuto={on:p.acc!==false,min:SL_MINS.includes(p.min)?p.min:0,wk:null,rep:null};} +// "This week Dave signed 3 customers (+$41k/mo), declined 17 tiny offers." +function slWeekLine(x,last){const parts=[];if(x.n)parts.push(trn('sales.w_signed',x.n,{rev:opsMo$(x.rev)}));if(x.x)parts.push(trn('sales.w_declined',x.x));if(x.y)parts.push(trn('sales.w_anyway',x.y)); + const v={name:tr(SALES[x.p].s),list:parts.join(', ')};return last?tr('sales.w_last',v):tr('sales.w_now',v);} +// An orbit offer fits where its dish has room for it; used: what this shift already signed on each dish. +function slSkyOk(o,used){const L=pieServe(o.city,o.type);if(!L)return null;const k=L.cr+'|'+L.k;return slP()==='shark'||L.left-(used.get(k)||0)>=o.bw?k:null;} +function slAutoDay(d){if(!slAutoOn())return;const A=S.slAuto,p=slP(),w=Math.floor(d/7); + // A new week: last week's tally becomes the report, and the one notice of the week. + if(!A.wk||A.wk.w!==w){if(slWkAny(A.wk)&&A.wk.w${esc(tr('sales.desk'))} ${esc(slWeekLine(A.rep,true))}`,A.rep.rev>0?'good':'',[],{a:'tab',v:'deals'});}A.wk={w,p,n:0,rev:0,x:0,y:0};} + const W=A.wk,used=new Map();W.p=p;let tries=0,dirty=false; + const tried=UI.slTried&&UI.slTried.s===S?UI.slTried.m:(UI.slTried={s:S,m:new Map()}).m; + const won=o=>{if(S.offers.includes(o))return false;W.n++;W.rev+=Math.round(bizMo(o));dirty=true;return true;}; + opsQuiet(()=>{for(const o of S.offers.slice()){if(!S.offers.includes(o))continue;const T=BIZ_T[o.type];if(!T||!(o.exp>d))continue;const v=T.event?(o.fee||0):bizMo(o); + if(A.min&&vb0){W.y++;W.rev+=Math.round(bizMo(o));dirty=true;}continue;} + if(!A.on)continue; + if(T.orbit){const k=slSkyOk(o,used);if(!k||(p==='shark'&&S.cashd)))continue;ACT.accept({id:o.id});won(o);continue;} + // Each trial is a full routing pass: at most SL_TRIALS a day, and an offer that did not fit waits a week. + if(!reqOk(o)||tries>=SL_TRIALS||tried.get(o.id)>d-SL_RETRY)continue;tries++;ACT.accept({id:o.id,auto:true});if(!won(o))tried.set(o.id,d);}}); + if(dirty)compute();} diff --git a/src/game/60-features/80-new-game.js b/src/game/60-features/80-new-game.js index 802b2b4..c661e15 100644 --- a/src/game/60-features/80-new-game.js +++ b/src/game/60-features/80-new-game.js @@ -1,6 +1,6 @@ function newGame(name,home){ S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,cash:START_CASH, - ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ops:opsNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{}, + ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ops:opsNew(),slAuto:slAutoNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{}, done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}}; } diff --git a/src/game/60-features/90-automation.js b/src/game/60-features/90-automation.js index 528c15a..0bb5dc9 100644 --- a/src/game/60-features/90-automation.js +++ b/src/game/60-features/90-automation.js @@ -1,4 +1,4 @@ -/* The sales engine of #185: would this offer work if signed now? The intern's sales order runs it once a day. +/* The sales engine of #185: would this offer work if signed now? The sales desk runs it once a day (39-sales-auto.js). It trials the new demand on a copy of the game, so a failed trial leaves the live game untouched. */ function offerCustomer(o){return {id:o.id,city:o.city,city2:o.city2||null,reqs:o.reqs||[],latMax:o.latMax||null,route:BIZ_T[o.type].scenic?'scenic':BIZ_T[o.type].lat?'fast':'normal',name:o.name,type:o.type,bw:o.bw,rate:o.rate,mood:100,since:S.day,sites:o.sites||null,start:o.start,dur:o.dur,fee:o.fee,link:o.link,slots:o.slots||0,what:o.what,prov:o.prov,due:BIZ_T[o.type].cap?S.day+o.win:undefined};} function autoOffer(o){if(!o||!own(BIZ_T,o.type)||!(o.exp>S.day)||!(o.bw>0)||o.rate<0||!bCities(o).length||!bCities(o).every(popUp)||!reqOk(o))return null; diff --git a/src/game/60-features/95-standing-orders.js b/src/game/60-features/95-standing-orders.js index 4f10364..f852910 100644 --- a/src/game/60-features/95-standing-orders.js +++ b/src/game/60-features/95-standing-orders.js @@ -8,6 +8,7 @@ const INTERNS={ kevin:{i:'🌙',n:N_('ops.kevin_from_the_night_shift'),s:N_('ops.kevin'),d:N_('ops.kevin_d')}, tracy:{i:'🧭',n:N_('ops.tracy_route'),s:N_('ops.tracy'),d:N_('ops.tracy_d')}, }; +// Deals are not the intern's: the sales desk signs them (39-sales-auto.js). // The orders, in the order the panel shows them. pop: can be switched off per POP. cap: default monthly budget, of setup // fees, or (mo) of the running costs the order adds, for caches, which are free to rack but cost rent every month. const OPS=[ @@ -16,19 +17,18 @@ const OPS=[ {k:'routers',i:'🧠',pop:1,cap:250000,t:N_('ops.o_routers'),d:N_('ops.o_routers_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},how:{d:'auto',v:['auto','add','swap'],l:N_('ops.p_how'),f:v=>tr({auto:N_('ops.how_auto'),add:N_('ops.how_add'),swap:N_('ops.how_swap')}[v])}}}, {k:'caches',i:'📦',pop:1,cap:5000,mo:1,t:N_('ops.o_caches'),d:N_('ops.o_caches_d'),p:{g:{d:5,v:[1,5,10,25,50],l:N_('ops.p_g'),f:v=>fmtG(v)}}}, {k:'ix',i:'🔀',t:N_('ops.o_ix'),d:N_('ops.o_ix_d'),p:{}}, - {k:'pni',i:'🤝',pop:1,cap:50000,t:N_('ops.o_pni'),d:N_('ops.o_pni_d'),p:{g:{d:25,v:[5,10,25,50,100],l:N_('ops.p_g'),f:v=>fmtG(v)},tier:{d:0,v:[0,1,2],l:N_('ops.p_tier'),f:v=>tr('ops.at_least_port',{port:PORT[v].n})},paid:{d:false,v:[false,true],l:N_('ops.p_paid'),f:v=>tr(v?'common.on':'common.off')}}}, - {k:'sales',i:'💼',t:N_('ops.o_sales'),d:N_('ops.o_sales_d'),p:{acc:{d:true,v:[true,false],l:N_('ops.p_acc'),f:v=>tr(v?'common.on':'common.off')},min:{d:0,v:[0,2000,5000,10000,25000,50000],l:N_('ops.p_min'),f:v=>v?tr('common.price_mo',{price:fmt$(v)}):tr('ops.never')}}}, + {k:'pni',i:'🤝',pop:1,cap:50000,t:N_('ops.o_pni'),d:N_('ops.o_pni_d'),p:{g:{d:25,v:[5,10,25,50,100],l:N_('ops.p_g'),f:v=>fmtG(v)},tier:{d:0,v:[0,1,2],l:N_('ops.p_tier'),f:v=>tr('ops.at_least_port',{port:PORT[v].n})},paid:{d:false,v:[false,true],l:N_('ops.p_paid'),f:v=>v?tr('common.on'):tr('common.off')}}}, {k:'repair',i:'🔧',cap:50000,t:N_('ops.o_repair'),d:N_('ops.o_repair_d'),p:{}}, {k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])}}}, - {k:'decom',i:'🧹',t:N_('ops.o_decom'),d:N_('ops.o_decom_d'),p:{keep:{d:true,v:[true,false],l:N_('ops.p_keep'),f:v=>tr(v?'common.on':'common.off')}}}, + {k:'decom',i:'🧹',t:N_('ops.o_decom'),d:N_('ops.o_decom_d'),p:{keep:{d:true,v:[true,false],l:N_('ops.p_keep'),f:v=>v?tr('common.on'):tr('common.off')}}}, ]; const OPSK=Object.fromEntries(OPS.map(o=>[o.k,o])),OPS_POP=OPS.filter(o=>o.pop).map(o=>o.k); const OPS_TPL=['bb','transit','ix','kit']; // What the shift log can say. One line per day: "{name} did this, that and the other." -const OPS_SAY={transit:N_('ops.l_transit'),ports:N_('ops.l_ports'),routers:N_('ops.l_routers'),caches:N_('ops.l_caches'),rs:N_('ops.l_rs'),peer:N_('ops.l_peer'),pni:N_('ops.l_pni'),sales:N_('ops.l_sales'),decline:N_('ops.l_decline'),repair:N_('ops.l_repair'),optics:N_('ops.l_optics'),decom:N_('ops.l_decom'),broke:N_('ops.l_broke'),snag:N_('ops.l_snag')}; +const OPS_SAY={transit:N_('ops.l_transit'),ports:N_('ops.l_ports'),routers:N_('ops.l_routers'),caches:N_('ops.l_caches'),rs:N_('ops.l_rs'),peer:N_('ops.l_peer'),pni:N_('ops.l_pni'),repair:N_('ops.l_repair'),optics:N_('ops.l_optics'),decom:N_('ops.l_decom'),broke:N_('ops.l_broke'),snag:N_('ops.l_snag')}; // Fat fingers: rare, visible, harmless. Only the LAG one costs anything, and only a little. const OPS_FF=[N_('ops.ff_desc'),N_('ops.ff_hostname'),N_('ops.ff_typo'),N_('ops.ff_lag'),N_('ops.ff_ping')]; -const OPS_TRIALS=1,OPS_FF_RATE={oncall:1/150,bgp:1/60}; +const OPS_FF_RATE={oncall:1/150,bgp:1/60}; function opsNew(){return {intern:null,hired:0,on:Object.fromEntries(OPS.map(o=>[o.k,false])),p:{},cap:{},spent:Object.fromEntries(OPS.filter(o=>o.cap).map(o=>[o.k,0])),addMo:{},mon:0,skip:{},log:[],wk:null,rep:null,floor:50000,tpl:{bb:true,transit:true,ix:true,kit:true}};} const opsO=()=>S.ops||(S.ops=opsNew()); const opsHired=()=>!!(S&&S.ops&&S.ops.intern&&own(INTERNS,S.ops.intern)); @@ -40,8 +40,9 @@ function opsCap(k){const c=S.ops.cap[k];return opsCaps(k).includes(c)?c:OPSK[k]. const opsHere=(k,c)=>!(S.ops.skip[c]||[]).includes(k); const opsPops=k=>Object.keys(S.pops).filter(c=>opsHere(k,c)); // Saves are untrusted: rebuild ops from known orders, params, cities and log shapes. Runs after the POPs are repaired, -// so exceptions only survive for POPs that still exist. Old saves get no intern, -// and the two #185 toggles (auto-accept, auto-pay repairs) become the sales and repair orders. +// so exceptions only survive for POPs that still exist. Old saves get no intern, and the #185 auto-repair toggle becomes +// the repair order. A sales order the intern was running moves to the sales desk (slAutoFrom); #185's auto-accept never +// ran without an intern, so it goes. function opsSanitize(s){const o=s.ops&&typeof s.ops==='object'&&!Array.isArray(s.ops)?s.ops:{},n=opsNew(),ob=x=>x&&typeof x==='object'&&!Array.isArray(x)?x:{}; n.intern=typeof o.intern==='string'&&own(INTERNS,o.intern)?o.intern:null;n.hired=int(o.hired,0,1e7,0);n.mon=int(o.mon,0,1e6,0); n.floor=OPS_FLOORS.includes(o.floor)?o.floor:n.floor; @@ -54,28 +55,32 @@ function opsSanitize(s){const o=s.ops&&typeof s.ops==='object'&&!Array.isArray(s {const sk=ob(o.skip);for(const c of Object.keys(sk))if(isCity(c)&&own(s.pops,c)&&Array.isArray(sk[c])){const ks=[...new Set(sk[c].filter(k=>OPS_POP.includes(k)))];if(ks.length)n.skip[c]=ks;}} if(Array.isArray(o.log))n.log=o.log.map(opsLogOk).filter(Boolean).slice(0,OPS_LOG); n.wk=opsWkOk(o.wk);n.rep=opsWkOk(o.rep); - if(s.autoSales===true)n.on.sales=true;if(s.autoRepair===true)n.on.repair=true;delete s.autoSales;delete s.autoRepair; + slAutoFrom(s,on.sales===true&&!!n.intern,ob(p.sales));if(s.autoRepair===true)n.on.repair=true;delete s.autoSales;delete s.autoRepair; s.ops=n;} // A log entry: {d, i: intern, r: [[kind, n, [where…]]], f: fat-finger index, c: its city, up: paid up front, mo: running costs added}. const opsWhereOk=w=>typeof w==='string'&&w.length<=48&&/^[a-z0-9~|]+( [+\w.×→⇧]+)?$/i.test(w)&&w.split(' ')[0].split('|').every(x=>isIx(x)||own(OPSK,x)||isNet(x)); -function opsLogOk(e){if(!e||typeof e!=='object'||!own(INTERNS,e.i))return null;const r=Array.isArray(e.r)?e.r.filter(x=>Array.isArray(x)&&own(OPS_SAY,x[0])&&Array.isArray(x[2])).map(x=>[x[0],int(x[1],1,1e6,1),x[2].filter(opsWhereOk).slice(0,3)]).slice(0,16):[]; +function opsLogOk(e){if(!e||typeof e!=='object'||!own(INTERNS,e.i))return null;const r0=Array.isArray(e.r)?e.r:[],r=r0.filter(x=>Array.isArray(x)&&own(OPS_SAY,x[0])&&Array.isArray(x[2])).map(x=>[x[0],int(x[1],1,1e6,1),x[2].filter(opsWhereOk).slice(0,3)]).slice(0,16); const f=Number.isInteger(e.f)&&OPS_FF[e.f]?e.f:undefined,up=int(e.up,0,1e12,0),mo=int(e.mo,-1e9,1e9,0); + // A day that only signed or declined deals (the retired sales order) has nothing left to say. + if(r0.length&&!r.length&&f===undefined&&!up&&!mo)return null; return {d:int(e.d,0,1e7,0),i:e.i,r,...(f!==undefined&&isCity(e.c)?{f,c:e.c}:{}),...(up?{up}:{}),...(mo?{mo}:{})};} -// A week's tally, for the shift report and the one NOC notice a week: {w: week, i: intern, n: {kind: count}, wh: {kind: [where…]}, up, mo, rev, ff}. +// A week's tally, for the shift report and the one NOC notice a week: {w: week, i: intern, n: {kind: count}, wh: {kind: [where…]}, up, mo, ff}. function opsWkOk(x){if(!x||typeof x!=='object'||Array.isArray(x)||!own(INTERNS,x.i))return null;const n={},wh={},xn=x.n&&typeof x.n==='object'?x.n:{},xw=x.wh&&typeof x.wh==='object'?x.wh:{}; for(const k of Object.keys(OPS_SAY)){if(own(xn,k)){const v=int(xn[k],0,1e6,0);if(v)n[k]=v;}if(own(xw,k)&&Array.isArray(xw[k])){const w=xw[k].filter(opsWhereOk).slice(0,3);if(w.length)wh[k]=w;}} - return {w:int(x.w,0,1e6,0),i:x.i,n,wh,up:int(x.up,0,1e12,0),mo:int(x.mo,-1e9,1e9,0),rev:int(x.rev,0,1e9,0),ff:int(x.ff,0,7,0)};} -const opsWkNew=w=>({w,i:S.ops.intern,n:{},wh:{},up:0,mo:0,rev:0,ff:0}); + // A tally of only the retired sales order says nothing any more. + const ff=int(x.ff,0,7,0);if(Object.keys(xn).length&&!Object.keys(n).length&&!ff)return null; + return {w:int(x.w,0,1e6,0),i:x.i,n,wh,up:int(x.up,0,1e12,0),mo:int(x.mo,-1e9,1e9,0),ff};} +const opsWkNew=w=>({w,i:S.ops.intern,n:{},wh:{},up:0,mo:0,ff:0}); const opsWkAny=x=>!!x&&(Object.keys(x.n).length>0||x.ff>0); -// "Kevin's week: signed 3 customers (+$41k/mo), topped up transit 2 times (Frankfurt +1×100G), declined 17 tiny offers. Week total: …" -function opsWeekLine(x){const I=INTERNS[x.i],name=I?tr(I.s):'',ks=Object.keys(x.n).sort((a,b)=>(a==='sales'?-1:b==='sales'?1:0)||(a==='broke')-(b==='broke')); - const parts=ks.map(k=>k==='sales'?trn('ops.w_sales',x.n[k],{rev:opsMo$(x.rev)}):trn(OPS_SAY[k],x.n[k],{where:(x.wh[k]||[]).map(w=>opsWhere(w,k)).join(', ')})); +// "Kevin's week: topped up transit 2 times (Frankfurt +1×100G), rushed a repair. Week total: …" +function opsWeekLine(x){const I=INTERNS[x.i],name=I?tr(I.s):'',ks=Object.keys(x.n).sort((a,b)=>(a==='broke')-(b==='broke')); + const parts=ks.map(k=>trn(OPS_SAY[k],x.n[k],{where:(x.wh[k]||[]).map(w=>opsWhere(w,k)).join(', ')})); if(x.ff)parts.push(trn('ops.w_oops',x.ff)); return tr('ops.w_line',{name,list:parts.join(', ')})+(x.up||x.mo?' '+tr('ops.w_money',{cost:fmt$(x.up),mo:opsMo$(x.mo)}):'');} // The intern's mood, from what the week has been like. No dice: the same day always reads the same. -function opsMood(){const O=S.ops,x=O.wk&&O.wk.w===Math.floor(S.day/7)?O.wk:null,n=x?x.n:{},jobs=Object.keys(n).filter(k=>k!=='broke'&&k!=='decline').reduce((a,k)=>a+n[k],0); - const k=S.day-O.hired<7?'new':x&&x.ff?'oops':n.snag?'snag':S.inc.some(i=>i.until>S.day&&i.type!=='ddos')?'outage':n.sales?'sales':n.broke?'broke':jobs>=5?'busy':S.day%2?'quiet':O.intern; - return tr({new:N_('ops.mood_new'),oops:N_('ops.mood_oops'),snag:N_('ops.mood_snag'),outage:N_('ops.mood_outage'),sales:N_('ops.mood_sales'),broke:N_('ops.mood_broke'),busy:N_('ops.mood_busy'),quiet:N_('ops.mood_quiet'), +function opsMood(){const O=S.ops,x=O.wk&&O.wk.w===Math.floor(S.day/7)?O.wk:null,n=x?x.n:{},jobs=Object.keys(n).filter(k=>k!=='broke').reduce((a,k)=>a+n[k],0); + const k=S.day-O.hired<7?'new':x&&x.ff?'oops':n.snag?'snag':S.inc.some(i=>i.until>S.day&&i.type!=='ddos')?'outage':n.broke?'broke':jobs>=5?'busy':S.day%2?'quiet':O.intern; + return tr({new:N_('ops.mood_new'),oops:N_('ops.mood_oops'),snag:N_('ops.mood_snag'),outage:N_('ops.mood_outage'),broke:N_('ops.mood_broke'),busy:N_('ops.mood_busy'),quiet:N_('ops.mood_quiet'), annie:N_('ops.mood_annie'),kevin:N_('ops.mood_kevin'),tracy:N_('ops.mood_tracy')}[k],{name:opsName()});} // "fra +1×100G", "fra|ams", "ams~3", "transit" (an order, for the budget line) or "ggl" (a network). // Peering is always at an exchange, and a city's first exchange has the city's id ("lon" is LYNX): name the exchange (#228). @@ -99,9 +104,9 @@ function opsQuiet(fn){const a=after,t=toast,s=sfx,f=floater,sel=UI.sel,cf=UI.con try{return fn();}finally{after=a;toast=t;sfx=s;floater=f;UI.confirm=cf;UI.tab=tab;UI.sel=sel&&(sel.type!=='link'||S.links.some(l=>l.id===sel.id))&&(sel.type!=='city'||isCity(sel.id))?sel:null;}} // One shift's bookkeeping: what got done, and whether a job had to wait for next month's budget. // dirty: a job changed the network, so R (loads, routing) is out of date until the next compute(). -// up/mo/rev: what this shift paid up front, added to the monthly bill, and signed in monthly revenue. +// up/mo: what this shift paid up front and added to the monthly bill. function opsShift(){const r=new Map(),broke=new Set(); - return {r,broke,dirty:false,up:0,mo:0,rev:0,did(k,w){if(k!=='decline')this.dirty=true;const x=r.get(k)||{n:0,w:[]};x.n++;if(w&&x.w.length<3&&!x.w.includes(w))x.w.push(w);r.set(k,x);}, + return {r,broke,dirty:false,up:0,mo:0,did(k,w){this.dirty=true;const x=r.get(k)||{n:0,w:[]};x.n++;if(w&&x.w.length<3&&!x.w.includes(w))x.w.push(w);r.set(k,x);}, // A job that costs nothing up front still has to pass the cash floor if it adds to the monthly bill. // quiet: only asking, so a no is not logged as the budget running out. can(k,cost,mo=0,quiet){const O=S.ops,cap=opsCap(k);if(cost<=0&&!(mo>0))return true; @@ -122,12 +127,6 @@ const opsProv=c=>{const pv=opsP('transit','prov'),n=isNet(pv)?NET[pv]:null;retur // The orders. Each takes the shift and does its jobs through the player's own actions. const OPS_RUN={ repair(X){purgeInc();for(const i of S.inc.slice())if(i.type!=='ddos'&&i.until>S.day&&i.cost>0&&!(i.slow&&i.rushed)&&X.can('repair',i.cost)&&X.pay('repair',()=>ACT.fixInc({id:i.id})))X.did('repair');}, - sales(X){const min=opsP('sales','min'),acc=opsP('sales','acc');let tries=0; - for(const o of S.offers.slice()){const T=BIZ_T[o.type];if(!T)continue;const v=T.event?(o.fee||0):bizMo(o); - if(min&&vx!==o);X.did('decline');continue;} - // Each trial is a full routing pass: at most one a shift, and an offer that did not fit waits a week. - if(acc&&o.exp>S.day&&bCities(o).every(popUp)&&reqOk(o)&&triesS.day-7)){tries++;ACT.accept({id:o.id,auto:true}); - if(!S.offers.includes(o)){X.did('sales');X.rev+=bizMo(o);}else{if(!UI.opsTried||UI.opsTried.s!==S)UI.opsTried={s:S,m:new Map()};UI.opsTried.m.set(o.id,S.day);}}}}, routers(X){const at=opsP('routers','at')/100,how=opsP('routers','how'); for(const c of opsPops('routers')){const p=S.pops[c];if(p.rupDay===S.day)continue; const ld=Math.max((R.nodeLoad[c]||0)/(R.nodeCap[c]||nodeCap(c)||1),portsUsed(c)/Math.max(1,portsMax(c)));if(ld(b.reqs||[]).some(k=>k==='diverse'||k==='sharks'||k==='lat')&&b.city2);if(!bz.length)return true; const chk=b=>(b.reqs||[]).every(k=>k==='diverse'?diversePaths(b.city,b.city2):k==='sharks'?terrestrialPath(b.city,b.city2):k==='lat'?bestLat(b.city,b.city2)<=b.latMax:true); const was=bz.filter(chk),all=S.links;S.links=all.filter(x=>x!==l);try{return was.every(chk);}finally{S.links=all;}} -const OPS_ORDER=['repair','sales','routers','transit','ports','optics','caches','ix','pni','decom']; +const OPS_ORDER=['repair','routers','transit','ports','optics','caches','ix','pni','decom']; // The shift: once per game day from dayTick, after outages and events have had their turn. function opsDay(d){if(!opsHired())return;const O=S.ops,m=monthIdx(d);if(m!==O.mon){O.mon=m;for(const k in O.spent)O.spent[k]=0;O.addMo={};} // A new week: last week's tally becomes the shift report, and the one NOC notice of the week. - const w=Math.floor(d/7);if(!O.wk||O.wk.w!==w){if(opsWkAny(O.wk)&&O.wk.w${esc(tr('ops.shift_report',{name:opsName()}))} ${esc(opsWeekLine(O.rep))}`,O.rep.rev>0?'good':'',[],{a:'ops'});}O.wk=opsWkNew(w);} + const w=Math.floor(d/7);if(!O.wk||O.wk.w!==w){if(opsWkAny(O.wk)&&O.wk.w${esc(tr('ops.shift_report',{name:opsName()}))} ${esc(opsWeekLine(O.rep))}`,'',[],{a:'ops'});}O.wk=opsWkNew(w);} const X=opsShift(); // One order that trips over something (an odd save, a bug) is paused and noted; payday, goals and the save still happen. opsQuiet(()=>{for(const k of OPS_ORDER)if(O.on[k])try{OPS_RUN[k](X);}catch(err){O.on[k]=false;X.dirty=true;X.did('snag',k);console.error('[tubes] standing order failed',k,err);}}); @@ -236,12 +235,12 @@ function opsDay(d){if(!opsHired())return;const O=S.ops,m=monthIdx(d);if(m!==O.mo if(f===3){const t=O.on.transit&&opsHere('transit',c)&&!scnRule('noTransit')&&S.transit.find(t=>t.city===c&&(t.n||1)X.pay('transit',()=>ACT.lagT({id:t.id,d:1}))))f=0;else X.dirty=true;} e.f=f;e.c=c;toast(esc(opsFFLine(e)),'',[{l:tr('ops.ops'),act:'opsOpen',args:{}}]);} if(X.up)e.up=Math.round(X.up);if(Math.round(X.mo))e.mo=Math.round(X.mo); - // Declining an offer or stopping at a budget changes nothing a route depends on: no recompute for those. + // Stopping at a budget changes nothing a route depends on: no recompute for that. if(X.dirty)compute(); if(e.r.length||e.f!==undefined){O.log.unshift(e);O.log.length=Math.min(O.log.length,OPS_LOG);} // The day's detail stays in the Ops sheet; the NOC gets one notice a week (above). const W=O.wk;for(const [k,n,ws] of e.r){W.n[k]=(W.n[k]||0)+n;const a=W.wh[k]||(W.wh[k]=[]);for(const x of ws)if(a.length<3&&!a.includes(x))a.push(x);} - W.up+=e.up||0;W.mo+=e.mo||0;W.rev+=Math.round(X.rev);if(e.f!==undefined)W.ff=Math.min(7,W.ff+1);} + W.up+=e.up||0;W.mo+=e.mo||0;if(e.f!==undefined)W.ff=Math.min(7,W.ff+1);} // New POP from the template: price the whole bundle first, then click through it in one go. function opsTplQuote(c){if(!S||S.pops[c]||!cityOn(c)||(cnCity(c)&&!cnOk()))return null;const T=S.ops.tpl,parts=[];let cost=popCost(c),net=null,ix=null,kit=null; if(T.bb){cost+=bbCost(c);parts.push(tr('ops.tpl_bb'));} diff --git a/src/game/60-features/99-pie-orbit-customers.js b/src/game/60-features/99-pie-orbit-customers.js index 53e4883..5012f29 100644 --- a/src/game/60-features/99-pie-orbit-customers.js +++ b/src/game/60-features/99-pie-orbit-customers.js @@ -22,14 +22,15 @@ function pieOfferTypes(){if(!pieOn()||!R||!R.pie||!R.pie.hubs.length||!pieDishes // Cities a terminal could sit in: cruise ships call at the coast, airlines at big airports, homes anywhere. function pieCands(t){if(t==='boat')return CITIES.filter(c=>c.beach||pieCoast(c.id));if(t==='flywifi')return CITIES.filter(c=>c.P>=250);return CITIES;} // The size fits the market left and the room on the dish it would land on (offers on the table count as taken). -function pieSpawn(t){const T=BIZ_T[t],min=T.opts[0],ok=pieCands(t).filter(c=>{if(c.cn)return false;const L=pieServe(c.id,t);return !!L&&L.left>=min;});if(!ok.length)return; +// Whoever runs sales has a say (99-pie-sales.js): the room they will sell, the size they ask for, how they dress it up. +function pieSpawn(t){const T=BIZ_T[t],min=T.opts[0],ok=pieCands(t).filter(c=>{if(c.cn)return false;const L=pieServe(c.id,t);return !!L&&pieSlRoom(L)>=min;});if(!ok.length)return; const far=ok.filter(c=>!S.pops[c.id]&&c.P<=60),city=(far.length&&Math.random()a+(BIZ_T[o.type].orbit?o.bw:0),0)),opts=T.opts.filter(g=>g<=left),bw=opts.length?pick(opts):0;if(!bw)return; + const left=Math.min(pieRoom(t),pieSlRoom(pieServe(city,t))-S.offers.reduce((a,o)=>a+(BIZ_T[o.type].orbit?o.bw:0),0)),opts=T.opts.filter(g=>g<=left),bw=opts.length?pieSlSize(opts):0;if(!bw)return; const list=T.names.filter(n=>!S.usedNames.includes(n)),name=list.length?pick(list):pick(T.names);useName(name); - S.offers.push({id:uid(),city,city2:null,name,type:t,bw,rate:T.rate,reqs:[],exp:S.day+40});} + const o={id:uid(),city,city2:null,name,type:t,bw,rate:T.rate,reqs:[],exp:S.day+40};pieSlShape(o);S.offers.push(o);} // Grand opening: the first PIE_OPEN_DAYS after a crust starts carrying traffic (crust.open, the day it first did), the phone // rings every day and up to PIE_OPEN_OFFERS wait, so regular customers sign while the patchy-sky income fades (99-pie-patchy.js). const PIE_OPEN_DAYS=30,PIE_OPEN_OFFERS=4; function pieOpening(){const P=S.pie;let on=false;for(const id of pieHubs()){const c=P.crusts[id];if(!c)continue;if(c.open===undefined&&pieCap(id)>0)c.open=S.day;if(c.open!==undefined&&S.day-c.open{const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random(){const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random()=PIE_ENG_SF?L.left/PIE_ENG_ROOM:0;} +// Which kinds get a call: the shark rings airlines and cruise lines first. +function pieSlTypes(t){if(slP()!=='shark')return t;const big=t.filter(x=>x==='flywifi'||x==='boat'||x==='marsorb');return big.length?big:t;} +// The size: the shark asks for the biggest that fits, everyone else as the customer asks (pick, as before). +const pieSlSize=opts=>slP()==='shark'?opts[opts.length-1]:pick(opts); +// A new orbit offer, dressed by whoever is at the desk. +function pieSlShape(o){const p=slP();if(!p)return;o.by=p; + if(p==='shark'){o.rate=Math.round(o.rate*PIE_SHARK);if(!REQS.skyfull.ok()&&slR('skyover|'+slKey(o))0)o.rate=Math.round(o.rate*(1-PIE_CEO_JIT*j));}} +const pieJit=()=>(S.pie&&S.pie.founder&&S.pie.founder.jit)||0; +// The CEO's golf with the Founder (salesGolf, on a golf day): true when this game was in orbit, deal or no deal. +function pieGolf(d){if(!pieOn()||!S.pie||!S.pie.co||slR('golfsky|'+d)>=PIE_GOLF_SKY)return false; + const ts=pieOfferTypes();if(!ts.length)return false; + if(pieJit()>=PIE_CEO_SKIP){toast(tr('sales.ceo_golf_skip'),'');return true;} + for(const t of ['marsorb','boat','flywifi','pizza']){if(!ts.includes(t))continue;const T=BIZ_T[t]; + const cs=pieCands(t).filter(c=>!c.cn).map(c=>[c,pieServe(c.id,t)]).filter(([,L])=>L&&L.left>=T.opts[0]).sort((a,b)=>b[0].P-a[0].P||(a[0].idg<=Math.min(pieRoom(t),L.left)).pop();if(!bw)continue; + const list=T.names.filter(n=>!S.usedNames.includes(n)),name=list.length?list[Math.floor(slR('golfskyn|'+d)*list.length)]:T.names[0];useName(name); + const off=1-0.7*(1-PIE_CEO_JIT*pieJit()),o={id:uid(),city:c.id,city2:null,name,type:t,bw,rate:Math.round(T.rate*(1-off)),reqs:REQS.skyfull.ok()?[]:['skyfull'],exp:d+40}; + const b=offerCustomer(o);b.by='ceo';S.biz.push(clSign(b)); + toast(tr('sales.ceo_golf_sky',{name:esc(name),city:esc(c.name),bw:fmtG(bw),price:fmt$(bw*o.rate),p:pct(off)})+(o.reqs.length?' '+tr('sales.ceo_promised',{req:esc(REQS.skyfull.l())}):''),'goal',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);sfx('coin');return true;} + return false;} diff --git a/src/game/80-simulation/60-requirements.js b/src/game/80-simulation/60-requirements.js index 784a72d..65c6e85 100644 --- a/src/game/80-simulation/60-requirements.js +++ b/src/game/80-simulation/60-requirements.js @@ -15,6 +15,8 @@ const REQS={ china:{l:tr('requirements.needs_low_loss_reach_into_china'),bonus:.3,ip:true,ok:()=>S.transit.some(premOn)||S.links.some(l=>l.premium)||S.pni.some(p=>NET[p.net].cn&&pniOn(p))}, scrubbed:{l:tr('requirements.will_only_sign_with_a_network'),bonus:.15,ok:()=>hasScrub()}, scrubnear:{l:tr('requirements.wants_a_scrubbing_center_on_its'),bonus:.15,ip:true,ok:b=>S.scrubs.some(x=>CITY[x.city].reg===CITY[b.city].reg)}, + // The shark's orbit promise (99-pie-sales.js): a full sky, a crust at least PIE_PROMISE in orbit. Never on an ordinary offer. + skyfull:{only:true,bonus:0,l:()=>tr('requirements.promised_a_full_sky',{p:pct(PIE_PROMISE)}),ok:()=>pieHubs().some(id=>pieCov(id)>=PIE_PROMISE)}, puns:{l:tr('requirements.their_ceo_hates_puns_please_do'),bonus:.05,ok:()=>true}, }; function terrestrialPath(a,b){const ls=S.links.filter(l=>!linkDown(l)&&!l.sub);const adj={};for(const l of ls){(adj[l.a]=adj[l.a]||[]).push(l.b);(adj[l.b]=adj[l.b]||[]).push(l.a);}const seen=new Set([a]),q=[a];while(q.length){const u=q.shift();if(u===b)return true;for(const v of adj[u]||[])if(!seen.has(v)){seen.add(v);q.push(v);}}return false;} diff --git a/src/game/88-days/10-day-tick.js b/src/game/88-days/10-day-tick.js index 74c618b..2f008db 100644 --- a/src/game/88-days/10-day-tick.js +++ b/src/game/88-days/10-day-tick.js @@ -52,6 +52,8 @@ function dayPost(d){ if(sf>=0.95&&reachOk&&scrubOk&&divOk)b.mood=Math.min(100,b.mood+2); else if(S.day-(b.since||0)<15){} else{const dm=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));b.mood-=BIZ_T[b.type].orbit?Math.min(dm,PIE_PATIENCE):dm; + // An orbit customer served in full but promised more (the shark's full sky) grumbles, and never cancels over it. + if(BIZ_T[b.type].orbit&&sf>=0.95&&reachOk)b.mood=Math.max(b.mood,Math.min(b.pm,PIE_GRUMBLE)); if(b.mood<=0){S.biz=S.biz.filter(x=>x!==b);toast(tr('day_tick.name_cancelled_too_many_outages_and',{name:esc(b.name),city:CITY[b.city].name}),'bad');sfx('err');} else if(b.mood<30&&!b.warned){b.warned=b.warn60=true;const why=bizWhy(b)[0],paused=pref('pauseFurious')&&autoPause(); toast(tr('day_tick.name_is_furious_fix_service_in',{name:esc(b.name),city:CITY[b.city].name})+(why?`
${esc(why)}`:'')+(paused?`
${tr('common.game_paused')}`:''),'bad',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}].concat(paused?[resumeAct()]:[]));sfx('err');} @@ -82,6 +84,8 @@ function dayPost(d){ if(cm&&d>45&&scnRule('anchors')){const n=S.links.filter(l=>l.kind!=='vxc'&&!linkDown(l)&&anchorProne(l)).length;if(n&&Math.random()=S.nextEvent){dirty=true;fireEvent();S.nextEvent=d+Math.round((45+Math.floor(Math.random()*45))/cm);} if(dirty)compute(); + // the sales desk signs and declines deals, when the player lets it (39-sales-auto.js), then the intern's shift sees them + slAutoDay(d); opsDay(d); if(S.pie){pieDay(d);pieTier();} // payday floaters diff --git a/src/game/90-actions/52-sales.js b/src/game/90-actions/52-sales.js index 68d36ee..b909207 100644 --- a/src/game/90-actions/52-sales.js +++ b/src/game/90-actions/52-sales.js @@ -8,5 +8,8 @@ Object.assign(ACT,{ salesFire:()=>{const p=slP();if(!p||p==='ceo')return;if(UI.confirm!=='salesFire'){UI.confirm='salesFire';salesModal();return;}UI.confirm=null;const nm=slCap();S.sales.p=null; toast(tr('sales.fired',{name:esc(nm)}),'');after();salesModal();}, // The CEO cannot be fired. A board meeting (and its catering) can get you a VP of Sales, who takes over a month later. + // Signing for you (39-sales-auto.js): on or off, and the minimum under which offers are declined. + salesAuto:()=>{if(!slP())return;const A=S.slAuto||(S.slAuto=slAutoNew());A.on=!A.on;sfx('click');after();salesModal();}, + salesMin:()=>{if(!slP())return;const A=S.slAuto||(S.slAuto=slAutoNew());A.min=opsCycle(SL_MINS,A.min);sfx('click');after();salesModal();}, salesVp:()=>{if(slP()!=='ceo'||S.sales.vp)return;if(!spend(SALES_VP))return;S.sales.vp=S.day+SALES_VP_DAYS;toast(tr('sales.vp_asked',{n:SALES_VP_DAYS}),'');after();salesModal();}, }); diff --git a/src/game/93-ui/58-sales-panel.js b/src/game/93-ui/58-sales-panel.js index 9204186..b155c20 100644 --- a/src/game/93-ui/58-sales-panel.js +++ b/src/game/93-ui/58-sales-panel.js @@ -1,7 +1,7 @@ // The sales desk in Deals, and its sheet: the three kinds of salesperson, who is at the desk, and what they cost. function salesCard(){if(!S||!rule('clock'))return '';const p=slP(),L=S.sales||{}; return `
${p?`${SALES[p].i} ${esc(tr('sales.at_desk',{name:slCap()}))}`:`💼 ${tr('sales.desk')}`}
-
${p?(L.vp?tr('sales.vp_coming',{n:Math.max(0,L.vp-S.day)}):tr(SALES[p].d)):salesCanHire()?tr('sales.pitch'):tr('sales.locked',{lv:SALES_LV})}
+
${p?(L.vp?tr('sales.vp_coming',{n:Math.max(0,L.vp-S.day)}):slCardLine()||tr(SALES[p].d)):salesCanHire()?tr('sales.pitch'):tr('sales.locked',{lv:SALES_LV})}
${btn(p?tr('sales.desk'):tr('sales.hire_sales'),'salesOpen',{},p?'sm':'pink sm',!p&&!salesCanHire())}
`;} function salesModal(){if(!S)return;const p=slP(),L=S.sales||{}; let h=`
${tr('common.deals')}

${tr('sales.desk')}

`; @@ -12,6 +12,19 @@ function salesModal(){if(!S)return;const p=slP(),L=S.sales||{}; :btn(UI.confirm==='salesFire'?tr('ops.really_fire'):tr('ops.fire'),'salesFire',{},'ghost sm')) :p?'':btn(id==='ceo'?tr('sales.let_ceo'):tr('ops.hire_mo',{price:fmt$(P.mo)}),'salesHire',{id},'pink sm',!salesCanHire()||!rule('clock')||S.cash
${tr(P.n)}
-
${tr(P.d)}
${here&&id!=='ceo'?`
${tr('ops.salary',{price:fmt$(P.mo),d:dateStr(L.hired||0)})}
`:''}${act?`
${act}
`:''}
`;}).join(''); +
${tr(P.d)}
${pieOn()?`
🥧 ${tr(SL_SKY[id])}
`:''}${here&&id!=='ceo'?`
${tr('ops.salary',{price:fmt$(P.mo),d:dateStr(L.hired||0)})}
`:''}${act?`
${act}
`:''}`;}).join(''); if(p&&p!=='ceo')h+=`

${tr('sales.one_at_a_time')}

`; + h+=p?slAutoHtml(p):rule('clock')?`

${tr('sales.by_hand')}

`:''; openModal(h,'ops');} +// What each of them does in orbit, shown once there is a rocket company to sell for (99-pie-sales.js). +const SL_SKY={eng:N_('sales.eng_sky'),shark:N_('sales.shark_sky'),ceo:N_('sales.ceo_sky')}; +const SL_AUTO={eng:N_('sales.auto_eng'),shark:N_('sales.auto_shark'),ceo:N_('sales.auto_ceo')}; +// Signing for you (39-sales-auto.js): the switch, the minimum, and this week's and last week's tally. +function slAutoHtml(p){const A=S.slAuto||slAutoNew(),w=Math.floor(S.day/7),cur=A.wk&&A.wk.w===w&&slWkAny(A.wk)?A.wk:null,rep=A.rep&&A.rep.w===w-1?A.rep:null; + const row=(x,last)=>`
${esc(slWeekLine(x,last))}
`; + return `

${tr('sales.auto')}

${tr(SL_AUTO[p],{name:esc(slCap())})}

+
+ ${btn(`${tr('sales.decline_below')}: ${A.min?tr('common.price_mo',{price:fmt$(A.min)}):tr('sales.never')}`,'salesMin',{},'ghost sm')}
+ ${rep?row(rep,true):''}${cur?row(cur,false):''}
`;} +// On the card in Deals: this week's tally, once there is one. +function slCardLine(){if(!slAutoOn())return '';const A=S.slAuto,x=A.wk&&A.wk.w===Math.floor(S.day/7)&&slWkAny(A.wk)?A.wk:null;return x?esc(slWeekLine(x,false)):'';} diff --git a/src/i18n/en.js b/src/i18n/en.js index 7f946fa..3e441b0 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3222,7 +3222,6 @@ "ops.kevin_from_the_night_shift":"Kevin from the night shift", "ops.l_broke":{"one":"stopped at the budget for {where}","other":"stopped at the budget for {n} orders ({where})"}, "ops.l_caches":{"one":"racked a free cache in {where}","other":"racked {n} free caches ({where})"}, -"ops.l_decline":{"one":"declined a tiny offer","other":"declined {n} tiny offers"}, "ops.l_decom":{"one":"handed back a small wave on {where}","other":"handed back {n} small waves ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"lit a channel on {where}","other":"lit {n} channels ({where})"}, @@ -3234,7 +3233,6 @@ "ops.l_repair":{"one":"rushed a repair","other":"rushed {n} repairs"}, "ops.l_routers":{"one":"upgraded routers in {where}","other":"upgraded routers in {n} places ({where})"}, "ops.l_rs":{"one":"joined a route server","other":"joined {n} route servers"}, -"ops.l_sales":{"one":"signed a customer","other":"signed {n} customers"}, "ops.l_snag":{"one":"got stuck on {where} and paused it until you have a look","other":"got stuck on {n} orders ({where}) and paused them until you have a look"}, "ops.l_transit":{"one":"topped up transit in {where}","other":"topped up transit {n} times ({where})"}, "ops.locked":"The NOC hires interns from customer level {lv}.", @@ -3246,10 +3244,8 @@ "ops.mood_oops":"{name} is being very careful today. Nobody mention the interface descriptions.", "ops.mood_outage":"{name} is watching the outage graphs and refreshing the status page. A lot.", "ops.mood_quiet":"{name} is quietly reading RFCs. The graphs are flat, which is how they like them.", -"ops.mood_sales":"{name} is walking a little taller: someone signed on their shift.", "ops.mood_snag":"{name} hit something odd, paused that order and left you a sticky note.", "ops.mood_tracy":"Tracy is three hops into a traceroute, with only one star so far.", -"ops.never":"never", "ops.no_cap":"no limit", "ops.no_clock":"No clock, no shifts: these rules have no days for an intern to work.", "ops.o_caches":"Accept free caches", @@ -3268,18 +3264,14 @@ "ops.o_repair_d":"Pay for the rush repair on every outage that has one, while the budget lasts.", "ops.o_routers":"Keep routers ahead", "ops.o_routers_d":"Add a router, or swap to the next generation where a second router carries the traffic, when load or ports pass a level.", -"ops.o_sales":"Handle sales", -"ops.o_sales_d":"Sign offers whose requirements are met with capacity to spare, and decline the ones that pay too little to bother.", "ops.o_transit":"Keep transit headroom", "ops.o_transit_d":"Keep transit at each POP above a multiple of its 30-day peak: add a LAG member, or move up a port size.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Accept ready offers", "ops.p_at":"Above", "ops.p_g":"From", "ops.p_how":"How", "ops.p_keep":"Keep one spare", -"ops.p_min":"Decline below", "ops.p_paid":"Paid peering", "ops.p_pick":"Optics", "ops.p_prov":"Provider", @@ -3315,7 +3307,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Week total: {cost} up front, {mo}/mo.", "ops.w_oops":{"one":"made one small oops","other":"made {n} small oopses"}, -"ops.w_sales":{"one":"signed a customer ({rev}/mo)","other":"signed {n} customers ({rev}/mo)"}, "optic_counts.apply_price":"Apply · {price}", "optic_counts.count_for_model":"Number of {model} channels", "optic_counts.only_n_channels_free":"Only {n} channels are free on this fiber.", @@ -4082,6 +4073,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× 400G alien wave on your {a}–{b} fiber","other":"{n}× 400G alien waves on your {a}–{b} fiber"}, "requirements.needs_low_loss_reach_into_china":"Needs low-loss reach into China", "requirements.one_way_latency_within_max_ms":"One-way latency within {max} ms (best now: {best})", +"requirements.promised_a_full_sky":"Promised a full sky: a crust at least {p} in orbit", "requirements.refuses_cogentle_transit_anywhere_on":"Refuses Cogentle transit anywhere on your network (long story)", "requirements.their_ceo_hates_puns_please_do":"Their CEO hates puns. Please do not mention the network names.", "requirements.two_data_centers_in_every_metro":"Two data centers in every metro they touch", @@ -4287,8 +4279,15 @@ "rules.your_pager_never_sleeps":"Your pager never sleeps.", "sales.ask_vp":"Ask the board for a VP of Sales · {cost}", "sales.at_desk":"{name} runs sales", +"sales.auto":"Signs deals for you", +"sales.auto_ceo":"{name} signs the offers your network can serve today, one trial a day. He declines the ones under your minimum too, though now and then he has already shaken hands on one.", +"sales.auto_eng":"{name} signs the offers your network can serve today, after trying each one on the network first (one a day), and declines the ones that pay less than your minimum.", +"sales.auto_shark":"{name} signs every offer the moment it lands, promises and all, as long as you can pay the commission, and declines the ones that pay less than your minimum.", +"sales.by_hand":"Nobody runs sales, so you sign every deal by hand. Hire a salesperson, or let the CEO run it, and they can sign deals for you.", "sales.ceo_d":"Free, and sure of it. Every couple of months signs a huge deal on the golf course at 30% off, often with a promise nobody checked, and now and then signs an offer you declined. Has opinions. Cannot be fired.", "sales.ceo_golf":"The CEO signed {name} on the golf course: {bw} in {city} for {price}/mo, 30% off list.", +"sales.ceo_golf_skip":"The Founder skipped golf: the markets are too jumpy. The CEO played alone and signed nothing in orbit.", +"sales.ceo_golf_sky":"The CEO and the Founder signed {name} on the golf course: {bw} in orbit over {city} for {price}/mo, {p} off list.", "sales.ceo_n":"The CEO, who sells better than anyone", "sales.ceo_override":"You declined {name}, but the CEO had already shaken hands on it. They are now a customer.", "sales.ceo_promised":"He also promised: {req}.", @@ -4300,27 +4299,38 @@ "sales.ceo_say_napkin":"I priced the next deal on a napkin. Engineering can work out the details.", "sales.ceo_say_synergy":"We don't sell bandwidth, we sell synergy. Put that on the website.", "sales.ceo_says":"The CEO: “{say}”", +"sales.ceo_sky":"In orbit: every other golf game is with the Founder, for the biggest orbit deal that fits at 30% off. Jumpy markets cost him: lower orbit prices, and no golf at all when they are very jumpy.", "sales.ceo_took_over":"{name} has taken over sales personally. He is sure he sells better than anyone.", "sales.commission":"{name} signed. Commission for the shark: {cost}.", +"sales.decline_below":"Decline below", "sales.desk":"Sales desk", "sales.eng_booked":"{name} registered you for {conf} in {city} ({cost}). They already have the lanyard.", "sales.eng_d":"Was a network engineer, now has a lanyard for every NOG. Books you into each one (you pay the ticket), brings plenty of small and mid deals but never the really big ones, and only sells what the network can do, so customers stay. The nerds love Dave. Haggles badly.", "sales.eng_n":"The engineer turned salesdroid", "sales.eng_s":"Dave", +"sales.eng_sky":"In orbit: only sells where the landing dish has room to spare, and those customers stay like the nerds do.", "sales.fired":"{name} has cleared their desk. The sales desk is free.", "sales.hire_sales":"Hire sales", "sales.hired":"{name} joined sales. Expect deals in their style.", "sales.intro":"One person runs sales at a time. Each brings deals in their own way, and the customers they sign remember it when their contract comes up.", "sales.let_ceo":"Let the CEO run it", "sales.locked":"The sales desk opens at customer level {lv}.", +"sales.never":"never", "sales.one_at_a_time":"One at a time: let them go to hire someone else.", +"sales.p_sign":"Sign deals", "sales.pitch":"One salesperson brings in deals their own way. Pick who.", "sales.shark_d":"Lands the biggest deals at a quarter more, and takes a month of each deal as commission. Oversells: half of them come with a promise your network does not keep yet, and those customers leave sooner. Ignores the nerds: no technical customers, no meetings, and peering desks want a quarter more traffic from you. Wins most haggles.", "sales.shark_n":"The shark", "sales.shark_s":"Chad", +"sales.shark_sky":"In orbit: calls airlines and cruise lines first, at the biggest size and a quarter more, and promises half of them a full sky before you have one. They grumble until you do.", "sales.vp_arrived":"The VP of Sales has started, and the CEO has gone back to strategy. The sales desk is free: hire someone.", "sales.vp_asked":"The board agreed, after lunch. A VP of Sales starts in {n} days; until then the CEO keeps selling.", "sales.vp_coming":"A VP of Sales takes over in {n} days.", +"sales.w_anyway":{"one":"signed one of those anyway","other":"signed {n} of those anyway"}, +"sales.w_declined":{"one":"declined a tiny offer","other":"declined {n} tiny offers"}, +"sales.w_last":"Last week {name} {list}.", +"sales.w_now":"This week {name} {list}.", +"sales.w_signed":{"one":"signed a customer ({rev}/mo)","other":"signed {n} customers ({rev}/mo)"}, "save.cash_in_the_bank":"{cash} in the bank", "save.import_failed_err":"Import failed.
{err}", "save.load_name":"Load {name}?", diff --git a/tests/automation.test.js b/tests/automation.test.js index 7a8c05a..4cca19f 100644 --- a/tests/automation.test.js +++ b/tests/automation.test.js @@ -3,29 +3,29 @@ const assert = require('node:assert/strict'); const { load } = require('./harness'); const { lit } = require('../scripts/lib/js-literal'); -// #185's sales and repair engines now run as the NOC intern's standing orders, once per game day. +// #185's engines: the repair one is the NOC intern's standing order, the sales one belongs to the sales desk +// (39-sales-auto.js). Here the engineer, who signs only what the trial says the network can serve, as #185 did. function setup(ev) { - ev("ACT.start({});S.cash=1e8;S.offers=[];S.biz=[];S.nextFail=S.nextEvent=1e6;for(const g of GOALS)S.done[g.id]=0;S.pops.fra.rgen=3;ACT.buyTransit({city:'fra',net:'lvl',tier:1});S.lvl=2;S.ops.intern='kevin';S.ops.floor=0;S.rules=makeRules('freeze');compute()"); + ev("ACT.start({});S.cash=1e8;S.offers=[];S.biz=[];S.nextFail=S.nextEvent=1e6;for(const g of GOALS)S.done[g.id]=0;S.pops.fra.rgen=3;ACT.buyTransit({city:'fra',net:'lvl',tier:1});S.lvl=2;S.ops.intern='kevin';S.ops.floor=0;S.rules=makeRules('freeze');ACT.salesHire({id:'eng'});compute()"); } -const orders = (ev, on) => ev(`for(const k of ${lit(on)})S.ops.on[k]=true`); -const shift = ev => ev('opsDay(S.day)'); +const shift = ev => ev('slAutoDay(S.day);opsDay(S.day)'); function offer(ev, id, extra = {}) { ev(`S.offers.push(${lit({ id, city: 'fra', name: id, type: 'dia', bw: 1, rate: 600, reqs: [], exp: 30, ...extra })})`); } -test('the sales order signs ready offers once per shift, and pausing it stops it', () => { +test('the sales desk signs ready offers once a day, and switching it off stops it', () => { const { ev, dom, errors } = load(); setup(ev); offer(ev, 'first'); shift(ev); assert.equal(ev('S.biz.length'), 0, 'off by default'); - orders(ev, ['sales']); + ev('ACT.salesAuto()'); shift(ev); assert.equal(ev('S.biz[0].id'), 'first'); - ev("ACT.opsToggle({k:'sales'})"); + ev('ACT.salesAuto()'); offer(ev, 'off'); ev('dayTick()'); - assert.equal(ev('S.biz.length'), 1, 'a paused order signs nothing'); + assert.equal(ev('S.biz.length'), 1, 'switched off, it signs nothing'); assert.ok(ev("S.offers.some(o=>o.id==='off')")); assert.deepEqual(errors, []); dom.window.close(); @@ -41,7 +41,7 @@ test('the trial includes new bandwidth and later offers cannot overbook earlier assert.equal(ev('!!autoOffer(S.offers[0])'), true); assert.equal(ev('JSON.stringify(S)'), state); assert.equal(ev('S===beforeState&&R===beforeResult&&UI.hotMap===beforeHot'), true); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.offers[0].id'), 'two'); assert.ok(ev('bizSf(S.biz[0])') >= 0.95); @@ -49,7 +49,7 @@ test('the trial includes new bandwidth and later offers cannot overbook earlier dom.window.close(); }); -test('the sales order checks actual circuits, latency and NNI capacity', () => { +test('the sales desk checks actual circuits, latency and NNI capacity', () => { const { ev, dom, errors } = load(); setup(ev); ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=3;compute()"); @@ -65,7 +65,7 @@ test('the sales order checks actual circuits, latency and NNI capacity', () => { offer(ev, 'fabric-one', { type: 'fabip', prov, bw: bandwidth, reqs: ['nni'] }); offer(ev, 'fabric-two', { type: 'fabip', prov, bw: bandwidth, reqs: ['nni'] }); // Transit has enough headroom, so the second rejection is the shared NNI port. - ev("S.transit[0].tier=4;compute();S.ops.on.sales=true;opsDay(S.day)"); + ev("S.transit[0].tier=4;compute();S.slAuto.on=true;slAutoDay(S.day)"); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.offers[0].id'), 'fabric-two'); assert.ok(ev("nniUsed('fra',fabric)<=NNI[0].g")); @@ -95,7 +95,7 @@ test('fiber sales check live equipment and free spectrum, and repeated carrier o assert.equal(ev('!!autoOffer(S.offers[0])'), false); ev("S.offers[0].slots=1;S.offers[0].name='Same Carrier';S.links[0].eqDown=10;compute()"); assert.equal(ev('!!autoOffer(S.offers[0])'), false, 'a broken amplifier prevents a wave sale'); - ev('S.links[0].eqDown=0;compute();S.ops.on.sales=true;opsDay(S.day)'); + ev('S.links[0].eqDown=0;compute();S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.biz[0].slots'), 2); assert.equal(ev('S.biz[0].rate'), 1600); @@ -111,7 +111,7 @@ test('capacity pair sales need completed infrastructure and reserve it for the a assert.equal(ev('!!autoOffer(S.offers[0])'), false); ev("ACT.buildPop({city:'ams'});S.links=[{id:'own',a:'fra',b:'ams',kind:'df',own:true,sys:'roadm',ch:[],km:450,sub:false,ready:0,cut:0,mo:1}];compute()"); assert.equal(ev('!!autoOffer(S.offers[0])'), true); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz[0].link'), 'own'); assert.equal(ev('capPend(S.biz[0])'), true, 'normal delivery handover still happens on a game day'); offer(ev, 'second-pairs', { type: 'capfib', city2: 'ams', slots: 2, win: 90 }); @@ -125,7 +125,7 @@ test('future event demand is tested before signing, with booked events reserving setup(ev); offer(ev, 'event', { type: 'event', bw: 80, rate: 0, start: 10, dur: 3, fee: 5000, exp: 9 }); assert.equal(ev('!!autoOffer(S.offers[0])'), true); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz[0].start'), 10, 'the trial does not move the actual event date'); assert.equal(ev('R.cityDem.fra'), 0); offer(ev, 'too-large', { bw: 30 }); @@ -184,7 +184,7 @@ test('the repair order rushes affordable repairs once, skips unaffordable and ex dom.window.close(); }); -test('the sales order leaves unready and expired offers alone without failure notifications', () => { +test('the sales desk leaves unready and expired offers alone without failure notifications', () => { const { ev, dom, errors } = load(); setup(ev); offer(ev, 'generator', { reqs: ['gen'] }); @@ -193,11 +193,11 @@ test('the sales order leaves unready and expired offers alone without failure no offer(ev, 'expired', { exp: 0 }); offer(ev, 'ipv6', { reqs: ['ipv6'] }); const log = ev('S.log.length'); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 0); assert.equal(ev('S.offers.length'), 5); - assert.equal(ev('S.log.length'), log, 'no failed manual-action toasts and no shift line when nothing got done'); - ev('S.pops.fra.gen=true;compute();opsDay(S.day)'); + assert.equal(ev('S.log.length'), log, 'no failed manual-action toasts and no notice when nothing got done'); + ev('S.pops.fra.gen=true;compute();slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.biz[0].id'), 'generator'); // Manual acceptance keeps its existing sign-now, provision-later behavior. @@ -207,15 +207,17 @@ test('the sales order leaves unready and expired offers alone without failure no dom.window.close(); }); -test('the #185 toggles in old saves become the sales and repair orders, malformed ones stay off', () => { +test('#185\'s auto-repair toggle in old saves becomes the repair order; its auto-accept, which never ran without an intern, goes', () => { const { ev, dom, errors } = load(); setup(ev); - ev("delete S.ops;S.autoSales=true;S.autoRepair=true;S=migrate(JSON.parse(JSON.stringify(S)))"); - assert.equal(ev('S.ops.on.sales&&S.ops.on.repair'), true); + ev("delete S.ops;delete S.slAuto;S.autoSales=true;S.autoRepair=true;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.ops.on.repair'), true); + assert.equal(ev("'sales' in S.ops.on"), false, 'the intern has no sales order any more'); + assert.equal(ev('S.slAuto.on'), false, 'nothing signs on its own that did not before'); assert.equal(ev("'autoSales' in S||'autoRepair' in S"), false); assert.equal(ev('S.ops.intern'), null, 'no intern until you hire one, so nothing runs yet'); ev("delete S.ops;S.autoSales='true';S.autoRepair=1;S=migrate(S)"); - assert.equal(ev('S.ops.on.sales||S.ops.on.repair'), false); + assert.equal(ev('S.ops.on.repair'), false); assert.deepEqual(errors, []); dom.window.close(); }); diff --git a/tests/sales-auto.test.js b/tests/sales-auto.test.js new file mode 100644 index 0000000..ac5a860 --- /dev/null +++ b/tests/sales-auto.test.js @@ -0,0 +1,275 @@ +// Deals belong to Sales: the NOC intern has no sales order any more, the sales desk signs deals for you in its own +// style (src/game/60-features/39-sales-auto.js), and orbit offers go through the desk too (99-pie-sales.js). +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); +const { lit } = require('../scripts/lib/js-literal'); + +// Frankfurt with 400G transit, level 4, nothing breaking, Change Freeze (no fat fingers). +const BASE = "ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=4;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');S.offers=[];S.biz=[];" + + "ACT.launchBB({city:'fra'});S.pops.fra.rgen=3;ACT.buyTransit({city:'fra',net:'lvl',tier:3});compute()"; +function game(t, who) { + const h = load(); + t.after(() => h.dom.window.close()); + h.ev(BASE); + if (who) h.ev(`ACT.salesHire({id:'${who}'});closeModal()`); + return h; +} +const offer = (ev, id, extra = {}) => ev(`S.offers.push(${lit({ id, city: 'fra', name: id, type: 'dia', bw: 1, rate: 6000, reqs: [], exp: 60, ...extra })})`); +const ids = (ev, k) => JSON.parse(ev(`JSON.stringify(S.${k}.map(x=>x.id))`)); +const desk = ev => ev('slAutoDay(S.day)'); + +test('an old save whose intern ran the sales order loads cleanly: the order is gone, its settings are at the sales desk', t => { + const { ev, dom, errors } = game(t); + ev("ACT.opsHire({id:'kevin'});closeModal()"); + // What 2.10 saved: the order on with its dials, a day that only signed and declined, a week's tally of it. + ev(`S.ops.on.sales=true;S.ops.p.sales={acc:true,min:5000};S.ops.on.repair=true; + S.ops.log=[{d:3,i:'kevin',r:[['sales',2,[]],['decline',5,[]]]},{d:2,i:'kevin',r:[['sales',1,[]],['repair',1,[]]]},{d:1,i:'kevin',r:[]}]; + S.ops.wk={w:0,i:'kevin',n:{sales:3,decline:5,repair:1},wh:{},up:0,mo:0,rev:18000,ff:0};S.ops.rep={w:0,i:'kevin',n:{sales:1},wh:{},up:0,mo:0,rev:6000,ff:0}; + delete S.slAuto;S=migrate(JSON.parse(JSON.stringify(S)))`); + assert.deepEqual(JSON.parse(ev('JSON.stringify(Object.keys(S.ops.on))')).includes('sales'), false, 'no sales order'); + assert.equal(ev("'sales' in S.ops.p"), false); + assert.equal(ev('S.ops.on.repair'), true, 'everything else the intern did stays'); + assert.equal(ev("JSON.stringify(S.ops.log)"), '[{"d":2,"i":"kevin","r":[["repair",1,[]]]},{"d":1,"i":"kevin","r":[]}]', 'a day of only deals has nothing left to say'); + assert.equal(ev("JSON.stringify(S.ops.wk)"), '{"w":0,"i":"kevin","n":{"repair":1},"wh":{},"up":0,"mo":0,"ff":0}'); + assert.equal(ev('S.ops.rep'), null, 'a report of only deals goes'); + assert.equal(ev('JSON.stringify(S.slAuto)'), '{"on":true,"min":5000,"wk":null,"rep":null}', 'the switch and the minimum moved to the sales desk'); + // Nobody runs sales in that save, so nothing signs on its own yet: the player signs by hand, as without the intern. + assert.equal(ev('slP()'), null); + offer(ev, 'tiny', { rate: 600 }); offer(ev, 'ready'); + ev('for(let i=0;i<3;i++)dayTick()'); + assert.deepEqual(ids(ev, 'offers').slice(0, 2), ['tiny', 'ready'], 'nothing declined, nothing signed'); + assert.equal(ev('S.biz.length'), 0); + ev("ACT.accept({id:'ready'})"); + assert.deepEqual(ids(ev, 'biz'), ['ready'], 'by hand, as before'); + // The Ops sheet has no sales order, and every order it shows still has a switch. + dom.window.innerWidth = 360; ev('opsModal()'); + const doc = dom.window.document, ks = [...doc.querySelectorAll('#modalCard [data-act="opsToggle"]')].map(b => JSON.parse(b.dataset.args).k); + assert.deepEqual(ks, JSON.parse(ev('JSON.stringify(OPS.map(o=>o.k))'))); + assert.ok(!ks.includes('sales')); + assert.doesNotMatch(doc.getElementById('modalCard').textContent, /Handle sales|signed|declined/); + // An intern who was not hired never ran the order: nothing to carry over. + ev("S.ops.intern=null;S.ops.on.sales=true;delete S.slAuto;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.slAuto.on||S.slAuto.min'), 0); + // Junk at the desk is repaired. + ev("S.slAuto={on:'yes',min:1234,wk:{w:'x',p:'pirate'},rep:{w:2,p:'eng',n:-4,rev:9e99,x:3,y:'a'}};S=migrate(S)"); + assert.equal(ev('JSON.stringify(S.slAuto)'), '{"on":false,"min":0,"wk":null,"rep":{"w":2,"p":"eng","n":0,"rev":10000000000,"x":3,"y":0}}'); + assert.deepEqual(errors, []); +}); + +test('nobody at the desk: nothing is signed for you, and the sheet says how to change that', t => { + const { ev, dom, errors } = game(t); + ev('S.slAuto.on=true;S.slAuto.min=5000'); + offer(ev, 'tiny', { rate: 600 }); offer(ev, 'ready'); + desk(ev); + assert.deepEqual(ids(ev, 'offers'), ['tiny', 'ready']); + ev('ACT.salesAuto();ACT.salesMin()'); + assert.equal(ev('S.slAuto.on&&S.slAuto.min===5000'), true, 'the switches need someone at the desk'); + ev('ACT.salesOpen()'); + assert.match(dom.window.document.getElementById('modalCard').textContent, /you sign every deal by hand/); + assert.equal(dom.window.document.querySelector('#modalCard [data-act="salesAuto"]'), null); + assert.deepEqual(errors, []); +}); + +test('the engineer signs only what the trial says the network can serve: one trial a day, a misfit waits a week', t => { + const { ev, errors } = game(t, 'eng'); + ev('ACT.salesAuto();ACT.salesMin();ACT.salesMin()'); + assert.equal(ev('S.slAuto.on&&S.slAuto.min'), 5000); + offer(ev, 'tiny', { rate: 600 }); offer(ev, 'gen', { reqs: ['gen'] }); offer(ev, 'huge', { bw: 1e5, rate: 600 }); offer(ev, 'ok'); + ev("window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); + desk(ev); + assert.equal(ev('__t'), 1, 'one routing trial a day'); + assert.deepEqual(ids(ev, 'offers'), ['gen', 'huge', 'ok'], 'the tiny one is declined; the unmet promise waits without a trial'); + ev('S.day++'); desk(ev); + assert.deepEqual(ids(ev, 'biz'), ['ok']); + assert.equal(ev("S.biz[0].by"), undefined, 'an offer nobody brought stays nobody\'s'); + assert.equal(ev('JSON.stringify([S.slAuto.wk.n,S.slAuto.wk.x])'), '[1,1]', 'the week\'s tally'); + ev('S.day++'); desk(ev); + assert.equal(ev('__t'), 2, 'the misfit is not tried again within the week'); + ev('S.day+=7'); desk(ev); + assert.equal(ev('__t'), 3); + ev('autoOffer=__a'); + assert.deepEqual(errors, []); +}); + +test('the shark signs every offer the moment it lands, promises and all, while the cash covers the commission', t => { + const { ev, errors } = game(t, 'shark'); + ev('ACT.salesAuto()'); + offer(ev, 'gen', { reqs: ['gen'], by: 'shark' }); offer(ev, 'a', { by: 'shark' }); offer(ev, 'b', { bw: 1e5, rate: 600 }); + ev("window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); + const c0 = ev('S.cash'); + desk(ev); + assert.equal(ev('__t'), 0, 'no trial: the shark does not ask the NOC'); + assert.deepEqual(ids(ev, 'biz'), ['gen', 'a', 'b'], 'all three, the one the network cannot carry too'); + assert.equal(c0 - ev('S.cash'), 12000, 'a month of each of his own deals as commission'); + ev('autoOffer=__a'); + ev('S.cash=1000'); offer(ev, 'c', { by: 'shark' }); + desk(ev); + assert.deepEqual(ids(ev, 'offers'), ['c'], 'no cash for the commission: it waits'); + assert.deepEqual(errors, []); +}); + +test('the CEO signs after a trial, and a decline is a handshake away; this week\'s and last week\'s tally in the sheet', t => { + const { ev, dom, errors } = game(t, 'ceo'); + ev('ACT.salesAuto();for(let i=0;i<5;i++)ACT.salesMin()'); + assert.equal(ev('S.slAuto.min'), 50000); + ev('window.__r=0;window.__r0=Math.random;Math.random=()=>{__r++;return __r0();}'); + ev("for(let i=0;i<60;i++)S.offers.push({id:'d'+i,city:'fra',name:'Deal '+i,type:'dia',bw:1,rate:600,reqs:[],exp:60})"); + desk(ev); + ev('Math.random=__r0'); + assert.equal(ev('__r'), 0, 'hashes, not the game\'s random stream'); + const y = ev('S.slAuto.wk.y'); + assert.equal(ev('S.offers.length'), 0, 'every tiny one declined'); + assert.ok(y >= 10 && y <= 30, `about one in three already shaken on (${y} of 60)`); + assert.equal(ev("S.biz.filter(b=>b.by==='ceo').length"), y); + const w = ev('S.slAuto.wk.w'); + ev('S.day=(S.slAuto.wk.w+1)*7'); desk(ev); + assert.equal(ev('S.slAuto.rep.w'), w, 'a new week: last week is the report'); + assert.match(ev('S.log[0].t'), new RegExp(`^Sales desk Last week the CEO declined 60 tiny offers, signed ${y} of those anyway\\.$`)); + ev('S.slAuto.min=0'); offer(ev, 'fit'); + desk(ev); + assert.ok(ids(ev, 'biz').includes('fit'), 'and signs what fits'); + dom.window.innerWidth = 360; ev('ACT.salesOpen()'); + const card = dom.window.document.getElementById('modalCard'); + assert.equal(card.querySelectorAll('.sl-auto .ops-rep').length, 2, 'last week, and this week so far'); + assert.match(card.querySelector('.sl-auto').textContent, /This week the CEO signed a customer \(\+\$6\.0k\/mo\)\./); + ev("UI.left='deals';renderLeft()"); + assert.match(dom.window.document.getElementById('left').textContent, /This week the CEO signed a customer/, 'and on the desk\'s card in Deals'); + assert.deepEqual(errors, []); +}); + +test('the sales sheet with signing for you works at 360 px in every language', t => { + for (const lang of ['en', 'de', 'es', 'fr', 'it', 'pt']) { + const h = load(lang === 'en' ? {} : { lang }); + const { ev, dom, errors } = h; + ev(BASE); dom.window.innerWidth = 360; + const doc = dom.window.document; + ev("ACT.phoneTab({t:'deals'})"); + doc.querySelector('#leftBody [data-act="salesOpen"]').click(); + doc.querySelector('#modalCard [data-act="salesHire"][data-args*="eng"]').click(); + doc.querySelector('#modalCard [data-act="salesAuto"]').click(); + assert.equal(doc.querySelector('#modalCard [data-act="salesAuto"]').getAttribute('aria-pressed'), 'true', lang); + doc.querySelector('#modalCard [data-act="salesMin"]').click(); + assert.equal(ev('S.slAuto.min'), 2000, lang); + assert.doesNotMatch(doc.getElementById('modalCard').textContent, /\b(sales|ops)\.[a-z_]+/, lang); + assert.deepEqual(errors, [], lang); + dom.window.close(); + } +}); + +/* ---------- orbit ---------- */ +// A sandbox with London, New York and Frankfurt, a company, a 16-antenna dish with landing rights at each POP and a +// lasered Shortcrust at cov (1: full). +function sky(t, who, cov = 1) { + const h = load(); + t.after(() => h.dom.window.close()); + const { ev } = h; + ev("ACT.modeSet({m:'sandbox'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.nextFail=1e9;S.nextEvent=1e9;S.pieV=1;S.lvl=13;S.offers=[];S.biz=[]"); + ev("for(const c of ['lon','nyc','fra'])if(!S.pops[c])ACT.buildPop({city:c});S.links=S.links.filter(l=>0);" + + "S.links.push({id:'ln',a:'lon',b:'nyc',kind:'wave',tier:3,km:5818,sub:true,cable:'grace',cut:0,mo:1},{id:'lf',a:'lon',b:'fra',kind:'wave',tier:3,km:640,sub:false,cut:0,mo:1});for(const c of ['lon','nyc','fra'])ACT.buyTransit({city:c,net:'cog',tier:1})"); + ev("ACT.pieFound();for(const c of ['lon','nyc','fra']){ACT.pieDish({city:c});S.pie.lic[CITY[c].cc]={state:'ok',until:1e6};}for(const x of S.pie.dishes)x.ant=PIE_ANT_MAX"); + ev(`S.pie.crusts.short.cohorts=[{n:Math.ceil(CRUSTS.short.full*${cov}),day:S.day,las:true}];compute()`); + if (who) ev(`ACT.salesHire({id:'${who}'});closeModal()`); + return h; +} +// n orbit offers as the day brings them (pieSpawn on an empty table, compute kept), by whoever is at the desk. +const spawn = (ev, n = 300) => JSON.parse(ev(`(()=>{const out=[];for(let i=0;i<${n};i++){S.offers=[];const t=pieOfferTypes();if(!t.length)break;pieSpawn(pick(pieSlTypes(t)));for(const o of S.offers)out.push({t:o.type,by:o.by||null,bw:o.bw,rate:o.rate,list:BIZ_T[o.type].rate,reqs:o.reqs.slice(),city:o.city});}S.offers=[];return JSON.stringify(out);})()`)); +const avg = (l, f) => l.reduce((a, x) => a + f(x), 0) / Math.max(1, l.length); + +test('orbit offers without a salesperson are what they were: nobody\'s, list price, no promises', t => { + const { ev, errors } = sky(t); + const o = spawn(ev); + assert.ok(o.length > 200); + assert.ok(o.every(x => x.by === null && x.rate === x.list && !x.reqs.length)); + assert.deepEqual(errors, []); +}); + +test('the engineer sells orbit only where the dish has room to spare, and those customers stay', t => { + const { ev, errors } = sky(t, 'eng'); + const o = spawn(ev); + assert.ok(o.length > 200 && o.every(x => x.by === 'eng' && x.rate === x.list && !x.reqs.length)); + // Every dish nearly full: the room left fits the smallest deal, but not with the engineer's headroom. + ev("S.biz=[];window.__room=()=>{const ds=pieDishes();return ds.map(d=>d.g)};for(const c of ['lon','nyc','fra'])S.biz.push({id:'fill'+c,type:'pizza',city:c,city2:null,bw:pieDishes().find(d=>d.city===c).g-30,rate:1,reqs:[],latMax:null,route:'normal',name:'Fill '+c,mood:100,since:0,sites:null});compute()"); + assert.ok(ev("pieOfferTypes().length") > 0, 'the market still has room'); + assert.equal(spawn(ev, 50).filter(x => x.t === 'flywifi').length, 0, 'not even a 20G airline where the dish has 30G left'); + ev("S.salesBak=S.sales.p;S.sales.p=null"); + assert.ok(spawn(ev, 50).some(x => x.t === 'flywifi'), 'without them, that airline is offered'); + ev('S.sales.p=S.salesBak;delete S.salesBak'); + assert.equal(ev("salesLeaveMul({by:'eng',type:'pizza'})"), 0.5, 'their orbit customers renew like the nerds'); + assert.equal(ev("salesLeaveMul({by:'eng',type:'dia'})"), 0.75); + assert.deepEqual(errors, []); +}); + +test('the shark sells airlines and cruise lines, the biggest that fits at a quarter more, and promises a full sky', t => { + const { ev, errors } = sky(t, 'shark', 0.7); + const plain = (() => { ev("S.sales.p=null"); const x = spawn(ev); ev("S.sales.p='shark'"); return x; })(); + const o = spawn(ev); + assert.ok(o.every(x => x.by === 'shark' && x.rate === Math.round(x.list * 1.25))); + assert.ok(o.every(x => ['flywifi', 'boat', 'marsorb'].includes(x.t)), 'no pizza homes while bigger fish are around'); + const size = l => avg(l, x => x.bw * x.rate); + assert.ok(size(o) > size(plain) * 1.5, `bigger deals (${Math.round(size(o))} vs ${Math.round(size(plain))} a month)`); + const over = o.filter(x => x.reqs.includes('skyfull')).length / o.length; + assert.ok(over > 0.35 && over < 0.65, `half of them promised a full sky at 70% (${Math.round(over * 100)}%)`); + // Signing one pays the commission; the promise makes them grumble, never cancel, until the sky is full. + ev("S.offers=[];for(let i=0;i<50&&!S.offers.some(o=>o.reqs.includes('skyfull'));i++){S.offers=[];pieSpawn('boat');}"); + const r = JSON.parse(ev("(()=>{const o=S.offers[0],c=S.cash;ACT.accept({id:o.id});const b=S.biz.find(b=>b.id===o.id);return JSON.stringify({paid:c-S.cash,mo:b.bw*b.rate,by:b.by});})()")); + assert.equal(r.by, 'shark'); + assert.equal(r.paid, r.mo, 'a month of the deal as commission'); + // One the sky serves in full (a full dish is the shark's other way to oversell), promised more than it has. + ev("S.biz=[{id:'cruise',type:'boat',city:'lon',city2:null,bw:50,rate:34375,reqs:['skyfull'],latMax:null,route:'normal',name:'Promised Cruises',mood:100,since:-100,sites:null,by:'shark'}];compute()"); + assert.ok(ev("bizSf(S.biz[0])") >= 0.95, 'served in full'); + ev("const b=S.biz[0];window.__m=[];for(let i=0;i<80;i++){dayTick();__m.push(Math.round(b.mood));}"); + const m = JSON.parse(ev('JSON.stringify(__m)')); + assert.ok(ev('S.biz.length') === 1 && m.at(-1) === ev('PIE_GRUMBLE'), `grumbles down to ${ev('PIE_GRUMBLE')} and stays (${m.slice(0, 5)}…${m.at(-1)})`); + ev("S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:true}];compute();for(let i=0;i<10;i++)dayTick()"); + assert.ok(ev('S.biz[0].mood') > m.at(-1), 'a full sky keeps the promise: happier again'); + assert.deepEqual(errors, []); +}); + +test('the CEO and the Founder sign a big orbit deal on the golf course at 30% off; jumpy markets cost him', t => { + const { ev, errors } = sky(t, 'ceo', 0.8); + const golfDay = ev("(()=>{for(let d=S.day+1;d{__r++;return __r0();}'); + ev(`S.day=${golfDay};salesGolf(S.day)`); + ev('Math.random=__r0'); + assert.equal(ev('__r'), 0, 'no draws from the game\'s random stream'); + const b = JSON.parse(ev("JSON.stringify(S.biz.at(-1))")); + assert.equal(b.type, 'marsorb', 'the Mars mission first'); + assert.equal(b.by, 'ceo'); + assert.equal(b.rate, Math.round(ev('BIZ_T.marsorb.rate') * 0.7), '30% off list'); + assert.deepEqual(b.reqs, ['skyfull'], 'with a promise nobody checked (the crust is at 80%)'); + assert.match(ev('S.log[0].t'), /The CEO and the Founder signed .+ on the golf course: .+ in orbit over .+, 30% off list\. He also promised: Promised a full sky/); + // Jitters: his own orbit offers get cheaper, a golf deal too, and from 0.6 the Founder does not show up. + ev('S.pie.founder.jit=0.5'); + const o = spawn(ev, 50); + assert.ok(o.every(x => x.by === 'ceo' && x.rate === Math.round(x.list * 0.8)), 'orbit prices 20% down at jitters 0.5'); + const n = ev('S.biz.length'); + ev(`salesGolf(${golfDay})`); + assert.equal(ev('S.biz.length'), n + 1); + assert.equal(ev('S.biz.at(-1).rate'), Math.round(ev(`BIZ_T.${ev('S.biz.at(-1).type')}.rate`) * 0.7 * 0.8), 'and the golf deal too'); + ev('S.pie.founder.jit=0.7'); + ev(`salesGolf(${golfDay})`); + assert.equal(ev('S.biz.length'), n + 1, 'the Founder skipped golf'); + assert.match(ev('S.log[0].t'), /The Founder skipped golf/); + // A golf day of the other kind is on the ground, as before. + const ground = ev("(()=>{for(let d=S.day+1;d=PIE_GOLF_SKY)return d;})()"); + ev(`salesGolf(${ground})`); + assert.equal(ev('BIZ_T[S.biz.at(-1).type].orbit'), undefined, 'on the ground'); + assert.deepEqual(errors, []); +}); + +test('the sales desk signs orbit offers where the dish has room, without a routing trial', t => { + const { ev, errors } = sky(t, 'eng'); + ev('ACT.salesAuto()'); + ev("S.offers=[];pieSpawn('pizza');pieSpawn('boat')"); + const want = ids(ev, 'offers'); + ev("window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); + ev('slAutoDay(S.day);autoOffer=__a'); + assert.equal(ev('__t'), 0); + assert.deepEqual(ids(ev, 'biz'), want, 'both signed in one day'); + assert.ok(ev("S.biz.every(b=>b.by==='eng')")); + // A full dish: an offer that does not fit waits. + ev("S.offers=[{id:'big',city:'lon',city2:null,name:'Big Boat',type:'boat',bw:1e5,rate:27500,reqs:[],exp:S.day+40,by:'eng'}];slAutoDay(S.day)"); + assert.deepEqual(ids(ev, 'offers'), ['big']); + assert.deepEqual(errors, []); +}); diff --git a/tests/sales-trial.test.js b/tests/sales-trial.test.js index 4b4e464..c74ef9f 100644 --- a/tests/sales-trial.test.js +++ b/tests/sales-trial.test.js @@ -5,7 +5,7 @@ const path = require('node:path'); const { load } = require('./harness'); const { lit } = require('../scripts/lib/js-literal'); -// The sales trial (#185, the intern's sales order) runs the pass with the offer first and skips the pass without +// The sales trial (#185, now the sales desk's signing for you) runs the pass with the offer first and skips the pass without // it when it cannot change the answer. It must sign exactly the offers the original two-pass trial signs. const ORIGINAL = `(function(o){if(!o||!own(BIZ_T,o.type)||!(o.exp>S.day)||!(o.bw>0)||o.rate<0||!bCities(o).length||!bCities(o).every(popUp)||!reqOk(o))return null; const T=BIZ_T[o.type],b=offerCustomer(o);if(T.event&&(!(o.start>S.day)||!(o.dur>0)))return null; diff --git a/tests/standing-orders.test.js b/tests/standing-orders.test.js index 1e7e99f..d5ed72a 100644 --- a/tests/standing-orders.test.js +++ b/tests/standing-orders.test.js @@ -141,18 +141,6 @@ test('PNI: weekly, big enough networks only, paid peering left out by default, a assert.deepEqual(errors, []); }); -test('sales: decline offers below the minimum, sign the ready ones with #185\'s trial', t => { - const { ev, errors } = game(t); - hire(ev); on(ev, 'sales', { acc: true, min: 5000 }); - ev('S.transit[0].tier=3;S.pops.fra.rgen=3;compute()'); - ev("S.offers=[{id:'tiny',city:'fra',name:'Tiny',type:'dia',bw:1,rate:600,reqs:[],exp:30},{id:'big',city:'fra',name:'Big',type:'dia',bw:10,rate:600,reqs:[],exp:30},{id:'gen',city:'fra',name:'Gen',type:'dia',bw:10,rate:600,reqs:['gen'],exp:30}]"); - shift(ev); - assert.deepEqual(JSON.parse(ev('JSON.stringify(S.biz.map(b=>b.id))')), ['big']); - assert.deepEqual(JSON.parse(ev('JSON.stringify(S.offers.map(o=>o.id))')), ['gen'], 'unmet requirements wait, the tiny one is gone'); - assert.match(ev('opsEntry(S.ops.log[0])'), /declined a tiny offer, signed a customer/); - assert.deepEqual(errors, []); -}); - test('repairs: rush what has a price, as the Rush repair button would', t => { twins(t, "S.links=[{id:'f',a:'fra',b:'ams',kind:'df',sys:'lite',ch:['zr4'],km:450,sub:false,ready:0,cut:0,eqDown:10,mo:1}];S.inc=[{id:'amp',type:'amp',ref:'f',until:10,cost:3000,msg:'amp'}];S.pops.ams={day:0,bb:null,boost:0,down:0,routers:1,gen:false}", ev => on(ev, 'repair'), "ACT.fixInc({id:'amp'})", 'S.inc.length'); @@ -235,26 +223,27 @@ test('the shift runs inside dayTick, respects a stopped clock, batches its work test('the NOC gets one notice a week, the shift report; the daily lines stay in the Ops sheet', t => { const { ev, errors } = game(t, "S.transit[0].hist=[600]"); ev('S.day=14'); - hire(ev); on(ev, 'transit', { x: 1.5 }); on(ev, 'sales', { acc: true, min: 5000 }); + hire(ev); on(ev, 'transit', { x: 1.5 }); ev('S.transit[0].tier=3;S.pops.fra.rgen=3;compute()'); const n0 = ev('S.log.length'); for (let d = 14; d < 21; d++) { - if (d === 15) ev("S.offers=[{id:'tiny',city:'fra',name:'Tiny',type:'dia',bw:1,rate:600,reqs:[],exp:60},{id:'big',city:'fra',name:'Big',type:'dia',bw:10,rate:600,reqs:[],exp:60}]"); + if (d === 15) ev('S.transit[0].hist=[6000]'); ev(`S.day=${d}`); shift(ev); } assert.equal(ev('S.log.length'), n0, 'a whole week of shifts: no NOC notice yet'); assert.ok(ev('S.ops.log.length') >= 2, 'the Ops sheet has the daily detail'); ev('S.day=21'); shift(ev); assert.equal(ev('S.log.length'), n0 + 1, 'one notice for the week'); - assert.match(ev('S.log[0].t'), /^Kevin's week Kevin signed a customer \(\+\$6\.0k\/mo\), topped up transit .*declined a tiny offer.*Week total: \$[\d.]+k up front, \+\$[\d.]+k\/mo\./); - assert.equal(ev('S.log[0].k'), 'good'); + assert.match(ev('S.log[0].t'), /^Kevin's week Kevin topped up transit .*Week total: \$[\d.]+k up front, \+\$[\d.]+k\/mo\./); + assert.doesNotMatch(ev('S.log[0].t'), /signed|declined/, 'deals are the sales desk\'s, not the intern\'s'); ev('S.day=22'); shift(ev); assert.equal(ev('S.log.length'), n0 + 1, 'and nothing more until the next week ends'); - // Only the sales order now: one tiny offer declined on day 23, reported when the week ends. - ev("for(const k in S.ops.on)S.ops.on[k]=false;S.ops.on.sales=true;S.offers=[{id:'t2',city:'fra',name:'T2',type:'dia',bw:1,rate:600,reqs:[],exp:60}];S.day=23");shift(ev); - ev("S.day=28");shift(ev); + // A week that only stopped at the budget, on day 23, reported when the week ends. + ev("S.ops.cap.transit=10000;S.ops.spent.transit=10000;S.ops.p.transit={x:3};S.day=23");shift(ev); + // A minute later in real time, so this one does not fold into last week's (both are plain notices now). + ev("S.log[0].at-=60000;for(const k in S.ops.on)S.ops.on[k]=false;S.day=28");shift(ev); assert.equal(ev('S.log.length'), n0 + 2); - assert.match(ev('S.log[0].t'), /declined a tiny offer\.$/, 'nothing spent: no money line'); + assert.match(ev('S.log[0].t'), /stopped at the budget for .*Keep transit headroom\)?\.$/, 'nothing spent: no money line'); assert.equal(ev('S.log[0].k'), ''); ev("S.day=35");shift(ev); assert.equal(ev('S.log.length'), n0 + 2, 'an idle week: no notice'); @@ -288,9 +277,7 @@ test('the mood follows the week, with no dice', t => { const quiet = ev('opsMood()'); assert.equal(ev('opsMood()'), quiet, 'the same day reads the same'); assert.ok([ev("tr('ops.mood_quiet',{name:'Kevin'})"), ev("tr('ops.mood_kevin')")].includes(quiet)); - ev("S.ops.wk=opsWkNew(Math.floor(S.day/7));S.ops.wk.n.sales=1"); - assert.equal(ev('opsMood()'), ev("tr('ops.mood_sales',{name:'Kevin'})")); - ev("S.ops.wk.n.broke=1;delete S.ops.wk.n.sales"); + ev("S.ops.wk=opsWkNew(Math.floor(S.day/7));S.ops.wk.n.broke=1"); assert.equal(ev('opsMood()'), ev("tr('ops.mood_broke',{name:'Kevin'})")); assert.deepEqual(errors, []); }); @@ -346,8 +333,8 @@ test('saves: old saves load with no intern and everything off, settings survive assert.equal(ev("JSON.stringify(S.ops.skip)"), '{"fra":["transit"]}'); assert.equal(ev("JSON.stringify(S.ops.log)"), '[{"d":1,"i":"kevin","r":[["transit",2,["fra +1×100G"]]]}]'); assert.equal(ev('S.ops.floor===50000&&S.ops.tpl.bb===true'), true); - ev(`S.ops.wk={w:3,i:'kevin',n:{sales:2,evil:9,transit:'x'},wh:{transit:['fra +1×100G','']},up:-5,mo:'a',rev:41000,ff:99};S.ops.rep={i:'mallory'};S=migrate(S)`); - assert.equal(ev("JSON.stringify(S.ops.wk)"), '{"w":3,"i":"kevin","n":{"sales":2},"wh":{"transit":["fra +1×100G"]},"up":0,"mo":0,"rev":41000,"ff":7}'); + ev(`S.ops.wk={w:3,i:'kevin',n:{sales:2,evil:9,transit:'x',repair:2},wh:{transit:['fra +1×100G','']},up:-5,mo:'a',rev:41000,ff:99};S.ops.rep={i:'mallory'};S=migrate(S)`); + assert.equal(ev("JSON.stringify(S.ops.wk)"), '{"w":3,"i":"kevin","n":{"repair":2},"wh":{"transit":["fra +1×100G"]},"up":0,"mo":0,"ff":7}', 'the retired sales order\'s tally goes'); assert.equal(ev('S.ops.rep'), null); assert.deepEqual(errors, []); }); @@ -381,22 +368,6 @@ test('the Ops sheet works at 360 px in every language, from the NOC tab and the } }); -test('sales trial at most one offer a shift, and an offer that did not fit waits a week', t => { - const { ev, errors } = game(t); - hire(ev); on(ev, 'sales', { acc: true, min: 0 }); - ev("S.offers=['a','b','c'].map(id=>({id,city:'fra',name:id,type:'dia',bw:1e5,rate:600,reqs:[],exp:60}));window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); - shift(ev); - assert.equal(ev('__t'), 1, 'one routing trial per shift'); - for (let i = 0; i < 2; i++) { ev('S.day++'); shift(ev); } - assert.equal(ev('__t'), 3, 'each offer once'); - ev('S.day++'); shift(ev); - assert.equal(ev('__t'), 3, 'too big for the network: not tried again within the week'); - ev('S.day+=7'); shift(ev); - assert.equal(ev('__t'), 4); - ev('autoOffer=__a'); - assert.deepEqual(errors, []); -}); - test('re-hiring in a later month starts on a fresh budget, not last month\'s spending', t => { const { ev, errors } = game(t); hire(ev); @@ -452,11 +423,11 @@ test('decommission keeps its spare in another trench than the big link', t => { assert.deepEqual(errors, []); }); -test('decommission sees the traffic of a customer signed earlier in the same shift', t => { +test('decommission sees the traffic of a customer the sales desk signed the same day', t => { const { ev, errors } = game(t, "S.pops.fra.bb.d=30;ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;for(const [id,tier,tr] of [['big',2,'T1'],['s1',1,'T2'],['s2',1,'T3']])S.links.push({id,a:'fra',b:'ams',kind:'wave',tier,km:400,sub:false,cut:0,mo:1000,trench:tr});compute()"); - hire(ev); on(ev, 'sales', { acc: true, min: 0 }); on(ev, 'decom', { keep: false }); - ev("S.offers=[{id:'o1',city:'fra',city2:'ams',name:'Bulk Co',type:'l2vpn',bw:450,rate:20,reqs:[],exp:S.day+20}]"); - shift(ev); + hire(ev); on(ev, 'decom', { keep: false }); + ev("ACT.salesHire({id:'eng'});S.slAuto.on=true;closeModal();S.offers=[{id:'o1',city:'fra',city2:'ams',name:'Bulk Co',type:'l2vpn',bw:450,rate:20,reqs:[],exp:S.day+20}]"); + ev('slAutoDay(S.day)'); shift(ev); assert.deepEqual(JSON.parse(ev('JSON.stringify(S.biz.map(b=>b.id))')).length, 1, 'signed'); assert.equal(ev('S.links.length'), 3, 'its 450G needs every wave, so none goes'); ev('compute()'); @@ -464,13 +435,13 @@ test('decommission sees the traffic of a customer signed earlier in the same shi assert.deepEqual(errors, []); }); -test('no recompute on a shift that only declined offers or stopped at a budget', t => { +test('no recompute on a shift that only stopped at a budget', t => { const { ev, errors } = game(t); - hire(ev); on(ev, 'sales', { acc: false, min: 50000 }); on(ev, 'transit', { x: 3 }, 10000); - ev("S.ops.spent.transit=10000;S.transit[0].hist=[600];S.offers=[{id:'tiny',city:'fra',name:'Tiny',type:'dia',bw:1,rate:600,reqs:[],exp:30}]"); + hire(ev); on(ev, 'transit', { x: 3 }, 10000); + ev("S.ops.spent.transit=10000;S.transit[0].hist=[600]"); const n = ev("window.__c=compute;window.__n=0;compute=()=>{__n++;return __c()};opsDay(S.day);compute=__c;__n"); assert.equal(n, 0, 'nothing in the network changed'); - assert.match(ev('opsEntry(S.ops.log[0])'), /declined a tiny offer, stopped at the budget/); + assert.match(ev('opsEntry(S.ops.log[0])'), /stopped at the budget/); ev("S.ops.spent.transit=0"); assert.equal(ev("window.__n=0;compute=()=>{__n++;return __c()};opsDay(S.day);compute=__c;__n"), 1, 'a real job still recomputes once'); assert.deepEqual(errors, []); @@ -567,8 +538,8 @@ test('transit: the log line and budget line show the monthly cost a top-up adds' test('#226 the shift report\'s Open button in the NOC opens the Ops sheet, and survives a reload', t => { const { ev, errors, dom } = game(t); - ev('S.day=14'); hire(ev); on(ev, 'sales', { acc: false, min: 5000 }); - ev("S.offers=[{id:'t',city:'fra',name:'T',type:'dia',bw:1,rate:600,reqs:[],exp:60}];S.day=15"); shift(ev); + ev('S.day=14'); hire(ev); on(ev, 'transit', { x: 3 }, 10000); + ev("S.ops.spent.transit=10000;S.transit[0].hist=[600];S.day=15"); shift(ev); ev('S.day=21'); shift(ev); assert.match(ev('S.log[0].t'), /^Kevin's week/); ev("S=migrate(JSON.parse(JSON.stringify(S)));closeModal();ACT.leftTab({t:'noc'})");