mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Added ToChat and UseItem
This commit is contained in:
parent
1506f46efb
commit
80fbfc6881
1 changed files with 19 additions and 1 deletions
|
|
@ -13,7 +13,9 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
addAdversary: this.addAdversary,
|
||||
deleteProperty: this.deleteProperty,
|
||||
viewAdversary: this.viewAdversary,
|
||||
openSettings: this.openSettings
|
||||
openSettings: this.openSettings,
|
||||
useItem: this.useItem,
|
||||
toChat: this.toChat
|
||||
},
|
||||
form: {
|
||||
handler: this._updateForm,
|
||||
|
|
@ -68,6 +70,12 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
return context;
|
||||
}
|
||||
|
||||
getAction(element) {
|
||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
||||
item = this.document.system.actions.find(x => x.id === itemId);
|
||||
return item;
|
||||
}
|
||||
|
||||
static async openSettings() {
|
||||
await new DHEnvironmentSettings(this.document).render(true);
|
||||
}
|
||||
|
|
@ -100,6 +108,16 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
adversary.sheet.render(true);
|
||||
}
|
||||
|
||||
static async useItem(event) {
|
||||
const action = this.getAction(event);
|
||||
action.use(event);
|
||||
}
|
||||
|
||||
static async toChat(event) {
|
||||
const item = this.getAction(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