diff --git a/CHANGELOG.md b/CHANGELOG.md index c3af51a..a000684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- The Build POP button now shows the whole price of a new POP, including the routers of your standard POP (#261). Before, it showed only the site, although the standard routers were paid for on top; a note under the button now lists them, and the intern's one-tap template prices them in as well. + ## [2.5.0] — 2026-11-02 **Mostly a performance release.** Big networks route their traffic on about half the processor time, days no longer freeze the game, and clicks that change nothing about your traffic answer at once, so phones last longer. Same routes, same results, just faster. diff --git a/site/i18n/de.js b/site/i18n/de.js index 6f59b57..62c0c8b 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2945,6 +2945,7 @@ "ops.tpl_offer":"{name} kann diese Stadt in einem Rutsch eröffnen: {list}.", "ops.tpl_open":"Aus Vorlage eröffnen · {cost}", "ops.tpl_pop":"POP", +"ops.tpl_std":"Standard-Router", "ops.tpl_transit":"10G Transit", "ops.tracy":"Tracy", "ops.tracy_d":"Verfolgt jedes Paket Hop für Hop. Kommt am Ende an, mit ein, zwei Sternchen unterwegs.", @@ -3083,8 +3084,9 @@ "pnis.their_peering_team_says_us_east":"Ihr Peering-Team sagt, US East sei „kapazitätsbeschränkt“, was in Cloud-Sprache „nein“ heißt.", "pnis.their_team_quotes_m_months":"Ihr Team nennt {m} Monate", "pnis.us_east_is_sold_out_until":"US East ist bis auf Weiteres ausverkauft. „Bis auf Weiteres“ ist auch ausverkauft.", -"pop_std.city_gets_the_standard_n":"{city} bekommt den Standard: {n} × {model}.", +"pop_std.city_gets_the_standard_cost":"{city} bekommt den Standard: {n} × {model} für {cost}.", "pop_std.clear":"Entfernen", +"pop_std.includes_the_standard_n_model":"Inklusive deiner Standard-Router: {n} × {model}, {cost} + {mo}/Monat. Reicht das Geld nicht, bekommt der POP, was passt.", "pop_std.make_this_the_standard":"Zum Standard machen", "pop_std.new_pops_now_start_with":"Neue POPs starten jetzt mit {n} × {model}.", "pop_std.none":"Keiner", diff --git a/site/i18n/es.js b/site/i18n/es.js index 03c7173..746a61b 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2943,6 +2943,7 @@ "ops.tpl_offer":"{name} puede abrir esta ciudad de una vez: {list}.", "ops.tpl_open":"Abrir desde plantilla · {cost}", "ops.tpl_pop":"POP", +"ops.tpl_std":"routers estándar", "ops.tpl_transit":"Tránsito de 10G", "ops.tracy":"Tracy", "ops.tracy_d":"Sigue cada paquete salto a salto. Al final llega, con alguna estrellita por el camino.", @@ -3081,8 +3082,9 @@ "pnis.their_peering_team_says_us_east":"Su equipo de peering dice que US East tiene «capacidad limitada», que en lenguaje de nube significa «no».", "pnis.their_team_quotes_m_months":"Su equipo da {m} meses", "pnis.us_east_is_sold_out_until":"US East está agotado hasta nuevo aviso. El nuevo aviso también está agotado.", -"pop_std.city_gets_the_standard_n":"{city} recibe el estándar: {n} × {model}.", +"pop_std.city_gets_the_standard_cost":"{city} recibe el estándar: {n} × {model} por {cost}.", "pop_std.clear":"Quitar", +"pop_std.includes_the_standard_n_model":"Incluye tus routers estándar: {n} × {model}, {cost} + {mo}/mes. Si falta dinero, el POP recibe lo que alcance.", "pop_std.make_this_the_standard":"Convertir en estándar", "pop_std.new_pops_now_start_with":"Los nuevos POP empiezan ahora con {n} × {model}.", "pop_std.none":"Ninguno", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 5842085..e05cb95 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2943,6 +2943,7 @@ "ops.tpl_offer":"{name} peut ouvrir cette ville d'un coup : {list}.", "ops.tpl_open":"Ouvrir depuis le modèle · {cost}", "ops.tpl_pop":"POP", +"ops.tpl_std":"routeurs standard", "ops.tpl_transit":"Transit 10G", "ops.tracy":"Tracy", "ops.tracy_d":"Suit chaque paquet saut par saut. Arrive au bout, avec une ou deux étoiles en chemin.", @@ -3081,8 +3082,9 @@ "pnis.their_peering_team_says_us_east":"Leur équipe de peering dit qu’US East est « capacity constrained », ce qui veut dire « non » en langage cloud.", "pnis.their_team_quotes_m_months":"Leur équipe annonce {m} mois", "pnis.us_east_is_sold_out_until":"US East est complet jusqu’à nouvel ordre. Le nouvel ordre est complet aussi.", -"pop_std.city_gets_the_standard_n":"{city} reçoit le standard : {n} × {model}.", +"pop_std.city_gets_the_standard_cost":"{city} reçoit le standard : {n} × {model} pour {cost}.", "pop_std.clear":"Effacer", +"pop_std.includes_the_standard_n_model":"Inclut tes routeurs standard : {n} × {model}, {cost} + {mo}/mois. Si l’argent manque, le POP reçoit ce qui rentre.", "pop_std.make_this_the_standard":"En faire le standard", "pop_std.new_pops_now_start_with":"Les nouveaux POP démarrent désormais avec {n} × {model}.", "pop_std.none":"Aucun", diff --git a/site/i18n/it.js b/site/i18n/it.js index 746ffba..fff5637 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2943,6 +2943,7 @@ "ops.tpl_offer":"{name} può aprire questa città in un colpo solo: {list}.", "ops.tpl_open":"Apri da modello · {cost}", "ops.tpl_pop":"POP", +"ops.tpl_std":"router standard", "ops.tpl_transit":"Transit 10G", "ops.tracy":"Tracy", "ops.tracy_d":"Segue ogni pacchetto hop per hop. Alla fine arriva, con qualche asterisco per strada.", @@ -3081,8 +3082,9 @@ "pnis.their_peering_team_says_us_east":"Il loro team di peering dice che US East è “capacity constrained”, che in linguaggio cloud vuol dire “no”.", "pnis.their_team_quotes_m_months":"Il loro team parla di {m} mesi", "pnis.us_east_is_sold_out_until":"US East è esaurito fino a nuovo avviso. Anche il nuovo avviso è esaurito.", -"pop_std.city_gets_the_standard_n":"{city} riceve lo standard: {n} × {model}.", +"pop_std.city_gets_the_standard_cost":"{city} riceve lo standard: {n} × {model} per {cost}.", "pop_std.clear":"Rimuovi", +"pop_std.includes_the_standard_n_model":"Include i tuoi router standard: {n} × {model}, {cost} + {mo}/mese. Se mancano i soldi, il POP riceve quello che ci sta.", "pop_std.make_this_the_standard":"Rendilo lo standard", "pop_std.new_pops_now_start_with":"I nuovi POP ora partono con {n} × {model}.", "pop_std.none":"Nessuno", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 758a3b0..67b0b08 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2943,6 +2943,7 @@ "ops.tpl_offer":"{name} pode abrir esta cidade de uma vez: {list}.", "ops.tpl_open":"Abrir pelo modelo · {cost}", "ops.tpl_pop":"POP", +"ops.tpl_std":"roteadores padrão", "ops.tpl_transit":"Trânsito de 10G", "ops.tracy":"Tracy", "ops.tracy_d":"Segue cada pacote salto a salto. Chega no fim, com uma ou duas estrelinhas no caminho.", @@ -3081,8 +3082,9 @@ "pnis.their_peering_team_says_us_east":"O time de peering deles diz que US East está “capacity constrained”, que na língua da nuvem quer dizer “não”.", "pnis.their_team_quotes_m_months":"A equipe deles fala em {m} meses", "pnis.us_east_is_sold_out_until":"US East está esgotado até segunda ordem. A segunda ordem também esgotou.", -"pop_std.city_gets_the_standard_n":"{city} recebe o padrão: {n} × {model}.", +"pop_std.city_gets_the_standard_cost":"{city} recebe o padrão: {n} × {model} por {cost}.", "pop_std.clear":"Limpar", +"pop_std.includes_the_standard_n_model":"Inclui seus roteadores padrão: {n} × {model}, {cost} + {mo}/mês. Se faltar dinheiro, o POP recebe o que couber.", "pop_std.make_this_the_standard":"Tornar este o padrão", "pop_std.new_pops_now_start_with":"Novos POPs agora começam com {n} × {model}.", "pop_std.none":"Nenhum", diff --git a/src/game/60-features/95-standing-orders.js b/src/game/60-features/95-standing-orders.js index a2596ea..c2a75ab 100644 --- a/src/game/60-features/95-standing-orders.js +++ b/src/game/60-features/95-standing-orders.js @@ -219,7 +219,9 @@ function opsTplQuote(c){if(!S||S.pops[c]||!cityOn(c)||(cnCity(c)&&!cnOk()))retur if(T.bb){cost+=bbCost(c);parts.push(tr('ops.tpl_bb'));} if(T.transit&&!scnRule('noTransit')){net=opsProv(c);if(net){cost+=PORT[0].setup;parts.push(tr('ops.tpl_transit'));}} // Priced as if the POP were already there (an IX port is dearer from afar). DE-KICKS wants a sales call first, so not those. - S.pops[c]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false}; + // The standard routers go in first (#261), so they are in the price and the kit is priced for them. + const sq=popStdQuote();if(sq){cost+=sq.cost;parts.push(tr('ops.tpl_std'));} + S.pops[c]={day:S.day,bb:null,boost:0,down:0,routers:sq?sq.rt:1,gen:false,rgen:sq?sq.g:0}; try{if(T.ix&&CITY[c].ix&&!isDk(c)&&S.ixp[c]===undefined){ix=c;cost+=ixPortMo(c,0);parts.push(tr('ops.tpl_ix'));} if(T.kit){kit=utilityKit(c);if(kit&&kit.cost){cost+=kit.cost;parts.push(tr('ops.tpl_kit'));}}}finally{delete S.pops[c];} return {cost,net:net&&net.id,ix,kit:!!(kit&&kit.cost),parts};} diff --git a/src/game/60-features/96-pop-standard.js b/src/game/60-features/96-pop-standard.js index 4f60bb6..6c78a14 100644 --- a/src/game/60-features/96-pop-standard.js +++ b/src/game/60-features/96-pop-standard.js @@ -1,10 +1,14 @@ /* ---------- The standard POP (#240) ---------- Big networks run one design everywhere. A new POP gets the standard routers at once, while the box is still idle (no maintenance window): the model if it is unlocked and affordable, then the extra routers as cash allows. */ -function popStdApply(city){const d=S.popStd,p=S.pops[city];if(!d||!p||pzOn())return;let miss=false; +// What the standard adds to a fresh POP, priced the way popStdApply pays for it, so it can be on the button (#261). +function popStdQuote(){const d=S.popStd;if(!d||pzOn())return null;const g=techOk('rg',d.g,RG[d.g].lvl)?d.g:0; + let cost=g?Math.max(0,Math.round(RG[g].cost*hwMul('rt')*techMul(RG[g].lvl))-tradeIn(0,1)):0;for(let n=1;n=swapCost(city,d.g)){spend(swapCost(city,d.g));p.rgen=d.g;}else miss=true;} while((p.routers||1)${tr('pop_std.standard_for_new_pops')}${d?`${d.rt} × ${esc(RG[d.g].n)}`:tr('pop_std.none')}
${same?'':btn(tr('pop_std.make_this_the_standard'),'popStdSet',{city:c},'ghost sm')}${d?btn(tr('pop_std.clear'),'popStdClear',{},'ghost sm'):''}
`;} diff --git a/src/game/93-ui/50-city-panel.js b/src/game/93-ui/50-city-panel.js index dc9c8cd..045d7ba 100644 --- a/src/game/93-ui/50-city-panel.js +++ b/src/game/93-ui/50-city-panel.js @@ -8,7 +8,7 @@ function cityPanel(c){ if(!p){ h+=`
${C.note?`

${esc(C.note)}

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

${tr('city_panel.open_a_pop_here')}

${tr('city_panel.a_pop_point_of_presence_is')}

- ${C.ru?`

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

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

`:''}${(q=>btn(tr('city_panel.build_pop_cost_mo_mo',{cost:fmt$(popCost(c)+(q?q.cost:0)),mo:fmt$(popMo(c)+(q?q.mo:0))}),'buildPop',{city:c},'pink big',S.cash${tr('pop_std.includes_the_standard_n_model',{n:q.rt,model:esc(RG[q.g].n),cost:fmt$(q.cost),mo:fmt$(q.mo)})}

`:''))(popStdQuote())}

${tr('city_panel.or_drag_from_one_of_your')}

${opsTplHtml(c)}`}`; h+=offersHere(c); const trs=NETS.filter(n=>sellsAt(n,c)); diff --git a/src/i18n/en.js b/src/i18n/en.js index d8b82f7..b95e358 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2944,6 +2944,7 @@ "ops.tpl_offer":"{name} can open this city in one go: {list}.", "ops.tpl_open":"Open from template · {cost}", "ops.tpl_pop":"POP", +"ops.tpl_std":"standard routers", "ops.tpl_transit":"10G transit", "ops.tracy":"Tracy", "ops.tracy_d":"Follows every packet hop by hop. Gets there in the end, with a star or two on the way.", @@ -3082,8 +3083,9 @@ "pnis.their_peering_team_says_us_east":"Their peering team says US East is “capacity constrained”, which is cloud for “no”.", "pnis.their_team_quotes_m_months":"Their team quotes {m} months", "pnis.us_east_is_sold_out_until":"US East is sold out until further notice. Further notice is also sold out.", -"pop_std.city_gets_the_standard_n":"{city} gets the standard: {n} × {model}.", +"pop_std.city_gets_the_standard_cost":"{city} gets the standard: {n} × {model} for {cost}.", "pop_std.clear":"Clear", +"pop_std.includes_the_standard_n_model":"Includes your standard routers: {n} × {model}, {cost} + {mo}/mo. Short on cash, the POP gets what fits.", "pop_std.make_this_the_standard":"Make this the standard", "pop_std.new_pops_now_start_with":"New POPs now start with {n} × {model}.", "pop_std.none":"None", diff --git a/tests/pop-standard.test.js b/tests/pop-standard.test.js index 8ba7621..61f90eb 100644 --- a/tests/pop-standard.test.js +++ b/tests/pop-standard.test.js @@ -35,3 +35,29 @@ test('without the cash or the level, a new POP gets what fits; clearing and save assert.equal(ev('S.popStd'), null, 'old saves have none'); assert.deepEqual(errors, []); }); + +test('the price of a new POP includes the standard routers, on the button and in the template (#261)', () => { + const { ev, dom, errors } = load(); + const U = g('The Router at the End of the Universe'); + ev(start + `;S.pops.fra.rgen=${U};S.pops.fra.routers=4;ACT.popStdSet({city:'fra'})`); + const q = JSON.parse(ev('JSON.stringify(popStdQuote())')); + assert.equal(q.rt, 4); + assert.ok(q.cost > 5e6, 'four of the biggest routers cost millions, not thousands'); + ev("selectCity('ams');renderPanel()"); + const btnText = dom.window.document.querySelector('[data-act="buildPop"]').textContent; + assert.ok(btnText.includes(ev(`fmt$(popCost('ams')+${q.cost})`)), 'the button shows the whole price: ' + btnText); + assert.match(dom.window.document.getElementById('panelBody').textContent, /Includes your standard routers: 4 ×/); + const cash = ev('S.cash'); + ev("ACT.buildPop({city:'ams'})"); + assert.equal(cash - ev('S.cash'), ev("popCost('ams')") + q.cost, 'and that is exactly what it costs'); + // The one-tap template prices the standard too, so it is all or nothing. + ev("S.ops.hired=true;S.ops.tpl={};"); + const t = JSON.parse(ev("JSON.stringify(opsTplQuote('par'))")); + assert.equal(t.cost, ev("popCost('par')") + q.cost); + // A locked model is not quoted: what fits is the plain routers. + ev('S.lvl=1'); + assert.equal(ev('popStdQuote().g'), 0); + ev('S.popStd=null'); + assert.equal(ev('popStdQuote()'), null); + assert.deepEqual(errors, []); +});