Skip to content
Merged

Stats #339

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions commands/search_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ async def stats(self, interaction: discord.Interaction, tourney_only:bool=False)
lowerLim = 100
higherLim = 999
gameSumString = ""
gameFactionString = ""
if tourney_only:
higherLim = 288
lowerLim = 254
Expand All @@ -299,6 +300,10 @@ async def stats(self, interaction: discord.Interaction, tourney_only:bool=False)
if game.gamestate["roundNum"] != 9:
continue
gameSumString += f"{gameName}: "
gameFactionString += f"{gameName}: "
if game.gamestate.get("5playerhyperlane"):
gameSumString += "(Hyperlane) "
gameFactionString += "(5p Hyperlane) "
highestVP = 1
for player in game.gamestate["players"]:
if drawing.get_public_points(game.gamestate["players"][player], True) > highestVP:
Expand All @@ -309,6 +314,7 @@ async def stats(self, interaction: discord.Interaction, tourney_only:bool=False)
username = username.split("(")[0].replace(" ","")
vp_count[username] += round(float(100.0*drawing.get_public_points(game.gamestate["players"][player], True)/highestVP),2)
gameSumString += f"{username}: {str(drawing.get_public_points(game.gamestate['players'][player], True))} "
gameSumString += f"{game.gamestate['players'][player]["name"]}: {str(drawing.get_public_points(game.gamestate['players'][player], True))} "
if game.gamestate["roundNum"] == 9:
finished_tourney_games[username] += 1
else:
Expand All @@ -326,6 +332,7 @@ async def stats(self, interaction: discord.Interaction, tourney_only:bool=False)
faction_performance[faction] += int(100*factionVP/highestScore)
max_faction_performance[faction] +=100
gameSumString += "\n"
gameFactionString += "\n"
with open("data/factions.json", "r") as f:
faction_data = json.load(f)
# await interaction.followup.send("Total Faction Draft Counts:")
Expand Down Expand Up @@ -364,4 +371,5 @@ async def send_long_message(interaction, message):
# for faction, count in relative_faction_performance.most_common():
# summary += f"{faction}: {count} out of 100 possible points (in {str(int(max_faction_performance[faction]/100))} games)\n"
asyncio.create_task(send_long_message(interaction, gameSumString))
asyncio.create_task(send_long_message(interaction, gameFactionString))

Loading