From a18c2e24e9415291f7d37dcb70af264996e9134b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 30 Oct 2022 02:12:32 +0200 Subject: [PATCH] fix bug in casino slots + change return value --- files/helpers/slots.py | 4 ++-- files/routes/casino.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/files/helpers/slots.py b/files/helpers/slots.py index 770166b0cb..426c7df96d 100644 --- a/files/helpers/slots.py +++ b/files/helpers/slots.py @@ -46,9 +46,9 @@ def casino_slot_pull(gambler, wager_value, currency): casino_game.game_state = json.dumps(game_state) g.db.add(casino_game) - return True, casino_game.game_state + return casino_game.id, casino_game.game_state else: - return False, "{}" + return 0, "{}", def build_symbols(for_payout): diff --git a/files/routes/casino.py b/files/routes/casino.py index 4eb2c91d85..5e26443015 100644 --- a/files/routes/casino.py +++ b/files/routes/casino.py @@ -95,10 +95,11 @@ def pull_slots(v): except: abort(400, "Invalid currency (expected 'coin' or 'marseybux').") - if (currency == "coin" and wager > v.coins) or (currency == "marseybux" and wager > v.procoins): + if (currency == "coins" and wager > v.coins) or (currency == "procoins" and wager > v.procoins): abort(400, f"Not enough {currency} to make that bet") - success, game_state = casino_slot_pull(v, wager, currency) + game_id, game_state = casino_slot_pull(v, wager, currency) + success = bool(game_id) if success: return {"game_state": game_state, "gambler": {"coins": v.coins, "procoins": v.procoins}}