fixed incorrect references in item sheet .htmls causing sheets to not work;

followed advised procedures for editor handlesbars (see https://foundryvtt.com/article/v10-text-editor/);
fixed incorrect reference in npc/unnatural sheet .htmls causing 'hide untrained' skills to work incorrectly
This commit is contained in:
jalensailin
2022-09-03 14:37:50 -04:00
parent d0fac732b6
commit 953b643729
11 changed files with 73 additions and 63 deletions
+12 -1
View File
@@ -47,13 +47,24 @@ export class DeltaGreenActorSheet extends ActorSheet {
}
/** @override */
getData() {
async getData() {
const data = super.getData();
// Prepare items.
if (this.actor.type == 'agent') {
this._prepareCharacterItems(data);
}
switch (this.actor.type) {
case "agent":
data.enrichedDescription = await TextEditor.enrichHTML(this.object.system.physicalDescription, {async: true});
break;
case "npc":
case "unnatural":
data.enrichedDescription = await TextEditor.enrichHTML(this.object.system.notes, {async: true});
break;
default:
}
return data;
}
+2 -1
View File
@@ -25,8 +25,9 @@ export class DeltaGreenItemSheet extends ItemSheet {
/* -------------------------------------------- */
/** @override */
getData() {
async getData() {
const data = super.getData();
data.enrichedDescription = await TextEditor.enrichHTML(this.object.system.description, {async: true});
return data;
}
+1 -1
View File
@@ -50,5 +50,5 @@
</div>
<div class="editor-host">
{{editor actor.system.physicalDescription target="system.physicalDescription" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.physicalDescription" button=true owner=owner editable=editable}}
</div>
+1 -1
View File
@@ -13,7 +13,7 @@
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" title="{{localize 'DG.AgentNameFieldTooltip' }}"/></h1>
</div>
<div>
<h2 class="profession"><input name="system.biography.profession" type="text" value="{{system.biography.profession}}" placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}"/></h1>
<h2 class="profession"><input name="system.biography.profession" type="text" value="{{actor.system.biography.profession}}" placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}"/></h1>
</div>
</div>
</div>
+2 -3
View File
@@ -1,5 +1,4 @@
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}} flexcol" autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
@@ -91,7 +90,7 @@
{{!-- Checkbox to hide/show skills that are at zero --}}
<div>
<span class="resource-label" for="system.showUntrainedSkills">{{localize 'DG.UnnaturalSheet.HideUntrainedSkillsLabel'}}:</label>
<input class="labeled-resource-checkbox" type="checkbox" name="system.showUntrainedSkills" {{checked system.showUntrainedSkills}} data-dtype="Boolean" />
<input class="labeled-resource-checkbox" type="checkbox" name="system.showUntrainedSkills" {{checked actor.system.showUntrainedSkills}} data-dtype="Boolean" />
</div>
<div class="grid grid-3col">
@@ -143,7 +142,7 @@
</div>
<div class="unnatural-notes-section">
<div class="editor-host">
{{editor actor.system.notes target="system.notes" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.notes" button=true owner=owner editable=editable}}
</div>
</div>
+2 -3
View File
@@ -1,5 +1,4 @@
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}} flexcol" autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
@@ -88,7 +87,7 @@
{{!-- Checkbox to hide/show skills that are at zero --}}
<div>
<span class="resource-label" for="system.showUntrainedSkills">{{localize 'DG.UnnaturalSheet.HideUntrainedSkillsLabel'}}:</label>
<input class="labeled-resource-checkbox" type="checkbox" name="system.showUntrainedSkills" {{checked system.showUntrainedSkills}} data-dtype="Boolean" />
<input class="labeled-resource-checkbox" type="checkbox" name="system.showUntrainedSkills" {{checked actor.system.showUntrainedSkills}} data-dtype="Boolean" />
</div>
<div class="grid grid-3col">
@@ -140,7 +139,7 @@
</div>
<div class="unnatural-notes-section">
<div class="editor-host">
{{editor actor.system.notes target="system.notes" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.notes" button=true owner=owner editable=editable}}
</div>
</div>
+8 -8
View File
@@ -11,22 +11,22 @@
<span class="resource-label">{{localize 'DG.ItemWindow.Armor.Expense'}}:</span>
<select name="system.expense" >
<option {{#if_eq system.expense 'Incidental'}}selected{{/if_eq}} value="Incidental">{{localize 'DG.Gear.Expense.Incidental'}}</option>
<option {{#if_eq system.expense 'Standard'}}selected{{/if_eq}} value="Standard">{{localize 'DG.Gear.Expense.Standard'}}</option>
<option {{#if_eq system.expense 'Unusual'}}selected{{/if_eq}} value="Unusual">{{localize 'DG.Gear.Expense.Unusual'}}</option>
<option {{#if_eq system.expense 'Major'}}selected{{/if_eq}} value="Major">{{localize 'DG.Gear.Expense.Major'}}</option>
<option {{#if_eq system.expense 'Extreme'}}selected{{/if_eq}} value="Extreme">{{localize 'DG.Gear.Expense.Extreme'}}</option>
<option {{#if_eq item.system.expense 'Incidental'}}selected{{/if_eq}} value="Incidental">{{localize 'DG.Gear.Expense.Incidental'}}</option>
<option {{#if_eq item.system.expense 'Standard'}}selected{{/if_eq}} value="Standard">{{localize 'DG.Gear.Expense.Standard'}}</option>
<option {{#if_eq item.system.expense 'Unusual'}}selected{{/if_eq}} value="Unusual">{{localize 'DG.Gear.Expense.Unusual'}}</option>
<option {{#if_eq item.system.expense 'Major'}}selected{{/if_eq}} value="Major">{{localize 'DG.Gear.Expense.Major'}}</option>
<option {{#if_eq item.system.expense 'Extreme'}}selected{{/if_eq}} value="Extreme">{{localize 'DG.Gear.Expense.Extreme'}}</option>
</select>
<span class="resource-label">{{localize 'DG.ItemWindow.Armor.Equipped'}}:</span>
<input class="labeled-resource-checkbox" type="checkbox" name="system.equipped" {{checked system.equipped}} data-dtype="Boolean" />
<input class="labeled-resource-checkbox" type="checkbox" name="system.equipped" {{checked item.system.equipped}} data-dtype="Boolean" />
</div>
</div>
<div class="armor-sheet-secondary-grid-2col">
<span class="resource-label">{{localize 'DG.ItemWindow.Armor.ArmorRating'}}:</span>
<input class="item-sheet-short-input" type="text" name="system.protection" value="{{system.protection}}" data-dtype="Number"/>
<input class="item-sheet-short-input" type="text" name="system.protection" value="{{item.system.protection}}" data-dtype="Number"/>
</div>
</header>
@@ -41,7 +41,7 @@
{{!-- Description Tab --}}
<div class="tab" data-group="primary" data-tab="description">
{{editor system.description target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
</div>
</section>
</form>
+3 -3
View File
@@ -9,12 +9,12 @@
<!-- <label class="resource-label">{{localize 'DG.Bonds.Score'}}</label> -->
<span class="resource-label">{{localize 'DG.Bonds.Score'}}:</span>
<input type="text" name="system.score" value="{{system.score}}" data-dtype="Number"
<input type="text" name="system.score" value="{{item.system.score}}" data-dtype="Number"
title="{{localize 'DG.ItemWindow.Bonds.ScoreTooltip'}}"
/>
<span class="resource-label">{{localize 'DG.Bonds.Relationship'}}:</span>
<input type="text" name="system.relationship" value="{{system.relationship}}" data-dtype="String" />
<input type="text" name="system.relationship" value="{{item.system.relationship}}" data-dtype="String" />
</div>
</div>
@@ -30,7 +30,7 @@
{{!-- Description Tab --}}
<div class="tab" data-group="primary" data-tab="description">
{{editor system.description target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
</div>
</section>
</form>
+7 -7
View File
@@ -12,15 +12,15 @@
<span class="resource-label">{{localize 'DG.ItemWindow.Gear.Expense'}}:</span>
<select name="system.expense" >
<option {{#if_eq system.expense 'Incidental'}}selected{{/if_eq}} value="Incidental">{{localize 'DG.Gear.Expense.Incidental'}}</option>
<option {{#if_eq system.expense 'Standard'}}selected{{/if_eq}} value="Standard">{{localize 'DG.Gear.Expense.Standard'}}</option>
<option {{#if_eq system.expense 'Unusual'}}selected{{/if_eq}} value="Unusual">{{localize 'DG.Gear.Expense.Unusual'}}</option>
<option {{#if_eq system.expense 'Major'}}selected{{/if_eq}} value="Major">{{localize 'DG.Gear.Expense.Major'}}</option>
<option {{#if_eq system.expense 'Extreme'}}selected{{/if_eq}} value="Extreme">{{localize 'DG.Gear.Expense.Extreme'}}</option>
<option {{#if_eq item.system.expense 'Incidental'}}selected{{/if_eq}} value="Incidental">{{localize 'DG.Gear.Expense.Incidental'}}</option>
<option {{#if_eq item.system.expense 'Standard'}}selected{{/if_eq}} value="Standard">{{localize 'DG.Gear.Expense.Standard'}}</option>
<option {{#if_eq item.system.expense 'Unusual'}}selected{{/if_eq}} value="Unusual">{{localize 'DG.Gear.Expense.Unusual'}}</option>
<option {{#if_eq item.system.expense 'Major'}}selected{{/if_eq}} value="Major">{{localize 'DG.Gear.Expense.Major'}}</option>
<option {{#if_eq item.system.expense 'Extreme'}}selected{{/if_eq}} value="Extreme">{{localize 'DG.Gear.Expense.Extreme'}}</option>
</select>
<span class="resource-label">{{localize 'DG.ItemWindow.Gear.Equipped'}}:</span>
<input class="labeled-resource-checkbox" type="checkbox" name="system.equipped" {{checked system.equipped}} data-dtype="Boolean" />
<input class="labeled-resource-checkbox" type="checkbox" name="system.equipped" {{checked item.system.equipped}} data-dtype="Boolean" />
</div>
</div>
@@ -38,7 +38,7 @@
{{!-- Description Tab --}}
<div class="tab" data-group="primary" data-tab="description">
{{editor system.description target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
</div>
</section>
+6 -6
View File
@@ -13,7 +13,7 @@
<div class="motivation-sheet-horizontal-grid-2col">
<span class="resource-label">{{localize 'DG.ItemWindow.Motivations.IsDisorder'}}:</span>
<input type="checkbox" name="system.crossedOut" {{checked system.crossedOut}} data-dtype="Boolean"
<input type="checkbox" name="system.crossedOut" {{checked item.system.crossedOut}} data-dtype="Boolean"
title="{{localize 'DG.ItemWindow.Motivations.IsDisorderTooltip'}}"
/>
@@ -25,7 +25,7 @@
title="{{localize 'DG.ItemWindow.Motivations.MotivationNameTooltip'}}"
{{!-- If a motivation has been crossed off after a breaking point, do a strikeout on it and disable it. --}}
{{#if system.crossedOut}}
{{#if item.system.crossedOut}}
style="text-decoration: line-through;"
disabled
{{/if}}
@@ -33,17 +33,17 @@
{{!-- Only Show the Disorders Section if Motivation Lost Checked --}}
{{#if system.crossedOut}}
{{#if item.system.crossedOut}}
<span class="resource-label">{{localize 'DG.ItemWindow.Motivations.Disorder'}}:</span>
<input type="text" name="system.disorder" value="{{system.disorder}}" data-dtype="String"
<input type="text" name="system.disorder" value="{{item.system.disorder}}" data-dtype="String"
title="{{localize 'DG.ItemWindow.Motivations.DisorderNameTooltip'}}"
/>
<span class="resource-label">{{localize 'DG.ItemWindow.Motivations.DisorderHasBeenCured'}}: </span>
<input class="labeled-resource-checkbox" type="checkbox" name="system.disorderCured" {{checked system.disorderCured}} data-dtype="Boolean"
<input class="labeled-resource-checkbox" type="checkbox" name="system.disorderCured" {{checked item.system.disorderCured}} data-dtype="Boolean"
title="{{localize 'DG.ItemWindow.Motivations.DisorderHasBeenCuredTooltip'}}"
/>
@@ -54,7 +54,7 @@
</div>
<div class="tab attributes" data-group="primary" data-tab="description">
{{editor system.description target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
</div>
</section>
+29 -29
View File
@@ -11,15 +11,15 @@
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.Expense'}}:</span>
<select name="system.expense" >
<option {{#if_eq system.expense 'Incidental'}}selected{{/if_eq}} value="Incidental">{{localize 'DG.Gear.Expense.Incidental'}}</option>
<option {{#if_eq system.expense 'Standard'}}selected{{/if_eq}} value="Standard">{{localize 'DG.Gear.Expense.Standard'}}</option>
<option {{#if_eq system.expense 'Unusual'}}selected{{/if_eq}} value="Unusual">{{localize 'DG.Gear.Expense.Unusual'}}</option>
<option {{#if_eq system.expense 'Major'}}selected{{/if_eq}} value="Major">{{localize 'DG.Gear.Expense.Major'}}</option>
<option {{#if_eq system.expense 'Extreme'}}selected{{/if_eq}} value="Extreme">{{localize 'DG.Gear.Expense.Extreme'}}</option>
<option {{#if_eq item.system.expense 'Incidental'}}selected{{/if_eq}} value="Incidental">{{localize 'DG.Gear.Expense.Incidental'}}</option>
<option {{#if_eq item.system.expense 'Standard'}}selected{{/if_eq}} value="Standard">{{localize 'DG.Gear.Expense.Standard'}}</option>
<option {{#if_eq item.system.expense 'Unusual'}}selected{{/if_eq}} value="Unusual">{{localize 'DG.Gear.Expense.Unusual'}}</option>
<option {{#if_eq item.system.expense 'Major'}}selected{{/if_eq}} value="Major">{{localize 'DG.Gear.Expense.Major'}}</option>
<option {{#if_eq item.system.expense 'Extreme'}}selected{{/if_eq}} value="Extreme">{{localize 'DG.Gear.Expense.Extreme'}}</option>
</select>
<span class="resource-label">{{localize 'DG.ItemWindow.Gear.Equipped'}}:</span>
<input class="labeled-resource-checkbox" type="checkbox" name="system.equipped" {{checked system.equipped}} data-dtype="Boolean" />
<input class="labeled-resource-checkbox" type="checkbox" name="system.equipped" {{checked item.system.equipped}} data-dtype="Boolean" />
</div>
</div>
@@ -30,56 +30,56 @@
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.Skill'}}:</span>
<select name="system.skill" >
<option {{#if_eq system.skill 'firearms'}}selected{{/if_eq}} value="firearms">{{localize 'DG.Skills.firearms'}}</option>
<option {{#if_eq system.skill 'melee_weapons'}}selected{{/if_eq}} value="melee_weapons">{{localize 'DG.Skills.melee_weapons'}}</option>
<option {{#if_eq system.skill 'unarmed_combat'}}selected{{/if_eq}} value="unarmed_combat">{{localize 'DG.Skills.unarmed_combat'}}</option>
<option {{#if_eq system.skill 'heavy_weapons'}}selected{{/if_eq}} value="heavy_weapons">{{localize 'DG.Skills.heavy_weapons'}}</option>
<option {{#if_eq system.skill 'athletics'}}selected{{/if_eq}} value="athletics">{{localize 'DG.Skills.athletics'}}</option>
<option {{#if_eq system.skill 'demolitions'}}selected{{/if_eq}} value="demolitions">{{localize 'DG.Skills.demolitions'}}</option>
<option {{#if_eq system.skill 'artillery'}}selected{{/if_eq}} value="artillery">{{localize 'DG.Skills.artillery'}}</option>
<option {{#if_eq system.skill 'str'}}selected{{/if_eq}} value="str">{{localize 'DG.Attributes.str'}}x5</option>
<option {{#if_eq system.skill 'con'}}selected{{/if_eq}} value="con">{{localize 'DG.Attributes.con'}}x5</option>
<option {{#if_eq system.skill 'dex'}}selected{{/if_eq}} value="dex">{{localize 'DG.Attributes.dex'}}x5</option>
<option {{#if_eq system.skill 'int'}}selected{{/if_eq}} value="int">{{localize 'DG.Attributes.int'}}x5</option>
<option {{#if_eq system.skill 'pow'}}selected{{/if_eq}} value="pow">{{localize 'DG.Attributes.pow'}}x5</option>
<option {{#if_eq system.skill 'cha'}}selected{{/if_eq}} value="cha">{{localize 'DG.Attributes.cha'}}x5</option>
<option {{#if_eq item.system.skill 'firearms'}}selected{{/if_eq}} value="firearms">{{localize 'DG.Skills.firearms'}}</option>
<option {{#if_eq item.system.skill 'melee_weapons'}}selected{{/if_eq}} value="melee_weapons">{{localize 'DG.Skills.melee_weapons'}}</option>
<option {{#if_eq item.system.skill 'unarmed_combat'}}selected{{/if_eq}} value="unarmed_combat">{{localize 'DG.Skills.unarmed_combat'}}</option>
<option {{#if_eq item.system.skill 'heavy_weapons'}}selected{{/if_eq}} value="heavy_weapons">{{localize 'DG.Skills.heavy_weapons'}}</option>
<option {{#if_eq item.system.skill 'athletics'}}selected{{/if_eq}} value="athletics">{{localize 'DG.Skills.athletics'}}</option>
<option {{#if_eq item.system.skill 'demolitions'}}selected{{/if_eq}} value="demolitions">{{localize 'DG.Skills.demolitions'}}</option>
<option {{#if_eq item.system.skill 'artillery'}}selected{{/if_eq}} value="artillery">{{localize 'DG.Skills.artillery'}}</option>
<option {{#if_eq item.system.skill 'str'}}selected{{/if_eq}} value="str">{{localize 'DG.Attributes.str'}}x5</option>
<option {{#if_eq item.system.skill 'con'}}selected{{/if_eq}} value="con">{{localize 'DG.Attributes.con'}}x5</option>
<option {{#if_eq item.system.skill 'dex'}}selected{{/if_eq}} value="dex">{{localize 'DG.Attributes.dex'}}x5</option>
<option {{#if_eq item.system.skill 'int'}}selected{{/if_eq}} value="int">{{localize 'DG.Attributes.int'}}x5</option>
<option {{#if_eq item.system.skill 'pow'}}selected{{/if_eq}} value="pow">{{localize 'DG.Attributes.pow'}}x5</option>
<option {{#if_eq item.system.skill 'cha'}}selected{{/if_eq}} value="cha">{{localize 'DG.Attributes.cha'}}x5</option>
</select>
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.IsLethality'}}:</span>
<input class="labeled-resource-checkbox" type="checkbox" name="system.isLethal" {{checked system.isLethal}} data-dtype="Boolean"
<input class="labeled-resource-checkbox" type="checkbox" name="system.isLethal" {{checked item.system.isLethal}} data-dtype="Boolean"
title="{{localize 'DG.ItemWindow.Weapons.IsLethalityTooltip'}}"
/>
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.KillRadius'}}:</span>
<input type="text" name="system.killRadius" value="{{system.killRadius}}" data-dtype="String"/>
<input type="text" name="system.killRadius" value="{{item.system.killRadius}}" data-dtype="String"/>
</div>
<div class="weapon-sheet-horizontal-grid-right-2col">
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.Range'}}:</span>
<input type="text" name="system.range" value="{{system.range}}" data-dtype="String"/>
<input type="text" name="system.range" value="{{item.system.range}}" data-dtype="String"/>
{{!-- If a weapon is 'Lethal', need to show the d100% Lethality input, otherwise only show the regular Damage formula (e.g. 1D6, 1D4+2, etc...) --}}
{{#unless system.isLethal}}
{{#unless item.system.isLethal}}
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.Damage'}}:</span>
<input type="text" name="system.damage" value="{{system.damage}}" data-dtype="String"/>
<input type="text" name="system.damage" value="{{item.system.damage}}" data-dtype="String"/>
{{/unless}}
{{#if system.isLethal}}
{{#if item.system.isLethal}}
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.Lethality'}} %:</span>
<input class="" type="text" name="system.lethality" value="{{system.lethality}}" data-dtype="Number"
<input class="" type="text" name="system.lethality" value="{{item.system.lethality}}" data-dtype="Number"
title="{{localize 'DG.ItemWindow.Weapons.LethalityTooltip'}}"
/>
{{/if}}
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.ArmorPiercing'}}:</span>
<input type="text" name="system.armorPiercing" value="{{system.armorPiercing}}" data-dtype="Number"/>
<input type="text" name="system.armorPiercing" value="{{item.system.armorPiercing}}" data-dtype="Number"/>
</div>
@@ -87,7 +87,7 @@
<div class="weapon-sheet-secondary-grid-2col">
<span class="resource-label">{{localize 'DG.ItemWindow.Weapons.Ammo'}}:</span>
<input type="text" name="system.ammo" value="{{system.ammo}}" data-dtype="String"/>
<input type="text" name="system.ammo" value="{{item.system.ammo}}" data-dtype="String"/>
</div>
</header>
@@ -103,7 +103,7 @@
{{!-- Description Tab --}}
<div class="tab" data-group="primary" data-tab="description">
{{editor system.description target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
</div>
</section>
</form>