Gauntlet Reward Fix

This commit is contained in:
Cal Corum 2023-05-02 10:45:03 -05:00
parent bb76a34256
commit 8788a02124
2 changed files with 41 additions and 11 deletions

View File

@ -1,4 +1,5 @@
import copy
import csv
import datetime
import logging
import re
@ -329,16 +330,38 @@ class Admins(commands.Cog):
@commands.command(name='tc', help='Mod: Test command')
@commands.is_owner()
async def test_choices_command(self, ctx):
await ctx.send(f'Checking legality now...')
lc = db_post(
'cards/legal-check/ranked?card_id=13222&card_id=8375&card_id=15789&card_id=15787&card_id=11449'
'&card_id=10073&card_id=2878',
payload={
'team_id': 31,
'pack_type_id': 8
}
)
await ctx.send(f'{lc}')
await ctx.send(f'Updating rarities now...')
RAR_IDS = {
'HoF': 99,
'MVP': 1,
'All-Star': 2,
'Starter': 3,
'Reserve': 4,
'Replacement': 5
}
with open('storage/player-json-2023-05-02-553165.csv') as csvfile:
csv_reader = csv.reader(csvfile, delimiter=',')
line_count = 0
update_ids = []
update_names = []
for row in csv_reader:
if line_count == 0:
pass
else:
p_query = db_get('players', params=[('name', row[1]), ('cardset_id', 9)])
if p_query['count'] > 0:
player = p_query['players'][0]
r_name = row[9] if row[9] != 'HoF' else 'Hall of Fame'
if player['rarity']['name'] != r_name:
update_ids.append(player['player_id'])
update_names.append(player['p_name'])
db_patch('players', object_id=player['player_id'], params=[('rarity_id', RAR_IDS[row[9]])])
line_count += 1
try:
await ctx.send(f'Updated {len(update_names)} player rarities:\n\n{", ".join(update_names)}')
except Exception as e:
await ctx.send(f'Updated {len(update_ids)} player rarities:\n\n{", ".join(update_ids)}')
async def setup(bot):

View File

@ -185,7 +185,8 @@ class Gameplay(commands.Cog):
win_string = f'1x {win_reward["pack_type"]["name"]} Pack\n'
# Post Team Choice packs
if this_game.ai_team is not None and not this_game.short_game and losing_team['is_ai']:
if this_game.ai_team is not None and not this_game.short_game and 'gauntlet' not in this_game.game_type and \
losing_team['is_ai']:
r_query = db_get(
'results',
params=[
@ -224,6 +225,12 @@ class Gameplay(commands.Cog):
loss_string = f'{loss_reward["money"]}\n'
# Post rewards
if 'gauntlet' in this_game.game_type:
if 'Gauntlet' in winning_team['abbrev']:
winning_team = db_get('teams', params=[('abbrev', winning_team['abbrev'].split('-')[1])])['teams'][0]
if 'Gauntlet' in losing_team['abbrev']:
losing_team = db_get('teams', params=[('abbrev', losing_team['abbrev'].split('-')[1])])['teams'][0]
give_packs(winning_team, num_packs=1, pack_type=win_reward['pack_type'])
db_post(f'teams/{winning_team["id"]}/money/{win_reward["money"]}')
db_post(f'teams/{losing_team["id"]}/money/{loss_reward["money"]}')