Fertigkeiten: Praxispunkte (10 Kaestchen) und Wuergel je Fertigkeitsstufe in Bogen und PDF
This commit is contained in:
parent
3a5d366aba
commit
85fd24a0f0
10 changed files with 185 additions and 7 deletions
|
|
@ -58,6 +58,14 @@ zauberturm.de: Nachtblau/Schwarz/Gold, Pergament, Animationen.
|
||||||
`WS_SAVE_TABLES` (`app/rules.php`, OSE-SRD-Werte, Westreiche-Klassen auf die
|
`WS_SAVE_TABLES` (`app/rules.php`, OSE-SRD-Werte, Westreiche-Klassen auf die
|
||||||
Grundklassen abgebildet) und werden bei Stufen-/Klassenwechsel neu gesetzt.
|
Grundklassen abgebildet) und werden bei Stufen-/Klassenwechsel neu gesetzt.
|
||||||
**Falls der SL eigene RW-Tabellen führt: dort in `app/rules.php` ändern**,
|
**Falls der SL eigene RW-Tabellen führt: dort in `app/rules.php` ändern**,
|
||||||
|
- **Praxispunkte (PP):** `character_skills.pp` (TINYINT 0–10, Migration 7) – im
|
||||||
|
Bogen zehn ankreuzbare Kästchen je Fertigkeit, Klick speichert per fetch auf
|
||||||
|
`/characters/<id>/skills/<skill>/pp` (`character_skill_set_pp()`); ohne JS
|
||||||
|
läuft dasselbe Formular als normaler POST mit Redirect auf `#fertigkeiten`.
|
||||||
|
- **Fertigkeitswürfel:** `skill_die()`/`skill_tier()` in `app/rules.php`
|
||||||
|
(`WS_SKILL_DICE`): Stufe 0 = W4 (ungelernt), 1 = W6, 2 = W8, 3 = W10,
|
||||||
|
4 = W12, 5 = 2W6, 6+ = 3W6. Der Würfel steht im HTML-Bogen und im PDF
|
||||||
|
(`app/sheet.php`, Spalte rechts neben Stufe; PP-Kästchen ganz rechts).
|
||||||
nicht in der DB.
|
nicht in der DB.
|
||||||
- **Trefferpunkte:** berechnet aus Einzelwürfen – `1W4` für Stufe 0 + je
|
- **Trefferpunkte:** berechnet aus Einzelwürfen – `1W4` für Stufe 0 + je
|
||||||
Stufenlevel `1W<Klassenwürfel>` (`WS_HIT_DICE`: Kämpferklassen W8, Kleriker
|
Stufenlevel `1W<Klassenwürfel>` (`WS_HIT_DICE`: Kämpferklassen W8, Kleriker
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ function skills_catalog_delete(int $id): void
|
||||||
function character_skills(int $characterId): array
|
function character_skills(int $characterId): array
|
||||||
{
|
{
|
||||||
$stmt = db()->prepare(
|
$stmt = db()->prepare(
|
||||||
"SELECT cs.id, cs.character_id, cs.skill_id, cs.name, cs.bonus, cs.note,
|
"SELECT cs.id, cs.character_id, cs.skill_id, cs.name, cs.bonus, cs.note, cs.pp,
|
||||||
COALESCE(NULLIF(cs.attribute, ''), s.attribute) AS attribute,
|
COALESCE(NULLIF(cs.attribute, ''), s.attribute) AS attribute,
|
||||||
s.category
|
s.category
|
||||||
FROM character_skills cs
|
FROM character_skills cs
|
||||||
|
|
@ -378,6 +378,35 @@ function character_skill_add(int $characterId, ?int $skillId, string $name, int
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Praxispunkte einer Fertigkeit setzen (0 … WS_SKILL_PRACTICE_SLOTS).
|
||||||
|
*
|
||||||
|
* Klick auf das zuletzt gefüllte Kästchen nimmt den Punkt wieder weg, deshalb
|
||||||
|
* toggelt die Funktion bei gleichem Wert auf eins weniger.
|
||||||
|
*
|
||||||
|
* @return int gespeicherter Wert
|
||||||
|
*/
|
||||||
|
function character_skill_set_pp(int $characterId, int $id, int $pp): int
|
||||||
|
{
|
||||||
|
$current = character_skill_pp($characterId, $id);
|
||||||
|
$pp = max(0, min(WS_SKILL_PRACTICE_SLOTS, $pp));
|
||||||
|
if ($current !== null && $pp === $current) {
|
||||||
|
$pp = max(0, $pp - 1);
|
||||||
|
}
|
||||||
|
db()->prepare('UPDATE character_skills SET pp = ? WHERE id = ? AND character_id = ?')
|
||||||
|
->execute([$pp, $id, $characterId]);
|
||||||
|
return $pp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gespeicherte Praxispunkte einer Fertigkeit; null, wenn sie nicht existiert. */
|
||||||
|
function character_skill_pp(int $characterId, int $id): ?int
|
||||||
|
{
|
||||||
|
$stmt = db()->prepare('SELECT pp FROM character_skills WHERE id = ? AND character_id = ? LIMIT 1');
|
||||||
|
$stmt->execute([$id, $characterId]);
|
||||||
|
$value = $stmt->fetchColumn();
|
||||||
|
return $value === false ? null : (int) $value;
|
||||||
|
}
|
||||||
|
|
||||||
function character_skill_delete(int $characterId, int $id): void
|
function character_skill_delete(int $characterId, int $id): void
|
||||||
{
|
{
|
||||||
db()->prepare('DELETE FROM character_skills WHERE id = ? AND character_id = ?')->execute([$id, $characterId]);
|
db()->prepare('DELETE FROM character_skills WHERE id = ? AND character_id = ?')->execute([$id, $characterId]);
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,10 @@ const WS_MIGRATIONS = [
|
||||||
6 => [
|
6 => [
|
||||||
"ALTER TABLE characters ADD COLUMN IF NOT EXISTS hp_rolls VARCHAR(160) NOT NULL DEFAULT '' AFTER hp_max",
|
"ALTER TABLE characters ADD COLUMN IF NOT EXISTS hp_rolls VARCHAR(160) NOT NULL DEFAULT '' AFTER hp_max",
|
||||||
],
|
],
|
||||||
|
// 7: Praxispunkte je Fertigkeit (Bogen-Spalte „PP", 0 … 10 ankreuzbar).
|
||||||
|
7 => [
|
||||||
|
'ALTER TABLE character_skills ADD COLUMN IF NOT EXISTS pp TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER note',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
function ws_migrations_apply(PDO $pdo): void
|
function ws_migrations_apply(PDO $pdo): void
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,29 @@ function page_handle(string $method, string $path): void
|
||||||
flash('info', '„' . $character['name'] . '“ wurde gelöscht.');
|
flash('info', '„' . $character['name'] . '“ wurde gelöscht.');
|
||||||
redirect('/');
|
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) {
|
if (preg_match('#^/characters/(\d+)/skills/(add|\d+/delete)$#', $path, $m) === 1) {
|
||||||
require_post();
|
require_post();
|
||||||
$character = character_require((int) $m[1], $user);
|
$character = character_require((int) $m[1], $user);
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,16 @@ const WS_SKILL_CATALOG = [
|
||||||
'Zauberkunde' => ['INT', 'Wissen'],
|
'Zauberkunde' => ['INT', 'Wissen'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fertigkeitsstufen des Charakterbogens (RPG/6-Dokumente/Charakterbogen.pdf):
|
||||||
|
* Index = Stufe. Stufe 0 = ungelernt, ab Stufe 6 immer 3W6.
|
||||||
|
*/
|
||||||
|
const WS_SKILL_DICE = ['W4', 'W6', 'W8', 'W10', 'W12', '2W6', '3W6'];
|
||||||
|
const WS_SKILL_TIERS = ['ungelernt', 'Anfänger', 'Geselle', 'Könner', 'Profi', 'Meister', 'Großmeister'];
|
||||||
|
|
||||||
|
/** Ankreuzbare Praxispunkte je Fertigkeit (Bogen-Spalte „PP"). */
|
||||||
|
const WS_SKILL_PRACTICE_SLOTS = 10;
|
||||||
|
|
||||||
const WS_CHARACTER_STATUS = [
|
const WS_CHARACTER_STATUS = [
|
||||||
'active' => 'im Spiel',
|
'active' => 'im Spiel',
|
||||||
'dead' => 'gefallen',
|
'dead' => 'gefallen',
|
||||||
|
|
@ -148,6 +158,26 @@ function bonus_class(int $value): string
|
||||||
return $value > 0 ? 'bonus-pos' : ($value < 0 ? 'bonus-neg' : 'bonus-zero');
|
return $value > 0 ? 'bonus-pos' : ($value < 0 ? 'bonus-neg' : 'bonus-zero');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stufe einer Fertigkeit auf die Würfelleiter abbilden (0 … 6).
|
||||||
|
*/
|
||||||
|
function skill_tier_index(int $level): int
|
||||||
|
{
|
||||||
|
return max(0, min(count(WS_SKILL_DICE) - 1, $level));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Würfel der Fertigkeitsstufe, z. B. Stufe 3 → „W10". */
|
||||||
|
function skill_die(int $level): string
|
||||||
|
{
|
||||||
|
return WS_SKILL_DICE[skill_tier_index($level)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Bezeichnung der Fertigkeitsstufe, z. B. Stufe 0 → „ungelernt". */
|
||||||
|
function skill_tier(int $level): string
|
||||||
|
{
|
||||||
|
return WS_SKILL_TIERS[skill_tier_index($level)];
|
||||||
|
}
|
||||||
|
|
||||||
/** Attributkürzel (STR, GES, …) prüfen; unbekannte Werte werden zu ''. */
|
/** Attributkürzel (STR, GES, …) prüfen; unbekannte Werte werden zu ''. */
|
||||||
function skill_attribute_code(string $value): string
|
function skill_attribute_code(string $value): string
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -334,19 +334,37 @@ function character_pdf(array $c, array $extra): string
|
||||||
$skill = $rows[$index];
|
$skill = $rows[$index];
|
||||||
$cx = $M + $col * ($colW + 16);
|
$cx = $M + $col * ($colW + 16);
|
||||||
$mod = skill_attribute_modifier($c, $skill);
|
$mod = skill_attribute_modifier($c, $skill);
|
||||||
|
$right = $cx + $colW;
|
||||||
$skillName = shorten((string) $skill['name'], 34);
|
$skillName = shorten((string) $skill['name'], 34);
|
||||||
$pdf->text($cx, $y + 8.5, 8.4, 'F3', $ink, $skillName);
|
$pdf->text($cx, $y + 8.5, 8.4, 'F3', $ink, $skillName);
|
||||||
$skillNote = trim((string) ($skill['note'] ?? ''));
|
$skillNote = trim((string) ($skill['note'] ?? ''));
|
||||||
if ($skillNote !== '') {
|
if ($skillNote !== '') {
|
||||||
$noteX = $cx + WsPdf::textWidth($skillName, 8.4, 'F3') + 6;
|
$noteX = $cx + WsPdf::textWidth($skillName, 8.4, 'F3') + 6;
|
||||||
$noteLimit = $cx + $colW - 84;
|
$noteLimit = $right - 128;
|
||||||
if ($noteLimit - $noteX > 26) {
|
if ($noteLimit - $noteX > 26) {
|
||||||
$pdf->text($noteX, $y + 8.4, 6.8, 'F1', $soft, WsPdf::fit($skillNote, 6.8, 'F1', $noteLimit - $noteX));
|
$pdf->text($noteX, $y + 8.4, 6.8, 'F1', $soft, WsPdf::fit($skillNote, 6.8, 'F1', $noteLimit - $noteX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pdf->text($cx + $colW - 64, $y + 8.2, 6.6, 'F1', $soft, trim((string) ($skill['attribute'] ?? '')));
|
$pdf->textRight($right - 112, $y + 8.2, 6.6, 'F1', $soft, trim((string) ($skill['attribute'] ?? '')));
|
||||||
$pdf->textRight($cx + $colW - 28, $y + 8.2, 6.8, 'F1', $soft, $mod === null ? '–' : signed($mod));
|
$pdf->textRight($right - 92, $y + 8.2, 6.8, 'F1', $soft, $mod === null ? '–' : signed($mod));
|
||||||
$pdf->textRight($cx + $colW, $y + 8.5, 8.4, 'F2', $gold, (string) max(0, (int) $skill['bonus']));
|
$pdf->textRight($right - 74, $y + 8.5, 8.4, 'F2', $gold, (string) max(0, (int) $skill['bonus']));
|
||||||
|
// Würfel der Fertigkeitsstufe (W4 ungelernt … 3W6 Großmeister)
|
||||||
|
$pdf->textRight($right, $y + 8.3, 7.0, 'F2', $ink, skill_die((int) $skill['bonus']));
|
||||||
|
// Praxispunkte: 10 ankreuzbare Kästchen
|
||||||
|
$pp = max(0, min(WS_SKILL_PRACTICE_SLOTS, (int) ($skill['pp'] ?? 0)));
|
||||||
|
$slotW = 4.2;
|
||||||
|
$slotGap = 0.9;
|
||||||
|
$slotH = 5.4;
|
||||||
|
$slotsRight = $right - 22;
|
||||||
|
$slotsLeft = $slotsRight - (WS_SKILL_PRACTICE_SLOTS * $slotW + (WS_SKILL_PRACTICE_SLOTS - 1) * $slotGap);
|
||||||
|
for ($slot = 1; $slot <= WS_SKILL_PRACTICE_SLOTS; $slot++) {
|
||||||
|
$sx = $slotsLeft + ($slot - 1) * ($slotW + $slotGap);
|
||||||
|
if ($slot <= $pp) {
|
||||||
|
$pdf->rect($sx, $y + 4.6, $slotW, $slotH, $gold, $gold, 0.2);
|
||||||
|
} else {
|
||||||
|
$pdf->rect($sx, $y + 4.6, $slotW, $slotH, null, $goldLight, 0.25);
|
||||||
|
}
|
||||||
|
}
|
||||||
$pdf->line($cx, $y + 10.4, $cx + $colW, $y + 10.4, $goldLight, 0.22);
|
$pdf->line($cx, $y + 10.4, $cx + $colW, $y + 10.4, $goldLight, 0.22);
|
||||||
}
|
}
|
||||||
$y += 12.6;
|
$y += 12.6;
|
||||||
|
|
|
||||||
|
|
@ -813,6 +813,24 @@ input[type="file"] {
|
||||||
MOD (regulär) und STUFE (fett) exakt auf gleicher Höhe stehen. */
|
MOD (regulär) und STUFE (fett) exakt auf gleicher Höhe stehen. */
|
||||||
.skill-table td.num { vertical-align: baseline; }
|
.skill-table td.num { vertical-align: baseline; }
|
||||||
|
|
||||||
|
/* Würfelspalte und ankreuzbare Praxispunkte (PP) */
|
||||||
|
.skill-table th.die, .skill-table td.die { width: 3.4rem; white-space: nowrap; }
|
||||||
|
.skill-table td.pp-cell { white-space: nowrap; vertical-align: baseline; }
|
||||||
|
.pp-slots { display: inline-flex; gap: 0.16rem; margin: 0; padding: 0; border: 0; }
|
||||||
|
.pp-slot {
|
||||||
|
width: 0.68rem;
|
||||||
|
height: 0.68rem;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid rgba(201, 162, 39, 0.55);
|
||||||
|
border-radius: 2px;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.12s ease, border-color 0.12s ease;
|
||||||
|
}
|
||||||
|
.pp-slot:hover { border-color: var(--gold); }
|
||||||
|
.pp-slot.is-filled { background: var(--gold); border-color: var(--gold); }
|
||||||
|
.pp-slot:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
|
||||||
|
|
||||||
/* --- Boni: positiv grün, null grau, negativ rot ------------------------- */
|
/* --- Boni: positiv grün, null grau, negativ rot ------------------------- */
|
||||||
.bonus-pos { color: #79d29a; }
|
.bonus-pos { color: #79d29a; }
|
||||||
.bonus-zero { color: var(--parchment-dim); }
|
.bonus-zero { color: var(--parchment-dim); }
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,36 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Praxispunkte im Charakterbogen: Klick setzt die Punkte ohne Reload
|
||||||
|
document.addEventListener('submit', async function (event) {
|
||||||
|
const form = event.target.closest('[data-pp-form]');
|
||||||
|
if (!form) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
const pressed = event.submitter;
|
||||||
|
const want = pressed ? parseInt(pressed.value, 10) || 0 : 0;
|
||||||
|
try {
|
||||||
|
const response = await fetch(form.action, {
|
||||||
|
method: 'POST',
|
||||||
|
body: new FormData(form),
|
||||||
|
headers: { 'X-Requested-With': 'fetch' }
|
||||||
|
});
|
||||||
|
const data = await response.json();
|
||||||
|
if (!data || data.ok !== true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
form.querySelectorAll('.pp-slot').forEach(function (slot) {
|
||||||
|
const value = parseInt(slot.value, 10) || 0;
|
||||||
|
const filled = value <= data.pp;
|
||||||
|
slot.classList.toggle('is-filled', filled);
|
||||||
|
slot.setAttribute('aria-pressed', filled ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Selektor-Schirme: Fertigkeiten und Zauber aus dem Katalog wählen
|
// Selektor-Schirme: Fertigkeiten und Zauber aus dem Katalog wählen
|
||||||
// Blendet Überschriften aus, wenn keine ihrer Einträge sichtbar ist.
|
// Blendet Überschriften aus, wenn keine ihrer Einträge sichtbar ist.
|
||||||
const hideEmptyGroups = function (dialog) {
|
const hideEmptyGroups = function (dialog) {
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,7 @@ CREATE TABLE IF NOT EXISTS character_skills (
|
||||||
attribute VARCHAR(3) NOT NULL DEFAULT '',
|
attribute VARCHAR(3) NOT NULL DEFAULT '',
|
||||||
bonus SMALLINT NOT NULL DEFAULT 0,
|
bonus SMALLINT NOT NULL DEFAULT 0,
|
||||||
note VARCHAR(255) NOT NULL DEFAULT '',
|
note VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
|
pp TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY uq_character_skills (character_id, name),
|
UNIQUE KEY uq_character_skills (character_id, name),
|
||||||
CONSTRAINT fk_character_skills_character FOREIGN KEY (character_id) REFERENCES characters (id) ON DELETE CASCADE,
|
CONSTRAINT fk_character_skills_character FOREIGN KEY (character_id) REFERENCES characters (id) ON DELETE CASCADE,
|
||||||
|
|
|
||||||
|
|
@ -157,23 +157,40 @@ $equipped = array_values(array_filter($items, static fn ($item) => (int) $item['
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel" id="fertigkeiten">
|
||||||
<h2>Fertigkeiten</h2>
|
<h2>Fertigkeiten</h2>
|
||||||
|
<p class="muted" style="margin-top:0">
|
||||||
|
Die Stufe bestimmt den Würfel: 0 = W4 (ungelernt), 1 = W6, 2 = W8, 3 = W10,
|
||||||
|
4 = W12, 5 = 2W6, 6+ = 3W6. Die Kästchen sind die Praxispunkte (max. <?= (int) WS_SKILL_PRACTICE_SLOTS ?>).
|
||||||
|
</p>
|
||||||
<?php if ($skills === []): ?>
|
<?php if ($skills === []): ?>
|
||||||
<p class="muted">Noch keine Fertigkeiten eingetragen. <a href="<?= e($base . '/edit#fertigkeiten') ?>">Ergänzen</a></p>
|
<p class="muted">Noch keine Fertigkeiten eingetragen. <a href="<?= e($base . '/edit#fertigkeiten') ?>">Ergänzen</a></p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php foreach (skills_grouped($skills) as $group => $groupSkills): ?>
|
<?php foreach (skills_grouped($skills) as $group => $groupSkills): ?>
|
||||||
<h3 class="skill-group"><?= e($group) ?></h3>
|
<h3 class="skill-group"><?= e($group) ?></h3>
|
||||||
<table class="data skill-table">
|
<table class="data skill-table">
|
||||||
<thead><tr><th>Fertigkeit</th><th>Attribut</th><th class="num">MOD</th><th class="num">Stufe</th><th>Notiz</th></tr></thead>
|
<thead><tr><th>Fertigkeit</th><th>Attribut</th><th class="num">MOD</th><th class="num">Stufe</th><th class="num">Würfel</th><th>PP</th><th>Notiz</th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($groupSkills as $skill): ?>
|
<?php foreach ($groupSkills as $skill): ?>
|
||||||
<?php $mod = skill_attribute_modifier($character, $skill); ?>
|
<?php $mod = skill_attribute_modifier($character, $skill); ?>
|
||||||
|
<?php $pp = max(0, min(WS_SKILL_PRACTICE_SLOTS, (int) ($skill['pp'] ?? 0))); ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="skill-name"><?= e((string) $skill['name']) ?></td>
|
<td class="skill-name"><?= e((string) $skill['name']) ?></td>
|
||||||
<td class="muted"><?= e((string) ($skill['attribute'] ?? '')) ?></td>
|
<td class="muted"><?= e((string) ($skill['attribute'] ?? '')) ?></td>
|
||||||
<td class="num <?= $mod === null ? 'muted' : bonus_class($mod) ?>"><?= $mod === null ? '–' : e(signed($mod)) ?></td>
|
<td class="num <?= $mod === null ? 'muted' : bonus_class($mod) ?>"><?= $mod === null ? '–' : e(signed($mod)) ?></td>
|
||||||
<td class="num <?= bonus_class((int) $skill['bonus']) ?>"><b><?= max(0, (int) $skill['bonus']) ?></b></td>
|
<td class="num <?= bonus_class((int) $skill['bonus']) ?>"><b><?= max(0, (int) $skill['bonus']) ?></b></td>
|
||||||
|
<td class="num die"><b><?= e(skill_die((int) $skill['bonus'])) ?></b></td>
|
||||||
|
<td class="pp-cell">
|
||||||
|
<form method="post" action="<?= e($base . '/skills/' . (int) $skill['id'] . '/pp') ?>" class="pp-slots" data-pp-form aria-label="Praxispunkte <?= e((string) $skill['name']) ?>">
|
||||||
|
<?= csrf_field() ?>
|
||||||
|
<?php for ($slot = 1; $slot <= WS_SKILL_PRACTICE_SLOTS; $slot++): ?>
|
||||||
|
<button type="submit" name="pp" value="<?= $slot ?>"
|
||||||
|
class="pp-slot<?= $slot <= $pp ? ' is-filled' : '' ?>"
|
||||||
|
title="<?= $slot ?> Praxispunkt<?= $slot === 1 ? '' : 'e' ?>"
|
||||||
|
aria-pressed="<?= $slot <= $pp ? 'true' : 'false' ?>"></button>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
<td class="muted"><?= e((string) $skill['note']) ?></td>
|
<td class="muted"><?= e((string) $skill['note']) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue