-
Notifications
You must be signed in to change notification settings - Fork 0
/
HoF.py
51 lines (43 loc) · 1.79 KB
/
HoF.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /usr/bin/env python3
from os.path import isfile
import util
from globals import DATA
from Reverse import reverseHallOfForms
from reward import parseReward
def HoFInfobox(data: dict, nb: int):
return "{{Hall of Forms Infobox\n" + \
f"|number={nb}\n" + \
f"|promoArt=Hall of Forms {nb}.jpg\n" + \
f"|forma={','.join([util.getName(unit) for unit in data['forma']['heroes']])}\n" + \
f"|startTime={data['avail']['start']}\n" + \
f"|endTime={util.timeDiff(data['avail']['finish'])}\n}}}}"
def HoFRewards(data: dict):
s = "==Rewards==\n===Daily rewards===\n{{#invoke:Reward/HallOfForms|daily\n"
for i in range(len(data['daily_bonuses'])):
s += f" |{i+1}=" + parseReward(data['daily_bonuses'][i]['reward']) + "\n"
s += "}}\n===Chamber cleared===\n{{#invoke:Reward/HallOfForms|chambers\n"
for chamber in data['chambers']:
s += f" | {util.getName('MID_IDOL_TOWER_STAGE_'+chamber['id_tag'])} = " + parseReward(chamber['reward']) + "\n"
return s + "}}"
def HallOfForms(tag: str):
datas = reverseHallOfForms(tag)
ret = {}
for data in datas:
nb = int(util.cargoQuery('HallOfForms', 'COUNT(_pageName)=Nb')[0]['Nb']) + 1
s = HoFInfobox(data, nb) + "\n"
s += HoFRewards(data) + "\n"
s += "==Trivia==\n*\n{{Main Events Navbox}}"
ret[f"Hall of Forms {nb}"] = s
return ret
from sys import argv
if __name__ == '__main__':
if len(argv) <= 1:
print("Enter at least one update tag")
exit(1)
for arg in argv[1:]:
if not isfile(util.BINLZ_ASSETS_DIR_PATH + 'Common/SRPG/IdolTower/' + arg + '.bin.lz'):
print(f'No Hall of Forms are related to the tag "{arg}"')
continue
hofs = HallOfForms(arg)
for hof in hofs:
print(hof, hofs[hof])