From 76a8a2d6514bfbaee904b9dfdce0935719fbba71 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Tue, 11 Jan 2022 13:53:55 -0500 Subject: [PATCH] export entity names --- scripts/lookuptable_generator.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/lookuptable_generator.py b/scripts/lookuptable_generator.py index d343bd28..b5134942 100644 --- a/scripts/lookuptable_generator.py +++ b/scripts/lookuptable_generator.py @@ -4,6 +4,7 @@ import xml.etree.ElementTree as ET 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 def sortByID(elem): @@ -15,6 +16,7 @@ itemIDToPool = {} maxItemID = 0 cardMetadatas = [] pillMetadatas = [] +entityNames = [] recipeIngredients = {} #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.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 @@ -137,9 +152,15 @@ for card in cardMetadatas: newfile.write("}\n\n") newfile.write("EID.pillMetadata = {") - - for pill in pillMetadatas: 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") +