summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-24 11:41:39 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-24 11:41:39 +0300
commita8151acf92fba0e0c8b09e7f04dbb7a4bc89834a (patch)
tree1c12f772c9c060c35868958db5f82dddbace84f2
parent1a381b5f46aa8708dfc5fe96ccb8dd8cfdddb2f2 (diff)
downloadevol-tools-a8151acf92fba0e0c8b09e7f04dbb7a4bc89834a.tar.gz
evol-tools-a8151acf92fba0e0c8b09e7f04dbb7a4bc89834a.tar.bz2
evol-tools-a8151acf92fba0e0c8b09e7f04dbb7a4bc89834a.tar.xz
evol-tools-a8151acf92fba0e0c8b09e7f04dbb7a4bc89834a.zip
hercules: add pets.xml generation.
-rwxr-xr-xhercules/maptool.py26
l---------hercules/petstoxml.py1
-rw-r--r--hercules/templates/pet.tpl3
-rw-r--r--hercules/templates/pets.xml6
4 files changed, 36 insertions, 0 deletions
diff --git a/hercules/maptool.py b/hercules/maptool.py
index fa3ecc8..26e5848 100755
--- a/hercules/maptool.py
+++ b/hercules/maptool.py
@@ -35,6 +35,8 @@ def detectCommand():
return "monsterstoxml"
elif sys.argv[0][-20:] == "/mercenariestoxml.py":
return "mercenariestoxml"
+ elif sys.argv[0][-13:] == "/petstoxml.py":
+ return "petstoxml"
return "help"
def makeDir(path):
@@ -394,6 +396,27 @@ def convertMercenaries():
data = data + tpl.format(mercenaryId, mercenarySprite)
saveFile(destDir + "mercenaries.xml", mercenaries.format(data))
+def convertPets():
+ destDir = "clientdata/"
+ templatesDir = "templates/"
+ petsDbFile = "serverdata/db/pet_db.txt"
+ fieldsSplit = re.compile(",")
+ makeDir(destDir)
+ tpl = readFile(templatesDir + "pet.tpl")
+ pets = readFile(templatesDir + "pets.xml")
+ data = ""
+ petSprite = "<sprite>monsters/tortuga.xml</sprite>";
+ with open(petsDbFile, "r") as f:
+ for line in f:
+ if line == "" or line[0:2] == "//":
+ continue
+ rows = fieldsSplit.split(line)
+ if len(rows) < 9:
+ continue
+ petId = rows[0]
+ data = data + tpl.format(petId, petSprite)
+ saveFile(destDir + "pets.xml", pets.format(data))
+
def readMapCache(path, cmd):
if cmd == "help":
@@ -410,6 +433,9 @@ def readMapCache(path, cmd):
elif cmd == "mercenariestoxml":
convertMercenaries();
return
+ elif cmd == "petstoxml":
+ convertPets();
+ return
with open(path, "rb") as f:
size = readInt32(f)
diff --git a/hercules/petstoxml.py b/hercules/petstoxml.py
new file mode 120000
index 0000000..df2b3e6
--- /dev/null
+++ b/hercules/petstoxml.py
@@ -0,0 +1 @@
+maptool.py \ No newline at end of file
diff --git a/hercules/templates/pet.tpl b/hercules/templates/pet.tpl
new file mode 100644
index 0000000..e328137
--- /dev/null
+++ b/hercules/templates/pet.tpl
@@ -0,0 +1,3 @@
+ <pet id="{0}">
+ {1}
+ </pet>
diff --git a/hercules/templates/pets.xml b/hercules/templates/pets.xml
new file mode 100644
index 0000000..6f838cf
--- /dev/null
+++ b/hercules/templates/pets.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Authors: 4144
+Copyright (C) 2014 Evol Online -->
+<pets>
+{0}
+</pets>