ds4/src/templates/sheets/actor/tabs/spells.hbs

99 lines
4.1 KiB
Handlebars
Raw Normal View History

2021-06-26 22:02:00 +02:00
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
2021-01-09 23:39:35 +01:00
{{!-- ======================================================================== --}}
{{!-- INLINE PARTIAL DEFINITIONS --}}
{{!-- ======================================================================== --}}
2021-01-16 23:47:05 +01:00
{{!--
!-- Base template to display a value with unit.
2021-01-09 23:39:35 +01:00
!-- @param unitDatum: the object to display; must have a value and a unit attribute
!-- @param titleKey: The key of the localized title to use.
2021-01-16 23:47:05 +01:00
!-- @param unitNames: mapping of allowed unitDatum.unit values to localized unit name
!-- @param unitAbbrs: mapping of allowed unitDatum.unit values to unit abbreviation
2021-01-09 23:39:35 +01:00
--}}
2021-01-16 23:47:05 +01:00
{{#*inline "unit"}}
<div title="{{localize titleKey}} [{{lookup unitNames unitDatum.unit}}]">
2021-01-16 23:47:05 +01:00
{{#if unitDatum.value }}
{{unitDatum.value}}&thinsp;{{lookup unitAbbrs unitDatum.unit}}
2021-01-16 23:47:05 +01:00
{{else}}-{{/if}}
2021-01-09 23:39:35 +01:00
</div>
{{/inline}}
{{!--
2021-05-13 19:59:44 +02:00
!-- Three templates based on the "unit" template for displaying values with unit.
2021-01-16 23:47:05 +01:00
!-- Both accept a `config` object holding the unitNames and unitAbbr instead of
!-- directly handing over the latter two.
!-- @param titleKey: The key of the localized title to use.
2021-01-16 23:47:05 +01:00
--}}
{{#*inline "temporalUnit"}}
{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum
titleKey=titleKey}}
2021-01-16 23:47:05 +01:00
{{/inline}}
2021-01-09 23:39:35 +01:00
2021-05-13 19:59:44 +02:00
{{#*inline "customTemporalUnit"}}
{{> unit unitNames=config.i18n.customTemporalUnits unitAbbrs=config.i18n.customTemporalUnitsAbbr unitDatum=unitDatum
titleKey=titleKey}}
{{/inline}}
2021-01-09 23:39:35 +01:00
{{#*inline "distanceUnit"}}
{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum
titleKey=titleKey}}
2021-01-09 23:39:35 +01:00
{{/inline}}
{{!-- ======================================================================== --}}
<div class="tab spells" data-group="primary" data-tab="spells">
2021-02-26 01:38:53 +01:00
{{#unless (isEmpty itemsByType.spell)}}
<ol class="ds4-item-list ds4-item-list--spell item-list">
2021-04-13 21:40:52 +02:00
{{#> systems/ds4/templates/sheets/actor/components/item-list-header.hbs isEquipable=true hideDescription=true}}
{{!-- spell type --}}
<div title="{{localize 'DS4.SpellType'}}">{{localize 'DS4.SpellTypeAbbr'}}</div>
{{!-- spell bonus --}}
<div title="{{localize 'DS4.SpellBonus'}}">{{localize 'DS4.SpellBonusAbbr'}}</div>
{{!-- max. distance --}}
<div title="{{localize 'DS4.SpellMaxDistance'}}"><i class="fas fa-ruler"></i></div>
{{!-- duration --}}
<div title="{{localize 'DS4.SpellDuration'}}"><i class="far fa-clock"></i></div>
{{!-- cooldown duration --}}
<div title="{{localize 'DS4.SpellCooldownDuration'}}"><i class="fas fa-hourglass-half"></i></div>
2021-04-13 21:40:52 +02:00
{{/systems/ds4/templates/sheets/actor/components/item-list-header.hbs}}
{{#each itemsByType.spell as |itemData id|}}
2021-04-13 21:40:52 +02:00
{{#> systems/ds4/templates/sheets/actor/components/item-list-entry.hbs itemData=itemData isEquipable=true
hideDescription=true}}
{{!-- spell type --}}
<img class="ds4-item-list__image" src="{{lookup ../../config.icons.spellTypes itemData.data.spellType}}"
title="{{lookup ../../config.i18n.spellTypes itemData.data.spellType}}" />
{{!-- spell bonus --}}
2021-07-23 00:43:15 +02:00
<input class="ds4-item-list__editable change-item" type="text" data-dtype="String" data-property="data.bonus"
value="{{itemData.data.bonus}}" title="{{localize 'DS4.SpellBonus'}}" />
{{!-- max. distance --}}
{{> distanceUnit titleKey='DS4.SpellMaxDistance' unitDatum=itemData.data.maxDistance
config=../../config}}
{{!-- duration --}}
2021-05-13 19:59:44 +02:00
{{> customTemporalUnit titleKey='DS4.SpellDuration' unitDatum=itemData.data.duration config=../../config}}
{{!-- cooldown duration --}}
{{> temporalUnit titleKey='DS4.SpellCooldownDuration' unitDatum=itemData.data.cooldownDuration
config=../../config}}
2021-04-13 21:40:52 +02:00
{{/systems/ds4/templates/sheets/actor/components/item-list-entry.hbs}}
2021-01-09 23:39:35 +01:00
{{/each}}
</ol>
2021-02-26 01:38:53 +01:00
{{/unless}}
2021-07-20 02:16:43 +02:00
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
documentType='item' type='spell'}}
</div>