mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Added buttons to features on characters, and actions on adversary/environment (#316)
This commit is contained in:
parent
5b9db88d50
commit
72436478c1
6 changed files with 37 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
||||||
actions: {
|
actions: {
|
||||||
reactionRoll: AdversarySheet.#reactionRoll,
|
reactionRoll: AdversarySheet.#reactionRoll,
|
||||||
useItem: this.useItem,
|
useItem: this.useItem,
|
||||||
|
useAction: this.useItem,
|
||||||
toChat: this.toChat
|
toChat: this.toChat
|
||||||
},
|
},
|
||||||
window: {
|
window: {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
levelManagement: CharacterSheet.#levelManagement,
|
levelManagement: CharacterSheet.#levelManagement,
|
||||||
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
||||||
useItem: this.useItem, //TODO Fix this
|
useItem: this.useItem, //TODO Fix this
|
||||||
|
useAction: this.useAction,
|
||||||
toChat: this.toChat
|
toChat: this.toChat
|
||||||
},
|
},
|
||||||
window: {
|
window: {
|
||||||
|
|
@ -620,6 +621,20 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use an action
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async useAction(event, button) {
|
||||||
|
const item = this.getItem(button);
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
const action = item.system.actions.find(x => x.id === button.dataset.actionId);
|
||||||
|
if (!action) return;
|
||||||
|
|
||||||
|
action.use(event);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send item to Chat
|
* Send item to Chat
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
useItem: this.useItem,
|
useItem: this.useItem,
|
||||||
|
useAction: this.useItem,
|
||||||
toChat: this.toChat
|
toChat: this.toChat
|
||||||
},
|
},
|
||||||
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,17 @@
|
||||||
transform: translateY(-20px);
|
transform: translateY(-20px);
|
||||||
transform-origin: top;
|
transform-origin: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-buttons {
|
||||||
|
grid-column: span 3;
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
button {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.application.setting.dh-style {
|
.application.setting.dh-style {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each values}}
|
{{#each values}}
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=this type=../type hideControls=../hideControls }}
|
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=this type=../type hideControls=../hideControls featureType=true }}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#each adversaries as |adversary|}}
|
{{#each adversaries as |adversary|}}
|
||||||
|
|
|
||||||
|
|
@ -171,4 +171,12 @@
|
||||||
<span></span>
|
<span></span>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<div class="item-description">{{#unless isSidebar}}{{{item.system.description}}}{{/unless}}</div>
|
<div class="item-description">{{#unless isSidebar}}{{{item.system.description}}}{{/unless}}</div>
|
||||||
|
|
||||||
|
{{#if featureType}}
|
||||||
|
<div class="item-buttons">
|
||||||
|
{{#each item.system.actions as | action |}}
|
||||||
|
<button type="button" data-action="useAction" data-action-id="{{action.id}}">{{action.name}}</button>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue