summaryrefslogtreecommitdiff
path: root/resources/js/classes/Item.js
blob: c70c28a6bbc9bfd1a3ff4c29162c6c9e6d1a7da3 (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);
  }

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

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