Fix some stuff with indexeddb I guess

This commit is contained in:
b 2021-01-19 15:07:10 -06:00
parent 76ae82dbcf
commit 6f792ee79d
3 changed files with 19 additions and 119 deletions

View file

@ -266994,46 +266994,6 @@
"spRegen": -12, "spRegen": -12,
"id": 10138 "id": 10138
}, },
{
"tier": "Mythic",
"type": "spear",
"name": "Collapse (1.20)",
"displayName": "Collapse (1.20)",
"set": null,
"quest": null,
"classReq": null,
"restrict": "1.20 item",
"fixID": false,
"strReq": 35,
"dexReq": 35,
"intReq": 35,
"defReq": 35,
"agiReq": 35,
"atkSpd": "SLOW",
"category": "weapon",
"lvl": 97,
"nDam": "60-90",
"eDam": "0-250",
"tDam": "0-250",
"wDam": "0-250",
"fDam": "0-250",
"aDam": "0-250",
"slots": 3,
"str": 50,
"dex": 0,
"int": 0,
"def": 0,
"agi": 0,
"ms": 4,
"expd": 250,
"mdPct": 100,
"eDefPct": -65,
"tDefPct": -65,
"wDefPct": -65,
"fDefPct": -65,
"aDefPct": -65,
"id": 10139
},
{ {
"tier": "Unique", "tier": "Unique",
"type": "leggings", "type": "leggings",
@ -268842,7 +268802,7 @@
"aDam": "100-450", "aDam": "100-450",
"slots": 15, "slots": 15,
"str": 0, "str": 0,
"dex": 50, "dex": 60,
"int": 0, "int": 0,
"def": 0, "def": 0,
"agi": 0, "agi": 0,
@ -276351,81 +276311,6 @@
"gSpd": 0, "gSpd": 0,
"id": 10404 "id": 10404
}, },
{
"name": "Singularity (1.20)",
"tier": "Mythic",
"type": "wand",
"set": null,
"quest": null,
"poison": 0,
"thorns": 0,
"sprint": 0,
"category": "weapon",
"slots": 15,
"drop": "NORMAL",
"nDam": "0-0",
"fDam": "150-400",
"wDam": "200-350",
"aDam": "100-450",
"tDam": "50-500",
"eDam": "250-300",
"atkSpd": "SUPER_SLOW",
"lvl": 99,
"classReq": null,
"strReq": 45,
"dexReq": 45,
"intReq": 45,
"agiReq": 45,
"defReq": 45,
"hprPct": 0,
"mr": 0,
"sdPct": 10,
"mdPct": 15,
"ls": 0,
"ms": 0,
"xpb": 0,
"lb": 0,
"ref": 0,
"str": 0,
"dex": 60,
"int": 0,
"agi": 0,
"def": 0,
"expd": 0,
"spd": -40,
"atkTier": 0,
"hpBonus": 0,
"spRegen": 0,
"eSteal": 0,
"hprRaw": 250,
"sdRaw": 300,
"mdRaw": 600,
"fDamPct": 0,
"wDamPct": 0,
"aDamPct": 0,
"tDamPct": 0,
"eDamPct": 0,
"fDefPct": 0,
"wDefPct": 0,
"aDefPct": 0,
"tDefPct": 0,
"eDefPct": 0,
"spPct1": 0,
"spRaw1": 0,
"spPct2": 0,
"spRaw2": 0,
"spPct3": 0,
"spRaw3": 0,
"spPct4": 0,
"spRaw4": 0,
"rainbowRaw": 0,
"sprintReg": 0,
"jh": 0,
"lq": 0,
"gXp": 0,
"gSpd": 0,
"id": 10405
},
{ {
"name": "Libra (1.20)", "name": "Libra (1.20)",
"tier": "Legendary", "tier": "Legendary",

File diff suppressed because one or more lines are too long

19
load.js
View file

@ -1,4 +1,4 @@
const DB_VERSION = 23; const DB_VERSION = 24;
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js // @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
let db; let db;
@ -68,12 +68,27 @@ async function load(init_func) {
items = result.items; items = result.items;
sets = result.sets; sets = result.sets;
let clear_tx = db.transaction(['item_db', 'set_db'], 'readwrite');
let clear_items = clear_tx.objectStore('item_db');
let clear_sets = clear_tx.objectStore('item_db');
await clear_items.clear();
await clear_sets.clear();
await clear_tx.complete;
let add_tx = db.transaction(['item_db', 'set_db'], 'readwrite'); let add_tx = db.transaction(['item_db', 'set_db'], 'readwrite');
add_tx.onabort = function() {
console.log("Not enough space...");
};
let items_store = add_tx.objectStore('item_db'); let items_store = add_tx.objectStore('item_db');
let add_promises = []; let add_promises = [];
for (const item of items) { for (const item of items) {
clean_item(item); clean_item(item);
add_promises.push(items_store.add(item, item.name)); let req = items_store.add(item, item.name);
req.onerror = function() {
console.log("ADD ITEM ERROR? " + item.name);
};
add_promises.push(req);
} }
let sets_store = add_tx.objectStore('set_db'); let sets_store = add_tx.objectStore('set_db');
for (const set in sets) { for (const set in sets) {