better sync for "Gm Monitor" between gm
This commit is contained in:
@@ -176,8 +176,7 @@ export class GmMonitor extends FormApplication {
|
|||||||
|
|
||||||
this.object.actors.push(actor[0]);
|
this.object.actors.push(actor[0]);
|
||||||
|
|
||||||
await this._saveActorsIds();
|
return this._saveAndRefresh();
|
||||||
return this.refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,6 +192,16 @@ export class GmMonitor extends FormApplication {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save ids and refresh the windows (local and socket)
|
||||||
|
* @return {Promise<void>}
|
||||||
|
*/
|
||||||
|
async _saveAndRefresh() {
|
||||||
|
await this._saveActorsIds();
|
||||||
|
game.l5r5e.sockets.refreshAppId("l5r5e-gm-monitor");
|
||||||
|
return this.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the Sheet for this actor
|
* Open the Sheet for this actor
|
||||||
* @param {Event} event
|
* @param {Event} event
|
||||||
@@ -228,8 +237,7 @@ export class GmMonitor extends FormApplication {
|
|||||||
|
|
||||||
this.object.actors = this.object.actors.filter((e) => e.id !== id);
|
this.object.actors = this.object.actors.filter((e) => e.id !== id);
|
||||||
|
|
||||||
await this._saveActorsIds();
|
return this._saveAndRefresh();
|
||||||
return this.refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -189,12 +189,12 @@ export class GmToolbox extends FormApplication {
|
|||||||
* @param {string} type
|
* @param {string} type
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_updatesActors(type) {
|
async _updatesActors(type) {
|
||||||
if (!game.user.isGM) {
|
if (!game.user.isGM) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
game.actors.contents.forEach((actor) => {
|
for await (const actor of game.actors.contents) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "sleep":
|
case "sleep":
|
||||||
// Remove 'water x2' fatigue points
|
// Remove 'water x2' fatigue points
|
||||||
@@ -225,7 +225,7 @@ export class GmToolbox extends FormApplication {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
actor.update({
|
await actor.update({
|
||||||
data: {
|
data: {
|
||||||
fatigue: {
|
fatigue: {
|
||||||
value: actor.data.data.fatigue.value,
|
value: actor.data.data.fatigue.value,
|
||||||
@@ -238,7 +238,7 @@ export class GmToolbox extends FormApplication {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
ui.notifications.info(game.i18n.localize(`l5r5e.gm_toolbox.${type}_info`));
|
ui.notifications.info(game.i18n.localize(`l5r5e.gm_toolbox.${type}_info`));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user