diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-04-10 00:45:07 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-04-10 00:45:07 -0300 |
commit | c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe (patch) | |
tree | 742dd839971d2aab1f08fd0291af66e6439646ab /hercules/code/server/tmw/mobskilldb.py | |
download | tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.gz tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.bz2 tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.xz tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.zip |
Add initial tools
Diffstat (limited to 'hercules/code/server/tmw/mobskilldb.py')
-rw-r--r-- | hercules/code/server/tmw/mobskilldb.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/hercules/code/server/tmw/mobskilldb.py b/hercules/code/server/tmw/mobskilldb.py new file mode 100644 index 0000000..7188824 --- /dev/null +++ b/hercules/code/server/tmw/mobskilldb.py @@ -0,0 +1,55 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2014 Evol Online +# Author: Andrei Karas (4144) + +import re + +from code.fileutils import readFile + +def convertMobSkillDb(): + srcFile = "oldserverdata/world/map/db/mob_skill_db.txt" + dstFile = "newserverdata/db/re/mob_skill_db.txt" + fieldsSplit = re.compile(",") + notintown = re.compile("notintown") + notintownSub = re.compile("notintown,0") + with open(srcFile, "r") as r: + with open(dstFile, "w") as w: + tpl = readFile("templates/mob_skill_db.tpl") + w.write(tpl) + for line in r: + if notintown.search(line): + if line[0:2] == "//": + line = '' + line = notintownSub.sub("myhpltmaxrate,20",line) + if len(line) < 2 or line[0:2] == "//": + w.write(line) + continue + rows = fieldsSplit.split(line) + if len(rows) < 10: + w.write(line) + continue + + for f in xrange(0, len(rows)): + rows[f] = rows[f].strip() + + w.write("{0},{1},{2},{3},{4},{5},{6}," + "{7},{8},{9},{10},{11},{12},{13}," + "{14},,,,\n".format( + rows[0], + rows[1], + rows[2], + rows[3], + rows[4], + rows[5], + rows[6], + rows[7], + rows[8], + rows[9], + rows[10], + rows[11], + rows[12], + rows[13], + rows[14] + )) + |