Add skin support

characters are now a tuple ("charname", "charskin").
master
Lertsenem 2020-07-09 09:52:31 +02:00
parent ee1104e36e
commit d5a85266c8
1 changed files with 9 additions and 12 deletions

View File

@ -108,9 +108,10 @@ class Player():
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
def add_character_selection(self, character, win): def add_character_selection(self, character, win):
try: try:
character = self.CHARACTERS[character] character = (self.CHARACTERS[character], "00")
except KeyError: except KeyError:
pass if type(character) != tuple:
character = (character, "00")
try: try:
self.chars[character] += ( 1.01 if win else 1.00 ) self.chars[character] += ( 1.01 if win else 1.00 )
@ -131,16 +132,12 @@ class Player():
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
def conf(self): def conf(self):
# The char list looks like 'character1 (12.08), character2 (3.02)' # The char list looks like 'character1_skin1 (12.08), character2_skin2
# where the number between parenthesis is the number of time the # (3.02)' where the number between parenthesis is the number of time
# character was played # the character was played
charslist = ", ".join( charslist = ", ".join( [ "{}_{} ({:.2f})".format(c,s,n) for (c,s),n in
[ "{} ({:.2f})".format(c,n) for c,n in sorted( sorted( self.chars.items(), key = lambda cv: cv[1], reverse =
self.chars.items(), True,) ])
key = lambda cv: cv[1],
reverse = True,
) ]
)
return """ return """
[player {tag}] [player {tag}]