From 839c867595c86e1b37069d5e4c3038a1d0235d02 Mon Sep 17 00:00:00 2001 From: martbost Date: Thu, 22 Oct 2026 10:26:58 -0500 Subject: [PATCH] Pass tiers restructure (Dallas, Marty approved 2026-10-22): Explorer $19.99 (1999 credits) and Champion $39.99 (3999) for 30 days, new Sovereign $99.99 (9999, 30 days) and Legend $249.99 (24999, 365 days, the yearly pass). One table (gamepass.js TIER_DEFS: rank, names, settings stem, defaults, member-card perks); settings gamePassSovereign*/gamePassLegend* with kill switches; flag()/partner player/hand-off token carry sovereign/legend; buy, waiting orders ($100/$250 package copy), extend from max(now, until), comp/revoke, admin By pass tier table and comp options; chatbot tier fact says coming soon while sovTiers is off. All behind sovTiers (still 0): weekly Game Pass price, length and caps unchanged. Tests: sov-passes store + local extended (all pass), member QA 0 bugs. Co-Authored-By: Claude Opus 5.5 --- chatbot.js | 16 +++++- docs/GAME-PASS.md | 65 +++++++++++++++--------- gamepass.js | 51 +++++++++++++------ public/admin.html | 6 +-- public/assets/admin.js | 6 +-- public/assets/my.js | 19 ++++--- public/my.html | 2 +- qa/run.sh | 2 +- qa/sov-passes-local.mjs | 51 +++++++++++++++---- qa/sov-passes-store.cjs | 107 +++++++++++++++++++++++++++++++++++++--- server.js | 11 +++-- 11 files changed, 259 insertions(+), 77 deletions(-) diff --git a/chatbot.js b/chatbot.js index 7f55b08..8c2d966 100644 --- a/chatbot.js +++ b/chatbot.js @@ -19,9 +19,10 @@ const kbSeed = require('./kb-seed'); let DATA_DIR = null; let chain = null; +let PASS_TIERS = null; // () => the live pass tiers (server.js, from gamepass.cfg): the tier fact follows the sovTiers switch const MODEL = process.env.OPENROUTER_MODEL || 'deepseek/deepseek-v4-flash:nitro'; -function init(opts) { DATA_DIR = opts.dataDir; chain = opts.chain; return kb.init({ dataDir: DATA_DIR, seeds: seeds() }); } +function init(opts) { DATA_DIR = opts.dataDir; chain = opts.chain; PASS_TIERS = typeof opts.passTiers === 'function' ? opts.passTiers : null; return kb.init({ dataDir: DATA_DIR, seeds: seeds() }); } function key() { if (process.env.OPENROUTER_API_KEY) return process.env.OPENROUTER_API_KEY.trim(); try { return fs.readFileSync(path.join(DATA_DIR, 'openrouter.key'), 'utf8').trim(); } catch (e) { return ''; } @@ -187,11 +188,22 @@ function seeds() { } // ---- facts for the AI fallback ---- +// PASS TIERS (2026-10-22): the passes above the weekly Game Pass (Explorer, Champion, Sovereign, Legend; names from gamepass.js +// TIER_DEFS). While sovTiers is off the assistant only says they are coming soon; once on, it quotes the live prices and contents. +function passTiersFact() { + let t = null; try { t = PASS_TIERS ? PASS_TIERS() : null; } catch (e) { t = null; } + const soon = '- MORE GAME PASSES: monthly and yearly passes for Shards of Valor are COMING SOON and are not on sale yet. If someone asks about them (or about an Explorer, Champion, Sovereign or Legend pass, or a monthly or yearly pass), say they are coming soon and that the $5 weekly Game Pass is the pass on sale today. Never quote their prices, contents or a launch date.\n'; + if (!t || !t.on) return soon; + const rows = (t.rows || []).filter(r => r.sale); + if (!rows.length) return soon; + return '- GAME PASS TIERS (on sale, Members > Games > Game Pass at https://instantadpay.com/my#games): beside the $5 weekly Game Pass, ' + rows.map(r => r.name + ' $' + r.usd + ' for ' + r.days + ' days (' + r.price + ' purchased credits): ' + r.perks.join('; ')).join(' | ') + + '. Each higher pass includes everything below it. Every pass is a Game Pass in all nine games with the SAME daily POL caps (1.50 / 5 POL): a higher pass never pays more POL. Passes run side by side, each with its own end date; no auto-renew; buying again adds the pass length from its end date (or from now if it ended). Paid with purchased credits only; with none, a package of at least the price starts the pass when it settles. Nothing earned in a game is taken away when a pass ends.\n'; +} function systemPrompt(kbBlock) { return `You are the assistant on InstantAdPay (https://instantadpay.com), a membership advertising platform. FACTS: -- ROAD AGENT (LIVE 2026-10-15, https://roadagent.app): a night-highway shooter open to every member. Open the Games tab and tap Play on the Road Agent card, or go to roadagent.app and sign in with the InstantAdPay email. Drive the four-lane highway, shoot the hostiles (thug sedans, switchblades, gunner vans), spare the civilians, pull into the weapons truck for oil slicks, smoke and missiles. Clearing a sector for the first time pays POL to the wallet on the member's InstantAdPay account, plus a daily patrol reward; scrap buys garage upgrades. Fuel = a sponsor visit: before a run the player visits an advertiser's page (a FUEL STOP), which is a normal verified visit with the dwell timer and human check, charged to the advertiser like any visit; advertisers' existing visits campaigns are already in the rotation, nothing to set up; to get more traffic from the game, top up the visits campaign. Clickable Pause, Sound and Music buttons sit under the game (P / M / N keys also work), and the Run tab has an Invite a friend card with the member's roadagent.app/?ref= link. +${passTiersFact()}- ROAD AGENT (LIVE 2026-10-15, https://roadagent.app): a night-highway shooter open to every member. Open the Games tab and tap Play on the Road Agent card, or go to roadagent.app and sign in with the InstantAdPay email. Drive the four-lane highway, shoot the hostiles (thug sedans, switchblades, gunner vans), spare the civilians, pull into the weapons truck for oil slicks, smoke and missiles. Clearing a sector for the first time pays POL to the wallet on the member's InstantAdPay account, plus a daily patrol reward; scrap buys garage upgrades. Fuel = a sponsor visit: before a run the player visits an advertiser's page (a FUEL STOP), which is a normal verified visit with the dwell timer and human check, charged to the advertiser like any visit; advertisers' existing visits campaigns are already in the rotation, nothing to set up; to get more traffic from the game, top up the visits campaign. Clickable Pause, Sound and Music buttons sit under the game (P / M / N keys also work), and the Run tab has an Invite a friend card with the member's roadagent.app/?ref= link. - HELP DESK (LIVE 2026-10-16): members open Help in the dashboard (/my#help) to send Marty a support ticket (pick a category, a subject, the message, up to 2 screenshots), see each ticket's status (Open, Waiting on you, Closed) and read and answer his replies; a badge shows when he has replied, and replies also arrive by email. Anyone signed out or locked out uses the public form at https://instantadpay.com/support (name, email, category, subject, message) and gets an email with the ticket number (like IAP-1042) and a private link to view and reply, no sign-in needed. support@instantadpay.com also reaches Marty. Replying to a closed ticket opens it again. In this chat, "Send this to support" turns the conversation into a ticket. Only Marty answers, so replies are not instant; never promise a response time. - PRESENTATION (2026-10-15): instantadpay.com/presentation is a public page (no sign-in) with the narrated InstantAdPay presentation, about six minutes, Marty's voice, captions in 6 languages (English, Italiano, Français, Español, Deutsch, Português) chosen with pills under the player. Sixteen parts: the platform, ad reach, the nine games that pay POL, the $20 split ($10 / $4 / $2 / $4 platform, same transaction), three rules, packages, the 2-then-5 unlock, pass-up, wide versus narrow ($800 vs $36, an illustration), Qualified Start, the Pipeline, LinkSpin (pre-launch Nov 1), one wallet across the network, the first week, and 'the target is five'. Share link: Members > Promo tools > 'Share the presentation' copies instantadpay.com/presentation?ref=; ?ref sets the same 30-day sponsor cookie as the invite link, the page shows 'Shared with you by @name' with avatar and a Join button to /join/. It is in the site menu as 'Presentation'. BUILD WIDE VIDEO: first card in Promo tools > Videos ('Build wide: watch the payments flow'), matched link ?v=wide. - WIRED WEDNESDAY: every Wednesday, Central time (midnight to midnight), any ad package of $20 or more (Activation and up; no $10 pack exists) earns +25% bonus credits wired into the buyer's balance the moment the purchase settles, purchased-grade (usable on every format incl. login ads), credit log label "Wired Wednesday". First one: Wednesday 2026-09-30. Page: instantadpay.com/wednesday. Credits buy ad delivery, never money. diff --git a/docs/GAME-PASS.md b/docs/GAME-PASS.md index 0d469b0..19af9dc 100644 --- a/docs/GAME-PASS.md +++ b/docs/GAME-PASS.md @@ -215,33 +215,52 @@ sales. If the POL rate is unavailable the tick retries next hour. - Settings pass through `/api/admin/site` like every other site setting (that endpoint accepts any key; the defaults above make the Game Pass keys show in the Site settings form). -## Pass tiers: Explorer and Champion (IAP side, 2026-10-18) +## Pass tiers: Explorer, Champion, Sovereign, Legend (IAP side, 2026-10-18; restructured 2026-10-22) -Spec: `ultima-rpg/docs/IAP-PASSES-SPEC.md`. Marty approved the safe form: paid tiers add Shards of Valor islands and looks, never -power, never more POL. The weekly pass is unchanged. +Spec: `ultima-rpg/docs/IAP-PASSES-SPEC.md`. Marty approved the safe form on 2026-10-18 (never more POL) and Dallas's new structure +on 2026-10-22 (prices below, plus Sovereign and the yearly Legend). The weekly pass is unchanged. Everything above weekly stays +switched off for members (`sovTiers` 0) until Marty flips it. -- **Tiers**: `weekly` (500 credits, 7 days), `explorer` (2000, 30 days), `champion` (4000, 30 days). Every tier is a Game Pass - holder everywhere with exactly the pass caps; `polgrant` keeps answering `pass: true` (a boolean). -- **Store**: `record.tiers = { weekly: { until }, explorer: { until }, champion: { until } }`, the legacy `until` mirrors the weekly - tier, bought rows carry `tier` (missing = weekly), waiting orders carry `tier` (missing = weekly). Lazy migration: a record - without `tiers` reads its `until` as the weekly tier. -- **Wire**: `flag()` = `{ active, until, tier, tiers }` (`tier` = highest active, `until` = that tier's end). The hand-off token - carries `gamePass: { active, until, tier }`; `GET /api/partner/player` carries `pass: { active, until, tier, tiers }`. -- **Buy**: `POST /api/my/gamepass/buy { tier }` (missing = weekly). Explorer/Champion need `sovTiers` on (and the weekly pass on); - while off, only the `ADMIN_EMAIL` account sees and can buy them (admin preview on the card). Short of purchased credits: a +| Tier | Name | Price | Length | In Shards of Valor (each includes everything below) | +|---|---|---|---|---| +| `weekly` | Game Pass | 500 credits ($5) | 7 days | the Game Pass in all nine games, the Sunless Vault, weapons unlocked | +| `explorer` | Explorer | 1999 ($19.99) | 30 days | weapons, gear, 2 DLC islands | +| `champion` | Champion | 3999 ($39.99) | 30 days | weapons, gear, 4 DLC islands of your choice, the Druid hero, level cap 30 | +| `sovereign` | Sovereign | 9999 ($99.99) | 30 days | weapons, gear, all DLC islands, the Necromancer hero, level cap 40 | +| `legend` | Legend | 24999 ($249.99) | 365 days | weapons, gear, all DLC islands, every hero including the Archer, level cap 40 | + +- **One table**: `gamepass.js` `TIER_DEFS` holds the rank, wire key, display name, settings stem, default price/length and the + member-card list for every tier. Rename a tier there (the card, admin pane, charge label and chatbot all read it). +- **Rank**: weekly < explorer < champion < sovereign < legend. Every tier is a Game Pass holder everywhere with exactly the pass + caps; `polgrant` keeps answering `pass: true` (a boolean). +- **Store**: `record.tiers = { weekly: { until }, explorer: { until }, champion: { until }, sovereign: { until }, legend: { until } }`, + the legacy `until` mirrors the weekly tier, bought rows carry `tier` (missing = weekly), waiting orders carry `tier` (missing = + weekly). Lazy migration: a record without `tiers` reads its `until` as the weekly tier. +- **Wire**: `flag()` = `{ active, until, tier, tiers }` (`tier` = highest active, `until` = that tier's end; `tiers` has all five + keys). The hand-off token carries `gamePass: { active, until, tier }`; `GET /api/partner/player` carries + `pass: { active, until, tier, tiers }`, so Shards of Valor sees `sovereign` / `legend`. +- **Buy**: `POST /api/my/gamepass/buy { tier }` (missing = weekly). Every tier above weekly needs `sovTiers` on (and the weekly pass + on); while off, only the `ADMIN_EMAIL` account sees and can buy them (admin preview on the card). Short of purchased credits: a waiting order per tier; a package of at least the tier price fulfils the highest-priced order it covers (one pass per purchase, - each tx once). There is no $40 package, so Champion's copy names the $50 one. -- **Renew / expiry**: no auto-renew, no proration. Buying again extends that tier from `max(now, until)`. Tiers run side by side; - when a higher one ends the next one shows through. Admin comp takes a tier; `POST /api/admin/gamepass/revoke { email, tier, why }` - ends one tier now (support refunds only, credits are not returned by it). -- **Tournament**: any tier holds a seat; only weekly sales feed the pool unless `passTournamentTierSales` is `1`. -- **Settings**: `sovTiers` 0, `gamePassExplorerEnabled` 1 / `gamePassChampionEnabled` 1 (a `0` stops one tier), - `gamePassExplorerPriceCredits` 2000, `gamePassChampionPriceCredits` 4000, `gamePassExplorerDays` / `gamePassChampionDays` 30, - `passTournamentTierSales` 0. -- **Member UI**: the Games tab card shows the three tiers side by side (end dates in Central time); `/my#passes` opens it (the + each tx once). Copy names the package that covers the price: $20 (Explorer), $50 (Champion, there is no $40 one), $100 + (Sovereign), $250 (Legend). +- **Renew / expiry**: no auto-renew, no proration. Buying again extends that tier from `max(now, until)` by its length (Legend: 365 + days). Tiers run side by side; when a higher one ends the next one shows through. Admin comp takes a tier; + `POST /api/admin/gamepass/revoke { email, tier, why }` ends one tier now (support refunds only, credits are not returned by it). +- **Tournament**: any tier holds a seat; only weekly sales feed the pool unless `passTournamentTierSales` is `1` (then every tier's + sales do). +- **Settings** (defaults): `sovTiers` 0; kill switches `gamePassExplorerEnabled` / `gamePassChampionEnabled` / + `gamePassSovereignEnabled` / `gamePassLegendEnabled` 1 (a `0` stops one tier); `gamePassExplorerPriceCredits` 1999, + `gamePassChampionPriceCredits` 3999, `gamePassSovereignPriceCredits` 9999, `gamePassLegendPriceCredits` 24999; + `gamePassExplorerDays` / `gamePassChampionDays` / `gamePassSovereignDays` 30, `gamePassLegendDays` 365; + `passTournamentTierSales` 0. A value saved in the site settings file wins over these defaults. +- **Chatbot**: while `sovTiers` is off the assistant only says more passes are coming soon (no prices, no contents, no date); once + on, its fact lists each tier on sale with the live price, length and contents. +- **Member UI**: the Games tab card shows the tiers side by side (end dates in Central time); `/my#passes` opens it (the Shards of Valor Buy button). **Admin**: Game Pass pane "By pass tier" table, comp per tier, end-a-tier button. -- **Tests**: `bash qa/run.sh sov-passes` (store unit checks + a local copy where the admin buys Explorer through the real - `ads.gamePurchase(purchasedOnly)` path with credits seeded by `qa/sov-passes-stub.cjs`). +- **Tests**: `bash qa/run.sh sov-passes` (store unit checks + a local copy where the admin buys Explorer and Sovereign through the + real `ads.gamePurchase(purchasedOnly)` path with credits seeded by `qa/sov-passes-stub.cjs`, and a Legend order is fulfilled by + a $250 package). ## Games: as built (2026-10-16, local commits only, nothing deployed) diff --git a/gamepass.js b/gamepass.js index b067c04..48e5adf 100644 --- a/gamepass.js +++ b/gamepass.js @@ -20,6 +20,9 @@ // `until` as the weekly tier). flag().tier = the highest active tier. Explorer/Champion sales sit behind the site switch // `sovTiers` (default off; only ADMIN_EMAIL can see and buy them while it is off). No proration, no auto-renew: buying again // extends that tier from max(now, until). +// 2026-10-22 (Dallas's structure, Marty approved): Explorer $19.99 and Champion $39.99 (30 days), plus Sovereign $99.99 (30 days) +// and Legend $249.99 (365 days, the yearly pass), all in TIER_DEFS below and all behind the same sovTiers switch. The weekly +// pass is unchanged ($5 / 7 days / the same caps). Rank weekly < explorer < champion < sovereign < legend. 'use strict'; const fs = require('fs'); const path = require('path'); @@ -29,8 +32,26 @@ const GAMES = ['polhunter', 'gemkingdom', 'spellwheel', 'spookydoors', 'polywarr const NAMES = { polhunter: 'PolHunter', gemkingdom: 'Gem Kingdom', spellwheel: 'SpellWheel', spookydoors: 'Spooky Doors', polywarriors: 'PolyWarriors', clutterhunt: 'ClutterHunt', polybreak: 'PolyBreak', driprunner: 'Drip Runner', roadagent: 'Road Agent', shardsofvalor: 'Shards of Valor' }; const SHARES = [0.5, 0.3, 0.2]; // tournament prize split, places 1-3 const KEEP_DAYS = 90; // answered refs and day rows are kept this long (idempotency window) -const TIERS = ['weekly', 'explorer', 'champion']; // lowest to highest -const TIER_NAMES = { weekly: 'Game Pass', explorer: 'Explorer', champion: 'Champion' }; +// THE pass table (2026-10-22, Dallas's structure, Marty approved): lowest to highest, a higher tier includes everything below. +// Rename a tier here (name) and nowhere else: the member card, the admin pane, the charge label and the chatbot read it from here. +// key = the wire value the games read (flag().tier / tiers); set = the Admin > Settings stem (gamePassEnabled / +// PriceCredits / Days; weekly keeps its original gamePassPriceCredits / gamePassDays); price = purchased-grade credits (100 = $1); +// perks = what the member card lists. Every tier is a Game Pass holder everywhere with the SAME caps (no extra POL). +const TIER_DEFS = [ + { key: 'weekly', name: 'Game Pass', set: '', price: 500, days: 7, + perks: ['Higher daily POL caps in every game', 'A seat in the weekly Pass Tournament', 'Extra plays and a perk in each game', 'Shards of Valor: the Sunless Vault and weapons unlocked'] }, + { key: 'explorer', name: 'Explorer', set: 'Explorer', price: 1999, days: 30, + perks: ['Everything in the Game Pass, in every game', 'Shards of Valor: weapons and gear unlocked', 'Shards of Valor: 2 bonus islands'] }, + { key: 'champion', name: 'Champion', set: 'Champion', price: 3999, days: 30, + perks: ['Everything in Explorer', 'Shards of Valor: 4 bonus islands of your choice', 'Shards of Valor: the Druid hero', 'Shards of Valor: level cap 30'] }, + { key: 'sovereign', name: 'Sovereign', set: 'Sovereign', price: 9999, days: 30, + perks: ['Everything in Champion', 'Shards of Valor: every bonus island', 'Shards of Valor: the Necromancer hero', 'Shards of Valor: level cap 40'] }, + { key: 'legend', name: 'Legend', set: 'Legend', price: 24999, days: 365, + perks: ['Everything in Sovereign, for a full year', 'Shards of Valor: every bonus island', 'Shards of Valor: every hero, the Archer included', 'Shards of Valor: level cap 40'] }, +]; +const TIERS = TIER_DEFS.map(d => d.key); // lowest to highest +const TIER_NAMES = Object.fromEntries(TIER_DEFS.map(d => [d.key, d.name])); +const TIER_DEF = Object.fromEntries(TIER_DEFS.map(d => [d.key, d])); const tierOk = t => TIERS.includes(t); const rowTier = b => (b && tierOk(b.tier)) ? b.tier : 'weekly'; // bought rows before 2026-10-18 have no tier: weekly const r6 = x => Math.round((Number(x) || 0) * 1e6) / 1e6; @@ -63,14 +84,12 @@ function cfg() { return { enabled: on('gamePassEnabled'), price, days, - // per tier: price in purchased-grade credits (100 = $1), length, and whether it is on sale. Explorer/Champion need the master - // switch sovTiers AND the weekly pass switched on; their own gamePassEnabled is a kill switch (missing = on). + // per tier: price in purchased-grade credits (100 = $1), length, and whether it is on sale. Every tier above weekly needs the + // master switch sovTiers AND the weekly pass switched on; its own gamePassEnabled is a kill switch (missing = on). tierSales: on('sovTiers'), - tiers: { - weekly: { price, days, sale: on('gamePassEnabled') }, - explorer: { price: Math.max(1, Math.round(n('gamePassExplorerPriceCredits', 2000))), days: Math.max(1, Math.round(n('gamePassExplorerDays', 30))), sale: on('gamePassEnabled') && on('sovTiers') && !offExplicit('gamePassExplorerEnabled') }, - champion: { price: Math.max(1, Math.round(n('gamePassChampionPriceCredits', 4000))), days: Math.max(1, Math.round(n('gamePassChampionDays', 30))), sale: on('gamePassEnabled') && on('sovTiers') && !offExplicit('gamePassChampionEnabled') }, - }, + tiers: Object.fromEntries(TIER_DEFS.map(d => [d.key, d.key === 'weekly' ? { price, days, sale: on('gamePassEnabled') } + : { price: Math.max(1, Math.round(n('gamePass' + d.set + 'PriceCredits', d.price))), days: Math.max(1, Math.round(n('gamePass' + d.set + 'Days', d.days))), + sale: on('gamePassEnabled') && on('sovTiers') && !offExplicit('gamePass' + d.set + 'Enabled') }])), tournamentTierSales: on('passTournamentTierSales'), // off: only weekly pass sales feed the Pass Tournament pool (exactly as before tiers) free: { daily: Math.max(0, n('capFreeDaily', 0.30)), total: Math.max(0, n('capFreeTotal', 2.0)) }, pass: { daily: Math.max(0, n('capPassDaily', 1.50)), total: Math.max(0, n('capPassTotal', 5.0)) }, @@ -150,20 +169,20 @@ function revoke(email, tier, why, now) { passes.set(e, writeTiers(p, T, { revokes: [{ ts: t, tier, why: String(why || 'support').slice(0, 80), was }].concat(p.revokes || []).slice(0, 50) })); return { ok: true, tier, was, until: t }; } -// on sale for this viewer: the tier's own switch, or the admin account testing Explorer/Champion while sovTiers is off +// on sale for this viewer: the tier's own switch, or the admin account testing the tiers above weekly while sovTiers is off const tierOpen = (c, tier, admin) => !!(c.tiers[tier].sale || (admin && tier !== 'weekly')); const PACKAGE_USD = [5, 10, 20, 50, 100, 250, 500]; // copy only: the package that covers a price const packageFor = usd => PACKAGE_USD.find(x => x >= usd) || usd; -// GET /api/my/gamepass. opts.admin = the ADMIN_EMAIL account (sees Explorer/Champion while sovTiers is off). +// GET /api/my/gamepass. opts.admin = the ADMIN_EMAIL account (sees every tier while sovTiers is off). function view(email, now, opts) { const e = String(email || '').toLowerCase(); const c = cfg(); const t = now || Date.now(); const f = flag(e, t); const p = rec(e); const w = waitingOrder(e, 'weekly'); const admin = !!(opts && opts.admin); const T = tiersOf(p); const caps = capsFor(e, t); - // the tier rows this member sees: weekly always; Explorer/Champion while on sale, to the admin, or to a current holder (holders + // the tier rows this member sees: weekly always; a higher tier while on sale, to the admin, or to a current holder (holders // keep their pass when a sale is switched off, they just cannot buy more) const passRows = TIERS.filter(k => k === 'weekly' || c.tiers[k].sale || admin || T[k] > t).map(k => { - const tc = c.tiers[k]; return { tier: k, name: TIER_NAMES[k], price: tc.price, usd: tc.price / 100, days: tc.days, package: packageFor(tc.price / 100), + const tc = c.tiers[k]; return { tier: k, name: TIER_NAMES[k], perks: TIER_DEF[k].perks, price: tc.price, usd: tc.price / 100, days: tc.days, package: packageFor(tc.price / 100), active: T[k] > t, until: T[k] > t ? T[k] : null, waiting: !!waitingOrder(e, k), open: k === 'weekly' ? c.enabled : tierOpen(c, k, admin) }; }); const tiered = passRows.some(r => r.tier !== 'weekly'); @@ -290,13 +309,13 @@ function voidGrant(o) { // ---- the weekly Pass Tournament (Monday 9 AM Central, the week that just closed) ---- function nextTournamentAt(now) { const t = now || Date.now(); const ws = weekStart(t); const thisMon = ws + 9 * 3600000; return t < thisMon ? thisMon : ws + 7 * 86400000 + 9 * 3600000; } -function holdersIn(start, end) { // any tier holds a Pass Tournament seat (Explorer and Champion include everything Weekly gives) +function holdersIn(start, end) { // any tier holds a Pass Tournament seat (every tier above weekly includes everything Weekly gives) const out = []; for (const [e, p] of passes) { if (!p || !(Math.max(...TIERS.map(k => tiersOf(p)[k])) > start)) continue; if ((p.bought || []).some(b => b.ts < end)) out.push(e); } return out; } const isSale = b => b && b.via !== 'admin'; // comps are passes, not sales -// the pool counts weekly pass sales only, unless passTournamentTierSales adds Explorer/Champion sales (default off: the pool exactly as before tiers) +// the pool counts weekly pass sales only, unless passTournamentTierSales adds the sales of every tier above weekly (default off: the pool exactly as before tiers) function salesIn(start, end, withTiers) { let n = 0, usd = 0; for (const [, p] of passes) for (const b of (p && p.bought) || []) if (isSale(b) && b.ts >= start && b.ts < end && (withTiers || rowTier(b) === 'weekly')) { n += 1; usd += Number(b.usd) || 0; } return { n, usd: Math.round(usd * 100) / 100 }; } function scoresFor(wk, emails) { return emails.map(e => { const M = L.members[e]; const g = (M && M.weeks[wk]) || {}; const score = Object.values(g).reduce((n, x) => n + x, 0); const first = ((passes.get(e) || {}).bought || []).reduce((m, b) => Math.min(m, b.ts), Infinity); @@ -422,5 +441,5 @@ function prune(now) { return n; } -module.exports = { init, cfg, GAMES, NAMES, TIERS, TIER_NAMES, flag, view, buy, comp, revoke, onEvent, capsFor, grant, voidGrant, tournamentTick, runTournament, pending, markPaid, adminStats, prune, weekStart, dayKey, +module.exports = { init, cfg, GAMES, NAMES, TIERS, TIER_NAMES, TIER_DEFS, flag, view, buy, comp, revoke, onEvent, capsFor, grant, voidGrant, tournamentTick, runTournament, pending, markPaid, adminStats, prune, weekStart, dayKey, _ledger: () => L }; diff --git a/public/admin.html b/public/admin.html index 4633ad3..ff3f5c3 100644 --- a/public/admin.html +++ b/public/admin.html @@ -554,9 +554,9 @@

Comp a pass

support: one pass period, recorded as no sale
-

+

-

Settings live in Settings › Site settings: gamePassEnabled (1/0), gamePassPriceCredits, gamePassDays, capFreeDaily, capFreeTotal, capPassDaily, capPassTotal, capsStartDate (Central YYYY-MM-DD; empty = caps recorded, not enforced), passTournamentPct, telegramGamesTopicId. Monthly tiers: sovTiers (1/0, the Explorer + Champion sale switch; off = only the admin account sees them), gamePassExplorerEnabled / gamePassChampionEnabled (0 stops one tier), gamePassExplorerPriceCredits (2000), gamePassChampionPriceCredits (4000), gamePassExplorerDays / gamePassChampionDays (30), passTournamentTierSales (1 = their sales feed the tournament pool; default 0). Prize POL is paid by the games from their faucets (GET /api/partner/tournament/pending), not from here.

+

Settings live in Settings › Site settings: gamePassEnabled (1/0), gamePassPriceCredits, gamePassDays, capFreeDaily, capFreeTotal, capPassDaily, capPassTotal, capsStartDate (Central YYYY-MM-DD; empty = caps recorded, not enforced), passTournamentPct, telegramGamesTopicId. Tiers above weekly: sovTiers (1/0, the sale switch for all of them; off = only the admin account sees them), gamePassExplorerEnabled / gamePassChampionEnabled / gamePassSovereignEnabled / gamePassLegendEnabled (0 stops one tier), gamePassExplorerPriceCredits (1999), gamePassChampionPriceCredits (3999), gamePassSovereignPriceCredits (9999), gamePassLegendPriceCredits (24999), gamePassExplorerDays / gamePassChampionDays / gamePassSovereignDays (30), gamePassLegendDays (365), passTournamentTierSales (1 = their sales feed the tournament pool; default 0). Prize POL is paid by the games from their faucets (GET /api/partner/tournament/pending), not from here.