Make some small improvements to actor sheets
This commit is contained in:
parent
df6e1672cf
commit
0fd9622e2d
8 changed files with 53 additions and 31 deletions
|
@ -8,6 +8,7 @@ import { DS4CreatureActorSheet } from "./actor/sheets/creature-sheet";
|
||||||
import { createCheckRoll } from "./rolls/check-factory";
|
import { createCheckRoll } from "./rolls/check-factory";
|
||||||
import { registerSystemSettings } from "./settings";
|
import { registerSystemSettings } from "./settings";
|
||||||
import { migration } from "./migrations";
|
import { migration } from "./migrations";
|
||||||
|
import handlebarsHelpers from "./handlebars-helpers";
|
||||||
|
|
||||||
Hooks.once("init", async () => {
|
Hooks.once("init", async () => {
|
||||||
console.log(`DS4 | Initializing the DS4 Game System\n${DS4.ASCII}`);
|
console.log(`DS4 | Initializing the DS4 Game System\n${DS4.ASCII}`);
|
||||||
|
@ -39,7 +40,8 @@ Hooks.once("init", async () => {
|
||||||
Items.unregisterSheet("core", ItemSheet);
|
Items.unregisterSheet("core", ItemSheet);
|
||||||
Items.registerSheet("ds4", DS4ItemSheet, { makeDefault: true });
|
Items.registerSheet("ds4", DS4ItemSheet, { makeDefault: true });
|
||||||
|
|
||||||
registerHandlebarsPartials();
|
await registerHandlebarsPartials();
|
||||||
|
registerHandlebarsHelpers();
|
||||||
});
|
});
|
||||||
|
|
||||||
async function registerHandlebarsPartials() {
|
async function registerHandlebarsPartials() {
|
||||||
|
@ -65,6 +67,10 @@ async function registerHandlebarsPartials() {
|
||||||
return loadTemplates(templatePaths);
|
return loadTemplates(templatePaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function registerHandlebarsHelpers() {
|
||||||
|
Object.entries(handlebarsHelpers).forEach(([key, helper]) => Handlebars.registerHelper(key, helper));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function runs after game data has been requested and loaded from the servers, so entities exist
|
* This function runs after game data has been requested and loaded from the servers, so entities exist
|
||||||
*/
|
*/
|
||||||
|
|
6
src/module/handlebars-helpers.ts
Normal file
6
src/module/handlebars-helpers.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export default { htmlToPlainText };
|
||||||
|
|
||||||
|
function htmlToPlainText(input: string | null | undefined): string | null | undefined {
|
||||||
|
if (!input) return;
|
||||||
|
return $(input).text();
|
||||||
|
}
|
|
@ -28,15 +28,16 @@ header.sheet-header {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: $header-top-margin 10px $header-top-margin 0;
|
margin: $header-top-margin 10px $header-top-margin 0;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
|
@include font-heading-upper;
|
||||||
|
display: block;
|
||||||
input {
|
input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
@include font-heading-upper;
|
||||||
}
|
}
|
||||||
@include font-heading-upper;
|
|
||||||
display: block;
|
|
||||||
}
|
}
|
||||||
h2.item-type {
|
h2.item-type {
|
||||||
@include font-heading-upper;
|
@include font-heading-upper;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
nav.tabs {
|
nav.tabs {
|
||||||
height: 40px;
|
height: auto;
|
||||||
border-top: 2px groove $c-border-groove;
|
border-top: 2px groove $c-border-groove;
|
||||||
border-bottom: 2px groove $c-border-groove;
|
border-bottom: 2px groove $c-border-groove;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
line-height: 40px;
|
// line-height: 40px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,12 @@
|
||||||
data-dtype="Number" data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" />
|
data-dtype="Number" data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" />
|
||||||
{{!-- name --}}
|
{{!-- name --}}
|
||||||
<input class="flex3 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
<input class="flex3 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||||
data-property="name" title="{{localize 'DS4.ItemName'}}" />
|
data-property="name" title="{{htmlToPlainText item.data.data.description}}" />
|
||||||
{{!-- item type specifics --}}
|
{{!-- item type specifics --}}
|
||||||
{{> @partial-block}}
|
{{> @partial-block}}
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex4 item-description">{{{item.data.data.description}}}</div>
|
<div class="flex4 item-description" title="{{htmlToPlainText item.data.data.description}}">
|
||||||
|
{{{item.data.data.description}}}</div>
|
||||||
{{!-- control buttons --}}
|
{{!-- control buttons --}}
|
||||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -20,9 +20,10 @@
|
||||||
</div>
|
</div>
|
||||||
{{!-- name --}}
|
{{!-- name --}}
|
||||||
<input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
<input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||||
data-property="name" title="{{localize 'DS4.ItemName'}}">
|
data-property="name" title="{{htmlToPlainText item.data.data.description}}">
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex3 item-description">{{{item.data.data.description}}}</div>
|
<div class="flex3 item-description" title="{{htmlToPlainText item.data.data.description}}">
|
||||||
|
{{{item.data.data.description}}}</div>
|
||||||
{{!-- control buttons --}}
|
{{!-- control buttons --}}
|
||||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
!-- @param unitAbbrs: mapping of allowed unitDatum.unit values to unit abbreviation
|
!-- @param unitAbbrs: mapping of allowed unitDatum.unit values to unit abbreviation
|
||||||
--}}
|
--}}
|
||||||
{{#*inline "unit"}}
|
{{#*inline "unit"}}
|
||||||
<div class="unit-data-pair item-num-val"
|
<div class="unit-data-pair item-num-val" title="{{localize localizationString}} [{{lookup unitNames unitDatum.unit}}]">
|
||||||
title="{{localize localizationString}} [{{lookup unitNames unitDatum.unit}}]" >
|
|
||||||
{{#if unitDatum.value }}
|
{{#if unitDatum.value }}
|
||||||
{{unitDatum.value}} {{lookup unitAbbrs unitDatum.unit}}
|
{{unitDatum.value}} {{lookup unitAbbrs unitDatum.unit}}
|
||||||
{{else}}-{{/if}}
|
{{else}}-{{/if}}
|
||||||
|
@ -23,11 +22,13 @@
|
||||||
!-- directly handing over the latter two.
|
!-- directly handing over the latter two.
|
||||||
--}}
|
--}}
|
||||||
{{#*inline "temporalUnit"}}
|
{{#*inline "temporalUnit"}}
|
||||||
{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum localizationString=localizationString}}
|
{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum
|
||||||
|
localizationString=localizationString}}
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
||||||
{{#*inline "distanceUnit"}}
|
{{#*inline "distanceUnit"}}
|
||||||
{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum localizationString=localizationString}}
|
{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum
|
||||||
|
localizationString=localizationString}}
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +39,8 @@
|
||||||
<ol class="items-list">
|
<ol class="items-list">
|
||||||
<li class="item flexrow item-header">
|
<li class="item flexrow item-header">
|
||||||
{{!-- equipped --}}
|
{{!-- equipped --}}
|
||||||
<div class="flex05 item-image" title="{{localize 'DS4.ItemEquipped'}}">{{localize 'DS4.ItemEquippedAbbr'}}</div>
|
<div class="flex05 item-image" title="{{localize 'DS4.ItemEquipped'}}">{{localize 'DS4.ItemEquippedAbbr'}}
|
||||||
|
</div>
|
||||||
{{!-- image --}}
|
{{!-- image --}}
|
||||||
<div class="flex05 item-image"></div>
|
<div class="flex05 item-image"></div>
|
||||||
{{!-- name --}}
|
{{!-- name --}}
|
||||||
|
@ -52,7 +54,8 @@
|
||||||
{{!-- duration --}}
|
{{!-- duration --}}
|
||||||
<div class="item-num-val" title="{{localize 'DS4.SpellDuration'}}"><i class="far fa-clock"></i></div>
|
<div class="item-num-val" title="{{localize 'DS4.SpellDuration'}}"><i class="far fa-clock"></i></div>
|
||||||
{{!-- cooldown duration --}}
|
{{!-- cooldown duration --}}
|
||||||
<div class="item-num-val" title="{{localize 'DS4.SpellCooldownDuration'}}"><i class="fas fa-hourglass-half"></i></div>
|
<div class="item-num-val" title="{{localize 'DS4.SpellCooldownDuration'}}"><i
|
||||||
|
class="fas fa-hourglass-half"></i></div>
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
{{!-- <div class="flex3">{{localize 'DS4.Description'}}</div> --}}
|
{{!-- <div class="flex3">{{localize 'DS4.Description'}}</div> --}}
|
||||||
{{!-- control buttons placeholder --}}
|
{{!-- control buttons placeholder --}}
|
||||||
|
@ -60,29 +63,31 @@
|
||||||
</li>
|
</li>
|
||||||
{{#each itemsByType.spell as |item id|}}
|
{{#each itemsByType.spell as |item id|}}
|
||||||
<li class="item flexrow" data-item-id="{{item._id}}">
|
<li class="item flexrow" data-item-id="{{item._id}}">
|
||||||
<input class="flex05 item-image item-change" type="checkbox" {{checked item.data.data.equipped}} data-dtype="Boolean"
|
<input class="flex05 item-image item-change" type="checkbox" {{checked item.data.data.equipped}}
|
||||||
data-property="data.equipped" title="{{localize 'DS4.ItemEquipped'}}">
|
data-dtype="Boolean" data-property="data.equipped" title="{{localize 'DS4.ItemEquipped'}}">
|
||||||
{{!-- image --}}
|
{{!-- image --}}
|
||||||
<div class="flex05 item-image">
|
<div class="flex05 item-image">
|
||||||
<img src="{{item.img}}" title="{{item.name}}" width="24" height="24" />
|
<img src="{{item.img}}" title="{{item.name}}" width="24" height="24" />
|
||||||
</div>
|
</div>
|
||||||
{{!-- name --}}
|
{{!-- name --}}
|
||||||
<input class="flex2 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
<input class="flex2 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||||
data-property="name" title="{{localize 'DS4.ItemName'}}" />
|
data-property="name" title="{{htmlToPlainText item.data.data.description}}" />
|
||||||
{{!-- spell type --}}
|
{{!-- spell type --}}
|
||||||
<div class="flex05 item-image">
|
<div class="flex05 item-image">
|
||||||
<img src="{{lookup ../config.icons.spellTypes item.data.data.spellType}}"
|
<img src="{{lookup ../config.icons.spellTypes item.data.data.spellType}}"
|
||||||
title="{{lookup ../config.i18n.spellTypes item.data.data.spellType}}" width="24" height="24" />
|
title="{{lookup ../config.i18n.spellTypes item.data.data.spellType}}" width="24" height="24" />
|
||||||
</div>
|
</div>
|
||||||
{{!-- spell bonus --}}
|
{{!-- spell bonus --}}
|
||||||
<input class="item-num-val item-change" type="text" data-dtype="String"
|
<input class="item-num-val item-change" type="text" data-dtype="String" data-property="data.bonus"
|
||||||
data-property="data.bonus" value="{{item.data.data.bonus}}" title="{{localize 'DS4.SpellBonus'}}" />
|
value="{{item.data.data.bonus}}" title="{{localize 'DS4.SpellBonus'}}" />
|
||||||
{{!-- max. distance --}}
|
{{!-- max. distance --}}
|
||||||
{{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance config=../config}}
|
{{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance
|
||||||
|
config=../config}}
|
||||||
{{!-- duration --}}
|
{{!-- duration --}}
|
||||||
{{> temporalUnit localizationString='DS4.SpellDuration' unitDatum=item.data.data.duration config=../config}}
|
{{> temporalUnit localizationString='DS4.SpellDuration' unitDatum=item.data.data.duration config=../config}}
|
||||||
{{!-- cooldown duration --}}
|
{{!-- cooldown duration --}}
|
||||||
{{> temporalUnit localizationString='DS4.SpellCooldownDuration' unitDatum=item.data.data.cooldownDuration config=../config}}
|
{{> temporalUnit localizationString='DS4.SpellCooldownDuration' unitDatum=item.data.data.cooldownDuration
|
||||||
|
config=../config}}
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
{{!-- <div class="flex3 item-description">{{{item.data.data.description}}}</div> --}}
|
{{!-- <div class="flex3 item-description">{{{item.data.data.description}}}</div> --}}
|
||||||
{{!-- control buttons --}}
|
{{!-- control buttons --}}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
--}}
|
--}}
|
||||||
{{#*inline "ifHasItemOfType"}}
|
{{#*inline "ifHasItemOfType"}}
|
||||||
{{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}}
|
{{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}}
|
||||||
{{> @partial-block}}
|
{{> @partial-block}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
|
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{!-- name --}}
|
{{!-- name --}}
|
||||||
<input class="flex2 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
<input class="flex2 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||||
data-property="name" title="{{localize 'DS4.ItemName'}}">
|
data-property="name" title="{{htmlToPlainText item.data.data.description}}">
|
||||||
<div class="flex3 flexrow talent-ranks-equation">
|
<div class="flex3 flexrow talent-ranks-equation">
|
||||||
{{!-- acquired rank --}}
|
{{!-- acquired rank --}}
|
||||||
{{> talentRankValue item=item property='base' localizeString='DS4.TalentRankBase'}}
|
{{> talentRankValue item=item property='base' localizeString='DS4.TalentRankBase'}}
|
||||||
|
@ -65,7 +65,8 @@
|
||||||
{{> talentRankValue item=item property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}}
|
{{> talentRankValue item=item property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}}
|
||||||
</div>
|
</div>
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex4 item-description">{{{item.data.data.description}}}</div>
|
<div class="flex4 item-description" title="{{htmlToPlainText item.data.data.description}}">
|
||||||
|
{{{item.data.data.description}}}</div>
|
||||||
{{!-- control buttons --}}
|
{{!-- control buttons --}}
|
||||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||||
</li>
|
</li>
|
||||||
|
@ -88,9 +89,10 @@
|
||||||
</div>
|
</div>
|
||||||
{{!-- name --}}
|
{{!-- name --}}
|
||||||
<input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
<input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||||
data-property="name" title="{{localize 'DS4.ItemName'}}">
|
data-property="name" title="{{htmlToPlainText item.data.data.description}}"">
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex3 item-description">{{{item.data.data.description}}}</div>
|
<div class=" flex3 item-description" title="{{htmlToPlainText item.data.data.description}}">
|
||||||
|
{{{item.data.data.description}}}</div>
|
||||||
{{!-- control buttons --}}
|
{{!-- control buttons --}}
|
||||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue