`;\r\n }\r\n\r\n /**\r\n * Get icon for a prepared spell\r\n * @private\r\n * @param {object} spell\r\n * @returns\r\n */\r\n #getPreparedIcon(spell) {\r\n if (spell?.type !== \"spell\" || !this.showUnpreparedSpells) return null;\r\n const level = spell.system.level;\r\n const preparationMode = spell.system.preparation.mode;\r\n const prepared = spell.system.preparation.prepared;\r\n const icon = prepared ? PREPARED_ICON : `${PREPARED_ICON} tah-icon-disabled`;\r\n const title = preparationMode === \"always\" ? game.i18n.localize(\"DND5E.SpellPrepAlways\") : prepared ? game.i18n.localize(\"DND5E.SpellPrepared\") : game.i18n.localize(\"DND5E.SpellUnprepared\");\r\n\r\n // Return icon if the preparation mode is 'prepared' or 'always' and the spell is not a cantrip\r\n return ((preparationMode === \"prepared\" || preparationMode === \"always\") && level !== 0) ? `` : null;\r\n }\r\n\r\n async #getTooltipData(entity) {\r\n if (this.tooltipsSetting === \"none\") return \"\";\r\n\r\n const name = entity?.name ?? \"\";\r\n\r\n if (this.tooltipsSetting === \"nameOnly\") return name;\r\n\r\n const unidentified = entity.system?.identified === false;\r\n const description = (typeof entity?.system?.description === \"string\") ? entity?.system?.description : (unidentified ? entity?.system?.unidentified?.description : entity?.system?.description?.value) ?? \"\";\r\n let modifiers; let properties; let rarity; let traits;\r\n if (!unidentified) {\r\n modifiers = entity?.modifiers ?? null;\r\n properties = [\r\n ...entity.system?.chatProperties ?? [],\r\n ...entity.system?.equippableItemCardProperties ?? [],\r\n entity.system?.parent?.labels?.activation,\r\n entity.system?.parent?.labels?.target,\r\n entity.system?.parent?.labels?.range,\r\n entity.system?.parent?.labels?.duration\r\n ].filter(p => p);\r\n rarity = unidentified ? null : entity?.rarity ?? null;\r\n traits = (entity?.type === \"weapon\") ? this.#getWeaponProperties(entity?.system?.properties) : null;\r\n }\r\n return { name, description, modifiers, properties, rarity, traits };\r\n }\r\n\r\n /**\r\n * Get condition tooltip data\r\n * @param {*} id The condition id\r\n * @param {*} name The condition name\r\n * @returns {object} The tooltip data\r\n */\r\n async #getConditionTooltipData(id, name) {\r\n if (this.tooltipsSetting === \"none\") return \"\";\r\n\r\n const condition = CONFIG.DND5E.conditionTypes[id];\r\n\r\n if (this.tooltipsSetting === \"nameOnly\" || !condition) return name;\r\n\r\n const journalEntry = (condition.reference) ? await fromUuid(condition.reference) : null;\r\n const description = journalEntry?.text?.content ?? \"\";\r\n const relativeTo = journalEntry;\r\n return {\r\n name,\r\n description,\r\n relativeTo\r\n };\r\n }\r\n\r\n /**\r\n * Get tooltip\r\n * @param {object} tooltipData The tooltip data\r\n * @returns {string} The tooltip\r\n */\r\n async #getTooltip(tooltipData) {\r\n if (this.tooltipsSetting === \"none\") return \"\";\r\n if (typeof tooltipData === \"string\") return tooltipData;\r\n\r\n const name = game.i18n.localize(tooltipData.name);\r\n\r\n if (this.tooltipsSetting === \"nameOnly\") return name;\r\n\r\n const nameHtml = `${name}
`;\r\n\r\n const relativeTo = tooltipData.relativeTo ?? this.actor;\r\n\r\n const description = tooltipData?.descriptionLocalised\r\n ?? await TextEditor.enrichHTML(game.i18n.localize(tooltipData?.description ?? \"\"), { async: true, relativeTo, secrets: true });\r\n\r\n const rarityHtml = tooltipData?.rarity\r\n ? `${game.i18n.localize(RARITY[tooltipData.rarity])}`\r\n : \"\";\r\n\r\n const propertiesHtml = tooltipData?.properties\r\n ? `${tooltipData.properties.map(property => `${game.i18n.localize(property)}`).join(\"\")}
`\r\n : \"\";\r\n\r\n const traitsHtml = tooltipData?.traits\r\n ? tooltipData.traits.map(trait => `${game.i18n.localize(trait.label ?? trait)}`).join(\"\")\r\n : \"\";\r\n\r\n const traits2Html = tooltipData?.traits2\r\n ? tooltipData.traits2.map(trait => `${game.i18n.localize(trait.label ?? trait)}`).join(\"\")\r\n : \"\";\r\n\r\n const traitsAltHtml = tooltipData?.traitsAlt\r\n ? tooltipData.traitsAlt.map(trait => `${game.i18n.localize(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 = game.i18n.localize(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 return `${nameHtml}${headerTags}${description}${propertiesHtml}
`;\r\n }\r\n\r\n #getWeaponProperties(weaponProperties) {\r\n if (!weaponProperties) return null;\r\n return Object.entries(weaponProperties)\r\n .filter(([id, selected]) => selected && CONFIG.DND5E.validProperties.weapon.has(id))\r\n .map(([id, _]) => game.i18n.localize(CONFIG.DND5E.itemProperties[id]));\r\n }\r\n };\r\n});\r\n","export let MagicItemActionHandlerExtender = null;\r\n\r\nHooks.once(\"tokenActionHudCoreApiReady\", async coreModule => {\r\n MagicItemActionHandlerExtender = class MagicItemActionHandlerExtender extends coreModule.api.ActionHandlerExtender {\r\n constructor(actionHandler) {\r\n super();\r\n this.actionHandler = actionHandler;\r\n this.actor = null;\r\n }\r\n\r\n /**\r\n * Extend the action list\r\n */\r\n async extendActionHandler() {\r\n this.actor = this.actionHandler.actor;\r\n if (!this.actor) return;\r\n\r\n const actor = await MagicItems.actor(this.actor.id);\r\n\r\n if (!actor) return;\r\n\r\n const magicItems = actor.items ?? [];\r\n\r\n if (magicItems.length === 0) return;\r\n\r\n const parentGroupId = \"magic-items\";\r\n const parentGroupType = \"system\";\r\n const parentGroupData = {\r\n id: parentGroupId,\r\n type: parentGroupType\r\n };\r\n\r\n magicItems.forEach(magicItem => {\r\n if (magicItem.attuned && !this._isItemAttuned(magicItem)) return;\r\n if (magicItem.equipped && !this._isItemEquipped(magicItem)) return;\r\n\r\n const groupId = `magic-items_${magicItem.id}`;\r\n const groupName = magicItem.name;\r\n const groupType = \"system-derived\";\r\n const groupInfo1 = `${magicItem.uses}/${magicItem.charges}`;\r\n const groupData = {\r\n id: groupId,\r\n name: groupName,\r\n type: groupType,\r\n info1: groupInfo1\r\n };\r\n\r\n // Add group to HUD\r\n this.actionHandler.addGroup(groupData, parentGroupData);\r\n\r\n const actions = magicItem.ownedEntries.map(entry => {\r\n const effect = entry.item;\r\n const id = effect.id;\r\n const name = effect.name;\r\n const img = coreModule.api.Utils.getImage(effect);\r\n const info1 = effect.consumption;\r\n const info2 = (effect.baseLevel) ? `${coreModule.api.Utils.i18n(\"DND5E.AbbreviationLevel\")} ${effect.baseLevel}` : \"\";\r\n return {\r\n id,\r\n name,\r\n encodedValue,\r\n img,\r\n info1,\r\n info2,\r\n selected: true,\r\n system: { actionType: \"magicItem\", itemId: magicItem.id, effectId: id}\r\n };\r\n });\r\n\r\n // Add actions to action list\r\n this.actionHandler.addActions(actions, groupData);\r\n });\r\n }\r\n\r\n /**\r\n * Whether the magic item is equipped or not\r\n * @param {object} magicItem The item\r\n * @returns {boolean}\r\n */\r\n _isItemEquipped(magicItem) {\r\n return magicItem.item.system.equipped;\r\n }\r\n\r\n /**\r\n * Whether the magic items is attuned or not\r\n * @param {object} magicItem The item\r\n * @returns {boolean}\r\n */\r\n _isItemAttuned(magicItem) {\r\n const attunement = magicItem.item.system.attunment;\r\n const attunementRequired = CONFIG.DND5E.attunementTypes?.REQUIRED ?? 1;\r\n\r\n if (attunement === attunementRequired) return false;\r\n\r\n return true;\r\n }\r\n };\r\n});\r\n","import { GROUP } from \"./constants.js\";\r\n\r\n/**\r\n * Default categories 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.name)}`;\r\n });\r\n const groupsArray = Object.values(groups);\r\n DEFAULTS = {\r\n layout: [\r\n {\r\n nestId: \"inventory\",\r\n id: \"inventory\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Inventory\"),\r\n groups: [\r\n { ...groups.weapons, nestId: \"inventory_weapons\" },\r\n { ...groups.equipment, nestId: \"inventory_equipment\" },\r\n { ...groups.consumables, nestId: \"inventory_consumables\" },\r\n { ...groups.tools, nestId: \"inventory_tools\" },\r\n { ...groups.containers, nestId: \"inventory_containers\" },\r\n { ...groups.loot, nestId: \"inventory_loot\" }\r\n ]\r\n },\r\n {\r\n nestId: \"features\",\r\n id: \"features\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Features\"),\r\n groups: [\r\n { ...groups.activeFeatures, nestId: \"features_active-features\" },\r\n { ...groups.passiveFeatures, nestId: \"features_passive-features\" }\r\n ]\r\n },\r\n {\r\n nestId: \"spells\",\r\n id: \"spells\",\r\n name: coreModule.api.Utils.i18n(\"TYPES.Item.spellPl\"),\r\n groups: [\r\n { ...groups.atWillSpells, nestId: \"spells_at-will-spells\" },\r\n { ...groups.innateSpells, nestId: \"spells_innate-spells\" },\r\n { ...groups.pactSpells, nestId: \"spells_pact-spells\" },\r\n { ...groups.cantrips, nestId: \"spells_cantrips\" },\r\n { ...groups._1stLevelSpells, nestId: \"spells_1st-level-spells\" },\r\n { ...groups._2ndLevelSpells, nestId: \"spells_2nd-level-spells\" },\r\n { ...groups._3rdLevelSpells, nestId: \"spells_3rd-level-spells\" },\r\n { ...groups._4thLevelSpells, nestId: \"spells_4th-level-spells\" },\r\n { ...groups._5thLevelSpells, nestId: \"spells_5th-level-spells\" },\r\n { ...groups._6thLevelSpells, nestId: \"spells_6th-level-spells\" },\r\n { ...groups._7thLevelSpells, nestId: \"spells_7th-level-spells\" },\r\n { ...groups._8thLevelSpells, nestId: \"spells_8th-level-spells\" },\r\n { ...groups._9thLevelSpells, nestId: \"spells_9th-level-spells\" }\r\n ]\r\n },\r\n {\r\n nestId: \"attributes\",\r\n id: \"attributes\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Attributes\"),\r\n groups: [\r\n { ...groups.abilities, nestId: \"attributes_abilities\" },\r\n { ...groups.skills, nestId: \"attributes_skills\" }\r\n ]\r\n },\r\n {\r\n nestId: \"effects\",\r\n id: \"effects\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Effects\"),\r\n groups: [\r\n { ...groups.temporaryEffects, nestId: \"effects_temporary-effects\" },\r\n { ...groups.passiveEffects, nestId: \"effects_passive-effects\" },\r\n { ...groups.conditions, nestId: \"effects_conditions\" }\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.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 { CUSTOM_DND5E } from \"./constants.js\";\r\n\r\nexport let RollHandler = null;\r\n\r\nHooks.once(\"tokenActionHudCoreApiReady\", async coreModule => {\r\n RollHandler = class RollHandler extends coreModule.api.RollHandler {\r\n /**\r\n * Handle action click\r\n * @override\r\n * @param {object} event\r\n */\r\n async handleActionClick(event) {\r\n const { actionType, actionId } = this.action.system;\r\n\r\n if (!this.actor) {\r\n for (const token of coreModule.api.Utils.getControlledTokens()) {\r\n const actor = token.actor;\r\n await this.handleAction(event, actionType, actor, token, actionId);\r\n }\r\n } else {\r\n await this.handleAction(event, actionType, this.actor, this.token, actionId);\r\n }\r\n }\r\n\r\n /**\r\n * Handle action\r\n * @private\r\n * @param {object} event\r\n * @param {string} actionType\r\n * @param {object} actor\r\n * @param {object} token\r\n * @param {string} actionId\r\n */\r\n async handleAction(event, actionType, actor, token, actionId) {\r\n switch (actionType) {\r\n case \"ability\":\r\n this.rollAbility(event, actor, actionId); break;\r\n case \"check\":\r\n this.rollAbilityTest(event, actor, actionId); break;\r\n case \"save\":\r\n this.rollAbilitySave(event, actor, actionId); break;\r\n case \"condition\":\r\n if (!token) return;\r\n await this.toggleCondition(actor, token, actionId); break;\r\n case \"counter\":\r\n await this.modifyCounter(event, actor); break;\r\n case \"effect\":\r\n await this.toggleEffect(actor, actionId); break;\r\n case \"exhaustion\":\r\n await this.modifyExhaustion(event, actor); break;\r\n case \"feature\":\r\n case \"item\":\r\n case \"spell\":\r\n case \"weapon\":\r\n if (this.isRenderItem()) this.renderItem(actor, actionId);\r\n else this.useItem(event, actor, actionId);\r\n break;\r\n case \"magicItem\":\r\n await this.rollMagicItem(actor, actionId); break;\r\n case \"skill\":\r\n this.rollSkill(event, actor, actionId); break;\r\n case \"utility\":\r\n await this.performUtilityAction(event, actor, token, actionId); break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Modify Counter\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n */\r\n async modifyCounter(event, actor) {\r\n switch (this.action?.system?.counterKey) {\r\n case \"death-saves\":\r\n this.rollDeathSave(event, actor); break;\r\n case \"exhaustion\":\r\n await this.modifyExhaustion(actor); break;\r\n case \"inspiration\":\r\n await this.modifyInspiration(actor); break;\r\n default:\r\n await this.modifyCustomCounter(actor); break;\r\n }\r\n }\r\n\r\n /**\r\n * Modify Exhaustion\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async modifyExhaustion(actor) {\r\n const currentExhaustion = actor.system.attributes.exhaustion;\r\n const newExhaustion = currentExhaustion + (this.isRightClick ? -1 : 1);\r\n if (newExhaustion >= 0 && newExhaustion !== currentExhaustion) {\r\n actor.update({ \"system.attributes.exhaustion\": newExhaustion });\r\n }\r\n }\r\n\r\n /**\r\n * Modify Inspiration\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async modifyInspiration(actor) {\r\n const update = !actor.system.attributes.inspiration;\r\n actor.update({ \"system.attributes.inspiration\": update });\r\n }\r\n\r\n /**\r\n * Modify Custom Counter\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async modifyCustomCounter(actor) {\r\n const { counterKey, counterType } = this.action.system;\r\n\r\n let value = actor.getFlag(CUSTOM_DND5E.ID, counterKey) || {};\r\n\r\n const setFlag = async (key, currentValue, newValue) => {\r\n if (newValue !== currentValue) {\r\n await actor.setFlag(CUSTOM_DND5E.ID, key, newValue);\r\n }\r\n };\r\n\r\n const adjustValue = (key, currentValue = 0, increment = 1) => {\r\n const newValue = this.isRightClick ? Math.max(0, currentValue - increment) : currentValue + increment;\r\n setFlag(key, currentValue, newValue);\r\n };\r\n\r\n switch (counterType) {\r\n case \"checkbox\":\r\n await setFlag(id, !value);\r\n break;\r\n\r\n case \"fraction\":\r\n if (this.isRightClick || (value.max && value.value < value.max) || !value.max) {\r\n adjustValue(`${id}.value`, value.value);\r\n }\r\n break;\r\n\r\n case \"number\":\r\n adjustValue(id, value);\r\n break;\r\n\r\n case \"successFailure\":\r\n value.success = value?.success ?? 0;\r\n value.failure = value?.failure ?? 0;\r\n if (this.isCtrl) {\r\n adjustValue(`${id}.failure`, value.failure);\r\n } else {\r\n adjustValue(`${id}.success`, value.success);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Roll Ability\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 rollAbility(event, actor, actionId) {\r\n if (!actor.system?.abilities) return;\r\n actor.rollAbility(actionId, { event });\r\n }\r\n\r\n /**\r\n * Roll Ability Save\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 rollAbilitySave(event, actor, actionId) {\r\n if (!actor.system?.abilities) return;\r\n actor.rollAbilitySave(actionId, { event });\r\n }\r\n\r\n /**\r\n * Roll Ability Test\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 rollAbilityTest(event, actor, actionId) {\r\n if (!actor.system?.abilities) return;\r\n actor.rollAbilityTest(actionId, { event });\r\n }\r\n\r\n /**\r\n * Roll Death Save\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n */\r\n rollDeathSave(event, actor) {\r\n actor.rollDeathSave({ event });\r\n }\r\n\r\n /**\r\n * Roll Magic Item\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async rollMagicItem(actor) {\r\n const { itemId, effectId } = this.action.system;\r\n\r\n const magicItemActor = await MagicItems.actor(actor.id);\r\n if (!magicItemActor) return;\r\n\r\n // Magicitems module 3.0.0 does not support Item5e#use\r\n magicItemActor.roll(itemId, effectId);\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\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 rollSkill(event, actor, actionId) {\r\n if (!actor.system?.skills) return;\r\n actor.rollSkill(actionId, { event });\r\n }\r\n\r\n /**\r\n * Use Item\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 useItem(event, actor, actionId) {\r\n const item = coreModule.api.Utils.getItem(actor, actionId);\r\n\r\n if (this.#needsRecharge(item)) {\r\n item.rollRecharge();\r\n } else {\r\n item.use({ event, legacy: false });\r\n }\r\n }\r\n\r\n /**\r\n * Needs Recharge\r\n * @private\r\n * @param {object} item\r\n * @returns {boolean}\r\n */\r\n #needsRecharge(item) {\r\n return (item?.system?.uses?.period === \"recharge\" && !(item?.system?.uses?.value > 0));\r\n }\r\n\r\n /**\r\n * Perform utility action\r\n * @param {object} event The event\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 performUtilityAction(event, actor, token, actionId) {\r\n switch (actionId) {\r\n case \"deathSave\":\r\n this.rollDeathSave(event, actor); break;\r\n case \"endTurn\":\r\n if (!token || game.combat?.current?.tokenId !== token.id) break;\r\n await game.combat?.nextTurn(); break;\r\n case \"initiative\":\r\n await this.rollInitiative(actor); break;\r\n case \"inspiration\":\r\n await this.modifyInspiration(actor); break;\r\n case \"longRest\":\r\n actor.longRest(); break;\r\n case \"shortRest\":\r\n actor.shortRest(); break;\r\n }\r\n\r\n // Update HUD\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Roll Initiative\r\n * @param {object} actor The actor\r\n * @private\r\n */\r\n async rollInitiative(actor) {\r\n if (!actor) return;\r\n await actor.rollInitiative({ createCombatants: true });\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Toggle Condition\r\n * @private\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 toggleCondition(actor, token, actionId) {\r\n if (!token) return;\r\n\r\n const statusEffect = CONFIG.statusEffects.find(statusEffect => statusEffect.id === actionId);\r\n const isConvenient = statusEffect?.flags?.[\"dfreds-convenient-effects\"]?.isConvenient\r\n ?? actionId.startsWith(\"Convenient Effect\");\r\n\r\n if (game.dfreds && isConvenient) {\r\n const effectName = statusEffect.name ?? statusEffect.label;\r\n await game.dfreds.effectInterface.toggleEffect(effectName, { overlay: !!this.isRightClick });\r\n } else {\r\n const condition = this.#findCondition(actionId);\r\n if (!condition) return;\r\n\r\n const effect = this.#findEffect(actor, actionId);\r\n if (effect?.disabled) { await effect.delete(); }\r\n\r\n await actor.toggleStatusEffect(condition.id, { overlay: !!this.isRightClick });\r\n }\r\n\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Find condition\r\n * @private\r\n * @param {string} actionId The action id\r\n * @returns {object} The condition\r\n */\r\n #findCondition(actionId) {\r\n return CONFIG.statusEffects.find(effect => effect.id === actionId);\r\n }\r\n\r\n /**\r\n * Find effect\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n * @returns {object} The effect\r\n */\r\n #findEffect(actor, actionId) {\r\n return actor.effects.find(effect => effect.statuses.every(status => status === actionId));\r\n }\r\n\r\n /**\r\n * Toggle Effect\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async toggleEffect(actor, actionId) {\r\n const effect = actor.allApplicableEffects().find(effect => effect.id === actionId);\r\n if (!effect) return;\r\n\r\n if (this.isRightClick && !effect.transfer) {\r\n await effect.delete();\r\n } else {\r\n await effect.update({ disabled: !effect.disabled });\r\n }\r\n\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Handle action hover\r\n * @override\r\n * @param {object} event\r\n */\r\n async handleActionHover(event) {\r\n const types = [\"feature\", \"item\", \"spell\", \"weapon\", \"magicItem\"];\r\n const { actionType, actionId } = this.action.system;\r\n\r\n if (!types.includes(actionType)) return;\r\n\r\n const item = coreModule.api.Utils.getItem(this.actor, actionId);\r\n\r\n if (this.isHover) {\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","import { MODULE } from \"./constants.js\";\r\n\r\n/**\r\n *\r\n * @param updateFunc\r\n */\r\nexport function register(updateFunc) {\r\n game.settings.register(MODULE.ID, \"abbreviateSkills\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.abbreviateSkills.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.abbreviateSkills.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, \"showSlowActions\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showSlowActions.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showSlowActions.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, \"displaySpellInfo\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.displaySpellInfo.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.displaySpellInfo.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, \"showUnchargedItems\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnchargedItems.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnchargedItems.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, \"showUnequippedItems\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItems.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItems.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, \"showUnequippedItemsNpcs\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.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, \"showUnpreparedSpells\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnpreparedSpells.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnpreparedSpells.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, \"showItemsWithoutActivationCosts\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.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 { MagicItemActionHandlerExtender } from \"./magic-items-extender.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 if (coreModule.api.Utils.isModuleActive(\"magic-items-2\")\r\n || coreModule.api.Utils.isModuleActive(\"magicitems\")) {\r\n actionHandler.addActionHandlerExtender(new MagicItemActionHandlerExtender(actionHandler));\r\n }\r\n return actionHandler;\r\n }\r\n\r\n /** @override */\r\n getAvailableRollHandlers() {\r\n let coreTitle = \"Core D&D5e\";\r\n\r\n if (coreModule.api.Utils.isModuleActive(\"midi-qol\")) {\r\n coreTitle += ` [supports ${coreModule.api.Utils.getModuleTitle(\"midi-qol\")}]`;\r\n }\r\n\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\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 the 'Magic Items' module is active, then add a group for it\r\n if (game.modules.get(\"magicitems\")?.active || game.modules.get(\"magic-items-2\")?.active) {\r\n const name = coreModule.api.Utils.i18n(\"tokenActionHud.dnd5e.magicItems\");\r\n defaults.groups.push(\r\n {\r\n id: \"magic-items\",\r\n name,\r\n listName: `Group: ${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","ACTION_TYPE","ability","check","condition","counter","effect","exhaustion","feature","item","save","skill","spell","utility","ACTIVATION_TYPE","action","group","bonus","icon","crew","day","hour","lair","minute","legendary","reaction","reactiondamage","reactionmanual","special","other","CONCENTRATION_ICON","CUSTOM_DND5E","COUNTERS","character","npc","FEATURE_GROUP_IDS","GROUP","_1stLevelSpells","id","name","spellMode","type","_2ndLevelSpells","_3rdLevelSpells","_4thLevelSpells","_5thLevelSpells","_6thLevelSpells","_7thLevelSpells","_8thLevelSpells","_9thLevelSpells","abilities","actions","activeFeatures","artificerInfusions","atWillSpells","backgroundFeatures","bonusActions","cantrips","channelDivinity","checks","classFeatures","combat","conditions","consumables","containers","counters","crewActions","defensiveTactics","eldritchInvocations","elementalDisciplines","equipment","equipped","feats","fightingStyles","huntersPrey","innateSpells","kiAbilities","lairActions","legendaryActions","loot","maneuvers","metamagicOptions","monsterFeatures","multiattacks","otherActions","pactBoons","pactSpells","passiveEffects","passiveFeatures","psionicPowers","raceFeatures","reactions","rests","runes","saves","skills","superiorHuntersDefense","temporaryEffects","token","tools","unequipped","weapons","PREPARED_ICON","PROFICIENCY_LEVEL_ICON","RARITY","common","uncommon","rare","veryRare","artifact","RITUAL_ICON","SPELL_GROUP_IDS","Utils","Hooks","once","async","capitalize","value","replace","text","charAt","toUpperCase","substring","toLowerCase","getSetting","key","defaultValue","game","settings","get","coreModule","api","Logger","debug","setSetting","set","ActionHandler","featureActions","inventoryActions","spellActions","buildSystemActions","groupIds","this","actors","actor","getValidActors","tokens","getValidTokens","items","sortItemsByName","discardSlowItems","abbreviateSkills","displaySpellInfo","showItemsWithoutActivationCosts","showUnchargedItems","showUnequippedItems","showUnpreparedSpells","activationgroupIds","inventorygroupIds","buildCharacterActions","buildVehicleActions","buildMultipleTokenActions","Promise","all","buildConditions","buildEffects","buildFeatures","buildInventory","buildSpells","buildAbilities","buildCombat","buildCounters","buildExhaustion","buildRests","buildSkills","buildUtility","actionType","groupId","system","CONFIG","DND5E","length","Object","entries","filter","map","abilityId","label","mod","icon1","getProficiencyIcon","proficient","info1","getModifier","title","i18n","localize","info2","listName","getListName","addActions","buildActivations","data","groupData","actionData","activationItems","Map","activationType","activities","contents","activation","has","values","groupDataClone","includes","defaultSelected","parentgroupData","addGroup","addGroupInfo","buildActions","combatType","initiative","current","tokenId","endTurn","getControlledTokens","tokenIds","combatants","combatant","getInfo1","class","cssClass","every","actionId","statusEffects","hasCondition","effects","some","statuses","status","disabled","img","getImage","tooltip","getTooltip","getConditionTooltipData","isModuleActive","keys","_","visible","active","attributes","death","success","failure","getFlag","max","counterKey","counterType","allApplicableEffects","size","statusEffectIds","Set","statusEffect","_id","effectId","isSuppressed","parent","identified","user","isGM","isTemporary","featuresMap","featureType","background","monster","race","classFeatureType","artificerInfusion","defensiveTactic","eldritchInvocation","elementalDiscipline","fightingStyle","ki","maneuver","metamagic","multiattack","pact","psionicPower","rune","subType","subtype","inventoryMap","quantity","isActiveItem","isUsableItem","isEquippedItem","shortRest","longRest","total","error","spells","spellsMap","isUsableSpell","preparation","mode","level","systemSpells","reverse","spellSlotsMap","spellSlotAvailable","pactSlotAvailable","pactSlot","hasValue","hasMax","hasLevel","slotAvailable","startsWith","slotsAvailable","spellSlotModes","levelInfo","slots","info","utilityTypes","deathSave","inspiration","hp","utilityType","options","getAction","entity","hasOwn","getItemInfo","getTooltipData","getActivationTypeIcon","icon2","getPreparedIcon","icon3","getConcentrationIcon","info3","activationTypes","activityActivationTypes","uses","preparationModes","spellPreparationModes","preparationMode","prepared","actionName","getSpellInfo","getQuantityData","getUsesData","getConsumeData","components","properties","componentsArray","vocal","somatic","material","ritual","push","join","allowedTypes","per","recovery","period","limitedUsePeriods","perPeriod","spent","firstActivity","firstTarget","consumption","targets","consumeId","target","consumeType","consumeAmount","parentId","substr","lastIndexOf","foundry","utils","getProperty","slowActivationTypes","proficiencyLevels","abilityActivationTypes","tooltipsSetting","unidentified","description","modifiers","rarity","traits","chatProperties","equippableItemCardProperties","labels","range","duration","p","getWeaponProperties","conditionTypes","journalEntry","fromUuid","reference","content","relativeTo","tooltipData","nameHtml","descriptionLocalised","TextEditor","enrichHTML","secrets","rarityHtml","propertiesHtml","property","traitsHtml","trait","traits2Html","traits2","traitsAltHtml","traitsAlt","modifiersHtml","modifier","enabled","tagsJoined","tagsHtml","weaponProperties","selected","validProperties","weapon","itemProperties","MagicItemActionHandlerExtender","ActionHandlerExtender","constructor","actionHandler","super","extendActionHandler","MagicItems","magicItems","parentGroupData","forEach","magicItem","attuned","_isItemAttuned","_isItemEquipped","charges","ownedEntries","entry","baseLevel","encodedValue","itemId","attunment","attunementTypes","REQUIRED","DEFAULTS","groups","groupsArray","layout","nestId","RollHandler","register","updateFunc","hint","scope","config","Boolean","default","onChange","handleActionClick","event","handleAction","rollAbility","rollAbilityTest","rollAbilitySave","toggleCondition","modifyCounter","toggleEffect","modifyExhaustion","isRenderItem","renderItem","useItem","rollMagicItem","rollSkill","performUtilityAction","rollDeathSave","modifyInspiration","modifyCustomCounter","currentExhaustion","newExhaustion","isRightClick","update","setFlag","currentValue","newValue","adjustValue","increment","Math","isCtrl","magicItemActor","roll","callAll","getItem","needsRecharge","rollRecharge","use","legacy","nextTurn","rollInitiative","createCombatants","find","isConvenient","flags","dfreds","effectName","effectInterface","overlay","findCondition","findEffect","delete","toggleStatusEffect","transfer","handleActionHover","isHover","call","SystemManager","getActionHandler","addActionHandlerExtender","getAvailableRollHandlers","coreTitle","getModuleTitle","core","getRollHandler","rollHandlerId","rollHandler","Core","registerSettings","onChangeFunction","systemSettings.register","registerDefaults","defaults","modules","sort","a","b","localeCompare","on","module","requiredCoreModuleVersion"],"mappings":"AAGY,MAACA,EAAS,CACpBC,GAAI,0BAMOC,EAAc,CACzBD,GAAI,yBAMOE,EAA+B,MAK/BC,EAAc,CACzBC,QAAS,gBACTC,MAAO,6BACPC,UAAW,iCACXC,QAAS,+BACTC,OAAQ,eACRC,WAAY,mBACZC,QAAS,kBACTC,KAAM,4BACNC,KAAM,uBACNC,MAAO,6BACPC,MAAO,mBACPC,QAAS,oBAMEC,EAAkB,CAC7BC,OAAQ,CAAEC,MAAO,WACjBC,MAAO,CAAED,MAAO,gBAAiBE,KAAM,eACvCC,KAAM,CAAEH,MAAO,eAAgBE,KAAM,gBACrCE,IAAK,CAAEF,KAAM,wBACbG,KAAM,CAAEH,KAAM,yBACdI,KAAM,CAAEN,MAAO,eAAgBE,KAAM,eACrCK,OAAQ,CAAEL,KAAM,0BAChBM,UAAW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AK,4BAA6BuB,EAAO"}
\ No newline at end of file
+{"version":3,"file":"token-action-hud-dnd5e.min.js","sources":["constants.js","utils.js","action-handler.js","magic-items-extender.js","roll-handler.js","defaults.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-dnd5e\"\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 * Action type\r\n */\r\nexport const ACTION_TYPE = {\r\n ability: \"DND5E.Ability\",\r\n check: \"tokenActionHud.dnd5e.check\",\r\n condition: \"tokenActionHud.dnd5e.condition\",\r\n counter: \"tokenActionHud.dnd5e.counter\",\r\n effect: \"DND5E.Effect\",\r\n exhaustion: \"DND5E.Exhaustion\",\r\n feature: \"TYPES.Item.feat\",\r\n item: \"tokenActionHud.dnd5e.item\",\r\n save: \"DND5E.SAVE.Title.one\",\r\n skill: \"tokenActionHud.dnd5e.skill\",\r\n spell: \"TYPES.Item.spell\",\r\n utility: \"DND5E.ActionUtil\"\r\n};\r\n\r\n/**\r\n * Activation types\r\n */\r\nexport const ACTIVATION_TYPE = {\r\n action: { group: \"actions\" },\r\n bonus: { group: \"bonus-actions\", icon: \"fas fa-plus\" },\r\n crew: { group: \"crew-actions\", icon: \"fas fa-users\" },\r\n day: { icon: \"fas fa-hourglass-end\" },\r\n hour: { icon: \"fas fa-hourglass-half\" },\r\n lair: { group: \"lair-actions\", icon: \"fas fa-home\" },\r\n minute: { icon: \"fas fa-hourglass-start\" },\r\n legendary: { group: \"legendary-actions\", icon: \"fas fas fa-dragon\" },\r\n reaction: { group: \"reactions\", icon: \"fas fa-bolt\" },\r\n reactiondamage: { group: \"reactions\", icon: \"fas fa-bolt\" },\r\n reactionmanual: { group: \"reactions\", icon: \"fas fa-bolt\" },\r\n special: { group: \"special-actions\", icon: \"fas fa-star\" },\r\n other: { group: \"other-actions\" }\r\n};\r\n\r\n/**\r\n * Concentration icon\r\n */\r\nexport const CONCENTRATION_ICON = \"systems/dnd5e/icons/svg/statuses/concentrating.svg\";\r\n\r\nexport const CUSTOM_DND5E = {\r\n ID: \"custom-dnd5e\",\r\n COUNTERS: {\r\n character: \"character-counters\",\r\n group: \"group-counters\",\r\n npc: \"npc-counters\"\r\n }\r\n};\r\n\r\n/**\r\n * Feature Group IDs\r\n */\r\nexport const FEATURE_GROUP_IDS = [\r\n \"activeFeatures\",\r\n \"passiveFeatures\",\r\n \"backgroundFeatures\",\r\n \"classFeatures\",\r\n \"feats\",\r\n \"monsterFeatures\",\r\n \"raceFeatures\",\r\n \"artificerInfusions\",\r\n \"channelDivinity\",\r\n \"defensiveTactics\",\r\n \"eldritchInvocations\",\r\n \"elementalDisciplines\",\r\n \"fightingStyles\",\r\n \"huntersPrey\",\r\n \"kiAbilities\",\r\n \"maneuvers\",\r\n \"metamagicOptions\",\r\n \"multiattacks\",\r\n \"pactBoons\",\r\n \"psionicPowers\",\r\n \"runes\",\r\n \"superiorHuntersDefense\"\r\n];\r\n\r\n/**\r\n * Groups\r\n */\r\nexport const GROUP = {\r\n _1stLevelSpells: { id: \"1st-level-spells\", name: \"tokenActionHud.dnd5e.1stLevelSpells\", spellMode: 1, type: \"system\" },\r\n _2ndLevelSpells: { id: \"2nd-level-spells\", name: \"tokenActionHud.dnd5e.2ndLevelSpells\", spellMode: 2, type: \"system\" },\r\n _3rdLevelSpells: { id: \"3rd-level-spells\", name: \"tokenActionHud.dnd5e.3rdLevelSpells\", spellMode: 3, type: \"system\" },\r\n _4thLevelSpells: { id: \"4th-level-spells\", name: \"tokenActionHud.dnd5e.4thLevelSpells\", spellMode: 4, type: \"system\" },\r\n _5thLevelSpells: { id: \"5th-level-spells\", name: \"tokenActionHud.dnd5e.5thLevelSpells\", spellMode: 5, type: \"system\" },\r\n _6thLevelSpells: { id: \"6th-level-spells\", name: \"tokenActionHud.dnd5e.6thLevelSpells\", spellMode: 6, type: \"system\" },\r\n _7thLevelSpells: { id: \"7th-level-spells\", name: \"tokenActionHud.dnd5e.7thLevelSpells\", spellMode: 7, type: \"system\" },\r\n _8thLevelSpells: { id: \"8th-level-spells\", name: \"tokenActionHud.dnd5e.8thLevelSpells\", spellMode: 8, type: \"system\" },\r\n _9thLevelSpells: { id: \"9th-level-spells\", name: \"tokenActionHud.dnd5e.9thLevelSpells\", spellMode: 9, type: \"system\" },\r\n abilities: { id: \"abilities\", name: \"tokenActionHud.dnd5e.abilities\", type: \"system\" },\r\n actions: { id: \"actions\", name: \"DND5E.ActionPl\", type: \"system\" },\r\n activeFeatures: { id: \"active-features\", name: \"tokenActionHud.dnd5e.activeFeatures\", type: \"system\" },\r\n artificerInfusions: { id: \"artificer-infusions\", name: \"tokenActionHud.dnd5e.artificerInfusions\", type: \"system\" },\r\n atWillSpells: { id: \"at-will-spells\", name: \"tokenActionHud.dnd5e.atWillSpells\", spellMode: \"atwill\", type: \"system\" },\r\n backgroundFeatures: { id: \"background-features\", name: \"tokenActionHud.dnd5e.backgroundFeatures\", type: \"system\" },\r\n bonusActions: { id: \"bonus-actions\", name: \"tokenActionHud.dnd5e.bonusActions\", type: \"system\" },\r\n cantrips: { id: \"cantrips\", name: \"tokenActionHud.dnd5e.cantrips\", spellMode: 0, type: \"system\" },\r\n channelDivinity: { id: \"channel-divinity\", name: \"tokenActionHud.dnd5e.channelDivinity\", type: \"system\" },\r\n checks: { id: \"checks\", name: \"tokenActionHud.dnd5e.checks\", type: \"system\" },\r\n classFeatures: { id: \"class-features\", name: \"tokenActionHud.dnd5e.classFeatures\", type: \"system\" },\r\n combat: { id: \"combat\", name: \"tokenActionHud.combat\", type: \"system\" },\r\n conditions: { id: \"conditions\", name: \"tokenActionHud.dnd5e.conditions\", type: \"system\" },\r\n consumables: { id: \"consumables\", name: \"TYPES.Item.consumablePl\", type: \"system\" },\r\n containers: { id: \"containers\", name: \"TYPES.Item.containerPl\", type: \"system\" },\r\n counters: { id: \"counters\", name: \"tokenActionHud.dnd5e.counters\", type: \"system\" },\r\n crewActions: { id: \"crew-actions\", name: \"tokenActionHud.dnd5e.crewActions\", type: \"system\" },\r\n defensiveTactics: { id: \"defensive-tactics\", name: \"tokenActionHud.dnd5e.defensiveTactics\", type: \"system\" },\r\n eldritchInvocations: { id: \"eldritch-invocations\", name: \"tokenActionHud.dnd5e.eldritchInvocations\", type: \"system\" },\r\n elementalDisciplines: { id: \"elemental-disciplines\", name: \"tokenActionHud.dnd5e.elementalDisciplines\", type: \"system\" },\r\n equipment: { id: \"equipment\", name: \"TYPES.Item.equipmentPl\", type: \"system\" },\r\n equipped: { id: \"equipped\", name: \"DND5E.Equipped\", type: \"system\" },\r\n exhaustion: { id: \"exhaustion\", name: \"DND5E.Exhaustion\", type: \"system\" },\r\n feats: { id: \"feats\", name: \"tokenActionHud.dnd5e.feats\", type: \"system\" },\r\n fightingStyles: { id: \"fighting-styles\", name: \"tokenActionHud.dnd5e.fightingStyles\", type: \"system\" },\r\n huntersPrey: { id: \"hunters-prey\", name: \"tokenActionHud.dnd5e.huntersPrey\", type: \"system\" },\r\n innateSpells: { id: \"innate-spells\", name: \"tokenActionHud.dnd5e.innateSpells\", spellMode: \"innate\", type: \"system\" },\r\n kiAbilities: { id: \"ki-abilities\", name: \"tokenActionHud.dnd5e.kiAbilities\", type: \"system\" },\r\n lairActions: { id: \"lair-actions\", name: \"tokenActionHud.dnd5e.lairActions\", type: \"system\" },\r\n legendaryActions: { id: \"legendary-actions\", name: \"tokenActionHud.dnd5e.legendaryActions\", type: \"system\" },\r\n loot: { id: \"loot\", name: \"TYPES.Item.lootPl\", type: \"system\" },\r\n maneuvers: { id: \"maneuvers\", name: \"tokenActionHud.dnd5e.maneuvers\", type: \"system\" },\r\n metamagicOptions: { id: \"metamagic-options\", name: \"tokenActionHud.dnd5e.metamagicOptions\", type: \"system\" },\r\n monsterFeatures: { id: \"monster-features\", name: \"tokenActionHud.dnd5e.monsterFeatures\", type: \"system\" },\r\n multiattacks: { id: \"multiattacks\", name: \"tokenActionHud.dnd5e.multiattacks\", type: \"system\" },\r\n otherActions: { id: \"other-actions\", name: \"tokenActionHud.dnd5e.otherActions\", type: \"system\" },\r\n pactBoons: { id: \"pact-boons\", name: \"tokenActionHud.dnd5e.pactBoons\", type: \"system\" },\r\n pactSpells: { id: \"pact-spells\", name: \"tokenActionHud.dnd5e.pactSpells\", spellMode: \"pact\", type: \"system\" },\r\n passiveEffects: { id: \"passive-effects\", name: \"DND5E.EffectPassive\", type: \"system\" },\r\n passiveFeatures: { id: \"passive-features\", name: \"tokenActionHud.dnd5e.passiveFeatures\", type: \"system\" },\r\n psionicPowers: { id: \"psionic-powers\", name: \"tokenActionHud.dnd5e.psionicPowers\", type: \"system\" },\r\n raceFeatures: { id: \"race-features\", name: \"tokenActionHud.dnd5e.raceFeatures\", type: \"system\" },\r\n reactions: { id: \"reactions\", name: \"DND5E.ReactionPl\", type: \"system\" },\r\n rests: { id: \"rests\", name: \"tokenActionHud.dnd5e.rests\", type: \"system\" },\r\n runes: { id: \"runes\", name: \"tokenActionHud.dnd5e.runes\", type: \"system\" },\r\n saves: { id: \"saves\", name: \"DND5E.ClassSaves\", type: \"system\" },\r\n skills: { id: \"skills\", name: \"tokenActionHud.dnd5e.skills\", type: \"system\" },\r\n superiorHuntersDefense: { id: \"superior-hunters-defense\", name: \"tokenActionHud.dnd5e.superiorHuntersDefense\", type: \"system\" },\r\n temporaryEffects: { id: \"temporary-effects\", name: \"DND5E.EffectTemporary\", type: \"system\" },\r\n token: { id: \"token\", name: \"tokenActionHud.token\", type: \"system\" },\r\n tools: { id: \"tools\", name: \"TYPES.Item.toolPl\", type: \"system\" },\r\n unequipped: { id: \"unequipped\", name: \"DND5E.Unequipped\", type: \"system\" },\r\n utility: { id: \"utility\", name: \"tokenActionHud.utility\", type: \"system\" },\r\n weapons: { id: \"weapons\", name: \"TYPES.Item.weaponPl\", type: \"system\" }\r\n};\r\n\r\n/**\r\n * Prepared icon\r\n */\r\nexport const PREPARED_ICON = \"fas fa-sun\";\r\n\r\n/**\r\n * Proficiency level icons\r\n */\r\nexport const PROFICIENCY_LEVEL_ICON = {\r\n 0: \"fa-regular fa-circle\",\r\n 0.5: \"fa-regular fa-circle-half-stroke\",\r\n 1: \"fa-solid fa-circle\",\r\n 2: \"fa-regular fa-circle-dot\"\r\n};\r\n\r\n/**\r\n * Rarity\r\n */\r\nexport const RARITY = {\r\n common: \"tokenActionHud.dnd5e.common\",\r\n uncommon: \"tokenActionHud.dnd5e.uncommon\",\r\n rare: \"tokenActionHud.dnd5e.rare\",\r\n veryRare: \"tokenActionHud.dnd5e.veryRare\",\r\n legendary: \"tokenActionHud.dnd5e.legendary\",\r\n artifact: \"tokenActionHud.dnd5e.artifact\"\r\n};\r\n\r\n/**\r\n * Ritual icon\r\n */\r\nexport const RITUAL_ICON = \"fas fa-circle-r\";\r\n\r\n/**\r\n * Spell Group IDs\r\n */\r\nexport const SPELL_GROUP_IDS = [\r\n \"cantrips\",\r\n \"_1stLevelSpells\",\r\n \"_2ndLevelSpells\",\r\n \"_3rdLevelSpells\",\r\n \"_4thLevelSpells\",\r\n \"_5thLevelSpells\",\r\n \"_6thLevelSpells\",\r\n \"_7thLevelSpells\",\r\n \"_8thLevelSpells\",\r\n \"_9thLevelSpells\",\r\n \"atWillSpells\",\r\n \"innateSpells\",\r\n \"pactSpells\"\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 * Capitalize the first letter of every word\r\n * @param {string} value The string to capitalize\r\n * @returns {string} The capitalized string\r\n */\r\n static capitalize(value) {\r\n return value.replace(\r\n /\\w\\S*/g,\r\n text => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase()\r\n );\r\n }\r\n\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 {\r\n ACTIVATION_TYPE, ACTION_TYPE, CONCENTRATION_ICON, CUSTOM_DND5E, FEATURE_GROUP_IDS,\r\n GROUP, PREPARED_ICON, PROFICIENCY_LEVEL_ICON, RARITY, SPELL_GROUP_IDS\r\n} 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 action variables\r\n featureActions = null;\r\n\r\n inventoryActions = null;\r\n\r\n spellActions = null;\r\n\r\n /**\r\n * Build System Actions\r\n * @override\r\n * @param {Array} groupIds\r\n * @returns {object}\r\n */\r\n async buildSystemActions(groupIds) {\r\n // Set actor and token variables\r\n this.actors = (!this.actor) ? this.#getValidActors() : [this.actor];\r\n this.tokens = (!this.token) ? this.#getValidTokens() : [this.token];\r\n\r\n // Set items variable\r\n if (this.actor) {\r\n this.items = coreModule.api.Utils.sortItemsByName(this.#discardSlowItems(this.actor.items));\r\n }\r\n\r\n // Set settings variables\r\n this.abbreviateSkills = Utils.getSetting(\"abbreviateSkills\");\r\n this.displaySpellInfo = Utils.getSetting(\"displaySpellInfo\");\r\n this.showItemsWithoutActivationCosts = Utils.getSetting(\"showItemsWithoutActivationCosts\");\r\n this.showUnchargedItems = Utils.getSetting(\"showUnchargedItems\");\r\n this.showUnequippedItems = Utils.getSetting(\"showUnequippedItems\");\r\n if (this.actor?.type === \"npc\" && !this.showUnequippedItems) {\r\n this.showUnequippedItems = Utils.getSetting(\"showUnequippedItemsNpcs\");\r\n }\r\n this.showUnpreparedSpells = Utils.getSetting(\"showUnpreparedSpells\");\r\n\r\n this.activationgroupIds = [\r\n \"actions\",\r\n \"bonus-actions\",\r\n \"crew-actions\",\r\n \"lair-actions\",\r\n \"legendary-actions\",\r\n \"reactions\",\r\n \"other-actions\"\r\n ];\r\n\r\n if (this.actor?.type === \"character\" || this.actor?.type === \"npc\") {\r\n this.inventorygroupIds = [\r\n \"equipped\",\r\n \"consumables\",\r\n \"containers\",\r\n \"equipment\",\r\n \"loot\",\r\n \"tools\",\r\n \"weapons\",\r\n \"unequipped\"\r\n ];\r\n\r\n await this.#buildCharacterActions();\r\n } else if (this.actor?.type === \"vehicle\") {\r\n this.inventorygroupIds = [\r\n \"consumables\",\r\n \"equipment\",\r\n \"tools\",\r\n \"weapons\"\r\n ];\r\n\r\n await this.#buildVehicleActions();\r\n } else if (!this.actor) {\r\n await this.#buildMultipleTokenActions();\r\n }\r\n }\r\n\r\n /**\r\n * Build character actions\r\n * @private\r\n * @returns {object}\r\n */\r\n async #buildCharacterActions() {\r\n await Promise.all([\r\n this.#buildConditions(),\r\n this.#buildEffects(),\r\n this.#buildFeatures(),\r\n this.#buildInventory(),\r\n this.#buildSpells()\r\n ]);\r\n this.#buildAbilities(\"ability\", \"abilities\");\r\n this.#buildAbilities(\"check\", \"checks\");\r\n this.#buildAbilities(\"save\", \"saves\");\r\n this.#buildCombat();\r\n this.#buildCounters();\r\n this.#buildExhaustion();\r\n this.#buildRests();\r\n this.#buildSkills();\r\n this.#buildUtility();\r\n }\r\n\r\n /**\r\n * Build vehicle actions\r\n * @private\r\n * @returns {object}\r\n */\r\n async #buildVehicleActions() {\r\n await Promise.all([\r\n this.#buildConditions(),\r\n this.#buildEffects(),\r\n this.#buildFeatures(),\r\n this.#buildInventory()\r\n ]);\r\n this.#buildAbilities(\"ability\", \"abilities\");\r\n this.#buildAbilities(\"check\", \"checks\");\r\n this.#buildAbilities(\"save\", \"saves\");\r\n this.#buildCombat();\r\n this.#buildUtility();\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 this.#buildAbilities(\"ability\", \"abilities\");\r\n this.#buildAbilities(\"check\", \"checks\");\r\n this.#buildAbilities(\"save\", \"saves\");\r\n this.#buildCombat();\r\n await this.#buildConditions();\r\n this.#buildRests();\r\n this.#buildSkills();\r\n this.#buildUtility();\r\n }\r\n\r\n /**\r\n * Build abilities\r\n * @private\r\n * @param {string} actionType\r\n * @param {string} groupId\r\n */\r\n #buildAbilities(actionType, groupId) {\r\n // Get abilities and exit if none exist\r\n const abilities = this.actor?.system.abilities || CONFIG.DND5E.abilities;\r\n if (abilities.length === 0) return;\r\n\r\n // Get actions\r\n const actions = Object.entries(abilities)\r\n .filter(ability => abilities[ability[0]].value !== 0)\r\n .map(([abilityId, ability]) => {\r\n const name = CONFIG.DND5E.abilities[abilityId].label;\r\n const mod = (groupId === \"saves\") ? ability?.save : ability?.mod;\r\n return {\r\n id: `${actionType}-${abilityId}`,\r\n name: (this.abbreviateSkills) ? Utils.capitalize(abilityId) : name,\r\n icon1: (groupId !== \"checks\") ? this.#getProficiencyIcon(abilities[abilityId].proficient) : \"\",\r\n info1: (this.actor) ? {\r\n text: coreModule.api.Utils.getModifier(mod),\r\n title: `${game.i18n.localize(\"DND5E.ActionAbil\")}: ${coreModule.api.Utils.getModifier(mod)}`\r\n } : null,\r\n info2: (this.actor && groupId === \"abilities\") ? {\r\n text: `(${coreModule.api.Utils.getModifier(ability?.save)})`,\r\n title: `${game.i18n.localize(\"DND5E.SavingThrow\")}: ${coreModule.api.Utils.getModifier(ability?.save)}`\r\n } : null,\r\n listName: this.#getListName(actionType, name),\r\n system: { actionType, abilityId }\r\n };\r\n });\r\n\r\n // Add actions to action list\r\n this.addActions(actions, { id: groupId });\r\n }\r\n\r\n /**\r\n * Build activations\r\n * @public\r\n * @param {object} data groupData, actionData, actionType\r\n */\r\n async buildActivations(data) {\r\n const { groupData, actionData, actionType = \"item\" } = data;\r\n\r\n // Create map of items according to activation type\r\n const activationItems = new Map();\r\n\r\n // Loop items and add to activationItems\r\n for (const [key, value] of actionData) {\r\n const activationType = value.system?.activities?.contents[0]?.activation?.type;\r\n const groupId = ACTIVATION_TYPE[activationType]?.group ?? \"other\";\r\n if (!activationItems.has(groupId)) activationItems.set(groupId, new Map());\r\n activationItems.get(groupId).set(key, value);\r\n }\r\n\r\n // Loop through action group ids\r\n for (const value of Object.values(ACTIVATION_TYPE)) {\r\n const group = value.group;\r\n\r\n // Skip if no items exist\r\n if (!activationItems.has(group)) continue;\r\n\r\n // Clone and add to group data\r\n const groupDataClone = { ...groupData, id: `${group}+${groupData.id}`, type: \"system-derived\" };\r\n\r\n // Set Equipped and Unequipped groups to not selected by default\r\n if ([\"equipped\", \"unequipped\"].includes(groupData.id)) { groupDataClone.defaultSelected = false; }\r\n\r\n // Create parent group data\r\n const parentgroupData = { id: group, type: \"system\" };\r\n\r\n // Add group to HUD\r\n await this.addGroup(groupDataClone, parentgroupData);\r\n\r\n // Add spell slot info to group\r\n if (actionType === \"spell\") { this.addGroupInfo(groupDataClone); }\r\n\r\n // Build actions\r\n await this.buildActions({\r\n groupData: groupDataClone,\r\n actionData: activationItems.get(group),\r\n actionType\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Build combat\r\n * @private\r\n */\r\n #buildCombat() {\r\n // If token's turn, include endTurn\r\n const combatType = {\r\n initiative: \"tokenActionHud.dnd5e.rollInitiative\",\r\n ...(game.combat?.current?.tokenId !== this.token?.id && { endTurn: \"tokenActionHud.endTurn\" })\r\n };\r\n\r\n const tokens = coreModule.api.Utils.getControlledTokens();\r\n const tokenIds = tokens?.map(token => token.id);\r\n const combatants = (game.combat)\r\n ? game.combat.combatants.filter(combatant => tokenIds.includes(combatant.tokenId))\r\n : [];\r\n\r\n const getInfo1 = id => {\r\n if (id === \"initiative\" && combatants.length === 1) {\r\n const currentInitiative = combatants[0].initiative;\r\n return { class: \"tah-spotlight\", text: currentInitiative };\r\n }\r\n return {};\r\n };\r\n\r\n const getActive = () => { return combatants.length > 0 && (combatants.every(combatant => combatant?.initiative)) ? \" active\" : \"\";};\r\n\r\n // Get actions\r\n const actionType = \"utility\";\r\n const actions = Object.entries(combatType).map(([id, name]) => {\r\n return {\r\n id,\r\n name: game.i18n.localize(name),\r\n info1: getInfo1(id),\r\n cssClass: (id === \"initiative\" ) ? `toggle${getActive()}` : \"\",\r\n listName: this.#getListName(actionType, name),\r\n system: { actionType, actionId: id }\r\n };\r\n });\r\n\r\n // Add actions to HUD\r\n this.addActions(actions, { id: \"combat\" });\r\n }\r\n\r\n /**\r\n * Build conditions\r\n * @private\r\n */\r\n async #buildConditions() {\r\n if (this.tokens?.length === 0) return;\r\n\r\n // Get conditions and exit if none exist\r\n const conditions = CONFIG.statusEffects.filter(condition => condition.id !== \"\");\r\n if (conditions.length === 0) return;\r\n\r\n // Get actions\r\n const actionType = \"condition\";\r\n const actions = await Promise.all(conditions.map(async condition => {\r\n const hasCondition = this.actors.every(actor => {\r\n return actor.effects.some(effect => effect.statuses.some(status => status === condition.id)\r\n && !effect?.disabled);\r\n });\r\n const name = game.i18n.localize(condition.label) ?? condition.name;\r\n return {\r\n id: condition.id,\r\n name,\r\n img: coreModule.api.Utils.getImage(condition),\r\n cssClass: `toggle${(hasCondition) ? \" active\" : \"\"}`,\r\n listName: this.#getListName(actionType, name),\r\n tooltip: await this.#getTooltip(await this.#getConditionTooltipData(condition.id, condition.name)),\r\n system: { actionType, actionId: condition.id }\r\n };\r\n }));\r\n\r\n // Add actions to HUD\r\n this.addActions(actions, { id: \"conditions\" });\r\n }\r\n\r\n /**\r\n * Build counters\r\n * @private\r\n */\r\n async #buildCounters() {\r\n if (!coreModule.api.Utils.isModuleActive(CUSTOM_DND5E.ID)\r\n || !CUSTOM_DND5E.COUNTERS[this.actor?.type]) return;\r\n\r\n const actionType = \"counter\";\r\n\r\n let counters = game.settings.get(CUSTOM_DND5E.ID, CUSTOM_DND5E.COUNTERS[this.actor?.type]) ?? {};\r\n\r\n if (coreModule.api.Utils.isModuleActive(CUSTOM_DND5E.ID) && Object.keys(counters).length) {\r\n counters = Object.entries(counters)\r\n .filter(([_, value]) => value.visible)\r\n .map(([key, value]) => {\r\n value.key = key;\r\n return value;\r\n });\r\n } else {\r\n counters = [\r\n {\r\n name: game.i18n.localize(\"DND5E.DeathSave\"),\r\n type: \"successFailure\",\r\n system: true,\r\n visible: true,\r\n key: \"death-saves\"\r\n },\r\n {\r\n name: game.i18n.localize(\"DND5E.Exhaustion\"),\r\n type: \"number\",\r\n system: true,\r\n visible: true,\r\n key: \"exhaustion\"\r\n },\r\n {\r\n name: game.i18n.localize(\"DND5E.Inspiration\"),\r\n type: \"checkbox\",\r\n system: true,\r\n visible: true,\r\n key: \"inspiration\"\r\n }\r\n ];\r\n }\r\n\r\n // Get actions\r\n const actions = counters.map(counter => {\r\n let active = \"\";\r\n let cssClass = \"\";\r\n let img = \"\";\r\n let info1 = \"\";\r\n if (counter.system) {\r\n switch (counter.key) {\r\n case \"exhaustion\":\r\n active = (this.actor.system.attributes.exhaustion > 0) ? \" active\" : \"\";\r\n cssClass = `toggle${active}`;\r\n img = coreModule.api.Utils.getImage(\"modules/token-action-hud-dnd5e/icons/exhaustion.svg\");\r\n info1 = { text: this.actor.system.attributes.exhaustion };\r\n break;\r\n case \"death-saves\":\r\n img = coreModule.api.Utils.getImage(\"modules/token-action-hud-dnd5e/icons/death-saves.svg\");\r\n info1 = { text: `${this.actor.system.attributes.death.success}/${this.actor.system.attributes.death.failure}` };\r\n break;\r\n case \"inspiration\":\r\n active = (this.actor.system.attributes.inspiration) ? \" active\" : \"\";\r\n cssClass = `toggle${active}`;\r\n img = coreModule.api.Utils.getImage(\"modules/token-action-hud-dnd5e/icons/inspiration.svg\");\r\n break;\r\n }\r\n } else {\r\n const value = this.actor.getFlag(CUSTOM_DND5E.ID, counter.key);\r\n switch (counter.type) {\r\n case \"checkbox\":\r\n active = (value) ? \" active\" : \"\";\r\n cssClass = `toggle${active}`;\r\n break;\r\n case \"fraction\":\r\n active = (value.value > 0) ? \" active\" : \"\";\r\n cssClass = `toggle${active}`;\r\n info1 = { text: `${value.value ?? 0}/${value.max ?? 0}` };\r\n break;\r\n case \"number\":\r\n active = (value > 0) ? \" active\" : \"\";\r\n cssClass = `toggle${active}`;\r\n info1 = { text: value };\r\n break;\r\n case \"successFailure\":\r\n info1 = { text: `${value?.success ?? 0}/${value?.failure ?? 0}` };\r\n break;\r\n }\r\n }\r\n\r\n return {\r\n id: counter.key,\r\n name: counter.label,\r\n listName: this.#getListName(actionType, counter.name),\r\n cssClass,\r\n img,\r\n info1,\r\n system: { actionType, counterKey: counter.key, counterType: counter.type}\r\n };\r\n });\r\n\r\n // Add actions to HUD\r\n this.addActions(actions, { id: \"counters\" });\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 and exit if none exist\r\n const effects = new Map(this.actor.allApplicableEffects().map(effect => [effect.id, effect]));\r\n if (effects.size === 0) return;\r\n\r\n // Map passive and temporary effects to new maps\r\n const passiveEffects = new Map();\r\n const temporaryEffects = new Map();\r\n const statusEffectIds = new Set(CONFIG.statusEffects.map(statusEffect => statusEffect._id));\r\n\r\n // Iterate effects and add to a map based on the isTemporary value\r\n for (const [effectId, effect] of effects.entries()) {\r\n if (effect.isSuppressed) continue;\r\n if (effect.parent?.system?.identified === false && !game.user.isGM) continue;\r\n if (statusEffectIds.has(effect.id)) continue;\r\n\r\n if (effect.isTemporary) { temporaryEffects.set(effectId, effect); }\r\n else { passiveEffects.set(effectId, effect); }\r\n }\r\n\r\n // Build passive and temporary effects\r\n await Promise.all([\r\n this.buildActions({ groupData: { id: \"passive-effects\" }, actionData: passiveEffects, actionType }),\r\n this.buildActions({ groupData: { id: \"temporary-effects\" }, actionData: temporaryEffects, actionType })\r\n ]);\r\n }\r\n\r\n /**\r\n * Build exhaustion\r\n * @private\r\n */\r\n #buildExhaustion() {\r\n // Exit if every actor is not the character type\r\n if (!this.actors.every(actor => actor.type === \"character\")) return;\r\n\r\n // Get actions\r\n const actionType = \"exhaustion\";\r\n const active = this.actor.system.attributes.exhaustion > 0 ? \" active\" : \"\";\r\n const actions = [{\r\n id: \"exhaustion\",\r\n name: game.i18n.localize(\"DND5E.Exhaustion\"),\r\n cssClass: `toggle${active}`,\r\n img: coreModule.api.Utils.getImage(\"modules/token-action-hud-dnd5e/icons/exhaustion.svg\"),\r\n info1: { text: this.actor.system.attributes.exhaustion },\r\n listName: this.#getListName(actionType, name),\r\n system: { actionType, actionId: \"exhaustion\" }\r\n }];\r\n\r\n // Add actions to HUD\r\n this.addActions(actions, { id: \"exhaustion\" });\r\n }\r\n\r\n /**\r\n * Build features\r\n * @private\r\n */\r\n async #buildFeatures() {\r\n // Filter feats from items and exit if none exist\r\n const feats = new Map([...this.items].filter(([, value]) => value.type === \"feat\"));\r\n if (feats.size === 0) return;\r\n\r\n // Map active and passive features to new maps\r\n const featuresMap = new Map([\r\n [\"activeFeatures\", new Map()],\r\n [\"passiveFeatures\", new Map()]\r\n ]);\r\n\r\n const featureType = {\r\n background: \"backgroundFeatures\",\r\n class: \"classFeatures\",\r\n monster: \"monsterFeatures\",\r\n race: \"raceFeatures\",\r\n feats: \"feats\"\r\n };\r\n\r\n const classFeatureType = {\r\n artificerInfusion: \"artificerInfusions\",\r\n channelDivinity: \"channelDivinity\",\r\n defensiveTactic: \"defensiveTactics\",\r\n eldritchInvocation: \"eldritchInvocations\",\r\n elementalDiscipline: \"elementalDisciplines\",\r\n fightingStyle: \"fightingStyles\",\r\n huntersPrey: \"huntersPrey\",\r\n ki: \"kiAbilities\",\r\n maneuver: \"maneuvers\",\r\n metamagic: \"metamagicOptions\",\r\n multiattack: \"multiattacks\",\r\n pact: \"pactBoons\",\r\n psionicPower: \"psionicPowers\",\r\n rune: \"runes\",\r\n superiorHuntersDefense: \"superiorHuntersDefense\"\r\n };\r\n\r\n for (const [key, value] of feats) {\r\n const activationType = value.system.activities.contents[0]?.type;\r\n const type = value.system.type.value;\r\n const subType = value.system.type?.subtype;\r\n\r\n if (activationType) { featuresMap.get(\"activeFeatures\").set(key, value); }\r\n else { featuresMap.get(\"passiveFeatures\").set(key, value); }\r\n\r\n // Map feature types\r\n if (featureType[type]) {\r\n if (!featuresMap.has(featureType[type])) featuresMap.set(featureType[type], new Map());\r\n featuresMap.get(featureType[type]).set(key, value);\r\n }\r\n\r\n // Map class feature subtypes\r\n if (classFeatureType[subType]) {\r\n if (!featuresMap.has(classFeatureType[subType])) featuresMap.set(classFeatureType[subType], new Map());\r\n featuresMap.get(classFeatureType[subType]).set(key, value);\r\n }\r\n }\r\n\r\n // Loop through inventory groups ids\r\n for (const id of FEATURE_GROUP_IDS) {\r\n const actionData = featuresMap.get(id);\r\n if (!actionData || actionData.size === 0) continue;\r\n\r\n // Create group data\r\n const groupData = {\r\n id: GROUP[id].id,\r\n name: game.i18n.localize(GROUP[id].name) ?? \"\"\r\n };\r\n\r\n // Build actions and activations\r\n const actionType = \"feature\";\r\n await this.buildActions({ groupData, actionData, actionType });\r\n await this.buildActivations({ groupData, actionData, actionType });\r\n }\r\n }\r\n\r\n /**\r\n * Build inventory\r\n * @private\r\n */\r\n async #buildInventory() {\r\n // Exit early if no items exist\r\n if (this.items.size === 0) return;\r\n\r\n // Initialize inventory map categories\r\n const inventoryMap = new Map([\r\n [\"equipped\", new Map()],\r\n [\"unequipped\", new Map()],\r\n [\"consumables\", new Map()],\r\n [\"containers\", new Map()],\r\n [\"equipment\", new Map()],\r\n [\"loot\", new Map()],\r\n [\"tools\", new Map()],\r\n [\"weapons\", new Map()]\r\n ]);\r\n\r\n for (const [key, value] of this.items) {\r\n // Set items into maps\r\n if (value.system?.quantity > 0 && this.#isActiveItem(value)) {\r\n if (value.system.equipped) { inventoryMap.get(\"equipped\").set(key, value); }\r\n else { inventoryMap.get(\"unequipped\").set(key, value); }\r\n\r\n if (this.#isUsableItem(value) && value.type === \"consumable\") inventoryMap.get(\"consumables\").set(key, value);\r\n if (this.#isEquippedItem(value)) {\r\n switch (value.type) {\r\n case \"container\": inventoryMap.get(\"containers\").set(key, value); break;\r\n case \"equipment\": inventoryMap.get(\"equipment\").set(key, value); break;\r\n case \"loot\": inventoryMap.get(\"loot\").set(key, value); break;\r\n case \"tool\": inventoryMap.get(\"tools\").set(key, value); break;\r\n case \"weapon\": inventoryMap.get(\"weapons\").set(key, value); break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Loop through inventory subcateogry ids\r\n for (const groupId of this.inventorygroupIds) {\r\n const actionData = inventoryMap.get(groupId);\r\n if (!actionData || actionData.size === 0) continue;\r\n\r\n // Create group data\r\n const groupData = {\r\n id: groupId,\r\n name: game.i18n.localize(GROUP[groupId].name)\r\n };\r\n\r\n const data = { groupData, actionData };\r\n\r\n // Build actions and activations\r\n await this.buildActions(data);\r\n await this.buildActivations(data);\r\n }\r\n }\r\n\r\n /**\r\n * Build rests\r\n * @private\r\n */\r\n #buildRests() {\r\n // Exit if every actor is not the character type\r\n if (this.actors.length === 0 || !this.actors.every(actor => actor.type === \"character\")) return;\r\n\r\n // Get actions\r\n const actionType = \"utility\";\r\n const restTypes = { shortRest: \"DND5E.ShortRest\", longRest: \"DND5E.LongRest\" };\r\n const actions = Object.entries(restTypes).map(([id, name]) => {\r\n name = game.i18n.localize(name);\r\n return {\r\n id,\r\n name,\r\n listName: this.#getListName(actionType, name),\r\n system: { actionType, actionId: id }\r\n };\r\n });\r\n\r\n // Add actions to HUD\r\n this.addActions(actions, { id: \"rests\" });\r\n }\r\n\r\n /**\r\n * Build skills\r\n * @private\r\n */\r\n #buildSkills() {\r\n // Get skills and exit if none exist\r\n const skills = this.actor?.system.skills || CONFIG.DND5E.skills;\r\n if (skills.length === 0) return;\r\n\r\n // Get actions\r\n const actionType = \"skill\";\r\n const actions = Object.entries(skills).map(([id, skill]) => {\r\n try {\r\n const name = CONFIG.DND5E.skills[id].label;\r\n return {\r\n id,\r\n name: this.abbreviateSkills ? Utils.capitalize(id) : name,\r\n icon1: this.#getProficiencyIcon(skill.value),\r\n info1: (this.actor) ? { text: coreModule.api.Utils.getModifier(skill.total) } : \"\",\r\n listName: this.#getListName(actionType, name),\r\n system: { actionType, actionId: id }\r\n };\r\n } catch(error) {\r\n coreModule.api.Logger.error(skill);\r\n return null;\r\n }\r\n }).filter(skill => !!skill);\r\n\r\n // Add actions to HUD\r\n this.addActions(actions, { id: \"skills\" });\r\n }\r\n\r\n /**\r\n * Build spells\r\n */\r\n async #buildSpells() {\r\n // Filter items for spells and exit if none exist\r\n const spells = new Map([...this.items].filter(([, value]) => value.type === \"spell\"));\r\n if (spells.size === 0) return;\r\n\r\n // Initialize spells map categories\r\n const spellsMap = new Map([\r\n [\"atWillSpells\", new Map()],\r\n [\"innateSpells\", new Map()],\r\n [\"pactSpells\", new Map()],\r\n [\"cantrips\", new Map()],\r\n [\"_1stLevelSpells\", new Map()],\r\n [\"_2ndLevelSpells\", new Map()],\r\n [\"_3rdLevelSpells\", new Map()],\r\n [\"_4thLevelSpells\", new Map()],\r\n [\"_5thLevelSpells\", new Map()],\r\n [\"_6thLevelSpells\", new Map()],\r\n [\"_7thLevelSpells\", new Map()],\r\n [\"_8thLevelSpells\", new Map()],\r\n [\"_9thLevelSpells\", new Map()]\r\n ]);\r\n\r\n // Loop through items\r\n for (const [key, value] of spells) {\r\n if (!this.#isUsableItem(value) || !this.#isUsableSpell(value)) continue;\r\n\r\n switch (value.system.preparation.mode) {\r\n case \"atwill\":\r\n spellsMap.get(\"atWillSpells\").set(key, value); break;\r\n case \"innate\":\r\n spellsMap.get(\"innateSpells\").set(key, value); break;\r\n case \"pact\":\r\n spellsMap.get(\"pactSpells\").set(key, value); break;\r\n default: {\r\n switch (value.system.level) {\r\n case 0:\r\n spellsMap.get(\"cantrips\").set(key, value); break;\r\n case 1:\r\n spellsMap.get(\"_1stLevelSpells\").set(key, value); break;\r\n case 2:\r\n spellsMap.get(\"_2ndLevelSpells\").set(key, value); break;\r\n case 3:\r\n spellsMap.get(\"_3rdLevelSpells\").set(key, value); break;\r\n case 4:\r\n spellsMap.get(\"_4thLevelSpells\").set(key, value); break;\r\n case 5:\r\n spellsMap.get(\"_5thLevelSpells\").set(key, value); break;\r\n case 6:\r\n spellsMap.get(\"_6thLevelSpells\").set(key, value); break;\r\n case 7:\r\n spellsMap.get(\"_7thLevelSpells\").set(key, value); break;\r\n case 8:\r\n spellsMap.get(\"_8thLevelSpells\").set(key, value); break;\r\n case 9:\r\n spellsMap.get(\"_9thLevelSpells\").set(key, value); break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Reverse sort spell slots by level\r\n const systemSpells = Object.entries(this.actor.system.spells).reverse();\r\n\r\n // Set spell slot availability\r\n const spellSlotsMap = new Map();\r\n let spellSlotAvailable = this.showUnchargedItems;\r\n let pactSlotAvailable = this.showUnchargedItems;\r\n let pactSlot = null;\r\n\r\n for (const [key, value] of systemSpells) {\r\n const hasValue = value.value > 0;\r\n const hasMax = value.max > 0;\r\n const hasLevel = value.level > 0;\r\n\r\n if (key === \"pact\") {\r\n pactSlotAvailable = pactSlotAvailable || (hasValue && hasMax && hasLevel);\r\n value.slotAvailable = pactSlotAvailable && hasLevel;\r\n pactSlot = [key, value];\r\n } else if (key.startsWith(\"spell\") && key !== \"spell0\") {\r\n spellSlotAvailable = spellSlotAvailable || (hasValue && hasMax);\r\n value.slotAvailable = spellSlotAvailable;\r\n spellSlotsMap.set(key, value);\r\n } else if (hasValue) {\r\n value.slotsAvailable = true;\r\n spellSlotsMap.set(key, value);\r\n }\r\n }\r\n\r\n // Set equivalent spell slot where pact slot is available\r\n if (pactSlot[1].slotAvailable) {\r\n const spellSlot = spellSlotsMap.get(`spell${pactSlot[1].level}`);\r\n spellSlot.slotsAvailable = true;\r\n }\r\n\r\n const spellSlotModes = new Set([1, 2, 3, 4, 5, 6, 7, 8, 9, \"pact\"]);\r\n\r\n for (const id of SPELL_GROUP_IDS) {\r\n // Skip if no spells exist\r\n if (!spellsMap.has(id)) continue;\r\n\r\n const spellMode = GROUP[id].spellMode;\r\n const levelInfo = (spellMode === \"pact\") ? pactSlot[1] : spellSlotsMap.get(`spell${spellMode}`);\r\n const { value: slots = 0, max = 0, slotAvailable = false } = levelInfo || {};\r\n\r\n // Skip if spells require spell slots and none are available\r\n if (!slotAvailable && spellSlotModes.has(spellMode)) continue;\r\n\r\n // Create group data\r\n const groupData = {\r\n id: GROUP[id].id,\r\n name: game.i18n.localize(GROUP[id].name),\r\n info: { info1: { class: \"tah-spotlight\", text: (max > 0) ? `${slots}/${max}` : \"\" } }\r\n };\r\n\r\n // Add spell slot info to group\r\n this.addGroupInfo(groupData);\r\n\r\n const data = { groupData, actionData: spellsMap.get(id), actionType: \"spell\" };\r\n\r\n // Build actions and activations\r\n await this.buildActions(data);\r\n await this.buildActivations(data);\r\n }\r\n }\r\n\r\n /**\r\n * Build utility\r\n * @private\r\n */\r\n #buildUtility() {\r\n // Exit if every actor is not the character type\r\n if (this.actors.length === 0) return;\r\n if (!this.actors.every(actor => actor.type === \"character\")) return;\r\n\r\n const actionType = \"utility\";\r\n\r\n // Set utility types\r\n const utilityTypes = {\r\n deathSave: { name: game.i18n.localize(\"DND5E.DeathSave\") },\r\n inspiration: { name: game.i18n.localize(\"DND5E.Inspiration\") }\r\n };\r\n\r\n // Delete 'deathSave' for multiple tokens\r\n if (!this.actor || this.actor.system.attributes.hp.value > 0) delete utilityTypes.deathSave;\r\n\r\n // Get actions\r\n const actions = Object.entries(utilityTypes)\r\n .map(utilityType => {\r\n const id = utilityType[0];\r\n const name = utilityType[1].name;\r\n let cssClass = \"\";\r\n if (utilityType[0] === \"inspiration\") {\r\n const active = this.actors.every(actor => actor.system.attributes?.inspiration)\r\n ? \" active\"\r\n : \"\";\r\n cssClass = `toggle${active}`;\r\n }\r\n return {\r\n id,\r\n name,\r\n cssClass,\r\n listName: this.#getListName(actionType, name),\r\n system: { actionType, actionId: id }\r\n };\r\n });\r\n\r\n // Crreate group data\r\n const groupData = { id: \"utility\" };\r\n\r\n // Add actions to HUD\r\n this.addActions(actions, groupData);\r\n }\r\n\r\n /**\r\n * Build actions\r\n * @public\r\n * @param {object} data actionData, groupData, actionType\r\n * @param {object} options\r\n */\r\n async buildActions(data, options) {\r\n const { actionData, groupData, actionType } = data;\r\n\r\n // Exit if there is no action data\r\n if (actionData.size === 0) return;\r\n\r\n // Exit if there is no groupId\r\n const groupId = (typeof groupData === \"string\" ? groupData : groupData?.id);\r\n if (!groupId) return;\r\n\r\n // Get actions\r\n const actions = await Promise.all([...actionData].map(async item => await this.#getAction(item[1], actionType)));\r\n\r\n // Add actions to action list\r\n this.addActions(actions, groupData);\r\n }\r\n\r\n /**\r\n * Get action\r\n * @private\r\n * @param {object} entity The entity\r\n * @param {string} actionType The action type\r\n * @returns {object} The action\r\n */\r\n async #getAction(entity, actionType = \"item\") {\r\n const id = entity.id ?? entity._id;\r\n let name = entity?.name ?? entity?.label;\r\n let cssClass = \"\";\r\n if (Object.hasOwn(entity, \"disabled\")) {\r\n const active = (!entity.disabled) ? \" active\" : \"\";\r\n cssClass = `toggle${active}`;\r\n }\r\n const info = this.#getItemInfo(entity);\r\n const tooltip = await this.#getTooltip(await this.#getTooltipData(entity));\r\n return {\r\n id,\r\n name,\r\n cssClass,\r\n img: coreModule.api.Utils.getImage(entity),\r\n icon1: this.#getActivationTypeIcon(entity.system?.activities?.contents[0]?.activation.type),\r\n icon2: this.#getPreparedIcon(entity),\r\n icon3: this.#getConcentrationIcon(entity),\r\n info1: info?.info1,\r\n info2: info?.info2,\r\n info3: info?.info3,\r\n listName: this.#getListName(actionType, name),\r\n tooltip,\r\n system: { actionType, actionId: id }\r\n };\r\n }\r\n\r\n /**\r\n * Is active item\r\n * @private\r\n * @param {object} item The item\r\n * @returns {boolean} Whether the item is active\r\n */\r\n #isActiveItem(item) {\r\n if (this.showItemsWithoutActivationCosts) return true;\r\n const activationTypes = new Set(Object.keys(CONFIG.DND5E.activityActivationTypes).filter(activationType => activationType !== \"none\"));\r\n const activationType = item.system?.activities?.contents[0]?.activation?.type;\r\n return activationTypes.has(activationType) || item.type === \"tool\";\r\n }\r\n\r\n /**\r\n * Is equipped item\r\n * @private\r\n * @param {object} item The item\r\n * @returns {boolean} Whether the item is equipped\r\n */\r\n #isEquippedItem(item) {\r\n const excludedTypes = [\"consumable\", \"spell\", \"feat\"];\r\n return (this.showUnequippedItems && !excludedTypes.includes(item.type))\r\n || (item.system.equipped && item.type !== \"consumable\");\r\n }\r\n\r\n /**\r\n * Is usable item\r\n * @private\r\n * @param {object} item The item\r\n * @returns {boolean} Whether the item is usable\r\n */\r\n #isUsableItem(item) {\r\n return this.showUnchargedItems || !!item.system.uses?.value || !item.system.uses?.max;\r\n }\r\n\r\n /**\r\n * Is usable spell\r\n * @private\r\n * @param {object} spell The spell\r\n * @returns {boolean} Whether the spell is usable\r\n */\r\n #isUsableSpell(spell) {\r\n if (this.actor?.type !== \"character\" && this.showUnequippedItems) return true;\r\n if (this.showUnpreparedSpells) return true;\r\n\r\n const preparationModes = new Set(Object.keys(CONFIG.DND5E.spellPreparationModes).filter(preparationMode => preparationMode !== \"prepared\"));\r\n\r\n // Return true if the spell has a preparation mode other than 'prepared' or is prepared\r\n return preparationModes.has(spell.system.preparation.mode) || spell.system.preparation.prepared;\r\n }\r\n\r\n #getListName(actionType, actionName) {\r\n const prefix = `${game.i18n.localize(ACTION_TYPE[actionType])}: ` ?? \"\";\r\n return `${prefix}${actionName}` ?? \"\";\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 info1 = item.type === \"spell\" ? this.#getSpellInfo(item) : this.#getQuantityData(item);\r\n const info2 = this.#getUsesData(item);\r\n const info3 = this.#getConsumeData(item);\r\n\r\n return { info1, info2, info3 };\r\n }\r\n\r\n /**\r\n * Add spell info\r\n * @private\r\n * @param {object} spell The spell\r\n * @returns {object} The spell info\r\n */\r\n #getSpellInfo(spell) {\r\n if (!this.displaySpellInfo) return null;\r\n\r\n const components = spell.system?.properties;\r\n if (!components) return null;\r\n\r\n const info = { text: \"\", title: \"\" };\r\n const componentTypes = {\r\n vocal: \"DND5E.ComponentVerbal\",\r\n somatic: \"DND5E.ComponentSomatic\",\r\n material: \"DND5E.ComponentMaterial\"\r\n };\r\n\r\n\r\n const componentsArray = Object.entries(componentTypes)\r\n .filter(([key]) => components[key])\r\n .map(([key, label]) => {\r\n info.text += game.i18n.localize(`${label}Abbr`);\r\n return game.i18n.localize(label);\r\n });\r\n\r\n // Ritual\r\n if (components.ritual) {\r\n componentsArray.push(`[${game.i18n.localize(\"DND5E.Ritual\")}]`);\r\n info.text += ` [${game.i18n.localize(\"DND5E.RitualAbbr\")}]`;\r\n }\r\n\r\n info.title = componentsArray.join(\", \");\r\n\r\n return info;\r\n }\r\n\r\n /**\r\n * Get valid actors\r\n * @private\r\n * @returns {object}\r\n */\r\n #getValidActors() {\r\n const allowedTypes = [\"character\", \"npc\"];\r\n return this.actors.every(actor => allowedTypes.includes(actor.type)) ? this.actors : [];\r\n }\r\n\r\n /**\r\n * Get valid tokens\r\n * @private\r\n * @returns {object}\r\n */\r\n #getValidTokens() {\r\n const allowedTypes = [\"character\", \"npc\"];\r\n return this.actors.every(actor => allowedTypes.includes(actor.type)) ? this.tokens : [];\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 ?? 0;\r\n return {\r\n text: (quantity > 1) ? quantity : \"\",\r\n title: `${game.i18n.localize(\"DND5E.Quantity\")}: ${quantity}`\r\n };\r\n }\r\n\r\n /**\r\n * Get uses\r\n * @private\r\n * @param {object} item\r\n * @returns {string}\r\n */\r\n #getUsesData(item) {\r\n const uses = item?.system?.uses;\r\n if (!(uses?.max > 0)) return {};\r\n const per = uses.recovery[0]?.period === \"charges\" ? \"\" : ` ${game.i18n.localize(\"DND5E.per\")} `;\r\n const period = CONFIG.DND5E.limitedUsePeriods[uses.recovery[0]?.period]?.label ?? uses.recovery[0]?.period;\r\n const perPeriod = (period) ? `${per}${period}` : \"\";\r\n const remainingUses = uses.max - (uses.spent ?? 0);\r\n const text = `${remainingUses}/${uses.max}`;\r\n const title = `${text}${perPeriod}`;\r\n return { text, title };\r\n }\r\n\r\n /**\r\n * Get consume\r\n * @private\r\n * @param {object} item\r\n * @returns {string}\r\n */\r\n #getConsumeData(item) {\r\n // Get consume target and type\r\n const firstActivity = item?.system?.activities?.contents[0];\r\n const firstTarget = firstActivity?.consumption?.targets?.[0];\r\n const consumeId = firstTarget?.target;\r\n const consumeType = firstTarget?.type;\r\n const consumeAmount = firstTarget?.value;\r\n\r\n if (!consumeId || !consumeType || consumeId === item.id) return {};\r\n\r\n // Return resources\r\n if (consumeType === \"attribute\") {\r\n const parentId = consumeId.substr(0, consumeId.lastIndexOf(\".\"));\r\n const target = foundry.utils.getProperty(this.actor.system, parentId);\r\n\r\n if (target) {\r\n const text = `${target.value ?? \"0\"}${target.max ? `/${target.max}` : \"\"}`;\r\n return {\r\n text,\r\n title: `${text} ${target.label ?? \"\"}`\r\n };\r\n }\r\n } else {\r\n const target = this.actor.items?.get(consumeId);\r\n\r\n // Return charges\r\n if (target && consumeType === \"charges\") {\r\n return this.#getUsesData(target);\r\n }\r\n\r\n // Return quantity\r\n if (target?.system?.quantity) {\r\n const text = `${consumeAmount > 1 ? `${consumeAmount} ${game.i18n.localize(\"DND5E.of\")} ` : \"\"}${target.system.quantity}`;\r\n return {\r\n text,\r\n title: `${text} ${target.name}`\r\n };\r\n }\r\n }\r\n\r\n return {};\r\n }\r\n\r\n /**\r\n * Discard slow items\r\n * @private\r\n * @param {Map} items The items\r\n * @returns {Map} The filtered items\r\n */\r\n #discardSlowItems(items) {\r\n // Return all items if slow actions are allowed\r\n if (Utils.getSetting(\"showSlowActions\")) return items;\r\n\r\n // Define slow activation types\r\n const slowActivationTypes = new Set([\"minute\", \"hour\", \"day\"]);\r\n\r\n // Filter out slow items and return the result\r\n return new Map([...items.entries()].filter(([_, item]) => {\r\n const activationType = item.system?.activation?.type;\r\n return !slowActivationTypes.has(activationType);\r\n }));\r\n }\r\n\r\n /**\r\n * Get proficiency icon\r\n * @param {string} level\r\n * @returns {string}\r\n */\r\n #getProficiencyIcon(level) {\r\n const title = CONFIG.DND5E.proficiencyLevels[level] ?? \"\";\r\n const icon = PROFICIENCY_LEVEL_ICON[level];\r\n return (icon) ? `` : \"\";\r\n }\r\n\r\n /**\r\n * Get icon for the activation type\r\n * @private\r\n * @param {object} activationType The activation type\r\n * @returns {string} The icon\r\n */\r\n #getActivationTypeIcon(activationType) {\r\n const title = CONFIG.DND5E.abilityActivationTypes[activationType] ?? \"\";\r\n const icon = ACTIVATION_TYPE[activationType]?.icon;\r\n return (icon) ? `` : \"\";\r\n }\r\n\r\n /**\r\n * Get icon for concentration type\r\n * @private\r\n * @param {object} spell\r\n * @returns {string}\r\n */\r\n #getConcentrationIcon(spell) {\r\n if (spell?.type !== \"spell\" || !this.displaySpellInfo || !spell.system?.properties?.has(\"concentration\")) return null;\r\n const title = game.i18n.localize(\"DND5E.Scroll.RequiresConcentration\");\r\n const icon = CONCENTRATION_ICON;\r\n return ``;\r\n }\r\n\r\n /**\r\n * Get icon for a prepared spell\r\n * @private\r\n * @param {object} spell\r\n * @returns\r\n */\r\n #getPreparedIcon(spell) {\r\n if (spell?.type !== \"spell\" || !this.showUnpreparedSpells) return null;\r\n const level = spell.system.level;\r\n const preparationMode = spell.system.preparation.mode;\r\n const prepared = spell.system.preparation.prepared;\r\n const icon = prepared ? PREPARED_ICON : `${PREPARED_ICON} tah-icon-disabled`;\r\n const title = preparationMode === \"always\" ? game.i18n.localize(\"DND5E.SpellPrepAlways\") : prepared ? game.i18n.localize(\"DND5E.SpellPrepared\") : game.i18n.localize(\"DND5E.SpellUnprepared\");\r\n\r\n // Return icon if the preparation mode is 'prepared' or 'always' and the spell is not a cantrip\r\n return ((preparationMode === \"prepared\" || preparationMode === \"always\") && level !== 0) ? `` : null;\r\n }\r\n\r\n async #getTooltipData(entity) {\r\n if (this.tooltipsSetting === \"none\") return \"\";\r\n\r\n const name = entity?.name ?? \"\";\r\n\r\n if (this.tooltipsSetting === \"nameOnly\") return name;\r\n\r\n const unidentified = entity.system?.identified === false;\r\n const description = (typeof entity?.system?.description === \"string\") ? entity?.system?.description : (unidentified ? entity?.system?.unidentified?.description : entity?.system?.description?.value) ?? \"\";\r\n let modifiers; let properties; let rarity; let traits;\r\n if (!unidentified) {\r\n modifiers = entity?.modifiers ?? null;\r\n properties = [\r\n ...entity.system?.chatProperties ?? [],\r\n ...entity.system?.equippableItemCardProperties ?? [],\r\n entity.system?.parent?.labels?.activation,\r\n entity.system?.parent?.labels?.target,\r\n entity.system?.parent?.labels?.range,\r\n entity.system?.parent?.labels?.duration\r\n ].filter(p => p);\r\n rarity = unidentified ? null : entity?.rarity ?? null;\r\n traits = (entity?.type === \"weapon\") ? this.#getWeaponProperties(entity?.system?.properties) : null;\r\n }\r\n return { name, description, modifiers, properties, rarity, traits };\r\n }\r\n\r\n /**\r\n * Get condition tooltip data\r\n * @param {*} id The condition id\r\n * @param {*} name The condition name\r\n * @returns {object} The tooltip data\r\n */\r\n async #getConditionTooltipData(id, name) {\r\n if (this.tooltipsSetting === \"none\") return \"\";\r\n\r\n const condition = CONFIG.DND5E.conditionTypes[id];\r\n\r\n if (this.tooltipsSetting === \"nameOnly\" || !condition) return name;\r\n\r\n const journalEntry = (condition.reference) ? await fromUuid(condition.reference) : null;\r\n const description = journalEntry?.text?.content ?? \"\";\r\n const relativeTo = journalEntry;\r\n return {\r\n name,\r\n description,\r\n relativeTo\r\n };\r\n }\r\n\r\n /**\r\n * Get tooltip\r\n * @param {object} tooltipData The tooltip data\r\n * @returns {string} The tooltip\r\n */\r\n async #getTooltip(tooltipData) {\r\n if (this.tooltipsSetting === \"none\") return \"\";\r\n if (typeof tooltipData === \"string\") return tooltipData;\r\n\r\n const name = game.i18n.localize(tooltipData.name);\r\n\r\n if (this.tooltipsSetting === \"nameOnly\") return name;\r\n\r\n const nameHtml = `${name}
`;\r\n\r\n const relativeTo = tooltipData.relativeTo ?? this.actor;\r\n\r\n const description = tooltipData?.descriptionLocalised\r\n ?? await TextEditor.enrichHTML(game.i18n.localize(tooltipData?.description ?? \"\"), { async: true, relativeTo, secrets: true });\r\n\r\n const rarityHtml = tooltipData?.rarity\r\n ? `${game.i18n.localize(RARITY[tooltipData.rarity])}`\r\n : \"\";\r\n\r\n const propertiesHtml = tooltipData?.properties\r\n ? `${tooltipData.properties.map(property => `${game.i18n.localize(property)}`).join(\"\")}
`\r\n : \"\";\r\n\r\n const traitsHtml = tooltipData?.traits\r\n ? tooltipData.traits.map(trait => `${game.i18n.localize(trait.label ?? trait)}`).join(\"\")\r\n : \"\";\r\n\r\n const traits2Html = tooltipData?.traits2\r\n ? tooltipData.traits2.map(trait => `${game.i18n.localize(trait.label ?? trait)}`).join(\"\")\r\n : \"\";\r\n\r\n const traitsAltHtml = tooltipData?.traitsAlt\r\n ? tooltipData.traitsAlt.map(trait => `${game.i18n.localize(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 = game.i18n.localize(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 return `${nameHtml}${headerTags}${description}${propertiesHtml}
`;\r\n }\r\n\r\n #getWeaponProperties(weaponProperties) {\r\n if (!weaponProperties) return null;\r\n return Object.entries(weaponProperties)\r\n .filter(([id, selected]) => selected && CONFIG.DND5E.validProperties.weapon.has(id))\r\n .map(([id, _]) => game.i18n.localize(CONFIG.DND5E.itemProperties[id]));\r\n }\r\n };\r\n});\r\n","export let MagicItemActionHandlerExtender = null;\r\n\r\nHooks.once(\"tokenActionHudCoreApiReady\", async coreModule => {\r\n MagicItemActionHandlerExtender = class MagicItemActionHandlerExtender extends coreModule.api.ActionHandlerExtender {\r\n constructor(actionHandler) {\r\n super();\r\n this.actionHandler = actionHandler;\r\n this.actor = null;\r\n }\r\n\r\n /**\r\n * Extend the action list\r\n */\r\n async extendActionHandler() {\r\n this.actor = this.actionHandler.actor;\r\n if (!this.actor) return;\r\n\r\n const actor = await MagicItems.actor(this.actor.id);\r\n\r\n if (!actor) return;\r\n\r\n const magicItems = actor.items ?? [];\r\n\r\n if (magicItems.length === 0) return;\r\n\r\n const parentGroupId = \"magic-items\";\r\n const parentGroupType = \"system\";\r\n const parentGroupData = {\r\n id: parentGroupId,\r\n type: parentGroupType\r\n };\r\n\r\n magicItems.forEach(magicItem => {\r\n if (magicItem.attuned && !this._isItemAttuned(magicItem)) return;\r\n if (magicItem.equipped && !this._isItemEquipped(magicItem)) return;\r\n\r\n const groupId = `magic-items_${magicItem.id}`;\r\n const groupName = magicItem.name;\r\n const groupType = \"system-derived\";\r\n const groupInfo1 = `${magicItem.uses}/${magicItem.charges}`;\r\n const groupData = {\r\n id: groupId,\r\n name: groupName,\r\n type: groupType,\r\n info1: groupInfo1\r\n };\r\n\r\n // Add group to HUD\r\n this.actionHandler.addGroup(groupData, parentGroupData);\r\n\r\n const actions = magicItem.ownedEntries.map(entry => {\r\n const effect = entry.item;\r\n const id = effect.id;\r\n const name = effect.name;\r\n const img = coreModule.api.Utils.getImage(effect);\r\n const info1 = effect.consumption;\r\n const info2 = (effect.baseLevel) ? `${coreModule.api.Utils.i18n(\"DND5E.AbbreviationLevel\")} ${effect.baseLevel}` : \"\";\r\n return {\r\n id,\r\n name,\r\n encodedValue,\r\n img,\r\n info1,\r\n info2,\r\n selected: true,\r\n system: { actionType: \"magicItem\", itemId: magicItem.id, effectId: id}\r\n };\r\n });\r\n\r\n // Add actions to action list\r\n this.actionHandler.addActions(actions, groupData);\r\n });\r\n }\r\n\r\n /**\r\n * Whether the magic item is equipped or not\r\n * @param {object} magicItem The item\r\n * @returns {boolean}\r\n */\r\n _isItemEquipped(magicItem) {\r\n return magicItem.item.system.equipped;\r\n }\r\n\r\n /**\r\n * Whether the magic items is attuned or not\r\n * @param {object} magicItem The item\r\n * @returns {boolean}\r\n */\r\n _isItemAttuned(magicItem) {\r\n const attunement = magicItem.item.system.attunment;\r\n const attunementRequired = CONFIG.DND5E.attunementTypes?.REQUIRED ?? 1;\r\n\r\n if (attunement === attunementRequired) return false;\r\n\r\n return true;\r\n }\r\n };\r\n});\r\n","import { CUSTOM_DND5E } from \"./constants.js\";\r\n\r\nexport let RollHandler = null;\r\n\r\nHooks.once(\"tokenActionHudCoreApiReady\", async coreModule => {\r\n RollHandler = class RollHandler extends coreModule.api.RollHandler {\r\n /**\r\n * Handle action click\r\n * @override\r\n * @param {object} event\r\n */\r\n async handleActionClick(event) {\r\n const { actionType, actionId } = this.action.system;\r\n\r\n if (!this.actor) {\r\n for (const token of coreModule.api.Utils.getControlledTokens()) {\r\n const actor = token.actor;\r\n await this.handleAction(event, actionType, actor, token, actionId);\r\n }\r\n } else {\r\n await this.handleAction(event, actionType, this.actor, this.token, actionId);\r\n }\r\n }\r\n\r\n /**\r\n * Handle action\r\n * @private\r\n * @param {object} event\r\n * @param {string} actionType\r\n * @param {object} actor\r\n * @param {object} token\r\n * @param {string} actionId\r\n */\r\n async handleAction(event, actionType, actor, token, actionId) {\r\n switch (actionType) {\r\n case \"ability\":\r\n this.rollAbility(event, actor, actionId); break;\r\n case \"check\":\r\n this.rollAbilityTest(event, actor, actionId); break;\r\n case \"save\":\r\n this.rollAbilitySave(event, actor, actionId); break;\r\n case \"condition\":\r\n if (!token) return;\r\n await this.toggleCondition(actor, token, actionId); break;\r\n case \"counter\":\r\n await this.modifyCounter(event, actor); break;\r\n case \"effect\":\r\n await this.toggleEffect(actor, actionId); break;\r\n case \"exhaustion\":\r\n await this.modifyExhaustion(event, actor); break;\r\n case \"feature\":\r\n case \"item\":\r\n case \"spell\":\r\n case \"weapon\":\r\n if (this.isRenderItem()) this.renderItem(actor, actionId);\r\n else this.useItem(event, actor, actionId);\r\n break;\r\n case \"magicItem\":\r\n await this.rollMagicItem(actor, actionId); break;\r\n case \"skill\":\r\n this.rollSkill(event, actor, actionId); break;\r\n case \"utility\":\r\n await this.performUtilityAction(event, actor, token, actionId); break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Modify Counter\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n */\r\n async modifyCounter(event, actor) {\r\n switch (this.action?.system?.counterKey) {\r\n case \"death-saves\":\r\n this.rollDeathSave(event, actor); break;\r\n case \"exhaustion\":\r\n await this.modifyExhaustion(actor); break;\r\n case \"inspiration\":\r\n await this.modifyInspiration(actor); break;\r\n default:\r\n await this.modifyCustomCounter(actor); break;\r\n }\r\n }\r\n\r\n /**\r\n * Modify Exhaustion\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async modifyExhaustion(actor) {\r\n const currentExhaustion = actor.system.attributes.exhaustion;\r\n const newExhaustion = currentExhaustion + (this.isRightClick ? -1 : 1);\r\n if (newExhaustion >= 0 && newExhaustion !== currentExhaustion) {\r\n actor.update({ \"system.attributes.exhaustion\": newExhaustion });\r\n }\r\n }\r\n\r\n /**\r\n * Modify Inspiration\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async modifyInspiration(actor) {\r\n const update = !actor.system.attributes.inspiration;\r\n actor.update({ \"system.attributes.inspiration\": update });\r\n }\r\n\r\n /**\r\n * Modify Custom Counter\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async modifyCustomCounter(actor) {\r\n const { counterKey, counterType } = this.action.system;\r\n\r\n let value = actor.getFlag(CUSTOM_DND5E.ID, counterKey) || {};\r\n\r\n const setFlag = async (key, currentValue, newValue) => {\r\n if (newValue !== currentValue) {\r\n await actor.setFlag(CUSTOM_DND5E.ID, key, newValue);\r\n }\r\n };\r\n\r\n const adjustValue = (key, currentValue = 0, increment = 1) => {\r\n const newValue = this.isRightClick ? Math.max(0, currentValue - increment) : currentValue + increment;\r\n setFlag(key, currentValue, newValue);\r\n };\r\n\r\n switch (counterType) {\r\n case \"checkbox\":\r\n await setFlag(id, !value);\r\n break;\r\n\r\n case \"fraction\":\r\n if (this.isRightClick || (value.max && value.value < value.max) || !value.max) {\r\n adjustValue(`${id}.value`, value.value);\r\n }\r\n break;\r\n\r\n case \"number\":\r\n adjustValue(id, value);\r\n break;\r\n\r\n case \"successFailure\":\r\n value.success = value?.success ?? 0;\r\n value.failure = value?.failure ?? 0;\r\n if (this.isCtrl) {\r\n adjustValue(`${id}.failure`, value.failure);\r\n } else {\r\n adjustValue(`${id}.success`, value.success);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Roll Ability\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 rollAbility(event, actor, actionId) {\r\n if (!actor.system?.abilities) return;\r\n actor.rollAbility(actionId, { event });\r\n }\r\n\r\n /**\r\n * Roll Ability Save\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 rollAbilitySave(event, actor, actionId) {\r\n if (!actor.system?.abilities) return;\r\n actor.rollAbilitySave(actionId, { event });\r\n }\r\n\r\n /**\r\n * Roll Ability Test\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 rollAbilityTest(event, actor, actionId) {\r\n if (!actor.system?.abilities) return;\r\n actor.rollAbilityTest(actionId, { event });\r\n }\r\n\r\n /**\r\n * Roll Death Save\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n */\r\n rollDeathSave(event, actor) {\r\n actor.rollDeathSave({ event });\r\n }\r\n\r\n /**\r\n * Roll Magic Item\r\n * @private\r\n * @param {object} actor The actor\r\n */\r\n async rollMagicItem(actor) {\r\n const { itemId, effectId } = this.action.system;\r\n\r\n const magicItemActor = await MagicItems.actor(actor.id);\r\n if (!magicItemActor) return;\r\n\r\n // Magicitems module 3.0.0 does not support Item5e#use\r\n magicItemActor.roll(itemId, effectId);\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\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 rollSkill(event, actor, actionId) {\r\n if (!actor.system?.skills) return;\r\n actor.rollSkill(actionId, { event });\r\n }\r\n\r\n /**\r\n * Use Item\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 useItem(event, actor, actionId) {\r\n const item = coreModule.api.Utils.getItem(actor, actionId);\r\n\r\n if (this.#needsRecharge(item)) {\r\n item.rollRecharge();\r\n } else {\r\n item.use({ event, legacy: false });\r\n }\r\n }\r\n\r\n /**\r\n * Needs Recharge\r\n * @private\r\n * @param {object} item\r\n * @returns {boolean}\r\n */\r\n #needsRecharge(item) {\r\n return (item?.system?.uses?.period === \"recharge\" && !(item?.system?.uses?.value > 0));\r\n }\r\n\r\n /**\r\n * Perform utility action\r\n * @param {object} event The event\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 performUtilityAction(event, actor, token, actionId) {\r\n switch (actionId) {\r\n case \"deathSave\":\r\n this.rollDeathSave(event, actor); break;\r\n case \"endTurn\":\r\n if (!token || game.combat?.current?.tokenId !== token.id) break;\r\n await game.combat?.nextTurn(); break;\r\n case \"initiative\":\r\n await this.rollInitiative(actor); break;\r\n case \"inspiration\":\r\n await this.modifyInspiration(actor); break;\r\n case \"longRest\":\r\n actor.longRest(); break;\r\n case \"shortRest\":\r\n actor.shortRest(); break;\r\n }\r\n\r\n // Update HUD\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Roll Initiative\r\n * @param {object} actor The actor\r\n * @private\r\n */\r\n async rollInitiative(actor) {\r\n if (!actor) return;\r\n await actor.rollInitiative({ createCombatants: true });\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Toggle Condition\r\n * @private\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 toggleCondition(actor, token, actionId) {\r\n if (!token) return;\r\n\r\n const statusEffect = CONFIG.statusEffects.find(statusEffect => statusEffect.id === actionId);\r\n const isConvenient = statusEffect?.flags?.[\"dfreds-convenient-effects\"]?.isConvenient\r\n ?? actionId.startsWith(\"Convenient Effect\");\r\n\r\n if (game.dfreds && isConvenient) {\r\n const effectName = statusEffect.name ?? statusEffect.label;\r\n await game.dfreds.effectInterface.toggleEffect(effectName, { overlay: !!this.isRightClick });\r\n } else {\r\n const condition = this.#findCondition(actionId);\r\n if (!condition) return;\r\n\r\n const effect = this.#findEffect(actor, actionId);\r\n if (effect?.disabled) { await effect.delete(); }\r\n\r\n await actor.toggleStatusEffect(condition.id, { overlay: !!this.isRightClick });\r\n }\r\n\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Find condition\r\n * @private\r\n * @param {string} actionId The action id\r\n * @returns {object} The condition\r\n */\r\n #findCondition(actionId) {\r\n return CONFIG.statusEffects.find(effect => effect.id === actionId);\r\n }\r\n\r\n /**\r\n * Find effect\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n * @returns {object} The effect\r\n */\r\n #findEffect(actor, actionId) {\r\n return actor.effects.find(effect => effect.statuses.every(status => status === actionId));\r\n }\r\n\r\n /**\r\n * Toggle Effect\r\n * @private\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async toggleEffect(actor, actionId) {\r\n const effect = actor.allApplicableEffects().find(effect => effect.id === actionId);\r\n if (!effect) return;\r\n\r\n if (this.isRightClick && !effect.transfer) {\r\n await effect.delete();\r\n } else {\r\n await effect.update({ disabled: !effect.disabled });\r\n }\r\n\r\n Hooks.callAll(\"forceUpdateTokenActionHud\");\r\n }\r\n\r\n /**\r\n * Handle action hover\r\n * @override\r\n * @param {object} event\r\n */\r\n async handleActionHover(event) {\r\n const types = [\"feature\", \"item\", \"spell\", \"weapon\", \"magicItem\"];\r\n const { actionType, actionId } = this.action.system;\r\n\r\n if (!types.includes(actionType)) return;\r\n\r\n const item = coreModule.api.Utils.getItem(this.actor, actionId);\r\n\r\n if (this.isHover) {\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","import { GROUP } from \"./constants.js\";\r\n\r\n/**\r\n * Default categories 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.name)}`;\r\n });\r\n const groupsArray = Object.values(groups);\r\n DEFAULTS = {\r\n layout: [\r\n {\r\n nestId: \"inventory\",\r\n id: \"inventory\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Inventory\"),\r\n groups: [\r\n { ...groups.weapons, nestId: \"inventory_weapons\" },\r\n { ...groups.equipment, nestId: \"inventory_equipment\" },\r\n { ...groups.consumables, nestId: \"inventory_consumables\" },\r\n { ...groups.tools, nestId: \"inventory_tools\" },\r\n { ...groups.containers, nestId: \"inventory_containers\" },\r\n { ...groups.loot, nestId: \"inventory_loot\" }\r\n ]\r\n },\r\n {\r\n nestId: \"features\",\r\n id: \"features\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Features\"),\r\n groups: [\r\n { ...groups.activeFeatures, nestId: \"features_active-features\" },\r\n { ...groups.passiveFeatures, nestId: \"features_passive-features\" }\r\n ]\r\n },\r\n {\r\n nestId: \"spells\",\r\n id: \"spells\",\r\n name: coreModule.api.Utils.i18n(\"TYPES.Item.spellPl\"),\r\n groups: [\r\n { ...groups.atWillSpells, nestId: \"spells_at-will-spells\" },\r\n { ...groups.innateSpells, nestId: \"spells_innate-spells\" },\r\n { ...groups.pactSpells, nestId: \"spells_pact-spells\" },\r\n { ...groups.cantrips, nestId: \"spells_cantrips\" },\r\n { ...groups._1stLevelSpells, nestId: \"spells_1st-level-spells\" },\r\n { ...groups._2ndLevelSpells, nestId: \"spells_2nd-level-spells\" },\r\n { ...groups._3rdLevelSpells, nestId: \"spells_3rd-level-spells\" },\r\n { ...groups._4thLevelSpells, nestId: \"spells_4th-level-spells\" },\r\n { ...groups._5thLevelSpells, nestId: \"spells_5th-level-spells\" },\r\n { ...groups._6thLevelSpells, nestId: \"spells_6th-level-spells\" },\r\n { ...groups._7thLevelSpells, nestId: \"spells_7th-level-spells\" },\r\n { ...groups._8thLevelSpells, nestId: \"spells_8th-level-spells\" },\r\n { ...groups._9thLevelSpells, nestId: \"spells_9th-level-spells\" }\r\n ]\r\n },\r\n {\r\n nestId: \"attributes\",\r\n id: \"attributes\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Attributes\"),\r\n groups: [\r\n { ...groups.abilities, nestId: \"attributes_abilities\" },\r\n { ...groups.skills, nestId: \"attributes_skills\" }\r\n ]\r\n },\r\n {\r\n nestId: \"effects\",\r\n id: \"effects\",\r\n name: coreModule.api.Utils.i18n(\"DND5E.Effects\"),\r\n groups: [\r\n { ...groups.temporaryEffects, nestId: \"effects_temporary-effects\" },\r\n { ...groups.passiveEffects, nestId: \"effects_passive-effects\" },\r\n { ...groups.conditions, nestId: \"effects_conditions\" }\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.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\n/**\r\n *\r\n * @param updateFunc\r\n */\r\nexport function register(updateFunc) {\r\n game.settings.register(MODULE.ID, \"abbreviateSkills\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.abbreviateSkills.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.abbreviateSkills.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, \"showSlowActions\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showSlowActions.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showSlowActions.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, \"displaySpellInfo\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.displaySpellInfo.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.displaySpellInfo.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, \"showUnchargedItems\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnchargedItems.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnchargedItems.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, \"showUnequippedItems\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItems.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItems.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, \"showUnequippedItemsNpcs\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnequippedItemsNpcs.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, \"showUnpreparedSpells\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnpreparedSpells.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showUnpreparedSpells.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, \"showItemsWithoutActivationCosts\", {\r\n name: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.name\"\r\n ),\r\n hint: game.i18n.localize(\r\n \"tokenActionHud.dnd5e.settings.showItemsWithoutActivationCosts.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 { MagicItemActionHandlerExtender } from \"./magic-items-extender.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 if (coreModule.api.Utils.isModuleActive(\"magic-items-2\")\r\n || coreModule.api.Utils.isModuleActive(\"magicitems\")) {\r\n actionHandler.addActionHandlerExtender(new MagicItemActionHandlerExtender(actionHandler));\r\n }\r\n return actionHandler;\r\n }\r\n\r\n /** @override */\r\n getAvailableRollHandlers() {\r\n let coreTitle = \"Core D&D5e\";\r\n\r\n if (coreModule.api.Utils.isModuleActive(\"midi-qol\")) {\r\n coreTitle += ` [supports ${coreModule.api.Utils.getModuleTitle(\"midi-qol\")}]`;\r\n }\r\n\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\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 the 'Magic Items' module is active, then add a group for it\r\n if (game.modules.get(\"magicitems\")?.active || game.modules.get(\"magic-items-2\")?.active) {\r\n const name = coreModule.api.Utils.i18n(\"tokenActionHud.dnd5e.magicItems\");\r\n defaults.groups.push(\r\n {\r\n id: \"magic-items\",\r\n name,\r\n listName: `Group: ${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","ACTION_TYPE","ability","check","condition","counter","effect","exhaustion","feature","item","save","skill","spell","utility","ACTIVATION_TYPE","action","group","bonus","icon","crew","day","hour","lair","minute","legendary","reaction","reactiondamage","reactionmanual","special","other","CONCENTRATION_ICON","CUSTOM_DND5E","COUNTERS","character","npc","FEATURE_GROUP_IDS","GROUP","_1stLevelSpells","id","name","spellMode","type","_2ndLevelSpells","_3rdLevelSpells","_4thLevelSpells","_5thLevelSpells","_6thLevelSpells","_7thLevelSpells","_8thLevelSpells","_9thLevelSpells","abilities","actions","activeFeatures","artificerInfusions","atWillSpells","backgroundFeatures","bonusActions","cantrips","channelDivinity","checks","classFeatures","combat","conditions","consumables","containers","counters","crewActions","defensiveTactics","eldritchInvocations","elementalDisciplines","equipment","equipped","feats","fightingStyles","huntersPrey","innateSpells","kiAbilities","lairActions","legendaryActions","loot","maneuvers","metamagicOptions","monsterFeatures","multiattacks","otherActions","pactBoons","pactSpells","passiveEffects","passiveFeatures","psionicPowers","raceFeatures","reactions","rests","runes","saves","skills","superiorHuntersDefense","temporaryEffects","token","tools","unequipped","weapons","PREPARED_ICON","PROFICIENCY_LEVEL_ICON","RARITY","common","uncommon","rare","veryRare","artifact","RITUAL_ICON","SPELL_GROUP_IDS","Utils","Hooks","once","async","capitalize","value","replace","text","charAt","toUpperCase","substring","toLowerCase","getSetting","key","defaultValue","game","settings","get","coreModule","api","Logger","debug","setSetting","set","ActionHandler","featureActions","inventoryActions","spellActions","buildSystemActions","groupIds","this","actors","actor","getValidActors","tokens","getValidTokens","items","sortItemsByName","discardSlowItems","abbreviateSkills","displaySpellInfo","showItemsWithoutActivationCosts","showUnchargedItems","showUnequippedItems","showUnpreparedSpells","activationgroupIds","inventorygroupIds","buildCharacterActions","buildVehicleActions","buildMultipleTokenActions","Promise","all","buildConditions","buildEffects","buildFeatures","buildInventory","buildSpells","buildAbilities","buildCombat","buildCounters","buildExhaustion","buildRests","buildSkills","buildUtility","actionType","groupId","system","CONFIG","DND5E","length","Object","entries","filter","map","abilityId","label","mod","icon1","getProficiencyIcon","proficient","info1","getModifier","title","i18n","localize","info2","listName","getListName","addActions","buildActivations","data","groupData","actionData","activationItems","Map","activationType","activities","contents","activation","has","values","groupDataClone","includes","defaultSelected","parentgroupData","addGroup","addGroupInfo","buildActions","combatType","initiative","current","tokenId","endTurn","getControlledTokens","tokenIds","combatants","combatant","getInfo1","class","cssClass","every","actionId","statusEffects","hasCondition","effects","some","statuses","status","disabled","img","getImage","tooltip","getTooltip","getConditionTooltipData","isModuleActive","keys","_","visible","active","attributes","death","success","failure","getFlag","max","counterKey","counterType","allApplicableEffects","size","statusEffectIds","Set","statusEffect","_id","effectId","isSuppressed","parent","identified","user","isGM","isTemporary","featuresMap","featureType","background","monster","race","classFeatureType","artificerInfusion","defensiveTactic","eldritchInvocation","elementalDiscipline","fightingStyle","ki","maneuver","metamagic","multiattack","pact","psionicPower","rune","subType","subtype","inventoryMap","quantity","isActiveItem","isUsableItem","isEquippedItem","shortRest","longRest","total","error","spells","spellsMap","isUsableSpell","preparation","mode","level","systemSpells","reverse","spellSlotsMap","spellSlotAvailable","pactSlotAvailable","pactSlot","hasValue","hasMax","hasLevel","slotAvailable","startsWith","slotsAvailable","spellSlotModes","levelInfo","slots","info","utilityTypes","deathSave","inspiration","hp","utilityType","options","getAction","entity","hasOwn","getItemInfo","getTooltipData","getActivationTypeIcon","icon2","getPreparedIcon","icon3","getConcentrationIcon","info3","activationTypes","activityActivationTypes","uses","spellPreparationModes","preparationMode","prepared","actionName","getSpellInfo","getQuantityData","getUsesData","getConsumeData","components","properties","componentsArray","vocal","somatic","material","ritual","push","join","allowedTypes","per","recovery","period","limitedUsePeriods","perPeriod","spent","firstActivity","firstTarget","consumption","targets","consumeId","target","consumeType","consumeAmount","parentId","substr","lastIndexOf","foundry","utils","getProperty","slowActivationTypes","proficiencyLevels","abilityActivationTypes","tooltipsSetting","unidentified","description","modifiers","rarity","traits","chatProperties","equippableItemCardProperties","labels","range","duration","p","getWeaponProperties","conditionTypes","journalEntry","fromUuid","reference","content","relativeTo","tooltipData","nameHtml","descriptionLocalised","TextEditor","enrichHTML","secrets","rarityHtml","propertiesHtml","property","traitsHtml","trait","traits2Html","traits2","traitsAltHtml","traitsAlt","modifiersHtml","modifier","enabled","tagsJoined","tagsHtml","weaponProperties","selected","validProperties","weapon","itemProperties","MagicItemActionHandlerExtender","ActionHandlerExtender","constructor","actionHandler","super","extendActionHandler","MagicItems","magicItems","parentGroupData","forEach","magicItem","attuned","_isItemAttuned","_isItemEquipped","charges","ownedEntries","entry","baseLevel","encodedValue","itemId","attunment","attunementTypes","REQUIRED","RollHandler","handleActionClick","event","handleAction","rollAbility","rollAbilityTest","rollAbilitySave","toggleCondition","modifyCounter","toggleEffect","modifyExhaustion","isRenderItem","renderItem","useItem","rollMagicItem","rollSkill","performUtilityAction","rollDeathSave","modifyInspiration","modifyCustomCounter","currentExhaustion","newExhaustion","isRightClick","update","setFlag","currentValue","newValue","adjustValue","increment","Math","isCtrl","magicItemActor","roll","callAll","getItem","needsRecharge","rollRecharge","use","legacy","nextTurn","rollInitiative","createCombatants","find","isConvenient","flags","dfreds","effectName","effectInterface","overlay","findCondition","findEffect","delete","toggleStatusEffect","transfer","handleActionHover","isHover","call","DEFAULTS","register","updateFunc","hint","scope","config","Boolean","default","onChange","groups","groupsArray","layout","nestId","SystemManager","getActionHandler","addActionHandlerExtender","getAvailableRollHandlers","coreTitle","getModuleTitle","core","getRollHandler","rollHandlerId","rollHandler","Core","registerSettings","onChangeFunction","systemSettings.register","registerDefaults","defaults","modules","sort","a","b","localeCompare","on","module","requiredCoreModuleVersion"],"mappings":"AAGY,MAACA,EAAS,CACpBC,GAAI,0BAMOC,EAAc,CACzBD,GAAI,yBAMOE,EAA+B,MAK/BC,EAAc,CACzBC,QAAS,gBACTC,MAAO,6BACPC,UAAW,iCACXC,QAAS,+BACTC,OAAQ,eACRC,WAAY,mBACZC,QAAS,kBACTC,KAAM,4BACNC,KAAM,uBACNC,MAAO,6BACPC,MAAO,mBACPC,QAAS,oBAMEC,EAAkB,CAC7BC,OAAQ,CAAEC,MAAO,WACjBC,MAAO,CAAED,MAAO,gBAAiBE,KAAM,eACvCC,KAAM,CAAEH,MAAO,eAAgBE,KAAM,gBACrCE,IAAK,CAAEF,KAAM,wBACbG,KAAM,CAAEH,KAAM,yBACdI,KAAM,CAAEN,MAAO,eAAgBE,KAAM,eACrCK,OAAQ,CAAEL,KAAM,0BAChBM,UAAW,CAAER,MAAO,oBAAqBE,KAAM,qBAC/CO,SAAU,CAAET,MAAO,YAAaE,KAAM,eACtCQ,eAAgB,CAAEV,MAAO,YAAaE,KAAM,eAC5CS,eAAgB,CAAEX,MAAO,YAAaE,KAAM,eAC5CU,QAAS,CAAEZ,MAAO,kBAAmBE,KAAM,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