From e2cdb30acdf291bf32bd7da7968e9bf99335313c Mon Sep 17 00:00:00 2001 From: Milo Date: Wed, 27 Aug 2025 13:21:32 +0200 Subject: [PATCH] updagraded solitaire and removed "no" option on timeout votes --- src/bot/commands/timeout.js | 2 -- src/server/routes/solitaire.js | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/bot/commands/timeout.js b/src/bot/commands/timeout.js index 9030691..1fe11f5 100644 --- a/src/bot/commands/timeout.js +++ b/src/bot/commands/timeout.js @@ -164,7 +164,6 @@ export async function handleTimeoutCommand(req, res, client) { type: MessageComponentTypes.ACTION_ROW, components: [ { type: MessageComponentTypes.BUTTON, custom_id: `vote_for_${pollId}`, label: 'Oui ✅', style: ButtonStyleTypes.SUCCESS }, - { type: MessageComponentTypes.BUTTON, custom_id: `vote_against_${pollId}`, label: 'Non ❌', style: ButtonStyleTypes.DANGER }, ], }], }, @@ -204,7 +203,6 @@ export async function handleTimeoutCommand(req, res, client) { type: MessageComponentTypes.ACTION_ROW, components: [ { type: MessageComponentTypes.BUTTON, custom_id: `vote_for_${pollId}`, label: 'Oui ✅', style: ButtonStyleTypes.SUCCESS }, - { type: MessageComponentTypes.BUTTON, custom_id: `vote_against_${pollId}`, label: 'Non ❌', style: ButtonStyleTypes.DANGER }, ], }], }, diff --git a/src/server/routes/solitaire.js b/src/server/routes/solitaire.js index b67d97b..a0b579f 100644 --- a/src/server/routes/solitaire.js +++ b/src/server/routes/solitaire.js @@ -206,13 +206,26 @@ function updateGameStats(gameState, actionType, moveData = {}) { /** Handles the logic when a game is won. */ async function handleWin(userId, gameState, io) { - if (!gameState.isSOTD) return; + const currentUser = getUser.get(userId); + if (!currentUser) return; + + if (gameState.hardMode) { + const bonus = 100; + const newCoins = currentUser.coins + bonus; + updateUserCoins.run({ id: userId, coins: newCoins }); + insertLog.run({ + id: `${userId}-hardmode-solitaire-${Date.now()}`, user_id: userId, + action: 'HARDMODE_SOLITAIRE_WIN', target_user_id: null, + coins_amount: bonus, user_new_amount: newCoins, + }); + await socketEmit('data-updated', { table: 'users' }); + } + + if (!gameState.isSOTD) return; // Only process SOTD wins here gameState.endTime = Date.now(); const timeTaken = gameState.endTime - gameState.startTime; - const currentUser = getUser.get(userId); - if (!currentUser) return; const existingStats = getUserSOTDStats.get(userId); if (!existingStats) {