Fix rnkMessage not passing on actor object for NPCs
This commit is contained in:
@@ -112,7 +112,7 @@ export class CombatL5r5e extends Combat {
|
|||||||
|
|
||||||
// Ugly but work... i need the new message
|
// Ugly but work... i need the new message
|
||||||
if (ids.length === 1) {
|
if (ids.length === 1) {
|
||||||
combatant.actor.rnkMessage = rnkMessage;
|
messageOptions.rnkMessage = rnkMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the character succeeded on their Initiative check, they add 1 to their base initiative value,
|
// if the character succeeded on their Initiative check, they add 1 to their base initiative value,
|
||||||
|
|||||||
@@ -434,22 +434,24 @@ export class DicePickerDialog extends FormApplication {
|
|||||||
let message;
|
let message;
|
||||||
if (this.object.isInitiativeRoll) {
|
if (this.object.isInitiativeRoll) {
|
||||||
// Initiative roll
|
// Initiative roll
|
||||||
|
let msgOptions = {
|
||||||
|
skillId: this.object.skill.id,
|
||||||
|
difficulty: this.object.difficulty.value,
|
||||||
|
difficultyHidden: this.object.difficulty.hidden,
|
||||||
|
useVoidPoint: this.object.useVoidPoint,
|
||||||
|
skillAssistance: this.object.skill.assistance,
|
||||||
|
};
|
||||||
|
|
||||||
await this._actor.rollInitiative({
|
await this._actor.rollInitiative({
|
||||||
initiativeOptions: {
|
initiativeOptions: {
|
||||||
formula: formula.join("+"),
|
formula: formula.join("+"),
|
||||||
// updateTurn: true,
|
// updateTurn: true,
|
||||||
messageOptions: {
|
messageOptions: msgOptions,
|
||||||
skillId: this.object.skill.id,
|
|
||||||
difficulty: this.object.difficulty.value,
|
|
||||||
difficultyHidden: this.object.difficulty.hidden,
|
|
||||||
useVoidPoint: this.object.useVoidPoint,
|
|
||||||
skillAssistance: this.object.skill.assistance,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// Adhesive tape to get the messageId :/
|
// Adhesive tape to get the messageId :/
|
||||||
message = this._actor.rnkMessage;
|
message = msgOptions.rnkMessage;
|
||||||
delete this._actor.rnkMessage;
|
delete msgOptions.rnkMessage;
|
||||||
} else {
|
} else {
|
||||||
// Regular roll, so let's roll !
|
// Regular roll, so let's roll !
|
||||||
const roll = await new game.l5r5e.RollL5r5e(formula.join("+"));
|
const roll = await new game.l5r5e.RollL5r5e(formula.join("+"));
|
||||||
|
|||||||
@@ -613,24 +613,28 @@ export class RollnKeepDialog extends FormApplication {
|
|||||||
const msgOldId = this._message._id;
|
const msgOldId = this._message._id;
|
||||||
|
|
||||||
if (this.roll.l5r5e.isInitiativeRoll) {
|
if (this.roll.l5r5e.isInitiativeRoll) {
|
||||||
|
let msgOptions = {
|
||||||
|
rnkRoll: this.roll,
|
||||||
|
};
|
||||||
|
|
||||||
await this.roll.l5r5e.actor.rollInitiative({
|
await this.roll.l5r5e.actor.rollInitiative({
|
||||||
rerollInitiative: true,
|
rerollInitiative: true,
|
||||||
initiativeOptions: {
|
initiativeOptions: {
|
||||||
messageOptions: {
|
messageOptions: msgOptions,
|
||||||
rnkRoll: this.roll,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// Adhesive tape to get the message :/
|
// Adhesive tape to get the message :/
|
||||||
this.message = this.roll.l5r5e.actor.rnkMessage;
|
this.message = msgOptions.rnkMessage;
|
||||||
delete this.roll.l5r5e.actor.rnkMessage;
|
delete msgOptions.rnkMessage;
|
||||||
} else {
|
} else {
|
||||||
// Send it to chat, switch to new message
|
// Send it to chat, switch to new message
|
||||||
this.message = await this.roll.toMessage();
|
this.message = await this.roll.toMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh viewers
|
// 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
|
// Delete old chat message related to this series
|
||||||
if (game.settings.get("l5r5e", "rnk.deleteOldMessage")) {
|
if (game.settings.get("l5r5e", "rnk.deleteOldMessage")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user