IPv4 address space: scarce, bought, leased, leased out; IPv6 is free (#150)
A rule (ip4), on in On-call and BGP at 3 a.m., off in the gentler presets, sandbox and puzzles; scenarios only when they opt in. You start with a /21 from the registry, sized so the early game never notices (a gameplay-rules F1 test plays six start cities for 50 days). Business customers need a block by kind and size; broadband homes take what is left and the rest go behind CGNAT, which costs a box per home and annoys some customers. An offer that does not fit cannot be signed and says why, and a customer that cannot grow at renewal stays its size. The bank's Address space section buys and sells blocks on a transfer market with a gentle trend, leases blocks in, and leases spare blocks out for monthly income, in real CIDR sizes (/24 to /16), at most 256 blocks (what a save keeps). Old saves get what they already use, plus room, so nothing changes on load. The dashboard's AS box now lists the blocks you announce.
This commit is contained in:
parent
2cd6b71198
commit
eac0604300
34 changed files with 957 additions and 32 deletions
|
|
@ -86,6 +86,9 @@ const API_DOMAINS={
|
|||
pieSpatId:{table:'PIE_SPAT_DEF',kind:'key'},
|
||||
pieSpatChoice:{kind:'enum',values:[0,1]},
|
||||
countryCode:{kind:'enum',values:()=>[...new Set(CITIES.map(c=>c.cc))].sort()},
|
||||
// Address space: an IPv4 prefix length the market sells, and the CGNAT ratios.
|
||||
ip4Len:{kind:'enum',values:()=>Array.from({length:IP4_MAX-IP4_MIN+1},(_,i)=>IP4_MIN+i)},
|
||||
ip4Ratio:{kind:'enum',values:()=>IP4_NAT.slice()},
|
||||
scnId:{table:'SCN',kind:'id'},
|
||||
// A traceroute target in the modal's own terms.
|
||||
};
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ const API_CMD={
|
|||
doc:'Set how many channels of one optic model a dark-fiber span carries, in one change. Added optics come from the spares shelf when you have them (regen cards still cost their share); removed ones go back to the shelf.'},
|
||||
/* ---------- 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.'},
|
||||
doc:'Sign a pending offer. Rejected without a POP in every city it needs, without the IPv4 addresses it needs (rule ip4: see the bank\'s Address space), 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.'},
|
||||
decline:{args:[['id','entityId']],
|
||||
doc:'Throw an offer away.'},
|
||||
salesHire:{args:[['id','salesPersona']],
|
||||
|
|
@ -282,6 +282,23 @@ const API_CMD={
|
|||
repayLoan:{args:[['id','entityId']],confirm:'double',
|
||||
quote:a=>{const l=S.loans.find(x=>x.id===a.id);return l?{setup:repayCost(l,BANKS[l.bank])}:{};},
|
||||
doc:'Repay a loan early, or buy an equity investor out.'},
|
||||
/* ---------- address space (IPv4, rule ip4: On-call and BGP at 3 a.m.) ---------- */
|
||||
ip4Buy:{args:[['len','ip4Len']],watch:['ip4'],
|
||||
quote:a=>({setup:ip4Cost(Number(a.len)),blocked:[ip4On()?'':tr('ip4.off'),ip4On()&&ip4Full()?tr('ip4.too_many',{n:IP4_BLK}):''].filter(Boolean)}),
|
||||
doc:'Buy an IPv4 block of this prefix length (24 = 256 addresses up to 16 = 65,536) on the transfer market at today\'s price. It can be sold again two years after this transfer. A network holds at most 256 blocks, bought, leased in and from the registry together.'},
|
||||
ip4Lease:{args:[['len','ip4Len']],watch:['ip4'],
|
||||
quote:a=>({setup:0,monthly:ip4InMo(Number(a.len)),blocked:[ip4On()?'':tr('ip4.off'),ip4On()&&ip4Full()?tr('ip4.too_many',{n:IP4_BLK}):''].filter(Boolean)}),
|
||||
doc:'Lease an IPv4 block of this prefix length by the month, at today\'s rate (fixed for the lease). Hand it back with ip4Return. Refused at 256 blocks, like ip4Buy.'},
|
||||
ip4Sell:{args:[['id','entityId']],confirm:'double',watch:['ip4'],
|
||||
doc:'Sell an owned block (not leased out) for 92% of the market price. Refused within two years of its last transfer, or when the customers signed would no longer fit with every home behind CGNAT.'},
|
||||
ip4Out:{args:[['id','entityId']],watch:['ip4'],
|
||||
doc:'Lease an owned block out through a broker for a monthly income, while your own customers still fit without it.'},
|
||||
ip4Back:{args:[['id','entityId']],watch:['ip4'],
|
||||
doc:'End the lease of a block you leased out; its addresses are yours to use again.'},
|
||||
ip4Return:{args:[['id','entityId']],watch:['ip4'],
|
||||
doc:'Hand a leased-in block back, ending its monthly fee, when your customers still fit without it.'},
|
||||
ip4Nat:{args:[['v','ip4Ratio']],watch:['ip4'],
|
||||
doc:'Set how many broadband homes share one IPv4 address behind CGNAT (8, 16, 32 or 64). More frees space for business customers but more gamers ask for refunds; fewer is refused when the customers signed would not fit.'},
|
||||
/* ---------- security, China, incidents ---------- */
|
||||
buildScrub:{args:[['city','cityId'],['tier','scrubTier',false]],watch:['scrubs'],
|
||||
quote:a=>{const T=SCRUB_TIERS[a.tier||0];return {setup:T?T.cost:undefined,monthly:T?T.mo:undefined};},
|
||||
|
|
@ -453,6 +470,8 @@ const API_CMD={
|
|||
|
||||
const API_VIEW={
|
||||
pieOpen:{args:[],doc:'Open Pie Control, the rocket company\'s panel.'},
|
||||
ip4Open:{args:[],doc:'Open the bank at its Address space section: your IPv4 blocks, who uses them, CGNAT and the transfer market.'},
|
||||
ip4Pick:{args:[['v','ip4Len']],doc:'Pick the block size the Address space market quotes (a prefix length, 24 to 16).'},
|
||||
pieGovOpen:{args:[],doc:'Open the bank at its Government money section: the rocket company\'s fund auctions, the Pitcairn grant and the Ex-Im Pie Bank (it used to be Pie Control\'s Gov tab).'},
|
||||
pieTab:{args:[['t','pieTab']],doc:'Switch the Pie Control tab: traffic, co (the company, its books and the Founder\'s posts), fly (launches) or dish.'},
|
||||
pieCity:{args:[['v','cityId']],doc:'Pick the POP the Dishes tab works on.'},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const API_STATE_DOC={
|
|||
cash:{type:'number',doc:'Cash on hand. Goes negative into the red; -100k is bankruptcy.'},
|
||||
priceMul:{type:'number',doc:'Multiplier on transit prices (weekly modifier).'},
|
||||
mode:{type:'string',doc:'normal | sandbox | scenario | puzzle.'},
|
||||
rules:{type:'map',doc:'The rules this network locked in at its door: preset (soft, freeze, oncall, bgp, sandbox or puzzle), the chaos dial, lead times, the market, and the Best Effort extras (sea, confs, broke, moods, pnis), which are only written where they differ from the classic game. They stay for the network\'s whole life.'},
|
||||
rules:{type:'map',doc:'The rules this network locked in at its door: preset (soft, freeze, oncall, bgp, sandbox or puzzle), the chaos dial, lead times, the market, and the later rules (sea, confs, broke, moods, pnis, and ip4 for scarce IPv4, off outside On-call and BGP at 3 a.m.), which are only written where they differ from the classic game. They stay for the network\'s whole life.'},
|
||||
charter:{type:'string',doc:'The charter a normal game signed when it started: global | boutique | broker. chartSet is false until one is signed.'},
|
||||
baronWon:{type:'number',doc:'The day a broker won Glass Baron, or 0.'},
|
||||
chartSet:{type:'boolean',doc:'The charter has been picked; false while the choice is still open.'},
|
||||
|
|
@ -61,6 +61,7 @@ const API_STATE_DOC={
|
|||
ops:{type:'map',doc:'The NOC intern: who is hired, each standing order\'s on/off switch and settings (network work only: deals belong to the sales desk, slAuto), the monthly budget and what it spent, per-POP exceptions, the new-POP template and the weekly log.'},
|
||||
core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'},
|
||||
ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'},
|
||||
ip4:{type:'map',doc:'IPv4 address space (rule ip4): b, the blocks, at most 256 (len: prefix length 16-24, k: rir from the registry, buy bought, in leased in; d: the day it last moved, out: leased out, mo: the monthly fee or income), nat: homes per address behind CGNAT, w: which warnings were shown. What customers use is derived from their kind and size.'},
|
||||
popStd:{type:'map',doc:'The build standard, or null for none. g router model (an RG index), rt routers, then only the targets that are set: site2, gen (true), lag (2 or 4 members), split, ix (true), pni (2 or 3 cities per network), sys (roadm, cl), opt (fast), wv (an LT index). New POPs get g, rt, site2 and gen at once; the std standing order and bstdApply bring the rest up.'},
|
||||
mp:{type:'map',doc:'Multiplayer, only in a self-hosted copy with a session server: the session code, your player id, the AS number and seed the session gave you, its rules preset, your colour, its title and the last save number the server holds; null in every other game.'},
|
||||
demo:{type:'map',doc:'Vendor demo units on order, by "kind:id" → ready day.'},
|
||||
|
|
|
|||
|
|
@ -6,17 +6,18 @@
|
|||
// sea: cable ships sail out to subsea cuts, or (timer) a cut mends on its own clock. confs: conference season.
|
||||
// broke: deep in the red ends the game, or (rescue) a state loan keeps it going. moods: patient customers sour half as fast.
|
||||
// pnis: PNIs and their augments wait for the other network's team, or (instant) are up the moment they are ordered.
|
||||
const RULE_DEF={clock:true,chaos:'normal',lead:'real',market:true,money:'normal',gates:'ladder',sea:'ships',confs:true,broke:'lose',moods:'normal',pnis:'wait',mods:[]};
|
||||
const RULE_LATE=['sea','confs','broke','moods','pnis'];
|
||||
const RULE_OK={clock:[true,false],chaos:['none','calm','normal','spicy'],lead:['real','quick'],market:[true,false],money:['normal','infinite'],gates:['ladder','open'],sea:['ships','timer'],confs:[true,false],broke:['lose','rescue'],moods:['normal','patient'],pnis:['wait','instant']};
|
||||
// ip4: IPv4 is scarce (#150, 33-address-space.js): customers need addresses, homes share them behind CGNAT.
|
||||
const RULE_DEF={clock:true,chaos:'normal',lead:'real',market:true,money:'normal',gates:'ladder',sea:'ships',confs:true,broke:'lose',moods:'normal',pnis:'wait',ip4:true,mods:[]};
|
||||
const RULE_LATE=['sea','confs','broke','moods','pnis','ip4'];
|
||||
const RULE_OK={clock:[true,false],chaos:['none','calm','normal','spicy'],lead:['real','quick'],market:[true,false],money:['normal','infinite'],gates:['ladder','open'],sea:['ships','timer'],confs:[true,false],broke:['lose','rescue'],moods:['normal','patient'],pnis:['wait','instant'],ip4:[true,false]};
|
||||
// i: icon, n: name, d: the one-line joke, x: what is different, in small print.
|
||||
const PRESETS={
|
||||
soft:{i:'☕',n:tr('rules.best_effort'),d:tr('rules.no_sla_no_pager_no_promises'),x:tr('rules.rare_outages_no_ddos_pnis_at_once'),clock:true,chaos:'calm',lead:'quick',market:false,money:'normal',gates:'ladder',sea:'timer',confs:false,broke:'rescue',moods:'patient',pnis:'instant'},
|
||||
freeze:{i:'🧊',n:tr('rules.change_freeze'),d:tr('rules.nobody_touches_prod_even_the_backhoes'),x:tr('rules.a_third_of_the_outages_no_ddos_pnis'),clock:true,chaos:'calm',lead:'quick',market:false,money:'normal',gates:'ladder'},
|
||||
soft:{i:'☕',n:tr('rules.best_effort'),d:tr('rules.no_sla_no_pager_no_promises'),x:tr('rules.rare_outages_no_ddos_pnis_at_once'),clock:true,chaos:'calm',lead:'quick',market:false,money:'normal',gates:'ladder',sea:'timer',confs:false,broke:'rescue',moods:'patient',pnis:'instant',ip4:false},
|
||||
freeze:{i:'🧊',n:tr('rules.change_freeze'),d:tr('rules.nobody_touches_prod_even_the_backhoes'),x:tr('rules.a_third_of_the_outages_no_ddos_pnis'),clock:true,chaos:'calm',lead:'quick',market:false,money:'normal',gates:'ladder',ip4:false},
|
||||
oncall:{i:'📟',n:tr('rules.on_call'),d:tr('rules.the_real_thing_your_pager_has'),x:tr('rules.real_lead_times_real_outages_a_real'),clock:true,chaos:'normal',lead:'real',market:true,money:'normal',gates:'ladder'},
|
||||
bgp:{i:'🔥',n:tr('rules.bgp_at_3_a_m'),d:tr('rules.everything_is_on_fire_and_it'),x:tr('rules.more_and_longer_outages_more_ddos'),clock:true,chaos:'spicy',lead:'real',market:true,money:'normal',gates:'ladder'},
|
||||
sandbox:{i:'🏖️',n:tr('common.sandbox'),d:tr('rules.a_billion_dollars_every_unlock_your'),x:tr('rules.infinite_money_everything_unlocked_quick'),clock:true,chaos:'none',lead:'quick',market:true,money:'infinite',gates:'open'},
|
||||
puzzle:{i:'🧩',n:tr('rules.puzzle'),d:tr('rules.one_small_network_one_tricky_goal'),x:tr('rules.no_clock_no_bills_nothing_breaks'),clock:false,chaos:'none',lead:'quick',market:false,money:'normal',gates:'open'},
|
||||
sandbox:{i:'🏖️',n:tr('common.sandbox'),d:tr('rules.a_billion_dollars_every_unlock_your'),x:tr('rules.infinite_money_everything_unlocked_quick'),clock:true,chaos:'none',lead:'quick',market:true,money:'infinite',gates:'open',ip4:false},
|
||||
puzzle:{i:'🧩',n:tr('rules.puzzle'),d:tr('rules.one_small_network_one_tricky_goal'),x:tr('rules.no_clock_no_bills_nothing_breaks'),clock:false,chaos:'none',lead:'quick',market:false,money:'normal',gates:'open',ip4:false},
|
||||
};
|
||||
const NORMAL_PRESETS=['soft','freeze','oncall','bgp'];
|
||||
// How often things break, against the classic game. Spicy outages also last half as long again.
|
||||
|
|
|
|||
89
src/game/60-features/33-address-space.js
Normal file
89
src/game/60-features/33-address-space.js
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/* ---------- Address space (#150): IPv6 is free for everyone, IPv4 ran out years ago ----------
|
||||
The network holds IPv4 blocks in real CIDR sizes (/24 to /16): its first allocation from the RIR, blocks bought on
|
||||
the transfer market and blocks leased in by the month. Owned blocks can be leased out (a broker finds the tenant) or
|
||||
sold, once two years have passed since they last moved (the RIRs' holding period, which also stops flipping).
|
||||
Business customers on IP service take a public block each, sized by kind and port (a /29 for a small DIA port, a /23
|
||||
for a big hosting company); broadband homes take what is left, and the homes that do not fit share addresses behind
|
||||
CGNAT at the player's ratio. CGNAT costs a little per Gbps it carries (IPv6 goes around the box) and some gamers want
|
||||
their money back. An offer that needs more than is free, with every home already behind CGNAT, cannot be signed, and a
|
||||
customer renewing bigger stays at its size when the bigger block is not free (clGrow).
|
||||
Nothing is stored per customer: what each one needs follows from its kind and size, so growing customers and old saves
|
||||
need no new fields. On in On-call and BGP at 3 a.m. (rule ip4), off in the gentler presets, sandbox and puzzles;
|
||||
scenarios only when they opt in (S.scn.rules.ip4). No random draws: the market price is a function of the day.
|
||||
The first allocation is a /21: one transit's worth of broadband levels off at about 1,300 homes in every start city,
|
||||
so the first months fit with room for a few customers (gameplay rule F1). */
|
||||
// IP4_BLK: the most blocks a network holds; buying and leasing stop there, and a save keeps that many.
|
||||
const IP4_START=21,IP4_MIN=16,IP4_MAX=24,IP4_HOLD=730,IP4_NAT=[8,16,32,64],IP4_NAT0=16,IP4_BLK=256;
|
||||
// Public addresses per Gbps of busy-hour broadband (a home each), and the part of it CGNAT still carries: the rest is IPv6.
|
||||
const IP4_BB=10,IP4_V4=0.55,IP4_CGN=2;
|
||||
// The market: dollars per address, flat for half a year, then +3% a year on a slow four-year swing. Leases are by the
|
||||
// month (a broker keeps a cut of what yours earn), sales pay 92% of the price after the broker's fee.
|
||||
const IP4_PX=38,IP4_FREE=180,IP4_YR=0.03,IP4_IN=0.5,IP4_OUT=0.4,IP4_SELL=0.92;
|
||||
// Of the bill of a home behind CGNAT, the share that comes back as refunds (gamers, mostly): more homes per address, more
|
||||
// grumbling. Homes squeezed past the ratio (port exhaustion) are worse.
|
||||
const IP4_ANNOY={8:0.01,16:0.015,32:0.025,64:0.04},IP4_SQZ=0.15;
|
||||
// Per kind of customer: addresses per Gbps of port, and the smallest block it takes. Circuits, waves and fiber carry no
|
||||
// addresses of yours; downstream ISPs and universities bring their own (universities sit on legacy /16s); orbit
|
||||
// terminals sit behind the satellite operator's own CGNAT.
|
||||
const IP4_BIZ={cgame:[0.5,256],dia:[2,8],fabip:[2,8],game:[2,16],gpu:[0.5,64],host:[4,64],metav:[0.25,256],scrub:[2,8],stream:[1,32]};
|
||||
const ip4Sz=len=>2**(32-len),ip4LenOk=len=>Number.isInteger(len)&&len>=IP4_MIN&&len<=IP4_MAX;
|
||||
const ip4Cidr=n=>'/'+(32-Math.ceil(Math.log2(Math.max(1,n)))),ip4N=n=>Math.round(n).toLocaleString();
|
||||
function ip4On(){return !!S&&!!S.ip4&&rule('ip4')===true&&(S.scn?scnRule('ip4'):S.mode==='normal');}
|
||||
function ip4Need(b){const k=b&&IP4_BIZ[b.type];if(!k||!(b.bw>0))return 0;return Math.min(4096,2**Math.ceil(Math.log2(Math.max(k[1],b.bw*k[0]))));}
|
||||
/* Who uses what. T: usable addresses (owned and leased in, without what is leased out); B: business customers; H: homes;
|
||||
cg: homes behind CGNAT; over: the share of homes that do not fit even at the ratio; free: what a new customer can have
|
||||
with every home behind CGNAT. */
|
||||
function ip4Use(s=S){const I=s.ip4,r=I.nat;let own=0,inn=0,out=0,B=0,H=0;
|
||||
for(const b of I.b){const n=ip4Sz(b.len);if(b.k==='in')inn+=n;else if(b.out)out+=n;else own+=n;}
|
||||
for(const b of s.biz)B+=ip4Need(b);
|
||||
for(const c in s.pops){const p=s.pops[c];if(p.bb)H+=p.bb.d*IP4_BB;}
|
||||
H=Math.ceil(H);const T=own+inn,A=Math.max(0,T-B),min=Math.ceil(H/r);let cg=0,over=0;
|
||||
if(A<H){if(A>=min)cg=Math.min(H,Math.ceil((H-A)*r/(r-1)));else{cg=H;over=min?1-A/min:0;}}
|
||||
return {T,own,inn,out,B,H,cg,over,free:T-B-min,r};}
|
||||
const ip4Fits=o=>!ip4On()||ip4Need(o)<=Math.max(0,ip4Use().free);
|
||||
// A customer renewing at bw: does the bigger block it needs fit what is free?
|
||||
const ip4GrowOk=(b,bw)=>!ip4On()||ip4Need({type:b.type,bw})-ip4Need(b)<=Math.max(0,ip4Use().free);
|
||||
const ip4Full=()=>S.ip4.b.length>=IP4_BLK;
|
||||
// What you announce, as the AS box shows it: your blocks by prefix length, without the ones leased out to others.
|
||||
const ip4Pfx=()=>{const c={};for(const b of S.ip4.b)if(!b.out)c[b.len]=(c[b.len]||0)+1;return Object.keys(c).sort((a,b)=>a-b).map(l=>`${c[l]} × /${l}`).join(', ');};
|
||||
// Would giving this block up (selling, leasing it out, handing it back) still leave room for everyone?
|
||||
const ip4Spare=b=>ip4Use().free>=ip4Sz(b.len);
|
||||
const ip4Held=b=>b.k!=='in'&&S.day-b.d<IP4_HOLD;
|
||||
function ip4Px(d=S.day){if(!rule('market')||d<=IP4_FREE)return IP4_PX;const y=(d-IP4_FREE)/365;return IP4_PX*(1+IP4_YR*y)*(1+0.12*Math.sin(2*Math.PI*y/4));}
|
||||
// Bigger blocks are a little cheaper per address, as on the real market.
|
||||
const ip4Cost=len=>Math.round(ip4Sz(len)*ip4Px()*(1-0.015*(IP4_MAX-len))/100)*100;
|
||||
const ip4Value=len=>Math.round(ip4Cost(len)*IP4_SELL/100)*100;
|
||||
const ip4InMo=len=>Math.round(ip4Sz(len)*IP4_IN*ip4Px()/IP4_PX),ip4OutMo=len=>Math.round(ip4Sz(len)*IP4_OUT*ip4Px()/IP4_PX);
|
||||
// The month's IPv4 bill: leases in and out, CGNAT boxes, refunds (eye: what broadband earns a month).
|
||||
function ip4Bill(eye){const u=ip4Use();let lin=0,lout=0;for(const b of S.ip4.b){if(b.k==='in')lin+=b.mo||0;else if(b.out)lout+=b.mo||0;}
|
||||
const cgS=u.H?u.cg/u.H:0;return {u,lin,lout,box:u.cg/IP4_BB*IP4_V4*IP4_CGN,refund:eye*(cgS*IP4_ANNOY[u.r]+u.over*IP4_SQZ)};}
|
||||
// computeMoney: only what is there, so a network with nothing to pay keeps its money rows as they were.
|
||||
function ip4Money(C,V){if(!ip4On())return;const b=ip4Bill(V.eyeballs||0),c=Math.round(b.lin+b.box+b.refund);if(c>0)C.ip4=c;if(b.lout>0)V.ip4=b.lout;}
|
||||
/* A new network gets its /21 from the RIR. An older save gets what it already uses registered to it and a quarter more to
|
||||
grow into (about a month for a big, fast-growing network), rounded up to /24s in real CIDR blocks (a /21 at the
|
||||
least), so nothing changes on load; those blocks move like any other two years on.
|
||||
Their ids are fixed (rir0, rir1…), not uid(): a new game draws no id, so every id after it stays as it was. */
|
||||
function ip4Grant(s){const d=s.day||0,b=[],add=len=>b.push({id:'rir'+b.length,len,k:'rir',d});let need=0;
|
||||
for(const x of s.biz||[])need+=ip4Need(x);
|
||||
for(const c in s.pops||{}){const p=s.pops[c];if(p&&p.bb&&p.bb.d>0)need+=p.bb.d*IP4_BB;}
|
||||
need=Math.max(ip4Sz(IP4_START),Math.ceil(need*1.25/256)*256);
|
||||
while(need>=ip4Sz(IP4_MIN)&&b.length<200){add(IP4_MIN);need-=ip4Sz(IP4_MIN);}
|
||||
for(let len=IP4_MIN+1;len<=IP4_MAX;len++)if(need>=ip4Sz(len)){add(len);need-=ip4Sz(len);}
|
||||
return {b,nat:IP4_NAT0,w:0};}
|
||||
const ip4New=()=>ip4Grant({});
|
||||
function ip4Fix(s){const I=s.ip4&&typeof s.ip4==='object'&&!Array.isArray(s.ip4)?s.ip4:null;if(!I){s.ip4=ip4Grant(s);return;}
|
||||
const day=Math.max(0,num(s.day,0)),mo=v=>Math.round(Math.min(1e8,Math.max(0,num(v,0))));
|
||||
const b=(Array.isArray(I.b)?I.b:[]).filter(x=>x&&typeof x==='object'&&ip4LenOk(x.len)&&['rir','buy','in'].includes(x.k)).slice(0,IP4_BLK).map(x=>{
|
||||
const o={id:typeof x.id==='string'&&x.id&&x.id.length<=40?x.id:uid(),len:x.len,k:x.k,d:int(x.d,0,day,0)};
|
||||
if(x.k==='in')o.mo=mo(x.mo);else if(x.out===true){o.out=true;o.mo=mo(x.mo);}return o;});
|
||||
s.ip4={b,nat:IP4_NAT.includes(I.nat)?I.nat:IP4_NAT0,w:int(I.w,0,3,0)};}
|
||||
/* Once a day: say so when homes go behind CGNAT (a percent of them at least), and when even CGNAT cannot fit them all
|
||||
(w: what was said). Each rearms only with room to spare again, so homes hovering at the limit hear it once. */
|
||||
function ip4Day(d){if(!ip4On())return;const I=S.ip4,u=ip4Use(),A=u.T-u.B,go=[{l:tr('ip4.section'),act:'ip4Open'}];
|
||||
if(u.cg>=Math.max(1,u.H*0.01)){if(!(I.w&1)){I.w|=1;toast(tr('ip4.toast_cgnat',{p:pct(u.cg/u.H)}),'',go);}}else if(A>=u.H*1.05)I.w&=~1;
|
||||
if(u.over>0){if(!(I.w&2)){I.w|=2;toast(tr('ip4.toast_out',{r:u.r}),'bad',go);sfx('err');}}else if(A>=Math.ceil(u.H/u.r)*1.1)I.w&=~2;}
|
||||
// Renewals that wanted a bigger block than is free (clGrow, [customer, bandwidth]): they stay as they are, and hear why.
|
||||
function ip4News(l=[]){for(const [b,bw] of l.slice(0,3))toast(tr('ip4.no_grow',{name:esc(b.name),city:esc(clWhere(b)),bw:fmtG(bw)}),'',[{l:tr('ip4.section'),act:'ip4Open'}]);}
|
||||
// The line under an offer that cannot be signed for want of addresses.
|
||||
function ip4Why(o){if(ip4Fits(o))return '';const n=ip4Need(o);
|
||||
return `<div class="why">${tr('ip4.offer_needs',{p:ip4Cidr(n),n:ip4N(n),free:ip4N(Math.max(0,ip4Use().free))})} ${btn(tr('ip4.section'),'ip4Open',{},'ghost sm')}</div>`;}
|
||||
|
|
@ -65,13 +65,13 @@ function salesDay(d){const L=S.sales;if(!L)return;
|
|||
// With a rocket company, every other game is with the Founder, and in orbit (pieGolf, 99-pie-sales.js).
|
||||
const SALES_GOLF=['metav','cgame','gpu','stream','isp','edu','host','dia'];
|
||||
function salesGolf(d){if(pieGolf(d))return;const mine=Object.keys(S.pops).filter(c=>popUp(c)&&bizCity(c));if(!mine.length)return;
|
||||
const t=SALES_GOLF.find(x=>(BIZ_T[x].lv||1)<=lvl());if(!t)return;const T=BIZ_T[t],city=mine.sort((a,b)=>CITY[b].P-CITY[a].P||(a<b?-1:1))[0];
|
||||
const t=SALES_GOLF.find(x=>(BIZ_T[x].lv||1)<=lvl()&&ip4Fits({type:x,bw:BIZ_T[x].opts[BIZ_T[x].opts.length-1]}));if(!t)return;const T=BIZ_T[t],city=mine.sort((a,b)=>CITY[b].P-CITY[a].P||(a<b?-1:1))[0];
|
||||
const list=(T.names||BIZ_N).filter(n=>!S.usedNames.includes(n));const name=list.length?list[Math.floor(slR('golfn|'+d)*list.length)]:(T.names||BIZ_N)[0];useName(name);
|
||||
const o={id:uid(),city,city2:null,name,type:t,bw:T.opts[T.opts.length-1],rate:Math.round((CITY[city].au?T.rate*AU_ARPU:T.rate)*mkt()*0.7),reqs:[],exp:d+40};
|
||||
const k=salesPromise(o);if(k)o.reqs.push(k);const b=offerCustomer(o);b.by='ceo';b.mk=mkt();S.biz.push(clSign(b));
|
||||
toast(tr('sales.ceo_golf',{name:esc(name),city:esc(CITY[city].name),bw:fmtG(o.bw),price:fmt$(o.bw*o.rate)})+(k?' '+tr('sales.ceo_promised',{req:esc(typeof REQS[k].l==='function'?REQS[k].l(o):REQS[k].l)}):''),'goal',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);sfx('coin');}
|
||||
// Declining an offer the CEO likes: about one in three, he already shook hands on it.
|
||||
function salesOverride(o){if(slP()!=='ceo'||!o||!bHas(o)||BIZ_T[o.type].event||slR('veto|'+slKey(o))>=0.33)return false;
|
||||
function salesOverride(o){if(slP()!=='ceo'||!o||!bHas(o)||BIZ_T[o.type].event||!ip4Fits(o)||slR('veto|'+slKey(o))>=0.33)return false;
|
||||
const b=offerCustomer(o);if(o.mk)b.mk=o.mk;b.by='ceo';S.offers=S.offers.filter(x=>x!==o);S.biz.push(clSign(b));toast(tr('sales.ceo_override',{name:esc(o.name)}),'');return true;}
|
||||
// Saves: who is at the desk, the VP on the way, the CEO's calendar; who brought each offer and signed each customer.
|
||||
function salesFix(s){const L=s.sales&&typeof s.sales==='object'&&!Array.isArray(s.sales)?s.sales:{},n=v=>Number.isInteger(v)&&v>=0&&v<1e7?v:null;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function slAutoDay(d){if(!slAutoOn())return;const A=S.slAuto,p=slP(),w=Math.floo
|
|||
const won=o=>{if(S.offers.includes(o))return false;W.n++;W.rev+=Math.round(bizMo(o));dirty=true;return true;};
|
||||
opsQuiet(()=>{for(const o of S.offers.slice()){if(!S.offers.includes(o))continue;const T=BIZ_T[o.type];if(!T||!(o.exp>d))continue;const v=T.event?(o.fee||0):bizMo(o);
|
||||
if(A.min&&v<A.min){const b0=S.biz.length;ACT.decline({id:o.id});W.x++;if(S.biz.length>b0){W.y++;W.rev+=Math.round(bizMo(o));dirty=true;}continue;}
|
||||
if(!A.on)continue;
|
||||
if(!A.on||!ip4Fits(o))continue;
|
||||
if(T.orbit){const k=slSkyOk(o,used);if(!k||(p==='shark'&&S.cash<bizMo(o)))continue;ACT.accept({id:o.id});if(won(o))used.set(k,(used.get(k)||0)+o.bw);continue;}
|
||||
if(!bCities(o).every(popUp))continue;
|
||||
if(p==='shark'){if(S.cash<bizMo(o)||(T.event&&!(o.start>d)))continue;ACT.accept({id:o.id});won(o);continue;}
|
||||
|
|
|
|||
|
|
@ -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:{},
|
||||
ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ip4:ip4New(),ops:opsNew(),slAuto:slAutoNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{},
|
||||
done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0},mp:null};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -374,10 +374,11 @@ function computeMoney(R2,PX=null){
|
|||
C.wholesale=0;C.levy=0;const lev=scnRule('levy');for(const c in S.pops){const sf=sfOf(R2,c)*(R2.bbF[c]??1),v=R2.cityEye[c]*sf*EYE_RATE*arpuOf(c);V.eyeballs+=v;if(CITY[c].au){if(lev)C.levy+=v*AU_LEVY;else C.wholesale+=v*AU_WHOLESALE;}}
|
||||
const ids=linkIds();for(const b of S.biz){if(capPend(b)||BIZ_T[b.type].orbit)continue;const sf=BIZ_T[b.type].fiber?(fiberOk(b,ids)?1:0):BIZ_T[b.type].l2?clamp((R2.l2[b.id]||0)/b.bw,0,1):sfOf(R2,b.city)*(R2.tgtF[b.id]??1);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;
|
||||
ip4Money(C,V);
|
||||
if(PX)pieMoney(PX,R2,V);
|
||||
// The UK grant for Pitcairn, its satellite tier once orbit is known; the Rural Digital Pie Fund (99-pie-subsidies.js).
|
||||
{const on=grantOn(R2),sky=!on&&!!PX&&grantSky(R2);V.grant=on?GRANT_MO:sky?GRANT_SKY_MO:0;if(PX)V.gov=pieGovMo();if(PX)R2.pie.gov={rdf:V.gov||0,sky:sky?GRANT_SKY_MO:0};}
|
||||
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+(V.orbit||0));
|
||||
R2.costMo=Object.values(C).reduce((a,b)=>a+b,0);
|
||||
R2.revMo=V.eyeballs+V.business+V.ix+V.grant+(V.gov||0)+(V.orbit||0);
|
||||
R2.revMo=V.eyeballs+V.business+V.ix+V.grant+(V.gov||0)+(V.orbit||0)+(V.ip4||0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ function sanitize(s){
|
|||
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);mpSanitize(s);
|
||||
pieSanitize(s);pieIncFix(s);
|
||||
ip4Fix(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):'';}}
|
||||
return s;}
|
||||
function migrate(s){sanitize(s);
|
||||
|
|
|
|||
|
|
@ -58,14 +58,16 @@ function clRenew(b,rate){b.rate=Math.max(0,Math.round(rate));b.mk=mkt();delete b
|
|||
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;}
|
||||
// Growing: the next size up their type sells, or twice the bandwidth past the top one. Fiber grows by renewing. Not
|
||||
// when the bigger IPv4 block it needs is not free (#150): out.v4 lists them for the day's news.
|
||||
function clGrow(b,out){const T=BIZ_T[b.type];if(T.fiber)return false;const bw=(T.opts||[]).find(x=>x>b.bw)||b.bw*2;
|
||||
if(!ip4GrowOk(b,bw)){if(out)out.v4.push([b,bw]);return false;}b.bw=bw;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;}
|
||||
const C=S.cl;if(d-C.odd>=CL_ODD_GAP&&clR(b,'odd')<0.25){C.odd=d;clGone(b,'odd');out.lost.push(tr('lifecycle.left_odd',{...v,why:tr(clPick(CL_ODD,b,'oddline'))}));return;}
|
||||
const ks=Object.keys(CL_WHY).filter(k=>CL_WHY[k].ok(b.type)),k=clPick(ks,b,'why');
|
||||
if(k==='acq'&&clR(b,'acqbig')<0.3&&clGrow(b)){clRenew(b,clFair(b));clNote('grew');out.ok.push(tr('lifecycle.acquired_stays_bigger',{...v,bw:fmtG(b.bw)}));return;}
|
||||
if(k==='acq'&&clR(b,'acqbig')<0.3&&clGrow(b,out)){clRenew(b,clFair(b));clNote('grew');out.ok.push(tr('lifecycle.acquired_stays_bigger',{...v,bw:fmtG(b.bw)}));return;}
|
||||
if(k==='moved'){const reg=CITY[b.city].reg,to=Object.keys(S.pops).filter(c=>c!==b.city&&CITY[c].reg===reg&&bizCity(c)).sort();
|
||||
const c2=to.length&&clR(b,'stay')<0.5?clPick(to,b,'to'):null;
|
||||
if(c2){const from=CITY[b.city].name;b.city=c2;clRenew(b,clFair(b));clNote('ren');out.ok.push(tr('lifecycle.moved_stays',{name:v.name,from:esc(from),to:esc(CITY[c2].name)}));return;}}
|
||||
|
|
@ -75,7 +77,7 @@ function clLeave(b,d,out){const T=BIZ_T[b.type],v={name:esc(b.name),city:esc(clW
|
|||
/* A day of contracts, after the moods. 30 days before a term ends a customer with competitors around may ask for a
|
||||
discount (at most three open at a time); at the end, the rest renew, grow or leave. An unanswered haggle renews at
|
||||
the asked price. */
|
||||
function clDay(d){if(!S.cl)S.cl={odd:-1e9,mo:[]};const out={ren:0,grew:0,ok:[],lost:[],hag:[]};let open=S.biz.reduce((a,b)=>a+(b.hag?1:0),0);
|
||||
function clDay(d){if(!S.cl)S.cl={odd:-1e9,mo:[]};const out={ren:0,grew:0,ok:[],lost:[],hag:[],v4:[]};let open=S.biz.reduce((a,b)=>a+(b.hag?1:0),0);
|
||||
const pat=rule('moods')==='patient'?0.5:1;
|
||||
for(const b of S.biz.slice()){if(!b.te||!clOn(b))continue;
|
||||
if(b.hag){if(d>=b.hag.until){clRenew(b,b.hag.rate);clNote('ren');out.ren++;}continue;}
|
||||
|
|
@ -86,7 +88,7 @@ function clDay(d){if(!S.cl)S.cl={odd:-1e9,mo:[]};const out={ren:0,grew:0,ok:[],l
|
|||
continue;}
|
||||
const cf=Math.min(1,clComp(b)/6),u=(100-b.mood)/100,leave=(0.04+0.08*cf+0.35*u*u)*pat*salesLeaveMul(b);
|
||||
if(clR(b,'leave')<leave){clLeave(b,d,out);continue;}
|
||||
const g=clR(b,'grow');if((b.mood>=80&&g<0.3)||(b.mood>=60&&g<0.12)){if(clGrow(b)){clRenew(b,clFair(b));clNote('grew');out.grew++;out.ok.push(tr('lifecycle.renewed_and_grew',{name:esc(b.name),city:esc(clWhere(b)),bw:fmtG(b.bw)}));continue;}}
|
||||
const g=clR(b,'grow');if((b.mood>=80&&g<0.3)||(b.mood>=60&&g<0.12)){if(clGrow(b,out)){clRenew(b,clFair(b));clNote('grew');out.grew++;out.ok.push(tr('lifecycle.renewed_and_grew',{name:esc(b.name),city:esc(clWhere(b)),bw:fmtG(b.bw)}));continue;}}
|
||||
clRenew(b,clFair(b));clNote('ren');out.ren++;}
|
||||
clNews(out);clReferral(d);}
|
||||
// What the day says: haggles one by one (they want an answer), the rest in a few lines so a big network is not a wall of toasts.
|
||||
|
|
@ -94,7 +96,7 @@ function clNews(out){
|
|||
for(const b of out.hag){const was=bizMo(b),now=BIZ_T[b.type].fiber?b.hag.rate:b.bw*b.hag.rate;
|
||||
toast(tr('lifecycle.haggle',{name:esc(b.name),city:esc(clWhere(b)),price:fmt$(now),p:pct(1-now/Math.max(1,was)),n:b.hag.until-S.day}),'',[{l:tr('common.deals'),act:'leftTab',args:{t:'deals'}}],{a:'cust',v:b.id});}
|
||||
const few=(list,kind)=>{for(const t of list.slice(0,3))toast(t,kind);if(list.length>3)toast(trn('lifecycle.n_more',list.length-3),kind);};
|
||||
few(out.ok,'good');few(out.lost,'');
|
||||
few(out.ok,'good');ip4News(out.v4);few(out.lost,'');
|
||||
if(out.ren)toast(trn('lifecycle.n_renewed',out.ren,{p:mktTxt()}),'');}
|
||||
const mktTxt=()=>{const m=mkt();return Math.abs(m-1)<0.005?tr('lifecycle.market_as_start'):m<1?tr('lifecycle.market_below',{p:pct(1-m)}):tr('lifecycle.market_above',{p:pct(m-1)});};
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ function dayPost(d){
|
|||
scnTick(d);
|
||||
confTick(d);
|
||||
specDay(d);
|
||||
ip4Day(d);
|
||||
// money trouble
|
||||
if(S.cash<0){S.neg++;if(S.neg===1)toast(tr('day_tick.you_are_in_the_red_cancel'),'bad');}
|
||||
else S.neg=0;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Object.assign(ACT,{
|
|||
if(!w&&!p){toast(tr('customers.nothing_spare_to_sell_on_this'),'bad');sfx('err');return;}const L=l.list||(l.list={w:0,p:0});L.w+=w;L.p+=p;
|
||||
toast(tr('broker.listed',{a:CITY[l.a].name,b:CITY[l.b].name}),'good');sfx('click');after();},
|
||||
unlistFiber:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||!l.list)return;delete l.list;sfx('click');after();},
|
||||
accept:({id,auto=false})=>{const o=S.offers.find(x=>x.id===id);if(!o)return;const customer=auto?autoOffer(o):offerCustomer(o);if(!customer)return;if(!bHas(o)){toast(tr('customers.you_need_a_pop_in_every'),'bad');return;}
|
||||
accept:({id,auto=false})=>{const o=S.offers.find(x=>x.id===id);if(!o)return;if(!ip4Fits(o)){const n=ip4Need(o);toast(tr('ip4.no_space',{name:esc(o.name),p:ip4Cidr(n),n:ip4N(n),free:ip4N(Math.max(0,ip4Use().free))}),'bad',[{l:tr('ip4.section'),act:'ip4Open'}]);sfx('err');return;}const customer=auto?autoOffer(o):offerCustomer(o);if(!customer)return;if(!bHas(o)){toast(tr('customers.you_need_a_pop_in_every'),'bad');return;}
|
||||
if(o.type==='wwave'){const l=S.links.find(x=>x.id===o.link);if(!l||chMax(l)-(l.ch||[]).length-soldSlots(l)<o.slots){toast(tr('customers.not_enough_free_channels_on_that'),'bad');return;}}
|
||||
if(BIZ_T[o.type].event&&S.day>=o.start){toast(tr('customers.too_late_the_event_has_already'),'bad');return;}
|
||||
// A carrier renting more alien waves on a fiber it already rents grows its contract, like a real order for extra waves,
|
||||
|
|
|
|||
29
src/game/90-actions/54-address-space.js
Normal file
29
src/game/90-actions/54-address-space.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/* Address space (#150, 33-address-space.js): buy, lease in, lease out, sell, hand back, and the CGNAT ratio. Every block
|
||||
change keeps room for the customers already signed, with every home behind CGNAT. */
|
||||
const ip4Re=()=>{after();renderBank();};
|
||||
function ip4Can(){if(ip4On())return true;toast(tr('ip4.off'),'bad');sfx('err');return false;}
|
||||
const ip4Blk=id=>S.ip4.b.find(b=>b.id===id);
|
||||
function ip4Busy(){toast(tr('ip4.in_use'),'bad');sfx('err');}
|
||||
// No more blocks than a save keeps (IP4_BLK): a new one is refused with the way out.
|
||||
function ip4Room(){if(!ip4Full())return true;toast(tr('ip4.too_many',{n:IP4_BLK}),'bad');sfx('err');return false;}
|
||||
Object.assign(ACT,{
|
||||
ip4Open:()=>{if(!S||pzOn()||!ip4On())return;if(!$('modal').hidden)closeModal();ACT.bank();const g=$('bankIp4');if(g&&g.scrollIntoView)g.scrollIntoView({block:'start'});},
|
||||
// The size the market rows quote (a dropdown: v is the prefix length).
|
||||
ip4Pick:({v})=>{const len=Number(v);if(ip4LenOk(len))UI.ip4Len=len;renderBank();},
|
||||
ip4Buy:({len})=>{if(!ip4Can())return;len=Number(len);if(!ip4LenOk(len)||!ip4Room())return;const c=ip4Cost(len);if(!spend(c))return;
|
||||
S.ip4.b.push({id:uid(),len,k:'buy',d:S.day});toast(tr('ip4.bought',{p:'/'+len,n:ip4N(ip4Sz(len)),price:fmt$(c)}),'good');sfx('coin');ip4Re();},
|
||||
ip4Lease:({len})=>{if(!ip4Can())return;len=Number(len);if(!ip4LenOk(len)||!ip4Room())return;const mo=ip4InMo(len);
|
||||
S.ip4.b.push({id:uid(),len,k:'in',d:S.day,mo});toast(tr('ip4.leased_in',{p:'/'+len,n:ip4N(ip4Sz(len)),price:fmt$(mo)}),'good');sfx('click');ip4Re();},
|
||||
ip4Sell:({id})=>{if(!ip4Can())return;const b=ip4Blk(id);if(!b||b.k==='in'||b.out)return;
|
||||
if(ip4Held(b)){toast(tr('ip4.held',{date:dateStr(b.d+IP4_HOLD)}),'bad');sfx('err');return;}if(!ip4Spare(b)){ip4Busy();return;}
|
||||
if(UI.confirm!==id){UI.confirm=id;renderBank();return;}UI.confirm=null;const v=ip4Value(b.len);S.ip4.b=S.ip4.b.filter(x=>x!==b);S.cash+=v;
|
||||
toast(tr('ip4.sold',{p:'/'+b.len,price:fmt$(v)}),'good');sfx('coin');ip4Re();},
|
||||
ip4Out:({id})=>{if(!ip4Can())return;const b=ip4Blk(id);if(!b||b.k==='in'||b.out)return;if(!ip4Spare(b)){ip4Busy();return;}
|
||||
b.out=true;b.mo=ip4OutMo(b.len);toast(tr('ip4.leased_out',{p:'/'+b.len,price:fmt$(b.mo)}),'good');sfx('coin');ip4Re();},
|
||||
ip4Back:({id})=>{if(!ip4Can())return;const b=ip4Blk(id);if(!b||!b.out)return;delete b.out;delete b.mo;sfx('click');ip4Re();},
|
||||
ip4Return:({id})=>{if(!ip4Can())return;const b=ip4Blk(id);if(!b||b.k!=='in')return;if(!ip4Spare(b)){ip4Busy();return;}
|
||||
S.ip4.b=S.ip4.b.filter(x=>x!==b);sfx('click');ip4Re();},
|
||||
// Fewer homes per address needs more addresses: refused when the customers already signed would not fit.
|
||||
ip4Nat:({v})=>{if(!ip4Can())return;const r=Number(v);if(!IP4_NAT.includes(r)||r===S.ip4.nat)return;const u=ip4Use();
|
||||
if(r<S.ip4.nat&&u.T-u.B<Math.ceil(u.H/r)){ip4Busy();UI._bh=null;renderBank();return;}S.ip4.nat=r;sfx('click');ip4Re();},
|
||||
});
|
||||
|
|
@ -47,7 +47,7 @@ function renderLeft(){checkLayer();
|
|||
{const lv=S.lvl||1,nx=LEVELS[lv];h+=`<div class="inc" style="background:var(--tint-y,#FFF6CF)"><div class="nm">${tr('hud_and_panels.customer_level_lv_name',{lv,name:LEVELS[lv-1].n})}</div><div class="meta">${nx?tr('hud_and_panels.next_req_unlocks_what',{req:nx.req,what:lc1(nx.unlock)}):tr('common.every_customer_type_is_unlocked_go')}</div></div>`;}
|
||||
if(!S.offers.length)h+=`<p class="empty">${tr('hud_and_panels.no_open_offers_right_now_businesses')}</p>`;
|
||||
for(const o of S.offers.slice().sort((a,b)=>a.exp-b.exp)){const has=bHas(o);
|
||||
h+=`<div class="row"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · <b>${bTerms(o)}</b> · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}</div>${o.refN?`<div class="meta">${tr('lifecycle.referred_by',{name:esc(o.refN)})}</div>`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}
|
||||
h+=`<div class="row"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · <b>${bTerms(o)}</b> · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}</div>${o.refN?`<div class="meta">${tr('lifecycle.referred_by',{name:esc(o.refN)})}</div>`:''}${spotWhy(o)}${ip4Why(o)}${bRisk(o)}${reqList(o)}
|
||||
<div class="btns">${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')}</div>${has?'':`<div class="why">${tr('hud_and_panels.needs_a_pop_in_cities',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div></div>`;}
|
||||
}else if(UI.left==='noc'){
|
||||
h+=`<div class="btns" style="margin-bottom:8px">${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${pieNocBtn()}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'<span class="cnt red dot" aria-hidden="true"></span>':''}`,'routingOpen',{},'')}</div>`;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ function dfPanel(l){
|
|||
}
|
||||
function offersHere(c){
|
||||
const os=S.offers.filter(o=>bCities(o).includes(c));if(!os.length)return '';
|
||||
return `<section><h3>${tr('common.offers_here')}</h3>${os.map(o=>`<div class="row${o.id===UI.offerAt?' on':''}"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${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})}</div>${spotWhy(o)}${R.reach<0.99&&!BIZ_T[o.type].l2?`<div class="why">${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}</div>`:''}${o.type==='scrub'&&!hasScrub()?`<div class="why">${tr('link_panels.needs_your_own_scrubbing_center')}</div>`:''}${bRisk(o)}${reqList(o)}${bHas(o)?'':`<div class="why">${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div>${bHas(o)?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}</div>`).join('')}</section>`;
|
||||
return `<section><h3>${tr('common.offers_here')}</h3>${os.map(o=>`<div class="row${o.id===UI.offerAt?' on':''}"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${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})}</div>${spotWhy(o)}${R.reach<0.99&&!BIZ_T[o.type].l2?`<div class="why">${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}</div>`:''}${o.type==='scrub'&&!hasScrub()?`<div class="why">${tr('link_panels.needs_your_own_scrubbing_center')}</div>`:''}${ip4Why(o)}${bRisk(o)}${reqList(o)}${bHas(o)?'':`<div class="why">${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div>${bHas(o)?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}</div>`).join('')}</section>`;
|
||||
}
|
||||
function linkPanel(id){
|
||||
const l=S.links.find(x=>x.id===id);if(!l){UI.sel=null;return '';}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function renderDash(){checkLayer();
|
|||
<div class="dgrid">${tile(tr('common.traffic_now'),fmtG(R.served),tr('dashboard.of_g_wanted',{g:fmtG(R.demand)}))}${tile(tr('common.peak'),fmtG(S.stats.peak))}${tile(tr('dashboard.delivered_30_days'),(up*100).toFixed(1)+'%',up>=0.999?tr('dashboard.five_nines_ish'):up>=0.99?tr('dashboard.two_nines_and_change'):tr('dashboard.customers_are_upset'))}${tile(tr('common.peering_ratio'),pct(R.peerShare||0),tr('dashboard.caches_pnis_and_ix'))}${tile(tr('dashboard.monthly_p_l'),`<span style="color:${net>=0?'var(--eye)':'var(--bad)'}">${net>=0?'+':''}${fmt$(net)}</span>`,tr('dashboard.in_in_out_out',{in:fmt$(R.revMo),out:fmt$(R.costMo)}))}${tile(tr('common.incidents'),S.stats.incidents,tr('dashboard.n_shrugged_off',{n:S.stats.survived}))}</div>
|
||||
<div class="dcols"><div class="panel2"><h3>${tr('dashboard.traffic_by_way_out')}</h3>${svgChart(rows,['c','p','ix','t','l2'],[{k:'dem',col:'var(--text)',dash:true}],v=>fmtCap(Math.round(v)),'traffic')}${chartLegend('traffic',k=>k==='dem'?'':' '+pct((R.egT[k]||0)/tot))}</div>
|
||||
<div class="panel2"><h3>${tr('dashboard.money_per_month')}</h3>${svgChart(rows,[],[{k:'rev',col:'#16A866'},{k:'cost',col:'#FF4D5E'}],v=>fmt$(v),'money')}${chartLegend('money')}
|
||||
<h3 style="margin-top:8px">${tr('dashboard.where_the_money_goes')}</h3>${Object.entries(R.cost).filter(([k,v])=>v>0).sort((a,b)=>b[1]-a[1]).map(([k,v])=>`<div class="kv"><span>${{pops:tr('dashboard.pops_and_routers'),links:tr('dashboard.waves_and_fiber'),transit:tr('common.transit'),ix:tr('common.ix_ports'),pni:tr('common.pnis'),caches:tr('common.cache_power'),nni:tr('common.fabric_ports'),optical:tr('dashboard.amp_huts_and_spares'),loans:tr('common.loan_repayments'),revshare:tr('dashboard.investor_revenue_share'),extras:tr('dashboard.licenses_and_scrubbing'),wholesale:tr('dashboard.nearly_broadband_network_wholesale'),levy:tr('dashboard.regional_broadband_levy'),pie:tr('pie.costs_row')}[k]||k}</span><b>${tr('common.price_mo',{price:fmt$(v)})}</b></div>`).join('')}</div></div>`;
|
||||
<h3 style="margin-top:8px">${tr('dashboard.where_the_money_goes')}</h3>${Object.entries(R.cost).filter(([k,v])=>v>0).sort((a,b)=>b[1]-a[1]).map(([k,v])=>`<div class="kv"><span>${{pops:tr('dashboard.pops_and_routers'),links:tr('dashboard.waves_and_fiber'),transit:tr('common.transit'),ix:tr('common.ix_ports'),pni:tr('common.pnis'),caches:tr('common.cache_power'),nni:tr('common.fabric_ports'),optical:tr('dashboard.amp_huts_and_spares'),loans:tr('common.loan_repayments'),revshare:tr('dashboard.investor_revenue_share'),extras:tr('dashboard.licenses_and_scrubbing'),wholesale:tr('dashboard.nearly_broadband_network_wholesale'),levy:tr('dashboard.regional_broadband_levy'),pie:tr('pie.costs_row'),ip4:tr('ip4.costs_row')}[k]||k}</span><b>${tr('common.price_mo',{price:fmt$(v)})}</b></div>`).join('')}</div></div>`;
|
||||
const tT=(R.egT.t||0)||1;
|
||||
const offMix=(UI.chartOff&&UI.chartOff.mix)||{},filt=Object.keys(offMix).length>0;
|
||||
// The legend above the table picks which ways in count; "lost" still looks at everything the network gets.
|
||||
|
|
@ -28,7 +28,7 @@ function renderDash(){checkLayer();
|
|||
const rs=Object.keys(S.pops).map(c=>({c,u:(R.nodeLoad[c]||0)/(R.nodeCap[c]||1)})).sort((a,b)=>b.u-a.u).slice(0,6);
|
||||
if(DT==='infra')h+=`<div class="dcols" style="margin-top:12px"><div class="panel2"><h3>${tr('common.busiest_links')}</h3>${ls.length?ls.map(({l,u})=>`<div class="row"><div class="grow"><div class="nm">${CITY[l.a].name} ⇄ ${CITY[l.b].name} <span class="meta">${capName(l)} · ${linkLat(l).toFixed(1)} ms</span></div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div></div><b class="num" style="min-width:42px;text-align:right">${pct(u)}</b>${btn(tr('common.open'),'dashLink',{id:l.id},'ghost sm')}</div>`).join(''):'<p class="empty">'+tr('common.no_links_yet')+'</p>'}</div>
|
||||
<div class="panel2"><h3>${tr('common.router_load')}</h3>${rs.map(({c,u})=>`<div class="row"><div class="grow"><div class="nm">${CITY[c].name} <span class="meta">${(S.pops[c].routers||1)} × ${esc(RG[S.pops[c].rgen||0].n)}</span></div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div></div><b class="num" style="min-width:42px;text-align:right">${pct(u)}</b></div>`).join('')}
|
||||
<h3 style="margin-top:10px">${tr('common.your_as')}</h3><div class="kv"><span>${tr('common.as_number')}</span><b>AS${S.asn}</b></div><div class="kv"><span>${tr('common.prefixes')}</span><b>${Math.max(1,Math.ceil(Object.keys(S.pops).length/3))} × /22 IPv4, 1 × /32 IPv6</b></div><div class="kv"><span>${tr('common.bgp_sessions')}</span><b>${R.sessions}</b></div><div class="kv"><span>${tr('common.upstreams')}</span><b>${new Set(S.transit.map(t=>t.net)).size}</b></div><div class="kv"><span>${tr('common.reach')}</span><b>${pct(R.reach)}</b></div><div class="kv"><span>${tr('common.customers')}</span><b>${tr('dashboard.n_businesses',{n:S.biz.length})}</b></div></div></div>`;
|
||||
<h3 style="margin-top:10px">${tr('common.your_as')}</h3><div class="kv"><span>${tr('common.as_number')}</span><b>AS${S.asn}</b></div><div class="kv"><span>${tr('common.prefixes')}</span><b>${(ip4On()&&ip4Pfx())||Math.max(1,Math.ceil(Object.keys(S.pops).length/3))+' × /22'} IPv4, 1 × /32 IPv6</b></div><div class="kv"><span>${tr('common.bgp_sessions')}</span><b>${R.sessions}</b></div><div class="kv"><span>${tr('common.upstreams')}</span><b>${new Set(S.transit.map(t=>t.net)).size}</b></div><div class="kv"><span>${tr('common.reach')}</span><b>${pct(R.reach)}</b></div><div class="kv"><span>${tr('common.customers')}</span><b>${tr('dashboard.n_businesses',{n:S.biz.length})}</b></div></div></div>`;
|
||||
if(DT==='pops')h+=popsSection();
|
||||
if(DT==='lease')h+=leaseTab();
|
||||
if(h!==UI._dh){UI._dh=h;morph($('dashCard'),h);}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@ function renderBank(){
|
|||
${B.equity?`<div class="meta">${tr('bank.taking_pct_of_your_revenue_every',{pct:pct(l.share)})}</div>`:`<div class="kv"><span>${tr('common.still_owed')}</span><b>${fmt$(l.bal)}</b></div><div class="bar me"><i style="width:${Math.min(100,(1-l.bal/l.amount)*100)}%"></i></div><div class="meta">${loanLine(l)}</div>`}
|
||||
${covList(l)}${l.breach>=1?`<div class="why">${trn('bank.condition_broken_for_n_day',l.breach)} ${l.breach<10?tr('bank.penalty_in_n_days',{n:10-l.breach}):tr('bank.penalties_are_running')}</div>`:''}
|
||||
<div class="btns" style="margin-top:6px">${btn(UI.confirm===l.id?tr('bank.really_pay_price',{price:fmt$(cost)}):B.equity?tr('bank.buy_them_out_price',{price:fmt$(cost)}):tr('bank.repay_early_price_incl_2_fee',{price:fmt$(cost)}),'repayLoan',{id:l.id},UI.confirm===l.id?'red sm':'sm',S.cash<cost)}</div></div></div>`;}
|
||||
h+=pieGovBank();
|
||||
h+=pieGovBank()+ip4Bank();
|
||||
if(h!==UI._bh){UI._bh=h;$('bankCard').innerHTML=h;}
|
||||
}
|
||||
|
|
|
|||
22
src/game/94-dashboard/72-address-space.js
Normal file
22
src/game/94-dashboard/72-address-space.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* The bank's Address space section (#150, 33-address-space.js): what you hold and who uses it, the CGNAT ratio, your
|
||||
blocks, and the transfer market. Phones: the boxes are full width, the dropdowns stack and every button row wraps. */
|
||||
const ip4Pc=x=>(x*100).toFixed(1).replace(/\.0$/,'')+'%';
|
||||
function ip4Bank(){if(!S||!ip4On())return '';const I=S.ip4,B=ip4Bill((R.rev&&R.rev.eyeballs)||0),u=B.u,len=ip4LenOk(UI.ip4Len)?UI.ip4Len:IP4_MAX,px=ip4Px(),full=ip4Full();
|
||||
const kv=(l,v,bad)=>`<div class="kv"><span>${l}</span><b${bad?' style="color:var(--bad)"':''}>${v}</b></div>`,mo=v=>tr('common.price_mo',{price:fmt$(v)});
|
||||
let h=`<section class="bank-gov bank-ip4"><h3 id="bankIp4" style="font-size:18px;margin-top:14px">🔢 ${tr('ip4.section')}</h3><p class="meta">${tr('ip4.note')}</p>`;
|
||||
h+=`<div class="ops-o">${kv(tr('ip4.yours'),ip4N(u.T))}${kv(tr('ip4.business'),ip4N(u.B))}${kv(tr('ip4.homes'),u.cg?tr('ip4.homes_cgnat',{n:ip4N(u.H),p:pct(u.cg/u.H)}):ip4N(u.H))}${kv(tr('ip4.free'),ip4N(Math.max(0,u.free)),u.free<=0)}`;
|
||||
if(u.over>0)h+=`<div class="why">${tr('ip4.squeezed',{p:pct(u.over),r:u.r})}</div>`;
|
||||
if(B.lin>0)h+=kv(tr('ip4.leases_in'),mo(B.lin));if(B.box>=1)h+=kv(tr('ip4.cgnat_boxes'),mo(B.box));if(B.refund>=1)h+=kv(tr('ip4.refunds'),mo(B.refund));if(B.lout>0)h+=kv(tr('ip4.leases_out'),'+'+mo(B.lout));
|
||||
h+=`<label class="ops-sel" style="margin-top:6px"><span>${tr('ip4.cgnat_ratio')}</span><select data-chg="ip4Nat">${IP4_NAT.map(r=>`<option value="${r}"${r===I.nat?' selected':''}>${trn('ip4.n_homes_per_address',r)}</option>`).join('')}</select></label>
|
||||
<p class="meta">${tr('ip4.cgnat_note',{p:ip4Pc(IP4_ANNOY[I.nat])})}</p></div>`;
|
||||
h+=`<div class="ops-o"><div class="nm">${tr('ip4.blocks')}</div>`;
|
||||
for(const b of I.b){const n=ip4Sz(b.len),spare=u.free>=n,held=ip4Held(b),sure=UI.confirm===b.id;
|
||||
const what=b.k==='in'?tr('ip4.leased_in_mo',{price:fmt$(b.mo||0)}):b.out?tr('ip4.leased_out_mo',{price:fmt$(b.mo||0)}):b.k==='buy'?tr('ip4.bought_on',{date:dateStr(b.d)}):tr('ip4.from_rir');
|
||||
const btns=b.k==='in'?btn(tr('ip4.give_back'),'ip4Return',{id:b.id},'ghost sm',!spare):b.out?btn(tr('ip4.take_back'),'ip4Back',{id:b.id},'ghost sm')
|
||||
:btn(tr('ip4.lease_out',{price:fmt$(ip4OutMo(b.len))}),'ip4Out',{id:b.id},'sm',!spare)+btn(sure?tr('ip4.really_sell',{price:fmt$(ip4Value(b.len))}):tr('ip4.sell',{price:fmt$(ip4Value(b.len))}),'ip4Sell',{id:b.id},sure?'red sm':'ghost sm',held||!spare);
|
||||
// Greyed for want of room: say so (a disabled button never gets to show ip4Busy's toast).
|
||||
h+=`<div class="row"><div class="grow"><div class="nm">/${b.len} · ${trn('ip4.n_addresses',n,{n:ip4N(n)})}</div><div class="meta">${what}${held&&!b.out?' · '+tr('ip4.movable_from',{date:dateStr(b.d+IP4_HOLD)}):''}</div>${!spare&&!b.out?`<div class="why">${tr('ip4.in_use')}</div>`:''}<div class="btns">${btns}</div></div></div>`;}
|
||||
h+=`</div><div class="ops-o"><div class="nm">${tr('ip4.market')}</div><p class="meta">${tr('ip4.market_note',{px:fmt$(px),lin:'$'+(IP4_IN*px/IP4_PX).toFixed(2),lout:'$'+(IP4_OUT*px/IP4_PX).toFixed(2),p:pct(IP4_SELL)})}</p>
|
||||
<label class="ops-sel"><span>${tr('ip4.block_size')}</span><select data-chg="ip4Pick">${Array.from({length:IP4_MAX-IP4_MIN+1},(_,i)=>IP4_MAX-i).map(l=>`<option value="${l}"${l===len?' selected':''}>/${l} · ${trn('ip4.n_addresses',ip4Sz(l),{n:ip4N(ip4Sz(l))})}</option>`).join('')}</select></label>
|
||||
${full?`<div class="why">${tr('ip4.too_many',{n:IP4_BLK})}</div>`:''}<div class="btns">${btn(tr('ip4.buy',{price:fmt$(ip4Cost(len))}),'ip4Buy',{len},'pink sm',full||S.cash<ip4Cost(len))}${btn(tr('ip4.lease',{price:fmt$(ip4InMo(len))}),'ip4Lease',{len},'sm',full)}</div></div></section>`;
|
||||
return h;}
|
||||
|
|
@ -43,7 +43,7 @@ function whatsNew(returning,force){
|
|||
const DOORS=[['puzzle','🧩',tr('title.puzzles'),tr('title.one_network_one_knot_no_clock')],['sandbox','🏖️',tr('common.sandbox'),tr('title.a_billion_dollars_and_every_toy')],['normal','📟',tr('common.normal'),tr('title.the_real_game_climb_from_tier')],['scn','🏆',tr('title.scenarios_amp_weekly'),tr('title.hand_built_crises_and_one_world')]];
|
||||
const doorAct={puzzle:'puzzleDoor',sandbox:'modeSet',normal:'modeSet',scn:'scenarios'};
|
||||
// The chosen preset in one line: its joke, then what actually changes.
|
||||
const presetWhat=k=>`${esc(PRESETS[k].d)} <span class="meta">${esc(PRESETS[k].x)}</span>`;
|
||||
const presetWhat=k=>`${esc(PRESETS[k].d)} <span class="meta">${esc(PRESETS[k].x)} ${PRESETS[k].ip4===false?tr('ip4.preset_plenty'):tr('ip4.preset_scarce')}</span>`;
|
||||
// The Normal presets, one toggle each: on the title screen, and for a multiplayer session (48-multiplayer.js).
|
||||
const presetBtns=pr=>`<label class="f">${tr('title.how_much_trouble')}</label><div class="presets">${NORMAL_PRESETS.map(k=>{const P=PRESETS[k];return `<button class="preset${k===pr?' on':''}" data-preset="${k}" data-act="presetSet" data-args='{"p":"${k}"}' aria-pressed="${k===pr}"><i aria-hidden="true">${P.i}</i><b>${P.n}</b></button>`;}).join('')}</div><p class="note" id="presetWhat">${presetWhat(pr)}</p>`;
|
||||
function doorsHtml(){const m=UI.mode==='sandbox'?'sandbox':'normal',pr=own(PRESETS,UI.preset)&&NORMAL_PRESETS.includes(UI.preset)?UI.preset:'oncall',ch=own(CHAOS,UI.sbChaos)?UI.sbChaos:'none';
|
||||
|
|
|
|||
|
|
@ -2639,6 +2639,54 @@
|
|||
"interface.tubecoin_moved_down_p_on_the":"TubeCoin moved down {p}% on the way to your account.",
|
||||
"interface.tubecoin_moved_up_p_on_the":"TubeCoin moved up {p}% on the way to your account.",
|
||||
"interface.you_bought_out_bank_they_flew":"<b>You bought out {bank}.</b><br>They flew off to find another startup.",
|
||||
"ip4.block_size":"Block size",
|
||||
"ip4.blocks":"Your blocks",
|
||||
"ip4.bought":"Bought a {p} ({n} addresses) for {price}.",
|
||||
"ip4.bought_on":"Bought {date}",
|
||||
"ip4.business":"Used by business customers",
|
||||
"ip4.buy":"Buy {price}",
|
||||
"ip4.cgnat_boxes":"CGNAT boxes",
|
||||
"ip4.cgnat_note":"More homes per address frees space for customers, but games and port forwarding suffer: {p} of a CGNAT home's bill comes back as refunds.",
|
||||
"ip4.cgnat_ratio":"CGNAT: homes sharing one address",
|
||||
"ip4.costs_row":"IPv4 leases and CGNAT",
|
||||
"ip4.free":"Free for new customers (homes move behind CGNAT first)",
|
||||
"ip4.from_rir":"From the RIR",
|
||||
"ip4.give_back":"Give it back",
|
||||
"ip4.held":"The RIR won't transfer that block again before {date}.",
|
||||
"ip4.homes":"Broadband homes",
|
||||
"ip4.homes_cgnat":"{n}, {p} behind CGNAT",
|
||||
"ip4.in_use":"Your customers need those addresses: put more homes behind CGNAT or get another block first.",
|
||||
"ip4.lease":"Lease {price}/mo",
|
||||
"ip4.lease_out":"Lease out +{price}/mo",
|
||||
"ip4.leased_in":"Leased a {p} ({n} addresses) for {price}/mo.",
|
||||
"ip4.leased_in_mo":"Leased in · {price}/mo",
|
||||
"ip4.leased_out":"Your {p} is leased out: +{price}/mo.",
|
||||
"ip4.leased_out_mo":"Leased out · +{price}/mo",
|
||||
"ip4.leases_in":"Blocks leased in",
|
||||
"ip4.leases_out":"Blocks leased out",
|
||||
"ip4.market":"Transfer market",
|
||||
"ip4.market_note":"IPv4 sells for about {px} an address (big blocks a little less), leases for {lin} an address a month, and earns {lout} leased out after the broker's cut. A sale pays {p} of the price, and a block can only move again two years after its last transfer.",
|
||||
"ip4.movable_from":"can move again from {date}",
|
||||
"ip4.n_addresses":{"one":"{n} address","other":"{n} addresses"},
|
||||
"ip4.n_homes_per_address":{"one":"{n} home per address","other":"{n} homes per address"},
|
||||
"ip4.no_grow":"{name} ({city}) wanted to grow to {bw}, but you had no IPv4 addresses free for it.",
|
||||
"ip4.no_space":"{name} needs a {p} of IPv4 ({n} addresses), and only {free} are free. Buy or lease a block, or put more homes behind CGNAT.",
|
||||
"ip4.note":"IPv6 is free and endless. IPv4 ran out years ago: business customers need public blocks of it, and homes that don't fit share addresses behind CGNAT (IPv6 traffic goes around the box).",
|
||||
"ip4.off":"IPv4 is plentiful under this game's rules.",
|
||||
"ip4.offer_needs":"Needs a {p} of IPv4 ({n} addresses); only {free} free.",
|
||||
"ip4.preset_plenty":"Plenty of IPv4 for everyone.",
|
||||
"ip4.preset_scarce":"IPv4 is scarce: buy it, lease it or share it behind CGNAT.",
|
||||
"ip4.really_sell":"Really sell for {price}?",
|
||||
"ip4.refunds":"Refunds to grumpy gamers",
|
||||
"ip4.section":"Address space",
|
||||
"ip4.sell":"Sell {price}",
|
||||
"ip4.sold":"Sold your {p} for {price}.",
|
||||
"ip4.squeezed":"Out of space: {p} of homes don't fit even at {r} homes per address. Their connections break and they want refunds: buy or lease a block.",
|
||||
"ip4.take_back":"Take it back",
|
||||
"ip4.toast_cgnat":"<b>Your IPv4 is full.</b> {p} of your homes now share addresses behind CGNAT, and a few gamers have already written in.",
|
||||
"ip4.toast_out":"<b>Out of IPv4.</b> Even at {r} homes per address, CGNAT can't fit everyone: buy or lease a block at the bank.",
|
||||
"ip4.too_many":"You hold {n} IPv4 blocks, the most one network can keep track of. Sell or give back small ones to make room for a bigger block.",
|
||||
"ip4.yours":"Your IPv4 addresses",
|
||||
"ix_downgrade.pni_downgraded":"The PNI with {net} in {city} is now {port}.",
|
||||
"ix_downgrade.port_downgraded_at_ix":"Port at {ix} is now {port}.",
|
||||
"ix_downgrade.transit_downgraded":"{net} transit in {city} is now {port}.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue