- Each set has three pages (tabs with counters): equipment, skills (active and passive) and stigmas; the skill pages live in includes/gear_skills_view.php - Specializations of active skills like in the aion2hub planner: collapsible list with unlock level and effect, three from level 8, one from 12, one from 16; one slot at 8, two at 12, three at 20; locked options are disabled, lowering the level drops options that no longer fit (checked on the server too, stored as bitmask gear_set_skills.specs) - Stigmas: the chosen ones as the 4 slots on top, each stigma lists its four bonuses at 5/10/15/20 with effect, reached ones are highlighted - Admin: "Spezialisierungen & Stigma-Boni übernehmen" reads the build planner page, finds the JavaScript file with the data set (one request per second, remembers the file) and stores the effects of all classes (gear_skills.spec_effects); new page "Namen & Spezialisierungen" (admin/gear_skills.php) for German skill names and texts - Autosave sends level and specializations per skill card, the tab counter updates live; compare shows specializations, copies keep them - Schema version 39 (gear_skills.name_de, spec_effects, spec_names; gear_set_skills.specs), patch notes, README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
250 lines
16 KiB
PHP
250 lines
16 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
/**
|
||
* Gear-Planer: die Unterseiten "Skills" (aktive und passive Skills mit Stufe und Spezialisierungen)
|
||
* und "Stigmen" (bis zu GEAR_STIGMA_SLOTS Stigma-Skills mit Stufe) eines Sets - eingebunden von gear.php.
|
||
* Speichern: gear_action.php (save_skills), sofort per assets/js/gear.js.
|
||
*/
|
||
|
||
// Unterseiten eines Sets: Schluessel (gear.php?tab=…) => Beschriftung
|
||
const GEAR_SET_TABS = ['gear' => 'Ausrüstung', 'skills' => 'Skills', 'stigma' => 'Stigmen'];
|
||
|
||
/** Auswahl der Stufe eines Skills (0 = nicht geplant). */
|
||
function gear_skill_level_select(array $skill, int $level, bool $disabled): string
|
||
{
|
||
$html = '<select name="level[' . (int) $skill['id'] . ']" aria-label="Stufe von ' . e(gear_skill_display_name($skill)) . '" data-skill-level'
|
||
. ($disabled ? ' disabled title="Schon ' . GEAR_STIGMA_SLOTS . ' Stigmen ausgewählt"' : '') . '>'
|
||
. '<option value="0"' . ($level === 0 ? ' selected' : '') . '>–</option>';
|
||
foreach (gear_skill_level_groups($skill['kind']) as $groupLabel => $groupLevels) {
|
||
$html .= $groupLabel !== '' ? '<optgroup label="' . e($groupLabel) . '">' : '';
|
||
foreach ($groupLevels as $l) {
|
||
$html .= '<option value="' . $l . '"' . ($level === $l ? ' selected' : '') . '>' . $l . '</option>';
|
||
}
|
||
$html .= $groupLabel !== '' ? '</optgroup>' : '';
|
||
}
|
||
return $html . '</select>';
|
||
}
|
||
|
||
/** Eine Zeile einer Spezialisierung bzw. eines Stigma-Bonus: ab welcher Stufe, Effekt (englisch als Tooltip, wenn uebersetzt). */
|
||
function gear_skill_part_row(array $part, string $inner = ''): string
|
||
{
|
||
$title = ($part['en'] !== '' && $part['en'] !== $part['text'] ? $part['en'] : '') . ($part['kr'] ? ($part['en'] !== '' ? ' – ' : '') . 'Text aus den Korea-Daten' : '');
|
||
return $inner . '<span class="gear-part-level">' . (int) $part['t'] . '</span>'
|
||
. '<span class="gear-part-text"' . ($title !== '' ? ' title="' . e($title) . '"' : '') . '>' . e($part['text']) . '</span>'
|
||
. '<span class="gear-part-lock" aria-hidden="true">' . icon('lock') . '</span>';
|
||
}
|
||
|
||
/**
|
||
* Spezialisierungen eines aktiven Skills wie im aion2hub-Planer: aufklappbar mit Zaehler (gewaehlt/Plaetze),
|
||
* je Zeile "ab Stufe" und Effekt. Eigenes Set: zum Anhaken - gesperrt, was bei der Stufe noch nicht
|
||
* freigeschaltet ist oder keinen Platz mehr hat. Fremdes Set: nur die gewaehlten.
|
||
*/
|
||
function gear_skill_specs_html(array $skill, int $level, int $specs, bool $isOwn): string
|
||
{
|
||
$parts = gear_skill_parts($skill);
|
||
$chosen = gear_skill_spec_numbers($specs);
|
||
$slots = gear_skill_spec_slots($level);
|
||
if (!$isOwn) {
|
||
if (!$chosen) {
|
||
return '';
|
||
}
|
||
$html = '<ul class="gear-skill-parts-list">';
|
||
foreach ($chosen as $no) {
|
||
$html .= '<li class="gear-part is-on">' . gear_skill_part_row($parts[$no]) . '</li>';
|
||
}
|
||
return $html . '</ul>';
|
||
}
|
||
$html = '<details class="gear-skill-parts" data-skill-specs>'
|
||
. '<summary><span>Spezialisierungen</span><span class="gear-parts-count" data-spec-count>' . count($chosen) . '/' . $slots . '</span></summary>'
|
||
. '<input type="hidden" name="spec_sent[' . (int) $skill['id'] . ']" value="1">'
|
||
. '<p class="gear-parts-hint">Plätze ab Stufe ' . implode(' / ', array_reverse(array_keys(GEAR_SKILL_SPEC_SLOTS))) . ' – je Platz eine Spezialisierung.</p>';
|
||
foreach ($parts as $no => $part) {
|
||
$on = in_array($no, $chosen, true);
|
||
$locked = $level < $part['t'];
|
||
$full = !$on && count($chosen) >= $slots;
|
||
$html .= '<label class="gear-part' . ($on ? ' is-on' : '') . ($locked ? ' is-locked' : '') . '">'
|
||
. gear_skill_part_row($part, '<input type="checkbox" name="spec[' . (int) $skill['id'] . '][]" value="' . $no . '" data-unlock="' . (int) $part['t'] . '"'
|
||
. ($on ? ' checked' : '') . ($locked || $full ? ' disabled' : '') . '>')
|
||
. '</label>';
|
||
}
|
||
return $html . '</details>';
|
||
}
|
||
|
||
/** Die Boni eines Stigmas bei Stufe 5/10/15/20 als kleine Punkte hinter der Art (leuchten, sobald erreicht). */
|
||
function gear_stigma_perks_html(int $level): string
|
||
{
|
||
$html = '<span class="gear-stigma-perks" data-stigma-perks title="Boni bei Stufe ' . implode(', ', GEAR_STIGMA_PERKS) . ' (werden automatisch aktiv)">';
|
||
foreach (GEAR_STIGMA_PERKS as $perk) {
|
||
$html .= '<i class="' . ($level >= $perk ? 'is-on' : '') . '" data-perk="' . $perk . '"></i>';
|
||
}
|
||
return $html . '</span>';
|
||
}
|
||
|
||
/** Die Boni eines Stigmas mit Effekt, aufklappbar - erreichte leuchten (werden automatisch aktiv). */
|
||
function gear_stigma_perk_list_html(array $skill, int $level): string
|
||
{
|
||
$parts = gear_skill_parts($skill);
|
||
$reached = count(array_filter($parts, static fn (array $part): bool => $level >= $part['t']));
|
||
$html = '<details class="gear-skill-parts">'
|
||
. '<summary><span>Boni</span><span class="gear-parts-count" data-perk-count>' . $reached . '/' . count($parts) . '</span></summary>';
|
||
foreach ($parts as $part) {
|
||
$html .= '<div class="gear-part' . ($level >= $part['t'] ? ' is-on' : ' is-locked') . '" data-perk-row="' . (int) $part['t'] . '">'
|
||
. gear_skill_part_row($part) . '</div>';
|
||
}
|
||
return $html . '</details>';
|
||
}
|
||
|
||
/**
|
||
* Eine Unterseite ("skills" oder "stigma") eines Sets.
|
||
*/
|
||
function gear_render_skill_tab(array $set, string $tab, bool $isOwn, bool $canManage): void
|
||
{
|
||
$rows = gear_set_skill_rows((int) $set['id']);
|
||
$kinds = $tab === 'stigma' ? ['stigma'] : ['active', 'passive'];
|
||
// Skills, die aion2hub nicht mehr listet, nur zeigen, wenn sie in diesem Set eine Stufe haben
|
||
$classSkills = array_filter(
|
||
gear_skills_for_class($set['class_name'], false),
|
||
static fn (array $skill): bool => in_array($skill['kind'], $kinds, true)
|
||
&& ((int) $skill['is_listed'] === 1 || isset($rows[(int) $skill['id']]))
|
||
);
|
||
$planned = gear_skills_of_tab(gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [], $tab);
|
||
[$summary, $costs] = gear_skill_tab_summary($planned, $tab);
|
||
$stigmaPlanned = $tab === 'stigma' ? count($planned) : 0;
|
||
?>
|
||
<div class="panel gear-skills" id="skills">
|
||
<div class="gear-skills-head">
|
||
<h3><?= e(GEAR_SET_TABS[$tab]) ?><?= !empty($set['class_name']) ? ' · ' . e($set['class_name']) : '' ?></h3>
|
||
<?php if ($classSkills): ?>
|
||
<span class="text-muted" data-skill-summary><?= e($summary) ?></span>
|
||
<span class="gear-skill-costs" data-skill-costs><?= e($costs) ?></span>
|
||
<?php if ($isOwn): ?><span class="gear-save-status" data-skill-status aria-live="polite"></span><?php endif; ?>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if (empty($set['class_name'])): ?>
|
||
<p class="text-muted"><?= $isOwn ? 'Wähle unter „Bearbeiten“ eine Klasse für das Set – dann planst du hier ihre ' . e(GEAR_SET_TABS[$tab]) . '.' : 'Für dieses Set ist keine Klasse gewählt.' ?></p>
|
||
<?php elseif (!$classSkills): ?>
|
||
<p class="text-muted">
|
||
Für <?= e($set['class_name']) ?> sind noch keine Skills da<?= $canManage ? '' : ' – die Leitung muss sie erst übernehmen' ?>.
|
||
<?php if ($canManage): ?><a href="/admin/gear_items.php#skills">Jetzt von aion2hub übernehmen</a><?php endif; ?>
|
||
</p>
|
||
<?php else: ?>
|
||
<?php if ($tab === 'stigma'): ?>
|
||
<p class="gear-hint text-muted gear-skills-legend">
|
||
Stigma-Skills steigen mit Stigma-Splittern bis Stufe <?= GEAR_STIGMA_LEVEL_MAX ?>, ausrüsten kannst du höchstens
|
||
<?= GEAR_STIGMA_SLOTS ?> gleichzeitig. Bei Stufe <?= implode(', ', array_slice(GEAR_STIGMA_PERKS, 0, -1)) ?> und
|
||
<?= GEAR_STIGMA_PERKS[count(GEAR_STIGMA_PERKS) - 1] ?> schaltet jedes Stigma automatisch einen Bonus frei (unter dem Stigma aufklappen,
|
||
die Punkte zeigen die erreichten).
|
||
</p>
|
||
<details class="gear-skills-details">
|
||
<summary>Kosten und Stand der Daten</summary>
|
||
<p class="gear-hint text-muted">
|
||
Stigma-Splitter: Stufe 1–5 je 1, 6–10 je 2, 11–15 je 4, 16–20 je 8 – 75 bis Stufe 20. Stand: Global-Client des
|
||
Launch-Tests und offizieller Guide aus Korea (September 2026) – in Korea gibt es inzwischen mehr Plätze und Stufe 25,
|
||
nach dem Launch gleichen wir die Zahlen ab.
|
||
</p>
|
||
</details>
|
||
<?php // Die ausgeruesteten Stigmen wie im Spiel als Plaetze (aktualisiert assets/js/gear.js beim Aendern) ?>
|
||
<div class="gear-stigma-slots" data-stigma-bar>
|
||
<?php $slotted = array_values($planned); ?>
|
||
<?php for ($i = 0; $i < GEAR_STIGMA_SLOTS; $i++): ?>
|
||
<?php $entry = $slotted[$i] ?? null; ?>
|
||
<div class="gear-stigma-slot<?= $entry ? ' is-filled' : '' ?>">
|
||
<?php if ($entry): ?>
|
||
<?php $slotIcon = gear_skill_icon_url($entry['skill']); ?>
|
||
<span class="gear-skill-icon"><?php if ($slotIcon): ?><img src="<?= e($slotIcon) ?>" alt="" width="36" height="36"><?php endif; ?></span>
|
||
<span class="gear-stigma-slot-text"><strong><?= e(gear_skill_display_name($entry['skill'])) ?></strong><span>Stufe <?= (int) $entry['level'] ?></span></span>
|
||
<?php else: ?>
|
||
<span class="gear-stigma-slot-empty">Platz <?= $i + 1 ?> frei</span>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endfor; ?>
|
||
</div>
|
||
<?php else: ?>
|
||
<p class="gear-hint text-muted gear-skills-legend">
|
||
Aktive und passive Skills steigerst du mit Skillpunkten bis Stufe <?= GEAR_SKILL_LEVEL_SELF ?>, darüber nur mit Boni:
|
||
<span class="gear-skill-bonus-text">die Daevanion-Bretter geben bis +<?= GEAR_SKILL_DAEVANION_BONUS ?>, Ausrüstung und Arcana den Rest bis <?= GEAR_SKILL_LEVEL_MAX ?></span>.
|
||
Aktive Skills haben fünf Spezialisierungen (aufklappen unter dem Skill): drei ab Stufe 8, eine ab 12 und eine ab 16 –
|
||
einsetzen kannst du eine ab Stufe 8, zwei ab 12 und drei ab 20.
|
||
</p>
|
||
<details class="gear-skills-details">
|
||
<summary>Kosten und Stand der Daten</summary>
|
||
<p class="gear-hint text-muted">
|
||
Skillpunkte: Stufe 1 gibt es beim Lernen, Stufe 2–4 kosten je 1 Punkt, 5–7 je 2, 8–10 je 4 – also 21 Punkte bis
|
||
Stufe 10. Mit Stufe 45 hat man etwa 230–250 Skillpunkte, alle Skills auf 10 bräuchten gut 460.
|
||
Stand: Global-Client des Launch-Tests und offizieller Guide aus Korea (September 2026) – nach dem Launch gleichen
|
||
wir die Zahlen ab. Skill-Liste und die Effekte der Spezialisierungen aus dem Global-Client (über aion2hub, englisch);
|
||
deutsche Namen und Texte trägt die Leitung ein, sobald sie feststehen.
|
||
</p>
|
||
</details>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($isOwn): ?>
|
||
<form method="post" action="/gear_action.php" class="gear-skills-form" data-skills-autosave
|
||
data-self-max="<?= GEAR_SKILL_LEVEL_SELF ?>" data-stigma-slots="<?= GEAR_STIGMA_SLOTS ?>"
|
||
data-spec-slots="<?= e((string) json_encode(GEAR_SKILL_SPEC_SLOTS)) ?>">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="save_skills">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<input type="hidden" name="tab" value="<?= e($tab) ?>">
|
||
<?php endif; ?>
|
||
<?php foreach ($kinds as $kind): ?>
|
||
<?php $kindSkills = array_filter($classSkills, static fn (array $skill): bool => $skill['kind'] === $kind); ?>
|
||
<?php if (!$kindSkills) { continue; } ?>
|
||
<h4 class="gear-skills-kind">
|
||
<?= e(GEAR_SKILL_KINDS[$kind]) ?>
|
||
<?php if ($kind === 'stigma'): ?>
|
||
<span class="gear-skills-kind-count<?= $stigmaPlanned >= GEAR_STIGMA_SLOTS ? ' is-full' : '' ?>" data-stigma-count><?= $stigmaPlanned ?> von <?= GEAR_STIGMA_SLOTS ?> ausgewählt</span>
|
||
<?php endif; ?>
|
||
</h4>
|
||
<div class="gear-skill-grid">
|
||
<?php foreach ($kindSkills as $skill): ?>
|
||
<?php
|
||
$level = $rows[(int) $skill['id']]['level'] ?? 0;
|
||
$specs = $rows[(int) $skill['id']]['specs'] ?? 0;
|
||
$skillIcon = gear_skill_icon_url($skill);
|
||
$unlisted = (int) $skill['is_listed'] !== 1;
|
||
$displayName = gear_skill_display_name($skill);
|
||
?>
|
||
<div class="gear-skill<?= $level > 0 ? ' is-planned' : '' ?><?= gear_skill_is_bonus($kind, $level) ? ' is-bonus' : '' ?><?= $unlisted ? ' is-unlisted' : '' ?>"
|
||
data-skill data-skill-id="<?= (int) $skill['id'] ?>" data-kind="<?= e($kind) ?>">
|
||
<span class="gear-skill-icon">
|
||
<?php if ($skillIcon): ?>
|
||
<img src="<?= e($skillIcon) ?>" alt="" width="36" height="36" loading="lazy">
|
||
<?php else: ?>
|
||
<span class="gear-skill-initial"><?= e(mb_substr($displayName, 0, 1)) ?></span>
|
||
<?php endif; ?>
|
||
<span class="gear-skill-level" data-skill-badge><?= $level > 0 ? $level : '' ?></span>
|
||
</span>
|
||
<span class="gear-skill-info">
|
||
<span class="gear-skill-name" title="<?= e($displayName !== $skill['name'] ? $displayName . ' (' . $skill['name'] . ')' : $displayName) ?>"><?= e($displayName) ?></span>
|
||
<span class="gear-skill-cat <?= e(gear_skill_category_class($skill['category'])) ?>">
|
||
<?= $unlisted ? 'nicht mehr in der Liste' : e(gear_skill_category_label($skill['category'])) ?>
|
||
<?= $kind === 'stigma' ? gear_stigma_perks_html($level) : '' ?>
|
||
</span>
|
||
</span>
|
||
<?php if ($isOwn): ?>
|
||
<?= gear_skill_level_select($skill, $level, $kind === 'stigma' && $level === 0 && $stigmaPlanned >= GEAR_STIGMA_SLOTS) ?>
|
||
<?php else: ?>
|
||
<span class="gear-skill-level-text"><?= $level > 0 ? 'Stufe ' . $level : '–' ?></span>
|
||
<?php endif; ?>
|
||
<?php if (gear_skill_has_specs($kind)): ?>
|
||
<?= gear_skill_specs_html($skill, $level, $specs, $isOwn) ?>
|
||
<?php elseif ($kind === 'stigma'): ?>
|
||
<?= gear_stigma_perk_list_html($skill, $level) ?>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<?php if ($isOwn): ?>
|
||
<div class="actions gear-skills-actions">
|
||
<?php // Mit JavaScript speichert jede Aenderung sofort (assets/js/gear.js) - der Knopf verschwindet dann ?>
|
||
<button type="submit" class="button" data-autosave-fallback>Speichern</button>
|
||
</div>
|
||
</form>
|
||
<?php endif; ?>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php
|
||
}
|