mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-19 16:24:06 +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": {
|
"SelectAction": {
|
||||||
"selectType": "Select Action Type",
|
"selectType": "Select Action Type",
|
||||||
"selectAction": "Select Action"
|
"selectAction": "Action Selection"
|
||||||
},
|
},
|
||||||
"Traits": {
|
"Traits": {
|
||||||
"agility": {
|
"agility": {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||||
|
|
||||||
export default class BeastformDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
export default class BeastformDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
constructor(configData) {
|
constructor(configData, item) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.item = item;
|
||||||
|
|
||||||
this.configData = configData;
|
this.configData = configData;
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.evolved = { form: null };
|
this.evolved = { form: null };
|
||||||
|
|
@ -14,11 +16,14 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
|
||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
tag: 'form',
|
tag: 'form',
|
||||||
classes: ['daggerheart', 'views', 'dh-style', 'beastform-selection'],
|
classes: ['daggerheart', 'views', 'dialog', 'dh-style', 'beastform-selection'],
|
||||||
position: {
|
position: {
|
||||||
width: 600,
|
width: 600,
|
||||||
height: 'auto'
|
height: 'auto'
|
||||||
},
|
},
|
||||||
|
window: {
|
||||||
|
icon: 'fa-solid fa-paw'
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
selectBeastform: this.selectBeastform,
|
selectBeastform: this.selectBeastform,
|
||||||
toggleHybridFeature: this.toggleHybridFeature,
|
toggleHybridFeature: this.toggleHybridFeature,
|
||||||
|
|
@ -34,11 +39,12 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
|
||||||
};
|
};
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
return game.i18n.localize('DAGGERHEART.ITEMS.Beastform.dialogTitle');
|
return this.item.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
|
header: { template: 'systems/daggerheart/templates/dialogs/beastform/header.hbs' },
|
||||||
tabs: { template: 'systems/daggerheart/templates/dialogs/beastform/tabs.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/dialogs/beastform/tabs.hbs' },
|
||||||
beastformTier: { template: 'systems/daggerheart/templates/dialogs/beastform/beastformTier.hbs' },
|
beastformTier: { template: 'systems/daggerheart/templates/dialogs/beastform/beastformTier.hbs' },
|
||||||
advanced: { template: 'systems/daggerheart/templates/dialogs/beastform/advanced.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;
|
if (!options.submitted) this.selected = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async configure(configData) {
|
static async configure(configData, item) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const app = new this(configData);
|
const app = new this(configData, item);
|
||||||
|
const featureItem = item;
|
||||||
app.addEventListener(
|
app.addEventListener(
|
||||||
'close',
|
'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 }
|
{ once: true }
|
||||||
);
|
);
|
||||||
app.render({ force: true });
|
app.render({ force: true });
|
||||||
|
|
|
||||||
|
|
@ -441,9 +441,13 @@ export default function DHApplicationMixin(Base) {
|
||||||
const { type: actionType } =
|
const { type: actionType } =
|
||||||
(await foundry.applications.api.DialogV2.input({
|
(await foundry.applications.api.DialogV2.input({
|
||||||
window: { title: 'Select Action Type' },
|
window: { title: 'Select Action Type' },
|
||||||
|
classes: ['daggerheart', 'dh-style'],
|
||||||
content: await foundry.applications.handlebars.renderTemplate(
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
'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: {
|
ok: {
|
||||||
label: game.i18n.format('DOCUMENT.Create', {
|
label: game.i18n.format('DOCUMENT.Create', {
|
||||||
|
|
@ -581,7 +585,7 @@ export default function DHApplicationMixin(Base) {
|
||||||
const { actionId } = target.closest('[data-action-id]').dataset;
|
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||||
const { actions, attack } = doc.system;
|
const { actions, attack } = doc.system;
|
||||||
const action = attack?.id === actionId ? attack : actions?.find(a => a.id === actionId);
|
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();
|
const abort = await this.handleActiveTransformations();
|
||||||
if (abort) return;
|
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;
|
if (!selected) return;
|
||||||
|
|
||||||
await this.transform(selected, evolved, hybrid);
|
await this.transform(selected, evolved, hybrid);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
@import '../../utils/colors.less';
|
@import '../../utils/colors.less';
|
||||||
@import '../../utils/mixin.less';
|
@import '../../utils/mixin.less';
|
||||||
|
@import '../../utils/fonts.less';
|
||||||
|
|
||||||
.theme-light .application.daggerheart.dh-style.views.beastform-selection .beastforms-outer-container {
|
.theme-light .application.daggerheart.dh-style.views.beastform-selection .beastforms-outer-container {
|
||||||
.beastform-title {
|
.beastform-title {
|
||||||
|
|
@ -209,6 +210,9 @@
|
||||||
|
|
||||||
button {
|
button {
|
||||||
flex: 1;
|
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'>
|
<section class='tab-navigation'>
|
||||||
<div class='navigation-container beastform-nav'>
|
<div class='navigation-container beastform-nav'>
|
||||||
<nav class='feature-tab sheet-tabs tabs' data-group='primary'>
|
<div class="navigation-inner-container">
|
||||||
{{#each tabs as |tab|}}
|
<line-div></line-div>
|
||||||
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
<nav class='feature-tab sheet-tabs tabs' data-group='primary'>
|
||||||
{{localize tab.label}}
|
{{#each tabs as |tab|}}
|
||||||
</a>
|
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
||||||
{{/each}}
|
{{localize tab.label}}
|
||||||
</nav>
|
</a>
|
||||||
|
{{/each}}
|
||||||
|
</nav>
|
||||||
|
<line-div></line-div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue