diff --git a/westreiche_website/app/character.php b/westreiche_website/app/character.php
index 82e477a..577a81b 100644
--- a/westreiche_website/app/character.php
+++ b/westreiche_website/app/character.php
@@ -153,7 +153,8 @@ function character_seed_skills(int $characterId): int
$count = 0;
foreach (skills_catalog() as $skill) {
$attribute = trim((string) ($skill['attribute'] ?? ''));
- $bonus = $attribute === '' ? 0 : max(0, attribute_bonus((int) ($character['attr_' . strtolower($attribute)] ?? 10)));
+ $field = attribute_field_for_code($attribute);
+ $bonus = $field === '' ? 0 : max(0, attribute_bonus((int) ($character[$field] ?? 10)));
$insert->execute([$characterId, (int) $skill['id'], (string) $skill['name'], $bonus]);
$count++;
}
@@ -175,10 +176,11 @@ function character_reset_skills(int $characterId, bool $force = false): int
$update = db()->prepare('UPDATE character_skills SET bonus = ? WHERE id = ?');
foreach (character_skills($characterId) as $row) {
$attribute = trim((string) ($row['attribute'] ?? ''));
- if ($attribute === '') {
+ $field = attribute_field_for_code($attribute);
+ if ($field === '') {
continue;
}
- $target = max(0, attribute_bonus((int) ($character['attr_' . strtolower($attribute)] ?? 10)));
+ $target = max(0, attribute_bonus((int) ($character[$field] ?? 10)));
if ($force || (int) $row['bonus'] === $target || (int) $row['bonus'] < 0) {
$update->execute([$target, (int) $row['id']]);
$changed++;
@@ -1024,9 +1026,9 @@ function skills_grouped(array $skills): array
/** Attributsbonus (MOD) einer Fertigkeit für einen Charakter. */
function skill_attribute_modifier(array $character, array $skill): ?int
{
- $attribute = strtolower(trim((string) ($skill['attribute'] ?? '')));
- if ($attribute === '') {
+ $field = attribute_field_for_code((string) ($skill['attribute'] ?? ''));
+ if ($field === '') {
return null;
}
- return attribute_bonus((int) ($character['attr_' . $attribute] ?? 10));
+ return attribute_bonus((int) ($character[$field] ?? 10));
}
diff --git a/westreiche_website/app/migrations.php b/westreiche_website/app/migrations.php
index 9b1a000..42fd488 100644
--- a/westreiche_website/app/migrations.php
+++ b/westreiche_website/app/migrations.php
@@ -46,6 +46,17 @@ const WS_MIGRATIONS = [
4 => [
"ALTER TABLE characters ADD COLUMN IF NOT EXISTS gender VARCHAR(20) NOT NULL DEFAULT 'männlich' AFTER title",
],
+ // 5: Attributkürzel deutsch (GES/KON/WEI statt DEX/CON/WIS). Erst die
+ // Daten umschlüsseln, dann den ENUM der Katalogtabelle nachziehen.
+ 5 => [
+ "UPDATE skills SET attribute = 'GES' WHERE attribute = 'DEX'",
+ "UPDATE skills SET attribute = 'KON' WHERE attribute = 'CON'",
+ "UPDATE skills SET attribute = 'WEI' WHERE attribute = 'WIS'",
+ "UPDATE character_skills SET attribute = 'GES' WHERE attribute = 'DEX'",
+ "UPDATE character_skills SET attribute = 'KON' WHERE attribute = 'CON'",
+ "UPDATE character_skills SET attribute = 'WEI' WHERE attribute = 'WIS'",
+ "ALTER TABLE skills MODIFY attribute ENUM('STR', 'GES', 'KON', 'INT', 'WEI', 'CHA', '') NOT NULL DEFAULT ''",
+ ],
];
function ws_migrations_apply(PDO $pdo): void
diff --git a/westreiche_website/app/pages.php b/westreiche_website/app/pages.php
index 787a63b..0f70c9f 100644
--- a/westreiche_website/app/pages.php
+++ b/westreiche_website/app/pages.php
@@ -878,7 +878,7 @@ function page_admin_skills(string $method, array $user): void
$category = post_string('category', 'Allgemein');
if ($name === '') {
$error = 'Bitte einen Namen angeben.';
- } elseif (!in_array($attribute, ['STR', 'DEX', 'CON', 'INT', 'WIS', 'CHA', ''], true)) {
+ } elseif (!in_array($attribute, array_merge(array_keys(WS_ATTRIBUTE_CODES), ['']), true)) {
$attribute = '';
} else {
skills_catalog_add($name, $attribute, $category);
diff --git a/westreiche_website/app/rules.php b/westreiche_website/app/rules.php
index 861175a..6985d4b 100644
--- a/westreiche_website/app/rules.php
+++ b/westreiche_website/app/rules.php
@@ -5,13 +5,26 @@ declare(strict_types=1);
const WS_ATTRIBUTES = [
'attr_str' => ['STR', 'Stärke'],
- 'attr_dex' => ['DEX', 'Geschicklichkeit'],
- 'attr_con' => ['CON', 'Konstitution'],
+ 'attr_dex' => ['GES', 'Geschicklichkeit'],
+ 'attr_con' => ['KON', 'Konstitution'],
'attr_int' => ['INT', 'Intelligenz'],
- 'attr_wis' => ['WIS', 'Weisheit'],
+ 'attr_wis' => ['WEI', 'Weisheit'],
'attr_cha' => ['CHA', 'Charisma'],
];
+/**
+ * Attributkürzel → Spaltenname am Charakterbogen. Die Kürzel sind deutsch
+ * (GES, KON, WEI), die Spalten bleiben historisch attr_dex/attr_con/attr_wis.
+ */
+const WS_ATTRIBUTE_CODES = [
+ 'STR' => 'attr_str',
+ 'GES' => 'attr_dex',
+ 'KON' => 'attr_con',
+ 'INT' => 'attr_int',
+ 'WEI' => 'attr_wis',
+ 'CHA' => 'attr_cha',
+];
+
const WS_CLASSES = [
'Kämpfer', 'Ritter', 'Paladin', 'Barbar', 'Waldläufer',
'Dieb', 'Assassine', 'Barde',
@@ -60,39 +73,39 @@ const WS_SKILL_CATEGORIES = WS_SKILL_GROUPS;
* Name => [Attribut, Gruppe]. Startwert ist der Attributsbonus.
*/
const WS_SKILL_CATALOG = [
- 'Ausdauer' => ['CON', 'Körper'],
- 'Balancieren' => ['DEX', 'Körper'],
- 'Fliegen' => ['DEX', 'Körper'],
+ 'Ausdauer' => ['KON', 'Körper'],
+ 'Balancieren' => ['GES', 'Körper'],
+ 'Fliegen' => ['GES', 'Körper'],
'Klettern' => ['STR', 'Körper'],
- 'Reiten & Wagenführung' => ['DEX', 'Körper'],
- 'Schleichen' => ['DEX', 'Körper'],
- 'Schwimmen' => ['CON', 'Körper'],
- 'Wahrnehmung' => ['WIS', 'Körper'],
+ 'Reiten & Wagenführung' => ['GES', 'Körper'],
+ 'Schleichen' => ['GES', 'Körper'],
+ 'Schwimmen' => ['KON', 'Körper'],
+ 'Wahrnehmung' => ['WEI', 'Körper'],
- 'Wildniskunde' => ['WIS', 'Wildnis'],
- 'Nahrung finden' => ['WIS', 'Wildnis'],
- 'Navigation' => ['WIS', 'Wildnis'],
+ 'Wildniskunde' => ['WEI', 'Wildnis'],
+ 'Nahrung finden' => ['WEI', 'Wildnis'],
+ 'Navigation' => ['WEI', 'Wildnis'],
'Orientierung' => ['INT', 'Wildnis'],
'Pflanzenkunde' => ['INT', 'Wildnis'],
'Segeln + Schiffahrt' => ['INT', 'Wildnis'],
- 'Seilkunde' => ['DEX', 'Wildnis'],
- 'Spurenlesen' => ['WIS', 'Wildnis'],
+ 'Seilkunde' => ['GES', 'Wildnis'],
+ 'Spurenlesen' => ['WEI', 'Wildnis'],
'Anführen' => ['CHA', 'Sozial'],
'Aufführung' => ['CHA', 'Sozial'],
'Einschüchtern' => ['STR', 'Sozial'],
'Etikette' => ['CHA', 'Sozial'],
- 'Handeln & Schätzen' => ['WIS', 'Sozial'],
+ 'Handeln & Schätzen' => ['WEI', 'Sozial'],
'Überzeugen' => ['CHA', 'Sozial'],
'Verstellen' => ['INT', 'Sozial'],
'Alchimie' => ['INT', 'Wissen'],
'Geschichts + Sagenkunde' => ['INT', 'Wissen'],
- 'Handwerk' => ['DEX', 'Wissen'],
- 'Heilkunde: Geist' => ['WIS', 'Wissen'],
+ 'Handwerk' => ['GES', 'Wissen'],
+ 'Heilkunde: Geist' => ['WEI', 'Wissen'],
'Heilkunde: Gift' => ['INT', 'Wissen'],
'Heilkunde: Krankheiten' => ['INT', 'Wissen'],
- 'Heilkunde: Wunden' => ['WIS', 'Wissen'],
+ 'Heilkunde: Wunden' => ['WEI', 'Wissen'],
'Religionskunde' => ['INT', 'Wissen'],
'Verwaltung' => ['INT', 'Wissen'],
'Zauberkunde' => ['INT', 'Wissen'],
@@ -135,16 +148,17 @@ function bonus_class(int $value): string
return $value > 0 ? 'bonus-pos' : ($value < 0 ? 'bonus-neg' : 'bonus-zero');
}
-/** Attributkürzel (STR, DEX, …) prüfen; unbekannte Werte werden zu ''. */
+/** Attributkürzel (STR, GES, …) prüfen; unbekannte Werte werden zu ''. */
function skill_attribute_code(string $value): string
{
$code = strtoupper(trim($value));
- foreach (WS_ATTRIBUTES as $attribute) {
- if ($attribute[0] === $code) {
- return $code;
- }
- }
- return '';
+ return isset(WS_ATTRIBUTE_CODES[$code]) ? $code : '';
+}
+
+/** Spaltenname (attr_dex …) zu einem Attributkürzel; unbekannt → ''. */
+function attribute_field_for_code(string $code): string
+{
+ return WS_ATTRIBUTE_CODES[skill_attribute_code($code)] ?? '';
}
/**
diff --git a/westreiche_website/sql/schema.sql b/westreiche_website/sql/schema.sql
index 693a94c..9bb3078 100644
--- a/westreiche_website/sql/schema.sql
+++ b/westreiche_website/sql/schema.sql
@@ -128,7 +128,7 @@ CREATE TABLE IF NOT EXISTS characters (
CREATE TABLE IF NOT EXISTS skills (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(80) NOT NULL,
- attribute ENUM('STR', 'DEX', 'CON', 'INT', 'WIS', 'CHA', '') NOT NULL DEFAULT '',
+ attribute ENUM('STR', 'GES', 'KON', 'INT', 'WEI', 'CHA', '') NOT NULL DEFAULT '',
category VARCHAR(40) NOT NULL DEFAULT 'Allgemein',
description VARCHAR(255) NOT NULL DEFAULT '',
sort_order INT NOT NULL DEFAULT 0,
diff --git a/westreiche_website/views/admin_skills.php b/westreiche_website/views/admin_skills.php
index fb3bbe2..8735173 100644
--- a/westreiche_website/views/admin_skills.php
+++ b/westreiche_website/views/admin_skills.php
@@ -26,7 +26,7 @@
Attribut