Déplacement des différents settings

This commit is contained in:
Vincent Vandemeulebrouck 2022-11-06 21:39:03 +01:00
parent 9ea4c05199
commit ce562b6b8a
15 changed files with 28 additions and 35 deletions

View File

@ -7,10 +7,10 @@ import { Misc } from "./misc.js";
import { RdDCombatManager } from "./rdd-combat.js"; import { RdDCombatManager } from "./rdd-combat.js";
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
import { DialogSplitItem } from "./dialog-split-item.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 { DialogRepos } from "./dialog-repos.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { STATUSES } from "./status-effects.js"; import { STATUSES } from "./settings/status-effects.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /**

View File

@ -17,10 +17,10 @@ import { RdDAudio } from "./rdd-audio.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { RdDItemArme } from "./item-arme.js"; import { RdDItemArme } from "./item-arme.js";
import { RdDAlchimie } from "./rdd-alchimie.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 { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { RdDItemSigneDraconique } from "./item-signedraconique.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 { TMRRencontres } from "./tmr-rencontres.js";
import { Poetique } from "./poetique.js"; import { Poetique } from "./poetique.js";
import { EffetsDraconiques } from "./tmr/effets-draconiques.js"; import { EffetsDraconiques } from "./tmr/effets-draconiques.js";

View File

@ -5,7 +5,7 @@ import { RdDItemCompetence } from "./item-competence.js";
import { RdDHerbes } from "./rdd-herbes.js"; import { RdDHerbes } from "./rdd-herbes.js";
import { RdDGemme } from "./rdd-gemme.js"; import { RdDGemme } from "./rdd-gemme.js";
import { HtmlUtility } from "./html-utility.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 { SYSTEM_RDD } from "./constants.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js";

View File

@ -9,8 +9,8 @@ import { RdDBonus } from "./rdd-bonus.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDRoll } from "./rdd-roll.js"; import { RdDRoll } from "./rdd-roll.js";
import { RdDRollTables } from "./rdd-rolltables.js"; import { RdDRollTables } from "./rdd-rolltables.js";
import { ReglesOptionelles } from "./regles-optionelles.js"; import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { STATUSES } from "./status-effects.js"; import { STATUSES } from "./settings/status-effects.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
const premierRoundInit = [ const premierRoundInit = [

View File

@ -1,5 +1,5 @@
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { ReglesOptionelles } from "./regles-optionelles.js"; import { ReglesOptionelles } from "./settings/regles-optionelles.js";
export class RdDConfirm { export class RdDConfirm {
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -23,9 +23,9 @@ import { RdDTokenHud } from "./rdd-token-hud.js";
import { RdDCommands } from "./rdd-commands.js"; import { RdDCommands } from "./rdd-commands.js";
import { RdDCombatManager, RdDCombat } from "./rdd-combat.js"; import { RdDCombatManager, RdDCombat } from "./rdd-combat.js";
import { ChatUtility } from "./chat-utility.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 { 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 { TMRRencontres } from "./tmr-rencontres.js";
import { RdDHotbar } from "./rdd-hotbar-drop.js" import { RdDHotbar } from "./rdd-hotbar-drop.js"
import { EffetsDraconiques } from "./tmr/effets-draconiques.js"; import { EffetsDraconiques } from "./tmr/effets-draconiques.js";

View File

@ -1,7 +1,7 @@
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.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 * difficultés au delà de -10

View File

@ -6,7 +6,7 @@ import { Misc } from "./misc.js";
import { RdDBonus } from "./rdd-bonus.js"; import { RdDBonus } from "./rdd-bonus.js";
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
import { RdDResolutionTable } from "./rdd-resolution-table.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 * Extend the base Dialog entity to select roll parameters

View File

@ -13,9 +13,9 @@ import { PixiTMR } from "./tmr/pixi-tmr.js";
import { Draconique } from "./tmr/draconique.js"; import { Draconique } from "./tmr/draconique.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { HtmlUtility } from "./html-utility.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 { RdDDice } from "./rdd-dice.js";
import { STATUSES } from "./status-effects.js"; import { STATUSES } from "./settings/status-effects.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDTMRDialog extends Dialog { export class RdDTMRDialog extends Dialog {

View File

@ -6,7 +6,7 @@ import { Misc } from "./misc.js";
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { TMRUtility } from "./tmr-utility.js"; import { TMRUtility } from "./tmr-utility.js";
import { DialogItemAchat } from "./dialog-item-achat.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 { RdDDice } from "./rdd-dice.js";
import { RdDItem } from "./item.js"; import { RdDItem } from "./item.js";
import { Monnaie } from "./item-monnaie.js"; import { Monnaie } from "./item-monnaie.js";

View File

@ -6,7 +6,7 @@ import { Misc } from "./misc.js";
import { RdDBonus } from "./rdd-bonus.js"; import { RdDBonus } from "./rdd-bonus.js";
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
import { RdDUtility } from "./rdd-utility.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. * tous les ajustements pouvant s'appliquer.

View File

@ -1,5 +1,5 @@
import { SYSTEM_RDD } from "./constants.js"; import { SYSTEM_RDD } from "../constants.js";
import { Misc } from "./misc.js"; import { Misc } from "../misc.js";
const listeReglesOptionelles = [ const listeReglesOptionelles = [
{ group: 'Règles de combat', name: 'recul', descr: "Appliquer le recul en cas de particulière en force ou de charge" }, { 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", { game.settings.registerMenu(SYSTEM_RDD, "rdd-options-regles", {
name: "Choisir les règles optionelles", 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", hint: "Ouvre la fenêtre de sélection des règles optionelles",
icon: "fas fa-bars", icon: "fas fa-bars",
type: ReglesOptionelles type: ReglesOptionelles
@ -61,8 +61,8 @@ export class ReglesOptionelles extends FormApplication {
static get defaultOptions() { static get defaultOptions() {
const options = super.defaultOptions; const options = super.defaultOptions;
mergeObject(options, { mergeObject(options, {
id: "optional-settings", id: "regles-optionelles",
template: "systems/foundryvtt-reve-de-dragon/templates/regles-optionelles.html", template: "systems/foundryvtt-reve-de-dragon/templates/settings/regles-optionelles.html",
height: 600, height: 600,
width: 450, width: 450,
minimizable: false, minimizable: false,

View File

@ -1,4 +1,4 @@
import { SYSTEM_RDD } from "./constants.js"; import { SYSTEM_RDD } from "../constants.js";
export const STATUSES = { export const STATUSES = {
StatusStunned : 'stun', StatusStunned : 'stun',
@ -32,7 +32,7 @@ const demiReveStatusEffect = rddStatusEffects.find(it => it.id == STATUSES.Statu
const statusDemiSurprise = [STATUSES.StatusStunned, STATUSES.StatusProne, STATUSES.StatusRestrained]; const statusDemiSurprise = [STATUSES.StatusStunned, STATUSES.StatusProne, STATUSES.StatusRestrained];
const statusSurpriseTotale = [STATUSES.StatusUnconscious, STATUSES.StatusBlind, STATUSES.StatusComma]; const statusSurpriseTotale = [STATUSES.StatusUnconscious, STATUSES.StatusBlind, STATUSES.StatusComma];
export class StatusEffects { export class StatusEffects extends FormApplication {
static onReady() { static onReady() {
const rddStatusIds = rddStatusEffects.map(it => it.id); const rddStatusIds = rddStatusEffects.map(it => it.id);
rddStatusEffects.forEach(it => it.flags = { core: { statusId: it.id } }); rddStatusEffects.forEach(it => it.flags = { core: { statusId: it.id } });
@ -50,7 +50,7 @@ export class StatusEffects {
label: "Choix des effets", label: "Choix des effets",
hint: "Ouvre la fenêtre de sélection des effets/status appliqués aux acteurs", hint: "Ouvre la fenêtre de sélection des effets/status appliqués aux acteurs",
icon: "fas fa-bars", icon: "fas fa-bars",
type: StatusEffectsSettings, type: StatusEffects,
restricted: true restricted: true
}); });
@ -69,13 +69,12 @@ export class StatusEffects {
} }
static _getUseStatusEffects() { static _getUseStatusEffects() {
const setting = game.settings.get(SYSTEM_RDD, "use-status-effects"); return game.settings.get(SYSTEM_RDD, "use-status-effects")?.split(',') ?? [];
return setting ? setting.split(',') : [];
} }
static _setUseStatusEffects(statusIds) { static _setUseStatusEffects(statusIds) {
if (game.user.isGM) { 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) { for (let effect of CONFIG.RDD.allEffects) {
@ -84,10 +83,6 @@ export class StatusEffects {
CONFIG.statusEffects = CONFIG.RDD.allEffects.filter(it => it.active); CONFIG.statusEffects = CONFIG.RDD.allEffects.filter(it => it.active);
} }
static _toSetting(statusIds) {
return statusIds.join();
}
static status(statusId) { static status(statusId) {
return rddStatusEffects.find(it => it.flags?.core?.statusId == statusId); return rddStatusEffects.find(it => it.flags?.core?.statusId == statusId);
} }
@ -95,9 +90,7 @@ export class StatusEffects {
static demiReve() { static demiReve() {
return demiReveStatusEffect; return demiReveStatusEffect;
} }
}
class StatusEffectsSettings extends FormApplication {
constructor(...args) { constructor(...args) {
super(...args); super(...args);
} }
@ -105,8 +98,8 @@ class StatusEffectsSettings extends FormApplication {
static get defaultOptions() { static get defaultOptions() {
const options = super.defaultOptions; const options = super.defaultOptions;
mergeObject(options, { mergeObject(options, {
id: "status-effects-settings", id: "status-effects",
template: "systems/foundryvtt-reve-de-dragon/templates/status-effects-settings.html", template: "systems/foundryvtt-reve-de-dragon/templates/settings/status-effects.html",
height: "800", height: "800",
width: 350, width: 350,
minimizable: false, minimizable: false,