Merge branch '022-languages' into 'master'

Resolve "Track Languages in Character Sheet"

Closes #22

See merge request dungeonslayers/ds4!35
This commit is contained in:
Gesina Schwalbe 2021-01-09 00:02:52 +01:00
commit 14aa77ddfb
17 changed files with 138 additions and 104 deletions

View file

@ -44,6 +44,10 @@
"DS4.ItemTypeTalentPlural": "Talents", "DS4.ItemTypeTalentPlural": "Talents",
"DS4.ItemTypeRacialAbility": "Racial Ability", "DS4.ItemTypeRacialAbility": "Racial Ability",
"DS4.ItemTypeRacialAbilityPlural": "Racial Abilities", "DS4.ItemTypeRacialAbilityPlural": "Racial Abilities",
"DS4.ItemTypeLanguage": "Language",
"DS4.ItemTypeLanguagePlural": "Languages",
"DS4.ItemTypeAlphabet": "Alphabet",
"DS4.ItemTypeAlphabetPlural": "Alphabets",
"DS4.ArmorType": "Armor Type", "DS4.ArmorType": "Armor Type",
"DS4.ArmorTypeAbbr": "AT", "DS4.ArmorTypeAbbr": "AT",
"DS4.ArmorMaterialType": "Material Type", "DS4.ArmorMaterialType": "Material Type",
@ -88,7 +92,6 @@
"DS4.BaseInfoRace": "Race", "DS4.BaseInfoRace": "Race",
"DS4.BaseInfoClass": "Class", "DS4.BaseInfoClass": "Class",
"DS4.BaseInfoHeroClass": "Hero Class", "DS4.BaseInfoHeroClass": "Hero Class",
"DS4.BaseInfoRacialAbilities": "Racial Abilites",
"DS4.BaseInfoCulture": "Culture", "DS4.BaseInfoCulture": "Culture",
"DS4.ProgressionLevel": "Level", "DS4.ProgressionLevel": "Level",
"DS4.ProgressionExperiencePoints": "Experience Points", "DS4.ProgressionExperiencePoints": "Experience Points",

View file

@ -57,7 +57,6 @@ interface DS4ActorDataBaseInfo {
race: string; race: string;
class: string; class: string;
heroClass: string; heroClass: string;
racialAbilities: string;
culture: string; culture: string;
} }

View file

@ -50,6 +50,8 @@ export const DS4 = {
equipment: "DS4.ItemTypeEquipment", equipment: "DS4.ItemTypeEquipment",
talent: "DS4.ItemTypeTalent", talent: "DS4.ItemTypeTalent",
racialAbility: "DS4.ItemTypeRacialAbility", racialAbility: "DS4.ItemTypeRacialAbility",
language: "DS4.ItemTypeLanguage",
alphabet: "DS4.ItemTypeAlphabet",
}, },
/** /**
@ -136,7 +138,6 @@ export const DS4 = {
race: "DS4.BaseInfoRace", race: "DS4.BaseInfoRace",
class: "DS4.BaseInfoClass", class: "DS4.BaseInfoClass",
heroClass: "DS4.BaseInfoHeroClass", heroClass: "DS4.BaseInfoHeroClass",
racialAbilities: "DS4.BaseInfoRacialAbilities",
culture: "DS4.BaseInfoCulture", culture: "DS4.BaseInfoCulture",
}, },

View file

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

View file

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

View file

@ -83,7 +83,6 @@
"race": "", "race": "",
"class": "", "class": "",
"heroClass": "", "heroClass": "",
"racialAbilities": "",
"culture": "" "culture": ""
}, },
"progression": { "progression": {
@ -98,10 +97,6 @@
"used": 0 "used": 0
} }
}, },
"language": {
"languages": "",
"alphabets": ""
},
"profile": { "profile": {
"gender": "", "gender": "",
"birthday": "", "birthday": "",
@ -116,7 +111,17 @@
} }
}, },
"Item": { "Item": {
"types": ["weapon", "armor", "shield", "trinket", "equipment", "talent", "racialAbility"], "types": [
"weapon",
"armor",
"shield",
"trinket",
"equipment",
"talent",
"racialAbility",
"language",
"alphabet"
],
"templates": { "templates": {
"base": { "base": {
"description": "" "description": ""
@ -164,6 +169,12 @@
}, },
"racialAbility": { "racialAbility": {
"templates": ["base"] "templates": ["base"]
},
"language": {
"templates": ["base"]
},
"alphabet": {
"templates": ["base"]
} }
} }
} }

View file

@ -25,7 +25,6 @@
!-- The partial assumes a variable item to be given in the context. !-- 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 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"}} {{#*inline "talentListEntry"}}
<li class="item flexrow" data-item-id="{{item._id}}"> <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. !-- 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. !-- 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 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}}"> <li class="item flexrow" data-item-id="{{item._id}}">
{{!-- image --}} {{!-- image --}}
<div class="flex05 item-image"> <div class="flex05 item-image">
@ -81,6 +80,26 @@
</li> </li>
{{/inline}} {{/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,25 @@
<h4 class="items-list-title">{{localize 'DS4.ItemTypeRacialAbilityPlural'}}</h4> <h4 class="items-list-title">{{localize 'DS4.ItemTypeRacialAbilityPlural'}}</h4>
<ol class="items-list"> <ol class="items-list">
<li class="item flexrow item-header"> {{> baseItemListHeader dataType='racialAbility' }}
{{!-- 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>
{{#each itemsByType.racialAbility as |item id|}} {{#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>
<h4 class="items-list-title">{{localize 'DS4.ItemTypeAlphabetPlural'}}</h4>
<ol class="items-list">
{{> baseItemListHeader dataType='alphabet' }}
{{#each itemsByType.alphabet as |item id|}}
{{> baseItemListEntry item=item}}
{{/each}} {{/each}}
</ol> </ol>
</div> </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

@ -1,9 +1,5 @@
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header"> {{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
<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>
<div class="grid grid-3col basic-properties"> <div class="grid grid-3col basic-properties">
<div class="basic-property"> <div class="basic-property">
<label>{{localize "DS4.ArmorType"}}</label> <label>{{localize "DS4.ArmorType"}}</label>
@ -31,8 +27,7 @@
placeholder="0" data-dtype="Number" /> placeholder="0" data-dtype="Number" />
</div> </div>
</div> </div>
</div> {{/systems/ds4/templates/item/partials/sheet-header.hbs}}
</header>
{{!-- Common Item body --}} {{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}} {{> systems/ds4/templates/item/partials/body.hbs}}

View file

@ -1,11 +1,6 @@
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header"> {{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" /> {{/systems/ds4/templates/item/partials/sheet-header.hbs}}
<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>
</div>
</header>
{{!-- Common Item body --}} {{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}} {{> systems/ds4/templates/item/partials/body.hbs}}

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>

View file

@ -1,11 +1,6 @@
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header"> {{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" /> {{/systems/ds4/templates/item/partials/sheet-header.hbs}}
<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>
</div>
</header>
{{!-- Common Item body --}} {{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}} {{> systems/ds4/templates/item/partials/body.hbs}}

View file

@ -1,9 +1,5 @@
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header"> {{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
<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>
<div class="grid grid-1col basic-properties"> <div class="grid grid-1col basic-properties">
<div class="basic-property"> <div class="basic-property">
<label>{{localize "DS4.ArmorValue"}}</label> <label>{{localize "DS4.ArmorValue"}}</label>
@ -11,8 +7,7 @@
placeholder="0" data-dtype="Number" /> placeholder="0" data-dtype="Number" />
</div> </div>
</div> </div>
</div> {{/systems/ds4/templates/item/partials/sheet-header.hbs}}
</header>
{{!-- Common Item body --}} {{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}} {{> systems/ds4/templates/item/partials/body.hbs}}

View file

@ -17,19 +17,14 @@
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header"> {{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
<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>
<div class="grid grid-4col basic-properties"> <div class="grid grid-4col basic-properties">
{{> talentRankBasicProperty data=data property='base' localizeString='DS4.TalentRankBase' }} {{> talentRankBasicProperty data=data property='base' localizeString='DS4.TalentRankBase' }}
{{> talentRankBasicProperty data=data property='max' localizeString='DS4.TalentRankMax'}} {{> talentRankBasicProperty data=data property='max' localizeString='DS4.TalentRankMax'}}
{{> talentRankBasicProperty data=data property='mod' localizeString='DS4.TalentRankMod'}} {{> talentRankBasicProperty data=data property='mod' localizeString='DS4.TalentRankMod'}}
{{> talentRankBasicProperty data=data property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}} {{> talentRankBasicProperty data=data property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}}
</div> </div>
</div> {{/systems/ds4/templates/item/partials/sheet-header.hbs}}
</header>
{{!-- Common Item body --}} {{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}} {{> systems/ds4/templates/item/partials/body.hbs}}

View file

@ -1,11 +1,6 @@
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header"> {{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" /> {{/systems/ds4/templates/item/partials/sheet-header.hbs}}
<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>
</div>
</header>
{{!-- Common Item body --}} {{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}} {{> systems/ds4/templates/item/partials/body.hbs}}

View file

@ -1,9 +1,5 @@
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header"> {{#> systems/ds4/templates/item/partials/sheet-header.hbs}}
<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>
<div class="grid grid-3col basic-properties"> <div class="grid grid-3col basic-properties">
<div class="basic-property"> <div class="basic-property">
<label>{{localize "DS4.AttackType"}}</label> <label>{{localize "DS4.AttackType"}}</label>
@ -26,8 +22,7 @@
value="{{data.opponentDefense}}" placeholder="0" data-dtype="Number" /> value="{{data.opponentDefense}}" placeholder="0" data-dtype="Number" />
</div> </div>
</div> </div>
</div> {{/systems/ds4/templates/item/partials/sheet-header.hbs}}
</header>
{{!-- Common Item body --}} {{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}} {{> systems/ds4/templates/item/partials/body.hbs}}