-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from Jagusti/packs
Add macro and table maintenance features
- Loading branch information
Showing
17 changed files
with
268 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import GMToolkit from "../modules/gm-toolkit.mjs"; | ||
import { refreshToolkitContent, strip } from "../modules/utility.mjs"; | ||
|
||
export default class GMToolkitMaintenanceWrapper extends FormApplication { | ||
async render() { | ||
let listToolkitContent = new Array() | ||
listToolkitContent.macros = await buildLocalizedContent(game.macros) | ||
listToolkitContent.tables = await buildLocalizedContent(game.tables) | ||
|
||
let html = await renderTemplate("modules/wfrp4e-gm-toolkit/templates/gm-toolkit-maintenance.html", listToolkitContent) | ||
|
||
new GMToolkitMaintenance("wfrp4e-gm-toolkit", `${GMToolkit.MODULE_NAME_FULL} Maintenance`,html).render(true); | ||
} | ||
} // end class GMToolkitMaintenanceWrapper | ||
|
||
class GMToolkitMaintenance extends Dialog { | ||
|
||
constructor(module = GMToolkit.MODULE_ID, title, html) { | ||
super({ | ||
title, | ||
content: html, | ||
module: game.modules.get(module), | ||
buttons: { | ||
macros: { | ||
label: "Macros", | ||
callback: async () => { | ||
await refreshToolkitContent("Macro") | ||
} | ||
}, | ||
tables: { | ||
label: "Tables", | ||
callback: async () => { | ||
await refreshToolkitContent("RollTable") | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
|
||
} // end class GMToolkitMainenance | ||
|
||
async function buildLocalizedContent(documentType) { | ||
GMToolkit.log(false, "Starting buildLocalizedContent") | ||
let toolkitContent = (documentType.filter(m=>m.folder?.name==game.gmtoolkit.module.MODULE_NAME)).sort((a, b) => a.name.localeCompare(b.name)) | ||
let contentArray = [] | ||
let pack = [] | ||
|
||
// Set translationKey prefix | ||
let translationKeyPrefix = "" | ||
if (documentType === game.macros) { | ||
translationKeyPrefix = "GMTOOLKIT.Macro" | ||
pack = game.packs.get(`${game.gmtoolkit.module.MODULE_ID}.gm-toolkit-macros`); | ||
} | ||
if (documentType === game.tables) { | ||
translationKeyPrefix = "GMTOOLKIT.Table" | ||
pack = game.packs.get(`${game.gmtoolkit.module.MODULE_ID}.gm-toolkit-tables`); | ||
} | ||
|
||
// Get Compendium documents | ||
let documents = await pack.getDocuments(); | ||
|
||
// build localized array | ||
for (var content of toolkitContent) { | ||
content.translationKey = strip(content.name, translationKeyPrefix, ".") | ||
content.compendiumVersion = documents.filter(d => d.id == content.id).map(i => i.data.flags["wfrp4e-gm-toolkit"].version) | ||
|
||
contentArray.push(content) | ||
} | ||
|
||
GMToolkit.log(false, "contentArray : ", contentArray) | ||
GMToolkit.log(false, "Ending buildLocalizedContent") | ||
|
||
return(contentArray) | ||
|
||
} // end function buildLocalizedContent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"_id":"9rXQv4uJcQoLBitt","name":"Dark Whispers","img":"icons/svg/d20-grey.svg","description":"Generic Dark Whispers that are used as placeholder prompts by the Send Dark Whispers macro.","results":[{"_id":"g9rsj2kp26oh6r3z","type":0,"text":"Let your quarry go.","range":[1,1],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":1,"rangeH":1},{"_id":"h3hvuahahukmiklq","type":0,"text":"'Accidentally' strike an ally.","range":[2,2],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":2,"rangeH":2},{"_id":"9ltv15jz9n4pkc7m","type":0,"text":"Fall asleep on watch.","range":[3,3],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":3,"rangeH":3},{"_id":"j1z9hqs65ife4pqx","type":0,"text":"Kneel before the Magister. Show your allegiance.","range":[4,4],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":4,"rangeH":4},{"_id":"ds7tn3xsonqyquvo","type":0,"text":"Nobody's that good or lucky. However popular or powerful they are. Call out the cheat!","range":[5,5],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":5,"rangeH":5},{"_id":"3cx7xfwzxscq40p2","type":0,"text":"You're not as prepared as you thought you were.","range":[6,6],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":6,"rangeH":6},{"_id":"2rq045im6k1pft53","type":0,"text":"Exert your authority. Make an example of the weakest or most vulnerable.","range":[7,7],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":7,"rangeH":7},{"_id":"5iq16gdx32qx83yv","type":0,"text":"The big indestructible one over there is looking at you funny. Don't stand for it. Defend your honour. Publicly and on your own.","range":[8,8],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":8,"rangeH":8},{"_id":"azxfuejsd1v28wym","type":0,"text":"You didn't come all this way to make friends. Sometimes you end up making enemies. This is one of those opportunities.","range":[9,9],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":9,"rangeH":9},{"_id":"gmfs74ty8wbm8eoy","type":0,"text":"Secrets are burdensome. Be generous and give them away.","range":[10,10],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","collection":null,"resultId":null,"weight":null,"rangeL":10,"rangeH":10}],"formula":"1d10","replacement":true,"displayRoll":true,"folder":null,"sort":0,"permission":{"default":0,"Lngg3hbkX3DayZX9":3},"flags":{"wfrp4e":{"key":"darkwhispers"},"core":{"sourceId":"RollTable.9rXQv4uJcQoLBitt"}}} | ||
{"_id":"9rXQv4uJcQoLBitt","name":"Dark Whispers","img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","description":"Generic Dark Whispers that are used as placeholder prompts by the Send Dark Whispers macro.","results":[{"_id":"g9rsj2kp26oh6r3z","type":0,"text":"Let your quarry go.","range":[1,1],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":1,"rangeH":1},{"_id":"h3hvuahahukmiklq","type":0,"text":"'Accidentally' strike an ally.","range":[2,2],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":2,"rangeH":2},{"_id":"9ltv15jz9n4pkc7m","type":0,"text":"Fall asleep on watch.","range":[3,3],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":3,"rangeH":3},{"_id":"j1z9hqs65ife4pqx","type":0,"text":"Kneel before the Magister. Show your allegiance.","range":[4,4],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":4,"rangeH":4},{"_id":"ds7tn3xsonqyquvo","type":0,"text":"Nobody's that good or lucky. However popular or powerful they are. Call out the cheat!","range":[5,5],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":5,"rangeH":5},{"_id":"3cx7xfwzxscq40p2","type":0,"text":"You're not as prepared as you thought you were.","range":[6,6],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":6,"rangeH":6},{"_id":"2rq045im6k1pft53","type":0,"text":"Exert your authority. Make an example of the weakest or most vulnerable.","range":[7,7],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":7,"rangeH":7},{"_id":"5iq16gdx32qx83yv","type":0,"text":"The big indestructible one over there is looking at you funny. Don't stand for it. Defend your honour. Publicly and on your own.","range":[8,8],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":8,"rangeH":8},{"_id":"azxfuejsd1v28wym","type":0,"text":"You didn't come all this way to make friends. Sometimes you end up making enemies. This is one of those opportunities.","range":[9,9],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":9,"rangeH":9},{"_id":"gmfs74ty8wbm8eoy","type":0,"text":"Secrets are burdensome. Be generous and give them away.","range":[10,10],"drawn":false,"flags":{},"img":"modules/wfrp4e-gm-toolkit/assets/icons/dark-whispers.svg","rangeL":10,"rangeH":10}],"formula":"1d10","replacement":true,"displayRoll":true,"folder":null,"sort":0,"permission":{"default":0,"Lngg3hbkX3DayZX9":3},"flags":{"wfrp4e":{"key":"darkwhispers"},"wfrp4e-gm-toolkit":{"version":"0.9.2"},"core":{"sourceId":"RollTable.9rXQv4uJcQoLBitt"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
========== */ |
Oops, something went wrong.