From b69086aaacd33e703eca477da23f10b7a22f29cd Mon Sep 17 00:00:00 2001 From: martbost Date: Mon, 2 Nov 2026 17:01:10 -0600 Subject: [PATCH] Tiers (Marty 2026-11-02, every game must fund itself): guests earn nothing (a guest's chapters, drips and best follow them at sign-in, the POL does not; no more collected= payout on /auth), a free InstantAdPay account earns freeSharePct (25, admin) of the chapter drip with the note "Game Pass holders earn the full amount.", Game Pass holders earn the full drip plus the shield perk, GAMEPASS off = everyone full. /api/me carries tier, freeSharePct and yourDrip; landing, lobby, clear card, tester briefing and share preview say play free, sign in to earn a taste, Game Pass for the full table. Tests: guest 0 at sign-in, free 25%, pass 100%, gp off full, settings key. Co-Authored-By: Claude Fable 5.1 --- lib/game.js | 5 +++-- lib/ledger.js | 47 +++++++++++++++++++++++++++++++-------------- public/admin.html | 3 ++- public/admin.js | 4 ++-- public/index.html | 6 +++--- public/play.html | 4 ++-- public/play.js | 13 +++++++------ public/testers.html | 2 +- server.js | 17 ++++++++-------- test/gamepass.js | 35 +++++++++++++++++++++------------ test/run.js | 11 +++++++---- 11 files changed, 92 insertions(+), 55 deletions(-) diff --git a/lib/game.js b/lib/game.js index 9fd2586..b58609d 100644 --- a/lib/game.js +++ b/lib/game.js @@ -96,9 +96,9 @@ async function events(me, runId, t, list, wantGoal) { // async since the Game Pa if (out.chapDrips < out.goal) { res.cleared = null; res.short = out.goal - out.chapDrips; return res; } const ch = out.chapter; const p = player(me.memberId); const first = !(p.cleared || {})[ch]; + // a guest earns nothing (Marty 2026-11-02): the clear counts as progress and follows them when they sign in, the POL does not const grant = me.guest ? { pol: 0, reason: 'guest' } : await ledger.chapterDripGated(me, ch, first && !out.flagged); if (first && out.flagged) grant.reason = 'flagged'; - if (me.guest && first && !out.flagged) updPlayer(me.memberId, x => { x.pending = Array.from(new Set([...(x.pending || []), ch])); }); // paid when they sign in updPlayer(me.memberId, x => { x.cleared[ch] = true; if (x.chapter <= ch) x.chapter = ch + 1; }); updRun(runId, x => { x.cleared.push(ch); x.chapter = ch + 1; x.chapDrips = 0; x.goal = spawn.goalFor(ch + 1); }); res.cleared = { chapter: ch, first, pol: grant.pol, reason: grant.reason, note: grant.note || null, next: ch + 1, nextGoal: spawn.goalFor(ch + 1), playTime: Math.round(out.t) }; // note = the Game Pass truth @@ -138,7 +138,8 @@ function buy(me, item) { return { error: 'No such item.' }; } // Move everything one id owns onto another (a guest who signs in, or a wallet-less member who links a wallet). -// Returns the chapters the old id cleared as a guest that the new id has never cleared: the caller pays those. +// Returns the chapters the old id cleared as a guest that the new id has never cleared. Since 2026-11-02 nobody pays those +// (guests earn nothing; the progress carries, the POL does not); the list is informational. function adopt(fromId, toId) { fromId = Number(fromId); toId = Number(toId); if (!fromId || fromId === toId) return { moved: false, pending: [] }; const all = store.read('players', {}); const a = all[String(fromId)]; if (!a) return { moved: false, pending: [] }; diff --git a/lib/ledger.js b/lib/ledger.js index 1565bc7..b8295a3 100644 --- a/lib/ledger.js +++ b/lib/ledger.js @@ -25,7 +25,11 @@ const DEFAULTS = { itemPol: { shield: 0.05, slow: 0.03 }, // hangar items paid from the POL balance (the sink) itemDrips: { magnet: 250, ship: 600 }, // hangar items paid in drips (never money) refSharePct: 10, // the referrer's slice of each refuel's pool income (their referrals' refuels), paid into the referrer's game balance - testers: [], // emails or member ids allowed through the hand-off while signups = 'testers' + // the free tier (Marty 2026-11-02, every game must fund itself): a free InstantAdPay account earns freeSharePct of the chapter + // drip; Game Pass holders earn the full table (the Pass is the purchase that funds the game); guests earn nothing. With + // GAMEPASS off there is no pass to buy, so everyone counts as a pass holder + freeSharePct: 25, + testers: [], // emails or member ids allowed through the hand-off while signups = 'testers' trial: true, // posts say 'coming soon, in testing' and 'would have earned' until Marty flips it signups: 'testers' // 'testers' | 'key' (tester list or the curtain pass) | 'open' | 'closed' }; @@ -79,10 +83,12 @@ function refuelsToday() { const d = ctDay(); return store.read('refuels', []).fi function account(memberId) { return Object.assign({ memberId: Number(memberId), unpaid: 0, paidTotal: 0, spentTotal: 0, earnedTotal: 0 }, store.read('accounts', {})[String(memberId)] || {}); } function updAccount(memberId, fn) { return store.update('accounts', {}, all => { const a = Object.assign({ memberId: Number(memberId), unpaid: 0, paidTotal: 0, spentTotal: 0, earnedTotal: 0 }, all[String(memberId)] || {}); fn(a); a.unpaid = r4(a.unpaid); all[String(memberId)] = a; return all; })[String(memberId)]; } -// a first-time chapter clear. eligible=false means a replay or a flagged run: cleared, unpaid. +// a first-time chapter clear. eligible=false means a replay or a flagged run: cleared, unpaid. A guest earns nothing (2026-11-02). function chapterDrip(me, chapter, eligible) { - const s = settings(); const pol = r4(Number(s.dripPol)); + if (me && me.guest) return { pol: 0, reason: 'guest' }; + const full = fullTier(me), pol = dripFor(me); if (!eligible) return { pol: 0, reason: 'replay' }; + if (!(pol > 0)) return { pol: 0, reason: 'none' }; const p = pool(); if (p.capLeft < pol) return { pol: 0, reason: 'cap' }; if (p.available < pol) return { pol: 0, reason: 'pool' }; @@ -90,7 +96,7 @@ function chapterDrip(me, chapter, eligible) { store.update('drips', [], all => { all.push(row); return all; }); poolAdd('out', pol); updAccount(me.memberId, a => { a.unpaid += pol; a.earnedTotal = r4((a.earnedTotal || 0) + pol); a.wallet = me.wallet || a.wallet || null; a.username = me.username || a.username || null; }); - return { pol, reason: 'paid', id: row.id }; + return freeNoted(full, { pol, reason: 'paid', id: row.id }); } // the sink: a hangar item paid from the member's unpaid POL balance goes back to the pool @@ -113,9 +119,20 @@ const gp = require('./polgrant'); const kindOf = key => 'progress'; // refs: chapter: const iapId = me => Number(me.memberId) > 0 ? Number(me.memberId) : 0; const passActive = me => !!(gp.on() && me && !me.guest && gp.passOf(iapId(me), me.email).active); +// the tiers (Marty 2026-11-02): guests earn nothing; a free InstantAdPay account earns freeSharePct of the table; Game Pass +// holders earn the full table. With GAMEPASS off there is no pass to buy, so every signed-in player is on the full tier. +const fullTier = me => !gp.on() || passActive(me); +const tierOf = me => (!me || me.guest) ? 'guest' : fullTier(me) ? 'full' : 'free'; +function freeShare() { const v = Number(settings().freeSharePct); return Number.isFinite(v) ? Math.max(0, Math.min(100, v)) : Number(DEFAULTS.freeSharePct); } +// what one first clear pays this player: the table for the full tier, freeSharePct of it for a free account (4 decimals) +function dripFor(me) { const full = r4(Number(settings().dripPol)); return fullTier(me) ? full : r4(full * freeShare() / 100); } +const FREE_NOTE = 'Game Pass holders earn the full amount.'; +// a reward that was scaled to the free share carries the note the client already shows (deferred / recorded notes stay in front). +// full = the tier at quote time: a grant answer re-records the pass flag, so the tier is read once, before IAP is asked +function freeNoted(full, res) { if (res && !full && (res.pol > 0 || res.reason === 'deferred' || res.reason === 'iap')) res.note = (res.note ? res.note + ' ' : '') + FREE_NOTE; return res; } // the same checks as chapterDrip() up to (not including) the ledger write -> { pol, key, chapter } or { pol: 0, reason } function quote(me, chapter, eligible) { - const s = settings(); const pol = r4(Number(s.dripPol)); + const pol = dripFor(me); if (!eligible) return { pol: 0, reason: 'replay' }; if (!(pol > 0)) return { pol: 0, reason: 'none' }; const p = pool(); if (p.capLeft < pol) return { pol: 0, reason: 'cap' }; if (p.available < pol) return { pol: 0, reason: 'pool' }; @@ -131,17 +148,19 @@ function settleGrant(me, q, r, gkind) { updAccount(me.memberId, a => { a.unpaid += allowed; a.earnedTotal = r4((a.earnedTotal || 0) + allowed); a.wallet = me.wallet || a.wallet || null; a.username = me.username || a.username || null; a.email = me.email || a.email || null; a.gpOwed = r4(Math.max(0, (a.gpOwed || 0) + (Number(r.deferred) || 0) - extra)); }); return { pol: allowed, reason: allowed > 0 ? 'paid' : (gkind === 'daily' ? 'capday' : 'deferred'), nominal: q.pol, deferred: r4(r.deferred || 0), pass: !!r.pass, note: gp.note(r, gkind, q.pol), id: row.id }; } -// chapterDrip() with IAP in front of it. Switch off, or a guest: the plain chapterDrip, unchanged. Fail closed: no answer from -// IAP = nothing paid now, the ref queued and retried (polgrant.js), the player told it is recorded. +// chapterDrip() with IAP in front of it. Switch off: the plain chapterDrip, unchanged. A guest earns nothing, on either path +// (2026-11-02). Fail closed: no answer from IAP = nothing paid now, the ref queued and retried (polgrant.js), the player told +// it is recorded. A free account's quote is already the scaled amount (dripFor), so IAP's caps see the taste, not the table. async function chapterDripGated(me, chapter, eligible) { - if (!gp.on() || me.guest || !gp.whoOf(iapId(me), me.email)) return chapterDrip(me, chapter, eligible); - const q = quote(me, chapter, eligible); if (q.reason) return q; - if (gp.queued(iapId(me), me.email, q.key)) return { pol: 0, reason: 'iap', nominal: q.pol }; + if (me && me.guest) return { pol: 0, reason: 'guest' }; + if (!gp.on() || !gp.whoOf(iapId(me), me.email)) return chapterDrip(me, chapter, eligible); + const full = fullTier(me), q = quote(me, chapter, eligible); if (q.reason) return q; + if (gp.queued(iapId(me), me.email, q.key)) return freeNoted(full, { pol: 0, reason: 'iap', nominal: q.pol }); const gkind = kindOf(q.key), r = await gp.grant({ memberId: iapId(me), email: me.email, kind: gkind, pol: q.pol, ref: q.key }); - if (r.retry) { gp.enqueue({ memberId: iapId(me), email: me.email, ref: q.key, kind: gkind, pol: q.pol, me: { memberId: Number(me.memberId), username: me.username || null, wallet: me.wallet || null, email: me.email || null }, q }); return { pol: 0, reason: 'iap', nominal: q.pol, note: gp.note(r, gkind, q.pol) }; } - return settleGrant(me, q, r, gkind); + if (r.retry) { gp.enqueue({ memberId: iapId(me), email: me.email, ref: q.key, kind: gkind, pol: q.pol, me: { memberId: Number(me.memberId), username: me.username || null, wallet: me.wallet || null, email: me.email || null }, q, full }); return freeNoted(full, { pol: 0, reason: 'iap', nominal: q.pol, note: gp.note(r, gkind, q.pol) }); } + return freeNoted(full, settleGrant(me, q, r, gkind)); } -const payQueued = (item, r) => settleGrant(item.me, item.q, r, item.kind); // a queued ref finally answered +const payQueued = (item, r) => freeNoted(item.full !== false, settleGrant(item.me, item.q, r, item.kind)); // a queued ref finally answered (full = the tier when it was quoted) // once a Central day per account IAP still owes: a zero-POL progress call collects the carry-forward (IAP folds it into `allowed`) async function carrySweep() { if (!gp.on()) return 0; const today = ctDay(), accts = store.read('accounts', {}); let got = 0; @@ -195,4 +214,4 @@ function balance(memberId) { return { unpaid: r4(a.unpaid), paidTotal: r4(a.paidTotal || 0), spentTotal: r4(a.spentTotal || 0), earnedTotal: r4(a.earnedTotal || 0), refTotal: r4(a.refTotal || 0), refSharePct: Number(s.refSharePct) || 0, threshold: Number(s.thresholdPol), history: hist, wallet: a.wallet || null }; } -module.exports = { DEFAULTS, settings, setSettings, ctDay, pool, refuel, refuelsToday, account, chapterDrip, chapterDripGated, quote, settleGrant, kindOf, passActive, iapId, payQueued, carrySweep, gp, spend, sweep, payable, mark, balance, usdPerPol, r4 }; +module.exports = { DEFAULTS, settings, setSettings, ctDay, pool, refuel, refuelsToday, account, chapterDrip, chapterDripGated, quote, settleGrant, kindOf, passActive, fullTier, tierOf, freeShare, dripFor, FREE_NOTE, iapId, payQueued, carrySweep, gp, spend, sweep, payable, mark, balance, usdPerPol, r4 }; diff --git a/public/admin.html b/public/admin.html index 52ec065..3b7afd9 100644 --- a/public/admin.html +++ b/public/admin.html @@ -23,6 +23,7 @@
+
@@ -51,6 +52,6 @@

Payouts

Recent runs

- + diff --git a/public/admin.js b/public/admin.js index d19c737..c59177e 100644 --- a/public/admin.js +++ b/public/admin.js @@ -20,7 +20,7 @@ function load() { $('pool').innerHTML = stat('Available now', f4(p.available) + ' POL') + stat('In from refuels', f4(p.in)) + stat('Back from spends', f4(p.spends)) + stat('Out as drips', f4(p.out)) + stat('Seed float', f4(p.seed)) + stat('Granted today', f4(p.grantedToday) + ' / ' + f4(p.dailyCapPol)); var f = d.faucet; $('faucet').innerHTML = stat('Mode', f.enabled ? (f.dryRun ? 'DRY RUN' : 'LIVE') : 'off') + stat('Wallet', f.address ? f.address.slice(0, 8) + '…' + f.address.slice(-6) : '–') + stat('Balance', f.balance != null ? f4(f.balance) + ' POL' : '–') + stat('Last check', ct(f.checkedAt) || '–') + stat('Last tick', f.lastTick ? esc(JSON.stringify(f.lastTick)) : '–'); var s = d.settings, form = $('settings'); - ['refSharePct', 'dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { form.elements[k].value = s[k]; }); + ['refSharePct', 'dripPol', 'freeSharePct', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { form.elements[k].value = s[k]; }); form.elements.item_shield.value = s.itemPol.shield; form.elements.item_slow.value = s.itemPol.slow; form.elements.item_magnet.value = s.itemDrips.magnet; form.elements.item_ship.value = s.itemDrips.ship; form.elements.testers.value = (s.testers || []).join('\n'); form.elements.trial.value = s.trial === false ? 'off' : 'on'; table('players', [['Member', function (r) { return '#' + r.memberId + (r.username ? ' @' + esc(r.username) : '') + '
' + esc(r.email || '') + ''; }], ['Wallet', function (r) { return r.wallet ? r.wallet.slice(0, 6) + '…' + r.wallet.slice(-4) : 'none'; }], ['Chapter', 'chapter', 1], ['Drips', 'bank', 1], ['Best', 'best', 1], ['Runs', 'runs', 1], ['Armed', function (r) { return Object.keys(r.items || {}).join(', '); }], ['Last seen', function (r) { return ct(r.lastSeen); }]], d.players); @@ -33,7 +33,7 @@ function load() { } $('settings').addEventListener('submit', function (e) { e.preventDefault(); var f = e.target.elements; var body = {}; - ['refSharePct', 'dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { body[k] = f[k].value; }); + ['refSharePct', 'dripPol', 'freeSharePct', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { body[k] = f[k].value; }); body.itemPol = { shield: Number(f.item_shield.value), slow: Number(f.item_slow.value) }; body.itemDrips = { magnet: Number(f.item_magnet.value), ship: Number(f.item_ship.value) }; body.trial = f.trial.value; body.testers = f.testers.value.split(/\r?\n/).map(function (x) { return x.trim(); }).filter(Boolean); api('/api/admin/settings', body).then(function (r) { $('saveOut').textContent = r.ok ? 'Saved.' : (r.error || 'Failed'); load(); }); diff --git a/public/index.html b/public/index.html index 2f28000..7dd18a0 100644 --- a/public/index.html +++ b/public/index.html @@ -6,7 +6,7 @@ Drip Runner · hop the network, get paid in POL - + @@ -45,7 +45,7 @@

Hop the network.
Get paid in POL.

-

A fast little runner game for InstantAdPay members. Grab gold drips, dodge the bots, clear chapters. Your first clear of every chapter drips POL into your game balance, and it pays out to the wallet on your InstantAdPay account.

+

A fast little runner game for InstantAdPay members. Grab gold drips, dodge the bots, clear chapters. Play free as a guest for the score; sign in with a free InstantAdPay account and your first clear of every chapter drips a taste of POL into your game balance; Game Pass holders earn the full drip. It pays out to the wallet on your InstantAdPay account.

Play with InstantAdPay Try a run first @@ -69,7 +69,7 @@

How it plays

1

Tap to hop

The courier drops when you let go and hops when you tap. Gold drips are your score and top up your fuel. Magenta bots end the run, and from chapter 2 you thread orange firewalls.

-
2

Clear chapters

Each chapter has a drip goal for one run. Clear it and you move up. The first clear of every chapter pays a POL drip into your game balance.

+
2

Clear chapters

Each chapter has a drip goal for one run. Clear it and you move up. Signed in, the first clear of every chapter pays a POL drip into your game balance: a free InstantAdPay account earns a taste of it, Game Pass holders earn the full drip. Guest runs earn no POL, but your progress follows you when you sign in.

3

Refuel, don't restart

Out of fuel or hit by a bot? Refuel with a short visit to a member's page or a member video. Your run picks up exactly where it stopped.

diff --git a/public/play.html b/public/play.html index dcc14ad..cce5211 100644 --- a/public/play.html +++ b/public/play.html @@ -170,7 +170,7 @@ canvas#game{position:absolute;inset:0;width:100%;height:100%;display:block;touch
+0.010POL

- +
@@ -205,6 +205,6 @@ canvas#game{position:absolute;inset:0;width:100%;height:100%;display:block;touch - + diff --git a/public/play.js b/public/play.js index 6aca722..0c90529 100644 --- a/public/play.js +++ b/public/play.js @@ -60,20 +60,21 @@ function share(text) { function lobby() { R = null; $('hud').classList.remove('on'); $('tapdesk').hidden = true; $('lChap').textContent = P.chapter; $('lDrips').textContent = P.bank.toLocaleString(); $('lPol').textContent = f3(BAL.unpaid); - $('lPool').innerHTML = 'POL pool ' + f3(POOL.available) + ' · today’s cap left ' + f3(POOL.capLeft) + ' · a chapter drip is ' + f3(POOL.dripPol) + ''; + // the tiers (2026-11-02): guests earn nothing, a free account earns a share of the table, Game Pass holders earn the table + $('lPool').innerHTML = 'POL pool ' + f3(POOL.available) + ' · today’s cap left ' + f3(POOL.capLeft) + ' · a chapter drip is ' + f3(POOL.dripPol) + '' + (POOL.tier === 'guest' ? ' · guests earn nothing, sign in free to earn' : POOL.tier === 'free' ? ' · yours pays ' + f3(POOL.yourDrip) + ' (' + (POOL.freeSharePct || 25) + '%), Game Pass holders earn the full amount' : ''); $('lIap').href = IAP + '/my'; $('bLevel').href = IAP + '/my#buy'; tip('lTip'); try { if (BAL && BAL.unpaid > 0 && ME && !hasW() && !ME.guest && !sessionStorage.getItem('dr.walletnudge')) { sessionStorage.setItem('dr.walletnudge', '1'); toast(f3(BAL.unpaid) + ' POL is waiting. Link your wallet on InstantAdPay to receive this POL.'); } } catch (e) {} $('lPerk').hidden = !ME_EXTRA.perk; $('lPerk').textContent = ME_EXTRA.perk || ''; // member perk (2026-10-05) // Game Pass (InstantAdPay, all nine games): active until , or the link to get it; opens a new tab (the game may be framed) (function () { var g = ME_EXTRA.gamepass, el = $('lPass'); if (!el) { el = document.createElement('p'); el.id = 'lPass'; el.className = 'fine'; $('lPool').parentNode.insertBefore(el, $('lPool').nextSibling); } if (!g || !g.on) { el.hidden = true; return; } el.hidden = false; - el.innerHTML = g.active ? '🎫 Game Pass active' + (g.untilText ? ' until ' + esc(g.untilText) : '') + ' · a shield at the start of every run' : '🎫 Get the Game Pass · higher daily POL caps across all nine games, a shield every run here'; })(); + el.innerHTML = g.active ? '🎫 Game Pass active' + (g.untilText ? ' until ' + esc(g.untilText) : '') + ' · the full POL on every first clear, a shield at the start of every run' : '🎫 Get the Game Pass · the full POL on every first clear (a free account earns ' + (POOL.freeSharePct || 25) + '%), higher daily caps across all nine games, a shield every run here'; })(); $('bHangar').textContent = P.freeUpgrades > 0 ? 'Hangar · ' + P.freeUpgrades + ' free' : 'Hangar'; // signed in through the game: these open InstantAdPay already signed in (in-game sign-in pass, 2026-10-03) if (window.IAPGames && !$('moreGames').dataset.done) { $('moreGames').dataset.done = 1; IAPGames.strip($('moreGames'), { current: 'driprunner', title: 'More games that pay POL' }); } // cross-promo strip (2026-10-03) [['lIap', 'overview'], ['bLevel', 'buy']].forEach(function (x) { var a = $(x[0]); if (a && !a.dataset.pass) { a.dataset.pass = 1; a.addEventListener('click', function (ev) { if (window.IAPSignin && IAPSignin.hasPass()) { ev.preventDefault(); IAPSignin.enter(x[1]); } }); } }); if (ME.guest) { - $('lMember').innerHTML = 'Playing as a guest · sign in to keep your progress and collect POL'; + $('lMember').innerHTML = 'Playing as a guest · guest runs earn no POL. Sign in free to earn on every new chapter; the Game Pass pays the full amount'; $('bSignin').hidden = false; $('bSignin').href = ME_EXTRA.signin || '/signin'; $('lShare').hidden = true; } else { $('lMember').innerHTML = 'InstantAdPay · ' + (ME.username ? '@' + ME.username : '#' + ME.memberId) + ' · ' + (ME.wallet ? ME.wallet.slice(0, 6) + '…' + ME.wallet.slice(-4) : hasW() ? 'wallet linked' : 'no wallet on file · ' + linkW()); @@ -156,7 +157,7 @@ function cleared() { $('cEyebrow').textContent = 'Chapter ' + c.chapter + ' cleared'; $('cTitle').textContent = 'Banked ' + (R.goal) + ' drips'; var m = Math.floor(c.playTime / 60), s = c.playTime % 60; var tm = m + ':' + (s < 10 ? '0' : '') + s; $('cBig').innerHTML = '+' + f3(c.pol) + 'POL'; $('cBig').classList.toggle('dim', !c.pol); - var why = { paid: 'First clear, verified. Added to your game balance.', replay: c.first ? 'Verified.' : 'You cleared this one before. Only the first clear pays.', pool: 'The POL pool is empty right now. Refuel visits fill it, so this clear counts but pays nothing.', cap: 'Today’s pool cap is spent. Chapter counts, no POL today.', flagged: 'This run was flagged by the server check, so it pays nothing.', guest: 'You are playing as a guest. Sign in with InstantAdPay and this clear pays ' + f3(POOL.dripPol) + ' POL into your balance. Your progress comes with you.' }; + var why = { paid: 'First clear, verified. Added to your game balance.', replay: c.first ? 'Verified.' : 'You cleared this one before. Only the first clear pays.', pool: 'The POL pool is empty right now. Refuel visits fill it, so this clear counts but pays nothing.', cap: 'Today’s pool cap is spent. Chapter counts, no POL today.', flagged: 'This run was flagged by the server check, so it pays nothing.', guest: 'You are playing as a guest, so this clear pays nothing. Sign in with InstantAdPay (free) and your next first clears earn POL; Game Pass holders earn the full amount. Your progress comes with you.' }; $('bShareClear').hidden = !!ME.guest || !ME_EXTRA.share; $('bShareClear').dataset.text = 'I just cleared Chapter ' + c.chapter + ' in Drip Runner' + (c.pol ? ' and it paid ' + f3(c.pol) + ' POL' : '') + '. Hop the network, dodge the bots:'; $('bClearSignin').hidden = !ME.guest; if (ME.guest) $('bClearSignin').href = ME_EXTRA.signin || '/signin'; $('cText').textContent = why[c.reason] || ''; @@ -296,12 +297,12 @@ resize(); requestAnimationFrame(loop); loadMe().then(function () { var q = new URLSearchParams(location.search); if (q.get('resume')) { history.replaceState(null, '', '/play'); return tryResume(q); } - if (q.get('collected')) { history.replaceState(null, '', '/play'); setTimeout(function () { toast('Signed in. Your guest clears paid ' + q.get('collected') + ' drip' + (q.get('collected') === '1' ? '' : 's') + ' into your balance.'); }, 600); } + if (q.get('carried') || q.get('collected')) { history.replaceState(null, '', '/play'); setTimeout(function () { toast('Signed in. Your guest progress came with you. From here on your first clears earn POL.'); }, 600); } // guest runs earn nothing (2026-11-02) lobby(); }).catch(function (r) { var b = $('loadBtn'); b.hidden = false; b.href = (r && (r.signin || r.iap)) || '/signin'; if (r && r.guestOk) { // came through a share or tester link: play first, sign in later - $('loadTitle').textContent = 'Ready to run'; $('loadText').textContent = 'Play a run right now, no sign-in. Sign in with InstantAdPay when you want to keep your progress, refuel, and collect POL.'; + $('loadTitle').textContent = 'Ready to run'; $('loadText').textContent = 'Play a run right now, no sign-in. Guest runs earn no POL: sign in with InstantAdPay (free) to earn a taste on every chapter you clear, refuel, and keep your progress. The Game Pass pays the full table.'; b.textContent = 'Sign in with InstantAdPay'; b.className = 'btn ghost'; var g = $('loadGuest'); g.hidden = false; g.onclick = function () { g.disabled = true; api('/api/guest', {}).then(function (x) { if (x._status !== 200) { g.disabled = false; return toast(x.error || 'Could not start a guest run.'); } return loadMe().then(function () { lobby(); newRun(); }); }); }; return; diff --git a/public/testers.html b/public/testers.html index 152d62e..d871faf 100644 --- a/public/testers.html +++ b/public/testers.html @@ -29,7 +29,7 @@
  • Tap to hop. The courier drops when you do nothing and hops when you tap. Space bar works on a computer.
  • Gold drips are the score. Magenta bots end the run. From chapter 2, orange firewalls have to be threaded through the gap.
  • Fuel drains all the time. Every drip tops it up a little. Empty tank, run over.
  • -
  • Chapters. Each chapter has a drip goal for one run. Clear it and you move up. The first time you clear a chapter, a drip of POL lands in your game balance.
  • +
  • Chapters. Each chapter has a drip goal for one run. Clear it and you move up. Signed in, the first time you clear a chapter a drip of POL lands in your game balance (a free account earns a taste of it, Game Pass holders the full drip). Guest runs earn no POL.
  • Where the POL comes from

    diff --git a/server.js b/server.js index 4487345..a81a6d1 100644 --- a/server.js +++ b/server.js @@ -104,7 +104,7 @@ async function notify(kind, p) { if (kind === 'low') return telegram('⚠️ Drip Runner wallet is low: ' + fmt(p.balance) + ' POL in ' + p.address + ' (needs ' + fmt(p.threshold) + ').'); if (kind === 'gpstuck') return telegram('⚠️ Drip Runner Game Pass grant stuck 48 h: member #' + p.memberId + ' ' + (p.email || '') + ' ref ' + p.ref + ' (' + fmt(p.pol) + ' POL, ' + p.kind + '). InstantAdPay /api/partner/polgrant unreachable: ' + (p.error || '?')); if (kind === 'refused') return telegram('\u{1F6AB} Drip Runner \u00b7 ' + who + ' (' + p.email + ') tried to sign in but is not on the tester list. Add them under Admin > Settings > Testers: ' + SITE + '/admin'); - if (kind === 'signin') return telegram('\u{1F44B} Drip Runner · first sign-in: ' + who + ' (' + (p.wallet ? 'wallet on file' : 'NO wallet yet') + ')'); + if (kind === 'signin') return telegram('\u{1F44B} Drip Runner · first sign-in: ' + who + ' (' + (p.wallet ? 'wallet on file' : 'NO wallet yet') + ')' + (p.via ? ' · came in through ' + p.via + ', played as a guest first (guest runs earn nothing)' : '')); if (kind === 'refuel') return telegram('⛽ Drip Runner · ' + who + ' refuelled on campaign #' + p.campaignId + ': +' + fmt(p.pol) + ' POL to the pool (' + p.credits + ' credits, $' + p.share + ' share)'); return false; } @@ -248,7 +248,8 @@ const server = http.createServer(async (req, res) => { const adopted = []; const guest = sso.guestFrom(req); if (Number(r.claims.memberId) > 0) { const ad = game.adopt(sso.emailId(r.claims.email), r.claims.memberId); if (ad.moved) adopted.push('wallet-less history'); } - const pendingClears = guest ? game.adopt(guest.memberId, r.claims.memberId).pending : []; + // a guest's progress (chapters, drips, best) follows them; guest rewards never turn into POL (Marty 2026-11-02: guests earn nothing) + const carried = guest ? !!game.adopt(guest.memberId, r.claims.memberId).moved : false; if (guest) sso.endGuest(guest.gid); const first = !existedBefore; game.updPlayer(r.claims.memberId, x => { x.email = String(r.claims.email).toLowerCase(); x.username = r.claims.username || x.username || null; x.wallet = r.claims.wallet ? String(r.claims.wallet).toLowerCase() : x.wallet || null; x.lastSeen = Date.now(); }); @@ -258,13 +259,11 @@ const server = http.createServer(async (req, res) => { game.updPlayer(r.claims.memberId, x => { if (!x.sponsorRef && r.claims.sponsorRef) x.sponsorRef = String(r.claims.sponsorRef).toLowerCase(); if (r.claims.joinedRef && !x.joinedRef) x.joinedRef = r.claims.joinedRef; }); starter.grantPerk(r.claims.memberId); // a member (memberId > 0) gets one free hangar upgrade, once per account (2026-10-05) if (r.claims.gamePass != null) ledger.gp.rememberPass(ledger.iapId(r.claims), r.claims.email, r.claims.gamePass); // the Game Pass flag rides on the hand-off as gamePass:{active,until} (GAME-PASS.md 3a item 7) - const meNow = { memberId: Number(r.claims.memberId), email: String(r.claims.email || '').toLowerCase(), username: r.claims.username || null, wallet: r.claims.wallet ? String(r.claims.wallet).toLowerCase() : null }; - for (const ch of pendingClears) { const g = await ledger.chapterDripGated(meNow, ch, true); if (g.pol) announceChapter(meNow, ch, g.pol); } // clears made as a guest pay now { const t = srctrack.fromRequest(req); if (t) { srctrack.bump(t.src, 'signins', r.claims.memberId); game.updPlayer(r.claims.memberId, x => { if (!x.src) x.src = t.src; }); if (r.claims.joinedAt && Date.now() - Number(r.claims.joinedAt) < 30 * 60000) { srctrack.bump(t.src, 'signups', r.claims.memberId); srctrack.postback(t, r.claims.memberId).catch(() => {}); } } } if (first) notify('signin', { memberId: r.claims.memberId, username: r.claims.username, wallet: r.claims.wallet, via: guest ? 'a share link' : null }).catch(() => {}); - res.writeHead(302, { Location: '/play' + (pendingClears.length ? '?collected=' + pendingClears.length : ''), 'Set-Cookie': [sso.cookie(sid)].concat(guest ? [sso.clearGuestCookie()] : []), 'Cache-Control': 'no-store' }); return res.end(); + res.writeHead(302, { Location: '/play' + (carried ? '?carried=1' : ''), 'Set-Cookie': [sso.cookie(sid)].concat(guest ? [sso.clearGuestCookie()] : []), 'Cache-Control': 'no-store' }); return res.end(); } // a member's share card (2026-10-04, Neville/cryptoassets: his link previewed as the blank First Chapter badge): the badge with // the sharer's name on the plate, rendered once and cached by lib/badge.js @@ -279,7 +278,7 @@ const server = http.createServer(async (req, res) => { if (mr && /TelegramBot|facebookexternalhit|Facebot|Twitterbot|WhatsApp|Slackbot|Discordbot|LinkedInBot|SkypeUriPreview|redditbot|Iframely|Embedly|vkShare|Pinterest|Googlebot|bingbot/i.test(String(req.headers['user-agent'] || ''))) { const sh = game.byUsername(mr[1]); const nm = sh ? sh.username : null; const card = SITE + '/r/' + encodeURIComponent(mr[1]) + '/card.jpg'; const t = nm ? '@' + nm + ' invited you to Drip Runner' : 'Drip Runner: hop the network, get paid in POL'; - const d = 'A fast little runner game in the InstantAdPay network, part of the Crypto Team Build Network. Play free, clear chapters and collect POL rewards.'; + const d = 'A fast little runner game in the InstantAdPay network, part of the Crypto Team Build Network. Play free; sign in with a free InstantAdPay account to earn POL on every chapter you clear, and the Game Pass pays the full reward.'; res.writeHead(200, Object.assign({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store' }, SEC)); return res.end('' + esc(t) + 'Play Drip Runner'); } @@ -361,7 +360,8 @@ const server = http.createServer(async (req, res) => { } if (p === '/api/admin/settings' && req.method === 'POST') { const { body } = await readBody(req); const patch = {}; - for (const k of ['refSharePct', 'usdPerCredit', 'creditsPerVisit', 'poolSharePct', 'usdPerPolFallback', 'dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'lowBalancePol']) if (body[k] != null && body[k] !== '') patch[k] = Number(body[k]); + for (const k of ['refSharePct', 'usdPerCredit', 'creditsPerVisit', 'poolSharePct', 'usdPerPolFallback', 'dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'lowBalancePol', 'freeSharePct']) if (body[k] != null && body[k] !== '' && Number.isFinite(Number(body[k])) && Number(body[k]) >= 0) patch[k] = Number(body[k]); + if (patch.freeSharePct != null) patch.freeSharePct = Math.min(100, patch.freeSharePct); // the free tier's share of the table (2026-11-02) if (body.signups && ['testers', 'key', 'open', 'closed'].includes(body.signups)) patch.signups = body.signups; if (body.trial === 'on' || body.trial === 'off') patch.trial = body.trial === 'on'; if (Array.isArray(body.testers)) patch.testers = body.testers.map(x => String(x).trim().toLowerCase()).filter(Boolean).slice(0, 500); @@ -414,7 +414,8 @@ async function memberApi(req, res, u, p, me) { const pl = ledger.pool(); if (!me.guest && ledger.gp.on()) ledger.gp.fetchPass(ledger.iapId(me), me.email).catch(() => {}); // keep the Game Pass flag fresh (display + the shield perk; grant answers carry the truth) const refs = me.guest ? [] : game.referralsOf(me); - return json(res, 200, { me: { memberId: me.memberId, username: me.username, wallet: me.wallet, guest: !!me.guest, hasWallet: !me.guest && !!(me.wallet || ledger.account(me.memberId).wallet || (game.player(me.memberId) || {}).wallet) }, player: game.view(me), balance: ledger.balance(me.memberId), pool: { available: pl.available, capLeft: pl.capLeft, dripPol: Number(ledger.settings().dripPol) }, iap: IAP, site: SITE, tips: await tips.list(ledger.settings()), + // tier (2026-11-02): guest = earns nothing, free = freeSharePct of the table (yourDrip), full = the table (Game Pass, or GAMEPASS off) + return json(res, 200, { me: { memberId: me.memberId, username: me.username, wallet: me.wallet, guest: !!me.guest, hasWallet: !me.guest && !!(me.wallet || ledger.account(me.memberId).wallet || (game.player(me.memberId) || {}).wallet) }, player: game.view(me), balance: ledger.balance(me.memberId), pool: { available: pl.available, capLeft: pl.capLeft, dripPol: Number(ledger.settings().dripPol), tier: ledger.tierOf(me), freeSharePct: ledger.freeShare(), yourDrip: me.guest ? 0 : ledger.dripFor(me) }, iap: IAP, site: SITE, tips: await tips.list(ledger.settings()), signin: me.guest ? signinUrl(req) : null, share: (!me.guest && me.username) ? SITE + '/r/' + encodeURIComponent(me.username) : null, referrals: { count: refs.length, clicks: (store.read('share-hits', {})[String(me.username || '').toLowerCase()] || 0), earned: ledger.balance(me.memberId).refTotal, pct: Number(ledger.settings().refSharePct) || 0 }, perk: me.guest ? null : starter.takeNotice(me.memberId), // the member perk's one-time message (2026-10-05) gamepass: me.guest ? null : ledger.gp.view(ledger.iapId(me), me.email) }); // Game Pass: active until , or the link to get it diff --git a/test/gamepass.js b/test/gamepass.js index 8ca9295..9896267 100644 --- a/test/gamepass.js +++ b/test/gamepass.js @@ -40,26 +40,37 @@ const ok = (name, cond, info) => { if (cond) { pass++; console.log(' ok ', nam ok('48 h without an answer: stuck, the admin chat told once', rr.stuck === 1 && alerts.length === 1 && alerts[0][0] === 'gpstuck'); gp.dequeue(7, '', 'q:old'); mode = 'ok'; // ---- the game: a chapter's first clear pays once -> 'progress'; the only POL Drip Runner pays + // the tiers (Marty 2026-11-02): guests earn nothing, a free account earns freeSharePct (25) of the drip, Game Pass holders the drip ledger.setSettings({ seedPol: 100, dailyCapPol: 5, dripPol: 0.01 }); const me = { memberId: 7, email: 'hugh@example.com', username: 'hugh', wallet: '0x' + 'a'.repeat(40) }, today = ledger.ctDay(); ok('classification: every chapter is progress', ledger.kindOf('chapter:1') === 'progress' && ledger.kindOf('chapter:9') === 'progress'); + ok('settings: freeSharePct defaults to 25 and is admin-editable', ledger.settings().freeSharePct === 25 && ledger.freeShare() === 25 && ledger.setSettings({ freeSharePct: 50 }).freeSharePct === 50 && ledger.dripFor(me) === 0.005 && ledger.setSettings({ freeSharePct: 25 }).freeSharePct === 25); + ok('tiers: no pass = free tier at 25% of the drip (4 decimals)', ledger.tierOf(me) === 'free' && !ledger.fullTier(me) && ledger.dripFor(me) === 0.0025); seen.length = 0; let g = await ledger.chapterDripGated(me, 1, true); - ok('chapter 1 pays what IAP allowed, asked as progress with ref chapter:1', g.reason === 'paid' && g.pol === 0.01 && seen[0].ref === 'chapter:1' && seen[0].kind === 'progress' && seen[0].memberId === 7 && seen[0].email === 'hugh@example.com', g); + ok('free tier: chapter 1 asks IAP for the scaled 0.0025 as progress (ref chapter:1), pays it, the note names the Pass', g.reason === 'paid' && g.pol === 0.0025 && seen[0].pol === 0.0025 && seen[0].ref === 'chapter:1' && seen[0].kind === 'progress' && seen[0].memberId === 7 && seen[0].email === 'hugh@example.com' && g.note === 'Game Pass holders earn the full amount.', g); g = await ledger.chapterDripGated(me, 1, false); ok('a replay is not a reward (no IAP call)', g.reason === 'replay' && seen.length === 1); - script['chapter:2'] = { allowed: 0, deferred: 0.01 }; g = await ledger.chapterDripGated(me, 2, true); - ok('chapter 2 deferred: handled, owed, the player told', g.reason === 'deferred' && g.pol === 0 && ledger.account(7).gpOwed === 0.01 && /pays out over the next days/.test(g.note) && store.read('drips', []).some(d => d.chapter === 2 && d.pol === 0)); - script['carry:' + today] = { allowed: 0.01, carried: 0.01 }; ok('carry sweep collects it once a day', (await ledger.carrySweep()) === 0.01 && ledger.account(7).gpOwed === 0 && (await ledger.carrySweep()) === 0); - mode = '500'; g = await ledger.chapterDripGated(me, 3, true); ok('IAP down: queued, nothing paid, the player told', g.reason === 'iap' && gp.queued(7, me.email, 'chapter:3') && /recorded/.test(g.note)); - const n = seen.length; g = await ledger.chapterDripGated(me, 3, true); ok('a queued chapter is not asked again', g.reason === 'iap' && seen.length === n); - mode = 'ok'; await gp.retry(ledger.payQueued, Date.now() + gp.RETRY_MS + 1); ok('the queued chapter pays on retry', !gp.queued(7, me.email, 'chapter:3') && store.read('drips', []).some(d => d.chapter === 3 && d.pol === 0.01) && ledger.account(7).unpaid === 0.03); - ok('the pool only counts what was paid', ledger.pool().out === 0.03); + // the pass: remembered from the hand-off, and re-recorded by every grant answer (so the stub says pass: true for a holder) + gp.rememberPass(7, me.email, { active: true, until: Date.now() + 86400000 }); ok('tiers: pass active = full tier, the whole drip', ledger.tierOf(me) === 'full' && ledger.fullTier(me) && ledger.dripFor(me) === 0.01); + for (const ref of ['chapter:2', 'chapter:4', 'carry:' + today]) script[ref] = { allowed: 0.01, pass: true }; + g = await ledger.chapterDripGated(me, 2, true); ok('pass holder: chapter 2 pays the full 0.01, no free note', g.reason === 'paid' && g.pol === 0.01 && seen.at(-1).pol === 0.01 && !g.note, g); + script['chapter:3'] = { allowed: 0, deferred: 0.01, pass: true }; g = await ledger.chapterDripGated(me, 3, true); + ok('chapter 3 deferred: handled, owed, the player told', g.reason === 'deferred' && g.pol === 0 && ledger.account(7).gpOwed === 0.01 && /pays out over the next days/.test(g.note) && store.read('drips', []).some(d => d.chapter === 3 && d.pol === 0)); + script['carry:' + today] = { allowed: 0.01, carried: 0.01, pass: true }; ok('carry sweep collects it once a day', (await ledger.carrySweep()) === 0.01 && ledger.account(7).gpOwed === 0 && (await ledger.carrySweep()) === 0); + mode = '500'; g = await ledger.chapterDripGated(me, 4, true); ok('IAP down: queued, nothing paid, the player told', g.reason === 'iap' && gp.queued(7, me.email, 'chapter:4') && /recorded/.test(g.note)); + const n = seen.length; g = await ledger.chapterDripGated(me, 4, true); ok('a queued chapter is not asked again', g.reason === 'iap' && seen.length === n); + mode = 'ok'; await gp.retry(ledger.payQueued, Date.now() + gp.RETRY_MS + 1); ok('the queued chapter pays on retry', !gp.queued(7, me.email, 'chapter:4') && store.read('drips', []).some(d => d.chapter === 4 && d.pol === 0.01) && ledger.account(7).unpaid === 0.0325); + ok('the pool only counts what was paid', ledger.pool().out === 0.0325); // a member with no wallet: negative local id (sso.emailId) -> memberId 0 + email on the wire; the pass flag keyed by email const nw = { memberId: sso.emailId('nowallet@example.com'), email: 'nowallet@example.com', username: 'nw', wallet: null }; ok('the negative local id is never sent', nw.memberId < 0 && ledger.iapId(nw) === 0); - g = await ledger.chapterDripGated(nw, 1, true); ok('a wallet-less member is gated by email', g.reason === 'paid' && seen.at(-1).memberId === 0 && seen.at(-1).email === 'nowallet@example.com'); - const guest = { memberId: -999999999999, guest: true, email: null }; seen.length = 0; g = await ledger.chapterDripGated(guest, 1, true); ok('a guest gets the plain chapterDrip (no IAP call)', seen.length === 0 && g.reason === 'paid'); - ledger.setSettings({ dailyCapPol: 0.001 }); g = await ledger.chapterDripGated(me, 4, true); ok('the local daily cap still stands in front of IAP', g.reason === 'cap'); ledger.setSettings({ dailyCapPol: 5 }); - process.env.GAMEPASS = 'off'; seen.length = 0; g = await ledger.chapterDripGated(me, 4, true); ok('GAMEPASS=off: the plain chapterDrip, no IAP call', g.reason === 'paid' && seen.length === 0); process.env.GAMEPASS = 'on'; + g = await ledger.chapterDripGated(nw, 1, true); ok('a wallet-less member is gated by email, on the free tier', g.reason === 'paid' && g.pol === 0.0025 && seen.at(-1).memberId === 0 && seen.at(-1).email === 'nowallet@example.com'); + const guest = { memberId: -999999999999, guest: true, email: null }; seen.length = 0; const drips0 = store.read('drips', []).length; g = await ledger.chapterDripGated(guest, 1, true); + ok('a guest earns nothing: no IAP call, no drip row, reason guest (2026-11-02)', seen.length === 0 && g.reason === 'guest' && g.pol === 0 && store.read('drips', []).length === drips0 && ledger.tierOf(guest) === 'guest'); + ok('...on the plain path too', ledger.chapterDrip(guest, 1, true).reason === 'guest' && store.read('drips', []).length === drips0); + ledger.setSettings({ dailyCapPol: 0.001 }); g = await ledger.chapterDripGated(me, 5, true); ok('the local daily cap still stands in front of IAP', g.reason === 'cap'); ledger.setSettings({ dailyCapPol: 5 }); + gp.rememberPass(7, me.email, false); + process.env.GAMEPASS = 'off'; seen.length = 0; ok('GAMEPASS=off: everyone is on the full tier', ledger.fullTier(me) && ledger.tierOf(me) === 'full' && ledger.dripFor(me) === 0.01 && ledger.tierOf(guest) === 'guest'); + g = await ledger.chapterDripGated(me, 5, true); ok('GAMEPASS=off: the plain chapterDrip pays the full drip, no IAP call, no free note', g.reason === 'paid' && g.pol === 0.01 && seen.length === 0 && !g.note); process.env.GAMEPASS = 'on'; ok('history explains deferral and carry', ledger.balance(7).history.some(h => /paying out over the next days/.test(h.label)) && ledger.balance(7).history.some(h => /Carried-over/.test(h.label))); // the perk: a shield at the start of every run while the pass is active gp.rememberPass(7, me.email, false); let run = game.start(me, 390, 760); ok('no pass: no free shield', run.armed.shield === false && !run.armed.passShield); diff --git a/test/run.js b/test/run.js index 3ff61a9..310b379 100644 --- a/test/run.js +++ b/test/run.js @@ -39,6 +39,8 @@ const spawnLib = require('../lib/spawn'); const tok0 = sso.mint({ memberId: 42, email: 'runner@example.com', wallet: '0x' + 'ab'.repeat(20), username: 'runner42' }); const denied = await call('/auth?t=' + tok0); eq(denied.status, 403, 'a member not on the tester list is refused'); const st = await admin('/api/admin/settings', { testers: ['runner@example.com'], thresholdPol: 0.02, dripPol: 0.01 }); eq(st.body.settings.testers, ['runner@example.com'], 'admin adds a tester'); + eq((await admin('/api/admin/state')).body.settings.freeSharePct, 25, 'freeSharePct defaults to 25'); + eq((await admin('/api/admin/settings', { freeSharePct: 40 })).body.settings.freeSharePct, 40, 'admin saves freeSharePct'); await admin('/api/admin/settings', { freeSharePct: 25 }); const tok = sso.mint({ memberId: 42, email: 'runner@example.com', wallet: '0x' + 'ab'.repeat(20), username: 'runner42' }); const a = await call('/auth?t=' + tok); eq([a.status, a.headers.get('location')], [302, '/play'], 'a listed member signs in and lands on the game'); eq((await call('/auth?t=' + tok)).status, 400, 'the hand-off token cannot be replayed'); @@ -116,13 +118,14 @@ const spawnLib = require('../lib/spawn'); const ggen = spawnLib.drips(gr.seed, W, H); const gcl = []; let gT = 0; while (gcl.length < 20) { const gg = ggen(); for (const d of gg.drips) if (gcl.length < 20) { gT = spawnLib.arrival(gg.t, d.x0, W, gr.speed) + 0.1; gcl.push({ k: 'd', i: d.i, t: Math.round(gT * 1000) / 1000 }); } } backdate(gr.runId, gT + 5); const gev = (await hit('/api/run/events', { method: 'POST', body: JSON.stringify({ runId: gr.runId, t: gT + 0.2, events: gcl, goal: true }) }, g)).body; - eq([gev.cleared.chapter, gev.cleared.pol, gev.cleared.reason], [1, 0, 'guest'], 'a guest clear pays nothing yet (reason guest)'); + eq([gev.cleared.chapter, gev.cleared.pol, gev.cleared.reason], [1, 0, 'guest'], 'a guest clear pays nothing (reason guest)'); + eq((await hit('/api/me', {}, g)).body.pool.tier, 'guest', '/api/me says tier guest'); eq((await hit('/api/refuel/start', { method: 'POST', body: JSON.stringify({ runId: gr.runId }) }, g)).status, 403, 'a guest cannot refuel before signing in'); - // the newcomer joins IAP under runner42 and signs in: the guest run is adopted and the clear pays + // the newcomer joins IAP under runner42 and signs in: the guest run is adopted; the progress follows, the POL does not (2026-11-02) const tokN = sso.mint({ memberId: 77, email: 'newbie@example.com', wallet: '0x' + 'cd'.repeat(20), username: 'newbie', sponsorRef: 'runner42' }); const au = await hit('/auth?t=' + tokN, {}, g); g = jarAdd(g, au.set); - eq([au.status, au.loc], [302, '/play?collected=1'], 'sign-in adopts the guest and pays the pending clear'); - const nme = (await hit('/api/me', {}, g)).body; eq([nme.me.guest, nme.player.chapter, nme.player.bank, nme.balance.unpaid], [false, 2, 20, 0.01], 'progress and the drip followed the newcomer'); + eq([au.status, au.loc], [302, '/play?carried=1'], 'sign-in adopts the guest progress and pays nothing for guest clears'); + const nme = (await hit('/api/me', {}, g)).body; eq([nme.me.guest, nme.player.chapter, nme.player.bank, nme.balance.unpaid, nme.balance.earnedTotal, nme.pool.tier], [false, 2, 20, 0, 0, 'full'], 'progress followed the newcomer, no POL for the guest clear; GAMEPASS off = full tier'); // the newcomer refuels: runner42 (their IAP sponsor) gets the slice const nr = (await hit('/api/run/start', { method: 'POST', body: JSON.stringify({ W, H }) }, g)).body; const nrf = (await hit('/api/refuel/start', { method: 'POST', body: JSON.stringify({ runId: nr.runId }) }, g)).body;