RnK : Fixed rights (introduced with strife modification)

This commit is contained in:
Vlyan
2022-03-28 14:06:30 +02:00
parent e9b289d4a6
commit fd25650a5d

View File

@@ -78,6 +78,14 @@ export class RollnKeepDialog extends FormApplication {
return this._message; return this._message;
} }
/**
* Return true if this actor has right on this roll
* @return {boolean}
*/
get isOwner() {
return this._message?.isAuthor || this._message?._roll.l5r5e.actor?.isOwner || this._message?.isOwner || false;
}
/** /**
* Create the Roll n Keep dialog * Create the Roll n Keep dialog
* @param {number} messageId * @param {number} messageId
@@ -86,9 +94,7 @@ export class RollnKeepDialog extends FormApplication {
constructor(messageId, options = {}) { constructor(messageId, options = {}) {
super({}, options); super({}, options);
this.message = game.messages.get(messageId); this.message = game.messages.get(messageId);
this.options.editable = this.isOwner;
this.options.editable =
this._message?.isAuthor || this._message?._roll.l5r5e.actor?.isOwner || this._message?.isOwner || false;
this._initializeDiceFaces(); this._initializeDiceFaces();
this._initializeHistory(); this._initializeHistory();
@@ -228,7 +234,7 @@ export class RollnKeepDialog extends FormApplication {
const kept = this._getKeepCount(this.object.currentStep); const kept = this._getKeepCount(this.object.currentStep);
this.object.submitDisabled = kept < 1 || kept > rollData.keepLimit; this.object.submitDisabled = kept < 1 || kept > rollData.keepLimit;
} else if (!this.object.dicesList[this.object.currentStep]) { } else if (!this.object.dicesList[this.object.currentStep]) {
this.options.editable = rollData.summary.strife > 0; this.options.editable = this.isOwner && rollData.summary.strife > 0;
this.options.classes.push("finalized"); this.options.classes.push("finalized");
} }
@@ -765,7 +771,7 @@ export class RollnKeepDialog extends FormApplication {
return e; return e;
}); });
this.options.editable = true; this.options.editable = this.isOwner;
await this._rebuildRoll(true); await this._rebuildRoll(true);
await this._toChatMessage(); await this._toChatMessage();
return this.render(false); return this.render(false);