Lottery: fix granted value, zero royalty.

grant_lottery_tickets_to_user incorrectly deposited the full ticket
value into manager account, not just the net value.

Additionally, royalty rate has been set to zero because Chapose won
the first lottery and grifting 8% that could instead go into the
prize pool seems unwarranted given that.
master
Snakes 2022-06-10 06:15:37 -04:00
parent b0554ce303
commit bea6d82b61
2 changed files with 16 additions and 15 deletions

View File

@ -1037,17 +1037,16 @@ linefeeds_regex = re.compile("([^\n])\n([^\n])", flags=re.A)
def make_name(*args, **kwargs): return request.base_url
# Lottery
LOTTERY_ENABLED = False
LOTTERY_TICKET_COST = 0
LOTTERY_SINK_RATE = 0
LOTTERY_ROYALTY_RATE = 0
LOTTERY_ROYALTY_ACCOUNT_ID = 0
LOTTERY_MANAGER_ACCOUNT_ID = 0
if SITE_NAME == 'rDrama':
LOTTERY_ENABLED = True
LOTTERY_TICKET_COST = 12
LOTTERY_SINK_RATE = 3
LOTTERY_ROYALTY_RATE = 1
LOTTERY_ROYALTY_RATE = 0
LOTTERY_ROYALTY_ACCOUNT_ID = 1387 # (Chapose)
LOTTERY_MANAGER_ACCOUNT_ID = 11651 # (Lottershe)
else:
LOTTERY_ENABLED = False
LOTTERY_TICKET_COST = 0
LOTTERY_SINK_RATE = 0
LOTTERY_ROYALTY_RATE = 0
LOTTERY_ROYALTY_ACCOUNT_ID = 0
LOTTERY_MANAGER_ACCOUNT_ID = 0

View File

@ -92,6 +92,8 @@ def check_if_end_lottery_task():
start_new_lottery_session()
return True
def lottery_ticket_net_value():
return LOTTERY_TICKET_COST - LOTTERY_SINK_RATE - LOTTERY_ROYALTY_RATE
def purchase_lottery_tickets(v, quantity=1):
if quantity < 1:
@ -107,7 +109,7 @@ def purchase_lottery_tickets(v, quantity=1):
v.currently_held_lottery_tickets += quantity
v.total_held_lottery_tickets += quantity
net_ticket_value = (LOTTERY_TICKET_COST - LOTTERY_SINK_RATE - LOTTERY_ROYALTY_RATE) * quantity
net_ticket_value = lottery_ticket_net_value() * quantity
most_recent_lottery.prize += net_ticket_value
most_recent_lottery.tickets_sold += quantity
@ -115,7 +117,7 @@ def purchase_lottery_tickets(v, quantity=1):
beneficiary = g.db.query(User).get(LOTTERY_ROYALTY_ACCOUNT_ID)
if beneficiary:
if beneficiary and LOTTERY_ROYALTY_RATE:
beneficiary.coins += LOTTERY_ROYALTY_RATE * quantity
g.db.commit()
@ -128,16 +130,16 @@ def grant_lottery_proceeds_to_manager(prize_value):
if manager:
manager.coins += prize_value
def grant_lottery_tickets_to_user(v, amount):
def grant_lottery_tickets_to_user(v, quantity):
active_lottery = get_active_lottery()
prize_value = amount * LOTTERY_TICKET_COST
prize_value = lottery_ticket_net_value() * quantity
if active_lottery:
v.currently_held_lottery_tickets += amount
v.total_held_lottery_tickets += amount
v.currently_held_lottery_tickets += quantity
v.total_held_lottery_tickets += quantity
active_lottery.prize += prize_value
active_lottery.tickets_sold += amount
active_lottery.tickets_sold += quantity
grant_lottery_proceeds_to_manager(prize_value)