undid April Fools + attempted changes on double loading
This commit is contained in:
parent
a093a65e76
commit
d44b275f77
9 changed files with 88 additions and 67 deletions
|
@ -1,6 +1,6 @@
|
|||
const url_tag = location.hash.slice(1);
|
||||
console.log(url_base);
|
||||
console.log(url_tag);
|
||||
// console.log(url_base);
|
||||
// console.log(url_tag);
|
||||
|
||||
const BUILD_VERSION = "6.9.42.0";
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
const ing_url_base = location.href.split("#")[0];
|
||||
const ing_url_tag = location.hash.slice(1);
|
||||
console.log(ing_url_base);
|
||||
console.log(ing_url_tag);
|
||||
// console.log(ing_url_base);
|
||||
// console.log(ing_url_tag);
|
||||
|
||||
|
||||
|
||||
|
@ -37,10 +37,9 @@ function init() {
|
|||
//no ing
|
||||
|
||||
console.log("all ingredients");
|
||||
console.log(ings);
|
||||
console.log("all recipes");
|
||||
console.log(recipes);
|
||||
console.log(ingMap);
|
||||
console.log("all recipes");
|
||||
console.log(recipeMap);
|
||||
/*console.log(ingList);
|
||||
console.log(recipeList);
|
||||
console.log(ingIDMap);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
const custom_url_base = location.href.split("#")[0];
|
||||
const custom_url_tag = location.hash.slice(1);
|
||||
console.log(custom_url_base);
|
||||
console.log(custom_url_tag);
|
||||
// console.log(custom_url_base);
|
||||
// console.log(custom_url_tag);
|
||||
|
||||
const CUSTOM_BUILD_VERSION = "6.9.42.0";
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
|||
|
||||
for (let i in damages) {
|
||||
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([
|
||||
//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
|
||||
|
|
3
icons.js
3
icons.js
|
@ -5,6 +5,9 @@ icon_state_stored = window_storage.getItem("newicons");
|
|||
newIcons = true;
|
||||
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.
|
||||
*
|
||||
*/
|
||||
|
|
4
item.js
4
item.js
|
@ -6,8 +6,8 @@
|
|||
|
||||
const item_url_base = location.href.split("#")[0];
|
||||
const item_url_tag = location.hash.slice(1);
|
||||
console.log(item_url_base);
|
||||
console.log(item_url_tag);
|
||||
// console.log(item_url_base);
|
||||
// console.log(item_url_tag);
|
||||
|
||||
const ITEM_BUILD_VERSION = "6.9.42.0";
|
||||
|
||||
|
|
63
load.js
63
load.js
|
@ -13,40 +13,47 @@ let itemLists = new Map();
|
|||
* Load item set from local DB. Calls init() on success.
|
||||
*/
|
||||
async function load_local(init_func) {
|
||||
let get_tx = db.transaction(['item_db', 'set_db'], 'readonly');
|
||||
let sets_store = get_tx.objectStore('set_db');
|
||||
let get_store = get_tx.objectStore('item_db');
|
||||
let request = get_store.getAll();
|
||||
request.onerror = function(event) {
|
||||
console.log("Could not read local item db...");
|
||||
}
|
||||
request.onsuccess = function(event) {
|
||||
console.log("Successfully read local item db.");
|
||||
items = request.result;
|
||||
//console.log(items);
|
||||
let request2 = sets_store.openCursor();
|
||||
|
||||
sets = {};
|
||||
request2.onerror = function(event) {
|
||||
console.log("Could not read local set db...");
|
||||
if (!itemMap) {
|
||||
let get_tx = db.transaction(['item_db', 'set_db'], 'readonly');
|
||||
let sets_store = get_tx.objectStore('set_db');
|
||||
let get_store = get_tx.objectStore('item_db');
|
||||
let request = get_store.getAll();
|
||||
request.onerror = function(event) {
|
||||
console.log("Could not read local item db...");
|
||||
}
|
||||
request.onsuccess = function(event) {
|
||||
console.log("Successfully read local item db.");
|
||||
items = request.result;
|
||||
//console.log(items);
|
||||
let request2 = sets_store.openCursor();
|
||||
|
||||
request2.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
sets[cursor.primaryKey] = cursor.value;
|
||||
cursor.continue();
|
||||
sets = {};
|
||||
request2.onerror = function(event) {
|
||||
console.log("Could not read local set db...");
|
||||
}
|
||||
else {
|
||||
console.log("Successfully read local set db.");
|
||||
//console.log(sets);
|
||||
init_maps();
|
||||
init_func();
|
||||
|
||||
request2.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
sets[cursor.primaryKey] = cursor.value;
|
||||
cursor.continue();
|
||||
}
|
||||
else {
|
||||
console.log("Successfully read local set db.");
|
||||
//console.log(sets);
|
||||
init_maps();
|
||||
}
|
||||
}
|
||||
}
|
||||
await get_tx.complete;
|
||||
db.close();
|
||||
} else {
|
||||
console.log("Item and Set dbs already loaded!");
|
||||
}
|
||||
|
||||
if (itemMap) {
|
||||
init_func();
|
||||
}
|
||||
await get_tx.complete;
|
||||
db.close();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
60
load_ing.js
60
load_ing.js
|
@ -7,42 +7,49 @@ let ireload = false;
|
|||
let ings;
|
||||
let recipes;
|
||||
|
||||
let ingMap = new Map();
|
||||
let ingMap;
|
||||
let ingList = [];
|
||||
|
||||
let recipeMap = new Map();
|
||||
let recipeMap;
|
||||
let recipeList = [];
|
||||
|
||||
let ingIDMap = new Map();
|
||||
let recipeIDMap = new Map();
|
||||
let ingIDMap;
|
||||
let recipeIDMap;
|
||||
|
||||
/*
|
||||
* Load item set from local DB. Calls init() on success.
|
||||
*/
|
||||
async function ing_load_local(init_func) {
|
||||
let get_tx = idb.transaction(['ing_db', 'recipe_db'], 'readonly');
|
||||
let ings_store = get_tx.objectStore('ing_db');
|
||||
let recipes_store = get_tx.objectStore('recipe_db');
|
||||
let request3 = ings_store.getAll();
|
||||
request3.onerror = function(event) {
|
||||
console.log("Could not read local ingredient db...");
|
||||
console.log("IngMap is: \n " + ingMap);
|
||||
if (!ingMap) {
|
||||
let get_tx = idb.transaction(['ing_db', 'recipe_db'], 'readonly');
|
||||
let ings_store = get_tx.objectStore('ing_db');
|
||||
let recipes_store = get_tx.objectStore('recipe_db');
|
||||
let request3 = ings_store.getAll();
|
||||
request3.onerror = function(event) {
|
||||
console.log("Could not read local ingredient db...");
|
||||
}
|
||||
request3.onsuccess = function(event) {
|
||||
console.log("Successfully read local ingredient db.");
|
||||
ings = request3.result;
|
||||
let request4 = recipes_store.getAll();
|
||||
request4.onerror = function(event) {
|
||||
console.log("Could not read local recipe db...");
|
||||
}
|
||||
request4.onsuccess = function(event) {
|
||||
console.log("Successfully read local recipe db.");
|
||||
recipes = request4.result;
|
||||
init_ing_maps();
|
||||
}
|
||||
}
|
||||
await get_tx.complete;
|
||||
idb.close();
|
||||
} else {
|
||||
console.log("Ingredient and Recipe dbs already loaded!");
|
||||
}
|
||||
request3.onsuccess = function(event) {
|
||||
console.log("Successfully read local ingredient db.");
|
||||
ings = request3.result;
|
||||
}
|
||||
let request4 = recipes_store.getAll();
|
||||
request4.onerror = function(event) {
|
||||
console.log("Could not read local recipe db...");
|
||||
}
|
||||
request4.onsuccess = function(event) {
|
||||
console.log("Successfully read local recipe db.");
|
||||
recipes = request4.result;
|
||||
init_ing_maps();
|
||||
if (ingMap) {
|
||||
init_func();
|
||||
}
|
||||
await get_tx.complete;
|
||||
idb.close();
|
||||
}
|
||||
|
||||
function clean_ing(ing) {
|
||||
|
@ -145,6 +152,11 @@ function load_ing_init(init_func) {
|
|||
}
|
||||
|
||||
function init_ing_maps() {
|
||||
ingMap = new Map();
|
||||
recipeMap = new Map();
|
||||
ingIDMap = new Map();
|
||||
recipeIDMap = new Map();
|
||||
|
||||
let ing = Object();
|
||||
ing.name = "No Ingredient";
|
||||
ing.displayName = "No Ingredient";
|
||||
|
|
4
map.js
4
map.js
|
@ -5,8 +5,8 @@
|
|||
|
||||
const map_url_base = location.href.split("#")[0];
|
||||
const map_url_tag = location.hash.slice(1);
|
||||
console.log(map_url_base);
|
||||
console.log(map_url_tag);
|
||||
// console.log(map_url_base);
|
||||
// console.log(map_url_tag);
|
||||
|
||||
const MAP_BUILD_VERSION = "6.9.42.0";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue