The sales desk answers renewal haggles, each salesperson their way
With the new switch at the sales desk, whoever runs sales answers a renewal haggle three days after it opens, unless the player did first. The engineer gives business customers their discount and keeps nerdy ones at the market price (nobody leaves); the shark holds the old price, often with a fresh promise, bills a month of the saving, and loses some (nerds most); the CEO gives 10% more off for a double term, says yes, or picks a fight. Every answer is a hash of the contract. The switch is stored only when on, so existing saves are unchanged.
This commit is contained in:
parent
d7aad7d965
commit
74e8611f8e
17 changed files with 238 additions and 6 deletions
|
|
@ -243,6 +243,8 @@ const API_CMD={
|
|||
doc:'With the CEO running sales: pay for a board meeting that brings a VP of Sales, who frees the desk a month later.'},
|
||||
salesAuto:{args:[],watch:['slAuto'],
|
||||
doc:'With someone at the sales desk: switch automatic signing on or off. Once a game day they sign the offers that fit, in their own style: eng and ceo after a routing trial (one a day; an offer that did not fit waits a week), shark every offer whose POPs are up, promises and all, while the cash covers the commission. Orbit offers sign where the landing dish has room (the shark ignores that). Nobody at the desk: nothing is signed for you.'},
|
||||
salesRen:{args:[],watch:['slAuto'],
|
||||
doc:'Switch whether the sales desk answers renewal haggles for you, 3 days after each opens (only while someone runs sales). The engineer gives business customers their discount and keeps nerdy ones at the market price; the shark holds the old price (sometimes with a new promise, billing a month of the saving) but some walk; the CEO gives 10% more off for a double term, says yes, or picks a fight and loses them.'},
|
||||
salesMin:{args:[],watch:['slAuto'],
|
||||
doc:'Step the minimum monthly value under which the sales desk declines offers: never, 2k, 5k, 10k, 25k, 50k. With the CEO, about one decline in three is signed anyway.'},
|
||||
renewMatch:{args:[['id','entityId']],watch:['biz.#id'],
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const API_STATE_DOC={
|
|||
biz:{type:'array',doc:'Signed customers: type, cities, bandwidth, rate, mood, contract dates (te: the day the term ends, mk: the bandwidth market it was priced in, hag: an open renewal haggle {rate, until}).'},
|
||||
offers:{type:'array',doc:'Pending customer offers, each expiring on a day (mk: the bandwidth market they were priced in; refN: the customer who referred them).'},
|
||||
sales:{type:'map',doc:'The sales desk: p (eng, shark, ceo or null), hired (day), vp (the day a VP of Sales takes over from the CEO), golf and say (the CEO\'s next golf deal and opinion). Offers and customers carry by: who brought or signed them, orbit ones too (the shark\'s may carry the skyfull promise).'},
|
||||
slAuto:{type:'map',doc:'Deals the sales desk signs for you (only while someone runs sales): on (sign offers that fit), min (decline offers paying less a month; 0 never), wk (this week: w, p who was at the desk, n signed, rev their monthly revenue, x declined, y declined but signed anyway by the CEO) and rep (last week, the same).'},
|
||||
slAuto:{type:'map',doc:'Deals the sales desk signs for you (only while someone runs sales): on (sign offers that fit), min (decline offers paying less a month; 0 never), ren (answer renewal haggles), wk (this week: w, p who was at the desk, n signed, rev their monthly revenue, x declined, y declined but signed anyway by the CEO) and rep (last week, the same).'},
|
||||
cl:{type:'map',doc:'Customer lifecycle (#178): odd (the day of the last unusual departure) and mo, one entry a month of customers won, renewed, grown, haggling and lost by reason.'},
|
||||
done:{type:'map',doc:'Goals landed, by goal id → day.'},
|
||||
ach:{type:'map',doc:'Badges earned this game, by badge id → day.'},
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const slAutoOn=()=>!!(S&&S.slAuto&&slP()&&(S.slAuto.on||S.slAuto.min));
|
|||
function slWkOk(x){if(!x||typeof x!=='object'||Array.isArray(x)||!own(SALES,x.p))return null;const n=v=>int(v,0,1e6,0);return {w:n(x.w),p:x.p,n:n(x.n),rev:int(x.rev,0,1e10,0),x:n(x.x),y:n(x.y)};}
|
||||
const slWkAny=x=>!!x&&(x.n>0||x.x>0);
|
||||
function slAutoFix(s){const a=s.slAuto&&typeof s.slAuto==='object'&&!Array.isArray(s.slAuto)?s.slAuto:{};
|
||||
s.slAuto={on:a.on===true,min:SL_MINS.includes(a.min)?a.min:0,wk:slWkOk(a.wk),rep:slWkOk(a.rep)};}
|
||||
s.slAuto={on:a.on===true,min:SL_MINS.includes(a.min)?a.min:0,wk:slWkOk(a.wk),rep:slWkOk(a.rep)};if(a.ren===true)s.slAuto.ren=true;}
|
||||
// An old save whose intern ran the sales order: the same switch and minimum, now at the sales desk (they run once someone is there).
|
||||
function slAutoFrom(s,on,p){if(!on||(s.slAuto&&typeof s.slAuto==='object'))return;s.slAuto={on:p.acc!==false,min:SL_MINS.includes(p.min)?p.min:0,wk:null,rep:null};}
|
||||
// "This week Dave signed 3 customers (+$41k/mo), declined 17 tiny offers."
|
||||
|
|
|
|||
36
src/game/60-features/39-sales-renewals.js
Normal file
36
src/game/60-features/39-sales-renewals.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* ---------- The sales desk answers renewal haggles ----------
|
||||
A customer near the end of its term may ask for a discount (#178, 75-customer-lifecycle.js). With S.slAuto.ren on,
|
||||
whoever runs sales answers it SL_REN_WAIT days after it opens, so the player can still answer first. Each in their way:
|
||||
- the engineer talks technology, not price: nerdy customers get an afternoon with the network diagrams and renew at
|
||||
the market price, now and then halfway; everyone else gets the discount they asked for. Nobody leaves.
|
||||
- the shark gives nothing away: most renew at the old price, often with a fresh promise, and he bills a month of what
|
||||
he saved you. Some walk, nerdy ones most of all.
|
||||
- the CEO settles it on the golf course: a deeper discount than asked for a contract twice as long, a quick yes, or
|
||||
a fight that ends with the customer gone.
|
||||
Each answer is a hash of the contract (clR), so no random numbers are drawn. */
|
||||
const SL_REN_WAIT=3;
|
||||
const slRenOn=()=>!!(S&&S.slAuto&&S.slAuto.ren&&slP());
|
||||
// The day the desk answers this haggle: a few days after it opened (30 days before the term ends), today at the earliest.
|
||||
const slRenAt=b=>b.hag.until-30+SL_REN_WAIT;
|
||||
function slRenDay(d){if(!slRenOn())return;const p=slP();let any=false;
|
||||
for(const b of S.biz.slice())if(b.hag&&d>=slRenAt(b)&&d<b.hag.until){slRenOne(b,p);any=true;}
|
||||
if(any)compute();}
|
||||
// One haggle: returns what happened (for the tests): 'tech', 'mid', 'cave', 'hold', 'walk', 'golf', 'yes', 'fight'.
|
||||
function slRenOne(b,p){const ask=b.hag.rate,was=b.rate,mid=clMid(b),nerd=SALES_NERDS.includes(b.type),r=clR(b,'sl|'+p);
|
||||
const v=x=>({name:esc(slCap()),cust:esc(b.name),...x}),bill=rate=>fmt$(clBill(b,rate));
|
||||
const keep=(rate,how,key,x,s)=>{clRenew(b,rate);clNote('ren');toast(tr(key,v({price:bill(b.rate),...x})),s===undefined?'good':s,[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);return how;};
|
||||
const gone=(how,key)=>{clGone(b,'cheap');toast(tr(key,v({})),'bad');sfx('err');return how;};
|
||||
if(p==='eng'){if(!nerd)return keep(ask,'cave','sales.ren_eng_cave');
|
||||
return r<0.7?keep(Math.max(ask,Math.min(was,clFair(b))),'tech','sales.ren_eng_tech'):keep(mid,'mid','sales.ren_mid');}
|
||||
if(p==='shark'){const walk=nerd?0.4:0.12;if(r<walk)return gone('walk','sales.ren_shark_walk');
|
||||
if(r<walk+0.5){const fee=Math.round(clBill(b,was-ask)),k=clR(b,'slp')<0.5?salesPromise(b):null;
|
||||
if(k)b.reqs=(b.reqs||[]).concat(k);S.cash-=fee;
|
||||
const req=k?' '+tr('sales.ceo_promised',{req:esc(typeof REQS[k].l==='function'?REQS[k].l(b):REQS[k].l)}):'';
|
||||
clRenew(b,was);clNote('ren');toast(tr('sales.ren_shark_hold',v({price:bill(b.rate),fee:fmt$(fee)}))+req,'',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);return 'hold';}
|
||||
return keep(mid,'mid','sales.ren_mid');}
|
||||
if(r<0.25)return gone('fight','sales.ren_ceo_fight');
|
||||
if(r<0.6){clRenew(b,Math.round(ask*0.9));b.te=clTerm(b,b.te);clNote('ren');
|
||||
toast(tr('sales.ren_ceo_golf',v({price:bill(b.rate),date:dateStr(b.te)})),'',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);return 'golf';}
|
||||
return keep(ask,'yes','sales.ren_ceo_yes',{},'');}
|
||||
// Under a haggle in Deals: when the desk will answer it.
|
||||
const slRenRow=b=>slRenOn()&&b.hag.until>S.day?`<div class="meta">${tr('sales.ren_when',{name:esc(slCap()),date:dateStr(Math.max(S.day+1,slRenAt(b)))})}</div>`:'';
|
||||
|
|
@ -117,7 +117,7 @@ const clHags=()=>S?S.biz.reduce((a,b)=>a+(b.hag?1:0),0):0;
|
|||
function clDealsHtml(){const hs=S.biz.filter(b=>b.hag).sort((a,b)=>a.hag.until-b.hag.until);if(!hs.length)return '';
|
||||
return `<h3 class="sub4">${tr('lifecycle.renewals')}</h3><p class="meta" style="margin:0 0 6px">${tr('lifecycle.unanswered_matches')}</p>`+hs.map(b=>{const now=BIZ_T[b.type].fiber?b.hag.rate:b.bw*b.hag.rate,was=bizMo(b);
|
||||
return `<div class="row"><div class="grow"><div class="nm">${esc(b.name)}</div><div class="meta">${esc(BIZ_T[b.type].l)} · ${esc(clWhere(b))} · ${tr('ui.n_d_left',{n:b.hag.until-S.day})}</div>
|
||||
<div class="meta">${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}</div>
|
||||
<div class="meta">${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}</div>${slRenRow(b)}
|
||||
<div class="btns">${btn(tr('lifecycle.match'),'renewMatch',{id:b.id},'green sm')}${btn(tr('lifecycle.meet_halfway',{price:fmt$(clBill(b,clMid(b)))}),'renewMeet',{id:b.id},'sm')}${btn(tr('lifecycle.let_them_go'),'renewLet',{id:b.id},'ghost sm')}</div></div></div>`;}).join('');}
|
||||
// The contract line on a customer row.
|
||||
const clTermTxt=b=>clOn(b)&&b.te?(b.hag?tr('lifecycle.renewal_haggle',{date:dateStr(b.te)}):tr('lifecycle.contract_until',{date:dateStr(b.te)})):'';
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ function dayPost(d){
|
|||
// contracts: renewals, growth, haggles and leaving (75-customer-lifecycle.js)
|
||||
clDay(d);
|
||||
// the sales desk: meetings booked, golf played (38-sales-desk.js)
|
||||
salesDay(d);
|
||||
salesDay(d);slRenDay(d);
|
||||
// own IX members join
|
||||
for(const c in S.myIx){const m=S.myIx[c];if(d>=m.next&&m.members.length<myFab(c).max){
|
||||
const cands=NETS.filter(n=>n.type!=='t1'&&!m.members.includes(n.id)&&(n.pops.includes(c)||n.pops.some(p=>CITY[p].reg===CITY[c].reg)));
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ Object.assign(ACT,{
|
|||
// The CEO cannot be fired. A board meeting (and its catering) can get you a VP of Sales, who takes over a month later.
|
||||
// Signing for you (39-sales-auto.js): on or off, and the minimum under which offers are declined.
|
||||
salesAuto:()=>{if(!slP())return;const A=S.slAuto||(S.slAuto=slAutoNew());A.on=!A.on;sfx('click');after();salesModal();},
|
||||
salesRen:()=>{if(!slP())return;const A=S.slAuto||(S.slAuto=slAutoNew());if(A.ren)delete A.ren;else A.ren=true;sfx('click');after();salesModal();},
|
||||
salesMin:()=>{if(!slP())return;const A=S.slAuto||(S.slAuto=slAutoNew());A.min=opsCycle(SL_MINS,A.min);sfx('click');after();salesModal();},
|
||||
salesVp:()=>{if(slP()!=='ceo'||S.sales.vp)return;if(!spend(SALES_VP))return;S.sales.vp=S.day+SALES_VP_DAYS;toast(tr('sales.vp_asked',{n:SALES_VP_DAYS}),'');after();salesModal();},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,12 +19,15 @@ function salesModal(){if(!S)return;const p=slP(),L=S.sales||{};
|
|||
// What each of them does in orbit, shown once there is a rocket company to sell for (99-pie-sales.js).
|
||||
const SL_SKY={eng:N_('sales.eng_sky'),shark:N_('sales.shark_sky'),ceo:N_('sales.ceo_sky')};
|
||||
const SL_AUTO={eng:N_('sales.auto_eng'),shark:N_('sales.auto_shark'),ceo:N_('sales.auto_ceo')};
|
||||
const SL_REN={eng:N_('sales.ren_eng'),shark:N_('sales.ren_shark'),ceo:N_('sales.ren_ceo')};
|
||||
// Signing for you (39-sales-auto.js): the switch, the minimum, and this week's and last week's tally.
|
||||
function slAutoHtml(p){const A=S.slAuto||slAutoNew(),w=Math.floor(S.day/7),cur=A.wk&&A.wk.w===w&&slWkAny(A.wk)?A.wk:null,rep=A.rep&&A.rep.w===w-1?A.rep:null;
|
||||
const row=(x,last)=>`<div class="ops-rep">${esc(slWeekLine(x,last))}</div>`;
|
||||
return `<section class="sl-auto"><h3>${tr('sales.auto')}</h3><p class="meta">${tr(SL_AUTO[p],{name:esc(slCap())})}</p>
|
||||
<div class="ops-p"><button class="b sm ${A.on?'green':'ghost'}" data-act="salesAuto" data-args='{}' aria-pressed="${A.on}">${tr('sales.p_sign')}: <b>${A.on?tr('common.on'):tr('common.off')}</b></button>
|
||||
${btn(`${tr('sales.decline_below')}: <b>${A.min?tr('common.price_mo',{price:fmt$(A.min)}):tr('sales.never')}</b>`,'salesMin',{},'ghost sm')}</div>
|
||||
${rep?row(rep,true):''}${cur?row(cur,false):''}</section>`;}
|
||||
${rep?row(rep,true):''}${cur?row(cur,false):''}</section>
|
||||
<section class="sl-auto"><h3>${tr('sales.ren')}</h3><p class="meta">${tr(SL_REN[p],{name:esc(slCap())})}</p>
|
||||
<div class="ops-p"><button class="b sm ${A.ren?'green':'ghost'}" data-act="salesRen" data-args='{}' aria-pressed="${!!A.ren}">${tr('sales.p_ren')}: <b>${A.ren?tr('common.on'):tr('common.off')}</b></button></div></section>`;}
|
||||
// On the card in Deals: this week's tally, once there is one.
|
||||
function slCardLine(){if(!slAutoOn())return '';const A=S.slAuto,x=A.wk&&A.wk.w===Math.floor(S.day/7)&&slWkAny(A.wk)?A.wk:null;return x?esc(slWeekLine(x,false)):'';}
|
||||
|
|
|
|||
|
|
@ -4330,8 +4330,22 @@
|
|||
"sales.locked":"The sales desk opens at customer level {lv}.",
|
||||
"sales.never":"never",
|
||||
"sales.one_at_a_time":"One at a time: let them go to hire someone else.",
|
||||
"sales.p_ren":"Answer haggles",
|
||||
"sales.p_sign":"Sign deals",
|
||||
"sales.pitch":"One salesperson brings in deals their own way. Pick who.",
|
||||
"sales.ren":"Renewal haggles",
|
||||
"sales.ren_ceo":"{name} answers a customer's haggle three days after it opens, on the golf course: a deeper discount than they asked for in exchange for a contract twice as long, a quick yes, or a fight that ends with the customer gone.",
|
||||
"sales.ren_ceo_fight":"{name} told {cust} that nobody haggles with him. They have left.",
|
||||
"sales.ren_ceo_golf":"{name} sorted out {cust} on the golf course: {price}/mo, even less than they asked, locked in until {date}.",
|
||||
"sales.ren_ceo_yes":"{name} said yes to {cust} before anyone could check: {price}/mo.",
|
||||
"sales.ren_eng":"{name} answers a customer's haggle three days after it opens. Nerdy customers get an afternoon with the network diagrams and usually renew at the market price; everyone else gets the discount they asked for. Nobody leaves.",
|
||||
"sales.ren_eng_cave":"{name} gave {cust} the discount they asked for: {price}/mo. They stay.",
|
||||
"sales.ren_eng_tech":"{name} walked {cust}'s engineers through the network for an afternoon. They renew at {price}/mo, no discount needed.",
|
||||
"sales.ren_mid":"{name} met {cust} halfway: {price}/mo.",
|
||||
"sales.ren_shark":"{name} answers a customer's haggle three days after it opens, and gives nothing away: most renew at the old price, often with a fresh promise, and he bills you a month of what he saved. Some walk, nerdy ones most of all.",
|
||||
"sales.ren_shark_hold":"{name} told {cust} the price is the price. They renew at {price}/mo, and he bills you {fee} for the save.",
|
||||
"sales.ren_shark_walk":"{name} played hardball with {cust}, and they walked.",
|
||||
"sales.ren_when":"{name} answers this on {date}, unless you do first.",
|
||||
"sales.shark_d":"Lands the biggest deals at a quarter more, and takes a month of each deal as commission. Oversells: half of them come with a promise your network does not keep yet, and those customers leave sooner. Ignores the nerds: no technical customers, no meetings, and peering desks want a quarter more traffic from you. Wins most haggles.",
|
||||
"sales.shark_n":"The shark",
|
||||
"sales.shark_s":"Chad",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue