Deals belong to Sales: the intern sticks to the network, the sales desk signs deals for you, orbit ones too

The NOC intern loses the sales order. Saves that had it load cleanly: sanitize drops the order, its log lines and its
weekly tally, and an intern who was running it hands its switch and minimum to the sales desk (S.slAuto).

With someone at the sales desk, the player can let them sign offers once a game day and decline the ones under a
minimum (39-sales-auto.js), each in their own style: the engineer and the CEO sign after the #185 routing trial (one a
day, a misfit waits a week), the shark signs every offer whose POPs are up, promises and commission included, and the
CEO's declines are a handshake away. Orbit offers need room on their landing dish instead of a trial. Nobody at the
desk (the default; the CEO is a choice, not a given): every deal is signed by hand. The sales desk runs before the
intern's shift, so a deal signed today is in the loads the intern works from. The sheet shows the switch, the minimum
and this week's and last week's tally; the NOC gets one notice a week.

Orbit offers go through the desk too (99-pie-sales.js): they carry o.by, so commission, renewal haggles and each
one's mark at renewal apply. The engineer only offers where the landing dish has 1.5x room on a well-served POP, and
those customers renew like the nerds (0.5x leave). The shark rings airlines, cruise lines and the Mars mission first,
at the biggest size that fits and 25% more, and half of them get a full-sky promise (REQS.skyfull: a crust at 90%)
before there is one; they grumble down to 40 happiness and never cancel over the promise alone. The CEO plays every
other golf game with the Founder: the biggest orbit deal that fits, Mars first, at 30% off; jitters cut his orbit
prices by 0.4x the jitters and from 0.6 the Founder skips golf. Without a salesperson orbit offers are drawn exactly
as before (the O7 balance save has nobody at the desk: payback unchanged, 7.0 years on seed 7, 7.5 on seed 11).

Also: the scenario reference plays 'sales' as the CEO signing for you; the route fuzz leaves out the state and
buttons of a standing order only main still has; the intern's on/off dials (paid peering, keep a spare) show their
translated value in the shipped page instead of the raw label.
This commit is contained in:
Frederic Jung 2026-11-06 09:40:18 +01:00
parent 2243280aff
commit 9a5522bbb1
No known key found for this signature in database
28 changed files with 613 additions and 184 deletions

View file

@ -0,0 +1,36 @@
/* ---------- Pie in the Sky: the sales desk sells orbit too (38-sales-desk.js, 99-pie-orbit-customers.js) ----------
Orbit offers go through whoever runs sales, as ground offers do: they carry o.by (so the shark's commission, the
renewal haggles and each one's mark at renewal apply), plus what each of them does with a sky to sell:
- the engineer only offers a deal where the dish it lands on has room to spare (PIE_ENG_ROOM times the deal) and its
POP is well served (PIE_ENG_SF), and their orbit customers renew like the nerds do (salesLeaveMul);
- the shark calls airlines and cruise lines first, asks for the biggest size that fits at a quarter more, and promises
half of them a full sky (REQS.skyfull) before the crust is there: those customers grumble until it is, but never
cancel over the promise alone (they stop at PIE_GRUMBLE happiness);
- the CEO plays some of his golf with the Founder (one game in two while a rocket company exists): the biggest orbit
deal that fits, the Mars mission first, at 30% off and with a promise nobody checked. A jumpy market costs him:
his orbit prices drop by PIE_CEO_JIT times the jitters, and from PIE_CEO_SKIP the Founder does not show up.
Rolls are hashes of the deal (slR), never Math.random: without a salesperson orbit offers are drawn exactly as before. */
const PIE_ENG_ROOM=1.5,PIE_ENG_SF=0.98,PIE_SHARK=1.25,PIE_SHARK_OVER=0.5,PIE_PROMISE=0.9,PIE_GRUMBLE=40,PIE_GOLF_SKY=0.5,PIE_CEO_JIT=0.4,PIE_CEO_SKIP=0.6;
// What the salesperson can sell on a landing (pieServe()'s answer): the engineer keeps headroom on healthy dishes only.
function pieSlRoom(L){if(slP()!=='eng')return L.left;const d=pieDishes()[L.k];return d&&!R.pie.isl.includes(d.city)&&sfOf(R,d.city)>=PIE_ENG_SF?L.left/PIE_ENG_ROOM:0;}
// Which kinds get a call: the shark rings airlines and cruise lines first.
function pieSlTypes(t){if(slP()!=='shark')return t;const big=t.filter(x=>x==='flywifi'||x==='boat'||x==='marsorb');return big.length?big:t;}
// The size: the shark asks for the biggest that fits, everyone else as the customer asks (pick, as before).
const pieSlSize=opts=>slP()==='shark'?opts[opts.length-1]:pick(opts);
// A new orbit offer, dressed by whoever is at the desk.
function pieSlShape(o){const p=slP();if(!p)return;o.by=p;
if(p==='shark'){o.rate=Math.round(o.rate*PIE_SHARK);if(!REQS.skyfull.ok()&&slR('skyover|'+slKey(o))<PIE_SHARK_OVER)o.reqs=['skyfull'];}
if(p==='ceo'){const j=pieJit();if(j>0)o.rate=Math.round(o.rate*(1-PIE_CEO_JIT*j));}}
const pieJit=()=>(S.pie&&S.pie.founder&&S.pie.founder.jit)||0;
// The CEO's golf with the Founder (salesGolf, on a golf day): true when this game was in orbit, deal or no deal.
function pieGolf(d){if(!pieOn()||!S.pie||!S.pie.co||slR('golfsky|'+d)>=PIE_GOLF_SKY)return false;
const ts=pieOfferTypes();if(!ts.length)return false;
if(pieJit()>=PIE_CEO_SKIP){toast(tr('sales.ceo_golf_skip'),'');return true;}
for(const t of ['marsorb','boat','flywifi','pizza']){if(!ts.includes(t))continue;const T=BIZ_T[t];
const cs=pieCands(t).filter(c=>!c.cn).map(c=>[c,pieServe(c.id,t)]).filter(([,L])=>L&&L.left>=T.opts[0]).sort((a,b)=>b[0].P-a[0].P||(a[0].id<b[0].id?-1:1));if(!cs.length)continue;
const [c,L]=cs[0],bw=T.opts.filter(g=>g<=Math.min(pieRoom(t),L.left)).pop();if(!bw)continue;
const list=T.names.filter(n=>!S.usedNames.includes(n)),name=list.length?list[Math.floor(slR('golfskyn|'+d)*list.length)]:T.names[0];useName(name);
const off=1-0.7*(1-PIE_CEO_JIT*pieJit()),o={id:uid(),city:c.id,city2:null,name,type:t,bw,rate:Math.round(T.rate*(1-off)),reqs:REQS.skyfull.ok()?[]:['skyfull'],exp:d+40};
const b=offerCustomer(o);b.by='ceo';S.biz.push(clSign(b));
toast(tr('sales.ceo_golf_sky',{name:esc(name),city:esc(c.name),bw:fmtG(bw),price:fmt$(bw*o.rate),p:pct(off)})+(o.reqs.length?' '+tr('sales.ceo_promised',{req:esc(REQS.skyfull.l())}):''),'goal',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);sfx('coin');return true;}
return false;}