diff --git a/module/applications/sheets/api/application-mixin.mjs b/module/applications/sheets/api/application-mixin.mjs index 452877e6..6b1819bf 100644 --- a/module/applications/sheets/api/application-mixin.mjs +++ b/module/applications/sheets/api/application-mixin.mjs @@ -480,7 +480,7 @@ export default function DHApplicationMixin(Base) { */ static async #toChat(_event, target) { let doc = await getDocFromElement(target); - return doc.toChat(this.document.id); + return doc.toChat(doc.uuid); } /** diff --git a/module/applications/ui/chatLog.mjs b/module/applications/ui/chatLog.mjs index 2e9e711e..151b1cc5 100644 --- a/module/applications/ui/chatLog.mjs +++ b/module/applications/ui/chatLog.mjs @@ -117,9 +117,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo async onRollAllSave(event, message) { event.stopPropagation(); if (!game.user.isGM) return; - const targets = event.target.parentElement.querySelectorAll( - '[data-token] .target-save' - ); + const targets = event.target.parentElement.querySelectorAll('[data-token] .target-save'); const actor = await this.getActor(message.system.source.actor), action = this.getAction(actor, message.system.source.item, message.system.source.action); targets.forEach(async el => { @@ -169,9 +167,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo async onRollSimple(event, message) { const buttonType = event.target.dataset.type ?? 'damage', - total = message.rolls.reduce((a,c) => a + Roll.fromJSON(c).total, 0), + total = message.rolls.reduce((a, c) => a + Roll.fromJSON(c).total, 0), damages = { - 'hitPoints': { + hitPoints: { parts: [ { applyTo: 'hitPoints', @@ -186,20 +184,18 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo if (targets.length === 0) return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected')); - targets.forEach(target => { - if(buttonType === 'healing') - target.actor.takeHealing(damages); - else - target.actor.takeDamage(damages); - }) + targets.forEach(target => { + if (buttonType === 'healing') target.actor.takeHealing(damages); + else target.actor.takeDamage(damages); + }); } async abilityUseButton(event, message) { event.stopPropagation(); - const action = message.system.actions[Number.parseInt(event.currentTarget.dataset.index)]; - const actor = game.actors.get(message.system.source.actor); - await actor.use(action); + const item = await foundry.utils.fromUuid(message.system.origin); + const action = item.system.actions.get(event.currentTarget.id); + await item.use(action); } async actionUseButton(event, message) { diff --git a/module/documents/item.mjs b/module/documents/item.mjs index 3c074f44..ffafa401 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -132,6 +132,8 @@ export default class DHItem extends foundry.documents.Item { async toChat(origin) { const cls = getDocumentClass('ChatMessage'); + const item = await foundry.utils.fromUuid(origin); + const systemData = { title: this.type === 'ancestry' @@ -148,13 +150,14 @@ export default class DHItem extends foundry.documents.Item { img: this.img, tags: this._getTags() }, - description: this.system.description, - actions: this.system.actions + actions: item.system.actions, + description: this.system.description }; + const msg = { type: 'abilityUse', user: game.user.id, - actor: game.actors.get(cls.getSpeaker().actor), + actor: item.parent, author: this.author, speaker: cls.getSpeaker(), system: systemData, diff --git a/templates/sheets/actors/adversary/features.hbs b/templates/sheets/actors/adversary/features.hbs index e5a304ef..98c1cedb 100644 --- a/templates/sheets/actors/adversary/features.hbs +++ b/templates/sheets/actors/adversary/features.hbs @@ -2,12 +2,12 @@ data-group='{{tabs.features.group}}'>
{{> 'daggerheart.inventory-items' - title=tabs.features.label - type='feature' - collection=document.system.features - hideControls=true - canCreate=true - showActions=true + title=tabs.features.label + type='feature' + collection=document.system.features + hideContextMenu=true + canCreate=true + showActions=true }}
\ No newline at end of file diff --git a/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs b/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs index 29b008bb..cc030523 100644 --- a/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs +++ b/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs @@ -55,6 +55,7 @@ Parameters: item=item type=../type hideControls=../hideControls + hideContextMenu=../hideContextMenu isActor=../isActor categoryAdversary=../categoryAdversary hideTooltip=../hideTooltip diff --git a/templates/sheets/global/partials/inventory-item-V2.hbs b/templates/sheets/global/partials/inventory-item-V2.hbs index 318e4dcb..623b880e 100644 --- a/templates/sheets/global/partials/inventory-item-V2.hbs +++ b/templates/sheets/global/partials/inventory-item-V2.hbs @@ -123,9 +123,11 @@ Parameters: {{/if}} + {{#unless hideContextMenu}} + {{/unless}} {{/if}} {{/unless}} diff --git a/templates/ui/chat/ability-use.hbs b/templates/ui/chat/ability-use.hbs index 30c5ebb9..0db5d5c8 100644 --- a/templates/ui/chat/ability-use.hbs +++ b/templates/ui/chat/ability-use.hbs @@ -15,8 +15,8 @@
{{{description}}}