extract and simplify attributes and traits

This commit is contained in:
Johannes Loher 2021-01-04 00:55:44 +01:00
parent 404ac08482
commit 6a12ba3938
7 changed files with 106 additions and 129 deletions

View file

@ -81,86 +81,9 @@
</div>
</div>
</div>
<div class="attributes-traits grid grid-3col">
<div class="attribute flexrow"><label for="data.attributes.body.total"
class="attribute-label ">{{config.attributes.body}}</label>
<div class="attribute-value flex15 grid grid-8col"><input type="number"
name="data.attributes.body.base" value='{{data.attributes.body.base}}'
data-dtype="Number" /><span> +
</span><input type="number" name="data.attributes.body.mod" value='{{data.attributes.body.mod}}'
data-dtype="Number" /><span> =
</span><span class="attribute-value-total">{{data.attributes.body.total}}</span></div>
</div>
<div class="attribute flexrow"><label for="data.attributes.mobility.total"
class="attribute-label">{{config.attributes.mobility}}</label>
<div class="attribute-value flex15 grid grid-8col"><input type="number"
name="data.attributes.mobility.base" value='{{data.attributes.mobility.base}}'
data-dtype="Number" /><span> +
</span><input type="number" name="data.attributes.mobility.mod"
value='{{data.attributes.mobility.mod}}' data-dtype="Number" /><span> =
</span><span class="attribute-value-total">{{data.attributes.mobility.total}}</span></div>
</div>
<div class="attribute flexrow"><label for="data.attributes.mind.total"
class="attribute-label">{{config.attributes.mind}}</label>
<div class="attribute-value flex15 grid grid-8col"><input type="number"
name="data.attributes.mind.base" value='{{data.attributes.mind.base}}'
data-dtype="Number" /><span> +
</span><input type="number" name="data.attributes.mind.mod" value='{{data.attributes.mind.mod}}'
data-dtype="Number" /><span> =
</span><span class="attribute-value-total">{{data.attributes.mind.total}}</span></div>
</div>
<div class="trait flexrow"><label for="data.traits.strength.total"
class="trait-label">{{config.traits.strength}}</label>
<div class="trait-value flex15 grid grid-8col"><input type="number" name="data.traits.strength.base"
value='{{data.traits.strength.base}}' data-dtype="Number" /><span> +
</span><input type="number" name="data.traits.strength.mod" value='{{data.traits.strength.mod}}'
data-dtype="Number" /><span> =
</span><span class="trait-value-total">{{data.traits.strength.total}}</span></div>
</div>
<div class="trait flexrow"><label for="data.traits.agility.total"
class="trait-label">{{config.traits.agility}}</label>
<div class="trait-value flex15 grid grid-8col"><input type="number" name="data.traits.agility.base"
value='{{data.traits.agility.base}}' data-dtype="Number" /><span> +
</span><input type="number" name="data.traits.agility.mod" value='{{data.traits.agility.mod}}'
data-dtype="Number" /><span> =
</span><span class="trait-value-total">{{data.traits.agility.total}}</span></div>
</div>
<div class="trait flexrow"><label for="data.traits.intellect.total"
class="trait-label">{{config.traits.intellect}}</label>
<div class="trait-value flex15 grid grid-8col"><input type="number"
name="data.traits.intellect.base" value='{{data.traits.intellect.base}}'
data-dtype="Number" /><span> +
</span><input type="number" name="data.traits.intellect.mod"
value='{{data.traits.intellect.mod}}' data-dtype="Number" /><span> =
</span><span class="trait-value-total">{{data.traits.intellect.total}}</span></div>
</div>
<div class="trait flexrow"><label for="data.traits.constitution.total"
class="trait-label">{{config.traits.constitution}}</label>
<div class="trait-value flex15 grid grid-8col"><input type="number"
name="data.traits.constitution.base" value='{{data.traits.constitution.base}}'
data-dtype="Number" /><span> +
</span><input type="number" name="data.traits.constitution.mod"
value='{{data.traits.constitution.mod}}' data-dtype="Number" /><span> =
</span><span class="trait-value-total">{{data.traits.constitution.total}}</span></div>
</div>
<div class="trait flexrow"><label for="data.traits.dexterity.total"
class="trait-label">{{config.traits.dexterity}}</label>
<div class="trait-value flex15 grid grid-8col"><input type="number"
name="data.traits.dexterity.base" value='{{data.traits.dexterity.base}}'
data-dtype="Number" /><span> +
</span><input type="number" name="data.traits.dexterity.mod"
value='{{data.traits.dexterity.mod}}' data-dtype="Number" /><span> =
</span><span class="trait-value-total">{{data.traits.dexterity.total}}</span></div>
</div>
<div class="trait flexrow"><label for="data.traits.aura.total"
class="trait-label">{{config.traits.aura}}</label>
<div class="trait-value flex15 grid grid-8col"><input type="number" name="data.traits.aura.base"
value='{{data.traits.aura.base}}' data-dtype="Number" /><span> +
</span><input type="number" name="data.traits.aura.mod" value='{{data.traits.aura.mod}}'
data-dtype="Number" /><span> =
</span><span class="trait-value-total">{{data.traits.aura.total}}</span></div>
</div>
</div>
{{> systems/ds4/templates/actor/partials/attributes-traits.hbs}}
<div class="combat-values flexrow flex-between">
<div class="combat-value-with-formula">
<div class="combat-value hitPoints"><span

View file

@ -0,0 +1,52 @@
{{!-- ======================================================================== --}}
{{!-- INLINE PARTIAL DEFINITIONS --}}
{{!-- ======================================================================== --}}
{{!--
!-- Render an attribute.
!--
!-- @param attribute-label: The label to display for the attribute
!-- @param attribute-key: The key of the attribute
!-- @param attribute-data: The data for the attribute
--}}
{{#*inline "attribute"}}
<div class="attribute flexrow"><label for="data.attributes.body.total"
class="attribute-label ">{{attribute-label}}</label>
<div class="attribute-value flex15 grid grid-8col"><input type="number"
name="data.attributes.{{attribute-key}}.base" value='{{attribute-data.base}}' data-dtype="Number" /><span> +
</span><input type="number" name="data.attributes.{{attribute-key}}.mod" value='{{attribute-data.mod}}'
data-dtype="Number" /><span> =
</span><span class="attribute-value-total">{{attribute-data.total}}</span></div>
</div>
{{/inline}}
{{!--
!-- Render a trait.
!--
!-- @param trait-label: The label to display for the trait
!-- @param trait-key: The key of the trait
!-- @param trait-data: The data for the trait
--}}
{{#*inline "trait"}}
<div class="trait flexrow"><label for="data.traits.strength.total" class="trait-label">{{trait-label}}</label>
<div class="trait-value flex15 grid grid-8col"><input type="number" name="data.traits.{{trait-key}}.base"
value='{{trait-data.base}}' data-dtype="Number" /><span> +
</span><input type="number" name="data.traits.{{trait-key}}.mod" value='{{trait-data.mod}}'
data-dtype="Number" /><span> =
</span><span class="trait-value-total">{{trait-data.total}}</span></div>
</div>
{{/inline}}
{{!-- ======================================================================== --}}
<div class="attributes-traits grid grid-3col">
{{#each config.attributes as |attribute-label attribute-key|}}
{{> attribute attribute-label=attribute-label attribute-key=attribute-key attribute-data=(lookup ../data.attributes
attribute-key)}}
{{/each}}
{{#each config.traits as |trait-label trait-key|}}
{{> trait trait-label=trait-label trait-key=trait-key trait-data=(lookup ../data.traits trait-key)}}
{{/each}}
</div>