summaryrefslogtreecommitdiff
path: root/wiki/wikigen.py
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-03-21 00:09:20 -0300
committerJesusaves <cpntb1@ymail.com>2018-03-21 00:09:20 -0300
commit0e6fb13bc211953646c145c5ab51a6970fdd0425 (patch)
treef181f7681637ea81a5de93f2d2ae121e4b19ba67 /wiki/wikigen.py
parente9dd6ef7a466d98337fe784804fdf9703d64ed8b (diff)
downloadtools-0e6fb13bc211953646c145c5ab51a6970fdd0425.tar.gz
tools-0e6fb13bc211953646c145c5ab51a6970fdd0425.tar.bz2
tools-0e6fb13bc211953646c145c5ab51a6970fdd0425.tar.xz
tools-0e6fb13bc211953646c145c5ab51a6970fdd0425.zip
Improvements to wikigen drop handling. Thanks Micksha
Diffstat (limited to 'wiki/wikigen.py')
-rwxr-xr-xwiki/wikigen.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/wiki/wikigen.py b/wiki/wikigen.py
index 8aa8c89..c88d037 100755
--- a/wiki/wikigen.py
+++ b/wiki/wikigen.py
@@ -152,7 +152,7 @@ def testMobs():
elif dropper and '}' in a:
dropper=False
elif dropper:
- x.drops.append(stp(a))
+ x.drops.append(stp(a).split(": "))
# Write last entry
MobAlloc(x)
@@ -239,7 +239,19 @@ def mb_rdrw(mb):
def mb_rddrop(mb):
buff=""
for ax in mb.drops:
- buff+=ax+'\n'
+ # Ignore disabled drops
+ if ax[0].startswith("//"):
+ continue
+
+ # Write drop
+ try:
+ buff+=ax[0]+': ' + str(int(ax[1])/100.0) + ' %\n'
+ except IndexError:
+ print("Fatal: invalid %s mob with %s drops" % (mb.name, str(ax)))
+ exit(1)
+ except:
+ print("[Warning] %s incorrect drop: %s" % (mb.name, str(ax)))
+ buff+=ax[0]+': ' + ax[1] + ' ppm\n'
return buff