Fix falsy display of rightclick context menu

This commit is contained in:
Byroks 2023-12-05 20:19:17 +01:00
parent 66e9f74346
commit 014885d0fa
1 changed files with 5 additions and 4 deletions

View File

@ -116,10 +116,11 @@ Hooks.on("getChatLogEntryContext", function (html, options) {
condition: (li) => {
// Only show this context menu if there are re-rollable dice in the message
const damageRolls = li.find(".apply-damage").length;
console.log(game["user"].isGm);
// All must be true to show the reroll dialogue
// The button doesn't work for the GM right now, so we don't need to show it
return !game["user"].isGm && damageRolls > 0;
return game["user"].character && damageRolls > 0;
},
callback: (li) => applyDamage(li, 2),
},
@ -132,7 +133,7 @@ Hooks.on("getChatLogEntryContext", function (html, options) {
// All must be true to show the reroll dialogue
// The button doesn't work for the GM right now, so we don't need to show it
return !game["user"].isGm && damageRolls > 0;
return game["user"].character && damageRolls > 0;
},
callback: (li) => applyDamage(li, 1),
},
@ -145,7 +146,7 @@ Hooks.on("getChatLogEntryContext", function (html, options) {
// All must be true to show the reroll dialogue
// The button doesn't work for the GM right now, so we don't need to show it
return !game["user"].isGm && damageRolls > 0;
return game["user"].character && damageRolls > 0;
},
callback: (li) => applyDamage(li, -1),
},
@ -158,7 +159,7 @@ Hooks.on("getChatLogEntryContext", function (html, options) {
// All must be true to show the reroll dialogue
// The button doesn't work for the GM right now, so we don't need to show it
return !game["user"].isGm && damageRolls > 0;
return game["user"].character && damageRolls > 0;
},
callback: (li) => applyDamage(li, -2),
}