+ Player items

This commit is contained in:
Wiktor Mazur
2019-12-12 15:58:14 +01:00
parent 9296f536e7
commit 47f64a9834
21 changed files with 10266 additions and 88 deletions
+26
View File
@@ -0,0 +1,26 @@
import json
import re
import sys
import xml.etree.ElementTree as ET
file = sys.argv[1]
def add_item(db, name, item):
if 'craftingcategory' in item:
db[name] = item['craftingcategory']
nd = {}
tree = ET.parse(file)
root = tree.getroot()
for child in root:
add_item(nd, child.attrib['uniquename'], child.attrib)
ench = child.find("enchantments")
if ench:
for e in ench:
add_item(nd, f"{child.attrib['uniquename']}@{e.attrib['enchantmentlevel']}", child.attrib)
print(json.dumps(nd))
+29
View File
@@ -0,0 +1,29 @@
import json
import re
import sys
import xml.etree.ElementTree as ET
file = sys.argv[1]
id = 0
def add_item(db, name):
global id
db[id] = name
print(f'{id},{name}')
id = id + 1
nd = {}
tree = ET.parse(file)
root = tree.getroot()
for child in root:
add_item(nd, child.attrib['uniquename'])
ench = child.find("enchantments")
if ench:
for e in ench:
add_item(nd, f"{child.attrib['uniquename']}@{e.attrib['enchantmentlevel']}")