Extract constants for SYSTEM / SOCKET

This commit is contained in:
Vincent Vandemeulebrouck
2022-01-29 22:49:34 +01:00
parent 3ae3003be3
commit 3abaf4e944
9 changed files with 37 additions and 31 deletions

View File

@ -7,7 +7,7 @@ import { RdDUtility } from "./rdd-utility.js";
import { Grammar } from "./grammar.js";
import { RdDDice } from "./rdd-dice.js";
import { Misc } from "./misc.js";
import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD } from "./constants.js";
import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
/* -------------------------------------------- */
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
@ -172,7 +172,7 @@ export class RdDCalendrier extends Application {
this.listeNombreAstral = [];
game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.listeNombreAstral);
game.socket.emit("system.foundryvtt-reve-de-dragon", {
game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_reset_nombre_astral",
data: {}
});
@ -254,8 +254,8 @@ export class RdDCalendrier extends Application {
this.checkMaladie("jour");
}
game.settings.set(SYSTEM_RDD, "calendrier", duplicate(this.calendrier));
// Notification aux joueurs
game.socket.emit("system.foundryvtt-reve-de-dragon", {
// Notification aux joueurs // TODO: replace with Hook on game settings update
game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_sync_time",
data: duplicate(this.calendrier)
});
@ -343,7 +343,7 @@ export class RdDCalendrier extends Application {
if (Misc.getActiveUser(request.userId)?.isGM) {
RdDUtility.responseNombreAstral(request);
} else {
game.socket.emit("system.foundryvtt-reve-de-dragon", {
game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_response_nombre_astral",
data: request
});
@ -474,7 +474,7 @@ export class RdDCalendrier extends Application {
await this.rebuildListeNombreAstral();
game.socket.emit("system.foundryvtt-reve-de-dragon", {
game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_sync_time",
data: duplicate(this.calendrier)
});