From f296b2280d6acdc06b7cdb4cfa23e9c65ab16d08 Mon Sep 17 00:00:00 2001
From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com>
Date: Sun, 4 May 2025 11:31:35 +0200
Subject: [PATCH] add SteigerungsKategorieField and use it for Kampftalent
---
src/ItemSheets/Kampftalent.hbs | 12 +-----------
src/lang/de.json | 24 ++++++++++++------------
src/main.mjs | 23 ++++++++++++++++++++++-
3 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/src/ItemSheets/Kampftalent.hbs b/src/ItemSheets/Kampftalent.hbs
index 008da03..05a95cf 100644
--- a/src/ItemSheets/Kampftalent.hbs
+++ b/src/ItemSheets/Kampftalent.hbs
@@ -5,17 +5,7 @@
{{>editable-input type="text" name="name" value=item.name placeholder=(localize "DSA41.name")}}
-
+ {{DSA41_input "system.steigern"}}
{{localize "DSA41.kampftalent.label_steigern"}}
{{>editable-input type="text" name="system.behinderung" value=item.system.behinderung placeholder=(localize "DSA41.talente.label_behinderung")}}
diff --git a/src/lang/de.json b/src/lang/de.json
index 4678dd5..bf608bf 100644
--- a/src/lang/de.json
+++ b/src/lang/de.json
@@ -34,6 +34,18 @@
"kreuzer": "Kreuzer"
},
+ "steigerungskategorie": {
+ "A_Star": "A*",
+ "A": "A",
+ "B": "B",
+ "C": "C",
+ "D": "D",
+ "E": "E",
+ "F": "F",
+ "G": "G",
+ "H": "H"
+ },
+
"chat": {
"result": "Ergebnis",
"success": "Geschafft",
@@ -165,18 +177,6 @@
"waffenlos": "Waffenlos",
"nahkampf": "Bewaffneter Nahkampf",
"fernkampf": "Fernkampf"
- },
-
- "steigern": {
- "A_Star": "A*",
- "A": "A",
- "B": "B",
- "C": "C",
- "D": "D",
- "E": "E",
- "F": "F",
- "G": "G",
- "H": "H"
}
},
diff --git a/src/main.mjs b/src/main.mjs
index d965ed6..57045f0 100644
--- a/src/main.mjs
+++ b/src/main.mjs
@@ -291,6 +291,27 @@ class AttributeChoiceField extends StringField {
}
}
+class SteigerungsKategorieField extends StringField {
+ constructor(options={}, context={}) {
+ return super({
+ required: true,
+ choices: {
+ "A_Star": "DSA41.steigerungskategorie.A_Star",
+ "A": "DSA41.steigerungskategorie.A",
+ "B": "DSA41.steigerungskategorie.B",
+ "C": "DSA41.steigerungskategorie.C",
+ "D": "DSA41.steigerungskategorie.D",
+ "E": "DSA41.steigerungskategorie.E",
+ "F": "DSA41.steigerungskategorie.F",
+ "G": "DSA41.steigerungskategorie.G",
+ "H": "DSA41.steigerungskategorie.H",
+ },
+ initial: "A_Star",
+ ...options,
+ }, context);
+ }
+}
+
class DSA41_CharacterDocument extends Actor {
static async create(data, operation) {
const actor = await super.create(data, operation);
@@ -781,7 +802,7 @@ class DSA41_KampftalentData extends TypeDataModel {
return {
kategorie: new StringField({ initial: "waffenlos" }),
behinderung: new StringField({ initial: "" }),
- steigern: new StringField({ initial: "A_Star"}),
+ steigern: new SteigerungsKategorieField(),
beschreibung: new StringField({ initial: "" }),