fix total and tooltip in render / inline
This commit is contained in:
@@ -141,9 +141,10 @@ export class RollL5r5e extends Roll {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the tooltip HTML for a Roll instance and inner rolls (eg [[2ds]])
|
* Render the tooltip HTML for a Roll instance and inner rolls (eg [[2ds]])
|
||||||
|
* @param contexte Used to differentiate render (no l5r dices) or inline tooltip (with l5r dices)
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
getTooltip() {
|
getTooltip(contexte = null) {
|
||||||
const parts = this.dice.map((term) => {
|
const parts = this.dice.map((term) => {
|
||||||
const cls = term.constructor;
|
const cls = term.constructor;
|
||||||
const isL5rDie = term instanceof L5rBaseDie;
|
const isL5rDie = term instanceof L5rBaseDie;
|
||||||
@@ -155,6 +156,7 @@ export class RollL5r5e extends Roll {
|
|||||||
flavor: term.options.flavor,
|
flavor: term.options.flavor,
|
||||||
isDieL5r: isL5rDie,
|
isDieL5r: isL5rDie,
|
||||||
isDieStd: !isL5rDie,
|
isDieStd: !isL5rDie,
|
||||||
|
display: !isL5rDie || contexte?.from !== "render",
|
||||||
rolls: term.results.map((r) => {
|
rolls: term.results.map((r) => {
|
||||||
return {
|
return {
|
||||||
result: cls.getResultLabel(r.result),
|
result: cls.getResultLabel(r.result),
|
||||||
@@ -210,8 +212,8 @@ export class RollL5r5e extends Roll {
|
|||||||
flavor: isPrivate ? null : chatOptions.flavor,
|
flavor: isPrivate ? null : chatOptions.flavor,
|
||||||
user: chatOptions.user,
|
user: chatOptions.user,
|
||||||
isPublicRoll: !chatOptions.isPrivate,
|
isPublicRoll: !chatOptions.isPrivate,
|
||||||
tooltip: isPrivate ? "" : await this.getTooltip(),
|
tooltip: isPrivate ? "" : await this.getTooltip({ from: "render" }),
|
||||||
total: isPrivate ? "?" : Math.round(this.total * 100) / 100,
|
total: isPrivate ? "?" : Math.round(this._total * 100) / 100,
|
||||||
data: this.data,
|
data: this.data,
|
||||||
l5r5e: isPrivate
|
l5r5e: isPrivate
|
||||||
? {}
|
? {}
|
||||||
@@ -262,7 +264,7 @@ export class RollL5r5e extends Roll {
|
|||||||
{
|
{
|
||||||
user: game.user._id,
|
user: game.user._id,
|
||||||
type: template,
|
type: template,
|
||||||
content: this.total,
|
content: this._total,
|
||||||
sound: CONFIG.sounds.dice,
|
sound: CONFIG.sounds.dice,
|
||||||
},
|
},
|
||||||
messageData
|
messageData
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<div class="dice-tooltip">
|
<div class="dice-tooltip">
|
||||||
{{#each chatData.parts}}
|
{{#each chatData.parts}}
|
||||||
|
{{#if this.display}}
|
||||||
<section class="tooltip-part">
|
<section class="tooltip-part">
|
||||||
<div class="dice">
|
<div class="dice">
|
||||||
<header class="part-header flexrow">
|
<header class="part-header flexrow">
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if chatData.l5r5e.dicesTypes.l5r}}
|
{{#if chatData.l5r5e.dicesTypes.l5r}}
|
||||||
|
|||||||
Reference in New Issue
Block a user