diff options
author | Jesusaves <cpntb1@ymail.com> | 2018-06-16 02:43:58 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2018-06-16 02:43:58 -0300 |
commit | f00ba088fa9ab568eae1dedbf6fae01b966997e6 (patch) | |
tree | b1a86941b20d3926e6c9956afa6587dfcbcb5996 /wiki | |
parent | ce3d32d74e32b2f04a64502bf830a7081d650384 (diff) | |
download | tools-f00ba088fa9ab568eae1dedbf6fae01b966997e6.tar.gz tools-f00ba088fa9ab568eae1dedbf6fae01b966997e6.tar.bz2 tools-f00ba088fa9ab568eae1dedbf6fae01b966997e6.tar.xz tools-f00ba088fa9ab568eae1dedbf6fae01b966997e6.zip |
[EXPERIMENTAL] Merge Elegen on WikiGen
Diffstat (limited to 'wiki')
-rwxr-xr-x | wiki/elegen.py | 2 | ||||
-rwxr-xr-x | wiki/wikigen.py | 152 |
2 files changed, 141 insertions, 13 deletions
diff --git a/wiki/elegen.py b/wiki/elegen.py index b5f1587..71b41d7 100755 --- a/wiki/elegen.py +++ b/wiki/elegen.py @@ -124,6 +124,7 @@ def WhatElem(rac): print("ERROR, INVALID ELEM ID: %d (ID: %s)" % (rc, rac.id)) exit(1) return "<font color=%s>%s</font>" % (cl, tl) + class Mob: def __init__(self): # Basic @@ -271,7 +272,6 @@ def MonsterWrite(tbl): # TODO: Check _mobs files to determine the usual monster density (a misc info to aid adding proper drop specs) wikib.write("<table border=1>\n") wikib.write("<tr><th>ID</th><th>Name</th><th>Mob Info</th><th>Elegen</th><th>Misc Info</th><th>Rewards</th><th>Drops</th></tr>\n") - #mb_core(mb) for i in tbl: if i.id == 'ID': continue diff --git a/wiki/wikigen.py b/wiki/wikigen.py index 04172a7..36b046d 100755 --- a/wiki/wikigen.py +++ b/wiki/wikigen.py @@ -62,6 +62,87 @@ def showFooter(): +def fwalk(wmask): + if wmask == 'WATER': + return '<font color=#00f>%s</font>' % (wmask) + elif wmask == 'AIR': + return '<font color=#093>%s</font>' % (wmask) + elif wmask == 'WALL': + return '<font color=#f00>%s</font>' % (wmask) + elif wmask == 'NORMAL' or wmask == 'DEFAULT': + return '<font color=#111>%s</font>' % (wmask) + else: + print("Invalid walk mask: "+wmask) + exit(1) + +def WhatRace(rac): + rc=rac.race + if rc == 0: + return "Formless" + elif rc == 1: + return "Undead" + elif rc == 2: + return "Brute" + elif rc == 3: + return "Plant" + elif rc == 4: + return "Insect" + elif rc == 5: + return "Fish" + elif rc == 6: + return "-" + elif rc == 7: + return "SemiHuman" + elif rc == 8: + return "Angel" + elif rc == 9: + return "Dragon" + elif rc == 10: + return "Player" + elif rc == 11: + return "Boss" + elif rc == 12: + return "NonBoss" + elif rc == 14: + return "NonSemiHuman" + elif rc == 15: + return "NonPlayer" + elif rc == 16: + return "SemiPlayer" + elif rc == 17: + return "NonSemiPlayer" + else: + print("ERROR, INVALID RACE ID: %d (ID: %s)" % (rc, rac.id)) + exit(1) + +def WhatElem(rac): + rc=rac.elem + tl="ERROR" + cl="#F00" + if rc == 0: + tl,cl="Neutral","#000" + elif rc == 1: + tl,cl="Water","#00F" + elif rc == 2: + tl,cl="Earth","#7A0" + elif rc == 3: + tl,cl="Fire","#F00" + elif rc == 4: + tl,cl="Wind","#093" + elif rc == 5: + tl,cl="Poison","#040" + elif rc == 6: + tl,cl="Holy","#afa" + elif rc == 7: + tl,cl="Dark","#908" + elif rc == 8: + tl,cl="Ghost","#404" + elif rc == 9: + tl,cl="Undead","#440" + else: + print("ERROR, INVALID ELEM ID: %d (ID: %s)" % (rc, rac.id)) + exit(1) + return "<font color=%s>%s</font>" % (cl, tl) class Mob: def __init__(self): @@ -85,6 +166,12 @@ class Mob: self.delay="0" self.drops=[] + # Elegen Info + self.race=-1 + self.elem=-1 + self.elel=-1 + self.walk="NORMAL" + def MobAlloc(ab): try: maab=int(ab.mobpt) @@ -122,7 +209,10 @@ def testMobs(): if " Id:" in a: x.id=stp(a) - elif " Name:" in a: + if x.id == "ID": + continue + + if " Name:" in a: x.name=stp(a) elif " Hp:" in a: x.hp=stp(a) @@ -143,11 +233,28 @@ def testMobs(): elif " AttackDelay:" in a: x.delay=stp(a) elif " Looter: true" in a: - x.st+="Lot," + x.st+="<font color=#790>Lot</font>," elif " Assist: true" in a: - x.st+="Ass," + x.st+="<font color=#0a0>Ass</font>," elif " Aggressive: true" in a: - x.st+="Agr," + x.st+="<font color=#f00>Agr</font>," + elif " WalkMask:" in a: + x.walk=stp(a) + elif " Element:" in a: + tmp=stp(a) + tmp2=tmp.split(',') + try: + x.elem=int(tmp2[0]) + x.elel=int(tmp2[1]) + except: + print("Invalid Element for mob %s: %s" % (x.id, tmp)) + exit(1) + elif " Race:" in a: + try: + x.race=int(stp(a)) + except: + print("Invalid Race for mob %s: %s" % (x.id, a)) + exit(1) elif 'Drops: ' in a: dropper=True elif dropper and '}' in a: @@ -167,21 +274,21 @@ def testMobs(): src.close() def stp(x): - return x.replace('\n', '').replace('|', '').replace('(int, defaults to ', '').replace(')', '').replace('basic experience', '').replace('"','').replace(" ","").replace("\t","").replace('(string', '').replace('Name: ','').replace('AttackDelay: ', '').replace('MoveSpeed: ', '').replace('AttackRange: ', '').replace('ViewRange: ','').replace('Attack: ','').replace('ViewRange: ','').replace('Hp: ','').replace('Id: ','').replace('Lv: ','').replace('view range','').replace('attack range','').replace('move speed','').replace('health','').replace('(int','').replace('attack delay','atk.') + return x.replace('\n', '').replace('|', '').replace('(int, defaults to ', '').replace(')', '').replace('basic experience', '').replace('"','').replace(" ","").replace("\t","").replace('(string', '').replace('Name: ','').replace('Element: ','').replace('Race: ','').replace('AttackDelay: ', '').replace('WalkMask: ','').replace('MoveSpeed: ', '').replace('AttackRange: ', '').replace('ViewRange: ','').replace('Attack: ','').replace('ViewRange: ','').replace('Hp: ','').replace('Id: ','').replace('Lv: ','').replace('view range','').replace('attack range','').replace('move speed','').replace('health','').replace('(int','').replace('attack delay','atk.').replace('(','').replace(')','').replace('WALK_','') def MonsterWrite(tbl): # TODO: Check _mobs files to determine the usual monster density (a misc info to aid adding proper drop specs) wikib.write("<table border=1>\n") - wikib.write("<tr><th>ID</th><th>Name</th><th>HP</th><th>Atk</th><th>Delay</th><th>Modes</th><th>Misc Info</th><th>Rewards</th><th>Drops</th></tr>\n") + wikib.write("<tr><th>ID</th><th>Name</th><th>Mob Info</th><th>Elegen</th><th>Misc Info</th><th>Rewards</th><th>Drops</th></tr>\n") for i in tbl: + if i.id == 'ID': + continue wikib.write('<tr><td><a name="' + i.id + '"></a>' + i.id +"</td><td>"+ - i.name +"</td><td>HP: "+ - i.hp +"</td><td>Atk: "+ - i.atk +"</td><td>"+ - i.delay +" ms</td><td>"+ - i.st +"</td><td>"+ + i.name +"</td><td>"+ + mb_core(i) +"</td><td>"+ + mb_eleg(i) +"</td><td>"+ mbdt('misc', mb_rdmisc(i)) +"</td><td>"+ mbdt('Exp\'s', mb_rdrw(i)) +"</td><td>"+ mbdt('drops', mb_rddrop(i)) +"</td></tr>\n" @@ -223,17 +330,38 @@ def mbdt(summary, content): <summary>"+summary+"</summary>\ <pre>"+content+"</pre></details>" +def mb_core(mb): + buff="" + buff+="Lvl: %s<br/>\n" % (mb.mobpt) + buff+="HP: <b><font color=#0a0>%s</font></b><br/>\n" % (mb.hp) + buff+="ATK: <b><font color=#a00>%s</font></b><br/>\n" % (mb.atk) + if mb.st != "": + buff+="Modes: <i>%s</i>" % (mb.st) + return buff + +def mb_eleg(mb): + buff="" + buff+="Race: %s<br/>\n" % (WhatRace(mb)) + buff+="Walk: %s<br/>\n" % (fwalk(mb.walk)) + buff+="Element: %s<br/>\n" % (WhatElem(mb)) + return buff + def mb_rdmisc(mb): buff="" if "agr" in mb.st.lower(): buff+="View Range: %s\n" % (mb.view) buff+="Attack Range: %s\n" % (mb.range) + buff+="AtkDelay: %s ms\n" % (mb.delay) buff+="Move speed: %s ms\n" % (mb.move) + buff+="Element Level: %d\n" % (mb.elel) return buff def mb_rdrw(mb): buff="" - buff+="MobPoints: %s\n" % (mb.mobpt) + try: + buff+="MobPoints: %d\n" % (int(mb.mobpt)*11/10) + except: + pass buff+="%s\n" % (mb.xp) buff+="%s\n" % (mb.jp) return buff |