<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Lucky Wheel Spin</title>
<style>
body { font-family: Arial, sans-serif; text-align: center; margin-top: 50px; }
button { margin: 5px; padding: 10px; }
#output { margin-top: 20px; font-size: 18px; }
</style>
</head>
<body>
<h1>Lucky Wheel Spin</h1>
<div id="status"></div>
<div>
<button onclick="spin(1, 10)">Spin Standard (10 WAXC)</button>
<button onclick="spin(2, 10)">Spin Deluxe (10 WAXC)</button>
<button onclick="spin(1, getMaxBet())">Spin Standard (Max)</button>
<button onclick="spin(2, getMaxBet())">Spin Deluxe (Max)</button>
<button onclick="cashout()">Cashout</button>
<button onclick="showStats()">Stats</button>
</div>
<div id="output"></div>
<script type="module">
import init, { Game, init as initPanic } from "./pkg/lucky_wheel_spin.js";
let game;
async function start() {
await init();
initPanic();
game = new Game();
updateStatus();
}
function updateStatus() {
document.getElementById("status").innerText =
`Money: ${game.get_money()} WAXC | High Score: ${game.get_high_score()} WAXC | Jackpot: ${game.get_jackpot()} WAXC`;
}
function getMaxBet() {
return game.get_money() - 2; // Account for 2 WAXC fee
}
window.spin = function(wheelType, bet) {
const result = game.spin(wheelType, bet);
document.getElementById("output").innerText = result;
updateStatus();
};
window.cashout = function() {
const result = game.cashout();
document.getElementById("output").innerText = result;
updateStatus();
};
window.showStats = function() {
const stats = game.get_stats();
document.getElementById("output").innerText = stats;
};
start();
</script>
</body>
</html>