diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index 282a8c9c..d251a67e 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -345,6 +345,37 @@ export const refreshTypes = { } }; +export const featureTokenTypes = { + tide: { + id: 'tide', + label: 'Tide', + group: 'TYPES.Actor.character' + }, + chaos: { + id: 'chaos', + label: 'Chaos', + group: 'TYPES.Actor.character' + } +}; + +export const featureDiceTypes = { + prayer: { + id: 'prayer', + label: 'Prayer Dice', + group: 'TYPES.Actor.character' + }, + favor: { + id: 'favor', + label: 'Favor Points', + group: 'TYPES.Actor.character' + }, + slayer: { + id: 'slayer', + label: 'Slayer Dice', + group: 'TYPES.Actor.character' + } +}; + export const abilityCosts = { hp: { id: 'hp', @@ -366,36 +397,13 @@ export const abilityCosts = { label: 'Armor Stack', group: 'TYPES.Actor.character' }, - prayer: { - id: 'prayer', - label: 'Prayer Dice', - group: 'TYPES.Actor.character' - }, - favor: { - id: 'favor', - label: 'Favor Points', - group: 'TYPES.Actor.character' - }, - slayer: { - id: 'slayer', - label: 'Slayer Dice', - group: 'TYPES.Actor.character' - }, - tide: { - id: 'tide', - label: 'Tide', - group: 'TYPES.Actor.character' - }, - chaos: { - id: 'chaos', - label: 'Chaos', - group: 'TYPES.Actor.character' - }, fear: { id: 'fear', label: 'Fear', group: 'TYPES.Actor.adversary' - } + }, + ...featureTokenTypes, + ...featureDiceTypes }; export const countdownTypes = { diff --git a/module/data/item/base.mjs b/module/data/item/base.mjs index 9358a6b3..87812431 100644 --- a/module/data/item/base.mjs +++ b/module/data/item/base.mjs @@ -29,7 +29,18 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel { /** @inheritDoc */ static defineSchema() { - const schema = {}; + const schema = { + uses: new fields.SchemaField({ + value: new fields.NumberField({ nullable: true, initial: null }), + max: new fields.NumberField({ nullable: true, initial: null }), + icon: new fields.StringField({ initial: 'fa-solid fa-hashtag' }), + recovery: new fields.StringField({ + choices: CONFIG.DH.GENERAL.refreshTypes, + initial: null, + nullable: true + }) + }) + }; if (this.metadata.hasDescription) schema.description = new fields.HTMLField({ required: true, nullable: true }); diff --git a/module/helpers/handlebarsHelper.mjs b/module/helpers/handlebarsHelper.mjs index feeebbd2..1b6de2a5 100644 --- a/module/helpers/handlebarsHelper.mjs +++ b/module/helpers/handlebarsHelper.mjs @@ -1,16 +1,20 @@ export default class RegisterHandlebarsHelpers { static registerHelpers() { Handlebars.registerHelper({ + emptyObject: this.emptyObject, add: this.add, includes: this.includes, times: this.times, damageFormula: this.damageFormula, damageSymbols: this.damageSymbols, - tertiary: this.tertiary, - signedNumber: this.signedNumber + tertiary: this.tertiary }); } + static emptyObject(a) { + return !a || typeof a !== 'object' || Object.keys(a).length === 0; + } + static add(a, b) { const aNum = Number.parseInt(a); const bNum = Number.parseInt(b); diff --git a/styles/less/global/inventory-item.less b/styles/less/global/inventory-item.less index 24e53165..1786f6f9 100644 --- a/styles/less/global/inventory-item.less +++ b/styles/less/global/inventory-item.less @@ -21,10 +21,19 @@ } } + .item-label-wrapper { + display: grid; + grid-template-columns: 1fr 60px; + } + .item-label { font-family: @font-body; align-self: center; + &.fullWidth { + grid-column: span 2; + } + .item-name { font-size: 14px; } @@ -58,6 +67,31 @@ } } + .item-tokens { + display: flex; + flex-direction: column; + gap: 4px; + + .item-token { + display: flex; + align-items: center; + gap: 4px; + + i { + flex: none; + font-size: 14px; + } + + input { + flex: 1; + + &::-webkit-outer-spin-button { + opacity: 1; + } + } + } + } + .controls { display: flex; align-items: center; diff --git a/templates/sheets/global/partials/inventory-item.hbs b/templates/sheets/global/partials/inventory-item.hbs index eae3dd5f..41327096 100644 --- a/templates/sheets/global/partials/inventory-item.hbs +++ b/templates/sheets/global/partials/inventory-item.hbs @@ -1,126 +1,138 @@