diff --git a/CHANGELOG.md b/CHANGELOG.md index 11d6e71..fa4338e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,9 @@ See [Issue Backlog](../../issues) and [Roadmap](../../milestones). - Existing content in the folder is removed, so any customizations should be moved to a separate location first. - The Maintenance dialog shows version numbers for world and compendium content, so you can more easily identify if an item has been updated for a release. - The Maintenance dialog also shows the database ID of the item. This can be used to identify existing duplicate world content (such as customised table or macro in a different folder location) that prevents re-importing. +- *Added* notes footer to Advantage suite and Toggle Scene Visibility and Light macros + - This includes macro decsription, version number and date plus usage tips + - This change standardises the presentation of in-context macro documentation across the suite. ## Version 0.9.2 - *Fixed* duplicate results numbering in Dark Whispers table and localization omission [#79] (Thanks @Txus5012). diff --git a/packs/gm-toolkit-macros.db b/packs/gm-toolkit-macros.db index 77419a7..202bf92 100644 --- a/packs/gm-toolkit-macros.db +++ b/packs/gm-toolkit-macros.db @@ -1,6 +1,6 @@ -{"_id":"2sefSFqqAbySw2nz","name":"Reduce Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-reduce.svg","scope":"global","command":"/* Reduces Advantage for the selected token by 1 (to minimum 0).\n*/\n\ngame.gmtoolkit.advantage.updateAdvantage(token,\"reduce\");","folder":null,"sort":0,"permission":{"default":0,"k5y1jEYMBqd9uLUx":3},"flags":{"wfrp4e-gm-toolkit":{"version":"0.8.0"}}} -{"_id":"6EKiEQZTbmQN97Vr","name":"Clear Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-clear.svg","scope":"global","command":"/* Resets Advantage for the selected token to 0 */\n\ngame.gmtoolkit.advantage.updateAdvantage(token,\"clear\");","folder":null,"sort":0,"permission":{"default":0,"k5y1jEYMBqd9uLUx":3},"flags":{"wfrp4e-gm-toolkit":{"version":"0.8.0"}}} -{"_id":"AjUYYy7qAN55BERN","name":"Add Advantage","type":"script","author":"k5y1jEYMBqd9uLUx","img":"modules/wfrp4e-gm-toolkit/assets/icons/advantage-add.svg","scope":"global","command":"/* Increases Advantage for the selected token by 1.\n * Caps at character's maximum advantage. \n*/\n\ngame.gmtoolkit.advantage.updateAdvantage(token,\"increase\");","folder":null,"sort":0,"permission":{"default":0,"k5y1jEYMBqd9uLUx":3},"flags":{"wfrp4e-gm-toolkit":{"version":"0.8.0"}}} +{"_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.updateAdvantage(token,`reduce`); \n\n/* ==========\n* MACRO: Reduce Advantage\n* VERSION: 0.8.0\n* UPDATED: 2021-12-26\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,"permission":{"default":0,"k5y1jEYMBqd9uLUx":3},"flags":{"wfrp4e-gm-toolkit":{"version":"0.8.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.updateAdvantage(token,`clear`);\n\n/* ==========\n* MACRO: Clear Advantage\n* VERSION: 0.8.0\n* UPDATED: 2021-12-26\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,"permission":{"default":0,"k5y1jEYMBqd9uLUx":3},"flags":{"wfrp4e-gm-toolkit":{"version":"0.8.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.updateAdvantage(token,`increase`);\n\n/* ==========\n* MACRO: Add Advantage\n* VERSION: 0.8.0\n* UPDATED: 2021-12-26\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,"permission":{"default":0,"k5y1jEYMBqd9uLUx":3},"flags":{"wfrp4e-gm-toolkit":{"version":"0.8.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.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 \n \n
\n
\n \n \n
\n
\n `,\n buttons: {\n yes: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Apply\"),\n callback: () => applyChanges = true\n },\n no: {\n icon: \"\",\n label: game.i18n.localize(\"GMTOOLKIT.Dialog.Cancel\"),\n },\n },\n default: \"yes\",\n close: async (html) => {\n if (applyChanges) {\n\n for ( let 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 item = token.actor.items.find(i => i.data.name.toLowerCase() == game.i18n.localize(\"GMTOOLKIT.Trait.DarkVision\").toLowerCase() );\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 // Night Vision requires some minimal illumination to provide a benefit\n if (game.scenes.viewed.data.darkness < 1 | dimLight > 0 | game.scenes.viewed.data.globalLight) {\n item = token.actor.items.find(i => i.data.name.toLowerCase() == game.i18n.localize(\"GMTOOLKIT.Talent.NightVision\").toLowerCase() );\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 {\n if (item.name.toLowerCase() == game.i18n.localize(\"GMTOOLKIT.Talent.NightVision\").toLowerCase() ) {\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.1\n * UPDATED: 2022-01-02\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,"permission":{"default":0,"Zo7HSQ75uO8dWUkH":3},"flags":{"core":{"sourceId":"Macro.issAGdpFxchQw2zp"},"wfrp4e-gm-toolkit":{"version":"0.9.1"}}} {"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.3\n* UPDATED: 2022-01-29\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,"permission":{"default":0,"WpuDIfNQnefaTyuV":3},"flags":{"furnace":{"runAsGM":false},"wfrp4e-gm-toolkit":{"version":"0.9.3"},"core":{"sourceId":"Compendium.wfrp4e-gm-toolkit.gm-toolkit-macros.6UwKY8nGZyXzAXCa"}},"_id":"OiQ0cS3QsmQadxqR"} {"_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) == thisSession ? Number(thisSession) + 1 : thisSession;\n \n const dialog = new Dialog({\n title: (game.i18n.localize(\"GMTOOLKIT.Dialog.SessionTurnover.UpdateSessionID.Title\")),\n content: `
\n

${game.i18n.format(\"GMTOOLKIT.Dialog.SessionTurnover.UpdateSessionID.CurrentSession\", {thisSession})}

\n
\n

${game.i18n.localize(\"GMTOOLKIT.Dialog.SessionTurnover.UpdateSessionID.NextSession\")}

\n \n
\n
`,\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.3\n * UPDATED: 2022-01-22\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,"permission":{"default":0,"BsnP0LhXXtS4iz4M":3},"flags":{"wfrp4e-gm-toolkit":{"version":"0.9.3"}}} diff --git a/scripts/macros/add-advantage.js b/scripts/macros/add-advantage.js index 429c876..32774f6 100644 --- a/scripts/macros/add-advantage.js +++ b/scripts/macros/add-advantage.js @@ -1,5 +1,10 @@ -/* Increases Advantage for the selected token by 1. - * Caps at character's maximum advantage. -*/ - game.gmtoolkit.advantage.updateAdvantage(token,`increase`); + +/* ========== +* MACRO: Add Advantage +* VERSION: 0.8.0 +* UPDATED: 2021-12-26 +* DESCRIPTION: Increases Advantage for the selected token by 1. +* TIP: Token must be added to an encounter in the Combat Tracker. +* TIP: Caps at character's maximum advantage. +========== */ diff --git a/scripts/macros/clear-advantage.js b/scripts/macros/clear-advantage.js index 71f6c95..7e472aa 100644 --- a/scripts/macros/clear-advantage.js +++ b/scripts/macros/clear-advantage.js @@ -1,3 +1,10 @@ -/* Resets Advantage for the selected token to 0 */ - game.gmtoolkit.advantage.updateAdvantage(token,`clear`); + +/* ========== +* MACRO: Clear Advantage +* VERSION: 0.8.0 +* UPDATED: 2021-12-26 +* DESCRIPTION: Resets Advantage for the selected token to 0. +* TIP: Token does not have to be added to an encounter in the Combat Tracker. +========== */ + diff --git a/scripts/macros/reduce-advantage.js b/scripts/macros/reduce-advantage.js index 637120f..186b9fa 100644 --- a/scripts/macros/reduce-advantage.js +++ b/scripts/macros/reduce-advantage.js @@ -1,4 +1,9 @@ -/* Reduces Advantage for the selected token by 1 (to minimum 0). -*/ +game.gmtoolkit.advantage.updateAdvantage(token,`reduce`); -game.gmtoolkit.advantage.updateAdvantage(token,`reduce`); \ No newline at end of file +/* ========== +* MACRO: Reduce Advantage +* VERSION: 0.8.0 +* UPDATED: 2021-12-26 +* DESCRIPTION: Reduces Advantage for the selected token by 1 (to minimum 0). +* TIP: Token must be added to an encounter in the Combat Tracker. +========== */