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 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-22 10:26:58 -05:00
parent 32eefae473
commit 839c867595
11 changed files with 259 additions and 77 deletions
+11 -8
View File
@@ -1727,12 +1727,15 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
const gpPol = n => Number(n || 0).toFixed(2).replace(/\.?0+$/, '');
// Pass tiers (2026-10-18, Marty approved the safe form): weekly Game Pass, monthly Explorer and Champion side by side. Paid tiers add
// islands and looks in Shards of Valor, never power and never more POL; the main story is free. End dates in Central time.
// 2026-10-22 (Dallas's structure): + Sovereign (monthly) and Legend (yearly). Names and what each includes come from the server
// (gamepass.js TIER_DEFS, row.perks); GP_TIER_PERKS is only the fallback for an older server answer.
const gpCT = ms => new Date(Number(ms)).toLocaleDateString('en-US', { timeZone: 'America/Chicago', weekday: 'short', month: 'short', day: 'numeric' }) + ' (Central)';
const GP_TIER_PERKS = {
weekly: ['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 the Weekly look'],
explorer: ['Everything in the Game Pass, in every game', 'Shards of Valor: up to 4 bonus islands you pick (1 swap a month)', 'Explorer outfits and gear styles for your character'],
champion: ['Everything in Explorer', 'Shards of Valor: every bonus island, now and future', 'Champion outfits and gear styles for your character'],
};
const gpLen = d => d >= 365 && d % 365 === 0 ? (d === 365 ? '1 year' : (d / 365) + ' years') : d + ' days';
function renderPassTiers(card, gp, highlight) {
const rows = gp.passes || []; const top = rows.find(r => r.tier === gp.tier);
const state = top ? '<span class="badge" style="background:var(--gold,#e2b04a);color:#111">' + esc(top.name) + ' active · until ' + esc(gpCT(top.until)) + '</span>'
@@ -1741,25 +1744,25 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
const capsLine = caps.enforced ? 'Today: <b>' + gpPol(caps.used && caps.used.total) + '</b> of ' + gpPol(caps.total) + ' POL used across the games (' + gpPol(caps.used && caps.used.daily) + ' of ' + gpPol(caps.daily) + ' on daily play).' : '';
const box = r => {
const btn = r.waiting ? '<button class="btn small" type="button" data-gp-go="1">Buy a $' + r.package + ' package</button>'
: r.open ? '<button class="btn small" type="button" data-gp-tier="' + esc(r.tier) + '">' + (r.active ? 'Extend ' + r.days + ' more days' : 'Get ' + esc(r.name)) + ' · ' + r.price + ' credits</button>'
: r.open ? '<button class="btn small" type="button" data-gp-tier="' + esc(r.tier) + '">' + (r.active ? 'Extend ' + gpLen(r.days) + ' more' : 'Get ' + esc(r.name)) + ' · ' + r.price + ' credits</button>'
: '<span class="small muted">Not on sale right now. Your pass keeps running.</span>';
return '<div class="gp-tier' + (r.tier === gp.tier ? ' on' : '') + '"><h4>' + esc(r.name) + '</h4>'
+ '<p class="gp-price">$' + r.usd + ' <span class="small muted">for ' + r.days + ' days</span></p>'
+ '<ul>' + (GP_TIER_PERKS[r.tier] || []).map(x => '<li>' + esc(x) + '</li>').join('') + '</ul>'
+ '<p class="gp-price">$' + r.usd + ' <span class="small muted">for ' + gpLen(r.days) + '</span></p>'
+ '<ul>' + (r.perks || GP_TIER_PERKS[r.tier] || []).map(x => '<li>' + esc(x) + '</li>').join('') + '</ul>'
+ '<p class="small" style="margin:6px 0">' + (r.active ? '<b>Active until ' + esc(gpCT(r.until)) + '</b>' : r.waiting ? 'Waiting for a $' + r.package + ' package' : 'Not active') + '</p>'
+ btn + '</div>';
};
card.hidden = false; card.classList.toggle('gp-hl', !!highlight);
card.innerHTML = '<div class="card-head"><h3>\u{1F39F}️ Game Passes</h3><span class="sub">weekly or monthly · every game</span></div>'
+ (gp.tierPreview ? '<p class="small" style="margin:0 0 8px;padding:6px 10px;border-radius:8px;background:#fde68a;color:#7c2d12"><b>Admin preview.</b> Explorer and Champion are hidden from members until sovTiers is switched on in Settings.</p>' : '')
card.innerHTML = '<div class="card-head"><h3>\u{1F39F}️ Game Passes</h3><span class="sub">weekly, monthly or yearly · every game</span></div>'
+ (gp.tierPreview ? '<p class="small" style="margin:0 0 8px;padding:6px 10px;border-radius:8px;background:#fde68a;color:#7c2d12"><b>Admin preview.</b> The passes above the weekly Game Pass are hidden from members until sovTiers is switched on in Settings.</p>' : '')
+ '<p style="margin:0 0 8px">' + state + '</p>'
+ '<p>Free play pays real POL every day, and the main story of Shards of Valor is free for everyone. Every pass gives the same higher POL caps in every game. The monthly passes add islands to explore and looks in Shards of Valor. <b>Paid passes never make you stronger than players who earn their gear</b>, and they never pay more POL.</p>'
+ '<p>Free play pays real POL every day, and the main story of Shards of Valor is free for everyone. Every pass gives the same higher POL caps in every game. Each higher pass includes everything below it and adds more of Shards of Valor: weapons, gear, bonus islands, heroes and a higher level cap. <b>Paid passes never make you stronger than players who earn their gear</b>, and they never pay more POL.</p>'
+ '<div class="gp-tiers">' + rows.map(box).join('') + '</div>'
+ (capsLine ? '<p class="small muted" style="margin-top:10px">' + capsLine + '</p>' : '')
+ '<p class="small muted" style="margin:10px 0 0">Paid with purchased credits from your packages (earned credits never buy a pass). Passes run side by side: a higher pass shows first, and the one underneath keeps its own end date. No auto-renew: buy again any time and that pass extends from its end date. When a pass ends, nothing you earned in a game is taken away.</p>';
card.querySelectorAll('[data-gp-tier]').forEach(b => b.addEventListener('click', async () => {
const r = rows.find(x => x.tier === b.dataset.gpTier); if (!r) return;
const yes = await IAP.confirmBox((r.active ? 'Extend your ' + r.name + ' by ' + r.days + ' days' : 'Get ' + r.name + ' for ' + r.days + ' days') + ' for ' + r.price + ' purchased credits ($' + r.usd + ')? It starts at once. Islands and looks only: no extra power, no extra POL.', { title: r.name, ok: r.active ? 'Extend' : 'Get ' + r.name, cancel: 'Not now' });
const yes = await IAP.confirmBox((r.active ? 'Extend your ' + r.name + ' by ' + gpLen(r.days) : 'Get ' + r.name + ' for ' + gpLen(r.days)) + ' for ' + r.price + ' purchased credits ($' + r.usd + ')? It starts at once. The same POL caps as every pass: no extra POL.', { title: r.name, ok: r.active ? 'Extend' : 'Get ' + r.name, cancel: 'Not now' });
if (!yes) return;
b.disabled = true;
try {
@@ -1797,7 +1800,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
const card = $('gpCard'); if (!card) return;
let gp = null; try { gp = await (await fetch('/api/my/gamepass')).json(); } catch (e) {}
if (!gp || !(gp.enabled || gp.show)) { card.hidden = true; return; }
if ((gp.passes || []).some(r => r.tier !== 'weekly')) return renderPassTiers(card, gp, highlight); // Explorer / Champion on sale (or admin preview, or a holder)
if ((gp.passes || []).some(r => r.tier !== 'weekly')) return renderPassTiers(card, gp, highlight); // a tier above weekly on sale (or admin preview, or a holder)
const caps = gp.caps || {}; const price = gp.price || 500;
const state = gp.active ? '<span class="badge" style="background:var(--gold,#e2b04a);color:#111">Pass active \u00b7 until ' + esc(gpDate(gp.until)) + '</span>'
: gp.waiting ? '<span class="badge amber">Waiting for a $' + (gp.usd || 5) + ' package</span>' : '<span class="badge">Not active</span>';