- 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>
136 lines
7.7 KiB
PHP
136 lines
7.7 KiB
PHP
<?php
|
|
/**
|
|
* Gear-Planer, Skills: deutsche Namen und deutsche Texte der Spezialisierungen bzw. Stigma-Boni je Klasse
|
|
* eintragen. aion2hub liefert beides nur englisch - die Leitung schreibt es aus dem Spiel ab (gespeichert in
|
|
* gear_skills.name_de / spec_names, Anzeige ueber includes/gear_skills.php).
|
|
*/
|
|
require_once __DIR__ . '/../includes/bootstrap.php';
|
|
require_once __DIR__ . '/../includes/gear.php';
|
|
require_permission('gear.manage');
|
|
|
|
const GEAR_SKILL_NAME_MAX = 100;
|
|
|
|
$status = gear_skill_catalog_status();
|
|
$className = (string) ($_GET['class'] ?? $_POST['class'] ?? '');
|
|
if (!in_array($className, AION_CLASSES, true)) {
|
|
// Ohne Angabe die erste Klasse, fuer die es schon Skills gibt
|
|
$className = '';
|
|
foreach ($status as $class => $row) {
|
|
if ($row['active'] + $row['stigma'] + $row['passive'] > 0) {
|
|
$className = $class;
|
|
break;
|
|
}
|
|
}
|
|
$className = $className ?: AION_CLASSES[0];
|
|
}
|
|
$skills = gear_skills_for_class($className, false);
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
verify_csrf();
|
|
$clean = static fn ($value): string => mb_substr(trim(preg_replace('/\s+/u', ' ', is_string($value) ? $value : '') ?? ''), 0, GEAR_SKILL_NAME_MAX);
|
|
$germanInput = is_array($_POST['name_de'] ?? null) ? $_POST['name_de'] : [];
|
|
$specInput = is_array($_POST['spec_name'] ?? null) ? $_POST['spec_name'] : [];
|
|
$update = db()->prepare('UPDATE gear_skills SET name_de = ?, spec_names = ? WHERE id = ?');
|
|
$changed = [];
|
|
foreach ($skills as $id => $skill) {
|
|
$german = $clean($germanInput[$id] ?? '');
|
|
$specs = null;
|
|
$levels = gear_skill_part_levels($skill['kind']);
|
|
if ($levels) {
|
|
$names = [];
|
|
foreach (array_keys($levels) as $no) {
|
|
$names[] = $clean($specInput[$id][$no] ?? '');
|
|
}
|
|
$specs = array_filter($names, static fn (string $name): bool => $name !== '') ? json_encode($names, JSON_UNESCAPED_UNICODE) : null;
|
|
}
|
|
if ($german !== (string) ($skill['name_de'] ?? '') || $specs !== ($skill['spec_names'] ?? null)) {
|
|
$update->execute([$german !== '' ? $german : null, $specs, $id]);
|
|
$changed[] = $german !== '' ? $german : $skill['name'];
|
|
}
|
|
}
|
|
if ($changed) {
|
|
admin_log('🗡️ Gear-Planer: Skill-Namen bearbeitet', [
|
|
'Klasse' => $className,
|
|
'Skills' => implode(', ', array_slice($changed, 0, 15)) . (count($changed) > 15 ? ' … (' . count($changed) . ')' : ''),
|
|
], 'info', 'gear');
|
|
set_flash('success', count($changed) . (count($changed) === 1 ? ' Skill' : ' Skills') . ' gespeichert.');
|
|
} else {
|
|
set_flash('info', 'Nichts geändert.');
|
|
}
|
|
redirect('/admin/gear_skills.php?class=' . rawurlencode($className));
|
|
}
|
|
|
|
$pageTitle = 'Gear-Planer: Skill-Namen';
|
|
$containerWide = true;
|
|
include __DIR__ . '/../includes/header.php';
|
|
?>
|
|
<div class="panel">
|
|
<h1>Gear-Planer: Skill-Namen</h1>
|
|
<p class="text-muted">
|
|
aion2hub liefert die Skills und die Effekte der Spezialisierungen bzw. Stigma-Boni nur auf Englisch (im Feld als
|
|
grauer Text). Hier trägst du die deutschen Namen und Texte ein, so wie sie im Spiel stehen - im Planer erscheinen sie
|
|
dann statt der englischen. Leer lassen = englisch. Die Reihenfolge ist die im Spiel.
|
|
</p>
|
|
<div class="gear-skill-classes">
|
|
<?php foreach (AION_CLASSES as $class): ?>
|
|
<?php $count = $status[$class]['active'] + $status[$class]['stigma'] + $status[$class]['passive']; ?>
|
|
<a class="gear-tab<?= $class === $className ? ' is-active' : '' ?>" href="/admin/gear_skills.php?class=<?= e(rawurlencode($class)) ?>">
|
|
<?= class_badge_html($class, 18) ?> <?= e($class) ?> <span class="gear-tab-count"><?= $count ?></span>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<p><a href="/admin/gear_items.php#skills">← Skills übernehmen / abgleichen</a></p>
|
|
</div>
|
|
|
|
<div class="panel">
|
|
<?php if (!$skills): ?>
|
|
<p class="text-muted">Für <?= e($className) ?> sind noch keine Skills da - zuerst unter <a href="/admin/gear_items.php#skills">Gegenstände & Skills</a> von aion2hub übernehmen.</p>
|
|
<?php else: ?>
|
|
<form method="post" action="/admin/gear_skills.php?class=<?= e(rawurlencode($className)) ?>">
|
|
<?= csrf_field() ?>
|
|
<input type="hidden" name="class" value="<?= e($className) ?>">
|
|
<?php foreach (GEAR_SKILL_KINDS as $kind => $kindLabel): ?>
|
|
<?php $kindSkills = array_filter($skills, static fn (array $skill): bool => $skill['kind'] === $kind); ?>
|
|
<?php if (!$kindSkills) { continue; } ?>
|
|
<h2 class="gear-skills-kind"><?= e($kindLabel) ?></h2>
|
|
<div class="table-scroll">
|
|
<table class="gear-admin-table gear-skill-names">
|
|
<thead>
|
|
<tr>
|
|
<th>Skill (aion2hub)</th>
|
|
<th>Deutscher Name</th>
|
|
<?php foreach (gear_skill_part_levels($kind) as $no => $unlock): ?>
|
|
<th><?= $kind === 'stigma' ? 'Bonus ab ' . $unlock : 'Spez. ' . GEAR_SKILL_SPEC_NUMERALS[$no] . ' (ab ' . $unlock . ')' ?></th>
|
|
<?php endforeach; ?>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($kindSkills as $id => $skill): ?>
|
|
<?php $specNames = gear_skill_spec_names($skill); $parts = gear_skill_parts($skill); $icon = gear_skill_icon_url($skill); ?>
|
|
<tr>
|
|
<td>
|
|
<span class="gear-compare-item">
|
|
<?php if ($icon): ?><img class="gear-skill-compare-icon" src="<?= e($icon) ?>" alt="" width="22" height="22" loading="lazy"><?php endif; ?>
|
|
<?= e($skill['name']) ?><?= (int) $skill['is_listed'] !== 1 ? ' <span class="text-muted">(nicht mehr gelistet)</span>' : '' ?>
|
|
</span>
|
|
</td>
|
|
<td><input type="text" name="name_de[<?= (int) $id ?>]" maxlength="<?= GEAR_SKILL_NAME_MAX ?>" value="<?= e((string) ($skill['name_de'] ?? '')) ?>" placeholder="<?= e($skill['name']) ?>" aria-label="Deutscher Name für <?= e($skill['name']) ?>"></td>
|
|
<?php foreach (gear_skill_part_levels($kind) as $no => $unlock): ?>
|
|
<?php $english = $parts[$no]['en']; ?>
|
|
<td><input type="text" name="spec_name[<?= (int) $id ?>][<?= $no ?>]" maxlength="<?= GEAR_SKILL_NAME_MAX ?>" value="<?= e($specNames[$no]) ?>"
|
|
placeholder="<?= e($english !== '' ? $english : ($kind === 'stigma' ? 'Bonus ab ' . $unlock : GEAR_SKILL_SPEC_NUMERALS[$no])) ?>"
|
|
title="<?= e($english) ?>" aria-label="<?= $kind === 'stigma' ? 'Bonus ab Stufe ' . $unlock : 'Spezialisierung ' . GEAR_SKILL_SPEC_NUMERALS[$no] ?> von <?= e($skill['name']) ?>"></td>
|
|
<?php endforeach; ?>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<div class="actions">
|
|
<button type="submit">Speichern</button>
|
|
</div>
|
|
</form>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php include __DIR__ . '/../includes/footer.php'; ?>
|