Shards of Valor bonus heroes sold one time (Marty approved 2026-11-05): Kestrel, Valda, Morag, Roland $20 each, $50 bundle (Valda + Morag + Roland), behind heroSales (OFF)
Paid exactly like a pass: no credits, no POL. POST /api/my/heroes/buy opens a waiting order (kind hero); a fresh package of at least the
price from one of the member's own positions fulfils it in gamepass.onEvent (one package, one order: the highest-priced it covers, pass
or hero; each tx once). Ownership is permanent on the passes record (heroes, heroBundle), never in bought, so hero sales never feed the
Pass Tournament pool. No double charge: an owned hero is refused, a bundle is refused once any of its heroes is owned, and waiting orders
made pointless by a purchase are cancelled.
Settings (Admin > Settings): heroSales '0', heroPrice<Kestrel|Valda|Morag|Roland>Cents 2000 (0 = free for every account),
heroBundlePriceCents 5000, heroBundleHeroes 'valda,morag,roland', heroBundleCap '' (unset: the bundle is heroes only, no cap change).
Hand-off: sovMint (and GET /api/partner/player for shardsofvalor) carries heroes, heroBundle, heroSale { free, bundle, each, bundlePrice },
and heroBundleCap only when set. TIER_DEFS perks: Champion no longer lists the Druid, Sovereign no longer the Necromancer (dropped),
Legend every bonus hero while active. Member Game Pass card: a Bonus heroes block (shown while heroSales is on or to an owner);
Admin > Game Pass: hero test on the admin's own account (test buy / cancel / give / remove) and /api/admin/heroes/stats.
Chatbot: canned sov-bonus-heroes answer + heroesFact following heroSales; KNOWLEDGE_DATE 2026-11-05. my.js?v=20261105hr, admin.js?v=20261105hr.
QA: qa/sov-heroes-store.cjs (39 checks, in member and sov-passes); sov-passes-local expects the hero test panel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -564,7 +564,8 @@ async function boot() {
|
||||
messages.init({ dataDir: DATA_DIR });
|
||||
reports.init({ dataDir: DATA_DIR });
|
||||
drip.init({ dataDir: DATA_DIR, mailer, accounts, chain, site: 'https://instantadpay.com' });
|
||||
chatbot.init({ dataDir: DATA_DIR, chain, bixLive: () => bixpay.live(), gameLive: slug => String(siteConfig().gamesLive == null ? 'polhunter' : siteConfig().gamesLive).split(',').map(x => x.trim().toLowerCase()).includes(slug), refuelOn: () => refuel.cfg().on, passTiers: () => { const c = gamepass.cfg(); return { on: c.enabled && c.tierSales, rows: gamepass.TIER_DEFS.filter(d => d.key !== 'weekly').map(d => ({ name: d.name, perks: d.perks, price: c.tiers[d.key].price, usd: c.tiers[d.key].price / 100, days: c.tiers[d.key].days, sale: c.tiers[d.key].sale })) }; } }); // pass tiers fact follows sovTiers (2026-10-22)
|
||||
chatbot.init({ dataDir: DATA_DIR, chain, bixLive: () => bixpay.live(), gameLive: slug => String(siteConfig().gamesLive == null ? 'polhunter' : siteConfig().gamesLive).split(',').map(x => x.trim().toLowerCase()).includes(slug), refuelOn: () => refuel.cfg().on, passTiers: () => { const c = gamepass.cfg(); return { on: c.enabled && c.tierSales, rows: gamepass.TIER_DEFS.filter(d => d.key !== 'weekly').map(d => ({ name: d.name, perks: d.perks, price: c.tiers[d.key].price, usd: c.tiers[d.key].price / 100, days: c.tiers[d.key].days, sale: c.tiers[d.key].sale })) }; },
|
||||
heroSale: () => { const h = gamepass.cfg().heroes, N = Object.fromEntries(gamepass.HERO_DEFS.map(d => [d.key, d.name])); return { sale: h.sale, rows: gamepass.HERO_DEFS.map(d => ({ name: d.name, usd: h.price[d.key] / 100, free: h.price[d.key] === 0 })), bundle: { names: h.bundle.heroes.map(k => N[k]), usd: h.bundle.price / 100 } }; } }); // pass tiers fact follows sovTiers (2026-10-22); bonus heroes follow heroSales (2026-11-05)
|
||||
setTimeout(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 1000);
|
||||
setInterval(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 60 * 1000);
|
||||
setInterval(() => ads.scheduleSweep().catch(e => console.error('schedule sweep', e.message)), 5 * 60 * 1000); // scheduled starts/ends
|
||||
@@ -832,6 +833,11 @@ function siteConfig() {
|
||||
// 2026-10-25 (Marty): prices = the one-click packages: Explorer $20, Champion $50, Sovereign $100, Legend $250 (cents below).
|
||||
sovTiers: '0', gamePassExplorerEnabled: '1', gamePassExplorerPriceCredits: 2000, gamePassExplorerDays: 30, gamePassChampionEnabled: '1', gamePassChampionPriceCredits: 5000, gamePassChampionDays: 30,
|
||||
gamePassSovereignEnabled: '1', gamePassSovereignPriceCredits: 10000, gamePassSovereignDays: 30, gamePassLegendEnabled: '1', gamePassLegendPriceCredits: 25000, gamePassLegendDays: 365, passTournamentTierSales: '0',
|
||||
// Shards of Valor bonus heroes (2026-11-05, Marty approved; gamepass.js HERO_DEFS): sold ONE TIME, paid by a fresh package like a pass.
|
||||
// heroSales = the sale switch (OFF until Marty flips it; the admin tests from Admin > Game Pass). Prices in cents: 2000 = $20 (the
|
||||
// Activation package); 0 = that hero is free for every account. heroBundleHeroes = the $50 bundle's list (default Valda, Morag,
|
||||
// Roland). heroBundleCap = a level cap the bundle would raise to; leave EMPTY (Marty has not approved one: the bundle is heroes only).
|
||||
heroSales: '0', heroPriceKestrelCents: 2000, heroPriceValdaCents: 2000, heroPriceMoragCents: 2000, heroPriceRolandCents: 2000, heroBundlePriceCents: 5000, heroBundleHeroes: 'valda,morag,roland', heroBundleCap: '',
|
||||
supportTelegramChat: '1289244227', // help desk pings: Marty's PRIVATE chat only (a positive user id; group/channel ids are refused). Sent with telegramBotToken, Hermes bot as fallback
|
||||
supportTemplates: '', // help desk saved replies, JSON [{name, body}] (Admin > Support > Saved replies); empty = the built-in set
|
||||
telegramGamesChatId: '', telegramGamesTopicId: '661565', // Game Achievements topic for the weekly Pass Tournament post (chat blank = the shared echo chat)
|
||||
@@ -1718,7 +1724,8 @@ const SOV_SECRET = () => String(process.env.SOV_SSO_SECRET || '').trim();
|
||||
const SOV_URL = () => String(process.env.SOV_URL || 'https://shardsofvalor.com').replace(/\/+$/, '');
|
||||
const SOV_ALT = () => String(process.env.SOV_ALT_URLS || 'https://www.shardsofvalor.com,https://sov.saasy.top').split(',').map(x => x.trim().replace(/\/+$/, '')).filter(Boolean);
|
||||
const sovSign = p => drB64u(crypto.createHmac('sha256', SOV_SECRET()).update(p).digest());
|
||||
function sovMint(claims, ttlMs) { const payload = JSON.stringify(Object.assign({ iat: Date.now(), exp: Date.now() + (ttlMs || 300000), nonce: crypto.randomBytes(12).toString('hex') }, claims, gpClaim(claims))); return drB64u(payload) + '.' + sovSign(payload); }
|
||||
// 2026-11-05: the bonus heroes ride along too (gamepass.heroClaim: heroes owned, heroBundle, the current sale; heroBundleCap only if set)
|
||||
function sovMint(claims, ttlMs) { const payload = JSON.stringify(Object.assign({ iat: Date.now(), exp: Date.now() + (ttlMs || 300000), nonce: crypto.randomBytes(12).toString('hex') }, claims, gpClaim(claims), claims && claims.email ? gamepass.heroClaim(claims.email) : {})); return drB64u(payload) + '.' + sovSign(payload); }
|
||||
function seekOpen(token) {
|
||||
if (SEEK_SECRET().length < 32) return { error: 'ClutterHunt is not connected yet.' };
|
||||
const [p, sig] = String(token || '').split('.'); if (!p || !sig) return { error: 'That link is not valid.' };
|
||||
@@ -4399,8 +4406,8 @@ const server = http.createServer(async (req, res) => {
|
||||
if (!gpSigOk(crypto.createHmac('sha256', chk.secret).update('player:' + (m > 0 ? String(m) : e) + ':' + ts).digest('hex'), sig)) return json(res, 401, { error: 'bad signature' });
|
||||
const r = await gpResolve(m, e); if (!r) return json(res, 404, { error: 'no such member', pass: { active: false, until: null, tier: null, tiers: { weekly: null, explorer: null, champion: null } } });
|
||||
const now = gpDevNow(u.searchParams.get('devDay'));
|
||||
return json(res, 200, { ok: true, memberId: r.memberId, username: r.acct.username || null, wallet: r.acct.address || null, suspended: fraud.isSuspended(r.email),
|
||||
pass: gamepass.flag(r.email, now), caps: gamepass.capsFor(r.email, now, game), gamePassEnabled: gamepass.cfg().enabled });
|
||||
return json(res, 200, Object.assign({ ok: true, memberId: r.memberId, username: r.acct.username || null, wallet: r.acct.address || null, suspended: fraud.isSuspended(r.email),
|
||||
pass: gamepass.flag(r.email, now), caps: gamepass.capsFor(r.email, now, game), gamePassEnabled: gamepass.cfg().enabled }, game === 'shardsofvalor' ? gamepass.heroClaim(r.email) : {}));
|
||||
}
|
||||
if ((p === '/api/partner/polgrant' || p === '/api/partner/polgrant/void' || p === '/api/partner/tournament/paid') && req.method === 'POST') {
|
||||
let raw; try { raw = (await readRaw(req, 16384)).toString('utf8'); } catch (e) { return json(res, 413, { error: 'too big' }); }
|
||||
@@ -4444,6 +4451,29 @@ const server = http.createServer(async (req, res) => {
|
||||
const r = gamepass.buy(s.email, gpDevNow(b.devDay), b.tier);
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
// Shards of Valor bonus heroes (2026-11-05, Marty approved): sold one time. Buy only opens a waiting order; a FRESH package of at least the
|
||||
// price ($20 hero = Activation, $50 bundle = Builder), bought by one of this member's own positions, fulfils it (gamepass.onEvent), so the
|
||||
// sponsor line is paid as usual. Refused while heroSales is off (the admin tests from Admin > Game Pass).
|
||||
if (p === '/api/my/heroes/buy' && req.method === 'POST') {
|
||||
const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
if (fraud.isSuspended(s.email)) return json(res, 403, { error: 'This account is suspended.' });
|
||||
const b = await readBody(req); const r = gamepass.buyHero(s.email, Date.now(), b.hero);
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
// Admin > Game Pass hero test (2026-11-05): the admin's OWN account only, as the tier test below
|
||||
if (['/api/admin/heroes/test-buy', '/api/admin/heroes/test-cancel', '/api/admin/heroes/test-comp', '/api/admin/heroes/test-revoke'].includes(p) && req.method === 'POST') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const as = adminFromRequest(req); const me = String((as && as.email) || ADMIN_EMAIL || '').trim().toLowerCase();
|
||||
if (!me) return json(res, 400, { error: 'No admin account email (ADMIN_EMAIL) is set.' });
|
||||
const b = await readBody(req); const hero = String(b.hero || '').toLowerCase(); let r;
|
||||
if (p === '/api/admin/heroes/test-buy') r = gamepass.buyHero(me, Date.now(), hero, { preview: true });
|
||||
else if (p === '/api/admin/heroes/test-cancel') r = gamepass.cancelHeroOrder(me, hero);
|
||||
else if (p === '/api/admin/heroes/test-comp') r = gamepass.compHero(me, hero, 'admin hero test');
|
||||
else r = gamepass.revokeHero(me, hero || 'all', 'admin hero test');
|
||||
if (!r.error) console.log('bonus heroes admin test', p.split('/').pop(), hero, me);
|
||||
return json(res, r.error ? 400 : 200, Object.assign({ email: me, test: true, heroes: gamepass.heroView(me, Date.now(), { preview: true }) }, r));
|
||||
}
|
||||
if (p === '/api/admin/heroes/stats' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, gamepass.heroStats()); }
|
||||
// Admin > Game Pass tier test (2026-10-25, Marty): every tier as members will see it, with the admin's OWN account's state, and a
|
||||
// test buy of a tier that is not on sale yet (opens the same waiting order a member gets; a fresh package on /my fulfils it).
|
||||
// Always the signed-in admin's own account (the bearer password falls back to ADMIN_EMAIL); never another member's.
|
||||
|
||||
Reference in New Issue
Block a user