From 315d9d6166ca7b2d46b1e4a641df466ac3866900 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 20 May 2019 13:02:20 -0300 Subject: Update wikigen to new healing item rules --- wiki/wikigen.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'wiki') diff --git a/wiki/wikigen.py b/wiki/wikigen.py index dcad2b3..6d0887c 100755 --- a/wiki/wikigen.py +++ b/wiki/wikigen.py @@ -325,6 +325,8 @@ class It: self.minheal="0" self.maxheal="0" self.delheal="0" + self.typheal="0" + self.rarheal="0" def ItAlloc(it): if (it.sl == "0" and it.ac) or (it.sl in ["1","2","3","4"] and not it.ac): @@ -446,6 +448,20 @@ def newItemDB(): x.maxheal=sti(a) elif "@delay" in a: x.delheal=sti(a) + elif "@type" in a: + x.typheal=sti(a) + try: + x.minheal=str(int(x.rarheal) * (int(x.typheal)*1 + 1)) + " %" + x.maxheal=str(int(x.rarheal) * (int(x.typheal)*2 + 1)) + " %" + if (x.delheal == "0"): + x.delheal=int(x.typheal)*2 + 1 + except: + x.delheal="ERROR" + pass + elif "@rarity" in a: + x.rarheal=sti(a) + x.minheal=str(int(x.rarheal) * (int(x.typheal)*1 + 1)) + " %" + x.maxheal=str(int(x.rarheal) * (int(x.typheal)*2 + 1)) + " %" # Write last entry ItAlloc(x) @@ -454,7 +470,7 @@ def newItemDB(): src.close() def sti(x): - return x.replace('\n', '').replace('|', '').replace(')', '').replace('Id: ', '').replace('"','').replace(" ","").replace("\t","").replace('AegisName: ', '').replace('Name: ','').replace('Sell: ', '').replace('Weight: ', '').replace('Type: ', '').replace('Loc: ', '').replace('Atk: ', '').replace('Matk: ', '').replace('Range: ', '').replace('Def: ', '').replace('EquipLv: ', '').replace('Slots: ','').replace(" ", "").replace('@min=','').replace('@max=','').replace('@delay=','').replace(';','') + return x.replace('\n', '').replace('|', '').replace(')', '').replace('Id: ', '').replace('"','').replace(" ","").replace("\t","").replace('AegisName: ', '').replace('Name: ','').replace('Sell: ', '').replace('Weight: ', '').replace('Type: ', '').replace('Loc: ', '').replace('Atk: ', '').replace('Matk: ', '').replace('Range: ', '').replace('Def: ', '').replace('EquipLv: ', '').replace('Slots: ','').replace(" ", "").replace('@min=','').replace('@max=','').replace('@delay=','').replace('@type=','').replace('@rarity=','').replace(';','') def stin(x): return x.replace('\n', '').replace('|', '').replace(')', '').replace('Id: ', '').replace('"','').replace(" ","").replace("\t","").replace('Name: ','').replace(';','') @@ -600,6 +616,16 @@ def ItemWrite(tbl, ID=False, AEGIS=False, NAME=False, PRICE=False, WEIGHT=False, wikia.write("\n") for i in tbl: + """ + # To sort by weight, for example, uncomment this block. + try: + zt=int(i.weight) + except: + tbl.remove(i) + + for i in sorted(tbl, key=lambda xcv: int(xcv.weight), reverse=True): + """ + wikia.write('') if ID: -- cgit v1.2.3-60-g2f50