diff --git a/src/ActorSheet.hbs b/src/ActorSheet.hbs index 1dc7382..cd33b85 100644 --- a/src/ActorSheet.hbs +++ b/src/ActorSheet.hbs @@ -179,6 +179,10 @@
{{localize (concat "DSA41.vornachteil.label_vorteile")}}
+ {{#unless (ne actor.system.computed.num_vorteile 0)}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.itemTypes.VorNachteil}} {{#if (eq system.kategorie "vorteil")}}
@@ -197,6 +201,10 @@
{{localize (concat "DSA41.vornachteil.label_nachteile")}}
+ {{#unless (ne actor.system.computed.num_nachteile 0)}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.itemTypes.VorNachteil}} {{#if (eq system.kategorie "nachteil")}}
@@ -216,6 +224,10 @@
{{localize (concat "DSA41.sonderfertigkeiten.label_allgemein")}}
+ {{#unless (ne actor.system.computed.num_allgemeine_sonderfertigkeiten 0)}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.itemTypes.Sonderfertigkeit}} {{#if (eq this.system.kategorie "allgemein")}}
@@ -285,6 +297,11 @@
{{localize "DSA41.weight"}}
+ + {{#unless (ne actor.itemTypes.Bewaffnung.length 0)}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.itemTypes.Bewaffnung}}
@@ -312,6 +329,11 @@
{{localize "DSA41.weight"}}
+ + {{#unless (ne actor.itemTypes.Ruestung.length 0)}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.itemTypes.Ruestung}}
@@ -331,6 +353,11 @@
{{localize "DSA41.weight"}}
+ + {{#unless (ne actor.itemTypes.Gegenstand.length 0)}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.itemTypes.Gegenstand}}
@@ -354,6 +381,10 @@
{{localize "DSA41.kampf.trefferpunkte"}}
+ {{#unless (or (ne actor.system.computed.num_waffen 0) (ne actor.system.computed.num_fernkampf_waffen 0))}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.system.computed.kampf.waffen}}
@@ -445,6 +476,10 @@
{{localize (concat "DSA41.sonderfertigkeiten.label_kampf")}}
+ {{#unless (ne actor.system.computed.num_kampf_sonderfertigkeiten 0)}} +
{{localize "DSA41.list_empty"}}
+ {{/unless}} + {{#each actor.itemTypes.Sonderfertigkeit}} {{#if (eq this.system.kategorie "kampf")}}
diff --git a/src/lang/de.json b/src/lang/de.json index d92c75e..4b641ed 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -24,6 +24,8 @@ "weight": "Gewicht", "price": "Preis", + "list_empty": "Keine", + "chat": { "result": "Ergebnis", "success": "Geschafft", diff --git a/src/main.mjs b/src/main.mjs index a07b5f8..ae2567d 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -255,6 +255,13 @@ class DSA41_CharacterData extends TypeDataModel { attributes: {}, attributes_without_modifiers: {}, + num_vorteile: 0, + num_nachteile: 0, + num_allgemeine_sonderfertigkeiten: 0, + num_kampf_sonderfertigkeiten: 0, + num_waffen: 0, + num_fernkampf_waffen: 0, + kampf: { talente: {}, waffen: {}, @@ -354,6 +361,7 @@ class DSA41_CharacterData extends TypeDataModel { for(const item of equipped_nahkampfwaffen) { if (item.system.nahkampfwaffe.aktiv) { + this.computed.num_waffen += 1; let computed = this.computed.kampf.waffen[item._id] = { item: item, attacke: 0, @@ -417,6 +425,7 @@ class DSA41_CharacterData extends TypeDataModel { } for (const item of equipped_fernkampfwaffen) { + this.computed.num_fernkampf_waffen += 1; let computed = this.computed.kampf.fernkampf_waffen[item._id] = { item: item, attacke: 0, @@ -446,6 +455,11 @@ class DSA41_CharacterData extends TypeDataModel { wissens: talente.filter((x) => x.system.kategorie === "wissens"), handwerks: talente.filter((x) => x.system.kategorie === "handwerks"), }; + + this.computed.num_allgemeine_sonderfertigkeiten = this.parent.items.filter((x) => x.type === "Sonderfertigkeit" && x.system.kategorie === "allgemein").length; + this.computed.num_kampf_sonderfertigkeiten = this.parent.items.filter((x) => x.type === "Sonderfertigkeit" && x.system.kategorie === "kampf").length; + this.computed.num_vorteile = this.parent.items.filter((x) => x.type === "VorNachteil" && x.system.kategorie === "vorteil").length; + this.computed.num_nachteile = this.parent.items.filter((x) => x.type === "VorNachteil" && x.system.kategorie === "nachteil").length; } }