Merge remote-tracking branch 'upstream/main' into own-carrier-egress
This commit is contained in:
commit
a469844f61
42 changed files with 757 additions and 42 deletions
|
|
@ -18,6 +18,12 @@ const AU_TRANSIT=3,AU_WAVE={land:1.8,sub:2.6,ew:1.3},AU_IX=0.8,AU_ARPU=1.8,AU_WH
|
|||
// Fibre to the Basement: on your own fibre you skip the wholesale cut, but competing networks pay the
|
||||
// Regional Broadband Scheme levy instead (about $7 a month on a ~$90 bill).
|
||||
const AU_LEVY=0.08;
|
||||
/* The Philippines: few, thin routes out and an incumbent that owns most of them. 100 GigE transit in Manila
|
||||
costs about 1.9 times Jakarta's (TeleGeography, 2026: $2.25 against $1.21 per Mbps), so the islands pay
|
||||
1.9 times the Asian rate. Homes pay about ₱1,450 (US$25) a month, the incumbent's own figure (PLDT, 2025).
|
||||
Between the islands capacity is dearer than out of the country: a Manila–Cebu wave costs about what
|
||||
Manila–Singapore does, twice Manila–Hong Kong. */
|
||||
const PH_TRANSIT=4.7,PH_ARPU=0.7,PH_WAVE=3.7;
|
||||
const SITE2_COST=45000,SITE2_MO=3000,TE_COST=60000,TE_MO=4000;
|
||||
const SITE2_N=[tr('economy.the_other_building'),tr('economy.campus_b_the_one_with_parking'),tr('economy.across_the_river_dc'),tr('common.the_annex'),tr('economy.suburban_mega_shed'),tr('economy.the_cheaper_one'),tr('economy.formerly_a_shopping_mall'),tr('common.bunker_two')];
|
||||
// A city's buildings: '#' becomes a site number from 1 to dcN (dc2N for the second building) that stays put for this network.
|
||||
|
|
|
|||
|
|
@ -79,4 +79,9 @@ LANDS_LL.push(
|
|||
LANDS_LL.push(
|
||||
{id:'mv',ll:[[73.11,4.48],[73.91,4.48],[73.91,3.88],[73.11,3.88]]},
|
||||
);
|
||||
// The Visayas and Mindanao: Cebu and Davao are islands of their own, reached from Luzon only by cable.
|
||||
LANDS_LL.push(
|
||||
{id:'ceb',ll:[[123.3,11.3],[124.1,11.3],[124.1,9.4],[123.3,9.4]]},
|
||||
{id:'mdn',ll:[[121.9,7],[123,8.4],[125.4,9.8],[126.6,7.5],[126.2,5.6],[125,5.6],[122,6.6]]},
|
||||
);
|
||||
const LANDS=LANDS_LL.map(l=>({id:l.id,hide:true,pts:l.ll.map(q=>proj(q[0],q[1]))}));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -44,6 +44,7 @@ const CITY_LL={
|
|||
"cbo":[80.0, 6.95],
|
||||
"cbr":[149.13,-35.28],
|
||||
"ccs":[-66.9,10.49],
|
||||
"ceb":[123.89,10.32],
|
||||
"cgb":[-56.1,-15.6],
|
||||
"cgr":[-54.65,-20.47],
|
||||
"chc":[172.55,-43.53],
|
||||
|
|
@ -70,6 +71,7 @@ const CITY_LL={
|
|||
"dur":[31.03,-29.86],
|
||||
"dus":[6.78,51.22],
|
||||
"dut":[-166.53,53.88],
|
||||
"dvo":[125.6,7.08],
|
||||
"dxb":[55.27,25.2],
|
||||
"dyr":[177.4,64.7],
|
||||
"ebj":[8.52,55.48],
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const CITIES=[
|
|||
{id:'akl',name:'Auckland',x:1964,y:826,land:'nz',reg:'OC',cc:'NZ',P:250,ix:'Kiwi-IX',dc:'Sheep-cooled Shed',note:tr('cities.far_from_everything_every_packet')},
|
||||
{id:'per',name:'Perth',x:1712,y:785,land:'oc',reg:'OC',cc:'AU',au:true,arpu:AU_ARPU,P:200,ix:'Beard-IX',dc:'Very Remote DC',dc2:'Next-Door-DC P#',dc2N:2,note:tr('cities.the_most_isolated_big_city_on')},
|
||||
{id:'jkt',name:'Jakarta',x:1614,y:624,land:'idn',reg:'AS',cc:'ID',P:900,ix:'Nasi-IX',dc:'Monsoon-proof DC',note:tr('cities.270_million_people_on_17_000')},
|
||||
{id:'mnl',name:'Manila',x:1714,y:494,land:'ph',reg:'AS',cc:'PH',P:600,ix:'',dc:'Typhoon-rated DC',note:tr('cities.typhoons_earthquakes_and_a_lot_of')},
|
||||
{id:'mnl',name:'Manila',x:1714,y:494,land:'ph',reg:'AS',cc:'PH',ph:true,arpu:PH_ARPU,P:1000,ix:'GotchaFIX Manila',ixCheap:1.8,dc:'Typhoon-rated DC',note:tr('cities.typhoons_earthquakes_and_a_lot_of')},
|
||||
{id:'ber',name:'Berlin',x:0,y:0,land:'eu',reg:'EU',cc:'DE',P:450,ix:'Currywurst-IX',dc:'Former Brewery DC',note:tr('cities.startups_techno_and_a_surprising')},
|
||||
{id:'ham',name:'Hamburg',x:0,y:0,land:'eu',reg:'EU',cc:'DE',P:250,ix:'Moin-IX',dc:'Speicherstadt Colo',note:tr('cities.germany_s_port_city_everyone_says')},
|
||||
{id:'dus',name:'Düsseldorf',x:0,y:0,land:'eu',reg:'EU',cc:'DE',P:300,ix:'Altbier-IX',dc:'Königsallee Cage',note:tr('cities.the_rhine_ruhr_hub_more_carrier')},
|
||||
|
|
@ -240,6 +240,9 @@ const CITIES=[
|
|||
{id:'mct',name:'Muscat',x:0,y:0,land:'eu',reg:'AS',cc:'OM',P:50,ix:'Halwa-IX',dc:'Frankincense Colo',note:tr('cities.oman_s_capital_just_outside_the')},
|
||||
{id:'mle',name:'Malé',x:0,y:0,land:'mv',reg:'AS',cc:'MV',P:4,ix:'',dc:'One-Metre-Up DC',note:tr('cities.the_maldives_capital_a_stop_on')},
|
||||
{id:'fuk',name:'Fukuoka',x:0,y:0,land:'jp',reg:'AS',cc:'JP',P:120,ix:'Mentaiko-IX',dc:'Hakata Ramen Racks',note:tr('cities.japan_s_closest_city_to_korea')},
|
||||
// The Philippines beyond Luzon
|
||||
{id:'ceb',name:'Cebu',x:0,y:0,land:'ceb',reg:'AS',cc:'PH',ph:true,arpu:PH_ARPU,P:125,ix:'GotchaFIX Cebu',ixCheap:1.8,dc:"Magellan's Last Rack",note:tr('cities.the_philippines_second_city_reached')},
|
||||
{id:'dvo',name:'Davao',x:0,y:0,land:'mdn',reg:'AS',cc:'PH',ph:true,arpu:PH_ARPU,P:135,ix:'GotchaFIX Davao',ixCheap:1.8,dc:"Heimdall's Hut",note:tr('cities.mindanao_s_big_city_and_the')},
|
||||
];
|
||||
// Display-only nudges for cities that sit on top of each other at map scale; distances still use real lon/lat.
|
||||
const CITY_NUDGE={
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ const CITY_PDB={
|
|||
cbo:[1,0,33],
|
||||
cbr:[5,60,3196], // est.
|
||||
ccs:[6,32,296],
|
||||
ceb:[4,25,750], // est.
|
||||
cgb:[4,5,9693],
|
||||
cgr:[4,4,9693],
|
||||
chc:[4,30,755], // est.
|
||||
|
|
@ -75,6 +76,7 @@ const CITY_PDB={
|
|||
dur:[4,137,879],
|
||||
dus:[13,350,3705], // 14 listed, one closed; Digital Realty DUS1-3 alone has 141 networks
|
||||
dut:[0,0,33300], // est.
|
||||
dvo:[2,10,750], // est.
|
||||
dxb:[8,135,231],
|
||||
dyr:[0,0,6683], // est.
|
||||
ebj:[1,5,529], // est.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const CABLES=[
|
|||
{"id":"cook","name":"Cook Strait Talking","price":1.0,"age":"mid","blurb":tr('cables.down_the_west_coast_and_across'),"pairs":[["akl","chc",[[175.75,-36.25],[178,-37],[179,-38],[178.5,-39.25],[174.25,-43.5]]]]},
|
||||
{"id":"ring","name":"Lord of the Tasman Rings","price":0.9,"age":"new","blurb":tr('cables.one_ring_to_bind_invercargill_to'),"pairs":[["ivc","syd",[[167.6,-46.9],[160,-42],[153,-35]]],["ivc","mel",[[167.6,-46.9],[156,-43.5],[146.2,-39.4]]],["ivc","akl",[[169,-47.25],[170.5,-47.25],[178.5,-39.25],[179,-38],[178,-37],[175.75,-36.25]]]]},
|
||||
{"id":"tasman","name":"Tasman Global Excess","price":0.95,"age":"new","blurb":tr('cables.sydney_to_auckland_with_plenty_to'),"pairs":[["akl","syd",[[170,-36],[158,-34.5]]]]},
|
||||
{"id":"bifrost","name":"Bi-Frosted","price":0.9,"age":"new","blurb":tr('cables.a_rainbow_bridge_from_singapore_to'),"pairs":[["sin","jkt",[[107,-2]]],["jkt","mnl",[[108.5,1.5]]],["mnl","lax",[[123,15],[140,20],[180,25],[210,30],[235,33.5]]],["mnl","gum",[[123,15],[136,14.5],[144.3,13.6]]],["gum","lax",[[145.5,14.2],[180,22],[210,30],[235,33.5]]],["jkt","gum",[[107.25,-5.25],[113,-5.25],[116,-4.25],[121,2],[139.42,11.57],[143.5,13.5]]],["gum","sea",[[149.93,19.74],[155.17,25.45],[160.51,30.59],[165.55,34.81],[170.63,38.48],[176.24,41.9],[181.86,44.75],[188.04,47.3],[190.71,48.15],[198.76,49.45],[205.61,50.09],[211.8,50.31],[218.01,50.21],[224.91,49.69],[234.5,48.25],[235.75,48.5],[236,48.25],[237.25,48.25]]]]},
|
||||
{"id":"bifrost","name":"Bi-Frosted","price":0.9,"age":"new","blurb":tr('cables.a_rainbow_bridge_from_singapore_to'),"pairs":[["sin","jkt",[[107,-2]]],["gum","lax",[[145.5,14.2],[180,22],[210,30],[235,33.5]]],["jkt","gum",[[107.25,-5.25],[113,-5.25],[116,-4.25],[121,2],[139.42,11.57],[143.5,13.5]]],["jkt","dvo",[[107.25,-5.25],[113,-5.25],[116,-4.25],[121,2],[124.5,4.6],[125.5,5.3],[125.75,6.2],[125.7,6.8]]],["dvo","gum",[[125.75,6.4],[126.1,5.6],[127,5.8],[130,8],[139.42,11.57],[143.5,13.5]]],["gum","sea",[[149.93,19.74],[155.17,25.45],[160.51,30.59],[165.55,34.81],[170.63,38.48],[176.24,41.9],[181.86,44.75],[188.04,47.3],[190.71,48.15],[198.76,49.45],[205.61,50.09],[211.8,50.31],[218.01,50.21],[224.91,49.69],[234.5,48.25],[235.75,48.5],[236,48.25],[237.25,48.25]]]]},
|
||||
{"id":"sjcph","name":"Sushi-Jollibee Cable","price":0.9,"age":"mid","blurb":tr('cables.southeast_asia_to_japan_with_snacks'),"pairs":[["hkg","mnl",[[116,21],[119.5,16],[120.3,14.6]]],["mnl","sin",[[119,12],[115,8],[110,5],[105,2]]],["mnl","tok",[[120,14.25],[119.25,15.25],[119.5,18],[128.03,26.23],[139,34.5]]],["sin","hkg",[[104.75,1.75],[109.75,11.5]]],["hkg","tok",[[116.5,22.25],[127,30],[130.75,30.5],[139,34.5]]]]},
|
||||
{"id":"farice","name":"Far-Ice-1","price":1.2,"age":"old","blurb":tr('cables.iceland_s_lifeline_to_scotland'),"pairs":[["rek","lon",[[-23,64],[-22.25,63.25],[-20.25,63],[-7,63],[-1.63,57.93],[2,53],[1.75,51.75]]]]},
|
||||
{"id":"danice","name":"Dance-Ice","price":1.0,"age":"mid","blurb":tr('cables.iceland_to_denmark_choreographed'),"pairs":[["rek","cph",[[-23,64],[-22.25,63.25],[7,57.5],[10.5,57.75],[11,57.5],[10.5,55.25],[12,54.75]]]]},
|
||||
|
|
@ -97,7 +97,7 @@ const CABLES=[
|
|||
{"id":"ouzo","name":"Ouzo Express","price":0.9,"age":"new","blurb":tr('cables.athens_to_alexandria_and_up_the'),"pairs":[["ath","cai",[[24,37.5],[25.2,35.5],[28,33],[29.9,31.4]]],["ath","ist",[[24.3,38.5],[25.6,39.9],[26.5,40.3],[28.2,40.8]]]]},
|
||||
{"id":"tea","name":"Boston Tea Party Line","price":0.9,"age":"mid","blurb":tr('cables.boston_to_dublin_nobody_has_thrown'),"pairs":[["bos","dub",[[-65.25,43],[-26,51],[-8.5,51],[-5.75,52.25],[-5.5,53.25]]]]},
|
||||
{"id":"clementine","name":"Clementine","price":0.6,"age":"new","df":true,"blurb":tr('cables.a_small_sweet_cable_from_broadstairs'),"pairs":[["lon","oos",[[1.44,51.36],[2.92,51.23]]]]},
|
||||
{"id":"seaus","name":"SEA-US Later","price":1.0,"age":"mid","blurb":tr('cables.los_angeles_to_hawaii_guam_and'),"pairs":[["lax","hnl",[[-119,33.5],[-140,27],[-157.6,21.6]]],["hnl","gum",[[-158.3,21.2],[-180,18],[-200,15],[-214.6,13.5]]],["gum","mnl",[[125.76,13.3],[123.5,12.5],[120.75,13.25],[120.5,14.25]]],["gum","ror",[[144.5,13.1],[139,9.5],[134.8,7.5]]]]},
|
||||
{"id":"seaus","name":"SEA-US Later","price":1.0,"age":"mid","blurb":tr('cables.los_angeles_to_hawaii_guam_and'),"pairs":[["lax","hnl",[[-119,33.5],[-140,27],[-157.6,21.6]]],["hnl","gum",[[-158.3,21.2],[-180,18],[-200,15],[-214.6,13.5]]],["gum","dvo",[[144,13.7],[135,10.5],[128,6.8],[126.4,5.7],[125.85,6.2],[125.7,6.75]]],["gum","ror",[[144.5,13.1],[139,9.5],[134.8,7.5]]]]},
|
||||
{"id":"aag","name":"Asia-America Gateaux","price":1.25,"age":"old","blurb":tr('cables.california_to_hong_kong_via_hawaii'),"pairs":[["sjc","hnl",[[-122.8,35],[-140,27.5],[-158.2,21.4]]],["hnl","gum",[[-158.4,21.5],[-180,19],[-200,16],[-214.4,13.7]]],["gum","hkg",[[144.5,14],[130,17.5],[121,20],[115,21.6],[114.3,22.2]]]]},
|
||||
{"id":"echo","name":"Echo-Chamber","price":0.85,"age":"new","blurb":tr('cables.california_to_singapore_via_guam'),"pairs":[["sjc","gum",[[-125,38],[-150,30],[-180,21],[-214.8,14]]],["gum","sin",[[137.45,12.58],[125,10.25],[123.75,9],[122,9],[108,5],[104.25,1.25]]]]},
|
||||
{"id":"hantru","name":"HANTRU-ly Yours","price":1.3,"age":"mid","blurb":tr('cables.guam_to_the_marshall_islands_with'),"pairs":[["gum","maj",[[145,13.3],[158,7],[167,8.5],[171.2,7.2]]]]},
|
||||
|
|
@ -161,6 +161,9 @@ const CABLES=[
|
|||
{"id":"tw1","name":"TW1-light","price":1.1,"age":"mid","blurb":tr('cables.the_emirates_oman_and_pakistan_on'),"pairs":[["fuj","mct",[[58.25,24.25]]],["mct","khi",[[58.75,24]]]]},
|
||||
{"id":"mct1","name":"MCT (Malaysia, Cambodia, Tuk-tuks)","price":0.95,"age":"new","blurb":tr('cables.malaysia_to_thailand_round_the_gulf'),"pairs":[["kul","bkk",[[101.75,2.5],[102.5,1.5],[103.5,0.75],[103.75,0.75],[104.75,1.75],[104.75,2.75],[100.5,12.75]]]]},
|
||||
{"id":"kjcn","name":"KJCN (Kimchi-Japan Cable Network)","price":1,"age":"mid","blurb":tr('cables.busan_to_kyushu_the_shortest_way'),"pairs":[["icn","fuk",[[126,36.75],[126,34],[130,34]]]]},
|
||||
{"id":"pdscn","name":"Pan de Sal Cable Network","price":0.9,"age":"new","blurb":tr('cables.the_philippines_longest_domestic_cable_fresh'),"pairs":[["mnl","ceb",[[120.6,14.4],[120.45,13.95],[120.85,13.6],[121.9,12.9],[122.7,12.3],[123.6,11.6],[124.2,11.2],[124.15,10.5]]],["ceb","dvo",[[124.05,10.2],[124.1,9.6],[124.5,8.9],[124.62,8.55]]],["mnl","dvo",[[121.6,13.85],[122.1,13.2],[122.9,12.45],[123.75,11.7],[124.3,11.1],[124.25,10.3],[124.1,9.6],[124.5,8.9],[124.62,8.55]]]]},
|
||||
{"id":"dfon","name":"Philippines Long Distance Relationship","price":1.1,"age":"mid","blurb":tr('cables.the_incumbent_s_own_line_south'),"pairs":[["mnl","ceb",[[121.6,13.85],[122.1,13.2],[122.9,12.45],[123.75,11.7],[124.3,11.1],[124.2,10.45]]],["ceb","dvo",[[123.95,10.05],[124.4,9.5],[124.75,9.05]]]]},
|
||||
{"id":"vismin","name":"Diverge VisMin Express","price":0.9,"age":"new","blurb":tr('cables.the_upstart_s_own_cable_from'),"pairs":[["ceb","dvo",[[124.15,10.9],[124.25,10.2],[124.4,9.3],[124.65,8.6]]]]},
|
||||
];
|
||||
const CAB=Object.fromEntries(CABLES.map(c=>[c.id,c]));
|
||||
const CABLE_PAIRS=CABLES.flatMap(c=>c.pairs.map(([a,b,mid])=>{const A=CITY[a],B=CITY[b];const near=(x,ref)=>x+W*Math.round((ref-x)/W);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,11 @@ NETS.push(
|
|||
{id:'bcd',name:'Bell Canad-eh',asn:577,type:'eye',cc:'CA',pol:'selective',minIx:10,minPni:30,share:.01,col:'#00549A',pops:['hfx','tor','mtl','nyc','chi','ott','cal','van'],ix:['tor','mtl','ott'],blurb:tr('networks.polite_enormous_and_sorry_about_the')});
|
||||
NETS.push(
|
||||
{id:'tsf',name:'Telkom-selfie',asn:7713,type:'eye',cc:'ID',pol:'selective',minIx:10,minPni:30,share:.01,col:'#E4002B',pops:['jkt','sin'],ix:['jkt','sin'],blurb:tr('networks.indonesia_s_mobile_giant_every')},
|
||||
{id:'pld',name:'PLDTea Time',asn:9299,type:'eye',cc:'PH',pol:'selective',minIx:10,minPni:30,share:.008,up:['ntt','tat'],col:'#D62027',pops:['mnl','hkg','sin'],ix:['hkg'],blurb:tr('networks.philippine_giant_peering_requests')},
|
||||
{id:'pld',name:'PLDTea Time',asn:9299,type:'t2',cc:'PH',pol:'selective',up:['ntt','tat'],minIx:10,minPni:30,share:.008,price:7,col:'#D62027',pops:['mnl','ceb','dvo','hkg','sin'],ix:['hkg','mnl~3'],blurb:tr('networks.philippine_giant_peering_requests')},
|
||||
{id:'cvg',name:'Diverge',asn:17639,type:'eye',cc:'PH',pol:'open',up:['ntt','tat'],share:.005,col:'#F26B21',pops:['mnl','ceb','dvo','hkg','sin'],ix:['mnl','mnl~2','hkg','sin'],blurb:tr('networks.the_fiber_upstart_from_the_provinces')},
|
||||
{id:'smt',name:'Smarty Pants',asn:10139,type:'eye',cc:'PH',pol:'selective',up:['pld'],minIx:10,minPni:30,share:.006,col:'#00A859',pops:['mnl'],ix:[],blurb:tr('networks.pldtea_time_s_mobile_sibling_buy')},
|
||||
{id:'dto',name:'Ditto',asn:139831,type:'eye',cc:'PH',pol:'open',up:['ntt','tat'],share:.002,col:'#B5121B',pops:['mnl'],ix:['mnl','mnl~2'],blurb:tr('networks.the_third_mobile_network_same_towers')},
|
||||
{id:'rsh',name:'RISE & Shine',asn:63927,type:'eye',cc:'PH',pol:'open',up:['ntt','tat'],share:.002,col:'#F5A623',pops:['mnl','ceb','dvo','sin','hkg','fra','ams','lon','sto'],ix:['mnl','mnl~2','mnl~3','ceb','dvo','sin','sin~2','hkg','hkg~2','fra','ams','lon','sto'],blurb:tr('networks.up_early_in_cebu_and_already')},
|
||||
{id:'spk',name:'Spark-le',asn:4771,type:'eye',cc:'NZ',pol:'open',share:.005,col:'#6A2C91',pops:['akl','syd','chc','ivc'],ix:['akl','syd','chc'],blurb:tr('networks.new_zealand_s_shiniest_isp')},
|
||||
{id:'tsy',name:'Telstraya',asn:1221,type:'t2',cc:'AU',pol:'selective',minIx:15,minPni:40,share:.01,price:9,col:'#0099F8',pops:['hnl','gum','suv','pom','nou','hir','syd','per','sin','hkg','lax','tpe','mel','bne','drw','adl','cbr','hba'],ix:['gum','sin','hkg'],blurb:tr('networks.australia_s_big_one_g_day')});
|
||||
NETS.push(
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ const XIX=[
|
|||
{id:'lax~2',c:'lax',name:'Smog-IX',cheap:0.6,take:0.45,blurb:tr('rival_exchanges.you_can_t_see_the_fabric')},
|
||||
{id:'sin~2',c:'sin',name:'Kopi-IX',cheap:0.6,take:0.5,blurb:tr('rival_exchanges.strong_sweet_and_cheaper_than_the')},
|
||||
{id:'hkg~2',c:'hkg',name:'Dim-Sum-IX',cheap:0.6,take:0.5,blurb:tr('rival_exchanges.lots_of_small_sessions_on_little')},
|
||||
{id:'mnl~2',c:'mnl',name:'Bayanihan-IX',cheap:0.3,take:0.4,blurb:tr('rival_exchanges.the_whole_neighbourhood_carries_the')},
|
||||
{id:'mnl~3',c:'mnl',name:'In-Vitro-IX',cheap:4.4,take:0.2,core:['pld','smt'],blurb:tr('rival_exchanges.grown_in_a_lab_by_the')},
|
||||
{id:'tok~2',c:'tok',name:'Bento-IX',cheap:0.65,take:0.5,core:['drz','akm','cfl','sgt','msf','amz'],blurb:tr('rival_exchanges.tokyo_has_more_exchanges_than_anyone')},
|
||||
{id:'syd~2',c:'syd',name:'At-The-Edge IX',cheap:.7,take:0.5,core:['drz','nfx','ggl','fbk','akm','cfl','amz','msf','bdc','slw','abb','voc','stb','spl','lpt','npt','mag'],blurb:tr('rival_exchanges.the_challenger_to_ix_straya_pops')},
|
||||
{id:'bom~2',c:'bom',name:'Vada-Pav-IX',cheap:0.45,take:0.45,blurb:tr('rival_exchanges.mumbai_s_street_food_exchange_fast')},
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ NETS.push(
|
|||
{id:'fet',name:'Far EasTone-Deaf',asn:9674,type:'eye',cc:'TW',pol:'selective',minIx:3,minPni:12,share:.003,up:['ntt'],col:'#E60012',pops:['tpe','hkg'],ix:['tpe'],blurb:tr('homegrown_eyeballs.taiwan_s_number_three_never_hears')},
|
||||
{id:'fre',name:'Free as in Beer',asn:12322,type:'eye',cc:'FR',pol:'selective',minIx:6,minPni:20,share:.006,up:['cog','lvl'],col:'#CD1E25',pops:['par','mrs','ams','lon','fra'],ix:['par','mrs'],blurb:tr('homegrown_eyeballs.the_challenger_that_made_french_broadband')},
|
||||
{id:'frs',name:'Yas Queen Sénégal',asn:37649,type:'eye',cc:'SN',pol:'open',share:.0008,up:['tat','tly'],col:'#FFD100',pops:['dkr'],ix:['dkr'],blurb:tr('homegrown_eyeballs.senegal_s_number_two_freshly_renamed')},
|
||||
{id:'glb',name:'Globe-Trotter Telecom',asn:4775,type:'eye',cc:'PH',pol:'selective',minIx:3,minPni:15,share:.006,up:['ntt','tat'],col:'#0056A2',pops:['mnl','hkg','sin'],ix:['hkg','sin'],blurb:tr('homegrown_eyeballs.the_philippines_other_mobile_giant_roaming')},
|
||||
{id:'glb',name:'Globe-Trotter Telecom',asn:4775,type:'t2',cc:'PH',pol:'selective',minIx:3,minPni:15,share:.006,price:6,up:['ntt','tat'],col:'#0056A2',pops:['mnl','ceb','dvo','hkg','sin'],ix:['mnl','mnl~2','hkg','sin'],blurb:tr('homegrown_eyeballs.the_philippines_other_mobile_giant_roaming')},
|
||||
{id:'gph',name:'Grameen Machine',asn:24389,type:'eye',cc:'BD',pol:'selective',minIx:3,minPni:12,share:.004,up:['tat','ntt'],col:'#19AAF8',pops:['dac','sin'],ix:['dac'],blurb:tr('homegrown_eyeballs.bangladesh_s_biggest_mobile_network_a')},
|
||||
{id:'hkb',name:'Ding-Ding Broadband',asn:9269,type:'eye',cc:'HK',pol:'open',share:.002,up:['ntt','cog'],col:'#6A2C91',pops:['hkg'],ix:['hkg'],blurb:tr('homegrown_eyeballs.fibre_to_every_tower_block_rung')},
|
||||
{id:'hkt',name:'Net-Vigour HK',asn:4760,type:'eye',cc:'HK',pol:'selective',minIx:5,minPni:20,share:.004,up:['ntt','tat'],col:'#00A0E1',pops:['hkg','sin','tok','lax'],ix:['hkg'],blurb:tr('homegrown_eyeballs.hong_kong_s_incumbent_broadband_full')},
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const INTERNS={
|
|||
// The orders, in the order the panel shows them. pop: can be switched off per POP. cap: default monthly budget, of setup
|
||||
// fees, or (mo) of the running costs the order adds, for caches, which are free to rack but cost rent every month.
|
||||
const OPS=[
|
||||
{k:'transit',i:'📈',pop:1,cap:50000,t:N_('ops.o_transit'),d:N_('ops.o_transit_d'),p:{x:{d:1.5,v:[1.25,1.5,2,3],l:N_('ops.p_x'),f:v=>v+'×'},prov:{d:'cheap',ok:v=>v==='cheap'||(isNet(v)&&!!NET[v].price),l:N_('ops.p_prov')}}},
|
||||
{k:'transit',i:'📈',pop:1,cap:50000,t:N_('ops.o_transit'),d:N_('ops.o_transit_d'),p:{x:{d:1.5,v:[1.25,1.5,2,3],l:N_('ops.p_x'),f:v=>v+'×'},prov:{d:'cheap',ok:v=>v==='cheap'||v==='have'||(isNet(v)&&!!NET[v].price),l:N_('ops.p_prov')}}},
|
||||
{k:'routers',i:'🧠',pop:1,cap:250000,t:N_('ops.o_routers'),d:N_('ops.o_routers_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},how:{d:'auto',v:['auto','add','swap'],l:N_('ops.p_how'),f:v=>tr({auto:N_('ops.how_auto'),add:N_('ops.how_add'),swap:N_('ops.how_swap')}[v])}}},
|
||||
{k:'caches',i:'📦',pop:1,cap:5000,mo:1,t:N_('ops.o_caches'),d:N_('ops.o_caches_d'),p:{g:{d:5,v:[1,5,10,25,50],l:N_('ops.p_g'),f:v=>fmtG(v)}}},
|
||||
{k:'ix',i:'🔀',t:N_('ops.o_ix'),d:N_('ops.o_ix_d'),p:{}},
|
||||
|
|
@ -137,15 +137,19 @@ const OPS_RUN={
|
|||
for(const c of opsPops('transit')){let ts=S.transit.filter(t=>t.city===c);if(!ts.length)continue;
|
||||
// Thirty days of 95th-percentile-ish history per port; their peaks summed is a safe (high) estimate of the POP's peak.
|
||||
const peak=ts.reduce((a,t)=>a+(t.hist||[]).reduce((m,v)=>Math.max(m,v),0),0);if(!(peak>0))continue;
|
||||
const n=opsProv(c);if(!n)continue;
|
||||
// "Already connected" (#227): only the providers you buy from here, the smallest first, never a new contract.
|
||||
const have=opsP('transit','prov')==='have',n=have?null:opsProv(c);if(!have&&!n)continue;
|
||||
const grow=t=>{const k=t.n||1,up=t.tier+1;
|
||||
if(k<4&&portOk(c,t.tier))return {cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};
|
||||
if(PORT[up]&&portShown(up)&&portOk(c,up))return {cost:PORT[up].setup*k,go:()=>ACT.buyTransit({city:c,net:t.net,tier:up}),w:PORT[t.tier].n+'→'+PORT[up].n};
|
||||
if(k<LAG_MAX&&portOk(c,t.tier))return {cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};return null;};
|
||||
for(let step=0;step<4;step++){const cap=ts.reduce((a,t)=>a+lagCap(PORT[t.tier].g,t.n),0);if(cap>=N*peak)break;
|
||||
const t=ts.find(x=>x.net===n.id);let job=null;
|
||||
if(t){const k=t.n||1,up=t.tier+1;
|
||||
if(k<4&&portOk(c,t.tier))job={cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};
|
||||
else if(PORT[up]&&portShown(up)&&portOk(c,up))job={cost:PORT[up].setup*k,go:()=>ACT.buyTransit({city:c,net:n.id,tier:up}),w:PORT[t.tier].n+'→'+PORT[up].n};
|
||||
else if(k<LAG_MAX&&portOk(c,t.tier))job={cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};}
|
||||
else{const need=N*peak-cap,ok=PORT.map((P,i)=>i).filter(i=>portShown(i)&&portOk(c,i)),i=ok.find(i=>PORT[i].g>=need)??ok.at(-1);
|
||||
if(i!==undefined)job={cost:PORT[i].setup,go:()=>ACT.buyTransit({city:c,net:n.id,tier:i}),w:'+'+PORT[i].n};}
|
||||
let job=null;
|
||||
if(have){for(const t of ts.slice().sort((a,b)=>lagCap(PORT[a.tier].g,a.n)-lagCap(PORT[b.tier].g,b.n)||transitPerG(NET[a.net],c,!!a.premium)-transitPerG(NET[b.net],c,!!b.premium))){job=grow(t);if(job)break;}}
|
||||
else{const t=ts.find(x=>x.net===n.id);
|
||||
if(t)job=grow(t);
|
||||
else{const need=N*peak-cap,ok=PORT.map((P,i)=>i).filter(i=>portShown(i)&&portOk(c,i)),i=ok.find(i=>PORT[i].g>=need)??ok.at(-1);
|
||||
if(i!==undefined)job={cost:PORT[i].setup,go:()=>ACT.buyTransit({city:c,net:n.id,tier:i}),w:'+'+PORT[i].n};}}
|
||||
if(!job||!X.can('transit',job.cost)||!X.pay('transit',job.go))break;
|
||||
X.did('transit',c+' '+job.w);ts=S.transit.filter(t=>t.city===c);}}},
|
||||
optics(X){const at=opsP('optics','at')/100;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ function sanitize(s){
|
|||
if(!isCity(s.home))s.home=Object.keys(s.pops)[0]||'fra';
|
||||
opsSanitize(s);
|
||||
const tier=v=>int(v,0,PORT.length-1,0),lag=v=>int(v,1,LAG_MAX,1),sid=v=>String(v==null?uid():v).slice(0,40);
|
||||
s.links=s.links.filter(l=>l&&isCity(l.a)&&isCity(l.b)&&l.a!==l.b).map(l=>{l.id=sid(l.id);if(l.list!==undefined){const L=l.list;if(l.kind==='df'&&L&&typeof L==='object'&&!Array.isArray(L)){const w=int(L.w,0,256,0),p=int(L.p,0,2,0);if(w||p)l.list={w,p};else delete l.list;}else delete l.list;}l.km=num(l.km,kmBetween(l.a,l.b));l.mo=num(l.mo,0);l.cut=num(l.cut,0);if(l.pairs!==undefined)l.pairs=Math.min(l.sub?SUB_PAIRS_MAX:s.lvl>=PAIRS_LV?PAIRS_BIG:PAIRS_MAX,Math.max(1,Math.floor(+l.pairs)||1));if(l.kind!=='df'&&l.kind!=='vxc')l.kind='wave';if(l.kind==='wave')l.tier=int(l.tier,0,LT.length-1,0);if(l.cable&&!own(CAB,l.cable))l.cable=null;if(l.kind==='vxc'&&!own(VXC,l.vt))l.vt=0;if(l.kind==='df'){if(!own(DF_SYS,l.sys))l.sys='lite';l.ch=Array.isArray(l.ch)?l.ch.filter(o=>own(OPT,o)):[];l.ready=num(l.ready,0);for(const k of Object.keys(SUB_UPGRADES)){const f='sub'+k;if(l[f]!==undefined){if(l.own&&l.sub&&Number.isFinite(l[f])&&l[f]>=0)l[f]=Math.round(l[f]);else delete l[f];}}if(l.seaPath!==undefined){if(l.own&&l.sub&&Array.isArray(l.seaPath)&&l.seaPath.length>=2&&l.seaPath.length<=2048&&l.seaPath.every(p=>Array.isArray(p)&&p.length===2&&p.every(Number.isFinite)&&Math.abs(p[0])<=180&&Math.abs(p[1])<=90))l.seaPath=l.seaPath.map(p=>p.slice());else delete l.seaPath;}if(l.paid!==undefined){if(l.own&&l.sub&&Number.isFinite(l.paid)&&l.paid>=0)l.paid=Math.round(l.paid);else delete l.paid;}if(l.own&&l.sub&&!own(SEA_DESIGNS,l.seaDesign))l.seaDesign='standard';l.regen=int(l.regen,0,REGEN_MAX,0);}const deg=v=>v&&typeof v==='object'?{until:num(v.until,0),f:Math.min(1,Math.max(0,num(v.f,1)))}:null;if(l.loss)l.loss=deg(l.loss);return l;});
|
||||
s.links=s.links.filter(l=>l&&isCity(l.a)&&isCity(l.b)&&l.a!==l.b).map(l=>{l.id=sid(l.id);if(l.list!==undefined){const L=l.list;if(l.kind==='df'&&L&&typeof L==='object'&&!Array.isArray(L)){const w=int(L.w,0,256,0),p=int(L.p,0,2,0);if(w||p)l.list={w,p};else delete l.list;}else delete l.list;}l.km=num(l.km,kmBetween(l.a,l.b));l.mo=num(l.mo,0);l.cut=num(l.cut,0);if(l.pairs!==undefined)l.pairs=Math.min(l.sub?SUB_PAIRS_MAX:s.lvl>=PAIRS_LV?PAIRS_BIG:PAIRS_MAX,Math.max(1,Math.floor(+l.pairs)||1));if(l.kind!=='df'&&l.kind!=='vxc')l.kind='wave';if(l.kind==='wave')l.tier=int(l.tier,0,LT.length-1,0);if(l.cable&&(!own(CAB,l.cable)||!cablePair(l.cable,l.a,l.b)))l.cable=null;if(l.kind==='vxc'&&!own(VXC,l.vt))l.vt=0;if(l.kind==='df'){if(!own(DF_SYS,l.sys))l.sys='lite';l.ch=Array.isArray(l.ch)?l.ch.filter(o=>own(OPT,o)):[];l.ready=num(l.ready,0);for(const k of Object.keys(SUB_UPGRADES)){const f='sub'+k;if(l[f]!==undefined){if(l.own&&l.sub&&Number.isFinite(l[f])&&l[f]>=0)l[f]=Math.round(l[f]);else delete l[f];}}if(l.seaPath!==undefined){if(l.own&&l.sub&&Array.isArray(l.seaPath)&&l.seaPath.length>=2&&l.seaPath.length<=2048&&l.seaPath.every(p=>Array.isArray(p)&&p.length===2&&p.every(Number.isFinite)&&Math.abs(p[0])<=180&&Math.abs(p[1])<=90))l.seaPath=l.seaPath.map(p=>p.slice());else delete l.seaPath;}if(l.paid!==undefined){if(l.own&&l.sub&&Number.isFinite(l.paid)&&l.paid>=0)l.paid=Math.round(l.paid);else delete l.paid;}if(l.own&&l.sub&&!own(SEA_DESIGNS,l.seaDesign))l.seaDesign='standard';l.regen=int(l.regen,0,REGEN_MAX,0);}const deg=v=>v&&typeof v==='object'?{until:num(v.until,0),f:Math.min(1,Math.max(0,num(v.f,1)))}:null;if(l.loss)l.loss=deg(l.loss);return l;});
|
||||
for(const l of s.links)repairSubUpgradeDates(l,s.day);
|
||||
/* Metrics moved from each link to its city pair (#122). Older saves routed a pair at the lowest metric of its
|
||||
links, with all of them carrying traffic, so the pair keeps that metric and nothing goes on standby. */
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const txComp=c=>{const q=CITY_PDB[c];return q?clamp((1000/Math.max(q[1],10))**0.
|
|||
// No neutral data center means building your own room: POPs cost more to build and to run.
|
||||
const colo=c=>{const q=CITY_PDB[c];return !q?1:q[0]===0?1.5:q[0]<=2?1.25:1;};
|
||||
const popMo=c=>Math.round(POP_MO*colo(c));
|
||||
function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.au)return AU_TRANSIT;if(C.tape)return 1.5;const base=C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;return Math.round(base*txComp(c)*10)/10;}
|
||||
function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.au)return AU_TRANSIT;if(C.ph)return PH_TRANSIT;if(C.tape)return 1.5;const base=C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;return Math.round(base*txComp(c)*10)/10;}
|
||||
// A network's own markup on top of that, where it is far from home (Glowball Sakura Lager in Asia and New Zealand).
|
||||
// What a home pays, against the usual bill.
|
||||
const arpuOf=c=>CITY[c].arpu||(CITY[c].kr&&scnRule('sender')?KR_ARPU:1);
|
||||
|
|
@ -34,7 +34,7 @@ function linkLat(l){const f=l.kind==='df'?(l.own?(l.sub?seaLatencyFactor(l):1.1)
|
|||
const WAVE_LAND={EU:0.65,AM:1,SA:1.6,AS:1.4,OC:1.2,AF:2.2},WAVE_SUB={EU:0.8,AM:1,SA:2,AS:1.5,OC:1.5,AF:4.5};
|
||||
const WAVE_NAME={EU:tr('common.europe'),AM:tr('common.north_america'),SA:tr('common.south_america'),AS:tr('common.asia'),OC:tr('common.oceania'),AF:tr('common.africa')};
|
||||
function waveMarket(a,b,sub){const ra=CITY[a].reg,rb=CITY[b].reg,T=sub?WAVE_SUB:WAVE_LAND,au=sub?AU_WAVE.sub:AU_WAVE.land;
|
||||
const fa=CITY[a].au?au:(T[ra]||1),fb=CITY[b].au?au:(T[rb]||1),reg=sub&&nullPair(a,b)?AU_WAVE.ew:sub?Math.max(fa,fb):(fa+fb)/2;
|
||||
const fa=CITY[a].au?au:(T[ra]||1),fb=CITY[b].au?au:(T[rb]||1),reg=sub&&nullPair(a,b)?AU_WAVE.ew:sub&&CITY[a].ph&&CITY[b].ph?PH_WAVE:sub?Math.max(fa,fb):(fa+fb)/2;
|
||||
const key=a<b?a+b:b+a,mood=0.85+(hstr(key+'|mood')%31)/100;
|
||||
const ero=Math.max(0.55,Math.pow(0.92,Math.floor((S?S.day:0)/360)));
|
||||
return {m:reg*mood*ero,reg,mood,ero};}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function fireEvent(){
|
|||
if(Object.keys(S.pops).some(ruCity))opts.push('runet','runet');
|
||||
if(S.pops.doh&&Object.keys(S.pops).some(c=>CITY[c].gcc||CITY[c].uae)&&!(S.ev.gulf>S.day))opts.push('gulf');
|
||||
if(Object.keys(S.pops).some(c=>CITY[c].saudi))opts.push('mega');
|
||||
if(['mnl','hkg','tok','icn','sha','jkt'].some(c=>S.pops[c]))opts.push('typhoon');
|
||||
if(['mnl','ceb','hkg','tok','icn','sha','jkt'].some(c=>S.pops[c]))opts.push('typhoon');
|
||||
if(S.pops.icn&&!S.krExit)opts.push('krexit');if(S.pops.icn&&!(S.ev.krroute>S.day))opts.push('krroute');
|
||||
if(Object.keys(S.pops).some(cnCity)||R.gfwCross>1)opts.push('golden','gfw');
|
||||
if(S.transit.some(t=>t.net==='cog'))opts.push('depeer','depeer');
|
||||
|
|
@ -34,7 +34,7 @@ function fireEvent(){
|
|||
if(e==='hijack'){const nh=NETS.map(n=>n.id).filter(()=>Math.random()<0.6),old=S.ev.rpki&&S.ev.rpki.until>S.day?S.ev.rpki:null;S.ev.rpki=old?{until:Math.max(old.until,S.day+1),nets:[...new Set(old.nets.concat(nh))]}:{until:S.day+1,nets:nh};addInc({type:'hijack',ref:'rpki',until:S.day+1,msg:tr('events.a_state_owned_isp_accidentally'),cost:1500,fix:tr('events.call_everyone_you_know')});toast(tr('events.bgp_hijack_someone_else_is'),'bad');sfx('alert');return;}
|
||||
if(e==='landban'){const lc=[...new Set(CABLE_PAIRS.flatMap(c=>[c.a,c.b]))];const c=pick(lc);S.ev.landban={city:c,until:S.day+45};toast(tr('events.landing_permit_dispute_in_city_two',{city:CITY[c].name}),'bad');return;}
|
||||
if(e==='shutdown'){const ps=Object.keys(S.pops).filter(c=>c!==S.home);if(!ps.length)return;const c=pick(ps);S.pops[c].down=Math.max(S.pops[c].down||0,S.day+1);addInc({type:'shutdown',ref:c,until:S.day+1,msg:tr('events.regulators_ordered_every_network_in',{city:CITY[c].name}),cost:0});toast(tr('events.ordered_offline_in_city_a_government',{city:CITY[c].name}),'bad');sfx('alert');return;}
|
||||
if(e==='typhoon'){const c=pick(['mnl','hkg','tok','icn','sha','jkt'].filter(x=>S.pops[x])),p=S.pops[c],nm=pick([tr('common.typhoon_bandwidth'),tr('common.typhoon_latency'),tr('common.typhoon_jitter'),tr('events.typhoon_packet_loss')]);
|
||||
if(e==='typhoon'){const c=pick(['mnl','ceb','hkg','tok','icn','sha','jkt'].filter(x=>S.pops[x])),p=S.pops[c],nm=pick([tr('common.typhoon_bandwidth'),tr('common.typhoon_latency'),tr('common.typhoon_jitter'),tr('events.typhoon_packet_loss')]);
|
||||
if(p.gen){S.stats.survived++;toast(tr('events.name_hits_city_the_grid_is',{name:nm,city:CITY[c].name}),'good');sfx('alert');return;}
|
||||
p.down=Math.max(p.down||0,S.day+2);addInc({type:'power',ref:c,until:p.down,msg:tr('events.name_knocked_out_power_in_city',{name:nm,city:CITY[c].name}),cost:7000,fix:tr('incidents.rent_a_generator')});toast(tr('events.name_hits_city_power_is_out',{name:nm,city:CITY[c].name}),'bad');sfx('alert');compute();return;}
|
||||
if(e==='runet'){S.ev.runet=S.day+1;toast(tr('events.sovereign_internet_drill_moscow'),'bad');sfx('alert');compute();return;}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ const ACT={
|
|||
if(o.a==='cust'){if(S.biz.some(b=>b.id===o.v)){ACT.custGo({id:o.v});return;}toast(tr('interface.that_customer_is_gone_the_contract'),'');return;}
|
||||
if(o.a==='bank'){ACT.bank({});return;}if(o.a==='ops'){ACT.opsOpen();return;}if(o.a==='tab'&&LOG_TABS.includes(o.v))ACT.leftTab({t:o.v});},
|
||||
logAll:()=>{UI.logAll=!UI.logAll;renderLeft();},
|
||||
findOpen:()=>findOpen(),
|
||||
findGo:({city})=>{if(!isCity(city))return;closeModal();$('dash').hidden=true;ACT.focusCity({city});},
|
||||
focusCity:({city})=>{selectCity(city);const C=CITY[city];cam.x=C.x;cam.y=C.y;cam.z=Math.max(cam.z,1.2);if(innerWidth<760)UI.leftOpen=false;renderLeft();},
|
||||
selLink:({id})=>selectLink(id),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Object.assign(ACT,{
|
|||
toast(esc(tr('ops.fired',{name:nm})),'');after();opsModal();},
|
||||
opsToggle:({k})=>{if(!opsHired()||!own(OPSK,k))return;S.ops.on[k]=!S.ops.on[k];sfx('click');after();opsModal();},
|
||||
opsParam:({k,p})=>{if(!opsHired()||!own(OPSK,k)||!own(OPSK[k].p,p))return;const P=OPSK[k].p[p];let v;
|
||||
if(p==='prov'){const ids=['cheap',...NETS.filter(n=>n.price&&Object.keys(S.pops).some(c=>sellsAt(n,c))).map(n=>n.id)];v=opsCycle(ids,opsP(k,p));}else v=opsCycle(P.v,opsP(k,p));
|
||||
if(p==='prov'){const ids=['cheap','have',...NETS.filter(n=>n.price&&Object.keys(S.pops).some(c=>sellsAt(n,c))).map(n=>n.id)];v=opsCycle(ids,opsP(k,p));}else v=opsCycle(P.v,opsP(k,p));
|
||||
(S.ops.p[k]||(S.ops.p[k]={}))[p]=v;sfx('click');after();opsModal();},
|
||||
opsCap:({k})=>{if(!opsHired()||!own(OPSK,k)||!OPSK[k].cap)return;S.ops.cap[k]=opsCycle(opsCaps(k),opsCap(k));sfx('click');after();opsModal();},
|
||||
opsFloor:()=>{if(!opsHired())return;S.ops.floor=opsCycle(OPS_FLOORS,S.ops.floor);sfx('click');after();opsModal();},
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function opsCard(){if(!S)return '';const last=opsHired()&&S.ops.log[0];
|
|||
<div class="meta">${opsHired()?esc(last?opsEntry(last):tr('ops.l_quiet',{name:opsName()})):opsCanHire()?tr('ops.hire_pitch_short'):tr('ops.locked',{lv:2})}</div>
|
||||
<div class="btns">${btn(opsHired()?tr('ops.standing_orders'):tr('ops.hire_an_intern'),'opsOpen',{},opsHired()?'sm':'pink sm',!opsHired()&&!opsCanHire())}</div></div>`;}
|
||||
const opsEntry=e=>(e.f!==undefined?opsFFLine(e)+' ':'')+(e.r.length||e.f===undefined?opsLine(e):'');
|
||||
function opsVal(k,p){const P=OPSK[k].p[p],v=opsP(k,p);return p==='prov'?(v==='cheap'?tr('ops.cheapest'):NET[v].name):P.f(v);}
|
||||
function opsVal(k,p){const P=OPSK[k].p[p],v=opsP(k,p);return p==='prov'?(v==='cheap'?tr('ops.cheapest'):v==='have'?tr('ops.already_connected'):NET[v].name):P.f(v);}
|
||||
function opsOrderHtml(d){const k=d.k,on=S.ops.on[k],cap=d.cap?opsCap(k):0,sp=S.ops.spent[k]||0,am=Math.round(S.ops.addMo[k]||0);
|
||||
return `<div class="ops-o${on?' on':''}"><div class="ops-h"><span class="ops-i" aria-hidden="true">${d.i}</span><div class="grow"><div class="nm">${tr(d.t)}</div><div class="meta">${tr(d.d)}${k==='caches'?' '+tr('ops.caches_rent',{price:fmt$(CACHE_MO)}):''}</div></div>
|
||||
<button class="b sm ${on?'green':'ghost'}" data-act="opsToggle" data-args='{"k":"${k}"}' aria-pressed="${on}" aria-label="${esc(tr(d.t))}">${on?tr('common.on'):tr('ops.paused')}</button></div>
|
||||
|
|
|
|||
30
src/game/93-ui/80-find-city.js
Normal file
30
src/game/93-ui/80-find-city.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* ---------- Find a city (#218): a search box that jumps the map there ----------
|
||||
Matches the city's name, its country (in the player's language and in English) and its exchange and data center
|
||||
names, so "Deutschland", "Germany" or "DE-CIX" all find Frankfurt. Press / anywhere, or the 🔍 chip in the HUD. */
|
||||
const FIND_N=8;
|
||||
const fold=s=>String(s||'').normalize('NFD').replace(/[̀-ͯ]/g,'').toLowerCase().trim();
|
||||
// Country names, built once per page: they never change while playing.
|
||||
let FIND_IX=null;
|
||||
function findIndex(){if(FIND_IX)return FIND_IX;let dn=null,en=null;try{dn=new Intl.DisplayNames([LANG],{type:'region'});en=new Intl.DisplayNames(['en'],{type:'region'});}catch(e){}
|
||||
const cn=(d,cc)=>{try{return d?d.of(cc)||'':'';}catch(e){return '';}};
|
||||
FIND_IX=Object.values(CITY).map(C=>{const land=cn(dn,C.cc)||C.cc||'';return {id:C.id,name:fold(C.name),land,ctry:fold(land+' '+cn(en,C.cc)+' '+(C.cc||'')),xtra:fold((C.ix||'')+' '+(C.dc||''))};});return FIND_IX;}
|
||||
// Best matches first: the name starts with it, a word of the name does, the name has it, then country, then exchange or DC.
|
||||
function findCities(q){q=fold(q);const mine=c=>S&&S.pops&&S.pops[c]?0:1;
|
||||
if(!q)return S&&S.pops?Object.keys(S.pops).filter(isCity).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name)).slice(0,FIND_N):[];
|
||||
const out=[];for(const e of findIndex()){const n=e.name;
|
||||
const s=n.startsWith(q)?0:n.split(/[\s\-.'()]+/).some(w=>w.startsWith(q))?1:n.includes(q)?2:e.ctry.includes(q)?3:e.xtra.includes(q)?4:-1;
|
||||
if(s>=0)out.push([s,mine(e.id),-(CITY[e.id].P||0),e.id]);}
|
||||
return out.sort((a,b)=>a[0]-b[0]||a[1]-b[1]||a[2]-b[2]).slice(0,FIND_N).map(r=>r[3]);}
|
||||
function findRows(q){const ids=findCities(q),land=c=>(findIndex().find(e=>e.id===c)||{}).land||'';
|
||||
if(!ids.length)return `<p class="meta" style="margin:10px 0">${q.trim()?tr('find.no_city_matches_q',{q:esc(q.trim())}):tr('find.type_a_city_a_country')}</p>`;
|
||||
return ids.map((c,i)=>{const C=CITY[c],p=S&&S.pops&&S.pops[c];
|
||||
return `<button class="row findrow${i?'':' on'}" data-act="findGo" data-args="${esc(JSON.stringify({city:c}))}"><span class="grow"><span class="nm">${p?'📍 ':''}${esc(C.name)}</span><span class="meta">${esc([land(c),C.ix].filter(Boolean).join(' · '))}${p?' · '+tr('find.your_pop'):''}</span></span><span aria-hidden="true">›</span></button>`;}).join('');}
|
||||
function findOpen(){if(!S||!UI.started)return;
|
||||
openModal(`<h2 style="font-size:24px;margin:0 0 10px">🔍 ${tr('find.find_a_city')}</h2><input class="t" id="findIn" type="search" enterkeyhint="go" autocomplete="off" autocapitalize="off" spellcheck="false" placeholder="${esc(tr('find.city_country_or_exchange'))}" aria-label="${esc(tr('find.find_a_city'))}" aria-controls="findList">
|
||||
<div id="findList" class="findlist" role="list">${findRows('')}</div>${isPhone()?'':`<p class="meta" style="margin:8px 0 0">${tr('find.press_slash_to_search_from')}</p>`}`,'find');
|
||||
const el=$('findIn');if(el)el.focus();}
|
||||
document.addEventListener('input',e=>{if(e.target.id!=='findIn')return;const L=$('findList');if(L)L.innerHTML=findRows(e.target.value);});
|
||||
document.addEventListener('keydown',e=>{
|
||||
if(e.target.id==='findIn'){if(e.key==='Escape'){closeModal();return;}if(e.key==='Enter'){e.preventDefault();const c=findCities(e.target.value)[0];if(c)ACT.findGo({city:c});}return;}
|
||||
if(e.key!=='/'||e.ctrlKey||e.metaKey||e.altKey||(e.target.closest&&e.target.closest('input,textarea,select,[contenteditable]')))return;
|
||||
if(!S||!UI.started||!$('modal').hidden)return;e.preventDefault();findOpen();});
|
||||
|
|
@ -30,10 +30,13 @@ function segDist(x,y,a,b){const dx=b[0]-a[0],dy=b[1]-a[1],L=dx*dx+dy*dy||1;const
|
|||
function drawCables(ks){const z=cam.z,selC=UI.drag&&UI.drag.mode==='link'?UI.drag.from:(UI.sel&&UI.sel.type==='city'?UI.sel.id:null),cached=!!(WL.cv&&WL.key&&WL.cab);
|
||||
if(!selC&&z<1.7&&cached)return;
|
||||
ctx.font='800 10px Nunito, sans-serif';ctx.textAlign='center';ctx.textBaseline='middle';
|
||||
// Labels that would sit on another, or on a segment shorter than the name, are left out (a selected city's always show).
|
||||
const LB=[],lbOk=(x,y,w,sp,hot)=>{const b=[x-w/2-3,y-7,x+w/2+3,y+7];if(!hot){let mn=Infinity,mx=-Infinity,my=Infinity,My=-Infinity;for(const q of sp){mn=Math.min(mn,q[0]);mx=Math.max(mx,q[0]);my=Math.min(my,q[1]);My=Math.max(My,q[1]);}
|
||||
if(Math.hypot(mx-mn,My-my)<w*0.8)return false;if(LB.some(o=>b[0]<o[2]&&b[2]>o[0]&&b[1]<o[3]&&b[3]>o[1]))return false;}LB.push(b);return true;};
|
||||
const ar=arOn();for(const cp of CABLE_PAIRS){const C=CAB[cp.cid],hot=!!selC&&(cp.a===selC||cp.b===selC);if(!hot&&cached&&z<1.7)continue;if(ar&&!hot&&!(arKind(cp.a)&&arKind(cp.b)))continue;const col=cableCol(C);
|
||||
for(const k of ks){const sp=cp.pts.map(p=>toS(p[0],p[1],k));let mn=Infinity,mx=-Infinity;for(const q of sp){if(q[0]<mn)mn=q[0];if(q[0]>mx)mx=q[0];}if(mx<-20||mn>CW+20)continue;
|
||||
if(hot||!cached){ctx.globalAlpha=hot?0.95:0.4;ctx.strokeStyle=col;ctx.lineWidth=hot?3:1.6;ctx.lineJoin='round';ctx.setLineDash(C.age==='old'?[6,5]:[]);ctx.beginPath();ctx.moveTo(sp[0][0],sp[0][1]);for(let i=1;i<sp.length;i++)ctx.lineTo(sp[i][0],sp[i][1]);ctx.stroke();ctx.setLineDash([]);}
|
||||
if(hot||(z>=1.7&&!ar)){const m=sp[Math.floor(sp.length/2)];ctx.globalAlpha=hot?1:0.75;ctx.lineWidth=3;ctx.strokeStyle='rgba(255,255,255,.85)';ctx.strokeText(C.name,m[0],m[1]-8);ctx.fillStyle=col;ctx.fillText(C.name,m[0],m[1]-8);}
|
||||
if((hot||(z>=1.7&&!ar))&&lbOk(sp[Math.floor(sp.length/2)][0],sp[Math.floor(sp.length/2)][1]-8,ctx.measureText(C.name).width,sp,hot)){const m=sp[Math.floor(sp.length/2)];ctx.globalAlpha=hot?1:0.75;ctx.lineWidth=3;ctx.strokeStyle='rgba(255,255,255,.85)';ctx.strokeText(C.name,m[0],m[1]-8);ctx.fillStyle=col;ctx.fillText(C.name,m[0],m[1]-8);}
|
||||
ctx.globalAlpha=1;}}}
|
||||
function bezGeom(l,at){const A=CITY[l.a],B=CITY[l.b];const i=at!==undefined?at:lineIdx(l);const key=l.id+'|b'+i;const hit=GEO.get(key);if(hit)return hit;
|
||||
const bx=A.x+wrapDx(A.x,B.x),by=B.y;const dx=bx-A.x,dy=by-A.y,len=Math.hypot(dx,dy)||1;let nx=-dy/len,ny=dx/len;if(ny>0){nx=-nx;ny=-ny;}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue