Network Tour (Marty 2026-11-17): mission rotation per hunter + free-tier tour stops

- lib/rotation.js: a round = every active house mission; the board offers only missions not found this
  round, never-visited first, then least recently found; mid-round additions join as not found, paused
  missions are skipped; the start gate refuses a mission found earlier this round. State per member in
  rotation.json (start, rounds); everyone starts at 0 so round 1 = their whole history. Paid missions
  keep their rules; daily limits, draws, pool and tiers unchanged. Setting rotationOn (default 1).
- Board: "Network tour: X of Y sites this round" with a progress bar and the sites left; New to you tag.
- Badge sweep renamed Full Network Tour (art unchanged), earned by the old rule or a closed round;
  celebrated on the board every round, round count on the card, Telegram posts it once.
- Free tier: POL only for discovery (first find of a mission). A repeat find is a tour stop: counts as
  the day's hunt and for the tour, 0 POL, ad credits through a signed call to InstantAdPay
  (polgrant.credits -> POST /api/partner/credits, idempotent on ref tour:<row id>); settings
  tourStopCredits 10 / tourStopCreditsDailyMax 10; unconfirmed stops stay owed and retry every 2 min.
  Game Pass holders unchanged. Toured free members see the Game Pass line on the board.
- Admin: Network Tour section (settings, rounds per hunter, credits sent/owed), GET /api/admin/rotation.
- Board daily line now passes the tier (a Pass holder saw 3, not 5).
- fridaybank: http for a local stub IAP (tests). Tests: test/rotation.js (27 checks), run.js waits for
  /health instead of a fixed 1.2 s. Guides: how-a-hunt-works, faq, free-account explain the tour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-17 09:20:42 -06:00
parent 408a30cf31
commit 654cd7b408
15 changed files with 352 additions and 26 deletions
+3 -2
View File
@@ -15,7 +15,7 @@ const BADGES = [
{ id: 'first', name: 'First Find', icon: '\u{1F3AF}', why: 'your first code claimed' },
{ id: 'hunter', name: 'Hunter', icon: '\u{1F9ED}', why: 'five finds' },
{ id: 'tracker', name: 'Tracker', icon: '\u{1F526}', why: 'twenty finds' },
{ id: 'sweep', name: 'Full Sweep', icon: '\u{1F5FA}️', why: 'a find on every site' },
{ id: 'sweep', name: 'Full Network Tour',icon: '\u{1F5FA}️', why: 'a find on every site in one round of the network tour' }, // renamed 2026-11-17 (the art still reads FULL SWEEP; only the title changed)
{ id: 'lucky', name: 'Lucky Find', icon: '\u{1F48E}', why: 'one drip of 0.4 POL or more' },
{ id: 'streak', name: 'On a Streak', icon: '\u{1F525}', why: 'finds on three days in a row' },
{ id: 'top', name: 'Top Hunter', icon: '\u{1F3C6}', why: 'won a weekly prize as #1' },
@@ -60,7 +60,8 @@ function badgesFor(memberId, list) {
if (mine.length >= 5) out.add('hunter');
if (mine.length >= 20) out.add('tracker');
const sites = new Set(missions.list().filter(m => m.active !== false).map(m => m.site));
if (sites.size && [...sites].every(s => mine.some(p => p.site === s))) out.add('sweep');
if (sites.size && [...sites].every(s => mine.some(p => p.site === s))) out.add('sweep'); // the original rule, so nobody loses it
try { if (require('./rotation').rounds(memberId) >= 1) out.add('sweep'); } catch (e) {} // a closed round of the Network Tour (once per round, count on the card)
if (mine.some(p => p.pol >= 0.4)) out.add('lucky');
const days = new Set(mine.map(p => p.day));
for (const d of days) { if (days.has(dayMinus(d, 1)) && days.has(dayMinus(d, 2))) { out.add('streak'); break; } }