From 9d23b4d3e05941a06bf71e3d83bce6e981f81689 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Wed, 14 Aug 2024 14:39:57 -0400 Subject: [PATCH] added idString and adjusted attribute string generation --- player.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/player.py b/player.py index 7d3f4b8..7603e7b 100644 --- a/player.py +++ b/player.py @@ -27,15 +27,22 @@ class Player(object): self.attributesVersion = rawAtrs[0] return rawAtrs[1:] - def twitterString(self): - """Generates a twitter-formatted string representing the player.""" - send = f"{self.name}:\n" + def statsString(self): + """Generates a formatted string representing the player's stats.""" + send = "" for attr in self.attributes: if attr.name not in attributes.noPrint: send += attr.twitterFormat() send += "\n" return send + def idString(self): + """Generates a formatted string of player name and number.""" + if self.number < 10: + return f"#0{self.number}: {self.name}" + else: + return f"#{self.number}: {self.name}" + def getAttribute(self, shortname:str): """Returns an Attribute object with given shortname.""" for attr in self.attributes: