diff --git a/packs/macros-module-specific.db b/packs/macros-module-specific.db index e69de29..d1ae378 100644 --- a/packs/macros-module-specific.db +++ b/packs/macros-module-specific.db @@ -0,0 +1 @@ +{"name":"Token Favorite Action","type":"script","scope":"global","author":"9xl2JLocACiT1lMg","img":"icons/svg/dice-target.svg","command":"/*\n* FAVORITE ACTION PICKER\n* Requires: DND5e with Tidy5eSheet extension\n* --------------------------------------------------------------------------------\n* Provides handy and minimalistic, icon based menu for accessing actions that checked\n* in as favorite for a selected token or main character.\n* --------------------------------------------------------------------------------\n* Author: Broadway-afk\n* This script forked from show_token_actions.js macro made by shawndibble and stick#0520\n*/\n\nclass ActionDialog extends Application {\n getData(){\n // Get user's character or the first token from the controlled list.\n function getTargetActor() {\n const character = game.user.character;\n if (character)\n return character;\n\n const controlled = canvas.tokens.controlled;\n\n if (controlled.length > 0 && controlled[0] !== null)\n return controlled[0].actor;\n }\n\n function buildActionsList(targetActor) {\n let actionsList = [];\n Object.entries(targetActor.itemTypes).forEach(([type, items]) => {\n items.forEach(item => {\n if (item.flags[\"tidy5e-sheet\"]?.favorite) {\n actionsList.push(item);\n }\n });\n })\n return actionsList;\n }\n\n function getContentTemplate(actions) {\n let actionButtonsTemplate = actions.map((action) => {\n let displayName = action.name.split(\" /\")[0];\n let initials = displayName.split(\" \").map((item) => item[0]).join(\"\").toUpperCase();\n return ``\n }).join(\" \");\n\n return `\n ${getCssStyle()}\n