532 lines
33 KiB
PHP
532 lines
33 KiB
PHP
<?php
|
||
/**
|
||
* Gear-Planer: eigene Ausruestungssets zusammenstellen und vergleichen.
|
||
* /gear.php Uebersicht der eigenen Sets
|
||
* /gear.php?set=ID[&slot=KEY] ein Set (eigene bearbeitbar, fremde nur wenn aufs Profil freigegeben)
|
||
* /gear.php?compare[]=ID&… 2-4 Sets nebeneinander
|
||
*/
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
require_once __DIR__ . '/includes/gear.php';
|
||
require_permission('gear.view');
|
||
|
||
$me = current_user();
|
||
$userId = (int) $me['id'];
|
||
$canManage = user_has_permission('gear.manage');
|
||
$catalogCount = (int) db()->query('SELECT COUNT(*) FROM gear_items')->fetchColumn();
|
||
|
||
$mySets = gear_sets_for_user($userId);
|
||
$mySlots = gear_slots_for_sets(array_column($mySets, 'id'));
|
||
|
||
// ---- Welche Ansicht? ----
|
||
$set = null;
|
||
$compare = [];
|
||
if (isset($_GET['compare'])) {
|
||
foreach (array_slice(array_unique(array_map('intval', (array) $_GET['compare'])), 0, 4) as $compareId) {
|
||
$candidate = gear_set($compareId);
|
||
if ($candidate && gear_can_view_set($candidate)) {
|
||
$compare[] = $candidate;
|
||
}
|
||
}
|
||
if (count($compare) < 2) {
|
||
set_flash('error', 'Zum Vergleichen bitte mindestens zwei Sets auswählen.');
|
||
redirect('/gear.php');
|
||
}
|
||
} elseif (isset($_GET['set'])) {
|
||
$set = gear_set((int) $_GET['set']);
|
||
if (!$set || !gear_can_view_set($set)) {
|
||
show_not_found();
|
||
}
|
||
}
|
||
|
||
$isOwn = $set && gear_is_own_set($set);
|
||
$slots = $set ? (gear_slots_for_sets([(int) $set['id']])[(int) $set['id']] ?? []) : [];
|
||
$activeSlot = $set && isset(GEAR_SLOTS[$_GET['slot'] ?? '']) ? (string) $_GET['slot'] : '';
|
||
$activeRow = $activeSlot !== '' ? ($slots[$activeSlot] ?? null) : null;
|
||
$activeItem = $activeRow['item'] ?? null;
|
||
|
||
/** Kurzinfo eines belegten Slots: "+15 · Durchbruch 5 · 3/4 Manasteine" */
|
||
$slotTags = static function (?array $row): array {
|
||
if (!$row || empty($row['item'])) {
|
||
return [];
|
||
}
|
||
$item = $row['item'];
|
||
$tags = [];
|
||
if ((int) $item['enchant_max'] > 0) {
|
||
$tags[] = '+' . (int) $row['enchant'];
|
||
}
|
||
if ((int) $row['exceed'] > 0) {
|
||
$tags[] = '⬆' . (int) $row['exceed'];
|
||
}
|
||
if ((int) $item['manastone_slots'] > 0) {
|
||
$tags[] = '◆ ' . count($row['manastones']) . '/' . (int) $item['manastone_slots'];
|
||
}
|
||
return $tags;
|
||
};
|
||
|
||
/** Symbol eines Gegenstands (oder Platzhalter) */
|
||
$itemIcon = static function (?array $item, int $size = 40): string {
|
||
$url = gear_icon_url($item);
|
||
if ($url === null) {
|
||
return '<span class="gear-icon gear-icon-empty" style="width:' . $size . 'px;height:' . $size . 'px"></span>';
|
||
}
|
||
return '<img class="gear-icon ' . e(gear_grade_class($item['grade'] ?? null)) . '" src="' . e($url) . '" alt="" width="' . $size . '" height="' . $size . '" loading="lazy">';
|
||
};
|
||
|
||
$pageTitle = $set ? $set['name'] . ' - Gear-Planer' : 'Gear-Planer';
|
||
$containerWide = true;
|
||
include __DIR__ . '/includes/header.php';
|
||
?>
|
||
<div class="panel gear-head">
|
||
<div>
|
||
<h1>Gear-Planer</h1>
|
||
<p class="text-muted">
|
||
Stell Ausrüstungssets zusammen und vergleiche sie. Grundwerte, Sockel und die Werte bei
|
||
voller Aufwertung stammen aus dem Spielclient (Global) und werden von der Leitung abgeglichen;
|
||
Werte mit <span class="gear-estimated">≈</span> sind für Zwischenstufen hochgerechnet.
|
||
</p>
|
||
</div>
|
||
<div class="gear-head-actions">
|
||
<?php if ($set || $compare): ?>
|
||
<a class="button button-secondary button-small" href="/gear.php">Meine Sets</a>
|
||
<?php endif; ?>
|
||
<?php if ($canManage): ?>
|
||
<a class="button button-secondary button-small" href="/admin/gear_items.php"><?= icon('list') ?> Gegenstände verwalten</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if ($catalogCount === 0): ?>
|
||
<div class="panel gear-empty">
|
||
<p><strong>Noch keine Gegenstände im Katalog.</strong></p>
|
||
<p class="text-muted">
|
||
<?= $canManage
|
||
? 'Übernimm zuerst Gegenstände von aion2hub - danach lassen sie sich in die Sets einsetzen.'
|
||
: 'Die Leitung muss erst die Gegenstände übernehmen. Sets anlegen kannst du trotzdem schon.' ?>
|
||
</p>
|
||
<?php if ($canManage): ?><a class="button" href="/admin/gear_items.php">Gegenstände übernehmen</a><?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($compare): ?>
|
||
<?php
|
||
// ---- Vergleich ----
|
||
$compareSlots = gear_slots_for_sets(array_column($compare, 'id'));
|
||
$compareTotals = [];
|
||
$allKeys = [];
|
||
foreach ($compare as $c) {
|
||
$compareTotals[(int) $c['id']] = gear_set_totals($compareSlots[(int) $c['id']] ?? []);
|
||
foreach ($compareTotals[(int) $c['id']] as $key => $row) {
|
||
$allKeys[$key] = $row;
|
||
}
|
||
}
|
||
uksort($allKeys, static function (string $a, string $b) use ($allKeys): int {
|
||
$ia = array_search($allKeys[$a]['name'], GEAR_STAT_ORDER, true);
|
||
$ib = array_search($allKeys[$b]['name'], GEAR_STAT_ORDER, true);
|
||
return [$ia === false ? 99 : $ia, $allKeys[$a]['unit'], $a] <=> [$ib === false ? 99 : $ib, $allKeys[$b]['unit'], $b];
|
||
});
|
||
$first = (int) $compare[0]['id'];
|
||
?>
|
||
<div class="panel">
|
||
<h2>Vergleich</h2>
|
||
<p class="text-muted">Unterschiede beziehen sich immer auf das erste Set (links).</p>
|
||
<div class="table-scroll">
|
||
<table class="gear-compare">
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<?php foreach ($compare as $c): ?>
|
||
<th>
|
||
<a href="/gear.php?set=<?= (int) $c['id'] ?>"><?= e($c['name']) ?></a>
|
||
<?= class_badge_html($c['class_name'], 18) ?>
|
||
<?php if ((int) $c['user_id'] !== $userId): ?><div class="text-muted gear-compare-owner"><?= e($c['owner_name']) ?></div><?php endif; ?>
|
||
</th>
|
||
<?php endforeach; ?>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr class="gear-compare-group"><th colspan="<?= count($compare) + 1 ?>">Werte</th></tr>
|
||
<?php foreach ($allKeys as $key => $meta): ?>
|
||
<?php $base = $compareTotals[$first][$key]['total'] ?? 0.0; ?>
|
||
<tr>
|
||
<th><?= e($meta['name']) ?></th>
|
||
<?php foreach ($compare as $index => $c): ?>
|
||
<?php $row = $compareTotals[(int) $c['id']][$key] ?? null; $value = $row['total'] ?? 0.0; $diff = $value - $base; ?>
|
||
<td>
|
||
<?= $row ? ($row['estimated'] ? '<span class="gear-estimated" title="enthält hochgerechnete Zwischenstufen">≈</span>' : '') . e(gear_format_value($value, $meta['unit'])) : '<span class="text-muted">–</span>' ?>
|
||
<?php if ($index > 0 && abs($diff) > 0.001): ?>
|
||
<span class="gear-diff <?= $diff > 0 ? 'is-up' : 'is-down' ?>"><?= $diff > 0 ? '+' : '−' ?><?= e(gear_format_value(abs($diff), $meta['unit'])) ?></span>
|
||
<?php endif; ?>
|
||
</td>
|
||
<?php endforeach; ?>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
<tr class="gear-compare-group"><th colspan="<?= count($compare) + 1 ?>">Ausrüstung</th></tr>
|
||
<?php foreach (GEAR_SLOTS as $slotKey => [$slotLabel]): ?>
|
||
<tr>
|
||
<th><?= e($slotLabel) ?></th>
|
||
<?php foreach ($compare as $c): ?>
|
||
<?php $row = $compareSlots[(int) $c['id']][$slotKey] ?? null; ?>
|
||
<td>
|
||
<?php if ($row && $row['item']): ?>
|
||
<span class="gear-compare-item">
|
||
<?= $itemIcon($row['item'], 24) ?>
|
||
<span class="<?= e(gear_grade_class($row['item']['grade'])) ?>"><?= e($row['item']['name']) ?></span>
|
||
<span class="text-muted"><?= e(implode(' · ', $slotTags($row))) ?></span>
|
||
</span>
|
||
<?php else: ?>
|
||
<span class="text-muted">–</span>
|
||
<?php endif; ?>
|
||
</td>
|
||
<?php endforeach; ?>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<?php elseif ($set): ?>
|
||
<?php $totals = gear_set_totals($slots); $itemLevel = gear_set_item_level($slots); ?>
|
||
<div class="panel gear-set-head">
|
||
<div class="gear-set-title">
|
||
<h2><?= e($set['name']) ?> <?= class_badge_html($set['class_name'], 26) ?></h2>
|
||
<div class="text-muted">
|
||
<?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
|
||
<?php if ($itemLevel !== null): ?> · Ø Gegenstandsstufe <?= e(number_format($itemLevel, 1, ',', '.')) ?><?php endif; ?>
|
||
<?php if ($isOwn && $set['show_on_profile']): ?> · <span class="badge">auf dem Profil sichtbar</span><?php endif; ?>
|
||
</div>
|
||
<?php if (!empty($set['note'])): ?><p><?= e($set['note']) ?></p><?php endif; ?>
|
||
</div>
|
||
<div class="gear-set-actions">
|
||
<?php if ($isOwn): ?>
|
||
<button type="button" class="button button-secondary button-small" data-modal-open="gear-set-edit"><?= icon('edit') ?> Bearbeiten</button>
|
||
<form method="post" action="/gear_action.php">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="duplicate">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<button type="submit" class="button button-secondary button-small">Kopieren</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
<?php $compareWith = array_values(array_filter($mySets, static fn (array $s): bool => (int) $s['id'] !== (int) $set['id'])); ?>
|
||
<?php if ($compareWith): ?>
|
||
<form method="get" action="/gear.php" class="gear-compare-with">
|
||
<input type="hidden" name="compare[]" value="<?= (int) $set['id'] ?>">
|
||
<select name="compare[]" aria-label="Vergleichen mit" onchange="this.form.submit()">
|
||
<option value="">Vergleichen mit …</option>
|
||
<?php foreach ($compareWith as $other): ?>
|
||
<option value="<?= (int) $other['id'] ?>"><?= e($other['name']) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="gear-layout">
|
||
<div class="panel gear-slots-panel">
|
||
<?php // Ausruestung als Raster wie im Spiel: zwei Slots pro Reihe, Name beim Drueberfahren ?>
|
||
<div class="gear-doll">
|
||
<?php foreach (GEAR_DOLL_ORDER as $slotKey): ?>
|
||
<?php
|
||
$slotLabel = GEAR_SLOTS[$slotKey][0];
|
||
$row = $slots[$slotKey] ?? null;
|
||
$item = $row['item'] ?? null;
|
||
$tip = $slotLabel . ': ' . ($item ? $item['name'] . ($slotTags($row) ? ' (' . implode(' · ', $slotTags($row)) . ')' : '') : 'leer');
|
||
?>
|
||
<a class="gear-doll-slot<?= $item ? ' is-filled ' . e(gear_grade_class($item['grade'])) : '' ?><?= $slotKey === $activeSlot ? ' is-active' : '' ?>"
|
||
href="/gear.php?set=<?= (int) $set['id'] ?>&slot=<?= e($slotKey) ?>#slot" title="<?= e($tip) ?>" aria-label="<?= e($tip) ?>">
|
||
<?php if ($item && ($iconUrl = gear_icon_url($item))): ?>
|
||
<img src="<?= e($iconUrl) ?>" alt="" loading="lazy">
|
||
<?php elseif ($item): ?>
|
||
<span class="gear-doll-initial"><?= e(mb_substr($item['name'], 0, 1)) ?></span>
|
||
<?php else: ?>
|
||
<?= gear_slot_silhouette($slotKey) ?>
|
||
<?php endif; ?>
|
||
<?php if ($item && (int) $row['exceed'] > 0): ?><span class="gear-doll-exceed">⬆<?= (int) $row['exceed'] ?></span><?php endif; ?>
|
||
<?php if ($item && (int) $row['enchant'] > 0): ?><span class="gear-doll-enchant">+<?= (int) $row['enchant'] ?></span><?php endif; ?>
|
||
<?php if ($item && (int) $item['manastone_slots'] > 0): ?>
|
||
<span class="gear-doll-stones" aria-hidden="true">
|
||
<?php for ($i = 0; $i < (int) $item['manastone_slots']; $i++): ?><i class="<?= $i < count($row['manastones']) ? 'is-set' : '' ?>"></i><?php endfor; ?>
|
||
</span>
|
||
<?php endif; ?>
|
||
</a>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<p class="gear-doll-hint text-muted"><?= $isOwn ? 'Slot anklicken zum Bearbeiten' : 'Slot anklicken für Details' ?></p>
|
||
</div>
|
||
|
||
<div class="gear-side">
|
||
<?php if ($activeSlot !== ''): ?>
|
||
<div class="panel gear-slot-editor" id="slot">
|
||
<h3><?= e(GEAR_SLOTS[$activeSlot][0]) ?></h3>
|
||
<?php if ($activeItem): ?>
|
||
<div class="gear-item-card">
|
||
<?= $itemIcon($activeItem, 48) ?>
|
||
<div>
|
||
<strong class="<?= e(gear_grade_class($activeItem['grade'])) ?>"><?= e($activeItem['name']) ?></strong>
|
||
<div class="text-muted">
|
||
<?= e($activeItem['grade']) ?> · Stufe <?= (int) $activeItem['item_level'] ?>
|
||
<?= $activeItem['item_type'] !== $activeItem['slot'] ? ' · ' . e($activeItem['item_type']) : '' ?>
|
||
· <a href="<?= e(GEAR_SOURCE_ITEM_URL . (int) $activeItem['id']) ?>" target="_blank" rel="noopener">aion2hub</a>
|
||
</div>
|
||
<div class="gear-item-stats"><?= e(gear_stats_text($activeItem['stats'])) ?></div>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($isOwn): ?>
|
||
<?php $pickerItems = gear_picker_items($activeSlot); ?>
|
||
<form method="post" action="/gear_action.php" class="gear-slot-form" data-autosave>
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="save_slot">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<input type="hidden" name="slot" value="<?= e($activeSlot) ?>">
|
||
<div>
|
||
<label for="gear-item-search">Gegenstand</label>
|
||
<div class="item-picker" data-picker-items="gear-picker" data-picker-mode="id" data-picker-empty="Nichts gefunden - fehlt ein Gegenstand, sag der Leitung Bescheid.">
|
||
<label class="search-field">
|
||
<span class="item-picker-icon"><?= icon('search') ?></span>
|
||
<input type="text" class="item-picker-input" id="gear-item-search" required placeholder="<?= $pickerItems ? 'Gegenstand suchen …' : 'Noch keine Gegenstände für diesen Slot' ?>">
|
||
</label>
|
||
<input type="hidden" name="item_id" value="<?= $activeItem ? (int) $activeItem['id'] : '' ?>">
|
||
</div>
|
||
<script type="application/json" id="gear-picker"><?= json_encode($pickerItems, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?></script>
|
||
</div>
|
||
|
||
<?php if ($activeItem): ?>
|
||
<div class="gear-form-row">
|
||
<?php if ((int) $activeItem['enchant_max'] > 0): ?>
|
||
<label>Aufwertung
|
||
<select name="enchant">
|
||
<?php for ($level = 0; $level <= (int) $activeItem['enchant_max']; $level++): ?>
|
||
<option value="<?= $level ?>"<?= (int) $activeRow['enchant'] === $level ? ' selected' : '' ?>>+<?= $level ?></option>
|
||
<?php endfor; ?>
|
||
</select>
|
||
</label>
|
||
<?php endif; ?>
|
||
<?php if ((int) $activeItem['exceed_max'] > 0): ?>
|
||
<label>Durchbruch
|
||
<select name="exceed">
|
||
<?php for ($level = 0; $level <= (int) $activeItem['exceed_max']; $level++): ?>
|
||
<option value="<?= $level ?>"<?= (int) $activeRow['exceed'] === $level ? ' selected' : '' ?>><?= $level ?></option>
|
||
<?php endfor; ?>
|
||
</select>
|
||
</label>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if ($activeItem['enchant_stats']): ?>
|
||
<p class="gear-hint text-muted">
|
||
Bei +<?= (int) $activeItem['enchant_max'] ?>: <?= e(gear_stats_text($activeItem['enchant_stats'])) ?>
|
||
<?php if ($activeItem['exceed_stats']): ?><br>Durchbruch <?= (int) $activeItem['exceed_max'] ?>: <?= e(gear_stats_text($activeItem['exceed_stats'])) ?><?php endif; ?>
|
||
</p>
|
||
<?php endif; ?>
|
||
|
||
<?php if ((int) $activeItem['soul_imprint_count'] > 0): ?>
|
||
<fieldset class="gear-fieldset">
|
||
<legend>Seelenprägung <span class="text-muted">(bis zu <?= (int) $activeItem['soul_imprint_count'] ?>, wie im Spiel gewürfelt)</span></legend>
|
||
<?php for ($i = 0; $i < (int) $activeItem['soul_imprint_count']; $i++): ?>
|
||
<?php $entry = $activeRow['soul_imprint'][$i] ?? null; ?>
|
||
<div class="gear-roll-row">
|
||
<select name="soul_stat[]" aria-label="Seelenprägung <?= $i + 1 ?>" data-range-select>
|
||
<option value="">– keine –</option>
|
||
<?php foreach ($activeItem['soul_imprint'] as [$stat, $min, $max, $unit]): ?>
|
||
<option value="<?= e($stat) ?>" data-min="<?= e((string) $min) ?>" data-max="<?= e((string) $max) ?>" data-unit="<?= e($unit) ?>"<?= $entry && $entry[0] === $stat ? ' selected' : '' ?>>
|
||
<?= e($stat) ?> (<?= e(gear_format_value((float) $min, $unit)) ?>–<?= e(gear_format_value((float) $max, $unit)) ?>)
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<input type="text" inputmode="decimal" name="soul_value[]" value="<?= $entry ? e(str_replace('.', ',', (string) $entry[1])) : '' ?>" placeholder="Wert" aria-label="Wert Seelenprägung <?= $i + 1 ?>">
|
||
</div>
|
||
<?php endfor; ?>
|
||
</fieldset>
|
||
<?php endif; ?>
|
||
|
||
<?php if ((int) $activeItem['manastone_slots'] > 0): ?>
|
||
<?php $manastoneStats = gear_manastone_stats(); ?>
|
||
<fieldset class="gear-fieldset">
|
||
<legend>Manasteine <span class="text-muted">(<?= (int) $activeItem['manastone_slots'] ?> Sockel)</span></legend>
|
||
<?php for ($i = 0; $i < (int) $activeItem['manastone_slots']; $i++): ?>
|
||
<?php $entry = $activeRow['manastones'][$i] ?? null; ?>
|
||
<div class="gear-roll-row">
|
||
<select name="mana_stat[]" aria-label="Manastein <?= $i + 1 ?>">
|
||
<option value="">– leer –</option>
|
||
<?php foreach ($manastoneStats as $stat): ?>
|
||
<option value="<?= e($stat) ?>"<?= $entry && $entry[0] === $stat ? ' selected' : '' ?>><?= e($stat) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<input type="text" inputmode="numeric" name="mana_value[]" value="<?= $entry ? (int) $entry[1] : '' ?>" placeholder="Wert" aria-label="Wert Manastein <?= $i + 1 ?>">
|
||
</div>
|
||
<?php endfor; ?>
|
||
</fieldset>
|
||
<?php endif; ?>
|
||
|
||
<?php if ((int) $activeItem['godstone_slots'] > 0): ?>
|
||
<label>Götterstein <span class="text-muted">(nur zur Info, zählt nicht in die Werte)</span>
|
||
<input type="text" name="godstone" maxlength="100" value="<?= e((string) ($activeRow['godstone'] ?? '')) ?>" placeholder="z.B. Götterstein: …">
|
||
</label>
|
||
<?php endif; ?>
|
||
<p class="gear-hint text-muted">Wechselst du den Gegenstand, werden Seelenprägung und Manasteine zurückgesetzt.</p>
|
||
<?php endif; ?>
|
||
|
||
<div class="actions gear-slot-actions">
|
||
<?php // Mit JavaScript speichert das Formular automatisch (assets/js/gear.js) - der Knopf verschwindet dann ?>
|
||
<button type="submit" class="button" data-autosave-fallback>Speichern</button>
|
||
<span class="gear-save-status" aria-live="polite"></span>
|
||
<a class="button button-secondary" href="/gear.php?set=<?= (int) $set['id'] ?>">Schließen</a>
|
||
</div>
|
||
</form>
|
||
<?php if ($activeItem): ?>
|
||
<form method="post" action="/gear_action.php" class="gear-clear-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="clear_slot">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<input type="hidden" name="slot" value="<?= e($activeSlot) ?>">
|
||
<button type="submit" class="button button-secondary button-small">Slot leeren</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
<?php elseif ($activeItem): ?>
|
||
<dl class="gear-detail-list">
|
||
<?php if ((int) $activeItem['enchant_max'] > 0): ?><div><dt>Aufwertung</dt><dd>+<?= (int) $activeRow['enchant'] ?> von +<?= (int) $activeItem['enchant_max'] ?></dd></div><?php endif; ?>
|
||
<?php if ((int) $activeItem['exceed_max'] > 0): ?><div><dt>Durchbruch</dt><dd><?= (int) $activeRow['exceed'] ?> von <?= (int) $activeItem['exceed_max'] ?></dd></div><?php endif; ?>
|
||
<?php if ($activeRow['soul_imprint']): ?>
|
||
<div><dt>Seelenprägung</dt><dd><?= e(implode(', ', array_map(static fn (array $s): string => $s[0] . ' ' . str_replace('.', ',', (string) $s[1]), $activeRow['soul_imprint']))) ?></dd></div>
|
||
<?php endif; ?>
|
||
<?php if ($activeRow['manastones']): ?>
|
||
<div><dt>Manasteine</dt><dd><?= e(implode(', ', array_map(static fn (array $s): string => $s[0] . ' ' . (int) $s[1], $activeRow['manastones']))) ?></dd></div>
|
||
<?php endif; ?>
|
||
<?php if (!empty($activeRow['godstone'])): ?><div><dt>Götterstein</dt><dd><?= e((string) $activeRow['godstone']) ?></dd></div><?php endif; ?>
|
||
</dl>
|
||
<?php else: ?>
|
||
<p class="text-muted">Dieser Slot ist leer.</p>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="panel gear-totals">
|
||
<h3>Werte gesamt</h3>
|
||
<?php if (!$totals): ?>
|
||
<p class="text-muted">Noch keine Gegenstände eingesetzt.</p>
|
||
<?php else: ?>
|
||
<?php $usedSources = array_keys(array_filter(GEAR_SOURCES, static fn (string $label, string $source): bool => (bool) array_filter($totals, static fn (array $t): bool => isset($t['by'][$source])), ARRAY_FILTER_USE_BOTH)); ?>
|
||
<div class="table-scroll">
|
||
<table class="gear-totals-table">
|
||
<thead>
|
||
<tr>
|
||
<th>Wert</th>
|
||
<th class="gear-total-col">Gesamt</th>
|
||
<?php foreach ($usedSources as $source): ?><th class="gear-source-col"><?= e(GEAR_SOURCES[$source]) ?></th><?php endforeach; ?>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php foreach ($totals as $row): ?>
|
||
<tr>
|
||
<th><?= e($row['name']) ?></th>
|
||
<td class="gear-total-col">
|
||
<?php if ($row['estimated']): ?><span class="gear-estimated" title="enthält hochgerechnete Zwischenstufen">≈</span><?php endif; ?>
|
||
<?= e(gear_format_value($row['total'], $row['unit'])) ?>
|
||
</td>
|
||
<?php foreach ($usedSources as $source): ?>
|
||
<td class="gear-source-col"><?= isset($row['by'][$source]) ? e(gear_format_value($row['by'][$source], $row['unit'])) : '<span class="text-muted">–</span>' ?></td>
|
||
<?php endforeach; ?>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<p class="gear-hint text-muted">Einfache Summe aller Gegenstände - Klassen- und Charakterwerte, Set-Boni und Götterstein sind nicht enthalten.</p>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if ($isOwn): ?>
|
||
<div class="modal-overlay" id="gear-set-edit" hidden>
|
||
<div class="modal">
|
||
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
|
||
<h2>Set bearbeiten</h2>
|
||
<form method="post" action="/gear_action.php">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="update">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<label>Name <input type="text" name="name" maxlength="80" required value="<?= e($set['name']) ?>"></label>
|
||
<label>Klasse
|
||
<select name="class_name">
|
||
<option value="">– keine –</option>
|
||
<?php foreach (AION_CLASSES as $class): ?>
|
||
<option value="<?= e($class) ?>"<?= $set['class_name'] === $class ? ' selected' : '' ?>><?= e($class) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
</label>
|
||
<label>Notiz <input type="text" name="note" maxlength="255" value="<?= e((string) $set['note']) ?>" placeholder="z.B. PvP, Raid, Ziel-Ausrüstung …"></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">
|
||
<button type="submit" class="button">Speichern</button>
|
||
</div>
|
||
</form>
|
||
<form method="post" action="/gear_action.php" onsubmit="return confirm('Set „<?= e(addslashes($set['name'])) ?>“ wirklich löschen?');" class="gear-delete-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="delete">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<button type="submit" class="button button-danger button-small"><?= icon('trash') ?> Set löschen</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php else: ?>
|
||
<?php // ---- Uebersicht der eigenen Sets ---- ?>
|
||
<div class="panel">
|
||
<div class="gear-overview-head">
|
||
<h2>Meine Sets</h2>
|
||
<form method="post" action="/gear_action.php" class="gear-create-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="create">
|
||
<input type="text" name="name" maxlength="80" required placeholder="Name, z.B. Raid-Set" aria-label="Name des neuen Sets">
|
||
<select name="class_name" aria-label="Klasse">
|
||
<?php foreach (AION_CLASSES as $class): ?>
|
||
<option value="<?= e($class) ?>"<?= ($me['class_name'] ?? '') === $class ? ' selected' : '' ?>><?= e($class) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<button type="submit" class="button">Neues Set</button>
|
||
</form>
|
||
</div>
|
||
|
||
<?php if (!$mySets): ?>
|
||
<p class="text-muted">Du hast noch kein Set. Leg oben eins an - z.B. deine aktuelle Ausrüstung und ein Ziel-Set zum Vergleichen.</p>
|
||
<?php else: ?>
|
||
<form method="get" action="/gear.php" id="gear-compare-form">
|
||
<div class="gear-set-cards">
|
||
<?php foreach ($mySets as $s): ?>
|
||
<?php $sSlots = $mySlots[(int) $s['id']] ?? []; $sLevel = gear_set_item_level($sSlots); ?>
|
||
<article class="gear-set-card">
|
||
<label class="gear-set-card-check" title="Zum Vergleich auswählen">
|
||
<input type="checkbox" name="compare[]" value="<?= (int) $s['id'] ?>">
|
||
</label>
|
||
<a class="gear-set-card-link" href="/gear.php?set=<?= (int) $s['id'] ?>">
|
||
<span class="gear-set-card-title"><?= e($s['name']) ?> <?= class_badge_html($s['class_name'], 20) ?></span>
|
||
<span class="text-muted">
|
||
<?= 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 ($s['show_on_profile']): ?> · auf dem Profil<?php endif; ?>
|
||
</span>
|
||
<?= gear_doll_mini_html($sSlots) ?>
|
||
<?php if (!empty($s['note'])): ?><span class="gear-set-card-note"><?= e($s['note']) ?></span><?php endif; ?>
|
||
</a>
|
||
</article>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php if (count($mySets) > 1): ?>
|
||
<div class="actions gear-compare-bar">
|
||
<button type="submit" class="button button-secondary" id="gear-compare-button" disabled>Ausgewählte vergleichen</button>
|
||
<span class="text-muted">2–4 Sets anhaken</span>
|
||
</div>
|
||
<?php endif; ?>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<script src="<?= e(asset_url('/assets/js/item-picker.js')) ?>"></script>
|
||
<script src="<?= e(asset_url('/assets/js/gear.js')) ?>"></script>
|
||
<?php include __DIR__ . '/includes/footer.php'; ?>
|