summaryrefslogtreecommitdiff
path: root/wiki
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-03-19 00:06:03 -0300
committerJesusaves <cpntb1@ymail.com>2018-03-19 00:06:03 -0300
commit87f14b13db50d9216c71a389b5ce4274bb564d59 (patch)
tree99feeead664d0012227b9ee487abcdeabc9d782e /wiki
parent0a39664bc2b3f5abcf37e152183de5a75d3c1d2f (diff)
downloadtools-87f14b13db50d9216c71a389b5ce4274bb564d59.tar.gz
tools-87f14b13db50d9216c71a389b5ce4274bb564d59.tar.bz2
tools-87f14b13db50d9216c71a389b5ce4274bb564d59.tar.xz
tools-87f14b13db50d9216c71a389b5ce4274bb564d59.zip
Renew the Monster WikiGenerator
Diffstat (limited to 'wiki')
-rwxr-xr-xwiki/wikigen.py187
1 files changed, 142 insertions, 45 deletions
diff --git a/wiki/wikigen.py b/wiki/wikigen.py
index b4c48d6..f76a726 100755
--- a/wiki/wikigen.py
+++ b/wiki/wikigen.py
@@ -55,55 +55,90 @@ def showFooter():
-def writeMob(wikib, tmb):
- wikib.write("|"+
- tmb[0]+"|"+
- tmb[1]+"|"+
- tmb[2]+"|"+
- tmb[3]+"|"+
- tmb[4]+"|"+
- tmb[5]+"|"+
- tmb[6]+"|"+
- tmb[7]+"|\n"
- )
+class Mob:
+ def __init__(self):
+ # Basic
+ self.id="0"
+ #self.aegis="UnknownMonster" # SpriteName is not used anywhere, we are using its ID
+ self.name="Unknown Monster Name"
+ self.view="1"
+
+ # Defensive
+ self.mobpt="0" # Mob Points “Level”
+ self.hp="0"
+ self.xp="0"
+ self.jp="0"
+ self.st=""
+
+ # Offensive
+ self.atk="[0, 0]"
+ self.range="0"
+ self.move="0"
+ self.delay="0"
+ self.drops=[]
+
+AggMobs=[]
+NrmMobs=[]
+
+def MobAlloc(ab):
+ if "agr" in ab.st.lower():
+ AggMobs.append(ab)
+ else:
+ NrmMobs.append(ab)
def testMobs():
print("Generating Mob Wiki...")
src=open("../../server-data/db/re/mob_db.conf", "r")
wikib.write("# Monster Database\n")
- wikib.write("|ID|Name|hp|xp|def|atk|delay|modes|\n")
- # 0 1 2 3 4 5 6 7
- #tm_entry=False # TODO: Drop list
- tmb=['--','----','--','--','---','---','-----','-----']
- # 0 1 2 3 4 5 6 7
+ start=False
+ dropper=False
+
for a in src:
if a == "{\n":
- writeMob(wikib, tmb)
- tmb=['','','','','','', '', '']
- # 0 1 2 3 4 5 6 7
- if " Id:" in a:
- tmb[0]=stp(a)
- if " Name:" in a:
- tmb[1]=stp(a)
- if " Hp:" in a:
- tmb[2]=stp(a)
- if " Exp:" in a:
- tmb[3]=stp(a)
- if " Def:" in a:
- tmb[4]=stp(a)
- if " Attack:" in a:
- tmb[5]=stp(a)
- if " AttackDelay:" in a:
- tmb[6]=stp(a)
- if " Looter: true" in a:
- tmb[7]+="Lot,"
- if " Assist: true" in a:
- tmb[7]+="Ass,"
- if " Aggressive: true" in a:
- tmb[7]+="Agr,"
+ if start:
+ MobAlloc(x)
+ else:
+ start=True
+ x=Mob()
+ if " Id:" in a:
+ x.id=stp(a)
+ elif " Name:" in a:
+ x.name=stp(a)
+ elif " Hp:" in a:
+ x.hp=stp(a)
+ elif " Level:" in a:
+ x.mobpt=stp(a)
+ elif " Exp:" in a:
+ x.xp=stp(a)
+ elif " JExp:" in a:
+ x.jp=stp(a)
+ elif " Attack:" in a:
+ x.atk=stp(a)
+ elif " AttackRange:" in a:
+ x.range=stp(a)
+ elif " MoveSpeed:" in a:
+ x.move=stp(a)
+ elif " ViewRange:" in a:
+ x.view=stp(a)
+ elif " AttackDelay:" in a:
+ x.delay=stp(a)
+ elif " Looter: true" in a:
+ x.st+="Lot,"
+ elif " Assist: true" in a:
+ x.st+="Ass,"
+ elif " Aggressive: true" in a:
+ x.st+="Agr,"
+ elif 'Drops: ' in a:
+ dropper=True
+ elif dropper and '}' in a:
+ dropper=False
+ elif dropper:
+ x.drops.append(stp(a))
# Write last entry
- writeMob(wikib, tmb)
+ MobAlloc(x)
+
+ writeMob()
wikib.write('\n\n|Mode|Desc|\n|----|----|\n')
wikib.write('|Lot|Looter|\n')
@@ -113,15 +148,77 @@ def testMobs():
src.close()
def stp(x):
- return x.replace('\n', '').replace('|', '').replace('(int, defaults to ', '').replace(')', '').replace('basic experience', '').replace('"','').replace(" ","").replace('(string', '').replace('Name: ','').replace('AttackDelay', 'ms')
-
-
-
-
+ return x.replace('\n', '').replace('|', '').replace('(int, defaults to ', '').replace(')', '').replace('basic experience', '').replace('"','').replace(" ","").replace('(string', '').replace('Name: ','').replace('AttackDelay: ', '').replace('MoveSpeed: ', '').replace('AttackRange: ', '').replace('ViewRange: ','')
+
+
+def writeMob():
+ wikib.write("\
++ [Aggressive Monsters](#aggressive-monsters)\n\
++ [Other Monsters](#other-monsters)\n\n\
+ ")
+
+ wikib.write("## Aggressive Monsters\n\n")
+
+ wikib.write("<table border=1>\n")
+ wikib.write("<tr><td>ID</td><td>Name</td><td>HP</td><td>Atk</td><td>Delay</td><td>View Range</td><td>Misc Info</td><td>Rewards</td><td>Drops</td>\n")
+ for i in AggMobs:
+ wikib.write('<tr><td>' +
+ i.id +"</td><td>"+
+ i.name +"</td><td>HP: "+
+ i.hp +"</td><td>Atk: "+
+ i.atk +"</td><td>"+
+ i.delay +" ms</td><td>View: "+
+ i.view +"</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"
+ )
+ wikib.write("</table>\n")
+ wikib.write("\n[(↑) Return to top](#items)\n\n")
+
+
+ wikib.write("## Normal Monsters\n\n")
+
+ wikib.write("<table border=1>\n")
+ wikib.write("<tr><td>ID</td><td>Name</td><td>HP</td><td>Atk</td><td>Delay</td><td>Misc Info</td><td>Rewards</td><td>Drops</td>\n")
+ for i in NrmMobs:
+ wikib.write('<tr><td>' +
+ i.id +"</td><td>"+
+ i.name +"</td><td>HP: "+
+ i.hp +"</td><td>Atk: "+
+ i.atk +"</td><td>"+
+ i.delay +" ms</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"
+ )
+ wikib.write("</table>\n")
+ wikib.write("\n[(↑) Return to top](#items)\n\n")
+def mbdt(summary, content):
+ return "<details>\
+<summary>"+summary+"</summary>\
+<pre>"+content+"</pre></details>"
+def mb_rdmisc(mb):
+ buff=""
+ buff+="Modes: %s\n" % (mb.st)
+ buff+="Attack Range: %s\n" % (mb.range)
+ buff+="Move speed: %s ms\n" % (mb.move)
+ return buff
+def mb_rdrw(mb):
+ buff=""
+ buff+="MobPoints: %s\n" % (mb.mobpt)
+ buff+="%s\n" % (mb.xp)
+ buff+="%s\n" % (mb.jp)
+ return buff
+def mb_rddrop(mb):
+ buff=""
+ for ax in mb.drops:
+ buff+=ax+'\n'
+ return buff
class It: