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 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.mat_tiers = mat_tiers;
this.ingreds = ingreds;
this.statMap = new Map(); //can use the statMap as an expanded Item
this.atkSpd = attackSpeed;
this.hash = hash;
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.
@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();
statMap.set("minRolls", 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("type", this.recipe.get("type").toLowerCase());
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("lvl", (this.recipe.get("lvl")[0] + "-" + this.recipe.get("lvl")[1]) );
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(this.recipe.get("lvl")[0] < 30) {
@ -70,7 +83,7 @@ class Craft{
}
statMap.set("category","consumable");
} else {
statMap.set("slots", 0);
statMap.set("charges", 0);
}
if (armorTypes.includes(statMap.get("type"))) {
@ -80,12 +93,13 @@ class Craft{
statMap.set("nDam", this.recipe.get("healthOrDamage").join("-"));
for (const e of skp_elements) {
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("category","weapon");
statMap.set("atkSpd",this.atkSpd);
}
statMap.set("powders","");
statMap.set("powders",[]);
/* Change certain IDs based on material tier.
healthOrDamage changes.
@ -94,7 +108,7 @@ class Craft{
*/
let matmult = 1;
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) {
matmult = 1;
} else if( sorted[0] == 1 && sorted[1] == 2) {
@ -123,18 +137,75 @@ class Craft{
}
if (statMap.get("category") === "weapon") {
//attack damages oh boy
let ratio = 2.05; //UNSURE IF THIS IS HOW IT'S DONE. MIGHT BE DONE WITH SKETCHY FLOORING.
if (this.atkSpd === "SLOW") {
let ratio = 2.05; //UNSURE IF THIS IS HOW IT'S DONE.
if (this['atkSpd'] === "SLOW") {
ratio /= 1.5;
} else if (this.atkSpd === "NORMAL") {
} else if (this['atkSpd'] === "NORMAL") {
ratio = 1;
} else if (this.atkSpd = "FAST") {
} else if (this['atkSpd'] === "FAST") {
ratio /= 2.5;
}
low *= ratio*matmult;
high *= ratio*matmult;
this.recipe.get("healthOrDamage")[0] = low;
this.recipe.get("healthOrDamage")[1] = high;
low = Math.floor(low * matmult);
high = Math.floor(high * matmult);
low = Math.floor(low * ratio);
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 */
@ -199,7 +270,11 @@ class Craft{
let eff_mult = (eff_flat[n] / 100).toFixed(2);
for (const [key, value] of ingred.get("itemIDs")) {
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
statMap.set("durability", statMap.get("durability").map(x => x + value));
}

View file

@ -43,138 +43,143 @@
</header>
</div>
<div class = "container" display = "grid">
<div class = "crafter center" style = "grid-column:1;grid-row:1" >
<table class = "center">
<tr>
<td>
<label for="recipe-choice">Recipe Type:</label>
<br/>
<input class="recipeinput" list="recipe-choices" id="recipe-choice" name="recipe-choice" placeholder="Potion"/>
<datalist id="recipe-choices">
</datalist>
</td>
<td >
<label for="level-choice">Recipe Level:</label>
<br/>
<input class="levelinput" list="level-choices" id="level-choice" name="level-choice" placeholder="103-105" />
<datalist id="level-choices">
</datalist>
</td>
</tr>
<tr>
<td class="center">
<label id = "mat-1" for="mat-1-tier-choice">Material 1 Tier:</label>
<br/>
<button class = "button Star" id = "mat-1-1" onclick = "toggleMaterial('mat-1-1')">1</button>
<button class = "button Star" id = "mat-1-2" onclick = "toggleMaterial('mat-1-2')">2</button>
<button class = "button Star" id = "mat-1-3" onclick = "toggleMaterial('mat-1-3')">3</button>
</td>
<td class="center">
<label id = "mat-2" for="mat-2-tier-choice">Material 2 Tier:</label>
<br/>
<button class = "button Star" id = "mat-2-1" onclick = "toggleMaterial('mat-2-1')">1</button>
<button class = "button Star" id = "mat-2-2" onclick = "toggleMaterial('mat-2-2')">2</button>
<button class = "button Star" id = "mat-2-3" onclick = "toggleMaterial('mat-2-3')">3</button>
</td>
</tr>
<tr>
<td class="center">
<label for="ing-choice-1">Ingredient 1:</label>
<br/>
<input class="inginput" list="ing-choices-1" id="ing-choice-1" name="ing-choice-1" placeholder="No Ingredient" />
<datalist id="ing-choices-1">
</datalist>
</td>
<td class="center">
<label for="ing-choice-2">Ingredient 2:</label>
<br/>
<input class="inginput" list="ing-choices-2" id="ing-choice-2" name="ing-choice-2" placeholder="No Ingredient" />
<datalist id="ing-choices-2">
</datalist>
</td>
</tr>
<tr>
<td class="center">
<label for="ing-choice-3">Ingredient 3:</label>
<br/>
<input class="inginput" list="ing-choices-3" id="ing-choice-3" name="ing-choice-3" placeholder="No Ingredient" />
<datalist id="ing-choices-3">
</datalist>
</td>
<td class="center">
<label for="ing-choice-4">Ingredient 4:</label>
<br/>
<input class="inginput" list="ing-choices-4" id="ing-choice-4" name="ing-choice-4" placeholder="No Ingredient" />
<datalist id="ing-choices-4">
</datalist>
</td>
</tr>
<tr>
<td class="center">
<label for="ing-choice-5">Ingredient 5:</label>
<br/>
<input class="inginput" list="ing-choices-5" id="ing-choice-5" name="ing-choice-5" placeholder="No Ingredient" />
<datalist id="ing-choices-5">
</datalist>
</td>
<td class="center">
<label for="ing-choice-6">Ingredient 6:</label>
<br/>
<input class="inginput" list="ing-choices-6" id="ing-choice-6" name="ing-choice-6" placeholder="No Ingredient" />
<datalist id="ing-choices-6">
</datalist>
</td>
</tr>
</table>
<label for = "atkSpdChoices"> Attack Speed (weapons only):</label>
<table class = "center" id = "atkSpdChoices">
<tr>
<td class = "center">
<button class = "button" id = "slow-atk-button" onclick = "toggleAtkSpd('slow-atk-button')">
Slow
</button>
</td>
<td class = "center">
<button class = "button" id = "normal-atk-button" onclick = "toggleAtkSpd('normal-atk-button')">
Normal
</button>
</td>
<td class = "center">
<button class = "button" id = "fast-atk-button" onclick = "toggleAtkSpd('fast-atk-button')">
Fast
</button>
</td>
</tr>
</table>
<table class = "center">
<tr>
<td class = "center">
<button class = "button" id = "craft-button" onclick = "calculateCraft()">
Craft Item
</button>
</td>
<td class = "center">
<button class = "button" id = "reset-button" onclick = "resetFields()">
Reset
</button>
</td>
<td class = "center">
<button class = "button" id = "copy-button" onclick = "copyRecipe()">
Copy Short
</button>
</td>
<td class = "center">
<button class = "button" id = "share-button" onclick = "shareRecipe()">
Copy Long
</button>
</td>
</tr>
</table>
<div class = "center" style = "grid-column:1;grid-row:1" >
<div class = "crafter">
<table class = "center">
<tr>
<td>
<label for="recipe-choice">Recipe Type:</label>
<br/>
<input class="recipeinput" list="recipe-choices" id="recipe-choice" name="recipe-choice" placeholder="Potion"/>
<datalist id="recipe-choices">
</datalist>
</td>
<td >
<label for="level-choice">Recipe Level:</label>
<br/>
<input class="levelinput" list="level-choices" id="level-choice" name="level-choice" placeholder="103-105" />
<datalist id="level-choices">
</datalist>
</td>
</tr>
<tr>
<td class="center">
<label id = "mat-1" for="mat-1-tier-choice">Material 1 Tier:</label>
<br/>
<button class = "button Star" id = "mat-1-1" onclick = "toggleMaterial('mat-1-1')">1</button>
<button class = "button Star" id = "mat-1-2" onclick = "toggleMaterial('mat-1-2')">2</button>
<button class = "button Star" id = "mat-1-3" onclick = "toggleMaterial('mat-1-3')">3</button>
</td>
<td class="center">
<label id = "mat-2" for="mat-2-tier-choice">Material 2 Tier:</label>
<br/>
<button class = "button Star" id = "mat-2-1" onclick = "toggleMaterial('mat-2-1')">1</button>
<button class = "button Star" id = "mat-2-2" onclick = "toggleMaterial('mat-2-2')">2</button>
<button class = "button Star" id = "mat-2-3" onclick = "toggleMaterial('mat-2-3')">3</button>
</td>
</tr>
<tr>
<td class="center">
<label for="ing-choice-1">Ingredient 1:</label>
<br/>
<input class="inginput" list="ing-choices-1" id="ing-choice-1" name="ing-choice-1" placeholder="No Ingredient" />
<datalist id="ing-choices-1">
</datalist>
</td>
<td class="center">
<label for="ing-choice-2">Ingredient 2:</label>
<br/>
<input class="inginput" list="ing-choices-2" id="ing-choice-2" name="ing-choice-2" placeholder="No Ingredient" />
<datalist id="ing-choices-2">
</datalist>
</td>
</tr>
<tr>
<td class="center">
<label for="ing-choice-3">Ingredient 3:</label>
<br/>
<input class="inginput" list="ing-choices-3" id="ing-choice-3" name="ing-choice-3" placeholder="No Ingredient" />
<datalist id="ing-choices-3">
</datalist>
</td>
<td class="center">
<label for="ing-choice-4">Ingredient 4:</label>
<br/>
<input class="inginput" list="ing-choices-4" id="ing-choice-4" name="ing-choice-4" placeholder="No Ingredient" />
<datalist id="ing-choices-4">
</datalist>
</td>
</tr>
<tr>
<td class="center">
<label for="ing-choice-5">Ingredient 5:</label>
<br/>
<input class="inginput" list="ing-choices-5" id="ing-choice-5" name="ing-choice-5" placeholder="No Ingredient" />
<datalist id="ing-choices-5">
</datalist>
</td>
<td class="center">
<label for="ing-choice-6">Ingredient 6:</label>
<br/>
<input class="inginput" list="ing-choices-6" id="ing-choice-6" name="ing-choice-6" placeholder="No Ingredient" />
<datalist id="ing-choices-6">
</datalist>
</td>
</tr>
</table>
<label for = "atkSpdChoices"> Attack Speed (weapons only):</label>
<table class = "center" id = "atkSpdChoices">
<tr>
<td class = "center">
<button class = "button" id = "slow-atk-button" onclick = "toggleAtkSpd('slow-atk-button')">
Slow
</button>
</td>
<td class = "center">
<button class = "button" id = "normal-atk-button" onclick = "toggleAtkSpd('normal-atk-button')">
Normal
</button>
</td>
<td class = "center">
<button class = "button" id = "fast-atk-button" onclick = "toggleAtkSpd('fast-atk-button')">
Fast
</button>
</td>
</tr>
</table>
<table class = "center">
<tr>
<td class = "center">
<button class = "button" id = "craft-button" onclick = "calculateCraft()">
Craft Item
</button>
</td>
<td class = "center">
<button class = "button" id = "reset-button" onclick = "resetFields()">
Reset
</button>
</td>
<td class = "center">
<button class = "button" id = "copy-button" onclick = "copyRecipe()">
Copy Short
</button>
</td>
<td class = "center">
<button class = "button" id = "share-button" onclick = "shareRecipe()">
Copy Long
</button>
</td>
</tr>
</table>
</div>
</div>
<div class = "recipe center hide-container-block" style = "display:none">
<div class = "recipe-stats">
<div class = "center" id = "recipe-stats"></div>
</div>
<div class = "craft-warnings">
<div class = "center" id = "craft-warnings"></div>
</div>
</div>
<div class = "crafted center hide-container-block" style = "display:none">
<div class = "craft-stats">
@ -183,9 +188,7 @@
</div>
<!--This is also incredibly janky.-->
<div class = "craft-warnings">
<div class = "center" id = "craft-warnings"></div>
</div>
<p></p>
<p></p>
<p></p>
<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").classList.add("funnynumber");
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);
}
setTitle();
@ -38,6 +38,10 @@ let ingMap = new Map();
let ingList = [];
let recipeMap = new Map();
let recipeList = [];
let ingIDMap = new Map();
let recipeIDMap = new Map();
function init() {
//no ing
let ing = Object();
@ -48,19 +52,62 @@ function init() {
ing.ids= {};
ing.itemIDs = {"dura": 0, "strReq": 0, "dexReq": 0,"intReq": 0,"defReq": 0,"agiReq": 0,};
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);
ing.posMods = {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0};
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) {
ingMap.set(ing["name"], ing);
ingList.push(ing["name"]);
}
for (const recipe of recipes) {
recipeMap.set(recipe["id"], recipe);
recipeList.push(recipe["id"]);
}
console.log("all ingredients");
console.log(ings);
console.log("all recipes");
console.log(recipes);
console.log("e");
console.log(ingList);
console.log(recipeList);
document.getElementById("recipe-choice").addEventListener("change", (event) => {
updateMaterials();
@ -70,6 +117,7 @@ function init() {
});
populateFields();
decodeCraft(url_tag);
}
function updateMaterials() {
let recipeName = getValue("recipe-choice") ? getValue("recipe-choice") : "Potion";
@ -80,7 +128,7 @@ function updateMaterials() {
document.getElementById("mat-1").textContent = recipe.get("materials")[0].get("item").split(" ").slice(1).join(" ") + " Tier:";
document.getElementById("mat-2").textContent = recipe.get("materials")[1].get("item").split(" ").slice(1).join(" ") + " Tier:";
} catch (error){
//eee
//e e e
}
}
else {
@ -139,7 +187,10 @@ function calculateCraft() {
}
}
//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(recipe)
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() {
let recipe_list = document.getElementById("recipe-choices");
for (const recipe of recipeTypes) {
@ -225,7 +323,13 @@ function copyRecipe(){
*/
function shareRecipe(){
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!";
}
}

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 },
] },
],
"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:[
{ 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 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 colorMap = new Map(
[
@ -91,6 +90,10 @@ function expandIngredient(ing) {
for (const id of normIds) {
expandedIng.set(id, ing[id]);
}
if (ing['isPowder']) {
expandedIng.set("isPowder",ing['isPowder']);
expandedIng.set("pid",ing['pid']);
}
//now the actually hard one
let idMap = new Map();
idMap.set("minRolls", new Map());
@ -121,7 +124,7 @@ function expandRecipe(recipe) {
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);
return expandedRecipe;
}
@ -369,7 +372,7 @@ function displayBuildStats(parent_id,build){
value_elem.classList.add('right');
value_elem.setAttribute("colspan", "2");
let prefix_elem = document.createElement('b');
prefix_elem.textContent = "-> With Strength: ";
prefix_elem.textContent = "\u279C With Strength: ";
let number_elem = document.createElement('b');
number_elem.classList.add(style);
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();
stats.set("atkSpd", item.get("atkSpd"));
stats.set("damageBonus", [0, 0, 0, 0, 0]);
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];
//SUPER JANK @HPP PLS FIX
let damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ];
for (const i in damage_keys) {
item.set(damage_keys[i], damages[i][0]+"-"+damages[i][1]);
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")]);
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], 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 = [
@ -518,11 +537,11 @@ function displayExpandedItem(item, parent_id){
}
}
else {
let id = command;
let id = command; //warp
if(( nonRolledIDs.includes(id) && item.get(id))){//nonRolledID & non-0/non-null/non-und ID
if (id === "slots") {
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"]]);
/*p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]) +
" [ " + 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;
active_elem.append(dura_elem);
}
//Show item tier
if (item.get("tier") && item.get("tier") !== " ") {
@ -1237,7 +1257,7 @@ function displayFixedID(active, id, value, elemental_format, style) {
}
else {
// HACK TO AVOID DISPLAYING ZERO DAMAGE! TODO
if (value === "0-0") {
if (value === "0-0" || value === "0-0\u279c0-0") {
return;
}
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)
with open("ingreds_compress2.json", "w") as 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)
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)
];
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]
class PowderSpecial{
constructor(wSpName, wSpEff, aSpName, aSpEff, cap){

View file

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