ds4/src/templates/actor/partials/items-overview.hbs

193 lines
7.8 KiB
Handlebars
Raw Normal View History

{{!-- TODO: Refactor to avoid code duplication with special-creature-abilites-overview and talents-overview --}}
{{!-- ======================================================================== --}}
{{!-- 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}}
{{/if}}
2021-01-23 23:44:49 +01:00
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
{{/inline}}
{{!--
!-- Render a header row for a given data type.
2021-02-21 03:40:54 +01:00
!-- An "equipped" heading is rendered except for the case dataType==='loot'.
!-- 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 in the partial block.
--}}
{{#*inline "itemListHeader" }}
<li class="item-row item-header">
{{!-- equipped --}}
2021-02-21 03:40:54 +01:00
{{#if (ne dataType 'loot')}}
<div title="{{localize 'DS4.ItemEquipped'}}">{{localize 'DS4.ItemEquippedAbbr'}}</div>
{{/if}}
{{!-- image --}}
<div class="item-image"></div>
{{!-- amount --}}
<div class="item-num-val" title="{{localize 'DS4.Quantity'}}">#</div>
{{!-- name --}}
<div class="item-name">{{localize 'DS4.ItemName'}}</div>
{{!-- item type specifics --}}
{{> @partial-block }}
{{!-- description --}}
<div>{{localize 'DS4.Description'}}</div>
2021-01-23 23:44:49 +01:00
{{!-- control buttons placeholder --}}
<div></div>
</li>
{{/inline}}
{{!--
!-- Render a list row from a given item.
!-- An equipped checkbox is rendered except for the case item.data.type==='loot'.
!-- 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 in the partial block.
--}}
{{#*inline "itemListEntry"}}
<li class="item-row" data-item-id="{{item._id}}">
{{!-- equipped --}}
{{#if (ne item.data.type 'loot')}}
<input class="item-change" type="checkbox" {{checked item.data.data.equipped}} data-dtype="Boolean"
data-property="data.equipped" title="{{localize 'DS4.ItemEquipped'}}">
{{/if}}
{{!-- image --}}
<div class="item-image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
{{!-- amount --}}
<input class="item-num-val item-change" type="number" min="0" step="1" value="{{item.data.data.quantity}}"
data-dtype="Number" data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" />
{{!-- name --}}
<input class="item-name item-change" type="text" value="{{item.name}}" data-dtype="String" data-property="name"
title="{{htmlToPlainText item.data.data.description}}" />
{{!-- item type specifics --}}
{{> @partial-block}}
{{!-- description --}}
<div class="item-description" title="{{htmlToPlainText item.data.data.description}}">
{{{item.data.data.description}}}</div>
{{!-- control buttons --}}
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
</li>
{{/inline}}
{{!-- ======================================================================== --}}
2021-01-18 19:59:25 +01:00
{{!-- WEAPONS --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeWeaponPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.weapon dataType='weapon' }}
<ol class="items-list weapon">
2021-01-18 19:59:25 +01:00
{{#> itemListHeader dataType='weapon'}}
<div class="item-image" title="{{localize 'DS4.AttackType'}}">{{localize 'DS4.AttackTypeAbbr'}}</div>
<div class="item-num-val" title="{{localize 'DS4.WeaponBonus'}}">
2021-01-18 19:59:25 +01:00
{{localize 'DS4.WeaponBonusAbbr'}}
</div>
<div class="item-num-val" title="{{localize 'DS4.OpponentDefense'}}">
2021-01-18 19:59:25 +01:00
{{localize 'DS4.OpponentDefenseAbbr'}}
</div>
{{/itemListHeader}}
{{#each itemsByType.weapon as |item id|}}
{{#> itemListEntry item=item}}
<div class="item-image"
style="background-image: url('{{lookup ../../config.icons.attackTypes item.data.data.attackType}}')"
title="{{lookup ../../config.i18n.attackTypes item.data.data.attackType}}">
2021-01-18 19:59:25 +01:00
</div>
<div class="item-num-val">{{ item.data.data.weaponBonus}}</div>
<div class="item-num-val">{{ item.data.data.opponentDefense}}</div>
2021-01-18 19:59:25 +01:00
{{/itemListEntry}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
{{!-- ARMOR --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeArmorPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.armor dataType='armor' }}
<ol class="items-list armor">
2021-01-18 19:59:25 +01:00
{{#> itemListHeader dataType='armor'}}
<div title="{{localize 'DS4.ArmorMaterialType'}}">{{localize 'DS4.ArmorMaterialTypeAbbr'}}</div>
<div title="{{localize 'DS4.ArmorType'}}">{{localize 'DS4.ArmorTypeAbbr'}}</div>
<div class="item-num-val" title="{{localize 'DS4.ArmorValue'}}">
2021-01-18 19:59:25 +01:00
{{localize 'DS4.ArmorValueAbbr'}}
</div>
{{/itemListHeader}}
{{#each itemsByType.armor as |item id|}}
{{#> itemListEntry item=item }}
<div title="{{lookup ../../config.i18n.armorMaterialTypes item.data.data.armorMaterialType}}">
{{lookup ../../config.i18n.armorMaterialTypesAbbr item.data.data.armorMaterialType}}
2021-01-18 19:59:25 +01:00
</div>
<div title="{{lookup ../../config.i18n.armorTypes item.data.data.armorType}}">
{{lookup ../../config.i18n.armorTypesAbbr item.data.data.armorType}}
2021-01-18 19:59:25 +01:00
</div>
<div class="item-num-val">{{ item.data.data.armorValue}}</div>
2021-01-18 19:59:25 +01:00
{{/itemListEntry}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
{{!-- SHIELD --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeShieldPlural'}}</h4>
2021-01-18 19:59:25 +01:00
{{#> ifHasItemOfType itemsArray=itemsByType.shield dataType='shield' }}
<ol class="items-list shield">
2021-01-18 19:59:25 +01:00
{{#> itemListHeader dataType='shield' }}
<div class="item-num-val" title="{{localize 'DS4.ArmorValue'}}">
2021-01-18 19:59:25 +01:00
{{localize 'DS4.ArmorValueAbbr'}}
</div>
{{/itemListHeader}}
{{#each itemsByType.shield as |item id|}}
{{#> itemListEntry item=item }}
<div class="item-num-val">{{item.data.data.armorValue}}</div>
2021-01-18 19:59:25 +01:00
{{/itemListEntry}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
2021-02-21 03:40:54 +01:00
{{!-- EQUIPMENT --}}
2021-02-21 03:40:54 +01:00
<h4 class="items-list-title">{{localize 'DS4.ItemTypeEquipmentPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.equipment dataType='equipment' }}
<ol class="items-list equipment">
2021-02-21 03:40:54 +01:00
{{#> itemListHeader dataType='equipment'}}
<div>{{localize 'DS4.StorageLocation'}}</div>
2021-01-18 19:59:25 +01:00
{{/itemListHeader}}
2021-02-21 03:40:54 +01:00
{{#each itemsByType.equipment as |item id|}}
2021-01-18 19:59:25 +01:00
{{#> itemListEntry item=item }}
<input class="item-change" type="text" value="{{item.data.data.storageLocation}}" data-dtype="String"
2021-01-18 19:59:25 +01:00
data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}">
{{/itemListEntry}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
2021-02-21 03:40:54 +01:00
{{!-- LOOT --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeLootPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.loot dataType='loot' }}
<ol class="items-list loot">
2021-02-21 03:40:54 +01:00
{{#> itemListHeader dataType='loot'}}
<div>{{localize 'DS4.StorageLocation'}}</div>
2021-01-18 19:59:25 +01:00
{{/itemListHeader}}
2021-02-21 03:40:54 +01:00
{{#each itemsByType.loot as |item id|}}
2021-01-18 19:59:25 +01:00
{{#> itemListEntry item=item }}
<input class="item-change" type="text" value="{{item.data.data.storageLocation}}" data-dtype="String"
2021-01-18 19:59:25 +01:00
data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}">
{{/itemListEntry}}
{{/each}}
</ol>
{{/ifHasItemOfType}}