mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Added Combat and CombatTracker
This commit is contained in:
parent
32730b3aac
commit
7eb662ac21
20 changed files with 900 additions and 334 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import DhAppearance from '../data/settings/Appearance.mjs';
|
||||
import DHAppearanceSettings from './settings/appearanceSettings.mjs';
|
||||
import DhVariantRules from '../data/settings/VariantRules.mjs';
|
||||
import DHVariantRuleSettings from './settings/variantRuleSettings.mjs';
|
||||
|
||||
class DhpAutomationSettings extends FormApplication {
|
||||
constructor(object = {}, options = {}) {
|
||||
|
|
@ -181,7 +183,8 @@ export const registerDHSettings = () => {
|
|||
type: Number,
|
||||
default: 0,
|
||||
onChange: () => {
|
||||
if(ui.resources) ui.resources.render({force: true});
|
||||
if (ui.resources) ui.resources.render({ force: true });
|
||||
ui.combat.render({ force: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -193,7 +196,7 @@ export const registerDHSettings = () => {
|
|||
type: Number,
|
||||
default: 12,
|
||||
onChange: () => {
|
||||
if(ui.resources) ui.resources.render({force: true});
|
||||
if (ui.resources) ui.resources.render({ force: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -204,15 +207,15 @@ export const registerDHSettings = () => {
|
|||
config: true,
|
||||
type: String,
|
||||
choices: {
|
||||
'token': 'Tokens',
|
||||
'bar': 'Bar',
|
||||
'hide': 'Hide'
|
||||
token: 'Tokens',
|
||||
bar: 'Bar',
|
||||
hide: 'Hide'
|
||||
},
|
||||
default: 'token',
|
||||
onChange: value => {
|
||||
if(ui.resources) {
|
||||
if(value === 'hide') ui.resources.close({allowed: true});
|
||||
else ui.resources.render({force: true});
|
||||
if (ui.resources) {
|
||||
if (value === 'hide') ui.resources.close({ allowed: true });
|
||||
else ui.resources.render({ force: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -251,6 +254,13 @@ export const registerDHSettings = () => {
|
|||
}
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules, {
|
||||
scope: 'world',
|
||||
config: false,
|
||||
type: DhVariantRules,
|
||||
default: DhVariantRules.defaultSchema
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, {
|
||||
scope: 'client',
|
||||
config: false,
|
||||
|
|
@ -291,4 +301,13 @@ export const registerDHSettings = () => {
|
|||
type: DHAppearanceSettings,
|
||||
restricted: false
|
||||
});
|
||||
|
||||
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.VariantRules.Name, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Menu.VariantRules.title'),
|
||||
label: game.i18n.localize('DAGGERHEART.Settings.Menu.VariantRules.label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Menu.VariantRules.hint'),
|
||||
icon: SYSTEM.SETTINGS.menu.VariantRules.Icon,
|
||||
type: DHVariantRuleSettings,
|
||||
restricted: false
|
||||
});
|
||||
};
|
||||
|
|
|
|||
59
module/applications/settings/variantRuleSettings.mjs
Normal file
59
module/applications/settings/variantRuleSettings.mjs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import DhVariantRules from '../../data/settings/VariantRules.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
export default class DHVariantRuleSettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor() {
|
||||
super({});
|
||||
|
||||
this.settings = new DhVariantRules(
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize('DAGGERHEART.Settings.Menu.VariantRules.name');
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
id: 'daggerheart-appearance-settings',
|
||||
classes: ['daggerheart', 'setting', 'dh-style'],
|
||||
position: { width: '600', height: 'auto' },
|
||||
actions: {
|
||||
reset: this.reset,
|
||||
save: this.save
|
||||
},
|
||||
form: { handler: this.updateData, submitOnChange: true }
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: 'systems/daggerheart/templates/settings/variant-rules.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 DhVariantRules();
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules, this.settings.toObject());
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue