const mongoose = require("mongoose"); const bankUserSchema = new mongoose.Schema({ userID: { type: String, required: true, unique: true }, balance: { type: Number, default: 0 } }); const BankUser = mongoose.models.DiabloBankUser || mongoose.model("DiabloBankUser", bankUserSchema); let statsDB = {}; module.exports = { config: { name: "slot3", aliases: ["s3", "spin"], version: "5.3", author: "Sazzad", countDown: 5, role: 0, shortDescription: "Tier slot game", longDescription: "Nice, Great, Jackpot", category: "game", guide: { en: "{p}slot3 100m | {p}slot3 all | {p}slot3 max" } }, formatMoney: function (num) { if (num >= 1000000000) return (num / 1000000000).toFixed(2).replace(/\.00$/, "") + "B"; if (num >= 1000000) return (num / 1000000).toFixed(2).replace(/\.00$/, "") + "M"; return num.toLocaleString(); }, parseBet: function(str, balance) { str = str.toLowerCase().replace(/,/g, ""); if (str === "all") return Math.min(balance, 269000000000); if (str === "max") return 269000000000; if (str.includes("b")) return parseFloat(str) * 1000000; if (str.includes("m")) return parseFloat(str) * 1000000; if (str.includes("k")) return parseFloat(str) * 1000; return parseFloat(str); }, onStart: async function ({ api, event, args, message }) { const sendMsg = (txt) => message.reply(txt); const userID = event.senderID; let user = await BankUser.findOne({ userID }); if (!user) user = await BankUser.create({ userID, balance: 1000 }); const now = Date.now(); const TWO_HOURS = 7200000; const MAX_SPIN = 50; if (!statsDB[userID]) statsDB[userID] = { wins: 0, streak: 0, plays: 0, spinsLeft: MAX_SPIN, lastReset: now }; let stats = statsDB[userID]; if (now - stats.lastReset >= TWO_HOURS) { stats.spinsLeft = MAX_SPIN; stats.lastReset = now; } if (stats.spinsLeft <= 0) { let msLeft = TWO_HOURS - (now - stats.lastReset); let h = Math.floor(msLeft / 3600000); let m = Math.floor((msLeft % 3600000) / 60000); return sendMsg(`ā³ š‹šˆšŒšˆš“ š’š„š’š‡\n2š”š« š©šØš« ššš›ššš« 50 š­šš š¬š©š¢š§ š©ššš›šš\nšŸ•’ šššš¤š¢: ${h}š” ${m}š¦`); } let bet = 100000000; if (args[0]) bet = this.parseBet(args[0], user.balance); if (isNaN(bet)) return sendMsg(`āŒ Janu thik moto bet dao. Ex: #slot3 100m | #slot3 all`); if (bet < 100000) return sendMsg(`āŒ Janu Minimum bet 100,000,000`); if (bet > 269000000000) return sendMsg(`āŒ Janu Max bet 269,000,000,000`); if (user.balance < bet) return sendMsg(`šŸ’ø Janu Balance kom! Tmr balance: $${this.formatMoney(user.balance)}`); stats.plays++; stats.spinsLeft--; const roll = Math.random(); let tier = "lose"; let multiplier = 0; if (roll < 0.05) { tier = "jackpot"; multiplier = 10; } else if (roll < 0.25) { tier = "great"; multiplier = 5; } else if (roll < 0.55) { tier = "nice"; multiplier = 1.5; } let payout = 0; let resultText = ""; if (tier!== "lose") { payout = bet * multiplier; user.balance += payout - bet; stats.wins++; stats.streak++; } else { user.balance -= bet; stats.streak = 0; resultText = "šŸ’€ šš”š’š“š„šƒ šŸ’€"; } await user.save(); const emojis = ["šŸ’Ž","šŸ”®","šŸ’","7ļøāƒ£","šŸ‘‘","šŸ’°"]; const slot1 = emojis[Math.floor(Math.random()*6)]; const slot2 = emojis[Math.floor(Math.random()*6)]; const slot3 = emojis[Math.floor(Math.random()*6)]; if (tier === "jackpot") { resultText = "✨ š‰š€š‚šŠššŽš“ š‡šˆš“! 10x ✨"; } else if (tier === "great") { resultText = "🌟 š†š‘š„š€š“ š‡šˆš“! 5x 🌟"; } else if (tier === "nice") { resultText = "šŸ”„ ššˆš‚š„ š‡šˆš“! 1.5x šŸ”„"; } const used = MAX_SPIN - stats.spinsLeft; return sendMsg( `🌌 ━━ š‘ŗš‘Øš’š’š‘Øš‘«'š‘ŗ š’š‘¶š‘µš‘¬ ━━ 🌌 [ ${slot1} | ${slot2} | ${slot3} ] ${resultText} šŸ’° ššžš­: $${bet.toLocaleString()} ${tier!== "lose"? `🟢 šššš²šØš®š­: +$${payout.toLocaleString()}` : `šŸ”“ š‹šØš¬š¬: -$${bet.toLocaleString()}`} šŸ’³ š–ššš„š„šžš­: $${user.balance.toLocaleString()} šŸŽŸļø š’š©š¢š§š¬: ${stats.spinsLeft}/50 šŸ† š–š¢š§š¬: ${stats.wins} šŸ”„ š’š­š«šžššš¤: ${stats.streak} šŸ“Š š‹š¢š¦š¢š­š¬: ${used}/50` ); } };