1320 lines
85 KiB
PHP
1320 lines
85 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
/**
|
||
* Gear-Planer: Guide zu einem Build (Reiter "Guide" in gear.php) - aufgebaut wie die Klassen-Guides bei wakayashi.gg:
|
||
* Kopf mit Klasse, Schwierigkeit, Tags und Beschreibung, Staerken/Schwaechen, Skill-Setup nach Stufe (mit Reihenfolge und
|
||
* Begruendung je Skill), Hotbar und Makro eines Presets mit Erklaerung je Taste, Daevanion, Ausruestung und Tipps.
|
||
* Beschreibung in gear_sets.description, der Rest als JSON in gear_sets.guide. Bearbeiten darf nur der Besitzer.
|
||
* In allen Texten wird [[Skillname]] (deutsch oder englisch, Skills der Klasse des Sets) zu einem Skill-Chip mit Icon.
|
||
*/
|
||
|
||
const GEAR_GUIDE_DIFFICULTIES = ['leicht' => 'Leicht', 'mittel' => 'Mittel', 'schwer' => 'Schwer'];
|
||
const GEAR_GUIDE_TAGS_MAX = 4;
|
||
const GEAR_GUIDE_TAG_LENGTH = 30;
|
||
const GEAR_GUIDE_POINTS_MAX = 6; // Staerken bzw. Schwaechen
|
||
const GEAR_GUIDE_POINT_LENGTH = 120;
|
||
const GEAR_GUIDE_TIPS_MAX = 5;
|
||
const GEAR_GUIDE_TIP_TITLE_LENGTH = 80;
|
||
const GEAR_GUIDE_TIP_TEXT_LENGTH = 600;
|
||
const GEAR_GUIDE_ORDER_MAX = 99; // Reihenfolge beim Steigern je Skill (0 = keine)
|
||
const GEAR_GUIDE_PRIO_MAX = 20; // Prioritaet je Stigma bzw. passivem Skill (0 = keine)
|
||
const GEAR_GUIDE_PRIO_KINDS = ['stigma' => 'Stigma', 'passive' => 'Passiv']; // Skill-Arten mit eigener Prioritaet
|
||
const GEAR_GUIDE_STYLES_MAX = 4; // Spielweisen (z.B. Tank, DPS) mit eigener Prioritaet der Stigmen und Passiven
|
||
const GEAR_GUIDE_STYLE_LENGTH = 16;
|
||
const GEAR_GUIDE_WHY_LENGTH = 600; // Begruendung je Skill
|
||
const GEAR_GUIDE_KEY_LENGTH = 300; // Erklaerung je Taste der Skill-Leiste
|
||
const GEAR_GUIDE_DAEVANION_LENGTH = 600; // Erklaerung zu den Daevanion-Brettern
|
||
// Stats-Prioritaet: Gruppen (Slot-Gruppen aus GEAR_SLOTS plus allgemein und Manasteine) => [Name, Slot fuer das Symbol]
|
||
const GEAR_GUIDE_STAT_GROUPS = [
|
||
'all' => ['Allgemein', null],
|
||
'weapon' => ['Waffen', 'main_hand'],
|
||
'armor' => ['Rüstung', 'torso'],
|
||
'jewelry' => ['Schmuck', 'necklace'],
|
||
'manastone' => ['Manasteine', null],
|
||
];
|
||
// Slot-Gruppe in GEAR_SLOTS => Gruppe der Stats-Prioritaet
|
||
const GEAR_GUIDE_SLOT_GROUPS = ['Waffen' => 'weapon', 'Rüstung' => 'armor', 'Schmuck' => 'jewelry'];
|
||
const GEAR_GUIDE_STATS_MAX = 6; // Werte je Gruppe
|
||
const GEAR_GUIDE_STAT_LENGTH = 40;
|
||
const GEAR_GUIDE_STAT_NOTE_LENGTH = 80;
|
||
|
||
/** Einzeiliger Text: Leerraum zusammengefasst und gekuerzt. */
|
||
function gear_guide_line(mixed $value, int $max): string
|
||
{
|
||
return mb_substr(trim((string) preg_replace('/\s+/u', ' ', is_string($value) ? $value : '')), 0, $max);
|
||
}
|
||
|
||
/**
|
||
* Guide aus Formular oder Datenbank bereinigen.
|
||
*
|
||
* @return array{difficulty: string, tags: string[], strengths: string[], weaknesses: string[], tips: array<int, array{title: string, text: string}>,
|
||
* skills: array<int, array{order: int, prio: int, styles: array<int, int>, level: int, why: string}>, styles: array<int, string>, preset: int, keys: array<string, string>}
|
||
*/
|
||
function gear_guide_normalize(array $raw): array
|
||
{
|
||
$list = static function (mixed $value, int $count, int $length): array {
|
||
$items = is_array($value) ? $value : preg_split('/\R/u', (string) $value);
|
||
$items = array_values(array_filter(array_map(static fn ($item): string => gear_guide_line($item, $length), $items ?: []), 'strlen'));
|
||
return array_slice(array_values(array_unique($items)), 0, $count);
|
||
};
|
||
$tags = $raw['tags'] ?? [];
|
||
$tips = [];
|
||
foreach (is_array($raw['tips'] ?? null) ? $raw['tips'] : [] as $tip) {
|
||
if (!is_array($tip)) {
|
||
continue;
|
||
}
|
||
$title = gear_guide_line($tip['title'] ?? '', GEAR_GUIDE_TIP_TITLE_LENGTH);
|
||
$text = gear_guide_text($tip['text'] ?? '', GEAR_GUIDE_TIP_TEXT_LENGTH);
|
||
if ($title !== '' || $text !== '') {
|
||
$tips[] = ['title' => $title, 'text' => $text];
|
||
}
|
||
}
|
||
// Spielweisen (z.B. Tank, DPS): feste Plaetze 1-4, damit die Zuordnung der Skills beim Umbenennen bzw. Leeren bleibt
|
||
$styles = [];
|
||
foreach (is_array($raw['styles'] ?? null) ? $raw['styles'] : [] as $styleId => $name) {
|
||
$name = gear_guide_line($name, GEAR_GUIDE_STYLE_LENGTH);
|
||
if (ctype_digit((string) $styleId) && (int) $styleId >= 1 && (int) $styleId <= GEAR_GUIDE_STYLES_MAX && $name !== '') {
|
||
$styles[(int) $styleId] = $name;
|
||
}
|
||
}
|
||
ksort($styles);
|
||
// Je Skill: Reihenfolge beim Steigern und Begruendung - leere fallen weg
|
||
$skills = [];
|
||
foreach (is_array($raw['skills'] ?? null) ? $raw['skills'] : [] as $skillId => $note) {
|
||
if (!is_array($note) || !ctype_digit((string) $skillId) || (int) $skillId <= 0) {
|
||
continue;
|
||
}
|
||
$order = is_numeric($note['order'] ?? null) ? max(0, min(GEAR_GUIDE_ORDER_MAX, (int) $note['order'])) : 0;
|
||
// Prioritaet unter den Stigmen bzw. passiven Skills (welche am wichtigsten sind)
|
||
$prio = is_numeric($note['prio'] ?? null) ? max(0, min(GEAR_GUIDE_PRIO_MAX, (int) $note['prio'])) : 0;
|
||
// ... und je Spielweise: [Spielweise => Prioritaet, -1 = dort ausgeblendet], nur fuer vorhandene Spielweisen;
|
||
// ohne Eintrag gilt in der Spielweise die allgemeine Prioritaet
|
||
$stylePrio = [];
|
||
$hidden = is_array($note['hide'] ?? null) ? $note['hide'] : [];
|
||
foreach (is_array($note['styles'] ?? null) ? $note['styles'] : [] as $styleId => $value) {
|
||
if (isset($styles[(int) $styleId]) && is_numeric($value) && ((int) $value > 0 || (int) $value === -1)) {
|
||
$stylePrio[(int) $styleId] = min(GEAR_GUIDE_PRIO_MAX, (int) $value);
|
||
}
|
||
}
|
||
foreach ($hidden as $styleId => $on) {
|
||
if (isset($styles[(int) $styleId]) && $on) {
|
||
$stylePrio[(int) $styleId] = -1;
|
||
}
|
||
}
|
||
ksort($stylePrio);
|
||
// Ziel-Stufe eines alternativen Stigmas (im Skill-Plan nicht gesteigert, nur fuer Spielweisen) - 0 = keine
|
||
$altLevel = is_numeric($note['level'] ?? null) ? max(0, min(GEAR_STIGMA_LEVEL_MAX, (int) $note['level'])) : 0;
|
||
$why = gear_guide_text($note['why'] ?? '', GEAR_GUIDE_WHY_LENGTH);
|
||
// Reihenfolge der Spezialisierungen: [Nr => Prioritaet]
|
||
$specOrder = [];
|
||
foreach (is_array($note['specs'] ?? null) ? $note['specs'] : [] as $no => $priority) {
|
||
if (isset(GEAR_SKILL_SPECS[(int) $no]) && is_numeric($priority) && (int) $priority > 0) {
|
||
$specOrder[(int) $no] = min(9, (int) $priority);
|
||
}
|
||
}
|
||
ksort($specOrder);
|
||
if ($order > 0 || $prio > 0 || $stylePrio || $altLevel > 0 || $why !== '' || $specOrder) {
|
||
$skills[(int) $skillId] = ['order' => $order, 'prio' => $prio, 'styles' => $stylePrio, 'level' => $altLevel, 'why' => $why, 'specs' => $specOrder];
|
||
}
|
||
}
|
||
// Je Taste der Skill-Leiste: Erklaerung
|
||
$keys = [];
|
||
foreach (is_array($raw['keys'] ?? null) ? $raw['keys'] : [] as $key => $text) {
|
||
$key = gear_macro_key($key);
|
||
$text = gear_guide_text($text, GEAR_GUIDE_KEY_LENGTH);
|
||
if ($key !== null && $text !== '') {
|
||
$keys[$key] = $text;
|
||
}
|
||
}
|
||
// Stats-Prioritaet je Gruppe: [['stat' => Wert, 'note' => Hinweis], …] in Reihenfolge
|
||
$stats = [];
|
||
foreach (GEAR_GUIDE_STAT_GROUPS as $group => $unused) {
|
||
$entries = [];
|
||
foreach (is_array($raw['stats'][$group] ?? null) ? $raw['stats'][$group] : [] as $entry) {
|
||
$stat = gear_guide_line(is_array($entry) ? ($entry['stat'] ?? '') : '', GEAR_GUIDE_STAT_LENGTH);
|
||
if ($stat !== '') {
|
||
$entries[] = ['stat' => $stat, 'note' => gear_guide_line($entry['note'] ?? '', GEAR_GUIDE_STAT_NOTE_LENGTH)];
|
||
}
|
||
}
|
||
if ($entries) {
|
||
$stats[$group] = array_slice($entries, 0, GEAR_GUIDE_STATS_MAX);
|
||
}
|
||
}
|
||
return [
|
||
'difficulty' => isset(GEAR_GUIDE_DIFFICULTIES[$raw['difficulty'] ?? '']) ? (string) $raw['difficulty'] : '',
|
||
'tags' => $list(is_array($tags) ? $tags : explode(',', (string) $tags), GEAR_GUIDE_TAGS_MAX, GEAR_GUIDE_TAG_LENGTH),
|
||
'strengths' => $list($raw['strengths'] ?? [], GEAR_GUIDE_POINTS_MAX, GEAR_GUIDE_POINT_LENGTH),
|
||
'weaknesses' => $list($raw['weaknesses'] ?? [], GEAR_GUIDE_POINTS_MAX, GEAR_GUIDE_POINT_LENGTH),
|
||
'tips' => array_slice($tips, 0, GEAR_GUIDE_TIPS_MAX),
|
||
'skills' => $skills,
|
||
'styles' => $styles,
|
||
'preset' => in_array((int) ($raw['preset'] ?? 1), GEAR_MACRO_PRESETS, true) ? (int) ($raw['preset'] ?? 1) : 1,
|
||
'keys' => $keys,
|
||
'daevanion' => gear_guide_text($raw['daevanion'] ?? '', GEAR_GUIDE_DAEVANION_LENGTH),
|
||
'stats' => $stats,
|
||
];
|
||
}
|
||
|
||
/**
|
||
* Werte, die bei Gegenstaenden einer Gruppe als Seelenpraegung vorkommen (Vorschlaege im Dialog "Stats-Prioritaet"),
|
||
* Manasteine wie im Slot-Editor, "Allgemein" alle zusammen.
|
||
*
|
||
* @return array<string, string[]> [Gruppe => Wertnamen]
|
||
*/
|
||
function gear_guide_stat_options(): array
|
||
{
|
||
$groups = array_fill_keys(array_keys(GEAR_GUIDE_STAT_GROUPS), []);
|
||
// gear_items.slot ist der Slot aus dem Spiel ("Torso", "Necklace" …) - dritter Eintrag in GEAR_SLOTS
|
||
$slotGroups = [];
|
||
foreach (GEAR_SLOTS as $slotKey => [, $slotGroup, $gameSlots]) {
|
||
foreach (array_merge([$slotKey], $gameSlots) as $name) {
|
||
$slotGroups[$name] = GEAR_GUIDE_SLOT_GROUPS[$slotGroup] ?? null;
|
||
}
|
||
}
|
||
foreach (db()->query('SELECT slot, data FROM gear_items')->fetchAll() as $row) {
|
||
$group = $slotGroups[$row['slot']] ?? null;
|
||
if ($group === null) {
|
||
continue;
|
||
}
|
||
foreach ((json_decode((string) $row['data'], true)['soul_imprint'] ?? []) as $entry) {
|
||
$name = (string) ($entry[0] ?? '');
|
||
if ($name !== '' && !str_contains($name, '[')) {
|
||
$groups[$group][$name] = true;
|
||
$groups['all'][$name] = true;
|
||
}
|
||
}
|
||
}
|
||
$groups['manastone'] = array_fill_keys(gear_manastone_stats(), true);
|
||
$sort = static function (string $a, string $b): int {
|
||
$ia = array_search($a, GEAR_STAT_ORDER, true);
|
||
$ib = array_search($b, GEAR_STAT_ORDER, true);
|
||
return [$ia === false ? 99 : $ia, $a] <=> [$ib === false ? 99 : $ib, $b];
|
||
};
|
||
return array_map(static function (array $names) use ($sort): array {
|
||
$names = array_map('strval', array_keys($names));
|
||
usort($names, $sort);
|
||
return $names;
|
||
}, $groups);
|
||
}
|
||
|
||
/** Slots einer Gruppe der Stats-Prioritaet als Text: "Kopf, Schultern, Brust, …" (Ring 1/2 nur einmal) */
|
||
function gear_guide_stat_group_slots(string $group): string
|
||
{
|
||
$names = [];
|
||
foreach (GEAR_SLOTS as [$label, $slotGroup]) {
|
||
if ((GEAR_GUIDE_SLOT_GROUPS[$slotGroup] ?? '') === $group) {
|
||
$names[(string) preg_replace('/ \d$/', '', $label)] = true;
|
||
}
|
||
}
|
||
return implode(', ', array_keys($names));
|
||
}
|
||
|
||
/**
|
||
* Skills einer Klasse fuer die Skill-Chips: [kleingeschriebener Name (deutsch und englisch) => Skill].
|
||
*
|
||
* @return array<string, array>
|
||
*/
|
||
function gear_guide_chip_skills(?string $className): array
|
||
{
|
||
static $cache = [];
|
||
$className = (string) $className;
|
||
if (!isset($cache[$className])) {
|
||
$cache[$className] = [];
|
||
foreach ($className !== '' ? gear_skills_for_class($className, false) : [] as $skill) {
|
||
foreach ([(string) $skill['name'], (string) ($skill['name_de'] ?? '')] as $name) {
|
||
if ($name !== '') {
|
||
$cache[$className][mb_strtolower($name, 'UTF-8')] ??= $skill;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return $cache[$className];
|
||
}
|
||
|
||
/**
|
||
* Info-Blase eines Skills (wie im Skills-Reiter, assets/js/gear.js): gibt die Attribute fuer das Element zurueck und
|
||
* merkt sich den Skill - die Beschreibung steht einmal je Skill versteckt am Ende des Reiters (gear_guide_tip_sources),
|
||
* so passt sie auch in Absaetze (<p> darf keine <div> enthalten). Leer, wenn der Skill keine Beschreibung hat.
|
||
*/
|
||
function gear_guide_tip_attrs(array $skill): string
|
||
{
|
||
if (gear_skill_info($skill) === null) {
|
||
return '';
|
||
}
|
||
gear_guide_tip_registry($skill);
|
||
return ' data-skill data-skill-tip data-tip-ref="gear-guide-tip-' . (int) $skill['id'] . '"';
|
||
}
|
||
|
||
/** Gemerkte Skills fuer die Info-Blasen (mit $skill: merken, ohne: alle zurueckgeben und vergessen). */
|
||
function gear_guide_tip_registry(?array $skill = null): array
|
||
{
|
||
static $skills = [];
|
||
if ($skill !== null) {
|
||
$skills[(int) $skill['id']] = $skill;
|
||
return [];
|
||
}
|
||
$all = $skills;
|
||
$skills = [];
|
||
return $all;
|
||
}
|
||
|
||
/**
|
||
* Versteckte Beschreibungen aller gemerkten Skills - Werte bei der geplanten Stufe (sonst Stufe 1).
|
||
*
|
||
* @param array<int, int> $levels geplante Stufe je Skill-ID
|
||
*/
|
||
function gear_guide_tip_sources(array $levels): string
|
||
{
|
||
$html = '';
|
||
foreach (gear_guide_tip_registry() as $id => $skill) {
|
||
$tip = gear_skill_tip_html($skill, $levels[$id] ?? 0);
|
||
// Spezialisierungen (Stigmen: Boni) fuer [[Skill:N]] - die Info-Blase zeigt sie nur dort und hebt die gemeinte
|
||
// hervor (assets/js/gear.js, data-tip-spec); ohne uebernommene Beschreibung nur Name und Spezialisierungen
|
||
$parts = '';
|
||
foreach (gear_skill_parts($skill) as $no => $part) {
|
||
$parts .= '<div class="gear-tip-part" data-part="' . (int) $no . '">'
|
||
. ($skill['kind'] === 'stigma' ? '<b class="gear-tip-part-no">' . (int) $no . '</b>' : gear_guide_spec_icon(true, (int) $no))
|
||
. '<span class="gear-tip-part-level">ab ' . (int) $part['t'] . '</span><span>' . e($part['text']) . '</span></div>';
|
||
}
|
||
if ($parts !== '') {
|
||
$parts = '<div class="gear-tip-parts"><div class="gear-tip-parts-head">' . ($skill['kind'] === 'stigma' ? 'Boni' : 'Spezialitäten') . '</div>' . $parts . '</div>';
|
||
$tip = $tip !== ''
|
||
? substr($tip, 0, -strlen('</div>')) . $parts . '</div>'
|
||
: '<div class="gear-tip-src" hidden><div class="gear-tip-head"><strong>' . e(gear_skill_display_name($skill)) . '</strong></div>' . $parts . '</div>';
|
||
}
|
||
$html .= '<div id="gear-guide-tip-' . $id . '" hidden>' . $tip . '</div>';
|
||
}
|
||
return $html !== '' ? '<div class="gear-guide-tip-sources" hidden>' . $html . '</div>' : '';
|
||
}
|
||
|
||
/** Skill-Chip: Icon und Name, beim Drueberfahren die Info-Blase des Skills (sonst der englische Name). */
|
||
function gear_guide_skill_chip(array $skill): string
|
||
{
|
||
$url = gear_skill_icon_url($skill);
|
||
$tip = gear_guide_tip_attrs($skill);
|
||
$other = !empty($skill['name_de']) && $skill['name_de'] !== $skill['name'] ? (string) $skill['name'] : '';
|
||
return '<span class="gear-guide-skill-chip' . ($skill['kind'] === 'stigma' ? ' is-stigma' : '') . '"'
|
||
. ($tip !== '' ? $tip . ' tabindex="0"' : ($other !== '' ? ' title="' . e($other) . '"' : '')) . '>'
|
||
. ($url ? '<img src="' . e($url) . '" alt="" loading="lazy">' : '')
|
||
. e(gear_skill_display_name($skill)) . '</span>';
|
||
}
|
||
|
||
/**
|
||
* [[Skill:N]] im Text: Symbol der Spezialisierung (aktive Skills: I-V in ihren Farben, Stigmen: Icon des Skills) und
|
||
* ihr Text - beim Drueberfahren die Info-Blase des Skills mit der hervorgehobenen Spezialisierung (assets/js/gear.js).
|
||
* null = diese Nummer hat der Skill nicht.
|
||
*/
|
||
function gear_guide_spec_chip(array $skill, int $no): ?string
|
||
{
|
||
$part = gear_skill_parts($skill)[$no] ?? null;
|
||
if ($part === null) {
|
||
return null;
|
||
}
|
||
gear_guide_tip_registry($skill);
|
||
$isStigma = $skill['kind'] === 'stigma';
|
||
$url = $isStigma ? gear_skill_icon_url($skill) : null;
|
||
$icon = $isStigma
|
||
? ($url ? '<img class="gear-guide-spec-ref-icon" src="' . e($url) . '" alt="" loading="lazy">' : '')
|
||
: '<img class="gear-guide-spec-ref-icon" src="' . e(asset_url('/assets/images/specs/spec-' . max(1, min(5, $no)) . '.png')) . '" alt="" loading="lazy">';
|
||
$label = gear_skill_display_name($skill) . ' – ' . ($isStigma ? 'Bonus ' . $no : 'Spezialisierung ' . GEAR_SKILL_SPEC_NUMERALS[$no]);
|
||
return '<span class="gear-guide-spec-ref' . ($isStigma ? ' is-stigma' : '') . '" data-skill data-skill-tip data-tip-ref="gear-guide-tip-' . (int) $skill['id'] . '"'
|
||
. ' data-tip-spec="' . $no . '" tabindex="0" aria-label="' . e($label . ': ' . $part['text']) . '">'
|
||
. $icon . '<span class="gear-guide-spec-ref-text">' . e($part['text']) . '</span></span>';
|
||
}
|
||
|
||
/**
|
||
* Schon maskiertes HTML: [[Skillname]] durch Skill-Chips ersetzen, [[Skillname:2]] bzw. [[Skillname:II]] durch die
|
||
* Spezialisierung (Stigmen: den Bonus) mit dieser Nummer. Unbekannte Namen bleiben als Text (ohne Klammern), eine
|
||
* Nummer, die der Skill nicht hat, ergibt den normalen Skill-Chip.
|
||
*/
|
||
function gear_guide_chips(string $html, ?string $className): string
|
||
{
|
||
if (!str_contains($html, '[[')) {
|
||
return $html;
|
||
}
|
||
$skills = gear_guide_chip_skills($className);
|
||
$romans = array_flip(array_map('strtoupper', GEAR_SKILL_SPEC_NUMERALS));
|
||
return (string) preg_replace_callback('/\[\[([^\[\]<>:]{1,80})(?::\s*([1-9]|[IVX]{1,4})\s*)?\]\]/iu', static function (array $match) use ($skills, $romans): string {
|
||
$name = mb_strtolower(trim(html_entity_decode($match[1], ENT_QUOTES | ENT_HTML5, 'UTF-8')), 'UTF-8');
|
||
$skill = $skills[$name] ?? null;
|
||
if ($skill === null) {
|
||
return $match[1];
|
||
}
|
||
$no = $match[2] ?? '';
|
||
if ($no !== '') {
|
||
$no = ctype_digit($no) ? (int) $no : (int) ($romans[strtoupper($no)] ?? 0);
|
||
$chip = gear_guide_spec_chip($skill, $no);
|
||
if ($chip !== null) {
|
||
return $chip;
|
||
}
|
||
}
|
||
return gear_guide_skill_chip($skill);
|
||
}, $html);
|
||
}
|
||
|
||
/** Text mit Absaetzen und Skill-Chips */
|
||
function gear_guide_rich_html(string $text, ?string $className): string
|
||
{
|
||
return gear_guide_chips(gear_description_html($text), $className);
|
||
}
|
||
|
||
/** Mehrzeiliger Text: Zeilenumbrueche vereinheitlicht und gekuerzt. */
|
||
function gear_guide_text(mixed $value, int $max): string
|
||
{
|
||
return mb_substr(trim(str_replace(["\r\n", "\r"], "\n", is_string($value) ? $value : '')), 0, $max);
|
||
}
|
||
|
||
/** Guide eines Sets (leer, wenn noch keiner geschrieben ist). */
|
||
function gear_guide(array $set): array
|
||
{
|
||
$data = json_decode((string) ($set['guide'] ?? ''), true);
|
||
return gear_guide_normalize(is_array($data) ? $data : []);
|
||
}
|
||
|
||
/** Zum Speichern: null, wenn nichts drinsteht. */
|
||
function gear_guide_json(array $guide): ?string
|
||
{
|
||
$empty = $guide['difficulty'] === '' && !$guide['tags'] && !$guide['strengths'] && !$guide['weaknesses'] && !$guide['tips']
|
||
&& !$guide['skills'] && !$guide['styles'] && !$guide['keys'] && $guide['daevanion'] === '' && !$guide['stats'];
|
||
return $empty ? null : json_encode($guide, JSON_UNESCAPED_UNICODE);
|
||
}
|
||
|
||
/** Hat der Build schon einen Guide (Beschreibung oder Guide-Felder)? */
|
||
function gear_guide_has_content(array $set, array $guide): bool
|
||
{
|
||
return trim((string) ($set['description'] ?? '')) !== '' || gear_guide_json($guide) !== null;
|
||
}
|
||
|
||
/**
|
||
* Geplante Skills fuer die Uebersicht: aktive und passive nach Stufe gruppiert (hoechste zuerst), Stigmen extra -
|
||
* innerhalb einer Gruppe die mit Reihenfolge zuerst (nach Nummer), danach wie im Skill-Fenster.
|
||
*
|
||
* @param array<int, array{skill: array, level: int, specs: int}> $planned
|
||
* @param array<int, array{order: int, why: string}> $notes Reihenfolge und Begruendung je Skill (Guide)
|
||
* @param array<int, string> $styles Spielweisen des Guides
|
||
* @param array<int, array> $alts alternative Stigmen (gear_guide_alt_stigmas) - nur in den Reihen der Spielweisen
|
||
* @return array{levels: array<int, array>, stigma: array, prio: array<string, array<int, array>>} prio: [Art => [Spielweise (0 = allgemein) => Skills]]
|
||
*/
|
||
function gear_guide_skill_groups(array $planned, array $notes = [], array $styles = [], array $alts = []): array
|
||
{
|
||
$levels = [];
|
||
$stigma = [];
|
||
foreach ($planned as $entry) {
|
||
if ($entry['skill']['kind'] === 'stigma') {
|
||
$stigma[] = $entry;
|
||
} else {
|
||
$levels[$entry['level']][] = $entry;
|
||
}
|
||
}
|
||
$byOrder = static function (array $a, array $b) use ($notes): int {
|
||
$oa = $notes[(int) $a['skill']['id']]['order'] ?? 0;
|
||
$ob = $notes[(int) $b['skill']['id']]['order'] ?? 0;
|
||
return [$oa === 0 ? PHP_INT_MAX : $oa, (int) $a['skill']['sort_order']] <=> [$ob === 0 ? PHP_INT_MAX : $ob, (int) $b['skill']['sort_order']];
|
||
};
|
||
krsort($levels);
|
||
foreach ($levels as &$entries) {
|
||
usort($entries, $byOrder);
|
||
}
|
||
unset($entries);
|
||
usort($stigma, static fn (array $a, array $b): int => ($b['level'] <=> $a['level']) ?: $byOrder($a, $b));
|
||
if (array_filter($stigma, static fn (array $e): bool => ($notes[(int) $e['skill']['id']]['order'] ?? 0) > 0)) {
|
||
usort($stigma, $byOrder); // Stigmen mit Reihenfolge: genau so, wie der Ersteller sie nummeriert hat
|
||
}
|
||
// Prioritaet je Art (Stigma, Passiv) und Spielweise (0 = allgemein): nur Skills mit Prioritaet, wichtigster zuerst
|
||
$prio = [];
|
||
foreach (GEAR_GUIDE_PRIO_KINDS as $kind => $unused) {
|
||
// Mit Spielweisen nur deren Reihen (die allgemeine Prioritaet steckt darin), sonst die allgemeine
|
||
foreach ($styles ? array_keys($styles) : [0] as $style) {
|
||
$entries = array_values(array_filter($style > 0 ? $planned + $alts : $planned, static fn (array $e): bool => $e['skill']['kind'] === $kind && gear_guide_prio($notes, (int) $e['skill']['id'], $style) > 0));
|
||
usort($entries, static fn (array $a, array $b): int => [gear_guide_prio($notes, (int) $a['skill']['id'], $style), (int) $a['skill']['sort_order']] <=> [gear_guide_prio($notes, (int) $b['skill']['id'], $style), (int) $b['skill']['sort_order']]);
|
||
if ($entries) {
|
||
$prio[$kind][$style] = $entries;
|
||
}
|
||
}
|
||
}
|
||
return ['levels' => $levels, 'stigma' => $stigma, 'prio' => $prio];
|
||
}
|
||
|
||
/**
|
||
* Alternative Stigmen eines Sets: Stigmen der Klasse, die im Skill-Plan nicht gesteigert sind (dort gehen nur
|
||
* GEAR_STIGMA_SLOTS) - im Guide lassen sie sich fuer Spielweisen einplanen, z.B. ein Block-Stigma nur fuer "Tank".
|
||
* Als Eintraege wie die geplanten Skills, mit der Ziel-Stufe aus dem Guide.
|
||
*
|
||
* @return array<int, array{skill: array, level: int, own: int, bonus: array, specs: int, alt: bool}>
|
||
*/
|
||
function gear_guide_alt_stigmas(array $set, array $planned, array $notes): array
|
||
{
|
||
$alts = [];
|
||
foreach (gear_skills_for_class(!empty($set['class_name']) ? (string) $set['class_name'] : null) as $id => $skill) {
|
||
if ($skill['kind'] === 'stigma' && !isset($planned[$id])) {
|
||
$level = (int) ($notes[$id]['level'] ?? 0);
|
||
$alts[$id] = ['skill' => $skill, 'level' => $level, 'own' => $level, 'bonus' => [], 'specs' => 0, 'alt' => true];
|
||
}
|
||
}
|
||
return $alts;
|
||
}
|
||
|
||
/** Skill einer Spielweise zugeordnet (dort eine eigene Prioritaet) - dann nur in diesen Spielweisen, nicht allgemein */
|
||
function gear_guide_style_bound(array $notes, int $skillId): bool
|
||
{
|
||
return (bool) array_filter($notes[$skillId]['styles'] ?? [], static fn (int $value): bool => $value > 0);
|
||
}
|
||
|
||
/**
|
||
* Prioritaet eines Skills - allgemein (Spielweise 0) oder in einer Spielweise: deren eigene, sonst die allgemeine;
|
||
* einer Spielweise zugeordnete Skills nur dort, wo sie eine eigene haben. 0 = keine bzw. ausgeblendet
|
||
*/
|
||
function gear_guide_prio(array $notes, int $skillId, int $style = 0): int
|
||
{
|
||
$general = gear_guide_style_bound($notes, $skillId) ? 0 : (int) ($notes[$skillId]['prio'] ?? 0);
|
||
if ($style === 0) {
|
||
return $general;
|
||
}
|
||
$own = (int) ($notes[$skillId]['styles'][$style] ?? 0);
|
||
return $own === -1 ? 0 : ($own > 0 ? $own : $general);
|
||
}
|
||
|
||
/** Skill-Symbol (oder Anfangsbuchstabe, wenn das Icon fehlt) */
|
||
function gear_guide_skill_icon(array $skill): string
|
||
{
|
||
$url = gear_skill_icon_url($skill);
|
||
return $url ? '<img src="' . e($url) . '" alt="" loading="lazy">' : '<span class="gear-guide-skill-initial">' . e(mb_substr(gear_skill_display_name($skill), 0, 1)) . '</span>';
|
||
}
|
||
|
||
/**
|
||
* Skill-Kachel mit Stufe und - falls vom Ersteller vergeben - Reihenfolge im Kreis. Ein Knopf: zeigt die Details des
|
||
* Skills (Begruendung, Spezialisierungen) im Feld daneben (assets/js/gear-guide.js).
|
||
*/
|
||
function gear_guide_skill_tile(array $entry, array $notes, bool $active = false, ?int $prioStyle = null): string
|
||
{
|
||
$skill = $entry['skill'];
|
||
$id = (int) $skill['id'];
|
||
// Im Kreis: Reihenfolge - in der Prioritaets-Zeile stattdessen die Prioritaet (allgemein bzw. der Spielweise)
|
||
$prio = $prioStyle !== null;
|
||
$order = $prio ? gear_guide_prio($notes, $id, $prioStyle) : (int) ($notes[$id]['order'] ?? 0);
|
||
$sources = gear_guide_level_sources($entry);
|
||
$alt = !empty($entry['alt']);
|
||
$title = gear_skill_display_name($skill) . ($alt ? ' – Alternative' : '') . ((int) $entry['level'] > 0 ? ' – Stufe ' . (int) $entry['level'] : '') . ($sources !== '' ? ' (' . $sources . ')' : '') . ($order > 0 ? ($prio ? ' · Priorität ' : ' · Reihenfolge ') . $order : '');
|
||
$tip = gear_guide_tip_attrs($skill);
|
||
return '<button type="button" class="gear-guide-skill' . ($active ? ' is-active' : '') . ($alt ? ' is-alt' : '') . ($sources !== '' ? ' is-boosted' : '') . (!empty($notes[$id]['why']) ? ' has-note' : '')
|
||
. '" data-guide-skill="' . $id . '" aria-controls="gear-guide-skill-' . $id . '" aria-pressed="' . ($active ? 'true' : 'false') . '"'
|
||
. ($tip !== '' ? $tip . ' aria-label="' . e($title) . '"' : ' title="' . e($title) . '"') . '>'
|
||
. gear_guide_skill_icon($skill)
|
||
. ($order > 0 ? '<span class="gear-guide-skill-order' . ($prio ? ' is-prio' : '') . '">' . $order . '</span>' : '')
|
||
. '<span class="gear-guide-skill-level">' . ((int) $entry['level'] > 0 ? 'Lv. ' . (int) $entry['level'] : 'Alt.') . '</span></button>';
|
||
}
|
||
|
||
/** "10 selbst · +4 Daevanion · +2 Arcana" - leer ohne Boni */
|
||
function gear_guide_level_sources(array $entry): string
|
||
{
|
||
$parts = [];
|
||
foreach (['daevanion' => 'Daevanion', 'arcana' => 'Arcana', 'gear' => 'Ausrüstung'] as $source => $label) {
|
||
if (!empty($entry['bonus'][$source])) {
|
||
$parts[] = '+' . (int) $entry['bonus'][$source] . ' ' . $label;
|
||
}
|
||
}
|
||
return $parts ? (int) ($entry['own'] ?? $entry['level']) . ' selbst · ' . implode(' · ', $parts) : '';
|
||
}
|
||
|
||
/**
|
||
* Gewaehlte bzw. erreichte Spezialisierungen eines geplanten Skills: aktive Skills die im Skills-Reiter gewaehlten
|
||
* (soweit die Stufe sie zulaesst), Stigmen die Boni bis zur erreichten Stufe.
|
||
*
|
||
* @return int[] Nummern
|
||
*/
|
||
function gear_guide_chosen_parts(array $entry): array
|
||
{
|
||
$skill = $entry['skill'];
|
||
$level = (int) $entry['level'];
|
||
if (gear_skill_has_specs($skill['kind'])) {
|
||
return gear_skill_spec_numbers(gear_skill_specs_clean((int) ($entry['specs'] ?? 0), $level));
|
||
}
|
||
return array_keys(array_filter(gear_skill_part_levels($skill['kind']), static fn (int $from): bool => $level >= $from));
|
||
}
|
||
|
||
/**
|
||
* Symbol einer Spezialisierung wie im Spiel - je Nummer eine Farbe (I gruen, II blau, III gelb, IV orange, V rot,
|
||
* assets/images/specs), nicht gewaehlte grau (CSS).
|
||
*/
|
||
function gear_guide_spec_icon(bool $on, int $no): string
|
||
{
|
||
$no = max(1, min(5, $no));
|
||
return '<img class="gear-guide-spec-img' . ($on ? ' is-on' : '') . '" src="' . e(asset_url('/assets/images/specs/spec-' . $no . '.png')) . '" alt="" width="26" height="26" loading="lazy">';
|
||
}
|
||
|
||
/** Details eines Skills fuer das Feld neben den Kacheln: Name, Ziel-Stufe, Prioritaet, Spezialisierungen, Begruendung. */
|
||
function gear_guide_skill_detail(array $entry, array $notes, bool $visible, array $styles = []): string
|
||
{
|
||
$skill = $entry['skill'];
|
||
$id = (int) $skill['id'];
|
||
$level = (int) $entry['level'];
|
||
$note = ($notes[$id] ?? []) + ['order' => 0, 'prio' => 0, 'styles' => [], 'why' => '', 'specs' => []];
|
||
$parts = gear_skill_parts($skill);
|
||
// Prioritaet je Spielweise (wie in den Reihen: eigene, sonst die allgemeine) - ausgeblendete als "aus"
|
||
$stylePrio = '';
|
||
foreach (isset(GEAR_GUIDE_PRIO_KINDS[$skill['kind']]) ? $styles : [] as $style => $name) {
|
||
$value = gear_guide_prio($notes, $id, $style);
|
||
$off = ($note['styles'][$style] ?? 0) === -1;
|
||
$stylePrio .= $value > 0 || $off ? '<span class="gear-guide-priority is-prio' . ($off ? ' is-off' : '') . '">' . e($name) . ' ' . ($off ? 'aus' : $value) . '</span>' : '';
|
||
}
|
||
$chosen = gear_guide_chosen_parts($entry);
|
||
$english = !empty($skill['name_de']) && $skill['name_de'] !== $skill['name'] ? (string) $skill['name'] : '';
|
||
$html = '<article class="gear-guide-skill-detail" id="gear-guide-skill-' . $id . '" data-guide-detail="' . $id . '"' . ($visible ? '' : ' data-guide-hidden') . '>'
|
||
. '<div class="gear-guide-skill-detail-head"><span class="gear-guide-skill is-static"' . gear_guide_tip_attrs($skill) . '>' . gear_guide_skill_icon($skill) . '</span><div>'
|
||
. '<h4>' . e(gear_skill_display_name($skill)) . ($level > 0 ? ' <span class="gear-guide-target">Ziel Lv. ' . $level . '</span>' : '') . '</h4>'
|
||
. (($sources = gear_guide_level_sources($entry)) !== '' ? '<div class="gear-guide-level-sources">' . e($sources) . '</div>' : '')
|
||
. '<div class="gear-guide-skill-meta">' . ($english !== '' ? '<span class="text-muted">' . e($english) . '</span>' : '')
|
||
. '<span class="gear-guide-kind">' . e(GEAR_SKILL_KINDS[$skill['kind']] ?? $skill['kind']) . '</span>'
|
||
. (!empty($entry['alt']) ? '<span class="gear-guide-kind is-alt" title="Nicht im Skill-Plan gesteigert – tauscht man je nach Spielweise ein">Alternative</span>' : '')
|
||
. ($note['order'] > 0 ? '<span class="gear-guide-priority">Reihenfolge ' . (int) $note['order'] . '</span>' : '')
|
||
. (!$styles && gear_guide_prio($notes, $id) > 0 && isset(GEAR_GUIDE_PRIO_KINDS[$skill['kind']]) ? '<span class="gear-guide-priority is-prio">' . GEAR_GUIDE_PRIO_KINDS[$skill['kind']] . '-Priorität ' . gear_guide_prio($notes, $id) . '</span>' : '')
|
||
. $stylePrio
|
||
. '</div></div></div>';
|
||
// Alle Spezialisierungen (Stigma: Boni) wie bei wakayashi.gg - gewaehlte hervorgehoben, mit Prioritaet am Schild
|
||
if ($parts) {
|
||
$html .= '<h5 class="gear-guide-specs-title">' . ($skill['kind'] === 'stigma' ? 'Boni' : 'Spezialitäten') . '</h5><ul class="gear-guide-specs">';
|
||
foreach ($parts as $no => $part) {
|
||
$on = in_array($no, $chosen, true);
|
||
$priority = (int) ($note['specs'][$no] ?? 0);
|
||
$html .= '<li class="' . ($on ? 'is-on' : 'is-off') . '"' . ($part['en'] !== '' && $part['en'] !== $part['text'] ? ' title="' . e($part['en']) . '"' : '') . '>'
|
||
. '<span class="gear-guide-spec-icon">' . gear_guide_spec_icon($on, (int) $no)
|
||
. ($priority > 0 && $on ? '<span class="gear-guide-spec-priority">' . $priority . '</span>' : '') . '</span>'
|
||
. '<span class="gear-guide-spec-from">ab ' . (int) $part['t'] . '</span>'
|
||
. '<span class="gear-guide-spec-text">' . e($part['text']) . '</span></li>';
|
||
}
|
||
$html .= '</ul>';
|
||
}
|
||
$html .= $note['why'] !== ''
|
||
? '<div class="gear-guide-why"><strong>Warum:</strong>' . gear_guide_rich_html($note['why'], (string) $skill['class_name']) . '</div>'
|
||
: '<p class="text-muted gear-guide-why-empty">Keine Begründung hinterlegt.</p>';
|
||
return $html . '</article>';
|
||
}
|
||
|
||
/**
|
||
* Reiter "Guide" eines Sets.
|
||
*
|
||
* @param array $slots Slots des Sets (gear_slots_for_sets)
|
||
* @param array $planned geplante Skills (gear_set_skills_for_sets)
|
||
* @param array $plans Planer-Seiten des Sets (gear_set_plans) - fuer die Stufen samt Boni auf der Skill-Leiste
|
||
*/
|
||
function gear_render_guide_tab(array $set, bool $isOwn, array $slots, array $planned, array $plans): void
|
||
{
|
||
$guide = gear_guide($set);
|
||
$notes = $guide['skills'];
|
||
// Erreichte Stufe wie im Skills-Reiter: selbst gesteigert + Boni aus Daevanion, Arcana und Ausruestung (bis zur Obergrenze)
|
||
$bonuses = gear_plan_skill_bonuses($set, $plans);
|
||
foreach ($planned as $skillId => $entry) {
|
||
$own = min((int) $entry['level'], gear_skill_level_max($entry['skill']['kind']));
|
||
$planned[$skillId]['own'] = $own;
|
||
$planned[$skillId]['bonus'] = $bonuses[$skillId] ?? [];
|
||
$planned[$skillId]['level'] = gear_skill_effective_level($entry['skill']['kind'], $own, (int) array_sum($bonuses[$skillId] ?? []));
|
||
}
|
||
$description = (string) ($set['description'] ?? '');
|
||
// Kopfteil (Tags, Beschreibung, Staerken/Schwaechen) - Skill- und Tasten-Erklaerungen stehen weiter unten
|
||
$hasIntro = $description !== '' || $guide['difficulty'] !== '' || $guide['tags'] || $guide['strengths'] || $guide['weaknesses'];
|
||
$styles = $guide['styles'];
|
||
$alts = gear_guide_alt_stigmas($set, $planned, $notes);
|
||
$groups = gear_guide_skill_groups($planned, $notes, $styles, $alts);
|
||
$setUrl = '/gear.php?set=' . (int) $set['id'];
|
||
$filled = count(array_filter($slots, static fn (array $row): bool => !empty($row['item'])));
|
||
// Reihenfolge wie angezeigt (fuer die Details und den Bearbeiten-Dialog)
|
||
$ordered = [];
|
||
foreach ($groups['levels'] as $levelEntries) {
|
||
array_push($ordered, ...$levelEntries);
|
||
}
|
||
array_push($ordered, ...$groups['stigma']);
|
||
// Details auch fuer alternative Stigmen, die in einer Spielweise vorkommen
|
||
$shownAlts = [];
|
||
foreach ($groups['prio']['stigma'] ?? [] as $prioEntries) {
|
||
foreach ($prioEntries as $entry) {
|
||
if (!empty($entry['alt'])) {
|
||
$shownAlts[(int) $entry['skill']['id']] = $entry;
|
||
}
|
||
}
|
||
}
|
||
// Zuerst gezeigter Skill: Prioritaet 1, sonst der erste mit Begruendung, sonst der erste
|
||
$activeId = 0;
|
||
foreach ($ordered as $entry) {
|
||
if (($notes[(int) $entry['skill']['id']]['order'] ?? 0) === 1) {
|
||
$activeId = (int) $entry['skill']['id'];
|
||
break;
|
||
}
|
||
}
|
||
if ($activeId === 0) {
|
||
foreach ($ordered as $entry) {
|
||
if (!empty($notes[(int) $entry['skill']['id']]['why'])) {
|
||
$activeId = (int) $entry['skill']['id'];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if ($activeId === 0 && $ordered) {
|
||
$activeId = (int) $ordered[0]['skill']['id'];
|
||
}
|
||
// Hotbar und Makro des gewaehlten Presets
|
||
$macro = gear_set_macro((int) $set['id']);
|
||
$macroSkills = gear_macro_skills(!empty($set['class_name']) ? (string) $set['class_name'] : null);
|
||
$macroLevels = gear_macro_levels($set, $macroSkills, $plans);
|
||
$preset = $guide['preset'];
|
||
$bar = $macro['bars'][$preset] ?? [];
|
||
$entries = $macro['presets'][$preset] ?? [];
|
||
// Tasten als Text ('1'-'8' werden als Array-Schluessel sonst zu Zahlen)
|
||
$macroKeys = array_map('strval', array_keys(GEAR_MACRO_KEYS));
|
||
$usedKeys = array_values(array_filter($macroKeys, static fn (string $key): bool => !empty($bar[$key]) || isset($guide['keys'][$key])));
|
||
$keyIcons = static function (string $key) use ($bar, $macroSkills, $macroLevels): string {
|
||
$html = '';
|
||
foreach ($bar[$key] ?? [] as $skillId) {
|
||
$tip = isset($macroSkills[(int) $skillId]) ? gear_guide_tip_attrs($macroSkills[(int) $skillId]) : '';
|
||
$html .= '<span class="gear-guide-hotbar-icon"' . ($tip !== '' ? $tip : ' title="' . e(gear_macro_skill_name((int) $skillId, $macroSkills)) . '"') . '>'
|
||
. gear_macro_icon_html($macroSkills[(int) $skillId] ?? null, $macroLevels[(int) $skillId] ?? 0, 34) . '</span>';
|
||
}
|
||
return $html;
|
||
};
|
||
?>
|
||
<?php if (!$hasIntro && ($isOwn || !gear_guide_has_content($set, $guide))): ?>
|
||
<div class="panel gear-guide-empty">
|
||
<?php if ($isOwn): ?>
|
||
<p><strong>Erkläre deinen Build.</strong> Wofür ist er gedacht, was kann er gut, worauf muss man achten? Schreib eine Beschreibung, Stärken, Schwächen und Tipps – das sehen alle, die das Set ansehen.</p>
|
||
<button type="button" class="button" data-modal-open="gear-guide-edit"><?= icon('edit') ?> Guide schreiben</button>
|
||
<?php else: ?>
|
||
<p class="text-muted">Zu diesem Build gibt es noch keine Erklärung – unten siehst du, was geplant ist.</p>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php elseif ($hasIntro): ?>
|
||
<div class="panel gear-guide-intro">
|
||
<div class="gear-guide-chips">
|
||
<?php if ($guide['difficulty'] !== ''): ?>
|
||
<span class="gear-guide-chip gear-guide-difficulty is-<?= e($guide['difficulty']) ?>"><?= e(GEAR_GUIDE_DIFFICULTIES[$guide['difficulty']]) ?></span>
|
||
<?php endif; ?>
|
||
<?php foreach ($guide['tags'] as $tag): ?><span class="gear-guide-chip"><?= e($tag) ?></span><?php endforeach; ?>
|
||
<?php if ($isOwn): ?>
|
||
<button type="button" class="button button-secondary button-small gear-guide-edit-button" data-modal-open="gear-guide-edit"><?= icon('edit') ?> Guide bearbeiten</button>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if ($description !== ''): ?><div class="gear-description-text"><?= gear_guide_rich_html($description, $set['class_name']) ?></div><?php endif; ?>
|
||
<?php if ($guide['strengths'] || $guide['weaknesses']): ?>
|
||
<div class="gear-guide-points">
|
||
<div class="gear-guide-point-box is-strengths">
|
||
<h4>Stärken</h4>
|
||
<?php if ($guide['strengths']): ?><ul><?php foreach ($guide['strengths'] as $point): ?><li><?= e($point) ?></li><?php endforeach; ?></ul><?php else: ?><p class="text-muted">–</p><?php endif; ?>
|
||
</div>
|
||
<div class="gear-guide-point-box is-weaknesses">
|
||
<h4>Schwächen</h4>
|
||
<?php if ($guide['weaknesses']): ?><ul><?php foreach ($guide['weaknesses'] as $point): ?><li><?= e($point) ?></li><?php endforeach; ?></ul><?php else: ?><p class="text-muted">–</p><?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<section class="panel gear-guide-section gear-guide-skills" data-guide-skills>
|
||
<div class="gear-guide-section-head">
|
||
<h3>Skill-Setup</h3>
|
||
<span class="text-muted gear-guide-legend">Zahl auf der Kachel = Ziel-Level · Nummer im Kreis = Reihenfolge<?= $groups['prio'] ? ' bzw. Priorität' : '' ?></span>
|
||
<?php if ($isOwn && $planned): ?>
|
||
<button type="button" class="button button-secondary button-small" data-modal-open="gear-guide-skills-edit"><?= icon('edit') ?> Skills & Tasten erklären</button>
|
||
<?php endif; ?>
|
||
<a href="<?= e($setUrl) ?>&tab=skills">Alle Skills →</a>
|
||
</div>
|
||
<?php if (!$planned): ?>
|
||
<p class="text-muted">Noch keine Skills geplant.</p>
|
||
<?php else: ?>
|
||
<div class="gear-guide-skills-layout">
|
||
<div class="gear-guide-skill-rows">
|
||
<?php foreach ($groups['levels'] as $level => $levelEntries): ?>
|
||
<div class="gear-guide-skill-row">
|
||
<span class="gear-guide-level">Lv <?= (int) $level ?></span>
|
||
<div class="gear-guide-skill-list"><?php foreach ($levelEntries as $entry): ?><?= gear_guide_skill_tile($entry, $notes, (int) $entry['skill']['id'] === $activeId) ?><?php endforeach; ?></div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<?php if ($groups['stigma']): ?>
|
||
<div class="gear-guide-skill-row is-stigma">
|
||
<span class="gear-guide-level">Stigma</span>
|
||
<div class="gear-guide-skill-list"><?php foreach ($groups['stigma'] as $entry): ?><?= gear_guide_skill_tile($entry, $notes, (int) $entry['skill']['id'] === $activeId) ?><?php endforeach; ?></div>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php
|
||
// Prioritaet der Stigmen und passiven Skills, wichtigster zuerst - allgemein bzw. je Spielweise. Die
|
||
// Stigma-Reihen aller Spielweisen stehen untereinander (damit keine uebersehen wird), bei den passiven
|
||
// Skills schaltet ein Umschalter um (assets/js/gear-guide.js) - ohne JavaScript stehen alle da
|
||
$prioRow = static function (string $kind, int $style, array $prioEntries, bool $switchable) use ($styles, $notes, $activeId): string {
|
||
$html = '<div class="gear-guide-skill-row is-prio' . ($kind === 'stigma' ? ' is-stigma' : '') . '"'
|
||
. ($switchable ? ' data-guide-style-row="' . $style . '"' : '') . '>'
|
||
. '<span class="gear-guide-level" title="' . e(GEAR_GUIDE_PRIO_KINDS[$kind]) . '-Priorität' . ($style > 0 ? ' (' . e($styles[$style]) . ')' : '') . ': wichtigster zuerst">'
|
||
. e(GEAR_GUIDE_PRIO_KINDS[$kind]) . '<small>' . ($style > 0 ? e($styles[$style]) : 'Priorität') . '</small></span>'
|
||
. '<div class="gear-guide-skill-list">';
|
||
foreach ($prioEntries as $i => $entry) {
|
||
$html .= ($i > 0 ? '<span class="gear-guide-prio-sep" aria-hidden="true">›</span>' : '')
|
||
. gear_guide_skill_tile($entry, $notes, (int) $entry['skill']['id'] === $activeId, $style);
|
||
}
|
||
return $html . '</div></div>';
|
||
};
|
||
$stigmaRows = $groups['prio']['stigma'] ?? [];
|
||
$passiveRows = $groups['prio']['passive'] ?? [];
|
||
?>
|
||
<?php if ($stigmaRows): ?>
|
||
<div class="gear-guide-prio gear-guide-prio-stigma">
|
||
<?php if (count($stigmaRows) > 1): ?><p class="gear-guide-prio-head">Stigmen je Spielweise</p><?php endif; ?>
|
||
<?php foreach ($stigmaRows as $style => $prioEntries): ?>
|
||
<?= $prioRow('stigma', (int) $style, $prioEntries, false) ?>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php if ($passiveRows): ?>
|
||
<div class="gear-guide-prio" data-guide-styles>
|
||
<?php if (count($passiveRows) > 1): ?>
|
||
<div class="gear-guide-style-tabs" role="group" aria-label="Spielweise der passiven Skills" hidden>
|
||
<span class="text-muted">Passive Skills für:</span>
|
||
<?php foreach (array_keys($passiveRows) as $i => $style): ?>
|
||
<button type="button" class="gear-guide-style-tab<?= $i === 0 ? ' is-active' : '' ?>" data-guide-style="<?= (int) $style ?>" aria-pressed="<?= $i === 0 ? 'true' : 'false' ?>"><?= e($style === 0 ? 'Allgemein' : $styles[$style]) ?></button>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php foreach ($passiveRows as $style => $prioEntries): ?>
|
||
<?= $prioRow('passive', (int) $style, $prioEntries, count($passiveRows) > 1) ?>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<div class="gear-guide-skill-details">
|
||
<?php foreach (array_merge($ordered, array_values($shownAlts)) as $entry): ?>
|
||
<?= gear_guide_skill_detail($entry, $notes, (int) $entry['skill']['id'] === $activeId, $styles) ?>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
</section>
|
||
|
||
<div class="gear-guide-grid">
|
||
<section class="panel gear-guide-section">
|
||
<div class="gear-guide-section-head">
|
||
<h3>Hotbar & Makro</h3>
|
||
<span class="text-muted gear-guide-legend">Preset <?= $preset ?></span>
|
||
<?php if ($isOwn): ?>
|
||
<button type="button" class="button button-secondary button-small" data-modal-open="gear-guide-skills-edit"><?= icon('edit') ?> Tasten erklären</button>
|
||
<?php endif; ?>
|
||
<a href="<?= e($setUrl) ?>&tab=macro&preset=<?= $preset ?>">Makro öffnen →</a>
|
||
</div>
|
||
<?php if (!$usedKeys && !$entries): ?>
|
||
<p class="text-muted">Für Preset <?= $preset ?> ist noch keine Skill-Leiste geplant<?= $isOwn ? ' – belege sie im Reiter „Makro“, dann kannst du hier jede Taste erklären' : '' ?>.</p>
|
||
<?php else: ?>
|
||
<?php if ($usedKeys): ?>
|
||
<?php
|
||
// Skill-Leiste wie das Skill-Fenster im Spiel: je Taste die Reihen 3 bis 0, darunter die Tastenreihe
|
||
// (zeigt den Skill aus Reihe 0); Reihennummern rechts, Gruppen 1-4, 5-8, Q E, R T
|
||
$hotbarCell = static function (int $skillId) use ($macroSkills, $macroLevels): string {
|
||
if ($skillId <= 0) {
|
||
return '';
|
||
}
|
||
$skill = $macroSkills[$skillId] ?? null;
|
||
$url = gear_skill_icon_url($skill);
|
||
$level = $macroLevels[$skillId] ?? 0;
|
||
$tip = $skill !== null ? gear_guide_tip_attrs($skill) : '';
|
||
return '<span class="gear-guide-skillbar-skill"' . ($tip !== '' ? $tip : ' title="' . e(gear_macro_skill_name($skillId, $macroSkills)) . '"') . '>'
|
||
. ($url !== null ? '<img src="' . e($url) . '" alt="' . e(gear_macro_skill_name($skillId, $macroSkills)) . '" loading="lazy">'
|
||
: '<span class="gear-macro-initial">' . e(mb_substr(gear_macro_skill_name($skillId, $macroSkills), 0, 1)) . '</span>')
|
||
. ($level > 0 ? '<span class="gear-guide-skillbar-lv">St. ' . $level . '</span>' : '') . '</span>';
|
||
};
|
||
?>
|
||
<div class="gear-guide-skillbar-wrap">
|
||
<div class="gear-guide-skillbar">
|
||
<?php foreach ($macroKeys as $index => $key): ?>
|
||
<?php $ids = array_values(array_map('intval', (array) ($bar[$key] ?? []))); ?>
|
||
<div class="gear-guide-skillbar-key<?= in_array($index, [3, 7, 9], true) ? ' is-group-end' : '' ?>">
|
||
<?php for ($row = GEAR_MACRO_KEY_ROWS - 1; $row >= 0; $row--): ?>
|
||
<span class="gear-guide-skillbar-cell<?= empty($ids[$row]) ? ' is-empty' : '' ?>"><?= $hotbarCell($ids[$row] ?? 0) ?></span>
|
||
<?php endfor; ?>
|
||
<span class="gear-guide-skillbar-cell is-hotkey<?= empty($ids[0]) ? ' is-empty' : '' ?>">
|
||
<?= $hotbarCell($ids[0] ?? 0) ?>
|
||
<span class="gear-guide-skillbar-keyname"><?= gear_macro_key_html($key) ?></span>
|
||
</span>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<div class="gear-guide-skillbar-rows" aria-hidden="true">
|
||
<?php for ($row = GEAR_MACRO_KEY_ROWS - 1; $row >= 0; $row--): ?><span><?= $row ?></span><?php endfor; ?><span></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php $notedKeys = array_values(array_filter($usedKeys, static fn (string $key): bool => isset($guide['keys'][$key]))); ?>
|
||
<?php if ($notedKeys): ?>
|
||
<ul class="gear-guide-hotbar">
|
||
<?php foreach ($notedKeys as $key): ?>
|
||
<li>
|
||
<?= gear_macro_key_html($key) ?>
|
||
<span class="gear-guide-hotbar-icons"><?= $keyIcons($key) ?></span>
|
||
<span class="gear-guide-hotbar-note"><?= gear_guide_chips(nl2br(e($guide['keys'][$key]), false), $set['class_name']) ?></span>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
<?php endif; ?>
|
||
<?php endif; ?>
|
||
<?php if ($entries): ?>
|
||
<h4 class="gear-guide-subhead">Makro <span class="text-muted">– Makro-Taste halten, läuft von oben nach unten</span></h4>
|
||
<?php // Wie die Makro-Liste im Spiel: Nummer, Skill der Taste mit Tasten-Abzeichen und Stufe, darunter die Verzoegerung ?>
|
||
<ol class="gear-guide-macro">
|
||
<?php foreach ($entries as $macroEntry): ?>
|
||
<?php
|
||
$keySkills = array_values(array_filter(array_map('intval', (array) ($bar[$macroEntry['k']] ?? []))));
|
||
$firstId = $keySkills[0] ?? 0;
|
||
$firstSkill = $macroSkills[$firstId] ?? null;
|
||
$tip = $firstSkill !== null ? gear_guide_tip_attrs($firstSkill) : '';
|
||
?>
|
||
<li>
|
||
<div class="gear-guide-macro-skill">
|
||
<span class="gear-guide-macro-icon"<?= $tip ?>>
|
||
<?php if ($firstId > 0): ?>
|
||
<?= gear_macro_icon_html($firstSkill, 0, 64) ?>
|
||
<?php else: ?>
|
||
<span class="gear-macro-initial">?</span>
|
||
<?php endif; ?>
|
||
<span class="gear-guide-macro-badge"><?= gear_macro_key_html($macroEntry['k']) ?></span>
|
||
<?php if (($macroLevels[$firstId] ?? 0) > 0): ?><span class="gear-guide-macro-level">St. <?= (int) $macroLevels[$firstId] ?></span><?php endif; ?>
|
||
</span>
|
||
<strong><?= $firstId > 0 ? e(gear_macro_skill_name($firstId, $macroSkills)) : '<span class="text-muted">Taste leer</span>' ?></strong>
|
||
<?php if (count($keySkills) > 1): ?>
|
||
<small class="text-muted">dann <?= e(implode(', ', array_map(static fn (int $id): string => gear_macro_skill_name($id, $macroSkills), array_slice($keySkills, 1)))) ?></small>
|
||
<?php endif; ?>
|
||
</div>
|
||
<div class="gear-guide-macro-delay"><span>Verzögerung</span><b><?= (int) $macroEntry['d'] ?></b><span>ms</span></div>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ol>
|
||
<?php endif; ?>
|
||
<?php endif; ?>
|
||
</section>
|
||
|
||
<section class="panel gear-guide-section">
|
||
<div class="gear-guide-section-head">
|
||
<h3>Ausrüstung</h3>
|
||
<a href="<?= e($setUrl) ?>">Ausrüstung öffnen →</a>
|
||
</div>
|
||
<?php
|
||
// Kennzahlen: Ø Gegenstandsstufe, belegte Slots, Ø Aufwertung; darunter das Raster und die wichtigsten Werte
|
||
$itemLevel = gear_set_item_level($slots);
|
||
$enchants = array_map(static fn (array $row): int => (int) $row['enchant'], array_filter($slots, static fn (array $row): bool => !empty($row['item']) && (int) $row['item']['enchant_max'] > 0));
|
||
$topStats = array_slice(gear_set_totals($slots), 0, 6);
|
||
?>
|
||
<div class="gear-guide-gear-stats">
|
||
<div class="gear-guide-gear-stat">
|
||
<span class="gear-guide-gear-stat-label" title="Ø Gegenstandsstufe">Ø Stufe</span>
|
||
<strong><?= $itemLevel !== null ? e(number_format($itemLevel, 0, ',', '.')) : '–' ?></strong>
|
||
</div>
|
||
<div class="gear-guide-gear-stat">
|
||
<span class="gear-guide-gear-stat-label">Slots</span>
|
||
<strong><?= $filled ?><small> / <?= count(GEAR_SLOTS) ?></small></strong>
|
||
<span class="gear-guide-gear-bar" aria-hidden="true"><i style="width: <?= (int) round($filled / max(1, count(GEAR_SLOTS)) * 100) ?>%"></i></span>
|
||
</div>
|
||
<div class="gear-guide-gear-stat">
|
||
<span class="gear-guide-gear-stat-label" title="Ø Aufwertung der aufwertbaren Gegenstände">Ø Plus</span>
|
||
<strong><?= $enchants ? '+' . e(number_format(array_sum($enchants) / count($enchants), 1, ',', '.')) : '–' ?></strong>
|
||
</div>
|
||
</div>
|
||
<div class="gear-guide-gear-doll"><?= gear_doll_mini_html($slots, false, true) ?></div>
|
||
<?php if ($topStats): ?>
|
||
<ul class="gear-guide-gear-totals">
|
||
<?php foreach ($topStats as $row): ?>
|
||
<li><span><?= e($row['name']) ?></span><strong><?= $row['estimated'] ? '≈' : '' ?><?= e(gear_format_value($row['total'], $row['unit'])) ?></strong></li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
<?php else: ?>
|
||
<p class="text-muted gear-guide-gear-empty">Noch keine Gegenstände eingesetzt – <?= $isOwn ? 'setz sie unter „Ausrüstung“ ein.' : 'die Werte erscheinen, sobald welche drin sind.' ?></p>
|
||
<?php endif; ?>
|
||
</section>
|
||
</div>
|
||
|
||
<?php if ($guide['stats'] || $isOwn): ?>
|
||
<?php // Stats-Prioritaet: worauf man bei Seelenpraegung und Manasteinen achten soll, allgemein und je Gruppe ?>
|
||
<section class="panel gear-guide-section gear-guide-stats">
|
||
<div class="gear-guide-section-head">
|
||
<h3>Stats-Priorität</h3>
|
||
<span class="text-muted gear-guide-legend">Worauf du bei Seelenprägung und Manasteinen achten solltest</span>
|
||
<?php if ($isOwn): ?>
|
||
<button type="button" class="button button-secondary button-small" data-modal-open="gear-guide-stats-edit"><?= icon('edit') ?> Priorität festlegen</button>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if (!$guide['stats']): ?>
|
||
<p class="text-muted">Noch keine Priorität festgelegt – lege fest, welche Werte für diesen Build am wichtigsten sind, allgemein oder je Waffe, Rüstung, Schmuck und Manastein.</p>
|
||
<?php else: ?>
|
||
<?php if (!empty($guide['stats']['all'])): ?>
|
||
<ol class="gear-guide-stat-chain">
|
||
<?php foreach ($guide['stats']['all'] as $i => $entry): ?>
|
||
<li<?= $entry['note'] !== '' ? ' title="' . e($entry['note']) . '"' : '' ?>>
|
||
<span class="gear-guide-stat-no"><?= $i + 1 ?></span><?= e($entry['stat']) ?>
|
||
<?php if ($entry['note'] !== ''): ?><small><?= e($entry['note']) ?></small><?php endif; ?>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ol>
|
||
<?php endif; ?>
|
||
<?php $statGroups = array_diff_key($guide['stats'], ['all' => true]); ?>
|
||
<?php if ($statGroups): ?>
|
||
<div class="gear-guide-stat-groups">
|
||
<?php foreach (GEAR_GUIDE_STAT_GROUPS as $group => [$groupLabel, $groupSlot]): ?>
|
||
<?php if (empty($statGroups[$group])) { continue; } ?>
|
||
<div class="gear-guide-stat-group">
|
||
<?php // Welche Slots dazugehoeren, steht im Tooltip - so beginnen die Listen aller Karten auf einer Hoehe ?>
|
||
<h4 title="<?= e($groupSlot !== null ? gear_guide_stat_group_slots($group) : 'Manasteine in allen Sockeln') ?>">
|
||
<span class="gear-guide-stat-icon" aria-hidden="true"><?= $groupSlot !== null ? gear_slot_silhouette($groupSlot) : '<span class="gear-guide-stat-gem"></span>' ?></span>
|
||
<?= e($groupLabel) ?>
|
||
</h4>
|
||
<ol>
|
||
<?php foreach ($statGroups[$group] as $entry): ?>
|
||
<li><strong><?= e($entry['stat']) ?></strong><?php if ($entry['note'] !== ''): ?><small class="gear-guide-stat-note"><?= e($entry['note']) ?></small><?php endif; ?></li>
|
||
<?php endforeach; ?>
|
||
</ol>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php endif; ?>
|
||
</section>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
// Daevanion: Bretter mit aktivierten Feldern, Kristalle, Skill-Boni und Werte (wie auf der Planer-Seite)
|
||
$class = (string) ($set['class_name'] ?? '');
|
||
$dvBoards = $class !== '' && gear_plan_ready('daevanion', $class) ? gear_daevanion_boards($class) : [];
|
||
$dvTotals = $dvBoards ? gear_daevanion_totals($plans['daevanion'] ?? [], $class) : null;
|
||
?>
|
||
<?php if ($dvBoards && ($dvTotals['spent'] || $guide['daevanion'] !== '')): ?>
|
||
<?php
|
||
// Nur Bretter mit aktivierten Feldern als Reiter; das Brett selbst wie auf der Seite Daevanion (Runen, nur ansehen)
|
||
$dvChosen = array_flip(array_map('intval', $plans['daevanion']['nodes'] ?? []));
|
||
$dvUsed = array_values(array_filter($dvBoards, static fn (array $board): bool => ($dvTotals['boards'][(int) $board['id']]['count'] ?? 0) > 0));
|
||
$dvSkills = gear_plan_class_skills($class);
|
||
?>
|
||
<section class="panel gear-guide-section gear-guide-daevanion" data-guide-dv>
|
||
<div class="gear-guide-section-head">
|
||
<h3>Daevanion</h3>
|
||
<a href="<?= e($setUrl) ?>&tab=daevanion">Daevanion öffnen →</a>
|
||
</div>
|
||
<?php if ($dvTotals['spent']): ?>
|
||
<div class="gear-guide-dv-budgets">
|
||
<?php foreach ($dvTotals['spent'] as $point => $spent): ?>
|
||
<?php $max = gear_daevanion_max((string) $point, $class); ?>
|
||
<div class="gear-guide-dv-budget">
|
||
<span><?= e(gear_daevanion_point_label((string) $point)) ?></span>
|
||
<strong><?= (int) $spent ?><small> / <?= $max ?></small></strong>
|
||
<i style="--fill: <?= $max > 0 ? min(100, round($spent / $max * 100, 1)) : 0 ?>%"></i>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<?php if ($dvTotals['skills']): ?>
|
||
<div class="gear-guide-dv-budget is-skills">
|
||
<span>Skillstufen aus Daevanion</span>
|
||
<strong>+<?= (int) array_sum($dvTotals['skills']) ?></strong>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php if ($guide['daevanion'] !== ''): ?>
|
||
<div class="gear-description-text gear-guide-dv-note"><?= gear_guide_rich_html($guide['daevanion'], $class) ?></div>
|
||
<?php endif; ?>
|
||
<?php if ($dvUsed): ?>
|
||
<div class="gear-guide-dv-tabs" role="tablist">
|
||
<?php foreach ($dvUsed as $index => $board): ?>
|
||
<?php $boardTotals = $dvTotals['boards'][(int) $board['id']]; ?>
|
||
<button type="button" class="gear-guide-dv-tab<?= $index === 0 ? ' is-active' : '' ?>" role="tab" data-guide-dv-tab="<?= (int) $board['id'] ?>"
|
||
aria-selected="<?= $index === 0 ? 'true' : 'false' ?>" style="--fill: <?= round($boardTotals['count'] / max(1, $boardTotals['total']) * 100, 1) ?>%">
|
||
<strong><?= e($board['title']) ?></strong>
|
||
<span><?= (int) $boardTotals['count'] ?>/<?= (int) $boardTotals['total'] ?> Felder</span>
|
||
</button>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php foreach ($dvUsed as $index => $board): ?>
|
||
<?php
|
||
$at = [];
|
||
foreach ($board['nodes'] as $node) {
|
||
$at[$node['r'] . ',' . $node['c']] = (int) $node['id'];
|
||
}
|
||
$rows = array_column($board['nodes'], 'r');
|
||
$cols = array_column($board['nodes'], 'c');
|
||
?>
|
||
<div class="gear-guide-dv-pane" role="tabpanel" data-guide-dv-pane="<?= (int) $board['id'] ?>">
|
||
<div class="gear-guide-dv-board">
|
||
<div class="gear-dv-grid" style="--cols: <?= max($cols) - min($cols) + 1 ?>; --rows: <?= max($rows) - min($rows) + 1 ?>">
|
||
<?php
|
||
foreach ($board['nodes'] as $node) {
|
||
echo gear_daevanion_node_html($node, min($rows), min($cols), $dvChosen, $at, $dvSkills, $class, false), "
|
||
";
|
||
}
|
||
?>
|
||
</div>
|
||
</div>
|
||
<?php
|
||
// Rechte Spalte wie im Spiel ("Board-Effekte"): Faehigkeitseffekte, darunter Attributeffekte
|
||
$boardTotals = $dvTotals['boards'][(int) $board['id']];
|
||
$skillNames = [];
|
||
foreach ($board['nodes'] as $node) {
|
||
if ($node['type'] === 'skill') {
|
||
$skillNames[$node['skill']] = $node['t'];
|
||
}
|
||
}
|
||
?>
|
||
<div class="gear-guide-dv-side">
|
||
<p class="gear-guide-dv-side-head"><strong><?= e($board['title']) ?></strong> <span class="text-muted"><?= (int) $boardTotals['count'] ?> von <?= (int) $boardTotals['total'] ?> Feldern · ab Stufe <?= (int) $board['need'] ?></span></p>
|
||
<?php if ($boardTotals['skills']): ?>
|
||
<h5 class="gear-guide-dv-effects">Fähigkeitseffekte</h5>
|
||
<?= gear_plan_skill_bonus_html($boardTotals['skills'], $class, $skillNames) ?>
|
||
<?php endif; ?>
|
||
<h5 class="gear-guide-dv-effects">Attributeffekte</h5>
|
||
<?= gear_plan_stats_html($boardTotals['stats'], 'Noch nichts aktiviert.') ?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<ul class="gear-guide-dv-legend">
|
||
<?php foreach (['common' => 'Werte', 'passive' => 'Passive Skills', 'active' => 'Aktive Skills', 'unique' => 'Große Felder'] as $rune => $label): ?>
|
||
<li><img src="/assets/images/daevanion/<?= $rune ?>-on.png" alt="" width="20" height="20"><?= e($label) ?></li>
|
||
<?php endforeach; ?>
|
||
<li><img src="/assets/images/daevanion/common-off.png" alt="" width="20" height="20">nicht aktiviert</li>
|
||
</ul>
|
||
<?php endif; ?>
|
||
<?php if ($dvTotals['spent']): ?>
|
||
<details class="gear-guide-dv-total">
|
||
<summary>Werte und Skill-Boni aller Bretter</summary>
|
||
<div class="gear-guide-dv-columns"><?= gear_daevanion_summary_html($dvTotals, $class) ?></div>
|
||
</details>
|
||
<?php endif; ?>
|
||
</section>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($guide['tips']): ?>
|
||
<section class="panel gear-guide-section">
|
||
<h3>Tipps</h3>
|
||
<ol class="gear-guide-tips">
|
||
<?php foreach ($guide['tips'] as $tip): ?>
|
||
<li>
|
||
<?php if ($tip['title'] !== ''): ?><strong><?= e($tip['title']) ?></strong><?php endif; ?>
|
||
<?php if ($tip['text'] !== ''): ?><div class="gear-description-text"><?= gear_guide_rich_html($tip['text'], $set['class_name']) ?></div><?php endif; ?>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ol>
|
||
</section>
|
||
<?php endif; ?>
|
||
|
||
<?= gear_guide_tip_sources(array_map(static fn (array $entry): int => (int) $entry['level'], $planned)) ?>
|
||
|
||
<?php if ($isOwn): ?>
|
||
<?php // Skills und Tasten erklaeren (auch ohne geplante Skills - dann nur die Tasten): Reihenfolge und Begruendung je Skill, Erklaerung je Taste (#skills-erklaeren) ?>
|
||
<div class="modal-overlay" id="gear-guide-skills-edit" data-hash="skills-erklaeren" hidden>
|
||
<div class="modal modal-wide">
|
||
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
|
||
<h2>Skills & Tasten erklären</h2>
|
||
<form method="post" action="/gear_action.php" class="gear-guide-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="save_guide_notes">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<?php if ($alts || array_filter($ordered, static fn (array $e): bool => isset(GEAR_GUIDE_PRIO_KINDS[$e['skill']['kind']]))): ?>
|
||
<fieldset class="gear-fieldset">
|
||
<legend>Spielweisen <span class="text-muted">(optional, z.B. Tank und DPS – je Spielweise eine eigene Priorität der Stigmen und Passiven)</span></legend>
|
||
<div class="gear-guide-style-names">
|
||
<?php for ($style = 1; $style <= GEAR_GUIDE_STYLES_MAX; $style++): ?>
|
||
<input type="text" name="styles[<?= $style ?>]" value="<?= e($styles[$style] ?? '') ?>" maxlength="<?= GEAR_GUIDE_STYLE_LENGTH ?>" placeholder="<?= e(['Tank', 'DPS', 'PvP', 'Solo'][$style - 1] ?? '') ?>" aria-label="Spielweise <?= $style ?>" data-guide-style-name="<?= $style ?>">
|
||
<?php endfor; ?>
|
||
</div>
|
||
<p class="field-hint">Sobald es Spielweisen gibt, zeigt der Guide nur noch sie. Jede übernimmt die Zahl unter „Standard“. Trägst du bei einem Stigma bzw. passiven Skill eine Zahl für eine Spielweise ein, gehört er zu ihr und steht nur in den Spielweisen mit eigener Zahl. Mit „aus“ blendest du einen Skill in einer Spielweise aus.</p>
|
||
</fieldset>
|
||
<?php endif; ?>
|
||
<?php if ($ordered): ?>
|
||
<fieldset class="gear-fieldset">
|
||
<legend>Skills <span class="text-muted">(Reihenfolge = in welcher Folge man sie steigert · Priorität = wie wichtig ein Stigma bzw. passiver Skill ist, 1 = am wichtigsten · leer = keine)</span></legend>
|
||
<?php foreach ($ordered as $entry): ?>
|
||
<?php $skillId = (int) $entry['skill']['id']; $note = ($notes[$skillId] ?? []) + ['order' => 0, 'prio' => 0, 'styles' => [], 'why' => '', 'specs' => []]; $prioKind = GEAR_GUIDE_PRIO_KINDS[$entry['skill']['kind']] ?? null; ?>
|
||
<div class="gear-guide-note-row">
|
||
<span class="gear-guide-skill is-static"><?= gear_guide_skill_icon($entry['skill']) ?><span class="gear-guide-skill-level">Lv. <?= (int) $entry['level'] ?></span></span>
|
||
<div class="gear-guide-note-fields">
|
||
<div class="gear-guide-note-title">
|
||
<strong><?= e(gear_skill_display_name($entry['skill'])) ?></strong>
|
||
<?php if ($entry['skill']['kind'] === 'stigma'): ?><span class="gear-skill-stigma-tag">Stigma</span><?php elseif ($entry['skill']['kind'] === 'passive'): ?><span class="gear-skill-stigma-tag is-passive">Passiv</span><?php endif; ?>
|
||
<?php if ($prioKind !== null): ?>
|
||
<label class="gear-guide-order" title="Wie wichtig dieser Skill unter den <?= $entry['skill']['kind'] === 'stigma' ? 'Stigmen' : 'passiven Skills' ?> ist – 1 = am wichtigsten<?= $styles ? '; gilt in allen Spielweisen ohne eigene Zahl' : '' ?>"><?= $styles ? 'Standard' : 'Priorität' ?>
|
||
<input type="number" name="skills[<?= $skillId ?>][prio]" min="0" max="<?= GEAR_GUIDE_PRIO_MAX ?>" value="<?= $note['prio'] > 0 ? (int) $note['prio'] : '' ?>">
|
||
</label>
|
||
<?php for ($style = 1; $style <= GEAR_GUIDE_STYLES_MAX; $style++): ?>
|
||
<?php $styleValue = (int) ($note['styles'][$style] ?? 0); ?>
|
||
<span class="gear-guide-order gear-guide-style-field" data-guide-style-field="<?= $style ?>"<?= isset($styles[$style]) ? '' : ' hidden' ?>>
|
||
<label title="Priorität in dieser Spielweise – leer = wie die allgemeine"><span data-guide-style-label="<?= $style ?>"><?= e($styles[$style] ?? '') ?></span>
|
||
<input type="number" name="skills[<?= $skillId ?>][styles][<?= $style ?>]" min="0" max="<?= GEAR_GUIDE_PRIO_MAX ?>" value="<?= $styleValue > 0 ? $styleValue : '' ?>" placeholder="<?= gear_guide_prio($notes, $skillId) ?: '' ?>">
|
||
</label>
|
||
<label class="gear-guide-style-hide" title="In dieser Spielweise ausblenden"><input type="checkbox" name="skills[<?= $skillId ?>][hide][<?= $style ?>]" value="1"<?= $styleValue === -1 ? ' checked' : '' ?>> aus</label>
|
||
</span>
|
||
<?php endfor; ?>
|
||
<?php endif; ?>
|
||
<label class="gear-guide-order">Reihenfolge
|
||
<input type="number" name="skills[<?= $skillId ?>][order]" min="0" max="<?= GEAR_GUIDE_ORDER_MAX ?>" value="<?= $note['order'] > 0 ? (int) $note['order'] : '' ?>">
|
||
</label>
|
||
</div>
|
||
<textarea name="skills[<?= $skillId ?>][why]" rows="2" maxlength="<?= GEAR_GUIDE_WHY_LENGTH ?>" placeholder="Warum dieser Skill, warum diese Stufe und Spezialisierungen …" aria-label="Begründung für <?= e(gear_skill_display_name($entry['skill'])) ?>"><?= e($note['why']) ?></textarea>
|
||
<?php if (gear_skill_has_specs($entry['skill']['kind'])): ?>
|
||
<?php $chosenSpecs = gear_guide_chosen_parts($entry); $specParts = gear_skill_parts($entry['skill']); ?>
|
||
<?php if ($chosenSpecs): ?>
|
||
<div class="gear-guide-spec-edit">
|
||
<span class="text-muted">Priorität der Spezialitäten:</span>
|
||
<?php foreach ($chosenSpecs as $no): ?>
|
||
<label title="<?= e($specParts[$no]['text'] ?? '') ?>">
|
||
<?= gear_guide_spec_icon(true, (int) $no) ?>
|
||
<span class="gear-guide-spec-edit-text"><?= e($specParts[$no]['text'] ?? '') ?></span>
|
||
<input type="number" name="skills[<?= $skillId ?>][specs][<?= $no ?>]" min="0" max="9" value="<?= (int) ($note['specs'][$no] ?? 0) ?: '' ?>" aria-label="Priorität: <?= e($specParts[$no]['text'] ?? '') ?>">
|
||
</label>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php else: ?>
|
||
<p class="field-hint">Spezialitäten wählst du im Reiter „Skills“ – danach kannst du hier ihre Reihenfolge festlegen.</p>
|
||
<?php endif; ?>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</fieldset>
|
||
<?php endif; ?>
|
||
<?php if ($alts): ?>
|
||
<fieldset class="gear-fieldset">
|
||
<legend>Alternative Stigmen <span class="text-muted">(nicht im Skill-Plan – zum Eintauschen je Spielweise, z.B. ein Block-Stigma nur für Tank)</span></legend>
|
||
<p class="field-hint">Im Reiter „Skills“ lassen sich wie im Spiel nur <?= GEAR_STIGMA_SLOTS ?> Stigmen steigern. Weitere trägst du hier mit Ziel-Stufe und Priorität je Spielweise ein – sie erscheinen nur in der Reihe dieser Spielweise.</p>
|
||
<p class="field-hint" data-guide-style-none<?= $styles ? ' hidden' : '' ?>>Benenne oben zuerst eine Spielweise – dann erscheinen hier ihre Felder.</p>
|
||
<?php foreach ($alts as $skillId => $entry): ?>
|
||
<?php $note = ($notes[$skillId] ?? []) + ['styles' => [], 'level' => 0, 'why' => '']; ?>
|
||
<div class="gear-guide-note-row">
|
||
<span class="gear-guide-skill is-static is-alt"><?= gear_guide_skill_icon($entry['skill']) ?></span>
|
||
<div class="gear-guide-note-fields">
|
||
<div class="gear-guide-note-title">
|
||
<strong><?= e(gear_skill_display_name($entry['skill'])) ?></strong>
|
||
<span class="gear-skill-stigma-tag">Stigma</span>
|
||
<?php for ($style = 1; $style <= GEAR_GUIDE_STYLES_MAX; $style++): ?>
|
||
<label class="gear-guide-order" data-guide-style-field="<?= $style ?>"<?= isset($styles[$style]) ? '' : ' hidden' ?>><span data-guide-style-label="<?= $style ?>"><?= e($styles[$style] ?? '') ?></span>
|
||
<input type="number" name="skills[<?= $skillId ?>][styles][<?= $style ?>]" min="0" max="<?= GEAR_GUIDE_PRIO_MAX ?>" value="<?= (int) ($note['styles'][$style] ?? 0) ?: '' ?>">
|
||
</label>
|
||
<?php endfor; ?>
|
||
<label class="gear-guide-order">Ziel-Stufe
|
||
<input type="number" name="skills[<?= $skillId ?>][level]" min="0" max="<?= GEAR_STIGMA_LEVEL_MAX ?>" value="<?= $note['level'] > 0 ? (int) $note['level'] : '' ?>">
|
||
</label>
|
||
</div>
|
||
<textarea name="skills[<?= $skillId ?>][why]" rows="1" maxlength="<?= GEAR_GUIDE_WHY_LENGTH ?>" placeholder="Wann und warum eintauschen …" aria-label="Begründung für <?= e(gear_skill_display_name($entry['skill'])) ?>"><?= e($note['why']) ?></textarea>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</fieldset>
|
||
<?php endif; ?>
|
||
<?php if (!$ordered): ?>
|
||
<p class="field-hint">Noch keine Skills geplant – Reihenfolge und Begründung je Skill kannst du ergänzen, sobald du im Reiter „Skills“ Stufen vergibst.</p>
|
||
<?php endif; ?>
|
||
<fieldset class="gear-fieldset">
|
||
<legend>Hotbar <span class="text-muted">(was auf welche Taste kommt und warum)</span></legend>
|
||
<label>Gezeigtes Preset
|
||
<select name="preset">
|
||
<?php foreach (GEAR_MACRO_PRESETS as $p): ?>
|
||
<option value="<?= $p ?>"<?= $preset === $p ? ' selected' : '' ?>>Preset <?= $p ?><?= gear_macro_count(['presets' => [$macro['presets'][$p] ?? []]]) > 0 || array_filter($macro['bars'][$p] ?? []) ? '' : ' (leer)' ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
</label>
|
||
<p class="field-hint">Die Tasten unten zeigen die Leiste von Preset <?= $preset ?>. Wechselst du das Preset, speichere und öffne den Dialog erneut, um die Belegung des anderen zu sehen.</p>
|
||
<?php foreach ($macroKeys as $key): ?>
|
||
<div class="gear-guide-key-row">
|
||
<?= gear_macro_key_html($key) ?>
|
||
<span class="gear-guide-hotbar-icons"><?= $keyIcons($key) ?></span>
|
||
<textarea name="keys[<?= e($key) ?>]" rows="1" maxlength="<?= GEAR_GUIDE_KEY_LENGTH ?>" placeholder="<?= !empty($bar[$key]) ? 'z.B. Hauptschaden über das Makro …' : 'leer' ?>" aria-label="Erklärung <?= e(GEAR_MACRO_KEYS[$key]) ?>"><?= e($guide['keys'][$key] ?? '') ?></textarea>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</fieldset>
|
||
<div class="actions">
|
||
<button type="submit" class="button">Speichern</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($isOwn): ?>
|
||
<?php // Stats-Prioritaet festlegen (#stats-prioritaet); Vorschlaege = Werte, die es bei der Gruppe gibt ?>
|
||
<?php $statOptions = gear_guide_stat_options(); ?>
|
||
<div class="modal-overlay" id="gear-guide-stats-edit" data-hash="stats-prioritaet" hidden>
|
||
<div class="modal modal-wide">
|
||
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
|
||
<h2>Stats-Priorität</h2>
|
||
<p class="text-muted">Wichtigster Wert zuerst. Die Vorschläge sind die Werte, die bei Gegenständen der Gruppe als Seelenprägung (bzw. als Manastein) vorkommen – du kannst aber auch etwas anderes eintragen. Leere Zeilen fallen weg.</p>
|
||
<form method="post" action="/gear_action.php" class="gear-guide-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="save_guide_stats">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<?php foreach (GEAR_GUIDE_STAT_GROUPS as $group => [$groupLabel]): ?>
|
||
<fieldset class="gear-fieldset">
|
||
<legend><?= e($groupLabel) ?><?= $group === 'all' ? ' <span class="text-muted">(gilt für die ganze Ausrüstung)</span>' : '' ?></legend>
|
||
<datalist id="gear-guide-stat-options-<?= e($group) ?>">
|
||
<?php foreach ($statOptions[$group] ?? [] as $option): ?><option value="<?= e($option) ?>"><?php endforeach; ?>
|
||
</datalist>
|
||
<?php for ($i = 0; $i < GEAR_GUIDE_STATS_MAX; $i++): ?>
|
||
<?php $entry = $guide['stats'][$group][$i] ?? ['stat' => '', 'note' => '']; ?>
|
||
<div class="gear-guide-stat-row">
|
||
<span class="gear-guide-stat-no"><?= $i + 1 ?></span>
|
||
<input type="text" name="stats[<?= e($group) ?>][<?= $i ?>][stat]" list="gear-guide-stat-options-<?= e($group) ?>" maxlength="<?= GEAR_GUIDE_STAT_LENGTH ?>" value="<?= e($entry['stat']) ?>" placeholder="Wert" aria-label="<?= e($groupLabel) ?>: Wert <?= $i + 1 ?>">
|
||
<input type="text" name="stats[<?= e($group) ?>][<?= $i ?>][note]" maxlength="<?= GEAR_GUIDE_STAT_NOTE_LENGTH ?>" value="<?= e($entry['note']) ?>" placeholder="Hinweis (optional), z.B. bis 50 %" aria-label="<?= e($groupLabel) ?>: Hinweis <?= $i + 1 ?>">
|
||
</div>
|
||
<?php endfor; ?>
|
||
</fieldset>
|
||
<?php endforeach; ?>
|
||
<div class="actions">
|
||
<button type="submit" class="button">Speichern</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($isOwn): ?>
|
||
<?php // Guide bearbeiten - nach einem Fehler geht der Dialog wieder auf (#guide) ?>
|
||
<div class="modal-overlay" id="gear-guide-edit" data-hash="guide" hidden>
|
||
<div class="modal modal-wide">
|
||
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
|
||
<h2>Guide bearbeiten</h2>
|
||
<form method="post" action="/gear_action.php" class="gear-guide-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="save_guide">
|
||
<input type="hidden" name="set_id" value="<?= (int) $set['id'] ?>">
|
||
<div class="gear-form-row">
|
||
<label>Schwierigkeit
|
||
<select name="difficulty">
|
||
<option value="">– keine Angabe –</option>
|
||
<?php foreach (GEAR_GUIDE_DIFFICULTIES as $key => $label): ?>
|
||
<option value="<?= e($key) ?>"<?= $guide['difficulty'] === $key ? ' selected' : '' ?>><?= e($label) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
</label>
|
||
<label>Tags <span class="text-muted">(bis zu <?= GEAR_GUIDE_TAGS_MAX ?>, mit Komma getrennt)</span>
|
||
<input type="text" name="tags" maxlength="<?= GEAR_GUIDE_TAGS_MAX * (GEAR_GUIDE_TAG_LENGTH + 2) ?>" value="<?= e(implode(', ', $guide['tags'])) ?>" placeholder="z.B. PvE, Raid, Gruppenheilung">
|
||
</label>
|
||
</div>
|
||
<?php $hintSkill = $planned ? gear_skill_display_name(reset($planned)['skill']) : ''; ?>
|
||
<p class="field-hint gear-guide-chip-hint">Tipp: <code>[[Skillname]]</code> in Beschreibung, Begründungen, Tasten und Tipps wird zu einem Skill-Chip mit Icon<?= $hintSkill !== '' ? ', z.B. <code>[[' . e($hintSkill) . ']]</code>' : '' ?>.
|
||
Mit Nummer zeigt er eine Spezialisierung bzw. bei Stigmen einen Bonus: <code>[[<?= e($hintSkill !== '' ? $hintSkill : 'Skillname') ?>:1]]</code> für die erste (auch <code>:II</code> usw.).</p>
|
||
<label>Beschreibung <span class="text-muted">(Absätze mit einer Leerzeile)</span>
|
||
<textarea name="description" rows="6" maxlength="<?= GEAR_DESCRIPTION_MAX ?>" placeholder="Wofür ist der Build gedacht, wie spielt er sich, warum diese Skills und Stigmen …"><?= e($description) ?></textarea>
|
||
</label>
|
||
<div class="gear-form-row">
|
||
<label>Stärken <span class="text-muted">(eine pro Zeile, bis zu <?= GEAR_GUIDE_POINTS_MAX ?>)</span>
|
||
<textarea name="strengths" rows="4" placeholder="z.B. Starke Gruppenheilung"><?= e(implode("\n", $guide['strengths'])) ?></textarea>
|
||
</label>
|
||
<label>Schwächen <span class="text-muted">(eine pro Zeile)</span>
|
||
<textarea name="weaknesses" rows="4" placeholder="z.B. Wenig Schaden"><?= e(implode("\n", $guide['weaknesses'])) ?></textarea>
|
||
</label>
|
||
</div>
|
||
<label>Daevanion <span class="text-muted">(optional: welche Bretter zuerst und warum)</span>
|
||
<textarea name="daevanion" rows="3" maxlength="<?= GEAR_GUIDE_DAEVANION_LENGTH ?>" placeholder="z.B. Zuerst Nezekan bis zu den Heil-Knoten, dann …"><?= e($guide['daevanion']) ?></textarea>
|
||
</label>
|
||
<fieldset class="gear-fieldset">
|
||
<legend>Tipps <span class="text-muted">(z.B. „Drei Dinge, die Neulinge falsch machen“ – leere bleiben weg)</span></legend>
|
||
<?php for ($i = 0; $i < GEAR_GUIDE_TIPS_MAX; $i++): ?>
|
||
<?php $tip = $guide['tips'][$i] ?? ['title' => '', 'text' => '']; ?>
|
||
<div class="gear-guide-tip-row">
|
||
<input type="text" name="tips[<?= $i ?>][title]" maxlength="<?= GEAR_GUIDE_TIP_TITLE_LENGTH ?>" value="<?= e($tip['title']) ?>" placeholder="Tipp <?= $i + 1 ?>: Überschrift" aria-label="Tipp <?= $i + 1 ?> Überschrift">
|
||
<textarea name="tips[<?= $i ?>][text]" rows="2" maxlength="<?= GEAR_GUIDE_TIP_TEXT_LENGTH ?>" placeholder="Erklärung" aria-label="Tipp <?= $i + 1 ?> Erklärung"><?= e($tip['text']) ?></textarea>
|
||
</div>
|
||
<?php endfor; ?>
|
||
</fieldset>
|
||
<div class="actions">
|
||
<button type="submit" class="button">Guide speichern</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php
|
||
}
|