Add special abilities to creature sheet

This commit is contained in:
Johannes Loher 2021-01-13 17:20:25 +01:00
parent 864a65fed2
commit e36f30a787
12 changed files with 107 additions and 15 deletions

View file

@ -53,8 +53,9 @@
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a>
<a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a>
<a class="item" data-tab="special-creature-abilites">{{localize 'DS4.HeadingSpecialCreatureAbilites'}}</a>
<a class="item" data-tab="spells">{{localize 'DS4.HeadingSpells'}}</a>
<a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a>
</nav>
{{!-- Sheet Body --}}
@ -62,6 +63,9 @@
{{!-- Items Tab --}}
{{> systems/ds4/templates/actor/partials/items-overview.hbs}}
{{!-- Special Creature Abilities Tab --}}
{{> systems/ds4/templates/actor/partials/special-creature-abilites-overview.hbs}}
{{!-- Spells Tab --}}
{{> systems/ds4/templates/actor/partials/spells-overview.hbs}}

View file

@ -1,5 +1,5 @@
{{!-- TODO: For items list: only show header, if list is not empty --}}
{{!-- TODO: Refactor to avoid code duplication with special-creature-abilites-overview and talents-overview --}}
{{!-- ======================================================================== --}}
{{!-- INLINE PARTIAL DEFINITIONS --}}

View file

@ -0,0 +1,61 @@
{{!-- TODO: Refactor to avoid code duplication with items-overview and talents-overview --}}
{{!-- ======================================================================== --}}
{{!-- INLINE PARTIAL DEFINITIONS --}}
{{!-- ======================================================================== --}}
{{!--
!-- Render a list row for a base item from a given item.
!-- Base item means it just has an image, a description, and a name (and effects).
!-- It is a flexbox with a child for each item value of interest.
!-- The partial assumes a variable item to be given in the context.
!--
!-- @param item: hand over the item to the partial as hash parameter
--}}
{{#*inline "baseItemListEntry"}}
<li class="item flexrow" data-item-id="{{item._id}}">
{{!-- image --}}
<div class="flex05 item-image">
<img src="{{item.img}}" title="{{item.name}}" width="24" height="24" />
</div>
{{!-- name --}}
<input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
data-property="name" title="{{localize 'DS4.ItemName'}}">
{{!-- description --}}
<div class="flex3 item-description">{{{item.data.data.description}}}</div>
{{!-- control buttons --}}
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
</li>
{{/inline}}
{{!--
!-- Render a list header for a base item list entries from a given item.
!-- The partial assumes a variable dataType to be given in the context.
!--
!-- @param dataType: the string item type for the list
--}}
{{#*inline "baseItemListHeader"}}
<li class="item flexrow item-header">
{{!-- image --}}
<div class="flex05 item-image"></div>
{{!-- name --}}
<div class="flex1 item-name">{{localize 'DS4.ItemName'}}</div>
{{!-- description --}}
<div class="flex3">{{localize 'DS4.Description'}}</div>
{{!-- add button --}}
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
</li>
{{/inline}}
{{!-- ======================================================================== --}}
<div class="tab special-creature-abilites" data-group="primary" data-tab="special-creature-abilites">
<ol class="items-list">
{{> baseItemListHeader dataType='specialCreatureAbility' }}
{{#each itemsByType.specialCreatureAbility as |item id|}}
{{> baseItemListEntry item=item}}
{{/each}}
</ol>
</div>

View file

@ -27,7 +27,7 @@
{{!-- ======================================================================== --}}
<div class="tab items" data-group="primary" data-tab="spells">
<div class="tab spells" data-group="primary" data-tab="spells">
<ol class="items-list">
<li class="item flexrow item-header">
{{!-- equipped --}}

View file

@ -1,3 +1,5 @@
{{!-- TODO: Refactor to avoid code duplication with creature-special-abilities-overview and talents-overview --}}
{{!-- ======================================================================== --}}
{{!-- INLINE PARTIAL DEFINITIONS --}}
{{!-- ======================================================================== --}}
@ -118,7 +120,7 @@
{{!-- ======================================================================== --}}
<div class="tab items" data-group="primary" data-tab="talents">
<div class="tab talents" data-group="primary" data-tab="talents">
<h4 class="items-list-title">{{localize 'DS4.ItemTypeTalentPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent' }}
<ol class="items-list">