diff --git a/src/module/actor/actor-sheet.ts b/src/module/actor/actor-sheet.ts index d08e488f..e7c16819 100644 --- a/src/module/actor/actor-sheet.ts +++ b/src/module/actor/actor-sheet.ts @@ -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 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)); } diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index 58f4dc90..a7771d67 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -30,7 +30,7 @@ interface DS4ItemPhysical { storageLocation: string; } -interface DS4ItemEquipable { +export interface DS4ItemEquipable { equipped: boolean; } diff --git a/src/templates/actor/partials/items.hbs b/src/templates/actor/partials/items.hbs index 1c72cd46..0d09670f 100644 --- a/src/templates/actor/partials/items.hbs +++ b/src/templates/actor/partials/items.hbs @@ -5,7 +5,7 @@ {{!-- WEAPONS --}}

{{localize 'DS4.ItemTypeWeapon'}}

{{!-- SPECIFIC --}}
    -
  1. +
  2. E
    {{!-- equipped --}} {{!-- SPECIFIC --}}
    @@ -32,8 +32,8 @@
  3. {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} + {{#if itemData.equipped}} + {{else}} {{/if}} {{!--SPECIFIC --}} {{!-- image --}}
    @@ -94,8 +94,8 @@
  4. {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} + {{#if itemData.equipped}} + {{else}} {{/if}} {{!--SPECIFIC --}} {{!-- image --}}
    @@ -152,8 +152,8 @@
  5. {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} + {{#if itemData.equipped}} + {{else}} {{/if}} {{!--SPECIFIC --}} {{!-- image --}}
    @@ -202,8 +202,8 @@
  6. {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} + {{#if itemData.equipped}} + {{else}} {{/if}} {{!--SPECIFIC --}} {{!-- image --}}