From eafade24055c8c0278a4de068c643fe8fbb1d6d2 Mon Sep 17 00:00:00 2001 From: Jagusti <521096+Jagusti@users.noreply.github.com> Date: Fri, 19 Aug 2022 17:06:35 +0100 Subject: [PATCH] Update macro compendium --- CHANGELOG.md | 1 + packs/gm-toolkit-macros.db | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bb2d41..36cd13d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ See [Issue Backlog](../../issues) and [Roadmap](../../milestones). - v9 is no longer supported beyond GM Toolkit [v0.9.4.4](https://github.com/Jagusti/fvtt-wfrp4e-gmtoolkit/releases/tag/v0.9.4.4). - v10 the minimum version required for GM Toolkit. - Full details can be found in [#156](https://github.com/Jagusti/fvtt-wfrp4e-gmtoolkit/issues/156). + - Nearly all macros have been updated. These can be re-imported using the `Update GM Toolkit` module setting. - *Removed* extra console logging in maintenance and group test applications. [#75d6dd](https://github.com/Jagusti/fvtt-wfrp4e-gmtoolkit/commit/75d6dd540a7d8dbe6a3cb9d6be940a33552dbd03) - *Added* initial support for vision modes, as well as sight saturation and colour to be able to leverage v10 vision changes in Set Token Vision and Light. - *Changed* Advantage handling to deal with Tokens primarily, and Combatants for setting flags (which is used for Lose Momentum). Actor documents are no longer supported. diff --git a/packs/gm-toolkit-macros.db b/packs/gm-toolkit-macros.db index f56757a..08d3ca5 100644 --- a/packs/gm-toolkit-macros.db +++ b/packs/gm-toolkit-macros.db @@ -1,15 +1,15 @@ -{"_id":"2sefSFqqAbySw2nz","name":"Reduce Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-reduce.svg","scope":"global","command":"game.gmtoolkit.advantage.update(token, \"reduce\")\n\n/* ==========\n* MACRO: Reduce Advantage\n* VERSION: 0.9.5\n* UPDATED: 2022-08-04\n* DESCRIPTION: Reduces Advantage for the selected token by 1 (to minimum 0).\n* TIP: Token must be added to an encounter in the Combat Tracker.\n========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"0.9.5"}}} -{"_id":"6EKiEQZTbmQN97Vr","name":"Clear Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-clear.svg","scope":"global","command":"game.gmtoolkit.advantage.update(token, \"clear\")\n\n/* ==========\n* MACRO: Clear Advantage\n* VERSION: 0.9.5\n* UPDATED: 2022-08-04\n* DESCRIPTION: Resets Advantage for the selected token to 0.\n* TIP: Token does not have to be added to an encounter in the Combat Tracker.\n========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"0.9.5"}}} -{"_id":"AjUYYy7qAN55BERN","name":"Add Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-add.svg","scope":"global","command":"game.gmtoolkit.advantage.update(token, \"increase\")\n\n/* ==========\n* MACRO: Add Advantage\n* VERSION: 0.9.5\n* UPDATED: 2022-08-04\n* DESCRIPTION: Increases Advantage for the selected token by 1.\n* TIP: Token must be added to an encounter in the Combat Tracker.\n* TIP: Caps at character's maximum advantage.\n========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"0.9.5"}}} -{"_id":"DGYdRmtbMZ81NmQ3","name":"Set Token Vision and Light","type":"script","author":"Zo7HSQ75uO8dWUkH","img":"modules/wfrp4e-gm-toolkit/assets/icons/set-token-vision-light.svg","scope":"global","command":"setTokenVisionLight()\n\nasync function canvasTokensUpdate (data) {\n const updates = canvas.tokens.controlled\n .map(token => mergeObject({ _id: token.id }, data))\n await canvas.scene.updateEmbeddedDocuments(\"Token\", updates)\n}\n\nasync function setTokenVisionLight () {\n if (canvas.tokens.controlled.length < 1) return ui.notifications.error( game.i18n.localize(\"GMTOOLKIT.Token.Select\"), {} )\n\n let applyChanges = false\n\n new Dialog({\n title: game.i18n.localize(\"GMTOOLKIT.Dialog.SetVisionLight.Title\"),\n content: `\n
\n `,\n buttons: {\n no: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Cancel\")\n },\n yes: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Apply\"),\n callback: () => applyChanges = true\n }\n },\n default: \"yes\",\n close: async html => {\n if (applyChanges) {\n\n for ( const token of canvas.tokens.controlled ) {\n\n // Define a set of baseline values. Light Source and Vision choices will only change the properties that differ. Not all of the options available since Foundry v9 are used.\n // Baseline Vision Values\n let advNightVision = 0\n let dimSight = 0\n let brightSight = 0\n let sightAngle = 360\n // Baseline Light Source Values\n let dimLight = 0\n let brightLight = 0\n let lightAngle = 360\n let lightColor = null\n let lightColorIntensity = 0\n let animationIntensity = 1\n let animationSpeed = 1\n let animationType = \"none\"\n\n let visionType = html.find('[name=\"vision-type\"]')[0].value // TODO: default vision option based on condition -> trait -> talent. Issue Log: https://github.com/Jagusti/fvtt-wfrp4e-gmtoolkit/issues/42\n let item // Used for finding whether token has Night Vision or Dark Vision\n let lightSource = html.find('[name=\"light-source\"]')[0].value\n\n // Get Light Source Values\n switch (lightSource) {\n case \"none\":\n case \"storm-shut\":\n dimLight = 0\n break\n case \"matches\":\n dimLight = 5\n brightLight = 2\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.3\n animationIntensity = 8\n animationSpeed = 8\n animationType = \"torch\"\n break\n case \"candle\":\n dimLight = 10\n brightLight = 5\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.3\n animationIntensity = 8\n animationSpeed = 8\n animationType = \"torch\"\n break\n case \"davrich-lamp\":\n dimLight = 10\n brightLight = 5\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.4\n animationIntensity = 4\n animationSpeed = 4\n animationType = \"torch\"\n break\n case \"torch\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.5\n animationIntensity = 7\n animationSpeed = 7\n animationType = \"torch\"\n break\n case \"lantern\":\n dimLight = 20\n brightLight = 10\n lightColor = \"#ffcc66\"\n lightColorIntensity = 0.7\n animationIntensity = 3\n animationSpeed = 3\n animationType = \"torch\"\n break\n case \"storm-broad\":\n dimLight = 20\n brightLight = 10\n lightColor = \"#ffcc66\"\n lightColorIntensity = 0.5\n animationIntensity = 1\n animationSpeed = 2\n animationType = \"torch\"\n break\n case \"storm-narrow\":\n dimLight = 30\n brightLight = 20\n lightColor = \"#ffcc66\"\n lightColorIntensity = 0.7\n animationIntensity = 1\n animationSpeed = 1\n animationType = \"torch\"\n lightAngle = 90\n break\n case \"light\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#99ffff\"\n lightColorIntensity = 0.5\n animationIntensity = 3\n animationSpeed = 2\n animationType = \"pulse\"\n break\n case \"witchlight\":\n dimLight = 20\n brightLight = 10\n lightColor = \"#99ffff\"\n lightColorIntensity = 0.7\n animationIntensity = 6\n animationSpeed = 2\n animationType = \"chroma\"\n break\n case \"glowing-skin\":\n dimLight = 10\n brightLight = 3\n lightColor = \"#ffbd80\"\n lightColorIntensity = 0.3\n animationIntensity = 2\n animationSpeed = 2\n animationType = \"pulse\"\n break\n case \"ablaze\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#ff7733\"\n lightColorIntensity = 0.5\n animationIntensity = 7\n animationSpeed = 7\n animationType = \"torch\"\n break\n case \"pha\":\n dimLight = token.actor.data.data.characteristics.wp.bonus\n brightLight = token.actor.data.data.characteristics.wp.bonus\n lightColor = \"#ffddbb\"\n lightColorIntensity = 0.6\n animationIntensity = 4\n animationSpeed = 4\n animationType = \"sunburst\"\n break\n case \"soulfire\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#ff7733\"\n lightColorIntensity = 0.5\n animationIntensity = 7\n animationSpeed = 7\n animationType = \"fog\"\n break\n default:\n dimLight = token.data.light.dim\n brightLight = token.data.light.bright\n lightAngle = token.data.light.angle\n lightColor = token.data.light.color\n }\n\n // Get Vision Type Values\n switch (visionType) {\n case \"blindedVision\":\n brightSight = 1\n dimSight = 0\n break\n case \"noVision\":\n dimSight = 0\n brightSight = 0\n dimLight = 0\n brightLight = 0\n break\n case \"darkVision\":\n const darkvision = game.i18n.localize(\"NAME.DarkVision\").toLowerCase()\n item = token.actor.items.find(\n i => i.data.name.toLowerCase() === darkvision\n )\n if (item !== undefined) {\n dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeDarkVision\"))\n } else {\n game.settings.get(\"wfrp4e-gm-toolkit\", \"overrideDarkVision\") ? dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeDarkVision\")) : dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\"))\n }\n brightSight = dimSight / 2\n break\n case \"nightVision\":\n const nightvision = game.i18n.localize(\"NAME.NightVision\").toLowerCase()\n // Night Vision requires some minimal illumination to provide a benefit\n if (\n game.scenes.viewed.data.darkness < 1\n | dimLight > 0\n | game.scenes.viewed.data.globalLight\n ) {\n item = token.actor.items.find(\n i => i.data.name.toLowerCase() === nightvision\n )\n if (item === undefined) {\n game.settings.get(\"wfrp4e-gm-toolkit\", \"overrideNightVision\") ? advNightVision = 1 : advNightVision = 0\n } else {\n for (let item of token.actor.items) {\n if (item.name.toLowerCase() === nightvision ) {\n switch (item.type) {\n case \"trait\":\n advNightVision = 1\n break\n case \"talent\":\n advNightVision += item.data.data.advances.value\n break\n }\n }\n }\n }\n brightSight = 20 * advNightVision\n dimSight = Math.max(brightSight + dimLight, Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\")))\n dimSight = advNightVision === 0 ? Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\")) : Math.max(brightSight + dimLight, Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\")))\n sightAngle = lightAngle\n }\n console.log(`Night Vision Advances ${advNightVision}`)\n break\n case \"normalVision\":\n dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\"))\n brightSight = 0\n break\n default:\n dimSight = token.data.dimSight\n brightSight = token.data.brightSight\n }\n\n // Update Token\n await token.document.update({\n vision: true,\n light: {\n dim: dimLight,\n bright: brightLight,\n angle: lightAngle,\n color: lightColor,\n alpha: lightColorIntensity\n },\n \"light.animation\": {\n intensity: animationIntensity,\n speed: animationSpeed,\n type: animationType\n },\n dimSight: dimSight,\n brightSight: brightSight,\n sightAngle: sightAngle\n // \"visionType\": visionType,\n // \"lightSource\": lightSource,\n // \"advNightVision\": advNightVision\n })\n token.refresh(true)\n }\n\n canvasTokensUpdate({ vision: true })\n\n }\n }\n }).render(true)\n}\n\n\n/* ==========\n * MACRO: Set Token Vision and Light\n * VERSION: 0.9.5\n * UPDATED: 2022-08-04\n * DESCRIPTION: Open a dialog for quickly changing vision and lighting parameters of the selected token(s).\n * TIP: Default sight range and Darkvision / Night Vision overrides can be configured in Configure Token Vision Settings under Module Settings.\n ========== */","folder":null,"sort":0,"flags":{"core":{"sourceId":"Macro.issAGdpFxchQw2zp"},"wfrp4e-gm-toolkit":{"version":"0.9.5"}}} -{"_id":"OiQ0cS3QsmQadxqR","name":"Toggle Scene Visibility and Light","type":"script","author":"WpuDIfNQnefaTyuV","img":"modules/wfrp4e-gm-toolkit/assets/icons/toggle-scene-light.svg","scope":"global","command":"let thisScene = game.scenes.viewed\nlet uiNotice = game.i18n.format(\"GMTOOLKIT.Message.UnexpectedNoChange\", {})\n\nif (thisScene.data.tokenVision) {\n thisScene.update({ tokenVision: false, globalLight: true })\n uiNotice = game.i18n.format(\"GMTOOLKIT.Scene.UnrestrictedNotToken\", { sceneName: thisScene.name }, {})\n} else {\n thisScene.update({ tokenVision: true, globalLight: false })\n uiNotice = game.i18n.format(\"GMTOOLKIT.Scene.TokenNotUnrestricted\", { sceneName: thisScene.name }, {})\n}\n\nui.notifications.notify(uiNotice)\n\n/* ==========\n* MACRO: Toggle Scene Vision and Light\n* VERSION: 0.9.5\n* UPDATED: 2022-08-04\n* DESCRIPTION: Toggles the Token Vision and Unrestricted Vision Range settings.\n* TIP: If Token Vision is set, Unrestricted Vision Range is unset (and vice-versa).\n* TIP: Applies to the scene being viewed, which is not necessarily the active scene.\n========== */","folder":null,"sort":0,"flags":{"furnace":{"runAsGM":false},"wfrp4e-gm-toolkit":{"version":"0.9.5"},"core":{"sourceId":"Compendium.wfrp4e-gm-toolkit.gm-toolkit-macros.6UwKY8nGZyXzAXCa"}}} -{"_id":"g9Wohpie7ODdbRKX","name":"Session Turnover","type":"script","author":"BsnP0LhXXtS4iz4M","img":"modules/wfrp4e-gm-toolkit/assets/icons/end-session.svg","scope":"global","command":"endSession()\n\nasync function endSession () {\n if (!game.user.isGM) {\n return ui.notifications.error(game.i18n.localize(\"GMTOOLKIT.Message.SessionEnd.NoPermission\"), {})\n }\n\n game.gmtoolkit.module.log(false, \"Processing Session Turnover.\")\n\n game.gmtoolkit.module.log(false, \"Pausing game.\")\n await game.togglePause(true)\n\n game.gmtoolkit.module.log(false, \"Switching to holding scene.\")\n game.scenes.getName(game.settings.get(\"wfrp4e-gm-toolkit\", \"holdingScene\"))?.activate(true)\n\n game.gmtoolkit.module.log(false, \"Adding Experience.\")\n await game.macros.getName(\"Add XP\").execute()\n\n game.gmtoolkit.module.log(false, \"Resetting Fortune.\")\n await game.macros.getName(\"Reset Fortune\").execute()\n\n game.gmtoolkit.module.log(false, \"Exporting Chat.\")\n if (game.settings.get(\"wfrp4e-gm-toolkit\", \"exportChat\")) {\n await game.messages.export()\n }\n\n if (game.settings.get(\"wfrp4e-gm-toolkit\", \"sessionID\") === \"null\") {\n game.gmtoolkit.module.log(false, \"Not updating Session ID.\")\n } else {\n game.gmtoolkit.module.log(false, \"Updating Session ID.\")\n const thisSession = game.gmtoolkit.utility.getSession().id\n let nextSession = Math.trunc(thisSession) === Number(thisSession)\n ? Number(thisSession) + 1\n : thisSession\n\n const dialog = new Dialog({\n title: game.i18n.localize(\"GMTOOLKIT.Dialog.SessionTurnover.UpdateSessionID.Title\"),\n content: ``,\n buttons: {\n yes: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Apply\"),\n callback: html => {\n nextSession = html.find(\"#next-session\").val()\n game.settings.set(\"wfrp4e-gm-toolkit\", \"sessionID\", nextSession)\n game.gmtoolkit.module.log(true, `Previous Session ID was ${thisSession}. Next Session ID is ${nextSession}.`)\n }\n },\n no: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Cancel\")\n }\n },\n default: \"yes\"\n }).render(true)\n } // End Session ID Update\n\n game.gmtoolkit.module.log(false, \"Completed Session Turnover tasks.\")\n}\n\n/* ==========\n * MACRO: Session Turnover\n * VERSION: 0.9.5\n * UPDATED: 2022-08-04\n * DESCRIPTION: Unified macro to run start and end of session admin, including awarding Experience Points, resetting Fortune, pausing the game and exporting the chat log.\n * TIP: Various default options can be defined in Session Management Settings under Module Settings.\n ========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"0.9.5"}}} +{"_id":"2sefSFqqAbySw2nz","name":"Reduce Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-reduce.svg","scope":"global","command":"game.gmtoolkit.advantage.update(token, \"reduce\")\n\n/* ==========\n* MACRO: Reduce Advantage\n* VERSION: 6.0.0\n* UPDATED: 2022-08-04\n* DESCRIPTION: Reduces Advantage for the selected token by 1 (to minimum 0).\n* TIP: Token must be added to an encounter in the Combat Tracker.\n========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"6.0.0"}}} +{"_id":"6EKiEQZTbmQN97Vr","name":"Clear Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-clear.svg","scope":"global","command":"game.gmtoolkit.advantage.update(token, \"clear\")\n\n/* ==========\n* MACRO: Clear Advantage\n* VERSION: 6.0.0\n* UPDATED: 2022-08-04\n* DESCRIPTION: Resets Advantage for the selected token to 0.\n* TIP: Token does not have to be added to an encounter in the Combat Tracker.\n========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"6.0.0"}}} +{"_id":"AjUYYy7qAN55BERN","name":"Add Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-add.svg","scope":"global","command":"game.gmtoolkit.advantage.update(token, \"increase\")\n\n/* ==========\n* MACRO: Add Advantage\n* VERSION: 6.0.0\n* UPDATED: 2022-08-04\n* DESCRIPTION: Increases Advantage for the selected token by 1.\n* TIP: Token must be added to an encounter in the Combat Tracker.\n* TIP: Caps at character's maximum advantage.\n========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"6.0.0"}}} +{"_id":"DGYdRmtbMZ81NmQ3","name":"Set Token Vision and Light","type":"script","author":"Zo7HSQ75uO8dWUkH","img":"modules/wfrp4e-gm-toolkit/assets/icons/set-token-vision-light.svg","scope":"global","command":"setTokenVisionLight()\n\nasync function canvasTokensUpdate (data) {\n const updates = canvas.tokens.controlled\n .map(token => mergeObject({ _id: token.id }, data))\n await canvas.scene.updateEmbeddedDocuments(\"Token\", updates)\n}\n\nasync function setTokenVisionLight () {\n if (canvas.tokens.controlled.length < 1) return ui.notifications.error( game.i18n.localize(\"GMTOOLKIT.Token.Select\"), {} )\n\n let applyChanges = false\n\n new Dialog({\n title: game.i18n.localize(\"GMTOOLKIT.Dialog.SetVisionLight.Title\"),\n content: `\n \n `,\n buttons: {\n no: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Cancel\")\n },\n yes: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Apply\"),\n callback: () => applyChanges = true\n }\n },\n default: \"yes\",\n close: async html => {\n if (applyChanges) {\n\n for ( const token of canvas.tokens.controlled ) {\n\n // Define a set of baseline values. Light Source and Vision choices will only change the properties that differ. Not all of the options available since Foundry v9 are used.\n // Baseline Vision Values\n let advNightVision = 0\n let dimSight = 0\n let brightSight = 0\n let sightAngle = 360\n // Baseline Light Source Values\n let dimLight = 0\n let brightLight = 0\n let lightAngle = 360\n let lightColor = null\n let lightColorIntensity = 0\n let animationIntensity = 1\n let animationSpeed = 1\n let animationType = \"none\"\n\n let visionType = html.find('[name=\"vision-type\"]')[0].value // TODO: default vision option based on condition -> trait -> talent. Issue Log: https://github.com/Jagusti/fvtt-wfrp4e-gmtoolkit/issues/42\n let item // Used for finding whether token has Night Vision or Dark Vision\n let lightSource = html.find('[name=\"light-source\"]')[0].value\n\n // Get Light Source Values\n switch (lightSource) {\n case \"none\":\n case \"storm-shut\":\n dimLight = 0\n break\n case \"matches\":\n dimLight = 5\n brightLight = 2\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.3\n animationIntensity = 8\n animationSpeed = 8\n animationType = \"torch\"\n break\n case \"candle\":\n dimLight = 10\n brightLight = 5\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.3\n animationIntensity = 8\n animationSpeed = 8\n animationType = \"torch\"\n break\n case \"davrich-lamp\":\n dimLight = 10\n brightLight = 5\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.4\n animationIntensity = 4\n animationSpeed = 4\n animationType = \"torch\"\n break\n case \"torch\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#ffaa00\"\n lightColorIntensity = 0.5\n animationIntensity = 7\n animationSpeed = 7\n animationType = \"torch\"\n break\n case \"lantern\":\n dimLight = 20\n brightLight = 10\n lightColor = \"#ffcc66\"\n lightColorIntensity = 0.7\n animationIntensity = 3\n animationSpeed = 3\n animationType = \"torch\"\n break\n case \"storm-broad\":\n dimLight = 20\n brightLight = 10\n lightColor = \"#ffcc66\"\n lightColorIntensity = 0.5\n animationIntensity = 1\n animationSpeed = 2\n animationType = \"torch\"\n break\n case \"storm-narrow\":\n dimLight = 30\n brightLight = 20\n lightColor = \"#ffcc66\"\n lightColorIntensity = 0.7\n animationIntensity = 1\n animationSpeed = 1\n animationType = \"torch\"\n lightAngle = 90\n break\n case \"light\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#99ffff\"\n lightColorIntensity = 0.5\n animationIntensity = 3\n animationSpeed = 2\n animationType = \"pulse\"\n break\n case \"witchlight\":\n dimLight = 20\n brightLight = 10\n lightColor = \"#99ffff\"\n lightColorIntensity = 0.7\n animationIntensity = 6\n animationSpeed = 2\n animationType = \"chroma\"\n break\n case \"glowing-skin\":\n dimLight = 10\n brightLight = 3\n lightColor = \"#ffbd80\"\n lightColorIntensity = 0.3\n animationIntensity = 2\n animationSpeed = 2\n animationType = \"pulse\"\n break\n case \"ablaze\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#ff7733\"\n lightColorIntensity = 0.5\n animationIntensity = 7\n animationSpeed = 7\n animationType = \"torch\"\n break\n case \"pha\":\n dimLight = token.actor.data.data.characteristics.wp.bonus\n brightLight = token.actor.data.data.characteristics.wp.bonus\n lightColor = \"#ffddbb\"\n lightColorIntensity = 0.6\n animationIntensity = 4\n animationSpeed = 4\n animationType = \"sunburst\"\n break\n case \"soulfire\":\n dimLight = 15\n brightLight = 7.5\n lightColor = \"#ff7733\"\n lightColorIntensity = 0.5\n animationIntensity = 7\n animationSpeed = 7\n animationType = \"fog\"\n break\n default:\n dimLight = token.data.light.dim\n brightLight = token.data.light.bright\n lightAngle = token.data.light.angle\n lightColor = token.data.light.color\n }\n\n // Get Vision Type Values\n switch (visionType) {\n case \"blindedVision\":\n brightSight = 1\n dimSight = 0\n break\n case \"noVision\":\n dimSight = 0\n brightSight = 0\n dimLight = 0\n brightLight = 0\n break\n case \"darkVision\":\n const darkvision = game.i18n.localize(\"NAME.DarkVision\").toLowerCase()\n item = token.actor.items.find(\n i => i.data.name.toLowerCase() === darkvision\n )\n if (item !== undefined) {\n dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeDarkVision\"))\n } else {\n game.settings.get(\"wfrp4e-gm-toolkit\", \"overrideDarkVision\") ? dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeDarkVision\")) : dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\"))\n }\n brightSight = dimSight / 2\n break\n case \"nightVision\":\n const nightvision = game.i18n.localize(\"NAME.NightVision\").toLowerCase()\n // Night Vision requires some minimal illumination to provide a benefit\n if (\n game.scenes.viewed.data.darkness < 1\n | dimLight > 0\n | game.scenes.viewed.data.globalLight\n ) {\n item = token.actor.items.find(\n i => i.data.name.toLowerCase() === nightvision\n )\n if (item === undefined) {\n game.settings.get(\"wfrp4e-gm-toolkit\", \"overrideNightVision\") ? advNightVision = 1 : advNightVision = 0\n } else {\n for (let item of token.actor.items) {\n if (item.name.toLowerCase() === nightvision ) {\n switch (item.type) {\n case \"trait\":\n advNightVision = 1\n break\n case \"talent\":\n advNightVision += item.data.data.advances.value\n break\n }\n }\n }\n }\n brightSight = 20 * advNightVision\n dimSight = Math.max(brightSight + dimLight, Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\")))\n dimSight = advNightVision === 0 ? Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\")) : Math.max(brightSight + dimLight, Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\")))\n sightAngle = lightAngle\n }\n console.log(`Night Vision Advances ${advNightVision}`)\n break\n case \"normalVision\":\n dimSight = Number(game.settings.get(\"wfrp4e-gm-toolkit\", \"rangeNormalSight\"))\n brightSight = 0\n break\n default:\n dimSight = token.data.dimSight\n brightSight = token.data.brightSight\n }\n\n // Update Token\n await token.document.update({\n vision: true,\n light: {\n dim: dimLight,\n bright: brightLight,\n angle: lightAngle,\n color: lightColor,\n alpha: lightColorIntensity\n },\n \"light.animation\": {\n intensity: animationIntensity,\n speed: animationSpeed,\n type: animationType\n },\n dimSight: dimSight,\n brightSight: brightSight,\n sightAngle: sightAngle\n // \"visionType\": visionType,\n // \"lightSource\": lightSource,\n // \"advNightVision\": advNightVision\n })\n token.refresh(true)\n }\n\n canvasTokensUpdate({ vision: true })\n\n }\n }\n }).render(true)\n}\n\n\n/* ==========\n * MACRO: Set Token Vision and Light\n * VERSION: 6.0.0\n * UPDATED: 2022-08-04\n * DESCRIPTION: Open a dialog for quickly changing vision and lighting parameters of the selected token(s).\n * TIP: Default sight range and Darkvision / Night Vision overrides can be configured in Configure Token Vision Settings under Module Settings.\n ========== */","folder":null,"sort":0,"flags":{"core":{"sourceId":"Macro.issAGdpFxchQw2zp"},"wfrp4e-gm-toolkit":{"version":"6.0.0"}}} +{"_id":"OiQ0cS3QsmQadxqR","name":"Toggle Scene Visibility and Light","type":"script","author":"WpuDIfNQnefaTyuV","img":"modules/wfrp4e-gm-toolkit/assets/icons/toggle-scene-light.svg","scope":"global","command":"let thisScene = game.scenes.viewed\nlet uiNotice = game.i18n.format(\"GMTOOLKIT.Message.UnexpectedNoChange\", {})\n\nif (thisScene.data.tokenVision) {\n thisScene.update({ tokenVision: false, globalLight: true })\n uiNotice = game.i18n.format(\"GMTOOLKIT.Scene.UnrestrictedNotToken\", { sceneName: thisScene.name }, {})\n} else {\n thisScene.update({ tokenVision: true, globalLight: false })\n uiNotice = game.i18n.format(\"GMTOOLKIT.Scene.TokenNotUnrestricted\", { sceneName: thisScene.name }, {})\n}\n\nui.notifications.notify(uiNotice)\n\n/* ==========\n* MACRO: Toggle Scene Vision and Light\n* VERSION: 6.0.0\n* UPDATED: 2022-08-04\n* DESCRIPTION: Toggles the Token Vision and Unrestricted Vision Range settings.\n* TIP: If Token Vision is set, Unrestricted Vision Range is unset (and vice-versa).\n* TIP: Applies to the scene being viewed, which is not necessarily the active scene.\n========== */","folder":null,"sort":0,"flags":{"furnace":{"runAsGM":false},"wfrp4e-gm-toolkit":{"version":"6.0.0"},"core":{"sourceId":"Compendium.wfrp4e-gm-toolkit.gm-toolkit-macros.6UwKY8nGZyXzAXCa"}}} +{"_id":"g9Wohpie7ODdbRKX","name":"Session Turnover","type":"script","author":"BsnP0LhXXtS4iz4M","img":"modules/wfrp4e-gm-toolkit/assets/icons/end-session.svg","scope":"global","command":"endSession()\n\nasync function endSession () {\n if (!game.user.isGM) {\n return ui.notifications.error(game.i18n.localize(\"GMTOOLKIT.Message.SessionEnd.NoPermission\"), {})\n }\n\n game.gmtoolkit.module.log(false, \"Processing Session Turnover.\")\n\n game.gmtoolkit.module.log(false, \"Pausing game.\")\n await game.togglePause(true)\n\n game.gmtoolkit.module.log(false, \"Switching to holding scene.\")\n game.scenes.getName(game.settings.get(\"wfrp4e-gm-toolkit\", \"holdingScene\"))?.activate(true)\n\n game.gmtoolkit.module.log(false, \"Adding Experience.\")\n await game.macros.getName(\"Add XP\").execute()\n\n game.gmtoolkit.module.log(false, \"Resetting Fortune.\")\n await game.macros.getName(\"Reset Fortune\").execute()\n\n game.gmtoolkit.module.log(false, \"Exporting Chat.\")\n if (game.settings.get(\"wfrp4e-gm-toolkit\", \"exportChat\")) {\n await game.messages.export()\n }\n\n if (game.settings.get(\"wfrp4e-gm-toolkit\", \"sessionID\") === \"null\") {\n game.gmtoolkit.module.log(false, \"Not updating Session ID.\")\n } else {\n game.gmtoolkit.module.log(false, \"Updating Session ID.\")\n const thisSession = game.gmtoolkit.utility.getSession().id\n let nextSession = Math.trunc(thisSession) === Number(thisSession)\n ? Number(thisSession) + 1\n : thisSession\n\n const dialog = new Dialog({\n title: game.i18n.localize(\"GMTOOLKIT.Dialog.SessionTurnover.UpdateSessionID.Title\"),\n content: ``,\n buttons: {\n yes: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Apply\"),\n callback: html => {\n nextSession = html.find(\"#next-session\").val()\n game.settings.set(\"wfrp4e-gm-toolkit\", \"sessionID\", nextSession)\n game.gmtoolkit.module.log(true, `Previous Session ID was ${thisSession}. Next Session ID is ${nextSession}.`)\n }\n },\n no: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Cancel\")\n }\n },\n default: \"yes\"\n }).render(true)\n } // End Session ID Update\n\n game.gmtoolkit.module.log(false, \"Completed Session Turnover tasks.\")\n}\n\n/* ==========\n * MACRO: Session Turnover\n * VERSION: 6.0.0\n * UPDATED: 2022-08-04\n * DESCRIPTION: Unified macro to run start and end of session admin, including awarding Experience Points, resetting Fortune, pausing the game and exporting the chat log.\n * TIP: Various default options can be defined in Session Management Settings under Module Settings.\n ========== */","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"6.0.0"}}} {"_id":"ihMGjHFP3SdvYH2k","name":"Simply d100","type":"chat","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/d100.svg","scope":"global","command":"/r 1d100","folder":null,"sort":0,"flags":{"wfrp4e-gm-toolkit":{"version":"0.9.3"}}} -{"_id":"iopoLXTz9kfDTfiX","name":"GM Toolbox","type":"script","author":"WpuDIfNQnefaTyuV","img":"modules/wfrp4e-gm-toolkit/assets/icons/macro-chest.svg","scope":"global","command":"(() => {\n // Add and remove macros from the list as needed.\n const macros = [\n \"Add Advantage\",\n \"Clear Advantage\",\n \"Reduce Advantage\",\n \"Check Conditions\",\n \"Session Turnover\",\n \"Add XP\",\n \"Reset Fortune\",\n \"Make Secret Group Test\",\n \"Send Dark Whispers\",\n \"Toggle Scene Visibility and Light\",\n \"Set Token Vision and Light\",\n \"Pull Everyone to Scene\",\n \"Simply d100\"\n ]\n\n let buttons = {}\n let dialog\n let content = \"