CRAFTER 1.0

This commit is contained in:
ferricles 2021-01-27 16:52:34 -08:00
parent fbadd591db
commit 733a5fca41
10 changed files with 7343 additions and 2750 deletions

105
craft.js
View file

@ -10,16 +10,22 @@ class Craft{
@param mat_tiers: [1->3, 1->3]. An array with 2 numbers. @param mat_tiers: [1->3, 1->3]. An array with 2 numbers.
@param ingreds: []. An array with 6 entries, each with an ingredient Map. @param ingreds: []. An array with 6 entries, each with an ingredient Map.
*/ */
constructor(recipe, mat_tiers, ingreds, attackSpeed) { constructor(recipe, mat_tiers, ingreds, attackSpeed, hash) {
this.recipe = recipe; this.recipe = recipe;
this.mat_tiers = mat_tiers; this.mat_tiers = mat_tiers;
this.ingreds = ingreds; this.ingreds = ingreds;
this.statMap = new Map(); //can use the statMap as an expanded Item this.statMap = new Map(); //can use the statMap as an expanded Item
this.atkSpd = attackSpeed; this.atkSpd = attackSpeed;
this.hash = hash;
this.initCraftStats(); this.initCraftStats();
} }
setHash(hash) {
this.hash = hash;
console.log(hash);
this.statMap.set("displayName", "CR-" + this.hash);
console.log(this.statMap.get("displayName"));
}
/* Get all stats for this build. Stores in this.statMap. /* Get all stats for this build. Stores in this.statMap.
@pre The craft itself should be valid. No checking of validity of pieces is done here. @pre The craft itself should be valid. No checking of validity of pieces is done here.
*/ */
@ -28,13 +34,20 @@ class Craft{
let statMap = new Map(); let statMap = new Map();
statMap.set("minRolls", new Map()); statMap.set("minRolls", new Map());
statMap.set("maxRolls", new Map()); statMap.set("maxRolls", new Map());
statMap.set("displayName", "Crafted Item"); //TODO: DISPLAY THE HASH statMap.set("displayName", "CR-" + this.hash); //TODO: DISPLAY THE HASH
statMap.set("tier", "Crafted"); statMap.set("tier", "Crafted");
statMap.set("type", this.recipe.get("type").toLowerCase()); statMap.set("type", this.recipe.get("type").toLowerCase());
statMap.set("duration", [this.recipe.get("duration")[0], this.recipe.get("duration")[1]]); //[low, high] statMap.set("duration", [this.recipe.get("duration")[0], this.recipe.get("duration")[1]]); //[low, high]
statMap.set("durability", [this.recipe.get("durability")[0], this.recipe.get("durability")[1]]); statMap.set("durability", [this.recipe.get("durability")[0], this.recipe.get("durability")[1]]);
statMap.set("lvl", (this.recipe.get("lvl")[0] + "-" + this.recipe.get("lvl")[1]) ); statMap.set("lvl", (this.recipe.get("lvl")[0] + "-" + this.recipe.get("lvl")[1]) );
statMap.set("nDam", 0); statMap.set("nDam", 0);
for (const e of skp_elements) {
statMap.set(e + "Dam", "0-0");
statMap.set(e + "Def", 0);
}
for (const e of skp_order) {
statMap.set(e + "Req", 0)
}
if (armorTypes.includes(statMap.get("type")) || weaponTypes.includes(statMap.get("type"))) { if (armorTypes.includes(statMap.get("type")) || weaponTypes.includes(statMap.get("type"))) {
if(this.recipe.get("lvl")[0] < 30) { if(this.recipe.get("lvl")[0] < 30) {
@ -70,7 +83,7 @@ class Craft{
} }
statMap.set("category","consumable"); statMap.set("category","consumable");
} else { } else {
statMap.set("slots", 0); statMap.set("charges", 0);
} }
if (armorTypes.includes(statMap.get("type"))) { if (armorTypes.includes(statMap.get("type"))) {
@ -80,12 +93,13 @@ class Craft{
statMap.set("nDam", this.recipe.get("healthOrDamage").join("-")); statMap.set("nDam", this.recipe.get("healthOrDamage").join("-"));
for (const e of skp_elements) { for (const e of skp_elements) {
statMap.set(e + "Dam", "0-0"); statMap.set(e + "Dam", "0-0");
statMap.set(e + "DamLow", "0-0");
} }
//statMap.set("damageBonus", [statMap.get("eDamPct"), statMap.get("tDamPct"), statMap.get("wDamPct"), statMap.get("fDamPct"), statMap.get("aDamPct")]); //statMap.set("damageBonus", [statMap.get("eDamPct"), statMap.get("tDamPct"), statMap.get("wDamPct"), statMap.get("fDamPct"), statMap.get("aDamPct")]);
statMap.set("category","weapon"); statMap.set("category","weapon");
statMap.set("atkSpd",this.atkSpd); statMap.set("atkSpd",this.atkSpd);
} }
statMap.set("powders",""); statMap.set("powders",[]);
/* Change certain IDs based on material tier. /* Change certain IDs based on material tier.
healthOrDamage changes. healthOrDamage changes.
@ -94,7 +108,7 @@ class Craft{
*/ */
let matmult = 1; let matmult = 1;
let sorted = this.mat_tiers.slice().sort(); let sorted = this.mat_tiers.slice().sort();
//TODO - idfk how this works //TODO - MAT MULTIPLIERS ARE SUS FOR NON-MIXING TIERS.
if( sorted[0] == 1 && sorted[1] == 1) { if( sorted[0] == 1 && sorted[1] == 1) {
matmult = 1; matmult = 1;
} else if( sorted[0] == 1 && sorted[1] == 2) { } else if( sorted[0] == 1 && sorted[1] == 2) {
@ -123,18 +137,75 @@ class Craft{
} }
if (statMap.get("category") === "weapon") { if (statMap.get("category") === "weapon") {
//attack damages oh boy //attack damages oh boy
let ratio = 2.05; //UNSURE IF THIS IS HOW IT'S DONE. MIGHT BE DONE WITH SKETCHY FLOORING. let ratio = 2.05; //UNSURE IF THIS IS HOW IT'S DONE.
if (this.atkSpd === "SLOW") { if (this['atkSpd'] === "SLOW") {
ratio /= 1.5; ratio /= 1.5;
} else if (this.atkSpd === "NORMAL") { } else if (this['atkSpd'] === "NORMAL") {
ratio = 1; ratio = 1;
} else if (this.atkSpd = "FAST") { } else if (this['atkSpd'] === "FAST") {
ratio /= 2.5; ratio /= 2.5;
} }
low *= ratio*matmult; low = Math.floor(low * matmult);
high *= ratio*matmult; high = Math.floor(high * matmult);
this.recipe.get("healthOrDamage")[0] = low; low = Math.floor(low * ratio);
this.recipe.get("healthOrDamage")[1] = high; high = Math.floor(high * ratio);
let low1 = Math.floor(low * 0.9);
let low2 = Math.floor(low * 1.1);
let high1 = Math.floor(high * 0.9);
let high2 = Math.floor(high * 1.1);
statMap.set("nDamLow", low1 + "-" + low2); //jank
statMap.set("nDam", high1 + "-" + high2);
/*
* APPLY POWDERS - MAY NOT BE CORRECT
*/
let mockItem = new Map();
mockItem.set("type",statMap.get("type"));
mockItem.set("atkSpd",statMap.get("atkSpd"));
mockItem.set("nDam", high1 + "-" + high2);
for (const e of skp_elements) {
mockItem.set(e+"Dam","0-0");
}
mockItem.set("powders",[]);
for (let n in this.ingreds) {
let ingred = this.ingreds[n];
if (ingred.get("isPowder")) {
mockItem.get("powders").push(ingred.get("pid"));
}
}
let stats = new Map();
stats.set("atkSpd", mockItem.get("atkSpd"));
stats.set("damageBonus", [0, 0, 0, 0, 0]);
stats.set("damageRaw", [mockItem.get("nDam"), mockItem.get("eDam"), mockItem.get("tDam"), mockItem.get("wDam"), mockItem.get("fDam"), mockItem.get("aDam")]);
let damage_keys = [ "nDam", "eDam", "tDam", "wDam", "fDam", "aDam" ]; //affects base damage directly.
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, mockItem, [0, 0, 0, 0, 0], 1, undefined);
let damages = results[2];
for (const i in damage_keys) {
statMap.set(damage_keys[i], damages[i][0]+"-"+damages[i][1]);
}
//second go-through: for the low roll.
mockItem.set("nDam", low1 + "-" + low2);
for (const e of skp_elements) {
mockItem.set(e+"Dam","0-0");
}
stats.set("damageRaw", [mockItem.get("nDam"), mockItem.get("eDam"), mockItem.get("tDam"), mockItem.get("wDam"), mockItem.get("fDam"), mockItem.get("aDam")]);
results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, mockItem, [0, 0, 0, 0, 0], 1, undefined);
damages = results[2];
for (const i in damage_keys) {
statMap.set(damage_keys[i]+"Low", damages[i][0]+"-"+damages[i][1]);
}
} else if (statMap.get("category") === "armor") {
for (let n in this.ingreds) {
let ingred = this.ingreds[n];
if (ingred.get("isPowder")) {
let powder = powderStats[ingred.get("pid")];
let name = powderNames.get(ingred.get("pid"));
statMap.set(name.charAt(0) + "Def", (statMap.get(name.charAt(0)+"Def") || 0) + powder["defPlus"]);
statMap.set(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 4 )% 5] + "Def", (statMap.get(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 4 )% 5]+"Def") || 0) - powder["defMinus"]);
}
}
} }
/* END SECTION */ /* END SECTION */
@ -199,7 +270,11 @@ class Craft{
let eff_mult = (eff_flat[n] / 100).toFixed(2); let eff_mult = (eff_flat[n] / 100).toFixed(2);
for (const [key, value] of ingred.get("itemIDs")) { for (const [key, value] of ingred.get("itemIDs")) {
if(key !== "dura") { if(key !== "dura") {
statMap.set(key, statMap.get(key) + Math.floor(value*eff_mult)); //CHECK IF THIS IS CORRECT if (!ingred.get("isPowder")) {
statMap.set(key, Math.floor(statMap.get(key) + value*eff_mult)); //CHECK IF THIS IS CORRECT
} else {
statMap.set(key, Math.floor(statMap.get(key) + value));
}
} else { //durability, NOT affected by effectiveness } else { //durability, NOT affected by effectiveness
statMap.set("durability", statMap.get("durability").map(x => x + value)); statMap.set("durability", statMap.get("durability").map(x => x + value));
} }

View file

@ -43,7 +43,8 @@
</header> </header>
</div> </div>
<div class = "container" display = "grid"> <div class = "container" display = "grid">
<div class = "crafter center" style = "grid-column:1;grid-row:1" > <div class = "center" style = "grid-column:1;grid-row:1" >
<div class = "crafter">
<table class = "center"> <table class = "center">
<tr> <tr>
<td> <td>
@ -171,10 +172,14 @@
</tr> </tr>
</table> </table>
</div> </div>
</div>
<div class = "recipe center hide-container-block" style = "display:none"> <div class = "recipe center hide-container-block" style = "display:none">
<div class = "recipe-stats"> <div class = "recipe-stats">
<div class = "center" id = "recipe-stats"></div> <div class = "center" id = "recipe-stats"></div>
</div> </div>
<div class = "craft-warnings">
<div class = "center" id = "craft-warnings"></div>
</div>
</div> </div>
<div class = "crafted center hide-container-block" style = "display:none"> <div class = "crafted center hide-container-block" style = "display:none">
<div class = "craft-stats"> <div class = "craft-stats">
@ -183,9 +188,7 @@
</div> </div>
<!--This is also incredibly janky.--> <!--This is also incredibly janky.-->
<div class = "craft-warnings"> <p></p>
<div class = "center" id = "craft-warnings"></div>
</div>
<p></p> <p></p>
<p></p> <p></p>
<div class="ingredients-container hide-container-grid" id = "ingreds" style = "display:none"> <div class="ingredients-container hide-container-grid" id = "ingreds" style = "display:none">

View file

@ -29,7 +29,7 @@ function setTitle() {
document.getElementById("header").textContent = "WynnCrafter version "+BUILD_VERSION+" (ingredient db version "+ING_DB_VERSION+")"; document.getElementById("header").textContent = "WynnCrafter version "+BUILD_VERSION+" (ingredient db version "+ING_DB_VERSION+")";
document.getElementById("header").classList.add("funnynumber"); document.getElementById("header").classList.add("funnynumber");
let disclaimer = document.createElement("p"); let disclaimer = document.createElement("p");
disclaimer.textContent = "THIS CRAFTER IS INCOMPLETE. The effect of material tiers on crated items is not accurate yet. If you know how the math behind it works, please contact ferricles on forums, discord, or ingame."; disclaimer.textContent = "THIS CRAFTER IS INCOMPLETE. The effect of material tiers on crated items is not 100% tested and accurate. If you know how the math behind it works, please contact ferricles on forums, discord, or ingame.";
document.getElementById("header").append(disclaimer); document.getElementById("header").append(disclaimer);
} }
setTitle(); setTitle();
@ -38,6 +38,10 @@ let ingMap = new Map();
let ingList = []; let ingList = [];
let recipeMap = new Map(); let recipeMap = new Map();
let recipeList = [];
let ingIDMap = new Map();
let recipeIDMap = new Map();
function init() { function init() {
//no ing //no ing
let ing = Object(); let ing = Object();
@ -48,19 +52,62 @@ function init() {
ing.ids= {}; ing.ids= {};
ing.itemIDs = {"dura": 0, "strReq": 0, "dexReq": 0,"intReq": 0,"defReq": 0,"agiReq": 0,}; ing.itemIDs = {"dura": 0, "strReq": 0, "dexReq": 0,"intReq": 0,"defReq": 0,"agiReq": 0,};
ing.consumableIDs = {"dura": 0, "charges": 0}; ing.consumableIDs = {"dura": 0, "charges": 0};
ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0} ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0};
ingMap.set(ing["name"], ing); ingMap.set(ing["name"], ing);
ingList.push(ing["name"]);
ingIDMap.set(ingList.length-1, ing["name"]);
let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]);
for (let i = 0; i < 5; i ++) {
for (const powderIng of powderIngreds) {
let ing = Object();
ing.name = "" + damageClasses[i+1] + " Powder " + numerals.get(powderIngreds.indexOf(powderIng) + 1);
ing.tier = 0;
ing.lvl = 0;
ing.skills = ["ARMOURING", "TAILORING", "WEAPONSMITHING", "WOODWORKING"];
ing.ids = {};
ing.isPowder = true;
ing.pid = 6*i + powderIngreds.indexOf(powderIng);
ing.itemIDs = {"dura": powderIng["durability"], "strReq": 0, "dexReq": 0,"intReq": 0,"defReq": 0,"agiReq": 0,};
switch(i) {
case 0:
ing.itemIDs["strReq"] = powderIng["skpReq"];
break;
case 1:
ing.itemIDs["dexReq"] = powderIng["skpReq"];
break;
case 2:
ing.itemIDs["intReq"] = powderIng["skpReq"];
break;
case 3:
ing.itemIDs["defReq"] = powderIng["skpReq"];
break;
case 4:
ing.itemIDs["agiReq"] = powderIng["skpReq"];
break;
}
ing.consumableIDs = {"dura": 0, "charges": 0};
ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0};
ingMap.set(ing["name"],ing);
ingList.push(ing["name"]);
}
}
for (const ing of ings) { for (const ing of ings) {
ingMap.set(ing["name"], ing); ingMap.set(ing["name"], ing);
ingList.push(ing["name"]); ingList.push(ing["name"]);
} }
for (const recipe of recipes) { for (const recipe of recipes) {
recipeMap.set(recipe["id"], recipe); recipeMap.set(recipe["id"], recipe);
recipeList.push(recipe["id"]);
} }
console.log("all ingredients"); console.log("all ingredients");
console.log(ings); console.log(ings);
console.log("all recipes"); console.log("all recipes");
console.log(recipes); console.log(recipes);
console.log("e");
console.log(ingList);
console.log(recipeList);
document.getElementById("recipe-choice").addEventListener("change", (event) => { document.getElementById("recipe-choice").addEventListener("change", (event) => {
updateMaterials(); updateMaterials();
@ -70,6 +117,7 @@ function init() {
}); });
populateFields(); populateFields();
decodeCraft(url_tag);
} }
function updateMaterials() { function updateMaterials() {
let recipeName = getValue("recipe-choice") ? getValue("recipe-choice") : "Potion"; let recipeName = getValue("recipe-choice") ? getValue("recipe-choice") : "Potion";
@ -139,7 +187,10 @@ function calculateCraft() {
} }
} }
//create the craft //create the craft
player_craft = new Craft(recipe,mat_tiers,ingreds,atkSpd); player_craft = new Craft(recipe,mat_tiers,ingreds,atkSpd,"");
location.hash = encodeCraft();
player_craft.setHash(encodeCraft().split("_")[1]);
console.log(player_craft); console.log(player_craft);
/*console.log(recipe) /*console.log(recipe)
console.log(levelrange) console.log(levelrange)
@ -172,10 +223,57 @@ function calculateCraft() {
} }
} }
//set the location hash. TODO
/*let hash = "";
location.hash = hash;*/
} }
function encodeCraft() {
if (player_craft) {
let atkSpds = ["SLOW","NORMAL","FAST"];
let craft_string = "1_" +
Base64.fromIntN(ingList.indexOf(player_craft.ingreds[0].get("name")), 2) +
Base64.fromIntN(ingList.indexOf(player_craft.ingreds[1].get("name")), 2) +
Base64.fromIntN(ingList.indexOf(player_craft.ingreds[2].get("name")), 2) +
Base64.fromIntN(ingList.indexOf(player_craft.ingreds[3].get("name")), 2) +
Base64.fromIntN(ingList.indexOf(player_craft.ingreds[4].get("name")), 2) +
Base64.fromIntN(ingList.indexOf(player_craft.ingreds[5].get("name")), 2) +
Base64.fromIntN(recipeList.indexOf(player_craft.recipe.get("id")),2) +
Base64.fromIntN(player_craft.mat_tiers[0] + (player_craft.mat_tiers[1]-1)*3, 1) + //this maps tiers [a,b] to a+3b.
Base64.fromIntN(atkSpds.indexOf(player_craft.statMap.get("atkSpd")),1);
return craft_string;
}
return "";
}
function decodeCraft(url_tag) {
if (url_tag) {
console.log(url_tag);
let info = url_tag.split("_");
let version = info[0];
let tag = info[1];
if (version === "1") {
ingreds = [];
for (let i = 0; i < 6; i ++ ) {
setValue("ing-choice-"+(i+1), ingList[Base64.toInt(tag.substring(2*i,2*i+2))]);
}
recipe = recipeList[Base64.toInt(tag.substring(12,14))];
recipesName = recipe.split("-");
setValue("recipe-choice",recipesName[0]);
setValue("level-choice",recipesName[1]+"-"+recipesName[2]);
tierNum = Base64.toInt(tag.substring(14,15));
mat_tiers = [];
mat_tiers.push(tierNum % 3 == 0 ? 3 : tierNum % 3);
mat_tiers.push(Math.floor((tierNum-0.5) / 3)+1); //Trying to prevent round-off error, don't yell at me
toggleMaterial("mat-1-"+mat_tiers[0]);
toggleMaterial("mat-2-"+mat_tiers[1]);
atkSpd = Base64.toInt(tag.substring(15));
console.log(atkSpd);
let atkSpdButtons = ["slow-atk-button", "normal-atk-button", "fast-atk-button"];
toggleAtkSpd(atkSpdButtons[atkSpd]);
calculateCraft();
}
}
}
function populateFields() { function populateFields() {
let recipe_list = document.getElementById("recipe-choices"); let recipe_list = document.getElementById("recipe-choices");
for (const recipe of recipeTypes) { for (const recipe of recipeTypes) {
@ -225,7 +323,13 @@ function copyRecipe(){
*/ */
function shareRecipe(){ function shareRecipe(){
if (player_craft) { if (player_craft) {
copyTextToClipboard(url_base+location.hash); let copyString = url_base+location.hash + "\n";
let name = player_craft.recipe.get("id").split("-");
copyString += " > " + name[0] + " " + "Lv. " + name[1] + "-" + name[2] + " (" + player_craft.mat_tiers[0] + "\u272B, " + player_craft.mat_tiers[1] + "\u272B)\n";
copyString += " > [" + player_craft.ingreds[0].get("name") + " | " + player_craft.ingreds[1].get("name") + "\n";
copyString += " > " + player_craft.ingreds[2].get("name") + " | " + player_craft.ingreds[3].get("name") + "\n";
copyString += " > " + player_craft.ingreds[4].get("name") + " | " + player_craft.ingreds[5].get("name") + "]";
copyTextToClipboard(copyString);
document.getElementById("share-button").textContent = "Copied!"; document.getElementById("share-button").textContent = "Copied!";
} }
} }

View file

@ -206,7 +206,7 @@ const spell_table = {
{ subtitle: "Total Damage", type: "damage", multiplier: 100, conversion: [70, 30, 0, 0, 0, 0], summary: true }, { subtitle: "Total Damage", type: "damage", multiplier: 100, conversion: [70, 30, 0, 0, 0, 0], summary: true },
] }, ] },
], ],
"powder": [ //This is how instant-damage powder specials are implemented. To view time-boosted damage powder specials (curse, 2nd courage, air prison, view @TODO) "powder": [ //This is how instant-damage powder specials are implemented.
{ title: "Quake", cost: 0, parts:[ { title: "Quake", cost: 0, parts:[
{ subtitle: "Total Damage", type: "damage", multiplier: [155, 220, 285, 350, 415], conversion: [0,100,0,0,0,0], summary: true}, { subtitle: "Total Damage", type: "damage", multiplier: [155, 220, 285, 350, 415], conversion: [0,100,0,0,0,0], summary: true},
] }, ] },

View file

@ -1,6 +1,5 @@
let nonRolledIDs = ["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","str", "dex", "int", "agi", "def", "fixID", "category", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_"]; let nonRolledIDs = ["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","str", "dex", "int", "agi", "def", "fixID", "category", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_"];
let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"]; let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"];
let damageClasses = ["Neutral","Earth","Thunder","Water","Fire","Air"];
let reversedIDs = [ "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ]; let reversedIDs = [ "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ];
let colorMap = new Map( let colorMap = new Map(
[ [
@ -91,6 +90,10 @@ function expandIngredient(ing) {
for (const id of normIds) { for (const id of normIds) {
expandedIng.set(id, ing[id]); expandedIng.set(id, ing[id]);
} }
if (ing['isPowder']) {
expandedIng.set("isPowder",ing['isPowder']);
expandedIng.set("pid",ing['pid']);
}
//now the actually hard one //now the actually hard one
let idMap = new Map(); let idMap = new Map();
idMap.set("minRolls", new Map()); idMap.set("minRolls", new Map());
@ -121,7 +124,7 @@ function expandRecipe(recipe) {
expandedRecipe.set(id, [0,0]); expandedRecipe.set(id, [0,0]);
} }
} }
expandedRecipe.set("materials", [ new Map([ ["item", recipe['materials'][0]['item']], ["amount", recipe['materials'][0]['amount']] ]) , new Map([ ["item", recipe['materials'][1]['item']], ["amount",recipe['materials'][0]['amount'] ] ]) ]); expandedRecipe.set("materials", [ new Map([ ["item", recipe['materials'][0]['item']], ["amount", recipe['materials'][0]['amount']] ]) , new Map([ ["item", recipe['materials'][1]['item']], ["amount",recipe['materials'][1]['amount'] ] ]) ]);
//console.log(expandedRecipe); //console.log(expandedRecipe);
return expandedRecipe; return expandedRecipe;
} }
@ -369,7 +372,7 @@ function displayBuildStats(parent_id,build){
value_elem.classList.add('right'); value_elem.classList.add('right');
value_elem.setAttribute("colspan", "2"); value_elem.setAttribute("colspan", "2");
let prefix_elem = document.createElement('b'); let prefix_elem = document.createElement('b');
prefix_elem.textContent = "-> With Strength: "; prefix_elem.textContent = "\u279C With Strength: ";
let number_elem = document.createElement('b'); let number_elem = document.createElement('b');
number_elem.classList.add(style); number_elem.classList.add(style);
number_elem.textContent = (id_val * (1+skillPointsToPercentage(build.total_skillpoints[0])) ).toFixed(0) + idSuffixes[id]; number_elem.textContent = (id_val * (1+skillPointsToPercentage(build.total_skillpoints[0])) ).toFixed(0) + idSuffixes[id];
@ -428,13 +431,29 @@ function displayExpandedItem(item, parent_id){
let stats = new Map(); let stats = new Map();
stats.set("atkSpd", item.get("atkSpd")); stats.set("atkSpd", item.get("atkSpd"));
stats.set("damageBonus", [0, 0, 0, 0, 0]); stats.set("damageBonus", [0, 0, 0, 0, 0]);
//SUPER JANK @HPP PLS FIX
let damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ];
if (item.get("tier") !== "Crafted") {
stats.set("damageRaw", [item.get("nDam"), item.get("eDam"), item.get("tDam"), item.get("wDam"), item.get("fDam"), item.get("aDam")]); stats.set("damageRaw", [item.get("nDam"), item.get("eDam"), item.get("tDam"), item.get("wDam"), item.get("fDam"), item.get("aDam")]);
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0], 1, undefined); let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0], 1, undefined);
let damages = results[2]; let damages = results[2];
let damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ];
for (const i in damage_keys) { for (const i in damage_keys) {
item.set(damage_keys[i], damages[i][0]+"-"+damages[i][1]); item.set(damage_keys[i], damages[i][0]+"-"+damages[i][1]);
} }
} else {
stats.set("damageRaw", [item.get("nDamLow"), item.get("eDamLow"), item.get("tDamLow"), item.get("wDamLow"), item.get("fDamLow"), item.get("aDamLow")]);
let resultsLow = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0], 1, undefined);
let damagesLow = resultsLow[2];
stats.set("damageRaw", [item.get("nDam"), item.get("eDam"), item.get("tDam"), item.get("wDam"), item.get("fDam"), item.get("aDam")]);
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0], 1, undefined);
let damages = results[2];
for (const i in damage_keys) {
item.set(damage_keys[i], damagesLow[i][0]+"-"+damagesLow[i][1]+"\u279c"+damages[i][0]+"-"+damages[i][1]);
}
}
} }
let display_commands = [ let display_commands = [
@ -518,11 +537,11 @@ function displayExpandedItem(item, parent_id){
} }
} }
else { else {
let id = command; let id = command; //warp
if(( nonRolledIDs.includes(id) && item.get(id))){//nonRolledID & non-0/non-null/non-und ID if(( nonRolledIDs.includes(id) && item.get(id))){//nonRolledID & non-0/non-null/non-und ID
if (id === "slots") { if (id === "slots") {
let p_elem = document.createElement("p"); let p_elem = document.createElement("p");
// PROPER POWDER DISPLAYING EZ CLAP // PROPER POWDER DISPLAYING
let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]); let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]);
/*p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]) + /*p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]) +
" [ " + item.get("powders").map(x => powderNames.get(x)) + " ]";*/ " [ " + item.get("powders").map(x => powderNames.get(x)) + " ]";*/
@ -757,6 +776,7 @@ function displayExpandedItem(item, parent_id){
} }
dura_elem.textContent += dura[0]+"-"+dura[1] + suffix; dura_elem.textContent += dura[0]+"-"+dura[1] + suffix;
active_elem.append(dura_elem); active_elem.append(dura_elem);
} }
//Show item tier //Show item tier
if (item.get("tier") && item.get("tier") !== " ") { if (item.get("tier") && item.get("tier") !== " ") {
@ -1237,7 +1257,7 @@ function displayFixedID(active, id, value, elemental_format, style) {
} }
else { else {
// HACK TO AVOID DISPLAYING ZERO DAMAGE! TODO // HACK TO AVOID DISPLAYING ZERO DAMAGE! TODO
if (value === "0-0") { if (value === "0-0" || value === "0-0\u279c0-0") {
return; return;
} }
let p_elem = document.createElement('p'); let p_elem = document.createElement('p');

View file

@ -345,7 +345,7 @@ with open("ingreds_clean.json", "w") as outfile:
json.dump(ing_data, outfile, indent = 2) json.dump(ing_data, outfile, indent = 2)
with open("ingreds_compress2.json", "w") as outfile: with open("ingreds_compress2.json", "w") as outfile:
json.dump(ing_data, outfile) json.dump(ing_data, outfile)
with open("recipes_clean.json", "w") as outfile: '''with open("recipes_clean.json", "w") as outfile:
json.dump(recipe_data, outfile, indent = 2) json.dump(recipe_data, outfile, indent = 2)
with open("recipes_compress2.json", "w") as outfile: with open("recipes_compress2.json", "w") as outfile:
json.dump(recipe_data, outfile) json.dump(recipe_data, outfile)'''

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -31,6 +31,17 @@ let powderStats = [
_p(2,6,11,3,1), _p(4,9,14,6,2), _p(7,10,17,10,3), _p(9,13,22,16,5), _p(13,18,28,24,9), _p(16,18,35,34,13) _p(2,6,11,3,1), _p(4,9,14,6,2), _p(7,10,17,10,3), _p(9,13,22,16,5), _p(13,18,28,24,9), _p(16,18,35,34,13)
]; ];
class PowderIngredient {
constructor(durability, skpReq) {
this.durability = durability;
this.skpReq = skpReq;
}
}
function _pi(a,b) { return new PowderIngredient(a,b)}
let powderIngreds = [
_pi(-35,0),_pi(-52.5,0),_pi(-70,10),_pi(-91,20),_pi(-112,28),_pi(-133,36)
];
//Ordering: [weapon special name, weapon special effects, armor special name, armor special effects] //Ordering: [weapon special name, weapon special effects, armor special name, armor special effects]
class PowderSpecial{ class PowderSpecial{
constructor(wSpName, wSpEff, aSpName, aSpEff, cap){ constructor(wSpName, wSpEff, aSpName, aSpEff, cap){

View file

@ -1,6 +1,7 @@
let skp_order = ["str","dex","int","def","agi"]; let skp_order = ["str","dex","int","def","agi"];
let skill = ["Strength", "Dexterity", "Intelligence", "Defense", "Agility"]; let skill = ["Strength", "Dexterity", "Intelligence", "Defense", "Agility"];
let skp_elements = ["e","t","w","f","a"]; let skp_elements = ["e","t","w","f","a"];
let damageClasses = ["Neutral","Earth","Thunder","Water","Fire","Air"];
let elementIcons = ["\u2724","\u2726", "\u2749", "\u2739", "\u274b" ]; let elementIcons = ["\u2724","\u2726", "\u2749", "\u2739", "\u274b" ];
let skpReqs = skp_order.map(x => x + "Req"); let skpReqs = skp_order.map(x => x + "Req");