more trustworthy material multipliers

This commit is contained in:
ferricles 2021-02-05 10:17:46 -08:00
parent 194800a82d
commit 860fe7698a
5 changed files with 19 additions and 25 deletions

View file

@ -155,21 +155,13 @@ class Craft{
*/ */
let matmult = 1; let matmult = 1;
let sorted = this.mat_tiers.slice().sort(function(a, b){return a - b}); let tierToMult = [0,1,1.25,1.4];
//TODO - MAT MULTIPLIERS ARE SUS FOR NON-MIXING TIERS. let tiers = this.mat_tiers.slice();
if( sorted[0] == 1 && sorted[1] == 1) { let amounts = this.recipe.get("materials").map(x=> x.get("amount"));
matmult = 1; //Mat Multipliers - should work!
} else if( sorted[0] == 1 && sorted[1] == 2) { matmult = (tierToMult[tiers[0]]*amounts[0] + tierToMult[tiers[1]]*amounts[1]) / (amounts[0]+amounts[1]);
matmult = 1.09; console.log(matmult);
}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 low = this.recipe.get("healthOrDamage")[0]; let low = this.recipe.get("healthOrDamage")[0];
let high = this.recipe.get("healthOrDamage")[1]; let high = this.recipe.get("healthOrDamage")[1];
if (statMap.get("category") === "consumable") { if (statMap.get("category") === "consumable") {

View file

@ -42,10 +42,9 @@
</div> </div>
</div> </div>
<div class = "headerright"> <div class = "headerright">
<div class="center" id="advanced">
</div> <a href="./items_2.html" class = "link">Advanced Search</a>
<div class="center" id="advanced"> </div>
<a href="./items_2.html">Advanced Search</a>
</div> </div>
</header> </header>
</div> </div>

View file

@ -35,14 +35,16 @@
</div> </div>
</div> </div>
<div class = "headerright"> <div class = "headerright">
<div class="center" id="basic">
<a href="./items.html" class = "link">Basic Search</a>
</div>
</div> </div>
</header> </header>
<div class="center" id="credits"> <div class="center" id="credits">
<a href="credits.txt">Additional credits</a> <a href="credits.txt" class = "link">Additional credits</a>
</div> </div>
<div class="center" id="help"> <div class="center" id="help">
<a href="options.txt">Search Guide</a> <a href="options.txt" class = "link">Search Guide</a>
</div> </div>
<div class="center" id="main" style="padding: 2%"> <div class="center" id="main" style="padding: 2%">
<div id="search-container" style="margin-bottom: 1.5%"> <div id="search-container" style="margin-bottom: 1.5%">

View file

@ -96,7 +96,7 @@ function init() {
// update url query string // update url query string
const newUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}` 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); window.history.pushState({ path: newUrl }, '', newUrl);
// hide old search results // hide old search results
@ -174,10 +174,10 @@ function init() {
if (ndx !== -1) { if (ndx !== -1) {
switch (entryStr.substring(0, ndx)) { switch (entryStr.substring(0, ndx)) {
case 'f': case 'f':
searchFilterField.field.value = decodeURI(entryStr.substring(ndx + 1)); searchFilterField.field.value = decodeURIComponent(entryStr.substring(ndx + 1));
break; break;
case 's': case 's':
searchSortField.field.value = decodeURI(entryStr.substring(ndx + 1)); searchSortField.field.value = decodeURIComponent(entryStr.substring(ndx + 1));
break; break;
} }
} }

View file

@ -20,6 +20,7 @@ async function load_local(init_func) {
request.onsuccess = function(event) { request.onsuccess = function(event) {
console.log("Successfully read local item db."); console.log("Successfully read local item db.");
items = request.result; items = request.result;
console.log(items);
let request2 = sets_store.openCursor(); let request2 = sets_store.openCursor();
sets = {}; sets = {};