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.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>}