From 7c8fa68659ad53cb52701684c0de9733e45bee53 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Wed, 28 Oct 2026 17:40:22 +0100 Subject: [PATCH 1/6] Standing orders: a NOC intern runs the player's orders once a day (#98) --- src/game/60-features/80-new-game.js | 2 +- src/game/60-features/90-automation.js | 23 +-- src/game/60-features/95-standing-orders.js | 157 ++++++++++++++++++++ src/game/80-simulation/30-compute.js | 2 +- src/game/80-simulation/50-sanitize.js | 2 +- src/game/88-days/10-day-tick.js | 1 + src/game/90-actions/50-customers.js | 3 +- src/game/90-actions/88-ops.js | 25 ++++ src/game/90-actions/89-game-and-settings.js | 2 +- src/game/90-actions/90-action-helpers.js | 2 +- src/game/93-ui/40-hud-and-panels.js | 5 +- src/game/93-ui/50-city-panel.js | 2 +- src/game/93-ui/57-ops-panel.js | 40 +++++ src/game/93-ui/70-link-panels.js | 4 +- src/game/94-dashboard/60-dashboard.js | 2 +- src/game/99-loop.js | 1 - src/i18n/en.js | 106 ++++++++++++- src/styles/36-ops.css | 13 ++ 18 files changed, 351 insertions(+), 41 deletions(-) create mode 100644 src/game/60-features/95-standing-orders.js create mode 100644 src/game/90-actions/88-ops.js create mode 100644 src/game/93-ui/57-ops-panel.js create mode 100644 src/styles/36-ops.css diff --git a/src/game/60-features/80-new-game.js b/src/game/60-features/80-new-game.js index 3dd1e86..e4c178c 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:3,auV:1,autoSales:false,autoRepair:false,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:3,auV:1,ops:opsNew(),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:[],ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},cnLic:{state:'none'},scrubs:[],scrubMode:'always',capDeal:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,inbox:{items:[],down:{},tiny:{},rep:0,bot:false,log:[],seq:0},hw:{},rules:makeRules('oncall')}; } diff --git a/src/game/60-features/90-automation.js b/src/game/60-features/90-automation.js index 8a2b0e8..aa4a274 100644 --- a/src/game/60-features/90-automation.js +++ b/src/game/60-features/90-automation.js @@ -1,17 +1,5 @@ -/* Optional operators use the same sales and repair actions as the player. */ -const AUTO_SALES_MS=5000; -function autoSalesSeconds(now=performance.now()){if(!S||!S.autoSales)return null; - const left=UI.autoGame===S&&autoActive()?AUTO_SALES_MS-(now-UI.autoSalesAt):AUTO_SALES_MS; - return Math.max(1,Math.min(AUTO_SALES_MS/1000,Math.ceil(left/1000)));} -function autoCountdownReady(o){if(!S||!S.autoSales||!o||!(o.exp>S.day)||!bCities(o).every(popUp)||!reqOk(o))return false; - const inc=S.inc.map(i=>i.id).join('|');let c=UI.autoReady; - // Share capacity trials between views and keep them until the next check, action or incident. - if(!c||c.s!==S||c.at!==UI.autoSalesAt||c.inc!==inc||c.event!==S.nextEvent)c=UI.autoReady={s:S,at:UI.autoSalesAt,inc,event:S.nextEvent,offers:new Map()}; - if(!c.offers.has(o))c.offers.set(o,!!autoOffer(o));return c.offers.get(o);} -function autoAcceptLabel(o){return tr('common.accept')+(S.autoSales?` ${autoCountdownReady(o)?`(${autoSalesSeconds()})`:''}`:'');} -function renderAutoCountdown(now=performance.now()){const n=autoSalesSeconds(now);if(UI.autoCount===n&&UI.autoCountResult===R)return;UI.autoCount=n;UI.autoCountResult=R; - const offers=new Map((S?S.offers:[]).map(o=>[o.id,o])); - for(const el of document.querySelectorAll('[data-auto-sales]'))el.textContent=n!==null&&autoCountdownReady(offers.get(el.dataset.autoSales))?`(${n})`:'';} +/* The sales engine of #185: would this offer work if signed now? The intern's sales order runs it once a day. + 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; const T=BIZ_T[o.type],b=offerCustomer(o);if(T.event&&(!(o.start>S.day)||!(o.dur>0)))return null; @@ -27,10 +15,3 @@ function autoOffer(o){if(!o||!own(BIZ_T,o.type)||!(o.exp>S.day)||!(o.bw>0)||o.ra const healthy=S.biz.filter(x=>!bizWhy(x).length);if(T.event)b.start=S.day;if(T.cap)b.live=true;S.biz=S.biz.concat(b);compute(); return !bizWhy(b).length&&healthy.every(x=>!bizWhy(x).length)?b:null; }finally{S=state;R=result;UI.hotMap=hot;b.start=o.start;if(T.cap)delete b.live;}} -function autoActive(){return !!(S&&UI.started&&!S.lost&&UI.speed&&$('modal').hidden&&document.visibilityState==='visible');} -function automationTick(now){if(UI.autoGame!==S){UI.autoGame=S;UI.autoSalesAt=now;} - if(!autoActive()){UI.autoSalesAt=now;return;} - if(S.autoRepair&&S.inc.length){purgeInc();for(const i of S.inc.slice()){if(!autoActive())break; - if(i.type!=='ddos'&&i.until>S.day&&i.cost>0&&i.cost<=S.cash&&!(i.slow&&i.rushed))ACT.fixInc({id:i.id});}} - if(!S.autoSales||!autoActive()){UI.autoSalesAt=now;return;}if(now-UI.autoSalesAtv+'×'},prov:{d:'cheap',ok:v=>v==='cheap'||(isNet(v)&&!!NET[v].price),l:N_('ops.p_prov')}}}, + {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,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:'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+'%'}}}, + {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')}}}, +]; +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'),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')}; +// 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_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:{},mon:0,skip:{},log:[],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)); +const opsCanHire=()=>lvl()>=2; +const opsName=(long)=>{const I=INTERNS[S.ops.intern];return I?tr(long?I.n:I.s):'';}; +function opsP(k,p){const P=OPSK[k].p[p],v=S.ops.p[k]&&S.ops.p[k][p];return v!==undefined&&(P.ok?P.ok(v):P.v.includes(v))?v:P.d;} +function opsCap(k){const c=S.ops.cap[k];return OPS_CAPS.includes(c)?c:OPSK[k].cap||0;} +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. Old saves get no intern, +// and the two #185 toggles (auto-accept, auto-pay repairs) become the sales and repair orders. +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; + const on=ob(o.on),p=ob(o.p),cap=ob(o.cap),sp=ob(o.spent); + for(const d of OPS){const k=d.k;n.on[k]=on[k]===true;const q=ob(p[k]),r={}; + for(const pk of Object.keys(d.p)){const P=d.p[pk];if(own(q,pk)&&(P.ok?P.ok(q[pk]):P.v.includes(q[pk])))r[pk]=q[pk];}n.p[k]=r; + if(d.cap&&OPS_CAPS.includes(cap[k]))n.cap[k]=cap[k];if(d.cap)n.spent[k]=Math.max(0,num(sp[k],0));} + {const t=ob(o.tpl);for(const k of OPS_TPL)if(typeof t[k]==='boolean')n.tpl[k]=t[k];} + {const sk=ob(o.skip);for(const c of Object.keys(sk))if(isCity(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); + if(s.autoSales===true)n.on.sales=true;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}. +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):[]; + const f=Number.isInteger(e.f)&&OPS_FF[e.f]?e.f:undefined;return {d:int(e.d,0,1e7,0),i:e.i,r,...(f!==undefined&&isCity(e.c)?{f,c:e.c}:{})};} +// "fra +1×100G", "fra|ams", "ams~3", "transit" (an order, for the budget line) or "ggl" (a network). +function opsWhere(w){const [a,x]=w.split(' '),nm=a.split('|').map(p=>own(OPSK,p)?tr(OPSK[p].t):isCity(p)?CITY[p].name:isNet(p)?NET[p].name:ixName(p)).join('–');return x?nm+' '+(isNet(x)?NET[x].name:x):nm;} +function opsLine(e){const I=INTERNS[e.i],name=I?tr(I.s):'',parts=e.r.map(([k,n,w])=>trn(OPS_SAY[k],n,{where:w.map(opsWhere).join(', ')})); + return parts.length?tr('ops.l_line',{name,list:parts.join(', ')}):tr('ops.l_quiet',{name});} +const opsFFLine=e=>tr('ops.ff_line',{name:tr(INTERNS[e.i].s),what:tr(OPS_FF[e.f],{city:CITY[e.c].name})}); +// Mute what a click would show (toasts, sounds, floaters, the full redraw) and keep the player's selection. +function opsQuiet(fn){const a=after,t=toast,s=sfx,f=floater,sel=UI.sel,cf=UI.confirm,tab=UI.tab;after=()=>{};toast=()=>{};sfx=()=>{};floater=()=>{}; + 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. +function opsShift(){const r=new Map(),broke=new Set(); + return {r,broke,did(k,w){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);}, + can(k,cost){const O=S.ops,cap=opsCap(k);if(cost<=0)return true;if(S.cash-costcap)){broke.add(k);return false;}return true;}, + // Run a click and book what it really cost; false when the action refused (no ports, no cash, a quote changed). + pay(k,fn){const c0=S.cash,x=fn();const d=c0-S.cash;if(d>0&&OPSK[k].cap)S.ops.spent[k]+=d;return x===undefined?d>0:x;}};} +const cheapestTransit=c=>NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>transitPerG(a,c,premOnlyAt(a,c))-transitPerG(b,c,premOnlyAt(b,c)))[0]; +// 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'); + 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;} + if(acc){ACT.accept({id:o.id,auto:true});if(!S.offers.includes(o)){X.did('sales');compute();}}}}, + 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=0&&RG[nx].lvl<=lvl()&&!modelFits(c,nx)&&(rt>1||popIdle(c)),add=rt=4||!add);if(!doSwap&&(how==='swap'||!add))continue; + const cost=doSwap?swapCost(c,nx):routerCost(g,rt);if(!X.can('routers',cost))continue; + if(X.pay('routers',()=>doSwap?ACT.upRouter({city:c,g:nx}):ACT.addRouter({city:c})))X.did('routers',c+(doSwap?' ⇧'+RG[nx].pn:' +1'));}}, + transit(X){if(scnRule('noTransit'))return;const N=opsP('transit','x'),pv=opsP('transit','prov'); + for(const c of opsPops('transit')){let ts=S.transit.filter(t=>t.city===c);if(!ts.length)continue; + // Thirty days of 95th-percentile-ish history per port; their peaks summed is a safe (high) estimate of the POP's peak. + const peak=ts.reduce((a,t)=>a+(t.hist||[]).reduce((m,v)=>Math.max(m,v),0),0);if(!(peak>0))continue; + const n=pv!=='cheap'&&sellsAt(NET[pv],c)?NET[pv]:cheapestTransit(c);if(!n)continue; + for(let step=0;step<4;step++){const cap=ts.reduce((a,t)=>a+lagCap(PORT[t.tier].g,t.n),0);if(cap>=N*peak)break; + const t=ts.find(x=>x.net===n.id);let job=null; + if(t){const k=t.n||1,up=t.tier+1; + if(k<4&&portOk(c,t.tier))job={cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n}; + else if(PORT[up]&&portShown(up)&&portOk(c,up))job={cost:PORT[up].setup*k,go:()=>ACT.buyTransit({city:c,net:n.id,tier:up}),w:PORT[t.tier].n+'→'+PORT[up].n}; + else if(kACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};} + else{const need=N*peak-cap,ok=PORT.map((P,i)=>i).filter(i=>portShown(i)&&portOk(c,i)),i=ok.find(i=>PORT[i].g>=need)??ok.at(-1); + if(i!==undefined)job={cost:PORT[i].setup,go:()=>ACT.buyTransit({city:c,net:n.id,tier:i}),w:'+'+PORT[i].n};} + if(!job||!X.can('transit',job.cost)||!X.pay('transit',job.go))break; + X.did('transit',c+' '+job.w);ts=S.transit.filter(t=>t.city===c);}}}, + optics(X){const at=opsP('optics','at')/100; + for(const l of S.links){if(l.kind!=='df'||l.ready>S.day||l.eqDown>S.day||l.standby||l.cut>S.day)continue; + let cap=dfCap(l);const load=(R.load&&R.load[l.id])||0; + // New fiber gets its first channel; lit fiber gets more while it runs hot. + for(let step=0;step<8&&(cap<=0?!(l.ch||[]).length:load>=cap*at);step++){if(chMax(l)-(l.ch||[]).length-soldSlots(l)<=0)break; + const cnt={};for(const k of l.ch||[])cnt[k]=(cnt[k]||0)+1; + // More of what is already lit, or else the most Gbps per dollar that reaches. + const fit=Object.keys(OPT).filter(o=>!chWhy(l,o)),o=fit.filter(o=>cnt[o]).sort((a,b)=>cnt[b]-cnt[a])[0]||fit.sort((a,b)=>optG(b,l)/optCost(b)-optG(a,l)/optCost(a))[0];if(!o)break; + const n=(cnt[o]||0)+1,cost=opticCountCost(l,o,n),before=(l.ch||[]).length;if(!X.can('optics',cost))break; + X.pay('optics',()=>{ACT.setChCount({id:l.id,o,n});return (l.ch||[]).length>before;});if((l.ch||[]).length<=before)break; + cap+=optG(o,l);X.did('optics',l.a+'|'+l.b);}}}, + caches(X){const g=opsP('caches','g'); + for(const c of opsPops('caches')){const q=utilityCaches(c);if(!q||!q.add.length)continue; + const want=q.add.filter(x=>(R.cityDem[c]||0)*(NSH[x.net]||0)>=g),free=Math.floor(portsMax(c)-portsUsed(c)+1e-9); + for(const x of want.slice(0,Math.max(0,free))){S.caches.push({id:uid(),city:c,net:x.net,site:x.site});X.did('caches',c);}}}, + // Weekly, like a person going through PeeringDB on a Monday: route servers, then every willing member (#192). + ix(X){if(S.day%7)return;for(const ix of utilityRouteServers()){S.rs[ix]=true;X.did('rs');} + for(const row of utilityPeers())for(const id of row.requests){S.peers[id+'@'+row.ix]=true;X.did('peer',row.ix);}}, + // Weekly too: every willing network above the threshold, at its own minimum size and lead time (#181). + pni(X){if(S.day%7!==3)return;const b=pniBatch(null,opsP('pni','tier'));if(!b)return;const g=opsP('pni','g'),paid=opsP('pni','paid'); + const loc=q=>(R.cityDem[q.city]||0)*(NSH[q.net]||0); + for(const q of b.orders.filter(q=>opsHere('pni',q.city)&&loc(q)>=g&&(paid||NET[q.net].pol!=='paid'||paidFree(NET[q.net]))).sort((a,b)=>loc(b)-loc(a))){ + if(!X.can('pni',q.cost))break;if(X.pay('pni',()=>{if(!spend(q.cost))return false;pniPlace(q);return true;}))X.did('pni',q.city+' '+q.net);}}, + // Hand back smaller waves once a bigger link between the same cities carries the pair with a quarter to spare (#102). + decom(X){const keep=opsP('decom','keep'),by=new Map();for(const l of S.links)if(l.kind!=='vxc'){const k=edgeKey(l);(by.get(k)||by.set(k,[]).get(k)).push(l);} + for(const ls of by.values()){if(ls.length<2)continue;const live=ls.filter(l=>!linkDown(l)),big=live.reduce((a,l)=>!a||capOf(l)>capOf(a)?l:a,null);if(!big)continue; + let cap=live.reduce((a,l)=>a+capOf(l),0);const load=ls.reduce((a,l)=>a+((R.load&&R.load[l.id])||0),0); + const small=live.filter(l=>l!==big&&l.kind==='wave'&&!l.standby&&!l.premium&&capOf(l)b.link===l.id)).sort((a,b)=>capOf(b)-capOf(a)); + if(keep)small.shift(); + for(const l of small.reverse()){if(cap-capOf(l)(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','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=Math.floor(d/30);if(m!==O.mon){O.mon=m;for(const k in O.spent)O.spent[k]=0;} + const X=opsShift(),cash=S.cash; + opsQuiet(()=>{for(const k of OPS_ORDER)if(O.on[k])OPS_RUN[k](X);}); + const e={d,i:O.intern,r:[]};for(const [k,x] of X.r)e.r.push([k,x.n,x.w]);if(X.broke.size)e.r.push(['broke',X.broke.size,[...X.broke]]); + // Very rarely, and never under Change Freeze, the intern fat-fingers something harmless. + const ff=OPS_FF_RATE[rulePreset()];if(ff&&Object.keys(S.pops).length&&Math.random()t.city===c&&(t.n||1)X.pay('transit',()=>ACT.lagT({id:t.id,d:1}))))f=0;} + e.f=f;e.c=c;toast(esc(opsFFLine(e)),'',[{l:tr('ops.ops'),act:'opsOpen',args:{}}]);} + if(e.r.length||e.f!==undefined){compute();O.log.unshift(e);O.log.length=Math.min(O.log.length,OPS_LOG);} + if(e.r.length)logNote(`${esc(tr('ops.shift',{name:opsName()}))} ${esc(opsLine(e))}`,cash>S.cash?'':'good',[],{a:'tab',v:'noc'});} +// 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'));} + if(T.transit&&!scnRule('noTransit')){const pv=opsP('transit','prov');net=pv!=='cheap'&&sellsAt(NET[pv],c)?NET[pv]:cheapestTransit(c);if(net){cost+=PORT[0].setup;parts.push(tr('ops.tpl_transit'));}} + // DE-KICKS wants a sales call before any port, so the template leaves those to the player. + if(T.ix&&CITY[c].ix&&!isDk(c)){ix=c;cost+=ixPortMo(c,0);parts.push(tr('ops.tpl_ix'));} + if(T.kit){S.pops[c]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};try{kit=utilityKit(c);}finally{delete S.pops[c];}if(kit&&kit.cost){cost+=kit.cost;parts.push(tr('ops.tpl_kit'));}} + return {cost,net:net&&net.id,ix,kit:!!(kit&&kit.cost),parts};} diff --git a/src/game/80-simulation/30-compute.js b/src/game/80-simulation/30-compute.js index 866f634..0429a59 100644 --- a/src/game/80-simulation/30-compute.js +++ b/src/game/80-simulation/30-compute.js @@ -263,7 +263,7 @@ function compute(){ C.pni=S.pni.reduce((a,p)=>a+pniMo(p,R2.usePni[p.id]||0),0); C.caches=S.caches.length*CACHE_MO; C.loans=(S.loans||[]).reduce((a,l)=>a+(BANKS[l.bank].equity?0:l.model==='transit'?Math.round((C.transit||0)*(l.cut||0.3)):l.pay)+loanFees(l),0); - C.extras=(S.cnLic&&S.cnLic.state==='ok'?CN_JV_MO:0)+scrubMo()+Object.keys(S.pops).filter(ruCity).length*RU_BOX_MO+Object.values(S.pops).filter(p=>p.site2).length*SITE2_MO+(S.te?TE_MO:0)+(S.inbox&&S.inbox.bot?AI_MO:0); + C.extras=(S.cnLic&&S.cnLic.state==='ok'?CN_JV_MO:0)+scrubMo()+Object.keys(S.pops).filter(ruCity).length*RU_BOX_MO+Object.values(S.pops).filter(p=>p.site2).length*SITE2_MO+(S.te?TE_MO:0)+(S.inbox&&S.inbox.bot?AI_MO:0)+(S.ops&&S.ops.intern?INTERN_MO:0); V.eyeballs=0;V.business=0;V.ix=0;V.grant=grantOn(R2)?GRANT_MO:0; C.wholesale=0;C.levy=0;const lev=scnRule('levy');for(const c in S.pops){const sf=sfOf(R2,c),v=R2.cityEye[c]*sf*EYE_RATE*(CITY[c].arpu||1);V.eyeballs+=v;if(CITY[c].au){if(lev)C.levy+=v*AU_LEVY;else C.wholesale+=v*AU_WHOLESALE;}} const ids=linkIds();for(const b of S.biz){if(capPend(b))continue;const sf=BIZ_T[b.type].fiber?(fiberOk(b,ids)?1:0):BIZ_T[b.type].l2?clamp((R2.l2[b.id]||0)/b.bw,0,1):sfOf(R2,b.city);V.business+=b.bw*b.rate*Math.min(1,sf/0.95);} diff --git a/src/game/80-simulation/50-sanitize.js b/src/game/80-simulation/50-sanitize.js index 0a48b3b..8976ceb 100644 --- a/src/game/80-simulation/50-sanitize.js +++ b/src/game/80-simulation/50-sanitize.js @@ -9,7 +9,7 @@ function sanitize(s){ ['pops','ixp','rs','peers','myIx','done','ev','stats','ixn','ixPref','ixSite','confReg','ach','pairMet'].forEach(obj); s.v=1;s.name=String(s.name==null?'Packet Pals':s.name).slice(0,24);s.day=int(s.day,0,1e7,0);s.cash=num(s.cash,0);s.asn=int(s.asn,1,4294967294,200000); s.priceMul=num(s.priceMul,1);s.nextFail=num(s.nextFail,s.day+45);s.nextEvent=num(s.nextEvent,s.day+40);s.lvl=int(s.lvl,1,LEVELS.length,1);s.neg=int(s.neg,0,1e7,0);s.loanStrikes=int(s.loanStrikes,0,1e3,0); - s.autoSales=s.autoSales===true;s.autoRepair=s.autoRepair===true; + opsSanitize(s); for(const k of Object.keys(s.stats)){const v=s.stats[k];if(k==='by'||k==='f'){if(!v||typeof v!=='object')s.stats[k]={};else for(const j of Object.keys(v))v[j]=num(v[j],0);}else if(typeof v!=='boolean')s.stats[k]=num(v,0);} for(const k of ['survived','incidents','peak'])s.stats[k]=num(s.stats[k],0); for(const c of Object.keys(s.pops)){const p=s.pops[c];if(!isCity(c)||!p||typeof p!=='object'){delete s.pops[c];continue;}p.routers=int(p.routers,1,RMAX,1);if(p.rupDay!==undefined)p.rupDay=num(p.rupDay,-1);if(p.rgen!==undefined)p.rgen=int(p.rgen,0,RG.length-1,0);p.down=num(p.down,0);if(p.bb&&typeof p.bb==='object')p.bb.d=num(p.bb.d,0);else p.bb=null;} diff --git a/src/game/88-days/10-day-tick.js b/src/game/88-days/10-day-tick.js index 358220e..2630903 100644 --- a/src/game/88-days/10-day-tick.js +++ b/src/game/88-days/10-day-tick.js @@ -65,6 +65,7 @@ function dayTick(){ if(cm&&d>=S.nextFail){dirty=true;fireFailure();const size=S.links.length+Object.keys(S.pops).length;S.nextFail=d+Math.round((Math.max(22,50-size*1.5)+Math.floor(Math.random()*25))*(scnRule('chaos')?0.5:1)/cm);} if(cm&&d>=S.nextEvent){dirty=true;fireEvent();S.nextEvent=d+Math.round((45+Math.floor(Math.random()*45))/cm);} if(dirty)compute(); + opsDay(d); // payday floaters if(d%30===0){for(const c in S.pops){let v=(R.cityEye[c]*sfOf(R,c)*EYE_RATE)+S.biz.filter(b=>b.city===c).reduce((a,b)=>a+b.bw*b.rate,0);v=v-R.cityEye[c]*sfOf(R,c)*EYE_RATE*(1-(CITY[c].arpu||1));if(v>500)floater(CITY[c].x,CITY[c].y-30,'+'+fmt$(v),'#16A866');}sfx('coin');} checkGoals(); diff --git a/src/game/90-actions/50-customers.js b/src/game/90-actions/50-customers.js index 97e0261..1c22220 100644 --- a/src/game/90-actions/50-customers.js +++ b/src/game/90-actions/50-customers.js @@ -4,8 +4,7 @@ Object.assign(ACT,{ const T=BIZ_T[t],nm=()=>{const list=T.names.filter(n=>!S.usedNames.includes(n)),n=list.length?pick(list):pick(T.names);useName(n);return n;}; // A capacity broker finds a buyer at once and keeps 10% of the monthly price. const o=fiberOffer(t,l,nm,0.9);o.broker=true;S.offers.push(o);toast(tr('customers.listed_with_a_capacity_broker_name',{name:esc(o.name),what:esc(o.what)}),'good');sfx('click');after();}, - autoToggle:({k})=>{if(k!=='autoSales'&&k!=='autoRepair')return;S[k]=!S[k];if(k==='autoSales'){UI.autoGame=S;UI.autoSalesAt=performance.now();}sfx('click');after();}, - accept:({id,auto=false})=>{const o=S.offers.find(x=>x.id===id);if(!o)return;const customer=auto?(S.autoSales&&autoOffer(o)):offerCustomer(o);if(!customer)return;if(!bHas(o)){toast(tr('customers.you_need_a_pop_in_every'),'bad');return;} + accept:({id,auto=false})=>{const o=S.offers.find(x=>x.id===id);if(!o)return;const customer=auto?autoOffer(o):offerCustomer(o);if(!customer)return;if(!bHas(o)){toast(tr('customers.you_need_a_pop_in_every'),'bad');return;} if(o.type==='wwave'){const l=S.links.find(x=>x.id===o.link);if(!l||chMax(l)-(l.ch||[]).length-soldSlots(l)=o.start){toast(tr('customers.too_late_the_event_has_already'),'bad');return;} // A carrier renting more alien waves on a fiber it already rents grows its contract, like a real order for extra waves, diff --git a/src/game/90-actions/88-ops.js b/src/game/90-actions/88-ops.js new file mode 100644 index 0000000..121e7a8 --- /dev/null +++ b/src/game/90-actions/88-ops.js @@ -0,0 +1,25 @@ +// Standing orders: hiring the intern, the switches and dials, and a new POP from the template. +const opsCycle=(a,v)=>a[(a.indexOf(v)+1)%a.length]; +Object.assign(ACT,{ + opsOpen:()=>{if(S)opsModal();}, + opsHire:({id})=>{if(!S||opsHired()||!own(INTERNS,id)||!opsCanHire()||!rule('clock'))return;if(!spend(INTERN_MO))return;const O=opsO();O.intern=id;O.hired=S.day;O.mon=Math.floor(S.day/30); + O.log.unshift({d:S.day,i:id,r:[]});toast(esc(tr('ops.hired',{name:opsName(true)})),'good',[{l:tr('ops.ops'),act:'opsOpen',args:{}}]);after();opsModal();}, + opsFire:()=>{if(!opsHired())return;if(UI.confirm!=='opsFire'){UI.confirm='opsFire';opsModal();return;}UI.confirm=null;const nm=opsName();S.ops.intern=null; + toast(esc(tr('ops.fired',{name:nm})),'');after();opsModal();}, + opsToggle:({k})=>{if(!opsHired()||!own(OPSK,k))return;S.ops.on[k]=!S.ops.on[k];sfx('click');after();opsModal();}, + opsParam:({k,p})=>{if(!opsHired()||!own(OPSK,k)||!own(OPSK[k].p,p))return;const P=OPSK[k].p[p];let v; + if(p==='prov'){const ids=['cheap',...NETS.filter(n=>n.price&&Object.keys(S.pops).some(c=>sellsAt(n,c))).map(n=>n.id)];v=opsCycle(ids,opsP(k,p));}else v=opsCycle(P.v,opsP(k,p)); + (S.ops.p[k]||(S.ops.p[k]={}))[p]=v;sfx('click');after();opsModal();}, + opsCap:({k})=>{if(!opsHired()||!own(OPSK,k)||!OPSK[k].cap)return;S.ops.cap[k]=opsCycle(OPS_CAPS,opsCap(k));sfx('click');after();opsModal();}, + opsFloor:()=>{if(!opsHired())return;S.ops.floor=opsCycle(OPS_FLOORS,S.ops.floor);sfx('click');after();opsModal();}, + opsCity:({v})=>{if(!S||!S.pops[v])return;UI.opsCity=v;opsModal();}, + opsPop:({k,city})=>{if(!opsHired()||!OPS_POP.includes(k)||!S.pops[city])return;const sk=S.ops.skip,a=sk[city]||[];sk[city]=a.includes(k)?a.filter(x=>x!==k):[...a,k];if(!sk[city].length)delete sk[city]; + UI.opsCity=city;sfx('click');after();opsModal();}, + opsTpl:({k})=>{if(!opsHired()||!OPS_TPL.includes(k))return;S.ops.tpl[k]=!S.ops.tpl[k];sfx('click');after();opsModal();}, + // One tap, a whole POP: the same clicks in the same order, all or nothing on the price. + opsNewPop:({city})=>{if(!opsHired())return;const q=opsTplQuote(city);if(!q)return;if(S.cash{ACT.buildPop({city});if(!S.pops[city])return;if(S.ops.tpl.bb)ACT.launchBB({city});if(q.net)ACT.buyTransit({city,net:q.net,tier:0});if(q.ix)ACT.buyIx({city:q.ix,tier:0}); + if(q.kit){const k=utilityKit(city);if(k&&k.cost&&S.cash>=k.cost)ACT.utilityKit({city,cost:k.cost});}}); + if(!S.pops[city])return;UI.tab='links';floater(CITY[city].x,CITY[city].y-30,tr('common.new_pop'),'#FF4F9A');sfx('build'); + toast(esc(tr('ops.tpl_done',{name:opsName(),city:CITY[city].name,list:q.parts.join(', ')||tr('ops.tpl_just_pop')})),'good',[],{a:'city',v:city});after();}, +}); diff --git a/src/game/90-actions/89-game-and-settings.js b/src/game/90-actions/89-game-and-settings.js index 70134bc..55ab145 100644 --- a/src/game/90-actions/89-game-and-settings.js +++ b/src/game/90-actions/89-game-and-settings.js @@ -29,7 +29,7 @@ Object.assign(ACT,{ ${btn(tr('game_and_settings.scenarios_amp_weekly_challenge'),'scenarios',{},'ghost')} ${btn(tr('common.how_to_play'),'help',{},'ghost')} ${RELEASE_NOTES.length?btn(tr('common.what_s_new_in_v',{v:esc(APP_VERSION)}),'whatsNewShow',{},'ghost'):''} - ${btn(tr('utilities.title'),'utilities',{},'')} + ${btn('🧑‍💻 '+tr('ops.standing_orders'),'opsOpen',{},'')} ${btn(tr('common.settings'),'settings',{},'ghost')} ${btn(tr('common.start_a_new_network'),'resetAsk',{},'red')} ${chatHtml()}${issueHtml()}`);}, diff --git a/src/game/90-actions/90-action-helpers.js b/src/game/90-actions/90-action-helpers.js index 002cdaa..0efe713 100644 --- a/src/game/90-actions/90-action-helpers.js +++ b/src/game/90-actions/90-action-helpers.js @@ -22,7 +22,7 @@ function chWhy(l,o){const O=OPT[o];if(O.lvl>lvl())return tr('action_helpers.unlo if((l.ch||[]).length+soldSlots(l)>=chMax(l))return soldSlots(l)?tr('action_helpers.sys_is_full_max_channels_sold',{sys:DF_SYS[l.sys].n,max:chMax(l),sold:soldSlots(l)}):tr('action_helpers.sys_is_full_max_channels',{sys:DF_SYS[l.sys].n,max:chMax(l)}); for(const c of [l.a,l.b]){const p=S.pops[c];if(p&&RG[p.rgen||0].clsinnerWidth>760&&innerWidth<=1200; function selectLink(id){UI.sel={type:'link',id};UI.confirm=null;if(isTablet()||isPhone())UI.leftOpen=false;$('panel').classList.remove('full');renderPanel();renderLeft();} function selectCity(c){UI.sel={type:'city',id:c};UI.confirm=null;if(isTablet()||isPhone())UI.leftOpen=false;const P=$('panel');if(P)P.classList.remove('full');if(!S.pops[c])UI.tab='cust';renderPanel();} diff --git a/src/game/93-ui/40-hud-and-panels.js b/src/game/93-ui/40-hud-and-panels.js index 8ea4fcd..155f29a 100644 --- a/src/game/93-ui/40-hud-and-panels.js +++ b/src/game/93-ui/40-hud-and-panels.js @@ -39,18 +39,17 @@ function renderLeft(){checkLayer(); h+=GOALS.map(g=>{const d=S.done[g.id]!==undefined,c=g===cur;return `
${d?'✓':''}
${esc(g.t)}
${c||!d?`
${esc(g.d)}
`:''}${!d&&g.r?`
${tr('hud_and_panels.reward_cash',{cash:fmt$(g.r)})}
`:''}
`;}).join(''); h+=badgeGrid(); }else if(UI.left==='deals'){ - h+=`

${tr('automation.sales_every_five_seconds')}

`; {const st=custStats();if(st.n)h+=`
${tr('common.your_customers')} ${st.n} · ${tr('hud_and_panels.happiness_p',{p:Math.round(st.avg)})}
${st.unhappy?`
${trn('hud_and_panels.n_unhappy_customer_price_mo_at',st.unhappy,{price:fmt$(st.risk)})}
`:''}
${btn(st.unhappy?tr('common.see_who'):tr('common.all_customers'),'custOpen',{sad:st.unhappy?1:0},st.unhappy?'pink sm':'ghost sm')}
`;} h+=confSection(); {const lv=S.lvl||1,nx=LEVELS[lv];h+=`
${tr('hud_and_panels.customer_level_lv_name',{lv,name:LEVELS[lv-1].n})}
${nx?tr('hud_and_panels.next_req_unlocks_what',{req:nx.req,what:lc1(nx.unlock)}):tr('common.every_customer_type_is_unlocked_go')}
`;} if(!S.offers.length)h+=`

${tr('hud_and_panels.no_open_offers_right_now_businesses')}

`; for(const o of S.offers.slice().sort((a,b)=>a.exp-b.exp)){const has=bHas(o); h+=`
${esc(o.name)}
${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}
${bRisk(o)}${reqList(o)} -
${has?btn(autoAcceptLabel(o),'accept',{id:o.id},'green sm'):btn(tr('common.go_there'),'focusCity',{city:bCities(o).find(c=>!S.pops[c])},'ghost sm')}${btn(tr('common.decline'),'decline',{id:o.id},'ghost sm')}
${has?'':`
${tr('hud_and_panels.needs_a_pop_in_cities',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}
`}
`;} +
${has?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):btn(tr('common.go_there'),'focusCity',{city:bCities(o).find(c=>!S.pops[c])},'ghost sm')}${btn(tr('common.decline'),'decline',{id:o.id},'ghost sm')}
${has?'':`
${tr('hud_and_panels.needs_a_pop_in_cities',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}
`}`;} }else if(UI.left==='noc'){ h+=`
${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${btn(tr('common.connections'),'connOpen',{},'')}${btn(tr('common.traceroute'),'trace',{},'')}
`; h+=`

${tr('hud_and_panels.your_network_operations_center_every')}

`; - h+=`

${tr('automation.repairs_when_affordable')}

`; + h+=opsCard(); // Incidents come first, the ones you can fix with one click at the top (#63): no scrolling past hot ports to replace an optic. for(const i of S.inc.filter(i=>i.type!=='ddos').sort((a,b)=>(b.cost?1:0)-(a.cost?1:0)||(b.impact||0)-(a.impact||0))){h+=`
${incTitle(i.type)}
${esc(i.msg)}
${trn('hud_and_panels.auto_fix_in_n_day',i.until-S.day)}${i.impact?` · ${tr('hud_and_panels.g_lost',{g:fmtG(i.impact)})}`:''}
${i.cost?`
${btn(`${esc(i.fix||tr('common.rush_repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash`:''}
`;} h+=logSection();UI.logSeen=Date.now(); diff --git a/src/game/93-ui/50-city-panel.js b/src/game/93-ui/50-city-panel.js index d20ab07..4c068b7 100644 --- a/src/game/93-ui/50-city-panel.js +++ b/src/game/93-ui/50-city-panel.js @@ -7,7 +7,7 @@ function cityPanel(c){ h+=`
${C.note?`

${esc(C.note)}

`:''} ${C.cn?chinaSection(c):''}${C.cn&&!cnOk()?'':`

${tr('city_panel.open_a_pop_here')}

${tr('city_panel.a_pop_point_of_presence_is')}

${C.ru?`

${tr('city_panel.includes_the_mandatory_government',{cost:fmt$(RU_BOX),mo:fmt$(RU_BOX_MO)})}

`:''}${btn(tr('city_panel.build_pop_cost_mo_mo',{cost:fmt$(popCost(c)),mo:fmt$(popMo(c))}),'buildPop',{city:c},'pink big',S.cash${tr('city_panel.or_drag_from_one_of_your')}

`}`; +

${tr('city_panel.or_drag_from_one_of_your')}

${opsTplHtml(c)}`}`; h+=offersHere(c); const trs=NETS.filter(n=>sellsAt(n,c)); const fh=FABS.filter(f=>f.cities.includes(c)); diff --git a/src/game/93-ui/57-ops-panel.js b/src/game/93-ui/57-ops-panel.js new file mode 100644 index 0000000..b0bf525 --- /dev/null +++ b/src/game/93-ui/57-ops-panel.js @@ -0,0 +1,40 @@ +const OPS_TPL_L={bb:N_('ops.tpl_bb'),transit:N_('ops.tpl_transit'),ix:N_('ops.tpl_ix'),kit:N_('ops.tpl_kit')}; +// The Ops panel: the intern, their shift log, and the standing orders with their dials. A bottom sheet on phones. +function opsCard(){if(!S)return '';const last=opsHired()&&S.ops.log[0]; + return `
${opsHired()?`${INTERNS[S.ops.intern].i} ${esc(tr('ops.ops_name',{name:opsName(true)}))}`:`🧑‍💻 ${tr('ops.standing_orders')}`}
+
${opsHired()?esc(last?opsEntry(last):tr('ops.l_quiet',{name:opsName()})):opsCanHire()?tr('ops.hire_pitch_short'):tr('ops.locked',{lv:2})}
+
${btn(opsHired()?tr('ops.standing_orders'):tr('ops.hire_an_intern'),'opsOpen',{},opsHired()?'sm':'pink sm',!opsHired()&&!opsCanHire())}
`;} +const opsEntry=e=>(e.f!==undefined?opsFFLine(e)+' ':'')+(e.r.length||e.f===undefined?opsLine(e):''); +function opsVal(k,p){const P=OPSK[k].p[p],v=opsP(k,p);return p==='prov'?(v==='cheap'?tr('ops.cheapest'):NET[v].name):P.f(v);} +function opsOrderHtml(d){const k=d.k,on=S.ops.on[k],cap=d.cap?opsCap(k):0; + return `
${tr(d.t)}
${tr(d.d)}
+
+ ${on?`
${Object.keys(d.p).map(p=>btn(`${tr(d.p[p].l)}: ${esc(opsVal(k,p))}`,'opsParam',{k,p},'ghost sm')).join('')} + ${d.cap?btn(`${tr('ops.budget')}: ${cap?tr('common.price_mo',{price:fmt$(cap)}):tr('ops.no_cap')}`,'opsCap',{k},'ghost sm'):''}
+ ${d.cap&&S.ops.spent[k]?`
${tr('ops.spent_this_month',{price:fmt$(S.ops.spent[k])})}
`:''} + ${k==='ix'&&ppol()!=='open'?`

${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}

`:''}`:''}
`;} +function opsModal(){if(!S)return;const hired=opsHired();let h=`
${tr('ops.ops')}

${tr('ops.standing_orders')}

`; + if(!hired){h+=`

${tr('ops.hire_pitch')}

`; + if(!rule('clock'))h+=`

${tr('ops.no_clock')}

`;else if(!opsCanHire())h+=`

${tr('ops.locked',{lv:2})}

`; + else h+=Object.entries(INTERNS).map(([id,I])=>`
${tr(I.n)}
${tr(I.d)}
+ ${btn(tr('ops.hire_mo',{price:fmt$(INTERN_MO)}),'opsHire',{id},'pink sm',S.cash
`).join(''); + openModal(h+opsOnceHtml(),'ops');return;} + const O=S.ops,I=INTERNS[O.intern]; + h+=`
${tr(I.n)}
${tr('ops.salary',{price:fmt$(INTERN_MO),d:dateStr(O.hired)})}
+ ${btn(UI.confirm==='opsFire'?tr('ops.really_fire'):tr('ops.fire'),'opsFire',{},'ghost sm')}
+ ${O.log.length?`
${O.log.slice(0,6).map(e=>esc(tr('peering_inbox.day_d',{d:e.d})+': '+opsEntry(e))).join('\n')}
`:''} +

${ibx().bot?tr('ops.lpm_on',{name:opsName()}):tr('ops.lpm_off',{name:opsName()})}

+
${btn(`${tr('ops.floor')}: ${O.floor?fmt$(O.floor):tr('ops.no_cap')}`,'opsFloor',{},'ghost sm')}
`; + h+=`

${tr('ops.how_it_works',{name:opsName()})}

`+OPS.map(opsOrderHtml).join(''); + // Per POP: switch single orders off where the player wants to decide by hand. + const cities=Object.keys(S.pops).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name)),c=S.pops[UI.opsCity]?UI.opsCity:cities[0]; + if(c)h+=`

${tr('ops.per_pop')}

+
${OPS_POP.map(k=>{const here=opsHere(k,c);return ``;}).join('')}
+

${tr('ops.per_pop_note')}

`; + h+=`

${tr('ops.template')}

${tr('ops.template_note',{name:opsName()})}

${OPS_TPL.map(k=>``).join('')}
`; + h+=opsOnceHtml();openModal(h,'ops');} +// The big one-off batches (#181, #192) live here now, next to the orders that run them every week. +const opsOnceHtml=()=>`

${tr('ops.by_hand')}

${tr('ops.by_hand_note')}

${btn(tr('utilities.title'),'utilities',{},'sm')}${btn(tr('pni_all.peer_all_networks'),'pniAllOpen',{net:null},'sm')}
`; +// On a city without a POP: open it from the template in one tap. +function opsTplHtml(c){if(!opsHired())return '';const q=opsTplQuote(c);if(!q)return ''; + return `

${tr('ops.template')}

${esc(tr('ops.tpl_offer',{name:opsName(),list:[tr('ops.tpl_pop'),...q.parts].join(', ')}))}

${btn(tr('ops.tpl_open',{cost:fmt$(q.cost)}),'opsNewPop',{city:c},'pink',S.cash
`;} diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 1ce06df..0b54d0f 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -104,7 +104,7 @@ function dfPanel(l){ if(!bld){const sold=S.biz.filter(b=>b.link===l.id&&(b.type==='wwave'||b.type==='dfpair'||b.type==='pairs')),off=S.offers.find(o=>o.link===l.id),fc=freeCh(l); h+=`

${tr('link_panels.selling_spare_capacity')}

${tr('link_panels.other_carriers_rent_what_you_do')}

${tr('common.free_channels')}${fc} / ${chMax(l)}
${sold.map(b=>`
${esc(b.name)}
${esc(b.what||BIZ_T[b.type].l)} · ${tr('common.price_mo',{price:fmt$(b.rate)})}
`).join('')} - ${off?`
${esc(off.name)}
${esc(off.what)} · ${tr('common.price_mo',{price:fmt$(off.rate)})} · ${tr('ui.n_d_left',{n:off.exp-S.day})}${off.broker?' · '+tr('link_panels.via_a_capacity_broker'):''}
${btn(autoAcceptLabel(off),'accept',{id:off.id},'pink sm')}
`:fc>=1||pairFree(l)?`
${btn(tr('link_panels.list_it_with_a_capacity_broker'),'advertise',{id:l.id},'sm')}
`:`

${tr('link_panels.nothing_spare_to_sell_on_this')}

`}
`;} + ${off?`
${esc(off.name)}
${esc(off.what)} · ${tr('common.price_mo',{price:fmt$(off.rate)})} · ${tr('ui.n_d_left',{n:off.exp-S.day})}${off.broker?' · '+tr('link_panels.via_a_capacity_broker'):''}
${btn(tr('common.accept'),'accept',{id:off.id},'pink sm')}
`:fc>=1||pairFree(l)?`
${btn(tr('link_panels.list_it_with_a_capacity_broker'),'advertise',{id:l.id},'sm')}
`:`

${tr('link_panels.nothing_spare_to_sell_on_this')}

`}`;} h+=`

${tr('common.optics')}

${tr('link_panels.each_channel_is_a_pair_of')}

`; if(l.own&&l.sub)h+=subUpgradePanel(l); for(const k of Object.keys(OPT)){const O=OPT[k],n=(l.ch||[]).filter(x=>x===k).length,why=chWhy(l,k); @@ -121,7 +121,7 @@ function dfPanel(l){ } function offersHere(c){ const os=S.offers.filter(o=>bCities(o).includes(c));if(!os.length)return ''; - return `

${tr('common.offers_here')}

${os.map(o=>`
${esc(o.name)}
${esc(BIZ_T[o.type].l)}${o.city2?` ${CITY[o.city].name} ⇄ ${CITY[o.city2].name}`:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}
${R.reach<0.99&&!BIZ_T[o.type].l2?`
${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}
`:''}${o.type==='scrub'&&!hasScrub()?`
${tr('link_panels.needs_your_own_scrubbing_center')}
`:''}${bRisk(o)}${reqList(o)}${bHas(o)?'':`
${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}
`}
${bHas(o)?btn(autoAcceptLabel(o),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}
`).join('')}
`; + return `

${tr('common.offers_here')}

${os.map(o=>`
${esc(o.name)}
${esc(BIZ_T[o.type].l)}${o.city2?` ${CITY[o.city].name} ⇄ ${CITY[o.city2].name}`:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}
${R.reach<0.99&&!BIZ_T[o.type].l2?`
${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}
`:''}${o.type==='scrub'&&!hasScrub()?`
${tr('link_panels.needs_your_own_scrubbing_center')}
`:''}${bRisk(o)}${reqList(o)}${bHas(o)?'':`
${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}
`}
${bHas(o)?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}
`).join('')}
`; } function linkPanel(id){ const l=S.links.find(x=>x.id===id);if(!l){UI.sel=null;return '';} diff --git a/src/game/94-dashboard/60-dashboard.js b/src/game/94-dashboard/60-dashboard.js index 85e9c64..f2c1bf7 100644 --- a/src/game/94-dashboard/60-dashboard.js +++ b/src/game/94-dashboard/60-dashboard.js @@ -18,7 +18,7 @@ function renderDash(){checkLayer(); {const k=UI.dashSort||'traffic',dir=UI.dashDir||-1,val=x=>k==='name'?x.n.name.toLowerCase():k==='asn'?x.n.asn:k==='type'?x.n.type:k==='cost'?x.cost:k==='lost'?x.lost:x.t;nets.sort((a,b)=>{const A=val(a),B=val(b);return (AB?1:0)*dir||b.t-a.t;});} if(DT==='cust')h+=custSection(); if(DT==='conn')h+=connSection(); - if(DT==='traffic')h+=`
${btn(tr('pni_all.peer_all_networks'),'pniAllOpen',{net:null},'pink sm')}
`; + if(DT==='traffic')h+=`
${btn(tr('ops.standing_orders'),'opsOpen',{},'sm')}
`; if(DT==='traffic')h+=`

${tr('dashboard.traffic_by_network_asn')}

${tr('dashboard.where_your_users_traffic_comes_from')}

${['c','p','ix','t'].map(k=>`${EGC[k][0]}`).join('')}
${[['name',tr('common.network_6974'),''],['asn','AS',''],['type',tr('common.type'),''],['traffic',tr('common.traffic'),'r'],['mix',tr('dashboard.how_it_arrives'),''],['cost',tr('common.transit_cost'),'r'],['lost',tr('common.lost'),'r']].map(([k,l,c])=>``).join('')} ${nets.map(({n,e,t,want})=>{return ``;}).join('')}
${k==='mix'?l:``}
${logo(n)}${esc(n.name)}${n.pops&&n.pops.some(c=>S.pops[c])?`
${btn(tr('pni_all.peer_on_all_pops'),'pniAllOpen',{net:n.id},'ghost sm')}
`:''}
${n.asn}${TYPE_L[n.type]}${fmtG(t)}
${['c','p','ix','t'].map(k=>``).join('')}
${e.t>0.01?tr('common.price_mo',{price:fmt$((R.cost.transit||0)*e.t/tT)}):'—'}${want>0.01?pct(Math.max(0,1-t/want)):'—'}
`; if(DT==='traffic'){const top=transitTop(S.transit.map(t=>t.id),8);if(top.length)h+=`

${tr('dashboard.who_your_transit_carries')}

${tr('dashboard.the_networks_you_pay_transit_to')}

${top.map(([id,v])=>`
${logo(NET[id])}
${esc(NET[id].name)} AS${NET[id].asn} · ${fmtG(v)} · ${tr('dashboard.about_price_mo',{price:fmt$((R.cost.transit||0)*v/tT)})}
${esc(offTransitHint(id))}
${btn(tr('common.where_6276'),'netFocus',{id},'ghost sm')}
`).join('')}
`;} diff --git a/src/game/99-loop.js b/src/game/99-loop.js index 70a4e5d..7f1b386 100644 --- a/src/game/99-loop.js +++ b/src/game/99-loop.js @@ -10,7 +10,6 @@ function frame(now){ if(UI.panelsDue){UI.panelsDue=false;if(!pressing){renderPanel();renderLeft();if(!$('dash').hidden)renderDash();renderBank();}renderHint();} if(S&&!S.lost&&$('modal').hidden&&UI.speed){acc+=dt*UI.speed;let n=0;while(acc>=DAY_MS&&n<4&&UI.speed){acc-=DAY_MS;try{dayTick();}catch(e){tickErr(e);}n++;} if(n){UI.ticking=true;renderHUD();UI.ticking=false;UI.panelsDue=true;}} - try{automationTick(now);renderAutoCountdown();}catch(e){tickErr(e);} if(UI.speed&&!(S&&S.lost))animT+=dt; /* paused = frozen dots, waves and clouds */ const t=animOn()?animT:0; if(!(UI.mapHid=mapHidden())&&!mapStill(t,now)){try{draw(t);}catch(e){tickErr(e);}UI.drawnAt=now;} diff --git a/src/i18n/en.js b/src/i18n/en.js index 959a73b..b2c756b 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -13,11 +13,6 @@ "action_helpers.too_far_even_at_its_slowest":"Too far even at its slowest setting: an optical span here is {span} km and it reaches {max} km. Add a regen site (Line system).", "action_helpers.unlocks_at_customer_level_n":"Unlocks at customer level {n}.", "actions.your_router_can_t_take_a":"Your router can't take a {port} port.
Upgrade it in the Infra tab.", -"automation.auto_accept_sales":"Auto-accept sales: {state}", -"automation.auto_pay_repairs":"Auto-pay repairs: {state}", -"automation.next_auto_check":"Time until the next automatic requirements check.", -"automation.repairs_when_affordable":"While playing, automatically pay for available rush repairs when you can afford them.", -"automation.sales_every_five_seconds":"Every 5 seconds while playing, accept only offers whose requirements and service capacity are ready.", "badges.a_petabit_a_second":"A Petabit a Second", "badges.a_secret_badge":"A secret badge", "badges.attend_a_conference":"Attend a conference.", @@ -2522,6 +2517,107 @@ "notifications.n_min_ago":{"one":"{n} min ago","other":"{n} min ago"}, "notifications.nothing_in_the_last_10_minutes":"Nothing in the last 10 minutes.", "notifications.show_all_n":"Show all {n}", +"ops.annie":"Annie", +"ops.annie_d":"Answers from whichever desk is closest. Loves a cheap port and a full IX.", +"ops.anycast_annie":"Anycast Annie", +"ops.at_least_port":"at least {port}", +"ops.budget":"Budget", +"ops.by_hand":"One-off batches", +"ops.by_hand_note":"For when you want it all done right now: every peer at every exchange, a redundancy kit, PNIs with everyone.", +"ops.cheapest":"Cheapest", +"ops.ff_desc":"labelled a port in {city} “TODO: fix later (do not fix)”", +"ops.ff_hostname":"renamed the router in {city} to router-final-FINAL-v2", +"ops.ff_lag":"added one transit LAG member too many in {city}. It works, so it stays.", +"ops.ff_line":"Oops: {name} {what}.", +"ops.ff_ping":"pinged a public resolver from {city} for forty minutes, just to be sure", +"ops.ff_typo":"wrote “pering” in every interface description in {city}", +"ops.fire":"Let go", +"ops.fired":"{name} handed in the badge and took the good stapler. Your standing orders are paused.", +"ops.floor":"Keep at least", +"ops.hire_an_intern":"Hire a NOC intern", +"ops.hire_mo":"Hire · {price}/mo", +"ops.hire_pitch":"Tired of clicking the same fifteen buttons in every city? Hire a NOC intern. You write the standing orders once; they run them every day, pay exactly what your clicks would, and leave one line in the log.", +"ops.hire_pitch_short":"Set the rules once, and an intern clicks the buttons every day.", +"ops.hired":"{name} joined the NOC. Write some standing orders and they get to work tomorrow.", +"ops.how_add":"add a router", +"ops.how_auto":"add, then swap", +"ops.how_it_works":"Every day {name} works through the orders that are on, pays for each job exactly as if you had clicked it, and stops when an order's monthly budget, or your cash floor, is reached.", +"ops.how_swap":"swap generation", +"ops.kevin":"Kevin", +"ops.kevin_d":"Has seen every outage since the dot-com crash. Mostly from the break room.", +"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})"}, +"ops.l_peer":{"one":"peered with a network at {where}","other":"peered with {n} networks at {where}"}, +"ops.l_pni":{"one":"ordered a PNI in {where}","other":"ordered {n} PNIs ({where})"}, +"ops.l_quiet":"{name} watched the graphs. Nothing needed doing.", +"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_transit":{"one":"topped up transit in {where}","other":"topped up transit {n} times ({where})"}, +"ops.locked":"The NOC hires interns from customer level {lv}.", +"ops.lpm_off":"The peering inbox is still yours. Hire the Large Peering Model for that; {name} does not do email.", +"ops.lpm_on":"The Large Peering Model answers the peering inbox. {name} keeps out of its way.", +"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", +"ops.o_caches_d":"Rack every free cache a network offers, once its traffic in that city passes a threshold.", +"ops.o_decom":"Retire small parallel links", +"ops.o_decom_d":"Once a bigger link between two cities is up, hand back the smaller waves it no longer needs. Never one a customer rents or relies on.", +"ops.o_ix":"Peer at every IX", +"ops.o_ix_d":"Every week: join the route servers and ask every willing member at each of your exchange ports.", +"ops.o_optics":"Light more fiber", +"ops.o_optics_d":"Add optics to dark fiber that runs hot, and light new fiber the day it is handed over.", +"ops.o_pni":"PNI with the big ones", +"ops.o_pni_d":"Every week: order a PNI with every willing network sending enough traffic at your POPs, at each network's own minimum size.", +"ops.o_repair":"Rush repairs", +"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_prov":"Provider", +"ops.p_tier":"Size", +"ops.p_x":"Headroom", +"ops.paused":"Paused", +"ops.per_pop":"Per POP", +"ops.per_pop_note":"Green orders run in this POP. Switch one off to decide here by hand.", +"ops.really_fire":"Really let go?", +"ops.salary":"Salary {price}/mo · since {d}", +"ops.shift":"{name}'s shift", +"ops.spent_this_month":"Spent this month: {price}", +"ops.standing_orders":"Standing orders", +"ops.template":"New POP from template", +"ops.template_note":"Pick what {name} sets up when you open a city from the template. The standing orders take it from there.", +"ops.tpl_bb":"Broadband", +"ops.tpl_done":"{name} opened {city}: {list}.", +"ops.tpl_ix":"IX port", +"ops.tpl_just_pop":"just the POP", +"ops.tpl_kit":"Redundancy kit", +"ops.tpl_offer":"{name} can open this city in one go: {list}.", +"ops.tpl_open":"Open from template · {cost}", +"ops.tpl_pop":"POP", +"ops.tpl_transit":"10G transit", +"ops.tracy":"Tracy", +"ops.tracy_d":"Follows every packet hop by hop. Gets there in the end, with a star or two on the way.", +"ops.tracy_route":"Tracy Route", "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.", diff --git a/src/styles/36-ops.css b/src/styles/36-ops.css new file mode 100644 index 0000000..5dc6720 --- /dev/null +++ b/src/styles/36-ops.css @@ -0,0 +1,13 @@ +/* Standing orders: the intern's card in the NOC and the Ops sheet */ +.ops-card{border:2px solid #8E5CF7;background:#F7F2FF;border-radius:12px;padding:8px 10px;margin:8px 0} +.ops-card .nm{font-weight:800} +.ops-o{border:2px solid var(--line);border-radius:12px;padding:8px 10px;margin:8px 0;background:var(--paper)} +.ops-o.on{border-color:var(--ok)} +.ops-h{display:flex;align-items:center;gap:8px} +.ops-h .grow{flex:1;min-width:0} +.ops-h .nm{font-weight:800;font-size:13.5px;line-height:1.2} +.ops-h .b{min-height:36px;flex:none} +.ops-i{font-size:22px;line-height:1;flex:none} +.ops-p{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px} +.ops-p .b{white-space:normal;text-align:left;min-height:36px} +.ops-log{white-space:pre-wrap;font-size:11.5px;max-height:160px;overflow:auto} From 4717bc0f751e47a1aada898f754eac0dc2dc7f8f Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Wed, 28 Oct 2026 17:43:12 +0100 Subject: [PATCH 2/6] Standing orders in German, Spanish, French, Italian and Portuguese --- site/i18n/de.js | 106 +++++++++++++++++++++++++++++++++++++++++++++--- site/i18n/es.js | 106 +++++++++++++++++++++++++++++++++++++++++++++--- site/i18n/fr.js | 106 +++++++++++++++++++++++++++++++++++++++++++++--- site/i18n/it.js | 106 +++++++++++++++++++++++++++++++++++++++++++++--- site/i18n/pt.js | 106 +++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 505 insertions(+), 25 deletions(-) diff --git a/site/i18n/de.js b/site/i18n/de.js index e0b8d31..70c16fd 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -14,11 +14,6 @@ "action_helpers.too_far_even_at_its_slowest":"Zu weit, selbst in der langsamsten Einstellung: Ein optischer Abschnitt ist hier {span} km lang, die Reichweite beträgt {max} km. Füge einen Regenerator-Standort hinzu (Line System).", "action_helpers.unlocks_at_customer_level_n":"Wird ab Kundenlevel {n} freigeschaltet.", "actions.your_router_can_t_take_a":"Dein Router kann keinen {port}-Port aufnehmen.
Rüste ihn im Tab Infra auf.", -"automation.auto_accept_sales":"Deals automatisch annehmen: {state}", -"automation.auto_pay_repairs":"Reparaturen automatisch zahlen: {state}", -"automation.next_auto_check":"Zeit bis zur nächsten automatischen Prüfung der Anforderungen.", -"automation.repairs_when_affordable":"Zahlt während des Spiels automatisch Express-Reparaturen, wenn du sie dir leisten kannst.", -"automation.sales_every_five_seconds":"Alle 5 Sekunden während des Spiels: Nur Angebote, deren Anforderungen und Kapazität bereit sind, werden angenommen.", "badges.a_petabit_a_second":"Ein Petabit pro Sekunde", "badges.a_secret_badge":"Ein geheimes Abzeichen", "badges.attend_a_conference":"Besuche eine Konferenz.", @@ -2523,6 +2518,107 @@ "notifications.n_min_ago":{"one":"vor {n} Min.","other":"vor {n} Min."}, "notifications.nothing_in_the_last_10_minutes":"Nichts in den letzten 10 Minuten.", "notifications.show_all_n":"Alle {n} anzeigen", +"ops.annie":"Annie", +"ops.annie_d":"Antwortet vom nächstgelegenen Schreibtisch. Liebt billige Ports und volle IXe.", +"ops.anycast_annie":"Anycast-Annie", +"ops.at_least_port":"mindestens {port}", +"ops.budget":"Budget", +"ops.by_hand":"Einmal alles", +"ops.by_hand_note":"Für den Moment, in dem alles sofort erledigt sein soll: jeder Peer an jedem Exchange, ein Redundanz-Kit, PNIs mit allen.", +"ops.cheapest":"Günstigster", +"ops.ff_desc":"hat einen Port in {city} „TODO: später fixen (nicht fixen)“ beschriftet", +"ops.ff_hostname":"hat den Router in {city} in router-final-FINAL-v2 umbenannt", +"ops.ff_lag":"hat in {city} ein Transit-LAG-Member zu viel bestellt. Läuft, also bleibt es.", +"ops.ff_line":"Hoppla: {name} {what}.", +"ops.ff_ping":"hat aus {city} vierzig Minuten lang einen öffentlichen Resolver angepingt, nur zur Sicherheit", +"ops.ff_typo":"hat in {city} in jede Interface-Beschreibung „Pering“ geschrieben", +"ops.fire":"Entlassen", +"ops.fired":"{name} hat den Ausweis abgegeben und den guten Tacker mitgenommen. Deine Daueraufträge ruhen.", +"ops.floor":"Mindestens behalten", +"ops.hire_an_intern":"NOC-Praktikant einstellen", +"ops.hire_mo":"Einstellen · {price}/Monat", +"ops.hire_pitch":"Keine Lust mehr, in jeder Stadt dieselben fünfzehn Buttons zu klicken? Stell einen NOC-Praktikanten ein. Du schreibst die Daueraufträge einmal; er arbeitet sie jeden Tag ab, zahlt genau das, was deine Klicks kosten würden, und hinterlässt eine Zeile im Log.", +"ops.hire_pitch_short":"Regeln einmal festlegen, und ein Praktikant klickt jeden Tag die Buttons.", +"ops.hired":"{name} ist im NOC. Schreib ein paar Daueraufträge, morgen geht es los.", +"ops.how_add":"Router dazu", +"ops.how_auto":"erst dazu, dann tauschen", +"ops.how_it_works":"Jeden Tag arbeitet {name} die eingeschalteten Aufträge ab, bezahlt jeden Job genau so, als hättest du geklickt, und hört auf, sobald das Monatsbudget eines Auftrags oder deine Bargeld-Untergrenze erreicht ist.", +"ops.how_swap":"Generation tauschen", +"ops.kevin":"Kevin", +"ops.kevin_d":"Hat jeden Ausfall seit dem Dotcom-Crash miterlebt. Meistens aus der Kaffeeküche.", +"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})"}, +"ops.l_peer":{"one":"hat mit einem Netz an {where} gepeert","other":"hat mit {n} Netzen an {where} gepeert"}, +"ops.l_pni":{"one":"hat einen PNI in {where} bestellt","other":"hat {n} PNIs bestellt ({where})"}, +"ops.l_quiet":"{name} hat auf die Graphen geschaut. Nichts zu tun.", +"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_transit":{"one":"hat Transit in {where} aufgestockt","other":"hat {n}-mal Transit aufgestockt ({where})"}, +"ops.locked":"Das NOC stellt ab Kundenlevel {lv} Praktikanten ein.", +"ops.lpm_off":"Die Peering-Inbox bleibt deine Sache. Dafür gibt es das Large Peering Model; {name} macht keine E-Mails.", +"ops.lpm_on":"Das Large Peering Model beantwortet die Peering-Inbox. {name} geht ihm aus dem Weg.", +"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", +"ops.o_caches_d":"Jeden Gratis-Cache einbauen, den ein Netz anbietet, sobald sein Traffic in der Stadt eine Schwelle überschreitet.", +"ops.o_decom":"Kleine Parallel-Links abbauen", +"ops.o_decom_d":"Sobald ein größerer Link zwischen zwei Städten läuft, die kleineren Waves zurückgeben, die er nicht mehr braucht. Nie eine, die ein Kunde mietet oder braucht.", +"ops.o_ix":"An jedem IX peeren", +"ops.o_ix_d":"Jede Woche: den Route Servern beitreten und jedes willige Mitglied an jedem deiner Exchange-Ports fragen.", +"ops.o_optics":"Mehr Dark Fiber beleuchten", +"ops.o_optics_d":"Optiken auf heiß laufende Dark Fiber stecken und neue Glasfaser am Tag der Übergabe beleuchten.", +"ops.o_pni":"PNI mit den Großen", +"ops.o_pni_d":"Jede Woche: mit jedem willigen Netz, das an deinen POPs genug Traffic schickt, einen PNI bestellen, in der jeweils kleinsten Größe des Netzes.", +"ops.o_repair":"Reparaturen beschleunigen", +"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_prov":"Anbieter", +"ops.p_tier":"Größe", +"ops.p_x":"Reserve", +"ops.paused":"Pausiert", +"ops.per_pop":"Pro POP", +"ops.per_pop_note":"Grüne Aufträge laufen in diesem POP. Schalte einen aus, um hier selbst zu entscheiden.", +"ops.really_fire":"Wirklich entlassen?", +"ops.salary":"Gehalt {price}/Monat · seit {d}", +"ops.shift":"Schicht von {name}", +"ops.spent_this_month":"Diesen Monat ausgegeben: {price}", +"ops.standing_orders":"Daueraufträge", +"ops.template":"Neuer POP aus der Vorlage", +"ops.template_note":"Wähle, was {name} einrichtet, wenn du eine Stadt aus der Vorlage eröffnest. Den Rest übernehmen die Daueraufträge.", +"ops.tpl_bb":"Breitband", +"ops.tpl_done":"{name} hat {city} eröffnet: {list}.", +"ops.tpl_ix":"IX-Port", +"ops.tpl_just_pop":"nur den POP", +"ops.tpl_kit":"Redundanz-Kit", +"ops.tpl_offer":"{name} kann diese Stadt in einem Rutsch eröffnen: {list}.", +"ops.tpl_open":"Aus Vorlage eröffnen · {cost}", +"ops.tpl_pop":"POP", +"ops.tpl_transit":"10G Transit", +"ops.tracy":"Tracy", +"ops.tracy_d":"Verfolgt jedes Paket Hop für Hop. Kommt am Ende an, mit ein, zwei Sternchen unterwegs.", +"ops.tracy_route":"Tracy Route", "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.", diff --git a/site/i18n/es.js b/site/i18n/es.js index f7d7cf0..9ded3e0 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -12,11 +12,6 @@ "action_helpers.too_far_even_at_its_slowest":"Demasiado lejos incluso en su ajuste más lento: aquí un tramo óptico mide {span} km y el alcance es de {max} km. Añade un sitio regenerador (Sistema de línea).", "action_helpers.unlocks_at_customer_level_n":"Se desbloquea en el nivel de cliente {n}.", "actions.your_router_can_t_take_a":"Tu router no admite un puerto de {port}.
Mejóralo en la pestaña Infra.", -"automation.auto_accept_sales":"Ventas automáticas: {state}", -"automation.auto_pay_repairs":"Reparaciones pagadas auto: {state}", -"automation.next_auto_check":"Tiempo hasta la próxima comprobación automática de requisitos.", -"automation.repairs_when_affordable":"Mientras juegas, paga automáticamente las reparaciones urgentes disponibles si hay fondos suficientes.", -"automation.sales_every_five_seconds":"Cada 5 segundos mientras juegas, acepta solo ofertas cuyos requisitos se cumplan y tengan capacidad de servicio disponible.", "badges.a_petabit_a_second":"Un petabit por segundo", "badges.a_secret_badge":"Una insignia secreta", "badges.attend_a_conference":"Asiste a una conferencia.", @@ -2521,6 +2516,107 @@ "notifications.n_min_ago":{"one":"hace {n} min","other":"hace {n} min"}, "notifications.nothing_in_the_last_10_minutes":"Nada en los últimos 10 minutos.", "notifications.show_all_n":"Mostrar las {n}", +"ops.annie":"Annie", +"ops.annie_d":"Responde desde el escritorio más cercano. Le encantan los puertos baratos y los IX llenos.", +"ops.anycast_annie":"Annie Anycast", +"ops.at_least_port":"al menos {port}", +"ops.budget":"Presupuesto", +"ops.by_hand":"Lotes puntuales", +"ops.by_hand_note":"Para cuando lo quieres todo hecho ya: cada peer en cada exchange, un kit de redundancia, PNIs con todos.", +"ops.cheapest":"El más barato", +"ops.ff_desc":"etiquetó un puerto en {city} como «TODO: arreglar luego (no arreglar)»", +"ops.ff_hostname":"renombró el router de {city} a router-final-FINAL-v2", +"ops.ff_lag":"añadió un miembro LAG de tránsito de más en {city}. Funciona, así que se queda.", +"ops.ff_line":"Ups: {name} {what}.", +"ops.ff_ping":"hizo ping a un resolver público desde {city} durante cuarenta minutos, por si acaso", +"ops.ff_typo":"escribió «pering» en todas las descripciones de interfaz de {city}", +"ops.fire":"Despedir", +"ops.fired":"{name} devolvió la tarjeta y se llevó la grapadora buena. Tus órdenes permanentes quedan en pausa.", +"ops.floor":"Conservar al menos", +"ops.hire_an_intern":"Contratar a un becario del NOC", +"ops.hire_mo":"Contratar · {price}/mes", +"ops.hire_pitch":"¿Harto de pulsar los mismos quince botones en cada ciudad? Contrata a un becario del NOC. Escribes las órdenes permanentes una vez; las ejecuta cada día, paga exactamente lo que costarían tus clics y deja una línea en el registro.", +"ops.hire_pitch_short":"Fija las reglas una vez y un becario pulsa los botones cada día.", +"ops.hired":"{name} se ha unido al NOC. Escribe unas órdenes permanentes y mañana se pone a trabajar.", +"ops.how_add":"añadir router", +"ops.how_auto":"añadir y luego cambiar", +"ops.how_it_works":"Cada día {name} repasa las órdenes activas, paga cada trabajo exactamente como si hubieras hecho clic y se detiene al llegar al presupuesto mensual de una orden o a tu mínimo de caja.", +"ops.how_swap":"cambiar de generación", +"ops.kevin":"Kevin", +"ops.kevin_d":"Ha visto todas las caídas desde la burbuja puntocom. Casi todas desde la sala del café.", +"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})"}, +"ops.l_peer":{"one":"hizo peering con una red en {where}","other":"hizo peering con {n} redes en {where}"}, +"ops.l_pni":{"one":"pidió un PNI en {where}","other":"pidió {n} PNIs ({where})"}, +"ops.l_quiet":"{name} miró las gráficas. No había nada que hacer.", +"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_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}.", +"ops.lpm_off":"La bandeja de peering sigue siendo cosa tuya. Para eso está el Large Peering Model; {name} no contesta correos.", +"ops.lpm_on":"El Large Peering Model contesta la bandeja de peering. {name} no se mete en su camino.", +"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", +"ops.o_caches_d":"Montar cada caché gratis que ofrezca una red, en cuanto su tráfico en esa ciudad pase un umbral.", +"ops.o_decom":"Retirar enlaces paralelos pequeños", +"ops.o_decom_d":"En cuanto funcione un enlace mayor entre dos ciudades, devolver las waves pequeñas que ya no hacen falta. Nunca una que un cliente alquile o necesite.", +"ops.o_ix":"Peering en cada IX", +"ops.o_ix_d":"Cada semana: unirse a los route servers y pedir peering a cada miembro dispuesto en cada uno de tus puertos de exchange.", +"ops.o_optics":"Encender más fibra", +"ops.o_optics_d":"Añadir ópticas a la fibra oscura que va caliente y encender la fibra nueva el día que te la entregan.", +"ops.o_pni":"PNI con los grandes", +"ops.o_pni_d":"Cada semana: pedir un PNI a cada red dispuesta que envíe suficiente tráfico en tus POPs, con el tamaño mínimo de cada red.", +"ops.o_repair":"Acelerar reparaciones", +"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_prov":"Proveedor", +"ops.p_tier":"Tamaño", +"ops.p_x":"Margen", +"ops.paused":"En pausa", +"ops.per_pop":"Por POP", +"ops.per_pop_note":"Las órdenes en verde se ejecutan en este POP. Apaga una para decidir aquí a mano.", +"ops.really_fire":"¿Despedir de verdad?", +"ops.salary":"Sueldo {price}/mes · desde {d}", +"ops.shift":"Turno de {name}", +"ops.spent_this_month":"Gastado este mes: {price}", +"ops.standing_orders":"Órdenes permanentes", +"ops.template":"POP nuevo desde plantilla", +"ops.template_note":"Elige lo que monta {name} cuando abres una ciudad desde la plantilla. Las órdenes permanentes se encargan del resto.", +"ops.tpl_bb":"Banda ancha", +"ops.tpl_done":"{name} abrió {city}: {list}.", +"ops.tpl_ix":"Puerto IX", +"ops.tpl_just_pop":"solo el POP", +"ops.tpl_kit":"Kit de redundancia", +"ops.tpl_offer":"{name} puede abrir esta ciudad de una vez: {list}.", +"ops.tpl_open":"Abrir desde plantilla · {cost}", +"ops.tpl_pop":"POP", +"ops.tpl_transit":"Tránsito de 10G", +"ops.tracy":"Tracy", +"ops.tracy_d":"Sigue cada paquete salto a salto. Al final llega, con alguna estrellita por el camino.", +"ops.tracy_route":"Tracy Route", "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.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index f58d605..7fc2ed1 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -12,11 +12,6 @@ "action_helpers.too_far_even_at_its_slowest":"Trop loin, même au débit le plus lent : ici une portée optique fait {span} km et l’optique va jusqu’à {max} km. Ajoute un site de régénération (Système de ligne).", "action_helpers.unlocks_at_customer_level_n":"Se débloque au niveau client {n}.", "actions.your_router_can_t_take_a":"Ton routeur ne supporte pas de port {port}.
Mets-le à niveau dans l’onglet Infra.", -"automation.auto_accept_sales":"Ventes automatiques : {state}", -"automation.auto_pay_repairs":"Réparations payées auto : {state}", -"automation.next_auto_check":"Temps avant la prochaine vérification automatique des conditions.", -"automation.repairs_when_affordable":"Pendant le jeu, paie automatiquement les réparations urgentes disponibles si les fonds suffisent.", -"automation.sales_every_five_seconds":"Toutes les 5 secondes pendant le jeu, accepte uniquement les offres dont les conditions sont remplies et la capacité de service disponible.", "badges.a_petabit_a_second":"Un pétabit par seconde", "badges.a_secret_badge":"Un badge secret", "badges.attend_a_conference":"Participe à une conférence.", @@ -2521,6 +2516,107 @@ "notifications.n_min_ago":{"one":"il y a {n} min","other":"il y a {n} min"}, "notifications.nothing_in_the_last_10_minutes":"Rien ces 10 dernières minutes.", "notifications.show_all_n":"Tout afficher ({n})", +"ops.annie":"Annie", +"ops.annie_d":"Répond depuis le bureau le plus proche. Adore les ports pas chers et les IX bien remplis.", +"ops.anycast_annie":"Annie Anycast", +"ops.at_least_port":"au moins {port}", +"ops.budget":"Budget", +"ops.by_hand":"Lots ponctuels", +"ops.by_hand_note":"Pour quand tu veux tout, tout de suite : chaque peer sur chaque exchange, un kit de redondance, des PNI avec tout le monde.", +"ops.cheapest":"Le moins cher", +"ops.ff_desc":"a étiqueté un port à {city} « TODO : corriger plus tard (ne pas corriger) »", +"ops.ff_hostname":"a renommé le routeur de {city} en router-final-FINAL-v2", +"ops.ff_lag":"a ajouté un membre LAG de transit en trop à {city}. Ça marche, donc ça reste.", +"ops.ff_line":"Oups : {name} {what}.", +"ops.ff_ping":"a pingé un résolveur public depuis {city} pendant quarante minutes, au cas où", +"ops.ff_typo":"a écrit « pering » dans toutes les descriptions d'interface à {city}", +"ops.fire":"Remercier", +"ops.fired":"{name} a rendu son badge et emporté la bonne agrafeuse. Tes ordres permanents sont en pause.", +"ops.floor":"Garder au moins", +"ops.hire_an_intern":"Recruter un stagiaire NOC", +"ops.hire_mo":"Recruter · {price}/mois", +"ops.hire_pitch":"Marre de cliquer sur les mêmes quinze boutons dans chaque ville ? Recrute un stagiaire NOC. Tu écris les ordres permanents une fois ; il les exécute chaque jour, paie exactement ce que coûteraient tes clics et laisse une ligne dans le journal.", +"ops.hire_pitch_short":"Fixe les règles une fois, un stagiaire clique sur les boutons chaque jour.", +"ops.hired":"{name} a rejoint le NOC. Écris quelques ordres permanents, et au travail dès demain.", +"ops.how_add":"ajouter un routeur", +"ops.how_auto":"ajouter, puis changer", +"ops.how_it_works":"Chaque jour, {name} passe en revue les ordres actifs, paie chaque tâche exactement comme si tu avais cliqué et s'arrête dès que le budget mensuel d'un ordre, ou ton plancher de trésorerie, est atteint.", +"ops.how_swap":"changer de génération", +"ops.kevin":"Kevin", +"ops.kevin_d":"A vu toutes les pannes depuis la bulle internet. Surtout depuis la salle café.", +"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})"}, +"ops.l_peer":{"one":"a peeré avec un réseau à {where}","other":"a peeré avec {n} réseaux à {where}"}, +"ops.l_pni":{"one":"a commandé un PNI à {where}","other":"a commandé {n} PNI ({where})"}, +"ops.l_quiet":"{name} a surveillé les graphes. Rien à faire.", +"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_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}.", +"ops.lpm_off":"La boîte de peering reste à toi. Pour ça, il y a le Large Peering Model ; {name} ne fait pas les mails.", +"ops.lpm_on":"Le Large Peering Model répond à la boîte de peering. {name} reste hors de son chemin.", +"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", +"ops.o_caches_d":"Installer chaque cache gratuit qu'un réseau propose, dès que son trafic dans la ville dépasse un seuil.", +"ops.o_decom":"Retirer les petits liens parallèles", +"ops.o_decom_d":"Dès qu'un plus gros lien relie deux villes, rendre les petites waves devenues inutiles. Jamais une qu'un client loue ou dont il dépend.", +"ops.o_ix":"Peerer sur chaque IX", +"ops.o_ix_d":"Chaque semaine : rejoindre les route servers et solliciter chaque membre partant sur chacun de tes ports d'exchange.", +"ops.o_optics":"Allumer plus de fibre", +"ops.o_optics_d":"Ajouter des optiques sur la fibre noire qui chauffe, et allumer la nouvelle fibre le jour de sa livraison.", +"ops.o_pni":"PNI avec les gros", +"ops.o_pni_d":"Chaque semaine : commander un PNI avec chaque réseau partant qui envoie assez de trafic sur tes POP, à la taille minimale de chaque réseau.", +"ops.o_repair":"Accélérer les réparations", +"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_prov":"Fournisseur", +"ops.p_tier":"Taille", +"ops.p_x":"Marge", +"ops.paused":"En pause", +"ops.per_pop":"Par POP", +"ops.per_pop_note":"Les ordres en vert s'appliquent à ce POP. Désactive-en un pour décider ici à la main.", +"ops.really_fire":"Vraiment remercier ?", +"ops.salary":"Salaire {price}/mois · depuis {d}", +"ops.shift":"Le service de {name}", +"ops.spent_this_month":"Dépensé ce mois-ci : {price}", +"ops.standing_orders":"Ordres permanents", +"ops.template":"Nouveau POP depuis le modèle", +"ops.template_note":"Choisis ce que {name} installe quand tu ouvres une ville depuis le modèle. Les ordres permanents s'occupent du reste.", +"ops.tpl_bb":"Haut débit", +"ops.tpl_done":"{name} a ouvert {city} : {list}.", +"ops.tpl_ix":"Port IX", +"ops.tpl_just_pop":"juste le POP", +"ops.tpl_kit":"Kit de redondance", +"ops.tpl_offer":"{name} peut ouvrir cette ville d'un coup : {list}.", +"ops.tpl_open":"Ouvrir depuis le modèle · {cost}", +"ops.tpl_pop":"POP", +"ops.tpl_transit":"Transit 10G", +"ops.tracy":"Tracy", +"ops.tracy_d":"Suit chaque paquet saut par saut. Arrive au bout, avec une ou deux étoiles en chemin.", +"ops.tracy_route":"Tracy Route", "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.", diff --git a/site/i18n/it.js b/site/i18n/it.js index 8f35453..d6752e3 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -12,11 +12,6 @@ "action_helpers.too_far_even_at_its_slowest":"Troppo lontano anche alla velocità più bassa: qui una tratta ottica è di {span} km e l’ottica arriva a {max} km. Aggiungi un sito di rigenerazione (Sistema di linea).", "action_helpers.unlocks_at_customer_level_n":"Si sblocca al livello cliente {n}.", "actions.your_router_can_t_take_a":"Il tuo router non regge una porta {port}.
Aggiornalo nella scheda Infra.", -"automation.auto_accept_sales":"Vendite automatiche: {state}", -"automation.auto_pay_repairs":"Riparazioni a pagamento auto: {state}", -"automation.next_auto_check":"Tempo fino alla prossima verifica automatica dei requisiti.", -"automation.repairs_when_affordable":"Durante il gioco, paga automaticamente le riparazioni urgenti disponibili se hai abbastanza fondi.", -"automation.sales_every_five_seconds":"Ogni 5 secondi durante il gioco, accetta solo le offerte con requisiti soddisfatti e capacità di servizio disponibile.", "badges.a_petabit_a_second":"Un petabit al secondo", "badges.a_secret_badge":"Un badge segreto", "badges.attend_a_conference":"Partecipa a una conferenza.", @@ -2521,6 +2516,107 @@ "notifications.n_min_ago":{"one":"{n} min fa","other":"{n} min fa"}, "notifications.nothing_in_the_last_10_minutes":"Niente negli ultimi 10 minuti.", "notifications.show_all_n":"Mostra tutte e {n}", +"ops.annie":"Annie", +"ops.annie_d":"Risponde dalla scrivania più vicina. Adora le porte economiche e gli IX pieni.", +"ops.anycast_annie":"Annie Anycast", +"ops.at_least_port":"almeno {port}", +"ops.budget":"Budget", +"ops.by_hand":"Lotti una tantum", +"ops.by_hand_note":"Per quando vuoi tutto fatto subito: ogni peer su ogni exchange, un kit di ridondanza, PNI con tutti.", +"ops.cheapest":"Il più economico", +"ops.ff_desc":"ha etichettato una porta a {city} «TODO: sistemare dopo (non sistemare)»", +"ops.ff_hostname":"ha rinominato il router di {city} in router-final-FINAL-v2", +"ops.ff_lag":"ha aggiunto un membro LAG di transit di troppo a {city}. Funziona, quindi resta.", +"ops.ff_line":"Ops: {name} {what}.", +"ops.ff_ping":"ha pingato un resolver pubblico da {city} per quaranta minuti, giusto per sicurezza", +"ops.ff_typo":"ha scritto «pering» in tutte le descrizioni delle interfacce a {city}", +"ops.fire":"Licenzia", +"ops.fired":"{name} ha restituito il badge e si è preso la spillatrice buona. I tuoi ordini permanenti sono in pausa.", +"ops.floor":"Tieni almeno", +"ops.hire_an_intern":"Assumi uno stagista NOC", +"ops.hire_mo":"Assumi · {price}/mese", +"ops.hire_pitch":"Stufo di cliccare gli stessi quindici pulsanti in ogni città? Assumi uno stagista NOC. Scrivi gli ordini permanenti una volta sola; lui li esegue ogni giorno, paga esattamente quanto costerebbero i tuoi clic e lascia una riga nel registro.", +"ops.hire_pitch_short":"Fissa le regole una volta, e uno stagista clicca i pulsanti ogni giorno.", +"ops.hired":"{name} è entrato nel NOC. Scrivi qualche ordine permanente e domani si comincia.", +"ops.how_add":"aggiungi router", +"ops.how_auto":"aggiungi, poi cambia", +"ops.how_it_works":"Ogni giorno {name} esegue gli ordini attivi, paga ogni lavoro esattamente come se avessi cliccato tu e si ferma quando raggiunge il budget mensile di un ordine o la tua soglia di cassa.", +"ops.how_swap":"cambia generazione", +"ops.kevin":"Kevin", +"ops.kevin_d":"Ha visto ogni guasto dai tempi della bolla dot-com. Quasi sempre dalla macchinetta del caffè.", +"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})"}, +"ops.l_peer":{"one":"ha fatto peering con una rete a {where}","other":"ha fatto peering con {n} reti a {where}"}, +"ops.l_pni":{"one":"ha ordinato un PNI a {where}","other":"ha ordinato {n} PNI ({where})"}, +"ops.l_quiet":"{name} ha guardato i grafici. Niente da fare.", +"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_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}.", +"ops.lpm_off":"La casella del peering resta tua. Per quella c'è il Large Peering Model; {name} non risponde alle email.", +"ops.lpm_on":"Il Large Peering Model risponde alla casella del peering. {name} gli sta alla larga.", +"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", +"ops.o_caches_d":"Monta ogni cache gratuita che una rete offre, appena il suo traffico in quella città supera una soglia.", +"ops.o_decom":"Ritira i piccoli link paralleli", +"ops.o_decom_d":"Quando un link più grande tra due città è attivo, restituisci le wave piccole che non servono più. Mai una che un cliente noleggia o da cui dipende.", +"ops.o_ix":"Peering su ogni IX", +"ops.o_ix_d":"Ogni settimana: entra nei route server e chiedi il peering a ogni membro disponibile su ciascuna delle tue porte di exchange.", +"ops.o_optics":"Accendi più fibra", +"ops.o_optics_d":"Aggiungi ottiche alla dark fiber che scotta e accendi la fibra nuova il giorno della consegna.", +"ops.o_pni":"PNI con i grandi", +"ops.o_pni_d":"Ogni settimana: ordina un PNI con ogni rete disponibile che manda abbastanza traffico nei tuoi POP, alla taglia minima di ciascuna rete.", +"ops.o_repair":"Accelera le riparazioni", +"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_prov":"Fornitore", +"ops.p_tier":"Taglia", +"ops.p_x":"Margine", +"ops.paused":"In pausa", +"ops.per_pop":"Per POP", +"ops.per_pop_note":"Gli ordini in verde valgono per questo POP. Spegnine uno per decidere qui a mano.", +"ops.really_fire":"Licenziare davvero?", +"ops.salary":"Stipendio {price}/mese · dal {d}", +"ops.shift":"Il turno di {name}", +"ops.spent_this_month":"Speso questo mese: {price}", +"ops.standing_orders":"Ordini permanenti", +"ops.template":"Nuovo POP da modello", +"ops.template_note":"Scegli cosa monta {name} quando apri una città dal modello. Al resto pensano gli ordini permanenti.", +"ops.tpl_bb":"Banda larga", +"ops.tpl_done":"{name} ha aperto {city}: {list}.", +"ops.tpl_ix":"Porta IX", +"ops.tpl_just_pop":"solo il POP", +"ops.tpl_kit":"Kit di ridondanza", +"ops.tpl_offer":"{name} può aprire questa città in un colpo solo: {list}.", +"ops.tpl_open":"Apri da modello · {cost}", +"ops.tpl_pop":"POP", +"ops.tpl_transit":"Transit 10G", +"ops.tracy":"Tracy", +"ops.tracy_d":"Segue ogni pacchetto hop per hop. Alla fine arriva, con qualche asterisco per strada.", +"ops.tracy_route":"Tracy Route", "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.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index a72d97f..b7acb7a 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -12,11 +12,6 @@ "action_helpers.too_far_even_at_its_slowest":"Longe demais até na configuração mais lenta: um span óptico aqui tem {span} km e ela alcança {max} km. Adicione um site de regeneração (Line system).", "action_helpers.unlocks_at_customer_level_n":"Desbloqueia no nível de cliente {n}.", "actions.your_router_can_t_take_a":"Seu router não aguenta uma porta {port}.
Faça upgrade na aba Infra.", -"automation.auto_accept_sales":"Vendas automáticas: {state}", -"automation.auto_pay_repairs":"Reparações pagas auto: {state}", -"automation.next_auto_check":"Tempo até à próxima verificação automática dos requisitos.", -"automation.repairs_when_affordable":"Durante o jogo, paga automaticamente as reparações urgentes disponíveis quando há fundos suficientes.", -"automation.sales_every_five_seconds":"A cada 5 segundos durante o jogo, aceita apenas ofertas com os requisitos cumpridos e capacidade de serviço disponível.", "badges.a_petabit_a_second":"Um petabit por segundo", "badges.a_secret_badge":"Um badge secreto", "badges.attend_a_conference":"Participe de uma conferência.", @@ -2521,6 +2516,107 @@ "notifications.n_min_ago":{"one":"há {n} min","other":"há {n} min"}, "notifications.nothing_in_the_last_10_minutes":"Nada nos últimos 10 minutos.", "notifications.show_all_n":"Mostrar todas as {n}", +"ops.annie":"Annie", +"ops.annie_d":"Responde da mesa mais próxima. Adora uma porta barata e um IX cheio.", +"ops.anycast_annie":"Annie Anycast", +"ops.at_least_port":"pelo menos {port}", +"ops.budget":"Orçamento", +"ops.by_hand":"Lotes avulsos", +"ops.by_hand_note":"Para quando você quer tudo feito agora: cada peer em cada exchange, um kit de redundância, PNIs com todo mundo.", +"ops.cheapest":"O mais barato", +"ops.ff_desc":"etiquetou uma porta em {city} como “TODO: corrigir depois (não corrigir)”", +"ops.ff_hostname":"renomeou o roteador de {city} para router-final-FINAL-v2", +"ops.ff_lag":"adicionou um membro LAG de trânsito a mais em {city}. Funciona, então fica.", +"ops.ff_line":"Ops: {name} {what}.", +"ops.ff_ping":"pingou um resolver público de {city} por quarenta minutos, só para garantir", +"ops.ff_typo":"escreveu “pering” em todas as descrições de interface em {city}", +"ops.fire":"Dispensar", +"ops.fired":"{name} devolveu o crachá e levou o grampeador bom. Suas ordens permanentes estão em pausa.", +"ops.floor":"Manter pelo menos", +"ops.hire_an_intern":"Contratar um estagiário de NOC", +"ops.hire_mo":"Contratar · {price}/mês", +"ops.hire_pitch":"Cansado de clicar nos mesmos quinze botões em cada cidade? Contrate um estagiário de NOC. Você escreve as ordens permanentes uma vez; ele as executa todo dia, paga exatamente o que seus cliques custariam e deixa uma linha no registro.", +"ops.hire_pitch_short":"Defina as regras uma vez, e um estagiário clica nos botões todo dia.", +"ops.hired":"{name} entrou no NOC. Escreva algumas ordens permanentes e amanhã começa o trabalho.", +"ops.how_add":"adicionar roteador", +"ops.how_auto":"adicionar, depois trocar", +"ops.how_it_works":"Todo dia {name} passa pelas ordens ativas, paga cada tarefa exatamente como se você tivesse clicado e para quando chega ao orçamento mensal de uma ordem ou ao seu piso de caixa.", +"ops.how_swap":"trocar de geração", +"ops.kevin":"Kevin", +"ops.kevin_d":"Viu todas as quedas desde a bolha pontocom. A maioria da copa.", +"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})"}, +"ops.l_peer":{"one":"fez peering com uma rede em {where}","other":"fez peering com {n} redes em {where}"}, +"ops.l_pni":{"one":"pediu um PNI em {where}","other":"pediu {n} PNIs ({where})"}, +"ops.l_quiet":"{name} ficou olhando os gráficos. Nada a fazer.", +"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_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}.", +"ops.lpm_off":"A caixa de peering continua com você. Para isso existe o Large Peering Model; {name} não responde e-mail.", +"ops.lpm_on":"O Large Peering Model responde a caixa de peering. {name} fica fora do caminho dele.", +"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", +"ops.o_caches_d":"Instalar cada cache grátis que uma rede oferece, assim que o tráfego dela na cidade passar de um limite.", +"ops.o_decom":"Desativar links paralelos pequenos", +"ops.o_decom_d":"Quando um link maior entre duas cidades estiver no ar, devolver as waves menores que não fazem mais falta. Nunca uma que um cliente aluga ou de que depende.", +"ops.o_ix":"Peering em cada IX", +"ops.o_ix_d":"Toda semana: entrar nos route servers e pedir peering a cada membro disposto em cada uma das suas portas de exchange.", +"ops.o_optics":"Acender mais fibra", +"ops.o_optics_d":"Adicionar ópticas à fibra escura que está esquentando e acender a fibra nova no dia da entrega.", +"ops.o_pni":"PNI com os grandes", +"ops.o_pni_d":"Toda semana: pedir um PNI com cada rede disposta que mande tráfego suficiente nos seus POPs, no tamanho mínimo de cada rede.", +"ops.o_repair":"Acelerar reparos", +"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_prov":"Provedor", +"ops.p_tier":"Tamanho", +"ops.p_x":"Folga", +"ops.paused":"Em pausa", +"ops.per_pop":"Por POP", +"ops.per_pop_note":"As ordens em verde valem neste POP. Desligue uma para decidir aqui na mão.", +"ops.really_fire":"Dispensar mesmo?", +"ops.salary":"Salário {price}/mês · desde {d}", +"ops.shift":"Turno de {name}", +"ops.spent_this_month":"Gasto este mês: {price}", +"ops.standing_orders":"Ordens permanentes", +"ops.template":"Novo POP por modelo", +"ops.template_note":"Escolha o que {name} monta quando você abre uma cidade pelo modelo. As ordens permanentes cuidam do resto.", +"ops.tpl_bb":"Banda larga", +"ops.tpl_done":"{name} abriu {city}: {list}.", +"ops.tpl_ix":"Porta de IX", +"ops.tpl_just_pop":"só o POP", +"ops.tpl_kit":"Kit de redundância", +"ops.tpl_offer":"{name} pode abrir esta cidade de uma vez: {list}.", +"ops.tpl_open":"Abrir pelo modelo · {cost}", +"ops.tpl_pop":"POP", +"ops.tpl_transit":"Trânsito de 10G", +"ops.tracy":"Tracy", +"ops.tracy_d":"Segue cada pacote salto a salto. Chega no fim, com uma ou duas estrelinhas no caminho.", +"ops.tracy_route":"Tracy Route", "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.", From 08413b53a3f1092b6eae16e611f1c25e1fdaafcd Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Wed, 28 Oct 2026 17:46:16 +0100 Subject: [PATCH 3/6] Tests: #185 sales and repair run as standing orders; batches open from the Ops sheet --- tests/automation.test.js | 241 ++++++++------------------------------- tests/pni-global.test.js | 6 +- tests/utilities.test.js | 5 +- 3 files changed, 56 insertions(+), 196 deletions(-) diff --git a/tests/automation.test.js b/tests/automation.test.js index 5ae9473..6b772f8 100644 --- a/tests/automation.test.js +++ b/tests/automation.test.js @@ -2,136 +2,30 @@ const test = require('node:test'); const assert = require('node:assert/strict'); const { load } = require('./harness'); +// #185's sales and repair engines now run as the NOC intern's standing orders, once per game day. 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});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');compute()"); } +const orders = (ev, on) => ev(`for(const k of ${JSON.stringify(on)})S.ops.on[k]=true`); +const shift = ev => ev('opsDay(S.day)'); function offer(ev, id, extra = {}) { ev(`S.offers.push(${JSON.stringify({ id, city: 'fra', name: id, type: 'dia', bw: 1, rate: 600, reqs: [], exp: 30, ...extra })})`); } -test('auto-accept waits five real seconds at every game speed and the toggle stops it', () => { - for (const speed of [0.5, 1, 2, 4, 8]) { - const { ev, dom, errors } = load(); - setup(ev); - offer(ev, 'first'); - ev("ACT.autoToggle({k:'autoSales'});UI.autoSalesAt=1000"); - const start = ev('UI.autoSalesAt'); - ev(`UI.speed=${speed};automationTick(${start + 4999})`); - assert.equal(ev('S.biz.length'), 0, speed); - ev(`automationTick(${start + 5000})`); - assert.equal(ev('S.biz[0].id'), 'first', speed); - offer(ev, 'second'); - ev(`automationTick(${start + 9999})`); - assert.equal(ev('S.biz.length'), 1, speed); - ev(`automationTick(${start + 10000})`); - assert.equal(ev('S.biz.length'), 2, speed); - ev("ACT.autoToggle({k:'autoSales'})"); - offer(ev, 'off'); - ev(`automationTick(${start + 20000});ACT.accept({id:'off',auto:true})`); - assert.equal(ev('S.biz.length'), 2, speed); - assert.equal(ev('S.offers[0].id'), 'off', speed); - assert.deepEqual(errors, []); - dom.window.close(); - } -}); - -test('Accept buttons share a real-time countdown in Deals, city offers and fiber broker offers', () => { +test('the sales order signs ready offers once per shift, and pausing it stops it', () => { const { ev, dom, errors } = load(); setup(ev); - offer(ev, 'ready'); - offer(ev, 'waiting', { reqs: ['gen'] }); - ev("window.testNow=1000;performance.now=()=>testNow;ACT.leftTab({t:'deals'});UI.sel={type:'city',id:'fra'};UI.tab='cust';UI.leftOpen=true;renderAll()"); - assert.equal(dom.window.document.querySelectorAll('[data-auto-sales]').length, 0); - ev("ACT.autoToggle({k:'autoSales'});renderAutoCountdown()"); - const counts = () => [...dom.window.document.querySelectorAll('[data-auto-sales]')]; - const readyCounts = () => counts().filter(el => el.dataset.autoSales === 'ready'); - assert.ok(readyCounts().length >= 2, 'Deals and the city panel both show it'); - assert.ok(readyCounts().every(el => el.textContent === '(5)')); - assert.ok(counts().filter(el => el.dataset.autoSales === 'waiting').every(el => el.textContent === ''), 'unmet requirements have no countdown'); - ev('testNow=2001;renderAutoCountdown()'); - assert.ok(readyCounts().every(el => el.textContent === '(4)')); - ev('testNow=3000;UI.speed=8;renderAutoCountdown()'); - assert.ok(readyCounts().every(el => el.textContent === '(3)')); - ev('UI.speed=0.5;renderAll();renderAutoCountdown()'); - assert.ok(readyCounts().every(el => el.textContent === '(3)'), 'game speed and re-rendering leave the real-time clock alone'); - assert.match(dom.window.document.querySelector('#leftBody [data-act="accept"]').textContent, /Accept \(3\)/); - ev("ACT.buildPop({city:'ams'});S.links.push({id:'fiber',a:'fra',b:'ams',kind:'df',sys:'lite',ch:[],own:true,km:450,ready:0,cut:0,mo:1})"); - offer(ev, 'broker', { type: 'wwave', city2: 'ams', link: 'fiber', slots: 1, what: 'One wave' }); - ev("compute();UI.sel={type:'link',id:'fiber'};renderPanel()"); - const broker = dom.window.document.querySelector('#panelBody [data-act="accept"] [data-auto-sales]'); - assert.ok(broker); - assert.equal(broker.textContent, '(3)'); - ev('testNow=6000;automationTick(testNow);renderAutoCountdown()'); - assert.equal(ev("S.biz.some(b=>b.id==='ready')"), true); - assert.equal(ev("S.offers.some(o=>o.id==='waiting')"), true, 'the countdown does not bypass requirements'); - offer(ev, 'next-ready'); - ev('renderAll();renderAutoCountdown()'); - assert.ok(counts().filter(el => el.dataset.autoSales === 'next-ready').every(el => el.textContent === '(5)'), 'the next check starts a fresh countdown'); - ev("ACT.autoToggle({k:'autoSales'});renderAutoCountdown()"); - assert.equal(counts().length, 0); - assert.deepEqual(errors, []); - dom.window.close(); -}); - -test('only ready offers get a countdown, including after requirements or capacity change', () => { - const { ev, dom, errors } = load(); - setup(ev); - offer(ev, 'ready'); - offer(ev, 'needs-generator', { reqs: ['gen'] }); - offer(ev, 'too-big', { bw: 1000 }); - offer(ev, 'expired', { exp: 0 }); - ev("window.testNow=1000;performance.now=()=>testNow;ACT.leftTab({t:'deals'});ACT.autoToggle({k:'autoSales'});renderAutoCountdown()"); - const count = id => dom.window.document.querySelector(`#leftBody [data-auto-sales="${id}"]`).textContent; - assert.equal(count('ready'), '(5)'); - assert.equal(count('needs-generator'), ''); - assert.equal(count('too-big'), ''); - assert.equal(count('expired'), ''); - ev('S.pops.fra.gen=true;after()'); - assert.equal(count('needs-generator'), '(5)', 'becoming eligible shows the timer'); - ev('S.pops.fra.gen=false;compute();renderAutoCountdown()'); - assert.equal(count('needs-generator'), '', 'a requirement becoming false hides it immediately'); - ev("S.offers.find(o=>o.id==='too-big').bw=2;after()"); - assert.equal(count('too-big'), '(5)', 'actions invalidate the capacity preview'); - ev('testNow=6000;automationTick(testNow);renderAutoCountdown()'); - assert.equal(ev("S.offers.some(o=>o.id==='needs-generator')"), true, 'acceptance checks requirements again'); - assert.deepEqual(errors, []); - dom.window.close(); -}); - -test('readiness trials are shared between views and are not repeated for every redraw', () => { - const { ev, dom, errors } = load(); - setup(ev); - offer(ev, 'ready'); - ev("window.testNow=1000;performance.now=()=>testNow;ACT.leftTab({t:'deals'});UI.sel={type:'city',id:'fra'};UI.tab='cust';window.originalAutoOffer=autoOffer;window.trials=0;window.autoOffer=o=>{trials++;return originalAutoOffer(o)};ACT.autoToggle({k:'autoSales'})"); - assert.equal(ev('trials'), 1); - ev('renderAll();compute();renderAll();renderAutoCountdown()'); - assert.equal(ev('trials'), 1, 'ordinary routing refreshes reuse the preview'); - ev('after()'); - assert.equal(ev('trials'), 2, 'a real action refreshes readiness'); - ev('window.autoOffer=originalAutoOffer'); - assert.deepEqual(errors, []); - dom.window.close(); -}); - -test('auto-accept leaves unready and expired offers alone without failure notifications', () => { - const { ev, dom, errors } = load(); - setup(ev); - offer(ev, 'generator', { reqs: ['gen'] }); - offer(ev, 'missing-pop', { city: 'ams' }); - offer(ev, 'scrub', { type: 'scrub' }); - offer(ev, 'expired', { exp: 0 }); - offer(ev, 'ipv6', { reqs: ['ipv6'] }); - const log = ev('S.log.length'); - ev('S.autoSales=true;UI.autoGame=S;UI.autoSalesAt=0;automationTick(5000)'); - assert.equal(ev('S.biz.length'), 0); - assert.equal(ev('S.offers.length'), 5); - assert.equal(ev('S.log.length'), log, 'no repeated failed manual-action toasts'); - ev('S.pops.fra.gen=true;compute();automationTick(10000)'); - 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. - ev("ACT.accept({id:'scrub'})"); - assert.equal(ev("S.biz.some(b=>b.id==='scrub')"), true); + offer(ev, 'first'); + shift(ev); + assert.equal(ev('S.biz.length'), 0, 'off by default'); + orders(ev, ['sales']); + shift(ev); + assert.equal(ev('S.biz[0].id'), 'first'); + ev("ACT.opsToggle({k:'sales'})"); + offer(ev, 'off'); + ev('dayTick()'); + assert.equal(ev('S.biz.length'), 1, 'a paused order signs nothing'); + assert.ok(ev("S.offers.some(o=>o.id==='off')")); assert.deepEqual(errors, []); dom.window.close(); }); @@ -146,7 +40,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.autoSales=true;UI.autoGame=S;UI.autoSalesAt=0;automationTick(5000)'); + ev('S.ops.on.sales=true;opsDay(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); @@ -154,7 +48,7 @@ test('the trial includes new bandwidth and later offers cannot overbook earlier dom.window.close(); }); -test('auto-accept checks actual circuits, latency and NNI capacity', () => { +test('the sales order 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()"); @@ -170,7 +64,7 @@ test('auto-accept 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.autoSales=true;UI.autoGame=S;UI.autoSalesAt=0;automationTick(5000)"); + ev("S.transit[0].tier=4;compute();S.ops.on.sales=true;opsDay(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")); @@ -200,7 +94,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.autoSales=true;UI.autoGame=S;UI.autoSalesAt=0;automationTick(5000)'); + ev('S.links[0].eqDown=0;compute();S.ops.on.sales=true;opsDay(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); @@ -216,7 +110,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.autoSales=true;UI.autoGame=S;UI.autoSalesAt=0;automationTick(5000)'); + ev('S.ops.on.sales=true;opsDay(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 }); @@ -230,7 +124,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.autoSales=true;UI.autoGame=S;UI.autoSalesAt=0;automationTick(5000)'); + ev('S.ops.on.sales=true;opsDay(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 }); @@ -257,7 +151,7 @@ test('failed capacity trials restore game, routing and map state even when compu dom.window.close(); }); -test('auto-pay rushes affordable repairs once, skips unaffordable and expired incidents, and obeys its toggle', () => { +test('the repair order rushes affordable repairs once, skips unaffordable and expired incidents, and obeys its pause', () => { const { ev, dom, errors } = load(); setup(ev); ev(`S.cash=10000;S.links=[{id:'fiber',a:'fra',b:'ams',kind:'df',sys:'lite',ch:['zr4'],km:450,sub:false,ready:0,cut:0,eqDown:10,chFail:{i:0,until:10},mo:1}]; @@ -268,7 +162,7 @@ test('auto-pay rushes affordable repairs once, skips unaffordable and expired in {id:'orphan',type:'amp',ref:'gone',until:10,cost:299,msg:'Removed equipment'}, {id:'expired',type:'amp',ref:'fiber',until:0,cost:1000,msg:'Expired'}, {id:'ddos',type:'ddos',ref:'fra',until:10,cost:1000,msg:'Attack'}]; - S.autoRepair=true;UI.autoGame=S;UI.autoSalesAt=0;automationTick(1)`); + S.ops.on.repair=true;opsDay(S.day)`); assert.equal(ev('S.cash'), 3000); assert.equal(ev("S.inc.some(i=>i.id==='optic')"), false); assert.equal(ev('S.links[0].chFail'), null); @@ -276,88 +170,51 @@ test('auto-pay rushes affordable repairs once, skips unaffordable and expired in assert.equal(ev("S.inc.find(i=>i.id==='slow').until"), 1); assert.equal(ev("S.inc.find(i=>i.id==='slow').cost"), 0); assert.equal(ev('S.pops.fra.down'), 1); - ev('automationTick(2)'); + ev('opsDay(S.day)'); assert.equal(ev('S.cash'), 3000, 'no duplicate rush payment'); - ev('S.cash=40000;automationTick(3)'); + ev('S.cash=40000;opsDay(S.day)'); assert.equal(ev('S.cash'), 10000); assert.equal(ev('S.links[0].eqDown'), 0); assert.equal(ev("S.inc.some(i=>i.id==='amp')"), false); - ev("ACT.autoToggle({k:'autoRepair'});S.inc.push({id:'new',type:'amp',ref:'fiber',until:10,cost:1000,msg:'New failure'});automationTick(4)"); + ev("ACT.opsToggle({k:'repair'});S.inc.push({id:'new',type:'amp',ref:'fiber',until:10,cost:1000,msg:'New failure'});opsDay(S.day)"); assert.equal(ev('S.cash'), 10000); assert.equal(ev("S.inc.some(i=>i.id==='new')"), true); assert.deepEqual(errors, []); dom.window.close(); }); -test('automation pauses with the game, dialogs, hidden pages and game over', () => { +test('the sales order leaves unready and expired offers alone without failure notifications', () => { const { ev, dom, errors } = load(); setup(ev); - offer(ev, 'paused'); - ev('S.autoSales=true;UI.autoGame=S;UI.autoSalesAt=0;UI.speed=0;automationTick(5000)'); + offer(ev, 'generator', { reqs: ['gen'] }); + offer(ev, 'missing-pop', { city: 'ams' }); + offer(ev, 'scrub', { type: 'scrub' }); + 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)'); assert.equal(ev('S.biz.length'), 0); - ev('UI.speed=1;automationTick(9999)'); - assert.equal(ev('S.biz.length'), 0, 'resume starts a fresh five-second wait'); - ev("openModal('

Menu

');automationTick(10000);closeModal()"); - ev("Object.defineProperty(document,'visibilityState',{configurable:true,value:'hidden'});automationTick(15000)"); - ev("Object.defineProperty(document,'visibilityState',{configurable:true,value:'visible'});S.lost=true;automationTick(20000);S.lost=false;automationTick(24999)"); - assert.equal(ev('S.biz.length'), 0); - ev('automationTick(25000)'); + 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.biz.length'), 1); + assert.equal(ev('S.biz[0].id'), 'generator'); + // Manual acceptance keeps its existing sign-now, provision-later behavior. + ev("ACT.accept({id:'scrub'})"); + assert.equal(ev("S.biz.some(b=>b.id==='scrub')"), true); assert.deepEqual(errors, []); dom.window.close(); }); -test('the frame loop repairs new incidents without waiting for the sales timer', () => { +test('the #185 toggles in old saves become the sales and repair orders, malformed ones stay off', () => { const { ev, dom, errors } = load(); setup(ev); - ev(`S.autoRepair=true;S.links=[{id:'fiber',a:'fra',b:'ams',kind:'df',sys:'lite',ch:['zr4'],km:450,sub:false,ready:0,cut:0,mo:1}]; - window.originalDay=dayTick;window.dayTick=()=>{S.links[0].eqDown=10;S.inc.push({id:'new',type:'amp',ref:'fiber',until:10,cost:1000,msg:'Broken amp'})}; - window.cashBefore=S.cash;last=0;acc=DAY_MS;frame(16);window.dayTick=originalDay`); - assert.equal(ev('S.cash'), ev('cashBefore-1000')); - assert.equal(ev('S.inc.length'), 0); - assert.equal(ev('S.links[0].eqDown'), 0); + 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); + 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.deepEqual(errors, []); dom.window.close(); }); - -test('toggles persist, old and malformed saves default off, and the timer resets for another game', () => { - const { ev, dom, errors } = load(); - setup(ev); - assert.equal(ev('S.autoSales||S.autoRepair'), false); - ev("ACT.autoToggle({k:'autoSales'});ACT.autoToggle({k:'autoRepair'});save();S=migrate(JSON.parse(localStorage.getItem('sot-save-v1')))"); - assert.equal(ev('S.autoSales&&S.autoRepair'), true); - ev("delete S.autoSales;delete S.autoRepair;S=migrate(S)"); - assert.equal(ev('S.autoSales||S.autoRepair'), false); - ev("S.autoSales='true';S.autoRepair=1;S=migrate(S);ACT.autoToggle({k:'cash'})"); - assert.equal(ev('S.autoSales||S.autoRepair'), false); - ev('UI.autoGame=S;UI.autoSalesAt=0;S=migrate(JSON.parse(JSON.stringify(S)));S.autoSales=true;compute()'); - offer(ev, 'imported'); - ev('automationTick(100000)'); - assert.equal(ev('S.biz.length'), 0, 'an imported game does not inherit another game timer'); - ev('automationTick(105000)'); - assert.equal(ev('S.biz.length'), 1); - assert.deepEqual(errors, []); - dom.window.close(); -}); - -test('both toggle buttons work by keyboard-compatible DOM events on phones in every language', () => { - for (const lang of ['en', 'it', 'pt', 'fr', 'es']) { - const { ev, dom, errors } = load(lang === 'en' ? {} : { lang }); - setup(ev); - dom.window.innerWidth = 360; - for (const [tab, key] of [['deals', 'autoSales'], ['noc', 'autoRepair']]) { - ev(`ACT.leftTab({t:'${tab}'});renderAll()`); - const button = [...dom.window.document.querySelectorAll('#leftBody [data-act="autoToggle"]')].find(b => JSON.parse(b.dataset.args).k === key); - assert.ok(button, lang); - assert.equal(button.getAttribute('aria-pressed'), 'false', lang); - button.focus(); - button.click(); - const updated = dom.window.document.querySelector('#leftBody [data-act="autoToggle"]'); - assert.equal(updated.getAttribute('aria-pressed'), 'true', lang); - assert.equal(ev(`S.${key}`), true, lang); - assert.doesNotMatch(dom.window.document.getElementById('leftBody').textContent, /automation\./, lang); - } - assert.deepEqual(errors, [], lang); - dom.window.close(); - } -}); diff --git a/tests/pni-global.test.js b/tests/pni-global.test.js index de03c9a..9661a0d 100644 --- a/tests/pni-global.test.js +++ b/tests/pni-global.test.js @@ -100,14 +100,16 @@ test('global PNIs require the full budget and reject unsupported sizes and an em dom.window.close(); }); -test('the global Traffic button preserves scope, keyboard focus and translations on phones', () => { +test('the global batch, now in the Ops sheet, preserves scope, keyboard focus and translations on phones', () => { for (const lang of ['en', 'it', 'pt', 'fr', 'es']) { const { dom, ev, errors } = load(lang === 'en' ? {} : { lang }); setup(ev); dom.window.innerWidth = 360; + // The Traffic tab now points at the Ops sheet, where the one-off batches live. ev("ACT.dash();ACT.dashTab({k:'traffic'})"); const doc = dom.window.document; - const button = [...doc.querySelectorAll('#dashCard [data-act="pniAllOpen"]')].find(b => JSON.parse(b.dataset.args).net === null); + doc.querySelector('#dashCard [data-act="opsOpen"]').click(); + const button = [...doc.querySelectorAll('#modalCard [data-act="pniAllOpen"]')].find(b => JSON.parse(b.dataset.args).net === null); assert.ok(button, lang); button.click(); assert.equal(doc.querySelector('#modalCard h2').textContent, ev("tr('pni_all.peer_all_networks')"), lang); diff --git a/tests/utilities.test.js b/tests/utilities.test.js index 1e86ee5..d096951 100644 --- a/tests/utilities.test.js +++ b/tests/utilities.test.js @@ -89,11 +89,12 @@ test('bulk peering skips disconnected IXs, route server coverage and existing do assert.deepEqual(errors, []); }); -test('utilities are available from the menu and PoP Infra in every language', t => { +test('utilities are available from the Ops sheet in the menu and from PoP Infra in every language', t => { for (const lang of ['en', 'it', 'pt', 'fr', 'es']) { const { ev, dom, errors } = setup(t, lang === 'en' ? {} : { lang }); ev('ACT.menu()'); - assert.ok(dom.window.document.querySelector('[data-act="utilities"]'), lang); + dom.window.document.querySelector('#modalCard [data-act="opsOpen"]').click(); + assert.ok(dom.window.document.querySelector('#modalCard [data-act="utilities"]'), lang); ev("selectCity('fra');ACT.tab({t:'links'})"); assert.ok(dom.window.document.querySelector('#panelBody [data-act="utilityKit"]'), lang); ev('ACT.utilities()'); From c3c25fe5656aa617469320a816b5107205457ac7 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Wed, 28 Oct 2026 17:52:37 +0100 Subject: [PATCH 4/6] Tests for standing orders: each order costs what the clicks cost; budget, pause, saves, fat fingers, phones --- src/game/60-features/95-standing-orders.js | 13 +- tests/standing-orders.test.js | 325 +++++++++++++++++++++ 2 files changed, 332 insertions(+), 6 deletions(-) create mode 100644 tests/standing-orders.test.js diff --git a/src/game/60-features/95-standing-orders.js b/src/game/60-features/95-standing-orders.js index 248fe53..582e273 100644 --- a/src/game/60-features/95-standing-orders.js +++ b/src/game/60-features/95-standing-orders.js @@ -27,7 +27,7 @@ const OPS_SAY={transit:N_('ops.l_transit'),routers:N_('ops.l_routers'),caches:N_ // 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_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:{},mon:0,skip:{},log:[],floor:50000,tpl:{bb:true,transit:true,ix:true,kit:true}};} +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])),mon:0,skip:{},log:[],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)); const opsCanHire=()=>lvl()>=2; @@ -65,9 +65,9 @@ function opsQuiet(fn){const a=after,t=toast,s=sfx,f=floater,sel=UI.sel,cf=UI.con // One shift's bookkeeping: what got done, and whether a job had to wait for next month's budget. function opsShift(){const r=new Map(),broke=new Set(); return {r,broke,did(k,w){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);}, - can(k,cost){const O=S.ops,cap=opsCap(k);if(cost<=0)return true;if(S.cash-costcap)){broke.add(k);return false;}return true;}, + can(k,cost){const O=S.ops,cap=opsCap(k);if(cost<=0)return true;if(S.cash-costcap)){broke.add(k);return false;}return true;}, // Run a click and book what it really cost; false when the action refused (no ports, no cash, a quote changed). - pay(k,fn){const c0=S.cash,x=fn();const d=c0-S.cash;if(d>0&&OPSK[k].cap)S.ops.spent[k]+=d;return x===undefined?d>0:x;}};} + pay(k,fn){const c0=S.cash,x=fn();const d=c0-S.cash;if(d>0&&OPSK[k].cap)S.ops.spent[k]=(S.ops.spent[k]||0)+d;return x===undefined?d>0:x;}};} const cheapestTransit=c=>NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>transitPerG(a,c,premOnlyAt(a,c))-transitPerG(b,c,premOnlyAt(b,c)))[0]; // The orders. Each takes the shift and does its jobs through the player's own actions. const OPS_RUN={ @@ -151,7 +151,8 @@ function opsDay(d){if(!opsHired())return;const O=S.ops,m=Math.floor(d/30);if(m!= 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'));} if(T.transit&&!scnRule('noTransit')){const pv=opsP('transit','prov');net=pv!=='cheap'&&sellsAt(NET[pv],c)?NET[pv]:cheapestTransit(c);if(net){cost+=PORT[0].setup;parts.push(tr('ops.tpl_transit'));}} - // DE-KICKS wants a sales call before any port, so the template leaves those to the player. - if(T.ix&&CITY[c].ix&&!isDk(c)){ix=c;cost+=ixPortMo(c,0);parts.push(tr('ops.tpl_ix'));} - if(T.kit){S.pops[c]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};try{kit=utilityKit(c);}finally{delete S.pops[c];}if(kit&&kit.cost){cost+=kit.cost;parts.push(tr('ops.tpl_kit'));}} + // Priced as if the POP were already there (an IX port is dearer from afar). DE-KICKS wants a sales call first, so not those. + S.pops[c]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false}; + try{if(T.ix&&CITY[c].ix&&!isDk(c)&&S.ixp[c]===undefined){ix=c;cost+=ixPortMo(c,0);parts.push(tr('ops.tpl_ix'));} + if(T.kit){kit=utilityKit(c);if(kit&&kit.cost){cost+=kit.cost;parts.push(tr('ops.tpl_kit'));}}}finally{delete S.pops[c];} return {cost,net:net&&net.id,ix,kit:!!(kit&&kit.cost),parts};} diff --git a/tests/standing-orders.test.js b/tests/standing-orders.test.js new file mode 100644 index 0000000..af96b48 --- /dev/null +++ b/tests/standing-orders.test.js @@ -0,0 +1,325 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +// A small network with a hired intern, every order off, no cash floor and no fat fingers (Change Freeze). +const BASE = "ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=3;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');" + + "ACT.launchBB({city:'fra'});S.pops.fra.bb.d=300;S.pops.fra.rgen=1;ACT.buyTransit({city:'fra',net:'cog',tier:1});compute()"; +function game(t, extra = '') { + const h = load(); + t.after(() => h.dom.window.close()); + h.ev(BASE); + if (extra) h.ev(extra); + return h; +} +const hire = ev => ev("ACT.opsHire({id:'kevin'});S.ops.floor=0;closeModal()"); +const on = (ev, k, p = {}, cap) => ev(`S.ops.on.${k}=true;S.ops.p.${k}=${JSON.stringify(p)};${cap === undefined ? '' : `S.ops.cap.${k}=${cap};`}`); +const shift = ev => ev('opsDay(S.day)'); +const cash = ev => ev('S.cash'); +// The same game twice: the intern's shift in one, the player's own clicks in the other. Both must cost the same and end the same. +function twins(t, extra, order, manual, pick) { + const A = game(t), B = game(t); + // Hire first: hiring recomputes, which would wipe any routing state the case stages. + hire(A.ev); hire(B.ev); + if (extra) { A.ev(extra); B.ev(extra); } + order(A.ev); + const a0 = cash(A.ev); shift(A.ev); const a1 = cash(A.ev); + const b0 = cash(B.ev); B.ev(manual); const b1 = cash(B.ev); + assert.ok(a0 - a1 > 0, 'the order did some paid work'); + assert.equal(a0 - a1, b0 - b1, 'the shift cost exactly what the clicks cost'); + if (pick) assert.equal(A.ev(pick), B.ev(pick), 'and left the network the same'); + assert.deepEqual(A.errors, []); assert.deepEqual(B.errors, []); + return A; +} + +test('a new game has no intern and every order off; nothing runs and no random numbers are drawn', t => { + const { ev, errors } = game(t); + assert.equal(ev('S.ops.intern'), null); + assert.equal(ev('Object.values(S.ops.on).some(Boolean)'), false); + ev("for(const k in S.ops.on)S.ops.on[k]=true"); + const r = ev('window.__n=0;window.__r=Math.random;Math.random=()=>{__n++;return __r()};const s=JSON.stringify(S);opsDay(S.day);Math.random=__r;s===JSON.stringify(S)&&__n===0'); + assert.equal(r, true, 'no intern: orders never run, even switched on'); + assert.deepEqual(errors, []); +}); + +test('the intern is hired from customer level 2 (or with gates open), costs a monthly salary, and can be let go', t => { + const { ev, errors } = game(t); + ev("S.lvl=1;ACT.opsHire({id:'kevin'})"); + assert.equal(ev('S.ops.intern'), null, 'level 1: not yet'); + ev("S.rules=makeRules('sandbox');S.rules.preset='freeze';ACT.opsHire({id:'annie'})"); + assert.equal(ev('S.ops.intern'), 'annie', 'gates open'); + ev("S.ops.intern=null;S.rules=makeRules('freeze');S.lvl=2;compute()"); + const mo = ev('R.costMo'), c0 = cash(ev); + ev("ACT.opsHire({id:'tracy'})"); + assert.equal(ev('S.ops.intern'), 'tracy'); + assert.equal(c0 - cash(ev), ev('INTERN_MO'), 'first month up front'); + assert.equal(ev('R.costMo') - mo, ev('INTERN_MO'), 'then a monthly salary'); + ev("ACT.opsFire();ACT.opsFire()"); + assert.equal(ev('S.ops.intern'), null); + assert.deepEqual(errors, []); +}); + +test('transit headroom adds a LAG member, exactly as the + member button would', t => { + const A = twins(t, "S.transit[0].hist=[60,80,70]", + ev => on(ev, 'transit', { x: 1.5 }), + "ACT.lagT({id:S.transit[0].id,d:1})", "JSON.stringify(S.transit.map(t=>[t.net,t.tier,t.n||1]))"); + assert.match(A.ev('opsEntry(S.ops.log[0])'), /Kevin topped up transit in Frankfurt \+1×100G/); +}); + +test('transit headroom buys a new port from a chosen provider and stops at the multiple', t => { + const A = twins(t, "S.transit[0].hist=[100]", + ev => on(ev, 'transit', { x: 2, prov: 'ntt' }), + "ACT.buyTransit({city:'fra',net:'ntt',tier:1})", "JSON.stringify(S.transit.map(t=>[t.net,t.tier,t.n||1]))"); + assert.ok(A.ev("S.transit.reduce((a,t)=>a+lagCap(PORT[t.tier].g,t.n),0)") >= 200); +}); + +test('routers: add one above the load level, as Add router would', t => { + twins(t, "R.nodeLoad.fra=R.nodeCap.fra*0.85", + ev => on(ev, 'routers', { at: 80, how: 'add' }), + "ACT.addRouter({city:'fra'})", 'S.pops.fra.routers'); +}); + +test('routers: swap generation only where a second router carries the traffic', t => { + const { ev, errors } = game(t, 'R.nodeLoad.fra=R.nodeCap.fra*0.95'); + hire(ev); on(ev, 'routers', { at: 80, how: 'swap' }); + shift(ev); + assert.equal(ev('S.pops.fra.rgen'), 1, 'one router: a swap would be an outage, so no'); + ev('S.pops.fra.routers=2;compute();R.nodeLoad.fra=R.nodeCap.fra*0.95'); + const want = ev('swapCost("fra",mainRG(RG[1].cls+1))'), c0 = cash(ev); + shift(ev); + assert.equal(ev('S.pops.fra.rgen'), ev('mainRG(RG[1].cls+1)')); + assert.equal(c0 - cash(ev), want, 'paid the swap price after trade-in'); + assert.equal(ev("S.inc.some(i=>i.type==='maint')"), false); + assert.deepEqual(errors, []); +}); + +test('caches: free boxes only once the network sends enough traffic locally', t => { + const { ev, errors } = game(t); + hire(ev); + const best = ev("NETS.filter(n=>n.cache&&(R.demTo[n.id]||0)>=n.cache.min).map(n=>(R.cityDem.fra||0)*NSH[n.id]).sort((a,b)=>b-a)[0]||0"); + assert.ok(best > 0, 'some network qualifies for a cache in this game'); + on(ev, 'caches', { g: 50 }); + if (best < 50) { shift(ev); assert.equal(ev('S.caches.length'), 0, 'below the threshold: nothing'); } + on(ev, 'caches', { g: 1 }); + const c0 = cash(ev); + shift(ev); + const want = JSON.parse(ev("JSON.stringify(utilityCaches('fra'))")); + assert.ok(ev('S.caches.length') > 0); + assert.equal(want.add.filter(x => ev(`(R.cityDem.fra||0)*NSH['${x.net}']`) >= 1).length, 0, 'every eligible box is in'); + assert.equal(cash(ev), c0, 'caches are free to rack'); + assert.deepEqual(errors, []); +}); + +test('IX: weekly route servers and every willing peer, the same as the #192 batch', t => { + const A = game(t, "ACT.buyIx({city:'fra',tier:0,signed:true});ACT.buyIx({city:'ams',tier:0})"), B = game(t, "ACT.buyIx({city:'fra',tier:0,signed:true});ACT.buyIx({city:'ams',tier:0})"); + hire(A.ev); on(A.ev, 'ix'); + A.ev('S.day=13');shift(A.ev); + assert.equal(A.ev('Object.keys(S.rs).length'), 0, 'not on a weekday the intern skips'); + A.ev('S.day=14');shift(A.ev); + B.ev('ACT.utilityRouteServers();ACT.utilityPeers()'); + assert.equal(A.ev('JSON.stringify(S.rs)'), B.ev('JSON.stringify(S.rs)')); + assert.equal(A.ev('JSON.stringify(Object.keys(S.peers).sort())'), B.ev('JSON.stringify(Object.keys(S.peers).sort())')); + assert.equal(A.ev('utilityPeers().reduce((n,r)=>n+r.requests.length,0)'), 0); + assert.deepEqual(A.errors, []); +}); + +test('PNI: weekly, big enough networks only, paid peering left out by default, at each network\'s own size and lead time', t => { + const { ev, errors } = game(t, "ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;compute()"); + hire(ev); on(ev, 'pni', { g: 5, tier: 1 }, 0); + ev('S.day=17;S.pops.fra.bb.d=3000;S.pops.ams.bb={d:3000};compute()'); + const plan = JSON.parse(ev("JSON.stringify(pniBatch(null,1).orders.filter(q=>(R.cityDem[q.city]||0)*NSH[q.net]>=5&&(NET[q.net].pol!=='paid'||paidFree(NET[q.net]))).map(q=>({k:q.city+q.net,cost:q.cost,tier:q.tier,big:pniBig(q.net)})))")); + assert.ok(plan.length > 0); + const c0 = cash(ev); + shift(ev); + const got = JSON.parse(ev('JSON.stringify(S.pni.map(p=>({k:p.city+p.net,tier:p.tier,ready:p.ready})))')); + assert.deepEqual(got.map(p => p.k).sort(), plan.map(p => p.k).sort()); + // Lead times are each network's own (pniLead), quick here under Change Freeze. + for (const p of plan) { const g = got.find(x => x.k === p.k); assert.equal(g.tier, p.tier); assert.ok(g.ready > 17 && g.ready <= 17 + ev(p.big ? 'leadDays(365)' : 'leadDays(42)'), p.k); } + assert.equal(c0 - cash(ev), plan.reduce((a, p) => a + p.cost, 0), 'the same setup fees as the bulk order'); + assert.equal(ev("S.pni.some(p=>NET[p.net].pol==='paid'&&!paidFree(NET[p.net]))"), false); + 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'); +}); + +test('optics: light hot fiber with the optic already in it, at the #177 batch price', t => { + const extra = "ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;S.links.push({id:'f',a:'fra',b:'ams',kind:'df',sys:'lite',ch:['zr4'],km:450,sub:false,ready:0,cut:0,mo:1,trench:'f'});compute();R.load.f=dfCap(S.links.at(-1))*0.95"; + const A = twins(t, extra, ev => on(ev, 'optics', { at: 70 }), + "ACT.setChCount({id:'f',o:'zr4',n:2})", "JSON.stringify(S.links.find(l=>l.id==='f').ch)"); + assert.equal(A.ev("S.links.find(l=>l.id==='f').ch.length"), 2, 'one more channel brings the fiber under the level'); +}); + +test('decommission: smaller parallel waves go once the bigger link has room, never one a customer needs', t => { + const { ev, errors } = game(t, "ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;for(const [id,tier] of [['w1',0],['w2',0],['big',2]])S.links.push({id,a:'fra',b:'ams',kind:'wave',tier,km:450,sub:false,cut:0,mo:100,trench:id});compute()"); + hire(ev); on(ev, 'decom', { keep: true }); + ev("R.load={w1:1,w2:1,big:10}"); + shift(ev); + assert.deepEqual(JSON.parse(ev("JSON.stringify(S.links.map(l=>l.id).sort())")), ['big', 'w1'], 'one small wave kept as a spare'); + on(ev, 'decom', { keep: false }); + ev("S.biz.push({id:'c',name:'C',type:'l2vpn',city:'fra',city2:'ams',bw:1,rate:1,reqs:['diverse'],mood:100,since:0});R.load={w1:1,big:10}"); + shift(ev); + assert.ok(ev("S.links.some(l=>l.id==='w1')"), 'a diverse-path customer still needs it'); + ev("S.biz=[];R.load={w1:1,big:10}"); + shift(ev); + assert.deepEqual(JSON.parse(ev("JSON.stringify(S.links.map(l=>l.id))")), ['big']); + assert.deepEqual(errors, []); +}); + +test('the monthly budget cap and the cash floor stop the intern; a new month resets the budget', t => { + const { ev, errors } = game(t); + hire(ev); ev('S.transit[0].hist=[600]'); on(ev, 'transit', { x: 3 }, 10000); + const c0 = cash(ev); + shift(ev); + const spent = c0 - cash(ev); + assert.ok(spent > 0 && spent <= 10000, 'some work, never over the cap'); + assert.equal(ev('S.ops.spent.transit'), spent); + assert.match(ev('opsEntry(S.ops.log[0])'), /stopped at the budget for Keep transit headroom/); + const c1 = cash(ev); + shift(ev); + assert.equal(cash(ev), c1, 'the same month: nothing more'); + // The next step (four 100G members to 400G, $16k) never fits a $10k month; the budget still starts again. + ev('S.day+=30;S.ops.cap.transit=50000'); + shift(ev); + assert.ok(cash(ev) < c1, 'a new month, a new budget'); + assert.equal(ev('S.ops.spent.transit'), c1 - cash(ev), 'counted from zero'); + ev("S.ops.cap.transit=0;S.ops.floor=1e6;S.cash=1e6+500;S.transit[0].hist=[1e5]"); + const c2 = cash(ev); + shift(ev); + assert.equal(cash(ev), c2, 'the cash floor holds even without a cap'); + assert.deepEqual(errors, []); +}); + +test('pause: an order switched off does nothing, and per-POP switches leave a city alone', t => { + const { ev, errors } = game(t, "ACT.buildPop({city:'ams'});ACT.buyTransit({city:'ams',net:'cog',tier:1});for(const t of S.transit)t.hist=[90]"); + hire(ev); on(ev, 'transit', { x: 2 }); + ev("ACT.opsToggle({k:'transit'})"); + const s0 = ev('JSON.stringify(S.transit)'); + shift(ev); + assert.equal(ev('JSON.stringify(S.transit)'), s0); + ev("ACT.opsToggle({k:'transit'});ACT.opsPop({k:'transit',city:'ams'});closeModal()"); + shift(ev); + assert.ok(ev("(S.transit.find(t=>t.city==='fra').n||1)") > 1, 'Frankfurt topped up'); + assert.equal(ev("(S.transit.find(t=>t.city==='ams').n||1)"), 1, 'Amsterdam left alone'); + assert.deepEqual(errors, []); +}); + +test('the shift runs inside dayTick, respects a stopped clock, batches its work and recomputes once', t => { + const { ev, errors } = game(t, "S.transit[0].hist=[60,80,70]"); + hire(ev); on(ev, 'transit', { x: 1.5 }); on(ev, 'caches', { g: 1 }); + const n = ev("window.__c=compute;window.__n=0;compute=()=>{__n++;return __c()};opsDay(S.day);compute=__c;__n"); + assert.equal(n, 1, 'one recompute for the whole shift'); + const d = ev('S.day'); + ev('dayTick()'); + assert.equal(ev('S.ops.log[0].d'), d + 1); + ev("S.rules.clock=false;const before=JSON.stringify(S.ops);dayTick();window.__same=before===JSON.stringify(S.ops)"); + assert.equal(ev('__same'), true, 'no clock, no shift'); + assert.deepEqual(errors, []); +}); + +test('the daily log line is folded into one NOC notification', t => { + const { ev, errors } = game(t, "S.transit[0].hist=[600]"); + hire(ev); on(ev, 'transit', { x: 1.5 }); + const n0 = ev('S.log.length'); + shift(ev); + assert.equal(ev('S.log.length'), n0 + 1); + assert.match(ev('S.log[0].t'), /Kevin's shift Kevin topped up transit/); + assert.deepEqual(errors, []); +}); + +test('fat fingers: never under Change Freeze, rare and harmless in On-call and BGP at 3 a.m.', t => { + const { ev, errors } = game(t); + hire(ev); + ev('window.__r=Math.random;Math.random=()=>0'); + for (let i = 0; i < 50; i++) shift(ev); + assert.equal(ev('S.ops.log.some(e=>e.f!==undefined)'), false, 'Change Freeze: never, even on the unluckiest roll'); + for (const p of ['oncall', 'bgp']) { + ev(`S.rules=makeRules('${p}');S.ops.log=[]`); + const c0 = cash(ev), links = ev('S.links.length'), pops = ev('Object.keys(S.pops).length'); + shift(ev); + assert.equal(ev('S.ops.log[0].f!==undefined'), true, p); + assert.ok(c0 - cash(ev) <= 20000, 'costs a little at most'); + assert.equal(ev('S.links.length'), links); assert.equal(ev('Object.keys(S.pops).length'), pops); + } + ev('Math.random=__r'); + assert.ok(ev("OPS_FF_RATE.oncall<0.01&&OPS_FF_RATE.bgp<0.02"), 'rare'); + assert.deepEqual(errors, []); +}); + +test('a new POP from the template costs exactly the clicks it replaces', t => { + const A = game(t), B = game(t); + hire(A.ev); hire(B.ev); + const q = JSON.parse(A.ev("JSON.stringify(opsTplQuote('ams'))")); + assert.ok(q.net && q.ix && q.kit); + const a0 = cash(A.ev); A.ev("ACT.opsNewPop({city:'ams'})"); const a1 = cash(A.ev); + const b0 = cash(B.ev); + B.ev(`ACT.buildPop({city:'ams'});ACT.launchBB({city:'ams'});ACT.buyTransit({city:'ams',net:'${q.net}',tier:0});ACT.buyIx({city:'ams',tier:0});ACT.utilityKit({city:'ams',cost:utilityKit('ams').cost})`); + assert.equal(a0 - a1, q.cost, 'the quoted price'); + assert.equal(a0 - a1, b0 - cash(B.ev), 'the same as clicking it'); + assert.equal(A.ev('JSON.stringify([S.pops.ams.gen,S.pops.ams.site2,S.pops.ams.routers,!!S.pops.ams.bb,S.ixp.ams])'), B.ev('JSON.stringify([S.pops.ams.gen,S.pops.ams.site2,S.pops.ams.routers,!!S.pops.ams.bb,S.ixp.ams])')); + A.ev('S.cash=10');A.ev("ACT.opsNewPop({city:'lon'})"); + assert.equal(A.ev('!!S.pops.lon'), false, 'all or nothing on the price'); + assert.deepEqual(A.errors, []); assert.deepEqual(B.errors, []); +}); + +test('saves: old saves load with no intern and everything off, settings survive a reload, junk is repaired', t => { + const { ev, errors } = game(t); + ev("delete S.ops;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.ops.intern'), null); + assert.equal(ev('Object.values(S.ops.on).some(Boolean)'), false); + hire(ev); + ev("on=1;S.ops.on.pni=true;S.ops.p.pni={g:50,tier:2,paid:true};S.ops.cap.pni=1e6;S.ops.skip.fra=['caches'];save();S=migrate(JSON.parse(localStorage.getItem('sot-save-v1')))"); + assert.equal(ev("S.ops.intern==='kevin'&&S.ops.on.pni&&S.ops.p.pni.tier===2&&S.ops.cap.pni===1e6&&S.ops.skip.fra[0]==='caches'"), true); + ev(`S.ops={intern:'mallory',on:{transit:'yes',hack:true},p:{transit:{x:99,prov:'nobody'}},cap:{transit:-5},spent:{transit:'lots'},skip:{atlantis:['transit'],fra:['ix','transit']}, + log:[{d:1,i:'kevin',r:[['transit',2,['fra +1×100G','']],['evil',1,[]]],f:99,c:'fra'},'junk'],floor:3,tpl:{bb:'no'}};S=migrate(S)`); + assert.equal(ev('S.ops.intern'), null); + assert.equal(ev("S.ops.on.transit===false&&!('hack' in S.ops.on)"), true); + assert.equal(ev("opsP('transit','x')===1.5&&opsP('transit','prov')==='cheap'&&opsCap('transit')===50000&&S.ops.spent.transit===0"), true); + 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); + assert.deepEqual(errors, []); +}); + +test('the Ops sheet works at 360 px in every language, from the NOC tab and the phone tab bar', 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:'noc'})"); + const open = doc.querySelector('#leftBody [data-act="opsOpen"]'); + assert.ok(open, lang); + open.click(); + const hireBtn = doc.querySelector('#modalCard [data-act="opsHire"]'); + assert.ok(hireBtn, lang); + hireBtn.click(); + assert.ok(ev('opsHired()'), lang); + doc.querySelector('#modalCard [data-act="opsToggle"]').click(); + assert.equal(doc.querySelector('#modalCard [data-act="opsToggle"]').getAttribute('aria-pressed'), 'true', lang); + doc.querySelector('#modalCard [data-act="opsParam"]').click(); + const txt = doc.getElementById('modalCard').textContent; + assert.doesNotMatch(txt, /\bops\.[a-z_]+/, lang); + assert.ok(doc.querySelector('#modalCard select[data-chg="opsCity"]'), lang); + ev("closeModal();selectCity('ams')"); + assert.ok(doc.querySelector('#panelBody [data-act="opsNewPop"]'), lang); + assert.doesNotMatch(doc.getElementById('panelBody').textContent, /\bops\.[a-z_]+/, lang); + assert.deepEqual(errors, [], lang); + dom.window.close(); + } +}); From 829d3a4ba63c6404e3932819b70af99a47cfe75b Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Wed, 28 Oct 2026 17:52:42 +0100 Subject: [PATCH 5/6] CHANGELOG and architecture notes for standing orders --- CHANGELOG.md | 5 +++-- docs/ARCHITECTURE.md | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ff161e..fb39718 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,9 +27,10 @@ All notable changes to this project are documented here. The project follows - Attacks can now use Memcached amplification or an ACK flood. Flowspec catches the former; the latter need mitigation. - Set the number of each optic model directly on land and subsea fiber links. Apply a whole change at once, with its total price shown before buying; removed optics return to the spares shelf. - Order PNIs with one network or every network at all shared POPs from the NOC Traffic tab: choose a port size, review the total cost, and add missing connections or upgrade smaller ones in one go. Each network keeps its own smallest PNI size and delivery time. -- Toggle auto-accept in Deals to check ready sales every five real seconds, including their requirements and available service capacity, with a countdown beside eligible Accept buttons. -- Toggle auto-pay repairs in the NOC to pay for affordable rush repairs automatically while the game runs. - Utilities join route servers and request eligible peers across every joined IX, install missing PoP redundancy hardware and balance caches between sites, and request a cache from each eligible provider at each site. +- Hire a NOC intern and give them standing orders: from customer level 2, Kevin from the night shift, Anycast Annie or Tracy Route runs your rules once a game day and pays exactly what your own clicks would. Keep transit above a multiple of its peak, add or swap routers above a load, take free caches, peer at every IX and PNI with the big networks every week, sign ready customers and decline tiny ones, rush repairs, light more fiber and retire small parallel waves. Each order has a pause switch, its own settings, a monthly budget and per-POP exceptions, and the intern writes one line a day in the NOC (#98, #100, #102, #181, #185, #192, #177). +- Open a new city from a template in one tap: POP, broadband, transit, an IX port and the redundancy kit, priced up front, with your standing orders taking it from there (#98, #192). +- Auto-accept and auto-pay repairs are now the intern's sales and repair orders and run once a game day; saved games keep both switched on, and they start working once you hire an intern. The bulk peering and PNI batches moved into the Ops sheet, next to the orders that repeat them (#185, #181, #192). ## [1.36.0] — 2026-10-28 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index d856f63..1e23b3b 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -29,7 +29,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, conferences, the tutorial, traceroute, the share card, `newGame()` | +| `60-features/` | Banks and loans, scenarios and the weekly challenge, conferences, the tutorial, traceroute, the share card, `newGame()`, the offer trial (`autoOffer()`), standing orders (`S.ops`, `opsDay()`, run from `dayTick()`) | | `70-rules/` | Formatting helpers and market rules: exchanges, PNIs, the peering inbox, peering policy and snubs, DE-KICKS, sold-out routes, hot ports and the Tier 1/2/3 rank | | `80-simulation/` | Dijkstra, RouteScript, `compute()`, monthly prices, `sanitize()`/`migrate()`, customer requirements, events, geography pricing and latency, second sites and service | | `85-incidents/` | `addInc()`, DDoS and scrubbing, `fireFailure()`, `clearInc()`, `fireEvent()` | @@ -99,6 +99,8 @@ never freezes the game. 3. Records history for 95th-percentile billing, stats and streaks. 4. Rolls failures (`fireFailure()`) and events (`fireEvent()`) when their timers run out, and expires incidents. + 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. 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. From 47fbd1c12485f928e778e1095b7bc4e82a67c06b Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Wed, 28 Oct 2026 18:13:48 +0100 Subject: [PATCH 6/6] Standing orders: one sales trial per shift, so a big network's day stays fast --- src/game/60-features/95-standing-orders.js | 8 +++++--- tests/standing-orders.test.js | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/game/60-features/95-standing-orders.js b/src/game/60-features/95-standing-orders.js index 582e273..9aa65be 100644 --- a/src/game/60-features/95-standing-orders.js +++ b/src/game/60-features/95-standing-orders.js @@ -26,7 +26,7 @@ const OPS_TPL=['bb','transit','ix','kit']; const OPS_SAY={transit:N_('ops.l_transit'),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')}; // 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_FF_RATE={oncall:1/150,bgp:1/60}; +const OPS_TRIALS=1,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])),mon:0,skip:{},log:[],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)); @@ -72,10 +72,12 @@ const cheapestTransit=c=>NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>transitPerG(a, // 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'); + 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;} - if(acc){ACT.accept({id:o.id,auto:true});if(!S.offers.includes(o)){X.did('sales');compute();}}}}, + // 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');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 { + 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, []); +});