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):
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}]