export entity names

This commit is contained in:
Buurazu authored and GitHub committed 2022-01-11 13:53:55 -05:00
1 parent a7ceab5778
commit 76a8a2d651
1 file changed
+24 -3
+24 -3
View File
@@ -4,6 +4,7 @@
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
filePath = "D:\\Programme\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\resources-dlc3\\" filePath = "D:\\Programme\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\resources-dlc3\\"
# filePath = "D:\\Program Files\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\resources-dlc3\\"
# take second element for sort # take second element for sort
def sortByID(elem): def sortByID(elem):
@@ -15,6 +16,7 @@ itemIDToPool = {}
maxItemID = 0 maxItemID = 0
cardMetadatas = [] cardMetadatas = []
pillMetadatas = [] pillMetadatas = []
entityNames = []
recipeIngredients = {} recipeIngredients = {}
#Poop, Penny #Poop, Penny
@@ -90,6 +92,19 @@ for pilleffect in pocketitemsXML.findall('pilleffect'):
pillMetadatas.append({ "id": pilleffect.get('id'), "mimiccharge": pilleffect.get('mimiccharge', 0), "class":pilleffect.get('class')}) pillMetadatas.append({ "id": pilleffect.get('id'), "mimiccharge": pilleffect.get('mimiccharge', 0), "class":pilleffect.get('class')})
pillMetadatas.sort(key=sortByID) pillMetadatas.sort(key=sortByID)
# Read entities2.xml
entitiesXML = ET.parse(filePath+'entities2.xml').getroot()
for entity in entitiesXML.findall('entity'):
theID = entity.get('id')
theName = entity.get('name')
if entity.get('variant'):
theID += "." + entity.get('variant')
if entity.get('subtype'):
theID += "." + entity.get('subtype')
if theName[0] == '#':
theName = theName[1:].replace('_',' ').title()
entityNames.append({ "id": theID, "name": theName })
#Write xml file #Write xml file
@@ -137,9 +152,15 @@ for card in cardMetadatas:
newfile.write("}\n\n") newfile.write("}\n\n")
newfile.write("EID.pillMetadata = {") newfile.write("EID.pillMetadata = {")
for pill in pillMetadatas: for pill in pillMetadatas:
newfile.write("["+pill['id']+"] = {mimiccharge="+str(pill['mimiccharge'])+", class=\""+str(pill['class'])+"\"}, ") newfile.write("["+pill['id']+"] = {mimiccharge="+str(pill['mimiccharge'])+", class=\""+str(pill['class'])+"\"}, ")
newfile.write("}\n") newfile.write("}\n\n")
newfile.write("--The name of each entity, for use in glitched item descriptions\n")
newfile.write("EID.XMLEntityNames = {")
for entity in entityNames:
newfile.write("[\""+entity['id']+"\"] = \""+entity['name']+"\", ")
newfile.write("}\n\n")