Gear planner: skill planner - skills of the set's class with planned level, stigma limit, point/shard costs, import from aion2hub

- Skills per class come from the aion2hub class pages (Global client core list only, Korea/Taiwan extras left out): 12 normal actives, then Dodge (no levels, dropped), then the stigma skills - matches the Global client's mastery and stigma lists for all 8 classes
- New tables gear_skills and gear_set_skills (schema version 35), skill icons stored under assets/uploads/skills/ (existing files are reused on re-import)
- Admin: "Skills" section on admin/gear_items.php imports/compares all classes (one request per second), marks skills aion2hub no longer lists and can remove them
- Set page: skill grid (active / stigma / passive) with level select and instant save; normal skills 1-10 by skill points, above that only with bonuses (Daevanion up to +4, gear and Arcana up to 20); stigmas up to 20, at most 4 at once (checked on the server too); shows skill point and stigma shard costs
- Planned skills on set cards, the profile page and in the comparison; copies take the skills along, a class change keeps the old levels hidden
- Patch notes entry, README section for the gear planner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-09-23 17:17:59 +02:00
parent 487b56d649
commit fab66f64d0
19 changed files with 1401 additions and 38 deletions

3
.gitignore vendored
View file

@ -14,6 +14,9 @@ assets/uploads/bugs/*
assets/uploads/gear/* assets/uploads/gear/*
!assets/uploads/gear/.htaccess !assets/uploads/gear/.htaccess
!assets/uploads/gear/.gitkeep !assets/uploads/gear/.gitkeep
assets/uploads/skills/*
!assets/uploads/skills/.htaccess
!assets/uploads/skills/.gitkeep
# Kacheln, Marker und Icons der Karte (~230 MB) - werden per FTP hochgeladen, siehe README # Kacheln, Marker und Icons der Karte (~230 MB) - werden per FTP hochgeladen, siehe README
assets/map/data/ assets/map/data/
__pycache__/ __pycache__/

View file

@ -33,6 +33,9 @@ und wird später ausgebaut. Fokus dieser Version ist der Mitglieder-/Admin-Berei
wahlweise eigen, unbegrenzt oder direkt aus dem Lagerhaus wahlweise eigen, unbegrenzt oder direkt aus dem Lagerhaus
- Lagerhaus: Bestand der Legion mit Einlagerungen (wer hat was wann überreicht) und Entnahmen - Lagerhaus: Bestand der Legion mit Einlagerungen (wer hat was wann überreicht) und Entnahmen
(wann, optional an wen), Gegenstandsliste aus dem Aion-2-Wiki mit rund 2.300 Einträgen (wann, optional an wen), Gegenstandsliste aus dem Aion-2-Wiki mit rund 2.300 Einträgen
- Gear-Planer: Ausrüstungssets mit Werten aus dem Spielclient (über aion2hub), dazu die Skills
der Klasse mit geplanter Stufe (aktive, Stigma- und passive Skills), vergleichen und auf der
Profilseite zeigen
- Anwesenheitsliste pro Raid (anwesend, abwesend), automatische Lumipunkte beim Archivieren - Anwesenheitsliste pro Raid (anwesend, abwesend), automatische Lumipunkte beim Archivieren
(fest +1 pro Teilnahme) und eine Discord-PN an die Raidleitung, sobald ein Raid beginnt (fest +1 pro Teilnahme) und eine Discord-PN an die Raidleitung, sobald ein Raid beginnt
- Raids-Seite: zeigt anstehende Raid-Termine, Anforderungen, Gruppen und Anmeldungen, - Raids-Seite: zeigt anstehende Raid-Termine, Anforderungen, Gruppen und Anmeldungen,
@ -679,6 +682,45 @@ entnehmen, Einträge löschen). Beide legt die Website nach dem Update selbst an
der Gruppe „Administrator“. Anderen Gruppen muss man sie unter Berechtigungsgruppen zuweisen. der Gruppe „Administrator“. Anderen Gruppen muss man sie unter Berechtigungsgruppen zuweisen.
Die Tabellen `warehouse_items` und `warehouse_movements` entstehen ebenfalls automatisch. Die Tabellen `warehouse_items` und `warehouse_movements` entstehen ebenfalls automatisch.
### Gear-Planer
Die Seite **Gear-Planer** (`gear.php`) lässt jedes Mitglied Ausrüstungssets zusammenstellen und
vergleichen: Gegenstand je Slot, Aufwertung, Durchbruch, Seelenprägung, Manasteine - und die
**Skills** der Klasse des Sets mit ihrer geplanten Stufe. Sets lassen sich kopieren, bis zu vier
nebeneinander vergleichen (Werte, Ausrüstung, Skillstufen) und auf der eigenen Profilseite zeigen.
- **Gegenstände** kommen von [aion2hub.com](https://aion2hub.com/database) (aus dem
Global-Client ausgelesen). Admins mit `gear.manage` übernehmen sie unter **Gegenstände &
Skills verwalten** (`admin/gear_items.php`) einzeln oder als ganze Liste und gleichen sie
nach einem Patch ab. Abgerufen wird höchstens eine Seite pro Sekunde, nur auf Knopfdruck.
- **Skills:** Im selben Admin-Bereich übernimmt „Skills übernehmen / abgleichen“ die
Skill-Listen aller acht Klassen von den Klassenseiten bei aion2hub (z.B.
`aion2hub.com/classes/chanter`): je Klasse die Kernliste aus dem Global-Client, samt Icons
(`assets/uploads/skills/`). Die aktiven Skills stehen dort in Spielreihenfolge - 12 normale,
dann „Dodge“ (ohne Stufen, wird ausgelassen), danach die Stigma-Skills; so trennt die Website
sie. Das stimmt für alle acht Klassen mit den Meisterschafts- und Stigma-Listen aus dem
Global-Client überein. Die zusätzlichen Korea/Taiwan-Skills bei aion2hub sind nicht mit dem
Global-Client abgeglichen und werden ausgelassen. Das erste Übernehmen dauert wegen der Icons
etwa 5-10 Minuten, jeder spätere Abgleich nur Sekunden (vorhandene Icon-Dateien werden
wiederverwendet). Skills, die aion2hub nicht mehr listet, bleiben für bestehende Pläne erhalten
und werden markiert; die Verwaltung kann sie entfernen.
- **Skillstufen:** Aktive und passive Skills steigert man mit Skillpunkten bis 10, darüber nur mit
Boni: die Daevanion-Bretter geben höchstens +4, Ausrüstung und Arcana den Rest bis 20. Stigma-Skills
steigen mit Stigma-Splittern bis 20, höchstens 4 lassen sich gleichzeitig ausrüsten - mehr lässt
der Planer nicht zu. Dazu rechnet er aus, was die geplanten Stufen kosten (Skillpunkte bis Stufe 10:
2-4 je 1, 5-7 je 2, 8-10 je 4; Stigma-Splitter: 1-5 je 1, 6-10 je 2, 11-15 je 4, 16-20 je 8). Stand
ist der Global-Client des Launch Scale Tests und der offizielle Guide aus Korea (September 2026); die
Grenzen stehen als `GEAR_SKILL_LEVEL_SELF`, `GEAR_SKILL_DAEVANION_BONUS`, `GEAR_SKILL_LEVEL_MAX`,
`GEAR_STIGMA_LEVEL_MAX` und `GEAR_STIGMA_SLOTS` in `includes/gear_skills.php`. Jede Änderung
speichert sofort. Wechselt ein Set die Klasse, bleiben die Stufen der alten Klasse gespeichert
und erscheinen beim Zurückwechseln wieder. Die Daevanion-Bretter selbst kennt die Website noch
nicht - dafür kann jedes Set einen Link zu einem Plan auf einer Planer-Seite (z.B. aion2hub)
bekommen.
Rechte: `gear.view` (eigene Sets planen, freigegebene ansehen) und `gear.manage` (Gegenstände und
Skills übernehmen). Die Tabellen `gear_items`, `gear_sets`, `gear_set_slots`, `gear_skills` und
`gear_set_skills` entstehen automatisch.
### Mitgliederliste ### Mitgliederliste
Zeigt alle aktiven Legionsmitglieder mit Profilbild und Rollen. Unter Berechtigungsgruppen -> Zeigt alle aktiven Legionsmitglieder mit Profilbild und Rollen. Unter Berechtigungsgruppen ->

View file

@ -1,7 +1,8 @@
<?php <?php
/** /**
* Gear-Planer, Katalog: Gegenstaende von aion2hub.com (Global-Client) uebernehmen, einzeln oder * Gear-Planer, Katalog: Gegenstaende von aion2hub.com (Global-Client) uebernehmen, einzeln oder
* alle mit der Quelle abgleichen (z.B. nach einem Patch) und Unterschiede pruefen. * alle mit der Quelle abgleichen (z.B. nach einem Patch) und Unterschiede pruefen. Dazu die
* Skill-Listen der Klassen fuer den Skillplaner.
*/ */
require_once __DIR__ . '/../includes/bootstrap.php'; require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/gear.php'; require_once __DIR__ . '/../includes/gear.php';
@ -47,12 +48,12 @@ $listUrl = static function (array $overrides = []) use ($query, $slotFilter): st
return '/admin/gear_items.php?' . ($params ? http_build_query($params) . '&' : ''); return '/admin/gear_items.php?' . ($params ? http_build_query($params) . '&' : '');
}; };
$pageTitle = 'Gear-Planer: Gegenstände'; $pageTitle = 'Gear-Planer: Gegenstände & Skills';
$containerWide = true; $containerWide = true;
include __DIR__ . '/../includes/header.php'; include __DIR__ . '/../includes/header.php';
?> ?>
<div class="panel"> <div class="panel">
<h1>Gear-Planer: Gegenstände</h1> <h1>Gear-Planer: Gegenstände &amp; Skills</h1>
<p class="text-muted"> <p class="text-muted">
Werte kommen von <a href="https://aion2hub.com/database" target="_blank" rel="noopener">aion2hub.com</a> Werte kommen von <a href="https://aion2hub.com/database" target="_blank" rel="noopener">aion2hub.com</a>
(aus dem Global-Client ausgelesen). Abgerufen wird immer nur eine Seite pro Sekunde und nur auf Knopfdruck. (aus dem Global-Client ausgelesen). Abgerufen wird immer nur eine Seite pro Sekunde und nur auf Knopfdruck.
@ -92,6 +93,68 @@ include __DIR__ . '/../includes/header.php';
</div> </div>
</div> </div>
<?php $skillStatus = gear_skill_catalog_status(); $unlistedSkills = array_sum(array_column($skillStatus, 'unlisted')); ?>
<div class="panel" id="skills">
<h2>Skills</h2>
<p class="text-muted">
Die Skill-Listen kommen von den Klassenseiten bei aion2hub (z.B.
<a href="<?= e(GEAR_SOURCE_CLASS_URL) ?>chanter" target="_blank" rel="noopener">aion2hub.com/classes/chanter</a>) - nur die
Kernliste aus dem Global-Client, die zusätzlichen Korea/Taiwan-Skills nicht. Aktive Skills nach „Dodge“ sind dort
die Stigma-Skills und werden als solche geführt. Die Icons werden einmalig mitgeladen
(beim ersten Mal etwa 5-10 Minuten für alle Klassen, danach reicht ein kurzer Abgleich).
</p>
<div class="table-scroll">
<table class="gear-admin-table gear-skill-status">
<thead>
<tr><th>Klasse</th><th>Aktiv</th><th>Stigma</th><th>Passiv</th><th>Ohne Icon</th><th>Nicht mehr gelistet</th><th>Abgeglichen</th></tr>
</thead>
<tbody>
<?php foreach ($skillStatus as $class => $row): ?>
<tr>
<td><span class="gear-compare-item"><?= class_badge_html($class, 20) ?> <?= e($class) ?></span></td>
<td><?= $row['active'] ?: '<span class="text-muted">–</span>' ?></td>
<td><?= $row['stigma'] ?: '<span class="text-muted">–</span>' ?></td>
<td><?= $row['passive'] ?: '<span class="text-muted">–</span>' ?></td>
<td><?= $row['no_icon'] ?: '<span class="text-muted">–</span>' ?></td>
<td><?= $row['unlisted'] ?: '<span class="text-muted">–</span>' ?></td>
<td class="text-muted">
<?= $row['checked_at'] ? e(date('d.m.Y H:i', strtotime((string) $row['checked_at']))) : 'noch nie' ?>
<?php if ($row['source_version'] !== ''): ?><span class="gear-admin-sub"><?= e($row['source_version']) ?></span><?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="gear-import" id="skill-import" data-classes="<?= e(json_encode(array_keys(GEAR_SOURCE_CLASSES), JSON_UNESCAPED_UNICODE)) ?>">
<div class="gear-import-row">
<select id="skill-import-class" aria-label="Klasse">
<option value="">Alle Klassen</option>
<?php foreach (array_keys(GEAR_SOURCE_CLASSES) as $class): ?>
<option value="<?= e($class) ?>"><?= e($class) ?></option>
<?php endforeach; ?>
</select>
<button type="button" class="button" id="skill-import-start">Skills übernehmen / abgleichen</button>
<button type="button" class="button button-secondary" id="skill-import-stop" hidden>Anhalten</button>
</div>
<div class="gear-import-progress" id="skill-import-progress" hidden>
<div class="gear-progress-bar"><span id="skill-progress-fill"></span></div>
<div class="text-muted" id="skill-progress-text"></div>
<ol class="gear-import-log" id="skill-import-log"></ol>
</div>
<?php if ($unlistedSkills > 0): ?>
<form method="post" action="/admin/gear_items_action.php" class="gear-import-row"
data-confirm="<?= $unlistedSkills === 1 ? 'Den Skill, den aion2hub nicht mehr listet, entfernen? Seine geplanten Stufen gehen' : $unlistedSkills . ' Skills, die aion2hub nicht mehr listet, entfernen? Ihre geplanten Stufen gehen' ?> in allen Sets verloren."
data-confirm-title="Alte Skills entfernen" data-confirm-danger data-confirm-ok="Entfernen">
<?= csrf_field() ?>
<input type="hidden" name="action" value="skills_prune">
<button type="submit" class="button button-secondary button-small"><?= icon('trash') ?> <?= $unlistedSkills === 1 ? '1 nicht mehr gelisteten Skill' : $unlistedSkills . ' nicht mehr gelistete Skills' ?> entfernen</button>
<span class="text-muted">Sie bleiben sonst in bestehenden Plänen stehen und sind dort markiert.</span>
</form>
<?php endif; ?>
</div>
</div>
<div class="panel"> <div class="panel">
<form class="list-toolbar" method="get" action="/admin/gear_items.php"> <form class="list-toolbar" method="get" action="/admin/gear_items.php">
<div class="audit-search-row"> <div class="audit-search-row">

View file

@ -1,7 +1,8 @@
<?php <?php
/** /**
* Gear-Planer, Katalog: Gegenstaende von aion2hub uebernehmen und abgleichen. * Gear-Planer, Katalog: Gegenstaende und die Skill-Listen der Klassen von aion2hub uebernehmen
* Antwortet als JSON (Aufrufe aus assets/js/gear-admin.js), nur "delete" leitet zurueck. * und abgleichen. Antwortet als JSON (Aufrufe aus assets/js/gear-admin.js), nur "delete" und
* "skills_prune" leiten zurueck.
*/ */
require_once __DIR__ . '/../includes/bootstrap.php'; require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/gear.php'; require_once __DIR__ . '/../includes/gear.php';
@ -110,6 +111,64 @@ try {
admin_log('🗡️ Gear-Planer: Gegenstände von aion2hub', $summary, 'info', 'gear'); admin_log('🗡️ Gear-Planer: Gegenstände von aion2hub', $summary, 'info', 'gear');
$respond(['ok' => true]); $respond(['ok' => true]);
case 'skills_class':
// Skill-Liste einer Klasse von ihrer Klassenseite uebernehmen bzw. abgleichen
$className = (string) ($_POST['class_name'] ?? '');
if (!isset(GEAR_SOURCE_CLASSES[$className])) {
$respond(['ok' => false, 'error' => 'Unbekannte Klasse.'], 400);
}
[$slug, $sourceClass] = GEAR_SOURCE_CLASSES[$className];
$politePause();
$parsed = gear_source_parse_class_skills(gear_source_fetch(GEAR_SOURCE_CLASS_URL . $slug), $sourceClass);
$respond(['ok' => true, 'class_name' => $className] + gear_skills_store($className, $parsed, $userId));
case 'skill_icon':
$skill = gear_skill((int) ($_POST['id'] ?? 0));
if (!$skill) {
$respond(['ok' => false, 'error' => 'Diesen Skill gibt es nicht (mehr).'], 404);
}
if (!empty($skill['icon']) && is_file(GEAR_SKILL_ICON_DIR . $skill['icon'])) {
$respond(['ok' => true, 'icon' => $skill['icon']]);
}
$politePause();
$icon = gear_skill_icon_download((int) $skill['id']);
if ($icon === null) {
$respond(['ok' => false, 'error' => 'Icon für „' . $skill['name'] . '“ ließ sich nicht laden (bei aion2hub fehlt es evtl. noch) - der nächste Abgleich versucht es erneut.'], 422);
}
db()->prepare('UPDATE gear_skills SET icon = ? WHERE id = ?')->execute([$icon, $skill['id']]);
$respond(['ok' => true, 'icon' => $icon]);
case 'skills_done':
// Eine Zusammenfassung pro Durchlauf
$summary = array_filter([
'Klassen' => mb_substr((string) ($_POST['classes'] ?? ''), 0, 200) ?: null,
'Skills' => (int) ($_POST['total'] ?? 0) ?: null,
'Neu' => (int) ($_POST['new'] ?? 0) ?: null,
'Geändert' => (int) ($_POST['changed'] ?? 0) ?: null,
'Nicht mehr gelistet' => (int) ($_POST['unlisted'] ?? 0) ?: null,
'Icons geladen' => (int) ($_POST['icons'] ?? 0) ?: null,
'Fehler' => (int) ($_POST['failed'] ?? 0) ?: null,
], static fn ($value): bool => $value !== null);
admin_log('🗡️ Gear-Planer: Skills von aion2hub', $summary, 'info', 'gear');
$respond(['ok' => true]);
case 'skills_prune':
// Skills, die aion2hub nicht mehr listet, samt ihrer geplanten Stufen entfernen
$gone = db()->query('SELECT id, name, class_name, icon FROM gear_skills WHERE is_listed = 0')->fetchAll();
if ($gone) {
db()->exec('DELETE FROM gear_skills WHERE is_listed = 0');
foreach ($gone as $skill) {
if (!empty($skill['icon']) && strpos((string) $skill['icon'], '/') === false) {
@unlink(GEAR_SKILL_ICON_DIR . $skill['icon']);
}
}
admin_log('🗡️ Gear-Planer: alte Skills entfernt', [
'Skills' => implode(', ', array_map(static fn (array $s): string => $s['name'] . ' (' . $s['class_name'] . ')', $gone)),
], 'danger', 'gear');
set_flash('success', count($gone) . (count($gone) === 1 ? ' alter Skill entfernt.' : ' alte Skills entfernt.'));
}
redirect('/admin/gear_items.php#skills');
case 'delete': case 'delete':
$item = gear_item((int) ($_POST['id'] ?? 0)); $item = gear_item((int) ($_POST['id'] ?? 0));
if ($item) { if ($item) {

View file

@ -5691,6 +5691,7 @@ strong.grade-common, strong.grade-rare, strong.grade-epic, strong.grade-unique,
.gear-set-card-stat-name { color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .gear-set-card-stat-name { color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gear-set-card-stat-value { flex-shrink: 0; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; } .gear-set-card-stat-value { flex-shrink: 0; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.gear-set-card-profile:hover .gear-set-card-more { text-decoration: underline; } .gear-set-card-profile:hover .gear-set-card-more { text-decoration: underline; }
.gear-set-card-skills { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); font-size: 0.8rem; }
/* Build-Link unter der Karte (die Karte selbst ist schon ein Link) */ /* Build-Link unter der Karte (die Karte selbst ist schon ein Link) */
.gear-set-card-build { display: inline-block; margin: 0 1rem 0.9rem; font-size: 0.82rem; } .gear-set-card-build { display: inline-block; margin: 0 1rem 0.9rem; font-size: 0.82rem; }
@media (max-width: 800px) { @media (max-width: 800px) {
@ -5750,6 +5751,121 @@ strong.grade-common, strong.grade-rare, strong.grade-epic, strong.grade-unique,
.gear-diff.is-down { color: #f08a86; background: rgba(217, 83, 79, 0.15); } .gear-diff.is-down { color: #f08a86; background: rgba(217, 83, 79, 0.15); }
.gear-compare-item { display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; } .gear-compare-item { display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
/* Skills eines Sets: Raster aus Karten (Icon mit Stufe, Name, Art, Auswahl der Stufe) */
.gear-skills-head { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: baseline; }
.gear-skills-head h3 { margin: 0; }
.gear-skills-head .gear-save-status { margin-left: auto; }
.gear-skills-legend { margin: 0.35rem 0 0; }
.gear-skill-costs { font-size: 0.85rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.gear-skills-details { margin-top: 0.35rem; font-size: 0.82rem; }
.gear-skills-details summary { cursor: pointer; color: var(--text-muted); }
.gear-skills-details summary:hover { color: var(--gold); }
.gear-skills-details p { margin: 0.35rem 0 0; }
.gear-skill-bonus-text { color: #b9a3ff; font-weight: 600; }
.gear-skills-kind { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.75rem; margin: 1.1rem 0 0.5rem; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); }
.gear-skills-kind-count { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.82rem; color: var(--text-muted); }
.gear-skills-kind-count.is-full { color: var(--gold); }
.gear-skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 0.5rem; }
.gear-skill {
display: flex;
align-items: center;
gap: 0.6rem;
min-width: 0;
padding: 0.4rem 0.5rem;
border: 1px solid var(--border);
border-radius: 8px;
background: rgba(255, 255, 255, 0.02);
transition: border-color 0.15s, background 0.15s;
}
.gear-skill.is-planned { border-color: rgba(201, 162, 39, 0.45); background: rgba(201, 162, 39, 0.07); }
/* Stufe 11-16 gibt es nur mit Boni (Daevanion-Bretter u. a.): violett */
.gear-skill.is-bonus { border-color: rgba(150, 120, 255, 0.6); background: rgba(150, 120, 255, 0.1); }
.gear-skill.is-unlisted { border-style: dashed; }
.gear-skill-icon {
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 40px;
height: 40px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
background: #0e0f14;
overflow: hidden;
}
.gear-skill-icon img { width: 36px; height: 36px; object-fit: contain; }
.gear-skill:not(.is-planned) .gear-skill-icon img { filter: grayscale(0.8) brightness(0.65); }
.gear-skill-initial { font-weight: 700; color: var(--text-muted); }
.gear-skill-level {
position: absolute;
right: 2px;
bottom: 1px;
font-size: 0.74rem;
font-weight: 700;
line-height: 1;
color: #fff;
text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 6px #000;
}
.gear-skill.is-bonus .gear-skill-level { color: #cdbdff; }
.gear-skill-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
/* Lange Namen ("Incandescent Blow") duerfen zweizeilig werden statt abgeschnitten */
.gear-skill-name {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 0.88rem;
font-weight: 600;
line-height: 1.2;
overflow-wrap: anywhere;
}
.gear-skill:not(.is-planned) .gear-skill-name { color: var(--text-muted); font-weight: 500; }
.gear-skill-cat { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); min-height: 1em; }
.gear-skill-cat.skill-cat-attack { color: #e0708a; }
.gear-skill-cat.skill-cat-buff { color: #5fd38d; }
.gear-skill-cat.skill-cat-heal { color: #6fc3ff; }
.gear-skill-cat.skill-cat-debuff { color: #d9a24a; }
.gear-skill select { flex-shrink: 0; width: 4.3rem; padding: 0.25rem 0.4rem; }
.gear-skill select:disabled { opacity: 0.45; cursor: not-allowed; }
.gear-skill-level-text { flex-shrink: 0; font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.gear-skill.is-planned .gear-skill-level-text { color: var(--text); font-weight: 600; }
.gear-skill.is-bonus .gear-skill-level-text { color: #cdbdff; }
.gear-skills-actions { margin-top: 1rem; }
/* Kleine Icon-Reihe der geplanten Skills (Set-Karten, Profilseite) */
.gear-skill-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0.15rem 0; }
.gear-skill-mini-icon {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
border: 1px solid rgba(201, 162, 39, 0.45);
border-radius: 5px;
background: #0e0f14;
overflow: hidden;
font-size: 0.8rem;
color: var(--text-muted);
}
.gear-skill-mini-icon.is-bonus { border-color: rgba(150, 120, 255, 0.7); }
.gear-skill-mini-icon.is-stigma { border-color: rgba(224, 112, 138, 0.75); }
.gear-skill-mini-icon img { width: 27px; height: 27px; object-fit: contain; }
.gear-skill-mini-level {
position: absolute;
right: 1px;
bottom: 0;
font-size: 0.6rem;
font-weight: 700;
line-height: 1;
color: #fff;
text-shadow: 0 0 3px #000, 0 1px 2px #000;
}
.gear-skill-mini-icon.is-bonus .gear-skill-mini-level { color: #cdbdff; }
.gear-skill-mini-more { font-size: 0.78rem; color: var(--text-muted); padding-left: 0.2rem; }
.gear-skill-compare-icon { width: 22px; height: 22px; border-radius: 4px; background: #0e0f14; object-fit: contain; }
.gear-skill-stigma-tag { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #e0708a; }
/* Admin: Katalog */ /* Admin: Katalog */
.gear-import { margin-top: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.025); } .gear-import { margin-top: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.025); }
.gear-import h2 { margin: 0 0 0.3rem; font-size: 1.1rem; } .gear-import h2 { margin: 0 0 0.3rem; font-size: 1.1rem; }

View file

@ -1,7 +1,7 @@
/** /**
* Gear-Planer, Katalog (admin/gear_items.php): Gegenstaende nacheinander von aion2hub * Gear-Planer, Katalog (admin/gear_items.php): Gegenstaende und die Skill-Listen der Klassen
* uebernehmen bzw. abgleichen - immer einer nach dem anderen (der Server wartet zusaetzlich * nacheinander von aion2hub uebernehmen bzw. abgleichen - immer ein Abruf nach dem anderen (der
* mindestens eine Sekunde zwischen zwei Abrufen), mit Fortschritt und Protokoll. * Server wartet zusaetzlich mindestens eine Sekunde dazwischen), mit Fortschritt und Protokoll.
*/ */
(function () { (function () {
'use strict'; 'use strict';
@ -236,6 +236,113 @@
} }
stopButton.addEventListener('click', function () { stopRequested = true; }); stopButton.addEventListener('click', function () { stopRequested = true; });
// ---- Skills: Klasse fuer Klasse die Liste abgleichen, danach fehlende Icons laden ----
var skillRoot = document.getElementById('skill-import');
if (skillRoot) {
var skillClass = document.getElementById('skill-import-class');
var skillStart = document.getElementById('skill-import-start');
var skillStop = document.getElementById('skill-import-stop');
var skillProgress = document.getElementById('skill-import-progress');
var skillFill = document.getElementById('skill-progress-fill');
var skillText = document.getElementById('skill-progress-text');
var skillLog = document.getElementById('skill-import-log');
var skillStopRequested = false;
var skillLogLine = function (text, kind, details) {
var li = document.createElement('li');
li.className = 'gear-log-' + kind;
li.textContent = text;
if (details && details.length) {
var list = document.createElement('ul');
details.forEach(function (detail) {
var item = document.createElement('li');
item.textContent = detail;
list.appendChild(item);
});
li.appendChild(list);
}
skillLog.insertBefore(li, skillLog.firstChild);
};
var runSkills = async function (classes) {
skillStopRequested = false;
skillStart.disabled = true;
skillStop.hidden = false;
skillProgress.hidden = false;
skillLog.innerHTML = '';
var totals = { total: 0, added: 0, changed: 0, unlisted: 0, icons: 0, failed: 0 };
var done = [];
for (var i = 0; i < classes.length && !skillStopRequested; i++) {
var name = classes[i];
skillFill.style.width = Math.round(i / classes.length * 100) + '%';
skillText.textContent = name + ' · Skill-Liste wird gelesen … (' + (i + 1) + ' von ' + classes.length + ')';
var result = await post({ action: 'skills_class', class_name: name });
if (!result.ok) {
totals.failed++;
skillLogLine(name + ': ' + result.error, 'error');
continue;
}
done.push(name);
totals.total += result.total;
totals.added += result['new'].length;
totals.changed += result.changed.length;
totals.unlisted += result.unlisted.length;
var details = [];
if (result['new'].length) details.push('Neu: ' + result['new'].join(', '));
result.changed.forEach(function (text) { details.push('Geändert: ' + text); });
if (result.unlisted.length) details.push('Nicht mehr in der Liste: ' + result.unlisted.join(', '));
// Fehlende Icons nacheinander (der Server wartet zwischen zwei Abrufen)
var icons = result.missing_icons || [];
var iconErrors = 0;
for (var k = 0; k < icons.length && !skillStopRequested; k++) {
skillText.textContent = name + ' · Icons ' + (k + 1) + ' von ' + icons.length + ' (' + (i + 1) + ' von ' + classes.length + ')';
skillFill.style.width = Math.round((i + (k + 1) / (icons.length + 1)) / classes.length * 100) + '%';
var icon = await post({ action: 'skill_icon', id: icons[k] });
if (icon.ok) {
totals.icons++;
} else {
iconErrors++;
details.push(icon.error);
}
}
if (iconErrors) totals.failed += iconErrors;
var kind = result['new'].length || result.changed.length ? 'new' : (iconErrors || result.unlisted.length ? 'changed' : 'same');
skillLogLine(name + ': ' + result.total + ' Skills'
+ (result['new'].length ? ' · ' + result['new'].length + ' neu' : '')
+ (result.changed.length ? ' · ' + result.changed.length + ' geändert' : '')
+ (result.unlisted.length ? ' · ' + result.unlisted.length + ' nicht mehr gelistet' : '')
+ (icons.length > iconErrors ? ' · ' + (icons.length - iconErrors) + ' Icons geladen' : '')
+ (!result['new'].length && !result.changed.length && !result.unlisted.length && !icons.length ? ' · alles aktuell' : ''),
kind, details);
}
skillFill.style.width = skillStopRequested ? skillFill.style.width : '100%';
skillText.textContent = (skillStopRequested ? 'Angehalten' : 'Fertig') + ' · ' + totals.total + ' Skills'
+ (totals.added ? ' · neu ' + totals.added : '') + (totals.changed ? ' · geändert ' + totals.changed : '')
+ (totals.icons ? ' · Icons ' + totals.icons : '') + (totals.failed ? ' · Fehler ' + totals.failed : '');
if (done.length) {
post({
action: 'skills_done', classes: done.join(', '), total: totals.total, 'new': totals.added,
changed: totals.changed, unlisted: totals.unlisted, icons: totals.icons, failed: totals.failed
});
skillLogLine('Seite neu laden, um die Übersicht zu aktualisieren.', 'info');
}
skillStart.disabled = false;
skillStop.hidden = true;
};
skillStart.addEventListener('click', async function () {
var all = JSON.parse(skillRoot.dataset.classes || '[]');
var classes = skillClass.value ? [skillClass.value] : all;
if (!classes.length) return;
if (classes.length > 1 && !(await window.luminaDialog.confirm('Die Skill-Listen aller ' + classes.length + ' Klassen werden von aion2hub gelesen. '
+ 'Beim ersten Mal kommen die Icons dazu - das dauert etwa 5-10 Minuten, die Seite muss so lange offen bleiben (Anhalten geht jederzeit).',
{ title: 'Skills übernehmen?', okLabel: 'Starten' }))) return;
runSkills(classes);
});
skillStop.addEventListener('click', function () { skillStopRequested = true; });
}
// ---- Einzelnen Gegenstand abgleichen: Unterschiede im Dialog, dann uebernehmen ---- // ---- Einzelnen Gegenstand abgleichen: Unterschiede im Dialog, dann uebernehmen ----
var modal = document.getElementById('gear-diff-modal'); var modal = document.getElementById('gear-diff-modal');
var title = document.getElementById('gear-diff-title'); var title = document.getElementById('gear-diff-title');

View file

@ -1,6 +1,7 @@
/** /**
* Gear-Planer (gear.php): Dialog "Set bearbeiten", Auswahl zum Vergleichen (2-4 Sets) und * Gear-Planer (gear.php): Dialog "Set bearbeiten", Auswahl zum Vergleichen (2-4 Sets),
* Hinweise zur Spanne der Seelenpraegung (Platzhalter + Pruefung beim Tippen). * Hinweise zur Spanne der Seelenpraegung (Platzhalter + Pruefung beim Tippen) und das
* automatische Speichern von Slots und Skillstufen.
*/ */
(function () { (function () {
'use strict'; 'use strict';
@ -167,4 +168,110 @@
save(); save();
}); });
} }
// ---- Skills: jede geaenderte Stufe speichert sofort ----
var skillsForm = document.querySelector('form[data-skills-autosave]');
if (skillsForm && window.fetch && window.FormData) {
var skillStatus = document.querySelector('[data-skill-status]');
var skillSummary = document.querySelector('[data-skill-summary]');
var skillCosts = document.querySelector('[data-skill-costs]');
var stigmaCount = document.querySelector('[data-stigma-count]');
var skillFallback = skillsForm.querySelector('[data-autosave-fallback]');
var selfMax = parseInt(skillsForm.dataset.selfMax, 10) || 10;
var stigmaSlots = parseInt(skillsForm.dataset.stigmaSlots, 10) || 4;
var skillSaving = false;
var skillAgain = false;
if (skillFallback) skillFallback.hidden = true;
var setSkillStatus = function (text, kind) {
if (!skillStatus) return;
skillStatus.textContent = text;
skillStatus.className = 'gear-save-status' + (kind ? ' is-' + kind : '');
};
// Karte an ihre Stufe anpassen (Stufe am Icon, Farbe fuer geplant / Bonusstufe)
var paintCard = function (select) {
var level = parseInt(select.value, 10) || 0;
var card = select.closest('[data-skill]');
if (!card) return;
card.classList.toggle('is-planned', level > 0);
card.classList.toggle('is-bonus', card.dataset.kind !== 'stigma' && level > selfMax);
var badge = card.querySelector('[data-skill-badge]');
if (badge) badge.textContent = level > 0 ? String(level) : '';
};
// Stigmen: sind alle Plaetze belegt, lassen sich weitere erst nach dem Abwaehlen eines anderen waehlen
var updateStigmaLimit = function () {
var selects = skillsForm.querySelectorAll('[data-kind="stigma"] [data-skill-level]');
var planned = Array.prototype.filter.call(selects, function (s) { return (parseInt(s.value, 10) || 0) > 0; }).length;
selects.forEach(function (s) {
var locked = planned >= stigmaSlots && (parseInt(s.value, 10) || 0) === 0;
s.disabled = locked;
s.title = locked ? 'Schon ' + stigmaSlots + ' Stigmen ausgewählt' : '';
});
if (stigmaCount) {
stigmaCount.textContent = planned + ' von ' + stigmaSlots + ' ausgewählt';
stigmaCount.classList.toggle('is-full', planned >= stigmaSlots);
}
};
// Gespeicherten Stand vom Server uebernehmen (abgelehnte Aenderungen springen zurueck)
var applyLevels = function (levels) {
skillsForm.querySelectorAll('[data-skill-level]').forEach(function (select) {
var id = (select.name.match(/\[(\d+)\]/) || [])[1];
var level = String(levels[id] || 0);
if (select.value !== level) select.value = level;
paintCard(select);
});
updateStigmaLimit();
};
// Nur geaenderte Stufen schicken - so ueberschreibt ein zweiter offener Tab nichts
var dirty = {};
var saveSkills = function () {
if (skillSaving) { skillAgain = true; return; }
var names = Object.keys(dirty);
if (!names.length) return;
var body = new FormData();
skillsForm.querySelectorAll('input[type="hidden"]').forEach(function (input) { body.append(input.name, input.value); });
names.forEach(function (name) { body.append(name, dirty[name].value); });
dirty = {};
skillSaving = true;
setSkillStatus('Speichert …', 'busy');
fetch(skillsForm.getAttribute('action'), {
method: 'POST',
body: body,
credentials: 'same-origin',
headers: { 'X-Requested-With': 'fetch', 'Accept': 'application/json' }
})
.then(function (response) { return response.json(); })
.then(function (result) {
if (!result.ok) throw new Error(result.error || 'Speichern fehlgeschlagen');
if (skillSummary && result.summary) skillSummary.textContent = result.summary;
if (skillCosts && result.costs) skillCosts.textContent = result.costs;
if (result.levels && !skillAgain) applyLevels(result.levels);
if (result.errors && result.errors.length) setSkillStatus(result.errors.join(' '), 'error');
else setSkillStatus('✓ Gespeichert', 'ok');
})
.catch(function (error) { setSkillStatus(error.message || 'Speichern fehlgeschlagen', 'error'); })
.then(function () {
skillSaving = false;
if (skillAgain) { skillAgain = false; saveSkills(); }
});
};
skillsForm.addEventListener('change', function (event) {
var select = event.target.closest('[data-skill-level]');
if (!select) return;
dirty[select.name] = select;
paintCard(select);
updateStigmaLimit();
saveSkills();
});
updateStigmaLimit();
skillsForm.addEventListener('submit', function (event) {
event.preventDefault();
saveSkills();
});
}
})(); })();

View file

View file

@ -0,0 +1,17 @@
# Skill-Icons des Gear-Planers (von aion2hub geladen) duerfen niemals als Skript
# ausgefuehrt werden - auch wenn eine Datei die Typpruefung in includes/gear.php umgehen sollte.
<IfModule mod_php.c>
php_flag engine off
</IfModule>
<IfModule mod_php7.c>
php_flag engine off
</IfModule>
<FilesMatch "\.(php|phtml|php[0-9]?|phar|cgi|pl)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
</FilesMatch>

178
gear.php
View file

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Gear-Planer: eigene Ausruestungssets zusammenstellen und vergleichen. * Gear-Planer: eigene Ausruestungssets zusammenstellen, ihre Skills planen und vergleichen.
* /gear.php Uebersicht der eigenen Sets * /gear.php Uebersicht der eigenen Sets
* /gear.php?set=ID[&slot=KEY] ein Set (eigene bearbeitbar, fremde nur wenn aufs Profil freigegeben) * /gear.php?set=ID[&slot=KEY] ein Set (eigene bearbeitbar, fremde nur wenn aufs Profil freigegeben)
* /gear.php?compare[]=ID&… 2-4 Sets nebeneinander * /gear.php?compare[]=ID&… 2-4 Sets nebeneinander
@ -16,6 +16,7 @@ $catalogCount = (int) db()->query('SELECT COUNT(*) FROM gear_items')->fetchColum
$mySets = gear_sets_for_user($userId); $mySets = gear_sets_for_user($userId);
$mySlots = gear_slots_for_sets(array_column($mySets, 'id')); $mySlots = gear_slots_for_sets(array_column($mySets, 'id'));
$mySkills = gear_set_skills_for_sets($mySets);
// ---- Welche Ansicht? ---- // ---- Welche Ansicht? ----
$set = null; $set = null;
@ -80,9 +81,10 @@ include __DIR__ . '/includes/header.php';
<div> <div>
<h1>Gear-Planer</h1> <h1>Gear-Planer</h1>
<p class="text-muted"> <p class="text-muted">
Stell Ausrüstungssets zusammen und vergleiche sie. Grundwerte, Sockel und die Werte bei Stell Ausrüstungssets zusammen, plane die Skills deiner Klasse und vergleiche sie. Grundwerte,
voller Aufwertung stammen aus dem Spielclient (Global) und werden von der Leitung abgeglichen; Sockel, die Werte bei voller Aufwertung und die Skill-Listen stammen aus dem Spielclient (Global)
Werte mit <span class="gear-estimated">≈</span> sind für Zwischenstufen hochgerechnet. und werden von der Leitung abgeglichen; Werte mit <span class="gear-estimated">≈</span> sind für
Zwischenstufen hochgerechnet.
</p> </p>
</div> </div>
<div class="gear-head-actions"> <div class="gear-head-actions">
@ -90,7 +92,7 @@ include __DIR__ . '/includes/header.php';
<a class="button button-secondary" href="/gear.php">Meine Sets</a> <a class="button button-secondary" href="/gear.php">Meine Sets</a>
<?php endif; ?> <?php endif; ?>
<?php if ($canManage): ?> <?php if ($canManage): ?>
<a class="button button-secondary" href="/admin/gear_items.php"><?= icon('list') ?> Gegenstände verwalten</a> <a class="button button-secondary" href="/admin/gear_items.php"><?= icon('list') ?> Gegenstände &amp; Skills verwalten</a>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
@ -111,6 +113,17 @@ include __DIR__ . '/includes/header.php';
<?php <?php
// ---- Vergleich ---- // ---- Vergleich ----
$compareSlots = gear_slots_for_sets(array_column($compare, 'id')); $compareSlots = gear_slots_for_sets(array_column($compare, 'id'));
$compareSkills = gear_set_skills_for_sets($compare);
// Alle Skills, die in mindestens einem Set geplant sind - nach Klasse (wie die Sets), dann wie auf der Klassenseite
$compareSkillRows = [];
foreach ($compare as $c) {
foreach ($compareSkills[(int) $c['id']] ?? [] as $skillId => $planned) {
$compareSkillRows[$skillId] ??= $planned['skill'];
}
}
$classOrder = array_flip(array_unique(array_map(static fn (array $c): string => (string) $c['class_name'], $compare)));
uasort($compareSkillRows, static fn (array $a, array $b): int =>
[$classOrder[$a['class_name']] ?? 99, $a['kind'], (int) $a['sort_order']] <=> [$classOrder[$b['class_name']] ?? 99, $b['kind'], (int) $b['sort_order']]);
$compareTotals = []; $compareTotals = [];
$allKeys = []; $allKeys = [];
foreach ($compare as $c) { foreach ($compare as $c) {
@ -180,13 +193,45 @@ include __DIR__ . '/includes/header.php';
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($compareSkillRows): ?>
<tr class="gear-compare-group"><th colspan="<?= count($compare) + 1 ?>">Skills</th></tr>
<?php foreach ($compareSkillRows as $skillId => $skill): ?>
<?php $baseLevel = $compareSkills[$first][$skillId]['level'] ?? 0; ?>
<tr>
<th>
<span class="gear-compare-item">
<?php if ($skillIcon = gear_skill_icon_url($skill)): ?><img class="gear-skill-compare-icon" src="<?= e($skillIcon) ?>" alt="" width="22" height="22" loading="lazy"><?php endif; ?>
<?= e($skill['name']) ?>
<?php if ($skill['kind'] === 'stigma'): ?><span class="gear-skill-stigma-tag">Stigma</span><?php endif; ?>
</span>
</th>
<?php foreach ($compare as $index => $c): ?>
<?php $level = $compareSkills[(int) $c['id']][$skillId]['level'] ?? 0; ?>
<td>
<?php if ($level > 0): ?>
<span class="<?= gear_skill_is_bonus($skill['kind'], $level) ? 'gear-skill-bonus-text' : '' ?>"><?= $level ?></span>
<?php else: ?>
<span class="text-muted">–</span>
<?php endif; ?>
<?php if ($index > 0 && $c['class_name'] === $compare[0]['class_name'] && $level !== $baseLevel): ?>
<span class="gear-diff <?= $level > $baseLevel ? 'is-up' : 'is-down' ?>"><?= $level > $baseLevel ? '+' : '−' ?><?= abs($level - $baseLevel) ?></span>
<?php endif; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<?php elseif ($set): ?> <?php elseif ($set): ?>
<?php $totals = gear_set_totals($slots); $itemLevel = gear_set_item_level($slots); ?> <?php
$totals = gear_set_totals($slots);
$itemLevel = gear_set_item_level($slots);
$plannedSkills = gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [];
?>
<div class="panel gear-set-head"> <div class="panel gear-set-head">
<div class="gear-set-title"> <div class="gear-set-title">
<h2><?= e($set['name']) ?> <?= class_badge_html($set['class_name'], 26) ?></h2> <h2><?= e($set['name']) ?> <?= class_badge_html($set['class_name'], 26) ?></h2>
@ -194,6 +239,7 @@ include __DIR__ . '/includes/header.php';
<?php if (!$isOwn): ?>Set von <?= e($set['owner_name']) ?> · <?php endif; ?> <?php if (!$isOwn): ?>Set von <?= e($set['owner_name']) ?> · <?php endif; ?>
<?= count(array_filter($slots, static fn (array $row): bool => !empty($row['item']))) ?>/<?= count(GEAR_SLOTS) ?> Slots belegt <?= count(array_filter($slots, static fn (array $row): bool => !empty($row['item']))) ?>/<?= count(GEAR_SLOTS) ?> Slots belegt
<?php if ($itemLevel !== null): ?> · Ø Gegenstandsstufe <?= e(number_format($itemLevel, 1, ',', '.')) ?><?php endif; ?> <?php if ($itemLevel !== null): ?> · Ø Gegenstandsstufe <?= e(number_format($itemLevel, 1, ',', '.')) ?><?php endif; ?>
<?php if ($plannedSkills): ?> · <a href="#skills"><?= count($plannedSkills) ?> <?= count($plannedSkills) === 1 ? 'Skill' : 'Skills' ?> geplant</a><?php endif; ?>
<?php if ($isOwn && $set['show_on_profile']): ?> · <span class="badge">auf dem Profil sichtbar</span><?php endif; ?> <?php if ($isOwn && $set['show_on_profile']): ?> · <span class="badge">auf dem Profil sichtbar</span><?php endif; ?>
</div> </div>
<?php if (!empty($set['note'])): ?><p><?= e($set['note']) ?></p><?php endif; ?> <?php if (!empty($set['note'])): ?><p><?= e($set['note']) ?></p><?php endif; ?>
@ -456,6 +502,120 @@ include __DIR__ . '/includes/header.php';
</div> </div>
</div> </div>
<?php
// ---- Skills der Klasse mit geplanter Stufe ----
$skillLevels = gear_set_skill_levels((int) $set['id']);
// 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 => (int) $skill['is_listed'] === 1 || isset($skillLevels[(int) $skill['id']])
);
?>
<div class="panel gear-skills" id="skills">
<div class="gear-skills-head">
<h3>Skills<?= !empty($set['class_name']) ? ' · ' . e($set['class_name']) : '' ?></h3>
<?php if ($classSkills): ?>
<span class="text-muted" data-skill-summary><?= e(gear_skill_summary($plannedSkills)) ?></span>
<span class="gear-skill-costs" data-skill-costs title="Was die geplanten Stufen kosten (Skillpunkte nur bis Stufe <?= GEAR_SKILL_LEVEL_SELF ?>)"><?= e(gear_skill_costs_text($plannedSkills)) ?></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 Skills.' : '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: ?>
<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>.
Stigma-Skills steigen mit Stigma-Splittern bis <?= GEAR_STIGMA_LEVEL_MAX ?>, ausrüsten kannst du höchstens <?= GEAR_STIGMA_SLOTS ?> gleichzeitig.
</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.
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) – nach dem Launch gleichen
wir die Zahlen ab. Skill-Liste aus dem Global-Client, Namen wie bei aion2hub (deutsche Namen folgen, sobald sie feststehen).
</p>
</details>
<?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 ?>">
<?= csrf_field() ?>
<input type="hidden" name="action" value="save_skills">
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
<?php endif; ?>
<?php
// Stigmen: hoechstens GEAR_STIGMA_SLOTS gleichzeitig - sind alle belegt, sind die uebrigen gesperrt
$stigmaPlanned = count(array_filter($classSkills, static fn (array $skill): bool =>
$skill['kind'] === 'stigma' && isset($skillLevels[(int) $skill['id']])));
?>
<?php foreach (GEAR_SKILL_KINDS as $kind => $kindLabel): ?>
<?php $kindSkills = array_filter($classSkills, static fn (array $skill): bool => $skill['kind'] === $kind); ?>
<?php if (!$kindSkills) { continue; } ?>
<h4 class="gear-skills-kind">
<?= e($kindLabel) ?>
<?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 = $skillLevels[(int) $skill['id']] ?? 0;
$skillIcon = gear_skill_icon_url($skill);
$unlisted = (int) $skill['is_listed'] !== 1;
?>
<div class="gear-skill<?= $level > 0 ? ' is-planned' : '' ?><?= gear_skill_is_bonus($kind, $level) ? ' is-bonus' : '' ?><?= $unlisted ? ' is-unlisted' : '' ?>"
data-skill 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($skill['name'], 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($skill['name']) ?>"><?= e($skill['name']) ?></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'])) ?>
</span>
</span>
<?php if ($isOwn): ?>
<select name="level[<?= (int) $skill['id'] ?>]" aria-label="Stufe von <?= e($skill['name']) ?>" data-skill-level
<?= $kind === 'stigma' && $level === 0 && $stigmaPlanned >= GEAR_STIGMA_SLOTS ? ' disabled title="Schon ' . GEAR_STIGMA_SLOTS . ' Stigmen ausgewählt"' : '' ?>>
<option value="0"<?= $level === 0 ? ' selected' : '' ?>>–</option>
<?php foreach (gear_skill_level_groups($kind) as $groupLabel => $groupLevels): ?>
<?php if ($groupLabel !== ''): ?><optgroup label="<?= e($groupLabel) ?>"><?php endif; ?>
<?php foreach ($groupLevels as $l): ?>
<option value="<?= $l ?>"<?= $level === $l ? ' selected' : '' ?>><?= $l ?></option>
<?php endforeach; ?>
<?php if ($groupLabel !== ''): ?></optgroup><?php endif; ?>
<?php endforeach; ?>
</select>
<?php else: ?>
<span class="gear-skill-level-text"><?= $level > 0 ? 'Stufe ' . $level : '–' ?></span>
<?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>Skills speichern</button>
</div>
</form>
<?php endif; ?>
<?php endif; ?>
</div>
<?php if ($isOwn): ?> <?php if ($isOwn): ?>
<div class="modal-overlay" id="gear-set-edit" hidden> <div class="modal-overlay" id="gear-set-edit" hidden>
<div class="modal"> <div class="modal">
@ -478,7 +638,7 @@ include __DIR__ . '/includes/header.php';
<label>Link zum Skill- &amp; Daevanion-Plan <span class="text-muted">(optional)</span> <label>Link zum Skill- &amp; Daevanion-Plan <span class="text-muted">(optional)</span>
<input type="url" name="build_url" maxlength="<?= GEAR_BUILD_URL_MAX ?>" value="<?= e((string) ($set['build_url'] ?? '')) ?>" placeholder="https://aion2hub.com/…"> <input type="url" name="build_url" maxlength="<?= GEAR_BUILD_URL_MAX ?>" value="<?= e((string) ($set['build_url'] ?? '')) ?>" placeholder="https://aion2hub.com/…">
</label> </label>
<p class="field-hint">Plane Skills, Stigmen und Daevanion-Bretter auf einer Planer-Seite (<?= e(implode(', ', GEAR_BUILD_HOSTS)) ?>) und füge hier den Link zum Teilen ein - er erscheint beim Set und auf deiner Profilseite.</p> <p class="field-hint">Die Skillstufen planst du direkt hier im Set. Daevanion-Bretter (und was die Website sonst noch nicht kennt) planst du auf einer Planer-Seite (<?= e(implode(', ', GEAR_BUILD_HOSTS)) ?>) und fügst hier den Link ein - er erscheint beim Set und auf deiner Profilseite.</p>
<label class="checkbox-label"><input type="checkbox" name="show_on_profile" value="1"<?= $set['show_on_profile'] ? ' checked' : '' ?>> Auf meiner Profilseite zeigen</label> <label class="checkbox-label"><input type="checkbox" name="show_on_profile" value="1"<?= $set['show_on_profile'] ? ' checked' : '' ?>> Auf meiner Profilseite zeigen</label>
<div class="actions"> <div class="actions">
<button type="submit" class="button">Speichern</button> <button type="submit" class="button">Speichern</button>
@ -519,7 +679,7 @@ include __DIR__ . '/includes/header.php';
<form method="get" action="/gear.php" id="gear-compare-form"> <form method="get" action="/gear.php" id="gear-compare-form">
<div class="gear-set-cards"> <div class="gear-set-cards">
<?php foreach ($mySets as $s): ?> <?php foreach ($mySets as $s): ?>
<?php $sSlots = $mySlots[(int) $s['id']] ?? []; $sLevel = gear_set_item_level($sSlots); ?> <?php $sSlots = $mySlots[(int) $s['id']] ?? []; $sLevel = gear_set_item_level($sSlots); $sSkills = $mySkills[(int) $s['id']] ?? []; ?>
<article class="gear-set-card"> <article class="gear-set-card">
<label class="gear-set-card-check" title="Zum Vergleich auswählen"> <label class="gear-set-card-check" title="Zum Vergleich auswählen">
<input type="checkbox" name="compare[]" value="<?= (int) $s['id'] ?>"> <input type="checkbox" name="compare[]" value="<?= (int) $s['id'] ?>">
@ -529,9 +689,11 @@ include __DIR__ . '/includes/header.php';
<span class="text-muted"> <span class="text-muted">
<?= count(array_filter($sSlots, static fn (array $row): bool => !empty($row['item']))) ?>/<?= count(GEAR_SLOTS) ?> Slots <?= count(array_filter($sSlots, static fn (array $row): bool => !empty($row['item']))) ?>/<?= count(GEAR_SLOTS) ?> Slots
<?php if ($sLevel !== null): ?> · Ø Stufe <?= e(number_format($sLevel, 1, ',', '.')) ?><?php endif; ?> <?php if ($sLevel !== null): ?> · Ø Stufe <?= e(number_format($sLevel, 1, ',', '.')) ?><?php endif; ?>
<?php if ($sSkills): ?> · <?= count($sSkills) ?> Skills<?php endif; ?>
<?php if ($s['show_on_profile']): ?> · auf dem Profil<?php endif; ?> <?php if ($s['show_on_profile']): ?> · auf dem Profil<?php endif; ?>
</span> </span>
<?= gear_doll_mini_html($sSlots) ?> <?= gear_doll_mini_html($sSlots) ?>
<?= gear_skills_mini_html($sSkills) ?>
<?php if (!empty($s['note'])): ?><span class="gear-set-card-note"><?= e($s['note']) ?></span><?php endif; ?> <?php if (!empty($s['note'])): ?><span class="gear-set-card-note"><?= e($s['note']) ?></span><?php endif; ?>
</a> </a>
</article> </article>

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Gear-Planer: Sets anlegen, bearbeiten, kopieren, loeschen und Slots belegen. Jedes Mitglied * Gear-Planer: Sets anlegen, bearbeiten, kopieren, loeschen, Slots belegen und Skillstufen
* bearbeitet nur seine eigenen Sets. * planen. Jedes Mitglied bearbeitet nur seine eigenen Sets.
*/ */
require_once __DIR__ . '/includes/bootstrap.php'; require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/gear.php'; require_once __DIR__ . '/includes/gear.php';
@ -27,13 +27,20 @@ $ownSet = static function () use ($userId): array {
return $set; return $set;
}; };
// Automatisches Speichern eines Slots (assets/js/gear.js) schickt X-Requested-With und will JSON // Automatisches Speichern (Slot, Skills - assets/js/gear.js) schickt X-Requested-With und will JSON
$wantsJson = !empty($_SERVER['HTTP_X_REQUESTED_WITH']); $wantsJson = !empty($_SERVER['HTTP_X_REQUESTED_WITH']);
$json = static function (array $data): void { $json = static function (array $data): void {
header('Content-Type: application/json; charset=UTF-8'); header('Content-Type: application/json; charset=UTF-8');
echo json_encode($data, JSON_UNESCAPED_UNICODE); echo json_encode($data, JSON_UNESCAPED_UNICODE);
exit; exit;
}; };
$fail = static function (string $message, string $to) use ($wantsJson, $json): void {
if ($wantsJson) {
$json(['ok' => false, 'error' => $message]);
}
set_flash('error', $message);
redirect($to);
};
$cleanName = static fn (string $value): string => mb_substr(trim(preg_replace('/\s+/u', ' ', $value) ?? ''), 0, 80); $cleanName = static fn (string $value): string => mb_substr(trim(preg_replace('/\s+/u', ' ', $value) ?? ''), 0, 80);
$cleanClass = static fn (string $value): ?string => in_array($value, AION_CLASSES, true) ? $value : null; $cleanClass = static fn (string $value): ?string => in_array($value, AION_CLASSES, true) ? $value : null;
@ -93,6 +100,14 @@ switch ($action) {
set_flash('info', 'Passt nicht zu ' . $class . ': ' . implode(', ', $wrong) . ' – neu wählen oder Slot leeren.'); set_flash('info', 'Passt nicht zu ' . $class . ': ' . implode(', ', $wrong) . ' – neu wählen oder Slot leeren.');
} }
} }
// Skillstufen gehoeren zur Klasse: die der alten bleiben gespeichert, nur ausgeblendet
if ($class !== $set['class_name'] && !empty($set['class_name'])) {
$oldSkills = gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [];
if ($oldSkills) {
set_flash('info', 'Deine ' . count($oldSkills) . ' geplanten Skills für ' . $set['class_name']
. ' bleiben gespeichert – wechselst du zurück, sind sie wieder da.');
}
}
redirect('/gear.php?set=' . (int) $set['id']); redirect('/gear.php?set=' . (int) $set['id']);
case 'duplicate': case 'duplicate':
@ -113,6 +128,8 @@ switch ($action) {
'INSERT INTO gear_set_slots (set_id, slot, item_id, enchant, exceed, soul_imprint, manastones, godstone) 'INSERT INTO gear_set_slots (set_id, slot, item_id, enchant, exceed, soul_imprint, manastones, godstone)
SELECT ?, slot, item_id, enchant, exceed, soul_imprint, manastones, godstone FROM gear_set_slots WHERE set_id = ?' SELECT ?, slot, item_id, enchant, exceed, soul_imprint, manastones, godstone FROM gear_set_slots WHERE set_id = ?'
)->execute([$newId, $set['id']]); )->execute([$newId, $set['id']]);
$pdo->prepare('INSERT INTO gear_set_skills (set_id, skill_id, level) SELECT ?, skill_id, level FROM gear_set_skills WHERE set_id = ?')
->execute([$newId, $set['id']]);
$pdo->commit(); $pdo->commit();
set_flash('success', 'Set kopiert - jetzt kannst du Varianten ausprobieren.'); set_flash('success', 'Set kopiert - jetzt kannst du Varianten ausprobieren.');
redirect('/gear.php?set=' . $newId); redirect('/gear.php?set=' . $newId);
@ -134,13 +151,6 @@ switch ($action) {
$set = $ownSet(); $set = $ownSet();
$slot = (string) ($_POST['slot'] ?? ''); $slot = (string) ($_POST['slot'] ?? '');
$back = '/gear.php?set=' . (int) $set['id'] . '&slot=' . rawurlencode($slot); $back = '/gear.php?set=' . (int) $set['id'] . '&slot=' . rawurlencode($slot);
$fail = static function (string $message, string $to) use ($wantsJson, $json): void {
if ($wantsJson) {
$json(['ok' => false, 'error' => $message]);
}
set_flash('error', $message);
redirect($to);
};
if (!isset(GEAR_SLOTS[$slot])) { if (!isset(GEAR_SLOTS[$slot])) {
$fail('Unbekannter Slot.', '/gear.php?set=' . (int) $set['id']); $fail('Unbekannter Slot.', '/gear.php?set=' . (int) $set['id']);
} }
@ -249,6 +259,81 @@ switch ($action) {
} }
set_flash('success', GEAR_SLOTS[$slot][0] . ' gespeichert.'); set_flash('success', GEAR_SLOTS[$slot][0] . ' gespeichert.');
redirect('/gear.php?set=' . (int) $set['id']); redirect('/gear.php?set=' . (int) $set['id']);
case 'save_skills':
// Stufen der Skills (level[<Skill-ID>] = 0 bis Hoechststufe der Art, 0 = nicht geplant) - nur
// Skills der Klasse des Sets, dazu hoechstens GEAR_STIGMA_SLOTS Stigma-Skills
$set = $ownSet();
$back = '/gear.php?set=' . (int) $set['id'] . '#skills';
$skills = gear_skills_for_class($set['class_name'], false);
if (!$skills) {
$fail('Für dieses Set gibt es keine Skills - wähle zuerst eine Klasse.', $back);
}
$current = gear_set_skill_levels((int) $set['id']);
$levels = [];
$errors = [];
foreach (is_array($_POST['level'] ?? null) ? $_POST['level'] : [] as $skillId => $raw) {
$skillId = (int) $skillId;
$raw = is_string($raw) ? trim($raw) : '';
if (!isset($skills[$skillId])) {
$errors[] = 'Skill #' . $skillId . ' gehört nicht zu ' . $set['class_name'] . '.';
continue;
}
$max = gear_skill_level_max($skills[$skillId]['kind']);
if (!ctype_digit($raw) || (int) $raw > $max) {
$errors[] = $skills[$skillId]['name'] . ': Stufe 0 bis ' . $max . '.';
continue;
}
$levels[$skillId] = (int) $raw;
}
// Stigmen: schon geplante bleiben, neue nur, solange Plaetze frei sind (die zuletzt gewaehlten fliegen zuerst)
$isStigma = static fn (int $id): bool => ($skills[$id]['kind'] ?? '') === 'stigma';
$stigmaCount = static fn (array $levels): int => count(array_filter(
array_replace($current, $levels),
static fn (int $level, int $id): bool => $level > 0 && $isStigma($id),
ARRAY_FILTER_USE_BOTH
));
foreach (array_reverse(array_keys($levels)) as $skillId) {
if ($stigmaCount($levels) <= GEAR_STIGMA_SLOTS) {
break;
}
if ($isStigma($skillId) && $levels[$skillId] > 0 && empty($current[$skillId])) {
unset($levels[$skillId]);
$errors[] = $skills[$skillId]['name'] . ': höchstens ' . GEAR_STIGMA_SLOTS . ' Stigma-Skills gleichzeitig - setz erst einen anderen auf „–“.';
}
}
$upsert = $pdo->prepare('INSERT INTO gear_set_skills (set_id, skill_id, level) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE level = VALUES(level)');
$remove = $pdo->prepare('DELETE FROM gear_set_skills WHERE set_id = ? AND skill_id = ?');
$pdo->beginTransaction();
foreach ($levels as $skillId => $level) {
if ($level === 0) {
$remove->execute([$set['id'], $skillId]);
} else {
$upsert->execute([$set['id'], $skillId, $level]);
}
}
$pdo->commit();
$touch((int) $set['id']);
if ($wantsJson) {
// Gespeicherter Stand, damit die Seite abgelehnte Aenderungen zuruecksetzen kann
$planned = gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [];
$json([
'ok' => true,
'summary' => gear_skill_summary($planned),
'costs' => gear_skill_costs_text($planned),
'levels' => (object) gear_set_skill_levels((int) $set['id']),
'errors' => $errors,
]);
}
if ($errors) {
set_flash('error', 'Gespeichert, aber nicht alles übernommen: ' . implode(' ', $errors));
} else {
set_flash('success', 'Skills gespeichert.');
}
redirect($back);
} }
set_flash('error', 'Unbekannte Aktion.'); set_flash('error', 'Unbekannte Aktion.');

View file

@ -110,7 +110,7 @@ const DATA_RESET_AREAS = [
], ],
'gear_sets' => [ 'gear_sets' => [
'label' => 'Gear-Planer: Sets', 'label' => 'Gear-Planer: Sets',
'description' => 'Alle Ausrüstungssets der Mitglieder. Der Katalog der Gegenstände bleibt.', 'description' => 'Alle Ausrüstungssets der Mitglieder samt geplanter Skills. Der Katalog der Gegenstände und Skills bleibt.',
'count' => 'SELECT COUNT(*) FROM gear_sets', 'count' => 'SELECT COUNT(*) FROM gear_sets',
'unit' => ['Set', 'Sets'], 'unit' => ['Set', 'Sets'],
'delete' => ['DELETE FROM gear_sets'], 'delete' => ['DELETE FROM gear_sets'],

View file

@ -3,7 +3,8 @@ declare(strict_types=1);
/** /**
* Gear-Planer: persoenliche Ausruestungssets (Gegenstand je Slot, Aufwertung, Durchbruch, * Gear-Planer: persoenliche Ausruestungssets (Gegenstand je Slot, Aufwertung, Durchbruch,
* Seelenpraegung, Manasteine) und der Katalog der Gegenstaende mit ihren Werten. * Seelenpraegung, Manasteine, Skillstufen) und der Katalog der Gegenstaende mit ihren Werten.
* Die Skills stehen in includes/gear_skills.php.
* *
* Der Katalog kommt von aion2hub.com (Global-Client, siehe includes/gear_source.php) und wird * Der Katalog kommt von aion2hub.com (Global-Client, siehe includes/gear_source.php) und wird
* von Admins unter /admin/gear_items.php uebernommen und abgeglichen. Verlaesslich sind die * von Admins unter /admin/gear_items.php uebernommen und abgeglichen. Verlaesslich sind die
@ -13,6 +14,7 @@ declare(strict_types=1);
*/ */
require_once __DIR__ . '/gear_source.php'; require_once __DIR__ . '/gear_source.php';
require_once __DIR__ . '/gear_skills.php';
const GEAR_ICON_DIR = __DIR__ . '/../assets/uploads/gear/'; const GEAR_ICON_DIR = __DIR__ . '/../assets/uploads/gear/';
const GEAR_ICON_URL = '/assets/uploads/gear/'; const GEAR_ICON_URL = '/assets/uploads/gear/';
@ -356,9 +358,15 @@ function gear_item_diff(?array $old, array $new): array
/** Icon von aion2hub laden (einmalig beim Uebernehmen). Gibt den Dateinamen zurueck oder null. */ /** Icon von aion2hub laden (einmalig beim Uebernehmen). Gibt den Dateinamen zurueck oder null. */
function gear_icon_download(int $id): ?string function gear_icon_download(int $id): ?string
{
return gear_image_download(GEAR_SOURCE_ICON_URL . $id, GEAR_ICON_DIR, (string) $id);
}
/** Bild von aion2hub als <Name>.<Endung> in $dir speichern - nur echte Bilder bis 512 KB. */
function gear_image_download(string $url, string $dir, string $baseName): ?string
{ {
try { try {
$body = gear_source_fetch(GEAR_SOURCE_ICON_URL . $id); $body = gear_source_fetch($url);
} catch (RuntimeException $e) { } catch (RuntimeException $e) {
return null; return null;
} }
@ -367,11 +375,11 @@ function gear_icon_download(int $id): ?string
if ($info === false || !isset($types[$info[2]]) || strlen($body) > 512 * 1024) { if ($info === false || !isset($types[$info[2]]) || strlen($body) > 512 * 1024) {
return null; return null;
} }
if (!is_dir(GEAR_ICON_DIR)) { if (!is_dir($dir)) {
@mkdir(GEAR_ICON_DIR, 0755, true); @mkdir($dir, 0755, true);
} }
$name = $id . '.' . $types[$info[2]]; $name = $baseName . '.' . $types[$info[2]];
return @file_put_contents(GEAR_ICON_DIR . $name, $body) !== false ? $name : null; return @file_put_contents($dir . $name, $body) !== false ? $name : null;
} }
/** /**
@ -514,7 +522,7 @@ function gear_set_item_level(array $slots): ?float
// ---- Sets ---- // ---- Sets ----
// Planer-Seiten, auf die ein Set als Skill-/Daevanion-Plan verlinken darf (auch deren Subdomains). // Planer-Seiten, auf die ein Set als Skill-/Daevanion-Plan verlinken darf (auch deren Subdomains).
// Eigene Skill- und Daevanion-Daten hat die Website (noch) nicht - bis dahin der Link zum Build. // Die Daevanion-Bretter kennt die Website (noch) nicht - dafuer der Link zum Build.
const GEAR_BUILD_HOSTS = ['aion2hub.com', 'talentbuilds.com', 'aion2t.com', 'aion2.online', 'gamers4.life', 'aion2.app']; const GEAR_BUILD_HOSTS = ['aion2hub.com', 'talentbuilds.com', 'aion2t.com', 'aion2.online', 'gamers4.life', 'aion2.app'];
const GEAR_BUILD_URL_MAX = 300; const GEAR_BUILD_URL_MAX = 300;
@ -612,14 +620,16 @@ function gear_slots_for_sets(array $setIds): array
return $result; return $result;
} }
/** Sets fuer die Profilseite: [[set, slots, item_level], …] */ /** Sets fuer die Profilseite: [[set, slots, item_level, skills], …] */
function gear_profile_sets(int $userId): array function gear_profile_sets(int $userId): array
{ {
$sets = gear_sets_for_user($userId, true); $sets = gear_sets_for_user($userId, true);
$slots = gear_slots_for_sets(array_column($sets, 'id')); $slots = gear_slots_for_sets(array_column($sets, 'id'));
$skills = gear_set_skills_for_sets($sets);
return array_map(static fn (array $set): array => [ return array_map(static fn (array $set): array => [
'set' => $set, 'set' => $set,
'slots' => $slots[(int) $set['id']] ?? [], 'slots' => $slots[(int) $set['id']] ?? [],
'item_level' => gear_set_item_level($slots[(int) $set['id']] ?? []), 'item_level' => gear_set_item_level($slots[(int) $set['id']] ?? []),
'skills' => $skills[(int) $set['id']] ?? [],
], $sets); ], $sets);
} }

378
includes/gear_skills.php Normal file
View file

@ -0,0 +1,378 @@
<?php
declare(strict_types=1);
/**
* Gear-Planer, Skills: Skill-Liste je Klasse (von aion2hub, Global-Client) und die geplante
* Skillstufe je Set.
*
* Die Listen uebernehmen Admins unter /admin/gear_items.php von den Klassenseiten bei aion2hub
* (includes/gear_source.php). Jedes Set plant die Skills seiner Klasse; wechselt die Klasse,
* bleiben die alten Stufen gespeichert (ausgeblendet) und sind beim Zurueckwechseln wieder da.
*
* Drei Arten (kind): normale aktive Skills und passive Skills (Meisterschaft, mit Skillpunkten
* gesteigert) und Stigma-Skills (mit Stigma-Splittern gesteigert, nur wenige gleichzeitig).
*/
const GEAR_SKILL_ICON_DIR = __DIR__ . '/../assets/uploads/skills/';
const GEAR_SKILL_ICON_URL = '/assets/uploads/skills/';
// Stufen (Stand: Global-Client des Launch Scale Tests und offizieller KR-Guide, geprueft 23.09.2026):
// Normale aktive und passive Skills (Meisterschaft) steigert man mit Skillpunkten bis 10, darueber
// nur mit Boni - die Daevanion-Bretter geben hoechstens +4, Ausruestung und Arcana den Rest bis 20.
// Stigma-Skills steigen mit Stigma-Splittern bis 20, hoechstens 4 lassen sich gleichzeitig ausruesten
// (Korea inzwischen 6 Plaetze und Stufe 25 - fuer spaetere Seasons hier anpassen).
const GEAR_SKILL_LEVEL_SELF = 10;
const GEAR_SKILL_DAEVANION_BONUS = 4;
const GEAR_SKILL_LEVEL_MAX = 20;
const GEAR_STIGMA_LEVEL_MAX = 20;
const GEAR_STIGMA_SLOTS = 4;
const GEAR_SKILL_KINDS = ['active' => 'Aktive Skills', 'stigma' => 'Stigma-Skills', 'passive' => 'Passive Skills'];
// Art des Skills auf Deutsch (aion2hub liefert sie englisch), unbekannte bleiben, wie sie sind
const GEAR_SKILL_CATEGORIES = [
'Attack' => 'Angriff', 'Buff' => 'Stärkung', 'Heal' => 'Heilung', 'Debuff' => 'Schwächung',
'Defense' => 'Verteidigung', 'Movement' => 'Bewegung', 'Crowd Control' => 'Kontrolle',
];
function gear_skill_icon_url(?array $skill): ?string
{
return !empty($skill['icon']) ? GEAR_SKILL_ICON_URL . rawurlencode((string) $skill['icon']) : null;
}
function gear_skill_category_label(string $category): string
{
return GEAR_SKILL_CATEGORIES[$category] ?? $category;
}
/** CSS-Klasse fuer die Farbe der Art ("skill-cat-attack"). */
function gear_skill_category_class(string $category): string
{
return 'skill-cat-' . (preg_replace('/[^a-z]+/', '-', strtolower($category)) ?: 'none');
}
/** Hoechste planbare Stufe einer Art. */
function gear_skill_level_max(string $kind): int
{
return $kind === 'stigma' ? GEAR_STIGMA_LEVEL_MAX : GEAR_SKILL_LEVEL_MAX;
}
/** Liegt die Stufe nur mit Boni (Daevanion u. a.) drin? Gilt nicht fuer Stigma-Skills. */
function gear_skill_is_bonus(string $kind, int $level): bool
{
return $kind !== 'stigma' && $level > GEAR_SKILL_LEVEL_SELF;
}
/**
* Auswahl der Stufen einer Art: [Gruppe => [Stufen]] - bei normalen Skills getrennt nach dem, was
* man dafuer braucht (Gruppe '' = ohne Ueberschrift).
*/
function gear_skill_level_groups(string $kind): array
{
if ($kind === 'stigma') {
return ['' => range(1, GEAR_STIGMA_LEVEL_MAX)];
}
$daevanion = GEAR_SKILL_LEVEL_SELF + GEAR_SKILL_DAEVANION_BONUS;
return [
'Skillpunkte' => range(1, GEAR_SKILL_LEVEL_SELF),
'Mit Daevanion (bis +' . GEAR_SKILL_DAEVANION_BONUS . ')' => range(GEAR_SKILL_LEVEL_SELF + 1, $daevanion),
'Mit Ausrüstung & Arcana' => range($daevanion + 1, GEAR_SKILL_LEVEL_MAX),
];
}
/** Skillpunkte bis zu einer Stufe (Stufe 1 gibt es beim Lernen): 2-4 je 1, 5-7 je 2, 8-10 je 4. */
function gear_skill_point_cost(int $level): int
{
$cost = 0;
for ($l = 2; $l <= min($level, GEAR_SKILL_LEVEL_SELF); $l++) {
$cost += $l <= 4 ? 1 : ($l <= 7 ? 2 : 4);
}
return $cost;
}
/** Stigma-Splitter bis zu einer Stufe (Stufe 1 = Lernen): 1-5 je 1, 6-10 je 2, 11-15 je 4, 16-20 je 8. */
function gear_stigma_shard_cost(int $level): int
{
$cost = 0;
for ($l = 1; $l <= $level; $l++) {
$cost += 2 ** intdiv($l - 1, 5);
}
return $cost;
}
/**
* Was die geplanten Stufen kosten: Skillpunkte (nur der Teil bis 10, darueber sind es Boni) und
* Stigma-Splitter.
*
* @return array{points: int, shards: int}
*/
function gear_skill_costs(array $planned): array
{
$costs = ['points' => 0, 'shards' => 0];
foreach ($planned as ['skill' => $skill, 'level' => $level]) {
if ($skill['kind'] === 'stigma') {
$costs['shards'] += gear_stigma_shard_cost($level);
} else {
$costs['points'] += gear_skill_point_cost($level);
}
}
return $costs;
}
/** "142 Skillpunkte · 55 Stigma-Splitter" */
function gear_skill_costs_text(array $planned): string
{
$costs = gear_skill_costs($planned);
return number_format($costs['points'], 0, ',', '.') . ' Skillpunkte · ' . number_format($costs['shards'], 0, ',', '.') . ' Stigma-Splitter';
}
function gear_skill(int $id): ?array
{
$stmt = db()->prepare('SELECT * FROM gear_skills WHERE id = ?');
$stmt->execute([$id]);
return $stmt->fetch() ?: null;
}
/**
* Skills einer Klasse in der Reihenfolge der Klassenseite (aktive, Stigma, passive).
* $listedOnly = false nimmt auch die, die beim letzten Abgleich nicht mehr in der Liste standen.
*
* @return array<int, array> [Skill-ID => Zeile]
*/
function gear_skills_for_class(?string $className, bool $listedOnly = true): array
{
if ($className === null || $className === '') {
return [];
}
$stmt = db()->prepare(
'SELECT * FROM gear_skills WHERE class_name = ?' . ($listedOnly ? ' AND is_listed = 1' : '') . ' ORDER BY kind, sort_order, id'
);
$stmt->execute([$className]);
$skills = [];
foreach ($stmt->fetchAll() as $row) {
$skills[(int) $row['id']] = $row;
}
return $skills;
}
/** Gespeicherte Stufen eines Sets: [Skill-ID => Stufe] (auch die einer frueheren Klasse). */
function gear_set_skill_levels(int $setId): array
{
$stmt = db()->prepare('SELECT skill_id, level FROM gear_set_skills WHERE set_id = ? AND level > 0');
$stmt->execute([$setId]);
return array_map('intval', $stmt->fetchAll(PDO::FETCH_KEY_PAIR));
}
/**
* Geplante Skills mehrerer Sets - nur die der Klasse des Sets und mit Stufe, in der Reihenfolge
* der Klassenseite.
*
* @param array<int, array> $sets Zeilen aus gear_sets (id, class_name)
* @return array<int, array<int, array{skill: array, level: int}>> [Set-ID => [Skill-ID => …]]
*/
function gear_set_skills_for_sets(array $sets): array
{
$classes = [];
foreach ($sets as $set) {
$classes[(int) $set['id']] = (string) ($set['class_name'] ?? '');
}
$result = array_fill_keys(array_keys($classes), []);
if (!$classes) {
return $result;
}
$stmt = db()->prepare(
'SELECT gss.set_id, gss.level, sk.* FROM gear_set_skills gss JOIN gear_skills sk ON sk.id = gss.skill_id
WHERE gss.set_id IN (' . implode(',', array_fill(0, count($classes), '?')) . ') AND gss.level > 0
ORDER BY sk.kind, sk.sort_order, sk.id'
);
$stmt->execute(array_keys($classes));
foreach ($stmt->fetchAll() as $row) {
$setId = (int) $row['set_id'];
if ($row['class_name'] !== $classes[$setId]) {
continue; // von einer frueheren Klasse des Sets
}
$level = (int) $row['level'];
unset($row['set_id'], $row['level']);
$result[$setId][(int) $row['id']] = ['skill' => $row, 'level' => $level];
}
return $result;
}
/** "14 Skills geplant · 4/4 Stigmen · 3 über Stufe 10" */
function gear_skill_summary(array $planned): string
{
if (!$planned) {
return 'Noch keine Skills geplant';
}
$stigma = count(array_filter($planned, static fn (array $p): bool => $p['skill']['kind'] === 'stigma'));
$bonus = count(array_filter($planned, static fn (array $p): bool => gear_skill_is_bonus($p['skill']['kind'], $p['level'])));
return count($planned) . (count($planned) === 1 ? ' Skill' : ' Skills') . ' geplant'
. ($stigma ? ' · ' . $stigma . '/' . GEAR_STIGMA_SLOTS . ' Stigmen' : '')
. ($bonus ? ' · ' . $bonus . ' über Stufe ' . GEAR_SKILL_LEVEL_SELF : '');
}
/**
* Kleine Icon-Reihe der geplanten Skills fuer Set-Karten: die hoechsten Stufen zuerst, mit Stufe.
*
* @param array<int, array{skill: array, level: int}> $planned
*/
function gear_skills_mini_html(array $planned, int $limit = 8): string
{
if (!$planned) {
return '';
}
$sorted = array_values($planned);
usort($sorted, static fn (array $a, array $b): int => $b['level'] <=> $a['level']);
$html = '<span class="gear-skill-mini">';
foreach (array_slice($sorted, 0, $limit) as ['skill' => $skill, 'level' => $level]) {
$url = gear_skill_icon_url($skill);
$html .= '<span class="gear-skill-mini-icon' . (gear_skill_is_bonus($skill['kind'], $level) ? ' is-bonus' : '')
. ($skill['kind'] === 'stigma' ? ' is-stigma' : '') . '" title="'
. e($skill['name'] . ($skill['kind'] === 'stigma' ? ' (Stigma)' : '') . ' – Stufe ' . $level) . '">'
. ($url ? '<img src="' . e($url) . '" alt="" loading="lazy">' : '<span>' . e(mb_substr((string) $skill['name'], 0, 1)) . '</span>')
. '<span class="gear-skill-mini-level">' . $level . '</span></span>';
}
if (count($sorted) > $limit) {
$html .= '<span class="gear-skill-mini-more">+' . (count($sorted) - $limit) . '</span>';
}
return $html . '</span>';
}
// ---- Uebernehmen von aion2hub ----
/** Skill-Icon von aion2hub laden (einmalig). Gibt den Dateinamen zurueck oder null. */
function gear_skill_icon_download(int $id): ?string
{
return gear_image_download(GEAR_SOURCE_SKILL_ICON_URL . $id, GEAR_SKILL_ICON_DIR, (string) $id);
}
/** Schon vorhandene Icon-Datei eines Skills (z.B. nach dem Entfernen und erneuten Uebernehmen). */
function gear_skill_icon_on_disk(int $id): ?string
{
foreach (['webp', 'png', 'jpg', 'gif'] as $extension) {
if (is_file(GEAR_SKILL_ICON_DIR . $id . '.' . $extension)) {
return $id . '.' . $extension;
}
}
return null;
}
/**
* Ausgelesene Skill-Liste einer Klasse speichern (gear_source_parse_class_skills). Skills, die
* nicht mehr in der Liste stehen, bleiben fuer bestehende Plaene erhalten und werden nur markiert.
*
* @return array{total: int, new: string[], changed: string[], same: int, unlisted: string[], missing_icons: int[], source_version: string}
*/
function gear_skills_store(string $className, array $parsed, int $userId): array
{
$pdo = db();
$ids = array_column($parsed['skills'], 'id');
$stmt = $pdo->prepare(
'SELECT * FROM gear_skills WHERE class_name = ?'
. ($ids ? ' OR id IN (' . implode(',', array_fill(0, count($ids), '?')) . ')' : '')
);
$stmt->execute([$className, ...$ids]);
$old = [];
foreach ($stmt->fetchAll() as $row) {
$old[(int) $row['id']] = $row;
}
$result = [
'total' => count($parsed['skills']), 'new' => [], 'changed' => [], 'same' => 0, 'unlisted' => [],
'missing_icons' => [], 'source_version' => $parsed['source_version'],
];
$upsert = $pdo->prepare(
'INSERT INTO gear_skills (id, class_name, name, kind, category, sort_order, source_version, is_listed, checked_at, checked_by)
VALUES (?, ?, ?, ?, ?, ?, ?, 1, NOW(), ?)
ON DUPLICATE KEY UPDATE class_name = VALUES(class_name), name = VALUES(name), kind = VALUES(kind), category = VALUES(category),
sort_order = VALUES(sort_order), source_version = VALUES(source_version), is_listed = 1,
checked_at = NOW(), checked_by = VALUES(checked_by)'
);
$pdo->beginTransaction();
try {
foreach ($parsed['skills'] as $index => $skill) {
$before = $old[$skill['id']] ?? null;
$upsert->execute([
$skill['id'], $className, $skill['name'], $skill['kind'], $skill['category'], $index + 1,
mb_substr($parsed['source_version'], 0, 120), $userId,
]);
if ($before === null) {
$result['new'][] = $skill['name'];
} else {
$changes = [];
if ($before['name'] !== $skill['name']) {
$changes[] = 'Name ' . $before['name'] . ' → ' . $skill['name'];
}
if ($before['kind'] !== $skill['kind']) {
$changes[] = ['active' => 'jetzt aktiv', 'stigma' => 'jetzt Stigma', 'passive' => 'jetzt passiv'][$skill['kind']] ?? $skill['kind'];
}
if ($before['category'] !== $skill['category']) {
$changes[] = 'Art ' . ($before['category'] ?: '–') . ' → ' . ($skill['category'] ?: '–');
}
if ($before['class_name'] !== $className) {
$changes[] = 'Klasse ' . $before['class_name'] . ' → ' . $className;
}
if (!(int) $before['is_listed']) {
$changes[] = 'wieder in der Liste';
}
if ($changes) {
$result['changed'][] = $skill['name'] . ' (' . implode(', ', $changes) . ')';
} else {
$result['same']++;
}
}
if ($before === null || empty($before['icon']) || !is_file(GEAR_SKILL_ICON_DIR . $before['icon'])) {
// Liegt die Datei noch da, reicht es, sie wieder einzutragen - sonst spaeter laden
$onDisk = gear_skill_icon_on_disk($skill['id']);
if ($onDisk !== null) {
$pdo->prepare('UPDATE gear_skills SET icon = ? WHERE id = ?')->execute([$onDisk, $skill['id']]);
} else {
$result['missing_icons'][] = $skill['id'];
}
}
}
$listed = array_flip($ids);
$unlist = $pdo->prepare('UPDATE gear_skills SET is_listed = 0 WHERE id = ?');
foreach ($old as $id => $row) {
if (!isset($listed[$id]) && $row['class_name'] === $className && (int) $row['is_listed']) {
$unlist->execute([$id]);
$result['unlisted'][] = $row['name'];
}
}
$pdo->commit();
} catch (Throwable $e) {
$pdo->rollBack();
throw $e;
}
return $result;
}
/**
* Stand des Skill-Katalogs je Klasse fuer die Verwaltung.
*
* @return array<string, array{active: int, stigma: int, passive: int, unlisted: int, no_icon: int, checked_at: ?string, source_version: string}>
*/
function gear_skill_catalog_status(): array
{
$status = [];
foreach (AION_CLASSES as $class) {
$status[$class] = ['active' => 0, 'stigma' => 0, 'passive' => 0, 'unlisted' => 0, 'no_icon' => 0, 'checked_at' => null, 'source_version' => ''];
}
$rows = db()->query(
"SELECT class_name, SUM(is_listed = 1 AND kind = 'active') AS active, SUM(is_listed = 1 AND kind = 'stigma') AS stigma,
SUM(is_listed = 1 AND kind = 'passive') AS passive, SUM(is_listed = 0) AS unlisted, SUM(icon IS NULL) AS no_icon,
MAX(checked_at) AS checked_at, MAX(source_version) AS source_version
FROM gear_skills GROUP BY class_name"
)->fetchAll();
foreach ($rows as $row) {
if (isset($status[$row['class_name']])) {
$status[$row['class_name']] = [
'active' => (int) $row['active'], 'stigma' => (int) $row['stigma'], 'passive' => (int) $row['passive'],
'unlisted' => (int) $row['unlisted'], 'no_icon' => (int) $row['no_icon'], 'checked_at' => $row['checked_at'],
'source_version' => (string) $row['source_version'],
];
}
}
return $status;
}

View file

@ -156,6 +156,129 @@ function gear_source_stat_list(string $text): array
return $stats; return $stats;
} }
// ---- Skills (Klassenseiten, z.B. aion2hub.com/classes/chanter) ----
const GEAR_SOURCE_CLASS_URL = 'https://aion2hub.com/classes/';
const GEAR_SOURCE_SKILL_ICON_URL = 'https://aion2hub.com/api/skill-icon/';
// Klassen der Website => Adresse und Name bei aion2hub (ohne den Brawler, den es bei uns nicht gibt)
const GEAR_SOURCE_CLASSES = [
'Templer' => ['templar', 'Templar'],
'Gladiator' => ['gladiator', 'Gladiator'],
'Assassine' => ['assassin', 'Assassin'],
'Jäger' => ['ranger', 'Ranger'],
'Magier' => ['sorcerer', 'Sorcerer'],
'Beschwörer' => ['spiritmaster', 'Spiritmaster'],
'Kleriker' => ['cleric', 'Cleric'],
'Kantor' => ['chanter', 'Chanter'],
];
/**
* Liest die Skill-Liste einer Klassenseite aus: "<Klasse> skills", darunter "Active skills" und
* "Passive skills" als Karten (Icon /api/skill-icon/<ID>, Name, Art wie "Attack" - bei manchen
* fehlt die Art). Nur diese Kernliste stammt aus dem Global-Client; der Abschnitt danach
* ("More … skills (Korea/Taiwan client data)") ist ungeprueft und wird bewusst ausgelassen.
*
* Die aktiven Skills stehen dort in der Reihenfolge des Spiels: erst die 12 normalen (Meisterschaft,
* mit Skillpunkten gesteigert), dann "Dodge", danach die Stigma-Skills. Alles nach Dodge wird
* deshalb als kind "stigma" gefuehrt, Dodge selbst (ohne Stufen) ausgelassen. Abgeglichen mit den
* Meisterschafts- und Stigma-Listen aus dem Global-Client (Stand Launch Scale Test, alle 8 Klassen).
*
* @return array{class: string, source_version: string, skills: array<int, array{id: int, name: string, kind: string, category: string}>}
*/
function gear_source_parse_class_skills(string $html, string $expectedClass): array
{
$html = preg_replace('#<(script|style|noscript)\b.*?</\1>#is', '', $html) ?? '';
// Ueberschriften der Seite mit Position, um die Abschnitte abzugrenzen
preg_match_all('#<(h2|h3)\b[^>]*>(.*?)</\1>#is', $html, $headings, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
$core = null;
$coreEnd = strlen($html);
foreach ($headings as $heading) {
$text = trim(html_entity_decode(strip_tags($heading[2][0]), ENT_QUOTES | ENT_HTML5, 'UTF-8'));
$position = $heading[0][1];
if ($core === null && $heading[1][0] === 'h2' && preg_match('/^(\S+) skills$/i', $text, $m)) {
$core = ['class' => $m[1], 'start' => $position + strlen($heading[0][0])];
} elseif ($core !== null && $heading[1][0] === 'h2') {
$coreEnd = $position;
break;
}
}
if ($core === null) {
throw new RuntimeException('Die Seite sieht nicht wie eine Klassenseite von aion2hub aus (keine Skill-Liste gefunden).');
}
if (strcasecmp($core['class'], $expectedClass) !== 0) {
throw new RuntimeException('Die Seite gehört zu einer anderen Klasse (' . $core['class'] . ').');
}
$section = substr($html, $core['start'], $coreEnd - $core['start']);
// "Core skill list — 26 active and 10 passive skills — from Global data (Launch Scale Test client, 2026-09-19)."
$intro = implode(' ', gear_source_tokens(substr($section, 0, (int) (stripos($section, '<h3') ?: strlen($section)))));
preg_match('/(\d+)\s+active\s+and\s+(\d+)\s+passive/i', $intro, $counts);
$version = preg_match('/from\s+(.+?)\.?$/i', $intro, $m) ? trim($m[1]) : '';
if (!str_contains($version, 'Global')) {
throw new RuntimeException('Keine Skill-Liste aus dem Global-Client gefunden - nicht übernommen.');
}
// Abschnitte "Active skills" / "Passive skills", darin je Karte: Icon-ID, dann Name und (optional) Art
$parts = preg_split('#<h3\b[^>]*>(.*?)</h3>#is', $section, -1, PREG_SPLIT_DELIM_CAPTURE) ?: [];
$skills = [];
for ($i = 1; $i < count($parts) - 1; $i += 2) {
$title = strtolower(trim(html_entity_decode(strip_tags($parts[$i]), ENT_QUOTES | ENT_HTML5, 'UTF-8')));
$kind = str_starts_with($title, 'active') ? 'active' : (str_starts_with($title, 'passive') ? 'passive' : null);
if ($kind === null) {
continue;
}
$cards = preg_split('#(?=<img\b[^>]*src="/api/skill-icon/\d+")#i', $parts[$i + 1]) ?: [];
foreach ($cards as $card) {
if (!preg_match('#^<img\b[^>]*src="/api/skill-icon/(\d{4,10})"#i', $card, $id)) {
continue;
}
$tokens = gear_source_tokens($card);
$name = $tokens[0] ?? '';
if ($name === '' || mb_strlen($name) > 100) {
throw new RuntimeException('Skill #' . $id[1] . ' ohne lesbaren Namen - hat sich die Seite geändert?');
}
$skills[(int) $id[1]] = [
'id' => (int) $id[1],
'name' => $name,
'kind' => $kind,
'category' => mb_substr($tokens[1] ?? '', 0, 30),
];
}
}
// Stimmen die Zahlen nicht mit der Angabe oben ueberein, hat sich der Aufbau der Seite geaendert
$active = count(array_filter($skills, static fn (array $s): bool => $s['kind'] === 'active'));
$passive = count($skills) - $active;
if (!$skills || ($counts && ((int) $counts[1] !== $active || (int) $counts[2] !== $passive))) {
throw new RuntimeException('Skill-Liste nicht vollständig gelesen (' . $active . ' aktive, ' . $passive . ' passive'
. ($counts ? ', laut Seite ' . (int) $counts[1] . ' und ' . (int) $counts[2] : '') . ') - hat sich die Seite geändert?');
}
// Aktive Skills nach "Dodge" sind Stigma-Skills
$dodge = null;
foreach ($skills as $id => $skill) {
if ($skill['kind'] === 'active' && strcasecmp($skill['name'], 'Dodge') === 0) {
$dodge = $id;
break;
}
}
if ($dodge === null) {
throw new RuntimeException('„Dodge“ steht nicht in der Skill-Liste - ohne ihn lassen sich normale und Stigma-Skills nicht trennen. Hat sich die Seite geändert?');
}
$afterDodge = false;
foreach ($skills as $id => $skill) {
if ($skill['kind'] === 'active' && $afterDodge) {
$skills[$id]['kind'] = 'stigma';
}
$afterDodge = $afterDodge || $id === $dodge;
}
// Dodge selbst (Ausweichen) hat keine Stufen - im Planer hat er nichts zu suchen
unset($skills[$dodge]);
return ['class' => $core['class'], 'source_version' => $version, 'skills' => array_values($skills)];
}
/** /**
* Liest eine Gegenstandsseite von aion2hub aus. * Liest eine Gegenstandsseite von aion2hub aus.
* *

View file

@ -19,6 +19,18 @@ const PATCHNOTE_TYPES = [
]; ];
const PATCHNOTES = [ const PATCHNOTES = [
[
'id' => '2026-09-23-b',
'date' => '2026-09-23',
'title' => 'Skillplaner im Gear-Planer',
'summary' => 'Plane zu jedem Set die Skills deiner Klasse - mit Stufen, Stigmen und Vergleich.',
'changes' => [
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Skillplaner: Jedes Set zeigt die Skills seiner Klasse - aktive, Stigma- und passive Skills mit Icons, so wie sie im Global-Client stehen. Pro Skill wählst du die geplante Stufe, jede Änderung speichert sofort.'],
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Stufen wie im Spiel: Aktive und passive Skills gehen mit Skillpunkten bis 10, darüber nur mit Boni - die Daevanion-Bretter geben höchstens +4, Ausrüstung und Arcana den Rest bis 20 (violett markiert). Stigma-Skills gehen bis 20, und wie im Spiel lassen sich höchstens 4 gleichzeitig auswählen. Der Planer rechnet mit, wie viele Skillpunkte und Stigma-Splitter dein Plan kostet.'],
['type' => 'verbessert', 'area' => 'Gear-Planer', 'text' => 'Geplante Skills erscheinen auf den Set-Karten, auf deiner Profilseite und im Vergleich - dort mit dem Unterschied zum ersten Set. Kopierte Sets übernehmen die Skills, und wechselst du die Klasse eines Sets, bleiben die alten Stufen gespeichert, bis du zurückwechselst.'],
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Die Skill-Listen aller Klassen übernimmt, wer den Gear-Planer verwalten darf (gear.manage), einmal unter „Gegenstände & Skills verwalten“ von aion2hub - das dauert beim ersten Mal wegen der Icons etwa 5-10 Minuten. Nach Patches reicht ein kurzer Abgleich.', 'audience' => 'leitung'],
],
],
[ [
'id' => '2026-09-23', 'id' => '2026-09-23',
'date' => '2026-09-23', 'date' => '2026-09-23',

View file

@ -11,7 +11,7 @@ declare(strict_types=1);
*/ */
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu. // Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
const SCHEMA_VERSION = 34; const SCHEMA_VERSION = 35;
/** /**
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql). * Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
@ -135,6 +135,43 @@ CREATE TABLE IF NOT EXISTS gear_set_slots (
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE, FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE,
FOREIGN KEY (item_id) REFERENCES gear_items(id) ON DELETE SET NULL FOREIGN KEY (item_id) REFERENCES gear_items(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SQL,
// Skillplaner im Gear-Planer (includes/gear_skills.php)
'gear_skills' => <<<'SQL'
CREATE TABLE IF NOT EXISTS gear_skills (
-- Skill-ID aus dem Spiel (wie bei aion2hub.com/api/skill-icon/<ID>)
id INT UNSIGNED NOT NULL PRIMARY KEY,
-- Klasse wie in AION_CLASSES (Templer, Kantor, ...)
class_name VARCHAR(30) NOT NULL,
name VARCHAR(100) NOT NULL,
-- active = normaler aktiver Skill, stigma = Stigma-Skill, passive = passiver Skill
kind ENUM('active', 'stigma', 'passive') NOT NULL DEFAULT 'active',
-- Art laut aion2hub (Attack, Buff, Heal, ...) - bei manchen Skills leer
category VARCHAR(30) NOT NULL DEFAULT '',
-- Reihenfolge wie auf der Klassenseite
sort_order SMALLINT UNSIGNED NOT NULL DEFAULT 0,
-- Dateiname unter assets/uploads/skills/
icon VARCHAR(40) NULL,
source_version VARCHAR(120) NOT NULL DEFAULT '',
-- 0 = stand beim letzten Abgleich nicht mehr in der Liste (bleibt fuer bestehende Plaene)
is_listed TINYINT(1) NOT NULL DEFAULT 1,
checked_at DATETIME NULL,
checked_by INT UNSIGNED NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (checked_by) REFERENCES users(id) ON DELETE SET NULL,
INDEX idx_gear_skills_class (class_name, kind, sort_order)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SQL,
'gear_set_skills' => <<<'SQL'
CREATE TABLE IF NOT EXISTS gear_set_skills (
set_id INT UNSIGNED NOT NULL,
skill_id INT UNSIGNED NOT NULL,
-- Geplante Stufe 1-20 (GEAR_SKILL_LEVEL_MAX / GEAR_STIGMA_LEVEL_MAX in includes/gear_skills.php)
level TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (set_id, skill_id),
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE,
FOREIGN KEY (skill_id) REFERENCES gear_skills(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SQL, SQL,
// "Angemeldet bleiben" (includes/auth.php) // "Angemeldet bleiben" (includes/auth.php)
'auth_tokens' => <<<'SQL' 'auth_tokens' => <<<'SQL'

View file

@ -148,6 +148,13 @@ include __DIR__ . '/includes/header.php';
<?php endforeach; ?> <?php endforeach; ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
<?php if ($gear['skills']): ?>
<?php // Geplante Skills: die hoechsten Stufen zuerst ?>
<span class="gear-set-card-skills">
<span class="text-muted"><?= e(gear_skill_summary($gear['skills'])) ?></span>
<?= gear_skills_mini_html($gear['skills'], 10) ?>
</span>
<?php endif; ?>
<span class="gear-set-card-more">Details ansehen &rarr;</span> <span class="gear-set-card-more">Details ansehen &rarr;</span>
</span> </span>
</a> </a>

View file

@ -667,6 +667,41 @@ CREATE TABLE IF NOT EXISTS gear_set_slots (
FOREIGN KEY (item_id) REFERENCES gear_items(id) ON DELETE SET NULL FOREIGN KEY (item_id) REFERENCES gear_items(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Skillplaner: Skills je Klasse (von aion2hub, Global-Client) und geplante Stufe je Set
CREATE TABLE IF NOT EXISTS gear_skills (
-- Skill-ID aus dem Spiel (wie bei aion2hub.com/api/skill-icon/<ID>)
id INT UNSIGNED NOT NULL PRIMARY KEY,
-- Klasse wie in AION_CLASSES (Templer, Kantor, ...)
class_name VARCHAR(30) NOT NULL,
name VARCHAR(100) NOT NULL,
-- active = normaler aktiver Skill, stigma = Stigma-Skill, passive = passiver Skill
kind ENUM('active', 'stigma', 'passive') NOT NULL DEFAULT 'active',
-- Art laut aion2hub (Attack, Buff, Heal, ...) - bei manchen Skills leer
category VARCHAR(30) NOT NULL DEFAULT '',
-- Reihenfolge wie auf der Klassenseite
sort_order SMALLINT UNSIGNED NOT NULL DEFAULT 0,
-- Dateiname unter assets/uploads/skills/
icon VARCHAR(40) NULL,
source_version VARCHAR(120) NOT NULL DEFAULT '',
-- 0 = stand beim letzten Abgleich nicht mehr in der Liste (bleibt fuer bestehende Plaene)
is_listed TINYINT(1) NOT NULL DEFAULT 1,
checked_at DATETIME NULL,
checked_by INT UNSIGNED NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (checked_by) REFERENCES users(id) ON DELETE SET NULL,
INDEX idx_gear_skills_class (class_name, kind, sort_order)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS gear_set_skills (
set_id INT UNSIGNED NOT NULL,
skill_id INT UNSIGNED NOT NULL,
-- Geplante Stufe 1-20 (GEAR_SKILL_LEVEL_MAX / GEAR_STIGMA_LEVEL_MAX in includes/gear_skills.php)
level TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (set_id, skill_id),
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE,
FOREIGN KEY (skill_id) REFERENCES gear_skills(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Lumipunkte fuer "Ich bin da" beim Aktivitaetscheck (die Checks selbst liegen beim Bot) -- Lumipunkte fuer "Ich bin da" beim Aktivitaetscheck (die Checks selbst liegen beim Bot)
CREATE TABLE IF NOT EXISTS activity_settings ( CREATE TABLE IF NOT EXISTS activity_settings (
-- ID des Aktivitaetschecks beim Bot -- ID des Aktivitaetschecks beim Bot