LuminaWebsite/admin/gear_items.php
Maaxxs fab66f64d0 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>
2026-09-23 17:17:59 +02:00

243 lines
14 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.
*/
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/gear.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. 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">
<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'; ?>