Add character translation in smashgg

Translate smash.gg weird characters ids into readable strings
master
Lertsenem 2020-07-07 16:07:06 +02:00
parent 689261a720
commit 19a1c293c3
1 changed files with 65 additions and 2 deletions

View File

@ -19,8 +19,66 @@ class Player():
"""A Player, as registered by the smash.gg API, and their characters
choices and placement in a tournament"""
CHARACTERS =
{
CHARACTERS = {
1272: "bowser jr",
1273: "bowser",
1275: "cloud",
1277: "daisy",
1280: "donkey kong",
1285: "falco",
1286: "fox",
1287: "ganondorf",
1290: "ice climbers",
1291: "ike",
1292: "inkling",
1293: "jigglypuff",
1294: "king dedede",
1295: "kirby",
1296: "link",
1297: "little mac",
1298: "lucario",
1299: "lucas",
1300: "lucina",
1301: "luigi",
1302: "mario",
1305: "megaman",
1307: "metaknight",
1310: "mewtwo",
1313: "ness",
1314: "olimar",
1315: "pacman",
1316: "palutena",
1317: "peach",
1318: "pichu",
1319: "pikachu",
1320: "pit",
1321: "pokemon trainer",
1323: "rob",
1324: "robin",
1325: "rosalina and luma",
1326: "roy",
1328: "samus",
1329: "sheik",
1330: "shulk",
1331: "snake",
1332: "sonic",
1333: "toon link",
1334: "villager",
1335: "wario",
1336: "wii-fit trainer",
1337: "wolf",
1338: "yoshi",
1339: "young link",
1340: "zelda",
1405: "mr game & watch",
1406: "incineroar",
1407: "king k. rool",
1408: "dark samus",
1409: "byleth",
1413: "isabelle",
1441: "piranha plant",
1453: "joker",
1532: "terry",
}
# -------------------------------------------------------------------------
@ -45,6 +103,11 @@ class Player():
# -------------------------------------------------------------------------
def add_character_selection(self, character, win):
try:
character = self.CHARACTERS[character]
except KeyError:
pass
try:
self.chars[character] += ( 1.01 if win else 1.00 )
# This 1.01 / 1.00 tricks should hold until the player loses 101