Pass tiers: Explorer ($20/30 days) and Champion ($40/30 days) beside the weekly Game Pass, behind sovTiers (default off, admin-only preview)

Islands and looks in Shards of Valor, never power and never more POL: every tier gets exactly the weekly pass caps and polgrant
still answers pass: true. Per-tier expiry side by side (record.tiers, legacy until mirrors weekly, lazy migration); flag() adds
tier (highest active) and tiers; hand-off token gamePass { active, until, tier }; /api/partner/player pass { active, until, tier,
tiers }. Buy { tier } with purchased credits or a waiting order per tier that a big-enough package fulfils (highest price first,
each tx once). No auto-renew, no proration. Admin: per-tier stats (Central week/month), comp per tier, end-a-tier (refund).
Tournament pool keeps weekly sales only unless passTournamentTierSales. Member card shows three tiers; /my#passes opens it.
Tests: qa/sov-passes-store.cjs, qa/sov-passes-local.mjs (bash qa/run.sh sov-passes). Cache tags my.js/admin.js 20261018tiers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-18 14:46:51 -05:00
parent 5e8f2c0b6b
commit 0688bdeb72
11 changed files with 590 additions and 59 deletions
+28
View File
@@ -215,6 +215,34 @@ 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)
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.
- **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
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
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`).
## Games: as built (2026-10-16, local commits only, nothing deployed)
Everything is behind `GAMEPASS=on` (env, default off = today's behaviour, so the games can be deployed before launch). `IAP_URL` is