mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Address context menu deprecation warnings
This commit is contained in:
parent
a993f3ae2d
commit
0f70755162
5 changed files with 39 additions and 52 deletions
|
|
@ -323,11 +323,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
|
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
name: 'toLoadout',
|
label: 'toLoadout',
|
||||||
icon: 'fa-solid fa-arrow-up',
|
icon: 'fa-solid fa-arrow-up',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return doc && doc.system.inVault;
|
return doc?.isOwner && doc.system.inVault;
|
||||||
},
|
},
|
||||||
callback: async target => {
|
callback: async target => {
|
||||||
const doc = await getDocFromElement(target);
|
const doc = await getDocFromElement(target);
|
||||||
|
|
@ -337,11 +337,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'recall',
|
label: 'recall',
|
||||||
icon: 'fa-solid fa-bolt-lightning',
|
icon: 'fa-solid fa-bolt-lightning',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return doc && doc.system.inVault;
|
return doc?.isOwner && doc.system.inVault;
|
||||||
},
|
},
|
||||||
callback: async (target, event) => {
|
callback: async (target, event) => {
|
||||||
const doc = await getDocFromElement(target);
|
const doc = await getDocFromElement(target);
|
||||||
|
|
@ -376,17 +376,17 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'toVault',
|
label: 'toVault',
|
||||||
icon: 'fa-solid fa-arrow-down',
|
icon: 'fa-solid fa-arrow-down',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return doc && !doc.system.inVault;
|
return doc?.isOwner && !doc.system.inVault;
|
||||||
},
|
},
|
||||||
callback: async target => (await getDocFromElement(target)).update({ 'system.inVault': true })
|
callback: async target => (await getDocFromElement(target)).update({ 'system.inVault': true })
|
||||||
}
|
}
|
||||||
].map(option => ({
|
].map(option => ({
|
||||||
...option,
|
...option,
|
||||||
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
|
label: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.label}`,
|
||||||
icon: `<i class="${option.icon}"></i>`
|
icon: `<i class="${option.icon}"></i>`
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -402,18 +402,18 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
static #getEquipmentContextOptions() {
|
static #getEquipmentContextOptions() {
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
name: 'equip',
|
label: 'equip',
|
||||||
icon: 'fa-solid fa-hands',
|
icon: 'fa-solid fa-hands',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return doc.isOwner && doc && !doc.system.equipped;
|
return doc.isOwner && doc && !doc.system.equipped;
|
||||||
},
|
},
|
||||||
callback: (target, event) => CharacterSheet.#toggleEquipItem.call(this, event, target)
|
callback: (target, event) => CharacterSheet.#toggleEquipItem.call(this, event, target)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'unequip',
|
label: 'unequip',
|
||||||
icon: 'fa-solid fa-hands',
|
icon: 'fa-solid fa-hands',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return doc.isOwner && doc && doc.system.equipped;
|
return doc.isOwner && doc && doc.system.equipped;
|
||||||
},
|
},
|
||||||
|
|
@ -421,7 +421,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
].map(option => ({
|
].map(option => ({
|
||||||
...option,
|
...option,
|
||||||
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
|
label: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.label}`,
|
||||||
icon: `<i class="${option.icon}"></i>`
|
icon: `<i class="${option.icon}"></i>`
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -418,18 +418,18 @@ export default function DHApplicationMixin(Base) {
|
||||||
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
|
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
name: 'disableEffect',
|
label: 'disableEffect',
|
||||||
icon: 'fa-solid fa-lightbulb',
|
icon: 'fa-solid fa-lightbulb',
|
||||||
condition: element => {
|
visible: element => {
|
||||||
const target = element.closest('[data-item-uuid]');
|
const target = element.closest('[data-item-uuid]');
|
||||||
return !target.dataset.disabled && target.dataset.itemType !== 'beastform';
|
return !target.dataset.disabled && target.dataset.itemType !== 'beastform';
|
||||||
},
|
},
|
||||||
callback: async target => (await getDocFromElement(target)).update({ disabled: true })
|
callback: async target => (await getDocFromElement(target)).update({ disabled: true })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'enableEffect',
|
label: 'enableEffect',
|
||||||
icon: 'fa-regular fa-lightbulb',
|
icon: 'fa-regular fa-lightbulb',
|
||||||
condition: element => {
|
visible: element => {
|
||||||
const target = element.closest('[data-item-uuid]');
|
const target = element.closest('[data-item-uuid]');
|
||||||
return target.dataset.disabled && target.dataset.itemType !== 'beastform';
|
return target.dataset.disabled && target.dataset.itemType !== 'beastform';
|
||||||
},
|
},
|
||||||
|
|
@ -437,7 +437,7 @@ export default function DHApplicationMixin(Base) {
|
||||||
}
|
}
|
||||||
].map(option => ({
|
].map(option => ({
|
||||||
...option,
|
...option,
|
||||||
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
|
label: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.label}`,
|
||||||
icon: `<i class="${option.icon}"></i>`
|
icon: `<i class="${option.icon}"></i>`
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -468,9 +468,9 @@ export default function DHApplicationMixin(Base) {
|
||||||
_getContextMenuCommonOptions({ usable = false, toChat = false, deletable = true }) {
|
_getContextMenuCommonOptions({ usable = false, toChat = false, deletable = true }) {
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
name: 'CONTROLS.CommonEdit',
|
label: 'CONTROLS.CommonEdit',
|
||||||
icon: 'fa-solid fa-pen-to-square',
|
icon: 'fa-solid fa-pen-to-square',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const { dataset } = target.closest('[data-item-uuid]');
|
const { dataset } = target.closest('[data-item-uuid]');
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return (
|
return (
|
||||||
|
|
@ -484,9 +484,9 @@ export default function DHApplicationMixin(Base) {
|
||||||
|
|
||||||
if (usable) {
|
if (usable) {
|
||||||
options.unshift({
|
options.unshift({
|
||||||
name: 'DAGGERHEART.GENERAL.damage',
|
label: 'DAGGERHEART.GENERAL.damage',
|
||||||
icon: 'fa-solid fa-explosion',
|
icon: 'fa-solid fa-explosion',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return (
|
return (
|
||||||
doc?.isOwner &&
|
doc?.isOwner &&
|
||||||
|
|
@ -508,9 +508,9 @@ export default function DHApplicationMixin(Base) {
|
||||||
});
|
});
|
||||||
|
|
||||||
options.unshift({
|
options.unshift({
|
||||||
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
|
label: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
|
||||||
icon: 'fa-solid fa-burst',
|
icon: 'fa-solid fa-burst',
|
||||||
condition: target => {
|
visible: target => {
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return doc?.isOwner && !(doc.type === 'domainCard' && doc.system.inVault);
|
return doc?.isOwner && !(doc.type === 'domainCard' && doc.system.inVault);
|
||||||
},
|
},
|
||||||
|
|
@ -520,16 +520,16 @@ export default function DHApplicationMixin(Base) {
|
||||||
|
|
||||||
if (toChat)
|
if (toChat)
|
||||||
options.push({
|
options.push({
|
||||||
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
|
label: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
|
||||||
icon: 'fa-solid fa-message',
|
icon: 'fa-solid fa-message',
|
||||||
callback: async target => (await getDocFromElement(target)).toChat(this.document.uuid)
|
callback: async target => (await getDocFromElement(target)).toChat(this.document.uuid)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (deletable)
|
if (deletable)
|
||||||
options.push({
|
options.push({
|
||||||
name: 'CONTROLS.CommonDelete',
|
label: 'CONTROLS.CommonDelete',
|
||||||
icon: 'fa-solid fa-trash',
|
icon: 'fa-solid fa-trash',
|
||||||
condition: element => {
|
visible: element => {
|
||||||
const target = element.closest('[data-item-uuid]');
|
const target = element.closest('[data-item-uuid]');
|
||||||
const doc = getDocFromElementSync(target);
|
const doc = getDocFromElementSync(target);
|
||||||
return doc?.isOwner && target.dataset.itemType !== 'beastform';
|
return doc?.isOwner && target.dataset.itemType !== 'beastform';
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@ export default class DhActorDirectory extends foundry.applications.sidebar.tabs.
|
||||||
const options = super._getEntryContextOptions();
|
const options = super._getEntryContextOptions();
|
||||||
options.push(
|
options.push(
|
||||||
{
|
{
|
||||||
name: 'DAGGERHEART.UI.Sidebar.actorDirectory.duplicateToNewTier',
|
label: 'DAGGERHEART.UI.Sidebar.actorDirectory.duplicateToNewTier',
|
||||||
icon: `<i class="fa-solid fa-arrow-trend-up" inert></i>`,
|
icon: `<i class="fa-solid fa-arrow-trend-up" inert></i>`,
|
||||||
condition: li => {
|
visible: li => {
|
||||||
const actor = game.actors.get(li.dataset.entryId);
|
const actor = game.actors.get(li.dataset.entryId);
|
||||||
return actor?.type === 'adversary' && actor.system.type !== 'social';
|
return actor?.type === 'adversary' && actor.system.type !== 'social';
|
||||||
},
|
},
|
||||||
|
|
@ -92,9 +92,9 @@ export default class DhActorDirectory extends foundry.applications.sidebar.tabs.
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'DAGGERHEART.UI.Sidebar.actorDirectory.activateParty',
|
label: 'DAGGERHEART.UI.Sidebar.actorDirectory.activateParty',
|
||||||
icon: `<i class="fa-regular fa-square"></i>`,
|
icon: `<i class="fa-regular fa-square"></i>`,
|
||||||
condition: li => {
|
visible: li => {
|
||||||
const actor = game.actors.get(li.dataset.entryId);
|
const actor = game.actors.get(li.dataset.entryId);
|
||||||
return actor && actor.type === 'party' && !actor.system.active;
|
return actor && actor.type === 'party' && !actor.system.active;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -103,23 +103,10 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
_getEntryContextOptions() {
|
_getEntryContextOptions() {
|
||||||
return [
|
return [
|
||||||
...super._getEntryContextOptions(),
|
...super._getEntryContextOptions(),
|
||||||
// {
|
|
||||||
// name: 'Reroll',
|
|
||||||
// icon: '<i class="fa-solid fa-dice"></i>',
|
|
||||||
// condition: li => {
|
|
||||||
// const message = game.messages.get(li.dataset.messageId);
|
|
||||||
|
|
||||||
// return (game.user.isGM || message.isAuthor) && message.rolls.length > 0;
|
|
||||||
// },
|
|
||||||
// callback: li => {
|
|
||||||
// const message = game.messages.get(li.dataset.messageId);
|
|
||||||
// new game.system.api.applications.dialogs.RerollDialog(message).render({ force: true });
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
name: game.i18n.localize('DAGGERHEART.UI.ChatLog.rerollDamage'),
|
label: 'DAGGERHEART.UI.ChatLog.rerollDamage',
|
||||||
icon: '<i class="fa-solid fa-dice"></i>',
|
icon: '<i class="fa-solid fa-dice"></i>',
|
||||||
condition: li => {
|
visible: li => {
|
||||||
const message = game.messages.get(li.dataset.messageId);
|
const message = game.messages.get(li.dataset.messageId);
|
||||||
const hasRolledDamage = message.system.hasDamage
|
const hasRolledDamage = message.system.hasDamage
|
||||||
? Object.keys(message.system.damage).length > 0
|
? Object.keys(message.system.damage).length > 0
|
||||||
|
|
|
||||||
|
|
@ -84,15 +84,15 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
||||||
_getCombatContextOptions() {
|
_getCombatContextOptions() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
name: 'COMBAT.ClearMovementHistories',
|
label: 'COMBAT.ClearMovementHistories',
|
||||||
icon: '<i class="fa-solid fa-shoe-prints"></i>',
|
icon: '<i class="fa-solid fa-shoe-prints"></i>',
|
||||||
condition: () => game.user.isGM && this.viewed?.combatants.size > 0,
|
visible: () => game.user.isGM && this.viewed?.combatants.size > 0,
|
||||||
callback: () => this.viewed.clearMovementHistories()
|
callback: () => this.viewed.clearMovementHistories()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'COMBAT.Delete',
|
label: 'COMBAT.Delete',
|
||||||
icon: '<i class="fa-solid fa-trash"></i>',
|
icon: '<i class="fa-solid fa-trash"></i>',
|
||||||
condition: () => game.user.isGM && !!this.viewed,
|
visible: () => game.user.isGM && !!this.viewed,
|
||||||
callback: () => this.viewed.endCombat()
|
callback: () => this.viewed.endCombat()
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue