added language item

- added to database and localization definitions
- added sheet
- added to talents overview
This commit is contained in:
Gesina Schwalbe 2021-01-08 23:23:53 +01:00
parent 9addb66a50
commit f8e1f32439
8 changed files with 60 additions and 17 deletions

View file

@ -44,6 +44,8 @@
"DS4.ItemTypeTalentPlural": "Talents",
"DS4.ItemTypeRacialAbility": "Racial Ability",
"DS4.ItemTypeRacialAbilityPlural": "Racial Abilities",
"DS4.ItemTypeLanguage": "Language",
"DS4.ItemTypeLanguagePlural": "Languages",
"DS4.ArmorType": "Armor Type",
"DS4.ArmorTypeAbbr": "AT",
"DS4.ArmorMaterialType": "Material Type",

View file

@ -50,6 +50,7 @@ export const DS4 = {
equipment: "DS4.ItemTypeEquipment",
talent: "DS4.ItemTypeTalent",
racialAbility: "DS4.ItemTypeRacialAbility",
language: "DS4.ItemTypeLanguage",
},
/**

View file

@ -32,6 +32,7 @@ Hooks.once("init", async function () {
async function registerHandlebarsPartials() {
const templatePaths = [
"systems/ds4/templates/item/partials/sheet-header.hbs",
"systems/ds4/templates/item/partials/description.hbs",
"systems/ds4/templates/item/partials/details.hbs",
"systems/ds4/templates/item/partials/effects.hbs",

View file

@ -7,7 +7,8 @@ export type DS4ItemDataType =
| DS4Trinket
| DS4Equipment
| DS4Talent
| DS4RacialAbility;
| DS4RacialAbility
| DS4Language;
// types
@ -34,6 +35,7 @@ interface DS4Shield extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4I
interface DS4Trinket extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable {}
interface DS4Equipment extends DS4ItemBase, DS4ItemPhysical {}
type DS4RacialAbility = DS4ItemBase;
type DS4Language = DS4ItemBase;
// templates

View file

@ -115,7 +115,7 @@
}
},
"Item": {
"types": ["weapon", "armor", "shield", "trinket", "equipment", "talent", "racialAbility"],
"types": ["weapon", "armor", "shield", "trinket", "equipment", "talent", "racialAbility", "language"],
"templates": {
"base": {
"description": ""
@ -163,6 +163,9 @@
},
"racialAbility": {
"templates": ["base"]
},
"language": {
"templates": ["base"]
}
}
}

View file

@ -25,7 +25,6 @@
!-- The partial assumes a variable item to be given in the context.
!--
!-- @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 "talentListEntry"}}
<li class="item flexrow" data-item-id="{{item._id}}">
@ -58,14 +57,14 @@
{{!--
!-- Render a racial ability list row from a given item.
!-- 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
!-- @param partial-block: hand over custom children of the flexbox in the partial block.
--}}
{{#*inline "racialAbilityListEntry"}}
{{#*inline "baseItemListEntry"}}
<li class="item flexrow" data-item-id="{{item._id}}">
{{!-- image --}}
<div class="flex05 item-image">
@ -81,6 +80,26 @@
</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.HeadingDescription'}}</div>
{{!-- add button --}}
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
</li>
{{/inline}}
{{!-- ======================================================================== --}}
@ -106,18 +125,17 @@
<h4 class="items-list-title">{{localize 'DS4.ItemTypeRacialAbilityPlural'}}</h4>
<ol class="items-list">
<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.HeadingDescription'}}</div>
{{!-- add button --}}
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='racialAbility' }}
</li>
{{> baseItemListHeader dataType='racialAbility' }}
{{#each itemsByType.racialAbility as |item id|}}
{{> racialAbilityListEntry item=item}}
{{> baseItemListEntry item=item}}
{{/each}}
</ol>
<h4 class="items-list-title">{{localize 'DS4.ItemTypeLanguagePlural'}}</h4>
<ol class="items-list">
{{> baseItemListHeader dataType='language' }}
{{#each itemsByType.language as |item id|}}
{{> baseItemListEntry item=item}}
{{/each}}
</ol>
</div>

View file

@ -0,0 +1,8 @@
<form class="{{cssClass}}" autocomplete="off">
{{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
{{/systems/ds4/templates/item/partials/sheet-header.hbs}}
{{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}}
</form>

View file

@ -0,0 +1,8 @@
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
<div class="header-fields flexrow">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name" /></h1>
<h2 class="item-type">{{localize (lookup config.itemTypes item.type)}}</h2>
{{> @partial-block}}
</div>
</header>