LuminaWebsite/admin/gear_items.php
Maaxxs b7f170432c Gear planner: skill icons are checked against the game client and replaced where aion2hub is wrong
A member reported a wrong icon for the Chanter skill Zauber der Genesung (18120000). The file on the
site is byte-identical to what aion2hub still serves for that ID; the game icon is ICON_CH_SKILL_013
(named by aion2.app after the official NCSOFT API, same on questlog).

- gear_source_parse_skill_info reads the 64 px skill icon's file name from the aion2.app page.
- "Beschreibungen übernehmen" replaces the icon file where the image differs
  (gear_skill_icon_replace): from aion2.app/db-item-icons/, and if the file is missing there (as for
  ICON_CH_SKILL_013) the same file from the questlog CDN. The name is stored in gear_skills.info
  (icon), so later runs only load on a new name; skills without a checked icon count as missing, a
  failed download is retried. gear_source_fetch allows cdn.questlog.gg for this.
- Icon URLs carry their modification time (?v=), so a replaced icon shows up right away.
- The import log and audit summary count replaced icons; admin hint, README and patch notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 00:22:34 +02:00

317 lines
21 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* 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. Dazu die
* Skill-Listen der Klassen fuer den Skillplaner und die Daten der Seiten Arcana, Pets, Daevanion,
* Pantheon und Closet aus dem Build-Planer.
*/
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/gear.php';
require_once __DIR__ . '/../includes/gear_planner.php';
require_permission('gear.manage');
$query = mb_substr(trim((string) ($_GET['q'] ?? '')), 0, 100);
$slotFilter = (string) ($_GET['slot'] ?? '');
$slotNames = db()->query('SELECT slot, COUNT(*) FROM gear_items GROUP BY slot ORDER BY slot')->fetchAll(PDO::FETCH_KEY_PAIR);
if (!isset($slotNames[$slotFilter])) {
$slotFilter = '';
}
$conditions = [];
$params = [];
if ($query !== '') {
$conditions[] = '(g.name LIKE ? OR g.id = ?)';
$params[] = '%' . addcslashes($query, '%_\\') . '%';
$params[] = ctype_digit($query) ? (int) $query : 0;
}
if ($slotFilter !== '') {
$conditions[] = 'g.slot = ?';
$params[] = $slotFilter;
}
$where = $conditions ? 'WHERE ' . implode(' AND ', $conditions) : '';
$countStmt = db()->prepare("SELECT COUNT(*) FROM gear_items g $where");
$countStmt->execute($params);
$total = (int) $countStmt->fetchColumn();
$perPage = 50;
$pageCount = max(1, (int) ceil($total / $perPage));
$page = min($pageCount, max(1, (int) ($_GET['page'] ?? 1)));
$stmt = db()->prepare(
"SELECT g.*, (SELECT COUNT(*) FROM gear_set_slots s WHERE s.item_id = g.id) AS used
FROM gear_items g $where ORDER BY g.item_level DESC, g.name LIMIT $perPage OFFSET " . (($page - 1) * $perPage)
);
$stmt->execute($params);
$items = array_map('gear_item_decode', $stmt->fetchAll());
$allIds = array_map('intval', db()->query('SELECT id FROM gear_items ORDER BY checked_at, id')->fetchAll(PDO::FETCH_COLUMN));
$lastVersion = (string) db()->query('SELECT source_version FROM gear_items ORDER BY checked_at DESC LIMIT 1')->fetchColumn();
$listUrl = static function (array $overrides = []) use ($query, $slotFilter): string {
$params = array_filter(array_merge(['q' => $query, 'slot' => $slotFilter], $overrides), static fn ($v): bool => $v !== '' && $v !== null);
return '/admin/gear_items.php?' . ($params ? http_build_query($params) . '&' : '');
};
$pageTitle = 'Gear-Planer: Gegenstände & Skills';
$containerWide = true;
include __DIR__ . '/../includes/header.php';
?>
<div class="panel">
<h1>Gear-Planer: Gegenstände &amp; Skills</h1>
<p class="text-muted">
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.
<?php if ($lastVersion !== ''): ?>Zuletzt abgeglichener Stand: <strong><?= e($lastVersion) ?></strong>.<?php endif; ?>
</p>
<div class="gear-import" id="gear-import"
data-action="/admin/gear_items_action.php" data-csrf="<?= e(csrf_token()) ?>" data-all-ids="<?= e(json_encode($allIds)) ?>">
<h2>Übernehmen</h2>
<p class="text-muted">
Gegenstands-ID, Link zu einem Gegenstand (<code>aion2hub.com/database/items/110130060</code>) oder
eine Liste - dann werden <strong>alle Seiten</strong> der Liste übernommen:
</p>
<ul class="text-muted gear-import-examples">
<li><code>aion2hub.com/database</code> - alle Waffen, Rüstungen und Schmuckstücke (rund 3.600, dauert gut eine Stunde)</li>
<li><code>aion2hub.com/database?grade=Unique</code> - nur eine Seltenheit, in allen drei Kategorien</li>
<li><code>aion2hub.com/database?cat=Armor&amp;grade=Heroic</code> - eine Kategorie mit Seltenheit</li>
</ul>
<p class="text-muted">Tränke, Materialien, Skins usw. werden nicht übernommen, nur Ausrüstung.</p>
<div class="gear-import-row">
<input type="text" id="gear-import-input" placeholder="ID oder aion2hub-Link …" aria-label="ID oder aion2hub-Link">
<label class="checkbox-label"><input type="checkbox" id="gear-import-skip" checked> schon vorhandene überspringen</label>
<button type="button" class="button" id="gear-import-start">Übernehmen</button>
</div>
<div class="gear-import-row">
<button type="button" class="button button-secondary" id="gear-check-all"<?= $allIds ? '' : ' disabled' ?>>
Alle <?= count($allIds) ?> abgleichen
</button>
<label class="checkbox-label"><input type="checkbox" id="gear-check-apply"> Änderungen gleich übernehmen</label>
<button type="button" class="button button-secondary" id="gear-import-stop" hidden>Anhalten</button>
</div>
<div class="gear-import-progress" id="gear-import-progress" hidden>
<div class="gear-progress-bar"><span id="gear-progress-fill"></span></div>
<div class="text-muted" id="gear-progress-text"></div>
<ol class="gear-import-log" id="gear-import-log"></ol>
</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. Deutsche Namen und die Namen der Spezialisierungen trägst du unter
„Namen &amp; Spezialisierungen“ ein (aion2hub hat nur englische). Die Effekte der Spezialisierungen und Stigma-Boni
kommen mit den <a href="#planner">Planer-Daten</a> (englisch, alle Klassen auf einmal - vorher die Skills übernehmen).
„Beschreibungen übernehmen“ holt für jeden Skill die Beschreibung aus dem deutschen Client von
<a href="https://aion2.app/de/db/skills" target="_blank" rel="noopener">aion2.app</a> samt Werten je Stufe (erscheint im Planer beim Drüberfahren,
mit den Werten der geplanten Stufe) und trägt dabei die offiziellen deutschen Namen und Texte der Spezialisierungen ein, wo noch keine
stehen (etwa 5 Minuten für alle, eine Seite pro Sekunde - „nur fehlende“ holt auch die, denen noch die Werte je Stufe fehlen).
Die Icons werden beim Übernehmen der Skills einmalig von aion2hub mitgeladen
(beim ersten Mal etwa 5-10 Minuten für alle Klassen, danach reicht ein kurzer Abgleich). Weil aion2hub bei manchen Skills ein falsches
Symbol hat, gleicht „Beschreibungen übernehmen“ es mit dem aus dem Spielclient (aion2.app) ab und ersetzt es, wo es abweicht – beim ersten
Mal für alle Skills, danach nur, wenn sich das Symbol im Spiel ändert.
</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 title="Aktive und Stigma-Skills mit Effekten der Spezialisierungen bzw. Boni">Effekte</th><th title="Skills mit Beschreibung und Werten je Stufe aus dem deutschen Client (aion2.app)">Beschreibung</th><th>Ohne Icon</th><th>Nicht mehr gelistet</th><th>Abgeglichen</th><th></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['active'] + $row['stigma'] > 0 ? $row['effects'] . '/' . ($row['active'] + $row['stigma']) : '<span class="text-muted">–</span>' ?></td>
<td><?= $row['active'] + $row['stigma'] + $row['passive'] > 0 ? $row['info'] . '/' . ($row['active'] + $row['stigma'] + $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>
<td>
<?php if ($row['active'] + $row['stigma'] + $row['passive'] > 0): ?>
<a class="button button-secondary button-small" href="/admin/gear_skills.php?class=<?= e(rawurlencode($class)) ?>">Namen &amp; Spezialisierungen</a>
<?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-info-start">Beschreibungen übernehmen</button>
<label class="checkbox-label"><input type="checkbox" id="skill-info-missing" checked> nur fehlende</label>
<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>
<?php
$plannerStatus = gear_planner_data_status();
$plannerIcons = gear_planner_icon_ids();
$plannerIconsMissing = count(array_filter($plannerIcons, static fn (int $id): bool => gear_planner_icon_url($id) === null));
$plannerClasses = gear_planner_data('daevanion')['classes'] ?? [];
?>
<div class="panel" id="planner">
<h2>Planer-Daten: Arcana, Pets, Daevanion, Pantheon, Closet</h2>
<p class="text-muted">
Diese Seiten der Sets bauen auf dem <a href="<?= e(GEAR_SOURCE_PLANNER_URL) ?>" target="_blank" rel="noopener">Build-Planer von aion2hub</a>
auf: Arcana-Karten, Pets, Daevanion-Bretter, Pantheon-Dekorationen und Closet-Skins samt Werten (Global-Client).
„Planer-Daten übernehmen“ sucht sie in den Dateien des Planers (eine nach der anderen, meist reichen drei) und bringt
die Effekte der Spezialisierungen und Stigma-Boni gleich mit. Die Bilder für Arcana, Pets und Pantheon lädt
„Bilder laden“ einmalig (beim ersten Mal etwa 6 Minuten, danach nur neue) - der Closet kommt ohne Bilder aus.
</p>
<div class="table-scroll">
<table class="gear-admin-table">
<thead><tr><th>Datensatz</th><th>Seite</th><th>Stand bei aion2hub</th><th>Zuletzt geändert</th><th>Abgeglichen</th><th>Größe</th></tr></thead>
<tbody>
<?php foreach (GEAR_PLANNER_PARTS as $partName => [$partLabel, $partSection]): ?>
<?php $row = $plannerStatus[$partName] ?? null; ?>
<tr>
<td><?= e($partLabel) ?><?= $partName === 'daevanion' && $plannerClasses ? ' <span class="text-muted">(' . count($plannerClasses) . ' Klassen)</span>' : '' ?></td>
<td><?= e($partSection !== '' ? GEAR_PLAN_SECTIONS[$partSection] : 'alle') ?></td>
<?php if ($row): ?>
<td><?= $row['built_at'] !== '' ? e($row['built_at']) : '<span class="text-muted">–</span>' ?></td>
<td class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $row['updated_at']))) ?></td>
<td class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $row['checked_at']))) ?></td>
<td class="text-muted"><?= e(number_format(((int) $row['bytes']) / 1024, 0, ',', '.')) ?> KB</td>
<?php else: ?>
<td colspan="4" class="text-muted">noch nicht übernommen</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<p class="text-muted">
Bilder: <?= count($plannerIcons) - $plannerIconsMissing ?> von <?= count($plannerIcons) ?> geladen<?= $plannerIconsMissing ? ' – ' . $plannerIconsMissing . ' fehlen noch' : '' ?>.
</p>
<div class="gear-import" id="planner-import">
<div class="gear-import-row">
<button type="button" class="button" id="planner-import-start">Planer-Daten übernehmen / abgleichen</button>
<button type="button" class="button button-secondary" id="planner-icons-start"<?= $plannerIcons ? '' : ' disabled title="Erst die Planer-Daten übernehmen"' ?>>Bilder laden</button>
<button type="button" class="button button-secondary" id="planner-import-stop" hidden>Anhalten</button>
</div>
<div class="gear-import-progress" id="planner-import-progress" hidden>
<div class="gear-progress-bar"><span id="planner-progress-fill"></span></div>
<div class="text-muted" id="planner-progress-text"></div>
<ol class="gear-import-log" id="planner-import-log"></ol>
</div>
</div>
</div>
<div class="panel">
<form class="list-toolbar" method="get" action="/admin/gear_items.php">
<div class="audit-search-row">
<label class="search-field">
<?= icon('search') ?>
<input type="search" name="q" value="<?= e($query) ?>" placeholder="Name oder ID suchen …" aria-label="Gegenstände durchsuchen">
</label>
<select name="slot" onchange="this.form.submit()" aria-label="Slot">
<option value="">Alle Slots</option>
<?php foreach ($slotNames as $slotName => $count): ?>
<option value="<?= e($slotName) ?>"<?= $slotFilter === $slotName ? ' selected' : '' ?>><?= e($slotName) ?> (<?= (int) $count ?>)</option>
<?php endforeach; ?>
</select>
</div>
<span class="list-search-count text-muted"><?= number_format($total, 0, ',', '.') ?> Gegenstände</span>
</form>
<?php if (!$items): ?>
<p class="text-muted"><?= $query !== '' || $slotFilter !== '' ? 'Nichts gefunden.' : 'Noch keine Gegenstände übernommen.' ?></p>
<?php else: ?>
<div class="table-scroll">
<table class="gear-admin-table">
<thead>
<tr>
<th>Gegenstand</th>
<th>Slot</th>
<th>Stufe</th>
<th>Sockel</th>
<th>Aufwertung</th>
<th>Geprüft</th>
<th>In Sets</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $item): ?>
<tr id="gear-item-<?= (int) $item['id'] ?>">
<td>
<span class="gear-compare-item">
<?php if ($url = gear_icon_url($item)): ?><img class="gear-icon <?= e(gear_grade_class($item['grade'])) ?>" src="<?= e($url) ?>" alt="" width="28" height="28" loading="lazy"><?php endif; ?>
<span>
<a class="<?= e(gear_grade_class($item['grade'])) ?>" href="<?= e(GEAR_SOURCE_ITEM_URL . (int) $item['id']) ?>" target="_blank" rel="noopener"><?= e($item['name']) ?></a>
<span class="text-muted gear-admin-sub">#<?= (int) $item['id'] ?> · <?= e(gear_stats_text($item['stats'])) ?></span>
</span>
</span>
</td>
<td><?= e($item['slot']) ?><?= $item['item_type'] !== $item['slot'] ? '<div class="text-muted">' . e($item['item_type']) . '</div>' : '' ?></td>
<td><?= (int) $item['item_level'] ?></td>
<td><?= (int) $item['manastone_slots'] ?><?= (int) $item['godstone_slots'] ? ' + ' . (int) $item['godstone_slots'] . ' G' : '' ?></td>
<td>
<?= (int) $item['enchant_max'] ? '+' . (int) $item['enchant_max'] : '–' ?>
<?= (int) $item['exceed_max'] ? ' · ⬆' . (int) $item['exceed_max'] : '' ?>
</td>
<td class="text-muted"><?= $item['checked_at'] ? e(date('d.m.Y', strtotime((string) $item['checked_at']))) : '–' ?></td>
<td><?= (int) $item['used'] ?></td>
<td class="gear-admin-actions">
<button type="button" class="button button-secondary button-small" data-gear-check="<?= (int) $item['id'] ?>">Abgleichen</button>
<form method="post" action="/admin/gear_items_action.php" data-confirm="„<?= e($item['name']) ?>“ aus dem Katalog löschen?<?= (int) $item['used'] ? ' Er steckt in ' . (int) $item['used'] . ' Sets - die Slots werden leer.' : '' ?>" data-confirm-title="Gegenstand löschen" data-confirm-danger data-confirm-ok="Löschen">
<?= csrf_field() ?>
<input type="hidden" name="action" value="delete">
<input type="hidden" name="id" value="<?= (int) $item['id'] ?>">
<button type="submit" class="icon-button" title="Löschen"><?= icon('trash') ?></button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php render_pagination($listUrl(), $page, $pageCount); ?>
<?php endif; ?>
</div>
<div class="modal-overlay" id="gear-diff-modal" hidden>
<div class="modal gear-diff-modal">
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
<h2 id="gear-diff-title">Abgleich</h2>
<div id="gear-diff-body"></div>
<div class="actions">
<button type="button" class="button" id="gear-diff-apply" hidden>Neue Werte übernehmen</button>
</div>
</div>
</div>
<script src="<?= e(asset_url('/assets/js/gear-admin.js')) ?>"></script>
<?php include __DIR__ . '/../includes/footer.php'; ?>