From 54490083103e31bf450030d927958b47e11a1495 Mon Sep 17 00:00:00 2001 From: Anthony Vadala Date: Sun, 20 Dec 2020 18:35:26 -0500 Subject: [PATCH] Added and updated macros --- packs/macros-token.db | 1 + 1 file changed, 1 insertion(+) diff --git a/packs/macros-token.db b/packs/macros-token.db index 2179753..4d84f7d 100644 --- a/packs/macros-token.db +++ b/packs/macros-token.db @@ -14,3 +14,4 @@ {"_id":"jBcKwGUwHS2V6nat","name":"Token Vision Configuration","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"chat","flags":{},"scope":"global","command":"// A macro for the Foundry virtual tabletop that lets a user configure their token's vision and lighting settings. This script is taken from Sky's foundry repo here: https://github.com/Sky-Captain-13/foundry/blob/master/scriptMacros/tokenVision.js.\n\nlet applyChanges = false;\nnew Dialog({\n title: `Token Vision Configuration`,\n content: `\n
\n
\n \n \n
\n
\n \n \n
\n
\n `,\n buttons: {\n yes: {\n icon: \"\",\n label: `Apply Changes`,\n callback: () => applyChanges = true\n },\n no: {\n icon: \"\",\n label: `Cancel Changes`\n },\n },\n default: \"yes\",\n close: html => {\n if (applyChanges) {\n for ( let token of canvas.tokens.controlled ) {\n let visionType = html.find('[name=\"vision-type\"]')[0].value || \"none\";\n let lightSource = html.find('[name=\"light-source\"]')[0].value || \"none\";\n let dimSight = 0;\n let brightSight = 0;\n let dimLight = 0;\n let brightLight = 0;\n let lightAngle = 360;\n let lockRotation = token.data.lockRotation;\n let lightAnimation = token.data.lightAnimation;\n let lightAlpha = token.data.lightAlpha;\n let lightColor = token.data.lightColor;\n const colorFire = \"#f8c377\";\n const colorWhite = \"#ffffff\";\n const colorMoonGlow = \"#f4f1c9\";\n // Get Vision Type Values\n switch (visionType) {\n case \"dim0\":\n dimSight = 0;\n brightSight = 0;\n break;\n case \"dim30\":\n dimSight = 30;\n brightSight = 0;\n break;\n case \"dim60\":\n dimSight = 60;\n brightSight = 0;\n break;\n case \"dim90\":\n dimSight = 90;\n brightSight = 0;\n break;\n case \"dim120\":\n dimSight = 120;\n brightSight = 0;\n break;\n case \"dim150\":\n dimSight = 150;\n brightSight = 0;\n break;\n case \"dim180\":\n dimSight = 180;\n brightSight = 0;\n break;\n case \"bright120\":\n dimSight = 0;\n brightSight= 120;\n break;\n case \"nochange\":\n default:\n dimSight = token.data.dimSight;\n brightSight = token.data.brightSight;\n }\n // Get Light Source Values\n switch (lightSource) {\n case \"none\":\n dimLight = 0;\n brightLight = 0;\n lightAnimation = {type: \"none\"};\n break;\n case \"candle\":\n dimLight = 10;\n brightLight = 5;\n lightAnimation = {type: \"torch\", speed: 2, intensity: 2};\n lightColor = colorFire;\n lightAlpha = 0.15;\n break;\n case \"lamp\":\n dimLight = 45;\n brightLight = 15;\n lightAnimation = {type: \"torch\", speed: 2, intensity: 2};\n lightColor = colorFire;\n lightAlpha = 0.15;\n break;\n case \"bullseye\":\n dimLight = 120;\n brightLight = 60;\n lockRotation = false;\n lightAngle = 52.5;\n lightAnimation = {type: \"torch\", speed: 2, intensity: 2};\n lightColor = colorFire;\n lightAlpha = 0.15;\n break;\n case \"hooded-dim\":\n dimLight = 5;\n brightLight = 0;\n lightAnimation = {type: \"torch\", speed: 2, intensity: 2};\n lightColor = colorFire;\n lightAlpha = 0.15;\n break;\n case \"hooded-bright\":\n dimLight = 60;\n brightLight = 30;\n lightAnimation = {type: \"torch\", speed: 2, intensity: 2};\n lightColor = colorFire;\n lightAlpha = 0.15;\n break;\n case \"light\":\n dimLight = 40;\n brightLight = 20;\n lightAnimation = {type: \"none\"};\n lightColor = colorWhite;\n break;\n case \"torch\":\n dimLight = 40;\n brightLight = 20;\n lightAnimation = {type: \"torch\", speed: 2, intensity: 2};\n lightColor = colorFire;\n lightAlpha = 0.15;\n break;\n case \"moon-touched\":\n dimLight = 30;\n brightLight = 15;\n lightAnimation = {type: \"none\"};\n lightColor = colorMoonGlow;\n break;\n case \"nochange\":\n default:\n dimLight = token.data.dimLight;\n brightLight = token.data.brightLight;\n lightAngle = token.data.lightAngle;\n lockRotation = token.data.lockRotation;\n lightAnimation = token.data.lightAnimation;\n lightAlpha = token.data.lightAlpha;\n lightColor = token.data.lightColor;\n }\n // Update Token\n console.log(token);\n token.update({\n vision: true,\n dimSight: dimSight,\n brightSight: brightSight,\n dimLight: dimLight,\n brightLight: brightLight,\n lightAngle: lightAngle,\n lockRotation: lockRotation,\n lightAnimation: lightAnimation,\n lightAlpha: lightAlpha,\n lightColor: lightColor\n });\n }\n }\n }\n}).render(true);","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[]} {"_id":"p8daoiwkQPAnOJNm","name":"Token Multi Select","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{},"scope":"global","command":"/*\nSwap the selected token with another of similar name via a\ndrop-down menu in a dialog box.\n\nTokens for each character should be named similarly but end with\n'_walking.png', '_fighting.png', and '_sneaking.png'. For example,\n'talion_walking.png', 'talion_fighting.png', and 'talion_sneaking.png'\n\nIf a token does not exist, mystery man will be automatically selected.\n*/\n\nif (actor !== undefined && actor !== null) {\n let d = new Dialog({\n title: 'Token Mogrifier',\n content: \"

Select a new token

\" +\n \"\",\n buttons: {\n ok: {\n icon: '',\n label: \"Do it!\",\n callback: () =>\n token.update({\n img: token.data.img.slice(0, token.data.img.lastIndexOf('_')) + document.getElementById(\"token\").value\n })\n },\n cancel: {\n icon: '',\n label: \"Nevermind\",\n callback: () => {}\n }\n }\n });\n d.render(true);\n} else {\n ui.notifications.warn(\"Please select a token.\");\n}\n","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[]} {"name":"Change Disposition","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{},"scope":"global","command":"let applyChanges = false;\nnew Dialog({\n title: `Token Disposition Changer`,\n content: `\n
\n
\n \n \n
\n
\n `,\n buttons: {\n yes: {\n icon: \"\",\n label: `Apply Changes`,\n callback: () => applyChanges = true\n },\n no: {\n icon: \"\",\n label: `Cancel Changes`\n },\n },\n default: \"yes\",\n close: html => {\n if (applyChanges) {\n for ( let token of canvas.tokens.controlled ) {\n let dispoType = html.find('[name=\"dispo-type\"]')[0].value || \"none\";\n switch (dispoType) {\n case \"hostile\":\n token.update({\"disposition\": -1});\n break;\n case \"friendly\":\n token.update({\"disposition\": 1});\n break;\n case \"neutral\":\n token.update({\"disposition\": 0});\n break;\n case \"nochange\":\n default:\n }\n }\n }\n }\n}).render(true);\n","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"soTXCSqJwGWNG9ga"} +{"name":"Randomize Wildcard Tokens","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{"core":{"sourceId":"Macro.BSlgjKB4i6nMVS9e"}},"scope":"global","command":"// To apply to only controlled tokens, change the first line to:\n// for(let nextToken of canvas.tokens.controlled) {\nasync function randomizeImages() {\nfor(let nextToken of canvas.tokens.placeables) {\n if (nextToken.actor.data.token.randomImg) {\n let tokenImgArray = await game.actors.get(nextToken.actor.id).getTokenImages();\n let imageChoice = Math.floor(Math.random() * tokenImgArray.length);\n let image = tokenImgArray[imageChoice]\n nextToken.update({ \"img\": image })\n }\n}\n}\nrandomizeImages()","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"Ou2x4SEW35uHCvDh"}