add toggleShowUntrained action;

note, this only affects npc/unnatural sheets, which I have not converted yet, so I wasn't able to actually test this change at the time of this commit
This commit is contained in:
jalensailin
2025-07-18 22:48:02 -04:00
parent 6944381e8f
commit 1f9d19ea3d
3 changed files with 243 additions and 133 deletions
+7 -6
View File
@@ -27,6 +27,7 @@ export default class DeltaGreenActorSheet extends DGSheetMixin(ActorSheetV2) {
toggleBondDamage: DeltaGreenActorSheet._toggleBondDamage,
clearBondDamage: DeltaGreenActorSheet._clearBondDamage,
toggleItemSortMode: DeltaGreenActorSheet._toggleItemSortMode,
toggleShowUntrained: DeltaGreenActorSheet._toggleShowUntrained,
},
});
@@ -762,6 +763,12 @@ export default class DeltaGreenActorSheet extends DGSheetMixin(ActorSheetV2) {
});
}
static toggleShowUntrained() {
const targetProp = "system.showUntrainedSkills";
const currentVal = foundry.utils.getProperty(this.actor, targetProp);
this.actor.update({ [targetProp]: !currentVal });
}
/** @override */
activateListeners(html) {
super.activateListeners(html);
@@ -772,12 +779,6 @@ export default class DeltaGreenActorSheet extends DGSheetMixin(ActorSheetV2) {
// Rollable abilities - bind to everything with the 'Rollable' class
html.find(".rollable").contextmenu(this._onRoll.bind(this)); // this is for right-click, which triggers the roll modifier dialogue for most rolls
html.find(".toggle-untrained").click(() =>
this.actor.update({
"system.showUntrainedSkills": !this.actor.system.showUntrainedSkills,
}),
);
// Macro for toggling an item's equipped state
html
.find(".equipped-item")
+124 -66
View File
@@ -1,67 +1,113 @@
<form class="{{cssClass}} {{getCharacterSheetStyle}} flexcol" autocomplete="off">
<form class="{{cssClass}} {{getCharacterSheetStyle}} flexcol"
autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
<div class="header-fields">
{{!-- Name, Profession, Portrait --}}
<div class="flexrow">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="150" width="100"/>
<img class="profile-img"
src="{{actor.img}}"
data-edit="img"
title="{{actor.name}}"
height="150"
width="100" />
<div>
<div>
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" /></h1>
<h1 class="charname">
<input name="name" type="text" value="{{actor.name}}" />
</h1>
</div>
<div class="">
<h2 class="profession"><input name="system.shortDescription" type="text" value="{{actor.system.shortDescription}}" placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}"/></h1>
<h2 class="profession">
<input name="system.shortDescription"
type="text"
value="{{actor.system.shortDescription}}"
placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}" />
</h1>
</div>
</div>
</div>
<div class="resources grid grid-3col bottom-margin-5px">
{{!-- HP --}}
<div class="resource-outer-grid-1col">
<label for="actor.system.health.value" class="resource-label" data-tooltip="{{localize 'DG.Attributes.Tooltip.HP'}}">{{localize 'DG.Attributes.HP'}} (<span>{{actor.system.health.protection}} <i class="fas fa-shield-alt"></i></span>)</label>
<div class="resource-inner-grid-3col">
<input type="text" name="system.health.value" value="{{actor.system.health.value}}" data-dtype="Number"/>
<span> / </span>
<!-- <input type="text" name="system.health.max" value="{{actor.system.health.max}}" data-dtype="Number"/> -->
<div class="max-resource-value" title="{{localize 'DG.Tooltip.MaximumHP'}}">
<div>{{numberFormat actor.system.health.max decimals=0 sign=false}}</div>
</div>
<label for="actor.system.health.value"
class="resource-label"
data-tooltip="{{localize 'DG.Attributes.Tooltip.HP'}}">
{{localize 'DG.Attributes.HP'}} (<span>{{actor.system.health.protection}} <i class="fas fa-shield-alt"></i></span>)
</label>
<div class="resource-inner-grid-3col">
<input type="text"
name="system.health.value"
value="{{actor.system.health.value}}"
data-dtype="Number" />
<span>/</span>
<!-- <input type="text"
name="system.health.max"
value="{{actor.system.health.max}}"
data-dtype="Number" /> -->
<div class="max-resource-value"
title="{{localize 'DG.Tooltip.MaximumHP'}}">
<div>{{numberFormat actor.system.health.max decimals=0 sign=false}}</div>
</div>
</div>
</div>
{{!-- WP --}}
<div class="resource-outer-grid-1col">
<label for="system.wp.value" class="resource-label" data-tooltip="{{localize 'DG.Attributes.Tooltip.WP'}}">{{localize 'DG.Attributes.WP' }}</label>
<div class="resource-inner-grid-3col">
<input type="text" name="system.wp.value" value="{{actor.system.wp.value}}" data-dtype="Number"/>
<span> / </span>
<!-- <input type="text" name="system.wp.max" value="{{actor.system.wp.max}}" data-dtype="Number"/> -->
<div class="max-resource-value" title="{{localize 'DG.Tooltip.MaximumWP'}}">
<div>{{numberFormat actor.system.wp.max decimals=0 sign=false}}</div>
</div>
<label for="system.wp.value"
class="resource-label"
data-tooltip="{{localize 'DG.Attributes.Tooltip.WP'}}">
{{localize 'DG.Attributes.WP' }}
</label>
<div class="resource-inner-grid-3col">
<input type="text"
name="system.wp.value"
value="{{actor.system.wp.value}}"
data-dtype="Number" />
<span>/</span>
<!-- <input type="text"
name="system.wp.max"
value="{{actor.system.wp.max}}"
data-dtype="Number" /> -->
<div class="max-resource-value"
title="{{localize 'DG.Tooltip.MaximumWP'}}">
<div>{{numberFormat actor.system.wp.max decimals=0 sign=false}}</div>
</div>
</div>
</div>
{{!-- Sanity --}}
<div class="resource-outer-grid-1col">
<label for="system.wp.value" class="resource-label rollable"
data-rolltype="sanity" data-tooltip="{{localize 'DG.Attributes.Tooltip.SAN'}}"
>{{localize 'DG.Attributes.SAN' }} <i class="fas fa-dice"></i></label>
<div class="resource-inner-grid-3col">
<input type="text" name="system.sanity.value" value="{{actor.system.sanity.value}}" data-dtype="Number" title="{{localize 'DG.Tooltip.CurrentSanityPartOne'}}{{actor.system.sanity.currentBreakingPoint}}{{localize 'DG.Tooltip.CurrentSanityPartTwo'}}" />
<span> {{localize 'DG.NPCSheet.BreakPointAbbreviation'}}: </span>
<input type="text" name="system.sanity.currentBreakingPoint" value="{{actor.system.sanity.currentBreakingPoint}}" data-dtype="Number" title="{{localize 'DG.Tooltip.BreakPoint'}}" />
</div>
<label for="system.wp.value"
class="resource-label rollable"
data-rolltype="sanity"
data-tooltip="{{localize 'DG.Attributes.Tooltip.SAN'}}">
{{localize 'DG.Attributes.SAN' }} <i class="fas fa-dice"></i>
</label>
<div class="resource-inner-grid-3col">
<input type="text"
name="system.sanity.value"
value="{{actor.system.sanity.value}}"
data-dtype="Number"
title="{{localize 'DG.Tooltip.CurrentSanityPartOne'}}{{actor.system.sanity.currentBreakingPoint}}{{localize 'DG.Tooltip.CurrentSanityPartTwo'}}" />
<span>{{localize 'DG.NPCSheet.BreakPointAbbreviation'}}:</span>
<input type="text"
name="system.sanity.currentBreakingPoint"
value="{{actor.system.sanity.currentBreakingPoint}}"
data-dtype="Number"
title="{{localize 'DG.Tooltip.BreakPoint'}}" />
</div>
</div>
</div>
{{!-- Physical Statistics like STR, CON, etc. --}}
<div class="">
<div class="horizontal-bar-section-divider">
<span>{{localize "DG.Sheet.BlockHeaders.Statistics"}}</span>
<span>{{localize "DG.Sheet.BlockHeaders.Statistics"}}</span>
</div>
{{> "systems/deltagreen/templates/actor/partials/attributes-grid-partial.html" actorType="npc"}}
@@ -73,9 +119,9 @@
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="skills">{{localize 'DG.UnnaturalSheet.Tabs.NotesTabLabel'}}</a>
<a class="item" data-tab="gear">{{localize 'DG.UnnaturalSheet.Tabs.ItemsTabLabel'}}</a>
<a class="item fas fa-question-circle" data-tab="about"></a>
<a class="item" data-tab="skills">{{localize 'DG.UnnaturalSheet.Tabs.NotesTabLabel'}}</a>
<a class="item" data-tab="gear">{{localize 'DG.UnnaturalSheet.Tabs.ItemsTabLabel'}}</a>
<a class="item fas fa-question-circle" data-tab="about"></a>
</nav>
{{!-- Sheet Body --}}
@@ -83,45 +129,58 @@
{{!-- Descriptions/Notes/Skills Tab --}}
<div class="tab skills" data-group="primary" data-tab="skills">
<div class="horizontal-bar-section-divider contains-hide-button">
<div class="horizontal-bar-section-divider contains-hide-button">
<span class="contains-hide-button-title">
{{localize "DG.Sheet.BlockHeaders.SkillsAndTraining"}}
{{!-- Checkbox to hide/show skills that are at zero --}}
</span>
<a class="toggle-untrained">
{{#if actor.system.showUntrainedSkills}}
<a class="toggle-untrained" data-action="toggleShowUntrained">
{{#if actor.system.showUntrainedSkills }}
{{localize 'DG.UnnaturalSheet.ShowUntrainedSkillsLabel'}}
{{else}}
{{localize 'DG.UnnaturalSheet.HideUntrainedSkillsLabel'}}
{{/if}}&nbsp;
<i class="far fa-eye{{#if actor.system.showUntrainedSkills}}-slash{{/if}}"></i>
<i class="far fa-eye
{{#if actor.system.showUntrainedSkills }}
-slash{{/if }}"></i>
</a>
</div>
<div class="grid grid-3col">
{{#each actor.system.sortedSkills as |skill key|}}
{{#if (hideSkillBasedOnProficiencyAndUserChoice ../actor.system.showUntrainedSkills skill.proficiency)}}
<div class="flexrow flex-group-left flex-thin-border">
<label data-tooltip="{{localize (concat 'DG.Skills.Tooltip.' skill.key)}}">
{{localizeWithFallback (concat "DG.Skills." skill.key) skill.label }}
</label>
<label class="{{if_gt skill.proficiency 0 'rollable' 'not-rollable'}} skill-label" data-rolltype="skill" data-key="{{skill.key}}" for="system.skills.{{skill.key}}.value"
{{#if skill.proficiency}}data-tooltip="{{localize 'DG.Tooltip.SkillLabel'}}"{{/if}}
{{#unless skill.proficiency}}data-tooltip="{{localize 'DG.Tooltip.CannotRollSkillLabel'}}"{{/unless}}
>
<i class="fas fa-dice"></i>
</label>
<input class="percentile-skill-input" type="text" name="system.skills.{{skill.key}}.proficiency" value="{{skill.proficiency}}" data-dtype="Number" {{#if skill.isCalculatedValue}} disabled {{/if}}/>
</div>
{{#each actor.system.sortedSkills as |skill key| }}
{{#if (hideSkillBasedOnProficiencyAndUserChoice ../actor.system.showUntrainedSkills skill.proficiency) }}
<div class="flexrow flex-group-left flex-thin-border">
<label data-tooltip="{{localize (concat 'DG.Skills.Tooltip.' skill.key)}}">
{{localizeWithFallback (concat "DG.Skills." skill.key) skill.label }}
</label>
<label class="{{if_gt skill.proficiency 0 'rollable' 'not-rollable'}} skill-label"
data-rolltype="skill"
data-key="{{skill.key}}"
for="system.skills.{{skill.key}}.value"
{{#if skill.proficiency }}
data-tooltip="{{localize 'DG.Tooltip.SkillLabel' }}"
{{/if}}
{{#unless skill.proficiency}}
data-tooltip="{{localize 'DG.Tooltip.CannotRollSkillLabel'}}"
{{/unless}}>
<i class="fas fa-dice"></i>
</label>
<input class="percentile-skill-input"
type="text"
name="system.skills.{{skill.key}}.proficiency"
value="{{skill.proficiency}}"
data-dtype="Number"
{{#if skill.isCalculatedValue }}
disabled
{{/if }} />
</div>
{{/if}}
{{/each}}
</div>
<br>
<div>
{{> "systems/deltagreen/templates/actor/partials/custom-skills-partial.html"}}
</div>
<div>{{> "systems/deltagreen/templates/actor/partials/custom-skills-partial.html"}}</div>
<br>
<div>
<span class="resource-label">{{localize 'DG.UnnaturalSheet.NotesLabel'}}</span>
@@ -131,19 +190,18 @@
{{editor enrichedDescription target="system.notes" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
</div>
{{!-- GEAR --}}
<div class="tab items" data-group="primary" data-tab="gear">
{{> "systems/deltagreen/templates/actor/partials/equipment-partial.html" }}
</div>
{{!-- About Tab --}}
<div class="tab about" data-group="primary" data-tab="about">
{{> "systems/deltagreen/templates/actor/partials/help-and-licensing-partial.html" }}
</div>
{{!-- About Tab --}}
<div class="tab about" data-group="primary" data-tab="about">
{{> "systems/deltagreen/templates/actor/partials/help-and-licensing-partial.html" }}
</div>
</section>
</form>
+112 -61
View File
@@ -1,63 +1,101 @@
<form class="{{cssClass}} {{getCharacterSheetStyle}} flexcol" autocomplete="off">
<form class="{{cssClass}} {{getCharacterSheetStyle}} flexcol"
autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
<div class="header-fields">
{{!-- Name, Profession, Portrait --}}
<div class="flexrow">
<img class="profile-img" src="{{actor.img}}" data-edit="img" height="150" width="100"/>
<img class="profile-img"
src="{{actor.img}}"
data-edit="img"
height="150"
width="100" />
<div>
<div>
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" /></h1>
<h1 class="charname">
<input name="name" type="text" value="{{actor.name}}" />
</h1>
</div>
<div class="">
<h2 class="profession"><input name="system.shortDescription" type="text" value="{{actor.system.shortDescription}}" placeholder="{{localize 'DG.UnnaturalSheet.ShortDescriptionFallbackText'}}"/></h1>
<h2 class="profession">
<input name="system.shortDescription"
type="text"
value="{{actor.system.shortDescription}}"
placeholder="{{localize 'DG.UnnaturalSheet.ShortDescriptionFallbackText'}}" />
</h1>
</div>
</div>
</div>
<div class="resources grid grid-3col bottom-margin-5px">
{{!-- HP --}}
<div class="resource-outer-grid-1col">
<label for="actor.system.health.value" class="resource-label" data-tooltip="{{localize 'DG.Attributes.Tooltip.HP'}}">{{localize 'DG.Attributes.HP'}} (<span>{{actor.system.health.protection}} <i class="fas fa-shield-alt"></i></span>)</label>
<div class="resource-inner-grid-3col">
<input type="text" name="system.health.value" value="{{actor.system.health.value}}" data-dtype="Number"/>
<span> / </span>
<input type="text" name="system.health.max" value="{{actor.system.health.max}}" data-dtype="Number"/>
</div>
<label for="actor.system.health.value"
class="resource-label"
data-tooltip="{{localize 'DG.Attributes.Tooltip.HP'}}">
{{localize 'DG.Attributes.HP'}} (<span>{{actor.system.health.protection}} <i class="fas fa-shield-alt"></i></span>)
</label>
<div class="resource-inner-grid-3col">
<input type="text"
name="system.health.value"
value="{{actor.system.health.value}}"
data-dtype="Number" />
<span>/</span>
<input type="text"
name="system.health.max"
value="{{actor.system.health.max}}"
data-dtype="Number" />
</div>
</div>
{{!-- WP --}}
<div class="resource-outer-grid-1col">
<label for="system.wp.value" class="resource-label" data-tooltip="{{localize 'DG.Attributes.Tooltip.WP'}}">{{localize 'DG.Attributes.WP' }}</label>
<div class="resource-inner-grid-3col">
<input type="text" name="system.wp.value" value="{{actor.system.wp.value}}" data-dtype="Number"/>
<span> / </span>
<input type="text" name="system.wp.max" value="{{actor.system.wp.max}}" data-dtype="Number"/>
</div>
<label for="system.wp.value"
class="resource-label"
data-tooltip="{{localize 'DG.Attributes.Tooltip.WP'}}">
{{localize 'DG.Attributes.WP' }}
</label>
<div class="resource-inner-grid-3col">
<input type="text"
name="system.wp.value"
value="{{actor.system.wp.value}}"
data-dtype="Number" />
<span>/</span>
<input type="text"
name="system.wp.max"
value="{{actor.system.wp.max}}"
data-dtype="Number" />
</div>
</div>
{{!-- Sanity Damage --}}
<div class="resource-outer-grid-1col">
<label class="resource-label rollable" data-rolltype="sanity-damage" data-tooltip="{{localize 'DG.Attributes.Tooltip.SAN'}}">{{localize 'DG.Attributes.SAN'}} <i class="fas fa-dice"></i></label>
<label class="resource-label rollable"
data-rolltype="sanity-damage"
data-tooltip="{{localize 'DG.Attributes.Tooltip.SAN'}}">
{{localize 'DG.Attributes.SAN'}} <i class="fas fa-dice"></i>
</label>
<div class="resource-inner-grid-3col">
<input type="text" name="system.sanity.successLoss" value="{{actor.system.sanity.successLoss}}" />
<span> / </span>
<input type="text" name="system.sanity.failedLoss" value="{{actor.system.sanity.failedLoss}}" />
<input type="text"
name="system.sanity.successLoss"
value="{{actor.system.sanity.successLoss}}" />
<span>/</span>
<input type="text"
name="system.sanity.failedLoss"
value="{{actor.system.sanity.failedLoss}}" />
</div>
</div>
</div>
{{!-- Physical Statistics like STR, CON, etc. --}}
<div class="">
<div class="horizontal-bar-section-divider">
<span>{{localize "DG.Sheet.BlockHeaders.Statistics"}}</span>
<span>{{localize "DG.Sheet.BlockHeaders.Statistics"}}</span>
</div>
{{> "systems/deltagreen/templates/actor/partials/attributes-grid-partial.html" actorType="unnatural"}}
</div>
@@ -67,9 +105,9 @@
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="skills">{{localize 'DG.UnnaturalSheet.Tabs.NotesTabLabel'}}</a>
<a class="item" data-tab="gear">{{localize 'DG.UnnaturalSheet.Tabs.ItemsTabLabel'}}</a>
<a class="item fas fa-question-circle" data-tab="about"></a>
<a class="item" data-tab="skills">{{localize 'DG.UnnaturalSheet.Tabs.NotesTabLabel'}}</a>
<a class="item" data-tab="gear">{{localize 'DG.UnnaturalSheet.Tabs.ItemsTabLabel'}}</a>
<a class="item fas fa-question-circle" data-tab="about"></a>
</nav>
{{!-- Sheet Body --}}
@@ -77,45 +115,59 @@
{{!-- Descriptions/Notes/Skills Tab --}}
<div class="tab skills" data-group="primary" data-tab="skills">
<div class="horizontal-bar-section-divider contains-hide-button">
<div class="horizontal-bar-section-divider contains-hide-button">
<span class="contains-hide-button-title">
{{localize "DG.Sheet.BlockHeaders.SkillsAndTraining"}}
{{!-- Checkbox to hide/show skills that are at zero --}}
</span>
<a class="toggle-untrained">
{{#if actor.system.showUntrainedSkills}}
<a class="toggle-untrained" data-action="toggleShowUntrained">
{{#if actor.system.showUntrainedSkills }}
{{localize 'DG.UnnaturalSheet.ShowUntrainedSkillsLabel'}}
{{else}}
{{localize 'DG.UnnaturalSheet.HideUntrainedSkillsLabel'}}
{{/if}}&nbsp;
<i class="far fa-eye{{#if actor.system.showUntrainedSkills}}-slash{{/if}}"></i>
<i class="far fa-eye
{{#if actor.system.showUntrainedSkills }}
-slash{{/if }}"></i>
</a>
</div>
<div class="grid grid-3col">
{{#each actor.system.sortedSkills as |skill key|}}
{{#if (hideSkillBasedOnProficiencyAndUserChoice ../actor.system.showUntrainedSkills skill.proficiency)}}
<div class="flexrow flex-group-left flex-thin-border">
<label data-tooltip="{{localize (concat 'DG.Skills.Tooltip.' skill.key)}}">
{{localizeWithFallback (concat "DG.Skills." skill.key) skill.label }}
</label>
<label class="{{if_gt skill.proficiency 0 'rollable' 'not-rollable'}} skill-label" data-rolltype="skill" data-roll="d100" data-key="{{skill.key}}" for="system.skills.{{skill.key}}.value"
{{#if skill.proficiency}}data-tooltip="{{localize 'DG.Tooltip.SkillLabel'}}"{{/if}}
{{#unless skill.proficiency}}data-tooltip="{{localize 'DG.Tooltip.CannotRollSkillLabel'}}"{{/unless}}
>
<i class="fas fa-dice"></i>
</label>
<input class="percentile-skill-input" type="text" name="system.skills.{{skill.key}}.proficiency" value="{{skill.proficiency}}" data-dtype="Number" {{#if skill.isCalculatedValue}} disabled {{/if}}/>
</div>
{{#each actor.system.sortedSkills as |skill key| }}
{{#if (hideSkillBasedOnProficiencyAndUserChoice ../actor.system.showUntrainedSkills skill.proficiency) }}
<div class="flexrow flex-group-left flex-thin-border">
<label data-tooltip="{{localize (concat 'DG.Skills.Tooltip.' skill.key)}}">
{{localizeWithFallback (concat "DG.Skills." skill.key) skill.label }}
</label>
<label class="{{if_gt skill.proficiency 0 'rollable' 'not-rollable'}} skill-label"
data-rolltype="skill"
data-roll="d100"
data-key="{{skill.key}}"
for="system.skills.{{skill.key}}.value"
{{#if skill.proficiency }}
data-tooltip="{{localize 'DG.Tooltip.SkillLabel' }}"
{{/if}}
{{#unless skill.proficiency}}
data-tooltip="{{localize 'DG.Tooltip.CannotRollSkillLabel'}}"
{{/unless}}>
<i class="fas fa-dice"></i>
</label>
<input class="percentile-skill-input"
type="text"
name="system.skills.{{skill.key}}.proficiency"
value="{{skill.proficiency}}"
data-dtype="Number"
{{#if skill.isCalculatedValue }}
disabled
{{/if }} />
</div>
{{/if}}
{{/each}}
</div>
<br>
<div>
{{> "systems/deltagreen/templates/actor/partials/custom-skills-partial.html"}}
</div>
<div>{{> "systems/deltagreen/templates/actor/partials/custom-skills-partial.html"}}</div>
<br>
<div>
<span class="resource-label">{{localize 'DG.UnnaturalSheet.NotesLabel'}}</span>
@@ -125,19 +177,18 @@
{{editor enrichedDescription target="system.notes" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
</div>
{{!-- GEAR --}}
<div class="tab items" data-group="primary" data-tab="gear">
{{> "systems/deltagreen/templates/actor/partials/equipment-partial.html" }}
</div>
{{!-- About Tab --}}
<div class="tab about" data-group="primary" data-tab="about">
{{> "systems/deltagreen/templates/actor/partials/help-and-licensing-partial.html" }}
</div>
{{!-- About Tab --}}
<div class="tab about" data-group="primary" data-tab="about">
{{> "systems/deltagreen/templates/actor/partials/help-and-licensing-partial.html" }}
</div>
</section>
</form>