added idString and adjusted attribute string generation

This commit is contained in:
Sakimori 2024-08-14 14:39:57 -04:00
parent eb9e371a5a
commit 9d23b4d3e0

View file

@ -27,15 +27,22 @@ class Player(object):
self.attributesVersion = rawAtrs[0] self.attributesVersion = rawAtrs[0]
return rawAtrs[1:] return rawAtrs[1:]
def twitterString(self): def statsString(self):
"""Generates a twitter-formatted string representing the player.""" """Generates a formatted string representing the player's stats."""
send = f"{self.name}:\n" send = ""
for attr in self.attributes: for attr in self.attributes:
if attr.name not in attributes.noPrint: if attr.name not in attributes.noPrint:
send += attr.twitterFormat() send += attr.twitterFormat()
send += "\n" send += "\n"
return send 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): def getAttribute(self, shortname:str):
"""Returns an Attribute object with given shortname.""" """Returns an Attribute object with given shortname."""
for attr in self.attributes: for attr in self.attributes: