diff --git a/bot.js b/bot.js index 48ef2c0..47f82f4 100644 --- a/bot.js +++ b/bot.js @@ -1438,27 +1438,30 @@ const spinSlots = async (ctx, bet, user) => { let resultMessage = `🎰 Итог:\n${finalIcons.join(' | ')}\n\n`; if (winMultiplier > 0) { const winnings = bet * winMultiplier; + utils.giveExp(user, winMultiplier*10) user.money += winnings; await user.save(); + console.log(`Win: ${winnings}`) resultMessage += `🎉 Вы выиграли ₽${spaces(winnings)}! Множитель: x${winMultiplier}`; } else { + utils.giveExp(user, 10) user.money -= bet; await user.save(); resultMessage += `💔 Вы проиграли ₽${spaces(bet)}. Попробуйте ещё раз!`; } // Отправляем результат - await ctx.reply(resultMessage); + await ctx.answerCbQuery(resultMessage, { show_alert: true }); }; // Функция для определения выигрыша const determineWin = () => { const probabilities = { - 25: 0.01, // 1% шанс на x25 - 10: 0.03, // 3% шанс на x10 - 5: 0.06, // 6% шанс на x5 - 2: 0.1, // 10% шанс на x2 - 0: 0.8, // 80% шанс на проигрыш + 25: 0.001, // 0.01% шанс на x25 + 10: 0.009, // 0.9% шанс на x10 + 5: 0.01, // 1% шанс на x5 + 2: 0.09, // 9% шанс на x2 + 0: 0.9, // 90% шанс на проигрыш }; const random = Math.random(); @@ -1479,13 +1482,29 @@ const generateVisualResult = (multiplier, slotIcons) => { if (multiplier === 10) return ['⚡', '⚡', '⚡']; if (multiplier === 5) return ['⭐', '⭐', '⭐']; if (multiplier === 2) return ['💀', '💀', '💀']; - return [ + + // Генерация случайных иконок для проигрыша + let icons = [ slotIcons[Math.floor(Math.random() * slotIcons.length)], slotIcons[Math.floor(Math.random() * slotIcons.length)], slotIcons[Math.floor(Math.random() * slotIcons.length)], - ]; // Проигрыш: случайные иконки + ]; + + // Проверка на уникальность + if (icons[0] === icons[1] && icons[1] === icons[2]) { + let newIcon; + do { + newIcon = slotIcons[Math.floor(Math.random() * slotIcons.length)]; + } while (newIcon === icons[0]); + + // Заменяем одну из иконок (например, третью) + icons[2] = newIcon; + } + + return icons; }; + // Основная команда слотов bot.action(/slots\d+/, async (ctx) => { try { diff --git a/commands/casino/slotsMenu.js b/commands/casino/slotsMenu.js index f1fed32..8950421 100644 --- a/commands/casino/slotsMenu.js +++ b/commands/casino/slotsMenu.js @@ -8,7 +8,7 @@ const { module.exports = async (ctx) => { let user = await UserModel.findByPk(ctx.from.id) ctx.args = ctx.update.message.text.split(' ') - await ctx.reply('Комбинации слотов:\n7️⃣7️⃣7️⃣ - x25\n🍋🍋🍋 - x20\n🍇🍇🍇 - x15\n🔤🔤🔤 - x10', Markup + await ctx.reply('Комбинации слотов:\n🔥🔥🔥- x25\n⚡⚡⚡ - x10\n⭐⭐⭐ - x5\n💀💀💀 - x2', Markup .inlineKeyboard([ [{ text: `1000`,