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 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") {

View file

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

View file

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

View file

@ -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;
}
}

View file

@ -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 = {};