diff options
author | Wushin <pasekei@gmail.com> | 2014-10-01 12:27:20 -0500 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2014-10-01 12:27:20 -0500 |
commit | 9587006e8a2ff995438defaa388e77c00426f3f8 (patch) | |
tree | fb6abd192df2130d5092d0d71756e931d0c7496a | |
parent | 614446a1858001fe3b3055296e2a6e2f526b8394 (diff) | |
parent | 51f924562b2a1e743fa8996c75fdf489aa51eef6 (diff) | |
download | manamarket-9587006e8a2ff995438defaa388e77c00426f3f8.tar.gz manamarket-9587006e8a2ff995438defaa388e77c00426f3f8.tar.bz2 manamarket-9587006e8a2ff995438defaa388e77c00426f3f8.tar.xz manamarket-9587006e8a2ff995438defaa388e77c00426f3f8.zip |
Merge pull request #3 from Rawng/includes
Parse new include style item.xml
-rw-r--r-- | utils.py | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -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 = item3.get('weight') + else: + item_struct.weight = 0 + if item3.get('type'): + item_struct.type = item3.get('type') + item_struct.description = item3.get('description') + self.item_names[int(item3.get('id'))] = item_struct def getItem(self, item_id): return self.item_names[item_id] |