2021-01-18 12:10:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
2021-05-20 03:35:35 +00:00
|
|
|
with open("../ingreds.json", "r") as infile:
|
2021-01-18 12:10:28 +00:00
|
|
|
ing_data = json.loads(infile.read())
|
2021-05-20 03:35:35 +00:00
|
|
|
ings = ing_data
|
2021-01-18 12:10:28 +00:00
|
|
|
#this data does not have request :)
|
|
|
|
|
2021-05-20 03:35:35 +00:00
|
|
|
import os
|
2021-05-21 17:57:36 +00:00
|
|
|
if os.path.exists("../ing_map.json"):
|
|
|
|
with open("../ing_map.json","r") as ing_mapfile:
|
2021-05-20 03:35:35 +00:00
|
|
|
ing_map = json.load(ing_mapfile)
|
|
|
|
else:
|
|
|
|
ing_map = {ing["name"]: i for i, ing in enumerate(ings)}
|
|
|
|
texture_names = []
|
|
|
|
|
2021-01-18 12:10:28 +00:00
|
|
|
|
|
|
|
delete_keys = [
|
|
|
|
"addedLore",
|
|
|
|
#"skin",
|
|
|
|
"armorType",
|
|
|
|
"armorColor",
|
|
|
|
"material"
|
|
|
|
]
|
|
|
|
|
|
|
|
ing_translate_mappings = {
|
|
|
|
#"name" : "name",
|
|
|
|
#"tier" :"tier",
|
|
|
|
"level" : "lvl",
|
|
|
|
#"skills" : "skills",
|
|
|
|
"identifications" : "ids",
|
|
|
|
"itemOnlyIDs" : "itemIDs",
|
|
|
|
"consumableOnlyIDs" : "consumableIDs",
|
|
|
|
"ingredientPositionModifiers" : "posMods",
|
|
|
|
}
|
|
|
|
ing_metaID_mappings = {
|
|
|
|
#item only IDs
|
|
|
|
"durabilityModifier": "dura",
|
|
|
|
"strengthRequirement": "strReq",
|
|
|
|
"dexterityRequirement": "dexReq",
|
|
|
|
"intelligenceRequirement": "intReq",
|
|
|
|
"defenceRequirement": "defReq",
|
|
|
|
"agilityRequirement": "agiReq",
|
|
|
|
"attackSpeedModifier": "atkTier",
|
|
|
|
"powderSlotModifier": "slotMod",
|
|
|
|
#consumable only IDs
|
|
|
|
"duration": "dura",
|
|
|
|
#"charges": "charges",
|
|
|
|
#position modifiers
|
|
|
|
#"left": "left",
|
|
|
|
#"right": "right",
|
|
|
|
#"above": "above",
|
|
|
|
#"under": "under",
|
|
|
|
#"touching": "touching",
|
|
|
|
#"notTouching": "notTouching",
|
|
|
|
}
|
|
|
|
ing_id_mappings = { #specifically for the id field of an ingredient.
|
|
|
|
#"name": "name",
|
|
|
|
#"displayName": "displayName",
|
|
|
|
#"tier": "tier",
|
|
|
|
#"set": "set",
|
|
|
|
#"sockets": "slots",
|
|
|
|
#"type": "type",
|
|
|
|
#"armorType": "armorType", (deleted)
|
|
|
|
#"armorColor": "color", (deleted)
|
|
|
|
#"addedLore": "lore", (deleted)
|
|
|
|
#"material": "material", (deleted)
|
|
|
|
#"dropType": "drop",
|
|
|
|
#"quest": "quest",
|
|
|
|
#"restrictions": "restrict",
|
|
|
|
#"damage": "nDam",
|
|
|
|
#"fireDamage": "fDam",
|
|
|
|
#"waterDamage": "wDam",
|
|
|
|
#"airDamage": "aDam",
|
|
|
|
#"thunderDamage": "tDam",
|
|
|
|
#"earthDamage": "eDam",
|
|
|
|
#"ATTACKSPEED": "atkSpd",
|
|
|
|
#"health": "hp",
|
|
|
|
"FIREDEFENSE": "fDefPct",
|
|
|
|
"WATERDEFENSE": "wDefPct",
|
|
|
|
"AIRDEFENSE": "aDefPct",
|
|
|
|
"THUNDERDEFENSE": "tDefPct",
|
|
|
|
"EARTHDEFENSE": "eDefPct",
|
|
|
|
#"level": "lvl",
|
|
|
|
#"classRequirement": "classReq",
|
|
|
|
#"strength": "strReq",
|
|
|
|
#"dexterity": "dexReq",
|
|
|
|
#"intelligence": "intReq",
|
|
|
|
#"agility": "agiReq",
|
|
|
|
#"defense": "defReq",
|
|
|
|
"HEALTHREGEN": "hprPct",
|
|
|
|
"MANAREGEN": "mr",
|
|
|
|
"SPELLDAMAGE": "sdPct",
|
|
|
|
"DAMAGEBONUS": "mdPct",
|
|
|
|
"LIFESTEAL": "ls",
|
|
|
|
"MANASTEAL": "ms",
|
|
|
|
"XPBONUS": "xpb",
|
|
|
|
"LOOTBONUS": "lb",
|
|
|
|
"LOOT_QUALITY": "lq",
|
|
|
|
"REFLECTION": "ref",
|
|
|
|
"STRENGTHPOINTS": "str",
|
|
|
|
"DEXTERITYPOINTS": "dex",
|
|
|
|
"INTELLIGENCEPOINTS": "int",
|
|
|
|
"AGILITYPOINTS": "agi",
|
|
|
|
"DEFENSEPOINTS": "def",
|
|
|
|
"THORNS": "thorns",
|
|
|
|
"EXPLODING": "expd",
|
|
|
|
"SPEED": "spd",
|
|
|
|
"ATTACKSPEED": "atkTier",
|
|
|
|
"POISON": "poison",
|
|
|
|
"HEALTHBONUS": "hpBonus",
|
|
|
|
"SOULPOINTS": "spRegen",
|
|
|
|
"EMERALDSTEALING": "eSteal",
|
|
|
|
"HEALTHREGENRAW": "hprRaw",
|
|
|
|
"SPELLDAMAGERAW": "sdRaw",
|
|
|
|
"DAMAGEBONUSRAW": "mdRaw",
|
|
|
|
"FIREDAMAGEBONUS": "fDamPct",
|
|
|
|
"WATERDAMAGEBONUS": "wDamPct",
|
|
|
|
"AIRDAMAGEBONUS": "aDamPct",
|
|
|
|
"THUNDERDAMAGEBONUS": "tDamPct",
|
|
|
|
"EARTHDAMAGEBONUS": "eDamPct",
|
|
|
|
#"accessoryType": "type",
|
|
|
|
#"identified": "fixID",
|
|
|
|
#"skin": "skin",
|
|
|
|
#"category": "category",
|
|
|
|
#THESE ARE NOT IN ANY INGREDIENT YET. THEY MAY NOT HAVE THE CORRECT ID NAME
|
|
|
|
"SPELLCOSTPCT1": "spPct1",
|
|
|
|
"SPELLCOSTRAW1": "spRaw1",
|
|
|
|
"SPELLCOSTPCT2": "spPct2",
|
|
|
|
"SPELLCOSTRAW2": "spRaw2",
|
|
|
|
"SPELLCOSTPCT3": "spPct3",
|
|
|
|
"SPELLCOSTRAW3": "spRaw3",
|
|
|
|
"SPELLCOSTPCT4": "spPct4",
|
|
|
|
"SPELLCOSTRAW4": "spRaw4",
|
2021-01-29 02:31:31 +00:00
|
|
|
"JUMP_HEIGHT": "jh",
|
2021-01-18 12:10:28 +00:00
|
|
|
#"rainbowSpellDamageRaw": "rainbowRaw",
|
2021-01-29 02:31:31 +00:00
|
|
|
"STAMINA": "sprint",
|
|
|
|
"STAMINA_REGEN": "sprintReg",
|
|
|
|
"GATHER_XP_BONUS": "gXp",
|
|
|
|
"GATHER_SPEED": "gSpd",
|
2021-01-18 12:10:28 +00:00
|
|
|
#"lootQuality": "lq",
|
|
|
|
}
|
|
|
|
ing_delete_keys = [
|
|
|
|
"sprite",
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2021-05-20 03:35:35 +00:00
|
|
|
print("loaded all files.")
|
2021-01-18 12:10:28 +00:00
|
|
|
|
|
|
|
print(ings[0])
|
|
|
|
for ing in ings:
|
|
|
|
for key in ing_delete_keys:
|
|
|
|
if key in ing:
|
|
|
|
del ing[key]
|
|
|
|
|
|
|
|
for k, v in ing_translate_mappings.items():
|
|
|
|
if k in ing:
|
|
|
|
ing[v] = ing[k]
|
|
|
|
del ing[k]
|
|
|
|
|
|
|
|
for k, v in ing_metaID_mappings.items():
|
|
|
|
if k in ing['itemIDs']:
|
2021-05-20 03:35:35 +00:00
|
|
|
print(ing['name'])
|
2021-01-18 12:10:28 +00:00
|
|
|
ing['itemIDs'][v] = ing['itemIDs'][k]
|
|
|
|
del ing['itemIDs'][k]
|
|
|
|
elif k in ing['consumableIDs']:
|
|
|
|
ing['consumableIDs'][v] = ing['consumableIDs'][k]
|
|
|
|
del ing['consumableIDs'][k]
|
|
|
|
'''elif k in ing.posMods: #Not subbing, if we do sub uncomment this.
|
|
|
|
ing.posMods[v] = ing.posMods[k]
|
|
|
|
del ing.posMods[k] '''
|
|
|
|
|
|
|
|
for k, v in ing_id_mappings.items():
|
|
|
|
if k in ing['ids']: #yes this is dumb
|
|
|
|
ing['ids'][v] = ing['ids'][k]
|
|
|
|
del ing['ids'][k]
|
2021-01-29 02:31:31 +00:00
|
|
|
|
|
|
|
if not (ing["name"] in ing_map):
|
|
|
|
ing_map[ing["name"]] = len(ing_map)
|
|
|
|
print(f'New Ingred: {ing["name"]}')
|
|
|
|
ing["id"] = ing_map[ing["name"]]
|
2021-01-18 12:10:28 +00:00
|
|
|
|
|
|
|
|
2021-05-20 03:35:35 +00:00
|
|
|
with open("../ingreds_clean.json", "w") as outfile:
|
2021-01-18 12:10:28 +00:00
|
|
|
json.dump(ing_data, outfile, indent = 2)
|
2021-05-20 03:35:35 +00:00
|
|
|
with open("../ingreds_compress.json", "w") as outfile:
|
2021-01-18 12:10:28 +00:00
|
|
|
json.dump(ing_data, outfile)
|
2021-05-20 03:35:35 +00:00
|
|
|
with open("../ing_map.json", "w") as ing_mapfile:
|
2021-01-29 02:31:31 +00:00
|
|
|
json.dump(ing_map, ing_mapfile, indent = 2)
|
2021-05-20 03:35:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
print('All ing jsons updated.')
|