From d5a85266c884456f42ce9bf736b3512c9c640671 Mon Sep 17 00:00:00 2001 From: Lertsenem Date: Thu, 9 Jul 2020 09:52:31 +0200 Subject: [PATCH] Add skin support characters are now a tuple ("charname", "charskin"). --- lokrez/smashgg.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lokrez/smashgg.py b/lokrez/smashgg.py index bd0ed05..d1fa658 100644 --- a/lokrez/smashgg.py +++ b/lokrez/smashgg.py @@ -108,9 +108,10 @@ class Player(): # ------------------------------------------------------------------------- def add_character_selection(self, character, win): try: - character = self.CHARACTERS[character] + character = (self.CHARACTERS[character], "00") except KeyError: - pass + if type(character) != tuple: + character = (character, "00") try: self.chars[character] += ( 1.01 if win else 1.00 ) @@ -131,16 +132,12 @@ class Player(): # ------------------------------------------------------------------------- def conf(self): - # The char list looks like 'character1 (12.08), character2 (3.02)' - # where the number between parenthesis is the number of time the - # character was played - charslist = ", ".join( - [ "{} ({:.2f})".format(c,n) for c,n in sorted( - self.chars.items(), - key = lambda cv: cv[1], - reverse = True, - ) ] - ) + # The char list looks like 'character1_skin1 (12.08), character2_skin2 + # (3.02)' where the number between parenthesis is the number of time + # the character was played + charslist = ", ".join( [ "{}_{} ({:.2f})".format(c,s,n) for (c,s),n in + sorted( self.chars.items(), key = lambda cv: cv[1], reverse = + True,) ]) return """ [player {tag}]