generated from League-of-Foundry-Developers/FoundryVTT-Module-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8af06e
commit 1d39760
Showing
8 changed files
with
123 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 |
---|---|---|
@@ -1,3 +1,21 @@ | ||
{ | ||
"MODULE.hello": "hello" | ||
"I18N.LANGUAGE": "English", | ||
"pf2e-rules-lawyer": { | ||
"module-settings": { | ||
"enabled": { | ||
"name": "Enable Module", | ||
"hint": "Enables functionality of module" | ||
}, | ||
"position": { | ||
"name": "Enable Module", | ||
"hint": "Enables functionality of module", | ||
"choices": { | ||
"top-left": "Top Left", | ||
"top-right": "Top Right", | ||
"bot-left": "Bottom Left", | ||
"bot-right": "Bottom Right" | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Binary file not shown.
Empty file.
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,7 +1,39 @@ | ||
Hooks.once('init', async function() { | ||
|
||
Hooks.once('ready', function () { | ||
Hooks.on('modifiersMatter', (data) => { | ||
//console.log({ modifiers: data }) | ||
if (!game.settings.get("pf2e-rules-lawyer", "enabled")) return; | ||
const sigMods = ["ESSENTIAL", "HELPFUL", "HARMFUL", "DETRIMENTAL"]; | ||
if (data?.significantModifiers.some(mod => sigMods.includes(mod.significance))) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
const chatWidth = chat.offsetWidth; | ||
const position = "bot-right"; | ||
const anchor = getAnchor(position); | ||
const file = 'modules/pf2e-rules-lawyer/resources/every-plus-one-extra.webm'; | ||
const xOffset = 40; | ||
const yOffset = 0 | ||
const duration = 5000; | ||
new Sequence() | ||
.effect() | ||
.file(file) | ||
.screenSpace() | ||
.screenSpaceAnchor(anchor) | ||
.screenSpacePosition({ x: chatWidth + xOffset, y: yOffset }) | ||
.duration(duration) | ||
} | ||
}) | ||
}); | ||
|
||
Hooks.once('ready', async function() { | ||
|
||
}); | ||
function getAnchor(position) { | ||
switch (position) { | ||
case 'bot-left': | ||
return { x: 0, y: 1 } | ||
case 'bot-right': | ||
return { x: 1, y: 1 } | ||
case 'top-left': | ||
return { x: 0, y: 0 } | ||
case 'top-right': | ||
return { x: 1, y: 0 } | ||
default: | ||
return { x: 0.5, y: 1 } | ||
} | ||
} |
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,27 @@ | ||
Hooks.on("init", () => { | ||
const debouncedReload = foundry.utils.debounce(() => window.location.reload(), 100); | ||
|
||
game.settings.register("pf2e-rules-lawyer", "enabled", { | ||
name: game.i18n.localize("pf2e-rules-lawyer.module-settings.enabled.name"), | ||
hint: game.i18n.localize("pf2e-rules-lawyer.module-settings.enabled.hint"), | ||
scope: "world", | ||
config: true, | ||
default: true, | ||
type: Boolean, | ||
}); | ||
|
||
// game.settings.register("pf2e-rules-lawyer", "position", { | ||
// name: game.i18n.localize("pf2e-rules-lawyer.module-settings.position.name"), | ||
// hint: game.i18n.localize("pf2e-rules-lawyer.module-settings.position.hint"), | ||
// scope: "world", | ||
// config: true, | ||
// default: "roll", | ||
// type: String, | ||
// choices: { | ||
// ["top-left"]: game.i18n.localize("pf2e-rules-lawyer.module-settings.position.choices.top-left"), | ||
// ["top-right"]: game.i18n.localize("pf2e-rules-lawyer.module-settings.position.choices.top-right"), | ||
// ["bot-left"]: game.i18n.localize("pf2e-rules-lawyer.module-settings.position.choices.bot-left"), | ||
// ["bot-right"]: game.i18n.localize("pf2e-rules-lawyer.module-settings.position.choices.bot-right"), | ||
// } | ||
// }); | ||
}) |
Empty file.
This code is now unnecessary if you upgrade your modifiers matter dependency to minimum v1.9.1+; I had a bug that made the hook call include "NONE"-significance modifiers in this list, but no longer.
You can just remove this line and the line before it (and the ending
}
)