From d086fcbd9208eb76ab09a1997e80a2cbca918bf6 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Tue, 10 Nov 2026 06:51:34 +0000 Subject: [PATCH 1/5] Show traffic, price per Gbps and path terms on renewal haggles; link panel city names open the city Renewal haggles in Deals now show booked and served Gbps (sites for SD-WAN), the price per Gbps now and asked, and the latency limit and path terms the customer signed for, each ticked as the network stands today (#292). The two city names in the header of wave, dark fiber and virtual circuit panels are buttons that open that city (#196). --- CHANGELOG.md | 2 + site/i18n/de.js | 6 ++ site/i18n/es.js | 6 ++ site/i18n/fr.js | 6 ++ site/i18n/it.js | 6 ++ site/i18n/pt.js | 6 ++ .../80-simulation/75-customer-lifecycle.js | 12 +++- src/game/93-ui/70-link-panels.js | 8 ++- src/i18n/en.js | 6 ++ src/styles/20-drawers.css | 2 + tests/link-panel-cities.test.js | 58 +++++++++++++++ tests/renewal-details.test.js | 72 +++++++++++++++++++ 12 files changed, 186 insertions(+), 4 deletions(-) create mode 100644 tests/link-panel-cities.test.js create mode 100644 tests/renewal-details.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 744dfae..68dcebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] - A link that a closed border has taken down, like Doha to Dubai or Abu Dhabi while the neighbours have fallen out, now says so in its panel, with the days until it comes back, instead of showing nothing wrong. Leasing a new wave or fiber pair across that border during the spat warns you first that it will stay dark (#329). +- A customer asking for a discount at renewal now shows how much traffic they book and get, the price per Gbps now and asked, and any latency limit or path terms they signed for, each ticked or crossed as your network stands today (#292). +- The two city names at the top of a wave, dark fiber or virtual circuit panel now open that city, for example to upgrade the router there before a bigger link (#196). ## [3.3.0] — 2026-11-09 diff --git a/site/i18n/de.js b/site/i18n/de.js index 5402b72..9f2feba 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2738,6 +2738,12 @@ "lifecycle.odd_wireguard":"Sie gehen komplett remote. Alle 40 Leute fahren WireGuard aus ihren Küchen, und die Büroleitung ist nur noch für die Pflanzen.", "lifecycle.odd_wrong_blue":"Die neue Büroleitung will alle Kabel in derselben Farbe, und deins ist das falsche Blau.", "lifecycle.referred_by":"Empfohlen von {name}, einem deiner zufriedensten Kunden.", +"lifecycle.ren_diverse":"zwei getrennte Pfade", +"lifecycle.ren_lat":"Latenz bis {max} ms (jetzt {now})", +"lifecycle.ren_no_subsea":"kein Seekabel", +"lifecycle.ren_per_g":"{was} → {price} pro Gbps", +"lifecycle.ren_sites_traffic":{"one":"{n} Standort × {bw} gebucht, {srv} geliefert","other":"{n} Standorte × {bw} gebucht, {srv} geliefert"}, +"lifecycle.ren_traffic":"{bw} gebucht, {srv} geliefert", "lifecycle.renewal_haggle":"Verlängerung am {date}: wird verhandelt", "lifecycle.renewals":"Verlängerungen", "lifecycle.renewals_soon":"Verlängerungen", diff --git a/site/i18n/es.js b/site/i18n/es.js index feaa272..3b2f43e 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2736,6 +2736,12 @@ "lifecycle.odd_wireguard":"Se pasan al teletrabajo total. Los 40 empleados usarán WireGuard desde sus cocinas, y la línea de la oficina es solo para las plantas.", "lifecycle.odd_wrong_blue":"La nueva responsable de oficina quiere todos los cables del mismo color, y el tuyo es del azul equivocado.", "lifecycle.referred_by":"Recomendado por {name}, uno de tus clientes más contentos.", +"lifecycle.ren_diverse":"dos rutas diversas", +"lifecycle.ren_lat":"latencia de hasta {max} ms (ahora {now})", +"lifecycle.ren_no_subsea":"sin cable submarino", +"lifecycle.ren_per_g":"{was} → {price} por Gbps", +"lifecycle.ren_sites_traffic":{"one":"{n} sede × {bw} contratados, {srv} servidos","other":"{n} sedes × {bw} contratados, {srv} servidos"}, +"lifecycle.ren_traffic":"{bw} contratados, {srv} servidos", "lifecycle.renewal_haggle":"renovación el {date}: negociando", "lifecycle.renewals":"Renovaciones", "lifecycle.renewals_soon":"Renovaciones", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index f971279..fd6e367 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2736,6 +2736,12 @@ "lifecycle.odd_wireguard":"Ils passent en télétravail complet. Les 40 salariés utiliseront WireGuard depuis leur cuisine, et la ligne du bureau ne sert plus qu'aux plantes.", "lifecycle.odd_wrong_blue":"La nouvelle responsable des locaux veut tous les câbles de la même couleur, et le vôtre n'est pas le bon bleu.", "lifecycle.referred_by":"Recommandé par {name}, l'un de vos clients les plus satisfaits.", +"lifecycle.ren_diverse":"deux chemins diversifiés", +"lifecycle.ren_lat":"latence jusqu’à {max} ms (maintenant {now})", +"lifecycle.ren_no_subsea":"pas de câble sous-marin", +"lifecycle.ren_per_g":"{was} → {price} par Gbps", +"lifecycle.ren_sites_traffic":{"one":"{n} site × {bw} réservés, {srv} servis","other":"{n} sites × {bw} réservés, {srv} servis"}, +"lifecycle.ren_traffic":"{bw} réservés, {srv} servis", "lifecycle.renewal_haggle":"renouvellement le {date} : en négociation", "lifecycle.renewals":"Renouvellements", "lifecycle.renewals_soon":"Renouvellements", diff --git a/site/i18n/it.js b/site/i18n/it.js index 9034753..797cb9b 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2736,6 +2736,12 @@ "lifecycle.odd_wireguard":"Passano al lavoro tutto da remoto. I 40 dipendenti useranno WireGuard dalle loro cucine, e la linea dell'ufficio serve solo alle piante.", "lifecycle.odd_wrong_blue":"Il nuovo responsabile dell'ufficio vuole tutti i cavi dello stesso colore, e il tuo è del blu sbagliato.", "lifecycle.referred_by":"Consigliato da {name}, uno dei tuoi clienti più contenti.", +"lifecycle.ren_diverse":"due percorsi diversi", +"lifecycle.ren_lat":"latenza entro {max} ms (ora {now})", +"lifecycle.ren_no_subsea":"niente cavi sottomarini", +"lifecycle.ren_per_g":"{was} → {price} per Gbps", +"lifecycle.ren_sites_traffic":{"one":"{n} sede × {bw} prenotati, {srv} serviti","other":"{n} sedi × {bw} prenotati, {srv} serviti"}, +"lifecycle.ren_traffic":"{bw} prenotati, {srv} serviti", "lifecycle.renewal_haggle":"rinnovo il {date}: si tratta", "lifecycle.renewals":"Rinnovi", "lifecycle.renewals_soon":"Rinnovi", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 0657f8f..626a03a 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2736,6 +2736,12 @@ "lifecycle.odd_wireguard":"Vão trabalhar 100% remoto. Os 40 funcionários vão usar WireGuard da cozinha, e a linha do escritório fica só para as plantas.", "lifecycle.odd_wrong_blue":"A nova gerente do escritório quer todos os cabos da mesma cor, e o seu é do azul errado.", "lifecycle.referred_by":"Indicado por {name}, um dos seus clientes mais felizes.", +"lifecycle.ren_diverse":"dois caminhos diversos", +"lifecycle.ren_lat":"latência de até {max} ms (agora {now})", +"lifecycle.ren_no_subsea":"sem cabo submarino", +"lifecycle.ren_per_g":"{was} → {price} por Gbps", +"lifecycle.ren_sites_traffic":{"one":"{n} unidade × {bw} contratados, {srv} entregues","other":"{n} unidades × {bw} contratados, {srv} entregues"}, +"lifecycle.ren_traffic":"{bw} contratados, {srv} entregues", "lifecycle.renewal_haggle":"renovação em {date}: negociando", "lifecycle.renewals":"Renovações", "lifecycle.renewals_soon":"Renovações", diff --git a/src/game/80-simulation/75-customer-lifecycle.js b/src/game/80-simulation/75-customer-lifecycle.js index aa9bc4c..d7b60e2 100644 --- a/src/game/80-simulation/75-customer-lifecycle.js +++ b/src/game/80-simulation/75-customer-lifecycle.js @@ -113,11 +113,21 @@ function mktPrice(from){const m=mkt();for(let i=from;iMath.round((b.rate+b.hag.rate)/2); const clBill=(b,rate)=>BIZ_T[b.type].fiber?rate:b.bw*rate; const clHags=()=>S?S.biz.reduce((a,b)=>a+(b.hag?1:0),0):0; +/* What is at stake in a renewal (#292): how much traffic they book and get, the price per Gbps now and asked, and the + path terms they signed for (latency, diverse, no subsea), each ticked as it stands today. Two short lines for a phone. */ +function clRenInfo(b){const T=BIZ_T[b.type],tick=v=>`${v?'✓':'✗'} `,top=[],rq=[]; + if(!T.fiber){const sf=bizSf(b),srv=`${fmtG(b.bw*sf)}`; + top.push(b.sites?trn('lifecycle.ren_sites_traffic',b.sites.length,{bw:fmtG(b.bw),srv}):tr('lifecycle.ren_traffic',{bw:fmtG(b.bw),srv})); + top.push(tr('lifecycle.ren_per_g',{was:fmt$(b.rate),price:fmt$(b.hag.rate)}));} + for(const k of b.reqs||[]){const Q=REQS[k];if(!Q)continue;const ok=Q.ok(b); + if(k==='lat'){const v=R.l2lat[b.id]!==undefined?R.l2lat[b.id]:bestLat(b.city,b.city2);rq.push(tick(ok)+tr('lifecycle.ren_lat',{max:b.latMax,now:isFinite(v)?tr('common.ms_ms_one_way',{ms:v.toFixed(1)}):tr('common.no_path')}));} + else rq.push(tick(ok)+(k==='diverse'?tr('lifecycle.ren_diverse'):k==='sharks'?tr('lifecycle.ren_no_subsea'):esc(typeof Q.l==='function'?Q.l(b):Q.l)));} + return (top.length?`
${top.join(' · ')}
`:'')+(rq.length?`
${rq.join(' · ')}
`:'');} // The renewals waiting for an answer, at the top of Deals. function clDealsHtml(){const hs=S.biz.filter(b=>b.hag).sort((a,b)=>a.hag.until-b.hag.until);if(!hs.length)return ''; return `

${tr('lifecycle.renewals')}

${tr('lifecycle.unanswered_matches')}

`+hs.map(b=>{const now=BIZ_T[b.type].fiber?b.hag.rate:b.bw*b.hag.rate,was=bizMo(b); return `
${esc(b.name)}
${esc(BIZ_T[b.type].l)} · ${esc(clWhere(b))} · ${tr('ui.n_d_left',{n:b.hag.until-S.day})}
-
${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}
${slRenRow(b)} +
${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}
${clRenInfo(b)}${slRenRow(b)}
${btn(tr('lifecycle.match'),'renewMatch',{id:b.id},'green sm')}${btn(tr('lifecycle.meet_halfway',{price:fmt$(clBill(b,clMid(b)))}),'renewMeet',{id:b.id},'sm')}${btn(tr('lifecycle.let_them_go'),'renewLet',{id:b.id},'ghost sm')}
`;}).join('');} // The contract line on a customer row. const clTermTxt=b=>clOn(b)&&b.te?(b.hag?tr('lifecycle.renewal_haggle',{date:dateStr(b.te)}):tr('lifecycle.contract_until',{date:dateStr(b.te)})):''; diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 39c6541..ff99639 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -23,9 +23,11 @@ function ixBlock(c,multi){const city=ixCity(c),C=CITY[city],ix=ixName(c),X=XIXM[ h+=``;return h; } function borderSection(l){const w=borderShut(l);return w?`

${tr('link_panels.border_closed')}

${w==='gulf'?tr('link_panels.a_diplomatic_spat_has_closed_the')+' '+tr('link_panels.back_in_n_days',{n:S.ev.gulf-S.day}):tr('link_panels.russia_has_unplugged_itself_from_the')}

`:'';} +// Both ends of a link in its panel header open that city (#196), say to upgrade the router there for a bigger wave. +const lkEnds=l=>[l.a,l.b].map(c=>cityOn(c)?btn(esc(CITY[c].name),'popGo',{city:c},'clink'):esc(CITY[c].name)).join(' ⇄ '); function vxcPanel(l){ const load=R.load[l.id]||0,cap=VXC[l.vt].g,u=load/cap,down=linkDown(l),f=FAB[l.prov]; - let h=`
${tr('link_panels.virtual_circuit_name_km_km',{name:esc(f.name),km:l.km.toLocaleString()})}

${CITY[l.a].name} ⇄ ${CITY[l.b].name}

`; + let h=`
${tr('link_panels.virtual_circuit_name_km_km',{name:esc(f.name),km:l.km.toLocaleString()})}

${lkEnds(l)}

`; h+=borderSection(l);if(down&&!borderShut(l))h+=`

${tr('common.fabric_outage')}

${tr('link_panels.name_is_down_nothing_you_can',{name:esc(f.name)})}

`; h+=`

${tr('common.capacity')}

${tr('link_panels.name_circuit',{name:VXC[l.vt].n})}${fmtG(load)} / ${fmtG(cap)}
${tr('common.monthly')}${tr('common.price_mo',{price:fmt$(l.mo)})}
${!S.pops[l.b]?`

${tr('link_panels.remote_peering_leg_into_ix',{ix:esc(CITY[l.b].ix)})}

`:''} @@ -114,7 +116,7 @@ function layPanel(l){const d=S.day,st=layStart(l),q=layQuote(l),km=Math.round(la return h;} function dfPanel(l){ const load=R.load[l.id]||0,cap=dfCap(l),u=cap?load/cap:0,bld=l.ready>S.day,A=CITY[l.a].name,B=CITY[l.b].name,inc=S.inc.find(i=>i.ref===l.id||i.ref===(l.trench||l.id)),amps=ampCount(l.km),sysD=DF_SYS[l.sys]; - let h=`
${tr('link_panels.dark_fiber_kind_km_km',{kind:l.own?tr('link_panels.your_own_build'):tr('common.leased_iru'),km:l.km.toLocaleString()})}

${A} ⇄ ${B}

`; + let h=`
${tr('link_panels.dark_fiber_kind_km_km',{kind:l.own?tr('link_panels.your_own_build'):tr('common.leased_iru'),km:l.km.toLocaleString()})}

${lkEnds(l)}

`; if(bld){const tot=Math.max(1,l.ready-l.day),done=clamp((S.day-l.day)/tot,0,1); h+=`

${l.own?tr('common.under_construction'):tr('common.being_spliced')}

${l.own?tr('link_panels.permits_trenching_splicing'):tr('common.iru_handover')}${tr('common.n_days_left',{n:l.ready-S.day})}
${l.own&&l.sub?layPanel(l):l.own?`
${btn(tr('link_panels.hire_extra_crews_price_30_days',{price:fmt$(crewCost(l))}),'crews',{id:l.id},'sm',!crewSteps(l)||S.cash${!crewSteps(l)&&l.ready>S.day+1?`

${tr('link_panels.crews_can_halve_a_build_at_most')}

`:''}`:''}

${tr('link_panels.you_can_pre_install_optics_now')}

`;} else if(inc&&linkDown(l))h+=`

${tr('common.dark_6bf5')}

${esc(inc.msg)}

${shipNote(inc)}${inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash`; @@ -149,7 +151,7 @@ function linkPanel(id){ if(l.kind==='vxc')return vxcPanel(l); if(l.kind==='df')return dfPanel(l); const load=R.load[l.id]||0,cap=LT[l.tier].g,u=load/cap,cut=l.cut>S.day,trk=l.trench||l.id,inc=S.inc.find(i=>(LINKCUT_TR.includes(i.type)&&i.ref===trk)||((i.type==='fatwave'||i.type==='label'||i.type==='mtu')&&i.ref===l.id)),sib=pairLinks(l.a,l.b).filter(x=>x!==l&&x.kind!=='vxc'),mates=sib.filter(x=>(x.trench||x.id)===trk); - let h=`
${l.cable?esc(CAB[l.cable].name):l.sub?tr('common.subsea_cable'):tr('common.terrestrial_fiber')} · ${l.km.toLocaleString()} km

${CITY[l.a].name} ⇄ ${CITY[l.b].name}

`; + let h=`
${l.cable?esc(CAB[l.cable].name):l.sub?tr('common.subsea_cable'):tr('common.terrestrial_fiber')} · ${l.km.toLocaleString()} km

${lkEnds(l)}

`; if(cut)h+=`

${tr('common.cut_2e50')}

${inc?esc(inc.msg):''} ${inc&&shipSea(inc)?'':tr('link_panels.back_in_n_days',{n:l.cut-S.day})}

${shipNote(inc)}${inc&&inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash`; h+=borderSection(l); h+=`

${tr('common.capacity')}

${tr('link_panels.name_wave',{name:LT[l.tier].n})}${fmtG(load)} / ${fmtG(cap)}
diff --git a/src/i18n/en.js b/src/i18n/en.js index bb7bbc3..2649cfc 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2737,6 +2737,12 @@ "lifecycle.odd_wireguard":"They are going fully remote. All 40 staff will run WireGuard from their kitchens, and the office line is just for the plants.", "lifecycle.odd_wrong_blue":"The new office manager wants every cable the same colour, and yours is the wrong blue.", "lifecycle.referred_by":"Referred by {name}, one of your happiest customers.", +"lifecycle.ren_diverse":"two diverse paths", +"lifecycle.ren_lat":"latency within {max} ms (now {now})", +"lifecycle.ren_no_subsea":"no subsea cable", +"lifecycle.ren_per_g":"{was} → {price} per Gbps", +"lifecycle.ren_sites_traffic":{"one":"{n} site × {bw} booked, {srv} served","other":"{n} sites × {bw} booked, {srv} served"}, +"lifecycle.ren_traffic":"{bw} booked, {srv} served", "lifecycle.renewal_haggle":"renewal on {date}: haggling", "lifecycle.renewals":"Renewals", "lifecycle.renewals_soon":"Renewals", diff --git a/src/styles/20-drawers.css b/src/styles/20-drawers.css index 31fc819..8dfcadd 100644 --- a/src/styles/20-drawers.css +++ b/src/styles/20-drawers.css @@ -49,6 +49,8 @@ section h3{font-size:17px;margin-bottom:6px;display:flex;align-items:center;gap: .b.green{background:var(--ok);color:#fff} .b.sm{font-size:12px;padding:2px 8px 1px;border-radius:9px;box-shadow:0 2px 0 var(--ink)} .b.big{font-size:18px;padding:7px 18px 5px} +/* A city name in a heading that opens the city (link panels, #196): reads as the heading, underlined like a link. */ +.b.clink,.b.clink:active{font:inherit;color:inherit;background:none;border:0;box-shadow:none;transform:none;padding:2px 0;border-radius:0;white-space:normal;text-align:left;text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:4px;text-decoration-color:var(--me)} .b small{font-family:var(--body);font-weight:800;font-size:10.5px;opacity:.85;margin-left:3px} .logo{width:30px;height:30px;border-radius:50%;background:var(--c);border:2.5px solid var(--ink);display:grid;place-items:center;color:#fff;font-family:var(--display);font-weight:800;font-size:11px;flex:none;letter-spacing:-.02em} diff --git a/tests/link-panel-cities.test.js b/tests/link-panel-cities.test.js new file mode 100644 index 0000000..5bbfef0 --- /dev/null +++ b/tests/link-panel-cities.test.js @@ -0,0 +1,58 @@ +// #196: the two city names at the top of a link panel (wave, dark fiber, virtual circuit) open that city's panel. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +const start = "ACT.start({});S.cash=1e9;S.lvl=13;S.nextFail=S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;"; +const ends = ev => JSON.parse(ev("JSON.stringify([...document.querySelectorAll('#panel .ph h2 button[data-act=\"popGo\"]')].map(b=>[b.textContent,JSON.parse(b.dataset.args).city]))")); +const click = (ev, i) => ev(`document.querySelectorAll('#panel .ph h2 button[data-act="popGo"]')[${i}].click()`); + +function setup(ev) { + ev(start + "ACT.launchBB({city:'fra'});ACT.buildPop({city:'ams'});compute()"); + ev("S.links.push({id:'w1',a:'fra',b:'ams',kind:'wave',tier:0,km:360,sub:false,mo:1,cut:0,day:0})"); + ev("S.links.push({id:'df1',a:'fra',b:'ams',kind:'df',own:false,sys:'lite',ch:[],km:360,sub:false,mo:1,ready:0,cut:0,day:0})"); + ev("S.links.push({id:'vx1',a:'fra',b:'ams',kind:'vxc',prov:Object.keys(FAB)[0],vt:0,km:360,sub:false,mo:1,cut:0,day:0});compute()"); +} + +for (const [id, kind] of [['w1', 'wave'], ['df1', 'dark fiber'], ['vx1', 'virtual circuit']]) { + test(`#196 a ${kind} panel links both of its cities, and a click opens the city`, () => { + const { ev, errors } = load(); + setup(ev); + ev(`selectLink('${id}')`); + assert.deepEqual(ends(ev), [['Frankfurt', 'fra'], ['Amsterdam', 'ams']]); + assert.match(ev("document.querySelector('#panel .ph h2').textContent"), /Frankfurt ⇄ Amsterdam/); + click(ev, 1); + assert.equal(ev("UI.sel.type+':'+UI.sel.id"), 'city:ams', 'the far end is selected'); + assert.equal(ev("cam.x"), ev("CITY.ams.x"), 'and the map moves to it'); + assert.match(ev("document.querySelector('#panel .ph h2').textContent"), /Amsterdam/); + ev(`selectLink('${id}')`); + click(ev, 0); + assert.equal(ev("UI.sel.id"), 'fra'); + assert.deepEqual(errors, []); + }); +} + +test('#196 on a 390 px phone the city links sit in the bottom sheet header and still open the city', () => { + const { ev, errors } = load(); + setup(ev); + ev("window.innerWidth=390;renderAll();selectLink('w1')"); + assert.equal(ev("isPhone()"), true); + assert.equal(ends(ev).length, 2); + // The link styling: reads as heading text that wraps, not a button that pushes the header wider. + assert.match(ev("document.querySelector('#panel .ph h2 button').className"), /\bclink\b/); + click(ev, 0); + assert.equal(ev("UI.sel.type+':'+UI.sel.id"), 'city:fra'); + assert.deepEqual(errors, []); +}); + +test('#196 a city the map does not show stays plain text', () => { + const { ev, errors } = load(); + setup(ev); + ev("selectLink('w1')"); + // cityOn() is false for an off-map city without a POP or IX port: no button to a panel that would not open. + ev("CITY.ams.off=true;delete S.pops.ams;renderPanel()"); + assert.deepEqual(ends(ev), [['Frankfurt', 'fra']]); + assert.match(ev("document.querySelector('#panel .ph h2').textContent"), /Frankfurt ⇄ Amsterdam/); + ev("delete CITY.ams.off"); + assert.deepEqual(errors, []); +}); diff --git a/tests/renewal-details.test.js b/tests/renewal-details.test.js new file mode 100644 index 0000000..091aee3 --- /dev/null +++ b/tests/renewal-details.test.js @@ -0,0 +1,72 @@ +// #292: a renewal haggle in Deals shows what is at stake: traffic booked and served, the price per Gbps now and asked, +// and the path terms the customer signed for, each ticked as it stands today. It fits on a phone. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +const start = "ACT.start({});S.cash=1e9;S.lvl=6;S.nextFail=S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;"; +// Frankfurt, Paris and Amsterdam in a triangle, so Frankfurt-Amsterdam has a direct path and one round through Paris. +function net(ev) { + ev(start + "ACT.launchBB({city:'fra'});ACT.buildPop({city:'par'});ACT.buildPop({city:'ams'});for(const c in S.pops){S.pops[c].rgen=3;S.pops[c].routers=2}"); + for (const [a, b] of [['fra', 'par'], ['par', 'ams'], ['fra', 'ams']]) ev(`UI.via=null;openLinkModal('${a}','${b}');ACT.buildLink({tier:1});closeModal()`); +} +const deals = ev => { ev("UI.left='deals';renderLeft()"); return ev("document.getElementById('left').innerHTML"); }; +const row = (ev, name) => ev(`(()=>{const r=[...document.querySelectorAll('#left .row')].find(r=>r.querySelector('.nm')&&r.querySelector('.nm').textContent==='${name}');return r?r.textContent:''})()`); + +test('#292 an IP customer\'s renewal shows booked and served traffic and the price per Gbps', () => { + const { ev, errors } = load(); + net(ev); + ev("S.biz.push({id:'h1',city:'ams',city2:null,name:'Haggle Hosting',type:'dia',bw:5,rate:600,reqs:[],mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:540,until:S.day+20}});compute()"); + deals(ev); + const t = row(ev, 'Haggle Hosting'); + assert.match(t, /5\.0 Gbps booked, [\d.]+ Gbps served/); + assert.ok(t.includes(ev("fmt$(600)") + ' → ' + ev("fmt$(540)") + ' per Gbps'), t); + assert.match(t, /Pays .* wants .* to renew/, 'the monthly bills are still there'); + assert.deepEqual(errors, []); +}); + +test('#292 a circuit\'s renewal shows its latency limit and path terms, ticked as they stand today', () => { + const { ev, errors } = load(); + net(ev); + ev("S.biz.push({id:'c1',city:'fra',city2:'ams',name:'Tulip Bank',type:'l2vpn',bw:10,rate:300,reqs:['lat','diverse','sharks'],latMax:50,route:'fast',mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:250,until:S.day+20}});compute()"); + deals(ev); + let t = row(ev, 'Tulip Bank'); + assert.match(t, /10\.0 Gbps booked, 10\.0 Gbps served/); + assert.match(t, /✓ latency within 50 ms \(now [\d.]+ ms one-way\)/); + assert.match(t, /✓ two diverse paths/, 'direct and round through Paris'); + assert.match(t, /✓ no subsea cable/); + // A tight budget the network cannot meet is crossed out, with what it gets today. + ev("S.biz.find(b=>b.id==='c1').latMax=0.5;compute()"); + deals(ev); + t = row(ev, 'Tulip Bank'); + assert.match(t, /✗ latency within 0\.5 ms/); + assert.doesNotMatch(t, /undefined|NaN/); + assert.deepEqual(errors, []); +}); + +test('#292 SD-WAN shows its sites, fiber deals show no Gbps, and served traffic below what is booked is red', () => { + const { ev, errors } = load(); + net(ev); + ev("S.biz.push({id:'s1',city:'fra',city2:null,sites:['fra','par','ams'],name:'Kebab Kingdom',type:'sdwan',bw:2,rate:400,reqs:[],mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:360,until:S.day+20}});compute()"); + deals(ev); + assert.match(row(ev, 'Kebab Kingdom'), /3 sites × 2\.0 Gbps booked/); + assert.doesNotMatch(row(ev, 'Kebab Kingdom'), /✓|✗/, 'no path terms when they asked for none'); + assert.equal(ev("clRenInfo({...S.biz.find(b=>b.id==='s1'),type:'dfpair'})"), '', 'a fiber pair is not sold by the Gbps'); + ev("R.l2['s1']=0.5"); + assert.match(ev("clRenInfo(S.biz.find(b=>b.id==='s1'))"), /color:var\(--bad\)">0\.5 Gbps/); + assert.deepEqual(errors, []); +}); + +test('#292 the renewal row fits a 390 px phone', () => { + const { ev, errors } = load(); + net(ev); + ev("S.biz.push({id:'c1',city:'fra',city2:'ams',name:'Tulip Bank',type:'l2vpn',bw:10,rate:300,reqs:['lat','diverse'],latMax:50,route:'fast',mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:250,until:S.day+20}});compute()"); + ev("window.innerWidth=390;renderAll()"); + deals(ev); + assert.match(row(ev, 'Tulip Bank'), /booked, .* served/); + // Every new line is a wrapping meta line, never one wide nowrap element. + const info = ev("clRenInfo(S.biz.find(b=>b.id==='c1'))"); + assert.match(info, /^
/); + assert.doesNotMatch(info, /nowrap|width:\s*\d{3,}px/); + assert.deepEqual(errors, []); +}); From e51510a1159a2205d0b5cc1a55ce141ed6f12544 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Tue, 10 Nov 2026 06:56:02 +0000 Subject: [PATCH 2/5] Strict latency contracts: big late-game customers who pay for a latency SLA (#137) From customer level 7, low-latency wholesale routes ask for 1.6 or 3.2 Tbps between two cities with the latency limit trading links already have (REQS.lat on the circuit latency compute() measures). They pay about three times a hyperscaler DCI per Gbps on the same route, never grow past 3.2 Tbps, and every day over the limit after the provisioning grace credits a day's fee and costs extra patience. New rule F9 in gameplay-rules. --- .claude/skills/gameplay-rules/SKILL.md | 1 + CHANGELOG.md | 1 + site/i18n/de.js | 6 +- site/i18n/es.js | 6 +- site/i18n/fr.js | 6 +- site/i18n/it.js | 6 +- site/i18n/pt.js | 6 +- src/game/40-progress/10-businesses.js | 6 +- src/game/60-features/38-latency-contracts.js | 25 +++ src/game/80-simulation/50-sanitize.js | 2 +- .../80-simulation/70-customers-and-events.js | 2 +- .../80-simulation/75-customer-lifecycle.js | 3 +- src/game/88-days/10-day-tick.js | 6 +- src/i18n/en.js | 6 +- tests/gameplay-rules.test.js | 24 +++ tests/latency-contracts.test.js | 162 ++++++++++++++++++ 16 files changed, 255 insertions(+), 13 deletions(-) create mode 100644 src/game/60-features/38-latency-contracts.js create mode 100644 tests/latency-contracts.test.js diff --git a/.claude/skills/gameplay-rules/SKILL.md b/.claude/skills/gameplay-rules/SKILL.md index d6fba4b..f1a5bee 100644 --- a/.claude/skills/gameplay-rules/SKILL.md +++ b/.claude/skills/gameplay-rules/SKILL.md @@ -72,6 +72,7 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one | F6 | An alien wave rents for at most 30% of what its fiber costs a month (lease plus amplifiers), each wave sold between two cities is never dearer than the one before, and a route sold out to its market earns less than eight times that cost. | A buyer would lease the fiber rather than pay many times its price; the old price made one wave worth the whole fiber and a full route 11 to 35 times its lease (#203). | | F7 | Extra crews cut a build on land to half its planned time at most. | Permits, rights of way and trenching set the pace; a 1,000-day build finishing tomorrow made lead times meaningless (#203). | | F8 | In the capacity market (Lambda Bazaar), a managed wave comes out of capacity you lit yourself (your own traffic gets that much less, and the customer suffers when your optics cannot carry it), rides one channel (an 800G or 1.6T wave needs an optic that big), and is priced against its fiber: a 400G wave 2.7 times a 100G one on land and 3.8 times on subsea, each bigger size cheaper per bit. Spectrum lists at 30% of the fiber's monthly cost, and heat moves any price by at most −30% to +35%. | Selling lit capacity must cost capacity, or every fiber sells twice; the ratios are 2025 market prices (TeleGeography), so bigger waves win on volume, not on price per bit. | +| F9 | A strict latency contract (`BIZ_T.lowlat`, #137) comes only from customer level 7, is 1.6T or 3.2T and never grows past 3.2T, has a latency limit something you can build meets (`latMaxOf`, as trading links), pays more per Gbps than any other big circuit on the same route even with all their extras, and once its 15-day grace is over credits a day's fee and loses patience faster for every day over its limit. | Real low-latency routes sell at a premium for guaranteed milliseconds and pay service credits when they miss; the cap keeps one contract from carrying a level. | ## DDoS diff --git a/CHANGELOG.md b/CHANGELOG.md index 744dfae..124425f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- From customer level 7, low-latency wholesale routes call: 1.6 or 3.2 Tbps between two of your cities with a strict latency limit, paying about three times what a hyperscaler pays per Gbps on the same route. Every day over the limit (after the first 15) you pay back a day's fee as an SLA credit and they lose patience twice as fast as a trading link over its limit, so keep a fast path and a fast backup. They never grow past 3.2 Tbps, so one contract cannot carry a whole level (#137). - A link that a closed border has taken down, like Doha to Dubai or Abu Dhabi while the neighbours have fallen out, now says so in its panel, with the days until it comes back, instead of showing nothing wrong. Leasing a new wave or fiber pair across that border during the spat warns you first that it will stay dark (#329). ## [3.3.0] — 2026-11-09 diff --git a/site/i18n/de.js b/site/i18n/de.js index 5402b72..b0339b6 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -407,7 +407,6 @@ "broker.win_text":"{name} (AS{asn}) hat in {days} Tagen eigene Kabel auf {n} Kontinente verlegt und verkauft anderen Carriern Kapazität für {mo} im Monat. Die Ozeane sind jetzt dein Graben.", "broker.won_on_date":"Gewonnen am {date}: Deine eigenen Kabel überspannen die Ozeane, und Carrier zahlen dir für ihre Nutzung.", "broker.your_glass_gear_is_already_yours":"Als Kabelmakler gehören dir jede Fiber, jedes Leitungssystem, jede Optik, jedes Seekabel und die Router, um sie zu beleuchten, schon jetzt, egal was das Level sagt.", -"businesses.a_free_pni_with_voda_phony":"Ein kostenloser PNI mit Voda-Phony. Hardware: Absolute-Unit-3.2T-Router, 3.2T-Ports und 12.8T-Waves.", "businesses.agi_lab_allegedly":"AGI-Labor (angeblich)", "businesses.agi_labs_allegedly_wanting_ai_wans":"AGI-Labore (angeblich), die KI-WANs mit 12,8 bis 25,6 Tbps wollen, und kostenlose PNIs mit Du-opoly und Ooh-redoo. Hardware: Mikrowtik-CCR-3.2T-Router.", "businesses.ai_gpu_data_center":"KI-GPU-Rechenzentrum", @@ -436,6 +435,8 @@ "businesses.hundreds_of_fiber_pairs":"Hunderte Faserpaare", "businesses.internet_weather_system":"Internet-Wettersystem", "businesses.it_s_not_dns_there_s":"Es ist nicht DNS. Auf keinen Fall ist es DNS. Es war DNS.", +"businesses.low_latency_routes_and_a_free_pni":"Low-Latency-Wholesale-Routen (ab 1.6T, mit Latenz-SLA) und ein kostenloser PNI mit Voda-Phony. Hardware: Absolute-Unit-3.2T-Router, 3.2T-Ports und 12.8T-Waves.", +"businesses.low_latency_wholesale_route":"Low-Latency-Wholesale-Route", "businesses.mars_mission_ground_station":"Bodenstation für die Marsmission", "businesses.mars_mission_ground_stations_gear":"Bodenstationen für die Marsmission. Hardware: The Router at the End of the Universe.", "businesses.mars_mission_over_your_pies":"Mars-Mission über deine Pies", @@ -2656,6 +2657,9 @@ "keys.show_this_list":"Diese Liste zeigen", "keys.space":"Leertaste", "keys.zoom_the_map_out_or":"Karte heraus- oder hineinzoomen", +"latency_contracts.credits_paid":"{price} an SLA-Gutschriften gezahlt", +"latency_contracts.over_sla":"{name}: {a} ⇄ {b} läuft mit {ms} ms, über den {max} ms aus dem Vertrag. Jeder Tag darüber kostet dich eine Tagesgebühr an SLA-Gutschriften ({price}).", +"latency_contracts.sla_terms":"Latenz-SLA {ms} ms: eine Tagesgebühr zurück für jeden Tag darüber · nie mehr als {max}", "lease_swaps.cap_fabric_circuit":"{cap}-Fabric-Verbindung", "lease_swaps.cap_on_a_dark_fiber_iru":"{cap} auf einer Dark-Fiber-IRU", "lease_swaps.cap_wave":"{cap}-Wave", diff --git a/site/i18n/es.js b/site/i18n/es.js index feaa272..c4bdb73 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -405,7 +405,6 @@ "broker.win_text":"{name} (AS{asn}) tendió sus propios cables hasta {n} continentes y vende {mo} al mes de capacidad a otros operadores, en {days} días. Los océanos son ahora tu zanja.", "broker.won_on_date":"Ganado el {date}: tus propios cables cruzan los océanos y los operadores te pagan por usarlos.", "broker.your_glass_gear_is_already_yours":"Como bróker de cables, toda la fibra, los sistemas de línea, los ópticos, los cables submarinos y los routers para iluminarlos ya son tuyos, diga lo que diga el nivel.", -"businesses.a_free_pni_with_voda_phony":"Un PNI gratis con Voda-Phony. Equipo: routers Absolute Unit 3.2T, puertos de 3.2T y ondas de 12.8T.", "businesses.agi_lab_allegedly":"Laboratorio de AGI (supuestamente)", "businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratorios de AGI (supuestamente) que quieren WAN de IA de 12.8 a 25.6 Tbps, y PNIs gratis con Du-opoly y Ooh-redoo. Equipo: routers Mikrowtik CCR 3.2T.", "businesses.ai_gpu_data_center":"Centro de datos de GPU para IA", @@ -434,6 +433,8 @@ "businesses.hundreds_of_fiber_pairs":"Cientos de pares de fibra", "businesses.internet_weather_system":"Sistema meteorológico de internet", "businesses.it_s_not_dns_there_s":"No es el DNS. Imposible que sea el DNS. Era el DNS.", +"businesses.low_latency_routes_and_a_free_pni":"Rutas mayoristas de baja latencia (desde 1.6T, con SLA de latencia) y un PNI gratis con Voda-Phony. Equipo: routers Absolute Unit 3.2T, puertos de 3.2T y ondas de 12.8T.", +"businesses.low_latency_wholesale_route":"Ruta mayorista de baja latencia", "businesses.mars_mission_ground_station":"Estación terrestre de misión a Marte", "businesses.mars_mission_ground_stations_gear":"Estaciones terrestres de misiones a Marte. Equipo: El Router del Fin del Universo.", "businesses.mars_mission_over_your_pies":"Misión a Marte por tus pies", @@ -2654,6 +2655,9 @@ "keys.show_this_list":"Mostrar esta lista", "keys.space":"Espacio", "keys.zoom_the_map_out_or":"Alejar o acercar el mapa", +"latency_contracts.credits_paid":"{price} pagados en créditos SLA", +"latency_contracts.over_sla":"{name}: {a} ⇄ {b} va a {ms} ms, por encima de los {max} ms del contrato. Cada día por encima te cuesta un día de cuota en créditos SLA ({price}).", +"latency_contracts.sla_terms":"SLA de latencia {ms} ms: un día de cuota devuelto por cada día por encima · nunca más de {max}", "lease_swaps.cap_fabric_circuit":"Circuito de fabric de {cap}", "lease_swaps.cap_on_a_dark_fiber_iru":"{cap} en una IRU de fibra oscura", "lease_swaps.cap_wave":"Onda de {cap}", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index f971279..0b0b12e 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -405,7 +405,6 @@ "broker.win_text":"{name} (AS{asn}) a posé ses propres câbles jusqu’à {n} continents et vend {mo} de capacité par mois à d’autres opérateurs, en {days} jours. Les océans sont ta tranchée maintenant.", "broker.won_on_date":"Gagné le {date} : tes propres câbles traversent les océans, et les opérateurs te paient pour s’en servir.", "broker.your_glass_gear_is_already_yours":"En courtier en câbles, toute la fibre, les systèmes de ligne, les optiques, les câbles sous-marins et les routeurs pour les allumer sont déjà à toi, quoi que dise le niveau.", -"businesses.a_free_pni_with_voda_phony":"Un PNI gratuit avec Voda-Phony. Matos : routeurs Absolute Unit 3.2T, ports 3.2T et longueurs d’onde 12.8T.", "businesses.agi_lab_allegedly":"Labo d’AGI (soi-disant)", "businesses.agi_labs_allegedly_wanting_ai_wans":"Des labos d’AGI (soi-disant) qui veulent des WAN IA de 12,8 à 25,6 Tbps, et des PNI gratuits avec Du-opoly et Ooh-redoo. Matos : routeurs Mikrowtik CCR 3.2T.", "businesses.ai_gpu_data_center":"Datacenter GPU pour l’IA", @@ -434,6 +433,8 @@ "businesses.hundreds_of_fiber_pairs":"Des centaines de paires de fibre", "businesses.internet_weather_system":"Météo d’Internet", "businesses.it_s_not_dns_there_s":"Ce n’est pas le DNS. Impossible que ce soit le DNS. C’était le DNS.", +"businesses.low_latency_routes_and_a_free_pni":"Des routes de gros à faible latence (à partir de 1.6T, avec SLA de latence), et un PNI gratuit avec Voda-Phony. Matos : routeurs Absolute Unit 3.2T, ports 3.2T et longueurs d’onde 12.8T.", +"businesses.low_latency_wholesale_route":"Route de gros à faible latence", "businesses.mars_mission_ground_station":"Station sol de mission martienne", "businesses.mars_mission_ground_stations_gear":"Stations sol de missions martiennes. Matos : The Router at the End of the Universe.", "businesses.mars_mission_over_your_pies":"Mission martienne via tes pies", @@ -2654,6 +2655,9 @@ "keys.show_this_list":"Afficher cette liste", "keys.space":"Espace", "keys.zoom_the_map_out_or":"Dézoomer ou zoomer la carte", +"latency_contracts.credits_paid":"{price} versés en crédits SLA", +"latency_contracts.over_sla":"{name} : {a} ⇄ {b} tourne à {ms} ms, au-delà des {max} ms du contrat. Chaque jour au-dessus te coûte une journée de facture en crédits SLA ({price}).", +"latency_contracts.sla_terms":"SLA de latence {ms} ms : une journée de facture remboursée par jour au-dessus · jamais plus de {max}", "lease_swaps.cap_fabric_circuit":"circuit fabric {cap}", "lease_swaps.cap_on_a_dark_fiber_iru":"{cap} sur un IRU de fibre noire", "lease_swaps.cap_wave":"longueur d’onde {cap}", diff --git a/site/i18n/it.js b/site/i18n/it.js index 9034753..e95b6a2 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -405,7 +405,6 @@ "broker.win_text":"{name} (AS{asn}) ha posato i propri cavi fino a {n} continenti e vende {mo} al mese di capacità ad altri operatori, in {days} giorni. Gli oceani ora sono la tua trincea.", "broker.won_on_date":"Vinto il {date}: i tuoi cavi attraversano gli oceani e gli operatori ti pagano per usarli.", "broker.your_glass_gear_is_already_yours":"Da broker di cavi, ogni fibra, sistema di linea, ottica, cavo sottomarino e i router per accenderli sono già tuoi, qualunque cosa dica il livello.", -"businesses.a_free_pni_with_voda_phony":"Un PNI gratuito con Voda-Phony. Gear: router Absolute Unit 3.2T, porte 3.2T e wave 12.8T.", "businesses.agi_lab_allegedly":"Laboratorio AGI (a sentir loro)", "businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratori AGI (a sentir loro) che vogliono AI WAN da 12.8 a 25.6 Tbps, e PNI gratuiti con Du-opoly e Ooh-redoo. Gear: router Mikrowtik CCR 3.2T.", "businesses.ai_gpu_data_center":"Data center GPU per l’AI", @@ -434,6 +433,8 @@ "businesses.hundreds_of_fiber_pairs":"Centinaia di coppie in fibra", "businesses.internet_weather_system":"Sistema meteorologico di internet", "businesses.it_s_not_dns_there_s":"Non è il DNS. Non può essere il DNS. Era il DNS.", +"businesses.low_latency_routes_and_a_free_pni":"Rotte wholesale a bassa latenza (da 1.6T in su, con SLA di latenza) e un PNI gratuito con Voda-Phony. Gear: router Absolute Unit 3.2T, porte 3.2T e wave 12.8T.", +"businesses.low_latency_wholesale_route":"Rotta wholesale a bassa latenza", "businesses.mars_mission_ground_station":"Stazione di terra per una missione su Marte", "businesses.mars_mission_ground_stations_gear":"Stazioni di terra per missioni su Marte. Gear: The Router at the End of the Universe.", "businesses.mars_mission_over_your_pies":"Missione su Marte via i tuoi pie", @@ -2654,6 +2655,9 @@ "keys.show_this_list":"Mostra questo elenco", "keys.space":"Spazio", "keys.zoom_the_map_out_or":"Zoom indietro o avanti sulla mappa", +"latency_contracts.credits_paid":"{price} pagati in crediti SLA", +"latency_contracts.over_sla":"{name}: {a} ⇄ {b} viaggia a {ms} ms, oltre i {max} ms del contratto. Ogni giorno sopra ti costa un giorno di canone in crediti SLA ({price}).", +"latency_contracts.sla_terms":"SLA di latenza {ms} ms: un giorno di canone restituito per ogni giorno sopra · mai più di {max}", "lease_swaps.cap_fabric_circuit":"circuito fabric da {cap}", "lease_swaps.cap_on_a_dark_fiber_iru":"{cap} su una dark fiber IRU", "lease_swaps.cap_wave":"wave da {cap}", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 0657f8f..11e4a50 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -405,7 +405,6 @@ "broker.win_text":"{name} (AS{asn}) lançou os próprios cabos até {n} continentes e vende {mo} por mês de capacidade a outras operadoras, em {days} dias. Os oceanos agora são a sua vala.", "broker.won_on_date":"Vencido em {date}: seus próprios cabos cruzam os oceanos e as operadoras pagam para usá-los.", "broker.your_glass_gear_is_already_yours":"Como corretor de cabos, toda fibra, sistema de linha, óptico, cabo submarino e os roteadores para acendê-los já são seus, diga o nível o que disser.", -"businesses.a_free_pni_with_voda_phony":"Um PNI grátis com a Voda-Phony. Gear: routers Absolute Unit 3.2T, portas 3.2T e waves de 12.8T.", "businesses.agi_lab_allegedly":"Laboratório de AGI (supostamente)", "businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratórios de AGI (supostamente) querendo AI WANs de 12.8 a 25.6 Tbps, e PNIs grátis com a Du-opoly e a Ooh-redoo. Gear: routers Mikrowtik CCR 3.2T.", "businesses.ai_gpu_data_center":"Data center de GPU para IA", @@ -434,6 +433,8 @@ "businesses.hundreds_of_fiber_pairs":"Centenas de pares de fibra", "businesses.internet_weather_system":"Sistema meteorológico da internet", "businesses.it_s_not_dns_there_s":"Não é DNS. Não tem como ser DNS. Era DNS.", +"businesses.low_latency_routes_and_a_free_pni":"Rotas atacadistas de baixa latência (a partir de 1.6T, com SLA de latência) e um PNI grátis com a Voda-Phony. Gear: routers Absolute Unit 3.2T, portas 3.2T e waves de 12.8T.", +"businesses.low_latency_wholesale_route":"Rota atacadista de baixa latência", "businesses.mars_mission_ground_station":"Estação terrestre de missão a Marte", "businesses.mars_mission_ground_stations_gear":"Estações terrestres de missões a Marte. Gear: The Router at the End of the Universe.", "businesses.mars_mission_over_your_pies":"Missão a Marte pelos seus pies", @@ -2654,6 +2655,9 @@ "keys.show_this_list":"Mostrar esta lista", "keys.space":"Espaço", "keys.zoom_the_map_out_or":"Afastar ou aproximar o mapa", +"latency_contracts.credits_paid":"{price} pagos em créditos de SLA", +"latency_contracts.over_sla":"{name}: {a} ⇄ {b} roda a {ms} ms, acima dos {max} ms do contrato. Cada dia acima te custa um dia de mensalidade em créditos de SLA ({price}).", +"latency_contracts.sla_terms":"SLA de latência {ms} ms: um dia de mensalidade devolvido por cada dia acima · nunca mais que {max}", "lease_swaps.cap_fabric_circuit":"circuito de fabric de {cap}", "lease_swaps.cap_on_a_dark_fiber_iru":"{cap} numa IRU de dark fiber", "lease_swaps.cap_wave":"wave de {cap}", diff --git a/src/game/40-progress/10-businesses.js b/src/game/40-progress/10-businesses.js index a79314c..dc45c81 100644 --- a/src/game/40-progress/10-businesses.js +++ b/src/game/40-progress/10-businesses.js @@ -28,6 +28,10 @@ const BIZ_T={ pairs:{l:tr('businesses.hundreds_of_fiber_pairs'),opts:[1],rate:0,fiber:true,mega:true,lv:4,names:['A Hyperscaler Who Shall Not Be Named','Planet-Scale AI WAN Team','The Fiber-Hungry Giant','Project Very Long Glass']}, esport:{l:tr('businesses.esports_world_final'),opts:[400,800,1600,3200],rate:0,event:true,lv:5,names:['League of Lag Finals','Counter-Ping Major','Fortnightly World Cup','Dota Two Many Viewers','Rocket Leak Championship','Street Frighter Evo']}, sov:{l:tr('businesses.sovereign_cloud_region'),opts:[400,800,1600],rate:0,l2:true,div:true,km:0.6,lv:6,names:['Gaia-Ex Sovereign Cloud','Bundeswolke (Very Secure)','Le Cloud Souverain','Datenschutz Deluxe','Your Data Stays Here, Probably','A Cloud With a Flag on It','Data Residency Is a State of Mind']}, + // Strict latency contracts (#137): a carrier or market-data network buys big capacity on one route with a latency SLA, + // the premium paid for the guaranteed milliseconds (km), credits paid for every day over it (38-latency-contracts.js), + // and never more than max: one customer cannot carry a whole level. + lowlat:{l:tr('businesses.low_latency_wholesale_route'),opts:[1600,3200],max:3200,rate:0,l2:true,lat:true,sla:true,km:2,lv:7,names:['Great Circle Clearing House','Straight Line Settlements','Millisecond Markets Exchange','Photon Arbitrage Partners','Shortest Path Securities','Tick Feed Torrent Co.','Matching Engine Mirror Ltd','Speed-of-Glass Replication','Order Book Express','Consolidated Tape Worm']}, cgame:{l:tr('businesses.cloud_gaming_platform'),gaming:true,opts:[800,1600,3200],rate:45,lv:8,names:['Stadia-ium (Back Again)','GeForce Later','Ping Station Now','Luna-tick Gaming','Shadow of a Doubt Cloud PC','Input Lag Arcade','Bufferbloat Bros. Streaming']}, metav:{l:tr('common.metaverse_platform'),opts:[1600,3200,6400],rate:35,lv:9,names:['Meh-taverse','Second Second Life','Horizon Worlds Apart','The Oasis (Ready Player Done)','Legs Finally Shipped Inc.','Decentra-landlocked']}, agi:{l:tr('businesses.agi_lab_allegedly'),opts:[12800,25600],rate:0,l2:true,div:true,mega:true,km:0.4,lv:11,names:['Almost General Intelligence Inc.','Superintelligence Pending','The Lab That Said Two More Years','Paperclip Maximizer Labs','Deep Thought Two','Benevolent Overlord Research']}, @@ -49,7 +53,7 @@ const LEVELS=[ {n:tr('common.big_league'),q:tr('businesses.your_mtu_is_9000_on_every'),req:tr('businesses.peak_3_tbps_10_pops_3'),unlock:tr('businesses.ai_training_interconnects_and')}, {n:tr('common.continental_carrier'),q:tr('businesses.your_noc_has_a_chat_channel'),req:tr('businesses.peak_6_tbps_15_pops_4'),era:1.15,unlock:tr('businesses.esports_world_finals_and_the_4k')}, {n:tr('common.transcontinental'),q:tr('businesses.you_joined_the_outages_mailing_list'),req:tr('businesses.peak_9_tbps_and_20_pops'),unlock:tr('businesses.sovereign_cloud_regions_and_a_free')}, - {n:tr('common.global_backbone'),q:tr('businesses.your_asn_now_shows_up_in'),req:tr('businesses.peak_12_tbps_25_pops_5'),unlock:tr('businesses.a_free_pni_with_voda_phony')}, + {n:tr('common.global_backbone'),q:tr('businesses.your_asn_now_shows_up_in'),req:tr('businesses.peak_12_tbps_25_pops_5'),unlock:tr('businesses.low_latency_routes_and_a_free_pni')}, {n:tr('common.packet_empire'),q:tr('businesses.your_maintenance_window_is_2_a'),req:tr('businesses.peak_16_tbps_and_32_pops'),era:1.15,unlock:tr('businesses.cloud_gaming_platforms_and_the_cloud')}, {n:tr('businesses.six_continent_carrier'),q:tr('businesses.somewhere_on_every_continent_a'),req:tr('businesses.peak_21_tbps_40_pops_6'),unlock:tr('businesses.metaverse_platforms_it_finally_took')}, {n:tr('businesses.backbone_of_backbones'),q:tr('businesses.your_routing_table_needs_its_own'),req:tr('businesses.peak_26_tbps_and_50_pops'),era:1.2,unlock:tr('businesses.the_vr_era_eyeballs_want_20')}, diff --git a/src/game/60-features/38-latency-contracts.js b/src/game/60-features/38-latency-contracts.js new file mode 100644 index 0000000..d430c54 --- /dev/null +++ b/src/game/60-features/38-latency-contracts.js @@ -0,0 +1,25 @@ +/* ---------- Strict latency contracts (#137) ---------- + Late in the game, carriers and market-data networks buy 1.6 or 3.2T on one route with a latency SLA, the way real + low-latency wholesale is sold: a premium per Gbps for guaranteed milliseconds, and a service credit for every day the + circuit runs over them. They are an ordinary customer type (BIZ_T.lowlat) with the latency requirement every trading + link has (REQS.lat on R.l2lat, the one-way path latency compute() measures), offered from customer level LC_LV, and + never bigger than BIZ_T.lowlat.max: one contract cannot carry a level on its own. */ +const LC_LV=BIZ_T.lowlat.lv,LC_MOOD=3,LC_GRACE=15; +// Once a day for each customer, from the mood check: a latency customer over its SLA after the provisioning grace is +// credited that day's fee and loses patience faster than for a bandwidth problem alone. Returns that extra mood lost. +function lcBreach(b,d){const T=BIZ_T[b.type];if(!T||!T.sla)return 0; + if(d-(b.since||0)0)||REQS.lat.ok(b)){delete b.lcB;return 0;} + const cr=Math.round(bizMo(b)/monLen(d));S.cash-=cr;b.lcCr=(b.lcCr||0)+cr; + if(!b.lcB){b.lcB=1;const v=R.l2lat[b.id]; + toast(tr('latency_contracts.over_sla',{name:esc(b.name),a:CITY[b.city].name,b:CITY[b.city2].name,ms:isFinite(v)?v.toFixed(1):'∞',max:b.latMax,price:fmt$(cr)}),'bad',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);} + return LC_MOOD;} +// The contract, on its offer and customer rows (bRisk()). +function lcNote(b){const T=BIZ_T[b.type];if(!T||!T.sla)return ''; + return `
⏱️ ${tr('latency_contracts.sla_terms',{ms:b.latMax,max:fmtG(T.max)})}${b.lcCr>0?' · '+tr('latency_contracts.credits_paid',{price:fmt$(b.lcCr)}):''}
`;} +// Saves: credits paid and the breach flag are numbers and a flag; a contract is never bigger than its type allows. +function lcSanitize(s){for(const b of [...s.biz,...s.offers]){const T=BIZ_T[b.type]; + if(b.lcCr!==undefined){const v=Math.round(+b.lcCr);if(Number.isFinite(v)&&v>0)b.lcCr=v;else delete b.lcCr;} + if(b.lcB!==undefined){if(b.lcB)b.lcB=1;else delete b.lcB;} + if(T&&T.max)b.bw=Math.min(T.max,Math.max(T.opts[0],b.bw)); + if(T&&T.sla&&Array.isArray(b.reqs)&&!b.reqs.includes('lat'))b.reqs.unshift('lat'); + if(T&&T.sla&&!(b.latMax>0)&&isCity(b.city)&&b.city2&&isCity(b.city2))b.latMax=latMaxOf(b.city,b.city2);}} diff --git a/src/game/80-simulation/50-sanitize.js b/src/game/80-simulation/50-sanitize.js index db35e34..7d0d9cd 100644 --- a/src/game/80-simulation/50-sanitize.js +++ b/src/game/80-simulation/50-sanitize.js @@ -113,7 +113,7 @@ function sanitize(s){ three Normal presets, unchanged (its validated mods kept). So an edited or imported save cannot stop the clock or print money. */ {const r=s.rules&&typeof s.rules==='object'&&!Array.isArray(s.rules)?s.rules:{}; const m={mods:r.mods};s.rules=s.scn&&typeof s.scn==='object'?makeRules('oncall',m):s.mode==='sandbox'?makeRules('sandbox',{...m,chaos:r.chaos}):makeRules(NORMAL_PRESETS.includes(r.preset)?r.preset:'oncall',m);} - specSanitize(s); + specSanitize(s);lcSanitize(s); cmFix(s); pieSanitize(s);pieIncFix(s);volFix(s); if(s.te){if(typeof s.te!=='object')s.te=null;else{s.te.on=!!s.te.on;s.te.script=typeof s.te.script==='string'?s.te.script.slice(0,4000):'';}} diff --git a/src/game/80-simulation/70-customers-and-events.js b/src/game/80-simulation/70-customers-and-events.js index cf037a7..f2a906c 100644 --- a/src/game/80-simulation/70-customers-and-events.js +++ b/src/game/80-simulation/70-customers-and-events.js @@ -5,7 +5,7 @@ function bCities(o){return o.sites?o.sites.slice():[o.city,o.city2].filter(Boole function bHas(o){return !!BIZ_T[o.type].cap||!!BIZ_T[o.type].orbit||bCities(o).every(c=>S.pops[c]);} function eventLive(b){return BIZ_T[b.type].event&&S.day>=b.start&&S.day⚠️ ${tr('customers_and_events.gaming_attracts_attacks')}
`:'';} +function bRisk(b){return (BIZ_T[b.type]?.gaming&&!ddosOff()?`
⚠️ ${tr('customers_and_events.gaming_attracts_attacks')}
`:'')+lcNote(b);} function bTerms(o){const T=BIZ_T[o.type];if(T.cap)return capTerms(o); if(T.event){const live=S.day>=o.start;return tr('customers_and_events.bw_extra_for_d_days_when',{bw:fmtG(o.bw),d:o.dur,when:live?tr('customers_and_events.day_n_of_d',{n:S.day-o.start+1,d:o.dur}):tr('customers_and_events.starting_in_n_d',{n:o.start-S.day}),fee:fmt$(o.fee)});} if(T.sdwan)return tr('customers_and_events.n_sites_list_bw_per_site',{n:o.sites.length,list:o.sites.map(c=>CITY[c].name).join(', '),bw:fmtG(o.bw),price:fmt$(o.bw*o.rate)}); diff --git a/src/game/80-simulation/75-customer-lifecycle.js b/src/game/80-simulation/75-customer-lifecycle.js index aa9bc4c..b93f6be 100644 --- a/src/game/80-simulation/75-customer-lifecycle.js +++ b/src/game/80-simulation/75-customer-lifecycle.js @@ -59,7 +59,8 @@ function clGone(b,why){S.biz=S.biz.filter(x=>x!==b);clNote('lost',why);} const clWhere=b=>bCities(b).map(c=>CITY[c].name).join(' ⇄ '); // Growing: the next size up their type sells, or twice the bandwidth past the top one. Fiber grows by renewing. -function clGrow(b){const T=BIZ_T[b.type];if(T.fiber)return false;const up=(T.opts||[]).find(x=>x>b.bw);b.bw=up||b.bw*2;return true;} +// A type with a most (max) never grows past it (#137). +function clGrow(b){const T=BIZ_T[b.type];if(T.fiber||(T.max&&b.bw>=T.max))return false;const up=(T.opts||[]).find(x=>x>b.bw);b.bw=T.max?Math.min(T.max,up||b.bw*2):up||b.bw*2;return true;} // Leaving, or one of the not-your-fault turns that keeps them. Returns what the log says. function clLeave(b,d,out){const T=BIZ_T[b.type],v={name:esc(b.name),city:esc(clWhere(b))}; if(b.mood<50){clGone(b,'sad');out.lost.push(tr('lifecycle.left_unhappy',v));return;} diff --git a/src/game/88-days/10-day-tick.js b/src/game/88-days/10-day-tick.js index 572e7ed..f4b3f58 100644 --- a/src/game/88-days/10-day-tick.js +++ b/src/game/88-days/10-day-tick.js @@ -69,10 +69,10 @@ function* dayPost(d){ (a.sla||(a.sla=[])).push(b.id);b.slaFor=a.start;S.cash-=SLA_PEN;b.mood=Math.max(0,b.mood-18);S.stats.sla=(S.stats.sla||0)+1; toast(tr('day_tick.sla_breach_name_the_attack_on',{name:esc(b.name),city:CITY[a.city].name,pen:fmt$(SLA_PEN)}),'bad');sfx('err');}} // businesses mood - const ids=linkIds(),frr=(coreFrr()&&S.links.some(l=>l.cut)?.5:1)*(rule('moods')==='patient'?.5:1);const bhT=new Set(ddosAll().filter(a=>a.bh).map(a=>a.tgt));let nb=0;TERR={S,gen:RW.gen,m:null};try{for(const b of S.biz.slice()){if(++nb%256===0)yield DAY_REST;if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;if(bhT.has(b.id))continue;const sf=bizSf(b,ids),reachOk=BIZ_T[b.type].l2||BIZ_T[b.type].fiber||R.reach>0.99||scnRule('local'),scrubOk=b.type!=='scrub'||(hasScrub()&&!scrubFar(b.city)),divOk=reqOk(b); + const ids=linkIds(),frr=(coreFrr()&&S.links.some(l=>l.cut)?.5:1)*(rule('moods')==='patient'?.5:1);const bhT=new Set(ddosAll().filter(a=>a.bh).map(a=>a.tgt));let nb=0;TERR={S,gen:RW.gen,m:null};try{for(const b of S.biz.slice()){if(++nb%256===0)yield DAY_REST;if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;if(bhT.has(b.id))continue;const sf=bizSf(b,ids),reachOk=BIZ_T[b.type].l2||BIZ_T[b.type].fiber||R.reach>0.99||scnRule('local'),scrubOk=b.type!=='scrub'||(hasScrub()&&!scrubFar(b.city)),divOk=reqOk(b),lcX=lcBreach(b,d); if(sf>=0.95&&reachOk&&scrubOk&&divOk)b.mood=Math.min(100,b.mood+2); else if(S.day-(b.since||0)<15){} - else{const dm=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));b.mood-=BIZ_T[b.type].orbit?Math.min(dm,PIE_PATIENCE):dm; + else{const dm=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0)+lcX);b.mood-=BIZ_T[b.type].orbit?Math.min(dm,PIE_PATIENCE):dm; // An orbit customer served in full but promised more (the shark's full sky) grumbles, and never cancels over it. if(BIZ_T[b.type].orbit&&sf>=0.95&&reachOk)b.mood=Math.max(b.mood,Math.min(b.pm,PIE_GRUMBLE)); if(b.mood<=0){S.biz=S.biz.filter(x=>x!==b);toast(tr('day_tick.name_cancelled_too_many_outages_and',{name:esc(b.name),city:CITY[b.city].name}),'bad');sfx('err');} @@ -134,7 +134,7 @@ function spawnOffer(){ const bk=broker(),dfR=S.links.some(l=>l.kind==='df'&&l.ready<=S.day),dfO=S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day); if(dfR)types.push('wwave','wwave');if(dfO)types.push('dfpair');if(bk){if(dfR)types.push('wwave','wwave','wwave','wwave');if(dfO)types.push('dfpair','dfpair','dfpair');}if(lv>=3)types.push('gpu','gpu','onramp','onramp');if(lv>=4)types.push('ai','ai','hyper','hyper'); if(lv>=3&&MEGA.some(m=>mine.includes(m.c)))types.push('ingest');if(lv>=4&&MEGA.some(m=>mine.includes(m.c)))types.push('aiwan','aiwan','mtrain');if((lv>=4||bk)&&dfO)types.push('pairs'); - if(lv>=5)types.push('esport');if(lv>=6&&mine.length>=2)types.push('sov','sov');if(lv>=8)types.push('cgame','cgame');if(lv>=9)types.push('metav','metav');if(lv>=11&&MEGA.some(m=>mine.includes(m.c)))types.push('agi');if(lv>=13&&mine.length>=2)types.push('mars'); + if(lv>=5)types.push('esport');if(lv>=6&&mine.length>=2)types.push('sov','sov');if(lv>=LC_LV&&mine.length>=2)types.push('lowlat','lowlat');if(lv>=8)types.push('cgame','cgame');if(lv>=9)types.push('metav','metav');if(lv>=11&&MEGA.some(m=>mine.includes(m.c)))types.push('agi');if(lv>=13&&mine.length>=2)types.push('mars'); const br=mine.filter(c=>CITY[c].br);if(br.length)types.push('provedor','provedor','provedor'); // Countries with thousands of ASNs (Brazil's provedores, US regionals) are full of small ISPs shopping for transit. const dense=mine.filter(c=>(CITY_PDB[c]||[])[2]>=2000);if(lv>=2&&dense.length)types.push('isp'); diff --git a/src/i18n/en.js b/src/i18n/en.js index bb7bbc3..10697f3 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -406,7 +406,6 @@ "broker.win_text":"{name} (AS{asn}) laid its own cables onto {n} continents and sells {mo} a month of capacity to other carriers, in {days} days. The oceans are your trench now.", "broker.won_on_date":"Won on {date}: your own cables span the oceans, and carriers pay you to use them.", "broker.your_glass_gear_is_already_yours":"As a Cable broker, every fiber, line system, optic, subsea cable and the routers to light them are yours already, whatever the level says.", -"businesses.a_free_pni_with_voda_phony":"A free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.", "businesses.agi_lab_allegedly":"AGI lab (allegedly)", "businesses.agi_labs_allegedly_wanting_ai_wans":"AGI labs (allegedly) wanting AI WANs of 12.8 to 25.6 Tbps, and free PNIs with Du-opoly and Ooh-redoo. Gear: Mikrowtik CCR 3.2T routers.", "businesses.ai_gpu_data_center":"AI GPU data center", @@ -435,6 +434,8 @@ "businesses.hundreds_of_fiber_pairs":"Hundreds of fiber pairs", "businesses.internet_weather_system":"Internet weather system", "businesses.it_s_not_dns_there_s":"It's not DNS. There's no way it's DNS. It was DNS.", +"businesses.low_latency_routes_and_a_free_pni":"Low-latency wholesale routes (1.6T and up, with a latency SLA), and a free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.", +"businesses.low_latency_wholesale_route":"Low-latency wholesale route", "businesses.mars_mission_ground_station":"Mars mission ground station", "businesses.mars_mission_ground_stations_gear":"Mars mission ground stations. Gear: The Router at the End of the Universe.", "businesses.mars_mission_over_your_pies":"Mars mission over your pies", @@ -2655,6 +2656,9 @@ "keys.show_this_list":"Show this list", "keys.space":"Space", "keys.zoom_the_map_out_or":"Zoom the map out or in", +"latency_contracts.credits_paid":"{price} paid in SLA credits", +"latency_contracts.over_sla":"{name}: {a} ⇄ {b} runs at {ms} ms, over the {max} ms in its contract. Every day over costs you a day's fee in SLA credits ({price}).", +"latency_contracts.sla_terms":"Latency SLA {ms} ms: a day's fee back for every day over it · never more than {max}", "lease_swaps.cap_fabric_circuit":"{cap} fabric circuit", "lease_swaps.cap_on_a_dark_fiber_iru":"{cap} on a dark fiber IRU", "lease_swaps.cap_wave":"{cap} wave", diff --git a/tests/gameplay-rules.test.js b/tests/gameplay-rules.test.js index 44414ca..4352927 100644 --- a/tests/gameplay-rules.test.js +++ b/tests/gameplay-rules.test.js @@ -485,6 +485,30 @@ test('F8: a managed wave costs your own capacity, rides one optic, and is priced assert.deepEqual(g.errors, []); }); +test('F9: a latency contract is late, capped, achievable, paid for its latency and credited when over it (#137)', () => { + const T = J('BIZ_T.lowlat'); + assert.ok(T.lv >= 7, `F9: from customer level 7, not ${T.lv}`); + assert.ok(T.l2 && T.lat && T.sla, 'F9: a circuit with a latency limit and an SLA'); + assert.ok(Math.min(...T.opts) >= 1600 && Math.max(...T.opts) <= T.max && T.max <= 3200, 'F9: 1.6T and up, never past 3.2T'); + assert.equal(ev("(()=>{const x={type:'lowlat',bw:BIZ_T.lowlat.max};return clGrow(x)||x.bw!==BIZ_T.lowlat.max;})()"), false, 'F9: never grows past its most'); + // Per Gbps on the same route, the bare contract beats any other big circuit with every extra it can ask for. + const best = ev("Math.max(...['hyper','ai','aiwan'].map(t=>BIZ_T[t].km))*(1+REQS.diverse.bonus+REQS.metro.bonus+REQS.sharks.bonus+REQS.gen.bonus)"); + assert.ok(T.km > best, `F9: ${T.km} per km-unit against the best other big circuit's ${best}`); + const g = load(); + g.ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;S.lvl=BIZ_T.lowlat.lv-1;S.biz=[];S.offers=[];for(const c of ['nyc','chi','lon','fra','tok','sin'])if(!S.pops[c])ACT.buildPop({city:c});compute()"); + const spawn = (n) => g.ev(`(()=>{const out=[];for(let i=0;i<${n};i++){S.offers=[];spawnOffer();out.push(...S.offers.filter(o=>o.type==='lowlat'));}S.offers=[];return JSON.stringify(out);})()`); + assert.deepEqual(JSON.parse(spawn(400)), [], 'F9: none below its level'); + g.ev('S.lvl=BIZ_T.lowlat.lv'); + const os = JSON.parse(spawn(400)); + assert.ok(os.length > 0, 'F9: offered at its level'); + for (const o of os) assert.ok(g.ev(`Math.min(latFloor('${o.city}','${o.city2}'),bestLat('${o.city}','${o.city2}'))<=${o.latMax}`), `F9: ${o.city}–${o.city2} in ${o.latMax} ms can be built`); + g.ev("S.biz.push({id:'x',type:'lowlat',name:'X',city:'nyc',city2:'chi',bw:1600,rate:100,reqs:['lat'],latMax:0.1,mood:100,since:S.day-30});compute()"); + const cash = g.ev('S.cash'); + assert.equal(g.ev("lcBreach(S.biz.find(b=>b.id==='x'),S.day)"), g.ev('LC_MOOD'), 'F9: over its limit, it loses patience'); + assert.equal(Math.round(cash - g.ev('S.cash')), g.ev('Math.round(1600*100/monLen(S.day))'), "F9: and a day's fee comes back as a credit"); + assert.deepEqual(g.errors, []); +}); + // D1–D4: DDoS as networks see it (#242). tests/ddos-model.test.js plays each one in detail. const ddFra = (ev) => ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;S.lvl=4;S.nextFail=1e9;S.nextEvent=1e9;ACT.launchBB({city:'fra'});S.pops.fra.bb.d=40;ACT.buyTransit({city:'fra',net:'cog',tier:1});S.pops.fra.rgen=RG.findIndex(r=>r.fsN===8);S.biz.push({id:'g',type:'game',name:'G',city:'fra',bw:10,rate:1,mood:80,since:0,reqs:[]},{id:'d',type:'dia',name:'D',city:'fra',bw:5,rate:1,mood:80,since:0,reqs:[]});compute()"); const ddHit = (ev, g) => ev(`S.ev.ddos={id:'x',city:'fra',tgt:'g',vec:'dns',gbps:${g},start:S.day,until:S.day+2,bh:false};compute()`); diff --git a/tests/latency-contracts.test.js b/tests/latency-contracts.test.js new file mode 100644 index 0000000..df345f2 --- /dev/null +++ b/tests/latency-contracts.test.js @@ -0,0 +1,162 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); +const { lit } = require('../scripts/lib/js-literal'); + +// Strict latency contracts (#137): big customers who pay for a latency SLA on one route, late in the game. +const start = "ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'nyc'})"; +const pop = (c) => `S.pops['${c}']=S.pops['${c}']||{day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};S.pops['${c}'].rgen=RG.length-1;`; +const wave = (id, a, b) => `S.links.push({id:'${id}',a:'${a}',b:'${b}',kind:'wave',tier:6,n:1,km:kmBetween('${a}','${b}'),cut:0,mo:0,day:0,ready:0});`; +const CITIES = ['nyc', 'chi', 'ash', 'mia', 'lon', 'fra']; +const net = () => CITIES.map(pop).join('') + wave('nc', 'nyc', 'chi') + wave('na', 'nyc', 'ash') + wave('am', 'ash', 'mia') + wave('mc', 'mia', 'chi') + 'compute();'; +// Spawn n offers, each on its own, and keep them all. +const spawnMany = (ev, n) => JSON.parse(ev(`(()=>{const out=[];for(let i=0;i<${n};i++){S.offers=[];spawnOffer();out.push(...S.offers);}S.offers=[];return JSON.stringify(out);})()`)); +// A latency contract on New York ⇄ Chicago, signed long enough ago that its provisioning grace is over. +const sign = (bw = 1600) => `(()=>{const b={id:'lc1',city:'nyc',city2:'chi',name:'Shortest Path Securities',type:'lowlat',bw:${bw},rate:500,reqs:['lat'],latMax:latMaxOf('nyc','chi'),route:'fast',mood:100,since:S.day-30};S.biz.push(b);compute();return b.id;})()`; + +test('#137 latency contracts are offered only from their customer level, sized and priced as promised', () => { + const { ev, errors } = load(); + ev(start); + ev(net()); + ev('S.lvl=LC_LV-1'); + assert.ok(ev('LC_LV') >= 7, 'a late-game customer'); + const early = spawnMany(ev, 600); + assert.equal(early.filter((o) => o.type === 'lowlat').length, 0, 'never below its level'); + ev('S.lvl=LC_LV'); + const late = spawnMany(ev, 600); + const lc = late.filter((o) => o.type === 'lowlat'); + assert.ok(lc.length >= 5, `they call at their level (${lc.length})`); + for (const o of lc) { + assert.ok([1600, 3200].includes(o.bw), 'big: 1.6T or 3.2T'); + assert.equal(o.reqs[0], 'lat', 'always a latency limit'); + assert.equal(o.latMax, ev(`latMaxOf('${o.city}','${o.city2}')`), 'the limit every latency customer gets'); + assert.ok(ev(`Math.min(latFloor('${o.city}','${o.city2}'),bestLat('${o.city}','${o.city2}'))<=${o.latMax}`), 'and one something you can build meets'); + } + // Pay: per Gbps on the same route, above any other high-volume circuit (hyperscaler DCI, AI interconnects), whatever they ask for. + const per = (o) => o.rate / ev(`150+kmBetween('${o.city}','${o.city2}')*0.08`); + const big = late.filter((o) => ['hyper', 'ai', 'aiwan'].includes(o.type)); + assert.ok(big.length >= 5, 'there are other big circuits to compare with'); + assert.ok(Math.min(...lc.map(per)) > Math.max(...big.map(per)), 'a latency contract pays more per Gbps than any other big circuit'); + // Same size, same route: a 1.6T latency contract against a 1.6T hyperscaler DCI with every extra a DCI can ask for. + const o = lc[0], km = ev(`kmBetween('${o.city}','${o.city2}')`); + const dciBest = (150 + km * 0.08) * ev('BIZ_T.hyper.km') * (1 + ev("REQS.diverse.bonus+REQS.metro.bonus+REQS.sharks.bonus+REQS.gen.bonus")); + assert.ok(1600 * o.rate > 1600 * dciBest, 'beats a fully loaded DCI of the same size'); + assert.deepEqual(errors, []); +}); + +test('#137 the latency limit is the circuit latency the game already measures, and breaking it costs credits and the customer', () => { + const { ev, errors } = load(); + ev(start); + ev(net()); + ev('S.lvl=LC_LV'); + ev(sign()); + const b = "S.biz.find(b=>b.id==='lc1')"; + assert.ok(ev(`R.l2lat['lc1']<=${b}.latMax`), 'the direct wave meets it'); + assert.ok(ev(`REQS.lat.ok(${b})`)); + assert.ok(ev(`bizSf(${b})>=0.95`), 'and carries all of it'); + // Cut the direct wave: the circuit reroutes the long way round, still carried in full but too slow. + ev("S.links.find(l=>l.id==='nc').cut=S.day+400;compute()"); + assert.ok(ev(`bizSf(${b})>=0.95`), 'all the bandwidth still arrives'); + assert.ok(ev(`R.l2lat['lc1']>${b}.latMax`), 'over its limit'); + assert.ok(!ev(`REQS.lat.ok(${b})`), 'REQS.lat says so'); + assert.ok(ev(`bizWhy(${b}).some(w=>/latency/i.test(w))`), 'and the customer row says why'); + // A day over: a day's fee back as an SLA credit, and more patience lost than a plain latency customer (HFT) loses. + const cash = ev('S.cash'), mo = ev(`bizMo(${b})`), days = ev('monLen(S.day)'); + const extra = ev(`lcBreach(${b},S.day)`); + assert.equal(extra, ev('LC_MOOD')); + assert.equal(Math.round(cash - ev('S.cash')), Math.round(mo / days), "a day's fee credited"); + assert.equal(ev(`${b}.lcCr`), Math.round(mo / days)); + assert.equal(ev("lcBreach({type:'hft',since:0,latMax:1,city:'nyc',city2:'chi',reqs:['lat'],id:'x'},S.day)"), 0, 'only latency contracts pay credits'); + // In the provisioning grace (rule F1) nothing is credited and nothing is lost. + assert.equal(ev(`(()=>{const x={...${b},id:'lc2',since:S.day-3};return lcBreach(x,S.day);})()`), 0); + // Day after day over the limit: unhappy, warned, and gone, with credits paid every day. + const m0 = ev(`${b}.mood`); + ev('dayTick()'); + const m1 = ev(`${b}.mood`); + assert.ok(m0 - m1 >= 6 - 1e-9, `loses at least 6 a day over its SLA (${m0} → ${m1})`); + let gone = false; + for (let i = 0; i < 40 && !gone; i++) { + ev("S.links.find(l=>l.id==='nc').cut=S.day+400;dayTick()"); + gone = !ev("S.biz.some(b=>b.id==='lc1')"); + } + assert.ok(gone, 'a contract over its latency for weeks cancels'); + assert.deepEqual(errors, []); +}); + +test('#137 a latency contract within its limit stays happy and pays no credits', () => { + const { ev, errors } = load(); + ev(start); + ev(net()); + ev(sign()); + ev("S.biz.find(b=>b.id==='lc1').mood=90"); + for (let i = 0; i < 5; i++) ev("S.links.forEach(l=>l.cut=0);dayTick()"); + const b = ev("JSON.stringify(S.biz.find(b=>b.id==='lc1')||null)"); + const o = JSON.parse(b); + assert.ok(o, 'still a customer'); + assert.equal(o.lcCr, undefined, 'no credits'); + assert.equal(o.lcB, undefined, 'not in breach'); + assert.ok(o.mood > 90, `happier every day it is served (${o.mood})`); + assert.deepEqual(errors, []); +}); + +test('#137 the volume cap holds: renewals, a sales shark and an edited save never take one past 3.2T', () => { + const { ev, errors } = load(); + ev(start); + ev(net()); + ev(sign(1600)); + const b = "S.biz.find(b=>b.id==='lc1')"; + assert.ok(ev('Math.max(...BIZ_T.lowlat.opts)<=BIZ_T.lowlat.max'), 'a shark bumps an offer one size up its list, never past the most'); + assert.equal(ev(`clGrow(${b})`), true, 'grows to the next size once'); + assert.equal(ev(`${b}.bw`), 3200); + assert.equal(ev(`clGrow(${b})`), false, 'and never past it'); + assert.equal(ev(`${b}.bw`), 3200); + assert.equal(ev("(()=>{const x={type:'hyper',bw:6400};clGrow(x);return x.bw;})()"), 12800, 'other customers still double past their top size'); + // An edited save asking for more is cut back to the most the type sells. + ev(`${b}.bw=51200`); + ev('S=migrate(JSON.parse(JSON.stringify(S)));compute()'); + assert.equal(ev(`${b}.bw`), 3200); + assert.deepEqual(errors, []); +}); + +test('#137 old saves load, and new fields from a save are checked', () => { + const { ev, errors } = load(); + ev(start); + ev(net()); + // A save from before latency contracts: nothing of theirs in it. + ev('S=migrate(JSON.parse(JSON.stringify(S)));compute()'); + assert.ok(!ev("S.biz.some(b=>b.type==='lowlat')")); + // A save with a contract whose fields were edited or lost. + ev(sign()); + ev(`(()=>{const s=JSON.parse(JSON.stringify(S)),b=s.biz.find(b=>b.id==='lc1');b.lcCr='lots';b.lcB='yes';delete b.latMax;b.reqs=[];S=migrate(s);compute();})()`); + const b = JSON.parse(ev("JSON.stringify(S.biz.find(b=>b.id==='lc1'))")); + assert.equal(b.lcCr, undefined, 'junk credits dropped'); + assert.equal(b.lcB, 1, 'flag as a flag'); + assert.equal(b.latMax, ev("latMaxOf('nyc','chi')"), 'the latency limit comes back'); + assert.ok(b.reqs.includes('lat'), 'and its requirement'); + ev(`(()=>{const s=JSON.parse(JSON.stringify(S));s.biz.find(b=>b.id==='lc1').lcCr=${lit(1234.4)};S=migrate(s);})()`); + assert.equal(ev("S.biz.find(b=>b.id==='lc1').lcCr"), 1234); + assert.deepEqual(errors, []); +}); + +test('#137 offer and customer rows on a 390 px phone', () => { + const { ev, dom, errors } = load(); + ev(start); + ev(net()); + ev('S.lvl=LC_LV'); + ev("S.offers.push({id:'o1',city:'nyc',city2:'chi',name:'Great Circle Clearing House',type:'lowlat',bw:3200,rate:900,reqs:['lat'],latMax:latMaxOf('nyc','chi'),exp:S.day+40})"); + dom.window.innerWidth = 390; + ev("ACT.leftTab({t:'deals'});renderAll()"); + const html = dom.window.document.body.innerHTML; + assert.match(html, /Great Circle Clearing House/); + assert.match(html, /Low-latency wholesale route/); + assert.match(html, /Latency SLA [\d.]+ ms: a day's fee back for every day over it · never more than 3\.20 Tbps/); + ev("ACT.accept({id:'o1'})"); + const c = JSON.parse(ev("JSON.stringify(S.biz.find(b=>b.name==='Great Circle Clearing House'))")); + assert.equal(c.route, 'fast', 'routed for latency'); + assert.equal(c.latMax, ev("latMaxOf('nyc','chi')")); + ev(`S.biz.find(b=>b.id===${lit(c.id)}).lcCr=5000;renderAll()`); + const cs = ev('custSection()'); + assert.match(cs, /Low-latency wholesale route/); + assert.match(cs, /\$5\.0k paid in SLA credits/); + assert.deepEqual(errors, []); +}); From 32b0b282f817d4535b0764426334101958c0d8e8 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Tue, 10 Nov 2026 07:03:57 +0000 Subject: [PATCH 3/5] Bulk actions for the late game: POP standards, kit everywhere, buy on signing, network search - POP standards by kind (micro, medium, regional hub), one button per POP and one per kind in Utilities (#315) - Redundancy kit at every POP from Utilities, and in the intern's template (#317) - Offers that need a generator, second router or second site can buy it and sign (#241) - The intern's Light more fiber order can leave new fiber dark (#316) - Search and connected-only filter for a POP's transit, exchange, PNI and cache lists (#199) - The link panel moves on to the next parallel link after a decommission (#119) --- CHANGELOG.md | 6 + site/i18n/de.js | 44 ++++ site/i18n/es.js | 44 ++++ site/i18n/fr.js | 44 ++++ site/i18n/it.js | 44 ++++ site/i18n/pt.js | 44 ++++ src/agent/10-domains.js | 2 + src/agent/20-commands.js | 23 +++ src/agent/30-docs.js | 1 + src/agent/60-dispatch.js | 2 +- src/game/60-features/39-req-fix.js | 20 ++ src/game/60-features/80-new-game.js | 2 +- src/game/60-features/95-standing-orders.js | 9 +- src/game/60-features/96-pop-tiers.js | 49 +++++ src/game/70-rules/95-utilities.js | 6 + src/game/80-simulation/50-sanitize.js | 2 + src/game/90-actions/46-net-filter.js | 6 + src/game/90-actions/51-customer-fix.js | 10 + src/game/90-actions/60-links.js | 5 +- src/game/90-actions/85-pop-tiers.js | 16 ++ src/game/90-actions/88-utilities.js | 8 + src/game/93-ui/40-hud-and-panels.js | 2 +- src/game/93-ui/50-city-panel.js | 12 +- src/game/93-ui/51-net-filter.js | 14 ++ src/game/93-ui/52-pni-list.js | 5 +- src/game/93-ui/55-utilities.js | 8 + src/game/93-ui/70-link-panels.js | 5 +- src/i18n/en.js | 44 ++++ src/styles/36-net-filter.css | 5 + tests/bulk-actions.test.js | 226 +++++++++++++++++++++ tests/mcp-commands.test.js | 2 +- 31 files changed, 692 insertions(+), 18 deletions(-) create mode 100644 src/game/60-features/39-req-fix.js create mode 100644 src/game/60-features/96-pop-tiers.js create mode 100644 src/game/90-actions/46-net-filter.js create mode 100644 src/game/90-actions/51-customer-fix.js create mode 100644 src/game/90-actions/85-pop-tiers.js create mode 100644 src/game/93-ui/51-net-filter.js create mode 100644 src/styles/36-net-filter.css create mode 100644 tests/bulk-actions.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 744dfae..ff61ad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- From customer level 2, you can save up to three POP standards (micro POP, medium POP, regional hub), each a router model and a number of routers, and mark which POP is which. One button in a POP's Infra tab brings it up to its standard, and Utilities brings every POP of a kind up at once with the price shown first. A POP is never stepped down to a smaller model, and a busy POP with one router gets its second router before the swap, so the upgrade rolls instead of taking the POP down (#315). +- Utilities can now install the redundancy kit at every POP still missing part of it in one go, at one price shown on the button, from customer level 2. With a NOC intern you can also put the kit in the intern's new-POP template from there (#317). +- A customer asking for a backup generator, a second router or a second site at POPs you already have now shows what is missing and what it costs, with a button that buys exactly that and signs the deal. Nothing is bought unless you press it (#241). +- The NOC intern's "Light more fiber" order can now leave new fiber dark, so a fiber handed over in the night no longer pulls in traffic before you are ready for it. Fiber you light yourself still gets more optics when it runs hot (#316). +- The Transit and Peering tabs of a POP have a search box for a network's name or AS number and a "Connected only" switch, so you can find the one network you need in a long list, on phones too (#199). +- Decommissioning one of several links between the same two cities keeps the link panel open on the next one, so you can hand back a row of waves without reopening it each time (#119). - A link that a closed border has taken down, like Doha to Dubai or Abu Dhabi while the neighbours have fallen out, now says so in its panel, with the days until it comes back, instead of showing nothing wrong. Leasing a new wave or fiber pair across that border during the spat warns you first that it will stay dark (#329). ## [3.3.0] — 2026-11-09 diff --git a/site/i18n/de.js b/site/i18n/de.js index 5402b72..52f3ae3 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3161,6 +3161,9 @@ "modal_and_names.the_real_thing_follow_a_packet":"Das Original: Folge einem Paket vom WLAN bis zur Unterseeglasfaser.", "modals.lay_your_own_subsea_cable":"Eigenes Seekabel verlegen…", "modals.your_own_subsea_cable_level_n":"Eigenes Seekabel Level {n} oder Tier 1", +"net_filter.clear":"Zurücksetzen", +"net_filter.connected_only":"Nur verbundene", +"net_filter.find_a_network":"Netzwerk oder AS-Nummer suchen", "networks.a_mobile_network_named_after_the":"Ein Mobilfunknetz, benannt nach dem Klang anstoßender Gläser. Prost auf jeden 5G-Mast.", "networks.a_spanish_carrier_starring_in_every":"Ein spanischer Carrier mit Hauptrolle in jedem lateinamerikanischen Markt, zumindest bis er den nächsten verkauft.", "networks.a_tiny_telco_in_a_country":"Eine winzige Telco in einem Land, in dem die Kabel der Welt an Land gehen. Die Preise passen dazu.", @@ -3396,6 +3399,7 @@ "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", "ops.p_at":"Ab", +"ops.p_fresh":"Neue Glasfaser anknipsen", "ops.p_g":"Ab", "ops.p_how":"Wie", "ops.p_keep":"Einen in Reserve", @@ -3927,6 +3931,29 @@ "pop_std.none":"Keiner", "pop_std.not_all_of_the_standard":"Nicht genug Geld oder Level für den ganzen Standard in {city}: Er bekam, was passte.", "pop_std.standard_for_new_pops":"Standard für neue POPs", +"pop_tiers.apply_cost":"Auf Standard bringen {cost}", +"pop_tiers.bring_up_n":{"one":"{n} POP hochbringen {cost}","other":"{n} POPs hochbringen {cost}"}, +"pop_tiers.bulk_done":{"one":"{kind}: {n} POP auf den Standard gebracht.","other":"{kind}: {n} POPs auf den Standard gebracht."}, +"pop_tiers.bulk_note":"Jeder POP, den du als eine Art markiert hast, in einem Rutsch auf ihren Standard gebracht. Ändere einen Standard (neues Modell, mehr Router) und drück nochmal.", +"pop_tiers.city_is_kind":"{city} erfüllt den Standard {kind}.", +"pop_tiers.hub":"Regionaler Hub", +"pop_tiers.mark":"Markieren", +"pop_tiers.medium":"Mittlerer POP", +"pop_tiers.meets_it":"Erfüllt", +"pop_tiers.micro":"Mikro-POP", +"pop_tiers.model_locked":"{model} gibt es ab Kundenlevel {lv}.", +"pop_tiers.n_below":{"one":"{n} unter dem Standard","other":"{n} unter dem Standard"}, +"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"}, +"pop_tiers.n_stuck":{"one":"{n} geht noch nicht","other":"{n} gehen noch nicht"}, +"pop_tiers.no_kind":"Noch keine Art", +"pop_tiers.not_all":"In {city} ging nicht der ganze Standard rein. Schau in den Infra-Tab.", +"pop_tiers.not_set":"noch nicht festgelegt", +"pop_tiers.note":"Speichere die Router eines POPs als Standard und markiere dann andere POPs als diese Art. Auf Standard bringen fügt Router hinzu und tauscht auf das größere Modell, nie einen Schritt zurück. Unter Werkzeuge bringst du alle POPs einer Art auf einmal hoch.", +"pop_tiers.save_here":"Diese Router speichern", +"pop_tiers.saved":"{kind} ist jetzt {desc}.", +"pop_tiers.swapped_today":"Die Router hier wurden heute getauscht. Versuch es morgen wieder.", +"pop_tiers.this_pop_is":"Dieser POP: {kind}", +"pop_tiers.title":"POP-Standards", "pops_transit_ix.40_off_for_6_months":"40 % Rabatt für 6 Monate", "pops_transit_ix.40_off_ix_for_6_months":"40 % Rabatt auf {ix} für 6 Monate.
Dein Account Manager ist erleichtert. Das Kleingedruckte liest du später.", "pops_transit_ix.after_consulting_with_management_the":"„Nach Rücksprache mit dem Management …“
Der Preis ist gestiegen. Das Management wurde konsultiert.", @@ -4194,6 +4221,12 @@ "release_notes.read_the_full_notes_on_github":"Alle Hinweise auf GitHub lesen", "release_notes.series_of_tubes_v_is_out":"Series of Tubes {v} ist da!", "release_notes.your_game_is_saved_automatically":"Dein Spiel wird automatisch gespeichert.", +"req_fix.bought":"Gekauft: {list} für {cost}.", +"req_fix.buy_and_sign":"Kaufen und unterschreiben {cost}", +"req_fix.buys_list":"Es fehlt: {list}. {cost} + {mo}/Monat.", +"req_fix.generator_in_city":"ein Notstromaggregat in {city}", +"req_fix.second_router_in_city":"ein zweiter Router in {city}", +"req_fix.second_site_in_city":"ein zweiter Standort in {city}", "requirements.a_spare_fiber_pair_in_your":"ein freies Faserpaar in deinem Graben {a}–{b}", "requirements.afraid_of_sharks_needs_a_path":"Angst vor Haien: braucht einen Pfad ohne Seekabel", "requirements.backup_generator_in_every_city_they":"Notstromgenerator in jeder Stadt, in der sie vertreten sind", @@ -4828,9 +4861,20 @@ "utilities.caches_requested":"{n} Cache-Boxen in {city} installiert.", "utilities.ix_peering":"IX-Peering im ganzen Netz", "utilities.join_route_servers":"Allen Route Servern beitreten ({n})", +"utilities.kit_all_applied":{"one":"Redundanz-Kit in {n} POP eingebaut.","other":"Redundanz-Kit in {n} POPs eingebaut."}, +"utilities.kit_all_apply":{"one":"Kit in {n} POP {cost}","other":"Kit in alle {n} POPs {cost}"}, +"utilities.kit_all_done":"Jeder POP hat das komplette Kit.", +"utilities.kit_all_quote":{"one":"{n} POP braucht es · {cost} + {mo}/Monat","other":"{n} POPs brauchen es · {cost} + {mo}/Monat"}, "utilities.kit_applied":"Redundanz in {city} aktualisiert.", "utilities.kit_balanced":"Hardware installiert und Caches ausgeglichen.", "utilities.kit_cost":"Einmalig: {cost} · Zusätzliche Kosten pro Monat: {mo}", +"utilities.kit_everywhere":"Redundanz-Kit überall", +"utilities.kit_everywhere_note":"Das Kit in jedem POP, dem noch ein Teil davon fehlt: Notstrom, zweites Gebäude, zweiter Router, Caches auf beide Standorte verteilt. Ein Preis für alle.", +"utilities.kit_new_pops_hire":"Stell einen NOC-Praktikanten ein, dann eröffnest du neue POPs aus einer Vorlage, das Kit schon drin.", +"utilities.kit_new_pops_off":"Neue POPs aus der Vorlage von {name} kommen ohne das Kit.", +"utilities.kit_new_pops_on":"Neue POPs aus der Vorlage von {name} bekommen das Kit gleich mit.", +"utilities.kit_new_pops_start":"Kit in die Vorlage", +"utilities.kit_new_pops_stop":"Kit aus der Vorlage nehmen", "utilities.peer_counts":"{ready} möglich · {existing} bestehend · {blocked} nicht verfügbar", "utilities.peering_note":"Fordert an jedem IX, an dem du bist, alle möglichen Peers an. Bestehende Sessions, auch über Route Server, werden übersprungen. Absagen und Traffic-Schwellen gelten weiter. Es werden keine Ports oder bezahlten PNIs gekauft.", "utilities.peers_requested":"{n} neue IX-Peering-Sessions aufgebaut.", diff --git a/site/i18n/es.js b/site/i18n/es.js index feaa272..467c907 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3159,6 +3159,9 @@ "modal_and_names.the_real_thing_follow_a_packet":"Lo de verdad: sigue un paquete del Wi-Fi a la fibra submarina.", "modals.lay_your_own_subsea_cable":"Tender tu propio cable submarino…", "modals.your_own_subsea_cable_level_n":"Tu propio cable submarino nivel {n} o Tier 1", +"net_filter.clear":"Borrar", +"net_filter.connected_only":"Solo conectadas", +"net_filter.find_a_network":"Buscar una red o número de AS", "networks.a_mobile_network_named_after_the":"Una red móvil con el nombre del sonido de un brindis. Salud por cada torre 5G.", "networks.a_spanish_carrier_starring_in_every":"Un operador español protagonista en todos los mercados latinoamericanos, al menos hasta que vende el siguiente.", "networks.a_tiny_telco_in_a_country":"Una telco diminuta en un país donde llegan a tierra los cables del mundo. Precios a juego.", @@ -3394,6 +3397,7 @@ "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", "ops.p_at":"Por encima de", +"ops.p_fresh":"Encender fibra nueva", "ops.p_g":"Desde", "ops.p_how":"Cómo", "ops.p_keep":"Dejar uno de reserva", @@ -3925,6 +3929,29 @@ "pop_std.none":"Ninguno", "pop_std.not_all_of_the_standard":"No hay dinero o nivel para todo el estándar en {city}: recibió lo que cupo.", "pop_std.standard_for_new_pops":"Estándar para nuevos POP", +"pop_tiers.apply_cost":"Ponerlo al día {cost}", +"pop_tiers.bring_up_n":{"one":"Poner al día {n} POP {cost}","other":"Poner al día {n} POPs {cost}"}, +"pop_tiers.bulk_done":{"one":"{kind}: {n} POP puesto al día.","other":"{kind}: {n} POPs puestos al día."}, +"pop_tiers.bulk_note":"Cada POP que marcaste de un tipo, puesto al día con su estándar de una vez. Cambia un estándar (un modelo nuevo, más routers) y vuelve a pulsar.", +"pop_tiers.city_is_kind":"{city} cumple el estándar {kind}.", +"pop_tiers.hub":"Hub regional", +"pop_tiers.mark":"Marcarlo", +"pop_tiers.medium":"POP mediano", +"pop_tiers.meets_it":"Lo cumple", +"pop_tiers.micro":"Micro POP", +"pop_tiers.model_locked":"{model} se desbloquea en el nivel de clientes {lv}.", +"pop_tiers.n_below":{"one":"{n} por debajo del estándar","other":"{n} por debajo del estándar"}, +"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"}, +"pop_tiers.n_stuck":{"one":"{n} todavía no puede","other":"{n} todavía no pueden"}, +"pop_tiers.no_kind":"Sin tipo aún", +"pop_tiers.not_all":"En {city} no entró todo el estándar. Revisa la pestaña Infra.", +"pop_tiers.not_set":"sin definir", +"pop_tiers.note":"Guarda los routers de un POP como estándar y marca otros POPs de ese tipo. Ponerlo al día añade routers y cambia al modelo más grande, nunca un paso atrás. En Utilidades pones al día todos los POPs de un tipo a la vez.", +"pop_tiers.save_here":"Guardar estos routers", +"pop_tiers.saved":"{kind} ahora es {desc}.", +"pop_tiers.swapped_today":"Los routers de aquí se cambiaron hoy. Prueba mañana.", +"pop_tiers.this_pop_is":"Este POP: {kind}", +"pop_tiers.title":"Estándares de POP", "pops_transit_ix.40_off_for_6_months":"40 % de descuento durante 6 meses", "pops_transit_ix.40_off_ix_for_6_months":"40 % de descuento en {ix} durante 6 meses.
Tu gestor de cuenta está aliviado. Lee la letra pequeña más tarde.", "pops_transit_ix.after_consulting_with_management_the":"«Tras consultar con la dirección…»
El precio subió. Se consultó a la dirección.", @@ -4192,6 +4219,12 @@ "release_notes.read_the_full_notes_on_github":"Lee las notas completas en GitHub", "release_notes.series_of_tubes_v_is_out":"¡Ya salió Series of Tubes {v}!", "release_notes.your_game_is_saved_automatically":"Tu partida se guarda automáticamente.", +"req_fix.bought":"Comprado: {list} por {cost}.", +"req_fix.buy_and_sign":"Comprar y firmar {cost}", +"req_fix.buys_list":"Falta: {list}. {cost} + {mo}/mes.", +"req_fix.generator_in_city":"un generador de respaldo en {city}", +"req_fix.second_router_in_city":"un segundo router en {city}", +"req_fix.second_site_in_city":"un segundo sitio en {city}", "requirements.a_spare_fiber_pair_in_your":"un par de fibra libre en tu zanja {a}–{b}", "requirements.afraid_of_sharks_needs_a_path":"Miedo a los tiburones: necesita una ruta sin cable submarino", "requirements.backup_generator_in_every_city_they":"Generador de respaldo en cada ciudad que toquen", @@ -4826,9 +4859,20 @@ "utilities.caches_requested":"Se han instalado {n} cachés en {city}.", "utilities.ix_peering":"Peering IX en toda la red", "utilities.join_route_servers":"Unirse a todos los route servers ({n})", +"utilities.kit_all_applied":{"one":"Kit de redundancia instalado en {n} POP.","other":"Kit de redundancia instalado en {n} POPs."}, +"utilities.kit_all_apply":{"one":"Kit en {n} POP {cost}","other":"Kit en los {n} POPs {cost}"}, +"utilities.kit_all_done":"Todos los POPs tienen el kit completo.", +"utilities.kit_all_quote":{"one":"{n} POP lo necesita · {cost} + {mo}/mes","other":"{n} POPs lo necesitan · {cost} + {mo}/mes"}, "utilities.kit_applied":"Redundancia actualizada en {city}.", "utilities.kit_balanced":"Hardware instalado y cachés equilibradas.", "utilities.kit_cost":"Pago único: {cost} · Coste mensual adicional: {mo}", +"utilities.kit_everywhere":"Kit de redundancia en todas partes", +"utilities.kit_everywhere_note":"El kit en cada POP al que todavía le falta alguna parte: generador, segundo edificio, segundo router, cachés repartidas entre sitios. Un solo precio para todos.", +"utilities.kit_new_pops_hire":"Contrata a un becario del NOC para abrir POPs nuevos con una plantilla que ya incluye el kit.", +"utilities.kit_new_pops_off":"Los POPs nuevos abiertos con la plantilla de {name} llegan sin el kit.", +"utilities.kit_new_pops_on":"Los POPs nuevos abiertos con la plantilla de {name} también llevan el kit.", +"utilities.kit_new_pops_start":"Meter el kit en la plantilla", +"utilities.kit_new_pops_stop":"Sacarlo de la plantilla", "utilities.peer_counts":"{ready} elegibles · {existing} existentes · {blocked} no disponibles", "utilities.peering_note":"Solicita peers elegibles en cada IX al que te hayas unido. Se omiten las sesiones existentes, incluidos los peers del route server. Los rechazos y umbrales de tráfico siguen vigentes. No se compran puertos ni PNI de pago.", "utilities.peers_requested":"Se han establecido {n} nuevas sesiones de peering IX.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index f971279..e91f313 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3159,6 +3159,9 @@ "modal_and_names.the_real_thing_follow_a_packet":"La version réelle : suis un paquet du Wi-Fi à la fibre sous-marine.", "modals.lay_your_own_subsea_cable":"Pose ton propre câble sous-marin…", "modals.your_own_subsea_cable_level_n":"Ton propre câble sous-marin niveau {n} ou Tier 1", +"net_filter.clear":"Effacer", +"net_filter.connected_only":"Connectés seulement", +"net_filter.find_a_network":"Chercher un réseau ou un numéro d'AS", "networks.a_mobile_network_named_after_the":"Un réseau mobile qui porte le nom du bruit d’un toast. Tchin-tchin à chaque antenne 5G.", "networks.a_spanish_carrier_starring_in_every":"Un opérateur espagnol en vedette sur chaque marché d’Amérique latine, au moins jusqu’à ce qu’il revende le suivant.", "networks.a_tiny_telco_in_a_country":"Un tout petit opérateur dans un pays où les câbles du monde entier touchent terre. Tarifs à l’avenant.", @@ -3394,6 +3397,7 @@ "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", "ops.p_at":"Au-delà de", +"ops.p_fresh":"Allumer la fibre neuve", "ops.p_g":"À partir de", "ops.p_how":"Comment", "ops.p_keep":"En garder un de secours", @@ -3925,6 +3929,29 @@ "pop_std.none":"Aucun", "pop_std.not_all_of_the_standard":"Pas assez d'argent ou de niveau pour tout le standard à {city} : il a reçu ce qui passait.", "pop_std.standard_for_new_pops":"Standard des nouveaux POP", +"pop_tiers.apply_cost":"Le mettre à niveau {cost}", +"pop_tiers.bring_up_n":{"one":"Mettre {n} POP à niveau {cost}","other":"Mettre {n} POP à niveau {cost}"}, +"pop_tiers.bulk_done":{"one":"{kind} : {n} POP mis à niveau.","other":"{kind} : {n} POP mis à niveau."}, +"pop_tiers.bulk_note":"Chaque POP que tu as marqué d'un type, mis à niveau selon son standard d'un seul coup. Change un standard (nouveau modèle, plus de routeurs) et appuie à nouveau.", +"pop_tiers.city_is_kind":"{city} respecte le standard {kind}.", +"pop_tiers.hub":"Hub régional", +"pop_tiers.mark":"Le marquer", +"pop_tiers.medium":"POP moyen", +"pop_tiers.meets_it":"Conforme", +"pop_tiers.micro":"Micro-POP", +"pop_tiers.model_locked":"{model} se débloque au niveau clients {lv}.", +"pop_tiers.n_below":{"one":"{n} sous le standard","other":"{n} sous le standard"}, +"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POP"}, +"pop_tiers.n_stuck":{"one":"{n} ne peut pas encore","other":"{n} ne peuvent pas encore"}, +"pop_tiers.no_kind":"Pas encore de type", +"pop_tiers.not_all":"Tout le standard n'a pas pu être installé à {city}. Regarde l'onglet Infra.", +"pop_tiers.not_set":"pas encore défini", +"pop_tiers.note":"Enregistre les routeurs d'un POP comme standard, puis marque d'autres POP de ce type. La mise à niveau ajoute des routeurs et passe au plus gros modèle, jamais un pas en arrière. Les Utilitaires mettent à niveau tous les POP d'un type d'un coup.", +"pop_tiers.save_here":"Enregistrer ces routeurs", +"pop_tiers.saved":"{kind} est maintenant {desc}.", +"pop_tiers.swapped_today":"Les routeurs ici ont été changés aujourd'hui. Réessaie demain.", +"pop_tiers.this_pop_is":"Ce POP : {kind}", +"pop_tiers.title":"Standards de POP", "pops_transit_ix.40_off_for_6_months":"40 % de remise pendant 6 mois", "pops_transit_ix.40_off_ix_for_6_months":"40 % de remise sur {ix} pendant 6 mois.
Ton account manager est soulagé. Lis les petites lignes plus tard.", "pops_transit_ix.after_consulting_with_management_the":"« Après consultation de la direction… »
Le prix a augmenté. La direction a été consultée.", @@ -4192,6 +4219,12 @@ "release_notes.read_the_full_notes_on_github":"Lire les notes complètes sur GitHub", "release_notes.series_of_tubes_v_is_out":"Series of Tubes {v} est sorti !", "release_notes.your_game_is_saved_automatically":"Ta partie est sauvegardée automatiquement.", +"req_fix.bought":"Acheté : {list} pour {cost}.", +"req_fix.buy_and_sign":"Acheter et signer {cost}", +"req_fix.buys_list":"Il manque : {list}. {cost} + {mo}/mois.", +"req_fix.generator_in_city":"un groupe électrogène à {city}", +"req_fix.second_router_in_city":"un second routeur à {city}", +"req_fix.second_site_in_city":"un second site à {city}", "requirements.a_spare_fiber_pair_in_your":"une paire de fibre libre dans ta tranchée {a}–{b}", "requirements.afraid_of_sharks_needs_a_path":"A peur des requins : veut un chemin sans câble sous-marin", "requirements.backup_generator_in_every_city_they":"Groupe électrogène dans chaque ville qu’il touche", @@ -4826,9 +4859,20 @@ "utilities.caches_requested":"{n} caches installés à {city}.", "utilities.ix_peering":"Peering IX sur tout le réseau", "utilities.join_route_servers":"Rejoindre tous les route servers ({n})", +"utilities.kit_all_applied":{"one":"Kit de redondance installé dans {n} POP.","other":"Kit de redondance installé dans {n} POP."}, +"utilities.kit_all_apply":{"one":"Kit pour {n} POP {cost}","other":"Kit pour les {n} POP {cost}"}, +"utilities.kit_all_done":"Chaque POP a le kit complet.", +"utilities.kit_all_quote":{"one":"{n} POP en a besoin · {cost} + {mo}/mois","other":"{n} POP en ont besoin · {cost} + {mo}/mois"}, "utilities.kit_applied":"Redondance mise à jour à {city}.", "utilities.kit_balanced":"Matériel installé et caches équilibrés.", "utilities.kit_cost":"Coût initial : {cost} · Coût mensuel supplémentaire : {mo}", +"utilities.kit_everywhere":"Kit de redondance partout", +"utilities.kit_everywhere_note":"Le kit dans chaque POP à qui il en manque une partie : groupe électrogène, second bâtiment, second routeur, caches répartis entre les sites. Un seul prix pour tous.", +"utilities.kit_new_pops_hire":"Embauche un stagiaire NOC pour ouvrir de nouveaux POP depuis un modèle, kit déjà compris.", +"utilities.kit_new_pops_off":"Les nouveaux POP ouverts avec le modèle de {name} arrivent sans le kit.", +"utilities.kit_new_pops_on":"Les nouveaux POP ouverts avec le modèle de {name} reçoivent aussi le kit.", +"utilities.kit_new_pops_start":"Mettre le kit dans le modèle", +"utilities.kit_new_pops_stop":"Le retirer du modèle", "utilities.peer_counts":"{ready} éligibles · {existing} existants · {blocked} indisponibles", "utilities.peering_note":"Demande les peers éligibles sur chaque IX rejoint. Les sessions existantes, y compris via le route server, sont ignorées. Les refus et seuils de trafic restent applicables. Aucun port ni PNI payant ne sera acheté.", "utilities.peers_requested":"{n} nouvelles sessions de peering IX établies.", diff --git a/site/i18n/it.js b/site/i18n/it.js index 9034753..9f86192 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3159,6 +3159,9 @@ "modal_and_names.the_real_thing_follow_a_packet":"La versione vera: segui un pacchetto dal Wi-Fi alla fibra sottomarina.", "modals.lay_your_own_subsea_cable":"Posa il tuo cavo sottomarino…", "modals.your_own_subsea_cable_level_n":"Il tuo cavo sottomarino livello {n} o Tier 1", +"net_filter.clear":"Cancella", +"net_filter.connected_only":"Solo collegate", +"net_filter.find_a_network":"Cerca una rete o un numero AS", "networks.a_mobile_network_named_after_the":"Una rete mobile che porta il nome del suono di un brindisi. Cin cin a ogni antenna 5G.", "networks.a_spanish_carrier_starring_in_every":"Un carrier spagnolo protagonista in ogni mercato latinoamericano, almeno finché non vende il prossimo.", "networks.a_tiny_telco_in_a_country":"Una piccola telco in un paese dove approdano i cavi di mezzo mondo. Prezzi in proporzione.", @@ -3394,6 +3397,7 @@ "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", "ops.p_at":"Oltre", +"ops.p_fresh":"Accendi la fibra nuova", "ops.p_g":"Da", "ops.p_how":"Come", "ops.p_keep":"Tienine uno di scorta", @@ -3925,6 +3929,29 @@ "pop_std.none":"Nessuno", "pop_std.not_all_of_the_standard":"Non bastano soldi o livello per tutto lo standard a {city}: ha avuto quello che si poteva.", "pop_std.standard_for_new_pops":"Standard per i nuovi POP", +"pop_tiers.apply_cost":"Portalo allo standard {cost}", +"pop_tiers.bring_up_n":{"one":"Porta {n} POP allo standard {cost}","other":"Porta {n} POP allo standard {cost}"}, +"pop_tiers.bulk_done":{"one":"{kind}: {n} POP portato allo standard.","other":"{kind}: {n} POP portati allo standard."}, +"pop_tiers.bulk_note":"Ogni POP che hai segnato di un tipo, portato al suo standard in un colpo solo. Cambia uno standard (un modello nuovo, più router) e premi di nuovo.", +"pop_tiers.city_is_kind":"{city} rispetta lo standard {kind}.", +"pop_tiers.hub":"Hub regionale", +"pop_tiers.mark":"Segnalo", +"pop_tiers.medium":"POP medio", +"pop_tiers.meets_it":"In regola", +"pop_tiers.micro":"Micro POP", +"pop_tiers.model_locked":"{model} si sblocca al livello clienti {lv}.", +"pop_tiers.n_below":{"one":"{n} sotto lo standard","other":"{n} sotto lo standard"}, +"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POP"}, +"pop_tiers.n_stuck":{"one":"{n} non può ancora","other":"{n} non possono ancora"}, +"pop_tiers.no_kind":"Nessun tipo ancora", +"pop_tiers.not_all":"A {city} non è entrato tutto lo standard. Controlla la scheda Infra.", +"pop_tiers.not_set":"non ancora definito", +"pop_tiers.note":"Salva i router di un POP come standard, poi segna altri POP di quel tipo. Portarlo allo standard aggiunge router e passa al modello più grande, mai un passo indietro. Da Utilità porti allo standard tutti i POP di un tipo in una volta.", +"pop_tiers.save_here":"Salva questi router", +"pop_tiers.saved":"{kind} ora è {desc}.", +"pop_tiers.swapped_today":"I router qui sono stati cambiati oggi. Riprova domani.", +"pop_tiers.this_pop_is":"Questo POP: {kind}", +"pop_tiers.title":"Standard dei POP", "pops_transit_ix.40_off_for_6_months":"40% di sconto per 6 mesi", "pops_transit_ix.40_off_ix_for_6_months":"40% di sconto su {ix} per 6 mesi.
Il tuo account manager tira un sospiro di sollievo. Le clausole in piccolo leggile dopo.", "pops_transit_ix.after_consulting_with_management_the":"“Dopo un confronto con il management…”
Il prezzo è salito. Il management è stato consultato.", @@ -4192,6 +4219,12 @@ "release_notes.read_the_full_notes_on_github":"Leggi le note complete su GitHub", "release_notes.series_of_tubes_v_is_out":"È uscito Series of Tubes {v}!", "release_notes.your_game_is_saved_automatically":"La tua partita viene salvata automaticamente.", +"req_fix.bought":"Comprato: {list} per {cost}.", +"req_fix.buy_and_sign":"Compra e firma {cost}", +"req_fix.buys_list":"Manca: {list}. {cost} + {mo}/mese.", +"req_fix.generator_in_city":"un generatore di backup a {city}", +"req_fix.second_router_in_city":"un secondo router a {city}", +"req_fix.second_site_in_city":"un secondo sito a {city}", "requirements.a_spare_fiber_pair_in_your":"una coppia di fibre libera nel tuo scavo {a}–{b}", "requirements.afraid_of_sharks_needs_a_path":"Ha paura degli squali: vuole un percorso senza cavi sottomarini", "requirements.backup_generator_in_every_city_they":"Generatore di backup in ogni città che tocca", @@ -4826,9 +4859,20 @@ "utilities.caches_requested":"Installate {n} cache a {city}.", "utilities.ix_peering":"Peering IX su tutta la rete", "utilities.join_route_servers":"Unisciti a tutti i route server ({n})", +"utilities.kit_all_applied":{"one":"Kit di ridondanza installato in {n} POP.","other":"Kit di ridondanza installato in {n} POP."}, +"utilities.kit_all_apply":{"one":"Kit per {n} POP {cost}","other":"Kit per tutti i {n} POP {cost}"}, +"utilities.kit_all_done":"Ogni POP ha il kit completo.", +"utilities.kit_all_quote":{"one":"{n} POP ne ha bisogno · {cost} + {mo}/mese","other":"{n} POP ne hanno bisogno · {cost} + {mo}/mese"}, "utilities.kit_applied":"Ridondanza aggiornata a {city}.", "utilities.kit_balanced":"Hardware installato e cache bilanciate.", "utilities.kit_cost":"Una tantum: {cost} · Costo mensile aggiuntivo: {mo}", +"utilities.kit_everywhere":"Kit di ridondanza ovunque", +"utilities.kit_everywhere_note":"Il kit in ogni POP a cui ne manca ancora un pezzo: generatore, secondo edificio, secondo router, cache divise tra i siti. Un solo prezzo per tutti.", +"utilities.kit_new_pops_hire":"Assumi uno stagista del NOC per aprire nuovi POP da un modello con il kit già dentro.", +"utilities.kit_new_pops_off":"I nuovi POP aperti dal modello di {name} arrivano senza kit.", +"utilities.kit_new_pops_on":"I nuovi POP aperti dal modello di {name} ricevono anche il kit.", +"utilities.kit_new_pops_start":"Metti il kit nel modello", +"utilities.kit_new_pops_stop":"Toglilo dal modello", "utilities.peer_counts":"{ready} idonei · {existing} esistenti · {blocked} non disponibili", "utilities.peering_note":"Richiedi i peer idonei in ogni IX a cui partecipi. Le sessioni esistenti, inclusi i peer del route server, vengono saltate. Rifiuti e soglie di traffico restano validi. Non vengono acquistate porte o PNI a pagamento.", "utilities.peers_requested":"Stabilite {n} nuove sessioni di peering IX.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 0657f8f..3a21141 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3159,6 +3159,9 @@ "modal_and_names.the_real_thing_follow_a_packet":"A coisa de verdade: siga um pacote do Wi-Fi até a fibra submarina.", "modals.lay_your_own_subsea_cable":"Lançar seu próprio cabo submarino…", "modals.your_own_subsea_cable_level_n":"Seu próprio cabo submarino nível {n} ou Tier 1", +"net_filter.clear":"Limpar", +"net_filter.connected_only":"Só ligadas", +"net_filter.find_a_network":"Procurar uma rede ou número AS", "networks.a_mobile_network_named_after_the":"Uma rede móvel com nome de brinde. Tim-tim para cada torre 5G.", "networks.a_spanish_carrier_starring_in_every":"Uma operadora espanhola estrelando em todo mercado latino-americano, pelo menos até vender o próximo.", "networks.a_tiny_telco_in_a_country":"Uma operadora minúscula num país onde os cabos do mundo chegam à terra. Os preços acompanham.", @@ -3394,6 +3397,7 @@ "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", "ops.p_at":"Acima de", +"ops.p_fresh":"Acender fibra nova", "ops.p_g":"A partir de", "ops.p_how":"Como", "ops.p_keep":"Manter um de reserva", @@ -3925,6 +3929,29 @@ "pop_std.none":"Nenhum", "pop_std.not_all_of_the_standard":"Sem dinheiro ou nível para todo o padrão em {city}: recebeu o que coube.", "pop_std.standard_for_new_pops":"Padrão para novos POPs", +"pop_tiers.apply_cost":"Pôr no padrão {cost}", +"pop_tiers.bring_up_n":{"one":"Pôr {n} POP no padrão {cost}","other":"Pôr {n} POPs no padrão {cost}"}, +"pop_tiers.bulk_done":{"one":"{kind}: {n} POP posto no padrão.","other":"{kind}: {n} POPs postos no padrão."}, +"pop_tiers.bulk_note":"Cada POP que marcaste de um tipo, posto no seu padrão de uma só vez. Muda um padrão (um modelo novo, mais routers) e carrega outra vez.", +"pop_tiers.city_is_kind":"{city} cumpre o padrão {kind}.", +"pop_tiers.hub":"Hub regional", +"pop_tiers.mark":"Marcar", +"pop_tiers.medium":"POP médio", +"pop_tiers.meets_it":"Cumpre", +"pop_tiers.micro":"Micro POP", +"pop_tiers.model_locked":"{model} desbloqueia no nível de clientes {lv}.", +"pop_tiers.n_below":{"one":"{n} abaixo do padrão","other":"{n} abaixo do padrão"}, +"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"}, +"pop_tiers.n_stuck":{"one":"{n} ainda não pode","other":"{n} ainda não podem"}, +"pop_tiers.no_kind":"Ainda sem tipo", +"pop_tiers.not_all":"Nem todo o padrão entrou em {city}. Vê o separador Infra.", +"pop_tiers.not_set":"ainda não definido", +"pop_tiers.note":"Guarda os routers de um POP como padrão e depois marca outros POPs desse tipo. Pôr no padrão adiciona routers e troca para o modelo maior, nunca um passo atrás. Em Utilitários pões todos os POPs de um tipo no padrão de uma vez.", +"pop_tiers.save_here":"Guardar estes routers", +"pop_tiers.saved":"{kind} agora é {desc}.", +"pop_tiers.swapped_today":"Os routers aqui foram trocados hoje. Tenta amanhã.", +"pop_tiers.this_pop_is":"Este POP: {kind}", +"pop_tiers.title":"Padrões de POP", "pops_transit_ix.40_off_for_6_months":"40% de desconto por 6 meses", "pops_transit_ix.40_off_ix_for_6_months":"40% de desconto no {ix} por 6 meses.
Seu account manager respirou aliviado. Leia as letras miúdas depois.", "pops_transit_ix.after_consulting_with_management_the":"“Depois de consultar a diretoria…”
O preço subiu. A diretoria foi consultada.", @@ -4192,6 +4219,12 @@ "release_notes.read_the_full_notes_on_github":"Leia as notas completas no GitHub", "release_notes.series_of_tubes_v_is_out":"Saiu o Series of Tubes {v}!", "release_notes.your_game_is_saved_automatically":"Seu jogo é salvo automaticamente.", +"req_fix.bought":"Comprado: {list} por {cost}.", +"req_fix.buy_and_sign":"Comprar e assinar {cost}", +"req_fix.buys_list":"Falta: {list}. {cost} + {mo}/mês.", +"req_fix.generator_in_city":"um gerador de backup em {city}", +"req_fix.second_router_in_city":"um segundo router em {city}", +"req_fix.second_site_in_city":"um segundo site em {city}", "requirements.a_spare_fiber_pair_in_your":"um par de fibra livre na sua vala {a}–{b}", "requirements.afraid_of_sharks_needs_a_path":"Tem medo de tubarão: quer um caminho sem cabo submarino", "requirements.backup_generator_in_every_city_they":"Gerador de backup em toda cidade que tocar", @@ -4826,9 +4859,20 @@ "utilities.caches_requested":"Instaladas {n} caches em {city}.", "utilities.ix_peering":"Peering IX em toda a rede", "utilities.join_route_servers":"Aderir a todos os route servers ({n})", +"utilities.kit_all_applied":{"one":"Kit de redundância instalado em {n} POP.","other":"Kit de redundância instalado em {n} POPs."}, +"utilities.kit_all_apply":{"one":"Kit em {n} POP {cost}","other":"Kit nos {n} POPs {cost}"}, +"utilities.kit_all_done":"Todos os POPs têm o kit completo.", +"utilities.kit_all_quote":{"one":"{n} POP precisa · {cost} + {mo}/mês","other":"{n} POPs precisam · {cost} + {mo}/mês"}, "utilities.kit_applied":"Redundância atualizada em {city}.", "utilities.kit_balanced":"Hardware instalado e caches equilibradas.", "utilities.kit_cost":"Custo único: {cost} · Custo mensal adicional: {mo}", +"utilities.kit_everywhere":"Kit de redundância em todo lado", +"utilities.kit_everywhere_note":"O kit em cada POP a que ainda falta alguma parte: gerador, segundo prédio, segundo router, caches divididos entre sites. Um só preço para todos.", +"utilities.kit_new_pops_hire":"Contrata um estagiário do NOC para abrir POPs novos a partir de um modelo, já com o kit.", +"utilities.kit_new_pops_off":"POPs novos abertos com o modelo de {name} vêm sem o kit.", +"utilities.kit_new_pops_on":"POPs novos abertos com o modelo de {name} também levam o kit.", +"utilities.kit_new_pops_start":"Pôr o kit no modelo", +"utilities.kit_new_pops_stop":"Tirá-lo do modelo", "utilities.peer_counts":"{ready} elegíveis · {existing} existentes · {blocked} indisponíveis", "utilities.peering_note":"Solicita peers elegíveis em todos os IX a que aderiste. As sessões existentes, incluindo peers do route server, são ignoradas. Recusas e limites de tráfego continuam a aplicar-se. Não são compradas portas nem PNI pagos.", "utilities.peers_requested":"Estabelecidas {n} novas sessões de peering IX.", diff --git a/src/agent/10-domains.js b/src/agent/10-domains.js index f1b8a8f..4a29ab0 100644 --- a/src/agent/10-domains.js +++ b/src/agent/10-domains.js @@ -38,6 +38,8 @@ const API_DOMAINS={ opsKey:{table:'OPSK',kind:'key'}, opsPopKind:{kind:'enum',values:()=>OPS_POP.slice()}, opsTplKey:{kind:'enum',values:()=>OPS_TPL.slice()}, + // The three POP standards (#315). + popTier:{kind:'enum',values:()=>POP_TIERS.slice()}, // The specialist's offers: a seat on a consortium cable, the charter, a vendor demo. seatPairs:{kind:'enum',values:()=>SEAT_N.slice()}, callAmount:{kind:'enum',values:()=>CALL_AMTS.slice()}, diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index de2324b..86d5437 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -239,6 +239,10 @@ const API_CMD={ /* ---------- customers ---------- */ accept:{args:[['id','entityId']], doc:'Sign a pending offer. Rejected without a POP in every city it needs, without free channels for a wave sale, or after an event\'s start date. Extra waves for a carrier you already serve grow that contract.'}, + acceptFix:{args:[['id','entityId'],['cost','integer',false]],watch:['pops','biz','offers'], + quote:a=>{const q=S?reqFix(S.offers.find(x=>x.id===a.id)):null;return q?{setup:q.cost,monthly:q.mo}:{setup:0};}, + pass:a=>({id:a.id,cost:a.cost??((reqFix(S.offers.find(x=>x.id===a.id))||{}).cost)}), + doc:'Buy what an offer asks for at POPs you already have (backup generator, a second router, a second site), then sign it. Pass the quoted setup as cost; the game checks it still matches.'}, decline:{args:[['id','entityId']], doc:'Throw an offer away.'}, salesHire:{args:[['id','salesPersona']], @@ -402,6 +406,22 @@ const API_CMD={ quote:a=>{const q=S?utilityKit(a.city):null;return q?{setup:q.cost,monthly:q.mo}:{};}, pass:a=>({city:a.city,cost:a.cost??((utilityKit(a.city)||{}).cost)}), doc:'Install the POP redundancy kit in one go: generator, second building, a second router, and the cache boxes balanced between sites. Pass the quoted setup as cost; the game checks it still matches. Nothing to do reads as no_effect.'}, + utilityKitAll:{args:[['cost','integer',false],['city','cityId',false]],watch:['pops','caches'], + quote:a=>{const q=S?utilityKitAll():null;return q?{setup:q.cost,monthly:q.mo}:{setup:0};}, + pass:a=>({city:a.city,cost:a.cost??((utilityKitAll()||{}).cost)}), + doc:'Install the redundancy kit at every POP still missing part of it, at one quoted price. From customer level 2. Pass the quoted setup as cost.'}, + utilityKitNew:{args:[['city','cityId',false]],watch:['ops'], + doc:'Put the redundancy kit in the intern\'s new-POP template, or take it out (the same switch as in the Ops sheet).'}, + ptSave:{args:[['city','cityId'],['k','popTier']],watch:['popTiers'], + doc:'Save a POP\'s routers (model and count) as one of three POP standards: micro, medium or hub. The POP is marked as that kind. From customer level 2.'}, + ptApply:{args:[['city','cityId'],['k','popTier'],['cost','integer',false]],watch:['pops.#city','popTiers'], + quote:a=>{const q=S?ptPlan(a.city,a.k):null;return q?{setup:q.cost,monthly:q.mo,blocked:q.why?[q.why]:[]}:{setup:0};}, + pass:a=>({city:a.city,k:a.k,cost:a.cost??((S&&ptPlan(a.city,a.k))||{cost:0}).cost}), + doc:'Mark a POP as one kind and bring its routers up to that standard: add routers, swap to the standard\'s model if it is bigger. Never a step down. Pass the quoted setup as cost.'}, + ptAll:{args:[['k','popTier'],['cost','integer',false],['city','cityId',false]],watch:['pops','popTiers'], + quote:a=>{const A=S?ptAll(a.k):null;return A?{setup:A.cost}:{setup:0};}, + pass:a=>({k:a.k,city:a.city,cost:a.cost??(ptAll(a.k)||{}).cost}), + doc:'Bring every POP marked as one kind up to that standard, at one quoted price. Pass the quoted setup as cost.'}, utilityCaches:{args:[['city','cityId'],['quote','string',false]],watch:['caches'], quote:a=>{const q=S?utilityCaches(a.city):null;return q?{key:q.key}:{};}, pass:a=>({city:a.city,quote:a.quote??((utilityCaches(a.city)||{}).key)}), @@ -530,6 +550,9 @@ const API_VIEW={ pniFilter:{args:[['f','pniFilter']],doc:'Filter the PNI list: all, via transit, worth it, already PNI.'}, pniGrp:{args:[['g','string'],['o','boolean',false]],doc:'Fold or unfold one group of the PNI list.'}, pniSort:{args:[],doc:'Flip the PNI list sort between A-Z and worth-it-first.'}, + netFind:{args:[['q','string']],doc:'Filter a POP\'s transit, exchange, PNI and cache lists by network name or AS number.'}, + netOnly:{args:[],doc:'Show only the networks you are connected to in a POP\'s lists, or all of them again.'}, + netClear:{args:[],doc:'Clear the network search and the connected-only switch.'}, puzzleMenu:{args:[],doc:'Open the puzzle list.'}, puzzleDoor:{args:[],doc:'From the title screen: open the puzzle list (keeps the typed name).'}, pzFinish:{args:[],doc:'Puzzles only: run the star count and show the results sheet.'}, diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index 83e7449..8ed02c5 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -62,6 +62,7 @@ const API_STATE_DOC={ core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'}, ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'}, popStd:{type:'map',doc:'The standard POP: router model and count new POPs start with, or null for none.'}, + popTiers:{type:'map',doc:'POP standards by kind: def.micro|medium|hub is {g: router model, rt: routers} or null; at maps a POP city to its kind.'}, demo:{type:'map',doc:'Vendor demo units on order, by "kind:id" → ready day.'}, seatOff:{type:'map',doc:'The pending consortium-cable seat offer: landings, km, name, expiry day.'}, monkey:{type:'map',doc:'The chaos monkey: next visit day, whether it is in your network now, days left, whether anyone noticed.'}, diff --git a/src/agent/60-dispatch.js b/src/agent/60-dispatch.js index 94957fd..4d403fb 100644 --- a/src/agent/60-dispatch.js +++ b/src/agent/60-dispatch.js @@ -19,7 +19,7 @@ function apiValidate(spec,args){ // maps, and the paths a command declares in watch. R is left out: it is rebuilt after every action. const API_FP_LEN=['links','transit','pni','caches','biz','offers','nni','loans','loanOffers','inc','scrubs']; const API_FP_KEYS=['pops','ixp','peers','myIx','done','ach','merged','confReg']; -const API_FP_JSON=['name','pairMet','rs','ixn','ixSite','ixPref','spares','te','cnLic','hw','scrubMode','ppol','ops','core','ddosAuto','popStd','demo','charter','monkey','seatOff','pz','ar','dk','ev']; +const API_FP_JSON=['name','pairMet','rs','ixn','ixSite','ixPref','spares','te','cnLic','hw','scrubMode','ppol','ops','core','ddosAuto','popStd','popTiers','demo','charter','monkey','seatOff','pz','ar','dk','ev']; function apiFp(watch,args){ if(!S)return null; const f={cash:S.cash,day:S.day,lvl:S.lvl||1,won:!!S.won,lost:!!S.lost}; diff --git a/src/game/60-features/39-req-fix.js b/src/game/60-features/39-req-fix.js new file mode 100644 index 0000000..41e9966 --- /dev/null +++ b/src/game/60-features/39-req-fix.js @@ -0,0 +1,20 @@ +/* ---------- Buy what a customer asks for, on signing (#241) ---------- + Some requirements are hardware at a POP you already have: a backup generator, a second router, a second building. + An offer that asks for them gets a second button that buys exactly what is missing and signs, with the price on it. + Never silent: the player presses it, and nothing is bought unless the deal can be signed right after. */ +const REQ_FIX=['gen','routers','metro']; +// What is missing for this offer, priced as the Infra tab's own buttons price it: [{k, city, cost, mo}], with totals. +function reqFix(o){if(!o||!bHas(o)||pzOn())return null;const items=[],cs=[o.city,o.city2].filter(Boolean); + for(const k of o.reqs||[]){if(!REQ_FIX.includes(k)||!REQS[k]||REQS[k].ok(o))continue; + for(const c of k==='routers'?[o.city]:cs){const p=S.pops[c];if(!p||items.some(x=>x.k===k&&x.city===c))continue; + if(k==='gen'&&!p.gen)items.push({k,city:c,cost:GEN_COST,mo:GEN_MO}); + else if(k==='metro'&&!p.site2)items.push({k,city:c,cost:SITE2_COST,mo:SITE2_MO}); + else if(k==='routers'&&(p.routers||1)<2){const g=p.rgen||0;items.push({k,city:c,cost:routerCost(g,p.routers||1),mo:routerMo(g)});}}} + if(!items.length)return null;return {items,cost:items.reduce((a,x)=>a+x.cost,0),mo:items.reduce((a,x)=>a+x.mo,0)};} +// Whether accept() would sign this offer now: the same checks, so money is never spent on a deal that then refuses. +const reqFixCanSign=o=>bHas(o)&&!(BIZ_T[o.type].event&&S.day>=o.start); +const REQ_FIX_L={gen:N_('req_fix.generator_in_city'),routers:N_('req_fix.second_router_in_city'),metro:N_('req_fix.second_site_in_city')}; +// The button and one line saying what it buys. sm: the button size the list around it uses. +function reqFixHtml(o){const q=reqFix(o);if(!q||!reqFixCanSign(o))return ''; + return `
${tr('req_fix.buys_list',{list:q.items.map(x=>tr(REQ_FIX_L[x.k],{city:CITY[x.city].name})).join(', '),cost:fmt$(q.cost),mo:fmt$(q.mo)})}
+
${btn(tr('req_fix.buy_and_sign',{cost:fmt$(q.cost)}),'acceptFix',{id:o.id,cost:q.cost},'pink sm',S.cash`;} diff --git a/src/game/60-features/80-new-game.js b/src/game/60-features/80-new-game.js index d21c562..03368f8 100644 --- a/src/game/60-features/80-new-game.js +++ b/src/game/60-features/80-new-game.js @@ -1,6 +1,6 @@ function newGame(name,home){ S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,cash:START_CASH, ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ops:opsNew(),slAuto:slAutoNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{}, - done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},vol:0,cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',cm:cmNew(),chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}}; + done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},vol:0,cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,popTiers:ptNew(),won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',cm:cmNew(),chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}}; } diff --git a/src/game/60-features/95-standing-orders.js b/src/game/60-features/95-standing-orders.js index 4071caa..21cb7cb 100644 --- a/src/game/60-features/95-standing-orders.js +++ b/src/game/60-features/95-standing-orders.js @@ -25,7 +25,10 @@ const OPS=[ {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=>v?tr('common.on'):tr('common.off')}}}, {k:'repair',i:'🔧',cap:50000,t:N_('ops.o_repair'),d:N_('ops.o_repair_d'),p:{}}, - {k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])}}}, + {k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])}, + // New fiber pulls traffic onto itself the day it is lit (#316): the player may want to light it by hand, when the + // ports behind it are ready. Off: fiber without a channel stays dark; lit fiber still gets more optics when hot. + fresh:{d:true,v:[true,false],l:N_('ops.p_fresh'),f:v=>v?tr('common.on'):tr('common.off')}}}, // Line systems up to a bigger one, and optics swapped for bigger ones, on fiber that is full and runs hot, or every fiber up to // a chosen line system. A line system swap is a day without that fiber: only where the traffic gets around it. {k:'optup',i:'🔭',cap:250000,t:N_('ops.o_optup'),d:N_('ops.o_optup_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'}, @@ -208,8 +211,8 @@ const OPS_RUN={ const lag=o.lag(),wantLag=o.n()<2&&o.rt>1,ups=wantLag&&lag?null:o.ups(),fit=ups&&(ups.find(u=>u.cap>=N*o.use)||ups.at(-1)),job=wantLag?lag||fit:fit||lag,was=o.sig(); if(!job||!X.can('ports',job.cost)||!X.pay('ports',()=>{job.go();return o.sig()!==was;})){KV.rv=null;KV.pu.clear();break;} KV.rv=null;KV.pu.clear();X.did('ports',o.at+' '+job.w);yield;}}, - *optics(X){const at=opsP('optics','at')/100,big=opsP('optics','pick')==='big',gpd=(o,l)=>optG(o,l)/optCost(o); - 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; + *optics(X){const at=opsP('optics','at')/100,big=opsP('optics','pick')==='big',fresh=opsP('optics','fresh'),gpd=(o,l)=>optG(o,l)/optCost(o); + for(const l of S.links){if(l.kind!=='df'||l.ready>S.day||l.eqDown>S.day||l.standby||l.cut>S.day||(!fresh&&!(l.ch||[]).length))continue; let cap=dfCap(l);const load=((R.load&&R.load[l.id])||0)*opsAhead(); // 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; diff --git a/src/game/60-features/96-pop-tiers.js b/src/game/60-features/96-pop-tiers.js new file mode 100644 index 0000000..f0af3a8 --- /dev/null +++ b/src/game/60-features/96-pop-tiers.js @@ -0,0 +1,49 @@ +/* ---------- POP standards: micro, medium, regional hub (#315) ---------- + Real networks build a few kinds of POP, not one: a small edge site, a medium one, a regional hub. The player saves a + POP's routers as one of three standards and marks POPs as that kind; a POP is brought up to its standard with one + button, and every POP of a kind with one more once the standard grows (a new model unlocked, more routers). Which POP + is which stays the player's choice, so growth stays selective. Never a step down: a POP with a bigger model keeps it. + The standard for brand-new POPs (#240, 96-pop-standard.js) is a separate thing. From customer level 2, like the intern. */ +const POP_TIERS=['micro','medium','hub']; +const POP_TIER_L={micro:N_('pop_tiers.micro'),medium:N_('pop_tiers.medium'),hub:N_('pop_tiers.hub')}; +const ptNew=()=>({def:{micro:null,medium:null,hub:null},at:{}}); +const ptOn=()=>!!S&&opsCanHire()&&!pzOn(); +const ptO=()=>S.popTiers||(S.popTiers=ptNew()); +// Saves are untrusted: known kinds, router models that exist, POPs that still exist. +function ptSanitize(s){const o=s.popTiers&&typeof s.popTiers==='object'&&!Array.isArray(s.popTiers)?s.popTiers:{},n=ptNew(),d=o.def&&typeof o.def==='object'?o.def:{},at=o.at&&typeof o.at==='object'&&!Array.isArray(o.at)?o.at:{}; + for(const k of POP_TIERS){const x=d[k];if(x&&typeof x==='object'&&Number.isInteger(x.g)&&RG[x.g])n.def[k]={g:x.g,rt:int(x.rt,1,RMAX,1)};} + for(const c of Object.keys(at))if(isCity(c)&&own(s.pops,c)&&POP_TIERS.includes(at[c]))n.at[c]=at[c]; + s.popTiers=n;} +// The clicks that bring a POP up to a standard, in order, priced as each click prices it: a second router first where a +// lone router carries traffic (so the swap is a rolling upgrade, not a maintenance window), the bigger model, the rest of +// the routers. null when the POP already meets it. why: what stops it today. +function ptPlan(c,k){const p=S.pops[c],d=S.popTiers&&S.popTiers.def[k];if(!p||!d)return null; + const g0=p.rgen||0,rt0=p.routers||1,up=d.g!==g0&&RG[d.g].cap>RG[g0].cap,steps=[];let rt=rt0,cost=0; + if(up&&rt===1&&d.rt>=2&&!popIdle(c)){cost+=routerCost(g0,1);steps.push('add');rt=2;} + if(up){cost+=Math.max(0,Math.round(RG[d.g].cost*rt*hwMul('rt')*techMul(RG[d.g].lvl))-tradeIn(g0,rt));steps.push('swap');} + const g=up?d.g:g0;while(rt(n-1)*ROUTER_MO+cageMo(n),why=up?(!techOk('rg',d.g,RG[d.g].lvl)?tr('pop_tiers.model_locked',{model:esc(RG[d.g].n),lv:RG[d.g].lvl}):modelFits(c,d.g)||(p.rupDay===S.day?tr('pop_tiers.swapped_today'):'')):''; + return {steps,cost,g:d.g,mo:mo(rt)+rt*RG[g].mo-mo(rt0)-rt0*RG[g0].mo,why};} +// Run the plan through the Infra tab's own actions, quietly. True when every click went through. +function ptRun(c,q){let ok=true;opsQuiet(()=>{for(const s of q.steps){const p=S.pops[c],rt=p.routers||1,g=p.rgen||0; + if(s==='add')ACT.addRouter({city:c});else ACT.upRouter({city:c,g:q.g});if((p.routers||1)===rt&&(p.rgen||0)===g){ok=false;break;}}});return ok;} +// The POPs of one kind, the busiest first, with their plans. +function ptAll(k){const at=S.popTiers?S.popTiers.at:{},cs=Object.keys(at).filter(c=>at[c]===k&&S.pops[c]).sort((a,b)=>(R.nodeLoad[b]||0)-(R.nodeLoad[a]||0)||a.localeCompare(b)); + const todo=[],stuck=[];for(const c of cs){const q=ptPlan(c,k);if(!q)continue;(q.why?stuck:todo).push({c,q});} + return {cs,todo,stuck,cost:todo.reduce((a,x)=>a+x.q.cost,0)};} +const ptName=k=>tr(POP_TIER_L[k]),ptDesc=d=>d?`${d.rt} × ${esc(RG[d.g].n)}`:tr('pop_tiers.not_set'); +// In a POP's router section: the three standards, what this POP is, and one button each. +function popTierHtml(c){if(!ptOn()||!S.pops[c])return '';const T=ptO(),p=S.pops[c],mine=T.at[c]; + return `
${tr('pop_tiers.title')}${mine?tr('pop_tiers.this_pop_is',{kind:ptName(mine)}):tr('pop_tiers.no_kind')}
+ ${POP_TIERS.map(k=>{const d=T.def[k],q=d?ptPlan(c,k):null,same=d&&d.g===(p.rgen||0)&&d.rt===(p.routers||1); + const main=!d?'':q?btn(tr('pop_tiers.apply_cost',{cost:fmt$(q.cost)}),'ptApply',{city:c,k,cost:q.cost},mine===k?'pink sm':'sm',!!q.why||S.cash✓ ${tr('pop_tiers.meets_it')}`; + return `
${ptName(k)} ${ptDesc(d)}
${q&&q.why?`
${esc(q.why)}
`:''} +
${main}${same?'':btn(tr('pop_tiers.save_here'),'ptSave',{city:c,k},'ghost sm')}
`;}).join('')} +

${tr('pop_tiers.note')}

`;} +// In Utilities: every kind with its POPs, and one button that brings them all up to their standard. +function popTierAllHtml(city){if(!ptOn())return '';const T=ptO();if(!POP_TIERS.some(k=>T.def[k]))return ''; + return `

${tr('pop_tiers.title')}

${tr('pop_tiers.bulk_note')}

+ ${POP_TIERS.filter(k=>T.def[k]).map(k=>{const A=ptAll(k);return `
${ptName(k)} ${ptDesc(T.def[k])}
+
${trn('pop_tiers.n_pops',A.cs.length)}${A.todo.length?' · '+trn('pop_tiers.n_below',A.todo.length):''}${A.stuck.length?' · '+trn('pop_tiers.n_stuck',A.stuck.length):''}
+ ${A.todo.length?`
${btn(trn('pop_tiers.bring_up_n',A.todo.length,{cost:fmt$(A.cost)}),'ptAll',{k,cost:A.cost,city},'pink sm',S.cash`:''}
`;}).join('')}
`;} diff --git a/src/game/70-rules/95-utilities.js b/src/game/70-rules/95-utilities.js index b007039..20cd483 100644 --- a/src/game/70-rules/95-utilities.js +++ b/src/game/70-rules/95-utilities.js @@ -40,6 +40,12 @@ function utilityKit(city){const p=S&&S.pops[city];if(!p)return null; const gen=!p.gen,site=!p.site2,router=(p.routers||1)<2,g=p.rgen||0; return {gen,site,router,moves:utilityCacheMoves(city),cost:(gen?GEN_COST:0)+(site?SITE2_COST:0)+(router?routerCost(g,1):0), mo:(gen?GEN_MO:0)+(site?SITE2_MO:0)+(router?routerMo(g):0)};} +// The kit at every POP that lacks part of it (#317): one quote, one button. From customer level 2, like the intern: early +// on, every generator is a choice about money. +const utilityKitAllOn=()=>!!S&&opsCanHire()&&!pzOn(); +function utilityKitAll(){if(!utilityKitAllOn())return null;const cities=[];let cost=0,mo=0,moves=0; + for(const c of Object.keys(S.pops)){const q=utilityKit(c);if(!q||(!q.cost&&!q.moves.length))continue;cities.push(c);cost+=q.cost;mo+=q.mo;moves+=q.moves.length;} + return {cities,cost,mo,moves};} function utilityPeers(){if(!S)return [];return Object.keys(S.ixp).filter(isIx).map(ix=>{ const sessions=ixSessions(ix),requests=[],blocked=[];let existing=0; for(const id of ixMembers(ix)){ diff --git a/src/game/80-simulation/50-sanitize.js b/src/game/80-simulation/50-sanitize.js index db35e34..ba08e0b 100644 --- a/src/game/80-simulation/50-sanitize.js +++ b/src/game/80-simulation/50-sanitize.js @@ -64,6 +64,8 @@ function sanitize(s){ // The backbone's technology: a save from before it with Auto-TE bought keeps the old rules on RSVP-TE (legacy). // The standard POP build (#240): a router model and how many. {const d=s.popStd;s.popStd=d&&typeof d==='object'&&Number.isInteger(d.g)&&RG[d.g]?{g:d.g,rt:int(d.rt,1,RMAX,1)}:null;} + // POP standards by kind (#315): micro, medium, regional hub, and which POP is which. + ptSanitize(s); {const c=s.core&&typeof s.core==='object'?s.core:null,lv=c?int(c.lv,0,4,0):(s.te?2:0);s.core={lv,run:c?int(c.run,0,lv,lv):lv};if(c?c.legacy===true:!!s.te)s.core.legacy=true;if(c&&c.lab===true)s.core.lab=true;if(c&&c.since!==undefined)s.core.since=num(c.since,0);} s.capDeal=s.capDeal&&typeof s.capDeal==='object'&&own(CAP_ROUTES,s.capDeal.c)?{at:num(s.capDeal.at,0),c:s.capDeal.c}:null; s.inc=s.inc.filter(i=>i&&typeof i.type==='string').map(i=>(i.type==='maxpfx'&&(i.type='ixloop'),i.id=sid(i.id),i.until=num(i.until,s.day),i.cost=num(i.cost,0),i.msg=String(i.msg||'').slice(0,400),i.fix=i.fix==null?undefined:String(i.fix).slice(0,60),i)); diff --git a/src/game/90-actions/46-net-filter.js b/src/game/90-actions/46-net-filter.js new file mode 100644 index 0000000..83e3ceb --- /dev/null +++ b/src/game/90-actions/46-net-filter.js @@ -0,0 +1,6 @@ +// Find a network at a POP (#199): view state only. +Object.assign(ACT,{ + netFind:({q})=>{UI.netQ=String(q??'').slice(0,40);listReset('pni');renderPanel();}, + netOnly:()=>{UI.netOnly=!UI.netOnly;listReset('pni');renderPanel();}, + netClear:()=>{UI.netQ='';UI.netOnly=false;listReset('pni');renderPanel();}, +}); diff --git a/src/game/90-actions/51-customer-fix.js b/src/game/90-actions/51-customer-fix.js new file mode 100644 index 0000000..2e58956 --- /dev/null +++ b/src/game/90-actions/51-customer-fix.js @@ -0,0 +1,10 @@ +Object.assign(ACT,{ + // Buy what the offer asks for, then sign (#241). cost: the price the button showed; a changed quote buys nothing. + acceptFix:({id,cost})=>{const o=S.offers.find(x=>x.id===id),q=reqFix(o);if(!o||!q||!reqFixCanSign(o))return; + if(q.cost!==+cost){toast(tr('utilities.quote_changed'),'bad');sfx('err');after();return;} + if(S.cash{for(const x of q.items){if(x.k==='gen')ACT.addGen({city:x.city});else if(x.k==='metro')ACT.addSite({city:x.city});else ACT.addRouter({city:x.city});}}); + toast(esc(tr('req_fix.bought',{list:q.items.map(x=>tr(REQ_FIX_L[x.k],{city:CITY[x.city].name})).join(', '),cost:fmt$(q.cost)})),'good'); + ACT.accept({id});}, +}); diff --git a/src/game/90-actions/60-links.js b/src/game/90-actions/60-links.js index 9848304..08e03c9 100644 --- a/src/game/90-actions/60-links.js +++ b/src/game/90-actions/60-links.js @@ -4,7 +4,10 @@ Object.assign(ACT,{ decomToggle:({city})=>{if(!S.pops[city])return;UI.decom=UI.decom||new Set();if(UI.decom.has(city))UI.decom.delete(city);else UI.decom.add(city);decomModal();}, decomGo:()=>{const sel=[...(UI.decom||[])].filter(c=>S.pops[c]);if(!sel.length||sel.length>=Object.keys(S.pops).length)return;closeModal();UI.decom=null;UI.sel=null;decommission(sel);sfx('alert');after();}, rmLink:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}{const l=S.links.find(x=>x.id===id),back=cabBack(l);if(back>0){S.cash+=back;toast(tr('links.name_is_called_off_the_cable',{name:esc(l.cname||tr('common.your_cable')),price:fmt$(back)}),'good');} - const n=chBack(l?[l]:[]);if(n)toast(trn('links.n_optic_back_on_the_spares_shelf',n),'good');}S.links=S.links.filter(l=>l.id!==id);prunePairMet();UI.sel=null;UI.confirm=null;after();}, + const n=chBack(l?[l]:[]);if(n)toast(trn('links.n_optic_back_on_the_spares_shelf',n),'good');}const l0=S.links.find(x=>x.id===id),sib=l0?pairLinks(l0.a,l0.b).filter(x=>x!==l0&&x.kind!=='vxc'):[];S.links=S.links.filter(l=>l.id!==id);prunePairMet(); + // One of several parallel links (#119): the panel moves on to the next one between the same cities, so a row of them + // can be handed back without opening the panel again each time. + UI.sel=sib.length?{type:'link',id:sib[0].id}:null;UI.confirm=null;after();}, // The chaos monkey takes a banana and goes home early (no bonus). mkBanana:()=>{if(!mkOn())return;if(!spend(mkBananaCost()))return;S.stats.bananas=(S.stats.bananas||0)+1;mkLeave('banana');track('monkey_banana');after();}, fixInc:({id})=>{const i=S.inc.find(x=>x.id===id);if(!i||!(i.cost>0))return; diff --git a/src/game/90-actions/85-pop-tiers.js b/src/game/90-actions/85-pop-tiers.js new file mode 100644 index 0000000..494f284 --- /dev/null +++ b/src/game/90-actions/85-pop-tiers.js @@ -0,0 +1,16 @@ +// POP standards (#315): save one, bring a POP up to one, bring every POP of a kind up to it. +Object.assign(ACT,{ + ptSave:({city,k})=>{const p=S.pops[city];if(!ptOn()||!p||!POP_TIERS.includes(k))return;const T=ptO();T.def[k]={g:p.rgen||0,rt:p.routers||1};T.at[city]=k; + toast(esc(tr('pop_tiers.saved',{kind:ptName(k),desc:`${T.def[k].rt} × ${RG[T.def[k].g].n}`})),'good');sfx('click');after();}, + // cost: the price on the button; a plan that changed under it buys nothing. A POP that already meets it is only marked. + ptApply:({city,k,cost})=>{if(!ptOn()||!S.pops[city]||!POP_TIERS.includes(k)||!ptO().def[k])return;const q=ptPlan(city,k); + if((q?q.cost:0)!==+cost){toast(tr('utilities.quote_changed'),'bad');sfx('err');after();return;} + if(q&&q.why){toast(esc(q.why),'bad');sfx('err');return;}if(q&&S.cash{if(!ptOn()||!POP_TIERS.includes(k))return;const A=ptAll(k);if(!A.todo.length)return; + if(A.cost!==+cost){utilitiesModal(city,tr('utilities.quote_changed'));return;} + if(S.cash[m.id,m.site]));for(const c of S.caches)if(moves.has(c.id))c.site=moves.get(c.id); after();const msg=tr('utilities.kit_applied',{city:CITY[city].name});if(modal)utilitiesModal(city,msg);else toast(esc(msg),'good');}, + // Every POP's kit in one go (#317), all or nothing on the quoted price, one redraw at the end. + utilityKitAll:({cost,city})=>{const q=utilityKitAll();if(!q||!q.cities.length)return; + if(q.cost!==+cost){utilitiesModal(city,tr('utilities.quote_changed'));return;} + if(S.cash{for(const c of q.cities){const k=utilityKit(c);if(!k||S.cash{if(!opsHired())return;S.ops.tpl.kit=!S.ops.tpl.kit;sfx('click');after();utilitiesModal(city);}, utilityCaches:({city,quote,modal})=>{const q=utilityCaches(city);if(!q||!q.add.length)return; if(q.key!==quote){if(modal)utilitiesModal(city,tr('utilities.quote_changed'));else{renderPanel();toast(tr('utilities.quote_changed'));}return;} if(!portGate(city,q.ports))return; diff --git a/src/game/93-ui/40-hud-and-panels.js b/src/game/93-ui/40-hud-and-panels.js index f05d9f8..db5c9c9 100644 --- a/src/game/93-ui/40-hud-and-panels.js +++ b/src/game/93-ui/40-hud-and-panels.js @@ -46,7 +46,7 @@ function renderLeft(){checkLayer(); {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)}`:''}
${o.refN?`
${tr('lifecycle.referred_by',{name:esc(o.refN)})}
`:''}${spotWhy(o)}${bRisk(o)}${reqList(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)}`:''}
${o.refN?`
${tr('lifecycle.referred_by',{name:esc(o.refN)})}
`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}${reqFixHtml(o)}
${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')}${pieNocBtn()}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'':''}`,'routingOpen',{},'')}
`; diff --git a/src/game/93-ui/50-city-panel.js b/src/game/93-ui/50-city-panel.js index 5a89d6a..9838389 100644 --- a/src/game/93-ui/50-city-panel.js +++ b/src/game/93-ui/50-city-panel.js @@ -40,10 +40,10 @@ function cityPanel(c){ for(const b of bz)h+=`
${esc(b.name)}
${esc(BIZ_T[b.type].l)}${b.city2?` ${CITY[b.city].name} ⇄ ${CITY[b.city2].name}`:''} · ${bTerms(b)}${clTermTxt(b)?' · '+clTermTxt(b):''}${BIZ_T[b.type].l2?` · ${b.sites?tr('city_panel.carrying_g_per_site',{g:fmtG(R.l2[b.id]||0)}):tr('city_panel.carrying_g',{g:fmtG(R.l2[b.id]||0)})}`:''}${BIZ_T[b.type].fiber&&!fiberOk(b)?' · '+tr('city_panel.fiber_is_down')+'':''}${BIZ_T[b.type].event&&eventLive(b)?` · ${tr('city_panel.serving_v',{v:pct(sfOf(R,b.city))})}`:''}${b.type==='scrub'&&!hasScrub()?' · '+tr('common.needs_a_scrubbing_center')+'':''}${S.day-(b.since||0)<15?` · ${tr('common.provisioning_n_d_grace',{n:15-(S.day-(b.since||0))})}`:''}
${bRisk(b)}${reqList(b)}${BIZ_T[b.type].l2?routeCtl(b):''}${pathCtl(b)}
${tr('common.happiness_p',{p:Math.round(b.mood)})}
${btn(UI.confirm===b.id?tr('common.really_drop'):tr('common.drop'),'dropBiz',{id:b.id},'ghost sm')}
`; h+=`
`+offersHere(c); }else if(UI.tab==='up'){ - h+=portNote(c)+latNote(c); + h+=netFilterHtml()+portNote(c)+latNote(c); h+=`

${tr('common.ip_transit')}

${tr('city_panel.pay_a_bigger_network_per_gbps')}

`; - const prov=NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>a.price-b.price); - if(!prov.length)h+=`

${tr('city_panel.nobody_sells_transit_here_haul_your')}

`; + const prov0=NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>a.price-b.price),prov=prov0.filter(n=>netKeep(n,S.transit.some(x=>x.city===c&&x.net===n.id))); + if(!prov0.length)h+=`

${tr('city_panel.nobody_sells_transit_here_haul_your')}

`;else if(!prov.length)h+=netNone(); for(const n of prov){const t=S.transit.find(x=>x.city===c&&x.net===n.id);const pr=transitPerG(n,c,premOnlyAt(n,c)||!!(t&&premOn(t)))*S.priceMul; h+=`
${logo(n)}
${esc(n.name)} ${TYPE_L[n.type]}
${tr('city_panel.price_per_gbps_month_billed_on',{price:pr.toFixed(2)})}
${premOnlyAt(n,c)&&!t?`
${tr('city_panel.only_the_cn_too_premium_crossing')}
`:''}`; if(t){const u=R.useT[t.id]||0,cap=lagCap(PORT[t.tier].g,t.n),tdown=t.down>S.day; @@ -53,12 +53,12 @@ function cityPanel(c){ h+=`
`;} h+=`
`; }else if(UI.tab==='peer'){ - h+=portNote(c); + h+=netFilterHtml()+portNote(c); h+=ixSection(c); h+=`

${tr('city_panel.private_interconnects_pni')}

${tr('city_panel.a_dedicated_cross_connect_to_one',{dc:esc(siteName(c,'a'))})}

`; h+=pniListHtml(c); h+=`

${tr('common.embedded_caches')}

${tr('city_panel.cdns_put_free_cache_servers_inside')}

`; - for(const n of NETS.filter(n=>n.cache)){const have=S.caches.filter(x=>x.city===c&&x.net===n.id),dem=R.demTo[n.id]||0,ok=dem>=n.cache.min; + for(const n of NETS.filter(n=>n.cache&&netKeep(n,S.caches.some(x=>x.city===c&&x.net===n.id)))){const have=S.caches.filter(x=>x.city===c&&x.net===n.id),dem=R.demTo[n.id]||0,ok=dem>=n.cache.min; h+=`
${logo(n)}
${esc(n.cache.name)}
${tr('common.from_net',{net:esc(n.name)})} · ${have.length?`${trn('common.n_box',have.length)} · ${tr('city_panel.serving_v',{v:fmtG(have.reduce((a,x)=>a+(R.useCache[x.id]||0),0))})}`:tr('city_panel.100g_per_box')}
${!ok?`
${tr('city_panel.needs_min_gbps_of_traffic_to',{min:n.cache.min,net:esc(n.name),now:dem.toFixed(1)})}
`:''}
${have.length?btn(tr('common.remove'),'rmCache',{id:(have.find(x=>x.site==='b')||have[0]).id},'ghost sm'):''}${btn(have.length?tr('common.box'):tr('common.request'),'cache',{city:c,net:n.id},'sm',!ok)}
${S.pops[c].site2&&have.length?(()=>{const nb=have.filter(x=>x.site==='b').length,na=have.length-nb;return `
${tr('city_panel.boxes_a_in_a_b_in',{a:na,b:nb})}${na?btn(tr('city_panel.move_one_to_b'),'cacheSite',{city:c,net:n.id,s:'b'},'ghost sm'):''}${nb?btn(tr('city_panel.move_one_to_a'),'cacheSite',{city:c,net:n.id,s:'a'},'ghost sm'):''}
`;})():''}`;} h+=`
`; @@ -75,7 +75,7 @@ function cityPanel(c){ ${nl>=nc*0.95?`

${tr('city_panel.maxed_out_traffic_here_is_being')}

`:''}
${N?(!techOk('rg',Ni,N.lvl)?demoBtn('rg',Ni,N.lvl,tr('city_panel.model_level_lv',{model:esc(N.n),lv:N.lvl}),'pink'):btn(tr('city_panel.upgrade_to_model_cost_mo_mo',{model:esc(N.n),cost:fmt$(swapCost(c,Ni)),mo:fmt$(N.mo*rt)}),'upRouter',{city:c,g:Ni},'pink',S.cash=RCAGE?CAGE_MO:0))}),'addRouter',{city:c},'',S.cash1?btn(tr('common.remove_one'),'rmRouter',{city:c},'ghost sm'):''}
${rt>=RCAGE&&rt${tr('city_panel.the_standard_cage_holds_n_routers',{n:RCAGE,mo:fmt$(CAGE_MO)})}

`:''}${rt>=RMAX?`

${tr('city_panel.this_pop_has_the_most_routers',{n:RMAX})}

`:''}${rt>RCAGE?`
${tr('city_panel.cage_extension')}${fmt$(cageMo(rt))}/mo
`:''} - ${popStdHtml(c)} + ${popStdHtml(c)}${popTierHtml(c)} ${UI.models?routerModels(c):''} ${N||UI.models?`

${(p.rgen||0)>0?tr('city_panel.prices_include_p_back_for_the',{p:fmt$(tradeIn(p.rgen||0,rt))})+' ':''}${p.rupDay===S.day?tr('city_panel.new_routers_went_in_today_the')+' ':''}${rt>1?tr('city_panel.rolling_upgrade_one_router_at_a'):tr('city_panel.with_one_router_the_upgrade_needs')}

`:''}

${rt>=2?tr('city_panel.a_crash_here_only_costs_one'):tr('city_panel.one_router_is_a_single_point')}

diff --git a/src/game/93-ui/51-net-filter.js b/src/game/93-ui/51-net-filter.js new file mode 100644 index 0000000..69ba979 --- /dev/null +++ b/src/game/93-ui/51-net-filter.js @@ -0,0 +1,14 @@ +/* ---------- Find a network at a POP (#199) ---------- + The Transit and Peering tabs list every network that sells or peers there: dozens in a big city. One search box and a + "connected only" switch filter all of them (transit, exchange members, PNIs, caches). View state only, never saved; + it stays while you hop between POPs, and a Clear button says it is on. */ +const netQ=()=>(UI.netQ||'').trim().toLowerCase(); +const netFiltered=()=>!!netQ()||!!UI.netOnly; +// on: connected to that network in this list (a transit port, a session, a PNI, a cache box). A number finds an AS. +function netKeep(n,on){const q=netQ();if(q&&!n.name.toLowerCase().includes(q)&&!(n.asn&&String(n.asn).startsWith(q)))return false;return !UI.netOnly||!!on;} +function netFilterHtml(){return `
+
${btn(tr('net_filter.connected_only'),'netOnly',{},UI.netOnly?'green sm':'ghost sm')}${netFiltered()?btn(tr('net_filter.clear'),'netClear',{},'ghost sm'):''}
`;} +const netNone=()=>`

${tr('pni_list.nothing_matches')}

`; +// Typing redraws the panel. The morph swaps an input whose value changed, so the new box gets the focus and the caret back. +document.addEventListener('input',e=>{if(e.target.id!=='netQ'||!S)return;const at=e.target.selectionStart;ACT.netFind({q:e.target.value}); + const n=$('netQ');if(n&&n!==e.target){n.focus();try{n.setSelectionRange(at,at);}catch(err){}}}); diff --git a/src/game/93-ui/52-pni-list.js b/src/game/93-ui/52-pni-list.js index 40f85f1..bc26076 100644 --- a/src/game/93-ui/52-pni-list.js +++ b/src/game/93-ui/52-pni-list.js @@ -15,7 +15,8 @@ function pniRow(c,n,pn,v,chk){let h=`
${logo(n)}
${pniG1(n.id)?btn(tr('city_panel.port_cost_mo_mo',{port:'1G',cost:fmt$(PNI_G1_COST),mo:fmt$(Math.round(PORT[0].pni/2))}),'pni',{city:c,net:n.id,tier:-1},'sm',S.cashportShown(i)&&i>=pniMin(n.id)?btn(tr('city_panel.port_cost_mo_mo',{port:P2.n,cost:fmt$(1500+P2.setup/2),mo:fmt$(P2.pni)}),'pni',{city:c,net:n.id,tier:i},'sm',S.cash<1500+P2.setup/2||!portOk(c,i)):'').join('')}
${pniEta(n.id)}${pniMin(n.id)?' · '+tr('city_panel.no_10g_net_starts_at_100g',{net:esc(n.name)}):pniG1(n.id)?' · '+tr('city_panel.sells_pnis_down_to_1g'):''}
${chk.fee?`
${tr('city_panel.paid_peering_price_mo_on_top',{price:fmt$(chk.fee)})}
`:''}`:`
${esc(chk.why)}
`;} return h+`
`;} function pniListHtml(c){const f=UI.pniF||'all',az=UI.pniSort==='az',open=UI.pniOpen||{}; - const rows=NETS.filter(n=>n.pops.includes(c)).map(n=>{const pn=S.pni.find(x=>x.city===c&&x.net===n.id)||null;const chk=pn?null:peerOk(n.id,'pni',c),v=pn?null:pniVal(n.id,c);return {n,pn,v,chk,s:pniStat(n.id,c).k,go:!!pn||(chk.ok&&v.g>=1)};}); + // The search (#199) first: a network it hides needs no value worked out. + const rows=NETS.filter(n=>n.pops.includes(c)).map(n=>[n,S.pni.find(x=>x.city===c&&x.net===n.id)||null]).filter(([n,pn])=>netKeep(n,pn)).map(([n,pn])=>{const chk=pn?null:peerOk(n.id,'pni',c),v=pn?null:pniVal(n.id,c);return {n,pn,v,chk,s:pniStat(n.id,c).k,go:!!pn||(chk.ok&&v.g>=1)};}); const keep=r=>f==='all'||(f==='t'&&(r.s==='t'||r.s==='none'))||(f==='worth'&&r.v&&r.v.worth)||(f==='pni'&&(r.s==='here'||r.s==='else')); const val=r=>r.v?r.v.val:-Infinity; rows.sort((a,b)=>az?a.n.name.localeCompare(b.n.name):(b.v&&b.v.worth)-(a.v&&a.v.worth)||val(b)-val(a)||a.n.name.localeCompare(b.n.name)); @@ -23,7 +24,7 @@ function pniListHtml(c){const f=UI.pniF||'all',az=UI.pniSort==='az',open=UI.pniO const shown=rows.filter(keep);if(!shown.length)return h+`

${tr('pni_list.nothing_matches')}

`; let left=listN('pni'),tot=0; for(const g of PNI_GRP){const gr=shown.filter(r=>pniGrpOf(r.n)===g);if(!gr.length)continue; - const w=gr.filter(r=>r.v&&r.v.worth).length,act=w||gr.some(r=>r.go),isOpen=f!=='all'||(open[g]??act); + const w=gr.filter(r=>r.v&&r.v.worth).length,act=w||gr.some(r=>r.go),isOpen=f!=='all'||netFiltered()||(open[g]??act); h+=`
${btn(`${isOpen?'▾':'▸'} ${esc(pniGrpL(g))} ${trn('pni_list.n_networks_w_worth_it',gr.length,{w})}`,'pniGrp',{g,o:isOpen?0:1},'ghost sm')}
`; if(!isOpen)continue;tot+=gr.length; for(const r of gr){if(left--<=0)break;h+=pniRow(c,r.n,r.pn,r.v,r.chk);}} diff --git a/src/game/93-ui/55-utilities.js b/src/game/93-ui/55-utilities.js index f32be67..9b56fda 100644 --- a/src/game/93-ui/55-utilities.js +++ b/src/game/93-ui/55-utilities.js @@ -26,5 +26,13 @@ function utilitiesModal(city,message){if(!S)return;const cities=Object.keys(S.po ${ppol()!=='open'?`

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

${btn(tr('common.peering_policy'),'leftTab',{t:'nets'},'ghost sm')}`:''} ${rows.map(r=>`
${esc(ixName(r.ix))} · ${tr('utilities.peer_counts',{ready:r.requests.length,existing:r.existing,blocked:r.blocked.length})} ${r.blocked.map(b=>`

${esc(NET[b.id].name)}: ${esc(b.why)}

`).join('')}
`).join('')}
+ ${utilityKitAllHtml(city)}${popTierAllHtml(city)} ${cities.length?`
${btn(tr('utilities.view_pop'),'utilityPick',{},'sm')}
${utilityKitHtml(city,true)}`:''}`); } +// The kit everywhere (#317), and where new POPs get it: the intern's template, which the intern clicks through. +function utilityKitAllHtml(city){const q=utilityKitAll();if(!q)return '';const tpl=opsHired()&&S.ops.tpl.kit; + return `

${tr('utilities.kit_everywhere')}

${tr('utilities.kit_everywhere_note')}

+ ${q.cities.length?`

${trn('utilities.kit_all_quote',q.cities.length,{cost:fmt$(q.cost),mo:fmt$(q.mo)})}${q.moves?' · '+tr('utilities.cache_moves',{n:q.moves}):''}

+
${btn(trn('utilities.kit_all_apply',q.cities.length,{cost:fmt$(q.cost)}),'utilityKitAll',{cost:q.cost,city},'pink',S.cash`:`

${tr('utilities.kit_all_done')}

`} +

${opsHired()?(tpl?tr('utilities.kit_new_pops_on',{name:opsName()}):tr('utilities.kit_new_pops_off',{name:opsName()})):tr('utilities.kit_new_pops_hire')}

+ ${opsHired()?`
${btn(tpl?tr('utilities.kit_new_pops_stop'):tr('utilities.kit_new_pops_start'),'utilityKitNew',{city},tpl?'ghost sm':'sm')}
`:''}
`;} diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 39c6541..1af0d5f 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -16,7 +16,8 @@ function ixBlock(c,multi){const city=ixCity(c),C=CITY[city],ix=ixName(c),X=XIXM[ else h+=`
${PORT.map((P2,i)=>i>S.ixp[c]&&portShown(i)?btn(tr('common.upgrade_port_price',{port:P2.n,price:portMo(ixPortMo(c,i)*((S.ixn||{})[c]||1))}),'buyIx',{city:c,tier:i},'sm',(!!S.pops[city]&&!portOk(city,i))||(!S.pops[city]&&i>1)):'').join('')}${S.pops[city]&&((S.ixn||{})[c]||1)1?btn(tr('common.member'),'lagIx',{city:c,d:-1},'ghost sm'):''}${S.ixp[c]>0?btn(tr('link_panels.downgrade_port_price',{port:PORT[S.ixp[c]-1].n,price:portMo(ixPortMo(c,S.ixp[c]-1)*((S.ixn||{})[c]||1))}),'downIx',{city:c},'ghost sm'):''}${btn(S.rs[c]?tr('link_panels.leave_route_server'):tr('link_panels.join_route_server'),'rs',{city:c},S.rs[c]?'ghost sm':'pink sm')}${S.rs[c]&&ppol()!=='open'?`${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}`:''}${btn(UI.confirm==='ix'+c?tr('common.really_leave'):tr('common.leave_ix'),'cancelIx',{city:c},'ghost sm')}
`; h+=`
`; {const elig=mine?[]:ixMembers(c).filter(id=>!set.has(id)&&peerOk(id,'ix',c).ok);if(elig.length>1)h+=`
${btn(tr('link_panels.request_all_n_willing_peers',{n:elig.length}),'peerAll',{city:c},'pink sm')}
`;} - for(const id of ixMembers(c).sort((a,b)=>NSH[b]-NSH[a])){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c); + {const ms=ixMembers(c),shown=ms.filter(id=>netKeep(NET[id],set.has(id)));if(ms.length&&!shown.length)h+=netNone();} + for(const id of ixMembers(c).filter(id=>netKeep(NET[id],set.has(id))).sort((a,b)=>NSH[b]-NSH[a])){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c); h+=`
${logo(n)}
${esc(n.name)}
${TYPE_L[n.type]} ${n.pol} · ${(NSH[id]*100).toFixed(NSH[id]<0.01?1:0)}%${n.tail?' '+tr('common.tiny')+'':''}
${!on&&!chk.ok?`
${esc(chk.why)}
`:''}
${on?(viaRs||mine?`${mine?tr('common.member_fef5'):tr('common.via_rs')}`:btn(tr('common.peered_ce2f'),'unpeer',{city:c,net:id},'green sm',false,tr('link_panels.click_to_tear_down'))):btn(tr('common.request'),'peer',{city:c,net:id},'sm',!chk.ok)}
`;} h+=`
`;} @@ -142,7 +143,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})}
${spotWhy(o)}${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('')}
`; + 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})}
${spotWhy(o)}${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)}${reqFixHtml(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/i18n/en.js b/src/i18n/en.js index bb7bbc3..aaaf94c 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3160,6 +3160,9 @@ "modal_and_names.the_real_thing_follow_a_packet":"The real thing: follow a packet from Wi-Fi to undersea fiber.", "modals.lay_your_own_subsea_cable":"Lay your own subsea cable…", "modals.your_own_subsea_cable_level_n":"Your own subsea cable level {n} or Tier 1", +"net_filter.clear":"Clear", +"net_filter.connected_only":"Connected only", +"net_filter.find_a_network":"Find a network or AS number", "networks.a_mobile_network_named_after_the":"A mobile network named after the sound of a toast. Cheers to every 5G tower.", "networks.a_spanish_carrier_starring_in_every":"A Spanish carrier starring in every Latin American market, at least until it sells the next one.", "networks.a_tiny_telco_in_a_country":"A tiny telco in a country where the world’s cables come ashore. Prices to match.", @@ -3395,6 +3398,7 @@ "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", "ops.p_at":"Above", +"ops.p_fresh":"Light new fiber", "ops.p_g":"From", "ops.p_how":"How", "ops.p_keep":"Keep one spare", @@ -3926,6 +3930,29 @@ "pop_std.none":"None", "pop_std.not_all_of_the_standard":"Not enough cash or level for the whole standard in {city}: it got what fit.", "pop_std.standard_for_new_pops":"Standard for new POPs", +"pop_tiers.apply_cost":"Bring it up {cost}", +"pop_tiers.bring_up_n":{"one":"Bring {n} POP up {cost}","other":"Bring {n} POPs up {cost}"}, +"pop_tiers.bulk_done":{"one":"{kind}: {n} POP brought up to the standard.","other":"{kind}: {n} POPs brought up to the standard."}, +"pop_tiers.bulk_note":"Every POP you marked as a kind, brought up to its standard in one go. Change a standard (a new model, more routers) and press again.", +"pop_tiers.city_is_kind":"{city} meets the {kind} standard.", +"pop_tiers.hub":"Regional hub", +"pop_tiers.mark":"Mark it", +"pop_tiers.medium":"Medium POP", +"pop_tiers.meets_it":"Meets it", +"pop_tiers.micro":"Micro POP", +"pop_tiers.model_locked":"{model} unlocks at customer level {lv}.", +"pop_tiers.n_below":{"one":"{n} below the standard","other":"{n} below the standard"}, +"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"}, +"pop_tiers.n_stuck":{"one":"{n} can't take it yet","other":"{n} can't take it yet"}, +"pop_tiers.no_kind":"No kind yet", +"pop_tiers.not_all":"Not all of the standard went in at {city}. Check the Infra tab.", +"pop_tiers.not_set":"not set yet", +"pop_tiers.note":"Save a POP's routers as a standard, then mark other POPs as that kind. Bringing a POP up adds routers and swaps to the bigger model, never a step down. Utilities brings every POP of a kind up at once.", +"pop_tiers.save_here":"Save these routers", +"pop_tiers.saved":"{kind} is now {desc}.", +"pop_tiers.swapped_today":"The routers here were swapped today. Try again tomorrow.", +"pop_tiers.this_pop_is":"This POP: {kind}", +"pop_tiers.title":"POP standards", "pops_transit_ix.40_off_for_6_months":"40% off for 6 months", "pops_transit_ix.40_off_ix_for_6_months":"40% off {ix} for 6 months.
Your account manager is relieved. Read the small print later.", "pops_transit_ix.after_consulting_with_management_the":"\"After consulting with management…\"
The price went up. Management was consulted.", @@ -4193,6 +4220,12 @@ "release_notes.read_the_full_notes_on_github":"Read the full notes on GitHub", "release_notes.series_of_tubes_v_is_out":"Series of Tubes {v} is out!", "release_notes.your_game_is_saved_automatically":"Your game is saved automatically.", +"req_fix.bought":"Bought {list} for {cost}.", +"req_fix.buy_and_sign":"Buy it and sign {cost}", +"req_fix.buys_list":"Missing: {list}. {cost} + {mo}/mo.", +"req_fix.generator_in_city":"a backup generator in {city}", +"req_fix.second_router_in_city":"a second router in {city}", +"req_fix.second_site_in_city":"a second site in {city}", "requirements.a_spare_fiber_pair_in_your":"a spare fiber pair in your {a}–{b} trench", "requirements.afraid_of_sharks_needs_a_path":"Afraid of sharks: needs a path with no subsea cable", "requirements.backup_generator_in_every_city_they":"Backup generator in every city they touch", @@ -4827,9 +4860,20 @@ "utilities.caches_requested":"Installed {n} cache boxes in {city}.", "utilities.ix_peering":"Network-wide IX peering", "utilities.join_route_servers":"Join all route servers ({n})", +"utilities.kit_all_applied":{"one":"Redundancy kit installed at {n} POP.","other":"Redundancy kit installed at {n} POPs."}, +"utilities.kit_all_apply":{"one":"Kit {n} POP {cost}","other":"Kit all {n} POPs {cost}"}, +"utilities.kit_all_done":"Every POP has the full kit.", +"utilities.kit_all_quote":{"one":"{n} POP needs it · {cost} + {mo}/mo","other":"{n} POPs need it · {cost} + {mo}/mo"}, "utilities.kit_applied":"Redundancy updated in {city}.", "utilities.kit_balanced":"Hardware installed and caches balanced.", "utilities.kit_cost":"One-off: {cost} · Additional monthly cost: {mo}", +"utilities.kit_everywhere":"Redundancy kit everywhere", +"utilities.kit_everywhere_note":"The kit at every POP still missing part of it: generator, second building, second router, caches balanced between sites. One price for all of them.", +"utilities.kit_new_pops_hire":"Hire a NOC intern to open new POPs from a template with the kit already in.", +"utilities.kit_new_pops_off":"New POPs opened from {name}'s template come without the kit.", +"utilities.kit_new_pops_on":"New POPs opened from {name}'s template get the kit too.", +"utilities.kit_new_pops_start":"Put the kit in the template", +"utilities.kit_new_pops_stop":"Leave it out of the template", "utilities.peer_counts":"{ready} eligible · {existing} existing · {blocked} unavailable", "utilities.peering_note":"Request eligible peers at every IX you have joined. Existing sessions, including route-server peers, are skipped. Refusals and traffic thresholds still apply. No ports or paid PNIs are purchased.", "utilities.peers_requested":"Established {n} new IX peering sessions.", diff --git a/src/styles/36-net-filter.css b/src/styles/36-net-filter.css new file mode 100644 index 0000000..2bae154 --- /dev/null +++ b/src/styles/36-net-filter.css @@ -0,0 +1,5 @@ +/* Find a network at a POP (#199) and the POP standards rows (#315). */ +.netf{display:flex;flex-direction:column;gap:6px;margin:0 0 10px} +.netf input.t{font-size:16px;padding:6px 10px;min-height:44px} +.netf .btns{margin:0} +.ptier .row .btns{margin-top:4px} diff --git a/tests/bulk-actions.test.js b/tests/bulk-actions.test.js new file mode 100644 index 0000000..ad5c58c --- /dev/null +++ b/tests/bulk-actions.test.js @@ -0,0 +1,226 @@ +// Late-game busywork: one policy or one button instead of many clicks, never a decision taken away. +// #316 the intern can leave new fiber dark, #119 the link panel stays open on a sibling, #317 the kit at every POP, +// #241 buy what a customer needs on signing, #315 POP standards by kind, #199 find a network at a POP. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); +const { lit } = require('../scripts/lib/js-literal'); + +function setup(t, extra = '') { + const h = load(); + t.after(() => h.dom.window.close()); + h.ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.nextFail=S.nextEvent=1e9;UI.speed=0;compute();" + extra); + return h; +} +const doc = h => h.dom.window.document; +const text = (h, sel) => [...doc(h).querySelectorAll(sel)].map(e => e.textContent).join('\n'); +const reload = ev => ev("save();S=migrate(JSON.parse(slotRaw(UI.slot)));compute()"); + +/* ---------- #316: new fiber stays dark when the player says so ---------- */ +const FIBER = "S.lvl=4;S.rules=makeRules('freeze');ACT.launchBB({city:'fra'});S.pops.fra.rgen=2;ACT.buildPop({city:'ams'});S.pops.ams.rgen=2;compute();" + + "ACT.opsHire({id:'kevin'});S.ops.floor=0;closeModal();" + + "S.links.push({id:'f',a:'fra',b:'ams',kind:'df',sys:'roadm',ch:[],km:450,sub:false,ready:0,cut:0,mo:1,trench:'f'});compute();S.ops.on.optics=true;"; +const ch = ev => JSON.parse(ev("JSON.stringify(S.links.find(l=>l.id==='f').ch)")); + +test('#316 by default the intern still lights new fiber, also in a save from before the switch', t => { + const { ev, errors } = setup(t, FIBER); + assert.equal(ev("opsP('optics','fresh')"), true); + ev("S.ops.p.optics={}"); + reload(ev); + assert.equal(ev("opsP('optics','fresh')"), true, 'an old save has no setting: the old behaviour'); + ev('opsDay(S.day)'); + assert.ok(ch(ev).length > 0); + assert.deepEqual(errors, []); +}); + +test('#316 told not to, the intern leaves new fiber dark but still grows hot lit fiber', t => { + const { ev, errors } = setup(t, FIBER); + ev("ACT.opsOpen();ACT.opsParam({k:'optics',p:'fresh',v:1})"); + assert.equal(ev("opsP('optics','fresh')"), false); + ev('opsDay(S.day)'); + assert.deepEqual(ch(ev), [], 'dark fiber stays dark'); + ev("S.links.find(l=>l.id==='f').ch=['zr8'];compute();R.load.f=dfCap(S.links.find(l=>l.id==='f'))*0.95;opsDay(S.day)"); + assert.ok(ch(ev).length > 1, 'a lit, hot fiber still gets more optics'); + reload(ev); + assert.equal(ev("opsP('optics','fresh')"), false, 'the switch survives a reload'); + ev("S.ops.p.optics.fresh='maybe';S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev("opsP('optics','fresh')"), true, 'a bad value is repaired to the default'); + assert.deepEqual(errors, []); +}); + +test('#316 the switch is in the Ops sheet', t => { + const h = setup(t, FIBER); + h.ev('ACT.opsOpen()'); + assert.match(h.ev("document.getElementById('modalCard').textContent"), /Light new fiber/); + assert.deepEqual(h.errors, []); +}); + +/* ---------- #119: decommissioning one of several waves keeps the panel open ---------- */ +test('#119 the link panel moves on to the next parallel link, and closes after the last', t => { + const h = setup(t, "ACT.buildPop({city:'ams'});" + + "for(const id of ['w1','w2','w3'])S.links.push({id,a:'fra',b:'ams',kind:'wave',tier:0,km:450,sub:false,cut:0,mo:1000});compute();UI.sel={type:'link',id:'w1'};renderAll()"); + const { ev, errors } = h; + ev("ACT.rmLink({id:'w1'});ACT.rmLink({id:'w1'})"); + assert.equal(ev("S.links.some(l=>l.id==='w1')"), false); + assert.equal(ev('JSON.stringify(UI.sel)'), JSON.stringify({ type: 'link', id: 'w2' })); + assert.equal(ev("document.getElementById('panel').hidden"), false, 'the panel is still open'); + ev("ACT.rmLink({id:'w2'});ACT.rmLink({id:'w2'})"); + assert.equal(ev('UI.sel.id'), 'w3'); + ev("ACT.rmLink({id:'w3'});ACT.rmLink({id:'w3'})"); + assert.equal(ev('UI.sel'), null, 'the last link closes it'); + assert.deepEqual(errors, []); +}); + +/* ---------- #317: the redundancy kit at every POP ---------- */ +const POPS = "for(const c of ['ams','lon','par'])ACT.buildPop({city:c});compute();"; +test('#317 one button kits every POP, at the sum of the per-POP quotes', t => { + const { ev, errors } = setup(t, POPS + 'S.lvl=2;'); + const q = JSON.parse(ev('JSON.stringify(utilityKitAll())')); + assert.equal(q.cities.length, 4); + assert.equal(q.cost, ev("Object.keys(S.pops).reduce((a,c)=>a+utilityKit(c).cost,0)")); + ev("ACT.utilities({})"); + assert.match(ev("document.getElementById('modalCard').textContent"), /Kit all 4 POPs/); + const cash = ev('S.cash'); + ev(`ACT.utilityKitAll({cost:${q.cost + 1}})`); + assert.equal(ev('S.cash'), cash, 'a stale quote buys nothing'); + assert.match(ev("document.getElementById('modalCard').textContent"), /quote changed/); + ev(`ACT.utilityKitAll({cost:${q.cost}})`); + assert.equal(ev('S.cash'), cash - q.cost); + assert.equal(ev("Object.values(S.pops).every(p=>p.gen&&p.site2&&p.routers>=2)"), true); + assert.match(ev("document.getElementById('modalCard').textContent"), /Every POP has the full kit/); + assert.deepEqual(errors, []); +}); + +test('#317 needs level 2, never spends what is not there, and can put the kit in the intern\'s template', t => { + const { ev, errors } = setup(t, POPS); + ev('S.lvl=1;ACT.utilities({})'); + assert.equal(ev('utilityKitAll()'), null); + assert.doesNotMatch(ev("document.getElementById('modalCard').textContent"), /Redundancy kit everywhere/); + ev('S.lvl=2;window.q=utilityKitAll().cost;S.cash=q-1;ACT.utilityKitAll({cost:q})'); + assert.equal(ev('S.cash'), ev('q-1')); + assert.equal(ev("Object.values(S.pops).some(p=>p.gen)"), false); + ev("S.cash=1e8;ACT.opsHire({id:'annie'});closeModal();S.ops.tpl.kit=false;ACT.utilities({})"); + assert.match(ev("document.getElementById('modalCard').textContent"), /come without the kit/); + ev('ACT.utilityKitNew({})'); + assert.equal(ev('S.ops.tpl.kit'), true); + assert.match(ev("document.getElementById('modalCard').textContent"), /get the kit too/); + assert.deepEqual(errors, []); +}); + +/* ---------- #241: buy what the customer asks for, on signing ---------- */ +const OFFER = (reqs, extra = {}) => `ACT.buildPop({city:'ams'});S.offers.push(${lit({ id: 'o1', city: 'fra', city2: 'ams', name: 'Needy Corp', type: 'l2vpn', bw: 1, rate: 900, reqs, exp: 30, ...extra })});compute();`; +test('#241 the offer shows what is missing with its price, and one button buys it and signs', t => { + const h = setup(t, OFFER(['gen', 'routers'])); + const { ev, errors } = h; + const q = JSON.parse(ev("JSON.stringify(reqFix(S.offers[0]))")); + assert.deepEqual(q.items.map(x => x.k + '@' + x.city), ['gen@fra', 'gen@ams', 'routers@fra']); + assert.equal(q.cost, ev("2*GEN_COST+routerCost(0,1)")); + ev("UI.left='deals';UI.leftOpen=true;window.innerWidth=390;renderAll()"); + const card = text(h, '#left'); + assert.match(card, /Missing: a backup generator in Frankfurt, a backup generator in Amsterdam, a second router in Frankfurt/); + assert.match(card, /Buy it and sign/); + assert.ok(doc(h).querySelector('[data-act="acceptFix"]'), 'the button is there on a phone'); + const cash = ev('S.cash'); + ev(`ACT.acceptFix({id:'o1',cost:${q.cost}})`); + assert.equal(ev('S.cash'), cash - q.cost); + assert.equal(ev("S.pops.fra.gen&&S.pops.ams.gen&&S.pops.fra.routers===2"), true); + assert.equal(ev("S.biz.some(b=>b.id==='o1')&&!S.offers.length"), true, 'signed'); + assert.equal(ev("reqOk(S.biz.find(b=>b.id==='o1'))"), true, 'and every requirement is met'); + assert.deepEqual(errors, []); +}); + +test('#241 never silent: a stale price, too little cash or a deal that cannot be signed buys nothing', t => { + const { ev, errors } = setup(t, OFFER(['metro'])); + const cost = ev("reqFix(S.offers[0]).cost"); + assert.equal(cost, ev('2*SITE2_COST')); + ev(`ACT.acceptFix({id:'o1',cost:${cost - 1}})`); + assert.equal(ev("!!S.pops.fra.site2||S.biz.length>0"), false); + ev(`S.cash=${cost - 1};ACT.acceptFix({id:'o1',cost:${cost}})`); + assert.equal(ev("!!S.pops.fra.site2||S.biz.length>0"), false); + ev(`S.cash=1e8;S.offers[0].city2='lon';ACT.acceptFix({id:'o1',cost:${cost}})`); + assert.equal(ev("!!S.pops.fra.site2||S.biz.length>0"), false, 'no POP in London: nothing is bought'); + assert.equal(ev("reqFixHtml(S.offers[0])"), ''); + ev("S.offers[0].city2='ams';S.offers[0].reqs=['nocog']"); + assert.equal(ev("reqFix(S.offers[0])"), null, 'only hardware at a POP is offered'); + assert.deepEqual(errors, []); +}); + +/* ---------- #315: POP standards by kind ---------- */ +test('#315 save a standard, bring a POP up to it, then every POP of that kind at once', t => { + const h = setup(t, POPS + "S.lvl=4;S.pops.fra.routers=2;S.pops.fra.rgen=1;compute();"); + const { ev, errors } = h; + ev("UI.sel={type:'city',id:'fra'};UI.tab='links';window.innerWidth=390;renderAll()"); + assert.match(text(h, '#panel'), /POP standards/); + assert.match(text(h, '#panel'), /Regional hub/); + ev("ACT.ptSave({city:'fra',k:'medium'})"); + assert.equal(ev("JSON.stringify(S.popTiers.def.medium)"), JSON.stringify({ g: 1, rt: 2 })); + assert.equal(ev('S.popTiers.at.fra'), 'medium'); + const q = JSON.parse(ev("JSON.stringify(ptPlan('ams','medium'))")); + assert.deepEqual(q.steps, ['swap', 'add'], 'an empty POP swaps first, then adds'); + const cash = ev('S.cash'); + ev(`ACT.ptApply({city:'ams',k:'medium',cost:${q.cost}})`); + assert.equal(ev('S.cash'), cash - q.cost, 'charged exactly the quote'); + assert.equal(ev("S.pops.ams.routers===2&&S.pops.ams.rgen===1&&S.popTiers.at.ams==='medium'"), true); + // The standard grows: one button brings both medium POPs up. + ev("S.pops.fra.routers=3;S.pops.fra.rgen=2;S.pops.fra.rupDay=-1;ACT.ptSave({city:'fra',k:'medium'});S.pops.fra.routers=2;S.pops.fra.rgen=1;S.pops.ams.rupDay=-1;compute()"); + const A = JSON.parse(ev("JSON.stringify({n:ptAll('medium').todo.length,cost:ptAll('medium').cost})")); + assert.equal(A.n, 2); + ev('ACT.utilities({})'); + assert.match(ev("document.getElementById('modalCard').textContent"), /Bring 2 POPs up/); + ev(`ACT.ptAll({k:'medium',cost:${A.cost}})`); + assert.equal(ev("['fra','ams'].every(c=>S.pops[c].routers===3&&S.pops[c].rgen===2)"), true); + assert.equal(ev("ptAll('medium').todo.length"), 0); + assert.deepEqual(errors, []); +}); + +test('#315 a busy lone router gets its partner before the swap, and never a step down', t => { + const { ev, errors } = setup(t, POPS + "S.lvl=4;ACT.launchBB({city:'ams'});S.popTiers.def.hub={g:2,rt:2};S.popTiers.def.micro={g:0,rt:1};compute();"); + assert.deepEqual(JSON.parse(ev("JSON.stringify(ptPlan('ams','hub').steps)")), ['add', 'swap']); + ev("ACT.ptApply({city:'ams',k:'hub',cost:ptPlan('ams','hub').cost})"); + assert.equal(ev("S.pops.ams.routers===2&&S.pops.ams.rgen===2"), true); + assert.equal(ev("S.inc.some(i=>i.type==='maint'&&i.ref==='ams')"), false, 'a rolling upgrade, no maintenance window'); + assert.equal(ev("ptPlan('ams','micro')"), null, 'a smaller standard asks for nothing'); + ev("ACT.ptApply({city:'ams',k:'micro',cost:0})"); + assert.equal(ev("S.pops.ams.rgen===2&&S.pops.ams.routers===2&&S.popTiers.at.ams==='micro'"), true, 'only marked'); + assert.deepEqual(errors, []); +}); + +test('#315 level 1 has no standards, and saves old and broken load', t => { + const h = setup(t, POPS); + const { ev, errors } = h; + ev("UI.sel={type:'city',id:'fra'};UI.tab='links';renderAll()"); + assert.doesNotMatch(text(h, '#panel'), /POP standards/); + ev("ACT.ptSave({city:'fra',k:'micro'})"); + assert.equal(ev('S.popTiers.def.micro'), null); + ev('delete S.popTiers;S=migrate(JSON.parse(JSON.stringify(S)))'); + assert.equal(ev('JSON.stringify(S.popTiers)'), JSON.stringify({ def: { micro: null, medium: null, hub: null }, at: {} })); + ev("S.popTiers={def:{micro:{g:999,rt:2},hub:{g:1,rt:99},bogus:{g:1,rt:1}},at:{fra:'hub',ams:'nope',xyz:'micro',ber:'hub'}};S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('JSON.stringify(S.popTiers)'), JSON.stringify({ def: { micro: null, medium: null, hub: { g: 1, rt: ev('RMAX') } }, at: { fra: 'hub' } })); + assert.deepEqual(errors, []); +}); + +/* ---------- #199: find a network at a POP ---------- */ +test('#199 search and connected-only filter the transit, exchange and PNI lists, on a phone', t => { + const h = setup(t, "S.lvl=4;ACT.buyTransit({city:'fra',net:'cog',tier:0});compute();window.innerWidth=390;UI.sel={type:'city',id:'fra'};UI.tab='up';renderAll()"); + const { ev, errors } = h; + const rows = () => [...doc(h).querySelectorAll('#panel .row .nm')].map(e => e.textContent.trim()); + const all = rows().length; + assert.ok(doc(h).getElementById('netQ'), 'the search box is there'); + ev("ACT.netOnly()"); + assert.equal(rows().length, 1); + assert.match(rows()[0], /Cogentle/); + ev("ACT.netClear()"); + assert.equal(rows().length, all); + // Typing into the box filters as you go, and the box keeps focus and text. + ev("const i=document.getElementById('netQ');i.focus();i.value='goggle';i.dispatchEvent(new window.Event('input',{bubbles:true}))"); + assert.equal(ev("document.activeElement.id"), 'netQ'); + assert.equal(ev("UI.netQ"), 'goggle'); + ev("UI.tab='peer';renderAll()"); + const peer = rows(); + assert.ok(peer.length > 0 && peer.every(r => /Goggle/.test(r)), peer.join(' | ')); + ev("ACT.netFind({q:'zzzz'})"); + assert.match(text(h, '#panel'), /No network here matches this filter/); + ev("ACT.netFind({q:String(NET.ggl.asn)})"); + assert.match(text(h, '#panel'), /Goggle/, 'an AS number finds the network'); + assert.deepEqual(errors, []); +}); diff --git a/tests/mcp-commands.test.js b/tests/mcp-commands.test.js index 9101521..76db0bc 100644 --- a/tests/mcp-commands.test.js +++ b/tests/mcp-commands.test.js @@ -226,7 +226,7 @@ test('a dry run prices every command that has a price, and changes nothing', () setChCount: { id: df, o: 'zr4', n: 2 }, repayLoan: { id: 'none' }, buildScrub: { city: 'ams', tier: 1 }, scrubUp: { city: 'fra', tier: 1 }, fixInc: { id: 'none' }, confGo: { key: T('catalog', { name: 'conferences' })[0].key }, confSponsor: { key: T('catalog', { name: 'conferences' })[0].key }, opsHire: { id: ev('Object.keys(INTERNS)[0]') }, opsNewPop: { city: 'nyc' }, pniAll: { net: 'cog', tier: 1 }, seatBuy: { n: 2 }, layShip: { id: df }, seaRush: { id: df }, - utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {}, + utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, acceptFix: { id: 'none' }, ptApply: { city: 'fra', k: 'medium' }, ptAll: { k: 'medium' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {}, pieRd: { k: 'reuse' }, pieAnt: { id: 'none' }, }; const missing = quoted.filter((n) => !sample[n] && T('schema', { section: 'commands' })[n].args.some((a) => a.required)); From d8223bad0401f5bfe43ba5536eb2146667ef9391 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Tue, 10 Nov 2026 07:14:36 +0000 Subject: [PATCH 4/5] Tests: route fuzz compares the customer catalog, day steps waits longer for its trial A new customer type changes which offers a seeded late-game draws, so the fuzz games cannot play move for move like main (as with a world change), and the sales-trial race in day-steps comes on day 46 instead of before day 20. --- tests/day-steps.test.js | 3 ++- tests/route-fuzz.test.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/day-steps.test.js b/tests/day-steps.test.js index 027b065..866cc51 100644 --- a/tests/day-steps.test.js +++ b/tests/day-steps.test.js @@ -189,7 +189,8 @@ test('a customer dropped while a sales trial routes: the trial runs again on the p.ev(TICK_ERR); p.ev("window.__ot=0;const ot=offerTrial;offerTrial=(...a)=>{__ot++;return ot(...a);};"); let found = false; - for (let d = 0; d < 20 && !found; d++) { + // Which day such a trial comes depends on the offers the seeded game draws (day 46 since latency contracts joined them). + for (let d = 0; d < 60 && !found; d++) { p.ev('rwDay()'); for (let k = 0; k < 400 && p.ev('!!RW.job'); k++) { if (p.ev('__later.length')) { p.ev('__later.shift()()'); continue; } diff --git a/tests/route-fuzz.test.js b/tests/route-fuzz.test.js index 8207da4..c0787f2 100644 --- a/tests/route-fuzz.test.js +++ b/tests/route-fuzz.test.js @@ -17,10 +17,10 @@ function pages() { let base = head; try { const b = path.join(os.tmpdir(), `tubes-fuzz-test-${process.pid}-base.html`); fs.writeFileSync(b, page.assembleRef('origin/main')); base = b; } catch (e) {} let P = { base: openPage(base, 'base'), head: openPage(head, 'head') }; - // A change to the world itself (cities, networks, cables) or to what links cost cannot route like main: there is no - // same game to compare. Then the base is this checkout too, and the cache on/off check still runs; equivalence with - // main resumes once it lands. - const world = (p) => p.ev("JSON.stringify([CITIES.map(c=>[c.id,c.land,c.P]),NETS.map(n=>[n.id,n.pops,n.ix,n.share,n.price,n.up]),CABLES.map(c=>[c.id,c.pairs.map(q=>[q[0],q[1]])]),[1,300,3000].map(k=>[dfLeaseMo(k),waveMo(k,false,2),dfBuildCost(k)])])"); + // A change to the world itself (cities, networks, cables, the kinds of customers that call) or to what links cost + // cannot route like main: there is no same game to compare. Then the base is this checkout too, and the cache on/off + // check still runs; equivalence with main resumes once it lands. + const world = (p) => p.ev("JSON.stringify([CITIES.map(c=>[c.id,c.land,c.P]),NETS.map(n=>[n.id,n.pops,n.ix,n.share,n.price,n.up]),CABLES.map(c=>[c.id,c.pairs.map(q=>[q[0],q[1]])]),[1,300,3000].map(k=>[dfLeaseMo(k),waveMo(k,false,2),dfBuildCost(k)]),Object.keys(BIZ_T).map(t=>[t,BIZ_T[t].lv||1,BIZ_T[t].opts])])"); if (base !== head && world(P.base) !== world(P.head)) { console.log('# route fuzz: the world or its prices differ from main, so both pages are this checkout'); P = { base: openPage(head, 'base'), head: P.head }; } return P; } From 870227100d024a5c502f696a3cd1e6dc16e77f39 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Tue, 10 Nov 2026 07:56:26 +0000 Subject: [PATCH 5/5] Route fuzz: leave the link panel's header city links out of the buttons both pages offer They only change the view, and main's page has plain text there, so offering them would make the two pages diverge on a screen that routes the same. --- scripts/lib/fuzz-page.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/lib/fuzz-page.js b/scripts/lib/fuzz-page.js index 5b05a14..769b69c 100644 --- a/scripts/lib/fuzz-page.js +++ b/scripts/lib/fuzz-page.js @@ -56,7 +56,9 @@ const screen = (w) => { if (w.where === 'modal') return btns($('modal')); if (w.where === 'city') { UI.sel = { type: 'city', id: w.city }; UI.tab = w.tab; renderAll(); return btns($('panel')); } - if (w.where === 'link') { if (!S.links.some((l) => l.id === w.id)) return []; UI.sel = { type: 'link', id: w.id }; renderAll(); return btns($('panel')); } + // The city names in a link panel's header open the city (#196); older pages have plain text there. They only change + // the view, so neither page offers them, and both stay in lockstep. + if (w.where === 'link') { if (!S.links.some((l) => l.id === w.id)) return []; UI.sel = { type: 'link', id: w.id }; renderAll(); const P = $('panel'); for (const h of P.querySelectorAll('.ph h2 [data-act]')) h.removeAttribute('data-act'); return btns(P); } if (w.where === 'dash') { $('dash').hidden = false; UI.dtab = w.tab; renderDash(); const b = btns($('dash')); return b; } if (w.where === 'left') { UI.left = w.tab; UI.leftOpen = true; renderLeft(); let b = btns($('leftBody'));