From d69559cd34637ef2d88a57d53314c795a7d74d3a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Sep 2014 12:02:45 +0300 Subject: hercules: in items.xml dont add attributes with value 0. --- hercules/maptool.py | 19 +++++++++++++++---- hercules/templates/item.tpl | 12 +++--------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/hercules/maptool.py b/hercules/maptool.py index 26e5848..7b70403 100755 --- a/hercules/maptool.py +++ b/hercules/maptool.py @@ -229,6 +229,11 @@ def covertQuests(): data = data + tpl.format(questId, name, text + ": " + str(questId)) saveFile(destDir + "quests.xml", quests.format(data)) +def prepStat(val, text): + if val != "0" and val != "": + return " {0}=\"{1}\"\n".format(text, val) + return "" + def convertItems(): destDir = "clientdata/" templatesDir = "templates/" @@ -286,6 +291,12 @@ def convertItems(): name = name.replace("\\'", "'") image = "" + statStr = prepStat(atk, "attack") + statStr = statStr + prepStat(matk, "mattack") + statStr = statStr + prepStat(defence, "defence") + statStr = statStr + prepStat(weight, "weight") + statStr = statStr + prepStat(attackRange, "range") + statStr = statStr + prepStat(delay, "speed") # print itemId + "," + equipLocations # typeStr = "other" typeStr = "equip-legs" @@ -337,12 +348,12 @@ def convertItems(): if itemId not in ids: ids.add(itemId) - data = data + tpl.format(itemId, name, weight, - atk, matk, defence, attackRange, delay, image, typeStr, spriteStr) + data = data + tpl.format(itemId, name, 0, + statStr, image, typeStr, spriteStr) if view != "0" and view not in ids: ids.add(view) - data = data + tpl.format(view, name, weight, - atk, matk, defence, attackRange, delay, image, typeStr, spriteStr) + data = data + tpl.format(view, name, 0, + statStr, image, typeStr, spriteStr) saveFile(destDir + "items.xml", items.format(data)) diff --git a/hercules/templates/item.tpl b/hercules/templates/item.tpl index e7ee095..a7f28a9 100644 --- a/hercules/templates/item.tpl +++ b/hercules/templates/item.tpl @@ -1,13 +1,7 @@ - {10} +{3} image="{4}" + type="{5}"> + {6} -- cgit v1.2.3-70-g09d2