text stringlengths 1 93.6k |
|---|
our_team_players, their_team_players, third_team_players = [], [], []
|
for i, player in enumerate(battle["myTeam"]["players"]):
|
p_dict = {}
|
p_dict["me"] = "yes" if player["isMyself"] else "no"
|
p_dict["name"] = player["name"]
|
try:
|
p_dict["number"] = str(player["nameId"]) # splashtag # - can contain alpha chars too... (why!!!)
|
except KeyError: # may not be present if first battle as "Player"
|
pass
|
p_dict["splashtag_title"] = player["byname"] # splashtag title
|
p_dict["weapon"] = utils.b64d(player["weapon"]["id"])
|
p_dict["inked"] = player["paint"]
|
p_dict["species"] = player["species"].lower()
|
p_dict["rank_in_team"] = i+1
|
if player.get("crown"):
|
p_dict["crown_type"] = "x"
|
if "DRAGON" in player.get("festDragonCert", ""):
|
if player["festDragonCert"] == "DRAGON":
|
p_dict["crown_type"] = "100x"
|
elif player["festDragonCert"] == "DOUBLE_DRAGON":
|
p_dict["crown_type"] = "333x"
|
if "result" in player and player["result"] is not None:
|
p_dict["kill_or_assist"] = player["result"]["kill"]
|
p_dict["assist"] = player["result"]["assist"]
|
p_dict["kill"] = p_dict["kill_or_assist"] - p_dict["assist"]
|
p_dict["death"] = player["result"]["death"]
|
p_dict["special"] = player["result"]["special"]
|
p_dict["signal"] = player["result"]["noroshiTry"]
|
p_dict["disconnected"] = "no"
|
p_dict["crown"] = "yes" if player.get("crown") == True else "no"
|
# https://github.com/fetus-hina/stat.ink/wiki/Spl3-API:-Battle-%EF%BC%8D-Post#gears-structure
|
gear_struct = {"headgear": {}, "clothing": {}, "shoes": {}}
|
h_main, h_subs, c_main, c_subs, s_main, s_subs = populate_gear_abilities(player)
|
gear_struct["headgear"] = {"primary_ability": h_main, "secondary_abilities": h_subs}
|
gear_struct["clothing"] = {"primary_ability": c_main, "secondary_abilities": c_subs}
|
gear_struct["shoes"] = {"primary_ability": s_main, "secondary_abilities": s_subs}
|
p_dict["gears"] = gear_struct
|
else:
|
p_dict["disconnected"] = "yes"
|
our_team_players.append(p_dict)
|
team_nums = [0, 1] if tricolor else [0]
|
for team_num in team_nums:
|
for i, player in enumerate(battle["otherTeams"][team_num]["players"]):
|
p_dict = {}
|
p_dict["me"] = "no"
|
p_dict["name"] = player["name"]
|
try:
|
p_dict["number"] = str(player["nameId"])
|
except:
|
pass
|
p_dict["splashtag_title"] = player["byname"]
|
p_dict["weapon"] = utils.b64d(player["weapon"]["id"])
|
p_dict["inked"] = player["paint"]
|
p_dict["species"] = player["species"].lower()
|
p_dict["rank_in_team"] = i+1
|
if player.get("crown"):
|
p_dict["crown_type"] = "x"
|
if "DRAGON" in player.get("festDragonCert", ""):
|
if player["festDragonCert"] == "DRAGON":
|
p_dict["crown_type"] = "100x"
|
elif player["festDragonCert"] == "DOUBLE_DRAGON":
|
p_dict["crown_type"] = "333x"
|
if "result" in player and player["result"] is not None:
|
p_dict["kill_or_assist"] = player["result"]["kill"]
|
p_dict["assist"] = player["result"]["assist"]
|
p_dict["kill"] = p_dict["kill_or_assist"] - p_dict["assist"]
|
p_dict["death"] = player["result"]["death"]
|
p_dict["special"] = player["result"]["special"]
|
p_dict["signal"] = player["result"]["noroshiTry"]
|
p_dict["disconnected"] = "no"
|
p_dict["crown"] = "yes" if player.get("crown") == True else "no"
|
gear_struct = {"headgear": {}, "clothing": {}, "shoes": {}}
|
h_main, h_subs, c_main, c_subs, s_main, s_subs = populate_gear_abilities(player)
|
gear_struct["headgear"] = {"primary_ability": h_main, "secondary_abilities": h_subs}
|
gear_struct["clothing"] = {"primary_ability": c_main, "secondary_abilities": c_subs}
|
gear_struct["shoes"] = {"primary_ability": s_main, "secondary_abilities": s_subs}
|
p_dict["gears"] = gear_struct
|
else:
|
p_dict["disconnected"] = "yes"
|
if team_num == 0:
|
their_team_players.append(p_dict)
|
elif team_num == 1:
|
third_team_players.append(p_dict)
|
if tricolor:
|
return our_team_players, their_team_players, third_team_players
|
else:
|
return our_team_players, their_team_players
|
def prepare_battle_result(battle, ismonitoring, isblackout, overview_data=None):
|
'''Converts the Nintendo JSON format for a battle to the stat.ink one.'''
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.