Skip to content

Commit

Permalink
Updated macros
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyVadala committed Jul 4, 2022
1 parent a7f85aa commit 10dcebd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packs/macros-misc.db
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@
{"name":"Show Modules","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{},"scope":"global","command":"/**\n * Show Modules - Shows currently installed modules in foundry. Added on behalf of @vance\n */\nlet mods = '';\ngame.modules.forEach(m => {\n let a = m.active ? 'Enabled' : 'Disabled';\n mods = mods.concat(`${m.id}: ${a}\\n`);\n});\n\nlet d = new Dialog({\n title: `Enabled Mods`,\n content: `<textarea style=\"height: 500px;\" type=\"text\" id=\"modslist\" name=\"modslist\">${mods}</textarea>`,\n buttons: {\n copy: {\n label: `Copy to clipboard`,\n callback: () => {\n $(\"#modslist\").select();\n document.execCommand('copy');\n }\n },\n close: {\n icon: \"<i class='fas fa-tick'></i>\",\n label: `Close`\n },\n },\n default: \"close\",\n close: () => {}\n});\n\nd.render(true);","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"u71xIHwO8uVaLS8o"}
{"_id":"wosXzUFEMQLD84so","name":"Ambient Light Quick Edit","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{},"scope":"global","command":"let macroName = \"AmbientLight QuickEditor\"\nlet macroEndLog = \"---------------------------------------------\"\n\nlet i=0;\nlet lights = canvas.lighting.objects.children;\nlet lightSelected = lights[0];\nlet selectOptions = \"\";\nlet lightSelectedAngle = 0;\nlet lightSelectedBright = 0;\nlet lightSelectedDim = 0;\nlet lightSelectedRotation = 0;\nlet lightSelectedTintAlpha = 1;\nlet lightSelectedTintColor = \"\";\n\nconsole.log(\"---------------------------------------------\");\nconsole.log(`${macroName} by PaperPunk`);\nconsole.log(\"---------------------------------------------\");\nconsole.log(`${macroName} | Start`);\n\nconst drawingDetails = {\n author: game.user._id,\n fillAlpha: 0,\n fillColor: \"#808080\",\n fillType: 1,\n fontFamily: \"FontAwesome\",\n fontSize: 24,\n height: 48,\n hidden: false,\n locked: false,\n rotation: 0,\n strokeAlpha: 1,\n strokeColor: \"#000000\",\n strokeWidth: 2,\n text: i,\n textAlpha: 1,\n textColor: \"#ffffff\",\n type: \"r\",\n width: 48,\n //x: 250,\n x: lightSelected.x-24,\n //y: 250\n y: lightSelected.y+25\n};\n\n//let d = Drawing.create(drawingDetails);\n//d.update({\"x\": lights[i].x-24, \"y\": lights[i].y+25, \"text\": i});\n\nfor (i= 0; i< lights.length; i++) {\n selectOptions += `<option value=\"${i}\">AmbientLight ${i}</option>`;\n}\n\nconst htmlLightSelection = `\n <form>\n <h2>Select your light.</h2>\n <div class=\"form-group\">\n <label>Light:</label>\n <select id=\"light-selector\" name=\"light-selector\">\n ${selectOptions}\n </select>\n </div>\n </form>\n `;\n\nlet dialogSelector = new Dialog({\n title: `${macroName}`,\n content: htmlLightSelection,\n buttons: {\n confirm: {\n icon: \"<i class='fas fa-tick'></i>\",\n label: `Confirm`,\n callback: htmlLightSelection => { \n lightSelected = (htmlLightSelection.find('[name=\"light-selector\"]')[0].value)\n lightSelectedAngle = lights[lightSelected].data.angle;\n lightSelectedBright = lights[lightSelected].data.bright;\n lightSelectedDim = lights[lightSelected].data.dim;\n lightSelectedRotation = lights[lightSelected].data.rotation;\n lightSelectedTintAlpha = lights[lightSelected].data.tintAlpha;\n lightSelectedTintColor = lights[lightSelected].data.tintColor;\n //console.log(`${macroName} | lightSelected = ${lightSelected}`);\n //console.log(`${macroName} | lightSelectedBright = ${lightSelectedBright}`);\n dialogEditor.render(true);\n }\n },\n cancel: {\n icon: \"<i class='fas fa-times'></i>\",\n label: `Cancel`,\n callback: () => {\n console.log(`${macroName} | Goodbye`);\n console.log(macroEndLog);\n }\n },\n },\n default: \"cancel\",\n //close: () => console.log(\"AmbientLight QuickEditor | Dialog Window Closed\")\n});\n\nlet dialogEditor = new Dialog({\n title: `${macroName}`,\n content: `<h2>Edit your light.</h2>\n <p>Emission Angle: ${lightSelectedAngle}</p>\n <p>Bright light distance: ${lightSelectedBright}</p>\n <p>Dim light distance: ${lightSelectedDim}</p>\n <p>Rotation CW from down: ${lightSelectedRotation}</p>\n <p>Tint Alpha: ${lightSelectedAngle}</p>\n <p>Tint Color HexCode: ${lightSelectedAngle}</p>`,\n buttons: {\n rot5cw: {\n icon: \"<i class='fas fa-redo'></i>\",\n label: `Rotate 5* CW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot+5});\n dialogEditor.render(true);\n }\n },\n rot15cw: {\n icon: \"<i class='fas fa-redo'></i>\",\n label: `Rotate 15* CW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot+15});\n dialogEditor.render(true);\n }\n },\n rot45cw: {\n icon: \"<i class='fas fa-redo'></i>\",\n label: `Rotate 45* CW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot+45});\n dialogEditor.render(true);\n }\n },\n rot5ccw: {\n icon: \"<i class='fas fa-undo'></i>\",\n label: `Rotate 5* CCW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot-5});\n dialogEditor.render(true);\n }\n },\n rot15ccw: {\n icon: \"<i class='fas fa-undo'></i>\",\n label: `Rotate 15* CCW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot-15});\n dialogEditor.render(true);\n }\n },\n rot45ccw: {\n icon: \"<i class='fas fa-undo'></i>\",\n label: `Rotate 45* CCW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot-45});\n dialogEditor.render(true);\n }\n },\n brightup: {\n icon: \"<i class='fas fa-circle'></i>\",\n label: `Increase Bright by 5`,\n callback: () => { \n let bright = lights[lightSelected].data.bright;\n lights[lightSelected].update({\"bright\":bright+5});\n dialogEditor.render(true);\n }\n },\n brightdown: {\n icon: \"<i class='fas fa-circle'></i>\",\n label: `Decrease Bright by 5`,\n callback: () => { \n let bright = lights[lightSelected].data.bright;\n lights[lightSelected].update({\"bright\":bright-5});\n dialogEditor.render(true);\n }\n },\n brightoff: {\n icon: \"<i class='fas fa-circle'></i>\",\n label: `Remove Bright Light`,\n callback: () => { \n lights[lightSelected].update({\"bright\":0});\n dialogEditor.render(true);\n }\n },\n dimup: {\n icon: \"<i class='fas fa-dot-circle'></i>\",\n label: `Increase Dim by 5`,\n callback: () => { \n let dim = lights[lightSelected].data.dim;\n lights[lightSelected].update({\"dim\":dim+5});\n dialogEditor.render(true);\n }\n },\n dimdown: {\n icon: \"<i class='fas fa-dot-circle'></i>\",\n label: `Decrease Dim by 5`,\n callback: () => { \n let dim = lights[lightSelected].data.dim;\n lights[lightSelected].update({\"dim\":dim-5});\n dialogEditor.render(true);\n }\n },\n dimoff: {\n icon: \"<i class='fas fa-dot-circle'></i>\",\n label: `Remove Dim Light`,\n callback: () => { \n lights[lightSelected].update({\"dim\":0});\n dialogEditor.render(true);\n }\n },\n emit15: {\n icon: \"<i class='fas fa-rss'></i>\",\n label: `Emission Angle 15*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":15});\n dialogEditor.render(true);\n }\n },\n emit45: {\n icon: \"<i class='fas fa-rss'></i>\",\n label: `Emission Angle 45*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":45});\n dialogEditor.render(true);\n }\n },\n emit90: {\n icon: \"<i class='fas fa-rss'></i>\",\n label: `Emission Angle 90*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":90});\n dialogEditor.render(true);\n }\n },\n emit180: {\n icon: \"<i class='fas fa-rss'></i>\",\n label: `Emission Angle 180*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":180});\n dialogEditor.render(true);\n }\n },\n emit270: {\n icon: \"<i class='fas fa-rss'></i>\",\n label: `Emission Angle 270*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":270});\n dialogEditor.render(true);\n }\n },\n emit360: {\n icon: \"<i class='fas fa-rss'></i>\",\n label: `Emission Angle 360*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":360});\n dialogEditor.render(true);\n }\n },\n back: {\n icon: \"<i class='fas fa-reply'></i>\",\n label: `Back`,\n callback: () => dialogSelector.render(true)\n },\n close: {\n icon: \"<i class='fas fa-tick'></i>\",\n label: `Close`\n },\n },\n default: \"close\",\n close: () => {\n console.log(`${macroName} | Goodbye`);\n console.log(macroEndLog);\n }\n});\n\ndialogSelector.render(true);\n","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"zsAzgwdGPAeArcIJ","name":"Lock All Doors","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"/**\n * Locks all closed doors on the canvas\n * Author: orcnog\n */\n \nawait canvas.walls.updateAll(w => ({ds: w.data.ds === CONST.WALL_DOOR_STATES.CLOSED ? CONST.WALL_DOOR_STATES.LOCKED : CONST.WALL_DOOR_STATES.CLOSED}), w => w.data.door === CONST.WALL_DOOR_TYPES.DOOR && (w.data.ds === CONST.WALL_DOOR_STATES.LOCKED || w.data.ds === CONST.WALL_DOOR_STATES.CLOSED));","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{"core":{"sourceId":"Macro.sSGS2FhGOqiTIpRV"}}}
{"_id":"BqcD9aq88kWU67Uf","name":"Equip Unequip Shield","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"/**\n * D&D5e biased, paths may be wrong in other systems!\n * Equips/unequips an item. Make sure you change the variables at the top (as required).\n * This script will also error check to make sure items exist and tokens are select. \n * Chat and token icon display options can be set as desired.\n * Author: Zapgun, Freeze#2689 (fix for v9)\n */\n\nconst itemName = 'Shield'; // <--- Change this to the *exact* item name (capitals count!)\nconst sendToChat = true; // <--- Change to 'true' or 'false' to display a chat message about equipping\nconst displayIcon = true; // <--- Change to 'true' or 'false' to display an effect icon when equipped\nconst effectIconPath = 'icons/svg/shield.svg'; // <--- Add the effect icon you want to appear when equipped\n\nlet toggleResult = false;\n\nif (!actor) {\n\tui.notifications.warn('You need to select a token before using this macro!');\n} else {\n\n\tconst myItem = actor.items.getName(itemName);\n\tif (myItem) {\n\t\tlet item = actor.items.get(myItem.id);\n\t\tlet attr = \"data.equipped\";\n\t\tlet equipped = getProperty(item.data, attr);\n\t\tif (sendToChat) {\n\t\t\tif (!equipped) {\n\t\t\t\tchatMessage(actor.name + ' <b>equips</b> their <i>' + ' ' + itemName + '</i>');\n\t\t\t} else {\n\t\t\t\tchatMessage(actor.name + ' <b>un-equips</b> their <i>' + ' ' + itemName + '</i>');\n\t\t\t}\n\t\t}\n\t\titem.update({ [attr]: !getProperty(item.data, attr) });\n\n\t\t// mark/unmark character's token with an effect icon when displayToken is true\n\t\t(async () => {\n\t\t\tif (displayIcon) {\n\t\t\t\ttoggleResult = await token.toggleEffect(effectIconPath, { active: !equipped });\n\t\t\t\t//\tif (toggleResult == equipped) token.toggleEffect(effectIconPath, {active: equipped}); \n\t\t\t}\n\t\t})();\n\n\t} else {\n\t\tui.notifications.warn(\"No item named '\" + itemName + \"' found on character!\");\n\t}\n}\n\nfunction chatMessage(messageContent) {\n\t// create the message\n\tif (messageContent !== '') {\n\t\tlet chatData = {\n\t\t\tuser: game.user.id,\n\t\t\tspeaker: ChatMessage.getSpeaker(),\n\t\t\tcontent: messageContent,\n\t\t};\n\t\tChatMessage.create(chatData, {});\n\t}\n}","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{}}

0 comments on commit 10dcebd

Please sign in to comment.