From a6dc61a92408685d0d4528039a0fdd224c5d2b91 Mon Sep 17 00:00:00 2001
From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com>
Date: Sun, 4 May 2025 11:04:01 +0200
Subject: [PATCH] add AttributeChoiceField and use it for Talent
---
src/ItemSheets/Talent.hbs | 35 +++--------------------------------
src/main.mjs | 25 ++++++++++++++++++++++---
2 files changed, 25 insertions(+), 35 deletions(-)
diff --git a/src/ItemSheets/Talent.hbs b/src/ItemSheets/Talent.hbs
index c47636b..4e10bcd 100644
--- a/src/ItemSheets/Talent.hbs
+++ b/src/ItemSheets/Talent.hbs
@@ -17,38 +17,9 @@
{{>editable-input type="text" name="system.behinderung" value=item.system.behinderung placeholder=(localize "DSA41.talente.label_behinderung")}}
-
-
-
-
-
+ {{DSA41_input "system.attribute1"}}
+ {{DSA41_input "system.attribute2"}}
+ {{DSA41_input "system.attribute3"}}
diff --git a/src/main.mjs b/src/main.mjs
index 2977bd2..9d4b0ea 100644
--- a/src/main.mjs
+++ b/src/main.mjs
@@ -271,6 +271,25 @@ class AttributeField extends SchemaField {
}
}
+class AttributeChoiceField extends StringField {
+ constructor() {
+ return super({
+ required: true,
+ choices: {
+ "courage": "DSA41.attributes.long.courage",
+ "cleverness": "DSA41.attributes.long.cleverness",
+ "intuition": "DSA41.attributes.long.intuition",
+ "charisma": "DSA41.attributes.long.charisma",
+ "dexterity": "DSA41.attributes.long.dexterity",
+ "agility": "DSA41.attributes.long.agility",
+ "constitution": "DSA41.attributes.long.constitution",
+ "strength": "DSA41.attributes.long.strength",
+ },
+ initial: "courage",
+ });
+ }
+}
+
class DSA41_CharacterDocument extends Actor {
static async create(data, operation) {
const actor = await super.create(data, operation);
@@ -737,9 +756,9 @@ class DSA41_TalentData extends TypeDataModel {
kategorie: new StringField({ initial: "koerperliche" }),
behinderung: new StringField({ initial: "" }),
- attribute1: new StringField({ initial: "courage" }),
- attribute2: new StringField({ initial: "courage" }),
- attribute3: new StringField({ initial: "courage" }),
+ attribute1: new AttributeChoiceField(),
+ attribute2: new AttributeChoiceField(),
+ attribute3: new AttributeChoiceField(),
talentwert: new NumberField({ integer: true, initial: 0 }),
};