diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-08-30 21:35:28 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-08-30 21:35:28 +0200 |
commit | 5214cdfbf26bc0bdee5d669a237fb8aefffb78d5 (patch) | |
tree | 7bec19278a0cf8fc1772e8eb6d985391d402c614 /resources/js/db.js | |
parent | 5e2e6753966c19616822915c14795bf62b589f68 (diff) |
story!
Diffstat (limited to 'resources/js/db.js')
-rw-r--r-- | resources/js/db.js | 15 |
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>} |