diff --git a/lang/en.json b/lang/en.json index 828b2303..68ab0a12 100755 --- a/lang/en.json +++ b/lang/en.json @@ -326,6 +326,7 @@ "equip": "Equip", "sendToChat": "Send To Chat", "toLoadout": "Send to Loadout", + "recall": "Recall", "toVault": "Send to Vault", "unequip": "Unequip", "useItem": "Use Item" diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index 66ed6315..b48d459d 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -318,6 +318,40 @@ export default class CharacterSheet extends DHBaseActorSheet { ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.loadoutMaxReached')); } }, + { + name: 'recall', + icon: 'fa-solid fa-bolt-lightning', + condition: target => { + const doc = getDocFromElementSync(target); + return doc && doc.system.inVault; + }, + callback: async (target, event) => { + const doc = await getDocFromElement(target); + const actorLoadout = doc.actor.system.loadoutSlot; + if (!actorLoadout.available) { + ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.loadoutMaxReached')); + return; + } + if (doc.system.recallCost == 0) { + return doc.update({ 'system.inVault': false }); + } + const type = 'effect'; + const cls = game.system.api.models.actions.actionsTypes[type]; + const action = new cls({ + ...cls.getSourceConfig(doc.system), + type: type, + chatDisplay: false, + cost: [{ + key: 'stress', + value: doc.system.recallCost + }] + }, { parent: doc.system }); + const config = await action.use(event); + if (config) { + return doc.update({ 'system.inVault': false }); + } + } + }, { name: 'toVault', icon: 'fa-solid fa-arrow-down',