diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-19 22:53:25 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-19 22:53:25 +0200 |
commit | c933307f77af600ccd0f0c0e80ad8e57a81e7c89 (patch) | |
tree | 994b3b77a8f76cd0be4192007e4af430eb475204 | |
parent | 3b9db5a5f3a10490821c9772434d7ccbc5970169 (diff) | |
download | evol-tools-c933307f77af600ccd0f0c0e80ad8e57a81e7c89.tar.gz evol-tools-c933307f77af600ccd0f0c0e80ad8e57a81e7c89.tar.bz2 evol-tools-c933307f77af600ccd0f0c0e80ad8e57a81e7c89.tar.xz evol-tools-c933307f77af600ccd0f0c0e80ad8e57a81e7c89.zip |
Add to tool testxml checking description and sound in items.xml
-rwxr-xr-x | testxml/testxml.py | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/testxml/testxml.py b/testxml/testxml.py index f181ef5..ca1dab1 100755 --- a/testxml/testxml.py +++ b/testxml/testxml.py @@ -14,6 +14,7 @@ dyesplit2 = re.compile(",") parentDir = "../../clientdata" iconsDir = "graphics/items/" spritesDir = "graphics/sprites/" +particlesDir = "graphics/particles/" sfxDir = "sfx/" errors = 0 warnings = 0 @@ -125,6 +126,8 @@ def loadPaths(): spritesDir = node.attributes["value"].value elif node.attributes["name"].value == "sfx": sfxDir = node.attributes["value"].value + elif node.attributes["name"].value == "particles": + particlesDir = node.attributes["value"].value except: print "warn: paths.xml not found" warnings = warnings + 1 @@ -519,6 +522,11 @@ def testSound(file): except ogg.vorbis.VorbisError as e: showMsgFile(file, "sound file incorrect error: " + str(e), True) +def testParticle(file): + fullPath = parentDir + "/" + file + if not os.path.isfile(fullPath) or os.path.exists(fullPath) == False: + showMsgFile(file, "particle file not found", True) + #todo add parsing and checking particle xml file def testItems(fileName, imgDir): @@ -552,6 +560,17 @@ def testItems(fileName, imgDir): image0 = "" imagecolor = "" + try: + description = node.attributes["description"].value + except: + description = "" + + try: + missile = node.attributes["missile-particle"].value + except: + missile = "" + + if type == "hairsprite": if idI >= 0: print "error: hairsprite with id=" + id @@ -584,6 +603,13 @@ def testItems(fileName, imgDir): elif len(imagecolor) > 0: testDye(id, imagecolor, "image=" + image0, True) + if description == "": + print "warn: missing description attribute on id=" + id + warnings = warnings + 1 + if missile != "": + testParticle(missile) + + testSounds(id, node, "item") fullPath = os.path.abspath(parentDir + "/" + imgDir + image) if not os.path.isfile(fullPath) or os.path.exists(fullPath) == False: @@ -630,18 +656,27 @@ def testMonsters(fileName): name = "" testSprites(id, node, False, True) - for sound in node.getElementsByTagName("sound"): - try: - event = sound.attributes["event"].value - except: - print "error: no sound event name in id=" + id - errors = errors + 1 + testSounds(id, node, "monster") + +def testSounds(id, node, type): + global errors + for sound in node.getElementsByTagName("sound"): + try: + event = sound.attributes["event"].value + except: + print "error: no sound event name in id=" + id + errors = errors + 1 + + if type == "monster": if event != "hit" and event != "miss" and event != "hurt" and event != "die": print "error: incorrect sound event name " + event + " in id=" + id errors = errors + 1 + elif type == "item": + if event != "hit" and event != "strike": + print "error: incorrect sound event name " + event + " in id=" + id - testSound(sound.childNodes[0].data) + testSound(sound.childNodes[0].data) def haveXml(dir): |