summaryrefslogtreecommitdiff
path: root/hercules/maptool.py
diff options
context:
space:
mode:
Diffstat (limited to 'hercules/maptool.py')
-rwxr-xr-xhercules/maptool.py26
1 files changed, 26 insertions, 0 deletions
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)