Fix undefined slots

This commit is contained in:
b 2021-01-29 17:15:00 -06:00
parent 2ac4ac2fef
commit 280e5cb643

View file

@ -1,4 +1,4 @@
const DB_VERSION = 31; const DB_VERSION = 32;
// @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;
@ -55,6 +55,9 @@ function clean_item(item) {
item.skillpoints = [item.str, item.dex, item.int, item.def, item.agi]; item.skillpoints = [item.str, item.dex, item.int, item.def, item.agi];
item.has_negstat = item.str < 0 || item.dex < 0 || item.int < 0 || item.def < 0 || item.agi < 0; item.has_negstat = item.str < 0 || item.dex < 0 || item.int < 0 || item.def < 0 || item.agi < 0;
item.reqs = [item.strReq, item.dexReq, item.intReq, item.defReq, item.agiReq]; item.reqs = [item.strReq, item.dexReq, item.intReq, item.defReq, item.agiReq];
if (item.slots === undefined) {
item.slots = 0
}
} }
} }