Synced "Gm Monitor" with actor updates
This commit is contained in:
@@ -186,7 +186,18 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
if (formData["data.description"]) {
|
||||
formData["data.description"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.description"], true);
|
||||
}
|
||||
return super._updateObject(event, formData);
|
||||
|
||||
return super._updateObject(event, formData).then(() => {
|
||||
// Notify the "Gm Monitor" if this actor is watched
|
||||
if (game.settings.get("l5r5e", "gm-monitor-actors").find((e) => e === this.actor.id)) {
|
||||
game.l5r5e.sockets.refreshAppId("l5r5e-gm-monitor");
|
||||
if (game.user.isGM) {
|
||||
Object.values(ui.windows)
|
||||
.find((e) => e.id === "l5r5e-gm-monitor")
|
||||
?.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,29 +25,11 @@ export class GmMonitor extends FormApplication {
|
||||
resizable: true,
|
||||
closeOnSubmit: false,
|
||||
submitOnClose: false,
|
||||
submitOnChange: true,
|
||||
submitOnChange: false,
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Refresh button on top of sheet
|
||||
* @override
|
||||
*/
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
|
||||
// Send To Chat
|
||||
buttons.unshift({
|
||||
label: game.i18n.localize("l5r5e.global.refresh"),
|
||||
class: "refresh",
|
||||
icon: "fas fa-sync-alt",
|
||||
onclick: async () => this.refresh(),
|
||||
});
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param {ApplicationOptions} options
|
||||
@@ -103,8 +85,6 @@ export class GmMonitor extends FormApplication {
|
||||
if (!game.user.isGM) {
|
||||
return false;
|
||||
}
|
||||
// this.position.width = "auto";
|
||||
// this.position.height = "auto";
|
||||
return super.render(force, options);
|
||||
}
|
||||
|
||||
@@ -170,17 +150,6 @@ export class GmMonitor extends FormApplication {
|
||||
}); // tooltips
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called upon form submission after form data is validated
|
||||
* @param event The initial triggering submission event
|
||||
* @param formData The object of validated form data with which to update the object
|
||||
* @returns A Promise which resolves once the update operation has completed
|
||||
* @override
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
this.render(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dropped data on the Actor sheet
|
||||
* @param {DragEvent} event
|
||||
@@ -258,8 +227,8 @@ export class GmMonitor extends FormApplication {
|
||||
}
|
||||
|
||||
this.object.actors = this.object.actors.filter((e) => e.id !== id);
|
||||
await this._saveActorsIds();
|
||||
|
||||
await this._saveActorsIds();
|
||||
return this.refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -241,5 +241,11 @@ export class GmToolbox extends FormApplication {
|
||||
});
|
||||
|
||||
ui.notifications.info(game.i18n.localize(`l5r5e.gm_toolbox.${type}_info`));
|
||||
|
||||
// Refresh gm-monitor
|
||||
Object.values(ui.windows)
|
||||
.find((e) => e.id === "l5r5e-gm-monitor")
|
||||
?.refresh();
|
||||
game.l5r5e.sockets.refreshAppId("l5r5e-gm-monitor");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user