Bearbeiten-Modus: Wuergel und Praxispunkte je Fertigkeit anzeigen und setzen

This commit is contained in:
torsten 2026-11-22 19:34:15 +01:00
parent 85fd24a0f0
commit 3795c517fb
2 changed files with 21 additions and 2 deletions

View file

@ -136,6 +136,9 @@ function page_handle(string $method, string $path): void
require_post();
$character = character_require((int) $m[1], $user);
$wantsJson = strtolower((string) ($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '')) === 'fetch';
$back = post_string('back') === 'edit'
? '/characters/' . $character['id'] . '/edit#fertigkeiten'
: '/characters/' . $character['id'] . '#fertigkeiten';
if (!csrf_valid()) {
if ($wantsJson) {
http_response_code(419);
@ -144,7 +147,7 @@ function page_handle(string $method, string $path): void
return;
}
flash('error', 'Die Sitzung ist abgelaufen. Bitte erneut versuchen.');
redirect('/characters/' . $character['id'] . '#fertigkeiten');
redirect($back);
}
$pp = max(0, min(WS_SKILL_PRACTICE_SLOTS, post_int('pp', 0)));
$pp = character_skill_set_pp((int) $character['id'], (int) $m[2], $pp);
@ -153,7 +156,7 @@ function page_handle(string $method, string $path): void
echo json_encode(['ok' => true, 'pp' => $pp], JSON_UNESCAPED_UNICODE);
return;
}
redirect('/characters/' . $character['id'] . '#fertigkeiten');
redirect($back);
}
if (preg_match('#^/characters/(\d+)/skills/(add|\d+/delete)$#', $path, $m) === 1) {
require_post();