/** * Help Modal * Displays game instructions and payment mode information */ const HelpModal = { _config: null, init: function() { // Bind close buttons $('#helpModalClose, #helpModalCloseBtn').on('click', function() { HelpModal.hide(); }); // Bind help button $('#helpButton').on('click', function() { HelpModal.show(); }); // Close on overlay click $('#helpModal').on('click', function(e) { if (e.target === this) { HelpModal.hide(); } }); // Close on Escape key $(document).on('keydown', function(e) { if (e.key === 'Escape' && !$('#helpModal').hasClass('hidden')) { HelpModal.hide(); } }); }, updateConfig: function(config) { this._config = config; const payoutsOn = !!(config && (config.directPayoutsEnabled || config.creditsPayoutsEnabled)); if (payoutsOn) { $('#helpPayoutTitle').text('🎁 Payouts'); $('#helpPayoutCopy').text('Set your payout address with “Manage Payout Address.” An escape pays the configured reward automatically, and escaping with the treasure earns the higher multiplier.'); $('#helpTreasureLegend').text('Treasure - collect for the higher payout and score bonus'); } else { $('#helpPayoutTitle').text('🏅 Prestige rewards'); $('#helpPayoutCopy').text('This server does not pay crypto winnings. Paid entries and credits qualify scores for the Hall of Champions; free runs stay on the separate Pleb leaderboard.'); $('#helpTreasureLegend').text('Treasure - collect for a score bonus'); } }, show: function() { this._renderPaymentModes(); $('#helpModal').removeClass('hidden'); }, hide: function() { $('#helpModal').addClass('hidden'); }, _renderPaymentModes: function() { const $container = $('#helpModesList'); $container.empty(); const config = this._config || {}; const currency = config.cryptoType || 'WOW'; // Fully free deployment (no payments configured). if (!config.paymentsEnabled) { $container.html(`
🆓 Free to play
No payment needed: just escape the dungeon.
`); return; } const directOn = config.directModeEnabled; const creditsOn = config.creditsModeEnabled; if (!directOn && !creditsOn) { $container.html('

Loading…

'); return; } // Unified model: everything is CREDITS. Buy one at the base price, or a bundle at a // discount; 1 credit = 1 run either way. const price = config.singleGamePriceFormatted || '1'; const packages = config.creditPackages || []; const payoutsOn = !!(config.directPayoutsEnabled || config.creditsPayoutsEnabled); const buy = []; if (directOn) buy.push(`1 credit: ${price} ${currency}`); if (creditsOn && packages.length > 0) { const bundles = packages.map(pkg => { const bonus = pkg.bonus > 0 ? ` +${pkg.bonus}` : ''; return `${pkg.credits}${bonus} for ${pkg.priceFormatted}`; }).join(' · '); buy.push(`Bundles: ${bundles} ${currency}`); } // Reward line is config-driven so it stays honest on prestige (no-payout) deployments. let reward; if (payoutsOn) { reward = '💰 Exact escape and treasure rewards are shown before entry and locked for that run.'; } else { reward = `🏅 No crypto payout: escape for the win; top scores enter the Hall of Champions.`; } const freeLine = config.freePlayEnabled ? `
Prefer a free entry? Free runs are available too (Pleb leaderboard).
` : ''; $container.html(`
🎫 1 credit = 1 run
Buy credits with ${currency}:
${buy.map(b => '  • ' + b).join('
')}
Spend a credit to enter: jump in immediately, or on the next block. Block timing is random, so your average wait is the same either way.
${reward}
${freeLine}
`); } }; // Expose globally window.HelpModal = HelpModal; // Initialize when DOM is ready $(document).ready(function() { HelpModal.init(); });