From c6549fffbb4d1295b87f07edd77a0ff5c1a9a883 Mon Sep 17 00:00:00 2001 From: hppeng Date: Mon, 3 Apr 2023 11:33:37 -0700 Subject: [PATCH] Move powder ingreds to ing load sequence not used anywhere else also, remove extra prints in crafter --- js/crafter.js | 2 -- js/load_ing.js | 32 +++++++++++--------------------- js/powders.js | 11 ----------- 3 files changed, 11 insertions(+), 34 deletions(-) diff --git a/js/crafter.js b/js/crafter.js index fe0a9f6..50a68c4 100644 --- a/js/crafter.js +++ b/js/crafter.js @@ -136,8 +136,6 @@ function calculateCraft() { } let ingreds = []; for (i = 1; i < 7; i++) { - console.log("ing-choice-"+i); - // console.log(getValue("ing-choice-"+i)); getValue("ing-choice-" + i) === "" ? ingreds.push(expandIngredient(ingMap.get("No Ingredient"))) : ingreds.push(expandIngredient(ingMap.get(getValue("ing-choice-" + i)))); } let atkSpd = "NORMAL"; //default attack speed will be normal. diff --git a/js/load_ing.js b/js/load_ing.js index 25b5bb1..e38ca18 100644 --- a/js/load_ing.js +++ b/js/load_ing.js @@ -201,39 +201,29 @@ function init_ing_maps() { ingList.push(ing.displayName); ingIDMap.set(ing.id, ing.displayName); let numerals = new Map([[1, "I"], [2, "II"], [3, "III"], [4, "IV"], [5, "V"], [6, "VI"]]); + + // pairs of (dura, req) + let powder_ing_info = [ + [-35,0],[-52.5,0],[-70,10],[-91,20],[-112,28],[-133,36] + ]; for (let i = 0; i < 5; i ++) { - for (const powderIng of powderIngreds) { + for (let powder_tier = 0; powder_tier < 6; ++powder_tier) { + powder_info = powder_ing_info[powder_tier]; let ing = { - name: "" + damageClasses[i+1] + " Powder " + numerals.get(powderIngreds.indexOf(powderIng) + 1), + name: "" + damageClasses[i+1] + " Powder " + numerals.get(powder_tier + 1), tier: 0, lvl: 0, skills: ["ARMOURING", "TAILORING", "WEAPONSMITHING", "WOODWORKING", "JEWELING"], ids: {}, isPowder: true, - pid: 6*i + powderIngreds.indexOf(powderIng), - itemIDs: {"dura": powderIng["durability"], "strReq": 0, "dexReq": 0,"intReq": 0,"defReq": 0,"agiReq": 0}, + pid: 6*i + powder_tier, + itemIDs: {"dura": powder_info[0], "strReq": 0, "dexReq": 0,"intReq": 0,"defReq": 0,"agiReq": 0}, consumableIDs: {"dura": 0, "charges": 0}, posMods: {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0} }; ing.id = 4001 + ing.pid; ing.displayName = ing.name; - 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.itemIDs[skp_order[i] + "Req"] = powder_info[1]; ingMap.set(ing.displayName, ing); ingList.push(ing.displayName); ingIDMap.set(ing.id, ing.displayName); diff --git a/js/powders.js b/js/powders.js index a937f04..5cd948b 100644 --- a/js/powders.js +++ b/js/powders.js @@ -31,17 +31,6 @@ let powderStats = [ _p(2,6,11,3,1), _p(3,10,14,6,2), _p(4,11,17,10,3), _p(5,11,22,16,5), _p(7,12,28,24,9), _p(8,14,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){