LuminaWebsite/admin/gear_items.php
Maaxxs 3cc60c7f7e Skill planner: set pages Ausrüstung / Skills / Stigmen, specializations and stigma bonuses with their effects from the aion2hub build planner
- Each set has three pages (tabs with counters): equipment, skills (active and passive) and stigmas; the skill pages live in includes/gear_skills_view.php
- Specializations of active skills like in the aion2hub planner: collapsible list with unlock level and effect, three from level 8, one from 12, one from 16; one slot at 8, two at 12, three at 20; locked options are disabled, lowering the level drops options that no longer fit (checked on the server too, stored as bitmask gear_set_skills.specs)
- Stigmas: the chosen ones as the 4 slots on top, each stigma lists its four bonuses at 5/10/15/20 with effect, reached ones are highlighted
- Admin: "Spezialisierungen & Stigma-Boni übernehmen" reads the build planner page, finds the JavaScript file with the data set (one request per second, remembers the file) and stores the effects of all classes (gear_skills.spec_effects); new page "Namen & Spezialisierungen" (admin/gear_skills.php) for German skill names and texts
- Autosave sends level and specializations per skill card, the tab counter updates live; compare shows specializations, copies keep them
- Schema version 39 (gear_skills.name_de, spec_effects, spec_names; gear_set_skills.specs), patch notes, README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 20:00:11 +02:00

253 lines
16 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. 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
holt „Spezialisierungen &amp; Stigma-Boni übernehmen“ aus dem Build-Planer von aion2hub (englisch, alle Klassen auf
einmal - vorher die Skills übernehmen). 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 title="Aktive und Stigma-Skills mit Effekten der Spezialisierungen bzw. Boni">Effekte</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['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-specs-start">Spezialisierungen &amp; Stigma-Boni übernehmen</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'; ?>