From ce562b6b8a50119227540e695a8b9397ca21ed28 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 6 Nov 2022 21:39:03 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20des=20diff=C3=A9rents=20sett?= =?UTF-8?q?ings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor-sheet.js | 4 ++-- module/actor.js | 4 ++-- module/item-sheet.js | 2 +- module/rdd-combat.js | 4 ++-- module/rdd-confirm.js | 2 +- module/rdd-main.js | 4 ++-- module/rdd-resolution-table.js | 2 +- module/rdd-roll.js | 2 +- module/rdd-tmr-dialog.js | 4 ++-- module/rdd-utility.js | 2 +- module/rolldata-ajustements.js | 2 +- module/{ => settings}/regles-optionelles.js | 10 ++++----- module/{ => settings}/status-effects.js | 21 +++++++------------ .../{ => settings}/regles-optionelles.html | 0 .../status-effects.html} | 0 15 files changed, 28 insertions(+), 35 deletions(-) rename module/{ => settings}/regles-optionelles.js (96%) rename module/{ => settings}/status-effects.js (89%) rename templates/{ => settings}/regles-optionelles.html (100%) rename templates/{status-effects-settings.html => settings/status-effects.html} (100%) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 61f17d1e..0ee4994f 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -7,10 +7,10 @@ import { Misc } from "./misc.js"; import { RdDCombatManager } from "./rdd-combat.js"; import { RdDCarac } from "./rdd-carac.js"; import { DialogSplitItem } from "./dialog-split-item.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; import { DialogRepos } from "./dialog-repos.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js"; -import { STATUSES } from "./status-effects.js"; +import { STATUSES } from "./settings/status-effects.js"; /* -------------------------------------------- */ /** diff --git a/module/actor.js b/module/actor.js index 4017a9e3..37f90e46 100644 --- a/module/actor.js +++ b/module/actor.js @@ -17,10 +17,10 @@ import { RdDAudio } from "./rdd-audio.js"; import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemArme } from "./item-arme.js"; import { RdDAlchimie } from "./rdd-alchimie.js"; -import { STATUSES, StatusEffects } from "./status-effects.js"; +import { STATUSES, StatusEffects } from "./settings/status-effects.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItemSigneDraconique } from "./item-signedraconique.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; import { TMRRencontres } from "./tmr-rencontres.js"; import { Poetique } from "./poetique.js"; import { EffetsDraconiques } from "./tmr/effets-draconiques.js"; diff --git a/module/item-sheet.js b/module/item-sheet.js index bd81e568..59c68d95 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -5,7 +5,7 @@ import { RdDItemCompetence } from "./item-competence.js"; import { RdDHerbes } from "./rdd-herbes.js"; import { RdDGemme } from "./rdd-gemme.js"; import { HtmlUtility } from "./html-utility.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; import { SYSTEM_RDD } from "./constants.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js"; diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 1858218d..518b5d4f 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -9,8 +9,8 @@ import { RdDBonus } from "./rdd-bonus.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDRoll } from "./rdd-roll.js"; import { RdDRollTables } from "./rdd-rolltables.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; -import { STATUSES } from "./status-effects.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; +import { STATUSES } from "./settings/status-effects.js"; /* -------------------------------------------- */ const premierRoundInit = [ diff --git a/module/rdd-confirm.js b/module/rdd-confirm.js index e406b877..6fe5579d 100644 --- a/module/rdd-confirm.js +++ b/module/rdd-confirm.js @@ -1,5 +1,5 @@ import { Grammar } from "./grammar.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; export class RdDConfirm { /* -------------------------------------------- */ diff --git a/module/rdd-main.js b/module/rdd-main.js index b607c3f8..a1029eeb 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -23,9 +23,9 @@ import { RdDTokenHud } from "./rdd-token-hud.js"; import { RdDCommands } from "./rdd-commands.js"; import { RdDCombatManager, RdDCombat } from "./rdd-combat.js"; import { ChatUtility } from "./chat-utility.js"; -import { StatusEffects } from "./status-effects.js"; +import { StatusEffects } from "./settings/status-effects.js"; import { RddCompendiumOrganiser } from "./rdd-compendium-organiser.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; import { TMRRencontres } from "./tmr-rencontres.js"; import { RdDHotbar } from "./rdd-hotbar-drop.js" import { EffetsDraconiques } from "./tmr/effets-draconiques.js"; diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index 3bf143ef..c6d67bf3 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -1,7 +1,7 @@ import { ChatUtility } from "./chat-utility.js"; import { Misc } from "./misc.js"; import { RdDDice } from "./rdd-dice.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; /** * difficultés au delà de -10 diff --git a/module/rdd-roll.js b/module/rdd-roll.js index fece5d69..efbe8c50 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -6,7 +6,7 @@ import { Misc } from "./misc.js"; import { RdDBonus } from "./rdd-bonus.js"; import { RdDCarac } from "./rdd-carac.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; /** * Extend the base Dialog entity to select roll parameters diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 59d8086a..b91b5d29 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -13,9 +13,9 @@ import { PixiTMR } from "./tmr/pixi-tmr.js"; import { Draconique } from "./tmr/draconique.js"; import { Misc } from "./misc.js"; import { HtmlUtility } from "./html-utility.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; import { RdDDice } from "./rdd-dice.js"; -import { STATUSES } from "./status-effects.js"; +import { STATUSES } from "./settings/status-effects.js"; /* -------------------------------------------- */ export class RdDTMRDialog extends Dialog { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 836926b7..e23d3377 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -6,7 +6,7 @@ import { Misc } from "./misc.js"; import { Grammar } from "./grammar.js"; import { TMRUtility } from "./tmr-utility.js"; import { DialogItemAchat } from "./dialog-item-achat.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; import { RdDDice } from "./rdd-dice.js"; import { RdDItem } from "./item.js"; import { Monnaie } from "./item-monnaie.js"; diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index 4631e7cc..7ba8b0b5 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -6,7 +6,7 @@ import { Misc } from "./misc.js"; import { RdDBonus } from "./rdd-bonus.js"; import { RdDCarac } from "./rdd-carac.js"; import { RdDUtility } from "./rdd-utility.js"; -import { ReglesOptionelles } from "./regles-optionelles.js"; +import { ReglesOptionelles } from "./settings/regles-optionelles.js"; /** * tous les ajustements pouvant s'appliquer. diff --git a/module/regles-optionelles.js b/module/settings/regles-optionelles.js similarity index 96% rename from module/regles-optionelles.js rename to module/settings/regles-optionelles.js index eceda14c..d9094180 100644 --- a/module/regles-optionelles.js +++ b/module/settings/regles-optionelles.js @@ -1,5 +1,5 @@ -import { SYSTEM_RDD } from "./constants.js"; -import { Misc } from "./misc.js"; +import { SYSTEM_RDD } from "../constants.js"; +import { Misc } from "../misc.js"; const listeReglesOptionelles = [ { group: 'Règles de combat', name: 'recul', descr: "Appliquer le recul en cas de particulière en force ou de charge" }, @@ -43,7 +43,7 @@ export class ReglesOptionelles extends FormApplication { game.settings.registerMenu(SYSTEM_RDD, "rdd-options-regles", { name: "Choisir les règles optionelles", - label: "Choix des règles optionelles", + label: "Règles optionelles", hint: "Ouvre la fenêtre de sélection des règles optionelles", icon: "fas fa-bars", type: ReglesOptionelles @@ -61,8 +61,8 @@ export class ReglesOptionelles extends FormApplication { static get defaultOptions() { const options = super.defaultOptions; mergeObject(options, { - id: "optional-settings", - template: "systems/foundryvtt-reve-de-dragon/templates/regles-optionelles.html", + id: "regles-optionelles", + template: "systems/foundryvtt-reve-de-dragon/templates/settings/regles-optionelles.html", height: 600, width: 450, minimizable: false, diff --git a/module/status-effects.js b/module/settings/status-effects.js similarity index 89% rename from module/status-effects.js rename to module/settings/status-effects.js index 488c0e54..6c2146f6 100644 --- a/module/status-effects.js +++ b/module/settings/status-effects.js @@ -1,4 +1,4 @@ -import { SYSTEM_RDD } from "./constants.js"; +import { SYSTEM_RDD } from "../constants.js"; export const STATUSES = { StatusStunned : 'stun', @@ -32,7 +32,7 @@ const demiReveStatusEffect = rddStatusEffects.find(it => it.id == STATUSES.Statu const statusDemiSurprise = [STATUSES.StatusStunned, STATUSES.StatusProne, STATUSES.StatusRestrained]; const statusSurpriseTotale = [STATUSES.StatusUnconscious, STATUSES.StatusBlind, STATUSES.StatusComma]; -export class StatusEffects { +export class StatusEffects extends FormApplication { static onReady() { const rddStatusIds = rddStatusEffects.map(it => it.id); rddStatusEffects.forEach(it => it.flags = { core: { statusId: it.id } }); @@ -50,7 +50,7 @@ export class StatusEffects { label: "Choix des effets", hint: "Ouvre la fenêtre de sélection des effets/status appliqués aux acteurs", icon: "fas fa-bars", - type: StatusEffectsSettings, + type: StatusEffects, restricted: true }); @@ -69,13 +69,12 @@ export class StatusEffects { } static _getUseStatusEffects() { - const setting = game.settings.get(SYSTEM_RDD, "use-status-effects"); - return setting ? setting.split(',') : []; + return game.settings.get(SYSTEM_RDD, "use-status-effects")?.split(',') ?? []; } static _setUseStatusEffects(statusIds) { if (game.user.isGM) { - game.settings.set(SYSTEM_RDD, "use-status-effects", StatusEffects._toSetting(statusIds)); + game.settings.set(SYSTEM_RDD, "use-status-effects", statusIds.join()); } for (let effect of CONFIG.RDD.allEffects) { @@ -84,10 +83,6 @@ export class StatusEffects { CONFIG.statusEffects = CONFIG.RDD.allEffects.filter(it => it.active); } - static _toSetting(statusIds) { - return statusIds.join(); - } - static status(statusId) { return rddStatusEffects.find(it => it.flags?.core?.statusId == statusId); } @@ -95,9 +90,7 @@ export class StatusEffects { static demiReve() { return demiReveStatusEffect; } -} -class StatusEffectsSettings extends FormApplication { constructor(...args) { super(...args); } @@ -105,8 +98,8 @@ class StatusEffectsSettings extends FormApplication { static get defaultOptions() { const options = super.defaultOptions; mergeObject(options, { - id: "status-effects-settings", - template: "systems/foundryvtt-reve-de-dragon/templates/status-effects-settings.html", + id: "status-effects", + template: "systems/foundryvtt-reve-de-dragon/templates/settings/status-effects.html", height: "800", width: 350, minimizable: false, diff --git a/templates/regles-optionelles.html b/templates/settings/regles-optionelles.html similarity index 100% rename from templates/regles-optionelles.html rename to templates/settings/regles-optionelles.html diff --git a/templates/status-effects-settings.html b/templates/settings/status-effects.html similarity index 100% rename from templates/status-effects-settings.html rename to templates/settings/status-effects.html