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