Synced "Gm Monitor" with actor updates

This commit is contained in:
Vlyan
2021-08-13 17:00:22 +02:00
parent d7059f09fa
commit 14d89f6943
9 changed files with 30 additions and 42 deletions

View File

@@ -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();
}

View File

@@ -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");
}
}