mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
[Feature] Custom Resources (#1714)
* Initial * . * Fixed positioning * . * Only showing the menu if there are extra resources * Improved resourceManager clickable * . * Changed variable name * Refactor resources selection and data prep (#1721) * Move resources select to scrolly text and accept actor object * Convert isReversed to prepared data and add label * Removed unused imports --------- Co-authored-by: WBHarry <williambjrklund@gmail.com> * Naming * [Feature] Custom Homebrew Resources (#1718) * Added resources to the Homebrew Menu * Fixed translations * . * Inverted from isImage to isIcon. Should be more logical for users * Removed testing resources * Refactor resource settings to not be a method (#1723) * Fix editing homebrew resources with a custom ResourcesField * Fix removing homebrew resources * Remove vestigial code * Use custom config for module data instead of including in all (#1724) * Use custom config for module data instead of including in all * More simple * base highest priority --------- Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com> Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
This commit is contained in:
parent
af04fb33d0
commit
552c62adc1
32 changed files with 970 additions and 189 deletions
78
templates/settings/homebrew-settings/resources.hbs
Normal file
78
templates/settings/homebrew-settings/resources.hbs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<section
|
||||
class="tab {{tabs.resources.cssClass}} {{tabs.resources.id}} scrollable"
|
||||
data-tab="{{tabs.resources.id}}"
|
||||
data-group="{{tabs.resources.group}}"
|
||||
>
|
||||
<div class="resource-types-container">
|
||||
{{#each settingFields.resources as |type key|}}
|
||||
<fieldset>
|
||||
<legend>
|
||||
{{localize "DAGGERHEART.SETTINGS.Homebrew.resources.typeTitle" type=(localize (concat "TYPES.Actor." key))}}
|
||||
<a data-action="addResource" data-actor-type="{{key}}"><i class="fa-solid fa-plus"></i></a>
|
||||
</legend>
|
||||
|
||||
<div class="resource-type-container">
|
||||
<div class="resources-container">
|
||||
{{#each type.resources as |resource key|}}
|
||||
<fieldset class="resource-container">
|
||||
<legend>{{resource.label}}<a data-action="removeResource" data-actor-type="{{@../key}}" data-resource-key="{{key}}"><i class="fa-solid fa-trash"></i></a></legend>
|
||||
|
||||
{{formField @root.schemaFields.resources.element.fields.resources.element.fields.label value=resource.label name=(concat "resources." @../key ".resources." key ".label") classes="vertical" localize=true }}
|
||||
|
||||
<div class="two-columns even">
|
||||
{{formField @root.schemaFields.resources.element.fields.resources.element.fields.initial value=resource.initial name=(concat "resources." @../key ".resources." key ".initial") classes="vertical" localize=true }}
|
||||
{{formField @root.schemaFields.resources.element.fields.resources.element.fields.max value=resource.max name=(concat "resources." @../key ".resources." key ".max") classes="vertical" localize=true }}
|
||||
</div>
|
||||
|
||||
<div class="resource-icons-container">
|
||||
<div class="resource-icon-container" data-actor-type="{{@../key}}" data-resource-key="{{key}}" data-image-key="full">
|
||||
{{#with @root.schemaFields.resources.element.fields.resources.element.fields.images.fields.full.fields}}
|
||||
<div class="resource-icon-title-container">
|
||||
<div class="resource-icon-title">
|
||||
<span>{{localize "DAGGERHEART.SETTINGS.Homebrew.resources.filledIcon"}}</span>
|
||||
<a data-action="resetResourceImage"><i class="fa-solid fa-arrow-rotate-left"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resource-icon-content">
|
||||
{{#if ../images.full.isIcon}}
|
||||
{{formGroup this.value value=../images.full.value name=(concat "resources." @../key ".resources." key ".images.full.value") localize=true }}
|
||||
{{else}}
|
||||
<div class="form-fields">
|
||||
<file-picker name="{{concat "resources." @../key ".resources." key ".images.full.value"}}" value="{{../images.full.value}}" type="image"></file-picker>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{formGroup this.isIcon value=../images.full.isIcon name="" classes="path-field" localize=true }}
|
||||
{{formGroup this.noColorFilter value=../images.full.noColorFilter name=(concat "resources." @../key ".resources." key ".images.full.noColorFilter") localize=true }}
|
||||
</div>
|
||||
{{/with}}
|
||||
</div>
|
||||
<div class="resource-icon-container" data-actor-type="{{@../key}}" data-resource-key="{{key}}" data-image-key="empty">
|
||||
{{#with @root.schemaFields.resources.element.fields.resources.element.fields.images.fields.empty.fields}}
|
||||
<div class="resource-icon-title-container">
|
||||
<div class="resource-icon-title">
|
||||
<span>{{localize "DAGGERHEART.SETTINGS.Homebrew.resources.emptyIcon"}}</span>
|
||||
<a data-action="resetResourceImage"><i class="fa-solid fa-arrow-rotate-left"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resource-icon-content">
|
||||
{{#if ../images.empty.isIcon}}
|
||||
{{formGroup this.value value=../images.empty.value name=(concat "resources." @../key ".resources." key ".images.empty.value") localize=true }}
|
||||
{{else}}
|
||||
<div class="form-fields">
|
||||
<file-picker name="{{concat "resources." @../key ".resources." key ".images.empty.value"}}" value="{{../images.empty.value}}" type="image"></file-picker>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{formGroup this.isIcon value=resource.images.empty.isIcon name="" classes="path-field" localize=true }}
|
||||
{{formGroup this.noColorFilter value=resource.images.empty.noColorFilter name=(concat "resources." @../key ".resources." key ".images.empty.noColorFilter") localize=true }}
|
||||
</div>
|
||||
{{/with}}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
{{/each}}
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -20,15 +20,11 @@
|
|||
|
||||
<div class="fieldsets-section">
|
||||
<fieldset class="flex">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.HitPoints.plural"}}</legend>
|
||||
{{formGroup systemFields.resources.fields.hitPoints.fields.value value=document._source.system.resources.hitPoints.value label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.hitPoints.value.label")}}
|
||||
{{formGroup systemFields.resources.fields.hitPoints.fields.max value=document._source.system.resources.hitPoints.max label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.hitPoints.max.label")}}
|
||||
</fieldset>
|
||||
<fieldset class="flex">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.stress"}}</legend>
|
||||
{{formGroup systemFields.resources.fields.stress.fields.value value=document._source.system.resources.stress.value label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.stress.value.label")}}
|
||||
{{formGroup systemFields.resources.fields.stress.fields.max value=document._source.system.resources.stress.max label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.stress.max.label")}}
|
||||
</fieldset>
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.Resource.plural"}}</legend>
|
||||
{{#each resources as |resource|}}
|
||||
{{formGroup resource.field value=resource.value name=resource.name}}
|
||||
{{/each}}
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<fieldset class="flex">
|
||||
|
|
@ -36,4 +32,4 @@
|
|||
{{formGroup systemFields.damageThresholds.fields.major value=document._source.system.damageThresholds.major label=(localize "DAGGERHEART.GENERAL.DamageThresholds.majorThreshold")}}
|
||||
{{formGroup systemFields.damageThresholds.fields.severe value=document._source.system.damageThresholds.severe label=(localize "DAGGERHEART.GENERAL.DamageThresholds.severeThreshold")}}
|
||||
</fieldset>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -22,15 +22,12 @@
|
|||
<legend>{{localize 'DAGGERHEART.GENERAL.basics'}}</legend>
|
||||
|
||||
<div class="two-columns even">
|
||||
{{formGroup systemFields.resources.fields.hitPoints.fields.value value=document._source.system.resources.hitPoints.value localize=true}}
|
||||
<span data-tooltip-text="{{localize "DAGGERHEART.UI.Tooltip.maxHPClassBound"}}">
|
||||
{{formGroup systemFields.resources.fields.hitPoints.fields.max value=document._source.system.resources.hitPoints.max localize=true}}
|
||||
</span>
|
||||
{{#each resources as |resource|}}
|
||||
<span {{#if resource.tooltip}}data-tooltip-text="{{resource.tooltip}}"{{/if}}>
|
||||
{{formGroup resource.field value=resource.value name=resource.name}}
|
||||
</span>
|
||||
{{/each}}
|
||||
|
||||
{{formGroup systemFields.resources.fields.stress.fields.value value=document._source.system.resources.stress.value localize=true}}
|
||||
{{formGroup systemFields.resources.fields.stress.fields.max value=document._source.system.resources.stress.max localize=true}}
|
||||
|
||||
{{formGroup systemFields.resources.fields.hope.fields.value value=document._source.system.resources.hope.value localize=true}}
|
||||
{{formGroup systemFields.scars value=document._source.system.scars localize=true}}
|
||||
|
||||
{{formGroup systemFields.proficiency value=document._source.system.proficiency localize=true}}
|
||||
|
|
@ -39,4 +36,4 @@
|
|||
</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@
|
|||
<legend>{{localize 'DAGGERHEART.GENERAL.basics'}}</legend>
|
||||
<div class="nest-inputs">
|
||||
{{formGroup systemFields.evasion value=document._source.system.evasion localize=true}}
|
||||
{{formGroup systemFields.resources.fields.stress.fields.value value=document._source.system.resources.stress.value label='DAGGERHEART.ACTORS.Companion.FIELDS.resources.stress.currentStress.label' localize=true}}
|
||||
{{formGroup systemFields.resources.fields.stress.fields.max value=document._source.system.resources.stress.max label='DAGGERHEART.ACTORS.Companion.FIELDS.resources.stress.maxStress.label' localize=true}}
|
||||
{{#each resources as |resource|}}
|
||||
{{formGroup resource.field value=resource.value name=resource.name}}
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-fields">
|
||||
|
|
@ -19,4 +20,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -65,22 +65,25 @@
|
|||
</div>
|
||||
|
||||
<div class="character-row">
|
||||
<div class="hope-section">
|
||||
<h4>{{localize "DAGGERHEART.GENERAL.hope"}}</h4>
|
||||
{{#times document.system.resources.hope.max}}
|
||||
<span class='hope-value' data-action='toggleHope' data-value="{{add this 1}}">
|
||||
{{#if (gte ../document.system.resources.hope.value (add this 1))}}
|
||||
<i class='fa-solid fa-diamond'></i>
|
||||
{{else}}
|
||||
<i class='fa-regular fa-circle'></i>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/times}}
|
||||
{{#times document.system.scars}}
|
||||
<span class='hope-value scar'>
|
||||
<i class='fa-regular fa-ban'></i>
|
||||
</span>
|
||||
{{/times}}
|
||||
<div class="resource-section">
|
||||
<div class="hope-section">
|
||||
<h4>{{localize "DAGGERHEART.GENERAL.hope"}}</h4>
|
||||
{{#times document.system.resources.hope.max}}
|
||||
<span class='hope-value' data-action='toggleHope' data-value="{{add this 1}}">
|
||||
{{#if (gte ../document.system.resources.hope.value (add this 1))}}
|
||||
<i class='fa-solid fa-diamond'></i>
|
||||
{{else}}
|
||||
<i class='fa-regular fa-circle'></i>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/times}}
|
||||
{{#times document.system.scars}}
|
||||
<span class='hope-value scar'>
|
||||
<i class='fa-regular fa-ban'></i>
|
||||
</span>
|
||||
{{/times}}
|
||||
{{#if hasExtraResources}}<a type="button" class="resource-manager" data-action="toggleResourceManagement"><i class="fa-solid fa-angle-down"></i></a>{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{#if document.system.class.value}}
|
||||
<div class="domains-section">
|
||||
|
|
|
|||
21
templates/ui/tooltip/resourceManagement.hbs
Normal file
21
templates/ui/tooltip/resourceManagement.hbs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<div class="daggerheart resource-management-container">
|
||||
{{#each resources as |resource|}}
|
||||
<div class="resource-section {{resource.resourceClass}}">
|
||||
<h4>{{resource.label}}</h4>
|
||||
{{#times resource.max}}
|
||||
<span class='resource-value' data-action='toggleResource' data-value="{{add this 1}}" data-resource="{{resource.id}}">
|
||||
{{#if resource.fullIcon.isIcon}}
|
||||
<i class='{{resource.fullIcon.value}} full {{#unless (gte ../value (add this 1))}}hidden{{/unless}}'></i>
|
||||
{{else}}
|
||||
<img src="{{resource.fullIcon.value}}" class="full {{#unless resource.fullIcon.noColorFilter}}filter{{else}}non-transparent{{/unless}} {{#unless (gte ../value (add this 1))}}hidden{{/unless}}" />
|
||||
{{/if}}
|
||||
{{#if resource.emptyIcon.isIcon}}
|
||||
<i class='{{resource.emptyIcon.value}} empty {{#if (gte ../value (add this 1))}}hidden{{/if}}'></i>
|
||||
{{else}}
|
||||
<img src="{{resource.emptyIcon.value}}" class="empty {{#unless resource.fullIcon.noColorFilter}}filter{{else}}non-transparent{{/unless}} {{#if (gte ../value (add this 1))}}hidden{{/if}}" />
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/times}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue