diff --git a/module/applications/_module.mjs b/module/applications/_module.mjs index 91aa6ba5..1e280d81 100644 --- a/module/applications/_module.mjs +++ b/module/applications/_module.mjs @@ -2,12 +2,12 @@ export { default as DhpPCSheet } from './sheets/pc.mjs'; export { default as DhpAdversarySheet } from './sheets/adversary.mjs'; export { default as DhpClassSheet } from './sheets/class.mjs'; export { default as DhpSubclass } from './sheets/subclass.mjs'; -export { default as DhpFeatureSheet } from './sheets/feature.mjs'; +export { default as DhpFeatureSheet } from './sheets/items/feature.mjs'; export { default as DhpDomainCardSheet } from './sheets/domainCard.mjs'; export { default as DhpAncestry } from './sheets/ancestry.mjs'; export { default as DhpCommunity } from './sheets/community.mjs'; -export { default as DhpMiscellaneous } from './sheets/miscellaneous.mjs'; -export { default as DhpConsumable } from './sheets/consumable.mjs'; +export { default as DhpMiscellaneous } from './sheets/items/miscellaneous.mjs'; +export { default as DhpConsumable } from './sheets/items/consumable.mjs'; export { default as DhpWeapon } from './sheets/weapon.mjs'; export { default as DhpArmor } from './sheets/armor.mjs'; export { default as DhpChatMessage } from './chatMessage.mjs'; diff --git a/module/applications/ancestrySelectionDialog.mjs b/module/applications/ancestrySelectionDialog.mjs index 1ca15908..0cdb0dd9 100644 --- a/module/applications/ancestrySelectionDialog.mjs +++ b/module/applications/ancestrySelectionDialog.mjs @@ -65,7 +65,7 @@ export default class AncestrySelectionDialog extends HandlebarsApplicationMixin( } async _prepareContext(_options) { - const systemAncestries = Array.from((await game.packs.get('daggerheart.playtest-ancestries')).index).map(x => ({ + const systemAncestries = Array.from((await game.packs.get('daggerheart.ancestries')).index).map(x => ({ ...x, selected: this.data.ancestries.some(selected => selected.uuid === x.uuid) })); diff --git a/module/applications/deathMove.mjs b/module/applications/deathMove.mjs index 54622a1a..af4a0c9c 100644 --- a/module/applications/deathMove.mjs +++ b/module/applications/deathMove.mjs @@ -48,7 +48,7 @@ export default class DhpDeathMove extends HandlebarsApplicationMixin(Application const msg = new cls({ user: game.user.id, content: await renderTemplate('systems/daggerheart/templates/chat/deathMove.hbs', { - player: game.user.character.name, + player: this.actor.name, title: game.i18n.localize(this.selectedMove.name), img: this.selectedMove.img, description: game.i18n.localize(this.selectedMove.description) diff --git a/module/applications/downtime.mjs b/module/applications/downtime.mjs index 06575f80..f1da7678 100644 --- a/module/applications/downtime.mjs +++ b/module/applications/downtime.mjs @@ -71,7 +71,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV const msg = new cls({ user: game.user.id, content: await renderTemplate('systems/daggerheart/templates/chat/downtime.hbs', { - player: game.user.character.name, + player: this.actor.name, title: game.i18n.localize(this.selectedActivity.name), img: this.selectedActivity.img, description: game.i18n.localize(this.selectedActivity.description), diff --git a/module/applications/settings.mjs b/module/applications/settings.mjs index fe425627..631ce1ce 100644 --- a/module/applications/settings.mjs +++ b/module/applications/settings.mjs @@ -218,7 +218,7 @@ export const registerDHSettings = () => { game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, { scope: 'client', - config: true, + config: false, type: DhAppearance, default: DhAppearance.defaultSchema }); diff --git a/module/applications/sheets/consumable.mjs b/module/applications/sheets/consumable.mjs deleted file mode 100644 index d9e25086..00000000 --- a/module/applications/sheets/consumable.mjs +++ /dev/null @@ -1,56 +0,0 @@ -// import DhpApplicationMixin from '../daggerheart-sheet.mjs'; - -// export default class ConsumableSheet extends DhpApplicationMixin(ItemSheet) { -// static documentType = "consumable"; - -// /** @override */ -// static get defaultOptions() { -// return foundry.utils.mergeObject(super.defaultOptions, { -// classes: ["daggerheart", "sheet", "consumable"], -// width: 480, -// height: 'auto', -// }); -// } - -// /** @override */ -// getData() { -// const context = super.getData(); - -// return context; -// } -// } - -import DaggerheartSheet from './daggerheart-sheet.mjs'; - -const { ItemSheetV2 } = foundry.applications.sheets; -export default class ConsumableSheet extends DaggerheartSheet(ItemSheetV2) { - static DEFAULT_OPTIONS = { - tag: 'form', - classes: ['daggerheart', 'sheet', 'consumable'], - position: { width: 480 }, - form: { - handler: this.updateForm, - submitOnChange: true, - closeOnSubmit: false - } - }; - - static PARTS = { - form: { - id: 'feature', - template: 'systems/daggerheart/templates/sheets/consumable.hbs' - } - }; - - async _prepareContext(_options) { - const context = await super._prepareContext(_options); - context.document = this.document; - - return context; - } - - static async updateForm(event, _, formData) { - await this.document.update(formData.object); - this.render(); - } -} diff --git a/module/applications/sheets/daggerheart-sheet.mjs b/module/applications/sheets/daggerheart-sheet.mjs index abf48793..635d2434 100644 --- a/module/applications/sheets/daggerheart-sheet.mjs +++ b/module/applications/sheets/daggerheart-sheet.mjs @@ -69,5 +69,14 @@ export default function DhpApplicationMixin(Base) { } _onDrop(event) {} + + _getTabs(tabs) { + for (const v of Object.values(tabs)) { + v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active; + v.cssClass = v.active ? 'active' : ''; + } + + return tabs; + } }; } diff --git a/module/applications/sheets/items/consumable.mjs b/module/applications/sheets/items/consumable.mjs new file mode 100644 index 00000000..eb0a3d6b --- /dev/null +++ b/module/applications/sheets/items/consumable.mjs @@ -0,0 +1,57 @@ +import DaggerheartSheet from '../daggerheart-sheet.mjs'; + +const { ItemSheetV2 } = foundry.applications.sheets; +export default class ConsumableSheet extends DaggerheartSheet(ItemSheetV2) { + static DEFAULT_OPTIONS = { + tag: 'form', + classes: ['daggerheart', 'sheet', 'dh-style', 'consumable'], + position: { width: 550 }, + form: { + handler: this.updateForm, + submitOnChange: true, + closeOnSubmit: false + } + }; + + static PARTS = { + header: { template: 'systems/daggerheart/templates/sheets/items/consumable/header.hbs' }, + tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' }, + description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' }, + settings: { + template: 'systems/daggerheart/templates/sheets/items/consumable/settings.hbs', + scrollable: ['.settings'] + } + }; + + static TABS = { + description: { + active: true, + cssClass: '', + group: 'primary', + id: 'description', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Description' + }, + settings: { + active: false, + cssClass: '', + group: 'primary', + id: 'settings', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Settings' + } + }; + + async _prepareContext(_options) { + const context = await super._prepareContext(_options); + context.document = this.document; + context.tabs = super._getTabs(this.constructor.TABS); + + return context; + } + + static async updateForm(event, _, formData) { + await this.document.update(formData.object); + this.render(); + } +} diff --git a/module/applications/sheets/feature.mjs b/module/applications/sheets/items/feature.mjs old mode 100755 new mode 100644 similarity index 72% rename from module/applications/sheets/feature.mjs rename to module/applications/sheets/items/feature.mjs index 54bfa68e..553b686d --- a/module/applications/sheets/feature.mjs +++ b/module/applications/sheets/items/feature.mjs @@ -1,6 +1,6 @@ -import DaggerheartAction from '../../data/action.mjs'; -import DaggerheartActionConfig from '../config/Action.mjs'; -import DaggerheartSheet from './daggerheart-sheet.mjs'; +import DaggerheartAction from '../../../data/action.mjs'; +import DaggerheartActionConfig from '../../config/Action.mjs'; +import DaggerheartSheet from '../daggerheart-sheet.mjs'; const { ItemSheetV2 } = foundry.applications.sheets; export default class FeatureSheet extends DaggerheartSheet(ItemSheetV2) { @@ -48,48 +48,40 @@ export default class FeatureSheet extends DaggerheartSheet(ItemSheetV2) { } }; - _getTabs() { - const tabs = { - description: { - active: true, - cssClass: '', - group: 'primary', - id: 'description', - icon: null, - label: 'DAGGERHEART.Sheets.Feature.Tabs.Description' - }, - actions: { - active: false, - cssClass: '', - group: 'primary', - id: 'actions', - icon: null, - label: 'DAGGERHEART.Sheets.Feature.Tabs.Actions' - }, - settings: { - active: false, - cssClass: '', - group: 'primary', - id: 'settings', - icon: null, - label: 'DAGGERHEART.Sheets.Feature.Tabs.Settings' - }, - effects: { - active: false, - cssClass: '', - group: 'primary', - id: 'effects', - icon: null, - label: 'DAGGERHEART.Sheets.Feature.Tabs.Effects' - } - }; - for (const v of Object.values(tabs)) { - v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active; - v.cssClass = v.active ? 'active' : ''; + static TABS = { + description: { + active: true, + cssClass: '', + group: 'primary', + id: 'description', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Description' + }, + actions: { + active: false, + cssClass: '', + group: 'primary', + id: 'actions', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Actions' + }, + settings: { + active: false, + cssClass: '', + group: 'primary', + id: 'settings', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Settings' + }, + effects: { + active: false, + cssClass: '', + group: 'primary', + id: 'effects', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Effects' } - - return tabs; - } + }; _attachPartListeners(partId, htmlElement, options) { super._attachPartListeners(partId, htmlElement, options); @@ -99,7 +91,7 @@ export default class FeatureSheet extends DaggerheartSheet(ItemSheetV2) { async _prepareContext(_options) { const context = await super._prepareContext(_options); context.document = this.document; - context.tabs = this._getTabs(); + context.tabs = super._getTabs(this.constructor.TABS); context.generalConfig = SYSTEM.GENERAL; context.itemConfig = SYSTEM.ITEM; context.properties = SYSTEM.ACTOR.featureProperties; diff --git a/module/applications/sheets/miscellaneous.mjs b/module/applications/sheets/items/miscellaneous.mjs similarity index 52% rename from module/applications/sheets/miscellaneous.mjs rename to module/applications/sheets/items/miscellaneous.mjs index 6d4d2646..cf4ba2c0 100644 --- a/module/applications/sheets/miscellaneous.mjs +++ b/module/applications/sheets/items/miscellaneous.mjs @@ -20,14 +20,14 @@ // } // } -import DaggerheartSheet from './daggerheart-sheet.mjs'; +import DaggerheartSheet from '../daggerheart-sheet.mjs'; const { ItemSheetV2 } = foundry.applications.sheets; export default class MiscellaneousSheet extends DaggerheartSheet(ItemSheetV2) { static DEFAULT_OPTIONS = { tag: 'form', - classes: ['daggerheart', 'sheet', 'miscellaneous'], - position: { width: 400 }, + classes: ['daggerheart', 'sheet', 'dh-style', 'miscellaneous'], + position: { width: 550 }, form: { handler: this.updateForm, submitOnChange: true, @@ -36,15 +36,38 @@ export default class MiscellaneousSheet extends DaggerheartSheet(ItemSheetV2) { }; static PARTS = { - form: { - id: 'feature', - template: 'systems/daggerheart/templates/sheets/miscellaneous.hbs' + header: { template: 'systems/daggerheart/templates/sheets/items/miscellaneous/header.hbs' }, + tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' }, + description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' }, + settings: { + template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs', + scrollable: ['.settings'] + } + }; + + static TABS = { + description: { + active: true, + cssClass: '', + group: 'primary', + id: 'description', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Description' + }, + settings: { + active: false, + cssClass: '', + group: 'primary', + id: 'settings', + icon: null, + label: 'DAGGERHEART.Sheets.Feature.Tabs.Settings' } }; async _prepareContext(_options) { const context = await super._prepareContext(_options); context.document = this.document; + context.tabs = super._getTabs(this.constructor.TABS); return context; } diff --git a/module/applications/sheets/pc.mjs b/module/applications/sheets/pc.mjs index d4eadedc..effada64 100644 --- a/module/applications/sheets/pc.mjs +++ b/module/applications/sheets/pc.mjs @@ -659,11 +659,11 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) { } static async selectClass() { - (await game.packs.get('daggerheart.playtest-classes'))?.render(true); + (await game.packs.get('daggerheart.classes'))?.render(true); } static async selectSubclass() { - (await game.packs.get('daggerheart.playtest-subclasses'))?.render(true); + (await game.packs.get('daggerheart.subclasses'))?.render(true); } static async selectAncestry() { @@ -694,7 +694,7 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) { } static async selectCommunity() { - (await game.packs.get('daggerheart.playtest-communities'))?.render(true); + (await game.packs.get('daggerheart.communities'))?.render(true); } static async viewObject(_, button) { @@ -702,7 +702,7 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) { if (!object) return; const tab = button.dataset.tab; - if (tab) object.sheet._tabs[0].active = tab; + if (tab && object.sheet._tabs) object.sheet._tabs[0].active = tab; if (object.sheet.editMode) object.sheet.editMode = false; diff --git a/module/applications/sheets/subclass.mjs b/module/applications/sheets/subclass.mjs index f456aac2..40128ab0 100644 --- a/module/applications/sheets/subclass.mjs +++ b/module/applications/sheets/subclass.mjs @@ -183,7 +183,7 @@ export default class SubclassSheet extends DaggerheartSheet(ItemSheetV2) { } async _onDrop(event) { - event.preventDefault() + event.preventDefault(); const data = TextEditor.getDragEventData(event); const item = await fromUuid(data.uuid); if (!(item.type === 'feature' && item.system.type === SYSTEM.ITEM.featureTypes.subclass.id)) return; @@ -196,7 +196,7 @@ export default class SubclassSheet extends DaggerheartSheet(ItemSheetV2) { const path = `system.${featureField}Feature.abilities`; const abilities = duplicate(getProperty(this.document, path)) || []; - const featureData = {name: item.name, img: item.img, uuid: item.uuid }; + const featureData = { name: item.name, img: item.img, uuid: item.uuid }; abilities.push(featureData); await this.document.update({ [path]: abilities }); diff --git a/module/data/class.mjs b/module/data/class.mjs index 2b29975f..52f6030e 100644 --- a/module/data/class.mjs +++ b/module/data/class.mjs @@ -13,11 +13,6 @@ export default class DhpClass extends foundry.abstract.TypeDataModel { uuid: new fields.StringField({}) }) ), - damageThresholds: new fields.SchemaField({ - minor: new fields.NumberField({ initial: 0, integer: true }), - major: new fields.NumberField({ initial: 0, integer: true }), - severe: new fields.NumberField({ initial: 0, integer: true }) - }), evasion: new fields.NumberField({ initial: 0, integer: true }), features: new fields.ArrayField( new fields.SchemaField({ diff --git a/module/data/pc.mjs b/module/data/pc.mjs index b68f0a03..c7aa9660 100644 --- a/module/data/pc.mjs +++ b/module/data/pc.mjs @@ -337,7 +337,7 @@ export default class DhpPC extends foundry.abstract.TypeDataModel { get refreshableFeatures() { return this.parent.items.reduce( (acc, x) => { - if (x.type === 'feature' && x.system.refreshData.type) { + if (x.type === 'feature' && x.system.refreshData?.type) { acc[x.system.refreshData.type].push(x); } diff --git a/styles/daggerheart.css b/styles/daggerheart.css index 6eab8757..f15e3ede 100755 --- a/styles/daggerheart.css +++ b/styles/daggerheart.css @@ -2984,10 +2984,13 @@ div.daggerheart.views.multiclass { outline: 2px solid light-dark(#222, #efe6d8); } .application.sheet.dh-style input[type='checkbox']:checked::after { - color: light-dark(#18162e, #f3c267); + color: light-dark(#222, #f3c267); +} +.application.sheet.dh-style input[type='checkbox']:checked::before { + color: light-dark(transparent, #18162e); } .application.sheet.dh-style input[type='checkbox']::before { - color: light-dark(#f3c267, #18162e); + color: light-dark(#222, #efe6d8); } .application.sheet.dh-style button { background: light-dark(transparent, #f3c267); diff --git a/styles/less/global/elements.less b/styles/less/global/elements.less index ddd8525e..7888d8d3 100755 --- a/styles/less/global/elements.less +++ b/styles/less/global/elements.less @@ -27,10 +27,13 @@ input[type='checkbox'] { &:checked::after { - color: light-dark(@dark-blue, @golden); + color: light-dark(@dark, @golden); + } + &:checked::before { + color: light-dark(transparent, @dark-blue); } &::before { - color: light-dark(@golden, @dark-blue); + color: light-dark(@dark, @beige); } } diff --git a/templates/sheets/class.hbs b/templates/sheets/class.hbs index e88b385b..99da282d 100644 --- a/templates/sheets/class.hbs +++ b/templates/sheets/class.hbs @@ -27,17 +27,6 @@ -
- -
- - - - - - -
-
{{formField systemFields.evasion value=source.system.evasion label=(localize "DAGGERHEART.Sheets.Class.Evasion")}} {{!--
diff --git a/templates/sheets/consumable.hbs b/templates/sheets/consumable.hbs deleted file mode 100644 index f920826b..00000000 --- a/templates/sheets/consumable.hbs +++ /dev/null @@ -1,36 +0,0 @@ -
-
-
- -
- {{formInput fields.name value=source.name rootId=partId}} -
-
-
- -
-
-
- {{formField systemFields.quantity value=source.system.quantity label=(localize "DAGGERHEART.Sheets.Consumable.Quantity") }} - {{formField systemFields.consumeOnUse value=source.system.consumeOnUse label=(localize "DAGGERHEART.Sheets.Consumable.ConsumeOnUse")}} - {{!--
- -
- -
-
--}} - {{!--
- -
- -
-
--}} -
-
-

{{localize "DAGGERHEART.General.Description"}}

- {{formInput systemFields.description value=source.system.description enriched=source.system.description localize=true toggled=true}} - {{!-- {{editor item.system.description target="system.description" button=true}} --}} -
-
-
-
\ No newline at end of file diff --git a/templates/sheets/items/consumable/header.hbs b/templates/sheets/items/consumable/header.hbs new file mode 100644 index 00000000..6ddea17e --- /dev/null +++ b/templates/sheets/items/consumable/header.hbs @@ -0,0 +1,10 @@ +
+ +
+ +

+
+

{{localize 'TYPES.Item.consumable'}}

+
+
+
\ No newline at end of file diff --git a/templates/sheets/items/consumable/settings.hbs b/templates/sheets/items/consumable/settings.hbs new file mode 100644 index 00000000..d3a9e2bb --- /dev/null +++ b/templates/sheets/items/consumable/settings.hbs @@ -0,0 +1,14 @@ +
+
+ {{localize tabs.settings.label}} + {{localize "DAGGERHEART.Sheets.Consumable.Quantity"}} + {{formField systemFields.quantity value=source.system.quantity}} + + {{localize "DAGGERHEART.Sheets.Consumable.ConsumeOnUse"}} + {{formField systemFields.consumeOnUse value=source.system.consumeOnUse}} +
+
\ No newline at end of file diff --git a/templates/sheets/items/miscellaneous/header.hbs b/templates/sheets/items/miscellaneous/header.hbs new file mode 100644 index 00000000..218c3a47 --- /dev/null +++ b/templates/sheets/items/miscellaneous/header.hbs @@ -0,0 +1,10 @@ +
+ +
+ +

+
+

{{localize 'TYPES.Item.miscellaneous'}}

+
+
+
\ No newline at end of file diff --git a/templates/sheets/items/miscellaneous/settings.hbs b/templates/sheets/items/miscellaneous/settings.hbs new file mode 100644 index 00000000..96c1dbe9 --- /dev/null +++ b/templates/sheets/items/miscellaneous/settings.hbs @@ -0,0 +1,11 @@ +
+
+ {{localize tabs.settings.label}} + {{localize "DAGGERHEART.Sheets.Miscellaneous.Quantity"}} + {{formField systemFields.quantity value=source.system.quantity}} +
+
\ No newline at end of file diff --git a/templates/sheets/miscellaneous.hbs b/templates/sheets/miscellaneous.hbs deleted file mode 100644 index 710186c6..00000000 --- a/templates/sheets/miscellaneous.hbs +++ /dev/null @@ -1,29 +0,0 @@ -
-
-
- -
- {{formInput fields.name value=source.name rootId=partId}} -
-
-
- -
-
-
- {{formField systemFields.quantity value=source.system.quantity label=(localize "DAGGERHEART.Sheets.Miscellaneous.Quantity")}} - {{!--
- -
- -
-
--}} -
-
-

{{localize "DAGGERHEART.General.Description"}}

- {{formInput systemFields.description value=source.system.description enriched=source.system.description localize=true toggled=true}} - {{!-- {{editor item.system.description target="system.description" button=true}} --}} -
-
-
-
\ No newline at end of file diff --git a/templates/sheets/pc/sections/loadout.hbs b/templates/sheets/pc/sections/loadout.hbs index 516a9411..62d76d1e 100644 --- a/templates/sheets/pc/sections/loadout.hbs +++ b/templates/sheets/pc/sections/loadout.hbs @@ -1,8 +1,11 @@
-