Remove unused stuff from the XMLData LUTs (#842)
* Remove unused stuff from the XMLData LUTs * Update eid_xmldata_rep+.lua
This commit is contained in:
1 parent
b1306477ad
commit
739b4150c2
4 files changed
+41
-99
No files matched your search
@@ -19,12 +19,10 @@ def sortByID(elem):
|
||||
return elem["id"]
|
||||
recipes = []
|
||||
itempools = {}
|
||||
itemIDToPool = {}
|
||||
maxItemID = 0
|
||||
pillMetadatas = []
|
||||
entityNames = []
|
||||
locusts = []
|
||||
locustColors = []
|
||||
|
||||
recipeIngredients = {}
|
||||
recipeIngredients["h"] = 1 # Red Heart
|
||||
@@ -75,7 +73,6 @@ for item in items_metadataXML.findall('item'):
|
||||
id = int(item.get('id'))
|
||||
if maxItemID < id:
|
||||
maxItemID = id
|
||||
itemIDToPool[id] = []
|
||||
|
||||
# Read itempools.xml
|
||||
itempoolsXML = ET.parse(filePath+'itempools.xml').getroot()
|
||||
@@ -85,20 +82,17 @@ for pool in itempoolsXML.findall('Pool'):
|
||||
for item in pool.findall('Item'):
|
||||
id = int(item.get('Id'))
|
||||
items.append([id,float(item.get('Weight'))])
|
||||
itemIDToPool[id].append(currentpool)
|
||||
itempools[pool.get("Name")] = items
|
||||
currentpool += 1
|
||||
|
||||
# Read pocketitems.xml
|
||||
pocketitemsXML = ET.parse(filePath+'pocketitems.xml').getroot()
|
||||
|
||||
for pilleffect in pocketitemsXML.findall('pilleffect'):
|
||||
pillMetadatas.append({ "id": pilleffect.get('id'), "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')
|
||||
@@ -125,26 +119,12 @@ for line in file_content.split("\n"):
|
||||
file_content = '\n'.join(content)
|
||||
|
||||
locustsXML = ET.ElementTree(ET.fromstring(file_content)).getroot()
|
||||
for color in locustsXML.findall('color'):
|
||||
name = color.get('name')
|
||||
c_r = color.get('r') or 0
|
||||
c_g = color.get('g') or 0
|
||||
c_b = color.get('b') or 0
|
||||
c_or = color.get('or') or 0
|
||||
c_og = color.get('og') or 0
|
||||
c_ob = color.get('ob') or 0
|
||||
locustColors.append({"name": name, "r":c_r, "g":c_g, "b":c_b, "or":c_or, "og":c_og, "ob":c_ob})
|
||||
|
||||
for locust in locustsXML.findall('locust'):
|
||||
id = locust.get('id')
|
||||
# locust entries can have multiple colors defined
|
||||
color = locust.get('color') or "default"
|
||||
colors = []
|
||||
for c in color.split("+"):
|
||||
colors.append(c.split("-")[len(c.split("-"))-1])
|
||||
|
||||
scale = locust.get('scale') or 1
|
||||
speed = locust.get('speed') or 1
|
||||
count = locust.get('count') or 1
|
||||
|
||||
locustFlags1 = locust.get('locustFlags') or locust.get('locustFlag') or -1
|
||||
locustFlags2 = locust.get('locustFlags2') or -1
|
||||
@@ -157,9 +137,6 @@ for locust in locustsXML.findall('locust'):
|
||||
procChance1 = locust.get('procChance') or 1
|
||||
procChance2 = locust.get('procChance2') or 1
|
||||
procChance3 = locust.get('procChance3') or 1
|
||||
count = locust.get('count') or 1
|
||||
|
||||
mutexFlags2 = locust.get('mutexFlags2') or 0
|
||||
|
||||
damageMultiplier1 = locust.get('damageMultiplier') or 1
|
||||
damageMultiplier2 = locust.get('damageMultiplier2') or 1
|
||||
@@ -175,7 +152,6 @@ for locust in locustsXML.findall('locust'):
|
||||
locusts.append(
|
||||
{
|
||||
"id": id,
|
||||
"color": colors,
|
||||
"scale": scale,
|
||||
"speed": speed,
|
||||
"count": count,
|
||||
@@ -190,7 +166,6 @@ for locust in locustsXML.findall('locust'):
|
||||
"procChance3": procChance3,
|
||||
"damageMultiplier1": damageMultiplier1,
|
||||
"damageMultiplier2": damageMultiplier2,
|
||||
"mutexFlags2": mutexFlags2,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -198,12 +173,12 @@ for locust in locustsXML.findall('locust'):
|
||||
|
||||
newfile = open(writeToFile, "w")
|
||||
newfile.write("--This file was autogenerated using 'lookuptable_generator.py' found in the scripts folder\n")
|
||||
newfile.write("--It will have to be updated whenever the game's item XML files are updated\n")
|
||||
newfile.write("--It will have to be updated whenever the game's XML files are updated\n\n")
|
||||
|
||||
|
||||
newfile.write("--The highest item ID found in this specific export of XML data\n")
|
||||
newfile.write("--Crafting doesn't use the in-game enum, because otherwise array index out-of-bounds errors could occur immediately after a game update\n")
|
||||
newfile.write("EID.XMLMaxItemID = "+str(maxItemID) + "\n")
|
||||
newfile.write("EID.XMLMaxItemID = "+str(maxItemID) + "\n\n")
|
||||
|
||||
|
||||
newfile.write("--The fixed recipes, for use in Bag of Crafting\n")
|
||||
@@ -220,43 +195,20 @@ for poolName, data in itempools.items():
|
||||
newfile.write("}\n\n")
|
||||
|
||||
|
||||
newfile.write("--The pools that each item is in, for roughly checking if a given item is unlocked\n")
|
||||
newfile.write("EID.XMLItemIsInPools = {")
|
||||
for itemid, data in itemIDToPool.items():
|
||||
newfile.write("["+str(itemid)+"] = "+str(data).replace("[","{").replace("]","}")+", ")
|
||||
newfile.write("}\n\n")
|
||||
|
||||
|
||||
newfile.write("--Metadata found in Pocketitems.xml\n")
|
||||
newfile.write("--Metadata found in pocketitems.xml (currently only used for pill class)\n")
|
||||
newfile.write("EID.pillMetadata = {")
|
||||
for pill in pillMetadatas:
|
||||
newfile.write("["+pill['id']+"] = {class=\""+str(pill['class'])+"\"}, ")
|
||||
|
||||
newfile.write("}\n\n")
|
||||
|
||||
newfile.write("-- locust colors for Abyss\n")
|
||||
newfile.write("EID.XMLLocustColors = {")
|
||||
for color in locustColors:
|
||||
tempString = ""
|
||||
tempString += "[\""+str(color["name"])+"\"] = {"
|
||||
tempString += str(color["r"])+", "
|
||||
tempString += str(color["g"])+", "
|
||||
tempString += str(color["b"])+", "
|
||||
tempString += str(color["or"])+", "
|
||||
tempString += str(color["og"])+", "
|
||||
tempString += str(color["ob"])+"}, "
|
||||
newfile.write(tempString)
|
||||
newfile.write("}\n\n")
|
||||
|
||||
|
||||
newfile.write("-- effect storage for each locust generated by Abyss\n")
|
||||
newfile.write("--Effect storage for each locust generated by Abyss\n")
|
||||
newfile.write("EID.XMLLocusts = {")
|
||||
counter = 0
|
||||
for locust in locusts:
|
||||
counter = counter+1
|
||||
tempString = ""
|
||||
tempString += "["+str(locust['id'])+"] = {"
|
||||
tempString += ""+str(locust['color']).replace("[","{").replace("]","}")+", "
|
||||
tempString += str(locust['count'])+", "
|
||||
tempString += str(locust['scale'])+", "
|
||||
tempString += str(locust['speed'])+", "
|
||||
@@ -271,8 +223,7 @@ for locust in locusts:
|
||||
tempString += str(locust['procChance2'])+", "
|
||||
tempString += str(locust['procChance3'])+", "
|
||||
tempString += str(locust['damageMultiplier1'])+", "
|
||||
tempString += str(locust['damageMultiplier2'])+", "
|
||||
tempString += str(locust['mutexFlags2'])
|
||||
tempString += str(locust['damageMultiplier2'])
|
||||
tempString += "}, "
|
||||
if counter > 50:
|
||||
newfile.write(tempString+"\n")
|
||||
@@ -281,6 +232,7 @@ for locust in locusts:
|
||||
newfile.write(tempString)
|
||||
newfile.write("}\n\n")
|
||||
|
||||
|
||||
newfile.write("--The name of each entity, for use in glitched item descriptions\n")
|
||||
newfile.write("EID.XMLEntityNames = {")
|
||||
tempString = ""
|
||||
@@ -292,8 +244,8 @@ for entity in entityNames:
|
||||
newfile.write(tempString+"\n")
|
||||
tempString =""
|
||||
counter = 0
|
||||
|
||||
newfile.write("}\n\n")
|
||||
|
||||
|
||||
newfile.close()
|
||||
print("SUCCESS")
|
||||
Reference in new issue
Block a user