mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Updated combat contextmenu
This commit is contained in:
parent
d0c29ede56
commit
6448666579
2 changed files with 42 additions and 7 deletions
|
|
@ -84,19 +84,49 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the dialog used to edit the name of the currently viewed Combat encounter.
|
||||||
|
* @this {CombatTracker}
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
static async #onEditName() {
|
||||||
|
const combat = this.viewed;
|
||||||
|
if (!combat || !game.user.isGM) return null;
|
||||||
|
const field = combat.schema.fields.name;
|
||||||
|
const inputHTML = field.toFormGroup({}, { name: 'name', value: combat.name, autofocus: true }).outerHTML;
|
||||||
|
const formData = await foundry.applications.api.DialogV2.input({
|
||||||
|
window: { icon: 'fa-solid fa-tag', title: 'COMBAT.ACTIONS.EditNameTitle' },
|
||||||
|
position: { width: 480 },
|
||||||
|
content: inputHTML
|
||||||
|
});
|
||||||
|
await combat.update({ name: formData.name || '' });
|
||||||
|
}
|
||||||
|
|
||||||
_getCombatContextOptions() {
|
_getCombatContextOptions() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'COMBAT.ClearMovementHistories',
|
label: 'COMBAT.ACTIONS.EditName',
|
||||||
icon: '<i class="fa-solid fa-shoe-prints"></i>',
|
icon: 'fa-solid fa-tag',
|
||||||
visible: () => game.user.isGM && this.viewed?.combatants.size > 0,
|
visible: () => game.user.isGM && !!this.viewed,
|
||||||
callback: () => this.viewed.clearMovementHistories()
|
onClick: () => DhCombatTracker.#onEditName.call(this)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'COMBAT.Delete',
|
label: 'COMBAT.ACTIONS.LinkToScene',
|
||||||
icon: '<i class="fa-solid fa-trash"></i>',
|
icon: '<i class="fa-solid fa-link"></i>',
|
||||||
|
visible: () => game.user.isGM && !this.scene,
|
||||||
|
onClick: () => this.viewed.toggleSceneLink()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'COMBAT.ACTIONS.UnlinkFromScene',
|
||||||
|
icon: '<i class="fa-solid fa-unlink"></i>',
|
||||||
|
visible: () => game.user.isGM && !!this.scene,
|
||||||
|
onClick: () => this.viewed.toggleSceneLink()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'COMBAT.End',
|
||||||
|
icon: 'fa-solid fa-xmark',
|
||||||
visible: () => game.user.isGM && !!this.viewed,
|
visible: () => game.user.isGM && !!this.viewed,
|
||||||
callback: () => this.viewed.endCombat()
|
onClick: () => this.viewed.endCombat()
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@
|
||||||
</nav>
|
</nav>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{!-- Encounter Name --}}
|
||||||
|
{{#if combat.name}}
|
||||||
|
<h2 class="encounter-name">{{ combat.name }}</h2>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="encounter-controls {{#if hasCombat}}combat{{/if}}">
|
<div class="encounter-controls {{#if hasCombat}}combat{{/if}}">
|
||||||
{{!-- Combat Status --}}
|
{{!-- Combat Status --}}
|
||||||
<strong class="encounter-title">
|
<strong class="encounter-title">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue