diff options
l--------- | hercules/monsterstoxml.py | 1 | ||||
-rw-r--r-- | hercules/templates/monster.tpl | 3 | ||||
-rw-r--r-- | hercules/templates/monsters.xml | 11 | ||||
-rwxr-xr-x | herculesversion/packetversion.py | 2 | ||||
-rwxr-xr-x | testxml/testxml.py | 64 |
5 files changed, 65 insertions, 16 deletions
diff --git a/hercules/monsterstoxml.py b/hercules/monsterstoxml.py new file mode 120000 index 0000000..df2b3e6 --- /dev/null +++ b/hercules/monsterstoxml.py @@ -0,0 +1 @@ +maptool.py
\ No newline at end of file diff --git a/hercules/templates/monster.tpl b/hercules/templates/monster.tpl new file mode 100644 index 0000000..3b6bf4d --- /dev/null +++ b/hercules/templates/monster.tpl @@ -0,0 +1,3 @@ + <monster id="{0}" name="{1}"> + {2} + </monster> diff --git a/hercules/templates/monsters.xml b/hercules/templates/monsters.xml new file mode 100644 index 0000000..9f8ffa0 --- /dev/null +++ b/hercules/templates/monsters.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010-2014 Evol Online --> + +<monsters> + <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0"> + <its:translateRule selector="//monster/@name" translate="yes"/> + <its:translateRule selector="//*" translate="no"/> + </its:rules> + +{0} +</monsters> diff --git a/herculesversion/packetversion.py b/herculesversion/packetversion.py index 2f2cf94..1f58b07 100755 --- a/herculesversion/packetversion.py +++ b/herculesversion/packetversion.py @@ -98,7 +98,7 @@ def showPlan(data): # print "{0:30} {1:4} {2:3} {3:4} {4:3}".format(line, oldFunc[line][0], oldFunc[line][1], newFunc[line][0], newFunc[line][1]) def main(): - data = readPackets("hercules/src/map/packets.h", 20131223, 20131230) + data = readPackets("hercules/src/map/packets.h", 20140416, ) changed = findChangedPackets(data) showPlan(changed) diff --git a/testxml/testxml.py b/testxml/testxml.py index 90670a8..7455e2a 100755 --- a/testxml/testxml.py +++ b/testxml/testxml.py @@ -934,16 +934,28 @@ def testParticle(id, file, src): showMsgFile(file, "incorrect particle xml file", True) return - nodes = dom.getElementsByTagName("particle") + nodes = dom.documentElement.childNodes if len(nodes) < 1: showMsgFile(file, "missing particle tags", False) else: for node in nodes: - testEmitters(id, file, node, file) - - -def testEmitters(id, file, parentNode, src): - for node in parentNode.getElementsByTagName("property"): + for emitter in node.childNodes: + testEmitters(id, file, emitter, file, 0) + + +def testEmitters(id, file, parentNode, src, level): +# print "check file: " + file +# print "parent node: " + parentNode.nodeName +# print "level: " + str(level) + foundLifeTime = False; + for node in parentNode.childNodes: +# print "node: " + node.nodeName + if node.nodeName == "emitter": +# print "found emitter" + testEmitters(id, file, node, src, level + 1) + continue + elif node.nodeName != "property": + continue try: name = node.attributes["name"].value except: @@ -955,6 +967,15 @@ def testEmitters(id, file, parentNode, src): except: value = None + if value == None: + try: + value = node.attributes["min"].value + value = node.attributes["max"].value + except: + value = None + +# print "name=" + name + if name == "image": if value == None: showMsgFile(file, "missing attribute value in emitter" \ @@ -969,18 +990,31 @@ def testEmitters(id, file, parentNode, src): showMsgFile(file, "image file not exist: " + image, True) else: testImageFile(image, fullName, 0, " " + file,True) - for node in parentNode.getElementsByTagName("emitter"): - testEmitters(id, file, node, src) + elif name == "lifetime": + if value == None: + showMsgFile(file, "missing attribute value in emitter" \ + " lifetime attribute", True) + if value == "": + if level > 0 and foundLifeTime == False: + showMsgFile(file, "in emmiter lifetime attribute must be set and not equal -1", True); + else: +# print "found lifetime" + foundLifeTime = True; + + + if level > 0 and foundLifeTime == False: +# print "life time missing" + showMsgFile(file, "in emmiter lifetime attribute must be set and not equal -1", True); def testItems(fileName, imgDir): global warnings, errors, safeDye - print "Checking " + fileName +# print "Checking " + fileName try: dom = minidom.parse(parentDir + fileName) except: - print "error: " + fileName + ": corrupted" + print "error: " + parentDir + fileName + ": corrupted" return idset = set() oldId = None @@ -991,7 +1025,7 @@ def testItems(fileName, imgDir): if name == "": errors = errors + 1 print "error: " + fileName + ": Empty include name"; - testItems(name, imgDir) + testItems("/" + name, imgDir) except: errors = errors + 1 print "error: " + fileName + ": Broken include tag"; @@ -1218,7 +1252,7 @@ def checkSpriteName(id, name): def testMonsters(fileName): global warnings, errors - print "Checking " + fileName +# print "Checking " + fileName dom = minidom.parse(parentDir + fileName) idset = set() for node in dom.documentElement.childNodes: @@ -1228,7 +1262,7 @@ def testMonsters(fileName): if name == "": errors = errors + 1 print "error: " + fileName + ": Empty include name"; - testMonsters(name) + testMonsters("/" + name) except: errors = errors + 1 print "error: " + fileName + ": Broken include tag"; @@ -1307,7 +1341,7 @@ def testSounds(id, node, type): def testNpcs(file): global warnings, errors - print "Checking " + file +# print "Checking " + file dom = minidom.parse(parentDir + file) idset = set() for node in dom.documentElement.childNodes: @@ -1317,7 +1351,7 @@ def testNpcs(file): if name == "": errors = errors + 1 print "error: " + fileName + ": Empty include name"; - testNpcs(name) + testNpcs("/" + name) except: errors = errors + 1 print "error: " + fileName + ": Broken include tag"; |