mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
FEAT: add inventory-fieldset-items-V2 and inventory-item-V2 partials for Actors
This commit is contained in:
parent
9ccbfe1b01
commit
634bb3d644
28 changed files with 733 additions and 514 deletions
|
|
@ -9,10 +9,7 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
|||
position: {
|
||||
width: 500
|
||||
},
|
||||
actions: {
|
||||
useItem: this.useItem,
|
||||
toChat: this.toChat
|
||||
},
|
||||
actions: {},
|
||||
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
||||
};
|
||||
|
||||
|
|
@ -76,45 +73,6 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
getItem(element) {
|
||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
||||
item = this.document.items.get(itemId);
|
||||
return item;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
async viewAdversary(_, button) {
|
||||
const target = button.closest('[data-item-uuid]');
|
||||
const adversary = await foundry.utils.fromUuid(target.dataset.itemUuid);
|
||||
if (!adversary) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.adversaryMissing'));
|
||||
return;
|
||||
}
|
||||
|
||||
adversary.sheet.render({ force: true });
|
||||
}
|
||||
|
||||
static async useItem(event, button) {
|
||||
const action = this.getItem(event);
|
||||
if (!action) {
|
||||
await this.viewAdversary(event, button);
|
||||
} else {
|
||||
action.use(event);
|
||||
}
|
||||
}
|
||||
|
||||
static async toChat(event) {
|
||||
const item = this.getItem(event);
|
||||
item.toChat(this.document.id);
|
||||
}
|
||||
|
||||
async _onDragStart(event) {
|
||||
const item = event.currentTarget.closest('.inventory-item');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue