From 860fe7698ae1a28c39da4075e3151303ae0ddedc Mon Sep 17 00:00:00 2001 From: ferricles Date: Fri, 5 Feb 2021 10:17:46 -0800 Subject: [PATCH] more trustworthy material multipliers --- craft.js | 22 +++++++--------------- items.html | 7 +++---- items_2.html | 8 +++++--- items_2.js | 6 +++--- load.js | 1 + 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/craft.js b/craft.js index 0ccdcdd..25caa36 100644 --- a/craft.js +++ b/craft.js @@ -155,21 +155,13 @@ class Craft{ */ let matmult = 1; - let sorted = this.mat_tiers.slice().sort(function(a, b){return a - b}); - //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) { - matmult = 1.09; - }else if( sorted[0] == 1 && sorted[1] == 3) { - matmult = 1.15; - }else if( sorted[0] == 2 && sorted[1] == 2) { - matmult = 1.25; - }else if( sorted[0] == 2 && sorted[1] == 3) { - matmult = 1.3; - }else if( sorted[0] == 3 && sorted[1] == 3) { - matmult = 1.4; - } + let tierToMult = [0,1,1.25,1.4]; + let tiers = this.mat_tiers.slice(); + let amounts = this.recipe.get("materials").map(x=> x.get("amount")); + //Mat Multipliers - should work! + matmult = (tierToMult[tiers[0]]*amounts[0] + tierToMult[tiers[1]]*amounts[1]) / (amounts[0]+amounts[1]); + console.log(matmult); + let low = this.recipe.get("healthOrDamage")[0]; let high = this.recipe.get("healthOrDamage")[1]; if (statMap.get("category") === "consumable") { diff --git a/items.html b/items.html index 79fe83e..c1b639b 100644 --- a/items.html +++ b/items.html @@ -42,10 +42,9 @@
- -
-
- Advanced Search +
diff --git a/items_2.html b/items_2.html index 981901c..b41fe7a 100644 --- a/items_2.html +++ b/items_2.html @@ -35,14 +35,16 @@
- +
- Additional credits + Additional credits
- Search Guide + Search Guide
diff --git a/items_2.js b/items_2.js index 9375ac3..bbe96f2 100644 --- a/items_2.js +++ b/items_2.js @@ -96,7 +96,7 @@ function init() { // update url query string const newUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}` - + `?f=${encodeURI(searchFilterField.value)}&s=${encodeURI(searchSortField.value)}`; + + `?f=${encodeURIComponent(searchFilterField.value)}&s=${encodeURIComponent(searchSortField.value)}`; window.history.pushState({ path: newUrl }, '', newUrl); // hide old search results @@ -174,10 +174,10 @@ function init() { if (ndx !== -1) { switch (entryStr.substring(0, ndx)) { case 'f': - searchFilterField.field.value = decodeURI(entryStr.substring(ndx + 1)); + searchFilterField.field.value = decodeURIComponent(entryStr.substring(ndx + 1)); break; case 's': - searchSortField.field.value = decodeURI(entryStr.substring(ndx + 1)); + searchSortField.field.value = decodeURIComponent(entryStr.substring(ndx + 1)); break; } } diff --git a/load.js b/load.js index 241ad4a..2891646 100644 --- a/load.js +++ b/load.js @@ -20,6 +20,7 @@ async function load_local(init_func) { request.onsuccess = function(event) { console.log("Successfully read local item db."); items = request.result; + console.log(items); let request2 = sets_store.openCursor(); sets = {};