{{!-- TODO: For items list: only show header, if list is not empty --}} {{!-- ======================================================================== --}} {{!-- INLINE PARTIAL DEFINITIONS --}} {{!-- ======================================================================== --}} {{!-- !-- Render the given partial block only if the given itemsArray has length > 0, !-- else only an add button. !-- !-- @param itemsArray: the array with the items to check the length of !-- @param dataType: the string type of the item --}} {{#*inline "ifHasItemOfType"}} {{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}} {{> @partial-block}} {{else}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} {{/if}} {{/inline}} {{!-- !-- Render a header row for a given data type. !-- It is a flexbox with a child for each column head. !-- An "equipped" heading is rendered except for the case dataType==='equipment'. !-- The partial assumes a variable dataType to be given in the context. !-- If the partial is called with a partial block, the partial block !-- content is inserted before the description heading. !-- @param datType: hand over the dataType to the partial as hash parameter !-- @param partial-block: hand over custom children of the flexbox in the partial block. --}} {{#*inline "itemListHeader" }}
  • {{!-- equipped --}} {{#if (ne dataType 'equipment')}}
    {{localize 'DS4.ItemEquippedAbbr'}}
    {{/if}} {{!-- image --}}
    {{!-- amount --}}
    #
    {{!-- name --}}
    {{localize 'DS4.ItemName'}}
    {{!-- item type specifics --}} {{> @partial-block }} {{!-- description --}}
    {{localize 'DS4.HeadingDescription'}}
    {{!-- add button --}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
  • {{/inline}} {{!-- !-- Render a list row from a given item. !-- It is a flexbox with a child for each item value of interest. !-- An equipped checkbox is rendered if item.data.data.equipped is defined. !-- The partial assumes a variable item to be given in the context. !-- If the partial is called with a partial block, the partial block !-- content is inserted before the description. !-- @param item: hand over the item to the partial as hash parameter !-- @param partial-block: hand over custom children of the flexbox in the partial block. --}} {{#*inline "itemListEntry"}}
  • {{!-- equipped --}} {{#if (ne item.data.data.equipped undefined)}} {{/if}} {{!-- image --}}
    {{!-- amount --}} {{!-- name --}} {{!-- item type specifics --}} {{> @partial-block}} {{!-- description --}}
    {{{item.data.data.description}}}
    {{!-- control buttons --}} {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
  • {{/inline}} {{!-- ======================================================================== --}}
    {{!-- WEAPONS --}}

    {{localize 'DS4.ItemTypeWeaponPlural'}}

    {{!-- {{#if (and (ne itemsByType.weapon undefined) (gt itemsByType.weapon.length 0)) }} --}} {{#> ifHasItemOfType itemsArray=itemsByType.weapon dataType='weapon' }}
      {{#> itemListHeader dataType='weapon'}}
      {{localize 'DS4.AttackTypeAbbr'}}
      {{localize 'DS4.WeaponBonusAbbr'}}
      {{localize 'DS4.OpponentDefenseAbbr'}}
      {{/itemListHeader}} {{#each itemsByType.weapon as |item id|}} {{#> itemListEntry item=item}}
      {{ item.data.data.weaponBonus}}
      {{ item.data.data.opponentDefense}}
      {{/itemListEntry}} {{/each}}
    {{!-- {{else}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='weapon' }} --}} {{/ifHasItemOfType}} {{!-- ARMOR --}}

    {{localize 'DS4.ItemTypeArmorPlural'}}

    {{#> ifHasItemOfType itemsArray=itemsByType.armor dataType='armor' }}
      {{#> itemListHeader dataType='armor'}}
      {{localize 'DS4.ArmorMaterialTypeAbbr'}}
      {{localize 'DS4.ArmorTypeAbbr'}}
      {{localize 'DS4.ArmorValueAbbr'}}
      {{/itemListHeader}} {{#each itemsByType.armor as |item id|}} {{#> itemListEntry item=item }}
      {{lookup ../../config.armorMaterialTypesAbbr item.data.data.armorMaterialType}}
      {{lookup ../../config.armorTypesAbbr item.data.data.armorType}}
      {{ item.data.data.armorValue}}
      {{/itemListEntry}} {{/each}}
    {{/ifHasItemOfType}} {{!-- SHIELD --}}

    {{localize 'DS4.ItemTypeShieldPlural'}}

    {{!-- SPECIFIC --}} {{#> ifHasItemOfType itemsArray=itemsByType.shield dataType='shield' }}
      {{#> itemListHeader dataType='shield' }}
      {{localize 'DS4.ArmorValueAbbr'}}
      {{/itemListHeader}} {{#each itemsByType.shield as |item id|}} {{#> itemListEntry item=item }}
      {{item.data.data.armorValue}}
      {{!-- SPECIFIC --}} {{/itemListEntry}} {{/each}}
    {{/ifHasItemOfType}} {{!-- TRINKET --}}

    {{localize 'DS4.ItemTypeTrinketPlural'}}

    {{#> ifHasItemOfType itemsArray=itemsByType.trinket dataType='trinket' }}
      {{#> itemListHeader dataType='trinket'}}
      {{localize 'DS4.StorageLocation'}}
      {{/itemListHeader}} {{#each itemsByType.trinket as |item id|}} {{#> itemListEntry item=item }} {{/itemListEntry}} {{/each}}
    {{/ifHasItemOfType}} {{!-- EQUIPMENT --}}

    {{localize 'DS4.ItemTypeEquipmentPlural'}}

    {{#> ifHasItemOfType itemsArray=itemsByType.equipment dataType='equipment' }}
      {{#> itemListHeader dataType='equipment'}}
      {{localize 'DS4.StorageLocation'}}
      {{/itemListHeader}} {{#each itemsByType.equipment as |item id|}} {{#> itemListEntry item=item }} {{/itemListEntry}} {{/each}}
    {{/ifHasItemOfType}}