Skip to content

Commit

Permalink
Add count of tutoial players to stats message
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhsm committed Aug 12, 2023
1 parent 159e095 commit 7a502de
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions dictator/cogs/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,32 +139,40 @@ async def group_families(self, parsed_player_list: str) -> str:

async def format_family_list(self, family_list: str) -> str:
formatted_families = ""
solo_eves, unnamed_families, unnamed_family_players = 0, 0, 0
solo_eves = 0
tutorial_players = 0
unnamed_families = 0
unnamed_family_players = 0
for family in family_list:
# TODO
# We can extract family_name into a recursive function
# where we loop the family until we find a surname
# and apply other relevant naming rules

if len(family) == 1:
solo_player = family[0]
(
player_id,
eve_id,
parent_id,
gender,
age,
declaredInfertile,
isTutorial,
name,
family_name
) = solo_player
first_player = family[0]
(
player_id,
eve_id,
parent_id,
gender,
age,
declaredInfertile,
isTutorial,
name,
family_name,
) = first_player

family_name = family_name.title()

if len(family) == 1:
if isTutorial == "1":
tutorial_players += 1
continue

if player_id == eve_id and declaredInfertile == "1":
solo_eves += 1
continue

family_name = family[0][8].title()
if not family_name:
unnamed_families += 1
unnamed_family_players += len(family)
Expand All @@ -173,9 +181,12 @@ async def format_family_list(self, family_list: str) -> str:

if unnamed_families:
formatted_families += f"{unnamed_family_players} in {unnamed_families} unnamed {self.p.plural('family', unnamed_families)}\n"

if solo_eves:
formatted_families += f"{solo_eves} playing as solo Eves"
formatted_families += f"{solo_eves} playing as solo Eves\n"

if tutorial_players:
formatted_families += f"{tutorial_players} playing the tutorial\n"

return formatted_families

Expand Down

0 comments on commit 7a502de

Please sign in to comment.