Free tier and full tier (Marty 2026-11-02, every game must fund itself): a free InstantAdPay account hunts one code a day drawn on 0.02 to 0.10 POL; Game Pass holders keep five a day at the full draw, the weekly prizes and the Mystery Hunt Box (a box already open stays reachable); advertiser-funded finds pay what the advertiser set on every tier; with GAMEPASS off everyone stays on the full tier. New settings freeMissionsPerDay / freeMinPol / freeMaxPol (admin), tests updated
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+8
-4
@@ -18,7 +18,10 @@ const { ctDay } = require('./missions');
|
||||
// drawSkew k: log-uniform on u^(1/k), so k=1 is the plain log-uniform and k=3 leans hard to the floor
|
||||
// (mean ~0.13 POL on 0.05..1, one drip in eighty above 0.5). missionsPerDay: finds per hunter per
|
||||
// Central day (Marty, 2026-09-20: cap 40, k=3, 3 a day, so a launch morning does not empty the pool)
|
||||
const DEFAULTS = { minPol: 0.05, maxPol: 1, dailyCapPol: 20, lowBalancePol: 40, drawSkew: 3, missionsPerDay: 3 };
|
||||
const DEFAULTS = { minPol: 0.05, maxPol: 1, dailyCapPol: 20, lowBalancePol: 40, drawSkew: 3, missionsPerDay: 3,
|
||||
// the free tier (Marty 2026-11-02, every game must fund itself): a free account gets freeMissionsPerDay hunts drawn on
|
||||
// freeMinPol..freeMaxPol; the full allotment and the full draw are for Game Pass holders (the Pass is the purchase)
|
||||
freeMissionsPerDay: 1, freeMinPol: 0.02, freeMaxPol: 0.1 };
|
||||
function settings() { return Object.assign({}, DEFAULTS, store.read('settings', {})); }
|
||||
function setSettings(patch) { return store.update('settings', {}, s => Object.assign(s, patch)); }
|
||||
|
||||
@@ -36,7 +39,7 @@ function draw(min, max, skew) {
|
||||
// returned 0 for everyone, which would read as "no finds yet" to any new caller
|
||||
function findsToday(memberId, day) { const d = day || ctDay(); return store.read('payouts', []).filter(p => p.memberId === Number(memberId) && p.day === d && p.status !== 'failed' && !p.prize && !p.ref && !p.detective).length; }
|
||||
// passExtra: the Game Pass perk, +2 missions a day while the member's pass is active (GAME-PASS.md 4: 3 -> 5); 0 otherwise
|
||||
function daily(memberId, doneIds, bonus, passExtra) { const s = settings(); const base = Math.max(1, Number(s.missionsPerDay) || 3);
|
||||
function daily(memberId, doneIds, bonus, passExtra, pass) { const s = settings(); const base = pass ? Math.max(1, Number(s.missionsPerDay) || 3) : Math.max(1, Number(s.freeMissionsPerDay) || 1); // free tier since 2026-11-02
|
||||
// every live paid mission this hunter has not done yet adds one, because the company is not
|
||||
// funding that completion
|
||||
let extra = 0; try { extra = require('./paid').extraAllowance(doneIds); } catch (e) {}
|
||||
@@ -44,7 +47,8 @@ function daily(memberId, doneIds, bonus, passExtra) { const s = settings(); cons
|
||||
const fb = Math.max(0, Number(bonus) || 0), pe = Math.max(0, Number(passExtra) || 0);
|
||||
const limit = base + extra + fb + pe; const done = findsToday(memberId, ctDay()); return { limit, done, left: Math.max(0, limit - done), base, friday: fb, pass: pe }; }
|
||||
// the nominal amount a completion of `mission` would pay (the Game Pass asks InstantAdPay about it before grant() records it)
|
||||
function quote(mission) { const s = settings(); return mission.paid ? Math.round(Number(mission.hunterPol || 0) * 10000) / 10000 : draw(Number(s.minPol), Number(s.maxPol)); }
|
||||
function quote(mission, pass) { const s = settings(); if (mission.paid) return Math.round(Number(mission.hunterPol || 0) * 10000) / 10000; // an advertiser-funded find pays what the advertiser set, every tier
|
||||
return pass ? draw(Number(s.minPol), Number(s.maxPol)) : draw(Number(s.freeMinPol), Number(s.freeMaxPol)); } // the free draw since 2026-11-02
|
||||
// What the COMPANY has spent today. Advertiser-funded completions are excluded on purpose: the
|
||||
// hunter is paid out of what the advertiser already put in the faucet, so counting it here would
|
||||
// let a paid mission use up the house budget (Marty, 2026-09-24).
|
||||
@@ -74,7 +78,7 @@ function grant(member, mission, opts) {
|
||||
// An advertiser-funded mission pays exactly what the advertiser set, every time. No draw, so
|
||||
// the reserve taken at purchase is exact and can never come up short.
|
||||
const isPaid = !!mission.paid;
|
||||
const pol = opts.pol != null ? Math.round(Number(opts.pol) * 10000) / 10000 : quote(mission);
|
||||
const pol = opts.pol != null ? Math.round(Number(opts.pol) * 10000) / 10000 : quote(mission, !!opts.pass);
|
||||
const day = ctDay();
|
||||
const budgetLeft = mission.budget ? mission.budget - store.read('payouts', []).filter(p => p.missionId === mission.id && p.status !== 'failed').length : Infinity;
|
||||
if (budgetLeft <= 0) return { error: 'This mission has paid out all it was funded for.' };
|
||||
|
||||
Reference in New Issue
Block a user