mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-11 03:27:08 +01:00
[Fix] Hit/Miss Display (#1711)
* Added an AppearanceSetting that decided if players should get to see information about hit/miss in chat messages * . * Improved setting name * Introduced metagaming settings * Raised verison
This commit is contained in:
parent
f920fa7ba2
commit
af04fb33d0
16 changed files with 142 additions and 6 deletions
13
lang/en.json
13
lang/en.json
|
|
@ -2644,6 +2644,14 @@
|
||||||
"title": "Triggers"
|
"title": "Triggers"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Metagaming": {
|
||||||
|
"FIELDS": {
|
||||||
|
"hideObserverPermissionInChat": {
|
||||||
|
"label": "Hide Chat Info From Players",
|
||||||
|
"hint": "Information such as hit/miss on attack rolls against adversaries will be hidden"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Homebrew": {
|
"Homebrew": {
|
||||||
"newDowntimeMove": "Downtime Move",
|
"newDowntimeMove": "Downtime Move",
|
||||||
"downtimeMove": "Downtime Move",
|
"downtimeMove": "Downtime Move",
|
||||||
|
|
@ -2703,6 +2711,11 @@
|
||||||
"label": "Configure Automation",
|
"label": "Configure Automation",
|
||||||
"hint": "Various settings automating resource management and more"
|
"hint": "Various settings automating resource management and more"
|
||||||
},
|
},
|
||||||
|
"metagaming": {
|
||||||
|
"name": "Metagaming Settings",
|
||||||
|
"label": "Configure Metagaming",
|
||||||
|
"hint": "Various settings controlling the flow of information to players"
|
||||||
|
},
|
||||||
"homebrew": {
|
"homebrew": {
|
||||||
"name": "Homebrew Settings",
|
"name": "Homebrew Settings",
|
||||||
"label": "Configure Homebrew",
|
"label": "Configure Homebrew",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
export { default as DhAppearanceSettings } from './appearanceSettings.mjs';
|
export { default as DhAppearanceSettings } from './appearanceSettings.mjs';
|
||||||
export { default as DhAutomationSettings } from './automationSettings.mjs';
|
export { default as DhAutomationSettings } from './automationSettings.mjs';
|
||||||
export { default as DhHomebrewSettings } from './homebrewSettings.mjs';
|
export { default as DhHomebrewSettings } from './homebrewSettings.mjs';
|
||||||
|
export { default as DhMetagamingSettings } from './metagamingSettings.mjs';
|
||||||
export { default as DhVariantRuleSettings } from './variantRuleSettings.mjs';
|
export { default as DhVariantRuleSettings } from './variantRuleSettings.mjs';
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ export default class DhAutomationSettings extends HandlebarsApplicationMixin(App
|
||||||
};
|
};
|
||||||
|
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
|
||||||
header: { template: 'systems/daggerheart/templates/settings/automation-settings/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/settings/automation-settings/header.hbs' },
|
||||||
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
general: { template: 'systems/daggerheart/templates/settings/automation-settings/general.hbs' },
|
general: { template: 'systems/daggerheart/templates/settings/automation-settings/general.hbs' },
|
||||||
rules: { template: 'systems/daggerheart/templates/settings/automation-settings/deathMoves.hbs' },
|
rules: { template: 'systems/daggerheart/templates/settings/automation-settings/deathMoves.hbs' },
|
||||||
roll: { template: 'systems/daggerheart/templates/settings/automation-settings/roll.hbs' },
|
roll: { template: 'systems/daggerheart/templates/settings/automation-settings/roll.hbs' },
|
||||||
|
|
|
||||||
62
module/applications/settings/metagamingSettings.mjs
Normal file
62
module/applications/settings/metagamingSettings.mjs
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
import { DhMetagaming } from '../../data/settings/_module.mjs';
|
||||||
|
|
||||||
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
|
|
||||||
|
export default class DhMetagamingSettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
constructor() {
|
||||||
|
super({});
|
||||||
|
|
||||||
|
this.settings = new DhMetagaming(
|
||||||
|
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Metagaming).toObject()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get title() {
|
||||||
|
return game.i18n.localize('DAGGERHEART.SETTINGS.Menu.title');
|
||||||
|
}
|
||||||
|
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
tag: 'form',
|
||||||
|
id: 'daggerheart-metagaming-settings',
|
||||||
|
classes: ['daggerheart', 'dh-style', 'dialog', 'setting'],
|
||||||
|
position: { width: '600', height: 'auto' },
|
||||||
|
window: {
|
||||||
|
icon: 'fa-solid fa-eye-low-vision'
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
reset: this.reset,
|
||||||
|
save: this.save
|
||||||
|
},
|
||||||
|
form: { handler: this.updateData, submitOnChange: true }
|
||||||
|
};
|
||||||
|
|
||||||
|
static PARTS = {
|
||||||
|
header: { template: 'systems/daggerheart/templates/settings/metagaming-settings/header.hbs' },
|
||||||
|
general: { template: 'systems/daggerheart/templates/settings/metagaming-settings/general.hbs' },
|
||||||
|
footer: { template: 'systems/daggerheart/templates/settings/metagaming-settings/footer.hbs' }
|
||||||
|
};
|
||||||
|
|
||||||
|
async _prepareContext(_options) {
|
||||||
|
const context = await super._prepareContext(_options);
|
||||||
|
context.settingFields = this.settings;
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
static async updateData(_event, _element, formData) {
|
||||||
|
const updatedSettings = foundry.utils.expandObject(formData.object);
|
||||||
|
|
||||||
|
await this.settings.updateSource(updatedSettings);
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
static async reset() {
|
||||||
|
this.settings = new DhMetagaming();
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
static async save() {
|
||||||
|
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Metagaming, this.settings.toObject());
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,10 @@ export const menu = {
|
||||||
Name: 'GameSettingsAutomation',
|
Name: 'GameSettingsAutomation',
|
||||||
Icon: 'fa-solid fa-robot'
|
Icon: 'fa-solid fa-robot'
|
||||||
},
|
},
|
||||||
|
Metagaming: {
|
||||||
|
Name: 'GameSettingsMetagaming',
|
||||||
|
Icon: 'fa-solid fa-eye-low-vision'
|
||||||
|
},
|
||||||
Homebrew: {
|
Homebrew: {
|
||||||
Name: 'GameSettingsHomebrew',
|
Name: 'GameSettingsHomebrew',
|
||||||
Icon: 'fa-solid fa-flask-vial'
|
Icon: 'fa-solid fa-flask-vial'
|
||||||
|
|
@ -19,6 +23,7 @@ export const menu = {
|
||||||
|
|
||||||
export const gameSettings = {
|
export const gameSettings = {
|
||||||
Automation: 'Automation',
|
Automation: 'Automation',
|
||||||
|
Metagaming: 'Metagaming',
|
||||||
Homebrew: 'Homebrew',
|
Homebrew: 'Homebrew',
|
||||||
appearance: 'Appearance',
|
appearance: 'Appearance',
|
||||||
variantRules: 'VariantRules',
|
variantRules: 'VariantRules',
|
||||||
|
|
|
||||||
12
module/data/settings/Metagaming.mjs
Normal file
12
module/data/settings/Metagaming.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
export default class DhMetagaming extends foundry.abstract.DataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
return {
|
||||||
|
hideObserverPermissionInChat: new fields.BooleanField({
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.SETTINGS.Metagaming.FIELDS.hideObserverPermissionInChat.label',
|
||||||
|
hint: 'DAGGERHEART.SETTINGS.Metagaming.FIELDS.hideObserverPermissionInChat.hint'
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
export { default as DhAppearance } from './Appearance.mjs';
|
export { default as DhAppearance } from './Appearance.mjs';
|
||||||
export { default as DhAutomation } from './Automation.mjs';
|
export { default as DhAutomation } from './Automation.mjs';
|
||||||
export { default as DhHomebrew } from './Homebrew.mjs';
|
export { default as DhHomebrew } from './Homebrew.mjs';
|
||||||
|
export { default as DhMetagaming } from './Metagaming.mjs';
|
||||||
export { default as DhVariantRules } from './VariantRules.mjs';
|
export { default as DhVariantRules } from './VariantRules.mjs';
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,10 @@ export default class DHRoll extends Roll {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
async render({ flavor, template = this.constructor.CHAT_TEMPLATE, isPrivate = false, ...options } = {}) {
|
async render({ flavor, template = this.constructor.CHAT_TEMPLATE, isPrivate = false, ...options } = {}) {
|
||||||
if (!this._evaluated) return;
|
if (!this._evaluated) return;
|
||||||
|
|
||||||
|
const metagamingSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Metagaming);
|
||||||
const chatData = await this._prepareChatRenderContext({ flavor, isPrivate, ...options });
|
const chatData = await this._prepareChatRenderContext({ flavor, isPrivate, ...options });
|
||||||
return foundry.applications.handlebars.renderTemplate(template, chatData);
|
return foundry.applications.handlebars.renderTemplate(template, { ...chatData, metagamingSettings });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,11 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||||
document = fromUuidSync(uuid);
|
document = fromUuidSync(uuid);
|
||||||
if (!document) return;
|
if (!document) return;
|
||||||
|
|
||||||
e.setAttribute('data-view-perm', document.testUserPermission(game.user, 'OBSERVER'));
|
|
||||||
e.setAttribute('data-use-perm', document.testUserPermission(game.user, 'OWNER'));
|
e.setAttribute('data-use-perm', document.testUserPermission(game.user, 'OWNER'));
|
||||||
|
|
||||||
|
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Metagaming);
|
||||||
|
if (settings.hideObserverPermissionInChat)
|
||||||
|
e.setAttribute('data-view-perm', document.testUserPermission(game.user, 'OBSERVER'));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.isContentVisible) {
|
if (this.isContentVisible) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
import { defaultLevelTiers, DhLevelTiers } from '../data/levelTier.mjs';
|
import { defaultLevelTiers, DhLevelTiers } from '../data/levelTier.mjs';
|
||||||
import DhCountdowns from '../data/countdowns.mjs';
|
import DhCountdowns from '../data/countdowns.mjs';
|
||||||
import { DhAppearance, DhAutomation, DhHomebrew, DhVariantRules } from '../data/settings/_module.mjs';
|
import { DhAppearance, DhAutomation, DhHomebrew, DhMetagaming, DhVariantRules } from '../data/settings/_module.mjs';
|
||||||
import {
|
import {
|
||||||
DhAppearanceSettings,
|
DhAppearanceSettings,
|
||||||
DhAutomationSettings,
|
DhAutomationSettings,
|
||||||
DhHomebrewSettings,
|
DhHomebrewSettings,
|
||||||
|
DhMetagamingSettings,
|
||||||
DhVariantRuleSettings
|
DhVariantRuleSettings
|
||||||
} from '../applications/settings/_module.mjs';
|
} from '../applications/settings/_module.mjs';
|
||||||
import { CompendiumBrowserSettings, DhTagTeamRoll } from '../data/_module.mjs';
|
import { CompendiumBrowserSettings, DhTagTeamRoll } from '../data/_module.mjs';
|
||||||
|
|
@ -38,6 +39,12 @@ const registerMenuSettings = () => {
|
||||||
type: DhAutomation
|
type: DhAutomation
|
||||||
});
|
});
|
||||||
|
|
||||||
|
game.settings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Metagaming, {
|
||||||
|
scope: 'world',
|
||||||
|
config: false,
|
||||||
|
type: DhMetagaming
|
||||||
|
});
|
||||||
|
|
||||||
game.settings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew, {
|
game.settings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew, {
|
||||||
scope: 'world',
|
scope: 'world',
|
||||||
config: false,
|
config: false,
|
||||||
|
|
@ -76,6 +83,16 @@ const registerMenus = () => {
|
||||||
type: DhAutomationSettings,
|
type: DhAutomationSettings,
|
||||||
restricted: true
|
restricted: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
game.settings.registerMenu(CONFIG.DH.id, CONFIG.DH.SETTINGS.menu.Metagaming.Name, {
|
||||||
|
name: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.metagaming.name'),
|
||||||
|
label: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.metagaming.label'),
|
||||||
|
hint: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.metagaming.hint'),
|
||||||
|
icon: CONFIG.DH.SETTINGS.menu.Metagaming.Icon,
|
||||||
|
type: DhMetagamingSettings,
|
||||||
|
restricted: true
|
||||||
|
});
|
||||||
|
|
||||||
game.settings.registerMenu(CONFIG.DH.id, CONFIG.DH.SETTINGS.menu.Homebrew.Name, {
|
game.settings.registerMenu(CONFIG.DH.id, CONFIG.DH.SETTINGS.menu.Homebrew.Name, {
|
||||||
name: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.homebrew.name'),
|
name: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.homebrew.name'),
|
||||||
label: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.homebrew.label'),
|
label: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.homebrew.label'),
|
||||||
|
|
|
||||||
|
|
@ -450,6 +450,10 @@
|
||||||
|
|
||||||
.target-data {
|
.target-data {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
|
.target-name {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.target-save {
|
.target-save {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "daggerheart",
|
"id": "daggerheart",
|
||||||
"title": "Daggerheart",
|
"title": "Daggerheart",
|
||||||
"description": "An unofficial implementation of the Daggerheart system",
|
"description": "An unofficial implementation of the Daggerheart system",
|
||||||
"version": "1.8.0",
|
"version": "1.9.0",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13.346",
|
"minimum": "13.346",
|
||||||
"verified": "13.351",
|
"verified": "13.351",
|
||||||
|
|
|
||||||
10
templates/settings/metagaming-settings/footer.hbs
Normal file
10
templates/settings/metagaming-settings/footer.hbs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<footer class="form-footer">
|
||||||
|
<button data-action="reset">
|
||||||
|
<i class="fa-solid fa-arrow-rotate-left"></i>
|
||||||
|
<span>{{localize "Reset"}}</span>
|
||||||
|
</button>
|
||||||
|
<button data-action="save" >
|
||||||
|
<i class="fa-solid fa-floppy-disk"></i>
|
||||||
|
<span>{{localize "Save Changes"}}</span>
|
||||||
|
</button>
|
||||||
|
</footer>
|
||||||
3
templates/settings/metagaming-settings/general.hbs
Normal file
3
templates/settings/metagaming-settings/general.hbs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div>
|
||||||
|
{{formGroup settingFields.schema.fields.hideObserverPermissionInChat value=settingFields._source.hideObserverPermissionInChat localize=true}}
|
||||||
|
</div>
|
||||||
3
templates/settings/metagaming-settings/header.hbs
Normal file
3
templates/settings/metagaming-settings/header.hbs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<header class="dialog-header">
|
||||||
|
<h1>{{localize 'DAGGERHEART.SETTINGS.Menu.metagaming.name'}}</h1>
|
||||||
|
</header>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="roll-part target-section dice-roll" data-action="expandRoll">
|
<div class="roll-part target-section dice-roll" data-action="expandRoll">
|
||||||
<div class="roll-part-header"><div><span>{{pluralize currentTargets.length "DAGGERHEART.GENERAL.Target"}}</span></div></div>
|
<div class="roll-part-header"><div><span>{{pluralize currentTargets.length "DAGGERHEART.GENERAL.Target"}}</span></div></div>
|
||||||
{{#if isGM}}
|
{{#if (or isGM (not metagamingSettings.hideObserverPermissionInChat))}}
|
||||||
<div class="roll-part-extra on-reduced">
|
<div class="roll-part-extra on-reduced">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{{#if (or (gt targetShort.hit 0) (gt targetShort.miss 0))}}
|
{{#if (or (gt targetShort.hit 0) (gt targetShort.miss 0))}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue