summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRawng <rawng.github@gmail.com>2014-09-27 01:02:43 -0400
committerRawng <rawng.github@gmail.com>2014-09-27 01:02:43 -0400
commit508411a4c6cc1bc94b3b0d79b8c05356972cb2a9 (patch)
tree3f926ce16823be23df0a17da5af38b511115b4ef
parent614446a1858001fe3b3055296e2a6e2f526b8394 (diff)
downloadmanamarket-508411a4c6cc1bc94b3b0d79b8c05356972cb2a9.tar.gz
manamarket-508411a4c6cc1bc94b3b0d79b8c05356972cb2a9.tar.bz2
manamarket-508411a4c6cc1bc94b3b0d79b8c05356972cb2a9.tar.xz
manamarket-508411a4c6cc1bc94b3b0d79b8c05356972cb2a9.zip
Parse new include style item.xml
-rw-r--r--utils.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/utils.py b/utils.py
index 07c4451..75cc80c 100644
--- a/utils.py
+++ b/utils.py
@@ -53,18 +53,22 @@ class ItemDB:
self.itemdb_file = ElementTree(file="data/items.xml")
for item in self.itemdb_file.getroot():
- if item.get('id') > 500:
- item_struct = Item()
- item_struct.name = item.get('name')
- if item.get('weight'):
- item_struct.weight = int(item.get('weight'))
- else:
- item_struct.weight = 0
-
- if item.get('type'):
- item_struct.type = item.get('type')
- item_struct.description = item.get('description')
- self.item_names[int(item.get('id'))] = item_struct
+ if item.get('name'):
+ file2 = ElementTree(file=item.get('name'))
+ for item2 in file2.getroot():
+ if item2.get('name'):
+ file3 = ElementTree(file=item2.get('name'))
+ for item3 in file3.getroot():
+ item_struct = Item()
+ item_struct.name = item3.get('name')
+ if item3.get('weight'):
+ item_struct.weight = item.get('weight')
+ else:
+ item_struct.weight = 0
+ if item3.get('type'):
+ item_struct.type = item3.get('type')
+ item_struct.description = item.get('description')
+ self.item_names[int(item3.get('id'))] = item_struct
def getItem(self, item_id):
return self.item_names[item_id]
@@ -129,4 +133,6 @@ class Broadcast:
self.shop_broadcast.join()
if __name__ == '__main__':
+
+
print "Do not run this file directly. Run main.py"