// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "dice", version: "2.1.0", author: "Farhan-Khan", countDown: 5, role: 0, description: { en: "Dice game with jackpot (10x) and updated probabilities." }, category: "game", guide: { en: "{p}dice " } }, onStart: async function ({ args, message, event, usersData }) { const { senderID } = event; const bet = parseInt(args[0]); if (isNaN(bet) || bet <= 0) { return message.reply("โŒ Please enter a valid amount to bet."); } if (bet < 50) { return message.reply("โŒ Minimum bet is 50$"); } try { const userData = await usersData.get(senderID); const money = userData.money || 0; if (money < bet) { return message.reply("โŒ You don't have enough balance to bet!"); } // ======================================================= // ๐ŸŽฒ PROBABILITY SYSTEM // // Lose: 40% // Win: 45% // Draw: 10% // Jackpot: 5% // ======================================================= const r = Math.random(); let outcome; if (r < 0.40) outcome = "lose"; else if (r < 0.85) outcome = "win"; else if (r < 0.95) outcome = "draw"; else outcome = "jackpot"; let userRoll, botRoll; let delta = 0; let result = ""; if (outcome === "jackpot") { userRoll = 6; botRoll = 1; delta = bet * 10; result = `๐ŸŽฒ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ฅ๐—ผ๐—น๐—น: 6\n` + `๐Ÿค– ๐—•๐—ผ๐˜'๐˜€ ๐—ฅ๐—ผ๐—น๐—น: 1\n` + `๐ŸŽ‰ ๐—๐—”๐—–๐—ž๐—ฃ๐—ข๐—ง!! ๐—ฌ๐—ผ๐˜‚ ๐—ช๐—ผ๐—ป +${bet * 10}$ ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ`; } else if (outcome === "win") { botRoll = randomInt(1, 4); userRoll = randomInt(botRoll + 1, 6); delta = bet; result = `๐ŸŽฒ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ฅ๐—ผ๐—น๐—น: ${userRoll}\n` + `๐Ÿค– ๐—•๐—ผ๐˜'๐˜€ ๐—ฅ๐—ผ๐—น๐—น: ${botRoll}\n` + `โœ… ๐—ฌ๐—ผ๐˜‚ ๐—ช๐—ผ๐—ป +${bet}$!`; } else if (outcome === "draw") { userRoll = botRoll = randomInt(1, 6); delta = 0; result = `๐ŸŽฒ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ฅ๐—ผ๐—น๐—น: ${userRoll}\n` + `๐Ÿค– ๐—•๐—ผ๐˜'๐˜€ ๐—ฅ๐—ผ๐—น๐—น: ${botRoll}\n` + `๐Ÿ” ๐—œ๐˜'๐˜€ ๐—ฎ ๐——๐—ฟ๐—ฎ๐˜„! ๐—ก๐—ผ ๐—ฐ๐—ต๐—ฎ๐—ป๐—ด๐—ฒ ๐—ถ๐—ป ๐—ฏ๐—ฎ๐—น๐—ฎ๐—ป๐—ฐ๐—ฒ.`; } else if (outcome === "lose") { userRoll = randomInt(1, 5); botRoll = randomInt(userRoll + 1, 6); delta = -bet; result = `๐ŸŽฒ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ฅ๐—ผ๐—น๐—น: ${userRoll}\n` + `๐Ÿค– ๐—•๐—ผ๐˜'๐˜€ ๐—ฅ๐—ผ๐—น๐—น: ${botRoll}\n` + `โŒ ๐—ฌ๐—ผ๐˜‚ ๐—Ÿ๐—ผ๐˜€๐˜ -${bet}$`; } // ๐Ÿ’ฐ Update money (normal usersData system) if (delta !== 0) { await usersData.set(senderID, { money: money + delta }); } return message.reply(result); } catch (err) { console.error(err); return message.reply("โš ๏ธ Dice game เฆ เฆธเฆฎเฆธเงเฆฏเฆพ เฆนเฆšเงเฆ›เง‡ (system error)."); } } }; function randomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }