From c657c77d0cf49afba627b93848e1915e2ce7d3ff Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 31 Aug 2023 20:23:06 +0200 Subject: story and npcs --- resources/js/classes/Npc.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 resources/js/classes/Npc.js (limited to 'resources/js/classes') diff --git a/resources/js/classes/Npc.js b/resources/js/classes/Npc.js new file mode 100644 index 0000000..6121bce --- /dev/null +++ b/resources/js/classes/Npc.js @@ -0,0 +1,15 @@ +class Npc { + name = ''; + spriteName = ''; + + constructor (slug) { + this.slug = slug; + + this.name = translate(slug) || slugToName(slug.replace('spyder_', '')); + this.spriteName = DB.npcs[slug]?.template[0].sprite_name; + } + + get sprite () { + return `/modules/tuxemon/mods/tuxemon/gfx/sprites/player/${this.spriteName}.png`; + } +} -- cgit v1.2.3