diff --git a/module.json b/module.json index a18ca53..b0f4a5b 100644 --- a/module.json +++ b/module.json @@ -96,8 +96,8 @@ "id": "pf2e", "type": "system", "compatibility": { - "minimum": "6.5.0", - "verified": "6.6.0" + "minimum": "6.6.2", + "verified": "6.6.2" } } ], @@ -107,7 +107,7 @@ "type": "module", "compatibility": { "minimum": "2.0.0", - "verified": "2.0.5", + "verified": "2.0.6", "maximum": "2.0.99" } } diff --git a/scripts/action-handler.js b/scripts/action-handler.js index 5b90a60..7d145e8 100644 --- a/scripts/action-handler.js +++ b/scripts/action-handler.js @@ -91,7 +91,8 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { this.#buildEffects(), this.#buildFeats(), this.#buildHeroActions(), - this.#buildHeroPoints(), + this.#buildPoints('heroPoints'), + this.#buildPoints('mythicPoints'), this.#buildInitiative(), this.#buildInventory(), this.#buildPerceptionCheck(), @@ -451,26 +452,47 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { /** * Build hero points */ - async #buildHeroPoints () { - const actionType = 'heroPoints' + async #buildPoints (actionType) { + let actions, groupData + + const mythicEnabled = this.actor.system.resources?.mythicPoints.max ? true : false // Create group data - const groupData = { id: 'hero-points', type: 'system' } + if (actionType === 'heroPoints' && !mythicEnabled) { + groupData = { id: 'hero-points', type: 'system' } - const heroPoints = this.actor.system.resources?.heroPoints - const value = heroPoints.value - const max = heroPoints.max + const heroPoints = this.actor.system.resources?.heroPoints + const value = heroPoints.value + const max = heroPoints.max - // Get actions - const actions = [{ - id: 'heroPoints', - name: coreModule.api.Utils.i18n('PF2E.HeroPointsLabel'), - encodedValue: [actionType, actionType].join(this.delimiter), - info1: { text: (max > 0) ? `${value ?? 0}/${max}` : '' } - }] + // Get actions + actions = [{ + id: 'heroPoints', + name: coreModule.api.Utils.i18n('PF2E.Actor.Resource.HeroPoints'), + encodedValue: [actionType, actionType].join(this.delimiter), + info1: { text: (max > 0) ? `${value ?? 0}/${max}` : '' } + }] + } + else if (actionType === 'mythicPoints' && mythicEnabled) { + groupData = { id: 'mythic-points', type: 'system' } + + const mythicPoints = this.actor.system.resources?.mythicPoints + const value = mythicPoints.value + const max = mythicPoints.max + + // Get actions + actions = [{ + id: 'mythicPoints', + name: coreModule.api.Utils.i18n('PF2E.Actor.Resource.MythicPoints'), + encodedValue: [actionType, actionType].join(this.delimiter), + info1: { text: (max > 0) ? `${value ?? 0}/${max}` : '' } + }] + } // Add actions to action list - this.addActions(actions, groupData) + if (actions && groupData) { + this.addActions(actions, groupData) + } } /** @@ -593,9 +615,9 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { } /** - * Build Hero Actions - * @private - */ + * Build hero actions + * @private + */ async #buildHeroActions () { if (!game.modules.get('pf2e-hero-actions')?.active) return @@ -2126,7 +2148,9 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { if (!description && !tagsHtml && !modifiersHtml) return name - return `
${nameHtml}${headerTags}${description}${propertiesHtml}
` + const tooltipHtml = `
${nameHtml}${headerTags}${description}${propertiesHtml}
` + + return await TextEditor.enrichHTML(tooltipHtml, { async: true }) } /** diff --git a/scripts/constants.js b/scripts/constants.js index 391609f..8091771 100644 --- a/scripts/constants.js +++ b/scripts/constants.js @@ -194,7 +194,8 @@ export const GROUP = { generalFeats: { id: 'general-feats', name: 'PF2E.FeatGeneralHeader', type: 'system' }, bonusFeats: { id: 'bonus-feats', name: 'PF2E.FeatBonusHeader', type: 'system' }, spells: { id: 'spells', name: 'PF2E.Item.Spell.Plural', type: 'system' }, - heroPoints: { id: 'hero-points', name: 'PF2E.HeroPointsLabel', type: 'system' }, + heroPoints: { id: 'hero-points', name: 'PF2E.Actor.Resource.HeroPoints', type: 'system' }, + mythicPoints: { id: 'mythic-points', name: 'PF2E.Actor.Resource.MythicPoints', type: 'system' }, initiative: { id: 'initiative', name: 'PF2E.InitiativeLabel', type: 'system' }, perceptionCheck: { id: 'perception-check', name: 'PF2E.PerceptionLabel', type: 'system' }, coreSkills: { id: 'core-skills', name: 'PF2E.CoreSkillsHeader', type: 'system' }, diff --git a/scripts/defaults.js b/scripts/defaults.js index a501f12..3f99047 100644 --- a/scripts/defaults.js +++ b/scripts/defaults.js @@ -85,6 +85,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { name: coreModule.api.Utils.i18n('tokenActionHud.pf2e.attributes'), groups: [ { ...groups.heroPoints, nestId: 'attributes_hero-points' }, + { ...groups.mythicPoints, nestId: 'attributes_mythic-points' }, { ...groups.initiative, nestId: 'attributes_initiative' }, { ...groups.perceptionCheck, nestId: 'attributes_perception-check' }, { ...groups.saves, nestId: 'attributes_saves' } diff --git a/scripts/roll-handler.js b/scripts/roll-handler.js index d38a226..ac3111e 100644 --- a/scripts/roll-handler.js +++ b/scripts/roll-handler.js @@ -195,12 +195,15 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { case 'feat': this.#rollItemMacro(event, actor, actionId) break - case 'heroAction': - this.#performHeroAction(actor, actionId) - break + case 'heroAction': + this.#performHeroAction(actor, actionId) + break case 'heroPoints': await this.#adjustResources(actor, 'heroPoints', 'value') break + case 'mythicPoints': + await this.#adjustResources(actor, 'mythicPoints', 'value') + break case 'initiative': this.#rollInitiative(actor, actionId) break @@ -375,7 +378,14 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { } } - await actor.update({ "system.resources.heroPoints.value": value }); + switch (resource) { + case "heroPoints": + await actor.update({ "system.resources.heroPoints.value": value }) + break + case "mythicPoints": + await actor.update({ "system.resources.mythicPoints.value": value }) + break + } Hooks.callAll('forceUpdateTokenActionHud') } diff --git a/scripts/token-action-hud-pf2e.min.js.map b/scripts/token-action-hud-pf2e.min.js.map index 917bdc1..f220acc 100644 --- a/scripts/token-action-hud-pf2e.min.js.map +++ b/scripts/token-action-hud-pf2e.min.js.map @@ -1 +1 @@ -{"version":3,"file":"token-action-hud-pf2e.min.js","sources":["constants.js","defaults.js","utils.js","action-handler.js","roll-handler.js","settings.js","system-manager.js","init.js"],"sourcesContent":["/**\r\n * Module-based constants\r\n */\r\nexport const MODULE = {\r\n ID: 'token-action-hud-pf2e'\r\n}\r\n\r\n/**\r\n * Core module\r\n */\r\nexport const CORE_MODULE = {\r\n ID: 'token-action-hud-core'\r\n}\r\n\r\n/**\r\n * Core module version required by the system module\r\n */\r\nexport const REQUIRED_CORE_MODULE_VERSION = '2.0'\r\n\r\n/**\r\n * Damage type icons\r\n */\r\nexport const DAMAGE_TYPE_ICONS = {\r\n axe: 'fa-solid fa-axe fa-fw',\r\n brain: 'fa-solid fa-brain fa-fw',\r\n bolt: 'fa-solid fa-bolt fa-fw',\r\n 'bow-arrow': 'fa-solid fa-bow-arrow fa-fw',\r\n droplet: 'fa-solid fa-droplet fa-fw',\r\n fire: 'fa-solid fa-fire fa-fw',\r\n ghost: 'fa-solid fa-ghost fa-fw',\r\n hammer: 'fa-solid fa-hammer fa-fw',\r\n skull: 'fa-solid fa-skull fa-fw',\r\n snowflake: 'fa-solid fa-snowflake fa-fw',\r\n spider: 'fa-solid fa-spider fa-fw',\r\n sun: 'fa-solid fa-sun fa-fw',\r\n vial: 'fa-solid fa-vial fa-fw',\r\n 'waveform-lines': 'fa-solid fa-waveform-lines fa-fw'\r\n}\r\n\r\n/**\r\n * Action icons\r\n */\r\nexport const ACTION_ICON = {\r\n 1: 'A',\r\n 2: 'D',\r\n 3: 'T',\r\n free: 'F',\r\n reaction: 'R',\r\n passive: '',\r\n A: 'A',\r\n D: 'D',\r\n T: 'T',\r\n F: 'F',\r\n R: 'R',\r\n ...DAMAGE_TYPE_ICONS\r\n}\r\n\r\n/**\r\n * Action type\r\n */\r\nexport const ACTION_TYPE = {\r\n action: 'TYPES.Item.action',\r\n attribute: 'tokenActionHud.pf2e.attribute',\r\n condition: 'TYPES.Item.condition',\r\n effect: 'TYPES.Item.effect',\r\n familiarAttack: 'PF2E.AttackLabel',\r\n feat: 'PF2E.Item.Feat.LevelLabel',\r\n heroAction: 'tokenActionHud.pf2e.heroAction',\r\n initiative: 'PF2E.InitiativeLabel',\r\n item: 'PF2E.ItemTitle',\r\n save: 'tokenActionHud.pf2e.save',\r\n skill: 'PF2E.SkillLabel',\r\n skillAction: 'tokenActionHud.pf2e.skillAction',\r\n spell: 'TYPES.Item.spell',\r\n strike: 'PF2E.WeaponStrikeLabel',\r\n strikeAuxiliaryAction: 'PF2E.WeaponStrikeLabel',\r\n toggle: 'tokenActionHud.pf2e.toggle',\r\n utility: 'tokenActionHud.utility'\r\n}\r\n\r\n/**\r\n * Carry types icons\r\n */\r\nexport const CARRY_TYPE_ICON = {\r\n held1: {\r\n icon: '',\r\n tooltip: 'PF2E.CarryType.held1'\r\n },\r\n held2: {\r\n icon: '',\r\n tooltip: 'PF2E.CarryType.held2'\r\n },\r\n dropped: {\r\n icon: '',\r\n tooltip: 'PF2E.CarryType.dropped'\r\n },\r\n stowed: {\r\n icon: '',\r\n tooltip: 'PF2E.CarryType.stowed'\r\n },\r\n worn: {\r\n icon: '',\r\n tooltip: 'PF2E.CarryType.worn'\r\n }\r\n}\r\n\r\n/**\r\n * Item types\r\n */\r\nexport const ITEM_TYPE = {\r\n armor: { groupId: 'armor' },\r\n consumable: { groupId: 'consumables' },\r\n backpack: { groupId: 'containers' },\r\n equipment: { groupId: 'equipment' },\r\n shield: { groupId: 'shields' },\r\n treasure: { groupId: 'treasure' },\r\n weapon: { groupId: 'weapons' }\r\n}\r\n\r\n/**\r\n * Modular options\r\n */\r\nexport const MODULAR_OPTION = {\r\n bludgeoning: 'PF2E.TraitBludgeoning',\r\n piercing: 'PF2E.TraitPiercing',\r\n slashing: 'PF2E.TraitSlashing'\r\n}\r\n\r\n/**\r\n * Skill abbreviations\r\n */\r\nexport const SKILL_ABBREVIATION = {\r\n acrobatics: 'acr',\r\n arcana: 'arc',\r\n athletics: 'ath',\r\n crafting: 'cra',\r\n deception: 'dec',\r\n diplomacy: 'dip',\r\n intimidation: 'itm',\r\n medicine: 'med',\r\n nature: 'nat',\r\n occultism: 'occ',\r\n performance: 'prf',\r\n perception: 'per',\r\n religion: 'rel',\r\n society: 'soc',\r\n stealth: 'ste',\r\n survival: 'sur',\r\n thievery: 'thi'\r\n}\r\n\r\n/**\r\n * Strike icons\r\n */\r\nexport const STRIKE_ICON = {\r\n melee: 'systems/pf2e/icons/mdi/sword.svg',\r\n thrown: 'systems/pf2e/icons/mdi/thrown.svg'\r\n}\r\n\r\n/**\r\n * Strike usage\r\n */\r\nexport const STRIKE_USAGE = {\r\n melee: { name: 'PF2E.WeaponRangeMelee' },\r\n ranged: { name: 'PF2E.NPCAttackRanged' },\r\n thrown: { name: 'PF2E.TraitThrown' }\r\n}\r\n\r\n/**\r\n * Groups\r\n */\r\nexport const GROUP = {\r\n attack: { id: 'attack', name: 'PF2E.AttackLabel', type: 'system' },\r\n toggles: { id: 'toggles', name: 'PF2E.TogglesLabel', type: 'system' },\r\n strikes: { id: 'strikes', name: 'PF2E.StrikesLabel', type: 'system' },\r\n actions: { id: 'actions', name: 'PF2E.ActionsActionsHeader', type: 'system' },\r\n reactions: { id: 'reactions', name: 'PF2E.ActionsReactionsHeader', type: 'system' },\r\n freeActions: { id: 'free-actions', name: 'PF2E.ActionsFreeActionsHeader', type: 'system' },\r\n passives: { id: 'passives', name: 'PF2E.NPC.PassivesLabel', type: 'system' },\r\n skillActionsGrouped: { id: 'skill-actions-grouped', name: 'tokenActionHud.pf2e.skillActions', listName: 'tokenActionHud.pf2e.skillActionsGrouped', type: 'system' },\r\n skillActionsUngrouped: { id: 'skill-actions-ungrouped', name: 'tokenActionHud.pf2e.skillActions', listName: 'tokenActionHud.pf2e.skillActionsUngrouped', type: 'system', settings: { sort: true } },\r\n weapons: { id: 'weapons', name: 'tokenActionHud.pf2e.weapons', type: 'system' },\r\n shields: { id: 'shields', name: 'tokenActionHud.pf2e.shields', type: 'system' },\r\n armor: { id: 'armor', name: 'tokenActionHud.pf2e.armor', type: 'system' },\r\n equipment: { id: 'equipment', name: 'tokenActionHud.pf2e.equipment', type: 'system' },\r\n consumables: { id: 'consumables', name: 'tokenActionHud.pf2e.consumables', type: 'system' },\r\n containers: { id: 'containers', name: 'tokenActionHud.pf2e.containers', type: 'system' },\r\n treasure: { id: 'treasure', name: 'tokenActionHud.pf2e.treasure', type: 'system' },\r\n ancestryFeatures: { id: 'ancestry-features', name: 'PF2E.FeaturesAncestryHeader', type: 'system' },\r\n classFeatures: { id: 'class-features', name: 'PF2E.FeaturesClassHeader', type: 'system' },\r\n ancestryFeats: { id: 'ancestry-feats', name: 'PF2E.FeatAncestryHeader', type: 'system' },\r\n classFeats: { id: 'class-feats', name: 'PF2E.FeatClassHeader', type: 'system' },\r\n skillFeats: { id: 'skill-feats', name: 'PF2E.FeatSkillHeader', type: 'system' },\r\n generalFeats: { id: 'general-feats', name: 'PF2E.FeatGeneralHeader', type: 'system' },\r\n bonusFeats: { id: 'bonus-feats', name: 'PF2E.FeatBonusHeader', type: 'system' },\r\n spells: { id: 'spells', name: 'PF2E.Item.Spell.Plural', type: 'system' },\r\n heroPoints: { id: 'hero-points', name: 'PF2E.HeroPointsLabel', type: 'system' },\r\n initiative: { id: 'initiative', name: 'PF2E.InitiativeLabel', type: 'system' },\r\n perceptionCheck: { id: 'perception-check', name: 'PF2E.PerceptionLabel', type: 'system' },\r\n coreSkills: { id: 'core-skills', name: 'PF2E.CoreSkillsHeader', type: 'system' },\r\n loreSkills: { id: 'lore-skills', name: 'PF2E.LoreSkillsHeader', type: 'system' },\r\n conditions: { id: 'conditions', name: 'PF2E.ConditionsLabel', type: 'system' },\r\n socialConditions: { id: 'social-conditions', name: 'tokenActionHud.pf2e.socialConditions', type: 'system' },\r\n otherConditions: { id: 'other-conditions', name: 'tokenActionHud.pf2e.otherConditions', type: 'system' },\r\n effects: { id: 'effects', name: 'PF2E.EffectsLabel', type: 'system' },\r\n combat: { id: 'combat', name: 'tokenActionHud.combat', type: 'system' },\r\n token: { id: 'token', name: 'tokenActionHud.token', type: 'system' },\r\n recoveryCheck: { id: 'recovery-check', name: 'PF2E.Check.Specific.Recovery', type: 'system' },\r\n rests: { id: 'rests', name: 'tokenActionHud.pf2e.rests', type: 'system' },\r\n saves: { id: 'saves', name: 'PF2E.SavesHeader', type: 'system' },\r\n utility: { id: 'utility', name: 'tokenActionHud.utility', type: 'system' }\r\n}\r\n\r\n/**\r\n * Skill actions\r\n */\r\nexport const SKILL_ACTION = {\r\n l5pbgrj8SSNtRGs8: { name: 'PF2E.Actions.AdministerFirstAid.Stabilize.Title', actionCost: 2, skill: 'medicine', image: 'systems/pf2e/icons/features/feats/treat-wounds.webp' },\r\n ZEWD4zcEDQwYhVT8: { name: 'PF2E.Actions.AdministerFirstAid.StopBleeding.Title', actionCost: 2, skill: 'medicine', image: 'systems/pf2e/icons/conditions/persistent-damage.webp' },\r\n '55mxH0w8UkY1o3Xv': { name: 'PF2E.Actions.Balance.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/skills/movement/feet-winged-boots-brown.webp' },\r\n LXCy1iJddD95Z91s: { name: 'PF2E.Actions.Climb.Title', skill: 'athletics', actionCost: 1, image: 'icons/sundries/misc/ladder.webp' },\r\n '9RNumMausgG7adgL': { name: 'PF2E.Actions.Coerce.Title', skill: 'intimidation', actionCost: 'passive', image: 'icons/skills/social/intimidation-impressing.webp' },\r\n xcrdOOiN0l6O1sIn: { name: 'PF2E.Actions.CommandAnAnimal.Title', skill: 'nature', actionCost: 1, image: 'icons/environment/creatures/horse-white.webp' },\r\n zn0HadZeoKDALxRu: { name: 'PF2E.Actions.ConcealAnObject.Title', skill: 'stealth', actionCost: 1, image: 'systems/pf2e/icons/equipment/adventuring-gear/wax-key-blank.webp' },\r\n Tu7LIRelQsiOuo1l: { name: 'PF2E.Actions.Craft.Title', skill: 'crafting', actionCost: 'passive', image: 'icons/skills/trades/smithing-anvil-silver-red.webp' },\r\n aDsYSdRqiC6qQIOQ: { name: 'PF2E.Actions.CreateADiversion.DistractingWords.Title', skill: 'deception', actionCost: 1, image: 'icons/magic/control/mouth-smile-deception-purple.webp' },\r\n zUJ0UhuoFt5a7tiN: { name: 'PF2E.Actions.CreateADiversion.Gesture.Title', skill: 'deception', actionCost: 1, image: 'icons/skills/social/wave-halt-stop.webp' },\r\n '1JpYPlIkjyseE9JU': { name: 'PF2E.Actions.CreateADiversion.Trick.Title', skill: 'deception', actionCost: 1, image: 'systems/pf2e/icons/spells/charming-words.webp' },\r\n mNphXpAkmGsMadUv: { name: 'PF2E.Actions.CreateForgery.Title', skill: 'society', actionCost: 'passive', image: 'systems/pf2e/icons/spells/transcribe-moment.webp' },\r\n U6WjxFPn4fUqIrfl: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'arcana', actionCost: 'passive', image: 'icons/skills/trades/academics-book-study-runes.webp' },\r\n RZyfkw1DiqVy3JUC: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'occultism', actionCost: 'passive', image: 'icons/skills/trades/academics-book-study-purple.webp' },\r\n sDUERv4E88G5BRPr: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'religion', actionCost: 'passive', image: 'systems/pf2e/icons/equipment/other/spellbooks/thresholds-of-truth.webp' },\r\n YWAvvDXpdW1fYPFo: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'society', actionCost: 'passive', image: 'icons/skills/trades/academics-study-reading-book.webp' },\r\n nEwqNNWX6scLt4sc: { name: 'PF2E.Actions.Demoralize.Title', skill: 'intimidation', actionCost: 1, image: 'icons/skills/social/intimidation-impressing.webp' },\r\n T2QNEoRojMWEec4a: { name: 'PF2E.Actions.DisableDevice.Title', skill: 'thievery', actionCost: 2, image: 'systems/pf2e/icons/equipment/adventuring-gear/thieves-tools.webp' },\r\n ooiO59Ch2QaebOmc: { name: 'PF2E.Actions.Disarm.Title', skill: 'athletics', actionCost: 1, image: 'icons/skills/melee/sword-damaged-broken-glow-red.webp' },\r\n '50Q0DYL33Kalu1BH': { name: 'PF2E.Actions.Escape.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/skills/movement/feet-winged-boots-glowing-yellow.webp' },\r\n lkEcQQss16SIrVxM: { name: 'PF2E.Actions.Escape.Title', skill: 'athletics', actionCost: 1, image: 'icons/skills/movement/feet-winged-boots-glowing-yellow.webp' },\r\n RjfPFjqPrNve6eeh: { name: 'PF2E.Actions.Feint.Title', skill: 'deception', actionCost: 1, image: 'icons/skills/melee/maneuver-sword-katana-yellow.webp' },\r\n yMTKMnaYSGtDz4wk: { name: 'PF2E.Actions.ForceOpen.Title', skill: 'athletics', actionCost: 1, image: 'icons/equipment/feet/boots-armored-steel.webp' },\r\n rCgGPEyXbzLFcio6: { name: 'PF2E.Actions.GatherInformation.Title', skill: 'diplomacy', actionCost: 'passive', image: 'icons/skills/social/diplomacy-handshake.webp' },\r\n i95kcGLIQKOTsnv6: { name: 'PF2E.Actions.Grapple.Title', skill: 'athletics', actionCost: 'passive', image: 'icons/skills/melee/unarmed-punch-fist.webp' },\r\n FlM3HvpnsZpCKawG: { name: 'PF2E.Actions.Hide.Title', skill: 'stealth', actionCost: 1, image: 'systems/pf2e/icons/features/classes/wild.webp' },\r\n v3dlDjFlOmT5T2gC: { name: 'PF2E.Actions.HighJump.Title', skill: 'athletics', actionCost: 2, image: 'icons/skills/movement/arrows-up-trio-red.webp' },\r\n k5nW4jGyXD0Oq9LR: { name: 'PF2E.Actions.Impersonate.Title', skill: 'deception', actionCost: 'passive', image: 'icons/equipment/head/mask-carved-scream-tan.webp' },\r\n VTg4t8kYTvXcHROq: { name: 'PF2E.Actions.Lie.Title', skill: 'deception', actionCost: 'passive', image: 'icons/magic/control/mouth-smile-deception-purple.webp' },\r\n QPsV0qi2zXm7syt6: { name: 'PF2E.Actions.LongJump.Title', skill: 'athletics', actionCost: 2, image: 'icons/skills/movement/figure-running-gray.webp' },\r\n '1Sj2Pz3VI2SFWqZw': { name: 'PF2E.Actions.MakeAnImpression.Title', skill: 'diplomacy', actionCost: 'passive', image: 'icons/environment/people/commoner.webp' },\r\n '9Ul5Op5OceT9P5SS': { name: 'PF2E.Actions.ManeuverInFlight.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/commodities/biological/wing-bird-white.webp' },\r\n Gj68YCVlDjc75iCP: { name: 'PF2E.Actions.PalmAnObject.Title', skill: 'thievery', actionCost: 1, image: 'icons/sundries/gaming/playing-cards.webp' },\r\n dWcrojMk0d2WRPBq: { name: 'PF2E.Actions.Perform.Title', skill: 'performance', actionCost: 1, image: 'icons/skills/trades/music-singing-voice-blue.webp' },\r\n '8YrH37NzKRuiKFbF': { name: 'PF2E.Actions.PickALock.Title', skill: 'thievery', actionCost: 2, image: 'icons/sundries/misc/lock-bronze-reinforced.webp' },\r\n BQTA7bL264189Xla: { name: 'PF2E.Actions.Repair.Title', skill: 'crafting', actionCost: 'passive', image: 'icons/tools/smithing/anvil.webp' },\r\n tbveXG4gaIoKnsWX: { name: 'PF2E.Actions.Request.Title', skill: 'diplomacy', actionCost: 1, image: 'icons/skills/social/thumbsup-approval-like.webp' },\r\n tikhJ2b6AMh7wQU7: { name: 'PF2E.Actions.Seek.Title', skill: 'perception', actionCost: 1, image: 'icons/tools/scribal/magnifying-glass.webp' },\r\n LN67MgbGE8IHb2X0: { name: 'PF2E.Actions.SenseDirection.Title', skill: 'survival', actionCost: 'passive', image: 'icons/tools/navigation/compass-brass-blue-red.webp' },\r\n PmHt7Gb5fCrlWWTr: { name: 'PF2E.Actions.SenseMotive.Title', skill: 'perception', actionCost: 1, image: 'icons/environment/people/commoner.webp' },\r\n yNry1xMZqdWHncbV: { name: 'PF2E.Actions.Shove.Title', skill: 'athletics', actionCost: 1, image: 'systems/pf2e/icons/spells/hydraulic-push.webp' },\r\n HSTkVuv0SjTNK3Xx: { name: 'PF2E.Actions.Sneak.Title', skill: 'stealth', actionCost: 1, image: 'systems/pf2e/icons/conditions/unnoticed.webp' },\r\n UKHPveLpG7hUs4D0: { name: 'PF2E.Actions.Squeeze.Title', skill: 'acrobatics', actionCost: 'passive', image: 'icons/commodities/tech/claw-mechanical.webp' },\r\n zjovbAeuLvyuWFKd: { name: 'PF2E.Actions.Steal.Title', skill: 'thievery', actionCost: 1, image: 'icons/containers/bags/coinpouch-gold-red.webp' },\r\n mkKko3CEBCyJVQw1: { name: 'PF2E.Actions.Subsist.Title', skill: 'society', actionCost: 'passive', image: 'icons/environment/settlement/building-rubble.webp' },\r\n zkqh01BoXDVgydzo: { name: 'PF2E.Actions.Subsist.Title', skill: 'survival', actionCost: 'passive', image: 'icons/environment/wilderness/camp-improvised.webp' },\r\n TIlUkCzviYxdVk4E: { name: 'PF2E.Actions.Swim.Title', skill: 'athletics', actionCost: 1, image: 'icons/creatures/fish/fish-shark-swimming.webp' },\r\n Al5LYMMdeDcpC9Br: { name: 'PF2E.Actions.Track.Title', skill: 'survival', actionCost: 'passive', image: 'systems/pf2e/icons/conditions/observed.webp' },\r\n m4iM5r3TfvQs5Y2n: { name: 'PF2E.Actions.TreatDisease.Title', skill: 'medicine', actionCost: 'passive', image: 'icons/magic/nature/root-vine-caduceus-healing.webp' },\r\n R03LRl2RBbsm6EcF: { name: 'PF2E.Actions.TreatPoison.Title', skill: 'medicine', actionCost: 1, image: 'systems/pf2e/icons/effects/treat-poison.webp' },\r\n gRj7xUfcpUZQLrOC: { name: 'PF2E.Actions.Trip.Title', skill: 'athletics', actionCost: 1, image: 'icons/skills/wounds/bone-broken-marrow-yellow.webp' },\r\n '2qhYHkcSsTJoSwrJ': { name: 'PF2E.Actions.TumbleThrough.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/skills/movement/feet-winged-sandals-tan.webp' }\r\n}\r\n\r\n/**\r\n * Skills\r\n */\r\nexport const SKILL = {\r\n acrobatics: { name: 'PF2E.SkillAcrobatics' },\r\n arcana: { name: 'PF2E.SkillArcana' },\r\n athletics: { name: 'PF2E.SkillAthletics' },\r\n crafting: { name: 'PF2E.SkillCrafting' },\r\n deception: { name: 'PF2E.SkillDeception' },\r\n diplomacy: { name: 'PF2E.SkillDiplomacy' },\r\n intimidation: { name: 'PF2E.SkillIntimidation' },\r\n lore: { name: 'PF2E.SkillLore' },\r\n medicine: { name: 'PF2E.SkillMedicine' },\r\n nature: { name: 'PF2E.SkillNature' },\r\n occultism: { name: 'PF2E.SkillOccultism' },\r\n perception: { name: 'PF2E.PerceptionLabel' },\r\n performance: { name: 'PF2E.SkillPerformance' },\r\n religion: { name: 'PF2E.SkillReligion' },\r\n society: { name: 'PF2E.SkillSociety' },\r\n stealth: { name: 'PF2E.SkillStealth' },\r\n survival: { name: 'PF2E.SkillSurvival' },\r\n thievery: { name: 'PF2E.SkillThievery' }\r\n}\r\n","import { GROUP } from './constants.js'\r\n\r\n/**\r\n * Default layout and groups\r\n */\r\nexport let DEFAULTS = null\r\n\r\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\r\n const groups = GROUP\r\n Object.values(groups).forEach(group => {\r\n group.name = coreModule.api.Utils.i18n(group.name)\r\n group.listName = `Group: ${coreModule.api.Utils.i18n(group.listName ?? group.name)}`\r\n })\r\n const groupsArray = Object.values(groups)\r\n DEFAULTS = {\r\n layout: [\r\n {\r\n nestId: 'attack',\r\n id: 'attack',\r\n name: coreModule.api.Utils.i18n('PF2E.AttackLabel'),\r\n groups: [\r\n { ...groups.attack, nestId: 'attack_attack' }\r\n ]\r\n },\r\n {\r\n nestId: 'strikes',\r\n id: 'strikes',\r\n name: coreModule.api.Utils.i18n('PF2E.StrikesLabel'),\r\n groups: [\r\n { ...groups.toggles, nestId: 'strikes_toggles' },\r\n { ...groups.strikes, nestId: 'strikes_strikes' }\r\n ],\r\n settings: { customWidth: 500 }\r\n },\r\n {\r\n nestId: 'actions',\r\n id: 'actions',\r\n name: coreModule.api.Utils.i18n('PF2E.ActionsActionsHeader'),\r\n groups: [\r\n { ...groups.actions, nestId: 'actions_actions' },\r\n { ...groups.reactions, nestId: 'actions_reactions' },\r\n { ...groups.freeActions, nestId: 'actions_free-actions' },\r\n { ...groups.passives, nestId: 'actions_passives' }\r\n ]\r\n },\r\n {\r\n nestId: 'inventory',\r\n id: 'inventory',\r\n name: coreModule.api.Utils.i18n('PF2E.TabInventoryLabel'),\r\n groups: [\r\n { ...groups.weapons, nestId: 'inventory_weapons' },\r\n { ...groups.shields, nestId: 'inventory_shields' },\r\n { ...groups.armor, nestId: 'inventory_armor' },\r\n { ...groups.equipment, nestId: 'inventory_equipment' },\r\n { ...groups.consumables, nestId: 'inventory_consumables' },\r\n { ...groups.containers, nestId: 'inventory_containers' },\r\n { ...groups.treasure, nestId: 'inventory_treasure' }\r\n ]\r\n },\r\n {\r\n nestId: 'feats',\r\n id: 'feats',\r\n name: coreModule.api.Utils.i18n('PF2E.Item.Feat.Plural'),\r\n groups: [\r\n { ...groups.ancestryFeatures, nestId: 'feats_ancestry-features' },\r\n { ...groups.classFeatures, nestId: 'feats_class-features' },\r\n { ...groups.ancestryFeats, nestId: 'feats_ancestry-feats' },\r\n { ...groups.classFeats, nestId: 'feats_class-feats' },\r\n { ...groups.skillFeats, nestId: 'feats_skill-feats' },\r\n { ...groups.generalFeats, nestId: 'feats_general-feats' },\r\n { ...groups.bonusFeats, nestId: 'feats_bonus-feats' }\r\n ]\r\n },\r\n {\r\n nestId: 'spells',\r\n id: 'spells',\r\n name: coreModule.api.Utils.i18n('PF2E.Item.Spell.Plural'),\r\n groups: [\r\n { ...groups.spells, nestId: 'spells_spells' }\r\n ]\r\n },\r\n {\r\n nestId: 'attributes',\r\n id: 'attributes',\r\n name: coreModule.api.Utils.i18n('tokenActionHud.pf2e.attributes'),\r\n groups: [\r\n { ...groups.heroPoints, nestId: 'attributes_hero-points' },\r\n { ...groups.initiative, nestId: 'attributes_initiative' },\r\n { ...groups.perceptionCheck, nestId: 'attributes_perception-check' },\r\n { ...groups.saves, nestId: 'attributes_saves' }\r\n ]\r\n },\r\n {\r\n nestId: 'skills',\r\n id: 'skills',\r\n name: coreModule.api.Utils.i18n('PF2E.SkillsLabel'),\r\n groups: [\r\n { ...groups.coreSkills, nestId: 'skills_core-skills' },\r\n { ...groups.loreSkills, nestId: 'skills_lore-skills' }\r\n ]\r\n },\r\n {\r\n nestId: 'effects',\r\n id: 'effects',\r\n name: coreModule.api.Utils.i18n('PF2E.EffectsLabel'),\r\n groups: [\r\n { ...groups.conditions, nestId: 'effects_conditions' },\r\n { ...groups.socialConditions, nestId: 'effects_social-conditions' },\r\n { ...groups.otherConditions, nestId: 'effects_other-conditions' },\r\n { ...groups.effects, nestId: 'effects_effects' }\r\n ]\r\n },\r\n {\r\n nestId: 'utility',\r\n id: 'utility',\r\n name: coreModule.api.Utils.i18n('tokenActionHud.utility'),\r\n groups: [\r\n { ...groups.combat, nestId: 'utility_combat' },\r\n { ...groups.token, nestId: 'utility_token' },\r\n { ...groups.recoveryCheck, nestId: 'utility_recovery-check' },\r\n { ...groups.rests, nestId: 'utility_rests' },\r\n { ...groups.utility, nestId: 'utility_utility' }\r\n ]\r\n }\r\n ],\r\n groups: groupsArray\r\n }\r\n})\r\n","import { MODULE } from './constants.js'\r\n\r\nexport let Utils = null\r\n\r\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\r\n Utils = class Utils {\r\n /**\r\n * Get setting value\r\n * @param {string} key The key\r\n * @param {string=null} defaultValue The default value\r\n * @returns The setting value\r\n */\r\n static getSetting (key, defaultValue = null) {\r\n let value = defaultValue ?? null\r\n try {\r\n value = game.settings.get(MODULE.ID, key)\r\n } catch {\r\n coreModule.api.Logger.debug(`Setting '${key}' not found`)\r\n }\r\n return value\r\n }\r\n\r\n /**\r\n * Set setting value\r\n * @param {string} key The key\r\n * @param {string} value The value\r\n */\r\n static async setSetting (key, value) {\r\n try {\r\n value = await game.settings.set(MODULE.ID, key, value)\r\n coreModule.api.Logger.debug(`Setting '${key}' set to '${value}'`)\r\n } catch {\r\n coreModule.api.Logger.debug(`Setting '${key}' not found`)\r\n }\r\n }\r\n }\r\n})\r\n","// System Module Imports\r\nimport { ACTION_ICON, ACTION_TYPE, CARRY_TYPE_ICON, ITEM_TYPE, MODULAR_OPTION, SKILL_ABBREVIATION, SKILL, SKILL_ACTION, STRIKE_ICON, STRIKE_USAGE, DAMAGE_TYPE_ICONS } from './constants.js'\r\nimport { Utils } from './utils.js'\r\n\r\nexport let ActionHandler = null\r\n\r\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\r\n ActionHandler = class ActionHandler extends coreModule.api.ActionHandler {\r\n // Initialize actor and token variables\r\n actors = null\r\n actorId = null\r\n actorType = null\r\n tokenId = null\r\n\r\n // Initialize items variable\r\n items = null\r\n\r\n // Initialize groupIds variables\r\n groupIds = null\r\n activationGroupIds = null\r\n effectGroupIds = null\r\n inventoryGroupIds = null\r\n spellGroupIds = null\r\n\r\n // Initialize action variables\r\n featureActions = null\r\n inventoryActions = null\r\n spellActions = null\r\n\r\n mapLabel = coreModule.api.Utils.i18n('PF2E.MAPAbbreviationLabel').replace(' {penalty}', '')\r\n\r\n /**\r\n * Build System Actions\r\n * @override\r\n * @param {array} groupIds\r\n */\r\n async buildSystemActions (groupIds) {\r\n // Set actor and token variables\r\n this.actors = (!this.actor) ? this.#getActors() : [this.actor]\r\n this.actorType = this.actor?.type\r\n\r\n // Exit if actor is not a known type\r\n const knownActors = ['character', 'familiar', 'hazard', 'npc']\r\n if (this.actorType && !knownActors.includes(this.actorType)) return\r\n\r\n // Set items variable\r\n if (this.actor) {\r\n let items = this.actor.items\r\n items = coreModule.api.Utils.sortItemsByName(items)\r\n this.items = items\r\n }\r\n\r\n // Set settings variables\r\n this.abbreviateSkills = Utils.getSetting('abbreviateSkills')\r\n this.addAuxiliaryActions = Utils.getSetting('addAuxiliaryActions')\r\n this.addDamageAndCritical = Utils.getSetting('addDamageAndCritical')\r\n this.addStowedItems = Utils.getSetting('addStowedItems')\r\n this.addUnequippedItems = Utils.getSetting('addUnequippedItems')\r\n this.calculateAttackPenalty = Utils.getSetting('calculateAttackPenalty')\r\n this.colorSkills = Utils.getSetting('colorSkills')\r\n this.showStrikeImages = Utils.getSetting('showStrikeImages')\r\n this.showStrikeNames = Utils.getSetting('showStrikeNames')\r\n this.showStrikeTraits = Utils.getSetting('showStrikeTraits')\r\n this.splitStrikes = Utils.getSetting('splitStrikes')\r\n\r\n // Set group variables\r\n this.groupIds = groupIds\r\n\r\n if (this.actorType === 'character') {\r\n await this.#buildCharacterActions()\r\n } else if (this.actorType === 'familiar') {\r\n await this.#buildFamiliarActions()\r\n } else if (this.actorType === 'hazard') {\r\n await this.#buildHazardActions()\r\n } else if (this.actorType === 'npc') {\r\n await this.#buildNpcActions()\r\n } else if (!this.actor) {\r\n this.#buildMultipleTokenActions()\r\n }\r\n }\r\n\r\n /**\r\n * Build character actions\r\n * @private\r\n */\r\n async #buildCharacterActions () {\r\n await Promise.all([\r\n this.#buildActions(),\r\n this.#buildCombat(),\r\n this.#buildConditions(),\r\n this.#buildEffects(),\r\n this.#buildFeats(),\r\n this.#buildHeroActions(),\r\n this.#buildHeroPoints(),\r\n this.#buildInitiative(),\r\n this.#buildInventory(),\r\n this.#buildPerceptionCheck(),\r\n this.#buildRecoveryCheck(),\r\n this.#buildRests(),\r\n this.#buildSaves(),\r\n this.#buildSkillActions(),\r\n this.#buildSkills(),\r\n this.#buildSpells(),\r\n this.#buildStrikes(),\r\n this.#buildToggles()\r\n ])\r\n // Build elemental blasts after other character actions so they are grouped together\r\n await this.#buildElementalBlasts()\r\n }\r\n\r\n /**\r\n * Build familiar actions\r\n * @private\r\n */\r\n async #buildFamiliarActions () {\r\n await Promise.all([\r\n this.#buildActions(),\r\n this.#buildAttack(),\r\n this.#buildCombat(),\r\n this.#buildConditions(),\r\n this.#buildEffects(),\r\n this.#buildInventory(),\r\n this.#buildPerceptionCheck(),\r\n this.#buildSaves(),\r\n this.#buildSkills()\r\n ])\r\n }\r\n\r\n /**\r\n * Build hazard actions\r\n * @private\r\n */\r\n async #buildHazardActions () {\r\n await Promise.all([\r\n this.#buildActions(),\r\n this.#buildCombat(),\r\n this.#buildInitiative(),\r\n this.#buildSaves(),\r\n this.#buildStrikes()\r\n ])\r\n }\r\n\r\n /**\r\n * Build NPC actions\r\n */\r\n async #buildNpcActions () {\r\n await Promise.all([\r\n this.#buildActions(),\r\n this.#buildCombat(),\r\n this.#buildConditions(),\r\n this.#buildEffects(),\r\n this.#buildFeats(),\r\n this.#buildInitiative(),\r\n this.#buildInventory(),\r\n this.#buildPerceptionCheck(),\r\n this.#buildSaves(),\r\n this.#buildSkillActions(),\r\n this.#buildSkills(),\r\n this.#buildStrikes(),\r\n this.#buildSpells(),\r\n this.#buildToggles()\r\n ])\r\n }\r\n\r\n /**\r\n * Build multiple token actions\r\n * @private\r\n * @returns {object}\r\n */\r\n async #buildMultipleTokenActions () {\r\n await Promise.all([\r\n this.#buildInitiative(),\r\n this.#buildPerceptionCheck(),\r\n this.#buildSaves(),\r\n this.#buildSkillActions(),\r\n this.#buildSkills()\r\n ])\r\n }\r\n\r\n /**\r\n * Build actions\r\n */\r\n async #buildActions () {\r\n const actionType = 'action'\r\n\r\n // Exit early if no items exist\r\n if (this.items.size === 0) return\r\n\r\n const actionTypes = ['action', 'reaction', 'free', 'passive']\r\n\r\n const actionItems = new Map([...this.items].filter(([_, itemData]) => itemData.type === 'action' || actionTypes.includes(itemData.system?.actionType?.value)))\r\n\r\n const actionsMap = new Map()\r\n\r\n for (const [key, value] of actionItems) {\r\n // Set variables\r\n const actionTypeValue = value.system.actionType?.value\r\n\r\n switch (actionTypeValue) {\r\n case 'action':\r\n actionsMap.set('actions', actionsMap.get('actions') || new Map())\r\n actionsMap.get('actions').set(key, value)\r\n break\r\n case 'reaction':\r\n actionsMap.set('reactions', actionsMap.get('reactions') || new Map())\r\n actionsMap.get('reactions').set(key, value)\r\n break\r\n case 'free':\r\n actionsMap.set('free-actions', actionsMap.get('free-actions') || new Map())\r\n actionsMap.get('free-actions').set(key, value)\r\n break\r\n case 'passive':\r\n actionsMap.set('passives', actionsMap.get('passives') || new Map())\r\n actionsMap.get('passives').set(key, value)\r\n break\r\n }\r\n }\r\n\r\n // Loop through inventory subcategory ids\r\n for (const [key, value] of actionsMap) {\r\n const groupId = key\r\n const items = value\r\n\r\n // Create group data\r\n const groupData = { id: groupId, type: 'system' }\r\n\r\n const actions = await Promise.all(\r\n [...items].map(async ([_, itemData]) => {\r\n const id = this.#getActionId(itemData)\r\n const name = this.#getActionName(itemData)\r\n const listName = this.#getActionListName(itemData, actionType)\r\n const cssClass = this.#getActionCss(itemData)\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const icon1 = this.#getIcon1(itemData, actionType)\r\n const img = coreModule.api.Utils.getImage(itemData)\r\n const info = this.#getItemInfo(itemData)\r\n const tooltipData = await this.#getTooltipData(itemData, actionType)\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n\r\n return {\r\n id,\r\n name,\r\n encodedValue,\r\n cssClass,\r\n img,\r\n icon1,\r\n info,\r\n listName,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n }\r\n\r\n /**\r\n * Build attacks\r\n * @private\r\n */\r\n #buildAttack () {\r\n const actionType = 'familiarAttack'\r\n\r\n const attack = this.actor.system.attack\r\n\r\n if (attack) {\r\n const id = attack.slug\r\n const name = coreModule.api.Utils.i18n('PF2E.AttackLabel')\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const modifier = coreModule.api.Utils.getModifier(attack?.totalModifier)\r\n const info1 = this.actor ? { text: modifier } : ''\r\n\r\n // Get actions\r\n const actions = [{\r\n id,\r\n name,\r\n listName,\r\n encodedValue,\r\n info1\r\n }]\r\n\r\n // Create group data\r\n const groupData = { id: 'attack', type: 'system' }\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n }\r\n\r\n /**\r\n * Build combat\r\n */\r\n #buildCombat () {\r\n const actionType = 'utility'\r\n\r\n // Set combat types\r\n const combatTypes = {\r\n endTurn: { id: 'endTurn', name: coreModule.api.Utils.i18n('tokenActionHud.endTurn') }\r\n }\r\n\r\n // Delete endTurn for multiple tokens\r\n if (game.combat?.current?.tokenId !== this.token?.id) delete combatTypes.endTurn\r\n\r\n // Get actions\r\n const actions = Object.entries(combatTypes).map((combatType) => {\r\n const id = combatType[1].id\r\n const name = combatType[1].name\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n return {\r\n id,\r\n name,\r\n listName,\r\n encodedValue\r\n }\r\n })\r\n\r\n // Create group data\r\n const groupData = { id: 'combat', type: 'system' }\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build conditions\r\n * @private\r\n */\r\n async #buildConditions () {\r\n const actionType = 'condition'\r\n const limitedConditions = ['doomed', 'dying', 'wounded']\r\n\r\n // Get active conditions\r\n const activeConditions = new Map(\r\n [...this.items]\r\n .filter(item => item[1].type === actionType)\r\n .map(item => {\r\n const itemData = item[1]\r\n return [\r\n itemData.slug,\r\n itemData\r\n ]\r\n })\r\n )\r\n\r\n // Get conditions\r\n // Conditions are duplicated in the ConditionManager and the name scaled conditions is suffixed with ' 1'\r\n const conditions = [...game.pf2e.ConditionManager.conditions]\r\n .filter(([conditionId]) => !conditionId.startsWith('Compendium'))\r\n .map(([conditionId, conditionData]) => {\r\n conditionData.name = conditionData.name.replace(' 1', '')\r\n return [conditionId, conditionData]\r\n })\r\n\r\n // Build actions\r\n const actions = await Promise.all(\r\n conditions.map(async ([conditionId, conditionData]) => {\r\n const id = conditionData.slug\r\n const activeCondition = activeConditions.get(conditionId)\r\n const activeConditionId = activeCondition?.id\r\n const name = conditionData.name\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const img = coreModule.api.Utils.getImage(conditionData)\r\n const active = activeConditionId ? ' active' : ''\r\n const cssClass = `toggle${active}`\r\n let info1 = ''\r\n let attributeValue = ''\r\n\r\n if (activeConditionId) {\r\n if (limitedConditions.includes(activeCondition.slug)) {\r\n const attribute = this.actor.system.attributes[activeCondition.slug]\r\n attributeValue = attribute.value\r\n const max = attribute.max\r\n info1 = { text: (max > 0) ? `${attributeValue ?? 0}/${max}` : '' }\r\n } else if (activeCondition.system.value.isValued) {\r\n attributeValue = activeCondition.system.value.value\r\n info1 = { text: attributeValue }\r\n }\r\n }\r\n\r\n const tooltipName = `${name}${(attributeValue) ? ` ${attributeValue}` : ''}`\r\n const tooltipData = {\r\n name: tooltipName,\r\n description: conditionData.description\r\n }\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n\r\n return {\r\n id,\r\n name,\r\n listName,\r\n encodedValue,\r\n cssClass,\r\n img,\r\n info1,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n actions.sort((a, b) => a.name.localeCompare(b.name))\r\n\r\n // Create group data\r\n const conditionsGroupData = { id: 'conditions', type: 'system' }\r\n const actionsTemp = []\r\n\r\n // Add conditions to the group\r\n await this.addActions(\r\n actions.reduce(function (acc, current) {\r\n const filter = ['Friendly', 'Helpful', 'Hostile', 'Indifferent', 'Malevolence', 'Unfriendly']\r\n if (!filter.includes(current.name)) {\r\n acc.push(current)\r\n } else {\r\n actionsTemp.push(current)\r\n }\r\n return acc\r\n }, []),\r\n conditionsGroupData\r\n )\r\n\r\n const socialGroupData = { id: 'social-conditions', type: 'system' }\r\n const actionsOther = []\r\n\r\n // Add social conditions to the group\r\n await this.addActions(\r\n actionsTemp.reduce(function (acc, current) {\r\n const filter = ['Friendly', 'Helpful', 'Hostile', 'Indifferent', 'Unfriendly']\r\n if (filter.includes(current.name)) {\r\n acc.push(current)\r\n } else {\r\n actionsOther.push(current)\r\n }\r\n return acc\r\n }, []),\r\n socialGroupData\r\n )\r\n\r\n const otherGroupData = { id: 'other-conditions', type: 'system' }\r\n\r\n // Add other conditions to the group\r\n await this.addActions(actionsOther, otherGroupData)\r\n }\r\n\r\n /**\r\n * Build hero points\r\n */\r\n async #buildHeroPoints () {\r\n const actionType = 'heroPoints'\r\n\r\n // Create group data\r\n const groupData = { id: 'hero-points', type: 'system' }\r\n\r\n const heroPoints = this.actor.system.resources?.heroPoints\r\n const value = heroPoints.value\r\n const max = heroPoints.max\r\n\r\n // Get actions\r\n const actions = [{\r\n id: 'heroPoints',\r\n name: coreModule.api.Utils.i18n('PF2E.HeroPointsLabel'),\r\n encodedValue: [actionType, actionType].join(this.delimiter),\r\n info1: { text: (max > 0) ? `${value ?? 0}/${max}` : '' }\r\n }]\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build effects\r\n * @private\r\n */\r\n async #buildEffects () {\r\n const actionType = 'effect'\r\n\r\n // Get effects\r\n const items = new Map([...this.items]\r\n .filter(item =>\r\n item[1].type === 'effect' &&\r\n ((!(item[1].system?.unidentified ?? false) &&\r\n !(item[1].unidentified ?? false)) || game.user.isGM)))\r\n\r\n // Create group data\r\n const groupData = { id: 'effects', type: 'system' }\r\n\r\n const actions = await Promise.all(\r\n [...items].map(async ([_$, itemData]) => {\r\n const id = this.#getActionId(itemData)\r\n const name = this.#getActionName(itemData)\r\n const listName = this.#getActionListName(itemData, actionType)\r\n const cssClass = this.#getActionCss(itemData)\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const icon1 = this.#getIcon1(itemData, actionType)\r\n const img = coreModule.api.Utils.getImage(itemData)\r\n const info = this.#getItemInfo(itemData)\r\n const tooltipData = {\r\n name,\r\n description: itemData.description\r\n }\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n return {\r\n id,\r\n name,\r\n listName,\r\n encodedValue,\r\n cssClass,\r\n img,\r\n icon1,\r\n info,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n actions.sort((a, b) => a.name.localeCompare(b.name))\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build Feats\r\n * @private\r\n */\r\n async #buildFeats () {\r\n const actionType = 'feat'\r\n const featTypes = {\r\n ancestryfeature: 'ancestry-features',\r\n classfeature: 'class-features',\r\n ancestry: 'ancestry-feats',\r\n class: 'class-feats',\r\n skill: 'skill-feats',\r\n general: 'general-feats',\r\n bonus: 'bonus-feats'\r\n }\r\n\r\n // Get feats\r\n const featsMap = new Map()\r\n\r\n for (const [key, value] of this.items) {\r\n if (value.type !== 'feat') continue\r\n // 'featType' changed to 'system.category' post pf2e 4.10+\r\n const featType = value.system?.category ?? value.featType\r\n const groupId = featTypes[featType]\r\n\r\n featsMap.set(groupId, featsMap.get(groupId) || new Map())\r\n featsMap.get(groupId).set(key, value)\r\n }\r\n\r\n for (const [key, value] of featsMap) {\r\n const groupId = key\r\n const items = value\r\n\r\n // Get group data\r\n const groupData = { id: groupId, type: 'system' }\r\n\r\n const actions = await Promise.all(\r\n [...items].map(async ([_, itemData]) => {\r\n const id = this.#getActionId(itemData)\r\n const name = this.#getActionName(itemData)\r\n const listName = this.#getActionListName(itemData, actionType)\r\n const cssClass = this.#getActionCss(itemData)\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const icon1 = this.#getIcon1(itemData, actionType)\r\n const img = coreModule.api.Utils.getImage(itemData)\r\n const info = this.#getItemInfo(itemData)\r\n const tooltipData = await this.#getTooltipData(itemData, actionType)\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n return {\r\n id,\r\n name,\r\n encodedValue,\r\n cssClass,\r\n img,\r\n icon1,\r\n info,\r\n listName,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n }\r\n\r\n /**\r\n * Build Hero Actions\r\n * @private\r\n */\r\n async #buildHeroActions () {\r\n if (!game.modules.get('pf2e-hero-actions')?.active) return\r\n\r\n const actionType = 'heroAction'\r\n const actionTypeName = coreModule.api.Utils.i18n(ACTION_TYPE[actionType])\r\n const heroActions = this.actor.getFlag('pf2e-hero-actions', 'heroActions') ?? []\r\n\r\n const groupData = { id: 'hero-actions', type: 'system' }\r\n\r\n const actions = []\r\n\r\n const heroPoints = this.actor.heroPoints?.value\r\n const remainingHeroPoints = heroPoints - (heroActions?.length ?? 0)\r\n\r\n if (remainingHeroPoints > 0) {\r\n actions.push({\r\n id: 'drawHeroActions',\r\n name: game.i18n.format('pf2e-hero-actions.templates.heroActions.draw', { nb: remainingHeroPoints }),\r\n listName: `${actionTypeName}: ${game.i18n.localize('pf2e-hero-actions.templates.heroActions.draw').replace('({nb}) ', '')}`,\r\n encodedValue: [actionType, 'drawHeroActions'].join(this.delimiter)\r\n })\r\n }\r\n\r\n const heroActionActions = await Promise.all(\r\n [...heroActions].map(async (heroAction) => {\r\n const id = heroAction?.uuid\r\n const name = heroAction?.name\r\n const listName = `${actionTypeName}: ${name}`\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const img = coreModule.api.Utils.getImage('systems/pf2e/icons/actions/Passive.webp')\r\n const uuidData = (heroAction?.uuid) ? await fromUuid(heroAction?.uuid) : null\r\n const tooltipData = {\r\n name,\r\n description: uuidData?.text?.content ?? null\r\n }\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n return {\r\n id,\r\n name,\r\n encodedValue,\r\n img,\r\n listName,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n actions.push(...heroActionActions)\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build initiative\r\n * @private\r\n */\r\n async #buildInitiative () {\r\n const actionType = 'initiative'\r\n\r\n const initiativeStatistic = this.actor?.system?.initiative?.statistic ?? null\r\n\r\n // Get actions\r\n const actions = []\r\n\r\n if (this.actorType !== 'hazard') {\r\n const initiative = this.actor ? this.actor.system.initiative : coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\r\n const fullName = coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\r\n const name = this.abbreviatedSkills ? SKILL_ABBREVIATION.perception ?? fullName : fullName\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, 'perception'].join(this.delimiter)\r\n const active = (initiativeStatistic === 'perception') ? ' active' : ''\r\n const cssClass = `toggle${active}`\r\n const modifier = coreModule.api.Utils.getModifier(initiative?.totalModifier)\r\n const info1 = this.actor ? { text: modifier } : ''\r\n const tooltipName = `${fullName}${(this.actor && modifier) ? ` ${modifier}` : ''}`\r\n const tooltipData = {\r\n name: tooltipName,\r\n modifiers: initiative?.modifiers\r\n }\r\n const tooltip = this.actor ? await this.#getTooltip(actionType, tooltipData) : null\r\n\r\n // Get actions\r\n actions.push({\r\n id: 'initiative-perception',\r\n name,\r\n listName,\r\n encodedValue,\r\n cssClass,\r\n info1,\r\n tooltip\r\n })\r\n }\r\n\r\n // Get skills\r\n const skills = (this.actor)\r\n ? Object.entries(this.actor.skills).filter(([_, skillData]) => !!skillData.label && skillData.label.length > 1)\r\n : this.#getSharedSkills()\r\n\r\n if (!skills) return\r\n\r\n const coreSkills = []\r\n const loreSkills = []\r\n\r\n for (const skill of skills) {\r\n if (!skill[1].lore) {\r\n coreSkills.push(skill)\r\n } else {\r\n loreSkills.push(skill)\r\n }\r\n }\r\n\r\n coreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\r\n loreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\r\n\r\n const skillActions = await Promise.all(\r\n [...coreSkills, ...loreSkills].map(async ([skillId, skillData]) => {\r\n const id = `initiative-${skillId}`\r\n const data = skillData\r\n const fullName = coreModule.api.Utils.i18n(data.label) ?? coreModule.api.Utils.i18n(CONFIG.PF2E.skillList[skillId])\r\n const name = this.abbreviatedSkills ? SKILL_ABBREVIATION[data.slug] ?? fullName : fullName\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, skillId].join(this.delimiter)\r\n const active = (initiativeStatistic === skillId) ? ' active' : ''\r\n const cssClass = `toggle${active}`\r\n const modifier = coreModule.api.Utils.getModifier(skillData.check?.mod)\r\n const info1 = this.actor ? { text: modifier } : ''\r\n const tooltipName = `${fullName}${(this.actor && modifier) ? ` ${modifier}` : ''}`\r\n const tooltipData = {\r\n name: tooltipName,\r\n modifiers: skillData?.modifiers\r\n }\r\n const tooltip = (this.actor) ? await this.#getTooltip(actionType, tooltipData) : null\r\n\r\n return {\r\n id,\r\n name,\r\n listName,\r\n encodedValue,\r\n cssClass,\r\n info1,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n actions.push(...skillActions)\r\n\r\n // Create group data\r\n const groupData = { id: 'initiative', type: 'system' }\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build inventory\r\n * @private\r\n */\r\n async #buildInventory () {\r\n // Exit if no items exist\r\n if (this.items.size === 0) return\r\n\r\n const actionType = 'item'\r\n const inventoryMap = new Map()\r\n\r\n for (const [key, value] of this.items) {\r\n const hasQuantity = value.system?.quantity > 0\r\n const isEquippedItem = this.#isEquippedItem(value)\r\n const isAddItem = this.#isAddItem('nonContainer', value)\r\n const type = value.type\r\n\r\n if (hasQuantity && isAddItem) {\r\n const itemType = isEquippedItem ? 'equipped' : 'unequipped'\r\n const itemCategoryMap = inventoryMap.get(itemType) ?? new Map()\r\n itemCategoryMap.set(key, value)\r\n inventoryMap.set(itemType, itemCategoryMap)\r\n\r\n if (isEquippedItem) {\r\n const categoryTypeMap = inventoryMap.get(type) ?? new Map()\r\n categoryTypeMap.set(key, value)\r\n inventoryMap.set(type, categoryTypeMap)\r\n }\r\n }\r\n }\r\n\r\n // Loop through inventory group ids\r\n for (const [id, items] of inventoryMap) {\r\n const groupId = ITEM_TYPE[id]?.groupId\r\n\r\n if (!groupId) continue\r\n\r\n // Create group data\r\n const groupData = { id: groupId, type: 'system' }\r\n\r\n // Get actions\r\n const actions = await Promise.all(\r\n [...items].map(async ([_, itemData]) => {\r\n const id = this.#getActionId(itemData)\r\n const name = this.#getActionName(itemData)\r\n const listName = this.#getActionListName(itemData, actionType)\r\n const cssClass = this.#getActionCss(itemData)\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const icon1 = this.#getIcon1(itemData, actionType)\r\n const icon2 = this.#getCarryTypeIcon(itemData)\r\n const img = coreModule.api.Utils.getImage(itemData)\r\n const info = this.#getItemInfo(itemData)\r\n const tooltipData = await this.#getTooltipData(itemData, actionType)\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n\r\n return {\r\n id,\r\n name,\r\n encodedValue,\r\n cssClass,\r\n img,\r\n icon1,\r\n icon2,\r\n info,\r\n listName,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n // Add container contents\r\n if (inventoryMap.has('backpack')) {\r\n // Create parent group data\r\n const parentGroupData = { id: 'containers', type: 'system' }\r\n\r\n const containers = inventoryMap.get('backpack')\r\n\r\n for (const [id, container] of containers) {\r\n const contents = container.contents\r\n\r\n // Skip if container has no contents\r\n if (!contents.size) continue\r\n\r\n // Create group data\r\n const groupData = {\r\n id,\r\n name: container.name,\r\n listName: `Group: ${container.name}`,\r\n type: 'system-derived'\r\n }\r\n\r\n // Add group to action list\r\n await this.addGroup(groupData, parentGroupData)\r\n\r\n const contentsMap = new Map()\r\n\r\n for (const content of contents) {\r\n const isAddItem = this.#isAddItem('container', content)\r\n\r\n if (isAddItem) {\r\n contentsMap.set(content.id, content)\r\n }\r\n }\r\n\r\n const actions = await Promise.all(\r\n [...contentsMap].map(async ([_, itemData]) => {\r\n const id = this.#getActionId(itemData)\r\n const name = this.#getActionName(itemData)\r\n const listName = this.#getActionListName(itemData, actionType)\r\n const cssClass = this.#getActionCss(itemData)\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const icon1 = this.#getIcon1(itemData, actionType)\r\n const icon2 = this.#getCarryTypeIcon(itemData)\r\n const img = coreModule.api.Utils.getImage(itemData)\r\n const info = this.#getItemInfo(itemData)\r\n const tooltipData = await this.#getTooltipData(itemData, actionType)\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n\r\n return {\r\n id,\r\n name,\r\n encodedValue,\r\n cssClass,\r\n img,\r\n icon1,\r\n icon2,\r\n info,\r\n listName,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Build perception check\r\n * @private\r\n */\r\n async #buildPerceptionCheck () {\r\n const actionType = 'perceptionCheck'\r\n const perception = this.actor ? this.actor.system.perception : coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\r\n const name = coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\r\n const modifier = coreModule.api.Utils.getModifier(perception?.totalModifier)\r\n const info1 = this.actor ? { text: modifier } : ''\r\n const tooltipName = `${name}${(this.actor && modifier) ? ` ${modifier}` : ''}`\r\n const tooltipData = {\r\n name: tooltipName,\r\n modifiers: perception?.modifiers\r\n }\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n\r\n // Get actions\r\n const actions = [{\r\n id: 'perception',\r\n name,\r\n encodedValue: [actionType, 'perception'].join(this.delimiter),\r\n info1,\r\n tooltip\r\n }]\r\n\r\n // Create group data\r\n const groupData = { id: 'perception-check', type: 'system' }\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build recovery check\r\n */\r\n #buildRecoveryCheck () {\r\n const actionType = 'recoveryCheck'\r\n const dyingValue = this.actor?.system.attributes?.dying\r\n\r\n if (dyingValue?.value > 0) {\r\n // Get actions\r\n const actions = [{\r\n id: actionType,\r\n name: coreModule.api.Utils.i18n('PF2E.Check.Specific.Recovery'),\r\n encodedValue: [actionType, actionType].join(this.delimiter)\r\n }]\r\n\r\n // Create group data\r\n const groupData = { id: 'recovery-check', type: 'system' }\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n }\r\n\r\n /**\r\n * Build rests\r\n */\r\n #buildRests () {\r\n // Exit if multiple actors and not every actor is the character type\r\n if (!this.actor && !this.actors.every(actor => actor.type === 'character')) return\r\n\r\n const actionType = 'utility'\r\n\r\n // Get actions\r\n const actions = [\r\n {\r\n id: 'treatWounds',\r\n name: coreModule.api.Utils.i18n('PF2E.Actions.TreatWounds.Label'),\r\n encodedValue: [actionType, 'treatWounds'].join(this.delimiter)\r\n },\r\n {\r\n id: 'rest',\r\n name: coreModule.api.Utils.i18n('PF2E.Actor.Character.Rest.Label'),\r\n encodedValue: [actionType, 'rest'].join(this.delimiter)\r\n }\r\n ]\r\n\r\n // Take a Breather\r\n if (game.settings.get('pf2e', 'staminaVariant')) {\r\n actions.push({\r\n id: 'takeBreather',\r\n name: coreModule.api.Utils.i18n('tokenActionHud.pf2e.takeBreather'),\r\n encodedValue: [actionType, 'takeBreather'].join(this.delimiter)\r\n })\r\n }\r\n\r\n // Create group data\r\n const groupData = { id: 'rests', type: 'system' }\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build saves\r\n * @private\r\n */\r\n async #buildSaves () {\r\n const actionType = 'save'\r\n\r\n // Get saves\r\n const saves = this.actor ? Object.entries(this.actor.saves || []) : Object.entries(CONFIG.PF2E.saves)\r\n\r\n // Exit if no saves exist\r\n if (!saves || saves.length === 0) return\r\n\r\n // Get actions\r\n const actions = await Promise.all(\r\n saves.map(async ([id, saveData]) => {\r\n const name = saveData.label ?? (typeof saveData === 'string' ? coreModule.api.Utils.i18n(saveData) : '')\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const modifier = coreModule.api.Utils.getModifier(saveData.mod)\r\n const info1 = this.actor ? { text: modifier } : ''\r\n const tooltipName = `${name}${(this.actor && modifier) ? ` ${modifier}` : ''}`\r\n const tooltipData = {\r\n name: tooltipName,\r\n modifiers: saveData?.modifiers\r\n }\r\n const tooltip = this.actor ? await this.#getTooltip(actionType, tooltipData) : null\r\n\r\n return {\r\n id,\r\n name,\r\n listName,\r\n encodedValue,\r\n info1,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n // Get group data\r\n const groupData = { id: 'saves', type: 'system' }\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n\r\n /**\r\n * Build skill actions\r\n * @private\r\n */\r\n async #buildSkillActions () {\r\n const actionType = 'compendiumMacro'\r\n\r\n // Get skill actions\r\n const actionMacros = await game.packs.get('pf2e.action-macros').getIndex()\r\n\r\n if (!actionMacros.size) return\r\n\r\n const skillActionsMap = new Map()\r\n\r\n // Get actions\r\n const actions = []\r\n for (const actionMacro of actionMacros) {\r\n const skillAction = SKILL_ACTION[actionMacro._id]\r\n\r\n if (!skillAction) continue\r\n\r\n const id = actionMacro._id\r\n const actionName = coreModule.api.Utils.i18n(skillAction.name)\r\n const skillName = coreModule.api.Utils.i18n(SKILL[skillAction.skill]?.name)\r\n const name = `${actionName} - ${skillName}`\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE.skillAction)}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, 'pf2e.action-macros', id].join(this.delimiter)\r\n const icon1 = this.#getActionIcon(skillAction.actionCost)\r\n const img = skillAction.image\r\n const modifier = coreModule.api.Utils.getModifier(this.actor?.skills[skillAction.skill]?.check?.mod)\r\n const info1 = this.actor ? { text: modifier } : null\r\n\r\n const action = {\r\n id,\r\n name,\r\n listName,\r\n encodedValue,\r\n icon1,\r\n img,\r\n info1\r\n }\r\n\r\n actions.push(action)\r\n\r\n skillActionsMap.set(skillAction.skill, skillActionsMap.get(skillAction.skill) || new Map())\r\n skillActionsMap.get(skillAction.skill).set(actionMacro._id, { ...action, name: actionName })\r\n }\r\n\r\n // Add actions to HUD\r\n await this.addActions(actions, { id: 'skill-actions-ungrouped', type: 'system' })\r\n\r\n for (const [key, value] of Object.entries(SKILL)) {\r\n const groupId = key\r\n const groupName = coreModule.api.Utils.i18n(value.name)\r\n const skillActions = skillActionsMap.get(groupId)\r\n\r\n if (!skillActions) continue\r\n\r\n // Create group data\r\n const groupData = { id: groupId, name: groupName, type: 'system-derived' }\r\n\r\n // Add group to HUD\r\n await this.addGroup(groupData, { id: 'skill-actions-grouped', type: 'system' })\r\n\r\n // Get actions\r\n const actions = [...skillActions].map(([_, skillAction]) => {\r\n return skillAction\r\n })\r\n\r\n // Add actions to HUD\r\n await this.addActions(actions, groupData)\r\n }\r\n }\r\n\r\n /**\r\n * Build skills\r\n * @private\r\n */\r\n async #buildSkills () {\r\n const actionType = 'skill'\r\n\r\n // Get skills\r\n const skills = (this.actor)\r\n ? Object.entries(this.actor.skills).filter(skill => !!skill[1].label && skill[1].label.length > 1)\r\n : this.#getSharedSkills()\r\n\r\n if (!skills) return\r\n\r\n const coreSkills = []\r\n const loreSkills = []\r\n\r\n for (const skill of skills) {\r\n if (!skill[1].lore) {\r\n coreSkills.push(skill)\r\n } else {\r\n loreSkills.push(skill)\r\n }\r\n }\r\n\r\n coreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\r\n loreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\r\n\r\n const skillsMap = new Map()\r\n\r\n skillsMap.set('skills', new Map())\r\n\r\n if (coreSkills.length > 0) {\r\n skillsMap.set('core-skills', new Map())\r\n }\r\n if (loreSkills.length > 0) {\r\n skillsMap.set('lore-skills', new Map())\r\n }\r\n\r\n for (const skill of [...coreSkills, ...loreSkills]) {\r\n if (!skill[1].lore) {\r\n skillsMap.get('core-skills').set(skill[0], skill[1])\r\n } else {\r\n skillsMap.get('lore-skills').set(skill[0], skill[1])\r\n }\r\n }\r\n\r\n // Loop through inventory subcateogry ids\r\n for (const [key, value] of skillsMap) {\r\n const groupId = key\r\n const skills = value\r\n\r\n // Create group data\r\n const groupData = { id: groupId, type: 'system' }\r\n\r\n // Get actions\r\n const actions = await Promise.all(\r\n [...skills].map(async ([skillId, skillData]) => {\r\n const id = skillId\r\n const label = coreModule.api.Utils.i18n(skillData.label) ?? coreModule.api.Utils.i18n(CONFIG.PF2E.skillList[skillId])\r\n const name = this.abbreviatedSkills ? SKILL_ABBREVIATION[skillData.slug] ?? label : label\r\n const fullName = label\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n const listName = `${actionTypeName}${name}`\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const cssClass = (this.actor && this.colorSkills && skillData.rank > 0) ? `tah-pf2e-skill-rank-${skillData.rank}` : ''\r\n const modifier = coreModule.api.Utils.getModifier(skillData.check?.mod)\r\n const info1 = this.actor ? { text: modifier } : ''\r\n const tooltipName = `${fullName}${(this.actor && modifier) ? ` ${modifier}` : ''}`\r\n const tooltipData = {\r\n name: tooltipName,\r\n modifiers: skillData?.modifiers\r\n }\r\n const tooltip = (this.actor) ? await this.#getTooltip(actionType, tooltipData) : null\r\n\r\n return {\r\n id,\r\n name,\r\n fullName,\r\n listName,\r\n encodedValue,\r\n cssClass,\r\n info1,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n }\r\n }\r\n\r\n /**\r\n * Get shared skills between all actors\r\n * @returns {object}\r\n */\r\n #getSharedSkills () {\r\n if (!this.actors) return\r\n const allSkillSets = this.actors.map(actor => Object.entries(actor.skills).filter(skill => !!skill[1].label && skill[1].label.length > 1))\r\n const minSkillSetSize = Math.min(...allSkillSets.map(skillSet => skillSet.length))\r\n const smallestSkillSet = allSkillSets.find(skillSet => skillSet.length === minSkillSetSize)\r\n return smallestSkillSet.filter(smallestSkill => allSkillSets.every(skillSet => skillSet.some(skill => skill[0] === smallestSkill[0])))\r\n }\r\n\r\n /**\r\n * Build spells\r\n * @private\r\n */\r\n async #buildSpells () {\r\n const actionType = 'spell'\r\n\r\n // Create parent group data\r\n const parentGroupData = { id: 'spells', type: 'system' }\r\n\r\n const spellcastingEntries = [...this.items].filter(item => item[1].type === 'spellcastingEntry')\r\n\r\n for (const spellcastingEntry of spellcastingEntries) {\r\n const spellbookGroupId = `spells+${spellcastingEntry[1].name.slugify({ replacement: '-', strict: true })}`\r\n const spellbookGroupName = spellcastingEntry[1].name\r\n const spellbookInfo1 = this.#getSpellDcInfo(spellcastingEntry[1])\r\n\r\n // Create book group data\r\n const bookGroupData = {\r\n id: spellbookGroupId,\r\n name: spellbookGroupName,\r\n type: 'system-derived',\r\n info1: spellbookInfo1\r\n }\r\n\r\n // Add group to action list\r\n await this.addGroup(bookGroupData, parentGroupData)\r\n\r\n // Add spell slot info to group\r\n this.addGroupInfo(bookGroupData)\r\n\r\n const spellInfo = await (spellcastingEntry[1].getSpellData ? spellcastingEntry[1].getSpellData() : spellcastingEntry[1].getSheetData())\r\n const activeLevels = spellInfo.groups.filter(level => level.active.length > 0)\r\n\r\n for (const level of Object.entries(activeLevels)) {\r\n const spellLevel = level[1].id\r\n const levelGroupId = `${spellbookGroupId}+${spellLevel}`\r\n const levelGroupName = String(coreModule.api.Utils.i18n(level[1].label))\r\n\r\n // Create level group data\r\n const levelGroupData = {\r\n id: levelGroupId,\r\n name: levelGroupName,\r\n type: 'system-derived'\r\n }\r\n\r\n // Add group to action list\r\n await this.addGroup(levelGroupData, bookGroupData)\r\n\r\n await this.#addSpellSlotInfo(bookGroupData, levelGroupData, level, spellInfo)\r\n\r\n // Get available spells\r\n const activeSpells = level[1].active\r\n .filter(activeSpell => activeSpell && !activeSpell.expended)\r\n .map(spell => spell.spell)\r\n\r\n const spells = new Map(activeSpells.map(spell => [spell.id, spell]))\r\n\r\n // Get actions\r\n const actions = await Promise.all(\r\n [...spells].map(async ([_, itemData]) => {\r\n const id = this.#getActionId(itemData, actionType, spellLevel)\r\n const name = this.#getActionName(itemData)\r\n const listName = this.#getActionListName(itemData, actionType)\r\n const cssClass = this.#getActionCss(itemData)\r\n const encodedValue = this.#getActionEncodedValue(itemData, actionType, spellLevel)\r\n const icon1 = this.#getIcon1(itemData, actionType)\r\n const img = coreModule.api.Utils.getImage(itemData)\r\n const tooltipData = await this.#getTooltipData(itemData, actionType, spellLevel)\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n\r\n return {\r\n id,\r\n name,\r\n listName,\r\n encodedValue,\r\n cssClass,\r\n img,\r\n icon1,\r\n tooltip\r\n }\r\n })\r\n )\r\n\r\n // Add actions to action list\r\n this.addActions(actions, levelGroupData)\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add spell slot info\r\n * @param {object} bookGroupData The book group data\r\n * @param {object} levelGroupData The level group data\r\n * @param {number} level The level\r\n * @param {object} spellInfo The spell info\r\n */\r\n async #addSpellSlotInfo (\r\n bookGroupData,\r\n levelGroupData,\r\n level,\r\n spellInfo\r\n ) {\r\n const isCantrip = level[1].id === 'cantrips'\r\n const isFlexible = spellInfo.isFlexible\r\n const isFocusPool = spellInfo.isFocusPool\r\n const isInnate = spellInfo.isInnate\r\n const isPrepared = spellInfo.isPrepared\r\n\r\n // Exit if spells are cantrips\r\n if (!isFocusPool && (isCantrip || isInnate)) return\r\n\r\n if (!isFocusPool && (isPrepared && !isFlexible)) return\r\n\r\n const actionType = 'spellSlot'\r\n const focus = this.actor.system.resources.focus\r\n const slots = level[1].uses\r\n const spellSlot = (isFocusPool) ? 'focus' : `slot${level[1].id}`\r\n const maxSlots = (spellSlot === 'focus') ? focus?.max : slots?.max\r\n const availableSlots = (spellSlot === 'focus') ? focus?.value : slots?.value\r\n const info1 = { text: (maxSlots >= 0) ? `${availableSlots ?? 0}/${maxSlots}` : '' }\r\n\r\n levelGroupData.info = { info1 }\r\n\r\n // Add group info to the group\r\n this.addGroupInfo(levelGroupData)\r\n\r\n const actionTypeName = coreModule.api.Utils.i18n(ACTION_TYPE.spell)\r\n\r\n // Get actions\r\n const actions = [\r\n {\r\n id: `${spellInfo.id}>${spellSlot}>slotIncrease`,\r\n name: '+',\r\n listName: `${actionTypeName}: ${bookGroupData.name}: ${levelGroupData.name}: +`,\r\n encodedValue: [actionType, `${spellInfo.id}>${spellSlot}>slotIncrease`].join(this.delimiter),\r\n cssClass: 'shrink'\r\n },\r\n {\r\n id: `${spellInfo.id}>${spellSlot}>slotDecrease`,\r\n name: '-',\r\n listName: `${actionTypeName}: ${bookGroupData.name}: ${levelGroupData.name}: -`,\r\n encodedValue: [actionType, `${spellInfo.id}>${spellSlot}>slotDecrease`].join(this.delimiter),\r\n cssClass: 'shrink'\r\n }\r\n ]\r\n\r\n // Add actions to action list\r\n this.addActions(actions, levelGroupData)\r\n }\r\n\r\n /**\r\n * Build elemental blasts\r\n */\r\n async #buildElementalBlasts () {\r\n const actionType = 'elementalBlast'\r\n\r\n // Get elemental blasts\r\n const blasts = new game.pf2e.ElementalBlast(this.actor)?.configs\r\n\r\n // Exit if no strikes exist\r\n if (!blasts.length) return\r\n\r\n // Create parent group data\r\n const parentGroupData = { id: 'strikes', type: 'system' }\r\n\r\n for (const blast of blasts) {\r\n let damageTypeActions = []\r\n let strikeGroupData = null\r\n const usageData = []\r\n\r\n const strikeId = `${blast.item.id}-${blast.element}`\r\n const strikeGroupId = `strikes+${strikeId}`\r\n const strikeGroupName = (() => {\r\n let groupName = coreModule.api.Utils.i18n(blast.label)\r\n if (this.showStrikeTraits && this.showStrikeNames) {\r\n const blastTraits = blast.item.system.traits.value\r\n if (blastTraits.length > 0) {\r\n groupName += ' - '\r\n for (const trait of blastTraits) {\r\n groupName += '[' + trait + ']'\r\n }\r\n }\r\n }\r\n return groupName\r\n })()\r\n const strikeGroupListName = `${coreModule.api.Utils.i18n(ACTION_TYPE.strike)}: ${strikeGroupName} (${blast.item.id})`\r\n const image = blast.img ?? blast.item?.img\r\n const showTitle = this.showStrikeNames\r\n const tooltipData = await this.#getTooltipData(blast, actionType)\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n\r\n // Create group data\r\n strikeGroupData = { id: strikeGroupId, name: strikeGroupName, listName: strikeGroupListName, type: 'system-derived', settings: { showTitle }, tooltip }\r\n if (this.showStrikeImages) {\r\n strikeGroupData.settings.image = image\r\n }\r\n\r\n // Add group to action list\r\n this.addGroup(strikeGroupData, parentGroupData)\r\n\r\n if (blast.damageTypes.length > 1) {\r\n // Get actions\r\n damageTypeActions = blast.damageTypes.map((damageType, index) => {\r\n const id = encodeURIComponent(`${blast.item.id}>${blast.element}>${damageType.value}>`)\r\n const fullName = damageType.label\r\n return {\r\n id,\r\n name: '',\r\n fullName,\r\n listName: `${strikeGroupListName}: ${fullName}`,\r\n encodedValue: ['elementalBlastDamageType', id].join(this.delimiter),\r\n cssClass: this.#getActionCss(damageType),\r\n icon1: this.#getActionIcon(damageType.icon, fullName)\r\n }\r\n })\r\n }\r\n\r\n const blastUsages = Object.entries(blast.maps) ?? []\r\n\r\n for (const [key, blastUsage] of blastUsages) {\r\n const usage = key\r\n const usageGroupId = `${strikeGroupId}+${key}`\r\n const usageGroupName = (() => {\r\n if (usage !== 'melee' && blast.range.max > 0 && blast.range.label.length > 0) {\r\n return blast.range.label\r\n } else {\r\n return coreModule.api.Utils.i18n(STRIKE_USAGE[key].name)\r\n }\r\n })()\r\n const usageGroupListName = `${strikeGroupListName}: ${usageGroupName}`\r\n const usageGroupImage = (blastUsages.length > 1)\r\n ? (usage === 'melee')\r\n ? STRIKE_ICON.melee\r\n : STRIKE_ICON.thrown\r\n : ''\r\n const usageGroupShowTitle = !((usageGroupImage || blastUsages.length <= 1))\r\n const settings = { showTitle: usageGroupShowTitle, image: usageGroupImage }\r\n\r\n const usageGroupData = {\r\n id: usageGroupId,\r\n name: usageGroupName,\r\n listName: usageGroupListName,\r\n type: 'system-derived',\r\n settings\r\n }\r\n\r\n const rolls = Object.values(blastUsage)\r\n\r\n const actions = rolls.map((roll, index) => {\r\n const id = encodeURIComponent(`${blast.item.id}>${blast.element}>${index}>` + usage)\r\n const isMap = `${roll}`.includes(this.mapLabel)\r\n let modifier\r\n if (isMap) {\r\n modifier = `${roll}`.split(' ')[0]\r\n } else {\r\n modifier = `${roll}`.replace(coreModule.api.Utils.i18n('PF2E.WeaponStrikeLabel'), '').replace(' ', '')\r\n }\r\n const name = (this.calculateAttackPenalty) ? modifier : roll\r\n return {\r\n id,\r\n name,\r\n encodedValue: [actionType, id].join(this.delimiter),\r\n listName: `${usageGroupListName}: ${name}`\r\n }\r\n })\r\n\r\n // Get Damage\r\n const damageId = encodeURIComponent(`${blast.item.id}>${blast.element}>damage>${usage}`)\r\n const damageName = coreModule.api.Utils.i18n('PF2E.DamageLabel')\r\n actions.push({\r\n id: damageId,\r\n name: damageName,\r\n listName: `${usageGroupListName}: ${damageName}`,\r\n encodedValue: [actionType, damageId].join(this.delimiter),\r\n systemSelected: this.addDamageAndCritical\r\n })\r\n\r\n // Get Critical\r\n const criticalId = encodeURIComponent(`${blast.item.id}>${blast.element}>critical>${usage}`)\r\n const criticalName = coreModule.api.Utils.i18n('PF2E.CriticalDamageLabel')\r\n actions.push({\r\n id: criticalId,\r\n name: criticalName,\r\n listName: `${usageGroupListName}: ${criticalName}`,\r\n encodedValue: [actionType, criticalId].join(this.delimiter),\r\n systemSelected: this.addDamageAndCritical\r\n })\r\n\r\n usageData.push({ actions, usageGroupData })\r\n }\r\n\r\n if (this.splitStrikes) {\r\n this.addActions(damageTypeActions, strikeGroupData)\r\n for (const usage of usageData) {\r\n this.addGroup(usage.usageGroupData, strikeGroupData)\r\n this.addActions(usage.actions, usage.usageGroupData)\r\n }\r\n } else {\r\n this.addActions([...(usageData[0]?.actions || []), ...damageTypeActions], strikeGroupData)\r\n usageData.shift()\r\n for (const usage of usageData) {\r\n this.addGroup(usage.usageGroupData, strikeGroupData)\r\n this.addActions(usage.actions, usage.usageGroupData)\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Build strikes\r\n */\r\n async #buildStrikes () {\r\n const actionType = 'strike'\r\n\r\n // Create parent group data\r\n const parentGroupData = { id: 'strikes', type: 'system' }\r\n\r\n // Get strikes\r\n const strikes = this.actor.system.actions\r\n .filter(action => (action.type === actionType && (action.item.system.quantity > 0 || this.actor.type === 'hazard' || this.actor.type === 'npc')))\r\n\r\n // Exit if no strikes exist\r\n if (!strikes) return\r\n\r\n for (const strike of strikes) {\r\n let auxiliaryActions = []\r\n let versatileOptionActions = []\r\n let strikeGroupData = null\r\n const usageData = []\r\n\r\n const strikeId = `${strike.item.id}-${strike.slug}`\r\n const strikeGroupId = `strikes+${strikeId}`\r\n const strikeGroupName = (() => {\r\n let groupName = strike.label\r\n if (this.showStrikeTraits && this.showStrikeNames) {\r\n let strikeTraits\r\n if (this.actor.type === 'character') {\r\n strikeTraits = strike.weaponTraits\r\n } else {\r\n strikeTraits = strike.traits\r\n }\r\n if (strikeTraits.length > 0) {\r\n groupName += ' - '\r\n for (const trait of strikeTraits) {\r\n groupName += '[' + trait.label + ']'\r\n }\r\n }\r\n }\r\n return groupName\r\n })()\r\n const strikeGroupListName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ${strike.label} (${strike.item.id})`\r\n const image = strike.imageUrl ?? strike.item?.img\r\n const showTitle = this.showStrikeNames\r\n const tooltipData = await this.#getTooltipData(strike, actionType)\r\n const tooltip = await this.#getTooltip(actionType, tooltipData)\r\n // Create group data\r\n strikeGroupData = { id: strikeGroupId, name: strikeGroupName, listName: strikeGroupListName, type: 'system-derived', settings: { showTitle }, tooltip }\r\n if (this.showStrikeImages) { strikeGroupData.settings.image = image }\r\n if (typeof strikeGroupData.settings.sort === 'undefined' && coreModule.api.Utils.getSetting('sortActions')) strikeGroupData.settings.sort = false\r\n\r\n // Add group to action list\r\n this.addGroup(strikeGroupData, parentGroupData)\r\n\r\n if (strike.auxiliaryActions?.length && this.addAuxiliaryActions) {\r\n // Get actions\r\n auxiliaryActions = strike.auxiliaryActions.flatMap((auxiliaryAction, index) => {\r\n if (auxiliaryAction.purpose === 'Modular') {\r\n const modularOptions = strike.item.system.traits.toggles.modular.options\r\n const modularSelection = strike.item.system.traits.toggles.modular.selection\r\n return modularOptions.map(modularOption => {\r\n const id = encodeURIComponent(`${strike.item.id}>${strike.slug}>${index}>${modularOption}`)\r\n const name = coreModule.api.Utils.i18n(MODULAR_OPTION[modularOption])\r\n return {\r\n id,\r\n name,\r\n listName: `${strikeGroupListName}: ${name}`,\r\n encodedValue: ['strikeAuxiliaryAction', id].join(this.delimiter),\r\n icon1: this.#getActionIcon(auxiliaryAction.glyph),\r\n cssClass: this.#getActionCss({ selected: (modularOption === modularSelection) })\r\n }\r\n })\r\n } else {\r\n const id = encodeURIComponent(`${strike.item.id}>${strike.slug}>${index}>`)\r\n const name = auxiliaryAction.label\r\n return {\r\n id,\r\n name,\r\n listName: `${strikeGroupListName}: ${name}`,\r\n encodedValue: ['strikeAuxiliaryAction', id].join(this.delimiter),\r\n icon1: this.#getActionIcon(auxiliaryAction.glyph),\r\n info: this.#getItemInfo(auxiliaryAction)\r\n }\r\n }\r\n })\r\n }\r\n if (strike.ready) {\r\n if (strike.versatileOptions?.length) {\r\n // Get actions\r\n versatileOptionActions = strike.versatileOptions.map(versatileOption => {\r\n const encodedId = encodeURIComponent(`${strike.item.id}>${strike.slug}>${versatileOption.value}>`)\r\n const fullName = coreModule.api.Utils.i18n(versatileOption.label)\r\n return {\r\n id: encodedId,\r\n name: '',\r\n fullName,\r\n listName: `${strikeGroupListName}: ${fullName}`,\r\n encodedValue: ['versatileOption', encodedId].join(this.delimiter),\r\n cssClass: this.#getActionCss(versatileOption),\r\n icon1: this.#getActionIcon(versatileOption.glyph, fullName)\r\n }\r\n })\r\n }\r\n\r\n const strikeUsages = (strike.altUsages) ? [strike, ...strike.altUsages] : [strike]\r\n\r\n for (const strikeUsage of strikeUsages) {\r\n const glyph = strike.glyph\r\n const encodedUsage = `${strikeUsage.item.isMelee}_${strikeUsage.item.isThrown}_${strikeUsage.item.isRanged}`\r\n let usage\r\n switch (encodedUsage) {\r\n case 'true_false_false':\r\n usage = 'melee'\r\n break\r\n case 'false_true_true':\r\n usage = 'thrown'\r\n break\r\n case 'false_false_true':\r\n usage = 'ranged'\r\n break\r\n }\r\n const usageGroupId = `${strikeGroupId}+${usage}`\r\n const usageGroupName = (strikeUsage.attackRollType)\r\n ? coreModule.api.Utils.i18n(strikeUsage.attackRollType)\r\n : coreModule.api.Utils.i18n(STRIKE_USAGE[usage].name)\r\n const usageGroupListName = `${strikeGroupListName}: ${usageGroupName}`\r\n const usageGroupIcon = (usage !== 'thrown' && glyph)\r\n ? `${glyph}`\r\n : STRIKE_ICON[usage]\r\n const usageGroupImage = (strikeUsages.length > 1) ? STRIKE_ICON[usage] : ''\r\n const usageGroupShowTitle = !((usageGroupImage || strikeUsages.length <= 1))\r\n const settings = { showTitle: usageGroupShowTitle, image: usageGroupImage }\r\n\r\n const usageGroupData = {\r\n id: usageGroupId,\r\n name: usageGroupName,\r\n listName: usageGroupListName,\r\n icon: usageGroupIcon,\r\n type: 'system-derived',\r\n settings\r\n }\r\n\r\n if (typeof usageGroupData.settings.sort === 'undefined' && coreModule.api.Utils.getSetting('sortActions')) {\r\n usageGroupData.settings.sort = false\r\n }\r\n\r\n const actions = strikeUsage.variants.map((variant, index) => {\r\n const id = encodeURIComponent(`${strike.item.id}>${strike.slug}>${index}>` + usage)\r\n const isMap = variant.label.includes(this.mapLabel)\r\n const modifier = (isMap)\r\n ? variant.label.split(' ')[0]\r\n : variant.label.replace(coreModule.api.Utils.i18n('PF2E.WeaponStrikeLabel'), '').replace(' ', '')\r\n const name = (this.calculateAttackPenalty) ? modifier : variant.label\r\n return {\r\n id,\r\n name,\r\n encodedValue: [actionType, id].join(this.delimiter),\r\n listName: `${usageGroupListName}: ${name}`\r\n }\r\n })\r\n\r\n // Get Damage\r\n const damageId = encodeURIComponent(`${strike.item.id}>${strike.slug}>damage>${usage}`)\r\n const damageName = coreModule.api.Utils.i18n('PF2E.DamageLabel')\r\n actions.push({\r\n id: damageId,\r\n name: damageName,\r\n listName: `${usageGroupListName}: ${damageName}`,\r\n encodedValue: [actionType, damageId].join(this.delimiter),\r\n systemSelected: this.addDamageAndCritical\r\n })\r\n\r\n // Get Critical\r\n const criticalId = encodeURIComponent(`${strike.item.id}>${strike.slug}>critical>${usage}`)\r\n const criticalName = coreModule.api.Utils.i18n('PF2E.CriticalDamageLabel')\r\n actions.push({\r\n id: criticalId,\r\n name: criticalName,\r\n listName: `${usageGroupListName}: ${criticalName}`,\r\n encodedValue: [actionType, criticalId].join(this.delimiter),\r\n systemSelected: this.addDamageAndCritical\r\n })\r\n\r\n // Get Ammo\r\n if (strikeUsage.selectedAmmoId && !strikeUsage.ammunition) {\r\n const item = this.actor.items.get(strikeUsage.selectedAmmoId)\r\n\r\n if (!item) {\r\n const id = 'noAmmo'\r\n const name = coreModule.api.Utils.i18n('tokenActionHud.pf2e.noAmmo')\r\n actions.push({\r\n id,\r\n name,\r\n listName: `${usageGroupListName}: ${name}`,\r\n encodedValue: id\r\n })\r\n } else {\r\n const id = this.#getActionId(item)\r\n const name = this.#getActionName(item)\r\n actions.push({\r\n id,\r\n name,\r\n\r\n listName: `${usageGroupListName}: ${name}`,\r\n encodedValue: [actionType, id].join(this.delimiter)\r\n })\r\n }\r\n }\r\n\r\n usageData.push({ actions, usageGroupData })\r\n }\r\n }\r\n\r\n if (this.splitStrikes) {\r\n this.addActions([...versatileOptionActions, ...auxiliaryActions], strikeGroupData)\r\n for (const usage of usageData) {\r\n this.addGroup(usage.usageGroupData, strikeGroupData)\r\n this.addActions(usage.actions, usage.usageGroupData)\r\n }\r\n } else {\r\n this.addActions([...(usageData[0]?.actions || []), ...versatileOptionActions, ...auxiliaryActions], strikeGroupData)\r\n usageData.shift()\r\n for (const usage of usageData) {\r\n this.addGroup(usage.usageGroupData, strikeGroupData)\r\n this.addActions(usage.actions, usage.usageGroupData)\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Build toggles\r\n */\r\n #buildToggles () {\r\n const actionType = 'toggle'\r\n\r\n // Get toggles\r\n const toggles = Object.values(this.actor.synthetics.toggles).flatMap(domain => Object.values(domain))\r\n\r\n // Exit if no toggles exist\r\n if (!toggles.length) return\r\n\r\n const togglesWithoutSuboptions = toggles.filter(toggle => toggle.suboptions.length === 0)\r\n const togglesWithSuboptions = toggles.filter(toggle => toggle.suboptions.length !== 0)\r\n\r\n // Create group data\r\n const groupData = { id: 'toggles', type: 'system' }\r\n\r\n // Get actions\r\n const actions = togglesWithoutSuboptions.map(toggle => {\r\n const id = encodeURIComponent(`${toggle.domain}>${toggle.option}>${toggle.itemId}>>`)\r\n const name = coreModule.api.Utils.i18n(toggle.label)\r\n const encodedValue = [actionType, id].join(this.delimiter)\r\n const active = (toggle.checked) ? ' active' : ''\r\n const cssClass = `toggle${active}`\r\n\r\n return { id, encodedValue, name, cssClass }\r\n })\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData)\r\n\r\n for (const toggle of togglesWithSuboptions) {\r\n const id = [toggle.domain, toggle.option].join('.')\r\n const subgroupName = coreModule.api.Utils.i18n(toggle.label)\r\n const subgroupListName = `${ACTION_TYPE.toggle}: ${subgroupName}`\r\n const subgroupData = {\r\n id,\r\n name: subgroupName,\r\n listName: subgroupListName,\r\n type: 'system-derived'\r\n }\r\n\r\n this.addGroup(subgroupData, groupData)\r\n\r\n // Get actions\r\n const actions = toggle.suboptions.map(suboption => {\r\n const id = encodeURIComponent(`${toggle.domain}>${toggle.option}>${toggle.itemId}>${suboption.value}`)\r\n const name = coreModule.api.Utils.i18n(suboption.label)\r\n const selected = suboption.selected && toggle.enabled && toggle.checked\r\n\r\n return {\r\n id,\r\n name,\r\n listName: `${subgroupListName}: ${name}`,\r\n encodedValue: ['toggle', id].join(this.delimiter),\r\n cssClass: this.#getActionCss({ selected })\r\n }\r\n })\r\n\r\n // Add actions to action list\r\n this.addActions(actions, subgroupData)\r\n }\r\n }\r\n\r\n #getActionId (entity, actionType, spellLevel) {\r\n return (actionType === 'spell') ? `${entity.id ?? entity._id}-${spellLevel}` : entity.id ?? entity._id\r\n }\r\n\r\n #getActionName (entity) {\r\n return entity?.name ?? entity?.label ?? ''\r\n }\r\n\r\n #getActionListName (entity, actionType) {\r\n const name = this.#getActionName(entity)\r\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\r\n return entity.listName ?? `${actionTypeName}${name}`\r\n }\r\n\r\n #getActionCss (entity) {\r\n if (Object.hasOwn(entity, 'disabled')) {\r\n const active = (!entity.disabled) ? ' active' : ''\r\n return `toggle${active}`\r\n }\r\n if (Object.hasOwn(entity, 'selected')) {\r\n const active = (entity.selected) ? ' active' : ''\r\n return `toggle${active}`\r\n }\r\n }\r\n\r\n #getActionEncodedValue (entity, actionType, spellLevel) {\r\n const spellcastingId = entity?.spellcasting?.id\r\n const encodedId = (actionType === 'spell') ? `${spellcastingId}>${spellLevel}>${entity.id ?? entity._id}` : this.#getActionId(entity, actionType, spellLevel)\r\n return [actionType, encodedId].join(this.delimiter)\r\n }\r\n\r\n #getIcon1 (entity, actionType) {\r\n const actions = entity.system?.actions\r\n const actionTypes = ['free', 'reaction', 'passive']\r\n const actionTypeValue = entity.system?.actionType?.value\r\n const actionsCost = (actions) ? parseInt((actions || {}).value, 10) : null\r\n const timeValue = entity.system?.time?.value\r\n const actionIcon = entity.actionIcon\r\n const iconType = (actionType === 'spell') ? timeValue : (actionTypes.includes(actionTypeValue)) ? actionTypeValue : actionsCost ?? actionIcon\r\n const name = this.#getActionName(entity)\r\n return this.#getActionIcon(iconType, name)\r\n }\r\n\r\n /**\r\n * Get spell DC info\r\n * @private\r\n * @param {object} spellcastingEntry The spellcasting entry\r\n * @returns {string} The spell DC info\r\n */\r\n #getSpellDcInfo (spellcastingEntry) {\r\n const statistic = spellcastingEntry.statistic\r\n const spellDc = typeof statistic.dc === 'function'\r\n ? statistic.dc().value\r\n : statistic.dc.value\r\n const spellAttackModifier = statistic.check.mod\r\n const spellAttackBonus = spellAttackModifier >= 0\r\n ? `${coreModule.api.Utils.i18n('tokenActionHud.pf2e.atk')} +${spellAttackModifier}`\r\n : `${coreModule.api.Utils.i18n('tokenActionHud.pf2e.atk')} ${spellAttackModifier}`\r\n const spellDcInfo = `${coreModule.api.Utils.i18n('tokenActionHud.pf2e.dc')}${spellDc}`\r\n return `${spellAttackBonus} ${spellDcInfo}`\r\n }\r\n\r\n /**\r\n * Get actors\r\n * @private\r\n * @returns {object}\r\n */\r\n #getActors () {\r\n const allowedTypes = ['character', 'npc']\r\n const actors = canvas.tokens.controlled.map(token => token.actor)\r\n if (actors.every(actor => allowedTypes.includes(actor.type))) { return actors }\r\n }\r\n\r\n /**\r\n * Is equipped item\r\n * @private\r\n * @param {object} item\r\n * @returns {boolean}\r\n */\r\n #isEquippedItem (item) {\r\n const carryTypes = ['held', 'worn']\r\n const carryType = item.system.equipped?.carryType\r\n\r\n if (this.addUnequippedItems) return true\r\n if (carryTypes.includes(carryType) && !item.system.containerId?.value?.length) return true\r\n return false\r\n }\r\n\r\n #isAddItem (groupType, item) {\r\n if (item.system.equipped?.carryType !== 'stowed') return true\r\n return this.#isAddStowedItem(groupType, item)\r\n }\r\n\r\n /**\r\n * Is add stowed item\r\n * @private\r\n * @param {string} groupType The group type: container or nonContainer\r\n * @param {object} item The item\r\n * @returns {boolean} Whether the stowed item should be added to the group\r\n */\r\n #isAddStowedItem (groupType, item) {\r\n if (item.system.equipped?.carryType !== 'stowed') return true\r\n if (this.addStowedItems === 'both') return true\r\n if (groupType === 'container' && this.addStowedItems === 'containers') return true\r\n if (groupType === 'nonContainer' && this.addStowedItems === 'nonContainers') return true\r\n return false\r\n }\r\n\r\n /**\r\n * Get item info\r\n * @private\r\n * @param {object} item\r\n * @returns {object}\r\n */\r\n #getItemInfo (item) {\r\n const quantityData = this.#getQuantityData(item) ?? ''\r\n return {\r\n info1: { text: quantityData }\r\n }\r\n }\r\n\r\n /**\r\n * Get quantity\r\n * @private\r\n * @param {object} item\r\n * @returns {string}\r\n */\r\n #getQuantityData (item) {\r\n const quantity = item?.system?.quantity?.value\r\n return (quantity > 1) ? quantity : ''\r\n }\r\n\r\n /**\r\n * Get action icon\r\n * @private\r\n * @param {object} action\r\n * @returns {string}\r\n */\r\n #getActionIcon (action, title = '') {\r\n if (DAMAGE_TYPE_ICONS[action]) {\r\n return ``\r\n }\r\n return ACTION_ICON[action]\r\n }\r\n\r\n /**\r\n * Get carry type icon\r\n * @private\r\n * @param {object} itemData The item data\r\n * @returns {string}\r\n */\r\n #getCarryTypeIcon (itemData) {\r\n let carryType = ''\r\n switch (itemData?.carryType) {\r\n case 'held':\r\n if (itemData?.handsHeld === 2) {\r\n carryType = 'held2'\r\n } else {\r\n carryType = 'held1'\r\n }\r\n break\r\n default:\r\n carryType = itemData?.carryType\r\n break\r\n }\r\n const tooltip = coreModule.api.Utils.i18n(CARRY_TYPE_ICON[carryType]?.tooltip) ?? ''\r\n return CARRY_TYPE_ICON[carryType]?.icon.replace('placeholder', tooltip) ?? ''\r\n }\r\n\r\n /**\r\n * Get tooltip data\r\n * @param {object} entity The entity\r\n * @param {string} actionType The action type\r\n * @returns {Promise} The tooltip data\r\n */\r\n async #getTooltipData (entity, actionType, spellRank = null) {\r\n if (this.tooltipsSetting === 'none' || !entity) return ''\r\n else if (this.tooltipsSetting === 'nameOnly') return entity.name ?? ''\r\n\r\n const itemActionTypes = ['elementalBlast', 'strike']\r\n\r\n let chatData\r\n\r\n if (itemActionTypes.includes(actionType)) {\r\n chatData = await entity.item.getChatData()\r\n } else {\r\n chatData = await entity.getChatData()\r\n }\r\n\r\n if (!chatData) return ''\r\n\r\n // console.log(entity)\r\n // console.log(actionType)\r\n\r\n switch (actionType) {\r\n case 'item':\r\n return {\r\n name: entity.name,\r\n description: chatData.description?.value,\r\n rarity: chatData.rarity,\r\n traits: chatData.traits,\r\n traits2: chatData.properties\r\n }\r\n case 'spell':\r\n {\r\n return {\r\n name: entity.name,\r\n description: chatData.description?.value,\r\n properties: chatData.properties,\r\n rarity: chatData.rarity,\r\n traits: chatData.traits,\r\n traitsAlt: chatData.spellTraits\r\n }\r\n }\r\n case 'strike':\r\n return {\r\n name: entity.label,\r\n descriptionLocalised: this.#getStrikeDescription(entity),\r\n modifiers: entity.modifiers,\r\n properties: chatData.properties?.filter(property => property !== 'PF2E.WeaponTypeMartial'),\r\n traits: entity.traits,\r\n traitsAlt: entity.weaponTraits\r\n }\r\n default:\r\n return {\r\n name: actionType === 'elementalBlast' ? entity.item.name : entity.name,\r\n description: chatData.description?.value,\r\n properties: chatData.properties,\r\n rarity: chatData.rarity,\r\n traits: chatData.traits\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get tooltip\r\n * @private\r\n * @param {string} actionType The action type\r\n * @param {object} tooltipData The tooltip data\r\n * @returns {Promise} The tooltip\r\n */\r\n async #getTooltip (actionType, tooltipData) {\r\n if (this.tooltipsSetting === 'none') return ''\r\n\r\n const name = coreModule.api.Utils.i18n(tooltipData.name)\r\n\r\n if (this.tooltipsSetting === 'nameOnly') return name\r\n\r\n if (typeof tooltipData === 'string') return tooltipData\r\n\r\n const nameHtml = `

${name}

`\r\n\r\n const description = coreModule.api.Utils.i18n(tooltipData?.description ?? tooltipData?.descriptionLocalised ?? '')\r\n\r\n const rarityHtml = tooltipData?.rarity\r\n ? `${coreModule.api.Utils.i18n(tooltipData.rarity.label)}`\r\n : ''\r\n\r\n const propertiesHtml = tooltipData?.properties\r\n ? `
${tooltipData.properties.map(property => `${coreModule.api.Utils.i18n(property)}`).join('')}
`\r\n : ''\r\n\r\n const traitsHtml = tooltipData?.traits\r\n ? tooltipData.traits.map(trait => `${coreModule.api.Utils.i18n(trait.label)}`).join('')\r\n : ''\r\n\r\n const traits2Html = tooltipData?.traits2\r\n ? tooltipData.traits2.map(trait => `${coreModule.api.Utils.i18n(trait.label ?? trait)}`).join('')\r\n : ''\r\n\r\n const traitsAltHtml = tooltipData?.traitsAlt\r\n ? tooltipData.traitsAlt.map(trait => `${coreModule.api.Utils.i18n(trait.label)}`).join('')\r\n : ''\r\n\r\n const modifiersHtml = tooltipData?.modifiers\r\n ? `
${tooltipData.modifiers.filter(modifier => modifier.enabled).map(modifier => {\r\n const label = coreModule.api.Utils.i18n(modifier.label)\r\n const sign = modifier.modifier >= 0 ? '+' : ''\r\n const mod = `${sign}${modifier.modifier ?? ''}`\r\n return `${label} ${mod}`\r\n }).join('')}
`\r\n : ''\r\n\r\n const tagsJoined = [rarityHtml, traitsHtml, traits2Html, traitsAltHtml].join('')\r\n\r\n const tagsHtml = (tagsJoined) ? `
${tagsJoined}
` : ''\r\n\r\n const headerTags = (tagsHtml || modifiersHtml) ? `
${tagsHtml}${modifiersHtml}
` : ''\r\n\r\n if (!description && !tagsHtml && !modifiersHtml) return name\r\n\r\n /* const tooltipHtml = await TextEditor.enrichHTML(\r\n `
${nameHtml}${headerTags}${description}${propertiesHtml}
`,\r\n { async: true }\r\n ) */\r\n\r\n const tooltipHtml = `
${nameHtml}${headerTags}${description}${propertiesHtml}
`\r\n\r\n return await TextEditor.enrichHTML(tooltipHtml, { async: true })\r\n }\r\n\r\n /**\r\n * Get strike description\r\n * @private\r\n * @param {object} strike The strike data\r\n * @returns {string} The strike description\r\n */\r\n #getStrikeDescription (strike) {\r\n const description = (strike?.description) ? `

${coreModule.api.Utils.i18n(strike?.description)}

` : ''\r\n const criticalSuccess = (strike?.criticalSuccess) ? `

${coreModule.api.Utils.i18n('PF2E.Check.Result.Degree.Check.criticalSuccess')}

${coreModule.api.Utils.i18n(strike?.criticalSuccess)}

` : ''\r\n const success = (strike?.success) ? `

${coreModule.api.Utils.i18n('PF2E.Check.Result.Degree.Check.success')}

${coreModule.api.Utils.i18n(strike?.success)}

` : ''\r\n return `${description}${criticalSuccess}${success}`\r\n }\r\n }\r\n})\r\n","export let RollHandler = null\r\n\r\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\r\n RollHandler = class RollHandler extends coreModule.api.RollHandler {\r\n /**\r\n * Execute macro by ID\r\n * @private\r\n * @param {string} id The macro id\r\n */\r\n async #executeMacroById (id) {\r\n game.packs.get('pf2e.pf2e-macros').getDocument(id).then((e) => e.execute())\r\n }\r\n\r\n /**\r\n * Is renderable item\r\n * @private\r\n * @param {string} actionType The action type\r\n * @return {boolean} Whether the action is a renderable item\r\n */\r\n #isRenderableItem (actionType) {\r\n const renderable = [\r\n 'action',\r\n 'ammo',\r\n 'feat',\r\n 'item',\r\n 'lore'\r\n ]\r\n\r\n return this.isRenderItem() && renderable.includes(actionType)\r\n }\r\n\r\n /**\r\n * Get controlled tokens\r\n * @private\r\n * @return {array} The controlled tokens\r\n */\r\n #getControlledTokens () {\r\n const actorTypes = [\r\n 'character',\r\n 'familiar',\r\n 'hazard',\r\n 'npc'\r\n ]\r\n\r\n return canvas.tokens.controlled.filter(token => actorTypes.includes(token.actor?.type))\r\n }\r\n\r\n /**\r\n * Set roll options\r\n * @private\r\n */\r\n #setRollOptions () {\r\n this.rollMode = this.ctrl ? game.user.isGM ? 'gmroll' : 'blindroll' : null\r\n this.showCheckDialogs = this.shift ? game.user.settings.showCheckDialogs : !game.user.settings.showCheckDialogs\r\n }\r\n\r\n /**\r\n * Handle action click\r\n * @override\r\n * @param {object} event The event\r\n * @param {string} encodedPayload The encoded payload\r\n */\r\n async handleActionClick (event, encodedPayload) {\r\n const payload = decodeURIComponent(encodedPayload).split('|', 2)\r\n\r\n if (payload.length < 2) {\r\n super.throwInvalidValueErr()\r\n }\r\n\r\n const [actionType, actionId] = payload\r\n\r\n this.#setRollOptions()\r\n\r\n if (this.#isRenderableItem(actionType)) {\r\n return this.renderItem(this.actor, actionId)\r\n }\r\n\r\n if (this.actor) {\r\n await this.#handleActions(event, actionType, this.actor, this.token, actionId)\r\n } else {\r\n for (const token of this.#getControlledTokens()) {\r\n await this.#handleActions(event, actionType, token.actor, token, actionId)\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Handle action hover\r\n * @override\r\n * @param {object} event The event\r\n * @param {string} encodedPayload The encoded payload\r\n */\r\n async handleActionHover (event, encodedPayload) {\r\n const payload = decodeURIComponent(encodedPayload).split('|', 2)\r\n\r\n if (payload.length < 2) {\r\n return\r\n }\r\n\r\n const [actionType, actionData] = payload\r\n\r\n if (!this.actor) return\r\n\r\n // Currently, only the following action types are handled.\r\n const actionTypes = [\r\n 'action',\r\n 'elementalBlast',\r\n 'familiarAttack',\r\n 'feat',\r\n 'item',\r\n 'spell',\r\n 'strike'\r\n ]\r\n\r\n if (!actionTypes.includes(actionType)) return\r\n\r\n let item\r\n\r\n switch (actionType) {\r\n case 'elementalBlast':\r\n {\r\n // blastId, blastElement, blastValue, blastType\r\n const [blastId, blastElement] = actionData.split('>', 2)\r\n const blast = coreModule.api.Utils.getItem(this.actor, blastId)\r\n item = blast?.rules.find(rule => rule.value?.element === blastElement)\r\n }\r\n break\r\n case 'familiarAttack':\r\n item = this.actor.system.attack\r\n break\r\n case 'spell':\r\n {\r\n // spellcastingEntry, rank, spellId\r\n const [, , spellId] = actionData.split('>', 3)\r\n item = coreModule.api.Utils.getItem(this.actor, spellId)\r\n }\r\n break\r\n case 'strike':\r\n {\r\n // strikeId, strikeName, strikeValue, strikeType\r\n const [strikeId] = actionData.split('>', 1)\r\n if (strikeId === 'xxPF2ExUNARMEDxx') {\r\n item = this.actor.system.actions.find(action => action.item?.id === 'xxPF2ExUNARMEDxx').item\r\n } else {\r\n item = coreModule.api.Utils.getItem(this.actor, strikeId)\r\n }\r\n }\r\n break\r\n default:\r\n {\r\n const [actionId] = actionData.split('>', 1)\r\n item = coreModule.api.Utils.getItem(this.actor, actionId)\r\n }\r\n break\r\n }\r\n\r\n if (!item) return\r\n\r\n if (event.type === 'mouseenter') {\r\n Hooks.call('tokenActionHudSystemActionHoverOn', event, item)\r\n } else {\r\n Hooks.call('tokenActionHudSystemActionHoverOff', event, item)\r\n }\r\n }\r\n\r\n /**\r\n * Handle actions\r\n * @private\r\n * @param {object} event The event\r\n * @param {string} actionType The action type\r\n * @param {object} actor The actor\r\n * @param {object} token The token\r\n * @param {string} actionId The action id\r\n */\r\n async #handleActions (event, actionType, actor, token, actionId) {\r\n switch (actionType) {\r\n case 'action':\r\n this.#rollItemMacro(event, actor, actionId)\r\n break\r\n case 'condition':\r\n this.#adjustCondition(actor, actionId)\r\n break\r\n case 'effect':\r\n this.#adjustEffect(actor, actionId)\r\n break\r\n case 'elementalBlast':\r\n await this.#rollElementalBlast(event, actor, actionId)\r\n break\r\n case 'elementalBlastDamageType':\r\n this.#setElementalBlastDamageType(actor, actionId)\r\n break\r\n case 'familiarAttack':\r\n this.#rollFamiliarAttack(actor)\r\n break\r\n case 'feat':\r\n this.#rollItemMacro(event, actor, actionId)\r\n break\r\n case 'heroAction':\r\n this.#performHeroAction(actor, actionId)\r\n break\r\n case 'heroPoints':\r\n await this.#adjustResources(actor, 'heroPoints', 'value')\r\n break\r\n case 'initiative':\r\n this.#rollInitiative(actor, actionId)\r\n break\r\n case 'item':\r\n this.#rollItemMacro(event, actor, actionId)\r\n break\r\n case 'perceptionCheck':\r\n this.#rollPerception(actor)\r\n break\r\n case 'recoveryCheck':\r\n this.#rollRecovery(event, actor)\r\n break\r\n case 'save':\r\n this.#rollSave(actor, actionId)\r\n break\r\n case 'spell':\r\n await this.#rollSpell(actor, actionId)\r\n break\r\n case 'spellSlot':\r\n await this.#adjustSpellSlot(actor, actionId)\r\n break\r\n case 'skill':\r\n await this.#rollSkill(event, actor, actionId)\r\n break\r\n case 'strike':\r\n this.#rollStrike(event, actor, actionId)\r\n break\r\n case 'strikeAuxiliaryAction':\r\n this.#performStrikeAuxiliaryAction(actor, actionId)\r\n break\r\n case 'toggle':\r\n await this.#performToggleAction(actor, actionId)\r\n break\r\n case 'utility':\r\n this.#performUtilityAction(token, actionId)\r\n break\r\n case 'versatileOption':\r\n this.#performVersatileOption(actor, actionId)\r\n break\r\n }\r\n }\r\n\r\n /**\r\n * Roll item macro\r\n * @private\r\n * @param {string} actionId The action id\r\n */\r\n #rollItemMacro (event, actor, actionId) {\r\n const item = actor?.items?.get(actionId)\r\n if (item) {\r\n if (!item.system.selfEffect && !item.system.frequency) {\r\n item.toMessage(event)\r\n }\r\n else {\r\n game.pf2e.rollItemMacro(actionId)\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adjust condition\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #adjustCondition (actor, actionId) {\r\n this.rightClick ? actor.decreaseCondition(actionId) : actor.increaseCondition(actionId)\r\n }\r\n\r\n /**\r\n * Adjust effect\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #adjustEffect (actor, actionId) {\r\n const effect = coreModule.api.Utils.getItem(actor, actionId)\r\n\r\n if (!effect) return\r\n\r\n this.rightClick ? effect.decrease() : effect.increase()\r\n\r\n Hooks.callAll('forceUpdateTokenActionHud')\r\n }\r\n\r\n /**\r\n * Roll elemental blast\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #rollElementalBlast (event, actor, actionId) {\r\n const [itemId, element, type, usage] = decodeURIComponent(actionId).split('>', 4)\r\n\r\n const blasts = new game.pf2e.ElementalBlast(actor)\r\n const blast = blasts.configs.find(blast => blast.item.id === itemId && blast.element === element)\r\n const damageType = blast.damageTypes.find(damageType => damageType.selected)?.value ?? element\r\n const melee = usage === 'melee'\r\n const outcome = type === 'damage' ? 'success' : 'criticalSuccess'\r\n\r\n switch (type) {\r\n case 'damage':\r\n case 'critical':\r\n await blasts.damage({ element, damageType, melee, outcome, event })\r\n break\r\n default:\r\n await blasts.attack({ mapIncreases: type, element, damageType, melee, event })\r\n break\r\n }\r\n }\r\n\r\n /**\r\n * Set elemental blast damage type\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n #setElementalBlastDamageType (actor, actionId) {\r\n // itemId, element, damageType\r\n const [, element, damageType] = decodeURIComponent(actionId).split('>', 3)\r\n\r\n const blasts = new game.pf2e.ElementalBlast(actor)\r\n blasts.setDamageType({ element, damageType })\r\n }\r\n\r\n /**\r\n * Roll familiar attack\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n #rollFamiliarAttack (actor) {\r\n actor.attackStatistic.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\r\n }\r\n\r\n /**\r\n * Perform hero action\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #performHeroAction (actor, actionId) {\r\n switch (actionId) {\r\n case actionId === 'drawHeroActions':\r\n await game.modules.get('pf2e-hero-actions')?.api?.drawHeroActions(actor)\r\n break\r\n case actionId === 'useHeroAction':\r\n await game.modules.get('pf2e-hero-actions')?.api?.useHeroAction(actor, actionId)\r\n break\r\n }\r\n\r\n Hooks.callAll('forceUpdateTokenActionHud')\r\n }\r\n\r\n /**\r\n * Adjust resources\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} resource The resource\r\n * @param {string} valueName The value name\r\n */\r\n async #adjustResources (actor, resource, valueName) {\r\n let value = actor.system.resources[resource][valueName]\r\n\r\n if (this.rightClick) {\r\n if (value > 0) {\r\n value--\r\n }\r\n } else {\r\n if (value < actor.system.resources[resource].max) {\r\n value++\r\n }\r\n }\r\n\r\n await actor.update({ \"system.resources.heroPoints.value\": value });\r\n\r\n Hooks.callAll('forceUpdateTokenActionHud')\r\n }\r\n\r\n /**\r\n * Roll initiative\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #rollInitiative (actor, actionId) {\r\n if (actor.inCombat && actor.combatant?.initiative) {\r\n coreModule.api.Logger.info(game.i18n.format('PF2E.Encounter.AlreadyRolled', { actor: actor.name }), true)\r\n } else {\r\n await actor.update({ 'system.initiative.statistic': actionId })\r\n\r\n actor.initiative.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\r\n }\r\n }\r\n\r\n /**\r\n * Roll perception\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n #rollPerception (actor) {\r\n actor.perception.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\r\n }\r\n\r\n /**\r\n * Roll recovery\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n */\r\n #rollRecovery (event, actor) {\r\n actor.rollRecovery({ event })\r\n }\r\n\r\n /**\r\n * Roll save\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n #rollSave (actor, actionId) {\r\n actor.saves[actionId].check.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\r\n }\r\n\r\n /**\r\n * Roll skill\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #rollSkill (event, actor, actionId) {\r\n await actor.skills[actionId].check.roll({ event })\r\n }\r\n\r\n /**\r\n * Roll spell\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #rollSpell (actor, actionId) {\r\n const [spellbookId, level, spellId, expend] = decodeURIComponent(actionId).split('>', 4)\r\n\r\n if (this.isRenderItem()) {\r\n return this.doRenderItem(actor, spellId)\r\n }\r\n\r\n const spellbook = actor.items.get(spellbookId)\r\n const spell = actor.items.get(spellId)\r\n\r\n if (!spellbook || !spell) return\r\n\r\n await spellbook.cast(spell, { message: !expend, consume: true, rank: Number(level) })\r\n\r\n Hooks.callAll('forceUpdateTokenActionHud')\r\n }\r\n\r\n /**\r\n * Adjust spell slot\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #adjustSpellSlot (actor, actionId) {\r\n const [spellbookId, slot, effect] = decodeURIComponent(actionId).split('>', 3)\r\n\r\n const spellbook = actor.items.get(spellbookId)\r\n\r\n if (!spellbook && slot !== 'focus') return\r\n\r\n let value, max\r\n\r\n if (slot === 'focus') {\r\n value = actor.system.resources.focus.value\r\n max = actor.system.resources.focus.max\r\n } else {\r\n value = spellbook.system.slots[slot].value\r\n max = spellbook.system.slots[slot].max\r\n }\r\n\r\n switch (effect) {\r\n case 'slotIncrease':\r\n if (value < max) {\r\n value++\r\n }\r\n break\r\n case 'slotDecrease':\r\n if (value > 0) {\r\n value--\r\n }\r\n }\r\n\r\n if (slot === 'focus') {\r\n actor.update({ 'system.resources.focus.value': value })\r\n } else {\r\n await Item.updateDocuments([{ _id: spellbook.id, data: { slots: { [slot]: { value } } } }], { parent: actor })\r\n }\r\n\r\n Hooks.callAll('forceUpdateTokenActionHud')\r\n }\r\n\r\n /**\r\n * Roll strike\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n #rollStrike (event, actor, actionId) {\r\n const [itemId, slug, strikeType, usage] = decodeURIComponent(actionId).split('>', 4)\r\n\r\n let strike = actor.system.actions\r\n .filter(action => action.type === 'strike')\r\n .find(strike => strike.item.id === itemId && strike.slug === slug)\r\n\r\n if (this.isRenderItem() && strike.item?.id !== 'xxPF2ExUNARMEDxx') {\r\n return this.doRenderItem(actor, strike.item.id)\r\n }\r\n\r\n let altUsage\r\n\r\n if (strike.altUsages?.length) {\r\n switch (true) {\r\n case usage === 'melee' && !strike.item.isMelee:\r\n altUsage = usage\r\n strike = strike.altUsages.find(strike => strike.item.isMelee)\r\n break\r\n case usage === 'ranged' && !strike.item.isRanged:\r\n altUsage = usage\r\n strike = strike.altUsages.find(strike => strike.item.isRanged)\r\n break\r\n case usage === 'thrown' && !strike.item.isThrown:\r\n altUsage = usage\r\n strike = strike.altUsages.find(strike => strike.item.isThrown)\r\n break\r\n }\r\n }\r\n\r\n switch (strikeType) {\r\n case 'damage':\r\n strike.damage({ event })\r\n break\r\n case 'critical':\r\n strike.critical({ event })\r\n break\r\n default:\r\n strike.variants[strikeType]?.roll({ event, altUsage })\r\n break\r\n }\r\n }\r\n\r\n /**\r\n * Perform strike auxiliary action\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n #performStrikeAuxiliaryAction (actor, actionId) {\r\n const [itemId, slug, strikeType, selection] = decodeURIComponent(actionId).split('>', 4)\r\n\r\n const strike = actor.system.actions\r\n .filter(action => action.type === 'strike')\r\n .find(strike => strike.item.id === itemId && strike.slug === slug)\r\n\r\n if (!strike) return\r\n\r\n if (strike.origin && this.isRenderItem()) {\r\n this.doRenderItem(actor, strike.origin.id)\r\n } else {\r\n strike.auxiliaryActions[strikeType]?.execute({ selection })\r\n }\r\n }\r\n\r\n /**\r\n * Perform toggle action\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #performToggleAction (actor, actionId) {\r\n const [domain, option, itemId, suboptionValue] = decodeURIComponent(actionId).split('>', 4)\r\n\r\n if (!domain || !option) return\r\n\r\n const toggles = Object.values(this.actor.synthetics.toggles).flatMap(domain => Object.values(domain))\r\n\r\n const toggle = toggles.find(t => t.domain === domain && t.option === option && t.itemId === itemId)\r\n\r\n if (!toggle) return\r\n\r\n const value = !toggle.enabled || !toggle.checked || (suboptionValue && !toggle.suboptions.find(s => s.value === suboptionValue)?.selected)\r\n\r\n await actor.toggleRollOption(domain, option, itemId, value, suboptionValue)\r\n }\r\n\r\n /**\r\n * Perform utility action\r\n * @private\r\n * @param {object} token The token\r\n * @param {string} actionId The action id\r\n */\r\n async #performUtilityAction (token, actionId) {\r\n switch (actionId) {\r\n case 'treatWounds':\r\n this.#executeMacroById('6duZj0Ygiqv712rq')\r\n break\r\n case 'rest':\r\n this.#executeMacroById('0GU2sdy3r2MeC56x')\r\n break\r\n case 'takeBreather':\r\n this.#executeMacroById('aS6F7PSUlS9JM5jr')\r\n break\r\n case 'endTurn':\r\n if (game.combat?.current?.tokenId === token.id) {\r\n await game.combat?.nextTurn()\r\n }\r\n break\r\n }\r\n }\r\n\r\n /**\r\n * Perform versatile option\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async #performVersatileOption (actor, actionId) {\r\n const [itemId, slug, selection] = decodeURIComponent(actionId).split('>', 3)\r\n\r\n const action = actor.system.actions\r\n .filter(action => action.type === 'strike')\r\n .find(strike => strike.item.id === itemId && strike.slug === slug)\r\n const weapon = action?.item\r\n\r\n if (!weapon) return\r\n\r\n await toggleWeaponTrait({ weapon, trait: 'versatile', selection })\r\n\r\n // Adapted from pf2e\r\n async function toggleWeaponTrait ({ weapon, trait, selection }) {\r\n if (!actor?.isOfType('character')) return\r\n\r\n const item = actor.items.get(weapon.id)\r\n\r\n const property = trait === 'double-barrel' ? 'doubleBarrel' : trait\r\n const current = item.system.traits.toggles[property].selected\r\n if (current === selection) return\r\n\r\n if (item?.isOfType('weapon') && item === weapon) {\r\n const value = property === 'doubleBarrel' ? !!selection : selection\r\n await item.update({ [`system.traits.toggles.${property}.selected`]: value })\r\n } else if (item?.isOfType('weapon') && weapon.altUsageType === 'melee') {\r\n item.update({ [`system.meleeUsage.traitToggles.${trait}`]: selection })\r\n } else if (trait === 'versatile' && item?.isOfType('shield')) {\r\n item.update({ 'system.traits.integrated.versatile.selected': selection })\r\n } else if (trait !== 'double-barrel') {\r\n const rule = item?.rules.find(\r\n r => r.key === 'Strike' && !r.ignored && r.slug === weapon.slug\r\n )\r\n await rule?.toggleTrait({ trait, selection })\r\n }\r\n }\r\n }\r\n }\r\n})\r\n","import { MODULE } from './constants.js'\r\n\r\nexport function register (updateFunc) {\r\n game.settings.register(MODULE.ID, 'calculateAttackPenalty', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.calculateAttackPenalty.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.calculateAttackPenalty.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: true,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'colorSkills', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.colorSkills.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.colorSkills.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: true,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'showStrikeImages', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.showStrikeImages.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.showStrikeImages.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: true,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'showStrikeNames', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.showStrikeNames.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.showStrikeNames.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: false,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'showStrikeTraits', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.showStrikeTraits.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.showStrikeTraits.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: false,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'splitStrikes', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.splitStrikes.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.splitStrikes.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: true,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'addAuxiliaryActions', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addAuxiliaryActions.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addAuxiliaryActions.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: true,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'addDamageAndCritical', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addDamageAndCritical.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addDamageAndCritical.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: true,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'addStowedItems', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addStowedItems.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addStowedItems.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: String,\r\n default: 'containers',\r\n choices: {\r\n containers: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.containers'),\r\n nonContainers: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.nonContainers'),\r\n both: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.both'),\r\n none: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.none')\r\n },\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n\r\n game.settings.register(MODULE.ID, 'addUnequippedItems', {\r\n name: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addUnequippedItems.name'\r\n ),\r\n hint: game.i18n.localize(\r\n 'tokenActionHud.pf2e.setting.addUnequippedItems.hint'\r\n ),\r\n scope: 'client',\r\n config: true,\r\n type: Boolean,\r\n default: false,\r\n onChange: (value) => {\r\n updateFunc(value)\r\n }\r\n })\r\n}\r\n","// System Module Imports\r\nimport { ActionHandler } from './action-handler.js'\r\nimport { RollHandler as Core } from './roll-handler.js'\r\nimport { DEFAULTS } from './defaults.js'\r\nimport * as systemSettings from './settings.js'\r\n\r\nexport let SystemManager = null\r\n\r\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\r\n SystemManager = class SystemManager extends coreModule.api.SystemManager {\r\n /** @override */\r\n getActionHandler () {\r\n const actionHandler = new ActionHandler()\r\n return actionHandler\r\n }\r\n\r\n /** @override */\r\n getAvailableRollHandlers () {\r\n const coreTitle = 'Core PF2E'\r\n const choices = { core: coreTitle }\r\n return choices\r\n }\r\n\r\n /** @override */\r\n getRollHandler (rollHandlerId) {\r\n let rollHandler\r\n switch (rollHandlerId) {\r\n case 'core':\r\n default:\r\n rollHandler = new Core()\r\n break\r\n }\r\n return rollHandler\r\n }\r\n\r\n /** @override */\r\n registerSettings (onChangeFunction) {\r\n systemSettings.register(onChangeFunction)\r\n }\r\n\r\n /** @override */\r\n async registerDefaults () {\r\n const defaults = DEFAULTS\r\n if (game.modules.get('pf2e-hero-actions')?.active) {\r\n const listType = coreModule.api.Utils.i18n('tokenActionHud.group')\r\n const name = coreModule.api.Utils.i18n('tokenActionHud.pf2e.heroActions')\r\n defaults.groups.push(\r\n {\r\n id: 'hero-actions',\r\n name,\r\n listName: `${listType}: ${name}`,\r\n type: 'system'\r\n }\r\n )\r\n defaults.groups.sort((a, b) => a.id.localeCompare(b.id))\r\n }\r\n return defaults\r\n }\r\n }\r\n})\r\n","import { SystemManager } from './system-manager.js'\r\nimport { MODULE, REQUIRED_CORE_MODULE_VERSION } from './constants.js'\r\n\r\nHooks.on('tokenActionHudCoreApiReady', async () => {\r\n const module = game.modules.get(MODULE.ID)\r\n module.api = {\r\n requiredCoreModuleVersion: REQUIRED_CORE_MODULE_VERSION,\r\n SystemManager\r\n }\r\n Hooks.call('tokenActionHudSystemReady', module)\r\n})\r\n"],"names":["MODULE","ID","CORE_MODULE","REQUIRED_CORE_MODULE_VERSION","DAMAGE_TYPE_ICONS","axe","brain","bolt","droplet","fire","ghost","hammer","skull","snowflake","spider","sun","vial","ACTION_ICON","free","reaction","passive","A","D","T","F","R","ACTION_TYPE","action","attribute","condition","effect","familiarAttack","feat","heroAction","initiative","item","save","skill","skillAction","spell","strike","strikeAuxiliaryAction","toggle","utility","CARRY_TYPE_ICON","held1","icon","tooltip","held2","dropped","stowed","worn","ITEM_TYPE","armor","groupId","consumable","backpack","equipment","shield","treasure","weapon","MODULAR_OPTION","bludgeoning","piercing","slashing","SKILL_ABBREVIATION","acrobatics","arcana","athletics","crafting","deception","diplomacy","intimidation","medicine","nature","occultism","performance","perception","religion","society","stealth","survival","thievery","STRIKE_ICON","melee","thrown","STRIKE_USAGE","name","ranged","GROUP","attack","id","type","toggles","strikes","actions","reactions","freeActions","passives","skillActionsGrouped","listName","skillActionsUngrouped","settings","sort","weapons","shields","consumables","containers","ancestryFeatures","classFeatures","ancestryFeats","classFeats","skillFeats","generalFeats","bonusFeats","spells","heroPoints","perceptionCheck","coreSkills","loreSkills","conditions","socialConditions","otherConditions","effects","combat","token","recoveryCheck","rests","saves","SKILL_ACTION","l5pbgrj8SSNtRGs8","actionCost","image","ZEWD4zcEDQwYhVT8","LXCy1iJddD95Z91s","xcrdOOiN0l6O1sIn","zn0HadZeoKDALxRu","Tu7LIRelQsiOuo1l","aDsYSdRqiC6qQIOQ","zUJ0UhuoFt5a7tiN","mNphXpAkmGsMadUv","U6WjxFPn4fUqIrfl","RZyfkw1DiqVy3JUC","sDUERv4E88G5BRPr","YWAvvDXpdW1fYPFo","nEwqNNWX6scLt4sc","T2QNEoRojMWEec4a","ooiO59Ch2QaebOmc","lkEcQQss16SIrVxM","RjfPFjqPrNve6eeh","yMTKMnaYSGtDz4wk","rCgGPEyXbzLFcio6","i95kcGLIQKOTsnv6","FlM3HvpnsZpCKawG","v3dlDjFlOmT5T2gC","k5nW4jGyXD0Oq9LR","VTg4t8kYTvXcHROq","QPsV0qi2zXm7syt6","Gj68YCVlDjc75iCP","dWcrojMk0d2WRPBq","BQTA7bL264189Xla","tbveXG4gaIoKnsWX","tikhJ2b6AMh7wQU7","LN67MgbGE8IHb2X0","PmHt7Gb5fCrlWWTr","yNry1xMZqdWHncbV","HSTkVuv0SjTNK3Xx","UKHPveLpG7hUs4D0","zjovbAeuLvyuWFKd","mkKko3CEBCyJVQw1","zkqh01BoXDVgydzo","TIlUkCzviYxdVk4E","Al5LYMMdeDcpC9Br","m4iM5r3TfvQs5Y2n","R03LRl2RBbsm6EcF","gRj7xUfcpUZQLrOC","SKILL","lore","DEFAULTS","Hooks","once","async","coreModule","groups","Object","values","forEach","group","api","Utils","i18n","groupsArray","layout","nestId","customWidth","getSetting","key","defaultValue","value","game","get","Logger","debug","setSetting","set","ActionHandler","actors","actorId","actorType","tokenId","items","groupIds","activationGroupIds","effectGroupIds","inventoryGroupIds","spellGroupIds","featureActions","inventoryActions","spellActions","mapLabel","replace","buildSystemActions","this","actor","getActors","includes","sortItemsByName","abbreviateSkills","addAuxiliaryActions","addDamageAndCritical","addStowedItems","addUnequippedItems","calculateAttackPenalty","colorSkills","showStrikeImages","showStrikeNames","showStrikeTraits","splitStrikes","buildCharacterActions","buildFamiliarActions","buildHazardActions","buildNpcActions","buildMultipleTokenActions","Promise","all","buildActions","buildCombat","buildConditions","buildEffects","buildFeats","buildHeroActions","buildHeroPoints","buildInitiative","buildInventory","buildPerceptionCheck","buildRecoveryCheck","buildRests","buildSaves","buildSkillActions","buildSkills","buildSpells","buildStrikes","buildToggles","buildElementalBlasts","buildAttack","actionType","size","actionTypes","actionItems","Map","filter","_","itemData","system","actionsMap","actionTypeValue","groupData","map","getActionId","getActionName","getActionListName","cssClass","getActionCss","encodedValue","join","delimiter","icon1","getIcon1","img","getImage","info","getItemInfo","tooltipData","getTooltipData","getTooltip","addActions","slug","modifier","getModifier","totalModifier","info1","text","combatTypes","endTurn","current","entries","combatType","limitedConditions","activeConditions","pf2e","ConditionManager","conditionId","startsWith","conditionData","activeCondition","activeConditionId","attributeValue","attributes","max","isValued","description","a","b","localeCompare","actionsTemp","reduce","acc","push","actionsOther","resources","unidentified","user","isGM","_$","featTypes","ancestryfeature","classfeature","ancestry","class","general","bonus","featsMap","category","featType","modules","active","actionTypeName","heroActions","getFlag","remainingHeroPoints","length","format","nb","localize","heroActionActions","uuid","uuidData","fromUuid","content","initiativeStatistic","statistic","fullName","abbreviatedSkills","modifiers","skills","skillData","label","getSharedSkills","skillActions","skillId","data","CONFIG","PF2E","skillList","check","mod","inventoryMap","hasQuantity","quantity","isEquippedItem","isAddItem","itemType","itemCategoryMap","categoryTypeMap","icon2","getCarryTypeIcon","has","parentGroupData","container","contents","addGroup","contentsMap","dyingValue","dying","every","saveData","actionMacros","packs","getIndex","skillActionsMap","actionMacro","_id","actionName","getActionIcon","groupName","skillsMap","rank","allSkillSets","minSkillSetSize","Math","min","skillSet","find","smallestSkill","some","spellcastingEntries","spellcastingEntry","spellbookGroupId","slugify","replacement","strict","bookGroupData","getSpellDcInfo","addGroupInfo","spellInfo","getSpellData","getSheetData","activeLevels","level","spellLevel","levelGroupData","String","addSpellSlotInfo","activeSpells","activeSpell","expended","getActionEncodedValue","isCantrip","isFlexible","isFocusPool","isInnate","isPrepared","focus","slots","uses","spellSlot","maxSlots","blasts","ElementalBlast","configs","blast","damageTypeActions","strikeGroupData","usageData","strikeGroupId","element","strikeGroupName","blastTraits","traits","trait","strikeGroupListName","showTitle","damageTypes","damageType","index","encodeURIComponent","blastUsages","maps","blastUsage","usage","usageGroupId","usageGroupName","range","usageGroupListName","usageGroupImage","usageGroupShowTitle","usageGroupData","roll","split","damageId","damageName","systemSelected","criticalId","criticalName","shift","auxiliaryActions","versatileOptionActions","strikeTraits","weaponTraits","imageUrl","flatMap","auxiliaryAction","purpose","modularOptions","modular","options","modularSelection","selection","modularOption","glyph","selected","ready","versatileOptions","versatileOption","encodedId","strikeUsages","altUsages","strikeUsage","isMelee","isThrown","isRanged","attackRollType","usageGroupIcon","variants","variant","selectedAmmoId","ammunition","synthetics","domain","togglesWithoutSuboptions","suboptions","togglesWithSuboptions","option","itemId","subgroupName","subgroupListName","subgroupData","suboption","enabled","checked","entity","hasOwn","disabled","spellcastingId","spellcasting","actionsCost","parseInt","timeValue","time","actionIcon","iconType","spellDc","dc","spellAttackModifier","allowedTypes","canvas","tokens","controlled","carryType","equipped","containerId","groupType","isAddStowedItem","getQuantityData","title","handsHeld","spellRank","tooltipsSetting","chatData","getChatData","rarity","traits2","properties","traitsAlt","spellTraits","descriptionLocalised","getStrikeDescription","property","nameHtml","rarityHtml","propertiesHtml","traitsHtml","traits2Html","traitsAltHtml","modifiersHtml","tagsJoined","tagsHtml","tooltipHtml","TextEditor","enrichHTML","criticalSuccess","success","RollHandler","register","updateFunc","hint","scope","config","Boolean","default","onChange","choices","nonContainers","both","none","executeMacroById","getDocument","then","e","execute","isRenderableItem","isRenderItem","getControlledTokens","actorTypes","setRollOptions","rollMode","ctrl","showCheckDialogs","handleActionClick","event","encodedPayload","payload","decodeURIComponent","super","throwInvalidValueErr","actionId","renderItem","handleActions","handleActionHover","actionData","blastId","blastElement","getItem","rules","rule","spellId","strikeId","call","rollItemMacro","adjustCondition","adjustEffect","rollElementalBlast","setElementalBlastDamageType","rollFamiliarAttack","performHeroAction","adjustResources","rollInitiative","rollPerception","rollRecovery","rollSave","rollSpell","adjustSpellSlot","rollSkill","rollStrike","performStrikeAuxiliaryAction","performToggleAction","performUtilityAction","performVersatileOption","selfEffect","frequency","toMessage","rightClick","decreaseCondition","increaseCondition","decrease","increase","callAll","outcome","damage","mapIncreases","setDamageType","attackStatistic","skipDialog","drawHeroActions","useHeroAction","resource","valueName","update","inCombat","combatant","spellbookId","expend","doRenderItem","spellbook","cast","message","consume","Number","slot","Item","updateDocuments","parent","strikeType","altUsage","critical","origin","suboptionValue","t","s","toggleRollOption","nextTurn","toggleWeaponTrait","isOfType","altUsageType","r","ignored","toggleTrait","SystemManager","getActionHandler","getAvailableRollHandlers","core","getRollHandler","rollHandlerId","rollHandler","Core","registerSettings","onChangeFunction","systemSettings.register","registerDefaults","defaults","listType","on","module","requiredCoreModuleVersion"],"mappings":"AAGY,MAACA,EAAS,CAClBC,GAAI,yBAMKC,EAAc,CACvBD,GAAI,yBAMKE,EAA+B,MAK/BC,EAAoB,CAC7BC,IAAK,wBACLC,MAAO,0BACPC,KAAM,yBACN,YAAa,8BACbC,QAAS,4BACTC,KAAM,yBACNC,MAAO,0BACPC,OAAQ,2BACRC,MAAO,0BACPC,UAAW,8BACXC,OAAQ,2BACRC,IAAK,wBACLC,KAAM,yBACN,iBAAkB,oCAMTC,EAAc,CACvB,EAAG,+FACH,EAAG,+FACH,EAAG,+FACHC,KAAM,+FACNC,SAAU,+FACVC,QAAS,GACTC,EAAG,+FACHC,EAAG,+FACHC,EAAG,+FACHC,EAAG,+FACHC,EAAG,kGACArB,GAMMsB,EAAc,CACvBC,OAAQ,oBACRC,UAAW,gCACXC,UAAW,uBACXC,OAAQ,oBACRC,eAAgB,mBAChBC,KAAM,4BACNC,WAAY,iCACZC,WAAY,uBACZC,KAAM,iBACNC,KAAM,2BACNC,MAAO,kBACPC,YAAa,kCACbC,MAAO,mBACPC,OAAQ,yBACRC,sBAAuB,yBACvBC,OAAQ,6BACRC,QAAS,0BAMAC,EAAkB,CAC3BC,MAAO,CACHC,KAAM,8LACNC,QAAS,wBAEbC,MAAO,CACHF,KAAM,8LACNC,QAAS,wBAEbE,QAAS,CACLH,KAAM,qEACNC,QAAS,0BAEbG,OAAQ,CACJJ,KAAM,8DACNC,QAAS,yBAEbI,KAAM,CACFL,KAAM,iEACNC,QAAS,wBAOJK,EAAY,CACrBC,MAAO,CAAEC,QAAS,SAClBC,WAAY,CAAED,QAAS,eACvBE,SAAU,CAAEF,QAAS,cACrBG,UAAW,CAAEH,QAAS,aACtBI,OAAQ,CAAEJ,QAAS,WACnBK,SAAU,CAAEL,QAAS,YACrBM,OAAQ,CAAEN,QAAS,YAMVO,EAAiB,CAC1BC,YAAa,wBACbC,SA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js","defaults.js","roll-handler.js","settings.js","system-manager.js","init.js"],"sourcesContent":["/**\n * Module-based constants\n */\nexport const MODULE = {\n ID: 'token-action-hud-pf2e'\n}\n\n/**\n * Core module\n */\nexport const CORE_MODULE = {\n ID: 'token-action-hud-core'\n}\n\n/**\n * Core module version required by the system module\n */\nexport const REQUIRED_CORE_MODULE_VERSION = '2.0'\n\n/**\n * Damage type icons\n */\nexport const DAMAGE_TYPE_ICONS = {\n axe: 'fa-solid fa-axe fa-fw',\n brain: 'fa-solid fa-brain fa-fw',\n bolt: 'fa-solid fa-bolt fa-fw',\n 'bow-arrow': 'fa-solid fa-bow-arrow fa-fw',\n droplet: 'fa-solid fa-droplet fa-fw',\n fire: 'fa-solid fa-fire fa-fw',\n ghost: 'fa-solid fa-ghost fa-fw',\n hammer: 'fa-solid fa-hammer fa-fw',\n skull: 'fa-solid fa-skull fa-fw',\n snowflake: 'fa-solid fa-snowflake fa-fw',\n spider: 'fa-solid fa-spider fa-fw',\n sun: 'fa-solid fa-sun fa-fw',\n vial: 'fa-solid fa-vial fa-fw',\n 'waveform-lines': 'fa-solid fa-waveform-lines fa-fw'\n}\n\n/**\n * Action icons\n */\nexport const ACTION_ICON = {\n 1: 'A',\n 2: 'D',\n 3: 'T',\n free: 'F',\n reaction: 'R',\n passive: '',\n A: 'A',\n D: 'D',\n T: 'T',\n F: 'F',\n R: 'R',\n ...DAMAGE_TYPE_ICONS\n}\n\n/**\n * Action type\n */\nexport const ACTION_TYPE = {\n action: 'TYPES.Item.action',\n attribute: 'tokenActionHud.pf2e.attribute',\n condition: 'TYPES.Item.condition',\n effect: 'TYPES.Item.effect',\n familiarAttack: 'PF2E.AttackLabel',\n feat: 'PF2E.Item.Feat.LevelLabel',\n heroAction: 'tokenActionHud.pf2e.heroAction',\n initiative: 'PF2E.InitiativeLabel',\n item: 'PF2E.ItemTitle',\n save: 'tokenActionHud.pf2e.save',\n skill: 'PF2E.SkillLabel',\n skillAction: 'tokenActionHud.pf2e.skillAction',\n spell: 'TYPES.Item.spell',\n strike: 'PF2E.WeaponStrikeLabel',\n strikeAuxiliaryAction: 'PF2E.WeaponStrikeLabel',\n toggle: 'tokenActionHud.pf2e.toggle',\n utility: 'tokenActionHud.utility'\n}\n\n/**\n * Carry types icons\n */\nexport const CARRY_TYPE_ICON = {\n held1: {\n icon: '',\n tooltip: 'PF2E.CarryType.held1'\n },\n held2: {\n icon: '',\n tooltip: 'PF2E.CarryType.held2'\n },\n dropped: {\n icon: '',\n tooltip: 'PF2E.CarryType.dropped'\n },\n stowed: {\n icon: '',\n tooltip: 'PF2E.CarryType.stowed'\n },\n worn: {\n icon: '',\n tooltip: 'PF2E.CarryType.worn'\n }\n}\n\n/**\n * Item types\n */\nexport const ITEM_TYPE = {\n armor: { groupId: 'armor' },\n consumable: { groupId: 'consumables' },\n backpack: { groupId: 'containers' },\n equipment: { groupId: 'equipment' },\n shield: { groupId: 'shields' },\n treasure: { groupId: 'treasure' },\n weapon: { groupId: 'weapons' }\n}\n\n/**\n * Modular options\n */\nexport const MODULAR_OPTION = {\n bludgeoning: 'PF2E.TraitBludgeoning',\n piercing: 'PF2E.TraitPiercing',\n slashing: 'PF2E.TraitSlashing'\n}\n\n/**\n * Skill abbreviations\n */\nexport const SKILL_ABBREVIATION = {\n acrobatics: 'acr',\n arcana: 'arc',\n athletics: 'ath',\n crafting: 'cra',\n deception: 'dec',\n diplomacy: 'dip',\n intimidation: 'itm',\n medicine: 'med',\n nature: 'nat',\n occultism: 'occ',\n performance: 'prf',\n perception: 'per',\n religion: 'rel',\n society: 'soc',\n stealth: 'ste',\n survival: 'sur',\n thievery: 'thi'\n}\n\n/**\n * Strike icons\n */\nexport const STRIKE_ICON = {\n melee: 'systems/pf2e/icons/mdi/sword.svg',\n thrown: 'systems/pf2e/icons/mdi/thrown.svg'\n}\n\n/**\n * Strike usage\n */\nexport const STRIKE_USAGE = {\n melee: { name: 'PF2E.WeaponRangeMelee' },\n ranged: { name: 'PF2E.NPCAttackRanged' },\n thrown: { name: 'PF2E.TraitThrown' }\n}\n\n/**\n * Groups\n */\nexport const GROUP = {\n attack: { id: 'attack', name: 'PF2E.AttackLabel', type: 'system' },\n toggles: { id: 'toggles', name: 'PF2E.TogglesLabel', type: 'system' },\n strikes: { id: 'strikes', name: 'PF2E.StrikesLabel', type: 'system' },\n actions: { id: 'actions', name: 'PF2E.ActionsActionsHeader', type: 'system' },\n reactions: { id: 'reactions', name: 'PF2E.ActionsReactionsHeader', type: 'system' },\n freeActions: { id: 'free-actions', name: 'PF2E.ActionsFreeActionsHeader', type: 'system' },\n passives: { id: 'passives', name: 'PF2E.NPC.PassivesLabel', type: 'system' },\n skillActionsGrouped: { id: 'skill-actions-grouped', name: 'tokenActionHud.pf2e.skillActions', listName: 'tokenActionHud.pf2e.skillActionsGrouped', type: 'system' },\n skillActionsUngrouped: { id: 'skill-actions-ungrouped', name: 'tokenActionHud.pf2e.skillActions', listName: 'tokenActionHud.pf2e.skillActionsUngrouped', type: 'system', settings: { sort: true } },\n weapons: { id: 'weapons', name: 'tokenActionHud.pf2e.weapons', type: 'system' },\n shields: { id: 'shields', name: 'tokenActionHud.pf2e.shields', type: 'system' },\n armor: { id: 'armor', name: 'tokenActionHud.pf2e.armor', type: 'system' },\n equipment: { id: 'equipment', name: 'tokenActionHud.pf2e.equipment', type: 'system' },\n consumables: { id: 'consumables', name: 'tokenActionHud.pf2e.consumables', type: 'system' },\n containers: { id: 'containers', name: 'tokenActionHud.pf2e.containers', type: 'system' },\n treasure: { id: 'treasure', name: 'tokenActionHud.pf2e.treasure', type: 'system' },\n ancestryFeatures: { id: 'ancestry-features', name: 'PF2E.FeaturesAncestryHeader', type: 'system' },\n classFeatures: { id: 'class-features', name: 'PF2E.FeaturesClassHeader', type: 'system' },\n ancestryFeats: { id: 'ancestry-feats', name: 'PF2E.FeatAncestryHeader', type: 'system' },\n classFeats: { id: 'class-feats', name: 'PF2E.FeatClassHeader', type: 'system' },\n skillFeats: { id: 'skill-feats', name: 'PF2E.FeatSkillHeader', type: 'system' },\n generalFeats: { id: 'general-feats', name: 'PF2E.FeatGeneralHeader', type: 'system' },\n bonusFeats: { id: 'bonus-feats', name: 'PF2E.FeatBonusHeader', type: 'system' },\n spells: { id: 'spells', name: 'PF2E.Item.Spell.Plural', type: 'system' },\n heroPoints: { id: 'hero-points', name: 'PF2E.Actor.Resource.HeroPoints', type: 'system' },\n mythicPoints: { id: 'mythic-points', name: 'PF2E.Actor.Resource.MythicPoints', type: 'system' },\n initiative: { id: 'initiative', name: 'PF2E.InitiativeLabel', type: 'system' },\n perceptionCheck: { id: 'perception-check', name: 'PF2E.PerceptionLabel', type: 'system' },\n coreSkills: { id: 'core-skills', name: 'PF2E.CoreSkillsHeader', type: 'system' },\n loreSkills: { id: 'lore-skills', name: 'PF2E.LoreSkillsHeader', type: 'system' },\n conditions: { id: 'conditions', name: 'PF2E.ConditionsLabel', type: 'system' },\n socialConditions: { id: 'social-conditions', name: 'tokenActionHud.pf2e.socialConditions', type: 'system' },\n otherConditions: { id: 'other-conditions', name: 'tokenActionHud.pf2e.otherConditions', type: 'system' },\n effects: { id: 'effects', name: 'PF2E.EffectsLabel', type: 'system' },\n combat: { id: 'combat', name: 'tokenActionHud.combat', type: 'system' },\n token: { id: 'token', name: 'tokenActionHud.token', type: 'system' },\n recoveryCheck: { id: 'recovery-check', name: 'PF2E.Check.Specific.Recovery', type: 'system' },\n rests: { id: 'rests', name: 'tokenActionHud.pf2e.rests', type: 'system' },\n saves: { id: 'saves', name: 'PF2E.SavesHeader', type: 'system' },\n utility: { id: 'utility', name: 'tokenActionHud.utility', type: 'system' }\n}\n\n/**\n * Skill actions\n */\nexport const SKILL_ACTION = {\n l5pbgrj8SSNtRGs8: { name: 'PF2E.Actions.AdministerFirstAid.Stabilize.Title', actionCost: 2, skill: 'medicine', image: 'systems/pf2e/icons/features/feats/treat-wounds.webp' },\n ZEWD4zcEDQwYhVT8: { name: 'PF2E.Actions.AdministerFirstAid.StopBleeding.Title', actionCost: 2, skill: 'medicine', image: 'systems/pf2e/icons/conditions/persistent-damage.webp' },\n '55mxH0w8UkY1o3Xv': { name: 'PF2E.Actions.Balance.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/skills/movement/feet-winged-boots-brown.webp' },\n LXCy1iJddD95Z91s: { name: 'PF2E.Actions.Climb.Title', skill: 'athletics', actionCost: 1, image: 'icons/sundries/misc/ladder.webp' },\n '9RNumMausgG7adgL': { name: 'PF2E.Actions.Coerce.Title', skill: 'intimidation', actionCost: 'passive', image: 'icons/skills/social/intimidation-impressing.webp' },\n xcrdOOiN0l6O1sIn: { name: 'PF2E.Actions.CommandAnAnimal.Title', skill: 'nature', actionCost: 1, image: 'icons/environment/creatures/horse-white.webp' },\n zn0HadZeoKDALxRu: { name: 'PF2E.Actions.ConcealAnObject.Title', skill: 'stealth', actionCost: 1, image: 'systems/pf2e/icons/equipment/adventuring-gear/wax-key-blank.webp' },\n Tu7LIRelQsiOuo1l: { name: 'PF2E.Actions.Craft.Title', skill: 'crafting', actionCost: 'passive', image: 'icons/skills/trades/smithing-anvil-silver-red.webp' },\n aDsYSdRqiC6qQIOQ: { name: 'PF2E.Actions.CreateADiversion.DistractingWords.Title', skill: 'deception', actionCost: 1, image: 'icons/magic/control/mouth-smile-deception-purple.webp' },\n zUJ0UhuoFt5a7tiN: { name: 'PF2E.Actions.CreateADiversion.Gesture.Title', skill: 'deception', actionCost: 1, image: 'icons/skills/social/wave-halt-stop.webp' },\n '1JpYPlIkjyseE9JU': { name: 'PF2E.Actions.CreateADiversion.Trick.Title', skill: 'deception', actionCost: 1, image: 'systems/pf2e/icons/spells/charming-words.webp' },\n mNphXpAkmGsMadUv: { name: 'PF2E.Actions.CreateForgery.Title', skill: 'society', actionCost: 'passive', image: 'systems/pf2e/icons/spells/transcribe-moment.webp' },\n U6WjxFPn4fUqIrfl: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'arcana', actionCost: 'passive', image: 'icons/skills/trades/academics-book-study-runes.webp' },\n RZyfkw1DiqVy3JUC: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'occultism', actionCost: 'passive', image: 'icons/skills/trades/academics-book-study-purple.webp' },\n sDUERv4E88G5BRPr: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'religion', actionCost: 'passive', image: 'systems/pf2e/icons/equipment/other/spellbooks/thresholds-of-truth.webp' },\n YWAvvDXpdW1fYPFo: { name: 'PF2E.Actions.DecipherWriting.Title', skill: 'society', actionCost: 'passive', image: 'icons/skills/trades/academics-study-reading-book.webp' },\n nEwqNNWX6scLt4sc: { name: 'PF2E.Actions.Demoralize.Title', skill: 'intimidation', actionCost: 1, image: 'icons/skills/social/intimidation-impressing.webp' },\n T2QNEoRojMWEec4a: { name: 'PF2E.Actions.DisableDevice.Title', skill: 'thievery', actionCost: 2, image: 'systems/pf2e/icons/equipment/adventuring-gear/thieves-tools.webp' },\n ooiO59Ch2QaebOmc: { name: 'PF2E.Actions.Disarm.Title', skill: 'athletics', actionCost: 1, image: 'icons/skills/melee/sword-damaged-broken-glow-red.webp' },\n '50Q0DYL33Kalu1BH': { name: 'PF2E.Actions.Escape.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/skills/movement/feet-winged-boots-glowing-yellow.webp' },\n lkEcQQss16SIrVxM: { name: 'PF2E.Actions.Escape.Title', skill: 'athletics', actionCost: 1, image: 'icons/skills/movement/feet-winged-boots-glowing-yellow.webp' },\n RjfPFjqPrNve6eeh: { name: 'PF2E.Actions.Feint.Title', skill: 'deception', actionCost: 1, image: 'icons/skills/melee/maneuver-sword-katana-yellow.webp' },\n yMTKMnaYSGtDz4wk: { name: 'PF2E.Actions.ForceOpen.Title', skill: 'athletics', actionCost: 1, image: 'icons/equipment/feet/boots-armored-steel.webp' },\n rCgGPEyXbzLFcio6: { name: 'PF2E.Actions.GatherInformation.Title', skill: 'diplomacy', actionCost: 'passive', image: 'icons/skills/social/diplomacy-handshake.webp' },\n i95kcGLIQKOTsnv6: { name: 'PF2E.Actions.Grapple.Title', skill: 'athletics', actionCost: 'passive', image: 'icons/skills/melee/unarmed-punch-fist.webp' },\n FlM3HvpnsZpCKawG: { name: 'PF2E.Actions.Hide.Title', skill: 'stealth', actionCost: 1, image: 'systems/pf2e/icons/features/classes/wild.webp' },\n v3dlDjFlOmT5T2gC: { name: 'PF2E.Actions.HighJump.Title', skill: 'athletics', actionCost: 2, image: 'icons/skills/movement/arrows-up-trio-red.webp' },\n k5nW4jGyXD0Oq9LR: { name: 'PF2E.Actions.Impersonate.Title', skill: 'deception', actionCost: 'passive', image: 'icons/equipment/head/mask-carved-scream-tan.webp' },\n VTg4t8kYTvXcHROq: { name: 'PF2E.Actions.Lie.Title', skill: 'deception', actionCost: 'passive', image: 'icons/magic/control/mouth-smile-deception-purple.webp' },\n QPsV0qi2zXm7syt6: { name: 'PF2E.Actions.LongJump.Title', skill: 'athletics', actionCost: 2, image: 'icons/skills/movement/figure-running-gray.webp' },\n '1Sj2Pz3VI2SFWqZw': { name: 'PF2E.Actions.MakeAnImpression.Title', skill: 'diplomacy', actionCost: 'passive', image: 'icons/environment/people/commoner.webp' },\n '9Ul5Op5OceT9P5SS': { name: 'PF2E.Actions.ManeuverInFlight.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/commodities/biological/wing-bird-white.webp' },\n Gj68YCVlDjc75iCP: { name: 'PF2E.Actions.PalmAnObject.Title', skill: 'thievery', actionCost: 1, image: 'icons/sundries/gaming/playing-cards.webp' },\n dWcrojMk0d2WRPBq: { name: 'PF2E.Actions.Perform.Title', skill: 'performance', actionCost: 1, image: 'icons/skills/trades/music-singing-voice-blue.webp' },\n '8YrH37NzKRuiKFbF': { name: 'PF2E.Actions.PickALock.Title', skill: 'thievery', actionCost: 2, image: 'icons/sundries/misc/lock-bronze-reinforced.webp' },\n BQTA7bL264189Xla: { name: 'PF2E.Actions.Repair.Title', skill: 'crafting', actionCost: 'passive', image: 'icons/tools/smithing/anvil.webp' },\n tbveXG4gaIoKnsWX: { name: 'PF2E.Actions.Request.Title', skill: 'diplomacy', actionCost: 1, image: 'icons/skills/social/thumbsup-approval-like.webp' },\n tikhJ2b6AMh7wQU7: { name: 'PF2E.Actions.Seek.Title', skill: 'perception', actionCost: 1, image: 'icons/tools/scribal/magnifying-glass.webp' },\n LN67MgbGE8IHb2X0: { name: 'PF2E.Actions.SenseDirection.Title', skill: 'survival', actionCost: 'passive', image: 'icons/tools/navigation/compass-brass-blue-red.webp' },\n PmHt7Gb5fCrlWWTr: { name: 'PF2E.Actions.SenseMotive.Title', skill: 'perception', actionCost: 1, image: 'icons/environment/people/commoner.webp' },\n yNry1xMZqdWHncbV: { name: 'PF2E.Actions.Shove.Title', skill: 'athletics', actionCost: 1, image: 'systems/pf2e/icons/spells/hydraulic-push.webp' },\n HSTkVuv0SjTNK3Xx: { name: 'PF2E.Actions.Sneak.Title', skill: 'stealth', actionCost: 1, image: 'systems/pf2e/icons/conditions/unnoticed.webp' },\n UKHPveLpG7hUs4D0: { name: 'PF2E.Actions.Squeeze.Title', skill: 'acrobatics', actionCost: 'passive', image: 'icons/commodities/tech/claw-mechanical.webp' },\n zjovbAeuLvyuWFKd: { name: 'PF2E.Actions.Steal.Title', skill: 'thievery', actionCost: 1, image: 'icons/containers/bags/coinpouch-gold-red.webp' },\n mkKko3CEBCyJVQw1: { name: 'PF2E.Actions.Subsist.Title', skill: 'society', actionCost: 'passive', image: 'icons/environment/settlement/building-rubble.webp' },\n zkqh01BoXDVgydzo: { name: 'PF2E.Actions.Subsist.Title', skill: 'survival', actionCost: 'passive', image: 'icons/environment/wilderness/camp-improvised.webp' },\n TIlUkCzviYxdVk4E: { name: 'PF2E.Actions.Swim.Title', skill: 'athletics', actionCost: 1, image: 'icons/creatures/fish/fish-shark-swimming.webp' },\n Al5LYMMdeDcpC9Br: { name: 'PF2E.Actions.Track.Title', skill: 'survival', actionCost: 'passive', image: 'systems/pf2e/icons/conditions/observed.webp' },\n m4iM5r3TfvQs5Y2n: { name: 'PF2E.Actions.TreatDisease.Title', skill: 'medicine', actionCost: 'passive', image: 'icons/magic/nature/root-vine-caduceus-healing.webp' },\n R03LRl2RBbsm6EcF: { name: 'PF2E.Actions.TreatPoison.Title', skill: 'medicine', actionCost: 1, image: 'systems/pf2e/icons/effects/treat-poison.webp' },\n gRj7xUfcpUZQLrOC: { name: 'PF2E.Actions.Trip.Title', skill: 'athletics', actionCost: 1, image: 'icons/skills/wounds/bone-broken-marrow-yellow.webp' },\n '2qhYHkcSsTJoSwrJ': { name: 'PF2E.Actions.TumbleThrough.Title', skill: 'acrobatics', actionCost: 1, image: 'icons/skills/movement/feet-winged-sandals-tan.webp' }\n}\n\n/**\n * Skills\n */\nexport const SKILL = {\n acrobatics: { name: 'PF2E.SkillAcrobatics' },\n arcana: { name: 'PF2E.SkillArcana' },\n athletics: { name: 'PF2E.SkillAthletics' },\n crafting: { name: 'PF2E.SkillCrafting' },\n deception: { name: 'PF2E.SkillDeception' },\n diplomacy: { name: 'PF2E.SkillDiplomacy' },\n intimidation: { name: 'PF2E.SkillIntimidation' },\n lore: { name: 'PF2E.SkillLore' },\n medicine: { name: 'PF2E.SkillMedicine' },\n nature: { name: 'PF2E.SkillNature' },\n occultism: { name: 'PF2E.SkillOccultism' },\n perception: { name: 'PF2E.PerceptionLabel' },\n performance: { name: 'PF2E.SkillPerformance' },\n religion: { name: 'PF2E.SkillReligion' },\n society: { name: 'PF2E.SkillSociety' },\n stealth: { name: 'PF2E.SkillStealth' },\n survival: { name: 'PF2E.SkillSurvival' },\n thievery: { name: 'PF2E.SkillThievery' }\n}\n","import { MODULE } from './constants.js'\n\nexport let Utils = null\n\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\n Utils = class Utils {\n /**\n * Get setting value\n * @param {string} key The key\n * @param {string=null} defaultValue The default value\n * @returns The setting value\n */\n static getSetting (key, defaultValue = null) {\n let value = defaultValue ?? null\n try {\n value = game.settings.get(MODULE.ID, key)\n } catch {\n coreModule.api.Logger.debug(`Setting '${key}' not found`)\n }\n return value\n }\n\n /**\n * Set setting value\n * @param {string} key The key\n * @param {string} value The value\n */\n static async setSetting (key, value) {\n try {\n value = await game.settings.set(MODULE.ID, key, value)\n coreModule.api.Logger.debug(`Setting '${key}' set to '${value}'`)\n } catch {\n coreModule.api.Logger.debug(`Setting '${key}' not found`)\n }\n }\n }\n})\n","// System Module Imports\nimport { ACTION_ICON, ACTION_TYPE, CARRY_TYPE_ICON, ITEM_TYPE, MODULAR_OPTION, SKILL_ABBREVIATION, SKILL, SKILL_ACTION, STRIKE_ICON, STRIKE_USAGE, DAMAGE_TYPE_ICONS } from './constants.js'\nimport { Utils } from './utils.js'\n\nexport let ActionHandler = null\n\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\n ActionHandler = class ActionHandler extends coreModule.api.ActionHandler {\n // Initialize actor and token variables\n actors = null\n actorId = null\n actorType = null\n tokenId = null\n\n // Initialize items variable\n items = null\n\n // Initialize groupIds variables\n groupIds = null\n activationGroupIds = null\n effectGroupIds = null\n inventoryGroupIds = null\n spellGroupIds = null\n\n // Initialize action variables\n featureActions = null\n inventoryActions = null\n spellActions = null\n\n mapLabel = coreModule.api.Utils.i18n('PF2E.MAPAbbreviationLabel').replace(' {penalty}', '')\n\n /**\n * Build System Actions\n * @override\n * @param {array} groupIds\n */\n async buildSystemActions (groupIds) {\n // Set actor and token variables\n this.actors = (!this.actor) ? this.#getActors() : [this.actor]\n this.actorType = this.actor?.type\n\n // Exit if actor is not a known type\n const knownActors = ['character', 'familiar', 'hazard', 'npc']\n if (this.actorType && !knownActors.includes(this.actorType)) return\n\n // Set items variable\n if (this.actor) {\n let items = this.actor.items\n items = coreModule.api.Utils.sortItemsByName(items)\n this.items = items\n }\n\n // Set settings variables\n this.abbreviateSkills = Utils.getSetting('abbreviateSkills')\n this.addAuxiliaryActions = Utils.getSetting('addAuxiliaryActions')\n this.addDamageAndCritical = Utils.getSetting('addDamageAndCritical')\n this.addStowedItems = Utils.getSetting('addStowedItems')\n this.addUnequippedItems = Utils.getSetting('addUnequippedItems')\n this.calculateAttackPenalty = Utils.getSetting('calculateAttackPenalty')\n this.colorSkills = Utils.getSetting('colorSkills')\n this.showStrikeImages = Utils.getSetting('showStrikeImages')\n this.showStrikeNames = Utils.getSetting('showStrikeNames')\n this.showStrikeTraits = Utils.getSetting('showStrikeTraits')\n this.splitStrikes = Utils.getSetting('splitStrikes')\n\n // Set group variables\n this.groupIds = groupIds\n\n if (this.actorType === 'character') {\n await this.#buildCharacterActions()\n } else if (this.actorType === 'familiar') {\n await this.#buildFamiliarActions()\n } else if (this.actorType === 'hazard') {\n await this.#buildHazardActions()\n } else if (this.actorType === 'npc') {\n await this.#buildNpcActions()\n } else if (!this.actor) {\n this.#buildMultipleTokenActions()\n }\n }\n\n /**\n * Build character actions\n * @private\n */\n async #buildCharacterActions () {\n await Promise.all([\n this.#buildActions(),\n this.#buildCombat(),\n this.#buildConditions(),\n this.#buildEffects(),\n this.#buildFeats(),\n this.#buildHeroActions(),\n this.#buildPoints('heroPoints'),\n this.#buildPoints('mythicPoints'),\n this.#buildInitiative(),\n this.#buildInventory(),\n this.#buildPerceptionCheck(),\n this.#buildRecoveryCheck(),\n this.#buildRests(),\n this.#buildSaves(),\n this.#buildSkillActions(),\n this.#buildSkills(),\n this.#buildSpells(),\n this.#buildStrikes(),\n this.#buildToggles()\n ])\n // Build elemental blasts after other character actions so they are grouped together\n await this.#buildElementalBlasts()\n }\n\n /**\n * Build familiar actions\n * @private\n */\n async #buildFamiliarActions () {\n await Promise.all([\n this.#buildActions(),\n this.#buildAttack(),\n this.#buildCombat(),\n this.#buildConditions(),\n this.#buildEffects(),\n this.#buildInventory(),\n this.#buildPerceptionCheck(),\n this.#buildSaves(),\n this.#buildSkills()\n ])\n }\n\n /**\n * Build hazard actions\n * @private\n */\n async #buildHazardActions () {\n await Promise.all([\n this.#buildActions(),\n this.#buildCombat(),\n this.#buildInitiative(),\n this.#buildSaves(),\n this.#buildStrikes()\n ])\n }\n\n /**\n * Build NPC actions\n */\n async #buildNpcActions () {\n await Promise.all([\n this.#buildActions(),\n this.#buildCombat(),\n this.#buildConditions(),\n this.#buildEffects(),\n this.#buildFeats(),\n this.#buildInitiative(),\n this.#buildInventory(),\n this.#buildPerceptionCheck(),\n this.#buildSaves(),\n this.#buildSkillActions(),\n this.#buildSkills(),\n this.#buildStrikes(),\n this.#buildSpells(),\n this.#buildToggles()\n ])\n }\n\n /**\n * Build multiple token actions\n * @private\n * @returns {object}\n */\n async #buildMultipleTokenActions () {\n await Promise.all([\n this.#buildInitiative(),\n this.#buildPerceptionCheck(),\n this.#buildSaves(),\n this.#buildSkillActions(),\n this.#buildSkills()\n ])\n }\n\n /**\n * Build actions\n */\n async #buildActions () {\n const actionType = 'action'\n\n // Exit early if no items exist\n if (this.items.size === 0) return\n\n const actionTypes = ['action', 'reaction', 'free', 'passive']\n\n const actionItems = new Map([...this.items].filter(([_, itemData]) => itemData.type === 'action' || actionTypes.includes(itemData.system?.actionType?.value)))\n\n const actionsMap = new Map()\n\n for (const [key, value] of actionItems) {\n // Set variables\n const actionTypeValue = value.system.actionType?.value\n\n switch (actionTypeValue) {\n case 'action':\n actionsMap.set('actions', actionsMap.get('actions') || new Map())\n actionsMap.get('actions').set(key, value)\n break\n case 'reaction':\n actionsMap.set('reactions', actionsMap.get('reactions') || new Map())\n actionsMap.get('reactions').set(key, value)\n break\n case 'free':\n actionsMap.set('free-actions', actionsMap.get('free-actions') || new Map())\n actionsMap.get('free-actions').set(key, value)\n break\n case 'passive':\n actionsMap.set('passives', actionsMap.get('passives') || new Map())\n actionsMap.get('passives').set(key, value)\n break\n }\n }\n\n // Loop through inventory subcategory ids\n for (const [key, value] of actionsMap) {\n const groupId = key\n const items = value\n\n // Create group data\n const groupData = { id: groupId, type: 'system' }\n\n const actions = await Promise.all(\n [...items].map(async ([_, itemData]) => {\n const id = this.#getActionId(itemData)\n const name = this.#getActionName(itemData)\n const listName = this.#getActionListName(itemData, actionType)\n const cssClass = this.#getActionCss(itemData)\n const encodedValue = [actionType, id].join(this.delimiter)\n const icon1 = this.#getIcon1(itemData, actionType)\n const img = coreModule.api.Utils.getImage(itemData)\n const info = this.#getItemInfo(itemData)\n const tooltipData = await this.#getTooltipData(itemData, actionType)\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n return {\n id,\n name,\n encodedValue,\n cssClass,\n img,\n icon1,\n info,\n listName,\n tooltip\n }\n })\n )\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n }\n\n /**\n * Build attacks\n * @private\n */\n #buildAttack () {\n const actionType = 'familiarAttack'\n\n const attack = this.actor.system.attack\n\n if (attack) {\n const id = attack.slug\n const name = coreModule.api.Utils.i18n('PF2E.AttackLabel')\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, id].join(this.delimiter)\n const modifier = coreModule.api.Utils.getModifier(attack?.totalModifier)\n const info1 = this.actor ? { text: modifier } : ''\n\n // Get actions\n const actions = [{\n id,\n name,\n listName,\n encodedValue,\n info1\n }]\n\n // Create group data\n const groupData = { id: 'attack', type: 'system' }\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n }\n\n /**\n * Build combat\n */\n #buildCombat () {\n const actionType = 'utility'\n\n // Set combat types\n const combatTypes = {\n endTurn: { id: 'endTurn', name: coreModule.api.Utils.i18n('tokenActionHud.endTurn') }\n }\n\n // Delete endTurn for multiple tokens\n if (game.combat?.current?.tokenId !== this.token?.id) delete combatTypes.endTurn\n\n // Get actions\n const actions = Object.entries(combatTypes).map((combatType) => {\n const id = combatType[1].id\n const name = combatType[1].name\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, id].join(this.delimiter)\n return {\n id,\n name,\n listName,\n encodedValue\n }\n })\n\n // Create group data\n const groupData = { id: 'combat', type: 'system' }\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n /**\n * Build conditions\n * @private\n */\n async #buildConditions () {\n const actionType = 'condition'\n const limitedConditions = ['doomed', 'dying', 'wounded']\n\n // Get active conditions\n const activeConditions = new Map(\n [...this.items]\n .filter(item => item[1].type === actionType)\n .map(item => {\n const itemData = item[1]\n return [\n itemData.slug,\n itemData\n ]\n })\n )\n\n // Get conditions\n // Conditions are duplicated in the ConditionManager and the name scaled conditions is suffixed with ' 1'\n const conditions = [...game.pf2e.ConditionManager.conditions]\n .filter(([conditionId]) => !conditionId.startsWith('Compendium'))\n .map(([conditionId, conditionData]) => {\n conditionData.name = conditionData.name.replace(' 1', '')\n return [conditionId, conditionData]\n })\n\n // Build actions\n const actions = await Promise.all(\n conditions.map(async ([conditionId, conditionData]) => {\n const id = conditionData.slug\n const activeCondition = activeConditions.get(conditionId)\n const activeConditionId = activeCondition?.id\n const name = conditionData.name\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, id].join(this.delimiter)\n const img = coreModule.api.Utils.getImage(conditionData)\n const active = activeConditionId ? ' active' : ''\n const cssClass = `toggle${active}`\n let info1 = ''\n let attributeValue = ''\n\n if (activeConditionId) {\n if (limitedConditions.includes(activeCondition.slug)) {\n const attribute = this.actor.system.attributes[activeCondition.slug]\n attributeValue = attribute.value\n const max = attribute.max\n info1 = { text: (max > 0) ? `${attributeValue ?? 0}/${max}` : '' }\n } else if (activeCondition.system.value.isValued) {\n attributeValue = activeCondition.system.value.value\n info1 = { text: attributeValue }\n }\n }\n\n const tooltipName = `${name}${(attributeValue) ? ` ${attributeValue}` : ''}`\n const tooltipData = {\n name: tooltipName,\n description: conditionData.description\n }\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n return {\n id,\n name,\n listName,\n encodedValue,\n cssClass,\n img,\n info1,\n tooltip\n }\n })\n )\n\n actions.sort((a, b) => a.name.localeCompare(b.name))\n\n // Create group data\n const conditionsGroupData = { id: 'conditions', type: 'system' }\n const actionsTemp = []\n\n // Add conditions to the group\n await this.addActions(\n actions.reduce(function (acc, current) {\n const filter = ['Friendly', 'Helpful', 'Hostile', 'Indifferent', 'Malevolence', 'Unfriendly']\n if (!filter.includes(current.name)) {\n acc.push(current)\n } else {\n actionsTemp.push(current)\n }\n return acc\n }, []),\n conditionsGroupData\n )\n\n const socialGroupData = { id: 'social-conditions', type: 'system' }\n const actionsOther = []\n\n // Add social conditions to the group\n await this.addActions(\n actionsTemp.reduce(function (acc, current) {\n const filter = ['Friendly', 'Helpful', 'Hostile', 'Indifferent', 'Unfriendly']\n if (filter.includes(current.name)) {\n acc.push(current)\n } else {\n actionsOther.push(current)\n }\n return acc\n }, []),\n socialGroupData\n )\n\n const otherGroupData = { id: 'other-conditions', type: 'system' }\n\n // Add other conditions to the group\n await this.addActions(actionsOther, otherGroupData)\n }\n\n /**\n * Build hero points\n */\n async #buildPoints (actionType) {\n let actions, groupData\n\n const mythicEnabled = this.actor.system.resources?.mythicPoints.max ? true : false\n\n // Create group data\n if (actionType === 'heroPoints' && !mythicEnabled) {\n groupData = { id: 'hero-points', type: 'system' }\n\n const heroPoints = this.actor.system.resources?.heroPoints\n const value = heroPoints.value\n const max = heroPoints.max\n\n // Get actions\n actions = [{\n id: 'heroPoints',\n name: coreModule.api.Utils.i18n('PF2E.Actor.Resource.HeroPoints'),\n encodedValue: [actionType, actionType].join(this.delimiter),\n info1: { text: (max > 0) ? `${value ?? 0}/${max}` : '' }\n }]\n }\n else if (actionType === 'mythicPoints' && mythicEnabled) {\n groupData = { id: 'mythic-points', type: 'system' }\n\n const mythicPoints = this.actor.system.resources?.mythicPoints\n const value = mythicPoints.value\n const max = mythicPoints.max\n\n // Get actions\n actions = [{\n id: 'mythicPoints',\n name: coreModule.api.Utils.i18n('PF2E.Actor.Resource.MythicPoints'),\n encodedValue: [actionType, actionType].join(this.delimiter),\n info1: { text: (max > 0) ? `${value ?? 0}/${max}` : '' }\n }]\n }\n\n // Add actions to action list\n if (actions && groupData) {\n this.addActions(actions, groupData)\n }\n }\n\n /**\n * Build effects\n * @private\n */\n async #buildEffects () {\n const actionType = 'effect'\n\n // Get effects\n const items = new Map([...this.items]\n .filter(item =>\n item[1].type === 'effect' &&\n ((!(item[1].system?.unidentified ?? false) &&\n !(item[1].unidentified ?? false)) || game.user.isGM)))\n\n // Create group data\n const groupData = { id: 'effects', type: 'system' }\n\n const actions = await Promise.all(\n [...items].map(async ([_$, itemData]) => {\n const id = this.#getActionId(itemData)\n const name = this.#getActionName(itemData)\n const listName = this.#getActionListName(itemData, actionType)\n const cssClass = this.#getActionCss(itemData)\n const encodedValue = [actionType, id].join(this.delimiter)\n const icon1 = this.#getIcon1(itemData, actionType)\n const img = coreModule.api.Utils.getImage(itemData)\n const info = this.#getItemInfo(itemData)\n const tooltipData = {\n name,\n description: itemData.description\n }\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n return {\n id,\n name,\n listName,\n encodedValue,\n cssClass,\n img,\n icon1,\n info,\n tooltip\n }\n })\n )\n\n actions.sort((a, b) => a.name.localeCompare(b.name))\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n /**\n * Build Feats\n * @private\n */\n async #buildFeats () {\n const actionType = 'feat'\n const featTypes = {\n ancestryfeature: 'ancestry-features',\n classfeature: 'class-features',\n ancestry: 'ancestry-feats',\n class: 'class-feats',\n skill: 'skill-feats',\n general: 'general-feats',\n bonus: 'bonus-feats'\n }\n\n // Get feats\n const featsMap = new Map()\n\n for (const [key, value] of this.items) {\n if (value.type !== 'feat') continue\n // 'featType' changed to 'system.category' post pf2e 4.10+\n const featType = value.system?.category ?? value.featType\n const groupId = featTypes[featType]\n\n featsMap.set(groupId, featsMap.get(groupId) || new Map())\n featsMap.get(groupId).set(key, value)\n }\n\n for (const [key, value] of featsMap) {\n const groupId = key\n const items = value\n\n // Get group data\n const groupData = { id: groupId, type: 'system' }\n\n const actions = await Promise.all(\n [...items].map(async ([_, itemData]) => {\n const id = this.#getActionId(itemData)\n const name = this.#getActionName(itemData)\n const listName = this.#getActionListName(itemData, actionType)\n const cssClass = this.#getActionCss(itemData)\n const encodedValue = [actionType, id].join(this.delimiter)\n const icon1 = this.#getIcon1(itemData, actionType)\n const img = coreModule.api.Utils.getImage(itemData)\n const info = this.#getItemInfo(itemData)\n const tooltipData = await this.#getTooltipData(itemData, actionType)\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n return {\n id,\n name,\n encodedValue,\n cssClass,\n img,\n icon1,\n info,\n listName,\n tooltip\n }\n })\n )\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n }\n\n /**\n * Build hero actions\n * @private\n */\n async #buildHeroActions () {\n if (!game.modules.get('pf2e-hero-actions')?.active) return\n\n const actionType = 'heroAction'\n const actionTypeName = coreModule.api.Utils.i18n(ACTION_TYPE[actionType])\n const heroActions = this.actor.getFlag('pf2e-hero-actions', 'heroActions') ?? []\n\n const groupData = { id: 'hero-actions', type: 'system' }\n\n const actions = []\n\n const heroPoints = this.actor.heroPoints?.value\n const remainingHeroPoints = heroPoints - (heroActions?.length ?? 0)\n\n if (remainingHeroPoints > 0) {\n actions.push({\n id: 'drawHeroActions',\n name: game.i18n.format('pf2e-hero-actions.templates.heroActions.draw', { nb: remainingHeroPoints }),\n listName: `${actionTypeName}: ${game.i18n.localize('pf2e-hero-actions.templates.heroActions.draw').replace('({nb}) ', '')}`,\n encodedValue: [actionType, 'drawHeroActions'].join(this.delimiter)\n })\n }\n\n const heroActionActions = await Promise.all(\n [...heroActions].map(async (heroAction) => {\n const id = heroAction?.uuid\n const name = heroAction?.name\n const listName = `${actionTypeName}: ${name}`\n const encodedValue = [actionType, id].join(this.delimiter)\n const img = coreModule.api.Utils.getImage('systems/pf2e/icons/actions/Passive.webp')\n const uuidData = (heroAction?.uuid) ? await fromUuid(heroAction?.uuid) : null\n const tooltipData = {\n name,\n description: uuidData?.text?.content ?? null\n }\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n return {\n id,\n name,\n encodedValue,\n img,\n listName,\n tooltip\n }\n })\n )\n\n actions.push(...heroActionActions)\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n /**\n * Build initiative\n * @private\n */\n async #buildInitiative () {\n const actionType = 'initiative'\n\n const initiativeStatistic = this.actor?.system?.initiative?.statistic ?? null\n\n // Get actions\n const actions = []\n\n if (this.actorType !== 'hazard') {\n const initiative = this.actor ? this.actor.system.initiative : coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\n const fullName = coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\n const name = this.abbreviatedSkills ? SKILL_ABBREVIATION.perception ?? fullName : fullName\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, 'perception'].join(this.delimiter)\n const active = (initiativeStatistic === 'perception') ? ' active' : ''\n const cssClass = `toggle${active}`\n const modifier = coreModule.api.Utils.getModifier(initiative?.totalModifier)\n const info1 = this.actor ? { text: modifier } : ''\n const tooltipName = `${fullName}${(this.actor && modifier) ? ` ${modifier}` : ''}`\n const tooltipData = {\n name: tooltipName,\n modifiers: initiative?.modifiers\n }\n const tooltip = this.actor ? await this.#getTooltip(actionType, tooltipData) : null\n\n // Get actions\n actions.push({\n id: 'initiative-perception',\n name,\n listName,\n encodedValue,\n cssClass,\n info1,\n tooltip\n })\n }\n\n // Get skills\n const skills = (this.actor)\n ? Object.entries(this.actor.skills).filter(([_, skillData]) => !!skillData.label && skillData.label.length > 1)\n : this.#getSharedSkills()\n\n if (!skills) return\n\n const coreSkills = []\n const loreSkills = []\n\n for (const skill of skills) {\n if (!skill[1].lore) {\n coreSkills.push(skill)\n } else {\n loreSkills.push(skill)\n }\n }\n\n coreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\n loreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\n\n const skillActions = await Promise.all(\n [...coreSkills, ...loreSkills].map(async ([skillId, skillData]) => {\n const id = `initiative-${skillId}`\n const data = skillData\n const fullName = coreModule.api.Utils.i18n(data.label) ?? coreModule.api.Utils.i18n(CONFIG.PF2E.skillList[skillId])\n const name = this.abbreviatedSkills ? SKILL_ABBREVIATION[data.slug] ?? fullName : fullName\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, skillId].join(this.delimiter)\n const active = (initiativeStatistic === skillId) ? ' active' : ''\n const cssClass = `toggle${active}`\n const modifier = coreModule.api.Utils.getModifier(skillData.check?.mod)\n const info1 = this.actor ? { text: modifier } : ''\n const tooltipName = `${fullName}${(this.actor && modifier) ? ` ${modifier}` : ''}`\n const tooltipData = {\n name: tooltipName,\n modifiers: skillData?.modifiers\n }\n const tooltip = (this.actor) ? await this.#getTooltip(actionType, tooltipData) : null\n\n return {\n id,\n name,\n listName,\n encodedValue,\n cssClass,\n info1,\n tooltip\n }\n })\n )\n\n actions.push(...skillActions)\n\n // Create group data\n const groupData = { id: 'initiative', type: 'system' }\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n /**\n * Build inventory\n * @private\n */\n async #buildInventory () {\n // Exit if no items exist\n if (this.items.size === 0) return\n\n const actionType = 'item'\n const inventoryMap = new Map()\n\n for (const [key, value] of this.items) {\n const hasQuantity = value.system?.quantity > 0\n const isEquippedItem = this.#isEquippedItem(value)\n const isAddItem = this.#isAddItem('nonContainer', value)\n const type = value.type\n\n if (hasQuantity && isAddItem) {\n const itemType = isEquippedItem ? 'equipped' : 'unequipped'\n const itemCategoryMap = inventoryMap.get(itemType) ?? new Map()\n itemCategoryMap.set(key, value)\n inventoryMap.set(itemType, itemCategoryMap)\n\n if (isEquippedItem) {\n const categoryTypeMap = inventoryMap.get(type) ?? new Map()\n categoryTypeMap.set(key, value)\n inventoryMap.set(type, categoryTypeMap)\n }\n }\n }\n\n // Loop through inventory group ids\n for (const [id, items] of inventoryMap) {\n const groupId = ITEM_TYPE[id]?.groupId\n\n if (!groupId) continue\n\n // Create group data\n const groupData = { id: groupId, type: 'system' }\n\n // Get actions\n const actions = await Promise.all(\n [...items].map(async ([_, itemData]) => {\n const id = this.#getActionId(itemData)\n const name = this.#getActionName(itemData)\n const listName = this.#getActionListName(itemData, actionType)\n const cssClass = this.#getActionCss(itemData)\n const encodedValue = [actionType, id].join(this.delimiter)\n const icon1 = this.#getIcon1(itemData, actionType)\n const icon2 = this.#getCarryTypeIcon(itemData)\n const img = coreModule.api.Utils.getImage(itemData)\n const info = this.#getItemInfo(itemData)\n const tooltipData = await this.#getTooltipData(itemData, actionType)\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n return {\n id,\n name,\n encodedValue,\n cssClass,\n img,\n icon1,\n icon2,\n info,\n listName,\n tooltip\n }\n })\n )\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n // Add container contents\n if (inventoryMap.has('backpack')) {\n // Create parent group data\n const parentGroupData = { id: 'containers', type: 'system' }\n\n const containers = inventoryMap.get('backpack')\n\n for (const [id, container] of containers) {\n const contents = container.contents\n\n // Skip if container has no contents\n if (!contents.size) continue\n\n // Create group data\n const groupData = {\n id,\n name: container.name,\n listName: `Group: ${container.name}`,\n type: 'system-derived'\n }\n\n // Add group to action list\n await this.addGroup(groupData, parentGroupData)\n\n const contentsMap = new Map()\n\n for (const content of contents) {\n const isAddItem = this.#isAddItem('container', content)\n\n if (isAddItem) {\n contentsMap.set(content.id, content)\n }\n }\n\n const actions = await Promise.all(\n [...contentsMap].map(async ([_, itemData]) => {\n const id = this.#getActionId(itemData)\n const name = this.#getActionName(itemData)\n const listName = this.#getActionListName(itemData, actionType)\n const cssClass = this.#getActionCss(itemData)\n const encodedValue = [actionType, id].join(this.delimiter)\n const icon1 = this.#getIcon1(itemData, actionType)\n const icon2 = this.#getCarryTypeIcon(itemData)\n const img = coreModule.api.Utils.getImage(itemData)\n const info = this.#getItemInfo(itemData)\n const tooltipData = await this.#getTooltipData(itemData, actionType)\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n return {\n id,\n name,\n encodedValue,\n cssClass,\n img,\n icon1,\n icon2,\n info,\n listName,\n tooltip\n }\n })\n )\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n }\n }\n\n /**\n * Build perception check\n * @private\n */\n async #buildPerceptionCheck () {\n const actionType = 'perceptionCheck'\n const perception = this.actor ? this.actor.system.perception : coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\n const name = coreModule.api.Utils.i18n('PF2E.PerceptionLabel')\n const modifier = coreModule.api.Utils.getModifier(perception?.totalModifier)\n const info1 = this.actor ? { text: modifier } : ''\n const tooltipName = `${name}${(this.actor && modifier) ? ` ${modifier}` : ''}`\n const tooltipData = {\n name: tooltipName,\n modifiers: perception?.modifiers\n }\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n // Get actions\n const actions = [{\n id: 'perception',\n name,\n encodedValue: [actionType, 'perception'].join(this.delimiter),\n info1,\n tooltip\n }]\n\n // Create group data\n const groupData = { id: 'perception-check', type: 'system' }\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n /**\n * Build recovery check\n */\n #buildRecoveryCheck () {\n const actionType = 'recoveryCheck'\n const dyingValue = this.actor?.system.attributes?.dying\n\n if (dyingValue?.value > 0) {\n // Get actions\n const actions = [{\n id: actionType,\n name: coreModule.api.Utils.i18n('PF2E.Check.Specific.Recovery'),\n encodedValue: [actionType, actionType].join(this.delimiter)\n }]\n\n // Create group data\n const groupData = { id: 'recovery-check', type: 'system' }\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n }\n\n /**\n * Build rests\n */\n #buildRests () {\n // Exit if multiple actors and not every actor is the character type\n if (!this.actor && !this.actors.every(actor => actor.type === 'character')) return\n\n const actionType = 'utility'\n\n // Get actions\n const actions = [\n {\n id: 'treatWounds',\n name: coreModule.api.Utils.i18n('PF2E.Actions.TreatWounds.Label'),\n encodedValue: [actionType, 'treatWounds'].join(this.delimiter)\n },\n {\n id: 'rest',\n name: coreModule.api.Utils.i18n('PF2E.Actor.Character.Rest.Label'),\n encodedValue: [actionType, 'rest'].join(this.delimiter)\n }\n ]\n\n // Take a Breather\n if (game.settings.get('pf2e', 'staminaVariant')) {\n actions.push({\n id: 'takeBreather',\n name: coreModule.api.Utils.i18n('tokenActionHud.pf2e.takeBreather'),\n encodedValue: [actionType, 'takeBreather'].join(this.delimiter)\n })\n }\n\n // Create group data\n const groupData = { id: 'rests', type: 'system' }\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n /**\n * Build saves\n * @private\n */\n async #buildSaves () {\n const actionType = 'save'\n\n // Get saves\n const saves = this.actor ? Object.entries(this.actor.saves || []) : Object.entries(CONFIG.PF2E.saves)\n\n // Exit if no saves exist\n if (!saves || saves.length === 0) return\n\n // Get actions\n const actions = await Promise.all(\n saves.map(async ([id, saveData]) => {\n const name = saveData.label ?? (typeof saveData === 'string' ? coreModule.api.Utils.i18n(saveData) : '')\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, id].join(this.delimiter)\n const modifier = coreModule.api.Utils.getModifier(saveData.mod)\n const info1 = this.actor ? { text: modifier } : ''\n const tooltipName = `${name}${(this.actor && modifier) ? ` ${modifier}` : ''}`\n const tooltipData = {\n name: tooltipName,\n modifiers: saveData?.modifiers\n }\n const tooltip = this.actor ? await this.#getTooltip(actionType, tooltipData) : null\n\n return {\n id,\n name,\n listName,\n encodedValue,\n info1,\n tooltip\n }\n })\n )\n\n // Get group data\n const groupData = { id: 'saves', type: 'system' }\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n\n /**\n * Build skill actions\n * @private\n */\n async #buildSkillActions () {\n const actionType = 'compendiumMacro'\n\n // Get skill actions\n const actionMacros = await game.packs.get('pf2e.action-macros').getIndex()\n\n if (!actionMacros.size) return\n\n const skillActionsMap = new Map()\n\n // Get actions\n const actions = []\n for (const actionMacro of actionMacros) {\n const skillAction = SKILL_ACTION[actionMacro._id]\n\n if (!skillAction) continue\n\n const id = actionMacro._id\n const actionName = coreModule.api.Utils.i18n(skillAction.name)\n const skillName = coreModule.api.Utils.i18n(SKILL[skillAction.skill]?.name)\n const name = `${actionName} - ${skillName}`\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE.skillAction)}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, 'pf2e.action-macros', id].join(this.delimiter)\n const icon1 = this.#getActionIcon(skillAction.actionCost)\n const img = skillAction.image\n const modifier = coreModule.api.Utils.getModifier(this.actor?.skills[skillAction.skill]?.check?.mod)\n const info1 = this.actor ? { text: modifier } : null\n\n const action = {\n id,\n name,\n listName,\n encodedValue,\n icon1,\n img,\n info1\n }\n\n actions.push(action)\n\n skillActionsMap.set(skillAction.skill, skillActionsMap.get(skillAction.skill) || new Map())\n skillActionsMap.get(skillAction.skill).set(actionMacro._id, { ...action, name: actionName })\n }\n\n // Add actions to HUD\n await this.addActions(actions, { id: 'skill-actions-ungrouped', type: 'system' })\n\n for (const [key, value] of Object.entries(SKILL)) {\n const groupId = key\n const groupName = coreModule.api.Utils.i18n(value.name)\n const skillActions = skillActionsMap.get(groupId)\n\n if (!skillActions) continue\n\n // Create group data\n const groupData = { id: groupId, name: groupName, type: 'system-derived' }\n\n // Add group to HUD\n await this.addGroup(groupData, { id: 'skill-actions-grouped', type: 'system' })\n\n // Get actions\n const actions = [...skillActions].map(([_, skillAction]) => {\n return skillAction\n })\n\n // Add actions to HUD\n await this.addActions(actions, groupData)\n }\n }\n\n /**\n * Build skills\n * @private\n */\n async #buildSkills () {\n const actionType = 'skill'\n\n // Get skills\n const skills = (this.actor)\n ? Object.entries(this.actor.skills).filter(skill => !!skill[1].label && skill[1].label.length > 1)\n : this.#getSharedSkills()\n\n if (!skills) return\n\n const coreSkills = []\n const loreSkills = []\n\n for (const skill of skills) {\n if (!skill[1].lore) {\n coreSkills.push(skill)\n } else {\n loreSkills.push(skill)\n }\n }\n\n coreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\n loreSkills.sort((a, b) => a[1].label.localeCompare(b[1].label))\n\n const skillsMap = new Map()\n\n skillsMap.set('skills', new Map())\n\n if (coreSkills.length > 0) {\n skillsMap.set('core-skills', new Map())\n }\n if (loreSkills.length > 0) {\n skillsMap.set('lore-skills', new Map())\n }\n\n for (const skill of [...coreSkills, ...loreSkills]) {\n if (!skill[1].lore) {\n skillsMap.get('core-skills').set(skill[0], skill[1])\n } else {\n skillsMap.get('lore-skills').set(skill[0], skill[1])\n }\n }\n\n // Loop through inventory subcateogry ids\n for (const [key, value] of skillsMap) {\n const groupId = key\n const skills = value\n\n // Create group data\n const groupData = { id: groupId, type: 'system' }\n\n // Get actions\n const actions = await Promise.all(\n [...skills].map(async ([skillId, skillData]) => {\n const id = skillId\n const label = coreModule.api.Utils.i18n(skillData.label) ?? coreModule.api.Utils.i18n(CONFIG.PF2E.skillList[skillId])\n const name = this.abbreviatedSkills ? SKILL_ABBREVIATION[skillData.slug] ?? label : label\n const fullName = label\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n const listName = `${actionTypeName}${name}`\n const encodedValue = [actionType, id].join(this.delimiter)\n const cssClass = (this.actor && this.colorSkills && skillData.rank > 0) ? `tah-pf2e-skill-rank-${skillData.rank}` : ''\n const modifier = coreModule.api.Utils.getModifier(skillData.check?.mod)\n const info1 = this.actor ? { text: modifier } : ''\n const tooltipName = `${fullName}${(this.actor && modifier) ? ` ${modifier}` : ''}`\n const tooltipData = {\n name: tooltipName,\n modifiers: skillData?.modifiers\n }\n const tooltip = (this.actor) ? await this.#getTooltip(actionType, tooltipData) : null\n\n return {\n id,\n name,\n fullName,\n listName,\n encodedValue,\n cssClass,\n info1,\n tooltip\n }\n })\n )\n\n // Add actions to action list\n this.addActions(actions, groupData)\n }\n }\n\n /**\n * Get shared skills between all actors\n * @returns {object}\n */\n #getSharedSkills () {\n if (!this.actors) return\n const allSkillSets = this.actors.map(actor => Object.entries(actor.skills).filter(skill => !!skill[1].label && skill[1].label.length > 1))\n const minSkillSetSize = Math.min(...allSkillSets.map(skillSet => skillSet.length))\n const smallestSkillSet = allSkillSets.find(skillSet => skillSet.length === minSkillSetSize)\n return smallestSkillSet.filter(smallestSkill => allSkillSets.every(skillSet => skillSet.some(skill => skill[0] === smallestSkill[0])))\n }\n\n /**\n * Build spells\n * @private\n */\n async #buildSpells () {\n const actionType = 'spell'\n\n // Create parent group data\n const parentGroupData = { id: 'spells', type: 'system' }\n\n const spellcastingEntries = [...this.items].filter(item => item[1].type === 'spellcastingEntry')\n\n for (const spellcastingEntry of spellcastingEntries) {\n const spellbookGroupId = `spells+${spellcastingEntry[1].name.slugify({ replacement: '-', strict: true })}`\n const spellbookGroupName = spellcastingEntry[1].name\n const spellbookInfo1 = this.#getSpellDcInfo(spellcastingEntry[1])\n\n // Create book group data\n const bookGroupData = {\n id: spellbookGroupId,\n name: spellbookGroupName,\n type: 'system-derived',\n info1: spellbookInfo1\n }\n\n // Add group to action list\n await this.addGroup(bookGroupData, parentGroupData)\n\n // Add spell slot info to group\n this.addGroupInfo(bookGroupData)\n\n const spellInfo = await (spellcastingEntry[1].getSpellData ? spellcastingEntry[1].getSpellData() : spellcastingEntry[1].getSheetData())\n const activeLevels = spellInfo.groups.filter(level => level.active.length > 0)\n\n for (const level of Object.entries(activeLevels)) {\n const spellLevel = level[1].id\n const levelGroupId = `${spellbookGroupId}+${spellLevel}`\n const levelGroupName = String(coreModule.api.Utils.i18n(level[1].label))\n\n // Create level group data\n const levelGroupData = {\n id: levelGroupId,\n name: levelGroupName,\n type: 'system-derived'\n }\n\n // Add group to action list\n await this.addGroup(levelGroupData, bookGroupData)\n\n await this.#addSpellSlotInfo(bookGroupData, levelGroupData, level, spellInfo)\n\n // Get available spells\n const activeSpells = level[1].active\n .filter(activeSpell => activeSpell && !activeSpell.expended)\n .map(spell => spell.spell)\n\n const spells = new Map(activeSpells.map(spell => [spell.id, spell]))\n\n // Get actions\n const actions = await Promise.all(\n [...spells].map(async ([_, itemData]) => {\n const id = this.#getActionId(itemData, actionType, spellLevel)\n const name = this.#getActionName(itemData)\n const listName = this.#getActionListName(itemData, actionType)\n const cssClass = this.#getActionCss(itemData)\n const encodedValue = this.#getActionEncodedValue(itemData, actionType, spellLevel)\n const icon1 = this.#getIcon1(itemData, actionType)\n const img = coreModule.api.Utils.getImage(itemData)\n const tooltipData = await this.#getTooltipData(itemData, actionType, spellLevel)\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n return {\n id,\n name,\n listName,\n encodedValue,\n cssClass,\n img,\n icon1,\n tooltip\n }\n })\n )\n\n // Add actions to action list\n this.addActions(actions, levelGroupData)\n }\n }\n }\n\n /**\n * Add spell slot info\n * @param {object} bookGroupData The book group data\n * @param {object} levelGroupData The level group data\n * @param {number} level The level\n * @param {object} spellInfo The spell info\n */\n async #addSpellSlotInfo (\n bookGroupData,\n levelGroupData,\n level,\n spellInfo\n ) {\n const isCantrip = level[1].id === 'cantrips'\n const isFlexible = spellInfo.isFlexible\n const isFocusPool = spellInfo.isFocusPool\n const isInnate = spellInfo.isInnate\n const isPrepared = spellInfo.isPrepared\n\n // Exit if spells are cantrips\n if (!isFocusPool && (isCantrip || isInnate)) return\n\n if (!isFocusPool && (isPrepared && !isFlexible)) return\n\n const actionType = 'spellSlot'\n const focus = this.actor.system.resources.focus\n const slots = level[1].uses\n const spellSlot = (isFocusPool) ? 'focus' : `slot${level[1].id}`\n const maxSlots = (spellSlot === 'focus') ? focus?.max : slots?.max\n const availableSlots = (spellSlot === 'focus') ? focus?.value : slots?.value\n const info1 = { text: (maxSlots >= 0) ? `${availableSlots ?? 0}/${maxSlots}` : '' }\n\n levelGroupData.info = { info1 }\n\n // Add group info to the group\n this.addGroupInfo(levelGroupData)\n\n const actionTypeName = coreModule.api.Utils.i18n(ACTION_TYPE.spell)\n\n // Get actions\n const actions = [\n {\n id: `${spellInfo.id}>${spellSlot}>slotIncrease`,\n name: '+',\n listName: `${actionTypeName}: ${bookGroupData.name}: ${levelGroupData.name}: +`,\n encodedValue: [actionType, `${spellInfo.id}>${spellSlot}>slotIncrease`].join(this.delimiter),\n cssClass: 'shrink'\n },\n {\n id: `${spellInfo.id}>${spellSlot}>slotDecrease`,\n name: '-',\n listName: `${actionTypeName}: ${bookGroupData.name}: ${levelGroupData.name}: -`,\n encodedValue: [actionType, `${spellInfo.id}>${spellSlot}>slotDecrease`].join(this.delimiter),\n cssClass: 'shrink'\n }\n ]\n\n // Add actions to action list\n this.addActions(actions, levelGroupData)\n }\n\n /**\n * Build elemental blasts\n */\n async #buildElementalBlasts () {\n const actionType = 'elementalBlast'\n\n // Get elemental blasts\n const blasts = new game.pf2e.ElementalBlast(this.actor)?.configs\n\n // Exit if no strikes exist\n if (!blasts.length) return\n\n // Create parent group data\n const parentGroupData = { id: 'strikes', type: 'system' }\n\n for (const blast of blasts) {\n let damageTypeActions = []\n let strikeGroupData = null\n const usageData = []\n\n const strikeId = `${blast.item.id}-${blast.element}`\n const strikeGroupId = `strikes+${strikeId}`\n const strikeGroupName = (() => {\n let groupName = coreModule.api.Utils.i18n(blast.label)\n if (this.showStrikeTraits && this.showStrikeNames) {\n const blastTraits = blast.item.system.traits.value\n if (blastTraits.length > 0) {\n groupName += ' - '\n for (const trait of blastTraits) {\n groupName += '[' + trait + ']'\n }\n }\n }\n return groupName\n })()\n const strikeGroupListName = `${coreModule.api.Utils.i18n(ACTION_TYPE.strike)}: ${strikeGroupName} (${blast.item.id})`\n const image = blast.img ?? blast.item?.img\n const showTitle = this.showStrikeNames\n const tooltipData = await this.#getTooltipData(blast, actionType)\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n // Create group data\n strikeGroupData = {\n id: strikeGroupId,\n name: strikeGroupName,\n listName: strikeGroupListName,\n type: 'system-derived',\n settings: { showTitle },\n tooltip\n }\n \n if (this.showStrikeImages) {\n strikeGroupData.settings.image = image\n }\n\n // Add group to action list\n this.addGroup(strikeGroupData, parentGroupData)\n\n if (blast.damageTypes.length > 1) {\n // Get actions\n damageTypeActions = blast.damageTypes.map((damageType, index) => {\n const id = encodeURIComponent(`${blast.item.id}>${blast.element}>${damageType.value}>`)\n const fullName = damageType.label\n return {\n id,\n name: '',\n fullName,\n listName: `${strikeGroupListName}: ${fullName}`,\n encodedValue: ['elementalBlastDamageType', id].join(this.delimiter),\n cssClass: this.#getActionCss(damageType),\n icon1: this.#getActionIcon(damageType.icon, fullName)\n }\n })\n }\n\n const blastUsages = Object.entries(blast.maps) ?? []\n\n for (const [key, blastUsage] of blastUsages) {\n const usage = key\n const usageGroupId = `${strikeGroupId}+${key}`\n const usageGroupName = (() => {\n if (usage !== 'melee' && blast.range.max > 0 && blast.range.label.length > 0) {\n return blast.range.label\n } else {\n return coreModule.api.Utils.i18n(STRIKE_USAGE[key].name)\n }\n })()\n const usageGroupListName = `${strikeGroupListName}: ${usageGroupName}`\n const usageGroupImage = (blastUsages.length > 1)\n ? (usage === 'melee')\n ? STRIKE_ICON.melee\n : STRIKE_ICON.thrown\n : ''\n const usageGroupShowTitle = !((usageGroupImage || blastUsages.length <= 1))\n const settings = { showTitle: usageGroupShowTitle, image: usageGroupImage }\n\n const usageGroupData = {\n id: usageGroupId,\n name: usageGroupName,\n listName: usageGroupListName,\n type: 'system-derived',\n settings\n }\n\n const rolls = Object.values(blastUsage)\n\n const actions = rolls.map((roll, index) => {\n const id = encodeURIComponent(`${blast.item.id}>${blast.element}>${index}>` + usage)\n const isMap = `${roll}`.includes(this.mapLabel)\n let modifier\n if (isMap) {\n modifier = `${roll}`.split(' ')[0]\n } else {\n modifier = `${roll}`.replace(coreModule.api.Utils.i18n('PF2E.WeaponStrikeLabel'), '').replace(' ', '')\n }\n const name = (this.calculateAttackPenalty) ? modifier : roll\n return {\n id,\n name,\n encodedValue: [actionType, id].join(this.delimiter),\n listName: `${usageGroupListName}: ${name}`\n }\n })\n\n // Get Damage\n const damageId = encodeURIComponent(`${blast.item.id}>${blast.element}>damage>${usage}`)\n const damageName = coreModule.api.Utils.i18n('PF2E.DamageLabel')\n actions.push({\n id: damageId,\n name: damageName,\n listName: `${usageGroupListName}: ${damageName}`,\n encodedValue: [actionType, damageId].join(this.delimiter),\n systemSelected: this.addDamageAndCritical\n })\n\n // Get Critical\n const criticalId = encodeURIComponent(`${blast.item.id}>${blast.element}>critical>${usage}`)\n const criticalName = coreModule.api.Utils.i18n('PF2E.CriticalDamageLabel')\n actions.push({\n id: criticalId,\n name: criticalName,\n listName: `${usageGroupListName}: ${criticalName}`,\n encodedValue: [actionType, criticalId].join(this.delimiter),\n systemSelected: this.addDamageAndCritical\n })\n\n usageData.push({ actions, usageGroupData })\n }\n\n if (this.splitStrikes) {\n this.addActions(damageTypeActions, strikeGroupData)\n for (const usage of usageData) {\n this.addGroup(usage.usageGroupData, strikeGroupData)\n this.addActions(usage.actions, usage.usageGroupData)\n }\n } else {\n this.addActions([...(usageData[0]?.actions || []), ...damageTypeActions], strikeGroupData)\n usageData.shift()\n for (const usage of usageData) {\n this.addGroup(usage.usageGroupData, strikeGroupData)\n this.addActions(usage.actions, usage.usageGroupData)\n }\n }\n }\n }\n\n /**\n * Build strikes\n */\n async #buildStrikes () {\n const actionType = 'strike'\n\n // Create parent group data\n const parentGroupData = { id: 'strikes', type: 'system' }\n\n // Get strikes\n const strikes = this.actor.system.actions\n .filter(action => (action.type === actionType && (action.item.system.quantity > 0 || this.actor.type === 'hazard' || this.actor.type === 'npc')))\n\n // Exit if no strikes exist\n if (!strikes) return\n\n for (const strike of strikes) {\n let auxiliaryActions = []\n let versatileOptionActions = []\n let strikeGroupData = null\n const usageData = []\n\n const strikeId = `${strike.item.id}-${strike.slug}`\n const strikeGroupId = `strikes+${strikeId}`\n const strikeGroupName = (() => {\n let groupName = strike.label\n if (this.showStrikeTraits && this.showStrikeNames) {\n let strikeTraits\n if (this.actor.type === 'character') {\n strikeTraits = strike.weaponTraits\n } else {\n strikeTraits = strike.traits\n }\n if (strikeTraits.length > 0) {\n groupName += ' - '\n for (const trait of strikeTraits) {\n groupName += '[' + trait.label + ']'\n }\n }\n }\n return groupName\n })()\n const strikeGroupListName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ${strike.label} (${strike.item.id})`\n const image = strike.imageUrl ?? strike.item?.img\n const showTitle = this.showStrikeNames\n const tooltipData = await this.#getTooltipData(strike, actionType)\n const tooltip = await this.#getTooltip(actionType, tooltipData)\n\n // Create group data\n strikeGroupData = {\n id: strikeGroupId,\n name: strikeGroupName,\n listName: strikeGroupListName,\n type: 'system-derived',\n settings: { showTitle },\n tooltip\n }\n if (this.showStrikeImages) strikeGroupData.settings.image = image\n if (typeof strikeGroupData.settings.sort === 'undefined' && coreModule.api.Utils.getSetting('sortActions')) strikeGroupData.settings.sort = false\n\n // Add group to action list\n this.addGroup(strikeGroupData, parentGroupData)\n\n if (strike.auxiliaryActions?.length && this.addAuxiliaryActions) {\n // Get actions\n auxiliaryActions = strike.auxiliaryActions.flatMap((auxiliaryAction, index) => {\n if (auxiliaryAction.purpose === 'Modular') {\n const modularOptions = strike.item.system.traits.toggles.modular.options\n const modularSelection = strike.item.system.traits.toggles.modular.selection\n return modularOptions.map(modularOption => {\n const id = encodeURIComponent(`${strike.item.id}>${strike.slug}>${index}>${modularOption}`)\n const name = coreModule.api.Utils.i18n(MODULAR_OPTION[modularOption])\n return {\n id,\n name,\n listName: `${strikeGroupListName}: ${name}`,\n encodedValue: ['strikeAuxiliaryAction', id].join(this.delimiter),\n cssClass: this.#getActionCss({ selected: (modularOption === modularSelection) }),\n icon1: this.#getActionIcon(auxiliaryAction.glyph)\n }\n })\n } else {\n const id = encodeURIComponent(`${strike.item.id}>${strike.slug}>${index}>`)\n const name = auxiliaryAction.label\n return {\n id,\n name,\n listName: `${strikeGroupListName}: ${name}`,\n encodedValue: ['strikeAuxiliaryAction', id].join(this.delimiter),\n icon1: this.#getActionIcon(auxiliaryAction.glyph),\n info: this.#getItemInfo(auxiliaryAction)\n }\n }\n })\n }\n if (strike.ready) {\n if (strike.versatileOptions?.length) {\n // Get actions\n versatileOptionActions = strike.versatileOptions.map(versatileOption => {\n const encodedId = encodeURIComponent(`${strike.item.id}>${strike.slug}>${versatileOption.value}>`)\n const fullName = coreModule.api.Utils.i18n(versatileOption.label)\n return {\n id: encodedId,\n name: '',\n fullName,\n listName: `${strikeGroupListName}: ${fullName}`,\n encodedValue: ['versatileOption', encodedId].join(this.delimiter),\n cssClass: this.#getActionCss(versatileOption),\n icon1: this.#getActionIcon(versatileOption.glyph, fullName)\n }\n })\n }\n\n const strikeUsages = (strike.altUsages) ? [strike, ...strike.altUsages] : [strike]\n\n for (const strikeUsage of strikeUsages) {\n const glyph = strike.glyph\n const encodedUsage = `${strikeUsage.item.isMelee}_${strikeUsage.item.isThrown}_${strikeUsage.item.isRanged}`\n let usage\n switch (encodedUsage) {\n case 'true_false_false':\n usage = 'melee'\n break\n case 'false_true_true':\n usage = 'thrown'\n break\n case 'false_false_true':\n usage = 'ranged'\n break\n }\n const usageGroupId = `${strikeGroupId}+${usage}`\n const usageGroupName = (strikeUsage.attackRollType)\n ? coreModule.api.Utils.i18n(strikeUsage.attackRollType)\n : coreModule.api.Utils.i18n(STRIKE_USAGE[usage].name)\n const usageGroupListName = `${strikeGroupListName}: ${usageGroupName}`\n const usageGroupIcon = (usage !== 'thrown' && glyph)\n ? `${glyph}`\n : STRIKE_ICON[usage]\n const usageGroupImage = (strikeUsages.length > 1) ? STRIKE_ICON[usage] : ''\n const usageGroupShowTitle = !((usageGroupImage || strikeUsages.length <= 1))\n const settings = { showTitle: usageGroupShowTitle, image: usageGroupImage }\n\n const usageGroupData = {\n id: usageGroupId,\n name: usageGroupName,\n listName: usageGroupListName,\n icon: usageGroupIcon,\n type: 'system-derived',\n settings\n }\n\n if (typeof usageGroupData.settings.sort === 'undefined' && coreModule.api.Utils.getSetting('sortActions')) {\n usageGroupData.settings.sort = false\n }\n\n const actions = strikeUsage.variants.map((variant, index) => {\n const id = encodeURIComponent(`${strike.item.id}>${strike.slug}>${index}>` + usage)\n const isMap = variant.label.includes(this.mapLabel)\n const modifier = (isMap)\n ? variant.label.split(' ')[0]\n : variant.label.replace(coreModule.api.Utils.i18n('PF2E.WeaponStrikeLabel'), '').replace(' ', '')\n const name = (this.calculateAttackPenalty) ? modifier : variant.label\n return {\n id,\n name,\n encodedValue: [actionType, id].join(this.delimiter),\n listName: `${usageGroupListName}: ${name}`\n }\n })\n\n // Get Damage\n const damageId = encodeURIComponent(`${strike.item.id}>${strike.slug}>damage>${usage}`)\n const damageName = coreModule.api.Utils.i18n('PF2E.DamageLabel')\n actions.push({\n id: damageId,\n name: damageName,\n listName: `${usageGroupListName}: ${damageName}`,\n encodedValue: [actionType, damageId].join(this.delimiter),\n systemSelected: this.addDamageAndCritical\n })\n\n // Get Critical\n const criticalId = encodeURIComponent(`${strike.item.id}>${strike.slug}>critical>${usage}`)\n const criticalName = coreModule.api.Utils.i18n('PF2E.CriticalDamageLabel')\n actions.push({\n id: criticalId,\n name: criticalName,\n listName: `${usageGroupListName}: ${criticalName}`,\n encodedValue: [actionType, criticalId].join(this.delimiter),\n systemSelected: this.addDamageAndCritical\n })\n\n // Get Ammo\n if (strikeUsage.selectedAmmoId && !strikeUsage.ammunition) {\n const item = this.actor.items.get(strikeUsage.selectedAmmoId)\n\n if (!item) {\n const id = 'noAmmo'\n const name = coreModule.api.Utils.i18n('tokenActionHud.pf2e.noAmmo')\n actions.push({\n id,\n name,\n listName: `${usageGroupListName}: ${name}`,\n encodedValue: id\n })\n } else {\n const id = this.#getActionId(item)\n const name = this.#getActionName(item)\n actions.push({\n id,\n name,\n listName: `${usageGroupListName}: ${name}`,\n encodedValue: [actionType, id].join(this.delimiter)\n })\n }\n }\n\n usageData.push({ actions, usageGroupData })\n }\n }\n\n if (this.splitStrikes) {\n this.addActions([...versatileOptionActions, ...auxiliaryActions], strikeGroupData)\n for (const usage of usageData) {\n this.addGroup(usage.usageGroupData, strikeGroupData)\n this.addActions(usage.actions, usage.usageGroupData)\n }\n } else {\n this.addActions([...(usageData[0]?.actions || []), ...versatileOptionActions, ...auxiliaryActions], strikeGroupData)\n usageData.shift()\n for (const usage of usageData) {\n this.addGroup(usage.usageGroupData, strikeGroupData)\n this.addActions(usage.actions, usage.usageGroupData)\n }\n }\n }\n }\n\n /**\n * Build toggles\n */\n #buildToggles () {\n const actionType = 'toggle'\n\n // Get toggles\n const toggles = Object.values(this.actor.synthetics.toggles).flatMap(domain => Object.values(domain))\n\n // Exit if no toggles exist\n if (!toggles.length) return\n\n const togglesWithoutSuboptions = toggles.filter(toggle => toggle.suboptions.length === 0)\n const togglesWithSuboptions = toggles.filter(toggle => toggle.suboptions.length !== 0)\n\n // Create group data\n const groupData = { id: 'toggles', type: 'system' }\n\n // Get actions\n const actions = togglesWithoutSuboptions.map(toggle => {\n const id = encodeURIComponent(`${toggle.domain}>${toggle.option}>${toggle.itemId}>>`)\n const name = coreModule.api.Utils.i18n(toggle.label)\n const encodedValue = [actionType, id].join(this.delimiter)\n const active = (toggle.checked) ? ' active' : ''\n const cssClass = `toggle${active}`\n\n return { id, encodedValue, name, cssClass }\n })\n\n // Add actions to action list\n this.addActions(actions, groupData)\n\n for (const toggle of togglesWithSuboptions) {\n const id = [toggle.domain, toggle.option].join('.')\n const subgroupName = coreModule.api.Utils.i18n(toggle.label)\n const subgroupListName = `${ACTION_TYPE.toggle}: ${subgroupName}`\n const subgroupData = {\n id,\n name: subgroupName,\n listName: subgroupListName,\n type: 'system-derived'\n }\n\n this.addGroup(subgroupData, groupData)\n\n // Get actions\n const actions = toggle.suboptions.map(suboption => {\n const id = encodeURIComponent(`${toggle.domain}>${toggle.option}>${toggle.itemId}>${suboption.value}`)\n const name = coreModule.api.Utils.i18n(suboption.label)\n const selected = suboption.selected && toggle.enabled && toggle.checked\n\n return {\n id,\n name,\n listName: `${subgroupListName}: ${name}`,\n encodedValue: ['toggle', id].join(this.delimiter),\n cssClass: this.#getActionCss({ selected })\n }\n })\n\n // Add actions to action list\n this.addActions(actions, subgroupData)\n }\n }\n\n #getActionId (entity, actionType, spellLevel) {\n return (actionType === 'spell') ? `${entity.id ?? entity._id}-${spellLevel}` : entity.id ?? entity._id\n }\n\n #getActionName (entity) {\n return entity?.name ?? entity?.label ?? ''\n }\n\n #getActionListName (entity, actionType) {\n const name = this.#getActionName(entity)\n const actionTypeName = `${coreModule.api.Utils.i18n(ACTION_TYPE[actionType])}: ` ?? ''\n return entity.listName ?? `${actionTypeName}${name}`\n }\n\n #getActionCss (entity) {\n if (Object.hasOwn(entity, 'disabled')) {\n const active = (!entity.disabled) ? ' active' : ''\n return `toggle${active}`\n }\n if (Object.hasOwn(entity, 'selected')) {\n const active = (entity.selected) ? ' active' : ''\n return `toggle${active}`\n }\n }\n\n #getActionEncodedValue (entity, actionType, spellLevel) {\n const spellcastingId = entity?.spellcasting?.id\n const encodedId = (actionType === 'spell') ? `${spellcastingId}>${spellLevel}>${entity.id ?? entity._id}` : this.#getActionId(entity, actionType, spellLevel)\n return [actionType, encodedId].join(this.delimiter)\n }\n\n #getIcon1 (entity, actionType) {\n const actions = entity.system?.actions\n const actionTypes = ['free', 'reaction', 'passive']\n const actionTypeValue = entity.system?.actionType?.value\n const actionsCost = (actions) ? parseInt((actions || {}).value, 10) : null\n const timeValue = entity.system?.time?.value\n const actionIcon = entity.actionIcon\n const iconType = (actionType === 'spell') ? timeValue : (actionTypes.includes(actionTypeValue)) ? actionTypeValue : actionsCost ?? actionIcon\n const name = this.#getActionName(entity)\n return this.#getActionIcon(iconType, name)\n }\n\n /**\n * Get spell DC info\n * @private\n * @param {object} spellcastingEntry The spellcasting entry\n * @returns {string} The spell DC info\n */\n #getSpellDcInfo (spellcastingEntry) {\n const statistic = spellcastingEntry.statistic\n const spellDc = typeof statistic.dc === 'function'\n ? statistic.dc().value\n : statistic.dc.value\n const spellAttackModifier = statistic.check.mod\n const spellAttackBonus = spellAttackModifier >= 0\n ? `${coreModule.api.Utils.i18n('tokenActionHud.pf2e.atk')} +${spellAttackModifier}`\n : `${coreModule.api.Utils.i18n('tokenActionHud.pf2e.atk')} ${spellAttackModifier}`\n const spellDcInfo = `${coreModule.api.Utils.i18n('tokenActionHud.pf2e.dc')}${spellDc}`\n return `${spellAttackBonus} ${spellDcInfo}`\n }\n\n /**\n * Get actors\n * @private\n * @returns {object}\n */\n #getActors () {\n const allowedTypes = ['character', 'npc']\n const actors = canvas.tokens.controlled.map(token => token.actor)\n if (actors.every(actor => allowedTypes.includes(actor.type))) { return actors }\n }\n\n /**\n * Is equipped item\n * @private\n * @param {object} item\n * @returns {boolean}\n */\n #isEquippedItem (item) {\n const carryTypes = ['held', 'worn']\n const carryType = item.system.equipped?.carryType\n\n if (this.addUnequippedItems) return true\n if (carryTypes.includes(carryType) && !item.system.containerId?.value?.length) return true\n return false\n }\n\n #isAddItem (groupType, item) {\n if (item.system.equipped?.carryType !== 'stowed') return true\n return this.#isAddStowedItem(groupType, item)\n }\n\n /**\n * Is add stowed item\n * @private\n * @param {string} groupType The group type: container or nonContainer\n * @param {object} item The item\n * @returns {boolean} Whether the stowed item should be added to the group\n */\n #isAddStowedItem (groupType, item) {\n if (item.system.equipped?.carryType !== 'stowed') return true\n if (this.addStowedItems === 'both') return true\n if (groupType === 'container' && this.addStowedItems === 'containers') return true\n if (groupType === 'nonContainer' && this.addStowedItems === 'nonContainers') return true\n return false\n }\n\n /**\n * Get item info\n * @private\n * @param {object} item\n * @returns {object}\n */\n #getItemInfo (item) {\n const quantityData = this.#getQuantityData(item) ?? ''\n return {\n info1: { text: quantityData }\n }\n }\n\n /**\n * Get quantity\n * @private\n * @param {object} item\n * @returns {string}\n */\n #getQuantityData (item) {\n const quantity = item?.system?.quantity?.value\n return (quantity > 1) ? quantity : ''\n }\n\n /**\n * Get action icon\n * @private\n * @param {object} action\n * @returns {string}\n */\n #getActionIcon (action, title = '') {\n if (DAMAGE_TYPE_ICONS[action]) {\n return ``\n }\n return ACTION_ICON[action]\n }\n\n /**\n * Get carry type icon\n * @private\n * @param {object} itemData The item data\n * @returns {string}\n */\n #getCarryTypeIcon (itemData) {\n let carryType = ''\n switch (itemData?.carryType) {\n case 'held':\n if (itemData?.handsHeld === 2) {\n carryType = 'held2'\n } else {\n carryType = 'held1'\n }\n break\n default:\n carryType = itemData?.carryType\n break\n }\n const tooltip = coreModule.api.Utils.i18n(CARRY_TYPE_ICON[carryType]?.tooltip) ?? ''\n return CARRY_TYPE_ICON[carryType]?.icon.replace('placeholder', tooltip) ?? ''\n }\n\n /**\n * Get tooltip data\n * @param {object} entity The entity\n * @param {string} actionType The action type\n * @returns {Promise} The tooltip data\n */\n async #getTooltipData (entity, actionType, spellRank = null) {\n if (this.tooltipsSetting === 'none' || !entity) return ''\n else if (this.tooltipsSetting === 'nameOnly') return entity.name ?? ''\n\n const itemActionTypes = ['elementalBlast', 'strike']\n\n let chatData\n\n if (itemActionTypes.includes(actionType)) {\n chatData = await entity.item.getChatData()\n } else {\n chatData = await entity.getChatData()\n }\n\n if (!chatData) return ''\n\n switch (actionType) {\n case 'item':\n return {\n name: entity.name,\n description: chatData.description?.value,\n rarity: chatData.rarity,\n traits: chatData.traits,\n traits2: chatData.properties\n }\n case 'spell':\n {\n return {\n name: entity.name,\n description: chatData.description?.value,\n properties: chatData.properties,\n rarity: chatData.rarity,\n traits: chatData.traits,\n traitsAlt: chatData.spellTraits\n }\n }\n case 'strike':\n return {\n name: entity.label,\n descriptionLocalised: this.#getStrikeDescription(entity),\n modifiers: entity.modifiers,\n properties: chatData.properties?.filter(property => property !== 'PF2E.WeaponTypeMartial'),\n traits: entity.traits,\n traitsAlt: entity.weaponTraits\n }\n default:\n return {\n name: actionType === 'elementalBlast' ? entity.item.name : entity.name,\n description: chatData.description?.value,\n properties: chatData.properties,\n rarity: chatData.rarity,\n traits: chatData.traits\n }\n }\n }\n\n /**\n * Get tooltip\n * @private\n * @param {string} actionType The action type\n * @param {object} tooltipData The tooltip data\n * @returns {Promise} The tooltip\n */\n async #getTooltip (actionType, tooltipData) {\n if (this.tooltipsSetting === 'none') return ''\n\n const name = coreModule.api.Utils.i18n(tooltipData.name)\n\n if (this.tooltipsSetting === 'nameOnly') return name\n\n if (typeof tooltipData === 'string') return tooltipData\n\n const nameHtml = `

${name}

`\n\n const description = coreModule.api.Utils.i18n(tooltipData?.description ?? tooltipData?.descriptionLocalised ?? '')\n\n const rarityHtml = tooltipData?.rarity\n ? `${coreModule.api.Utils.i18n(tooltipData.rarity.label)}`\n : ''\n\n const propertiesHtml = tooltipData?.properties\n ? `
${tooltipData.properties.map(property => `${coreModule.api.Utils.i18n(property)}`).join('')}
`\n : ''\n\n const traitsHtml = tooltipData?.traits\n ? tooltipData.traits.map(trait => `${coreModule.api.Utils.i18n(trait.label)}`).join('')\n : ''\n\n const traits2Html = tooltipData?.traits2\n ? tooltipData.traits2.map(trait => `${coreModule.api.Utils.i18n(trait.label ?? trait)}`).join('')\n : ''\n\n const traitsAltHtml = tooltipData?.traitsAlt\n ? tooltipData.traitsAlt.map(trait => `${coreModule.api.Utils.i18n(trait.label)}`).join('')\n : ''\n\n const modifiersHtml = tooltipData?.modifiers\n ? `
${tooltipData.modifiers.filter(modifier => modifier.enabled).map(modifier => {\n const label = coreModule.api.Utils.i18n(modifier.label)\n const sign = modifier.modifier >= 0 ? '+' : ''\n const mod = `${sign}${modifier.modifier ?? ''}`\n return `${label} ${mod}`\n }).join('')}
`\n : ''\n\n const tagsJoined = [rarityHtml, traitsHtml, traits2Html, traitsAltHtml].join('')\n\n const tagsHtml = (tagsJoined) ? `
${tagsJoined}
` : ''\n\n const headerTags = (tagsHtml || modifiersHtml) ? `
${tagsHtml}${modifiersHtml}
` : ''\n\n if (!description && !tagsHtml && !modifiersHtml) return name\n\n const tooltipHtml = `
${nameHtml}${headerTags}${description}${propertiesHtml}
`\n\n return await TextEditor.enrichHTML(tooltipHtml, { async: true })\n }\n\n /**\n * Get strike description\n * @private\n * @param {object} strike The strike data\n * @returns {string} The strike description\n */\n #getStrikeDescription (strike) {\n const description = (strike?.description) ? `

${coreModule.api.Utils.i18n(strike?.description)}

` : ''\n const criticalSuccess = (strike?.criticalSuccess) ? `

${coreModule.api.Utils.i18n('PF2E.Check.Result.Degree.Check.criticalSuccess')}

${coreModule.api.Utils.i18n(strike?.criticalSuccess)}

` : ''\n const success = (strike?.success) ? `

${coreModule.api.Utils.i18n('PF2E.Check.Result.Degree.Check.success')}

${coreModule.api.Utils.i18n(strike?.success)}

` : ''\n return `${description}${criticalSuccess}${success}`\n }\n }\n})\n","import { GROUP } from './constants.js'\n\n/**\n * Default layout and groups\n */\nexport let DEFAULTS = null\n\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\n const groups = GROUP\n Object.values(groups).forEach(group => {\n group.name = coreModule.api.Utils.i18n(group.name)\n group.listName = `Group: ${coreModule.api.Utils.i18n(group.listName ?? group.name)}`\n })\n const groupsArray = Object.values(groups)\n DEFAULTS = {\n layout: [\n {\n nestId: 'attack',\n id: 'attack',\n name: coreModule.api.Utils.i18n('PF2E.AttackLabel'),\n groups: [\n { ...groups.attack, nestId: 'attack_attack' }\n ]\n },\n {\n nestId: 'strikes',\n id: 'strikes',\n name: coreModule.api.Utils.i18n('PF2E.StrikesLabel'),\n groups: [\n { ...groups.toggles, nestId: 'strikes_toggles' },\n { ...groups.strikes, nestId: 'strikes_strikes' }\n ],\n settings: { customWidth: 500 }\n },\n {\n nestId: 'actions',\n id: 'actions',\n name: coreModule.api.Utils.i18n('PF2E.ActionsActionsHeader'),\n groups: [\n { ...groups.actions, nestId: 'actions_actions' },\n { ...groups.reactions, nestId: 'actions_reactions' },\n { ...groups.freeActions, nestId: 'actions_free-actions' },\n { ...groups.passives, nestId: 'actions_passives' }\n ]\n },\n {\n nestId: 'inventory',\n id: 'inventory',\n name: coreModule.api.Utils.i18n('PF2E.TabInventoryLabel'),\n groups: [\n { ...groups.weapons, nestId: 'inventory_weapons' },\n { ...groups.shields, nestId: 'inventory_shields' },\n { ...groups.armor, nestId: 'inventory_armor' },\n { ...groups.equipment, nestId: 'inventory_equipment' },\n { ...groups.consumables, nestId: 'inventory_consumables' },\n { ...groups.containers, nestId: 'inventory_containers' },\n { ...groups.treasure, nestId: 'inventory_treasure' }\n ]\n },\n {\n nestId: 'feats',\n id: 'feats',\n name: coreModule.api.Utils.i18n('PF2E.Item.Feat.Plural'),\n groups: [\n { ...groups.ancestryFeatures, nestId: 'feats_ancestry-features' },\n { ...groups.classFeatures, nestId: 'feats_class-features' },\n { ...groups.ancestryFeats, nestId: 'feats_ancestry-feats' },\n { ...groups.classFeats, nestId: 'feats_class-feats' },\n { ...groups.skillFeats, nestId: 'feats_skill-feats' },\n { ...groups.generalFeats, nestId: 'feats_general-feats' },\n { ...groups.bonusFeats, nestId: 'feats_bonus-feats' }\n ]\n },\n {\n nestId: 'spells',\n id: 'spells',\n name: coreModule.api.Utils.i18n('PF2E.Item.Spell.Plural'),\n groups: [\n { ...groups.spells, nestId: 'spells_spells' }\n ]\n },\n {\n nestId: 'attributes',\n id: 'attributes',\n name: coreModule.api.Utils.i18n('tokenActionHud.pf2e.attributes'),\n groups: [\n { ...groups.heroPoints, nestId: 'attributes_hero-points' },\n { ...groups.mythicPoints, nestId: 'attributes_mythic-points' },\n { ...groups.initiative, nestId: 'attributes_initiative' },\n { ...groups.perceptionCheck, nestId: 'attributes_perception-check' },\n { ...groups.saves, nestId: 'attributes_saves' }\n ]\n },\n {\n nestId: 'skills',\n id: 'skills',\n name: coreModule.api.Utils.i18n('PF2E.SkillsLabel'),\n groups: [\n { ...groups.coreSkills, nestId: 'skills_core-skills' },\n { ...groups.loreSkills, nestId: 'skills_lore-skills' }\n ]\n },\n {\n nestId: 'effects',\n id: 'effects',\n name: coreModule.api.Utils.i18n('PF2E.EffectsLabel'),\n groups: [\n { ...groups.conditions, nestId: 'effects_conditions' },\n { ...groups.socialConditions, nestId: 'effects_social-conditions' },\n { ...groups.otherConditions, nestId: 'effects_other-conditions' },\n { ...groups.effects, nestId: 'effects_effects' }\n ]\n },\n {\n nestId: 'utility',\n id: 'utility',\n name: coreModule.api.Utils.i18n('tokenActionHud.utility'),\n groups: [\n { ...groups.combat, nestId: 'utility_combat' },\n { ...groups.token, nestId: 'utility_token' },\n { ...groups.recoveryCheck, nestId: 'utility_recovery-check' },\n { ...groups.rests, nestId: 'utility_rests' },\n { ...groups.utility, nestId: 'utility_utility' }\n ]\n }\n ],\n groups: groupsArray\n }\n})\n","export let RollHandler = null\n\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\n RollHandler = class RollHandler extends coreModule.api.RollHandler {\n /**\n * Execute macro by ID\n * @private\n * @param {string} id The macro id\n */\n async #executeMacroById (id) {\n game.packs.get('pf2e.pf2e-macros').getDocument(id).then((e) => e.execute())\n }\n\n /**\n * Is renderable item\n * @private\n * @param {string} actionType The action type\n * @return {boolean} Whether the action is a renderable item\n */\n #isRenderableItem (actionType) {\n const renderable = [\n 'action',\n 'ammo',\n 'feat',\n 'item',\n 'lore'\n ]\n\n return this.isRenderItem() && renderable.includes(actionType)\n }\n\n /**\n * Get controlled tokens\n * @private\n * @return {array} The controlled tokens\n */\n #getControlledTokens () {\n const actorTypes = [\n 'character',\n 'familiar',\n 'hazard',\n 'npc'\n ]\n\n return canvas.tokens.controlled.filter(token => actorTypes.includes(token.actor?.type))\n }\n\n /**\n * Set roll options\n * @private\n */\n #setRollOptions () {\n this.rollMode = this.ctrl ? game.user.isGM ? 'gmroll' : 'blindroll' : null\n this.showCheckDialogs = this.shift ? game.user.settings.showCheckDialogs : !game.user.settings.showCheckDialogs\n }\n\n /**\n * Handle action click\n * @override\n * @param {object} event The event\n * @param {string} encodedPayload The encoded payload\n */\n async handleActionClick (event, encodedPayload) {\n const payload = decodeURIComponent(encodedPayload).split('|', 2)\n\n if (payload.length < 2) {\n super.throwInvalidValueErr()\n }\n\n const [actionType, actionId] = payload\n\n this.#setRollOptions()\n\n if (this.#isRenderableItem(actionType)) {\n return this.renderItem(this.actor, actionId)\n }\n\n if (this.actor) {\n await this.#handleActions(event, actionType, this.actor, this.token, actionId)\n } else {\n for (const token of this.#getControlledTokens()) {\n await this.#handleActions(event, actionType, token.actor, token, actionId)\n }\n }\n }\n\n /**\n * Handle action hover\n * @override\n * @param {object} event The event\n * @param {string} encodedPayload The encoded payload\n */\n async handleActionHover (event, encodedPayload) {\n const payload = decodeURIComponent(encodedPayload).split('|', 2)\n\n if (payload.length < 2) {\n return\n }\n\n const [actionType, actionData] = payload\n\n if (!this.actor) return\n\n // Currently, only the following action types are handled.\n const actionTypes = [\n 'action',\n 'elementalBlast',\n 'familiarAttack',\n 'feat',\n 'item',\n 'spell',\n 'strike'\n ]\n\n if (!actionTypes.includes(actionType)) return\n\n let item\n\n switch (actionType) {\n case 'elementalBlast':\n {\n // blastId, blastElement, blastValue, blastType\n const [blastId, blastElement] = actionData.split('>', 2)\n const blast = coreModule.api.Utils.getItem(this.actor, blastId)\n item = blast?.rules.find(rule => rule.value?.element === blastElement)\n }\n break\n case 'familiarAttack':\n item = this.actor.system.attack\n break\n case 'spell':\n {\n // spellcastingEntry, rank, spellId\n const [, , spellId] = actionData.split('>', 3)\n item = coreModule.api.Utils.getItem(this.actor, spellId)\n }\n break\n case 'strike':\n {\n // strikeId, strikeName, strikeValue, strikeType\n const [strikeId] = actionData.split('>', 1)\n if (strikeId === 'xxPF2ExUNARMEDxx') {\n item = this.actor.system.actions.find(action => action.item?.id === 'xxPF2ExUNARMEDxx').item\n } else {\n item = coreModule.api.Utils.getItem(this.actor, strikeId)\n }\n }\n break\n default:\n {\n const [actionId] = actionData.split('>', 1)\n item = coreModule.api.Utils.getItem(this.actor, actionId)\n }\n break\n }\n\n if (!item) return\n\n if (event.type === 'mouseenter') {\n Hooks.call('tokenActionHudSystemActionHoverOn', event, item)\n } else {\n Hooks.call('tokenActionHudSystemActionHoverOff', event, item)\n }\n }\n\n /**\n * Handle actions\n * @private\n * @param {object} event The event\n * @param {string} actionType The action type\n * @param {object} actor The actor\n * @param {object} token The token\n * @param {string} actionId The action id\n */\n async #handleActions (event, actionType, actor, token, actionId) {\n switch (actionType) {\n case 'action':\n this.#rollItemMacro(event, actor, actionId)\n break\n case 'condition':\n this.#adjustCondition(actor, actionId)\n break\n case 'effect':\n this.#adjustEffect(actor, actionId)\n break\n case 'elementalBlast':\n await this.#rollElementalBlast(event, actor, actionId)\n break\n case 'elementalBlastDamageType':\n this.#setElementalBlastDamageType(actor, actionId)\n break\n case 'familiarAttack':\n this.#rollFamiliarAttack(actor)\n break\n case 'feat':\n this.#rollItemMacro(event, actor, actionId)\n break\n case 'heroAction':\n this.#performHeroAction(actor, actionId)\n break\n case 'heroPoints':\n await this.#adjustResources(actor, 'heroPoints', 'value')\n break\n case 'mythicPoints':\n await this.#adjustResources(actor, 'mythicPoints', 'value')\n break\n case 'initiative':\n this.#rollInitiative(actor, actionId)\n break\n case 'item':\n this.#rollItemMacro(event, actor, actionId)\n break\n case 'perceptionCheck':\n this.#rollPerception(actor)\n break\n case 'recoveryCheck':\n this.#rollRecovery(event, actor)\n break\n case 'save':\n this.#rollSave(actor, actionId)\n break\n case 'spell':\n await this.#rollSpell(actor, actionId)\n break\n case 'spellSlot':\n await this.#adjustSpellSlot(actor, actionId)\n break\n case 'skill':\n await this.#rollSkill(event, actor, actionId)\n break\n case 'strike':\n this.#rollStrike(event, actor, actionId)\n break\n case 'strikeAuxiliaryAction':\n this.#performStrikeAuxiliaryAction(actor, actionId)\n break\n case 'toggle':\n await this.#performToggleAction(actor, actionId)\n break\n case 'utility':\n this.#performUtilityAction(token, actionId)\n break\n case 'versatileOption':\n this.#performVersatileOption(actor, actionId)\n break\n }\n }\n\n /**\n * Roll item macro\n * @private\n * @param {string} actionId The action id\n */\n #rollItemMacro (event, actor, actionId) {\n const item = actor?.items?.get(actionId)\n if (item) {\n if (!item.system.selfEffect && !item.system.frequency) {\n item.toMessage(event)\n }\n else {\n game.pf2e.rollItemMacro(actionId)\n }\n }\n }\n\n /**\n * Adjust condition\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #adjustCondition (actor, actionId) {\n this.rightClick ? actor.decreaseCondition(actionId) : actor.increaseCondition(actionId)\n }\n\n /**\n * Adjust effect\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #adjustEffect (actor, actionId) {\n const effect = coreModule.api.Utils.getItem(actor, actionId)\n\n if (!effect) return\n\n this.rightClick ? effect.decrease() : effect.increase()\n\n Hooks.callAll('forceUpdateTokenActionHud')\n }\n\n /**\n * Roll elemental blast\n * @private\n * @param {object} event The event\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #rollElementalBlast (event, actor, actionId) {\n const [itemId, element, type, usage] = decodeURIComponent(actionId).split('>', 4)\n\n const blasts = new game.pf2e.ElementalBlast(actor)\n const blast = blasts.configs.find(blast => blast.item.id === itemId && blast.element === element)\n const damageType = blast.damageTypes.find(damageType => damageType.selected)?.value ?? element\n const melee = usage === 'melee'\n const outcome = type === 'damage' ? 'success' : 'criticalSuccess'\n\n switch (type) {\n case 'damage':\n case 'critical':\n await blasts.damage({ element, damageType, melee, outcome, event })\n break\n default:\n await blasts.attack({ mapIncreases: type, element, damageType, melee, event })\n break\n }\n }\n\n /**\n * Set elemental blast damage type\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n #setElementalBlastDamageType (actor, actionId) {\n // itemId, element, damageType\n const [, element, damageType] = decodeURIComponent(actionId).split('>', 3)\n\n const blasts = new game.pf2e.ElementalBlast(actor)\n blasts.setDamageType({ element, damageType })\n }\n\n /**\n * Roll familiar attack\n * @private\n * @param {object} actor The actor\n */\n #rollFamiliarAttack (actor) {\n actor.attackStatistic.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\n }\n\n /**\n * Perform hero action\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #performHeroAction (actor, actionId) {\n switch (actionId) {\n case actionId === 'drawHeroActions':\n await game.modules.get('pf2e-hero-actions')?.api?.drawHeroActions(actor)\n break\n case actionId === 'useHeroAction':\n await game.modules.get('pf2e-hero-actions')?.api?.useHeroAction(actor, actionId)\n break\n }\n\n Hooks.callAll('forceUpdateTokenActionHud')\n }\n\n /**\n * Adjust resources\n * @private\n * @param {object} actor The actor\n * @param {string} resource The resource\n * @param {string} valueName The value name\n */\n async #adjustResources (actor, resource, valueName) {\n let value = actor.system.resources[resource][valueName]\n\n if (this.rightClick) {\n if (value > 0) {\n value--\n }\n } else {\n if (value < actor.system.resources[resource].max) {\n value++\n }\n }\n\n switch (resource) {\n case \"heroPoints\":\n await actor.update({ \"system.resources.heroPoints.value\": value })\n break\n case \"mythicPoints\":\n await actor.update({ \"system.resources.mythicPoints.value\": value })\n break\n }\n\n Hooks.callAll('forceUpdateTokenActionHud')\n }\n\n /**\n * Roll initiative\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #rollInitiative (actor, actionId) {\n if (actor.inCombat && actor.combatant?.initiative) {\n coreModule.api.Logger.info(game.i18n.format('PF2E.Encounter.AlreadyRolled', { actor: actor.name }), true)\n } else {\n await actor.update({ 'system.initiative.statistic': actionId })\n\n actor.initiative.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\n }\n }\n\n /**\n * Roll perception\n * @private\n * @param {object} actor The actor\n */\n #rollPerception (actor) {\n actor.perception.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\n }\n\n /**\n * Roll recovery\n * @private\n * @param {object} event The event\n * @param {object} actor The actor\n */\n #rollRecovery (event, actor) {\n actor.rollRecovery({ event })\n }\n\n /**\n * Roll save\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n #rollSave (actor, actionId) {\n actor.saves[actionId].check.roll({ rollMode: this.rollMode, skipDialog: this.skipDialog })\n }\n\n /**\n * Roll skill\n * @private\n * @param {object} event The event\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #rollSkill (event, actor, actionId) {\n await actor.skills[actionId].check.roll({ event })\n }\n\n /**\n * Roll spell\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #rollSpell (actor, actionId) {\n const [spellbookId, level, spellId, expend] = decodeURIComponent(actionId).split('>', 4)\n\n if (this.isRenderItem()) {\n return this.renderItem(actor, spellId)\n }\n\n const spellbook = actor.items.get(spellbookId)\n const spell = actor.items.get(spellId)\n\n if (!spellbook || !spell) return\n\n await spellbook.cast(spell, { message: !expend, consume: true, rank: Number(level) })\n\n Hooks.callAll('forceUpdateTokenActionHud')\n }\n\n /**\n * Adjust spell slot\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #adjustSpellSlot (actor, actionId) {\n const [spellbookId, slot, effect] = decodeURIComponent(actionId).split('>', 3)\n\n const spellbook = actor.items.get(spellbookId)\n\n if (!spellbook && slot !== 'focus') return\n\n let value, max\n\n if (slot === 'focus') {\n value = actor.system.resources.focus.value\n max = actor.system.resources.focus.max\n } else {\n value = spellbook.system.slots[slot].value\n max = spellbook.system.slots[slot].max\n }\n\n switch (effect) {\n case 'slotIncrease':\n if (value < max) {\n value++\n }\n break\n case 'slotDecrease':\n if (value > 0) {\n value--\n }\n }\n\n if (slot === 'focus') {\n actor.update({ 'system.resources.focus.value': value })\n } else {\n await Item.updateDocuments([{ _id: spellbook.id, data: { slots: { [slot]: { value } } } }], { parent: actor })\n }\n\n Hooks.callAll('forceUpdateTokenActionHud')\n }\n\n /**\n * Roll strike\n * @private\n * @param {object} event The event\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n #rollStrike (event, actor, actionId) {\n const [itemId, slug, strikeType, usage] = decodeURIComponent(actionId).split('>', 4)\n\n let strike = actor.system.actions\n .filter(action => action.type === 'strike')\n .find(strike => strike.item.id === itemId && strike.slug === slug)\n\n if (this.isRenderItem() && strike.item?.id !== 'xxPF2ExUNARMEDxx') {\n return this.renderItem(actor, strike.item.id)\n }\n\n let altUsage\n\n if (strike.altUsages?.length) {\n switch (true) {\n case usage === 'melee' && !strike.item.isMelee:\n altUsage = usage\n strike = strike.altUsages.find(strike => strike.item.isMelee)\n break\n case usage === 'ranged' && !strike.item.isRanged:\n altUsage = usage\n strike = strike.altUsages.find(strike => strike.item.isRanged)\n break\n case usage === 'thrown' && !strike.item.isThrown:\n altUsage = usage\n strike = strike.altUsages.find(strike => strike.item.isThrown)\n break\n }\n }\n\n switch (strikeType) {\n case 'damage':\n strike.damage({ event })\n break\n case 'critical':\n strike.critical({ event })\n break\n default:\n strike.variants[strikeType]?.roll({ event, altUsage })\n break\n }\n }\n\n /**\n * Perform strike auxiliary action\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n #performStrikeAuxiliaryAction (actor, actionId) {\n const [itemId, slug, strikeType, selection] = decodeURIComponent(actionId).split('>', 4)\n\n const strike = actor.system.actions\n .filter(action => action.type === 'strike')\n .find(strike => strike.item.id === itemId && strike.slug === slug)\n\n if (!strike) return\n\n if (strike.origin && this.isRenderItem()) {\n this.renderItem(actor, strike.origin.id)\n } else {\n strike.auxiliaryActions[strikeType]?.execute({ selection })\n }\n }\n\n /**\n * Perform toggle action\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #performToggleAction (actor, actionId) {\n const [domain, option, itemId, suboptionValue] = decodeURIComponent(actionId).split('>', 4)\n\n if (!domain || !option) return\n\n const toggles = Object.values(this.actor.synthetics.toggles).flatMap(domain => Object.values(domain))\n\n const toggle = toggles.find(t => t.domain === domain && t.option === option && t.itemId === itemId)\n\n if (!toggle) return\n\n const value = !toggle.enabled || !toggle.checked || (suboptionValue && !toggle.suboptions.find(s => s.value === suboptionValue)?.selected)\n\n await actor.toggleRollOption(domain, option, itemId, value, suboptionValue)\n }\n\n /**\n * Perform utility action\n * @private\n * @param {object} token The token\n * @param {string} actionId The action id\n */\n async #performUtilityAction (token, actionId) {\n switch (actionId) {\n case 'treatWounds':\n this.#executeMacroById('6duZj0Ygiqv712rq')\n break\n case 'rest':\n this.#executeMacroById('0GU2sdy3r2MeC56x')\n break\n case 'takeBreather':\n this.#executeMacroById('aS6F7PSUlS9JM5jr')\n break\n case 'endTurn':\n if (game.combat?.current?.tokenId === token.id) {\n await game.combat?.nextTurn()\n }\n break\n }\n }\n\n /**\n * Perform versatile option\n * @private\n * @param {object} actor The actor\n * @param {string} actionId The action id\n */\n async #performVersatileOption (actor, actionId) {\n const [itemId, slug, selection] = decodeURIComponent(actionId).split('>', 3)\n\n const action = actor.system.actions\n .filter(action => action.type === 'strike')\n .find(strike => strike.item.id === itemId && strike.slug === slug)\n const weapon = action?.item\n\n if (!weapon) return\n\n await toggleWeaponTrait({ weapon, trait: 'versatile', selection })\n\n // Adapted from pf2e\n async function toggleWeaponTrait ({ weapon, trait, selection }) {\n if (!actor?.isOfType('character')) return\n\n const item = actor.items.get(weapon.id)\n\n const property = trait === 'double-barrel' ? 'doubleBarrel' : trait\n const current = item.system.traits.toggles[property].selected\n if (current === selection) return\n\n if (item?.isOfType('weapon') && item === weapon) {\n const value = property === 'doubleBarrel' ? !!selection : selection\n await item.update({ [`system.traits.toggles.${property}.selected`]: value })\n } else if (item?.isOfType('weapon') && weapon.altUsageType === 'melee') {\n item.update({ [`system.meleeUsage.traitToggles.${trait}`]: selection })\n } else if (trait === 'versatile' && item?.isOfType('shield')) {\n item.update({ 'system.traits.integrated.versatile.selected': selection })\n } else if (trait !== 'double-barrel') {\n const rule = item?.rules.find(\n r => r.key === 'Strike' && !r.ignored && r.slug === weapon.slug\n )\n await rule?.toggleTrait({ trait, selection })\n }\n }\n }\n }\n})\n","import { MODULE } from './constants.js'\n\nexport function register (updateFunc) {\n game.settings.register(MODULE.ID, 'calculateAttackPenalty', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.calculateAttackPenalty.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.calculateAttackPenalty.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: true,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'colorSkills', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.colorSkills.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.colorSkills.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: true,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'showStrikeImages', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.showStrikeImages.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.showStrikeImages.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: true,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'showStrikeNames', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.showStrikeNames.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.showStrikeNames.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: false,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'showStrikeTraits', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.showStrikeTraits.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.showStrikeTraits.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: false,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'splitStrikes', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.splitStrikes.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.splitStrikes.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: true,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'addAuxiliaryActions', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addAuxiliaryActions.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addAuxiliaryActions.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: true,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'addDamageAndCritical', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addDamageAndCritical.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addDamageAndCritical.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: true,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'addStowedItems', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addStowedItems.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addStowedItems.hint'\n ),\n scope: 'client',\n config: true,\n type: String,\n default: 'containers',\n choices: {\n containers: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.containers'),\n nonContainers: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.nonContainers'),\n both: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.both'),\n none: game.i18n.localize('tokenActionHud.pf2e.setting.addStowedItems.choice.none')\n },\n onChange: (value) => {\n updateFunc(value)\n }\n })\n\n game.settings.register(MODULE.ID, 'addUnequippedItems', {\n name: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addUnequippedItems.name'\n ),\n hint: game.i18n.localize(\n 'tokenActionHud.pf2e.setting.addUnequippedItems.hint'\n ),\n scope: 'client',\n config: true,\n type: Boolean,\n default: false,\n onChange: (value) => {\n updateFunc(value)\n }\n })\n}\n","// System Module Imports\nimport { ActionHandler } from './action-handler.js'\nimport { RollHandler as Core } from './roll-handler.js'\nimport { DEFAULTS } from './defaults.js'\nimport * as systemSettings from './settings.js'\n\nexport let SystemManager = null\n\nHooks.once('tokenActionHudCoreApiReady', async (coreModule) => {\n SystemManager = class SystemManager extends coreModule.api.SystemManager {\n /** @override */\n getActionHandler () {\n const actionHandler = new ActionHandler()\n return actionHandler\n }\n\n /** @override */\n getAvailableRollHandlers () {\n const coreTitle = 'Core PF2E'\n const choices = { core: coreTitle }\n return choices\n }\n\n /** @override */\n getRollHandler (rollHandlerId) {\n let rollHandler\n switch (rollHandlerId) {\n case 'core':\n default:\n rollHandler = new Core()\n break\n }\n return rollHandler\n }\n\n /** @override */\n registerSettings (onChangeFunction) {\n systemSettings.register(onChangeFunction)\n }\n\n /** @override */\n async registerDefaults () {\n const defaults = DEFAULTS\n if (game.modules.get('pf2e-hero-actions')?.active) {\n const listType = coreModule.api.Utils.i18n('tokenActionHud.group')\n const name = coreModule.api.Utils.i18n('tokenActionHud.pf2e.heroActions')\n defaults.groups.push(\n {\n id: 'hero-actions',\n name,\n listName: `${listType}: ${name}`,\n type: 'system'\n }\n )\n defaults.groups.sort((a, b) => a.id.localeCompare(b.id))\n }\n return defaults\n }\n }\n})\n","import { SystemManager } from './system-manager.js'\nimport { MODULE, REQUIRED_CORE_MODULE_VERSION } from './constants.js'\n\nHooks.on('tokenActionHudCoreApiReady', async () => {\n const module = game.modules.get(MODULE.ID)\n module.api = {\n requiredCoreModuleVersion: REQUIRED_CORE_MODULE_VERSION,\n SystemManager\n }\n Hooks.call('tokenActionHudSystemReady', module)\n})\n"],"names":["MODULE","ID","CORE_MODULE","REQUIRED_CORE_MODULE_VERSION","DAMAGE_TYPE_ICONS","axe","brain","bolt","droplet","fire","ghost","hammer","skull","snowflake","spider","sun","vial","ACTION_ICON","free","reaction","passive","A","D","T","F","R","ACTION_TYPE","action","attribute","condition","effect","familiarAttack","feat","heroAction","initiative","item","save","skill","skillAction","spell","strike","strikeAuxiliaryAction","toggle","utility","CARRY_TYPE_ICON","held1","icon","tooltip","held2","dropped","stowed","worn","ITEM_TYPE","armor","groupId","consumable","backpack","equipment","shield","treasure","weapon","MODULAR_OPTION","bludgeoning","piercing","slashing","SKILL_ABBREVIATION","acrobatics","arcana","athletics","crafting","deception","diplomacy","intimidation","medicine","nature","occultism","performance","perception","religion","society","stealth","survival","thievery","STRIKE_ICON","melee","thrown","STRIKE_USAGE","name","ranged","GROUP","attack","id","type","toggles","strikes","actions","reactions","freeActions","passives","skillActionsGrouped","listName","skillActionsUngrouped","settings","sort","weapons","shields","consumables","containers","ancestryFeatures","classFeatures","ancestryFeats","classFeats","skillFeats","generalFeats","bonusFeats","spells","heroPoints","mythicPoints","perceptionCheck","coreSkills","loreSkills","conditions","socialConditions","otherConditions","effects","combat","token","recoveryCheck","rests","saves","SKILL_ACTION","l5pbgrj8SSNtRGs8","actionCost","image","ZEWD4zcEDQwYhVT8","LXCy1iJddD95Z91s","xcrdOOiN0l6O1sIn","zn0HadZeoKDALxRu","Tu7LIRelQsiOuo1l","aDsYSdRqiC6qQIOQ","zUJ0UhuoFt5a7tiN","mNphXpAkmGsMadUv","U6WjxFPn4fUqIrfl","RZyfkw1DiqVy3JUC","sDUERv4E88G5BRPr","YWAvvDXpdW1fYPFo","nEwqNNWX6scLt4sc","T2QNEoRojMWEec4a","ooiO59Ch2QaebOmc","lkEcQQss16SIrVxM","RjfPFjqPrNve6eeh","yMTKMnaYSGtDz4wk","rCgGPEyXbzLFcio6","i95kcGLIQKOTsnv6","FlM3HvpnsZpCKawG","v3dlDjFlOmT5T2gC","k5nW4jGyXD0Oq9LR","VTg4t8kYTvXcHROq","QPsV0qi2zXm7syt6","Gj68YCVlDjc75iCP","dWcrojMk0d2WRPBq","BQTA7bL264189Xla","tbveXG4gaIoKnsWX","tikhJ2b6AMh7wQU7","LN67MgbGE8IHb2X0","PmHt7Gb5fCrlWWTr","yNry1xMZqdWHncbV","HSTkVuv0SjTNK3Xx","UKHPveLpG7hUs4D0","zjovbAeuLvyuWFKd","mkKko3CEBCyJVQw1","zkqh01BoXDVgydzo","TIlUkCzviYxdVk4E","Al5LYMMdeDcpC9Br","m4iM5r3TfvQs5Y2n","R03LRl2RBbsm6EcF","gRj7xUfcpUZQLrOC","SKILL","lore","Utils","Hooks","once","async","coreModule","getSetting","key","defaultValue","value","game","get","api","Logger","debug","setSetting","set","ActionHandler","actors","actorId","actorType","tokenId","items","groupIds","activationGroupIds","effectGroupIds","inventoryGroupIds","spellGroupIds","featureActions","inventoryActions","spellActions","mapLabel","i18n","replace","buildSystemActions","this","actor","getActors","includes","sortItemsByName","abbreviateSkills","addAuxiliaryActions","addDamageAndCritical","addStowedItems","addUnequippedItems","calculateAttackPenalty","colorSkills","showStrikeImages","showStrikeNames","showStrikeTraits","splitStrikes","buildCharacterActions","buildFamiliarActions","buildHazardActions","buildNpcActions","buildMultipleTokenActions","Promise","all","buildActions","buildCombat","buildConditions","buildEffects","buildFeats","buildHeroActions","buildPoints","buildInitiative","buildInventory","buildPerceptionCheck","buildRecoveryCheck","buildRests","buildSaves","buildSkillActions","buildSkills","buildSpells","buildStrikes","buildToggles","buildElementalBlasts","buildAttack","actionType","size","actionTypes","actionItems","Map","filter","_","itemData","system","actionsMap","actionTypeValue","groupData","map","getActionId","getActionName","getActionListName","cssClass","getActionCss","encodedValue","join","delimiter","icon1","getIcon1","img","getImage","info","getItemInfo","tooltipData","getTooltipData","getTooltip","addActions","slug","modifier","getModifier","totalModifier","info1","text","combatTypes","endTurn","current","Object","entries","combatType","limitedConditions","activeConditions","pf2e","ConditionManager","conditionId","startsWith","conditionData","activeCondition","activeConditionId","attributeValue","attributes","max","isValued","description","a","b","localeCompare","actionsTemp","reduce","acc","push","actionsOther","mythicEnabled","resources","unidentified","user","isGM","_$","featTypes","ancestryfeature","classfeature","ancestry","class","general","bonus","featsMap","category","featType","modules","active","actionTypeName","heroActions","getFlag","remainingHeroPoints","length","format","nb","localize","heroActionActions","uuid","uuidData","fromUuid","content","initiativeStatistic","statistic","fullName","abbreviatedSkills","modifiers","skills","skillData","label","getSharedSkills","skillActions","skillId","data","CONFIG","PF2E","skillList","check","mod","inventoryMap","hasQuantity","quantity","isEquippedItem","isAddItem","itemType","itemCategoryMap","categoryTypeMap","icon2","getCarryTypeIcon","has","parentGroupData","container","contents","addGroup","contentsMap","dyingValue","dying","every","saveData","actionMacros","packs","getIndex","skillActionsMap","actionMacro","_id","actionName","getActionIcon","groupName","skillsMap","rank","allSkillSets","minSkillSetSize","Math","min","skillSet","find","smallestSkill","some","spellcastingEntries","spellcastingEntry","spellbookGroupId","slugify","replacement","strict","bookGroupData","getSpellDcInfo","addGroupInfo","spellInfo","getSpellData","getSheetData","activeLevels","groups","level","spellLevel","levelGroupData","String","addSpellSlotInfo","activeSpells","activeSpell","expended","getActionEncodedValue","isCantrip","isFlexible","isFocusPool","isInnate","isPrepared","focus","slots","uses","spellSlot","maxSlots","blasts","ElementalBlast","configs","blast","damageTypeActions","strikeGroupData","usageData","strikeGroupId","element","strikeGroupName","blastTraits","traits","trait","strikeGroupListName","showTitle","damageTypes","damageType","index","encodeURIComponent","blastUsages","maps","blastUsage","usage","usageGroupId","usageGroupName","range","usageGroupListName","usageGroupImage","usageGroupShowTitle","usageGroupData","values","roll","split","damageId","damageName","systemSelected","criticalId","criticalName","shift","auxiliaryActions","versatileOptionActions","strikeTraits","weaponTraits","imageUrl","flatMap","auxiliaryAction","purpose","modularOptions","modular","options","modularSelection","selection","modularOption","selected","glyph","ready","versatileOptions","versatileOption","encodedId","strikeUsages","altUsages","strikeUsage","isMelee","isThrown","isRanged","attackRollType","usageGroupIcon","variants","variant","selectedAmmoId","ammunition","synthetics","domain","togglesWithoutSuboptions","suboptions","togglesWithSuboptions","option","itemId","subgroupName","subgroupListName","subgroupData","suboption","enabled","checked","entity","hasOwn","disabled","spellcastingId","spellcasting","actionsCost","parseInt","timeValue","time","actionIcon","iconType","spellDc","dc","spellAttackModifier","allowedTypes","canvas","tokens","controlled","carryType","equipped","containerId","groupType","isAddStowedItem","getQuantityData","title","handsHeld","spellRank","tooltipsSetting","chatData","getChatData","rarity","traits2","properties","traitsAlt","spellTraits","descriptionLocalised","getStrikeDescription","property","nameHtml","rarityHtml","propertiesHtml","traitsHtml","traits2Html","traitsAltHtml","modifiersHtml","tagsJoined","tagsHtml","tooltipHtml","TextEditor","enrichHTML","criticalSuccess","success","DEFAULTS","forEach","group","groupsArray","layout","nestId","customWidth","RollHandler","register","updateFunc","hint","scope","config","Boolean","default","onChange","choices","nonContainers","both","none","executeMacroById","getDocument","then","e","execute","isRenderableItem","isRenderItem","getControlledTokens","actorTypes","setRollOptions","rollMode","ctrl","showCheckDialogs","handleActionClick","event","encodedPayload","payload","decodeURIComponent","super","throwInvalidValueErr","actionId","renderItem","handleActions","handleActionHover","actionData","blastId","blastElement","getItem","rules","rule","spellId","strikeId","call","rollItemMacro","adjustCondition","adjustEffect","rollElementalBlast","setElementalBlastDamageType","rollFamiliarAttack","performHeroAction","adjustResources","rollInitiative","rollPerception","rollRecovery","rollSave","rollSpell","adjustSpellSlot","rollSkill","rollStrike","performStrikeAuxiliaryAction","performToggleAction","performUtilityAction","performVersatileOption","selfEffect","frequency","toMessage","rightClick","decreaseCondition","increaseCondition","decrease","increase","callAll","outcome","damage","mapIncreases","setDamageType","attackStatistic","skipDialog","drawHeroActions","useHeroAction","resource","valueName","update","inCombat","combatant","spellbookId","expend","spellbook","cast","message","consume","Number","slot","Item","updateDocuments","parent","strikeType","altUsage","critical","origin","suboptionValue","t","s","toggleRollOption","nextTurn","toggleWeaponTrait","isOfType","altUsageType","r","ignored","toggleTrait","SystemManager","getActionHandler","getAvailableRollHandlers","core","getRollHandler","rollHandlerId","rollHandler","Core","registerSettings","onChangeFunction","systemSettings.register","registerDefaults","defaults","listType","on","module","requiredCoreModuleVersion"],"mappings":"AAGY,MAACA,EAAS,CAClBC,GAAI,yBAMKC,EAAc,CACvBD,GAAI,yBAMKE,EAA+B,MAK/BC,EAAoB,CAC7BC,IAAK,wBACLC,MAAO,0BACPC,KAAM,yBACN,YAAa,8BACbC,QAAS,4BACTC,KAAM,yBACNC,MAAO,0BACPC,OAAQ,2BACRC,MAAO,0BACPC,UAAW,8BACXC,OAAQ,2BACRC,IAAK,wBACLC,KAAM,yBACN,iBAAkB,oCAMTC,EAAc,CACvB,EAAG,+FACH,EAAG,+FACH,EAAG,+FACHC,KAAM,+FACNC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