ENH: Default item icons

master
U~man 2020-07-20 23:34:53 +02:00
parent 63567b45b1
commit 2f3c91d72c
6 changed files with 21 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
src/assets/default/item.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@ -4,14 +4,34 @@ import { OseDice } from "../dice.js";
* Override and extend the basic :class:`Item` implementation * Override and extend the basic :class:`Item` implementation
*/ */
export class OseItem extends Item { export class OseItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Data Preparation */ /* Data Preparation */
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /**
* Augment the basic Item data model with additional dynamic data. * Augment the basic Item data model with additional dynamic data.
*/ */
prepareData() { prepareData() {
// Set default image
let img = CONST.DEFAULT_TOKEN;
switch (this.data.type) {
case "spell":
img = "/systems/ose/assets/default/spell.png";
break;
case "ability":
img = "/systems/ose/assets/default/ability.png";
break;
case "armor":
img = "/systems/ose/assets/default/armor.png";
break;
case "weapon":
img = "/systems/ose/assets/default/weapon.png";
break;
case "item":
img = "/systems/ose/assets/default/item.png";
break;
}
if (!this.data.img) this.data.img = img;
super.prepareData(); super.prepareData();
} }