`;\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 encodedValue = [\r\n \"magicItem\",\r\n `${magicItem.id}>${id}`\r\n ].join(\"|\");\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 };\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 * @param {string} encodedValue\r\n */\r\n async handleActionClick(event, encodedValue) {\r\n const [actionType, actionId] = encodedValue.split(\"|\");\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(event, actor, token, actionId); break;\r\n case \"counter\":\r\n await this.modifyCounter(event, actor, actionId); break;\r\n case \"effect\":\r\n await this.toggleEffect(event, 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 * @param {string} actionId The action id\r\n */\r\n async modifyCounter(event, actor, actionId) {\r\n switch (actionId) {\r\n case \"death-saves\":\r\n this.rollDeathSave(event, actor); break;\r\n case \"exhaustion\":\r\n await this.modifyExhaustion(event, actor); break;\r\n case \"inspiration\":\r\n await this.modifyInspiration(actor); break;\r\n default:\r\n await this.modifyCustomCounter(event, actor, actionId); break;\r\n }\r\n }\r\n\r\n /**\r\n * Modify Exhaustion\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n */\r\n async modifyExhaustion(event, actor) {\r\n const isRightClick = this.isRightClick(event);\r\n const currentExhaustion = actor.system.attributes.exhaustion;\r\n const newExhaustion = currentExhaustion + (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} event The event\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async modifyCustomCounter(event, actor, actionId) {\r\n const [id, type] = decodeURIComponent(actionId).split(\">\");\r\n const isRightClick = this.isRightClick(event);\r\n const isCtrl = this.isCtrl(event);\r\n\r\n let value = actor.getFlag(CUSTOM_DND5E.ID, id) || {};\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 = isRightClick ? Math.max(0, currentValue - increment) : currentValue + increment;\r\n setFlag(key, currentValue, newValue);\r\n };\r\n\r\n switch (type) {\r\n case \"checkbox\":\r\n await setFlag(id, !value);\r\n break;\r\n\r\n case \"fraction\":\r\n if (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 (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 * @param {string} actionId The action id\r\n */\r\n async rollMagicItem(actor, actionId) {\r\n const [itemId, magicEffectId] = actionId.split(\">\");\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, magicEffectId);\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} 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 toggleCondition(event, actor, token, actionId) {\r\n if (!token) return;\r\n\r\n const isRightClick = this.isRightClick(event);\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: !!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: !!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} event The event\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async toggleEffect(event, actor, actionId) {\r\n const effects = actor.effects.entries ? actor.effects.entries : actor.effects;\r\n const actorEffect = effects.find(effect => effect.id === actionId);\r\n\r\n const effect = actorEffect ?? actor.allApplicableEffects().find(effect => effect.id === actionId);\r\n if (!effect) return;\r\n\r\n const isRightClick = this.isRightClick(event);\r\n\r\n if (isRightClick && actorEffect) {\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 * @param {string} encodedValue\r\n */\r\n async handleActionHover(event, encodedValue) {\r\n const types = [\"feature\", \"item\", \"spell\", \"weapon\", \"magicItem\"];\r\n const [actionType, actionId] = encodedValue.split(\"|\");\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 switch (event.type) {\r\n case \"mouseenter\":\r\n case \"mouseover\":\r\n Hooks.call(\"tokenActionHudSystemActionHoverOn\", event, item);\r\n break;\r\n case \"mouseleave\":\r\n case \"mouseout\":\r\n Hooks.call(\"tokenActionHudSystemActionHoverOff\", event, item);\r\n break;\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","coreModule","getSetting","key","defaultValue","value","game","settings","get","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","capitalize","encodedValue","join","delimiter","icon1","getProficiencyIcon","proficient","info1","text","getModifier","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","i18n","localize","cssClass","every","statusEffects","hasCondition","effects","some","statuses","status","disabled","img","getImage","tooltip","getTooltip","getConditionTooltipData","isModuleActive","keys","_","visible","active","attributes","death","success","failure","getFlag","max","encodeURIComponent","allApplicableEffects","size","conditionIds","Set","conditionTypes","dnd5e","utils","staticID","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","f","spellSlotModes","levelInfo","slots","info","utilityTypes","deathSave","inspiration","hp","utilityType","options","getAction","entity","_id","hasOwn","getItemInfo","getTooltipData","getActivationTypeIcon","icon2","getPreparedIcon","icon3","getConcentrationIcon","info3","activationTypes","activityActivationTypes","uses","preparationModes","spellPreparationModes","preparationMode","prepared","actionName","getSpellInfo","getQuantityData","getUsesData","getConsumeData","components","properties","title","componentsArray","vocal","somatic","material","ritual","push","allowedTypes","per","recovery","period","limitedUsePeriods","perPeriod","spent","firstActivity","firstTarget","consumption","targets","consumeId","target","consumeType","consumeAmount","parentId","substr","lastIndexOf","foundry","getProperty","slowActivationTypes","proficiencyLevels","abilityActivationTypes","tooltipsSetting","unidentified","description","modifiers","rarity","traits","chatProperties","equippableItemCardProperties","labels","range","duration","p","getWeaponProperties","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","attunment","attunementTypes","REQUIRED","RollHandler","handleActionClick","event","actionId","split","handleAction","rollAbility","rollAbilityTest","rollAbilitySave","toggleCondition","modifyCounter","toggleEffect","modifyExhaustion","isRenderItem","renderItem","useItem","rollMagicItem","rollSkill","performUtilityAction","rollDeathSave","modifyInspiration","modifyCustomCounter","isRightClick","currentExhaustion","newExhaustion","update","decodeURIComponent","isCtrl","setFlag","currentValue","newValue","adjustValue","increment","Math","itemId","magicEffectId","magicItemActor","roll","callAll","getItem","needsRecharge","rollRecharge","use","legacy","nextTurn","rollInitiative","createCombatants","statusEffect","find","isConvenient","flags","dfreds","effectName","effectInterface","overlay","findCondition","findEffect","delete","toggleStatusEffect","actorEffect","handleActionHover","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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,MAAMkI,eAAe,cACtC4R,GAAa,cAAc1Z,EAAWQ,IAAIZ,MAAM+Z,eAAe,gBAIjE,MADgB,CAAEC,KAAMF,EAEzB,CAGD,cAAAG,CAAeC,GACb,IAAIC,EAQJ,OAJIA,EAAc,IAAIC,EAIfD,CACR,CAGD,gBAAAE,CAAiBC,GACfC,SAAwBD,EACzB,CAGD,sBAAME,GACJ,MAAMC,EAAW5B,EAEjB,GAAIpY,KAAKia,QAAQ/Z,IAAI,eAAe2H,QAAU7H,KAAKia,QAAQ/Z,IAAI,kBAAkB2H,OAAQ,CACvF,MAAM/M,EAAO6E,EAAWQ,IAAIZ,MAAMkH,KAAK,mCACvCuT,EAASnB,OAAO/J,KACd,CACEjU,GAAI,cACJC,OACA0J,SAAU,UAAU1J,IACpBE,KAAM,WAGVgf,EAASnB,OAAOqB,MAAK,CAACC,EAAGC,IAAMD,EAAEtf,GAAGwf,cAAcD,EAAEvf,KACrD,CACD,OAAOmf,CACR,EACF,IClEHxa,MAAM8a,GAAG,8BAA8B5a,UACrC,MAAM6a,EAASva,KAAKia,QAAQ/Z,IAAI9H,EAAOC,IACvCkiB,EAAOpa,IAAM,CACXqa,0BRWwC,MQVxCvB,iBAEFzZ,MAAM2Y,KAAK,4BAA6BoC,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 = \"1.5\";\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 * 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) ? coreModule.api.Utils.capitalize(abilityId) : name,\r\n encodedValue: [actionType, abilityId].join(this.delimiter),\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 };\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 encodedValue: [actionType, id].join(this.delimiter),\r\n info1: getInfo1(id),\r\n cssClass: (id === \"initiative\" ) ? `toggle${getActive()}` : \"\",\r\n listName: this.#getListName(actionType, name)\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 encodedValue: [actionType, condition.id].join(this.delimiter),\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 };\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 encodedValue: [actionType, (counter.system) ? counter.key : encodeURIComponent(`${counter.key}>${counter.type}`)].join(this.delimiter),\r\n cssClass,\r\n img,\r\n info1\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 conditionIds = new Set(Object.keys(CONFIG.DND5E.conditionTypes).map(key => dnd5e.utils.staticID(`dnd5e${key}`)));\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 (conditionIds.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 encodedValue: [actionType, \"exhaustion\"].join(this.delimiter),\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 }];\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 encodedValue: [actionType, id].join(this.delimiter),\r\n listName: this.#getListName(actionType, name)\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 ? coreModule.api.Utils.capitalize(id) : name,\r\n encodedValue: [actionType, id].join(this.delimiter),\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 };\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(f`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 const encodedValue = [actionType, id].join(this.delimiter);\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 encodedValue,\r\n cssClass,\r\n listName: this.#getListName(actionType, name)\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 encodedValue: [actionType, id].join(this.delimiter),\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 };\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 spell is a cantrip, has a preparation mode other than 'prepared' or is prepared\r\n return spell.system.level === 0 || preparationModes.has(spell.system.preparation.mode)\r\n || 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 encodedValue = [\r\n \"magicItem\",\r\n `${magicItem.id}>${id}`\r\n ].join(\"|\");\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 };\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 * @param {string} encodedValue\r\n */\r\n async handleActionClick(event, encodedValue) {\r\n const [actionType, actionId] = encodedValue.split(\"|\");\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(event, actor, token, actionId); break;\r\n case \"counter\":\r\n await this.modifyCounter(event, actor, actionId); break;\r\n case \"effect\":\r\n await this.toggleEffect(event, 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 * @param {string} actionId The action id\r\n */\r\n async modifyCounter(event, actor, actionId) {\r\n switch (actionId) {\r\n case \"death-saves\":\r\n this.rollDeathSave(event, actor); break;\r\n case \"exhaustion\":\r\n await this.modifyExhaustion(event, actor); break;\r\n case \"inspiration\":\r\n await this.modifyInspiration(actor); break;\r\n default:\r\n await this.modifyCustomCounter(event, actor, actionId); break;\r\n }\r\n }\r\n\r\n /**\r\n * Modify Exhaustion\r\n * @private\r\n * @param {object} event The event\r\n * @param {object} actor The actor\r\n */\r\n async modifyExhaustion(event, actor) {\r\n const isRightClick = this.isRightClick(event);\r\n const currentExhaustion = actor.system.attributes.exhaustion;\r\n const newExhaustion = currentExhaustion + (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} event The event\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async modifyCustomCounter(event, actor, actionId) {\r\n const [id, type] = decodeURIComponent(actionId).split(\">\");\r\n const isRightClick = this.isRightClick(event);\r\n const isCtrl = this.isCtrl(event);\r\n\r\n let value = actor.getFlag(CUSTOM_DND5E.ID, id) || {};\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 = isRightClick ? Math.max(0, currentValue - increment) : currentValue + increment;\r\n setFlag(key, currentValue, newValue);\r\n };\r\n\r\n switch (type) {\r\n case \"checkbox\":\r\n await setFlag(id, !value);\r\n break;\r\n\r\n case \"fraction\":\r\n if (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 (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 * @param {string} actionId The action id\r\n */\r\n async rollMagicItem(actor, actionId) {\r\n const [itemId, magicEffectId] = actionId.split(\">\");\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, magicEffectId);\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} 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 toggleCondition(event, actor, token, actionId) {\r\n if (!token) return;\r\n\r\n const isRightClick = this.isRightClick(event);\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: !!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: !!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} event The event\r\n * @param {object} actor The actor\r\n * @param {string} actionId The action id\r\n */\r\n async toggleEffect(event, actor, actionId) {\r\n const effects = actor.effects.entries ? actor.effects.entries : actor.effects;\r\n const actorEffect = effects.find(effect => effect.id === actionId);\r\n\r\n const effect = actorEffect ?? actor.allApplicableEffects().find(effect => effect.id === actionId);\r\n if (!effect) return;\r\n\r\n const isRightClick = this.isRightClick(event);\r\n\r\n if (isRightClick && actorEffect) {\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 * @param {string} encodedValue\r\n */\r\n async handleActionHover(event, encodedValue) {\r\n const types = [\"feature\", \"item\", \"spell\", \"weapon\", \"magicItem\"];\r\n const [actionType, actionId] = encodedValue.split(\"|\");\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 switch (event.type) {\r\n case \"mouseenter\":\r\n case \"mouseover\":\r\n Hooks.call(\"tokenActionHudSystemActionHoverOn\", event, item);\r\n break;\r\n case \"mouseleave\":\r\n case \"mouseout\":\r\n Hooks.call(\"tokenActionHudSystemActionHoverOff\", event, item);\r\n break;\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","coreModule","getSetting","key","defaultValue","value","game","settings","get","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","capitalize","encodedValue","join","delimiter","icon1","getProficiencyIcon","proficient","info1","text","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","statusEffects","hasCondition","effects","some","statuses","status","disabled","img","getImage","tooltip","getTooltip","getConditionTooltipData","isModuleActive","keys","_","visible","active","attributes","death","success","failure","getFlag","max","encodeURIComponent","allApplicableEffects","size","conditionIds","Set","conditionTypes","dnd5e","utils","staticID","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","f","spellSlotModes","levelInfo","slots","info","utilityTypes","deathSave","inspiration","hp","utilityType","options","getAction","entity","_id","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","allowedTypes","per","recovery","period","limitedUsePeriods","perPeriod","spent","firstActivity","firstTarget","consumption","targets","consumeId","target","consumeType","consumeAmount","parentId","substr","lastIndexOf","foundry","getProperty","slowActivationTypes","proficiencyLevels","abilityActivationTypes","tooltipsSetting","unidentified","description","modifiers","rarity","traits","chatProperties","equippableItemCardProperties","labels","range","duration","p","getWeaponProperties","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","attunment","attunementTypes","REQUIRED","RollHandler","handleActionClick","event","actionId","split","handleAction","rollAbility","rollAbilityTest","rollAbilitySave","toggleCondition","modifyCounter","toggleEffect","modifyExhaustion","isRenderItem","renderItem","useItem","rollMagicItem","rollSkill","performUtilityAction","rollDeathSave","modifyInspiration","modifyCustomCounter","isRightClick","currentExhaustion","newExhaustion","update","decodeURIComponent","isCtrl","setFlag","currentValue","newValue","adjustValue","increment","Math","itemId","magicEffectId","magicItemActor","roll","callAll","getItem","needsRecharge","rollRecharge","use","legacy","nextTurn","rollInitiative","createCombatants","statusEffect","find","isConvenient","flags","dfreds","effectName","effectInterface","overlay","findCondition","findEffect","delete","toggleStatusEffect","actorEffect","handleActionHover","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,KA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ACd,CACEjU,GAAI,cACJC,OACA6J,SAAU,UAAU7J,IACpBE,KAAM,WAGVgf,EAASnB,OAAOqB,MAAK,CAACC,EAAGC,IAAMD,EAAEtf,GAAGwf,cAAcD,EAAEvf,KACrD,CACD,OAAOmf,CACR,EACF,IClEHxa,MAAM8a,GAAG,8BAA8B5a,UACrC,MAAM6a,EAASva,KAAKia,QAAQ/Z,IAAI9H,EAAOC,IACvCkiB,EAAOpa,IAAM,CACXqa,0BRWwC,MQVxCvB,iBAEFzZ,MAAM2Y,KAAK,4BAA6BoC,EAAO"}
\ No newline at end of file
diff --git a/styles/tah-dnd5e.css b/styles/tah-dnd5e.css
index 7fba029..645c582 100644
--- a/styles/tah-dnd5e.css
+++ b/styles/tah-dnd5e.css
@@ -76,4 +76,8 @@
.tah-tags .tah-tag.artifact {
border-color: #9d0289;
background-color: #9d0289;
+ }
+
+ .tah-icon > i {
+ font-size: 10px;
}
\ No newline at end of file