Fix rnkMessage not passing on actor object for NPCs

This commit is contained in:
Marco Braga
2021-04-22 21:59:36 +02:00
parent 80907c8a01
commit 7943d38e87
3 changed files with 22 additions and 16 deletions

View File

@@ -613,24 +613,28 @@ export class RollnKeepDialog extends FormApplication {
const msgOldId = this._message._id;
if (this.roll.l5r5e.isInitiativeRoll) {
let msgOptions = {
rnkRoll: this.roll,
};
await this.roll.l5r5e.actor.rollInitiative({
rerollInitiative: true,
initiativeOptions: {
messageOptions: {
rnkRoll: this.roll,
},
messageOptions: msgOptions,
},
});
// Adhesive tape to get the message :/
this.message = this.roll.l5r5e.actor.rnkMessage;
delete this.roll.l5r5e.actor.rnkMessage;
this.message = msgOptions.rnkMessage;
delete msgOptions.rnkMessage;
} else {
// Send it to chat, switch to new message
this.message = await this.roll.toMessage();
}
// Refresh viewers
game.l5r5e.sockets.updateMessageIdAndRefresh(appOldId, this._message._id);
if (this._message) {
game.l5r5e.sockets.updateMessageIdAndRefresh(appOldId, this._message._id);
}
// Delete old chat message related to this series
if (game.settings.get("l5r5e", "rnk.deleteOldMessage")) {