/** * 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; }, 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(`
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.payoutsEnabled || 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} (cheaper per run)`); } // Reward line is config-driven so it stays honest on prestige (no-payout) deployments. let reward; if (payoutsOn) { const m = (config.payoutMultipliers && (config.payoutMultipliers.direct || config.payoutMultipliers.credits)) || {}; const esc = m.escape || 2; const tre = m.escapeWithTreasure || m.treasure || 3; reward = `π° Escape pays ${esc}Γ Β· with treasure ${tre}Γ.`; } else { reward = `π No crypto payout β escape for the win; top scores enter the Hall of Champions.`; } const freeLine = config.freePlayEnabled ? `