{{!-- TODO: For items list: only show header, if list is not empty --}} {{!-- ======================================================================== --}} {{!-- INLINE PARTIAL DEFINITIONS --}} {{!-- ======================================================================== --}} {{!-- !-- Render an "add" button for a given data type. !-- !-- @param datType: hand over the dataType to the partial as hash parameter --}} {{#*inline "addButton"}}
{{localize 'DS4.UserInteractionAddItem'}}
{{/inline}} {{!-- !-- Render a group of an "edit" and a "delete" button for the current item. !-- The current item is defined by the data-item-id HTML property of the parent li element. --}} {{#*inline "itemControlButtons"}}
{{/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 "listHeader" }}
  • {{!-- equipped --}} {{#if (ne dataType 'equipment')}}
    E
    {{/if}} {{!-- image --}}
    {{!-- amount --}}
    #
    {{!-- name --}}
    {{localize 'DS4.ItemName'}}
    {{!-- item type specifics --}} {{> @partial-block }} {{!-- description --}}
    {{localize 'DS4.Description'}}
    {{!-- add button --}} {{> addButton 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 "listEntry"}}
  • {{!-- equipped --}} {{#if (ne item.data.data.equipped undefined)}} {{#if item.data.data.equipped}} {{else}} {{/if}} {{/if}}
    {{!-- image --}}
    {{!-- amount --}}
    {{item.data.data.quantity}}
    {{!-- name --}}

    {{item.name}}

    {{!-- item type specifics --}} {{> @partial-block}} {{!-- description --}}
    {{{item.data.data.description}}}
    {{!-- control buttons --}} {{> itemControlButtons}}
  • {{/inline}} {{!-- ======================================================================== --}}
    {{!-- WEAPONS --}}

    {{localize 'DS4.ItemTypeWeapon'}}

      {{#> listHeader dataType='weapon'}}
      {{localize 'DS4.AttackTypeAbbr'}}
      {{localize 'DS4.WeaponBonusAbbr'}}
      {{localize 'DS4.OpponentDefenseAbbr'}}
      {{/listHeader}} {{#each itemsByType.weapon as |item id|}} {{#> listEntry item=item}}
      {{ item.data.data.weaponBonus}}
      {{ item.data.data.opponentDefense}}
      {{/listEntry}} {{/each}}
    {{!-- ARMOR --}}

    {{localize 'DS4.ItemTypeArmor'}}

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

    {{localize 'DS4.ItemTypeShield'}}

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

    {{localize 'DS4.ItemTypeTrinket'}}

      {{#> listHeader dataType='trinket'}}
      {{localize 'DS4.StorageLocation'}}
      {{/listHeader}} {{#each itemsByType.trinket as |item id|}} {{#> listEntry item=item }}
      {{{item.data.data.storageLocation}}}
      {{/listEntry}} {{/each}}
    {{!-- EQUIPMENT --}}

    {{localize 'DS4.ItemTypeEquipment'}}

      {{#> listHeader dataType='equipment'}}
      {{localize 'DS4.StorageLocation'}}
      {{/listHeader}} {{#each itemsByType.equipment as |item id|}} {{#> listEntry item=item }}
      {{{item.data.data.storageLocation}}}
      {{/listEntry}} {{/each}}