From 7a502de918b25ae5ee726f62fe414f190fbf2be4 Mon Sep 17 00:00:00 2001 From: Connor Smith Date: Sun, 13 Aug 2023 03:21:52 +1000 Subject: [PATCH] Add count of tutoial players to stats message --- dictator/cogs/stats.py | 45 ++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/dictator/cogs/stats.py b/dictator/cogs/stats.py index 27ed555..eb96857 100644 --- a/dictator/cogs/stats.py +++ b/dictator/cogs/stats.py @@ -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) @@ -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