repairs visuals advantages and special abilities

feature/applicationv2
macniel 2025-10-20 12:34:00 +02:00
parent 523cbb9f62
commit eb88377f14
7 changed files with 135 additions and 398 deletions

View File

@ -0,0 +1,45 @@
export default {
_prepareContext: async (context, options, object) => {
const actorData = context.document
context.system = actorData.system
context.flags = actorData.flags
context.derived = context.document.system
context.originalName = actorData.name
context.name = context.derived.name ?? actorData.name
context.effects = actorData.effects ?? []
context.advantages = []
actorData.itemTypes.Advantage.forEach((item) => {
context.advantages.push({
id: item._id,
name: item.name,
value: item.system.value,
options: item.system.auswahl,
description: item.system.description,
isAdvantage: !item.system.nachteil,
isDisadvantage: item.system.nachteil,
isBadAttribute: item.system.schlechteEigenschaft
})
}
)
context.specialAbilities = []
actorData.itemTypes.SpecialAbility.forEach((item) => {
context.specialAbilities.push({
id: item._id,
name: item.name,
});
}
);
return context
},
_onRender: (context, options) => {
},
_getTabConfig: (group) => {
group.tabs.push({id: "advsf", group: "sheet", label: "Vorteile"})
},
template: `systems/DSA_4-1/templates/actor/character/tab-advsf.hbs`
}

View File

@ -1,128 +0,0 @@
export default {
_prepareContext: async (context, options, object) => {
const actorData = context.document
context.system = actorData.system
context.flags = actorData.flags
context.derived = context.document.system
context.originalName = actorData.name
context.name = context.derived.name ?? actorData.name
context.effects = actorData.effects ?? []
context.advantages = []
const getModsOfAttribute = async (keyPath, object) => {
let returnValue = [];
Array.from(object.appliedEffects).forEach(
(e) =>
e.changes.filter(c => c.key === keyPath).forEach(change => {
returnValue.push({
name: e.name,
value: change.value > 0 ? "+" + change.value : "" + change.value,
icon: e.icon,
})
}))
return returnValue
}
context.mods = {
"mu": await getModsOfAttribute('system.attribute.mu.mod', actorData),
"kl": await getModsOfAttribute('system.attribute.kl.mod', actorData),
"in": await getModsOfAttribute('system.attribute.in.mod', actorData),
"ch": await getModsOfAttribute('system.attribute.ch.mod', actorData),
"ff": await getModsOfAttribute('system.attribute.ff.mod', actorData),
"ge": await getModsOfAttribute('system.attribute.ge.mod', actorData),
"ko": await getModsOfAttribute('system.attribute.ko.mod', actorData),
"kk": await getModsOfAttribute('system.attribute.kk.mod', actorData),
"at": await getModsOfAttribute('system.at.mod', actorData),
"pa": await getModsOfAttribute('system.pa.mod', actorData),
"fk": await getModsOfAttribute('system.fk.mod', actorData),
}
context.attributes = [
{
eigenschaft: "mu",
name: "MU",
tooltip: "Mut",
wert: context.derived.attribute.mu.aktuell ?? 0,
},
{
eigenschaft: "kl",
name: "KL",
tooltip: "Klugheit",
wert: context.derived.attribute.kl.aktuell ?? 0,
},
{
eigenschaft: "in",
name: "IN",
tooltip: "Intuition",
wert: context.derived.attribute.in.aktuell ?? 0,
},
{
eigenschaft: "ch",
name: "CH",
tooltip: "Charisma",
wert: context.derived.attribute.ch.aktuell ?? 0,
},
{
eigenschaft: "ff",
name: "FF",
tooltip: "Fingerfertigkeit",
wert: context.derived.attribute.ff.aktuell ?? 0,
},
{
eigenschaft: "ge",
name: "GE",
tooltip: "Geschicklichkeit",
wert: context.derived.attribute.ge.aktuell ?? 0,
},
{
eigenschaft: "ko",
name: "KO",
tooltip: "Konstitution",
wert: context.derived.attribute.ko.aktuell ?? 0,
},
{
eigenschaft: "kk",
name: "KK",
tooltip: "Körperkraft",
wert: context.derived.attribute.kk.aktuell ?? 0,
},
]
Object.values(actorData.items).forEach((item) => {
if (item.type === "Advantage") {
context.advantages.push({
id: item._id,
name: item.name,
value: item.system.value,
options: item.system.auswahl,
description: item.system.description,
isAdvantage: !item.system.nachteil,
isDisadvantage: item.system.nachteil,
isBadAttribute: item.system.schlechteEigenschaft
})
}
}
)
context.specialAbilities = []
Object.values(actorData.items).forEach((item) => {
if (item.type === "SpecialAbility") {
context.specialAbilities.push({
id: item._id,
name: item.name,
});
}
}
);
return context
},
_onRender: (context, options) => {
},
_getTabConfig: (group) => {
group.tabs.push({id: "attributes", group: "sheet", label: "Eigenschaften"})
},
template: `systems/DSA_4-1/templates/actor/character/tab-attributes.hbs`
}

View File

@ -1,4 +1,4 @@
import Attributes from "./character/attributes.mjs"
import Advsf from "./character/advsf.mjs"
import Combat from "./character/combat.mjs"
import Effects from "./character/effects.mjs"
import Equipment from "./character/equipment.mjs"
@ -55,8 +55,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
social: {
template: Social.template
},
attributes: {
template: Attributes.template
advsf: {
template: Advsf.template
},
combat: {
template: Combat.template
@ -146,7 +146,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
const tabs = foundry.utils.deepClone(super._getTabsConfig(group))
Meta._getTabConfig(tabs, this);
Social._getTabConfig(tabs, this);
Attributes._getTabConfig(tabs, this)
Advsf._getTabConfig(tabs, this)
Combat._getTabConfig(tabs, this)
Equipment._getTabConfig(tabs, this)
Skills._getTabConfig(tabs, this)
@ -341,8 +341,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
case "social":
await Social._prepareContext(context, this.document)
break
case "attributes":
await Attributes._prepareContext(context, this.document)
case "advsf":
await Advsf._prepareContext(context, this.document)
break
case "combat":
await Combat._prepareContext(context, this.document)
@ -369,7 +369,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
_onRender(context, options) {
Meta._onRender(context, options, this.element)
Social._onRender(context, options, this.element)
Attributes._onRender(context, options, this.element)
Advsf._onRender(context, options, this.element)
Combat._onRender(context, options, this.element)
Effects._onRender(context, options, this.element)
Equipment._onRender(context, options, this)

View File

@ -4,7 +4,7 @@
label,
.sheet-tabs.tabs a,
h2 {
h2, h3 {
font-family: Gentium, sans-serif;
font-weight: bold;
font-size: 12pt;

View File

@ -1,121 +1,80 @@
@mixin tab {
height: 100%;
.attribute {
padding: 8px 0;
display: flex;
gap: 0 8px;
.advantages-and-specialabilities {
label {
width: 120px;
text-align: right;
vertical-align: middle;
line-height: 24px;
}
height: unset;
display: unset;
gap: 0;
padding: unset;
input {
max-width: 80px;
text-align: right;
}
.advantages, .special-abilities {
margin-bottom: 16px;
.mod {
color: grey;
text-shadow: 0 -1px 0 #ccc;
box-Shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
border-radius: 4px;
height: 24px;
width: 24px;
background: linear-gradient(0deg, rgba(24, 24, 24, 1) 0%, rgba(80, 80, 80, 1) 100%);;
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 24px;
margin-left: 4px;
}
ul {
list-style-type: none;
padding: 0;
margin: 0;
text-indent: 0;
}
li {
display: inline-block;
}
.attributes-overview {
columns: 2;
gap: 0 16px;
}
.resource-overview {
.attribute {
}
}
.advantages, .special-abilities {
margin-bottom: 16px;
ul {
list-style-type: none;
padding: 0;
margin: 0;
text-indent: 0;
li {
display: inline-block;
}
.advantage, .special-ability {
position: relative;
border: 1px solid gold;
box-shadow: 2px 2px 4px #000;
border-radius: 8px;
height: 24px;
color: gold;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
display: inline-block;
padding: 0 8px;
margin-left: 0;
margin-bottom: 4px;
background-image: url("../../assets/velvet_button.png");
background-repeat: repeat-y;
background-size: cover;
span {
.advantage, .special-ability {
position: relative;
z-index: 2;
line-height: 24px;
vertical-align: middle;
}
&.special-ability {
&::after {
background: rgba(128, 0, 96, 0.5);
}
}
&::after {
content: "";
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
border: 1px solid gold;
box-shadow: 2px 2px 4px #000;
border-radius: 8px;
background: rgba(0, 128, 0, 0.5);
}
height: 24px;
color: gold;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
display: inline-block;
padding: 0 8px;
margin-left: 0;
margin-bottom: 4px;
background-image: url("../../assets/velvet_button.png");
background-repeat: repeat-y;
background-size: cover;
& + .advantage, & + .special-ability {
margin-left: 8px;
}
span {
position: relative;
z-index: 2;
line-height: 24px;
vertical-align: middle;
}
&.disadvantage {
font-style: italic;
&.special-ability {
&::after {
background: rgba(128, 0, 96, 0.5);
}
}
&::after {
background: rgba(128, 0, 0, 0.5);
content: "";
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
border-radius: 8px;
background: rgba(0, 128, 0, 0.5);
}
& + .advantage, & + .special-ability {
margin-left: 8px;
}
&.disadvantage {
font-style: italic;
&::after {
background: rgba(128, 0, 0, 0.5);
}
}
}
}
}
}
}
}

View File

@ -0,0 +1,22 @@
<section class="tab {{tabs.advsf.id}} {{tabs.advsf.cssClass}}"
data-tab="{{tabs.advsf.id}}"
data-group="{{tabs.advsf.group}}">
<div class="advantages-and-specialabilities">
<div class="advantages">
<h3>Vor- und Nachteile</h3>
<ul>
{{#each this.advantages}}
<li>{{> "systems/DSA_4-1/templates/ui/partial-advantage-button.hbs" this}}</li>
{{/each}}
</ul>
</div>
<div class="special-abilities">
<h3>Sonderfertigkeiten</h3>
<ul>
{{#each this.specialAbilities}}
<li>{{> "systems/DSA_4-1/templates/ui/partial-sf-button.hbs" this}}</li>
{{/each}}
</ul>
</div>
</div>
</section>

View File

@ -1,161 +0,0 @@
<section class="tab {{tabs.attributes.id}} {{tabs.attributes.cssClass}}"
data-tab="{{tabs.attributes.id}}"
data-group="{{tabs.attributes.group}}">
<div class="attributes-overview">
<div class="attribute">
<label>Mut</label>
<input value="{{this.system.attribute.mu.aktuell}}">
<div class="mods">
{{#each this.mods.mu}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Klugheit</label>
<input value="{{this.system.attribute.kl.aktuell}}">
<div class="mods">
{{#each this.mods.kl}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Intuition</label>
<input value="{{this.system.attribute.in.aktuell}}">
<div class="mods">
{{#each this.mods.in}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Charisma</label>
<input value="{{this.system.attribute.ch.aktuell}}">
<div class="mods">
{{#each this.mods.ch}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Fingerfertigkeit</label>
<input value="{{this.system.attribute.ff.aktuell}}">
<div class="mods">
{{#each this.mods.ff}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Geschicklichkeit</label>
<input value="{{this.system.attribute.ge.aktuell}}">
<div class="mods">
{{#each this.mods.ge}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Konstitution</label>
<input value="{{this.system.attribute.ko.aktuell}}">
<div class="mods">
{{#each this.mods.ko}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Körperkraft</label>
<input value="{{this.system.attribute.kk.aktuell}}">
<div class="mods">
{{#each this.mods.kk}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>Sozialstatus</label>
<input value="{{this.system.attribute.so.aktuell}}">
</div>
<div class="attribute">
<label>AT-Basis</label>
<input value="{{derived.at.basis}}">
<div class="mods">
{{#each this.mods.at}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>PA-Basis</label>
<input value="{{derived.pa.basis}}">
<div class="mods">
{{#each this.mods.pa}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
<div class="attribute">
<label>FK-Basis</label>
<input value="{{derived.fk.basis}}">
<div class="mods">
{{#each this.mods.fk}}
<span class="mod" title="{{this.name}}">{{this.value}}</span>
{{/each}}
</div>
</div>
</div>
<div class="resources-overview">
<div class="attribute">
<label>Lebensenergie</label>
<input value="{{actor.system.lep.aktuell}}">
<input value="{{actor.system.lep.max}}">
</div>
{{#if ausdauer}}
<div class="attribute">
<label>Ausdauer</label>
<input value="{{actor.system.aup.aktuell}}">
<input value="{{actor.system.aup.max}}">
</div>
{{/if}}
{{#if hasSpells}}
<div class="attribute">
<label>Astralenergie</label>
<input value="{{actor.system.asp.aktuell}}">
<input value="{{actor.system.asp.max}}">
</div>
{{/if}}
{{#if hasLiturgies}}
<div class="attribute">
<label>Karmaenergie</label>
<input value="{{actor.system.kap.aktuell}}">
<input value="{{actor.system.kap.max}}">
</div>
{{/if}}
</div>
<div class="advantages">
<h3>Vor- und Nachteile</h3>
<ul>
{{#each this.advantages}}
<li>{{> "systems/DSA_4-1/templates/ui/partial-advantage-button.hbs" this}}</li>
{{/each}}
</ul>
</div>
<div class="special-abilities">
<h3>Sonderfertigkeiten</h3>
<ul>
{{#each this.specialAbilities}}
<li>{{> "systems/DSA_4-1/templates/ui/partial-sf-button.hbs" this}}</li>
{{/each}}
</ul>
</div>
</section>