From b1da5ff6f2288780143ff597f8c96cc8a6122a9b Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Tue, 4 Feb 2025 23:37:16 +0100 Subject: [PATCH] add Abenteuerpunkte to Eigenschaften tab --- src/ActorSheet.hbs | 8 ++++++++ src/lang/de.json | 15 ++++++++------- src/main.css | 19 +++++++++++++++++++ src/main.mjs | 8 ++++++++ 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/ActorSheet.hbs b/src/ActorSheet.hbs index dcc669b..ca0c8d4 100644 --- a/src/ActorSheet.hbs +++ b/src/ActorSheet.hbs @@ -63,6 +63,14 @@
+
+ {{localize "DSA41.abenteuerpunkte"}}: + {{>editable-input type="number" name="system.abenteuerpunkte.ausgegeben" value=actor.system.abenteuerpunkte.ausgegeben}} + / + {{>editable-input type="number" name="system.abenteuerpunkte.gesamt" value=actor.system.abenteuerpunkte.gesamt}} + ({{actor.system.computed.abenteuerpunkte.uebrig}}) +
+
diff --git a/src/lang/de.json b/src/lang/de.json index a844b0d..4678dd5 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -16,13 +16,14 @@ }, "DSA41": { - "name": "Name", - "race": "Rasse", - "culture": "Kultur", - "profession": "Profession", - "sozialstatus": "Sozialstatus", - "weight": "Gewicht", - "price": "Preis", + "name": "Name", + "race": "Rasse", + "culture": "Kultur", + "profession": "Profession", + "sozialstatus": "Sozialstatus", + "weight": "Gewicht", + "price": "Preis", + "abenteuerpunkte": "Abenteuerpunkte", "list_empty": "Keine", diff --git a/src/main.css b/src/main.css index a4f6ed7..4723daa 100644 --- a/src/main.css +++ b/src/main.css @@ -281,6 +281,7 @@ html { width: 7ch; & input { + background: transparent; padding: 0; } } @@ -291,6 +292,24 @@ html { } } + & .Abenteuerpunkte { + width: min-content; + margin-left: auto; + align-items: center; + + display: flex; + gap: 1em; + + & .editable-input { + display: inline-block; + width: 5ch; + + & input { + background: transparent; + padding: 0; + } + } + } & .tabs { padding: .5rem; diff --git a/src/main.mjs b/src/main.mjs index abcde94..80b46a8 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -294,6 +294,11 @@ class DSA41_CharacterData extends TypeDataModel { profession: new StringField(), sozialstatus: new NumberField({ integer: true, inital: 1 }), + abenteuerpunkte: new SchemaField({ + ausgegeben: new NumberField({ integer: true, initial: 0 }), + gesamt: new NumberField({ integer: true, initial: 0 }), + }), + currency: new SchemaField({ dukaten: new NumberField({ integer: true, initial: 0 }), silbertaler: new NumberField({ integer: true, initial: 0 }), @@ -355,6 +360,7 @@ class DSA41_CharacterData extends TypeDataModel { async prepareDerivedData() { super.prepareDerivedData(); this.computed = { + abenteuerpunkte: {}, attributes: {}, attributes_without_modifiers: {}, @@ -386,6 +392,8 @@ class DSA41_CharacterData extends TypeDataModel { }, }; + this.computed.abenteuerpunkte.uebrig = this.abenteuerpunkte.gesamt - this.abenteuerpunkte.ausgegeben; + for (const [attribute, values] of Object.entries(this.attributes)) { this.computed.attributes[attribute] = values.initial + values.advancement + values.modifier; this.computed.attributes_without_modifiers[attribute] = values.initial + values.advancement;