Skip to content

Commit

Permalink
Use Hiding status effect for v12 only
Browse files Browse the repository at this point in the history
  • Loading branch information
Eligarf committed Jul 1, 2024
1 parent d309ff8 commit 7ee085d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# v4.4.0
* dnd5e: *Hiding* Status Effect can be used to bank stealth results
* dnd5e: *Hiding* Status Effect can be used to bank stealth results (Foundry v12/dnd5e v3.2 only)
* dnd5e: Handle vision-5e's "undefined" detection mode
* Systems can specialize game settings defaults
* Fix v12 lighting calculations
Expand Down
1 change: 0 additions & 1 deletion languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
},
"hiding": {
"choice": "Use 'Hiding' Status Effect",
"hint": "This string will be sent through i18n.localize(). Changing these may affect overall automation of Stealthy's effects. If you want 'hiding', use 'EFFECT.DND5E.StatusHiding'",
"iconhint": "Default icon for Hidden effect (ignored if using Status Effect)"
},
"perceptionDisadvantage": {
Expand Down
1 change: 0 additions & 1 deletion languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
},
"hiding": {
"choice": "Use 'Hiding' Status Effect",
"hint": "Cette chaîne sera envoyée via i18n.localize(). Changing these may affect overall automation of Stealthy's effects. If you want 'hiding', use 'EFFECT.DND5E.StatusHiding'",
"iconhint": "Icône par défaut pour l'effet Détection (ignored if using Status Effect)"
},
"perceptionDisadvantage": {
Expand Down
1 change: 0 additions & 1 deletion languages/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
},
"hiding": {
"choice": "Use 'Hiding' Status Effect",
"hint": "Esta string será enviada através de i18n.localize(). Mudar isso pode afetar a automação geral dos efeitos do Stealthy.. If you want 'hiding', use 'EFFECT.DND5E.StatusHiding'",
"iconhint": "Ícone padrão para o efeito Escondido (ignored if using Status Effect)"
},
"perceptionDisadvantage": {
Expand Down
18 changes: 12 additions & 6 deletions scripts/systems/dnd5e.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ class Engine5e extends Engine {
super.setup();

const hiddenSource = game.settings.get(Stealthy.MODULE_ID, 'hiddenSource');
const hidingAvailable = CONFIG?.DND5E.statusEffects?.hiding.name;
if (hiddenSource === 'hiding' && hidingAvailable) {
this.hiding = game.i18n.localize(hidingAvailable);
const beforeV12 = Math.floor(game.version) < 12;
if (!beforeV12) {
const hidingAvailable = CONFIG?.DND5E.statusEffects?.hiding.name;
if (hiddenSource === 'hiding' && hidingAvailable) {
this.hiding = game.i18n.localize(hidingAvailable);
}
}

Hooks.on('dnd5e.rollSkill', async (actor, roll, skill) => {
Expand All @@ -113,14 +116,17 @@ class Engine5e extends Engine {

getSettingsParameters(version) {
let settings = super.getSettingsParameters(version);

const hidingAvailable = CONFIG?.DND5E.statusEffects?.hiding.name;
if (hidingAvailable) {
settings.hiddenLabel.default = 'EFFECT.DND5E.StatusHiding';
settings.hiddenLabel.hint = 'stealthy.dnd5e.hiding.hint';
settings.hiddenIcon.default = 'systems/dnd5e/icons/svg/statuses/hiding.svg';
settings.hiddenSource.choices['hiding'] = 'stealthy.dnd5e.hiding.choice';
settings.hiddenSource.default = 'hiding';
settings.hiddenIcon.hint = 'stealthy.dnd5e.hiding.iconhint';
const beforeV12 = Math.floor(game.version) < 12;
if (!beforeV12) {
settings.hiddenSource.choices['hiding'] = 'stealthy.dnd5e.hiding.choice';
settings.hiddenSource.default = 'hiding';
}
}
return settings;
}
Expand Down

0 comments on commit 7ee085d

Please sign in to comment.