summaryrefslogtreecommitdiff
path: root/resources/js/db.js
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-30 21:35:28 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-30 21:35:28 +0200
commit5214cdfbf26bc0bdee5d669a237fb8aefffb78d5 (patch)
tree7bec19278a0cf8fc1772e8eb6d985391d402c614 /resources/js/db.js
parent5e2e6753966c19616822915c14795bf62b589f68 (diff)
story!
Diffstat (limited to 'resources/js/db.js')
-rw-r--r--resources/js/db.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/resources/js/db.js b/resources/js/db.js
index 54fc751..3c8be05 100644
--- a/resources/js/db.js
+++ b/resources/js/db.js
@@ -68,6 +68,8 @@ const DB = {
*/
items: {},
+ npcs: {},
+
areas: {},
translations: {},
@@ -163,6 +165,19 @@ async function fetchItem (slug) {
}
/**
+ * @param {string} slug
+ *
+ * @returns {Promise<Object>}
+ */
+async function fetchNpc (slug) {
+ if (! DB.npcs[slug]) {
+ DB.npcs[slug] = await fetchDBData(`/modules/tuxemon/mods/tuxemon/db/npc/${slug}.json`).then((response) => response.json());
+ }
+
+ return DB.npcs[slug];
+}
+
+/**
* @param {string} locale
*
* @returns {Promise<Object>}