Refactor out ingredient code, update necrosis
This commit is contained in:
parent
67d0fbbb29
commit
9ea117c746
8 changed files with 501 additions and 280 deletions
10
builder.js
10
builder.js
|
@ -1,16 +1,9 @@
|
||||||
/*
|
|
||||||
* TESTING SECTION
|
|
||||||
*/
|
|
||||||
|
|
||||||
const url_base = location.href.split("#")[0];
|
const url_base = location.href.split("#")[0];
|
||||||
const url_tag = location.hash.slice(1);
|
const url_tag = location.hash.slice(1);
|
||||||
console.log(url_base);
|
console.log(url_base);
|
||||||
console.log(url_tag);
|
console.log(url_tag);
|
||||||
|
|
||||||
/*
|
const BUILD_VERSION = "6.9.3";
|
||||||
* END testing section
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function setTitle() {
|
function setTitle() {
|
||||||
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
||||||
|
@ -464,6 +457,7 @@ function calculateBuild(save_skp, skp){
|
||||||
for (let i of document.getElementsByClassName("hide-container-grid")) {
|
for (let i of document.getElementsByClassName("hide-container-grid")) {
|
||||||
i.style.display = "grid";
|
i.style.display = "grid";
|
||||||
}
|
}
|
||||||
|
document.getElementById("int-info-div").style.display = "none";
|
||||||
|
|
||||||
console.log(player_build.toString());
|
console.log(player_build.toString());
|
||||||
displayEquipOrder(document.getElementById("build-order"),player_build.equip_order);
|
displayEquipOrder(document.getElementById("build-order"),player_build.equip_order);
|
||||||
|
|
|
@ -270652,7 +270652,7 @@
|
||||||
"restrict": "1.20 item",
|
"restrict": "1.20 item",
|
||||||
"fixID": false,
|
"fixID": false,
|
||||||
"strReq": 0,
|
"strReq": 0,
|
||||||
"dexReq": 105,
|
"dexReq": 120,
|
||||||
"intReq": 0,
|
"intReq": 0,
|
||||||
"defReq": 0,
|
"defReq": 0,
|
||||||
"agiReq": 0,
|
"agiReq": 0,
|
||||||
|
|
|
@ -6,5 +6,5 @@ The game, of course
|
||||||
|
|
||||||
Additional Contributors:
|
Additional Contributors:
|
||||||
- QuantumNep (Layout code/layout ideas)
|
- QuantumNep (Layout code/layout ideas)
|
||||||
- dr_carlos (Hiding UI elements, misc. fixes)
|
- dr_carlos (Hiding UI elements properly, fade animations, proper error handling)
|
||||||
- Atlas Inc discord (feedback, ideas, etc)
|
- Atlas Inc discord (feedback, ideas, etc)
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
<div class="header" id="header">
|
<div class="header" id="header">
|
||||||
Wynn build calculator
|
Wynn build calculator
|
||||||
</div>
|
</div>
|
||||||
|
<div class="center" id="help">
|
||||||
|
<a href="https://forums.wynncraft.com/threads/wynnbuilder-release-thread-and-some-damage-calculation-updates.281438">Forum thread (instructions/help)</a>
|
||||||
|
</div>
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<div class="equipment" style="grid-column:1/span 2;grid-row:1">
|
<div class="equipment" style="grid-column:1/span 2;grid-row:1">
|
||||||
<div style="grid-column:1/span 2;grid-row:1">
|
<div style="grid-column:1/span 2;grid-row:1">
|
||||||
|
@ -572,13 +575,12 @@
|
||||||
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1; display: none;">
|
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1; display: none;">
|
||||||
<div class = "center" id = "set-info">Set info</div>
|
<div class = "center" id = "set-info">Set info</div>
|
||||||
</div>
|
</div>
|
||||||
<div class = "center int-info" id = "int-info-div" style = "grid-column:4;grid-row:1;visibility:visible;">
|
<div class = "center int-info" id = "int-info-div" style = "grid-column:4;grid-row:1; display: none;">
|
||||||
<div class = "center" id = "int-info">Next Spell Costs</div>
|
<div class = "center" id = "int-info">Next Spell Costs</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="center" id="header2">
|
<div class="center" id="header2">
|
||||||
<p>Made by <b class = "hppeng">hppeng</b> and <b class = "ferricles">ferricles</b> with Atlas Inc (JavaScript required to function, nothing works without js)</p>
|
<p>Made by <b class = "hppeng">hppeng</b> and <b class = "ferricles">ferricles</b> with Atlas Inc (JavaScript required to function, nothing works without js)</p>
|
||||||
<p>Hard refresh the page (Ctrl+Shift+R on windows/chrome) if it isn't updating correctly.</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="center" id="credits">
|
<div class="center" id="credits">
|
||||||
<a href="credits.txt" class="link">Additional credits</a>
|
<a href="credits.txt" class="link">Additional credits</a>
|
||||||
|
@ -589,7 +591,6 @@
|
||||||
<script type="text/javascript" src="damage_calc.js"></script>
|
<script type="text/javascript" src="damage_calc.js"></script>
|
||||||
<script type="text/javascript" src="display.js"></script>
|
<script type="text/javascript" src="display.js"></script>
|
||||||
<script type="text/javascript" src="build.js"></script>
|
<script type="text/javascript" src="build.js"></script>
|
||||||
<script type="text/javascript" src="craft.js"></script>
|
|
||||||
<script type="text/javascript" src="load.js"></script>
|
<script type="text/javascript" src="load.js"></script>
|
||||||
<script type="text/javascript" src="builder.js"></script>
|
<script type="text/javascript" src="builder.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
359
ing_transform_combine.py
Normal file
359
ing_transform_combine.py
Normal file
|
@ -0,0 +1,359 @@
|
||||||
|
"""
|
||||||
|
|
||||||
|
NOTE!!!!!!!
|
||||||
|
|
||||||
|
DEMON TIDE 1.20 IS HARD CODED!
|
||||||
|
|
||||||
|
AMBIVALENCE IS REMOVED!
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
with open("dump.json", "r") as infile:
|
||||||
|
data = json.loads(infile.read())
|
||||||
|
|
||||||
|
items = data["items"]
|
||||||
|
del data["request"]
|
||||||
|
|
||||||
|
with open("recipes_compress.json", "r") as infile:
|
||||||
|
recipe_data = json.loads(infile.read())
|
||||||
|
recipes = recipe_data["recipes"]
|
||||||
|
#this data does not have request :)
|
||||||
|
with open("ingreds_compress.json", "r") as infile:
|
||||||
|
ing_data = json.loads(infile.read())
|
||||||
|
ings = ing_data["ingredients"]
|
||||||
|
#this data does not have request :)
|
||||||
|
import os
|
||||||
|
sets = dict()
|
||||||
|
item_set_map = dict()
|
||||||
|
for filename in os.listdir('sets'):
|
||||||
|
if "json" not in filename:
|
||||||
|
continue
|
||||||
|
set_name = filename[1:].split(".")[0].replace("+", " ").replace("%27", "'")
|
||||||
|
with open("sets/"+filename) as set_info:
|
||||||
|
set_obj = json.load(set_info)
|
||||||
|
for item in set_obj["items"]:
|
||||||
|
item_set_map[item] = set_name
|
||||||
|
sets[set_name] = set_obj
|
||||||
|
|
||||||
|
data["sets"] = sets
|
||||||
|
|
||||||
|
translate_mappings = { #this is used for items.
|
||||||
|
#"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": "fDef",
|
||||||
|
"waterDefense": "wDef",
|
||||||
|
"airDefense": "aDef",
|
||||||
|
"thunderDefense": "tDef",
|
||||||
|
"earthDefense": "eDef",
|
||||||
|
"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",
|
||||||
|
"reflection": "ref",
|
||||||
|
"strengthPoints": "str",
|
||||||
|
"dexterityPoints": "dex",
|
||||||
|
"intelligencePoints": "int",
|
||||||
|
"agilityPoints": "agi",
|
||||||
|
"defensePoints": "def",
|
||||||
|
#"thorns": "thorns",
|
||||||
|
"exploding": "expd",
|
||||||
|
"speed": "spd",
|
||||||
|
"attackSpeedBonus": "atkTier",
|
||||||
|
#"poison": "poison",
|
||||||
|
"healthBonus": "hpBonus",
|
||||||
|
"soulPoints": "spRegen",
|
||||||
|
"emeraldStealing": "eSteal",
|
||||||
|
"healthRegenRaw": "hprRaw",
|
||||||
|
"spellDamageRaw": "sdRaw",
|
||||||
|
"damageBonusRaw": "mdRaw",
|
||||||
|
"bonusFireDamage": "fDamPct",
|
||||||
|
"bonusWaterDamage": "wDamPct",
|
||||||
|
"bonusAirDamage": "aDamPct",
|
||||||
|
"bonusThunderDamage": "tDamPct",
|
||||||
|
"bonusEarthDamage": "eDamPct",
|
||||||
|
"bonusFireDefense": "fDefPct",
|
||||||
|
"bonusWaterDefense": "wDefPct",
|
||||||
|
"bonusAirDefense": "aDefPct",
|
||||||
|
"bonusThunderDefense": "tDefPct",
|
||||||
|
"bonusEarthDefense": "eDefPct",
|
||||||
|
"accessoryType": "type",
|
||||||
|
"identified": "fixID",
|
||||||
|
#"skin": "skin",
|
||||||
|
#"category": "category",
|
||||||
|
|
||||||
|
"spellCostPct1": "spPct1",
|
||||||
|
"spellCostRaw1": "spRaw1",
|
||||||
|
"spellCostPct2": "spPct2",
|
||||||
|
"spellCostRaw2": "spRaw2",
|
||||||
|
"spellCostPct3": "spPct3",
|
||||||
|
"spellCostRaw3": "spRaw3",
|
||||||
|
"spellCostPct4": "spPct4",
|
||||||
|
"spellCostRaw4": "spRaw4",
|
||||||
|
|
||||||
|
"rainbowSpellDamageRaw": "rainbowRaw",
|
||||||
|
#"sprint": "sprint",
|
||||||
|
"sprintRegen": "sprintReg",
|
||||||
|
"jumpHeight": "jh",
|
||||||
|
"lootQuality": "lq",
|
||||||
|
|
||||||
|
"gatherXpBonus": "gXp",
|
||||||
|
"gatherSpeed": "gSpd",
|
||||||
|
}
|
||||||
|
|
||||||
|
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",
|
||||||
|
"JUMPHEIGHT": "jh",
|
||||||
|
#"rainbowSpellDamageRaw": "rainbowRaw",
|
||||||
|
"SPRINT": "sprint",
|
||||||
|
"SPRINGREGEN": "sprintReg",
|
||||||
|
"GATHERXPBONUS": "gXp",
|
||||||
|
"GATHERSPEED": "gSpd",
|
||||||
|
#"lootQuality": "lq",
|
||||||
|
}
|
||||||
|
ing_delete_keys = [
|
||||||
|
"sprite",
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
recipe_translate_mappings = {
|
||||||
|
"level" : "lvl",
|
||||||
|
}
|
||||||
|
recipe_delete_keys = [ #lol
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
import os
|
||||||
|
if os.path.exists("id_map.json"):
|
||||||
|
with open("id_map.json","r") as id_mapfile:
|
||||||
|
id_map = json.load(id_mapfile)
|
||||||
|
else:
|
||||||
|
id_map = {item["name"]: i for i, item in enumerate(items)}
|
||||||
|
# wtf is this hpp
|
||||||
|
|
||||||
|
texture_names = []
|
||||||
|
|
||||||
|
import base64
|
||||||
|
for item in items:
|
||||||
|
for key in delete_keys:
|
||||||
|
if key in item:
|
||||||
|
del item[key]
|
||||||
|
|
||||||
|
for k, v in translate_mappings.items():
|
||||||
|
if k in item:
|
||||||
|
item[v] = item[k]
|
||||||
|
del item[k]
|
||||||
|
|
||||||
|
if not (item["name"] in id_map):
|
||||||
|
id_map[item["name"]] = len(id_map)
|
||||||
|
print(f'New item: {item["name"]}')
|
||||||
|
item["id"] = id_map[item["name"]]
|
||||||
|
|
||||||
|
item["type"] = item["type"].lower()
|
||||||
|
if item["name"] in item_set_map:
|
||||||
|
item["set"] = item_set_map[item["name"]]
|
||||||
|
|
||||||
|
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']:
|
||||||
|
print(ing['itemIDs'])
|
||||||
|
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]
|
||||||
|
|
||||||
|
|
||||||
|
for recipe in recipes:
|
||||||
|
for key in recipe_delete_keys:
|
||||||
|
if key in recipe:
|
||||||
|
del recipe[key]
|
||||||
|
|
||||||
|
for k, v in recipe_translate_mappings.items():
|
||||||
|
if k in recipe:
|
||||||
|
recipe[v] = recipe[k]
|
||||||
|
del recipe[k]
|
||||||
|
|
||||||
|
|
||||||
|
with open("1_20_ci.json", "r") as ci_file:
|
||||||
|
ci_items = json.load(ci_file)
|
||||||
|
items.extend(ci_items)
|
||||||
|
|
||||||
|
'''with open("id_map.json","w") as id_mapfile:
|
||||||
|
json.dump(id_map, id_mapfile, indent=2)
|
||||||
|
with open("clean.json", "w") as outfile:
|
||||||
|
json.dump(data, outfile, indent=2)
|
||||||
|
with open("compress.json", "w") as outfile:
|
||||||
|
json.dump(data, outfile)'''
|
||||||
|
with open("ingreds_clean.json", "w") as outfile:
|
||||||
|
json.dump(ing_data, outfile, indent = 2)
|
||||||
|
with open("ingreds_compress2.json", "w") as outfile:
|
||||||
|
json.dump(ing_data, outfile)
|
||||||
|
with open("recipes_clean.json", "w") as outfile:
|
||||||
|
json.dump(recipe_data, outfile, indent = 2)
|
||||||
|
with open("recipes_compress2.json", "w") as outfile:
|
||||||
|
json.dump(recipe_data, outfile)
|
82
load.js
82
load.js
|
@ -1,24 +1,18 @@
|
||||||
const DB_VERSION = 20;
|
const DB_VERSION = 21;
|
||||||
const BUILD_VERSION = "6.9.2";
|
|
||||||
|
|
||||||
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
|
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
|
||||||
|
|
||||||
let db;
|
let db;
|
||||||
let reload = false;
|
let reload = false;
|
||||||
let items;
|
let items;
|
||||||
let sets;
|
let sets;
|
||||||
let ings;
|
|
||||||
let recipes;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load item set from local DB. Calls init() on success.
|
* Load item set from local DB. Calls init() on success.
|
||||||
*/
|
*/
|
||||||
async function load_local(init_func) {
|
async function load_local(init_func) {
|
||||||
let get_tx = db.transaction(['item_db', 'set_db', 'ing_db', 'recipe_db'], 'readonly');
|
let get_tx = db.transaction(['item_db', 'set_db'], 'readonly');
|
||||||
let sets_store = get_tx.objectStore('set_db');
|
let sets_store = get_tx.objectStore('set_db');
|
||||||
let get_store = get_tx.objectStore('item_db');
|
let get_store = get_tx.objectStore('item_db');
|
||||||
let ings_store = get_tx.objectStore('ing_db');
|
|
||||||
let recipes_store = get_tx.objectStore('recipe_db');
|
|
||||||
let request = get_store.getAll();
|
let request = get_store.getAll();
|
||||||
request.onerror = function(event) {
|
request.onerror = function(event) {
|
||||||
console.log("Could not read local item db...");
|
console.log("Could not read local item db...");
|
||||||
|
@ -44,25 +38,8 @@ async function load_local(init_func) {
|
||||||
console.log(sets);
|
console.log(sets);
|
||||||
init_func();
|
init_func();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let request3 = ings_store.getAll();
|
|
||||||
request3.onerror = function(event) {
|
|
||||||
console.log("Could not read local ingredient db...");
|
|
||||||
}
|
|
||||||
request3.onsuccess = function(event) {
|
|
||||||
console.log("Successfully read local ingredient db.");
|
|
||||||
ings = request3.result;
|
|
||||||
}
|
|
||||||
let request4 = recipes_store.getAll();
|
|
||||||
request4.onerror = function(event) {
|
|
||||||
console.log("Could not read local recipe db...");
|
|
||||||
}
|
|
||||||
request4.onsuccess = function(event) {
|
|
||||||
console.log("Successfully read local recipe db.");
|
|
||||||
recipes = request4.result;
|
|
||||||
}
|
|
||||||
await get_tx.complete;
|
await get_tx.complete;
|
||||||
db.close();
|
db.close();
|
||||||
}
|
}
|
||||||
|
@ -87,32 +64,9 @@ async function load(init_func) {
|
||||||
let getUrl = window.location;
|
let getUrl = window.location;
|
||||||
let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
||||||
let url = baseUrl + "/compress.json";
|
let url = baseUrl + "/compress.json";
|
||||||
url = url.replace("/crafter.html", ""); //JANK
|
|
||||||
let result = await (await fetch(url)).json();
|
let result = await (await fetch(url)).json();
|
||||||
items = result.items;
|
items = result.items;
|
||||||
sets = result.sets;
|
sets = result.sets;
|
||||||
url = url.replace("/compress.json", "/ingreds_compress.json");
|
|
||||||
result = await (await fetch(url)).json();
|
|
||||||
ings = result.ingredients;
|
|
||||||
url = url.replace("/ingreds_compress.json", "/recipes_compress.json");
|
|
||||||
result = await (await fetch(url)).json();
|
|
||||||
recipes = result.recipes;
|
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/clear
|
|
||||||
let clear_tx = db.transaction(['item_db', 'set_db'], 'readwrite');
|
|
||||||
let clear_items = clear_tx.objectStore('item_db');
|
|
||||||
let clear_sets = clear_tx.objectStore('item_db');
|
|
||||||
let clear_tx2 = db.transaction(['ing_db'], 'readwrite');
|
|
||||||
let clear_ings = clear_tx2.objectStore('ing_db');
|
|
||||||
let clear_tx3 = db.transaction(['recipe_db'], 'readwrite');
|
|
||||||
let clear_recipes = clear_tx3.objectStore('recipe_db');
|
|
||||||
await clear_items.clear();
|
|
||||||
await clear_sets.clear();
|
|
||||||
await clear_ings.clear();
|
|
||||||
await clear_recipes.clear();
|
|
||||||
await clear_tx.complete;
|
|
||||||
await clear_tx2.complete;
|
|
||||||
await clear_tx3.complete;
|
|
||||||
|
|
||||||
let add_tx = db.transaction(['item_db', 'set_db'], 'readwrite');
|
let add_tx = db.transaction(['item_db', 'set_db'], 'readwrite');
|
||||||
let items_store = add_tx.objectStore('item_db');
|
let items_store = add_tx.objectStore('item_db');
|
||||||
|
@ -125,20 +79,7 @@ async function load(init_func) {
|
||||||
for (const set in sets) {
|
for (const set in sets) {
|
||||||
add_promises.push(sets_store.add(sets[set], set));
|
add_promises.push(sets_store.add(sets[set], set));
|
||||||
}
|
}
|
||||||
|
|
||||||
let add_tx2 = db.transaction(['ing_db'], 'readwrite');
|
|
||||||
let ings_store = add_tx2.objectStore('ing_db');
|
|
||||||
for (const ing in ings) {
|
|
||||||
add_promises.push(ings_store.add(ings[ing], ing));
|
|
||||||
}
|
|
||||||
let add_tx3 = db.transaction(['recipe_db'], 'readwrite');
|
|
||||||
let recipes_store = add_tx3.objectStore('recipe_db');
|
|
||||||
for (const recipe in recipes) {
|
|
||||||
add_promises.push(recipes_store.add(recipes[recipe], recipe));
|
|
||||||
}
|
|
||||||
add_promises.push(add_tx.complete);
|
add_promises.push(add_tx.complete);
|
||||||
add_promises.push(add_tx2.complete);
|
|
||||||
add_promises.push(add_tx3.complete);
|
|
||||||
Promise.all(add_promises).then((values) => {
|
Promise.all(add_promises).then((values) => {
|
||||||
db.close();
|
db.close();
|
||||||
init_func();
|
init_func();
|
||||||
|
@ -146,11 +87,11 @@ async function load(init_func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_init(init_func) {
|
function load_init(init_func) {
|
||||||
|
let request = window.indexedDB.open('item_db', DB_VERSION);
|
||||||
|
|
||||||
let request = window.indexedDB.open("ing_db", DB_VERSION)
|
|
||||||
request.onerror = function() {
|
request.onerror = function() {
|
||||||
console.log("DB failed to open...");
|
console.log("DB failed to open...");
|
||||||
}
|
};
|
||||||
|
|
||||||
request.onsuccess = function() {
|
request.onsuccess = function() {
|
||||||
db = request.result;
|
db = request.result;
|
||||||
|
@ -181,22 +122,9 @@ function load_init(init_func) {
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log("Could not delete set DB. This is probably fine");
|
console.log("Could not delete set DB. This is probably fine");
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
db.deleteObjectStore('ing_db');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("Could not delete ingredient DB. This is probably fine");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
db.deleteObjectStore('recipe_db');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("Could not delete recipe DB. This is probably fine");
|
|
||||||
}
|
|
||||||
db.createObjectStore('item_db');
|
db.createObjectStore('item_db');
|
||||||
db.createObjectStore('set_db');
|
db.createObjectStore('set_db');
|
||||||
db.createObjectStore('ing_db');
|
|
||||||
db.createObjectStore('recipe_db');
|
|
||||||
|
|
||||||
console.log("DB setup complete...");
|
console.log("DB setup complete...");
|
||||||
}
|
}
|
||||||
|
|
124
load_ing.js
Normal file
124
load_ing.js
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
const ING_DB_VERSION = 1;
|
||||||
|
|
||||||
|
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
|
||||||
|
|
||||||
|
let db;
|
||||||
|
let reload = false;
|
||||||
|
let ings;
|
||||||
|
let recipes;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load item set from local DB. Calls init() on success.
|
||||||
|
*/
|
||||||
|
async function ing_load_local(init_func) {
|
||||||
|
let get_tx = db.transaction(['ing_db', 'recipe_db'], 'readonly');
|
||||||
|
let ings_store = get_tx.objectStore('ing_db');
|
||||||
|
let recipes_store = get_tx.objectStore('recipe_db');
|
||||||
|
let request3 = ings_store.getAll();
|
||||||
|
request3.onerror = function(event) {
|
||||||
|
console.log("Could not read local ingredient db...");
|
||||||
|
}
|
||||||
|
request3.onsuccess = function(event) {
|
||||||
|
console.log("Successfully read local ingredient db.");
|
||||||
|
ings = request3.result;
|
||||||
|
}
|
||||||
|
let request4 = recipes_store.getAll();
|
||||||
|
request4.onerror = function(event) {
|
||||||
|
console.log("Could not read local recipe db...");
|
||||||
|
}
|
||||||
|
request4.onsuccess = function(event) {
|
||||||
|
console.log("Successfully read local recipe db.");
|
||||||
|
recipes = request4.result;
|
||||||
|
}
|
||||||
|
await get_tx.complete;
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load item set from remote DB (aka a big json file). Calls init() on success.
|
||||||
|
*/
|
||||||
|
async function load_ings(init_func) {
|
||||||
|
|
||||||
|
let getUrl = window.location;
|
||||||
|
let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
||||||
|
let url = baseUrl + "/ingreds_compress.json";
|
||||||
|
url = url.replace("/crafter.html", ""); //JANK
|
||||||
|
let result = await (await fetch(url)).json();
|
||||||
|
|
||||||
|
result = await (await fetch(url)).json();
|
||||||
|
ings = result.ingredients;
|
||||||
|
|
||||||
|
url = url.replace("/ingreds_compress.json", "/recipes_compress.json");
|
||||||
|
result = await (await fetch(url)).json();
|
||||||
|
recipes = result.recipes;
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/clear
|
||||||
|
let clear_tx2 = db.transaction(['ing_db'], 'readwrite');
|
||||||
|
let clear_ings = clear_tx2.objectStore('ing_db');
|
||||||
|
let clear_tx3 = db.transaction(['recipe_db'], 'readwrite');
|
||||||
|
let clear_recipes = clear_tx3.objectStore('recipe_db');
|
||||||
|
await clear_ings.clear();
|
||||||
|
await clear_recipes.clear();
|
||||||
|
await clear_tx2.complete;
|
||||||
|
await clear_tx3.complete;
|
||||||
|
|
||||||
|
let add_tx2 = db.transaction(['ing_db'], 'readwrite');
|
||||||
|
let ings_store = add_tx2.objectStore('ing_db');
|
||||||
|
for (const ing in ings) {
|
||||||
|
add_promises.push(ings_store.add(ings[ing], ing));
|
||||||
|
}
|
||||||
|
let add_tx3 = db.transaction(['recipe_db'], 'readwrite');
|
||||||
|
let recipes_store = add_tx3.objectStore('recipe_db');
|
||||||
|
for (const recipe in recipes) {
|
||||||
|
add_promises.push(recipes_store.add(recipes[recipe], recipe));
|
||||||
|
}
|
||||||
|
add_promises.push(add_tx2.complete);
|
||||||
|
add_promises.push(add_tx3.complete);
|
||||||
|
Promise.all(add_promises).then((values) => {
|
||||||
|
db.close();
|
||||||
|
init_func();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function load_ing_init(init_func) {
|
||||||
|
|
||||||
|
let request = window.indexedDB.open("ing_db", DB_VERSION)
|
||||||
|
request.onerror = function() {
|
||||||
|
console.log("DB failed to open...");
|
||||||
|
}
|
||||||
|
|
||||||
|
request.onsuccess = function() {
|
||||||
|
db = request.result;
|
||||||
|
if (!reload) {
|
||||||
|
console.log("Using stored data...")
|
||||||
|
load_local(init_func);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("Using new data...")
|
||||||
|
load(init_func);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
request.onupgradeneeded = function(e) {
|
||||||
|
reload = true;
|
||||||
|
|
||||||
|
let db = e.target.result;
|
||||||
|
|
||||||
|
try {
|
||||||
|
db.deleteObjectStore('ing_db');
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log("Could not delete ingredient DB. This is probably fine");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
db.deleteObjectStore('recipe_db');
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log("Could not delete recipe DB. This is probably fine");
|
||||||
|
}
|
||||||
|
db.createObjectStore('ing_db');
|
||||||
|
db.createObjectStore('recipe_db');
|
||||||
|
|
||||||
|
console.log("DB setup complete...");
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,14 +16,6 @@ with open("dump.json", "r") as infile:
|
||||||
items = data["items"]
|
items = data["items"]
|
||||||
del data["request"]
|
del data["request"]
|
||||||
|
|
||||||
with open("recipes_compress.json", "r") as infile:
|
|
||||||
recipe_data = json.loads(infile.read())
|
|
||||||
recipes = recipe_data["recipes"]
|
|
||||||
#this data does not have request :)
|
|
||||||
with open("ingreds_compress.json", "r") as infile:
|
|
||||||
ing_data = json.loads(infile.read())
|
|
||||||
ings = ing_data["ingredients"]
|
|
||||||
#this data does not have request :)
|
|
||||||
import os
|
import os
|
||||||
sets = dict()
|
sets = dict()
|
||||||
item_set_map = dict()
|
item_set_map = dict()
|
||||||
|
@ -39,7 +31,7 @@ for filename in os.listdir('sets'):
|
||||||
|
|
||||||
data["sets"] = sets
|
data["sets"] = sets
|
||||||
|
|
||||||
translate_mappings = { #this is used for items.
|
translate_mappings = {
|
||||||
#"name": "name",
|
#"name": "name",
|
||||||
#"displayName": "displayName",
|
#"displayName": "displayName",
|
||||||
#"tier": "tier",
|
#"tier": "tier",
|
||||||
|
@ -140,142 +132,13 @@ delete_keys = [
|
||||||
"material"
|
"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",
|
|
||||||
"JUMPHEIGHT": "jh",
|
|
||||||
#"rainbowSpellDamageRaw": "rainbowRaw",
|
|
||||||
"SPRINT": "sprint",
|
|
||||||
"SPRINGREGEN": "sprintReg",
|
|
||||||
"GATHERXPBONUS": "gXp",
|
|
||||||
"GATHERSPEED": "gSpd",
|
|
||||||
#"lootQuality": "lq",
|
|
||||||
}
|
|
||||||
ing_delete_keys = [
|
|
||||||
"sprite",
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
recipe_translate_mappings = {
|
|
||||||
"level" : "lvl",
|
|
||||||
}
|
|
||||||
recipe_delete_keys = [ #lol
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
if os.path.exists("id_map.json"):
|
if os.path.exists("id_map.json"):
|
||||||
with open("id_map.json","r") as id_mapfile:
|
with open("id_map.json","r") as id_mapfile:
|
||||||
id_map = json.load(id_mapfile)
|
id_map = json.load(id_mapfile)
|
||||||
else:
|
else:
|
||||||
id_map = {item["name"]: i for i, item in enumerate(items)}
|
id_map = {item["name"]: i for i, item in enumerate(items)}
|
||||||
# wtf is this hpp
|
|
||||||
|
|
||||||
texture_names = []
|
texture_names = []
|
||||||
|
|
||||||
|
@ -299,61 +162,13 @@ for item in items:
|
||||||
if item["name"] in item_set_map:
|
if item["name"] in item_set_map:
|
||||||
item["set"] = item_set_map[item["name"]]
|
item["set"] = item_set_map[item["name"]]
|
||||||
|
|
||||||
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']:
|
|
||||||
print(ing['itemIDs'])
|
|
||||||
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]
|
|
||||||
|
|
||||||
|
|
||||||
for recipe in recipes:
|
|
||||||
for key in recipe_delete_keys:
|
|
||||||
if key in recipe:
|
|
||||||
del recipe[key]
|
|
||||||
|
|
||||||
for k, v in recipe_translate_mappings.items():
|
|
||||||
if k in recipe:
|
|
||||||
recipe[v] = recipe[k]
|
|
||||||
del recipe[k]
|
|
||||||
|
|
||||||
|
|
||||||
with open("1_20_ci.json", "r") as ci_file:
|
with open("1_20_ci.json", "r") as ci_file:
|
||||||
ci_items = json.load(ci_file)
|
ci_items = json.load(ci_file)
|
||||||
items.extend(ci_items)
|
items.extend(ci_items)
|
||||||
|
|
||||||
'''with open("id_map.json","w") as id_mapfile:
|
with open("id_map.json","w") as id_mapfile:
|
||||||
json.dump(id_map, id_mapfile, indent=2)
|
json.dump(id_map, id_mapfile, indent=2)
|
||||||
with open("clean.json", "w") as outfile:
|
with open("clean.json", "w") as outfile:
|
||||||
json.dump(data, outfile, indent=2)
|
json.dump(data, outfile, indent=2)
|
||||||
with open("compress.json", "w") as outfile:
|
with open("compress.json", "w") as outfile:
|
||||||
json.dump(data, outfile)'''
|
json.dump(data, outfile)
|
||||||
with open("ingreds_clean.json", "w") as outfile:
|
|
||||||
json.dump(ing_data, outfile, indent = 2)
|
|
||||||
with open("ingreds_compress2.json", "w") as outfile:
|
|
||||||
json.dump(ing_data, outfile)
|
|
||||||
with open("recipes_clean.json", "w") as outfile:
|
|
||||||
json.dump(recipe_data, outfile, indent = 2)
|
|
||||||
with open("recipes_compress2.json", "w") as outfile:
|
|
||||||
json.dump(recipe_data, outfile)
|
|
Loading…
Reference in a new issue