undid April Fools + attempted changes on double loading

This commit is contained in:
ferricles 2021-04-02 10:44:54 -07:00
parent a093a65e76
commit d44b275f77
9 changed files with 88 additions and 67 deletions

View file

@ -1,6 +1,6 @@
const url_tag = location.hash.slice(1); const url_tag = location.hash.slice(1);
console.log(url_base); // console.log(url_base);
console.log(url_tag); // console.log(url_tag);
const BUILD_VERSION = "6.9.42.0"; const BUILD_VERSION = "6.9.42.0";

View file

@ -4,8 +4,8 @@
const ing_url_base = location.href.split("#")[0]; const ing_url_base = location.href.split("#")[0];
const ing_url_tag = location.hash.slice(1); const ing_url_tag = location.hash.slice(1);
console.log(ing_url_base); // console.log(ing_url_base);
console.log(ing_url_tag); // console.log(ing_url_tag);
@ -37,10 +37,9 @@ function init() {
//no ing //no ing
console.log("all ingredients"); console.log("all ingredients");
console.log(ings);
console.log("all recipes");
console.log(recipes);
console.log(ingMap); console.log(ingMap);
console.log("all recipes");
console.log(recipeMap);
/*console.log(ingList); /*console.log(ingList);
console.log(recipeList); console.log(recipeList);
console.log(ingIDMap); console.log(ingIDMap);

View file

@ -5,8 +5,8 @@
const custom_url_base = location.href.split("#")[0]; const custom_url_base = location.href.split("#")[0];
const custom_url_tag = location.hash.slice(1); const custom_url_tag = location.hash.slice(1);
console.log(custom_url_base); // console.log(custom_url_base);
console.log(custom_url_tag); // console.log(custom_url_tag);
const CUSTOM_BUILD_VERSION = "6.9.42.0"; const CUSTOM_BUILD_VERSION = "6.9.42.0";

View file

@ -136,7 +136,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
for (let i in damages) { for (let i in damages) {
let damageBoost = 1 + skillBoost[i] + staticBoost; let damageBoost = 1 + skillBoost[i] + staticBoost;
tooltipinfo.set("damageBoost", `(1 + ${tooltipinfo.get("skillBoost")[i]} + ${tooltipinfo.get("staticBoost")})`) tooltipinfo.set("damageBoost", `(1 + ${tooltipinfo.get("skillBoost")[i-1]} + ${tooltipinfo.get("staticBoost")})`)
damages_results.push([ damages_results.push([
//Math.max(damages[i][0] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal min //Math.max(damages[i][0] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal min
//Math.max(damages[i][1] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal max //Math.max(damages[i][1] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal max

View file

@ -5,6 +5,9 @@ icon_state_stored = window_storage.getItem("newicons");
newIcons = true; newIcons = true;
if (icon_state_stored === "false") {toggleIcons()} if (icon_state_stored === "false") {toggleIcons()}
//REMOVE THIS IN THE REAL VERSION 7 OR SOMETHING
window_storage.removeItem("rick");
/** Toggle icons on the ENTIRE page. /** Toggle icons on the ENTIRE page.
* *
*/ */

View file

@ -6,8 +6,8 @@
const item_url_base = location.href.split("#")[0]; const item_url_base = location.href.split("#")[0];
const item_url_tag = location.hash.slice(1); const item_url_tag = location.hash.slice(1);
console.log(item_url_base); // console.log(item_url_base);
console.log(item_url_tag); // console.log(item_url_tag);
const ITEM_BUILD_VERSION = "6.9.42.0"; const ITEM_BUILD_VERSION = "6.9.42.0";

View file

@ -13,6 +13,7 @@ let itemLists = new Map();
* Load item set from local DB. Calls init() on success. * Load item set from local DB. Calls init() on success.
*/ */
async function load_local(init_func) { async function load_local(init_func) {
if (!itemMap) {
let get_tx = db.transaction(['item_db', 'set_db'], 'readonly'); let get_tx = db.transaction(['item_db', 'set_db'], 'readonly');
let sets_store = get_tx.objectStore('set_db'); let sets_store = get_tx.objectStore('set_db');
let get_store = get_tx.objectStore('item_db'); let get_store = get_tx.objectStore('item_db');
@ -41,12 +42,18 @@ async function load_local(init_func) {
console.log("Successfully read local set db."); console.log("Successfully read local set db.");
//console.log(sets); //console.log(sets);
init_maps(); init_maps();
init_func();
} }
} }
} }
await get_tx.complete; await get_tx.complete;
db.close(); db.close();
} else {
console.log("Item and Set dbs already loaded!");
}
if (itemMap) {
init_func();
}
} }
/* /*

View file

@ -7,19 +7,21 @@ let ireload = false;
let ings; let ings;
let recipes; let recipes;
let ingMap = new Map(); let ingMap;
let ingList = []; let ingList = [];
let recipeMap = new Map(); let recipeMap;
let recipeList = []; let recipeList = [];
let ingIDMap = new Map(); let ingIDMap;
let recipeIDMap = new Map(); let recipeIDMap;
/* /*
* Load item set from local DB. Calls init() on success. * Load item set from local DB. Calls init() on success.
*/ */
async function ing_load_local(init_func) { async function ing_load_local(init_func) {
console.log("IngMap is: \n " + ingMap);
if (!ingMap) {
let get_tx = idb.transaction(['ing_db', 'recipe_db'], 'readonly'); let get_tx = idb.transaction(['ing_db', 'recipe_db'], 'readonly');
let ings_store = get_tx.objectStore('ing_db'); let ings_store = get_tx.objectStore('ing_db');
let recipes_store = get_tx.objectStore('recipe_db'); let recipes_store = get_tx.objectStore('recipe_db');
@ -30,7 +32,6 @@ async function ing_load_local(init_func) {
request3.onsuccess = function(event) { request3.onsuccess = function(event) {
console.log("Successfully read local ingredient db."); console.log("Successfully read local ingredient db.");
ings = request3.result; ings = request3.result;
}
let request4 = recipes_store.getAll(); let request4 = recipes_store.getAll();
request4.onerror = function(event) { request4.onerror = function(event) {
console.log("Could not read local recipe db..."); console.log("Could not read local recipe db...");
@ -39,10 +40,16 @@ async function ing_load_local(init_func) {
console.log("Successfully read local recipe db."); console.log("Successfully read local recipe db.");
recipes = request4.result; recipes = request4.result;
init_ing_maps(); init_ing_maps();
init_func(); }
} }
await get_tx.complete; await get_tx.complete;
idb.close(); idb.close();
} else {
console.log("Ingredient and Recipe dbs already loaded!");
}
if (ingMap) {
init_func();
}
} }
function clean_ing(ing) { function clean_ing(ing) {
@ -145,6 +152,11 @@ function load_ing_init(init_func) {
} }
function init_ing_maps() { function init_ing_maps() {
ingMap = new Map();
recipeMap = new Map();
ingIDMap = new Map();
recipeIDMap = new Map();
let ing = Object(); let ing = Object();
ing.name = "No Ingredient"; ing.name = "No Ingredient";
ing.displayName = "No Ingredient"; ing.displayName = "No Ingredient";

4
map.js
View file

@ -5,8 +5,8 @@
const map_url_base = location.href.split("#")[0]; const map_url_base = location.href.split("#")[0];
const map_url_tag = location.hash.slice(1); const map_url_tag = location.hash.slice(1);
console.log(map_url_base); // console.log(map_url_base);
console.log(map_url_tag); // console.log(map_url_tag);
const MAP_BUILD_VERSION = "6.9.42.0"; const MAP_BUILD_VERSION = "6.9.42.0";