Fertigkeiten: Praxispunkte (10 Kaestchen) und Wuergel je Fertigkeitsstufe in Bogen und PDF

This commit is contained in:
torsten 2026-11-22 19:31:30 +01:00
parent 3a5d366aba
commit 85fd24a0f0
10 changed files with 185 additions and 7 deletions

View file

@ -132,6 +132,29 @@ function page_handle(string $method, string $path): void
flash('info', '„' . $character['name'] . '“ wurde gelöscht.');
redirect('/');
}
if (preg_match('#^/characters/(\d+)/skills/(\d+)/pp$#', $path, $m) === 1) {
require_post();
$character = character_require((int) $m[1], $user);
$wantsJson = strtolower((string) ($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '')) === 'fetch';
if (!csrf_valid()) {
if ($wantsJson) {
http_response_code(419);
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['ok' => false, 'error' => 'Sitzung abgelaufen.'], JSON_UNESCAPED_UNICODE);
return;
}
flash('error', 'Die Sitzung ist abgelaufen. Bitte erneut versuchen.');
redirect('/characters/' . $character['id'] . '#fertigkeiten');
}
$pp = max(0, min(WS_SKILL_PRACTICE_SLOTS, post_int('pp', 0)));
$pp = character_skill_set_pp((int) $character['id'], (int) $m[2], $pp);
if ($wantsJson) {
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['ok' => true, 'pp' => $pp], JSON_UNESCAPED_UNICODE);
return;
}
redirect('/characters/' . $character['id'] . '#fertigkeiten');
}
if (preg_match('#^/characters/(\d+)/skills/(add|\d+/delete)$#', $path, $m) === 1) {
require_post();
$character = character_require((int) $m[1], $user);