add racial abilites as item type

This commit is contained in:
Johannes Loher 2021-01-07 20:20:40 +01:00
parent cad0d74522
commit 149096e985
9 changed files with 118 additions and 45 deletions

View file

@ -4,7 +4,7 @@
"DS4.HeadingDescription": "Description", "DS4.HeadingDescription": "Description",
"DS4.HeadingDetails": "Details", "DS4.HeadingDetails": "Details",
"DS4.HeadingEffects": "Effects", "DS4.HeadingEffects": "Effects",
"DS4.HeadingItems": "Items", "DS4.HeadingInventory": "Inventory",
"DS4.HeadingProfile": "Profile", "DS4.HeadingProfile": "Profile",
"DS4.HeadingTalents": "Talents & Abilities", "DS4.HeadingTalents": "Talents & Abilities",
"DS4.AttackType": "Attack Type", "DS4.AttackType": "Attack Type",
@ -31,11 +31,19 @@
"DS4.ItemAvailabilityNowhere": "Nowhere", "DS4.ItemAvailabilityNowhere": "Nowhere",
"DS4.ItemName": "Name", "DS4.ItemName": "Name",
"DS4.ItemTypeWeapon": "Weapon", "DS4.ItemTypeWeapon": "Weapon",
"DS4.ItemTypeWeaponPlural": "Weapons",
"DS4.ItemTypeArmor": "Armor", "DS4.ItemTypeArmor": "Armor",
"DS4.ItemTypeArmorPlural": "Armor",
"DS4.ItemTypeShield": "Shield", "DS4.ItemTypeShield": "Shield",
"DS4.ItemTypeShieldPlural": "Shields",
"DS4.ItemTypeTrinket": "Trinket", "DS4.ItemTypeTrinket": "Trinket",
"DS4.ItemTypeTrinketPlural": "Trinkets",
"DS4.ItemTypeEquipment": "Equipment", "DS4.ItemTypeEquipment": "Equipment",
"DS4.ItemTypeEquipmentPlural": "Equipment",
"DS4.ItemTypeTalent": "Talent", "DS4.ItemTypeTalent": "Talent",
"DS4.ItemTypeTalentPlural": "Talents",
"DS4.ItemTypeRacialAbility": "Racial Ability",
"DS4.ItemTypeRacialAbilityPlural": "Racial Abilities",
"DS4.ArmorType": "Armor Type", "DS4.ArmorType": "Armor Type",
"DS4.ArmorTypeAbbr": "AT", "DS4.ArmorTypeAbbr": "AT",
"DS4.ArmorMaterialType": "Material Type", "DS4.ArmorMaterialType": "Material Type",

View file

@ -49,6 +49,7 @@ export const DS4 = {
trinket: "DS4.ItemTypeTrinket", trinket: "DS4.ItemTypeTrinket",
equipment: "DS4.ItemTypeEquipment", equipment: "DS4.ItemTypeEquipment",
talent: "DS4.ItemTypeTalent", talent: "DS4.ItemTypeTalent",
racialAbility: "DS4.ItemTypeRacialAbility",
}, },
/** /**

View file

@ -1,6 +1,13 @@
import { ModifiableData } from "../actor/actor-data"; import { ModifiableData } from "../actor/actor-data";
export type DS4ItemDataType = DS4Weapon | DS4Armor | DS4Shield | DS4Trinket | DS4Equipment | DS4Talent; export type DS4ItemDataType =
| DS4Weapon
| DS4Armor
| DS4Shield
| DS4Trinket
| DS4Equipment
| DS4Talent
| DS4RacialAbility;
// types // types
@ -26,6 +33,7 @@ interface DS4TalentRank extends ModifiableData<number> {
interface DS4Shield extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4ItemProtective {} interface DS4Shield extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4ItemProtective {}
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;
// templates // templates

View file

@ -43,7 +43,7 @@ header.sheet-header {
display: block; display: block;
height: 50px; height: 50px;
padding: 0px; padding: 0px;
flex: 0 0 0; flex: 0 0 auto;
color: $c-light-grey; color: $c-light-grey;
border: none; border: none;
line-height: 50px; line-height: 50px;

View file

@ -116,7 +116,7 @@
} }
}, },
"Item": { "Item": {
"types": ["weapon", "armor", "shield", "trinket", "equipment", "talent"], "types": ["weapon", "armor", "shield", "trinket", "equipment", "talent", "racialAbility"],
"templates": { "templates": {
"base": { "base": {
"description": "" "description": ""
@ -161,6 +161,9 @@
"max": 0, "max": 0,
"mod": 0 "mod": 0
} }
},
"racialAbility": {
"templates": ["base"]
} }
} }
} }

View file

@ -61,7 +61,7 @@
<a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a> <a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a>
<a class="item" data-tab="talents">{{localize 'DS4.HeadingTalents'}}</a> <a class="item" data-tab="talents">{{localize 'DS4.HeadingTalents'}}</a>
<a class="item" data-tab="profile">{{localize "DS4.HeadingProfile"}}</a> <a class="item" data-tab="profile">{{localize "DS4.HeadingProfile"}}</a>
<a class="item" data-tab="items">{{localize 'DS4.HeadingItems'}}</a> <a class="item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a>
</nav> </nav>
{{!-- Sheet Body --}} {{!-- Sheet Body --}}

View file

@ -79,10 +79,10 @@
{{!-- ======================================================================== --}} {{!-- ======================================================================== --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab inventory" data-group="primary" data-tab="inventory">
{{!-- WEAPONS --}} {{!-- WEAPONS --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeWeapon'}}</h4> <h4 class="items-list-title">{{localize 'DS4.ItemTypeWeaponPlural'}}</h4>
<ol class="items-list"> <ol class="items-list">
{{#> itemListHeader dataType='weapon'}} {{#> itemListHeader dataType='weapon'}}
<div class="flex05 item-image" title="{{localize 'DS4.AttackType'}}">{{localize 'DS4.AttackTypeAbbr'}}</div> <div class="flex05 item-image" title="{{localize 'DS4.AttackType'}}">{{localize 'DS4.AttackTypeAbbr'}}</div>
@ -106,7 +106,7 @@
</ol> </ol>
{{!-- ARMOR --}} {{!-- ARMOR --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeArmor'}}</h4> <h4 class="items-list-title">{{localize 'DS4.ItemTypeArmorPlural'}}</h4>
<ol class="items-list"> <ol class="items-list">
{{#> itemListHeader dataType='armor'}} {{#> itemListHeader dataType='armor'}}
<div title="{{localize 'DS4.ArmorMaterialType'}}">{{localize 'DS4.ArmorMaterialTypeAbbr'}}</div> <div title="{{localize 'DS4.ArmorMaterialType'}}">{{localize 'DS4.ArmorMaterialTypeAbbr'}}</div>
@ -130,7 +130,7 @@
{{!-- SHIELD --}} {{!-- SHIELD --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeShield'}}</h4> {{!-- SPECIFIC --}} <h4 class="items-list-title">{{localize 'DS4.ItemTypeShieldPlural'}}</h4> {{!-- SPECIFIC --}}
<ol class="items-list"> <ol class="items-list">
{{#> itemListHeader dataType='shield' }} {{#> itemListHeader dataType='shield' }}
<div class="flex05 item-num-val" title="{{localize 'DS4.ArmorValue'}}"> <div class="flex05 item-num-val" title="{{localize 'DS4.ArmorValue'}}">
@ -145,7 +145,7 @@
</ol> </ol>
{{!-- TRINKET --}} {{!-- TRINKET --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeTrinket'}}</h4> <h4 class="items-list-title">{{localize 'DS4.ItemTypeTrinketPlural'}}</h4>
<ol class="items-list"> <ol class="items-list">
{{#> itemListHeader dataType='trinket'}} {{#> itemListHeader dataType='trinket'}}
<div class="flex2">{{localize 'DS4.StorageLocation'}}</div> <div class="flex2">{{localize 'DS4.StorageLocation'}}</div>
@ -159,7 +159,7 @@
</ol> </ol>
{{!-- EQUIPMENT --}} {{!-- EQUIPMENT --}}
<h4 class="items-list-title">{{localize 'DS4.ItemTypeEquipment'}}</h4> <h4 class="items-list-title">{{localize 'DS4.ItemTypeEquipmentPlural'}}</h4>
<ol class="items-list"> <ol class="items-list">
{{#> itemListHeader dataType='equipment'}} {{#> itemListHeader dataType='equipment'}}
<div class="flex2">{{localize 'DS4.StorageLocation'}}</div> <div class="flex2">{{localize 'DS4.StorageLocation'}}</div>

View file

@ -13,11 +13,9 @@
!-- meant to be set to "disabled" to disable the input element !-- meant to be set to "disabled" to disable the input element
--}} --}}
{{#*inline "talentRankValue"}} {{#*inline "talentRankValue"}}
<input class="item-num-val item-change" data-dtype="Number" type="number" min="0" step="1" <input class="item-num-val item-change" data-dtype="Number" type="number" min="0" step="1" {{#if (eq property 'base' )
{{#if (eq property 'base') }}max="{{item.data.data.rank.max}}"{{/if}} }}max="{{item.data.data.rank.max}}" {{/if}} {{disabled}} data-property="data.rank.{{property}}"
{{disabled}} value="{{lookup item.data.data.rank property}}" title="{{localize localizeString}}" />
data-property="data.rank.{{property}}" value="{{lookup item.data.data.rank property}}"
title="{{localize localizeString}}" />
{{/inline}} {{/inline}}
@ -59,10 +57,35 @@
{{/inline}} {{/inline}}
{{!--
!-- Render a racial ability list row from a given item.
!-- 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"}}
<li class="item flexrow" data-item-id="{{item._id}}">
{{!-- image --}}
<div class="flex05 item-image">
<img src="{{item.img}}" title="{{item.name}}" width="24" height="24" />
</div>
{{!-- name --}}
<input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
data-property="name" title="{{localize 'DS4.ItemName'}}">
{{!-- description --}}
<div class="flex3 item-description">{{{item.data.data.description}}}</div>
{{!-- control buttons --}}
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
</li>
{{/inline}}
{{!-- ======================================================================== --}} {{!-- ======================================================================== --}}
<div class="tab items" data-group="primary" data-tab="talents"> <div class="tab items" data-group="primary" data-tab="talents">
<h4 class="items-list-title">{{localize 'DS4.ItemTypeTalentPlural'}}</h4>
<ol class="items-list"> <ol class="items-list">
<li class="item flexrow item-header"> <li class="item flexrow item-header">
{{!-- image --}} {{!-- image --}}
@ -80,4 +103,21 @@
{{> talentListEntry item=item}} {{> talentListEntry item=item}}
{{/each}} {{/each}}
</ol> </ol>
<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>
{{#each itemsByType.racialAbility as |item id|}}
{{> racialAbilityListEntry item=item}}
{{/each}}
</ol>
</div> </div>

View file

@ -0,0 +1,13 @@
<form class="{{cssClass}}" autocomplete="off">
<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>
</div>
</header>
{{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}}
</form>