Conference sponsorships and yearly capacity conferences with build-to-order carrier deals (#168)

This commit is contained in:
Frederic Jung 2026-10-27 18:47:43 +01:00
parent 239682720e
commit 6b04a530e8
No known key found for this signature in database
17 changed files with 278 additions and 17 deletions

View file

@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- Sponsor a conference: some peering meetings sell sponsorships, and while the glow lasts more customers from that region come knocking (#168).
- Capacity conferences arrive: PTC in Honolulu and Capacity Europe in London, once a year from customer level 3. Attend, and carriers ask for huge deals (waves, subsea capacity, whole fiber pairs) that you sign first and build afterwards, with months to deliver and a penalty if you miss the date (#168).
- Big POPs can now run up to 16 routers (#157). The standard cage still holds six: each router past that costs half again to install and adds rent for a cage extension.
## [1.34.1] — 2026-10-27

View file

@ -381,6 +381,21 @@
"cables.the_straightest_line_across_the":"La ligne la plus droite à travers l’Atlantique. Les traders paient le double pour gagner quelques millisecondes.",
"cables.up_the_west_coast_of_africa":"Remonte la côte ouest de l’Afrique. Tu répares un bout, un autre tombe.",
"cables.west_africa_s_first_big_cable":"Le premier grand câble d’Afrique de l’Ouest, du Portugal au Cap. Vieux et bancal, mais il tient encore tout debout.",
"capacity_deals.build_your_own_fiber_a_b":"Construisez votre propre fibre entre {a} et {b} pour livrer les paires · {n} jours restants",
"capacity_deals.bw_of_subsea_capacity":"{bw} de capacité sous-marine",
"capacity_deals.carrying_p_of_it_n_days":"Pas encore livré : vous pouvez en transporter {p} · {n} jours restants",
"capacity_deals.delivered_name_now_pays_price_mo":"Livré ! {name} est en service et paie {price}/mois.",
"capacity_deals.fiber_pairs":"Paires de fibre",
"capacity_deals.n_400g_waves":{"one":"{n} longueur d'onde 400G","other":"{n} longueurs d'onde 400G"},
"capacity_deals.n_carriers_from_the_conference":{"one":"Un opérateur rencontré à la conférence veut un gros contrat de capacité, avec des mois pour le livrer. Jetez un œil aux Offres.","other":"{n} opérateurs rencontrés à la conférence veulent de gros contrats de capacité, avec des mois pour les livrer. Jetez un œil aux Offres."},
"capacity_deals.n_fiber_pairs":{"one":"{n} paire de fibre","other":"{n} paires de fibre"},
"capacity_deals.name_is_due_in_30_days":"{name} arrive à échéance dans 30 jours : {what} entre {a} et {b}, et rien n'est encore livré.",
"capacity_deals.name_walked_away_you_missed_the":"{name} est parti : vous avez manqué la date de livraison. La pénalité du contrat vous a coûté {pen}.",
"capacity_deals.subsea_capacity":"Capacité sous-marine",
"capacity_deals.what_price_mo":"{what} · {price}/mois",
"capacity_deals.what_price_mo_deliver_within_n":"{what} · {price}/mois · à livrer dans les {n} jours après la signature",
"capacity_deals.what_price_mo_due_date":"{what} · {price}/mois une fois livré · échéance {date}",
"capacity_deals.wholesale_waves":"Longueurs d'onde en gros",
"cities.270_million_people_on_17_000":"270 millions d’habitants sur 17 000 îles. Mobile first, et très gourmands en bande passante.",
"cities.a_capital_high_in_the_andes":"Une capitale perchée dans les Andes, juste au sud de l’équateur, qui paie en dollars américains. Des volcans à chaque horizon.",
"cities.a_capital_in_a_valley_under":"Une capitale dans une vallée au pied d’une montagne verte. Le réseau électrique national a connu quelques jours noirs célèbres : prévois un groupe électrogène.",
@ -1250,15 +1265,23 @@
"compute.courtesy_route_to_new_networks":"Route de courtoisie vers les nouveaux réseaux",
"compute.l2vpn_for_name":"L2VPN pour {name}",
"compute.sd_wan_for_name":"SD-WAN pour {name}",
"conferences.as_a_sponsor_you_also_get":"En tant que sponsor, vous recevez aussi plus d'offres de clients en {region}.",
"conferences.attend_cost":"Participer <small>{cost}</small>",
"conferences.capacity_conference_carriers_buy_in":"conférence capacité : les opérateurs y achètent en gros",
"conferences.carriers_took_your_card_expect_big":"Les opérateurs ont pris votre carte : de grosses demandes de capacité arrivent dans quelques jours.",
"conferences.conf_comes_to_city_in_30":"<b>{conf} arrive à {city} dans 30 jours.</b><br>Peering coordinators, discussions de couloir, stickers gratuits. Inscris-toi dans l’onglet Offres.",
"conferences.conf_in_city_you_shook_a":"<b>{conf} à {city}</b><br>Tu as serré plein de mains. Pendant {n} jours, les réseaux sélectifs présents en {region} demandent deux fois moins de trafic avant de peerer.",
"conferences.in_n_days":"dans {n} jours",
"conferences.name_glow_n_days_left":"Effet {name} : encore {n} jours",
"conferences.selective_networks_in_region_need":"Les réseaux sélectifs en {region} demandent deux fois moins de trafic pour peerer. C’est le moment de demander ce PNI.",
"conferences.someone_from_goggle_bought_you_a":"Quelqu’un de chez Goggle t’a payé une bière. Tu n’as pas retenu son nom, juste un sticker.",
"conferences.sponsor":"Sponsor",
"conferences.sponsor_cost":"Sponsoriser {cost}",
"conferences.sponsorships_available":"sponsoring possible",
"conferences.the_hallway_track_moved_to_a":"Le hallway track a migré vers un bar du port, où la femme derrière le comptoir a continué à servir de l’aquavit bien après minuit sans demander à personne son AS path. De retour au bar de l’hôtel, quelqu’un a dit « allez, un dernier verre ». Tes sessions BGP ont tenu toute la nuit. Toi aussi.",
"conferences.you_also_won_the_raffle_cash":"Tu as aussi gagné la tombola : {cash} d’optiques, revendues sur eBuy le soir même.",
"conferences.you_are_sponsoring_conf_your_logo":"Vous sponsorisez {conf}. Votre logo sera sur les tours de cou, et on parlera de vous en {region}.",
"conferences.your_logo_was_on_every_lanyard":"Votre logo était sur chaque tour de cou : attendez-vous à plus de clients en {region} tant que l'effet dure.",
"connections.95th_percentile_g":"95e centile {g}",
"connections.every_port_that_connects_you_to":"Chaque port qui te relie à un autre réseau, et où il se trouve. Filtre par type, ville ou réseau, et touche Ouvrir pour y aller.",
"connections.n_connection":{"one":"{n} connexion","other":"{n} connexions"},

View file

@ -381,6 +381,21 @@
"cables.the_straightest_line_across_the":"La linea più dritta attraverso l’Atlantico. I trader pagano il doppio per risparmiare qualche millisecondo.",
"cables.up_the_west_coast_of_africa":"Risale la costa ovest dell’Africa. C’è sempre qualcosa giù.",
"cables.west_africa_s_first_big_cable":"Il primo grande cavo dell’Africa occidentale, dal Portogallo a Città del Capo. Vecchio e traballante, ma regge ancora tutto.",
"capacity_deals.build_your_own_fiber_a_b":"Costruisci la tua fibra tra {a} e {b} per consegnare le coppie · mancano {n} giorni",
"capacity_deals.bw_of_subsea_capacity":"{bw} di capacità sottomarina",
"capacity_deals.carrying_p_of_it_n_days":"Non ancora consegnato: ne puoi trasportare il {p} · mancano {n} giorni",
"capacity_deals.delivered_name_now_pays_price_mo":"Consegnato! {name} è attivo e paga {price}/mese.",
"capacity_deals.fiber_pairs":"Coppie di fibra",
"capacity_deals.n_400g_waves":{"one":"{n} wave da 400G","other":"{n} wave da 400G"},
"capacity_deals.n_carriers_from_the_conference":{"one":"Un carrier conosciuto alla conferenza vuole un grosso contratto di capacità, con mesi per consegnarlo. Dai un'occhiata in Offerte.","other":"{n} carrier conosciuti alla conferenza vogliono grossi contratti di capacità, con mesi per consegnarli. Dai un'occhiata in Offerte."},
"capacity_deals.n_fiber_pairs":{"one":"{n} coppia di fibra","other":"{n} coppie di fibra"},
"capacity_deals.name_is_due_in_30_days":"{name} scade tra 30 giorni: {what} tra {a} e {b}, e non è ancora consegnato.",
"capacity_deals.name_walked_away_you_missed_the":"{name} se n'è andato: hai mancato la data di consegna. La penale del contratto ti è costata {pen}.",
"capacity_deals.subsea_capacity":"Capacità sottomarina",
"capacity_deals.what_price_mo":"{what} · {price}/mese",
"capacity_deals.what_price_mo_deliver_within_n":"{what} · {price}/mese · da consegnare entro {n} giorni dalla firma",
"capacity_deals.what_price_mo_due_date":"{what} · {price}/mese a consegna avvenuta · scadenza {date}",
"capacity_deals.wholesale_waves":"Wave all'ingrosso",
"cities.270_million_people_on_17_000":"270 milioni di persone su 17.000 isole. Mobile first, e affamatissime di banda.",
"cities.a_capital_high_in_the_andes":"Una capitale in alto sulle Ande, appena a sud dell’equatore, che paga in dollari USA. Vulcani su ogni orizzonte.",
"cities.a_capital_in_a_valley_under":"Una capitale in una valle sotto una montagna verde. La rete elettrica nazionale ha avuto qualche giornata nera famosa, quindi porta un generatore.",
@ -1250,15 +1265,23 @@
"compute.courtesy_route_to_new_networks":"Percorso di cortesia verso le nuove reti",
"compute.l2vpn_for_name":"L2VPN per {name}",
"compute.sd_wan_for_name":"SD-WAN per {name}",
"conferences.as_a_sponsor_you_also_get":"Come sponsor ricevi anche più offerte di clienti da {region}.",
"conferences.attend_cost":"Partecipa <small>{cost}</small>",
"conferences.capacity_conference_carriers_buy_in":"conferenza sulla capacità: qui i carrier comprano all'ingrosso",
"conferences.carriers_took_your_card_expect_big":"I carrier hanno preso il tuo biglietto da visita: tra qualche giorno arriveranno grosse richieste di capacità.",
"conferences.conf_comes_to_city_in_30":"<b>{conf} arriva a {city} tra 30 giorni.</b><br>Peering coordinator, chiacchiere nei corridoi, adesivi gratis. Iscriviti dalla scheda Offerte.",
"conferences.conf_in_city_you_shook_a":"<b>{conf} a {city}</b><br>Hai stretto un sacco di mani. Per {n} giorni, alle reti selective presenti in {region} basta metà del solito traffico per fare peering.",
"conferences.in_n_days":"tra {n} giorni",
"conferences.name_glow_n_days_left":"Effetto {name}: ancora {n} giorni",
"conferences.selective_networks_in_region_need":"Alle reti selective in {region} basta metà del solito traffico per fare peering. È il momento di chiedere quel PNI.",
"conferences.someone_from_goggle_bought_you_a":"Qualcuno di Goggle ti ha offerto una birra. Non hai capito il nome, solo un adesivo.",
"conferences.sponsor":"Sponsor",
"conferences.sponsor_cost":"Sponsorizza {cost}",
"conferences.sponsorships_available":"sponsorizzazioni disponibili",
"conferences.the_hallway_track_moved_to_a":"L'hallway track si è spostato in un bar sul porto, dove la signora dietro al bancone ha continuato a versare acquavite ben oltre mezzanotte senza chiedere a nessuno il suo AS path. Poi al bar dell'hotel qualcuno ha detto «solo un ultimo bicchiere». Le tue sessioni BGP sono rimaste su tutta la notte. Anche tu.",
"conferences.you_also_won_the_raffle_cash":"Hai pure vinto alla lotteria: {cash} di ottiche, rivendute su eBuy la sera stessa.",
"conferences.you_are_sponsoring_conf_your_logo":"Sponsorizzi {conf}. Il tuo logo finisce sui lanyard e in {region} sentiranno parlare di te.",
"conferences.your_logo_was_on_every_lanyard":"Il tuo logo era su ogni lanyard: aspettati più clienti da {region} finché dura l'effetto.",
"connections.95th_percentile_g":"95° percentile {g}",
"connections.every_port_that_connects_you_to":"Ogni porta che ti collega a un’altra rete, e dove si trova. Filtra per tipo, città o rete, e tocca Apri per andarci.",
"connections.n_connection":{"one":"{n} connessione","other":"{n} connessioni"},

View file

@ -381,6 +381,21 @@
"cables.the_straightest_line_across_the":"A linha mais reta através do Atlântico. Traders pagam o dobro para economizar alguns milissegundos.",
"cables.up_the_west_coast_of_africa":"Sobe a costa oeste da África. Sempre tem alguma coisa fora do ar.",
"cables.west_africa_s_first_big_cable":"O primeiro grande cabo da África Ocidental, de Portugal à Cidade do Cabo. Velho e bambo, mas ainda segurando as pontas.",
"capacity_deals.build_your_own_fiber_a_b":"Construa sua própria fibra entre {a} e {b} para entregar os pares · faltam {n} dias",
"capacity_deals.bw_of_subsea_capacity":"{bw} de capacidade submarina",
"capacity_deals.carrying_p_of_it_n_days":"Ainda não entregue: você consegue levar {p} · faltam {n} dias",
"capacity_deals.delivered_name_now_pays_price_mo":"Entregue! {name} está no ar e paga {price}/mês.",
"capacity_deals.fiber_pairs":"Pares de fibra",
"capacity_deals.n_400g_waves":{"one":"{n} onda de 400G","other":"{n} ondas de 400G"},
"capacity_deals.n_carriers_from_the_conference":{"one":"Uma operadora que você conheceu na conferência quer um grande contrato de capacidade, com meses para entregar. Dê uma olhada em Negócios.","other":"{n} operadoras que você conheceu na conferência querem grandes contratos de capacidade, com meses para entregar. Dê uma olhada em Negócios."},
"capacity_deals.n_fiber_pairs":{"one":"{n} par de fibra","other":"{n} pares de fibra"},
"capacity_deals.name_is_due_in_30_days":"O prazo de {name} vence em 30 dias: {what} entre {a} e {b}, e ainda não foi entregue.",
"capacity_deals.name_walked_away_you_missed_the":"{name} desistiu: você perdeu o prazo de entrega. A multa do contrato custou {pen}.",
"capacity_deals.subsea_capacity":"Capacidade submarina",
"capacity_deals.what_price_mo":"{what} · {price}/mês",
"capacity_deals.what_price_mo_deliver_within_n":"{what} · {price}/mês · entregar em até {n} dias após assinar",
"capacity_deals.what_price_mo_due_date":"{what} · {price}/mês após a entrega · prazo {date}",
"capacity_deals.wholesale_waves":"Ondas no atacado",
"cities.270_million_people_on_17_000":"270 milhões de pessoas em 17.000 ilhas. Mobile first, e com muita fome de banda.",
"cities.a_capital_high_in_the_andes":"Uma capital no alto dos Andes, logo ao sul do equador, que paga em dólar. Vulcões em todo horizonte.",
"cities.a_capital_in_a_valley_under":"Uma capital num vale ao pé de uma montanha verde. A rede elétrica nacional já teve dias ruins famosos, então leve um gerador.",
@ -1250,15 +1265,23 @@
"compute.courtesy_route_to_new_networks":"Rota de cortesia para novas redes",
"compute.l2vpn_for_name":"L2VPN para {name}",
"compute.sd_wan_for_name":"SD-WAN para {name}",
"conferences.as_a_sponsor_you_also_get":"Como patrocinador, você também recebe mais ofertas de clientes de {region}.",
"conferences.attend_cost":"Participar <small>{cost}</small>",
"conferences.capacity_conference_carriers_buy_in":"conferência de capacidade: aqui as operadoras compram no atacado",
"conferences.carriers_took_your_card_expect_big":"As operadoras pegaram seu cartão: espere grandes pedidos de capacidade em poucos dias.",
"conferences.conf_comes_to_city_in_30":"<b>{conf} chega a {city} em 30 dias.</b><br>Peering coordinators, hallway track, adesivos grátis. Inscreva-se na aba Negócios.",
"conferences.conf_in_city_you_shook_a":"<b>{conf} em {city}</b><br>Você apertou muitas mãos. Por {n} dias, redes seletivas com presença em {region} pedem metade do tráfego de sempre para fazer peering.",
"conferences.in_n_days":"em {n} dias",
"conferences.name_glow_n_days_left":"Efeito {name}: faltam {n} dias",
"conferences.selective_networks_in_region_need":"Redes seletivas em {region} pedem metade do tráfego de sempre para fazer peering. Agora é a hora de pedir aquele PNI.",
"conferences.someone_from_goggle_bought_you_a":"Alguém da Goggle te pagou uma cerveja. Você não pegou o nome, só um adesivo.",
"conferences.sponsor":"Patrocinador",
"conferences.sponsor_cost":"Patrocinar {cost}",
"conferences.sponsorships_available":"patrocínios disponíveis",
"conferences.the_hallway_track_moved_to_a":"O hallway track mudou para um bar no porto, onde a moça atrás do balcão serviu aquavit até bem depois da meia-noite sem perguntar o AS path de ninguém. De volta ao bar do hotel, alguém disse “só mais uma”. Suas sessões BGP ficaram de pé a noite toda. Você também.",
"conferences.you_also_won_the_raffle_cash":"Você também ganhou o sorteio: {cash} em ópticas, vendidas no eBuy na mesma noite.",
"conferences.you_are_sponsoring_conf_your_logo":"Você está patrocinando o {conf}. Seu logo vai nos crachás, e {region} vai ouvir falar de você.",
"conferences.your_logo_was_on_every_lanyard":"Seu logo estava em todos os crachás: espere mais clientes de {region} enquanto o efeito durar.",
"connections.95th_percentile_g":"Percentil 95 {g}",
"connections.every_port_that_connects_you_to":"Toda porta que te liga a outra rede, e onde ela fica. Filtre por tipo, cidade ou rede, e toque em Abrir para ir até ela.",
"connections.n_connection":{"one":"{n} conexão","other":"{n} conexões"},

View file

@ -1,15 +1,26 @@
/* ---------- conference season ---------- */
const CONFS=[{n:'NANOG',c:'chi',m:1},{n:'APRICOT',c:'sin',m:1},{n:'Peering Days',c:'waw',m:2},{n:'DKNOG',c:'cph',m:2,j:N_('conferences.the_hallway_track_moved_to_a')},{n:'UKNOF',c:'lon',m:3},{n:'MENOG',c:'dxb',m:3},{n:'NZNOG',c:'akl',m:3},{n:'RIPE',c:'ams',m:4},{n:'NANOG',c:'sea',m:5},{n:'IX Forum',c:'tok',m:6},{n:'AfPIF',c:'nbo',m:7},{n:'AusNOG',c:'syd',m:8},{n:'NLNOG Day',c:'ams',m:8},{n:'LACNOG',c:'sao',m:9},{n:'NANOG',c:'ash',m:9},{n:'DENOG',c:'fra',m:10},{n:'RIPE',c:'ber',m:10},{n:'PTT Forum',c:'sao',m:11},{n:'PacNOG',c:'suv',m:11}];
const CONFS=[{n:'PTC',c:'hnl',m:0,cap:1},{n:'NANOG',c:'chi',m:1},{n:'APRICOT',c:'sin',m:1},{n:'Peering Days',c:'waw',m:2},{n:'DKNOG',c:'cph',m:2,j:N_('conferences.the_hallway_track_moved_to_a')},{n:'UKNOF',c:'lon',m:3},{n:'MENOG',c:'dxb',m:3},{n:'NZNOG',c:'akl',m:3},{n:'RIPE',c:'ams',m:4},{n:'NANOG',c:'sea',m:5},{n:'IX Forum',c:'tok',m:6},{n:'AfPIF',c:'nbo',m:7},{n:'AusNOG',c:'syd',m:8},{n:'NLNOG Day',c:'ams',m:8},{n:'LACNOG',c:'sao',m:9},{n:'NANOG',c:'ash',m:9},{n:'Capacity Europe',c:'lon',m:9,cap:1},{n:'DENOG',c:'fra',m:10},{n:'RIPE',c:'ber',m:10},{n:'PTT Forum',c:'sao',m:11},{n:'PacNOG',c:'suv',m:11}];
const CONF_COST=8000,CONF_DAYS=45;
// Sponsoring (#168) puts your logo on the lanyards: more customers call from that region while the glow lasts.
// Only some meetings sell sponsorships, the same ones every time you look. Capacity conferences are where carriers buy in bulk.
const CONF_SP=40000,CAP_COST=30000,CAP_LV=3;
const confSp=cf=>!cf.cap&&[...cf.key].reduce((a,ch)=>(a*31+ch.charCodeAt(0))>>>0,7)%3!==0;
const confCost=cf=>cf.cap?CAP_COST:CONF_COST;
const confDay=(cf,y)=>y*360+cf.m*30+9;
function confKey(cf,y){return cf.n+'@'+cf.c+'@'+y;}
function upcomingConfs(within){const y0=Math.floor(S.day/360),out=[];for(const y of [y0,y0+1])for(const cf of CONFS){const d=confDay(cf,y);if(d>=S.day&&d-S.day<=within)out.push({...cf,day:d,key:confKey(cf,y)});}return out.sort((a,b)=>a.day-b.day);}
function confBoost(id){const cb=S.conf;if(!cb||!(cb.until>S.day))return 1;const n=NET[id];return n&&n.pops.some(c=>CITY[c]&&CITY[c].reg===cb.reg)?0.5:1;}
function confTick(d){S.confReg=S.confReg||{};
for(const cf of upcomingConfs(30)){if(cf.day-d===30&&!S.confReg[cf.key])toast(tr('conferences.conf_comes_to_city_in_30',{conf:esc(cf.n),city:esc(CITY[cf.c].name)}),'goal',[{l:tr('common.show_me'),act:'leftTab',args:{t:'deals'}}]);}
for(const cf of upcomingConfs(0)){if(cf.day!==d||!S.confReg[cf.key])continue;const reg=CITY[cf.c].reg;S.conf={until:d+CONF_DAYS,reg,name:cf.n};S.stats.confs=(S.stats.confs||0)+1;
for(const cf of upcomingConfs(0)){if(cf.day!==d||!S.confReg[cf.key])continue;const reg=CITY[cf.c].reg,sp=S.confReg[cf.key]==='sp';S.conf={until:d+CONF_DAYS,reg,name:cf.n,sp};S.stats.confs=(S.stats.confs||0)+1;if(sp)S.stats.confSp=(S.stats.confSp||0)+1;
if(cf.cap)S.capDeal={at:d+4+Math.floor(Math.random()*5),c:cf.c};
const r=Math.random();let extra='';if(r<0.3){const cash=5000+Math.floor(Math.random()*4)*5000;S.cash+=cash;extra=' '+tr('conferences.you_also_won_the_raffle_cash',{cash:fmt$(cash)});}else if(r<0.5)extra=' '+tr('conferences.someone_from_goggle_bought_you_a');if(cf.j)extra=' '+tr(cf.j)+(r<0.3?extra:'');
toast(tr('conferences.conf_in_city_you_shook_a',{conf:esc(cf.n),city:esc(CITY[cf.c].name),n:CONF_DAYS,region:esc(REG[reg])})+extra,'goal');sfx('coin');}}
toast(tr('conferences.conf_in_city_you_shook_a',{conf:esc(cf.n),city:esc(CITY[cf.c].name),n:CONF_DAYS,region:esc(REG[reg])})+(sp?' '+tr('conferences.your_logo_was_on_every_lanyard',{region:esc(REG[reg])}):'')+(cf.cap?' '+tr('conferences.carriers_took_your_card_expect_big'):'')+extra,'goal');sfx('coin');}
capDealTick(d);}
function confSection(){const up=upcomingConfs(75).slice(0,3),cb=S.conf&&S.conf.until>S.day?S.conf:null;if(!up.length&&!cb)return '';
return `<h3 style="font-size:15px;margin:10px 0 4px">${tr('common.conferences')}</h3>${cb?`<div class="inc" style="background:#EAF7EE"><div class="nm">${tr('conferences.name_glow_n_days_left',{name:esc(cb.name),n:cb.until-S.day})}</div><div class="meta">${tr('conferences.selective_networks_in_region_need',{region:esc(REG[cb.reg])})}</div></div>`:''}${up.map(cf=>{const reg=S.confReg&&S.confReg[cf.key];return `<div class="row"><div class="grow"><div class="nm">${esc(cf.n)} · ${esc(CITY[cf.c].name)}</div><div class="meta">${cf.day===S.day?tr('common.today'):tr('conferences.in_n_days',{n:cf.day-S.day})} · ${esc(REG[CITY[cf.c].reg])}</div></div>${reg?'<span class="tag st on">'+tr('common.registered')+'</span>':cf.day<=S.day?'<span class="tag st">'+tr('common.registration_closed')+'</span>':btn(tr('conferences.attend_cost',{cost:fmt$(CONF_COST)}),'confGo',{key:cf.key},'sm',S.cash<CONF_COST)}</div>`;}).join('')}`;}
return `<h3 style="font-size:15px;margin:10px 0 4px">${tr('common.conferences')}</h3>${cb?`<div class="inc" style="background:#EAF7EE"><div class="nm">${tr('conferences.name_glow_n_days_left',{name:esc(cb.name),n:cb.until-S.day})}</div><div class="meta">${tr('conferences.selective_networks_in_region_need',{region:esc(REG[cb.reg])})}${cb.sp?' '+tr('conferences.as_a_sponsor_you_also_get',{region:esc(REG[cb.reg])}):''}</div></div>`:''}${up.map(confRow).join('')}`;}
function confRow(cf){const reg=S.confReg&&S.confReg[cf.key],open=cf.day>S.day,sp=confSp(cf),cost=confCost(cf),lk=cf.cap&&lvl()<CAP_LV;
const tags=(reg==='sp'?'<span class="tag st on">'+tr('conferences.sponsor')+'</span>':reg?'<span class="tag st on">'+tr('common.registered')+'</span>':open?'':'<span class="tag st">'+tr('common.registration_closed')+'</span>');
const btns=!open||reg==='sp'?'':(reg?'':lk?btn(tr('sites_and_service.level_n',{n:CAP_LV}),'confGo',{key:cf.key},'sm',true):btn(tr('conferences.attend_cost',{cost:fmt$(cost)}),'confGo',{key:cf.key},'sm',S.cash<cost))+(sp?btn(tr('conferences.sponsor_cost',{cost:fmt$(CONF_SP-(reg?CONF_COST:0))}),'confSponsor',{key:cf.key},'pink sm',S.cash<CONF_SP-(reg?CONF_COST:0)):'');
return `<div class="row"><div class="grow"><div class="nm">${esc(cf.n)} · ${esc(CITY[cf.c].name)}</div><div class="meta">${cf.day===S.day?tr('common.today'):tr('conferences.in_n_days',{n:cf.day-S.day})} · ${esc(REG[CITY[cf.c].reg])}${cf.cap?' · '+tr('conferences.capacity_conference_carriers_buy_in'):sp&&open&&reg!=='sp'?' · '+tr('conferences.sponsorships_available'):''}</div></div>${tags}${btns?`<div class="btns">${btns}</div>`:''}</div>`;}

View file

@ -0,0 +1,48 @@
/* ---------- capacity deals and sponsored conferences (#168) ---------- */
// A capacity conference ends with carriers asking for bulk: waves, subsea capacity or whole fiber pairs on a route.
// You sign first and build afterwards, like a real pre-sale: it pays nothing until it is delivered, and missing
// the date costs a penalty and the deal.
Object.assign(BIZ_T,{
capw:{l:tr('capacity_deals.wholesale_waves'),opts:[8,16,32],rate:0,l2:true,cap:true,km:0.45,lv:CAP_LV,names:['Lambda Llama Carriers','Wavelength Wholesalers','Big Pipe Partners','Rainbow Lambda Ltd','Tera Firma Networks']},
capsub:{l:tr('capacity_deals.subsea_capacity'),opts:[1600,3200,6400],rate:0,l2:true,cap:true,km:0.35,lv:CAP_LV,names:['Seven Seas Capacity Co.','Petabyte Pirates','Deep Blue Bandwidth','Cable Guy Consortium','Kraken Transit Holdings']},
capfib:{l:tr('capacity_deals.fiber_pairs'),opts:[2,4,8],rate:0,fiber:true,cap:true,lv:CAP_LV,names:['Glass Half Full Fiber','Hyperscale Hydra','A Hyperscaler Who Shall Not Be Named','Strand Theft Auto','Pair-a-Dice Networks']},
});
// The routes each capacity conference talks about. PTC is a Pacific crowd; Capacity Europe is the Atlantic and Europe.
const CAP_ROUTES={
hnl:[['syd','lax','capsub'],['tok','sea','capsub'],['hnl','lax','capsub'],['sin','hkg','capsub'],['syd','per','capw'],['dal','ash','capw'],['syd','akl','capfib'],['lax','sea','capfib']],
lon:[['bde','nyc','capsub'],['lis','for','capsub'],['mrs','sin','capsub'],['lon','fra','capw'],['chi','ash','capw'],['fra','ams','capw'],['chi','ash','capfib'],['mad','mrs','capfib']],
};
const SP_OFFERS=1.8,SP_REGION=0.6,CAP_PEN=2;
const confSpOn=()=>!!(S.conf&&S.conf.sp&&S.conf.until>S.day);
// While a sponsored glow lasts, most new customers come from that region.
function spMine(mine){if(!confSpOn()||Math.random()>=SP_REGION)return mine;const r=mine.filter(c=>CITY[c].reg===S.conf.reg);return r.length?r:mine;}
const capPend=b=>!!(BIZ_T[b.type]&&BIZ_T[b.type].cap&&b.due!==undefined&&!b.live);
const capN=b=>b.type==='capw'?Math.round(b.bw/400):b.type==='capfib'?(b.slots||1):0;
function capWhat(o){return o.type==='capw'?trn('capacity_deals.n_400g_waves',capN(o)):o.type==='capfib'?trn('capacity_deals.n_fiber_pairs',capN(o)):tr('capacity_deals.bw_of_subsea_capacity',{bw:fmtG(o.bw)});}
function capTerms(o){const price=fmt$(bizMo(o)),what=capWhat(o);
if(o.due===undefined)return tr('capacity_deals.what_price_mo_deliver_within_n',{what,price,n:o.win});
return o.live?tr('capacity_deals.what_price_mo',{what,price}):tr('capacity_deals.what_price_mo_due_date',{what,price,date:dateStr(o.due)});}
function capOffer(a,b,t,nm){const T=BIZ_T[t],km=kmBetween(a,b),n=pick(T.opts),o={id:uid(),city:a,city2:b,name:nm(),type:t,reqs:[],exp:S.day+30};
if(t==='capfib'){o.bw=1;o.slots=n;o.rate=Math.round(dfLeaseMo(km)*n*1.5);o.win=dfBuildDays(km)+150;}
else{o.bw=t==='capw'?n*400:n;o.rate=Math.round((150+km*0.08)*T.km);o.win=t==='capsub'?300+Math.floor(Math.random()*121):180+Math.floor(Math.random()*91);}
return o;}
function capDealTick(d){const q=S.capDeal;if(!q||q.at!==d)return;S.capDeal=null;const pool=(CAP_ROUTES[q.c]||[]).filter(r=>isCity(r[0])&&isCity(r[1])).slice(),out=[];
while(out.length<3&&pool.length){const [a,b,t]=pool.splice(Math.floor(Math.random()*pool.length),1)[0],T=BIZ_T[t];
const nm=()=>{const list=T.names.filter(n=>!S.usedNames.includes(n)),n=list.length?pick(list):pick(T.names);S.usedNames.push(n);return n;};out.push(capOffer(a,b,t,nm));}
if(!out.length)return;S.offers.push(...out);
toast(trn('capacity_deals.n_carriers_from_the_conference',out.length),'goal',[{l:tr('common.show_me'),act:'leftTab',args:{t:'deals'}}]);sfx('coin');}
// A signed deal waits for its route. Fiber pairs need a fiber of your own between the two cities.
function capFibLink(b){return S.links.find(l=>l.kind==='df'&&l.own&&l.ready<=S.day&&!(l.cut>S.day)&&((l.a===b.city&&l.b===b.city2)||(l.a===b.city2&&l.b===b.city))&&!S.biz.some(x=>x!==b&&(x.type==='pairs'||x.type==='capfib'||x.type==='dfpair')&&x.link===l.id));}
function capPendTick(b,d){if(!capPend(b))return false;
if(b.type==='capfib'){const l=capFibLink(b);if(l)b.link=l.id;}
if(bizSf(b)>=0.95&&reqOk(b)){b.live=true;b.since=d;b.mood=100;S.stats.capDone=(S.stats.capDone||0)+1;
toast(tr('capacity_deals.delivered_name_now_pays_price_mo',{name:esc(b.name),price:fmt$(bizMo(b))}),'goal');sfx('coin');return true;}
if(b.type==='capfib'&&b.link&&!capFibLink(b))b.link=undefined;
if(d>=b.due){const pen=Math.round(bizMo(b)*CAP_PEN);S.cash-=pen;S.biz=S.biz.filter(x=>x!==b);
toast(tr('capacity_deals.name_walked_away_you_missed_the',{name:esc(b.name),pen:fmt$(pen)}),'bad');sfx('err');return true;}
if(b.due-d===30)toast(tr('capacity_deals.name_is_due_in_30_days',{name:esc(b.name),what:capWhat(b),a:CITY[b.city].name,b:CITY[b.city2].name}),'bad',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);
return true;}
// What a pending deal still needs, for the customer list.
function capWhy(b){if(!capPend(b))return [];const left=b.due-S.day;
if(b.type==='capfib')return [tr('capacity_deals.build_your_own_fiber_a_b',{a:CITY[b.city].name,b:CITY[b.city2].name,n:left})];
return [tr('capacity_deals.carrying_p_of_it_n_days',{p:pct(bizSf(b)),n:left})];}

View file

@ -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:2,auV:1,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:{},
done:{},inc:[],ev:{},priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},cnLic:{state:'none'},scrubs:[],scrubMode:'always',won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,inbox:{items:[],down:{},tiny:{},rep:0,bot:false,log:[],seq:0},hw:{}};
done:{},inc:[],ev:{},priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},cnLic:{state:'none'},scrubs:[],scrubMode:'always',capDeal:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,inbox:{items:[],down:{},tiny:{},rep:0,bot:false,log:[],seq:0},hw:{}};
}

View file

@ -259,7 +259,7 @@ function compute(){
C.extras=(S.cnLic&&S.cnLic.state==='ok'?CN_JV_MO:0)+scrubMo()+Object.keys(S.pops).filter(ruCity).length*RU_BOX_MO+Object.values(S.pops).filter(p=>p.site2).length*SITE2_MO+(S.te?TE_MO:0)+(S.inbox&&S.inbox.bot?AI_MO:0);
V.eyeballs=0;V.business=0;V.ix=0;
C.wholesale=0;C.levy=0;const lev=scnRule('levy');for(const c in S.pops){const sf=sfOf(R2,c),v=R2.cityEye[c]*sf*EYE_RATE*(CITY[c].arpu||1);V.eyeballs+=v;if(CITY[c].au){if(lev)C.levy+=v*AU_LEVY;else C.wholesale+=v*AU_WHOLESALE;}}
for(const b of S.biz){const sf=BIZ_T[b.type].fiber?(fiberOk(b)?1:0):BIZ_T[b.type].l2?clamp((R2.l2[b.id]||0)/b.bw,0,1):sfOf(R2,b.city);V.business+=b.bw*b.rate*Math.min(1,sf/0.95);}
for(const b of S.biz){if(capPend(b))continue;const sf=BIZ_T[b.type].fiber?(fiberOk(b)?1:0):BIZ_T[b.type].l2?clamp((R2.l2[b.id]||0)/b.bw,0,1):sfOf(R2,b.city);V.business+=b.bw*b.rate*Math.min(1,sf/0.95);}
for(const c in S.myIx)V.ix+=S.myIx[c].members.length*MYIX_FEE;
C.revshare=(S.loans||[]).reduce((a,l)=>a+(BANKS[l.bank].equity||l.bal>0?l.share||0:0),0)*(V.eyeballs+V.business+V.ix);
R2.costMo=Object.values(C).reduce((a,b)=>a+b,0);

View file

@ -39,8 +39,12 @@ function sanitize(s){
for(const k of Object.keys(s.peers)){const [n,c]=k.split('@');if(!isNet(n)||!isIx(c))delete s.peers[k];}
for(const c of Object.keys(s.myIx)){const m=s.myIx[c];if(!isCity(c)||!m||typeof m!=='object'){delete s.myIx[c];continue;}m.members=Array.isArray(m.members)?m.members.filter(isNet):[];m.name=String(m.name||tr('common.your_ix')).slice(0,40);m.next=num(m.next,s.day);m.fab=int(m.fab,0,MYIX_FAB.length-1,0);}
const okBiz=b=>b&&own(BIZ_T,b.type)&&(!BIZ_T[b.type].nni||own(FAB,b.prov))&&isCity(b.city)&&(!b.city2||isCity(b.city2))&&(!b.sites||Array.isArray(b.sites)&&b.sites.every(isCity));
const fixBiz=b=>{b.id=sid(b.id);b.name=String(b.name||tr('common.customer')).slice(0,80);b.bw=num(b.bw,1);b.rate=num(b.rate,0);if(b.fee!==undefined)b.fee=num(b.fee,0);if(b.start!==undefined)b.start=num(b.start,0);if(b.dur!==undefined)b.dur=num(b.dur,1);if(b.slots!==undefined)b.slots=num(b.slots,0);if(b.what!==undefined)b.what=String(b.what).slice(0,200);if(b.broker!==undefined)b.broker=!!b.broker;if(!Array.isArray(b.reqs))b.reqs=[];b.reqs=b.reqs.filter(r=>own(REQS,r));if(b.mood!==undefined)b.mood=num(b.mood,100);if(b.pm!==undefined)b.pm=num(b.pm,b.mood||100);if(b.exp!==undefined)b.exp=num(b.exp,0);if(b.latMax!=null)b.latMax=num(b.latMax,10);if(b.route&&!own(RT,b.route))b.route='normal';return b;};
const fixBiz=b=>{b.id=sid(b.id);b.name=String(b.name||tr('common.customer')).slice(0,80);b.bw=num(b.bw,1);b.rate=num(b.rate,0);if(b.fee!==undefined)b.fee=num(b.fee,0);if(b.start!==undefined)b.start=num(b.start,0);if(b.dur!==undefined)b.dur=num(b.dur,1);if(b.slots!==undefined)b.slots=num(b.slots,0);if(b.what!==undefined)b.what=String(b.what).slice(0,200);if(b.broker!==undefined)b.broker=!!b.broker;if(!Array.isArray(b.reqs))b.reqs=[];b.reqs=b.reqs.filter(r=>own(REQS,r));if(b.mood!==undefined)b.mood=num(b.mood,100);if(b.pm!==undefined)b.pm=num(b.pm,b.mood||100);if(b.exp!==undefined)b.exp=num(b.exp,0);if(b.latMax!=null)b.latMax=num(b.latMax,10);if(b.route&&!own(RT,b.route))b.route='normal';if(b.due!==undefined)b.due=num(b.due,0);if(b.win!==undefined)b.win=num(b.win,180);if(b.live!==undefined)b.live=!!b.live;if(b.link!==undefined&&typeof b.link!=='string')delete b.link;return b;};
s.biz=s.biz.filter(okBiz).map(fixBiz);s.offers=s.offers.filter(okBiz).map(fixBiz);
// Sponsorships and capacity conferences (#168): registrations are true or 'sp', the glow and the pending deals are checked.
for(const k of Object.keys(s.confReg))s.confReg[k]=s.confReg[k]==='sp'?'sp':!!s.confReg[k];
if(s.conf){const c=s.conf;if(typeof c!=='object'||!own(REG,c.reg))s.conf=null;else s.conf={until:num(c.until,0),reg:c.reg,name:String(c.name||'').slice(0,40),sp:!!c.sp};}
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.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));
s.loans=s.loans.filter(l=>l&&own(BANKS,l.bank));for(const l of s.loans){if(l.model!==undefined&&!['balloon','storm','transit','astro'].includes(l.model))delete l.model;for(const k of ['apr0','cut','share'])if(l[k]!==undefined&&!isFinite(+l[k]))delete l[k];if(!Array.isArray(l.covs))l.covs=[];l.covs=l.covs.filter(c=>own(COVS,c));}s.loanOffers=s.loanOffers.filter(l=>l&&own(BANKS,l.bank));
s.usedNames=s.usedNames.filter(x=>typeof x==='string');s.log=s.log.filter(e=>e&&typeof e.t==='string').slice(0,LOG_KEEP).map(e=>{const o=e.o&&typeof e.o==='object'&&LOG_OPEN.includes(e.o.a)?(e.o.a==='bank'||e.o.a==='inbox'?{a:e.o.a}:typeof e.o.v==='string'&&e.o.v.length<=64&&(e.o.a!=='city'||isCity(e.o.v))&&(e.o.a!=='tab'||LOG_TABS.includes(e.o.v))?{a:e.o.a,v:e.o.v}:null):null;

View file

@ -51,11 +51,11 @@ function diversityPossible(a,b,state=S){
const pair=[a,b].sort().join(':');
return diversityMap.answers[pair]??(diversityMap.answers[pair]=disjointRoutes(a,b,diversityMap.links));
}
function fiberOk(b){const l=S.links.find(x=>x.id===b.link);if(!l)return false;if(b.type==='dfpair'||b.type==='pairs')return l.ready<=S.day&&!(l.cut>S.day);return l.ready<=S.day&&!(l.cut>S.day)&&!(l.eqDown>S.day);}
function fiberOk(b){const l=S.links.find(x=>x.id===b.link);if(!l)return false;if(b.type==='dfpair'||b.type==='pairs'||b.type==='capfib')return l.ready<=S.day&&!(l.cut>S.day);return l.ready<=S.day&&!(l.cut>S.day)&&!(l.eqDown>S.day);}
function soldSlots(l){return S.biz.filter(b=>b.type==='wwave'&&b.link===l.id).reduce((a,b)=>a+(b.slots||0),0);}
// Spare capacity other carriers can rent on a dark fiber (#51): free channels for alien waves, and on your own build
// a spare pair in the trench. Random offers and broker listings follow the same rules and the same prices.
const freeCh=l=>chMax(l)-(l.ch||[]).length-soldSlots(l),pairFree=l=>!!l.own&&S.biz.filter(b=>b.type==='dfpair'&&b.link===l.id).length<2&&!S.biz.some(b=>b.type==='pairs'&&b.link===l.id);
const freeCh=l=>chMax(l)-(l.ch||[]).length-soldSlots(l),pairFree=l=>!!l.own&&S.biz.filter(b=>b.type==='dfpair'&&b.link===l.id).length<2&&!S.biz.some(b=>(b.type==='pairs'||b.type==='capfib')&&b.link===l.id);
const wwWhat=(l,n)=>trn('requirements.n_400g_alien_wave_on_your',n,{a:CITY[l.a].name,b:CITY[l.b].name});
function fiberOffer(t,l,nm,cut=1){
if(t==='wwave'){const slots=1+Math.floor(Math.random()*Math.min(4,freeCh(l)));

View file

@ -2,9 +2,9 @@ function bizSf(b){const T=BIZ_T[b.type];return T.fiber?(fiberOk(b)?1:0):T.l2?cla
// Protected business traffic has its own served share; without the rule it shares the city's.
function bizSfOf(r,c){const d=r.bizDem&&r.bizDem[c];return teRules()&&teRules().protect&&d>1e-6?clamp(r.bizSrv[c]/d,0,1):sfOf(r,c);}
function bCities(o){return o.sites?o.sites.slice():[o.city,o.city2].filter(Boolean);}
function bHas(o){return bCities(o).every(c=>S.pops[c]);}
function bHas(o){return !!BIZ_T[o.type].cap||bCities(o).every(c=>S.pops[c]);}
function eventLive(b){return BIZ_T[b.type].event&&S.day>=b.start&&S.day<b.start+b.dur;}
function bTerms(o){const T=BIZ_T[o.type];
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)});
if(T.fiber)return esc(o.what)+' · '+tr('common.price_mo',{price:fmt$(o.rate)});

View file

@ -38,7 +38,7 @@ function dayTick(){
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
for(const b of S.biz.slice()){if(eventTick(b,d))continue;b.pm=b.mood;const sf=bizSf(b),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);
for(const b of S.biz.slice()){if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;const sf=bizSf(b),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);
if(sf>=0.95&&reachOk&&scrubOk&&divOk)b.mood=Math.min(100,b.mood+2);
else if(S.day-(b.since||0)<15){}
else{b.mood-=(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));
@ -56,7 +56,7 @@ function dayTick(){
if(S.mode==='sandbox'&&S.cash<1e8)S.cash=1e9;
// offers
S.offers=S.offers.filter(o=>o.exp>d);
if(S.offers.length<5&&Math.random()<(0.05+0.01*(S.lvl||1))*(ppol()==='closed'?0.6:1))spawnOffer();
if(S.offers.length<5&&Math.random()<(0.05+0.01*(S.lvl||1))*(ppol()==='closed'?0.6:1)*(confSpOn()?SP_OFFERS:1))spawnOffer();
// failures & events
let dirty=false;
if(d>=S.nextFail){dirty=true;fireFailure();const size=S.links.length+Object.keys(S.pops).length;S.nextFail=d+Math.round((Math.max(22,50-size*1.5)+Math.floor(Math.random()*25))*(scnRule('chaos')?0.5:1));}
@ -75,7 +75,7 @@ function dayTick(){
if(d%10===0)save();
}
function spawnOffer(){
const mine=Object.keys(S.pops),lv=S.lvl||1;
const mine=spMine(Object.keys(S.pops)),lv=S.lvl||1;
const types=['dia','dia','game','host'];if(mine.length>=2)types.push('l2vpn','l2vpn');if(S.day>60)types.push('scrub');
if(lv>=2)types.push('isp','stream','edu','host','hft','bulk','event','event');if(mine.length>=3&&lv>=2)types.push('sdwan','sdwan');
if(S.links.some(l=>l.kind==='df'&&l.ready<=S.day))types.push('wwave','wwave');if(S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day))types.push('dfpair');if(lv>=3)types.push('gpu','gpu','onramp','onramp');if(lv>=4)types.push('ai','ai','hyper','hyper');

View file

@ -22,6 +22,7 @@ Object.assign(ACT,{
share:()=>shareModal(),
shareDl:()=>shareFile(f=>{if(!f)return;const a=document.createElement('a');a.href=URL.createObjectURL(f);a.download=f.name;document.body.appendChild(a);a.click();setTimeout(()=>{URL.revokeObjectURL(a.href);a.remove();},1000);track('share_download');}),
shareGo:()=>shareFile(f=>{const d={title:'Series of Tubes',text:tr('route_script_and_tools.name_as_asn_tier_peak_peak',{name:S.name,asn:S.asn,tier:tierLabel(),peak:fmtG(S.stats.peak||0)}),url:'https://seriesoftub.es/'};try{if(f&&navigator.canShare&&navigator.canShare({files:[f]}))d.files=[f];navigator.share(d).then(()=>track('share_done')).catch(()=>{});}catch(e){}}),
confGo:({key})=>{S.confReg=S.confReg||{};if(S.confReg[key])return;const cf=upcomingConfs(75).find(x=>x.key===key);if(!cf||cf.day<=S.day)return;if(!spend(CONF_COST))return;S.confReg[key]=true;toast(tr('route_script_and_tools.registered_flights_booked_badge'),'good');after();},
confGo:({key})=>{S.confReg=S.confReg||{};if(S.confReg[key])return;const cf=upcomingConfs(75).find(x=>x.key===key);if(!cf||cf.day<=S.day||(cf.cap&&lvl()<CAP_LV))return;if(!spend(confCost(cf)))return;S.confReg[key]=true;toast(tr('route_script_and_tools.registered_flights_booked_badge'),'good');after();},
confSponsor:({key})=>{S.confReg=S.confReg||{};const was=S.confReg[key];if(was==='sp')return;const cf=upcomingConfs(75).find(x=>x.key===key);if(!cf||cf.day<=S.day||!confSp(cf))return;if(!spend(CONF_SP-(was?CONF_COST:0)))return;S.confReg[key]='sp';toast(tr('conferences.you_are_sponsoring_conf_your_logo',{conf:esc(cf.n),region:esc(REG[CITY[cf.c].reg])}),'good');sfx('coin');after();},
tutSkip:()=>{S.tut=null;try{localStorage.setItem('sot-tut','1');}catch(e){}renderCoach();},
});

View file

@ -12,7 +12,7 @@ Object.assign(ACT,{
const more=o.type==='wwave'&&S.biz.find(b=>b.type==='wwave'&&b.link===o.link&&b.name===o.name);
if(more){const l=S.links.find(x=>x.id===o.link);S.offers=S.offers.filter(x=>x!==o);more.slots=(more.slots||0)+(o.slots||0);more.rate+=o.rate;if(l)more.what=wwWhat(l,more.slots);
floater(CITY[o.city].x,CITY[o.city].y-30,tr('common.signed'),'#16A866');sfx('coin');after();return;}
S.offers=S.offers.filter(x=>x!==o);S.biz.push({id:o.id,city:o.city,city2:o.city2||null,reqs:o.reqs||[],latMax:o.latMax||null,route:BIZ_T[o.type].scenic?'scenic':BIZ_T[o.type].lat?'fast':'normal',name:o.name,type:o.type,bw:o.bw,rate:o.rate,mood:100,since:S.day,sites:o.sites||null,start:o.start,dur:o.dur,fee:o.fee,link:o.link,slots:o.slots||0,what:o.what,prov:o.prov});
S.offers=S.offers.filter(x=>x!==o);S.biz.push({id:o.id,city:o.city,city2:o.city2||null,reqs:o.reqs||[],latMax:o.latMax||null,route:BIZ_T[o.type].scenic?'scenic':BIZ_T[o.type].lat?'fast':'normal',name:o.name,type:o.type,bw:o.bw,rate:o.rate,mood:100,since:S.day,sites:o.sites||null,start:o.start,dur:o.dur,fee:o.fee,link:o.link,slots:o.slots||0,what:o.what,prov:o.prov,due:BIZ_T[o.type].cap?S.day+o.win:undefined});
floater(CITY[o.city].x,CITY[o.city].y-30,tr('common.signed'),'#16A866');sfx('coin');after();},
decline:({id})=>{S.offers=S.offers.filter(x=>x.id!==id);after();},
dropBiz:({id})=>{const b0=S.biz.find(x=>x.id===id);if(!b0)return;if(BIZ_T[b0.type].event&&S.day>=b0.start){toast(tr('customers.the_event_is_already_running_the'),'bad');sfx('err');return;}if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.biz=S.biz.filter(b=>b.id!==id);UI.confirm=null;after();},

View file

@ -1,7 +1,7 @@
/* ---------- customers overview (#13, #14, #15) ---------- */
const bizMo=b=>{const T=BIZ_T[b.type];return T.event?0:T.fiber?b.rate:b.bw*b.rate;};
// Why a customer is unhappy, in the same terms the daily mood update uses.
function bizWhy(b){const T=BIZ_T[b.type],out=[];if(T.event&&!eventLive(b))return out;
function bizWhy(b){const T=BIZ_T[b.type],out=[];if(T.event&&!eventLive(b))return out;if(capPend(b))return capWhy(b);
const sf=bizSf(b);if(sf<0.95)out.push(T.fiber?tr('customers.their_fiber_is_down'):tr('customers.getting_only_p_of_the_bandwidth',{p:pct(sf)}));
if(!(T.l2||T.fiber)&&R.reach<=0.99&&!scnRule('local'))out.push(tr('customers.you_cannot_reach_the_whole_internet',{p:pct(R.reach)}));
if(b.type==='scrub'&&!hasScrub())out.push(tr('common.needs_a_scrubbing_center'));

View file

@ -382,6 +382,21 @@
"cables.the_straightest_line_across_the":"The straightest line across the Atlantic. Traders pay double to save a few milliseconds.",
"cables.up_the_west_coast_of_africa":"Up the west coast of Africa. Something on it is always down.",
"cables.west_africa_s_first_big_cable":"West Africa’s first big cable, from Portugal to Cape Town. Old and wobbly, but still holding things up.",
"capacity_deals.build_your_own_fiber_a_b":"Build your own fiber between {a} and {b} to hand over the pairs · {n} days left",
"capacity_deals.bw_of_subsea_capacity":"{bw} of subsea capacity",
"capacity_deals.carrying_p_of_it_n_days":"Not delivered yet: you can carry {p} of it · {n} days left",
"capacity_deals.delivered_name_now_pays_price_mo":"Delivered! {name} is live and pays {price}/mo.",
"capacity_deals.fiber_pairs":"Fiber pairs",
"capacity_deals.n_400g_waves":{"one":"{n} × 400G wave","other":"{n} × 400G waves"},
"capacity_deals.n_carriers_from_the_conference":{"one":"A carrier you met at the conference wants a big capacity deal, with months to deliver it. Have a look in Deals.","other":"{n} carriers you met at the conference want big capacity deals, with months to deliver them. Have a look in Deals."},
"capacity_deals.n_fiber_pairs":{"one":"{n} fiber pair","other":"{n} fiber pairs"},
"capacity_deals.name_is_due_in_30_days":"{name} is due in 30 days: {what} between {a} and {b}, and it is not delivered yet.",
"capacity_deals.name_walked_away_you_missed_the":"{name} walked away: you missed the delivery date. The contract's penalty cost you {pen}.",
"capacity_deals.subsea_capacity":"Subsea capacity",
"capacity_deals.what_price_mo":"{what} · {price}/mo",
"capacity_deals.what_price_mo_deliver_within_n":"{what} · {price}/mo · deliver within {n} days of signing",
"capacity_deals.what_price_mo_due_date":"{what} · {price}/mo once delivered · due {date}",
"capacity_deals.wholesale_waves":"Wholesale waves",
"cities.270_million_people_on_17_000":"270 million people on 17,000 islands. Mobile first, and very hungry for bandwidth.",
"cities.a_capital_high_in_the_andes":"A capital high in the Andes, just south of the equator, that pays in US dollars. Volcanoes on every horizon.",
"cities.a_capital_in_a_valley_under":"A capital in a valley under a green mountain. The national grid has had some famous bad days, so bring a generator.",
@ -1251,15 +1266,23 @@
"compute.courtesy_route_to_new_networks":"Courtesy route to new networks",
"compute.l2vpn_for_name":"L2VPN for {name}",
"compute.sd_wan_for_name":"SD-WAN for {name}",
"conferences.as_a_sponsor_you_also_get":"As a sponsor you also get more customer offers from {region}.",
"conferences.attend_cost":"Attend <small>{cost}</small>",
"conferences.capacity_conference_carriers_buy_in":"capacity conference: carriers buy in bulk here",
"conferences.carriers_took_your_card_expect_big":"Carriers took your card: expect big capacity requests in a few days.",
"conferences.conf_comes_to_city_in_30":"<b>{conf} comes to {city} in 30 days.</b><br>Peering coordinators, hallway track, free stickers. Register in the Deals tab.",
"conferences.conf_in_city_you_shook_a":"<b>{conf} in {city}</b><br>You shook a lot of hands. For {n} days, selective networks with a presence in {region} want half the usual traffic before they peer.",
"conferences.in_n_days":"in {n} days",
"conferences.name_glow_n_days_left":"{name} glow: {n} days left",
"conferences.selective_networks_in_region_need":"Selective networks in {region} need half the usual traffic to peer. Now is the time to ask for that PNI.",
"conferences.someone_from_goggle_bought_you_a":"Someone from Goggle bought you a beer. You did not get their name, only a sticker.",
"conferences.sponsor":"Sponsor",
"conferences.sponsor_cost":"Sponsor {cost}",
"conferences.sponsorships_available":"sponsorships available",
"conferences.the_hallway_track_moved_to_a":"The hallway track moved to a bar by the harbour, where the woman behind the bar kept pouring aquavit long past midnight and asked nobody about their AS path. Back at the hotel bar, someone said “just one more drink”. Your BGP sessions stayed up all night. So did you.",
"conferences.you_also_won_the_raffle_cash":"You also won the raffle: {cash} worth of optics, sold on eBuy the same evening.",
"conferences.you_are_sponsoring_conf_your_logo":"You are sponsoring {conf}. Your logo goes on the lanyards, and {region} will hear about you.",
"conferences.your_logo_was_on_every_lanyard":"Your logo was on every lanyard: expect more customers from {region} while the glow lasts.",
"connections.95th_percentile_g":"95th percentile {g}",
"connections.every_port_that_connects_you_to":"Every port that connects you to another network, and where it is. Filter by type, city or network, and tap Open to go to it.",
"connections.n_connection":{"one":"{n} connection","other":"{n} connections"},

View file

@ -0,0 +1,103 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const start = "ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})";
// Jump to a conference's day and run just the conference part of the daily tick.
const confAt = (ev, find) => ev(`(()=>{const cf=CONFS.find(${find});const d=confDay(cf,0);S.day=d;confTick(d);return d;})()`);
test('#168 only some conferences sell sponsorships, and a sponsor gets more local customers', () => {
const { ev, dom, errors } = load();
ev(start);
ev("S.day=0");
const all = JSON.parse(ev("JSON.stringify(upcomingConfs(400).map(cf=>({k:cf.key,sp:confSp(cf),cap:!!cf.cap})))"));
assert.ok(all.some(c => c.sp) && all.some(c => !c.sp && !c.cap), 'some can be sponsored, some cannot');
assert.ok(all.filter(c => c.cap).every(c => !c.sp), 'capacity conferences are not sponsored');
const no = all.find(c => !c.sp && !c.cap).k;
ev(`S.day=0;ACT.confSponsor({key:'${no}'})`);
assert.equal(ev(`S.confReg['${no}']||null`), null, 'cannot sponsor one that is not for sale');
// A sponsorable European meeting.
const sp = JSON.parse(ev("JSON.stringify((()=>{for(const cf of CONFS){if(cf.cap||CITY[cf.c].reg!=='EU')continue;const k=confKey(cf,0);if(confSp({...cf,key:k}))return {k,n:cf.n,c:cf.c};}})())"));
ev(`S.day=confDay(CONFS.find(c=>c.n==='${sp.n}'&&c.c==='${sp.c}'),0)-20;ACT.leftTab({t:'deals'});renderAll()`);
assert.match(dom.window.document.body.innerHTML, /Sponsor \$/);
const cash = ev('S.cash');
ev(`ACT.confGo({key:'${sp.k}'});ACT.confSponsor({key:'${sp.k}'})`);
assert.equal(cash - ev('S.cash'), ev('CONF_SP'), 'registering then upgrading costs the sponsorship in total');
assert.equal(ev(`S.confReg['${sp.k}']`), 'sp');
confAt(ev, `c=>c.n==='${sp.n}'&&c.c==='${sp.c}'`);
assert.ok(ev('confSpOn()'), 'the sponsored glow is on');
ev("ACT.buildPop({city:'nyc'});ACT.buildPop({city:'ams'})");
ev('Math.random=()=>0.1');
assert.deepEqual(JSON.parse(ev("JSON.stringify(spMine(['fra','nyc','ams']))")), ['fra', 'ams'], 'offers lean to the sponsored region');
ev('S.conf.until=S.day');
assert.deepEqual(JSON.parse(ev("JSON.stringify(spMine(['fra','nyc','ams']))")), ['fra', 'nyc', 'ams'], 'and stop when the glow ends');
assert.deepEqual(errors, []);
});
test('#168 a capacity conference brings big deals you can sign before you build', () => {
const { ev, dom, errors } = load();
ev(start);
const key = ev("confKey(CONFS.find(c=>c.n==='Capacity Europe'),0)");
ev("S.day=confDay(CONFS.find(c=>c.n==='Capacity Europe'),0)-20;S.lvl=1");
ev(`ACT.confGo({key:'${key}'})`);
assert.equal(ev(`S.confReg['${key}']||null`), null, 'needs customer level 3');
ev(`S.lvl=3;ACT.confGo({key:'${key}'})`);
assert.equal(ev(`S.confReg['${key}']`), true);
const d = confAt(ev, "c=>c.n==='Capacity Europe'");
assert.ok(ev('S.capDeal&&S.capDeal.at') > d);
ev('S.offers=[];S.day=S.capDeal.at;capDealTick(S.day)');
const offers = JSON.parse(ev("JSON.stringify(S.offers)"));
assert.ok(offers.length >= 2, 'several carriers call');
assert.ok(offers.every(o => ev(`!!BIZ_T['${o.type}'].cap`) && o.win >= 180), 'long delivery windows');
ev("ACT.leftTab({t:'deals'});renderAll()");
assert.match(dom.window.document.body.innerHTML, /deliver within \d+ days of signing/);
// Sign one with no POPs on the route yet: it waits and pays nothing.
ev("S.offers=[capOffer('chi','ash','capfib',()=>'Test Fiber Co.')];window.__o=S.offers[0].id;ACT.accept({id:__o})");
assert.ok(ev("S.biz.some(b=>b.id===__o&&capPend(b))"), 'signed and pending');
// Even with the fiber in place, a deal pays nothing until it is handed over.
ev("S.biz.find(b=>b.id===__o).link='tmp';S.links.push({id:'tmp',a:'chi',b:'ash',kind:'df',own:true,km:950,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0});compute()");
const rev = ev('R.revMo');
ev("S.biz.find(b=>b.id===__o).live=true;compute()");
assert.ok(ev('R.revMo') > rev, 'it only pays once live');
ev("const b=S.biz.find(b=>b.id===__o);b.live=false;delete b.link;S.links=S.links.filter(l=>l.id!=='tmp');compute()");
ev("ACT.custOpen({});renderAll()");
assert.match(dom.window.document.body.innerHTML, /Build your own fiber between Chicago and/);
// Build the fiber and it is handed over.
ev("S.links.push({id:'own1',a:'ash',b:'chi',kind:'df',own:true,km:950,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0});dayTick()");
assert.ok(ev("S.biz.find(b=>b.id===__o).live"), 'delivered on the next day');
assert.equal(ev("S.biz.find(b=>b.id===__o).link"), 'own1');
assert.equal(ev("pairFree(S.links.find(l=>l.id==='own1'))"), false, 'the trench is sold');
assert.deepEqual(errors, []);
});
test('#168 missing the delivery date costs a penalty and the deal', () => {
const { ev, errors } = load();
ev(start);
ev("S.offers=[capOffer('bde','nyc','capsub',()=>'Late Cable Co.')];window.__o=S.offers[0].id;ACT.accept({id:__o})");
ev("const b=S.biz.find(x=>x.id===__o);window.__pen=Math.round(bizMo(b)*CAP_PEN);S.day=b.due-1;window.__c=S.cash");
ev("capPendTick(S.biz.find(x=>x.id===__o),S.day+1)");
assert.equal(ev("S.biz.some(b=>b.id===__o)"), false, 'the carrier walks away');
assert.equal(ev('__c-S.cash'), ev('__pen'));
assert.deepEqual(errors, []);
});
test('#168 saves keep sponsorships and pending deals, and old saves still load', () => {
const { ev, errors } = load();
ev(start);
ev("S.offers=[capOffer('lon','fra','capw',()=>'Wave Co.')];window.__o=S.offers[0].id;ACT.accept({id:__o})");
ev("S.confReg={'RIPE@ams@0':'sp','NANOG@chi@0':true,'x':'junk'};S.conf={until:S.day+5,reg:'EU',name:'RIPE',sp:true};S.capDeal={at:S.day+3,c:'lon'}");
ev("window.__t=migrate(JSON.parse(JSON.stringify(S)))");
assert.equal(ev("__t.confReg['RIPE@ams@0']"), 'sp');
assert.equal(ev("__t.confReg['x']"), true);
assert.equal(ev('__t.conf.sp'), true);
assert.equal(ev('__t.capDeal.c'), 'lon');
assert.ok(ev("__t.biz.some(b=>b.id===__o&&b.due>0&&!b.live)"), 'the pending deal survives');
ev("const s=JSON.parse(JSON.stringify(S));delete s.capDeal;delete s.conf;s.capDeal={at:'x',c:'nowhere'};window.__t=migrate(s)");
assert.equal(ev('__t.capDeal'), null, 'bad data is dropped');
ev("const s=JSON.parse(JSON.stringify(S));delete s.capDeal;s.biz=s.biz.filter(b=>!BIZ_T[b.type].cap);window.__t=migrate(s)");
assert.equal(ev('__t.capDeal'), null, 'an old save gets the default');
assert.deepEqual(errors, []);
});