summaryrefslogtreecommitdiff
path: root/resources/js/db.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/js/db.js')
-rw-r--r--resources/js/db.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/resources/js/db.js b/resources/js/db.js
index 96b971a..64b2e9b 100644
--- a/resources/js/db.js
+++ b/resources/js/db.js
@@ -1,16 +1,19 @@
const DB = {
allMonsters: [],
allAnimations: {},
+ allItems: [],
monsters: {},
shapes: {},
elements: {},
techniques: {},
statusEffects: {},
+ items: {},
};
async function initializeDB () {
DB.allMonsters = await fetch('/db/all-monsters.json').then((response) => response.json());
DB.allAnimations = await fetch('/db/animations.json').then((response) => response.json());
+ DB.allItems = await fetch('/db/all-items.json').then((response) => response.json());
DB.shapes = await fetch('/modules/tuxemon/mods/tuxemon/db/shape/shapes.json').then((response) => response.json());
@@ -60,3 +63,16 @@ async function fetchStatusEffect (slug) {
return new StatusEffect(slug);
}
+
+/**
+ * @param {string} slug
+ *
+ * @returns {Promise<StatusEffect>}
+ */
+async function fetchItem (slug) {
+ if (! DB.items[slug]) {
+ DB.items[slug] = await fetch(`/modules/tuxemon/mods/tuxemon/db/item/${slug}.json`).then((response) => response.json());
+ }
+
+ return new Item(slug);
+}