Fixes for RnK visibility

This commit is contained in:
Vlyan
2021-08-12 10:29:13 +02:00
parent 45af487a4b
commit 0d7ddddaee
5 changed files with 38 additions and 7 deletions

View File

@@ -6,6 +6,9 @@
- Fixed Compendium entries thanks to TesserWract : - Fixed Compendium entries thanks to TesserWract :
- Utaku Battle Maiden: Replace "Striking as Air" with "Courtier's Resolve". - Utaku Battle Maiden: Replace "Striking as Air" with "Courtier's Resolve".
- Weapons: Chair, lute, sake bottle and cups, and scroll case use the "Unarmed skill" and changed the umbrella's stab grip to be 2-handed. - Weapons: Chair, lute, sake bottle and cups, and scroll case use the "Unarmed skill" and changed the umbrella's stab grip to be 2-handed.
- Fixes for RnK :
- Visibility mode is now consistent with the 1st message (public, private, gm...).
- DiceSoNice will now not show the new dice(s) for explosive in non-public mode.
- Minor fixe on editable state. - Minor fixe on editable state.
## 1.3.2 - Ronin's Bubble ## 1.3.2 - Ronin's Bubble

View File

@@ -88,7 +88,7 @@ export class CombatL5r5e extends Combat {
if (messageOptions.rnkRoll instanceof game.l5r5e.RollL5r5e && ids.length === 1) { if (messageOptions.rnkRoll instanceof game.l5r5e.RollL5r5e && ids.length === 1) {
// Specific RnK // Specific RnK
roll = messageOptions.rnkRoll; roll = messageOptions.rnkRoll;
rnkMessage = await roll.toMessage({ flavor }); rnkMessage = await roll.toMessage({ flavor }, { rollMode: messageOptions.rollMode || null });
} else { } else {
// Regular // Regular
roll = new game.l5r5e.RollL5r5e(formula); roll = new game.l5r5e.RollL5r5e(formula);

View File

@@ -512,7 +512,13 @@ export class RollnKeepDialog extends FormApplication {
// Show DsN dice for the new roll // Show DsN dice for the new roll
if (game.dice3d !== undefined) { if (game.dice3d !== undefined) {
game.dice3d.showForRoll(roll, game.user, true); game.dice3d.showForRoll(
roll,
game.user,
true,
this._message.data.whisper.length === 0 ? null : this._message.data.whisper,
this._message.data.blind
);
} }
roll.terms.forEach((term) => { roll.terms.forEach((term) => {
@@ -617,6 +623,7 @@ export class RollnKeepDialog extends FormApplication {
if (this.roll.l5r5e.isInitiativeRoll) { if (this.roll.l5r5e.isInitiativeRoll) {
let msgOptions = { let msgOptions = {
rnkRoll: this.roll, rnkRoll: this.roll,
rollMode: game.l5r5e.HelpersL5r5e.getRollMode(this._message.data),
}; };
await this.roll.l5r5e.actor.rollInitiative({ await this.roll.l5r5e.actor.rollInitiative({
@@ -630,7 +637,10 @@ export class RollnKeepDialog extends FormApplication {
delete msgOptions.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(
{},
{ rollMode: game.l5r5e.HelpersL5r5e.getRollMode(this._message.data) }
);
} }
// Refresh viewers // Refresh viewers

View File

@@ -302,8 +302,8 @@ export class RollL5r5e extends Roll {
// RollMode // RollMode
const rMode = rollMode || messageData.rollMode || game.settings.get("core", "rollMode"); const rMode = rollMode || messageData.rollMode || game.settings.get("core", "rollMode");
if (rollMode) { if (rMode) {
ChatMessage.applyRollMode(messageData, rMode); messageData = ChatMessage.applyRollMode(messageData, rMode);
} }
// Prepare chat data // Prepare chat data
@@ -336,8 +336,8 @@ export class RollL5r5e extends Roll {
static fromData(data) { static fromData(data) {
const roll = super.fromData(data); const roll = super.fromData(data);
roll.data = duplicate(data.data); roll.data = foundry.utils.duplicate(data.data);
roll.l5r5e = duplicate(data.l5r5e); roll.l5r5e = foundry.utils.duplicate(data.l5r5e);
// get real Actor object // get real Actor object
if (data.l5r5e.actor) { if (data.l5r5e.actor) {

View File

@@ -511,4 +511,22 @@ export class HelpersL5r5e {
content: `<div class="l5r5e-chat-item">${tpl}${link ? `<hr>` + link : ""}</div>`, content: `<div class="l5r5e-chat-item">${tpl}${link ? `<hr>` + link : ""}</div>`,
}); });
} }
/**
* Return the RollMode for this ChatData
* @param {object} chatData
* @return {string}
*/
static getRollMode(chatData) {
if (chatData.whisper.length === 1 && chatData.whisper[0] === game.user.id) {
return "selfroll";
}
if (chatData.blind) {
return "blindroll";
}
if (chatData.whisper.length > 1) {
return "gmroll";
}
return "roll";
}
} }