make equip icon for items clickable in item list in character sheet

This commit is contained in:
Johannes Loher 2020-12-31 12:10:59 +01:00
parent cba20e47e5
commit 6fac2c597f
3 changed files with 18 additions and 11 deletions

View file

@ -1,4 +1,4 @@
import { DS4ItemDataType } from "../item/item-data";
import { DS4ItemDataType, DS4ItemEquipable } from "../item/item-data";
import { DS4Actor } from "./actor";
import { DS4ActorDataType } from "./actor-data";
@ -62,6 +62,13 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4Ite
li.slideUp(200, () => this.render(false));
});
html.find(".item-equip").on("click", (ev) => {
const id = $(ev.currentTarget).parents(".item").data("itemId");
const item = duplicate(this.actor.getEmbeddedEntity("OwnedItem", id));
setProperty(item, "data.equipped", !getProperty(item, "data.equipped"));
this.actor.updateOwnedItem(item);
});
// Rollable abilities.
html.find(".rollable").click(this._onRoll.bind(this));
}