summaryrefslogtreecommitdiff
path: root/resources/js/classes/Item.js
blob: 40089f23245b983d1d8cd418face432b93d167ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Item {
  constructor (slug) {
    this.slug = slug;
  }

  get name () {
    return translate(this.slug) || slugToName(this.slug);
  }

  get description () {
    return translate(`${this.slug}_description`) || 'ITEM_DESCRIPTION_MISSING';
  }

  get category () {
    return DB.items[this.slug].category;
  }

  get type () {
    return DB.items[this.slug].type;
  }

  get sprite () {
    const sprite = DB.items[this.slug].sprite;

    if (sprite) {
      return '/modules/tuxemon/mods/tuxemon/' + sprite;
    }

    return '';
  }

  get conditions () {
    return DB.items[this.slug].conditions;
  }

  get effects () {
    return DB.items[this.slug].effects;
  }
}