Added an AppearanceSetting that decided if players should get to see information about hit/miss in chat messages

This commit is contained in:
WBHarry 2026-03-07 18:26:56 +01:00
parent f1f5102af1
commit f75468c9e0
6 changed files with 17 additions and 3 deletions

View file

@ -25,6 +25,7 @@ export default class DhAppearance extends foundry.abstract.DataModel {
choices: CONFIG.DH.GENERAL.fearDisplay,
initial: CONFIG.DH.GENERAL.fearDisplay.token.value
}),
hideHitMissForPlayers: new BooleanField({ initial: false }),
displayCountdownUI: new BooleanField({ initial: true }),
diceSoNice: new SchemaField({
hope: diceStyle({ fg: '#ffffff', bg: '#ffe760', outline: '#000000', edge: '#ffffff' }),

View file

@ -140,8 +140,10 @@ export default class DHRoll extends Roll {
/** @inheritDoc */
async render({ flavor, template = this.constructor.CHAT_TEMPLATE, isPrivate = false, ...options } = {}) {
if (!this._evaluated) return;
const appearanceSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
const chatData = await this._prepareChatRenderContext({ flavor, isPrivate, ...options });
return foundry.applications.handlebars.renderTemplate(template, chatData);
return foundry.applications.handlebars.renderTemplate(template, { ...chatData, appearanceSettings });
}
/** @inheritDoc */

View file

@ -68,8 +68,11 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
document = fromUuidSync(uuid);
if (!document) return;
e.setAttribute('data-view-perm', document.testUserPermission(game.user, 'OBSERVER'));
e.setAttribute('data-use-perm', document.testUserPermission(game.user, 'OWNER'));
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
if (settings.hideHitMissForPlayers)
e.setAttribute('data-view-perm', document.testUserPermission(game.user, 'OBSERVER'));
});
if (this.isContentVisible) {