Charakterverwalter: Stufe aus Erfahrungspunkten und Klasse ableiten (WS_XP_TABLES)
This commit is contained in:
parent
f21b714d82
commit
b4d4c53dd4
8 changed files with 138 additions and 11 deletions
|
|
@ -477,7 +477,6 @@ function character_form_values(array $source): array
|
|||
$values['name'] = post_string('name', (string) ($source['name'] ?? ''));
|
||||
$values['title'] = post_string('title', (string) ($source['title'] ?? ''));
|
||||
$values['class_name'] = post_string('class_name', (string) ($source['class_name'] ?? 'Kämpfer'));
|
||||
$values['level'] = max(1, min(20, post_int('level', (int) ($source['level'] ?? 1))));
|
||||
$values['xp'] = max(0, post_int('xp', (int) ($source['xp'] ?? 0)));
|
||||
$values['hp_max'] = max(1, post_int('hp_max', (int) ($source['hp_max'] ?? 1)));
|
||||
$values['hp_current'] = post_int('hp_current', (int) ($source['hp_current'] ?? $values['hp_max']));
|
||||
|
|
@ -500,6 +499,9 @@ function character_form_values(array $source): array
|
|||
if (!in_array($values['class_name'], WS_CLASSES, true)) {
|
||||
$values['class_name'] = 'Kämpfer';
|
||||
}
|
||||
// Stufe wird aus Erfahrungspunkten und Klasse abgeleitet (WS_XP_TABLES) –
|
||||
// sie ist kein eigenes Eingabefeld mehr.
|
||||
$values['level'] = level_for_xp((string) $values['class_name'], (int) $values['xp']);
|
||||
foreach (WS_SAVES as $field => $label) {
|
||||
// Auf GET (Formular anzeigen) gilt der gespeicherte Wert; nur ein
|
||||
// tatsächlich abgeschicktes Feld überschreibt ihn.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue