/**
* 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';
// Check if payments are disabled (free mode)
if (!config.paymentsEnabled) {
$container.html(`
🆓 Free Mode
Play for free! No payment required. Payouts may or may not be enabled.
`);
return;
}
// Direct payment mode
if (config.directModeEnabled) {
const price = config.singleGamePriceFormatted || '1';
const multipliers = config.payoutMultipliers?.direct || {};
const escapeMulti = multipliers.escape || 2;
const treasureMulti = multipliers.treasure || 3;
$container.append(`
âš¡ Direct Payment
Pay ${price} ${currency} per game.
Escape: ${escapeMulti}× payout | With treasure: ${treasureMulti}× payout
`);
}
// Credits mode
if (config.creditsModeEnabled) {
const packages = config.creditPackages || [];
const creditsPayoutEnabled = config.creditsPayoutsEnabled;
let packagesInfo = '';
if (packages.length > 0) {
packagesInfo = packages.map(pkg => {
const bonus = pkg.bonus > 0 ? ` +${pkg.bonus} bonus` : '';
return `${pkg.credits}${bonus} credits for ${pkg.priceFormatted} ${currency}`;
}).join(', ');
}
$container.append(`
🎫 Credits Mode
Buy credits in bulk and use them to play.
${packagesInfo ? `Packages: ${packagesInfo}
` : ''}
${creditsPayoutEnabled
? '✓ Payouts enabled for credit games'
: 'Payouts not available for credit games'}
`);
}
// If no paid modes are shown but payments enabled
if (!config.directModeEnabled && !config.creditsModeEnabled && config.paymentsEnabled) {
$container.html(`
Payment configuration is loading...
`);
}
}
};
// Expose globally
window.HelpModal = HelpModal;
// Initialize when DOM is ready
$(document).ready(function() {
HelpModal.init();
});