mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
enhance beastform application and fix action selection style
This commit is contained in:
parent
a6c4516238
commit
d04393dd5a
7 changed files with 41 additions and 17 deletions
|
|
@ -756,7 +756,7 @@
|
|||
},
|
||||
"SelectAction": {
|
||||
"selectType": "Select Action Type",
|
||||
"selectAction": "Select Action"
|
||||
"selectAction": "Action Selection"
|
||||
},
|
||||
"Traits": {
|
||||
"agility": {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class BeastformDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(configData) {
|
||||
constructor(configData, item) {
|
||||
super();
|
||||
|
||||
this.item = item;
|
||||
|
||||
this.configData = configData;
|
||||
this.selected = null;
|
||||
this.evolved = { form: null };
|
||||
|
|
@ -14,11 +16,14 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
|
|||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'views', 'dh-style', 'beastform-selection'],
|
||||
classes: ['daggerheart', 'views', 'dialog', 'dh-style', 'beastform-selection'],
|
||||
position: {
|
||||
width: 600,
|
||||
height: 'auto'
|
||||
},
|
||||
window: {
|
||||
icon: 'fa-solid fa-paw'
|
||||
},
|
||||
actions: {
|
||||
selectBeastform: this.selectBeastform,
|
||||
toggleHybridFeature: this.toggleHybridFeature,
|
||||
|
|
@ -34,11 +39,12 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
|
|||
};
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize('DAGGERHEART.ITEMS.Beastform.dialogTitle');
|
||||
return this.item.name;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
header: { template: 'systems/daggerheart/templates/dialogs/beastform/header.hbs' },
|
||||
tabs: { template: 'systems/daggerheart/templates/dialogs/beastform/tabs.hbs' },
|
||||
beastformTier: { template: 'systems/daggerheart/templates/dialogs/beastform/beastformTier.hbs' },
|
||||
advanced: { template: 'systems/daggerheart/templates/dialogs/beastform/advanced.hbs' },
|
||||
|
|
@ -262,12 +268,13 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
|
|||
if (!options.submitted) this.selected = null;
|
||||
}
|
||||
|
||||
static async configure(configData) {
|
||||
static async configure(configData, item) {
|
||||
return new Promise(resolve => {
|
||||
const app = new this(configData);
|
||||
const app = new this(configData, item);
|
||||
const featureItem = item;
|
||||
app.addEventListener(
|
||||
'close',
|
||||
() => resolve({ selected: app.selected, evolved: app.evolved, hybrid: app.hybrid }),
|
||||
() => resolve({ selected: app.selected, evolved: app.evolved, hybrid: app.hybrid, item: featureItem }),
|
||||
{ once: true }
|
||||
);
|
||||
app.render({ force: true });
|
||||
|
|
|
|||
|
|
@ -441,9 +441,13 @@ export default function DHApplicationMixin(Base) {
|
|||
const { type: actionType } =
|
||||
(await foundry.applications.api.DialogV2.input({
|
||||
window: { title: 'Select Action Type' },
|
||||
classes: ['daggerheart', 'dh-style'],
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
{
|
||||
types: CONFIG.DH.ACTIONS.actionTypes,
|
||||
itemName: game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectAction')
|
||||
}
|
||||
),
|
||||
ok: {
|
||||
label: game.i18n.format('DOCUMENT.Create', {
|
||||
|
|
@ -581,7 +585,7 @@ export default function DHApplicationMixin(Base) {
|
|||
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||
const { actions, attack } = doc.system;
|
||||
const action = attack?.id === actionId ? attack : actions?.find(a => a.id === actionId);
|
||||
await action.use(event);
|
||||
await action.use(event, doc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ export default class DhBeastformAction extends DHBaseAction {
|
|||
const abort = await this.handleActiveTransformations();
|
||||
if (abort) return;
|
||||
|
||||
const { selected, evolved, hybrid } = await BeastformDialog.configure(beastformConfig);
|
||||
const item = args[0];
|
||||
|
||||
const { selected, evolved, hybrid } = await BeastformDialog.configure(beastformConfig, item);
|
||||
if (!selected) return;
|
||||
|
||||
await this.transform(selected, evolved, hybrid);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@import '../../utils/colors.less';
|
||||
@import '../../utils/mixin.less';
|
||||
@import '../../utils/fonts.less';
|
||||
|
||||
.theme-light .application.daggerheart.dh-style.views.beastform-selection .beastforms-outer-container {
|
||||
.beastform-title {
|
||||
|
|
@ -209,6 +210,9 @@
|
|||
|
||||
button {
|
||||
flex: 1;
|
||||
font-family: @font-body;
|
||||
font-weight: bold;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
templates/dialogs/beastform/header.hbs
Normal file
3
templates/dialogs/beastform/header.hbs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<header class="dialog-header">
|
||||
<h1>{{localize 'DAGGERHEART.ITEMS.Beastform.dialogTitle'}}</h1>
|
||||
</header>
|
||||
|
|
@ -1,11 +1,15 @@
|
|||
<section class='tab-navigation'>
|
||||
<div class='navigation-container beastform-nav'>
|
||||
<nav class='feature-tab sheet-tabs tabs' data-group='primary'>
|
||||
{{#each tabs as |tab|}}
|
||||
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
||||
{{localize tab.label}}
|
||||
</a>
|
||||
{{/each}}
|
||||
</nav>
|
||||
<div class="navigation-inner-container">
|
||||
<line-div></line-div>
|
||||
<nav class='feature-tab sheet-tabs tabs' data-group='primary'>
|
||||
{{#each tabs as |tab|}}
|
||||
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
||||
{{localize tab.label}}
|
||||
</a>
|
||||
{{/each}}
|
||||
</nav>
|
||||
<line-div></line-div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Loading…
Add table
Add a link
Reference in a new issue