Lottery: fix negative ticket quantity exploit.

master
Snakes 2022-06-07 17:50:31 -04:00
parent 995375decc
commit e85d76947a
1 changed files with 3 additions and 1 deletions

View File

@ -94,7 +94,9 @@ def check_if_end_lottery_task():
def purchase_lottery_tickets(v, quantity=1): def purchase_lottery_tickets(v, quantity=1):
if (v.coins < LOTTERY_TICKET_COST * quantity): if quantity < 1:
return False, "Must purchase one or more lottery tickets."
elif (v.coins < LOTTERY_TICKET_COST * quantity):
return False, f'Lottery tickets cost {LOTTERY_TICKET_COST} dramacoins each.' return False, f'Lottery tickets cost {LOTTERY_TICKET_COST} dramacoins each.'
most_recent_lottery = get_active_lottery() most_recent_lottery = get_active_lottery()