Seamless update for 20Q (deleted refresh button)

Fix for error css
Some start for roll n keep
This commit is contained in:
Vlyan
2021-01-10 21:12:36 +01:00
parent 2ad6b1f44b
commit e30e5d02a6
16 changed files with 647 additions and 45 deletions

View File

@@ -48,24 +48,10 @@ export class TwentyQuestionsDialog extends FormApplication {
}
/**
* Add a refresh button on top of sheet
* Allow a GM or player to see the change made by another player without closing the dialog
* @override
* Define a unique and dynamic element ID for the rendered ActorSheet application
*/
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
buttons.unshift({
label: game.i18n.localize("l5r5e.twenty_questions.bt_refresh"),
class: "twenty-questions",
icon: "fas fa-sync-alt",
onclick: async () => {
this._initialize(game.actors.get(this.actor._id));
await this._constructCache();
this.render(false);
},
});
return buttons;
get id() {
return `l5r5e-twenty-questions-dialog-${this.actor._id}`;
}
/**
@@ -76,6 +62,18 @@ export class TwentyQuestionsDialog extends FormApplication {
this._initialize(actor);
}
/**
* Refresh data (used from socket)
*/
async refresh() {
if (!this.actor) {
return;
}
this._initialize(game.actors.get(this.actor._id));
await this._constructCache();
this.render(false);
}
/**
* Initialize actor and object for dialog
* @private
@@ -343,6 +341,9 @@ export class TwentyQuestionsDialog extends FormApplication {
},
});
// Notify the change to other players
game.l5r5e.sockets.refreshAppId(this.id);
this.render(false);
}