summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------hercules/homunculusestoxml.py1
-rwxr-xr-xhercules/maptool.py26
-rw-r--r--hercules/templates/homunculus.tpl3
-rw-r--r--hercules/templates/homunculuses.xml6
4 files changed, 36 insertions, 0 deletions
diff --git a/hercules/homunculusestoxml.py b/hercules/homunculusestoxml.py
new file mode 120000
index 0000000..df2b3e6
--- /dev/null
+++ b/hercules/homunculusestoxml.py
@@ -0,0 +1 @@
+maptool.py \ No newline at end of file
diff --git a/hercules/maptool.py b/hercules/maptool.py
index 7b70403..9615edf 100755
--- a/hercules/maptool.py
+++ b/hercules/maptool.py
@@ -37,6 +37,8 @@ def detectCommand():
return "mercenariestoxml"
elif sys.argv[0][-13:] == "/petstoxml.py":
return "petstoxml"
+ elif sys.argv[0][-21:] == "/homunculusestoxml.py":
+ return "homunculusestoxml"
return "help"
def makeDir(path):
@@ -428,6 +430,27 @@ def convertPets():
data = data + tpl.format(petId, petSprite)
saveFile(destDir + "pets.xml", pets.format(data))
+def convertHomunculuses():
+ destDir = "clientdata/"
+ templatesDir = "templates/"
+ homunculusesDbFile = "serverdata/db/re/homunculus_db.txt"
+ fieldsSplit = re.compile(",")
+ makeDir(destDir)
+ tpl = readFile(templatesDir + "homunculus.tpl")
+ homunculuses = readFile(templatesDir + "homunculuses.xml")
+ data = ""
+ homunculusSprite = "<sprite>monsters/tortuga.xml</sprite>";
+ with open(homunculusesDbFile, "r") as f:
+ for line in f:
+ if line == "" or line[0:2] == "//":
+ continue
+ rows = fieldsSplit.split(line)
+ if len(rows) < 9:
+ continue
+ homunculusId = rows[0]
+ data = data + tpl.format(homunculusId, homunculusSprite)
+ saveFile(destDir + "homunculuses.xml", homunculuses.format(data))
+
def readMapCache(path, cmd):
if cmd == "help":
@@ -447,6 +470,9 @@ def readMapCache(path, cmd):
elif cmd == "petstoxml":
convertPets();
return
+ elif cmd == "homunculusestoxml":
+ convertHomunculuses();
+ return
with open(path, "rb") as f:
size = readInt32(f)
diff --git a/hercules/templates/homunculus.tpl b/hercules/templates/homunculus.tpl
new file mode 100644
index 0000000..f2c3301
--- /dev/null
+++ b/hercules/templates/homunculus.tpl
@@ -0,0 +1,3 @@
+ <homunculus id="{0}">
+ {1}
+ </homunculus>
diff --git a/hercules/templates/homunculuses.xml b/hercules/templates/homunculuses.xml
new file mode 100644
index 0000000..3737d8b
--- /dev/null
+++ b/hercules/templates/homunculuses.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Authors: 4144
+Copyright (C) 2014 Evol Online -->
+<homunculuses>
+{0}
+</homunculuses>