summaryrefslogtreecommitdiff
path: root/hercules
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-27 21:56:02 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-27 21:56:02 +0300
commit6f8dd2e9450befa9632ebcee1086c2095ee0aeae (patch)
tree6825fb027a916a9f9b0ee2e2042db31eace8334d /hercules
parenta383622485a6c10c68bb3e69cc3470e94b359d55 (diff)
downloadtools-6f8dd2e9450befa9632ebcee1086c2095ee0aeae.tar.gz
tools-6f8dd2e9450befa9632ebcee1086c2095ee0aeae.tar.bz2
tools-6f8dd2e9450befa9632ebcee1086c2095ee0aeae.tar.xz
tools-6f8dd2e9450befa9632ebcee1086c2095ee0aeae.zip
hercules: add support for converting skils.xml
Diffstat (limited to 'hercules')
-rwxr-xr-xhercules/maptool.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/hercules/maptool.py b/hercules/maptool.py
index 9615edf..e965802 100755
--- a/hercules/maptool.py
+++ b/hercules/maptool.py
@@ -39,6 +39,8 @@ def detectCommand():
return "petstoxml"
elif sys.argv[0][-21:] == "/homunculusestoxml.py":
return "homunculusestoxml"
+ elif sys.argv[0][-15:] == "/skillstoxml.py":
+ return "skillstoxml"
return "help"
def makeDir(path):
@@ -451,6 +453,31 @@ def convertHomunculuses():
data = data + tpl.format(homunculusId, homunculusSprite)
saveFile(destDir + "homunculuses.xml", homunculuses.format(data))
+def convertSkillsToXml():
+ destDir = "clientdata/"
+ templatesDir = "templates/"
+ skillsDbFile = "serverdata/db/re/skill_db.txt"
+ fieldsSplit = re.compile(",")
+ makeDir(destDir)
+ tpl = readFile(templatesDir + "skill.tpl")
+ skills = readFile(templatesDir + "skills.xml")
+ data = ""
+ with open(skillsDbFile, "r") as f:
+ for line in f:
+ if line == "" or line[0:2] == "//":
+ continue
+ rows = fieldsSplit.split(line)
+ if len(rows) < 9:
+ continue
+ skillId = rows[0]
+ name = rows[15].strip()
+ description = rows[16].strip()
+ idx = description.find ("//")
+ if idx > 1:
+ description = description[:idx]
+ data = data + tpl.format(skillId, name, description)
+ saveFile(destDir + "skills.xml", skills.format(data))
+
def readMapCache(path, cmd):
if cmd == "help":
@@ -473,6 +500,9 @@ def readMapCache(path, cmd):
elif cmd == "homunculusestoxml":
convertHomunculuses();
return
+ elif cmd == "skillstoxml":
+ convertSkillsToXml();
+ return
with open(path, "rb") as f:
size = readInt32(f)