mirror of
https://github.com/frozenpandaman/s3s.git
synced 2026-04-19 07:27:34 -05:00
add support for sending gear abilities (#69)
This commit is contained in:
parent
de40343be7
commit
be8804cda9
50
s3s.py
50
s3s.py
|
|
@ -8,7 +8,7 @@ import argparse, datetime, json, os, shutil, re, requests, sys, time, uuid
|
|||
import msgpack
|
||||
import iksm, utils
|
||||
|
||||
A_VERSION = "0.1.11"
|
||||
A_VERSION = "0.1.12"
|
||||
|
||||
DEBUG = False
|
||||
|
||||
|
|
@ -339,6 +339,39 @@ def update_salmon_profile():
|
|||
# print(updateprofile.text)
|
||||
|
||||
|
||||
def populate_gear_abilities(player):
|
||||
'''Returns string representing all 12 ability slots for the player's gear, for use in set_scoreboard().'''
|
||||
|
||||
h_main = utils.translate_gear_ability(player["headGear"]["primaryGearPower"]["image"]["url"])
|
||||
h_subs = []
|
||||
if len(player["headGear"]["additionalGearPowers"]) > 0:
|
||||
h_subs.append(utils.translate_gear_ability(player["headGear"]["additionalGearPowers"][0]["image"]["url"]))
|
||||
if len(player["headGear"]["additionalGearPowers"]) > 1:
|
||||
h_subs.append(utils.translate_gear_ability(player["headGear"]["additionalGearPowers"][1]["image"]["url"]))
|
||||
if len(player["headGear"]["additionalGearPowers"]) > 2:
|
||||
h_subs.append(utils.translate_gear_ability(player["headGear"]["additionalGearPowers"][2]["image"]["url"]))
|
||||
|
||||
c_main = utils.translate_gear_ability(player["clothingGear"]["primaryGearPower"]["image"]["url"])
|
||||
c_subs = []
|
||||
if len(player["clothingGear"]["additionalGearPowers"]) > 0:
|
||||
h_subs.append(utils.translate_gear_ability(player["clothingGear"]["additionalGearPowers"][0]["image"]["url"]))
|
||||
if len(player["clothingGear"]["additionalGearPowers"]) > 1:
|
||||
c_subs.append(utils.translate_gear_ability(player["clothingGear"]["additionalGearPowers"][1]["image"]["url"]))
|
||||
if len(player["clothingGear"]["additionalGearPowers"]) > 2:
|
||||
c_subs.append(utils.translate_gear_ability(player["clothingGear"]["additionalGearPowers"][2]["image"]["url"]))
|
||||
|
||||
s_main = utils.translate_gear_ability(player["shoesGear"]["primaryGearPower"]["image"]["url"])
|
||||
s_subs = []
|
||||
if len(player["shoesGear"]["additionalGearPowers"]) > 0:
|
||||
h_subs.append(utils.translate_gear_ability(player["shoesGear"]["additionalGearPowers"][0]["image"]["url"]))
|
||||
if len(player["shoesGear"]["additionalGearPowers"]) > 1:
|
||||
s_subs.append(utils.translate_gear_ability(player["shoesGear"]["additionalGearPowers"][1]["image"]["url"]))
|
||||
if len(player["shoesGear"]["additionalGearPowers"]) > 2:
|
||||
s_subs.append(utils.translate_gear_ability(player["shoesGear"]["additionalGearPowers"][2]["image"]["url"]))
|
||||
|
||||
return h_main, h_subs, c_main, c_subs, s_main, s_subs
|
||||
|
||||
|
||||
def set_scoreboard(battle):
|
||||
'''Returns two lists of player dictionaries, for our_team_players and their_team_players.'''
|
||||
|
||||
|
|
@ -364,6 +397,14 @@ def set_scoreboard(battle):
|
|||
p_dict["death"] = player["result"]["death"]
|
||||
p_dict["special"] = player["result"]["special"]
|
||||
p_dict["disconnected"] = "no"
|
||||
|
||||
# https://github.com/fetus-hina/stat.ink/wiki/Spl3-API:-Post-v3-battle#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)
|
||||
|
|
@ -387,6 +428,13 @@ def set_scoreboard(battle):
|
|||
p_dict["death"] = player["result"]["death"]
|
||||
p_dict["special"] = player["result"]["special"]
|
||||
p_dict["disconnected"] = "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"
|
||||
their_team_players.append(p_dict)
|
||||
|
|
|
|||
38
utils.py
38
utils.py
|
|
@ -31,6 +31,44 @@ translate_rid = {
|
|||
}
|
||||
|
||||
|
||||
def translate_gear_ability(url):
|
||||
'''Given a URL, returns the gear ability string corresponding to the filename hash.'''
|
||||
|
||||
hash_map = {
|
||||
'5c98cc37d2ce56291a7e430459dc9c44d53ca98b8426c5192f4a53e6dd6e4293': 'ink_saver_main',
|
||||
'11293d8fe7cfb82d55629c058a447f67968fc449fd52e7dd53f7f162fa4672e3': 'ink_saver_sub',
|
||||
'29b845ea895b931bfaf895e0161aeb47166cbf05f94f04601769c885d019073b': 'ink_recovery_up',
|
||||
'3b6c56c57a6d8024f9c7d6e259ffa2e2be4bdf958653b834e524ffcbf1e6808e': 'run_speed_up',
|
||||
'087ffffe40c28a40a39dc4a577c235f4cc375540c79dfa8ede1d8b63a063f261': 'swim_speed_up',
|
||||
'e8668a2af7259be74814a9e453528a3e9773435a34177617a45bbf79ad0feb17': 'special_charge_up',
|
||||
'e3154ab67494df2793b72eabf912104c21fbca71e540230597222e766756b3e4': 'special_saver',
|
||||
'fba267bd56f536253a6bcce1e919d8a48c2b793c1b554ac968af8d2068b22cab': 'special_power_up',
|
||||
'aaa9b7e95a61bfd869aaa9beb836c74f9b8d4e5d4186768a27d6e443c64f33ce': 'quick_respawn',
|
||||
'138820ed46d68bdf2d7a21fb3f74621d8fc8c2a7cb6abe8d7c1a3d7c465108a7': 'quick_super_jump',
|
||||
'9df9825e470e00727aa1009c4418cf0ace58e1e529dab9a7c1787309bb25f327': 'sub_power_up',
|
||||
'db36f7e89194ed642f53465abfa449669031a66d7538135c703d3f7d41f99c0d': 'ink_resistance_up',
|
||||
'664489b24e668ef1937bfc9a80a8cf9cf4927b1e16481fa48e7faee42122996d': 'sub_resistance_up',
|
||||
'1a0c78a1714c5abababd7ffcba258c723fefade1f92684aa5f0ff7784cc467d0': 'intensify_action',
|
||||
'85d97cd3d5890b80e020a554167e69b5acfa86e96d6e075b5776e6a8562d3d4a': 'opening_gambit',
|
||||
'd514787f65831c5121f68b8d96338412a0d261e39e522638488b24895e97eb88': 'last_ditch_effort',
|
||||
'aa5b599075c3c1d27eff696aeded9f1e1ddf7ae3d720268e520b260db5600d60': 'tenacity',
|
||||
'748c101d23261aee8404c573a947ffc7e116a8da588c7371c40c4f2af6a05a19': 'comeback',
|
||||
'2c0ef71abfb3efe0e67ab981fc9cd46efddcaf93e6e20da96980079f8509d05d': 'ninja_squid',
|
||||
'de15cad48e5f23d147449c70ee4e2973118959a1a115401561e90fc65b53311b': 'haunt',
|
||||
'56816a7181e663b5fedce6315eb0ad538e0aadc257b46a630fcfcc4a16155941': 'thermal_ink',
|
||||
'de0d92f7dfed6c76772653d6858e7b67dd1c83be31bd2324c7939105180f5b71': 'respawn_punisher',
|
||||
'0d6607b6334e1e84279e482c1b54659e31d30486ef0576156ee0974d8d569dbc': 'ability_doubler',
|
||||
'f9c21eacf6dbc1d06edbe498962f8ed766ab43cb1d63806f3731bf57411ae7b6': 'stealth_jump',
|
||||
'9d982dc1a7a8a427d74df0edcebcc13383c325c96e75af17b9cdb6f4e8dafb24': 'object_shredder',
|
||||
'18f03a68ee64da0a2e4e40d6fc19de2e9af3569bb6762551037fd22cf07b7d2d': 'drop_roller',
|
||||
'dc937b59892604f5a86ac96936cd7ff09e25f18ae6b758e8014a24c7fa039e91': None
|
||||
}
|
||||
|
||||
for entry in hash_map:
|
||||
if entry in url:
|
||||
return hash_map[entry]
|
||||
|
||||
|
||||
def set_noun(which):
|
||||
'''Returns the term to be used when referring to the type of results in question.'''
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user