Merge branch 'dev' of git://github.com/wynnbuilder/wynnbuilder.github.io

This commit is contained in:
dr-carlos 2021-01-19 07:47:48 +10:30
commit d231e0a092
12 changed files with 886 additions and 319 deletions

View file

@ -409,14 +409,10 @@ class Build{
}
}
}
statMap.set("poisonPct", 100);
// The stuff relevant for damage calculation!!! @ferricles
statMap.set("atkSpd", this.weapon.get("atkSpd"));
statMap.set("damageRaw", [this.weapon.get("nDam"), this.weapon.get("eDam"), this.weapon.get("tDam"), this.weapon.get("wDam"), this.weapon.get("fDam"), this.weapon.get("aDam")]);
statMap.set("damageBonus", [statMap.get("eDamPct"), statMap.get("tDamPct"), statMap.get("wDamPct"), statMap.get("fDamPct"), statMap.get("aDamPct")]);
statMap.set("defRaw", [statMap.get("eDam"), statMap.get("tDef"), statMap.get("wDef"), statMap.get("fDef"), statMap.get("aDef")]);
statMap.set("defBonus", [statMap.get("eDamPct"), statMap.get("tDefPct"), statMap.get("wDefPct"), statMap.get("fDefPct"), statMap.get("aDefPct")]);
statMap.set("poisonPct", 100);
for (const x of skp_elements) {
this.externalStats.set(x + "DamPct", 0);
@ -427,6 +423,15 @@ class Build{
this.externalStats.set("defBonus",[0, 0, 0, 0, 0]);
this.externalStats.set("poisonPct", 0);
this.statMap = statMap;
this.aggregateStats();
}
aggregateStats() {
let statMap = this.statMap;
statMap.set("damageRaw", [this.weapon.get("nDam"), this.weapon.get("eDam"), this.weapon.get("tDam"), this.weapon.get("wDam"), this.weapon.get("fDam"), this.weapon.get("aDam")]);
statMap.set("damageBonus", [statMap.get("eDamPct"), statMap.get("tDamPct"), statMap.get("wDamPct"), statMap.get("fDamPct"), statMap.get("aDamPct")]);
statMap.set("defRaw", [statMap.get("eDef"), statMap.get("tDef"), statMap.get("wDef"), statMap.get("fDef"), statMap.get("aDef")]);
statMap.set("defBonus", [statMap.get("eDefPct"), statMap.get("tDefPct"), statMap.get("wDefPct"), statMap.get("fDefPct"), statMap.get("aDefPct")]);
}
}

View file

@ -1,16 +1,9 @@
/*
* TESTING SECTION
*/
const url_base = location.href.split("#")[0];
const url_tag = location.hash.slice(1);
console.log(url_base);
console.log(url_tag);
/*
* END testing section
*/
const BUILD_VERSION = "6.9.4";
function setTitle() {
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
@ -26,6 +19,7 @@ let accessoryTypes = [ "ring", "bracelet", "necklace" ];
let weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
// THIS IS SUPER DANGEROUS, WE SHOULD NOT BE KEEPING THIS IN SO MANY PLACES
let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "id" ];
let editable_item_fields = [ "sdPct", "sdRaw", "mdPct", "mdRaw", "poison", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "hprRaw", "hprPct", "hpBonus", "atkTier", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ];
let skp_order = ["str","dex","int","def","agi"];
let skp_elements = ["e","t","w","f","a"];
@ -476,6 +470,11 @@ function calculateBuild(save_skp, skp){
setText(skp_order[i] + "-skp-base", "Original Value: " + skillpoints[i]);
}
for (let id of editable_item_fields) {
setValue(id, player_build.statMap.get(id));
setText(id+"-base", "Original Value: " + player_build.statMap.get(id));
}
if (save_skp) {
// TODO: reduce duplicated code, @updateStats
let skillpoints = player_build.total_skillpoints;
@ -588,28 +587,33 @@ function updateStats() {
delta_total += delta;
}
player_build.assigned_skillpoints += delta_total;
calculateBuildStats();
if(player_build){
updatePowderSpecials("skip");
updateBoosts("skip");
updatePowderSpecials("skip", false);
updateBoosts("skip", false);
}
for (let id of editable_item_fields) {
player_build.statMap.set(id, parseInt(getValue(id)));
}
player_build.aggregateStats();
console.log(player_build.statMap);
calculateBuildStats();
}
/* Updates all spell boosts
*/
function updateBoosts(buttonId) {
function updateBoosts(buttonId, recalcStats) {
let elem = document.getElementById(buttonId);
let name = buttonId.split("-")[0];
if(buttonId !== "skip") {
if (elem.classList.contains("toggleOn")) {
player_build.damageMultiplier -= damageMultipliers.get(name);
if (name === "warscream") {
player_build.defenseMultiplier -= .10;
player_build.defenseMultiplier -= .20;
}
elem.classList.remove("toggleOn");
}else{
player_build.damageMultiplier += damageMultipliers.get(name);
if (name === "warscream") {
player_build.defenseMultiplier += .10;
player_build.defenseMultiplier += .20;
}
elem.classList.add("toggleOn");
}
@ -620,16 +624,18 @@ function updateBoosts(buttonId) {
if (elem.classList.contains("toggleOn")) {
elem.classList.remove("toggleOn");
player_build.damageMultiplier -= value;
if (key === "warscream") { player_build.defenseMultiplier -= .10 }
if (key === "warscream") { player_build.defenseMultiplier -= .20 }
}
}
}
calculateBuildStats();
if (recalcStats) {
calculateBuildStats();
}
}
/* Updates all powder special boosts
*/
function updatePowderSpecials(buttonId){
function updatePowderSpecials(buttonId, recalcStats) {
//console.log(player_build.statMap);
let name = (buttonId).split("-")[0];
@ -709,8 +715,10 @@ function updatePowderSpecials(buttonId){
}
}
if (recalcStats) {
calculateBuildStats();
}
displayPowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build);
calculateBuildStats(); //also make damage boosts apply ;-;
}
/* Calculates all build statistics and updates the entire display.
*/
@ -874,5 +882,18 @@ function resetFields(){
calculateBuild();
}
function toggleID() {
let button = document.getElementById("show-id-button");
let targetDiv = document.getElementById("id-edit");
if (button.classList.contains("toggleOn")) { //toggle the pressed button off
targetDiv.style.display = "none";
button.classList.remove("toggleOn");
}
else {
targetDiv.style.display = "block";
button.classList.add("toggleOn");
}
}
load_init(init);

View file

@ -270652,7 +270652,7 @@
"restrict": "1.20 item",
"fixID": false,
"strReq": 0,
"dexReq": 105,
"dexReq": 120,
"intReq": 0,
"defReq": 0,
"agiReq": 0,

View file

@ -6,5 +6,5 @@ The game, of course
Additional Contributors:
- 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)

View file

@ -16,6 +16,9 @@
<div class="header" id="header">
Wynn build calculator
</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="equipment" style="grid-column:1/span 2;grid-row:1">
<div style="grid-column:1/span 2;grid-row:1">
@ -439,7 +442,7 @@
<div class="center" style="grid-column:1;grid-row:1">
<div>
<label for="str-skp" class="skpLabel" id="str-skp-label">Strength:</label><br>
<input class="skp-input" type="string" id="str-skp" name="str-skp" value="0" class="skpInput"/>
<input type="string" id="str-skp" name="str-skp" value="0" class="skpInput"/>
</div>
<div id="str-skp-assign">
Manually Assigned: 0
@ -453,7 +456,7 @@
<div class="center" style="grid-column:2;grid-row:1">
<div>
<label for="dex-skp" class="skpLabel" id="dex-skp-label">Dexterity:</label><br>
<input class="skp-input" type="string" id="dex-skp" name="dex-skp" value="0" class="skpInput"/>
<input type="string" id="dex-skp" name="dex-skp" value="0" class="skpInput"/>
</div>
<div id="dex-skp-assign">
Manually Assigned: 0
@ -467,7 +470,7 @@
<div class="center" style="grid-column:3;grid-row:1">
<div>
<label for="int-skp" class="skpLabel" id="int-skp-label">Intelligence:</label><br>
<input class="skp-input" type="string" id="int-skp" name="int-skp" value="0" class="skpInput"/>
<input type="string" id="int-skp" name="int-skp" value="0" class="skpInput"/>
</div>
<div id="int-skp-assign">
Manually Assigned: 0
@ -481,7 +484,7 @@
<div class="center" style="grid-column:4;grid-row:1">
<div>
<label for="def-skp" class="skpLabel" id="def-skp-label">Defense:</label><br>
<input class="skp-input" type="string" id="def-skp" name="def-skp" value="0" class="skpInput"/>
<input type="string" id="def-skp" name="def-skp" value="0" class="skpInput"/>
</div>
<div id="def-skp-assign">
Manually Assigned: 0
@ -495,7 +498,7 @@
<div class="center" style="grid-column:5;grid-row:1">
<div>
<label for="agi-skp" class="skpLabel" id="agi-skp-label">Agility:</label><br>
<input class="skp-input" type="string" id="agi-skp" name="agi-skp" value="0" class="skpInput"/>
<input type="string" id="agi-skp" name="agi-skp" value="0" class="skpInput"/>
</div>
<div id="agi-skp-assign">
Manually Assigned: 0
@ -507,10 +510,317 @@
</div>
</div>
</div>
<div class="id-box fade-in" id="id-edit" style="display: none">
<div class="id-edit1">
<div class="idCenter">
<div class="idWrap">
<div>
<label for="sdPct" class="idLabel" id="sdPct-label">Spell Damage %:</label><br>
<input type="number" id="sdPct" name="sdPct" value="0" class="idInput"/>
</div>
<div id="sdPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="sdRaw" class="idLabel" id="sdRaw-label">Spell Damage Raw:</label><br>
<input type="number" id="sdRaw" name="sdRaw" value="0" class="idInput"/>
</div>
<div id="sdRaw-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="mdPct" class="idLabel" id="mdPct-label">Melee Damage %:</label><br>
<input type="number" id="mdPct" name="mdPct" value="0" class="idInput"/>
</div>
<div id="mdPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="mdRaw" class="idLabel" id="mdRaw-label">Melee Damage Raw:</label><br>
<input type="number" id="mdRaw" name="mdRaw" value="0" class="idInput"/>
</div>
<div id="mdRaw-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="poison" class="idLabel" id="poison-label">Poison:</label><br>
<input type="number" id="poison" name="poison" value="0" class="idInput"/>
</div>
<div id="poison-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="eDamPct" class="idLabel" id="eDamPct-label">Earth Damage %:</label><br>
<input type="number" id="eDamPct" name="eDamPct" value="0" class="idInput"/>
</div>
<div id="eDamPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="tDamPct" class="idLabel" id="tDamPct-label">Thunder Damage %:</label><br>
<input type="number" id="tDamPct" name="tDamPct" value="0" class="idInput"/>
</div>
<div id="tDamPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="wDamPct" class="idLabel" id="wDamPct-label">Water Damage %:</label><br>
<input type="number" id="wDamPct" name="wDamPct" value="0" class="idInput"/>
</div>
<div id="wDamPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="fDamPct" class="idLabel" id="fDamPct-label">Fire Damage %:</label><br>
<input type="number" id="fDamPct" name="fDamPct" value="0" class="idInput"/>
</div>
<div id="fDamPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="aDamPct" class="idLabel" id="aDamPct-label">Air Damage %:</label><br>
<input type="number" id="aDamPct" name="aDamPct" value="0" class="idInput"/>
</div>
<div id="aDamPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="eDefPct" class="idLabel" id="eDefPct-label">Earth Defense %:</label><br>
<input type="number" id="eDefPct" name="eDefPct" value="0" class="idInput"/>
</div>
<div id="eDefPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="tDefPct" class="idLabel" id="tDefPct-label">Thunder Defense %:</label><br>
<input type="number" id="tDefPct" name="tDefPct" value="0" class="idInput"/>
</div>
<div id="tDefPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="wDefPct" class="idLabel" id="wDefPct-label">Water Defense %:</label><br>
<input type="number" id="wDefPct" name="wDefPct" value="0" class="idInput"/>
</div>
<div id="wDefPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="fDefPct" class="idLabel" id="fDefPct-label">Fire Defense %:</label><br>
<input type="number" id="fDefPct" name="fDefPct" value="0" class="idInput"/>
</div>
<div id="fDefPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="aDefPct" class="idLabel" id="aDefPct-label">Air Defense %:</label><br>
<input type="number" id="aDefPct" name="aDefPct" value="0" class="idInput"/>
</div>
<div id="aDefPct-base">
Original Value: 0
</div>
</div>
</div>
</div>
<div class="id-edit2">
<div class="idCenter">
<div class="idWrap">
<div>
<label for="hprRaw" class="idLabel" id="hprRaw-label">Health Regen Raw:</label><br>
<input type="number" id="hprRaw" name="hprRaw" value="0" class="idInput"/>
</div>
<div id="hprRaw-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="hprPct" class="idLabel" id="hprPct-label">Health Regen %:</label><br>
<input type="number" id="hprPct" name="hprPct" value="0" class="idInput"/>
</div>
<div id="hprPct-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="hpBonus" class="idLabel" id="hpBonus-label">Health Bonus:</label><br>
<input type="number" id="hpBonus" name="hpBonus" value="0" class="idInput"/>
</div>
<div id="hpBonus-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="atkTier" class="idLabel" id="atkTier-label">Attack Speed Bonus:</label><br>
<input type="number" id="atkTier" name="atkTier" value="0" class="idInput"/>
</div>
<div id="atkTier-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spPct1" class="idLabel" id="spPct1-label">1st Spell Cost %:</label><br>
<input type="number" id="spPct1" name="spPct1" value="0" class="idInput"/>
</div>
<div id="spPct1-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spPct2" class="idLabel" id="spPct2-label">2nd Spell Cost %:</label><br>
<input type="number" id="spPct2" name="spPct2" value="0" class="idInput"/>
</div>
<div id="spPct2-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spPct3" class="idLabel" id="spPct3-label">3rd Spell Cost %:</label><br>
<input type="number" id="spPct3" name="spPct3" value="0" class="idInput"/>
</div>
<div id="spPct3-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spPct4" class="idLabel" id="spPct4-label">4th Spell Cost %:</label><br>
<input type="number" id="spPct4" name="spPct4" value="0" class="idInput"/>
</div>
<div id="spPct4-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spRaw1" class="idLabel" id="spRaw1-label">1st Spell Cost Raw:</label><br>
<input type="number" id="spRaw1" name="spRaw1" value="0" class="idInput"/>
</div>
<div id="spRaw1-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spRaw2" class="idLabel" id="spRaw2-label">2nd Spell Cost Raw:</label><br>
<input type="number" id="spRaw2" name="spRaw2" value="0" class="idInput"/>
</div>
<div id="spRaw2-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spRaw3" class="idLabel" id="spRaw3-label">3rd Spell Cost Raw:</label><br>
<input type="number" id="spRaw3" name="spRaw3" value="0" class="idInput"/>
</div>
<div id="spRaw3-base">
Original Value: 0
</div>
</div>
</div>
<div class="idCenter">
<div class="idWrap">
<div>
<label for="spRaw4" class="idLabel" id="spRaw4-label">4th Spell Cost Raw:</label><br>
<input type="number" id="spRaw4" name="spRaw4" value="0" class="idInput"/>
</div>
<div id="spRaw4-base">
Original Value: 0
</div>
</div>
</div>
</div>
</div>
<br>
<div class="center">
<button class = "button" id = "update-button" onclick = "updateStats()">
Update Stats
</button>
<button class = "button" id = "show-id-button" onclick = "toggleID()">
Edit IDs
</button>
</div>
<div class = "build hide-container-grid" style="display: none;">
<div class = "center build-helmet" id = "build-helmet" style = "grid-item-1">
@ -575,7 +885,6 @@
</div>
<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>Hard refresh the page (Ctrl+Shift+R on windows/chrome) if it isn't updating correctly.</p>
</div>
<div class="center" id="credits">
<a href="credits.txt" class="link">Additional credits</a>
@ -586,7 +895,6 @@
<script type="text/javascript" src="damage_calc.js"></script>
<script type="text/javascript" src="display.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="builder.js"></script>
</body>

359
ing_transform_combine.py Normal file
View 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
View file

@ -1,24 +1,18 @@
const DB_VERSION = 20;
const BUILD_VERSION = "6.9.2";
const DB_VERSION = 21;
// @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 items;
let sets;
let ings;
let recipes;
/*
* Load item set from local DB. Calls init() on success.
*/
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 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();
request.onerror = function(event) {
console.log("Could not read local item db...");
@ -44,25 +38,8 @@ async function load_local(init_func) {
console.log(sets);
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;
db.close();
}
@ -87,32 +64,9 @@ async function load(init_func) {
let getUrl = window.location;
let baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
let url = baseUrl + "/compress.json";
url = url.replace("/crafter.html", ""); //JANK
let result = await (await fetch(url)).json();
items = result.items;
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 items_store = add_tx.objectStore('item_db');
@ -125,20 +79,7 @@ async function load(init_func) {
for (const set in sets) {
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_tx2.complete);
add_promises.push(add_tx3.complete);
Promise.all(add_promises).then((values) => {
db.close();
init_func();
@ -146,11 +87,11 @@ async function load(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() {
console.log("DB failed to open...");
}
};
request.onsuccess = function() {
db = request.result;
@ -181,22 +122,9 @@ function load_init(init_func) {
catch (error) {
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('set_db');
db.createObjectStore('ing_db');
db.createObjectStore('recipe_db');
console.log("DB setup complete...");
}

124
load_ing.js Normal file
View 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...");
}
}

View file

@ -33,8 +33,8 @@
max-height: 50px;
}
.skp-input {
width: 15vw;
.skpInput, .idInput {
width: 90%;
height: 7vw;
max-height: 30px;
}

View file

@ -28,7 +28,7 @@ div {
grid-template-rows: min-content min-content auto;
}
.skillpoints {
.skillpoints, .id-edit1 {
padding: 0% 4% 2%;
display: grid;
grid-template-columns: repeat(5, 1fr);
@ -36,6 +36,14 @@ div {
grid-auto-rows: minmax(60px, auto);
}
.id-edit2 {
padding: 0% 4% 2%;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 5px;
grid-auto-rows: minmax(60px, auto);
}
.powder-specials{
padding: 0% 4% 2%;
display: grid;
@ -67,6 +75,7 @@ a.link{
}
.center {
text-align: center;
position: relative;
}
table.center{
margin: 10px;
@ -83,7 +92,7 @@ table.center{
text-align: left;
}
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order, .build-overall, .build-melee-stats, .build-defense-stats, .spell-info, .set-info, .powder-special, .powder-special-stats, .int-info, .crafter, .recipe-stats, .craft-stats, .ing-stats {
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order, .build-overall, .build-melee-stats, .build-defense-stats, .spell-info, .set-info, .powder-special, .powder-special-stats, .int-info, .crafter, .recipe-stats, .craft-stats, .ing-stats, .id-box {
color: #aaa;
background: #121516;
border: 3px solid #BCBCBC;
@ -177,11 +186,21 @@ table.center{
content: "\2764" ' ';
}
.skpInput, .skplabel {
.skplabel {
display: block;
margin: auto;
}
.idCenter {
text-align: center;
padding: 1em 0px 0px 0px;
position: relative;
display: flex;
}
.idWrap {
align-self: flex-end;
}
/*Scrollbar*/
/* width */
::-webkit-scrollbar {
@ -302,19 +321,7 @@ button.toggleOn{
width: 100%;
}
.hide-container-block {
animation-duration: 0.5s;
animation-name: fadeInFromNone;
animation-fill-mode: forwards;
}
.hide-container-grid {
animation-duration: 0.5s;
animation-name: fadeInFromNone;
animation-fill-mode: forwards;
}
.misc {
.hide-container-block, .hide-container-grid, .set-info-div, .fade-in, .misc {
animation-duration: 0.5s;
animation-name: fadeInFromNone;
animation-fill-mode: forwards;

View file

@ -16,14 +16,6 @@ with open("dump.json", "r") as infile:
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()
@ -39,7 +31,7 @@ for filename in os.listdir('sets'):
data["sets"] = sets
translate_mappings = { #this is used for items.
translate_mappings = {
#"name": "name",
#"displayName": "displayName",
#"tier": "tier",
@ -140,142 +132,13 @@ delete_keys = [
"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 = []
@ -299,61 +162,13 @@ for item in items:
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:
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)
json.dump(data, outfile)

View file

@ -43,6 +43,6 @@
}
.skp-input {
.skpInput, .idInput {
}