diff options
author | wushin <pasekei@gmail.com> | 2015-02-18 21:32:51 -0600 |
---|---|---|
committer | wushin <pasekei@gmail.com> | 2015-02-18 21:32:51 -0600 |
commit | f158506f009ded0dfa695a4c7eb6181f9ea09066 (patch) | |
tree | 567a2f89ffc4db95939024e1ff4109cc232de926 /hercules/code/server/tmw/itemdb.py | |
parent | 3c410c7ab75a2f730ef41ca8d0c55fe1fc23ac13 (diff) | |
download | tools-f158506f009ded0dfa695a4c7eb6181f9ea09066.tar.gz tools-f158506f009ded0dfa695a4c7eb6181f9ea09066.tar.bz2 tools-f158506f009ded0dfa695a4c7eb6181f9ea09066.tar.xz tools-f158506f009ded0dfa695a4c7eb6181f9ea09066.zip |
Hercules: tmw convertor: calculate mob exp
Hercules: tmw convertor: add item scripts
Hercules: tmw convertor: add equip scripts
Diffstat (limited to 'hercules/code/server/tmw/itemdb.py')
-rw-r--r-- | hercules/code/server/tmw/itemdb.py | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/hercules/code/server/tmw/itemdb.py b/hercules/code/server/tmw/itemdb.py index eff90cd..c27a06c 100644 --- a/hercules/code/server/tmw/itemdb.py +++ b/hercules/code/server/tmw/itemdb.py @@ -24,7 +24,10 @@ def convertItemDb(): if os.path.isfile(constsFile): os.remove(constsFile) fieldsSplit = re.compile(",") - scriptsSplit = re.compile("{") + scriptsSplit = re.compile("},") + scriptsTextClean = re.compile('([{}])') + scriptsTextComma = re.compile('^,') + scriptsTextColon = re.compile('; ') items = dict() tpl = readFile("templates/item_db.tpl") @@ -48,12 +51,16 @@ def convertItemDb(): rows[f] = rows[f].strip() items[rows[1]] = {'id':rows[0],'buy':rows[4]} + # set all values then write w.write("{\n") c.write("{0}\t{1}\n".format(rows[1], rows[0])) writeIntField(w, "Id", rows[0]) writeStrField(w, "AegisName", rows[1]) writeStrField(w, "Name", rows[2]) - writeIntField(w, "Type", rows[3]) + if rows[3] == "0": + writeIntField(w, "Type", "2") + else: + writeIntField(w, "Type", rows[3]) writeIntField(w, "Buy", rows[4]) writeIntField(w, "Sell", rows[5]) writeIntField(w, "Weight", rows[6]) @@ -83,18 +90,23 @@ def convertItemDb(): writeIntField(w, "Sprite", "0") scripts = "" - for f in xrange(sz, len(rows)): + for f in xrange(17, len(rows)): scripts = scripts + ", " + rows[f] rows = scriptsSplit.split(scripts) - cnt = len(rows) - if cnt > 1: - text = rows[1].strip() - if len(text) > 1: - text = text[:-2] - if text != "": - writeStartScript(w, "Script") - w.write(" {0}\n".format(text)) - writeEndScript(w) + # Needs .split(';') and \n each + UseScript = scriptsTextColon.sub(';',scriptsTextComma.sub('', scriptsTextClean.sub('', rows[0]))).strip().split(';') + EquipScript = scriptsTextColon.sub(';',scriptsTextComma.sub('', scriptsTextClean.sub('', rows[1]))).strip().split(';') + # move to for stmt + if len(UseScript) > 1: + writeStartScript(w, "Script") + for uline in UseScript: + w.write(" {0};\n".format(uline)) + writeEndScript(w) + if len(EquipScript) > 1: + writeStartScript(w, "OnEquipScript") + for eline in EquipScript: + w.write(" {0};\n".format(eline)) + writeEndScript(w) w.write("},\n") w.write(")\n") |