forked from rDrama/rDrama
1
0
Fork 0

casino: procoins -> mbux

master
justcool393 2022-11-16 10:14:46 -06:00
parent 366f5d14c1
commit eba6625b81
1 changed files with 7 additions and 4 deletions

View File

@ -86,12 +86,15 @@ def pull_slots(v):
abort(400, "Invalid wager.") abort(400, "Invalid wager.")
try: try:
currency = request.values.get("currency") currency = request.values.get("currency", "").lower()
if currency not in ('coins', 'procoins'): raise ValueError()
except: except:
abort(400, "Invalid currency (expected 'coin' or 'marseybux').") abort(400, "Invalid currency (expected 'coins' or 'procoins').")
friendly_currency_name = "coins" if currency == "coins" else "marseybux"
if (currency == "coins" and wager > v.coins) or (currency == "procoins" 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") abort(400, f"Not enough {friendly_currency_name} to make that bet")
game_id, game_state = casino_slot_pull(v, wager, currency) game_id, game_state = casino_slot_pull(v, wager, currency)
success = bool(game_id) success = bool(game_id)
@ -99,7 +102,7 @@ def pull_slots(v):
if success: if success:
return {"game_state": game_state, "gambler": {"coins": v.coins, "procoins": v.procoins}} return {"game_state": game_state, "gambler": {"coins": v.coins, "procoins": v.procoins}}
else: else:
abort(400, f"Wager must be 5 {currency} or more") abort(400, f"Wager must be 5 {friendly_currency_name} or more")
# 21 # 21