Gear planner: set pages Arcana, Pets, Daevanion, Pantheon and Closet modelled on the aion2hub build planner
Data (cards, enchant points, skill pools, sets, pets, genus insight, daevanion boards, pantheon decorations, closet skins, stat names and units) is read from the build planner's JS chunks and recognised by content; one admin import "Planer-Daten übernehmen" (also brings the specializations) plus "Bilder laden". Plans are stored per set and page (gear_set_plans, schema v40), saved instantly, shown in the compare view, copied with the set and transferable from another own set. The skills page shows the skill bonuses from Daevanion and Arcana. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3cc60c7f7e
commit
4ff71fe163
17 changed files with 4005 additions and 134 deletions
71
README.md
71
README.md
|
|
@ -34,7 +34,8 @@ und wird später ausgebaut. Fokus dieser Version ist der Mitglieder-/Admin-Berei
|
||||||
- Lagerhaus: Bestand der Legion mit Einlagerungen (wer hat was wann überreicht) und Entnahmen
|
- Lagerhaus: Bestand der Legion mit Einlagerungen (wer hat was wann überreicht) und Entnahmen
|
||||||
(wann, optional an wen), Gegenstandsliste aus dem Aion-2-Wiki mit rund 2.300 Einträgen
|
(wann, optional an wen), Gegenstandsliste aus dem Aion-2-Wiki mit rund 2.300 Einträgen
|
||||||
- Gear-Planer: Ausrüstungssets mit Werten aus dem Spielclient (über aion2hub), dazu die Skills
|
- Gear-Planer: Ausrüstungssets mit Werten aus dem Spielclient (über aion2hub), dazu die Skills
|
||||||
der Klasse mit geplanter Stufe (aktive, Stigma- und passive Skills), vergleichen und auf der
|
der Klasse mit geplanter Stufe (aktive, Stigma- und passive Skills) sowie Arcana, Pets,
|
||||||
|
Daevanion-Bretter, Pantheon und Closet wie im Build-Planer von aion2hub, vergleichen und auf der
|
||||||
Profilseite zeigen
|
Profilseite zeigen
|
||||||
- Anwesenheitsliste pro Raid (anwesend, abwesend), automatische Lumipunkte beim Archivieren
|
- Anwesenheitsliste pro Raid (anwesend, abwesend), automatische Lumipunkte beim Archivieren
|
||||||
(fest +1 pro Teilnahme) und eine Discord-PN an die Raidleitung, sobald ein Raid beginnt
|
(fest +1 pro Teilnahme) und eine Discord-PN an die Raidleitung, sobald ein Raid beginnt
|
||||||
|
|
@ -685,12 +686,14 @@ Die Tabellen `warehouse_items` und `warehouse_movements` entstehen ebenfalls aut
|
||||||
### Gear-Planer
|
### Gear-Planer
|
||||||
|
|
||||||
Die Seite **Gear-Planer** (`gear.php`) lässt jedes Mitglied Ausrüstungssets zusammenstellen und
|
Die Seite **Gear-Planer** (`gear.php`) lässt jedes Mitglied Ausrüstungssets zusammenstellen und
|
||||||
vergleichen. Jedes Set hat drei Unterseiten (Reiter): **Ausrüstung** (Gegenstand je Slot, Aufwertung,
|
vergleichen. Jedes Set hat acht Unterseiten (Reiter, Reihenfolge wie im Build-Planer von aion2hub):
|
||||||
Durchbruch, Seelenprägung, Manasteine), **Skills** (aktive und passive Skills der Klasse mit Stufe und
|
**Ausrüstung** (Gegenstand je Slot, Aufwertung, Durchbruch, Seelenprägung, Manasteine), **Arcana**,
|
||||||
Spezialisierungen) und **Stigmen** (die ausgerüsteten Stigma-Skills mit Stufe) - `gear.php?set=ID`,
|
**Pets**, **Skills** (aktive und passive Skills der Klasse mit Stufe und Spezialisierungen),
|
||||||
`&tab=skills`, `&tab=stigma`, die Skill-Seiten stehen in `includes/gear_skills_view.php`. Sets lassen
|
**Stigmen** (die ausgerüsteten Stigma-Skills mit Stufe), **Daevanion**, **Pantheon** und **Closet** -
|
||||||
sich kopieren, bis zu vier nebeneinander vergleichen (Werte, Ausrüstung, Skillstufen) und auf der
|
`gear.php?set=ID&tab=…`. Die Skill-Seiten stehen in `includes/gear_skills_view.php`, die fünf
|
||||||
eigenen Profilseite zeigen.
|
Planer-Seiten in `includes/gear_planner_view.php` (siehe unten). Sets lassen sich kopieren (samt aller
|
||||||
|
Seiten), bis zu vier nebeneinander vergleichen (Werte, Ausrüstung, Werte der Planer-Seiten,
|
||||||
|
Skillstufen) und auf der eigenen Profilseite zeigen.
|
||||||
|
|
||||||
- **Gegenstände** kommen von [aion2hub.com](https://aion2hub.com/database) (aus dem
|
- **Gegenstände** kommen von [aion2hub.com](https://aion2hub.com/database) (aus dem
|
||||||
Global-Client ausgelesen). Admins mit `gear.manage` übernehmen sie unter **Gegenstände &
|
Global-Client ausgelesen). Admins mit `gear.manage` übernehmen sie unter **Gegenstände &
|
||||||
|
|
@ -723,26 +726,52 @@ eigenen Profilseite zeigen.
|
||||||
Senken der Stufe fallen zu hohe wieder heraus. Gespeichert als Bitmaske in `gear_set_skills.specs`.
|
Senken der Stufe fallen zu hohe wieder heraus. Gespeichert als Bitmaske in `gear_set_skills.specs`.
|
||||||
Stigma-Skills schalten ihre vier Boni bei Stufe 5/10/15/20 automatisch frei - die Stigmen-Seite zeigt
|
Stigma-Skills schalten ihre vier Boni bei Stufe 5/10/15/20 automatisch frei - die Stigmen-Seite zeigt
|
||||||
sie mit Effekt und die gewählten Stigmen als Plätze wie im Spiel.
|
sie mit Effekt und die gewählten Stigmen als Plätze wie im Spiel.
|
||||||
- **Effekte der Spezialisierungen und Stigma-Boni:** „Spezialisierungen & Stigma-Boni übernehmen“ im
|
- **Effekte der Spezialisierungen und Stigma-Boni** kommen mit den Planer-Daten (nächster Punkt) aus dem
|
||||||
Admin-Bereich holt sie aus dem Build-Planer von aion2hub (Global-Client, englisch). Dort stecken sie
|
Build-Planer von aion2hub (Global-Client, englisch) und landen in `gear_skills.spec_effects`. Stufen,
|
||||||
als Datensatz (`JSON.parse('{"builtAt":…,"slotUnlock":…,"byParent":…}')`) in einer der
|
die von denen des Planers abweichen, meldet der Import. Texte, die dort nur aus den Korea-Daten
|
||||||
JavaScript-Dateien unter `/_next/static/chunks/`; der Import liest die Seite
|
|
||||||
`/tools/build-calculator`, sucht die Datei (eine pro Sekunde, die zuletzt passende zuerst,
|
|
||||||
gemerkt in `settings.gear_planner_chunk`) und speichert die Effekte in `gear_skills.spec_effects`.
|
|
||||||
Ändert aion2hub den Aufbau, meldet der Import einen Fehler, die gespeicherten Effekte bleiben. Stufen,
|
|
||||||
die von denen des Planers abweichen, meldet er ebenfalls. Texte, die dort nur aus den Korea-Daten
|
|
||||||
stammen, sind im Planer gekennzeichnet (Tooltip).
|
stammen, sind im Planer gekennzeichnet (Tooltip).
|
||||||
|
- **Planer-Daten (Arcana, Pets, Daevanion, Pantheon, Closet):** „Planer-Daten übernehmen“ im
|
||||||
|
Admin-Bereich (`#planner`) liest die Seite `/tools/build-calculator` von aion2hub und durchsucht deren
|
||||||
|
JavaScript-Dateien unter `/_next/static/chunks/` (eine pro Sekunde, die zuletzt ergiebigen zuerst,
|
||||||
|
gemerkt in `settings.gear_planner_chunks`; meist reichen drei). Die Datensätze stecken dort als Module
|
||||||
|
(`JSON.parse('…')` oder JavaScript-Objekte) und werden an ihrem Inhalt erkannt, nicht an Namen oder
|
||||||
|
Nummern (`includes/gear_planner_source.php`): Arcana-Karten (aus der Gegenstandsliste), Punkte je
|
||||||
|
Aufwertung, Skill-Pools, Sets, Pets mit Besitz-Effekten, Gattungs-Einsicht, Daevanion-Bretter je
|
||||||
|
Klasse, Pantheon-Dekorationen mit Domänen, Closet-Skins mit Werten je Punkt sowie Namen und Einheiten
|
||||||
|
aller Werte. Gespeichert in `gear_planner_data` (JSON je Datensatz, `daevanion:<Klasse>` je Klasse),
|
||||||
|
was sich nicht geändert hat, bleibt unverändert. „Bilder laden“ holt danach einmalig die Bilder der
|
||||||
|
Karten, Pets und Dekorationen (`assets/uploads/gear/<ID>`), der Closet kommt ohne Bilder aus.
|
||||||
|
- **Die fünf Planer-Seiten** (`includes/gear_planner.php` rechnet, gespeichert je Set und Seite als JSON
|
||||||
|
in `gear_set_plans`, sofort per `assets/js/gear-plans.js` über `gear_action.php` → `save_plan`; ohne
|
||||||
|
JavaScript per Speichern-Knopf). Gerechnet wird wie bei aion2hub: Prozentwerte in Hundertstel-Prozent,
|
||||||
|
Domänenpunkte (z.B. Zeit [Siel]) werden je Punkt in zwei Kampfwerte umgerechnet (Tabelle aus dem
|
||||||
|
Pantheon-Datensatz).
|
||||||
|
- *Arcana:* je Kartenart ein Platz mit Karte, Aufwertung (bis +2/+3/+4/+5 je Seltenheit) und geprägten
|
||||||
|
Skills aus dem Pool der Karte für die Klasse - höchstens so viele wie die Karte Plätze hat, zusammen
|
||||||
|
höchstens Plätze + Aufwertung Stufen, je Skill bis +4. Set-Effekte ab 2 und 4 Teilen (Text von aion2hub).
|
||||||
|
- *Pets:* Stufe 0-3 je Pet (besondere: haben oder nicht, zählen mit 3), Besitz-Effekt je Gattung und
|
||||||
|
Stufe; Gattungs-Einsicht je Gattung Stufe 1-10 mit so vielen Plätzen wie die Stufe öffnet, je Platz
|
||||||
|
Seltenheit (nur die bei der Stufe möglichen) und Wert, gerechnet mit dem besten Wurf.
|
||||||
|
- *Daevanion:* die Bretter der Klasse als Raster; Felder nur vom Startfeld aus waagerecht/senkrecht
|
||||||
|
angrenzend, Entfernen nimmt Unerreichbares mit, die ersten vier Bretter teilen sich 570
|
||||||
|
Daevanion-Kristalle, das Saison-Brett hat eigene. Skillfelder geben je +1 Stufe (über alle vier
|
||||||
|
Bretter +4 je Skill) - die Skills-Seite zeigt diese Boni zusammen mit denen der Arcana an jedem Skill.
|
||||||
|
- *Pantheon:* 1 Koloss, 4 Statuen, 12 Kunstwerke (aus dem Datensatz), nur Dekorationen für alle oder
|
||||||
|
die gewählte Seite (Elyos/Asmodier), Domänenpunkte je Domäne höchstens 200.
|
||||||
|
- *Closet:* Sammelpunkte je Kategorie (Waffe der Klasse, Rüstung, Schmuck; bis 500) aus dem Spiel
|
||||||
|
eintragen oder aus abgehakten Skins schätzen (Gewicht je Seltenheit laut aion2hub), je Punkt +0,1 %.
|
||||||
|
Pets, Pantheon und Closet sind meist in allen Sets gleich - jede Seite lässt sich deshalb aus einem
|
||||||
|
anderen eigenen Set übernehmen (`copy_plan`).
|
||||||
- **Deutsche Namen:** aion2hub liefert Skillnamen und Effekte nur englisch. Unter Gegenstände & Skills →
|
- **Deutsche Namen:** aion2hub liefert Skillnamen und Effekte nur englisch. Unter Gegenstände & Skills →
|
||||||
„Namen & Spezialisierungen“ (`admin/gear_skills.php`) trägt die Leitung pro Klasse die deutschen
|
„Namen & Spezialisierungen“ (`admin/gear_skills.php`) trägt die Leitung pro Klasse die deutschen
|
||||||
Skillnamen und Texte der Spezialisierungen/Boni ein (`gear_skills.name_de`, `gear_skills.spec_names`;
|
Skillnamen und Texte der Spezialisierungen/Boni ein (`gear_skills.name_de`, `gear_skills.spec_names`;
|
||||||
der englische Text steht als Vorlage im Feld). Ein Abgleich mit aion2hub überschreibt sie nicht. Wechselt ein Set die Klasse, bleiben die Stufen der alten Klasse gespeichert
|
der englische Text steht als Vorlage im Feld). Ein Abgleich mit aion2hub überschreibt sie nicht. Wechselt ein Set die Klasse, bleiben die Stufen der alten Klasse gespeichert
|
||||||
und erscheinen beim Zurückwechseln wieder. Die Daevanion-Bretter selbst kennt die Website noch
|
und erscheinen beim Zurückwechseln wieder. Für das, was die Website nicht kennt (z.B. Titel oder
|
||||||
nicht - dafür kann jedes Set einen Link zu einem Plan auf einer Planer-Seite (z.B. aion2hub)
|
Flügel), kann jedes Set einen Link zu einem Build auf einer Planer-Seite (z.B. aion2hub) bekommen.
|
||||||
bekommen.
|
|
||||||
|
|
||||||
Rechte: `gear.view` (eigene Sets planen, freigegebene ansehen) und `gear.manage` (Gegenstände und
|
Rechte: `gear.view` (eigene Sets planen, freigegebene ansehen) und `gear.manage` (Gegenstände,
|
||||||
Skills übernehmen). Die Tabellen `gear_items`, `gear_sets`, `gear_set_slots`, `gear_skills` und
|
Skills und Planer-Daten übernehmen). Die Tabellen `gear_items`, `gear_sets`, `gear_set_slots`,
|
||||||
`gear_set_skills` entstehen automatisch.
|
`gear_skills`, `gear_set_skills`, `gear_planner_data` und `gear_set_plans` entstehen automatisch.
|
||||||
|
|
||||||
### Mitgliederliste
|
### Mitgliederliste
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* Gear-Planer, Katalog: Gegenstaende von aion2hub.com (Global-Client) uebernehmen, einzeln oder
|
* Gear-Planer, Katalog: Gegenstaende von aion2hub.com (Global-Client) uebernehmen, einzeln oder
|
||||||
* alle mit der Quelle abgleichen (z.B. nach einem Patch) und Unterschiede pruefen. Dazu die
|
* alle mit der Quelle abgleichen (z.B. nach einem Patch) und Unterschiede pruefen. Dazu die
|
||||||
* Skill-Listen der Klassen fuer den Skillplaner.
|
* Skill-Listen der Klassen fuer den Skillplaner und die Daten der Seiten Arcana, Pets, Daevanion,
|
||||||
|
* Pantheon und Closet aus dem Build-Planer.
|
||||||
*/
|
*/
|
||||||
require_once __DIR__ . '/../includes/bootstrap.php';
|
require_once __DIR__ . '/../includes/bootstrap.php';
|
||||||
require_once __DIR__ . '/../includes/gear.php';
|
require_once __DIR__ . '/../includes/gear.php';
|
||||||
|
require_once __DIR__ . '/../includes/gear_planner.php';
|
||||||
require_permission('gear.manage');
|
require_permission('gear.manage');
|
||||||
|
|
||||||
$query = mb_substr(trim((string) ($_GET['q'] ?? '')), 0, 100);
|
$query = mb_substr(trim((string) ($_GET['q'] ?? '')), 0, 100);
|
||||||
|
|
@ -102,8 +104,8 @@ include __DIR__ . '/../includes/header.php';
|
||||||
Kernliste aus dem Global-Client, die zusätzlichen Korea/Taiwan-Skills nicht. Aktive Skills nach „Dodge“ sind dort
|
Kernliste aus dem Global-Client, die zusätzlichen Korea/Taiwan-Skills nicht. Aktive Skills nach „Dodge“ sind dort
|
||||||
die Stigma-Skills und werden als solche geführt. Deutsche Namen und die Namen der Spezialisierungen trägst du unter
|
die Stigma-Skills und werden als solche geführt. Deutsche Namen und die Namen der Spezialisierungen trägst du unter
|
||||||
„Namen & Spezialisierungen“ ein (aion2hub hat nur englische). Die Effekte der Spezialisierungen und Stigma-Boni
|
„Namen & Spezialisierungen“ ein (aion2hub hat nur englische). Die Effekte der Spezialisierungen und Stigma-Boni
|
||||||
holt „Spezialisierungen & Stigma-Boni übernehmen“ aus dem Build-Planer von aion2hub (englisch, alle Klassen auf
|
kommen mit den <a href="#planner">Planer-Daten</a> (englisch, alle Klassen auf einmal - vorher die Skills übernehmen).
|
||||||
einmal - vorher die Skills übernehmen). Die Icons werden einmalig mitgeladen
|
Die Icons werden einmalig mitgeladen
|
||||||
(beim ersten Mal etwa 5-10 Minuten für alle Klassen, danach reicht ein kurzer Abgleich).
|
(beim ersten Mal etwa 5-10 Minuten für alle Klassen, danach reicht ein kurzer Abgleich).
|
||||||
</p>
|
</p>
|
||||||
<div class="table-scroll">
|
<div class="table-scroll">
|
||||||
|
|
@ -144,7 +146,6 @@ include __DIR__ . '/../includes/header.php';
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<button type="button" class="button" id="skill-import-start">Skills übernehmen / abgleichen</button>
|
<button type="button" class="button" id="skill-import-start">Skills übernehmen / abgleichen</button>
|
||||||
<button type="button" class="button button-secondary" id="skill-specs-start">Spezialisierungen & Stigma-Boni übernehmen</button>
|
|
||||||
<button type="button" class="button button-secondary" id="skill-import-stop" hidden>Anhalten</button>
|
<button type="button" class="button button-secondary" id="skill-import-stop" hidden>Anhalten</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="gear-import-progress" id="skill-import-progress" hidden>
|
<div class="gear-import-progress" id="skill-import-progress" hidden>
|
||||||
|
|
@ -165,6 +166,60 @@ include __DIR__ . '/../includes/header.php';
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$plannerStatus = gear_planner_data_status();
|
||||||
|
$plannerIcons = gear_planner_icon_ids();
|
||||||
|
$plannerIconsMissing = count(array_filter($plannerIcons, static fn (int $id): bool => gear_planner_icon_url($id) === null));
|
||||||
|
$plannerClasses = gear_planner_data('daevanion')['classes'] ?? [];
|
||||||
|
?>
|
||||||
|
<div class="panel" id="planner">
|
||||||
|
<h2>Planer-Daten: Arcana, Pets, Daevanion, Pantheon, Closet</h2>
|
||||||
|
<p class="text-muted">
|
||||||
|
Diese Seiten der Sets bauen auf dem <a href="<?= e(GEAR_SOURCE_PLANNER_URL) ?>" target="_blank" rel="noopener">Build-Planer von aion2hub</a>
|
||||||
|
auf: Arcana-Karten, Pets, Daevanion-Bretter, Pantheon-Dekorationen und Closet-Skins samt Werten (Global-Client).
|
||||||
|
„Planer-Daten übernehmen“ sucht sie in den Dateien des Planers (eine nach der anderen, meist reichen drei) und bringt
|
||||||
|
die Effekte der Spezialisierungen und Stigma-Boni gleich mit. Die Bilder für Arcana, Pets und Pantheon lädt
|
||||||
|
„Bilder laden“ einmalig (beim ersten Mal etwa 6 Minuten, danach nur neue) - der Closet kommt ohne Bilder aus.
|
||||||
|
</p>
|
||||||
|
<div class="table-scroll">
|
||||||
|
<table class="gear-admin-table">
|
||||||
|
<thead><tr><th>Datensatz</th><th>Seite</th><th>Stand bei aion2hub</th><th>Zuletzt geändert</th><th>Abgeglichen</th><th>Größe</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach (GEAR_PLANNER_PARTS as $partName => [$partLabel, $partSection]): ?>
|
||||||
|
<?php $row = $plannerStatus[$partName] ?? null; ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= e($partLabel) ?><?= $partName === 'daevanion' && $plannerClasses ? ' <span class="text-muted">(' . count($plannerClasses) . ' Klassen)</span>' : '' ?></td>
|
||||||
|
<td><?= e($partSection !== '' ? GEAR_PLAN_SECTIONS[$partSection] : 'alle') ?></td>
|
||||||
|
<?php if ($row): ?>
|
||||||
|
<td><?= $row['built_at'] !== '' ? e($row['built_at']) : '<span class="text-muted">–</span>' ?></td>
|
||||||
|
<td class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $row['updated_at']))) ?></td>
|
||||||
|
<td class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $row['checked_at']))) ?></td>
|
||||||
|
<td class="text-muted"><?= e(number_format(((int) $row['bytes']) / 1024, 0, ',', '.')) ?> KB</td>
|
||||||
|
<?php else: ?>
|
||||||
|
<td colspan="4" class="text-muted">noch nicht übernommen</td>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<p class="text-muted">
|
||||||
|
Bilder: <?= count($plannerIcons) - $plannerIconsMissing ?> von <?= count($plannerIcons) ?> geladen<?= $plannerIconsMissing ? ' – ' . $plannerIconsMissing . ' fehlen noch' : '' ?>.
|
||||||
|
</p>
|
||||||
|
<div class="gear-import" id="planner-import">
|
||||||
|
<div class="gear-import-row">
|
||||||
|
<button type="button" class="button" id="planner-import-start">Planer-Daten übernehmen / abgleichen</button>
|
||||||
|
<button type="button" class="button button-secondary" id="planner-icons-start"<?= $plannerIcons ? '' : ' disabled title="Erst die Planer-Daten übernehmen"' ?>>Bilder laden</button>
|
||||||
|
<button type="button" class="button button-secondary" id="planner-import-stop" hidden>Anhalten</button>
|
||||||
|
</div>
|
||||||
|
<div class="gear-import-progress" id="planner-import-progress" hidden>
|
||||||
|
<div class="gear-progress-bar"><span id="planner-progress-fill"></span></div>
|
||||||
|
<div class="text-muted" id="planner-progress-text"></div>
|
||||||
|
<ol class="gear-import-log" id="planner-import-log"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<form class="list-toolbar" method="get" action="/admin/gear_items.php">
|
<form class="list-toolbar" method="get" action="/admin/gear_items.php">
|
||||||
<div class="audit-search-row">
|
<div class="audit-search-row">
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Gear-Planer, Katalog: Gegenstaende und die Skill-Listen der Klassen von aion2hub uebernehmen
|
* Gear-Planer, Katalog: Gegenstaende, die Skill-Listen der Klassen und die Daten der Seiten Arcana, Pets,
|
||||||
* und abgleichen. Antwortet als JSON (Aufrufe aus assets/js/gear-admin.js), nur "delete" und
|
* Daevanion, Pantheon und Closet (Build-Planer) von aion2hub uebernehmen und abgleichen. Antwortet als JSON
|
||||||
* "skills_prune" leiten zurueck.
|
* (Aufrufe aus assets/js/gear-admin.js), nur "delete" und "skills_prune" leiten zurueck.
|
||||||
*/
|
*/
|
||||||
require_once __DIR__ . '/../includes/bootstrap.php';
|
require_once __DIR__ . '/../includes/bootstrap.php';
|
||||||
require_once __DIR__ . '/../includes/gear.php';
|
require_once __DIR__ . '/../includes/gear.php';
|
||||||
|
require_once __DIR__ . '/../includes/gear_planner.php';
|
||||||
require_permission('gear.manage');
|
require_permission('gear.manage');
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||||
|
|
@ -138,41 +139,66 @@ try {
|
||||||
db()->prepare('UPDATE gear_skills SET icon = ? WHERE id = ?')->execute([$icon, $skill['id']]);
|
db()->prepare('UPDATE gear_skills SET icon = ? WHERE id = ?')->execute([$icon, $skill['id']]);
|
||||||
$respond(['ok' => true, 'icon' => $icon]);
|
$respond(['ok' => true, 'icon' => $icon]);
|
||||||
|
|
||||||
case 'specs_plan':
|
case 'planner_plan':
|
||||||
// Wo stecken die Spezialisierungen? In einer der JavaScript-Dateien des Build-Planers (die zuletzt
|
// Die JavaScript-Dateien des Build-Planers - die, in denen zuletzt Daten steckten, zuerst (die Namen
|
||||||
// passende zuerst - die Namen aendern sich nur mit neuen Versionen der Seite)
|
// aendern sich nur mit neuen Versionen der Seite)
|
||||||
$politePause();
|
$politePause();
|
||||||
$chunks = gear_source_planner_chunks(gear_source_fetch(GEAR_SOURCE_PLANNER_URL));
|
$chunks = gear_source_planner_chunks(gear_source_fetch(GEAR_SOURCE_PLANNER_URL));
|
||||||
$known = setting_get('gear_planner_chunk');
|
|
||||||
if ($known !== '' && in_array($known, $chunks, true)) {
|
|
||||||
$chunks = array_values(array_unique(array_merge([$known], $chunks)));
|
|
||||||
}
|
|
||||||
if (!$chunks) {
|
if (!$chunks) {
|
||||||
$respond(['ok' => false, 'error' => 'Im Build-Planer von aion2hub stehen keine Dateien mehr, in denen die Spezialisierungen stecken könnten - hat sich die Seite geändert?'], 422);
|
$respond(['ok' => false, 'error' => 'Im Build-Planer von aion2hub stehen keine Dateien mehr, in denen die Daten stecken könnten - hat sich die Seite geändert?'], 422);
|
||||||
}
|
}
|
||||||
$respond(['ok' => true, 'chunks' => $chunks]);
|
$known = json_decode(setting_get('gear_planner_chunks'), true);
|
||||||
|
$known = array_values(array_intersect(array_merge(is_array($known) ? $known : [], [setting_get('gear_planner_chunk')]), $chunks));
|
||||||
|
$respond(['ok' => true, 'chunks' => array_values(array_unique(array_merge($known, $chunks))), 'expected' => array_merge(['specs'], array_keys(GEAR_PLANNER_PARTS))]);
|
||||||
|
|
||||||
case 'specs_chunk':
|
case 'planner_chunk':
|
||||||
// Eine Datei des Build-Planers durchsuchen - steckt der Datensatz drin, gleich speichern
|
// Eine Datei des Build-Planers durchsuchen und alles speichern, was darin steckt
|
||||||
$path = (string) ($_POST['path'] ?? '');
|
$path = (string) ($_POST['path'] ?? '');
|
||||||
if (!preg_match('#^/_next/static/chunks/[A-Za-z0-9_~-]+\.js$#', $path)) {
|
if (!preg_match('#^/_next/static/chunks/[A-Za-z0-9_~-]+\.js$#', $path)) {
|
||||||
$respond(['ok' => false, 'error' => 'Ungültige Datei.'], 400);
|
$respond(['ok' => false, 'error' => 'Ungültige Datei.'], 400);
|
||||||
}
|
}
|
||||||
$politePause();
|
$politePause();
|
||||||
$planner = gear_source_parse_planner_specs(gear_source_fetch('https://' . GEAR_SOURCE_HOST . $path, '*/*'));
|
$found = gear_planner_source_extract(gear_source_fetch('https://' . GEAR_SOURCE_HOST . $path, '*/*'));
|
||||||
if ($planner === null) {
|
$stored = [];
|
||||||
$respond(['ok' => true, 'found' => false]);
|
foreach ($found['parts'] as $name => $part) {
|
||||||
|
$stored[$name] = gear_planner_data_store($name, $part['data'], $part['built_at']);
|
||||||
}
|
}
|
||||||
$result = gear_skills_store_specs($planner);
|
$specs = $found['specs'] !== null ? gear_skills_store_specs($found['specs']) : null;
|
||||||
setting_set('gear_planner_chunk', $path);
|
if ($stored || $specs !== null) {
|
||||||
admin_log('🗡️ Gear-Planer: Spezialisierungen von aion2hub', array_filter([
|
$known = json_decode(setting_get('gear_planner_chunks'), true);
|
||||||
'Stand' => $result['built_at'],
|
setting_set('gear_planner_chunks', json_encode(array_values(array_unique(array_merge([$path], is_array($known) ? $known : [])))));
|
||||||
'Aktualisiert' => $result['updated'] ?: null,
|
}
|
||||||
'Unverändert' => $result['same'] ?: null,
|
$respond(['ok' => true, 'found' => array_merge(array_keys($stored), $specs !== null ? ['specs'] : []), 'stored' => $stored, 'specs' => $specs]);
|
||||||
'Ohne Daten' => $result['missing'] ? count($result['missing']) : null,
|
|
||||||
'Hinweis' => $result['warning'] ?: null,
|
case 'planner_done':
|
||||||
], static fn ($value): bool => $value !== null && $value !== ''), 'info', 'gear');
|
// Eine Zusammenfassung pro Durchlauf
|
||||||
$respond(['ok' => true, 'found' => true] + $result);
|
$list = static fn (string $key): string => mb_substr(implode(', ', array_filter(explode(',', (string) ($_POST[$key] ?? '')))), 0, 300);
|
||||||
|
admin_log('🗡️ Gear-Planer: Planer-Daten von aion2hub', array_filter([
|
||||||
|
'Neu' => $list('new') ?: null,
|
||||||
|
'Geändert' => $list('changed') ?: null,
|
||||||
|
'Unverändert' => (int) ($_POST['same'] ?? 0) ?: null,
|
||||||
|
'Spezialisierungen' => mb_substr((string) ($_POST['specs'] ?? ''), 0, 200) ?: null,
|
||||||
|
'Nicht gefunden' => $list('missing') ?: null,
|
||||||
|
], static fn ($value): bool => $value !== null), 'info', 'gear');
|
||||||
|
$respond(['ok' => true]);
|
||||||
|
|
||||||
|
case 'planner_icons':
|
||||||
|
// Bilder fuer Arcana, Pets und Pantheon, die noch fehlen
|
||||||
|
$missing = array_values(array_filter(gear_planner_icon_ids(), static fn (int $id): bool => gear_planner_icon_url($id) === null));
|
||||||
|
$respond(['ok' => true, 'ids' => $missing, 'total' => count(gear_planner_icon_ids())]);
|
||||||
|
|
||||||
|
case 'planner_icon':
|
||||||
|
$id = (int) ($_POST['id'] ?? 0);
|
||||||
|
if (!in_array($id, gear_planner_icon_ids(), true)) {
|
||||||
|
$respond(['ok' => false, 'error' => 'Unbekanntes Bild.'], 400);
|
||||||
|
}
|
||||||
|
if (gear_planner_icon_url($id) === null) {
|
||||||
|
$politePause();
|
||||||
|
if (gear_icon_download($id) === null) {
|
||||||
|
$respond(['ok' => false, 'error' => 'Bild #' . $id . ' ließ sich nicht laden (bei aion2hub fehlt es evtl.) - der nächste Durchlauf versucht es erneut.'], 422);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$respond(['ok' => true]);
|
||||||
|
|
||||||
case 'skills_done':
|
case 'skills_done':
|
||||||
// Eine Zusammenfassung pro Durchlauf
|
// Eine Zusammenfassung pro Durchlauf
|
||||||
|
|
|
||||||
|
|
@ -6031,6 +6031,266 @@ label.gear-part:hover:not(.is-locked) { border-color: rgba(201, 162, 39, 0.6); }
|
||||||
.gear-skill-compare-icon { width: 22px; height: 22px; border-radius: 4px; background: #0e0f14; object-fit: contain; }
|
.gear-skill-compare-icon { width: 22px; height: 22px; border-radius: 4px; background: #0e0f14; object-fit: contain; }
|
||||||
.gear-skill-stigma-tag { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #e0708a; }
|
.gear-skill-stigma-tag { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #e0708a; }
|
||||||
|
|
||||||
|
/* Skills: Boni aus Daevanion und Arcana am Skill, Stufe ueber Skillpunkte + Boni */
|
||||||
|
.gear-skill-plus {
|
||||||
|
position: absolute;
|
||||||
|
left: 1px;
|
||||||
|
top: 1px;
|
||||||
|
padding: 0 0.2rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: rgba(40, 24, 90, 0.9);
|
||||||
|
color: #cdbdff;
|
||||||
|
font-size: 0.6rem;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.35;
|
||||||
|
cursor: help;
|
||||||
|
}
|
||||||
|
.gear-skill.is-short select { border-color: #d9a24a; box-shadow: 0 0 0 1px rgba(217, 162, 74, 0.5); }
|
||||||
|
|
||||||
|
/* ---- Planer-Seiten: Arcana, Pets, Daevanion, Pantheon, Closet (includes/gear_planner_view.php) ---- */
|
||||||
|
.gear-tab-count:empty { display: none; }
|
||||||
|
button.gear-tab, label.gear-tab { font-size: 0.9rem; line-height: 1.25; cursor: pointer; }
|
||||||
|
button.gear-tab { background: var(--bg-panel); color: var(--text); padding: 0.4rem 0.8rem; }
|
||||||
|
button.gear-tab:hover, label.gear-tab:hover { background: var(--bg-panel); color: var(--text); box-shadow: none; }
|
||||||
|
button.gear-tab.is-active, button.gear-tab.is-active:hover, label.gear-tab.is-active { background: rgba(201, 162, 39, 0.14); color: var(--gold); }
|
||||||
|
.gear-plan [hidden] { display: none !important; }
|
||||||
|
.gear-plan-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 1rem 1.5rem; align-items: start; margin-top: 0.9rem; }
|
||||||
|
.gear-plan-main { min-width: 0; }
|
||||||
|
.gear-plan-summary {
|
||||||
|
position: sticky;
|
||||||
|
top: 1rem;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.2rem 1rem 1rem;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.025);
|
||||||
|
}
|
||||||
|
.gear-plan-summary .gear-skills-kind:first-child { margin-top: 0.8rem; }
|
||||||
|
.gear-plan-empty { margin: 0.2rem 0; font-size: 0.85rem; }
|
||||||
|
.gear-plan-stats { display: flex; flex-direction: column; margin: 0; font-size: 0.88rem; }
|
||||||
|
.gear-plan-stats > div { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.22rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
|
||||||
|
.gear-plan-stats dt { color: var(--text-muted); min-width: 0; }
|
||||||
|
.gear-plan-stats dt[title] { cursor: help; }
|
||||||
|
.gear-plan-stats dd { margin: 0; flex-shrink: 0; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
|
||||||
|
.gear-plan-stats dd.is-minus { color: #7ddc8a; }
|
||||||
|
.gear-plan-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--grade, var(--border)) 55%, transparent);
|
||||||
|
border-radius: 7px;
|
||||||
|
background: linear-gradient(180deg, color-mix(in srgb, var(--grade, #888) 10%, #121418), color-mix(in srgb, var(--grade, #888) 30%, #121418));
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.gear-plan-icon img { width: 86%; height: 86%; object-fit: contain; }
|
||||||
|
.gear-plan-icon.is-empty { font-weight: 700; color: var(--grade, var(--text-muted)); }
|
||||||
|
.gear-plan-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.25rem;
|
||||||
|
padding: 0.1rem 0.45rem;
|
||||||
|
border-radius: 5px;
|
||||||
|
background: rgba(255, 255, 255, 0.07);
|
||||||
|
font-size: 0.74rem;
|
||||||
|
color: var(--text);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.gear-plan-chip strong { color: var(--gold); }
|
||||||
|
.gear-plan-chip-set { background: rgba(92, 193, 107, 0.12); color: #9fdca8; }
|
||||||
|
.gear-plan-badge { margin-left: 0.3rem; padding: 0 0.35rem; border-radius: 4px; background: rgba(255, 255, 255, 0.08); font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
|
||||||
|
.gear-plan-badge.is-set { background: rgba(76, 175, 80, 0.18); color: #7ddc8a; }
|
||||||
|
.gear-plan-skill-bonus { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
|
||||||
|
.gear-plan-skill-bonus li { display: flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
|
||||||
|
.gear-plan-skill-bonus img { width: 22px; height: 22px; border-radius: 4px; background: #0e0f14; object-fit: contain; }
|
||||||
|
.gear-plan-skill-bonus span { flex: 1; min-width: 0; }
|
||||||
|
.gear-plan-skill-bonus strong { color: #cdbdff; font-variant-numeric: tabular-nums; }
|
||||||
|
.gear-plan-skill-dot { flex: 0 0 22px !important; height: 22px; border-radius: 4px; background: rgba(150, 120, 255, 0.2); }
|
||||||
|
.gear-plan-filter { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0; }
|
||||||
|
.gear-plan-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 0.75rem; }
|
||||||
|
.gear-plan-tools input[type="search"] { flex: 1 1 220px; width: auto; min-width: 0; padding: 0.45rem 0.7rem; font-size: 0.92rem; }
|
||||||
|
.gear-plan-tools select { width: auto; padding: 0.45rem 0.7rem; font-size: 0.92rem; }
|
||||||
|
.gear-plan-tools .checkbox-label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 400; font-size: 0.88rem; }
|
||||||
|
.gear-plan-toggle { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.2rem 0 0.4rem; }
|
||||||
|
.gear-plan-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
|
||||||
|
.gear-plan-toggle label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 1px; }
|
||||||
|
.gear-plan-copy { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1.25rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
|
||||||
|
.gear-plan-copy select { width: auto; max-width: 100%; padding: 0.4rem 0.6rem; font-size: 0.9rem; }
|
||||||
|
|
||||||
|
/* Arcana: je Kartenart ein Platz mit Karte, Aufwertung, Domaenenpunkten und gepraegten Skills */
|
||||||
|
.gear-arcana-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 0.6rem; align-items: start; }
|
||||||
|
.gear-arcana-slot { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.6rem 0.7rem; border: 1px dashed var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); min-width: 0; }
|
||||||
|
.gear-arcana-slot.is-filled { border-style: solid; border-color: color-mix(in srgb, var(--grade) 45%, transparent); background: color-mix(in srgb, var(--grade) 6%, transparent); }
|
||||||
|
.gear-arcana-head { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
|
||||||
|
.gear-arcana-title { display: flex; flex-direction: column; min-width: 0; font-size: 0.85rem; }
|
||||||
|
.gear-arcana-title strong { font-size: 0.95rem; overflow-wrap: anywhere; }
|
||||||
|
.gear-arcana-title .text-muted { font-size: 0.76rem; }
|
||||||
|
.gear-arcana-type { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
|
||||||
|
.gear-arcana-pick { display: flex; gap: 0.4rem; }
|
||||||
|
.gear-arcana-pick select { padding: 0.35rem 0.5rem; font-size: 0.88rem; }
|
||||||
|
.gear-arcana-pick select[data-arcana-enchant] { width: 4.3rem; flex-shrink: 0; }
|
||||||
|
.gear-arcana-points { display: flex; flex-wrap: wrap; gap: 0.3rem; }
|
||||||
|
.gear-arcana-skills { padding-top: 0.4rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
|
||||||
|
.gear-arcana-skills-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.25rem; }
|
||||||
|
.gear-arcana-skills.is-over [data-arcana-used] { color: #f08a86; }
|
||||||
|
.gear-arcana-skill-row { display: grid; grid-template-columns: minmax(0, 1fr) 4.3rem; gap: 0.35rem; margin-top: 0.3rem; }
|
||||||
|
.gear-arcana-skill-row select { padding: 0.3rem 0.45rem; font-size: 0.85rem; }
|
||||||
|
.gear-arcana-skill-row select:disabled { opacity: 0.45; }
|
||||||
|
.gear-arcana-skills .gear-plan-skill-bonus { margin-top: 0.2rem; }
|
||||||
|
.gear-arcana-set-bonus { margin: 0.3rem 0 0.6rem; font-size: 0.86rem; }
|
||||||
|
.gear-arcana-set-bonus ul { list-style: none; margin: 0.25rem 0 0; padding: 0; }
|
||||||
|
.gear-arcana-set-bonus li { display: flex; gap: 0.45rem; align-items: flex-start; padding: 0.15rem 0; color: var(--text-muted); font-size: 0.82rem; }
|
||||||
|
.gear-arcana-set-bonus li span { flex-shrink: 0; min-width: 1.4rem; padding: 0 0.25rem; border-radius: 4px; background: rgba(255, 255, 255, 0.08); text-align: center; font-weight: 700; font-size: 0.72rem; line-height: 1.5; }
|
||||||
|
.gear-arcana-set-bonus li.is-on { color: var(--text); }
|
||||||
|
.gear-arcana-set-bonus li.is-on span { background: var(--gold); color: #1a1a1a; }
|
||||||
|
|
||||||
|
/* Pets: Sammlung mit Stufe je Pet, Gattungs-Einsicht je Gattung */
|
||||||
|
.gear-pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(235px, 100%), 1fr)); gap: 0.45rem; }
|
||||||
|
.gear-pet { display: flex; align-items: center; gap: 0.55rem; min-width: 0; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); }
|
||||||
|
.gear-pet.is-on { border-color: rgba(201, 162, 39, 0.45); background: rgba(201, 162, 39, 0.07); }
|
||||||
|
.gear-pet:not(.is-on) .gear-plan-icon img { filter: grayscale(0.7) brightness(0.7); }
|
||||||
|
.gear-pet-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
|
||||||
|
.gear-pet-name { font-size: 0.88rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
|
||||||
|
.gear-pet:not(.is-on) .gear-pet-name { color: var(--text-muted); font-weight: 500; }
|
||||||
|
.gear-pet-family { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
|
||||||
|
.gear-pet select { flex-shrink: 0; width: 4.6rem; padding: 0.25rem 0.4rem; font-size: 0.88rem; }
|
||||||
|
.gear-pet-toggle { display: inline-flex; align-items: center; gap: 0.3rem; flex-shrink: 0; font-size: 0.8rem; font-weight: 500; cursor: pointer; }
|
||||||
|
.gear-pet-toggle input { width: 16px; height: 16px; accent-color: var(--gold); }
|
||||||
|
.gear-pet-level { flex-shrink: 0; font-size: 0.82rem; color: var(--gold); font-weight: 600; }
|
||||||
|
.gear-insight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 0.6rem; align-items: start; }
|
||||||
|
.gear-insight { display: flex; flex-direction: column; gap: 0.35rem; }
|
||||||
|
.gear-insight-level { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.88rem; }
|
||||||
|
.gear-insight-level label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
|
||||||
|
.gear-insight-level select { width: 4.3rem; padding: 0.25rem 0.4rem; }
|
||||||
|
.gear-insight-slot { padding: 0.35rem 0.5rem; font-size: 0.85rem; }
|
||||||
|
.gear-insight-pick { font-size: 0.86rem; }
|
||||||
|
|
||||||
|
/* Daevanion: Bretter als Raster wie im Spiel - Start in der Mitte, Linien zwischen aktiven Nachbarn */
|
||||||
|
.gear-dv-budgets { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.8rem 0 0.2rem; font-size: 0.88rem; color: var(--text-muted); }
|
||||||
|
.gear-dv-budget strong { color: var(--gold); font-variant-numeric: tabular-nums; }
|
||||||
|
.gear-dv-tabs { margin: 0.6rem 0 0.4rem; }
|
||||||
|
.gear-dv-board { margin-top: 0.8rem; }
|
||||||
|
.gear-dv-board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; }
|
||||||
|
.gear-dv-board-head h4 { margin: 0; font-size: 1rem; }
|
||||||
|
.gear-dv-board-head h4 .text-muted { font-size: 0.82rem; font-weight: 400; }
|
||||||
|
.gear-dv-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
|
||||||
|
.gear-dv-layout { display: grid; grid-template-columns: auto minmax(200px, 1fr); gap: 1rem 1.5rem; align-items: start; margin-top: 0.6rem; }
|
||||||
|
.gear-dv-scroll { max-width: 100%; overflow-x: auto; }
|
||||||
|
.gear-dv-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(var(--cols), minmax(0, 34px));
|
||||||
|
width: min(100%, calc(var(--cols) * 34px));
|
||||||
|
min-width: calc(var(--cols) * 21px);
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: radial-gradient(circle at 50% 50%, rgba(201, 162, 39, 0.09), rgba(0, 0, 0, 0.25) 70%);
|
||||||
|
}
|
||||||
|
.gear-dv-node { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; margin: 0; font-weight: 400; }
|
||||||
|
label.gear-dv-node { cursor: pointer; }
|
||||||
|
.gear-dv-node input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
|
||||||
|
.gear-dv-node:has(input:disabled) { cursor: default; }
|
||||||
|
.gear-dv-node:has(input:focus-visible) .gear-dv-cell { outline: 2px solid var(--gold); outline-offset: 1px; }
|
||||||
|
.gear-dv-cell {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 78%;
|
||||||
|
height: 78%;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--grade) 30%, #2c3142);
|
||||||
|
border-radius: 5px;
|
||||||
|
background: rgba(8, 10, 18, 0.72);
|
||||||
|
color: var(--gold);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
|
||||||
|
}
|
||||||
|
.gear-dv-node.is-on .gear-dv-cell { border-color: var(--grade); background: color-mix(in srgb, var(--grade) 28%, #10131c); box-shadow: 0 0 7px color-mix(in srgb, var(--grade) 55%, transparent); }
|
||||||
|
.gear-dv-node.is-open .gear-dv-cell { box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.7); }
|
||||||
|
label.gear-dv-node.is-open:hover .gear-dv-cell, label.gear-dv-node.is-on:hover .gear-dv-cell { border-color: var(--gold); }
|
||||||
|
.gear-dv-cell img { width: 90%; height: 90%; object-fit: contain; border-radius: 3px; }
|
||||||
|
.gear-dv-node:not(.is-on) .gear-dv-cell img { filter: grayscale(0.9) brightness(0.55); }
|
||||||
|
.gear-dv-dot, .gear-dv-skill-dot { display: block; width: 30%; height: 30%; border-radius: 50%; background: var(--grade); opacity: 0.4; }
|
||||||
|
.gear-dv-skill-dot { border-radius: 2px; }
|
||||||
|
.gear-dv-node.is-on .gear-dv-dot, .gear-dv-node.is-on .gear-dv-skill-dot { opacity: 1; box-shadow: 0 0 4px var(--grade); }
|
||||||
|
.gear-dv-node.grade-common .gear-dv-dot { width: 24%; height: 24%; }
|
||||||
|
.gear-dv-node.is-start .gear-dv-cell { font-size: 0.85rem; }
|
||||||
|
.gear-dv-node.link-r::after, .gear-dv-node.link-d::before { content: ''; position: absolute; background: rgba(227, 189, 110, 0.55); z-index: 0; }
|
||||||
|
.gear-dv-node.link-r::after { left: 50%; top: calc(50% - 1px); width: 100%; height: 2px; }
|
||||||
|
.gear-dv-node.link-d::before { top: 50%; left: calc(50% - 1px); width: 2px; height: 100%; }
|
||||||
|
.gear-dv-side { font-size: 0.88rem; min-width: 0; }
|
||||||
|
.gear-dv-count { margin: 0 0 0.4rem; color: var(--text-muted); }
|
||||||
|
.gear-dv-count strong { color: var(--gold); }
|
||||||
|
.gear-dv-side .gear-plan-skill-bonus { margin-top: 0.6rem; }
|
||||||
|
.gear-dv-summary { position: static; margin-top: 1.1rem; }
|
||||||
|
|
||||||
|
/* Pantheon: Domaenen mit Balken, Dekorationen zum Aufstellen */
|
||||||
|
.gear-pantheon-domains { display: flex; flex-direction: column; gap: 0.35rem; }
|
||||||
|
.gear-pantheon-domain { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 0.5rem; font-size: 0.82rem; }
|
||||||
|
.gear-pantheon-domain.is-empty { opacity: 0.45; }
|
||||||
|
.gear-pantheon-domain-name { color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.gear-pantheon-domain-value { font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
|
||||||
|
.gear-pantheon-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
|
||||||
|
.gear-pantheon-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #a07d1c, #e6c15a); }
|
||||||
|
.gear-deco-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 0.45rem; }
|
||||||
|
.gear-deco { position: relative; display: flex; align-items: flex-start; gap: 0.55rem; min-width: 0; margin: 0; padding: 0.45rem 0.55rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); font-weight: 400; }
|
||||||
|
label.gear-deco { cursor: pointer; }
|
||||||
|
label.gear-deco:hover { border-color: rgba(201, 162, 39, 0.6); }
|
||||||
|
.gear-deco input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
|
||||||
|
.gear-deco:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 1px; }
|
||||||
|
.gear-deco.is-on { border-color: var(--gold); background: rgba(201, 162, 39, 0.1); }
|
||||||
|
.gear-deco.is-full { opacity: 0.45; cursor: not-allowed; }
|
||||||
|
.gear-deco-info { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
|
||||||
|
.gear-deco-name { font-size: 0.86rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
|
||||||
|
.gear-deco-meta { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
|
||||||
|
.gear-deco-domains { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.1rem; }
|
||||||
|
.gear-deco-check { flex-shrink: 0; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; color: transparent; }
|
||||||
|
.gear-deco-check svg { width: 13px; height: 13px; }
|
||||||
|
.gear-deco.is-on .gear-deco-check { border-color: var(--gold); background: var(--gold); color: #1a1a1a; }
|
||||||
|
|
||||||
|
/* Closet: Sammelpunkte je Kategorie, Skins zum Abhaken */
|
||||||
|
.gear-closet-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
|
||||||
|
.gear-closet-table th, .gear-closet-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
|
||||||
|
.gear-closet-table thead th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||||
|
.gear-closet-table tbody th { font-weight: 600; white-space: nowrap; }
|
||||||
|
.gear-closet-table tr:not(.is-on) tbody th, .gear-closet-table tbody tr:not(.is-on) th { color: var(--text-muted); }
|
||||||
|
.gear-closet-points-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
|
||||||
|
.gear-closet-points-cell strong { color: var(--gold); }
|
||||||
|
.gear-closet-stat { color: var(--text-muted); font-size: 0.85rem; }
|
||||||
|
.gear-closet-table tr.is-on .gear-closet-stat { color: var(--text); }
|
||||||
|
.gear-closet-table input { width: 6rem; padding: 0.3rem 0.45rem; font-size: 0.9rem; }
|
||||||
|
.gear-skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 0.35rem; }
|
||||||
|
.gear-skin { position: relative; display: grid; grid-template-columns: 4px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 0.55rem; margin: 0; padding: 0.35rem 0.55rem 0.35rem 0.4rem; border: 1px solid var(--border); border-radius: 7px; background: rgba(255, 255, 255, 0.02); font-weight: 400; cursor: pointer; }
|
||||||
|
.gear-skin:hover { border-color: rgba(201, 162, 39, 0.6); }
|
||||||
|
.gear-skin input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
|
||||||
|
.gear-skin:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 1px; }
|
||||||
|
.gear-skin.is-on { border-color: var(--gold); background: rgba(201, 162, 39, 0.1); }
|
||||||
|
.gear-skin-grade { grid-row: 1 / 3; border-radius: 2px; background: var(--grade); opacity: 0.35; }
|
||||||
|
.gear-skin.is-on .gear-skin-grade { opacity: 1; }
|
||||||
|
.gear-skin-name { font-size: 0.86rem; line-height: 1.25; overflow-wrap: anywhere; }
|
||||||
|
.gear-skin:not(.is-on) .gear-skin-name { color: var(--text-muted); }
|
||||||
|
.gear-skin-meta { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
|
||||||
|
span.gear-skin-meta { color: color-mix(in srgb, var(--grade) 80%, #999); }
|
||||||
|
|
||||||
|
@media (max-width: 1100px) {
|
||||||
|
.gear-plan-layout { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.gear-plan-summary { position: static; }
|
||||||
|
}
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.gear-dv-layout { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.gear-plan-filter .gear-tab { padding: 0.3rem 0.6rem; font-size: 0.84rem; }
|
||||||
|
/* Closet-Tabelle: je Kategorie zwei Zeilen (Name und Punkte links, Eingabe rechts), darunter der Wert */
|
||||||
|
.gear-closet-table thead { display: none; }
|
||||||
|
.table-scroll .gear-closet-table { min-width: 0; }
|
||||||
|
.gear-closet-table, .gear-closet-table tbody { display: block; }
|
||||||
|
.gear-closet-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
|
||||||
|
.gear-closet-table th, .gear-closet-table td { display: block; padding: 0; border: 0; }
|
||||||
|
.gear-closet-table tbody th { grid-column: 1; grid-row: 1; }
|
||||||
|
.gear-closet-points-cell { grid-column: 1; grid-row: 2; }
|
||||||
|
.gear-closet-table td:has(input) { grid-column: 2; grid-row: 1 / 3; align-self: center; }
|
||||||
|
.gear-closet-stat { grid-column: 1 / -1; grid-row: 3; }
|
||||||
|
}
|
||||||
|
|
||||||
/* Admin: Katalog */
|
/* Admin: Katalog */
|
||||||
.gear-import { margin-top: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.025); }
|
.gear-import { margin-top: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.025); }
|
||||||
.gear-import h2 { margin: 0 0 0.3rem; font-size: 1.1rem; }
|
.gear-import h2 { margin: 0 0 0.3rem; font-size: 1.1rem; }
|
||||||
|
|
|
||||||
|
|
@ -341,57 +341,131 @@
|
||||||
runSkills(classes);
|
runSkills(classes);
|
||||||
});
|
});
|
||||||
skillStop.addEventListener('click', function () { skillStopRequested = true; });
|
skillStop.addEventListener('click', function () { skillStopRequested = true; });
|
||||||
|
}
|
||||||
|
|
||||||
// Spezialisierungen und Stigma-Boni: im Build-Planer von aion2hub die Datei mit dem Datensatz suchen
|
// ---- Planer-Daten (Arcana, Pets, Daevanion, Pantheon, Closet, Spezialisierungen): die Dateien des
|
||||||
// (eine nach der anderen, der Server wartet zwischen zwei Abrufen) und alles auf einmal speichern
|
// Build-Planers nacheinander durchsuchen, bis alles gefunden ist; danach fehlende Bilder laden ----
|
||||||
var specsStart = document.getElementById('skill-specs-start');
|
var plannerRoot = document.getElementById('planner-import');
|
||||||
if (specsStart) {
|
if (plannerRoot) {
|
||||||
specsStart.addEventListener('click', async function () {
|
var plannerStart = document.getElementById('planner-import-start');
|
||||||
skillStopRequested = false;
|
var iconsStart = document.getElementById('planner-icons-start');
|
||||||
specsStart.disabled = true;
|
var plannerStop = document.getElementById('planner-import-stop');
|
||||||
skillStart.disabled = true;
|
var plannerProgress = document.getElementById('planner-import-progress');
|
||||||
skillStop.hidden = false;
|
var plannerFill = document.getElementById('planner-progress-fill');
|
||||||
skillProgress.hidden = false;
|
var plannerText = document.getElementById('planner-progress-text');
|
||||||
skillLog.innerHTML = '';
|
var plannerLog = document.getElementById('planner-import-log');
|
||||||
skillFill.style.width = '0%';
|
var plannerStopRequested = false;
|
||||||
skillText.textContent = 'Build-Planer von aion2hub wird gelesen …';
|
|
||||||
var plan = await post({ action: 'specs_plan' });
|
var plannerLogLine = function (text, kind, details) {
|
||||||
var found = null;
|
var li = document.createElement('li');
|
||||||
if (!plan.ok) {
|
li.className = 'gear-log-' + kind;
|
||||||
skillLogLine(plan.error, 'error');
|
li.textContent = text;
|
||||||
} else {
|
if (details && details.length) {
|
||||||
for (var i = 0; i < plan.chunks.length && !skillStopRequested; i++) {
|
var list = document.createElement('ul');
|
||||||
skillText.textContent = 'Spezialisierungen werden gesucht … Datei ' + (i + 1) + ' von ' + plan.chunks.length;
|
details.forEach(function (detail) {
|
||||||
skillFill.style.width = Math.round((i + 1) / plan.chunks.length * 100) + '%';
|
var item = document.createElement('li');
|
||||||
var result = await post({ action: 'specs_chunk', path: plan.chunks[i] });
|
item.textContent = detail;
|
||||||
if (!result.ok) {
|
list.appendChild(item);
|
||||||
skillLogLine(result.error, 'error');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (result.found) {
|
|
||||||
found = result;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
var details = [];
|
|
||||||
if (found.missing.length) details.push('Ohne Daten bei aion2hub: ' + found.missing.join(', '));
|
|
||||||
if (found.kr) details.push(found.kr + ' Texte stammen dort aus den Korea-Daten (im Planer markiert).');
|
|
||||||
if (found.warning) details.push(found.warning);
|
|
||||||
skillLogLine('Spezialisierungen & Stigma-Boni (Stand ' + found.built_at + '): ' + found.updated + ' Skills aktualisiert, '
|
|
||||||
+ found.same + ' unverändert.', found.missing.length || found.warning ? 'changed' : 'new', details);
|
|
||||||
skillLogLine('Seite neu laden, um die Übersicht zu aktualisieren.', 'info');
|
|
||||||
} else if (plan.ok && !skillStopRequested) {
|
|
||||||
skillLogLine('Im Build-Planer keine Spezialisierungen gefunden - hat sich die Seite von aion2hub geändert?', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
skillFill.style.width = '100%';
|
|
||||||
skillText.textContent = skillStopRequested ? 'Angehalten' : (found ? 'Fertig' : 'Nicht gefunden');
|
|
||||||
specsStart.disabled = false;
|
|
||||||
skillStart.disabled = false;
|
|
||||||
skillStop.hidden = true;
|
|
||||||
});
|
});
|
||||||
|
li.appendChild(list);
|
||||||
}
|
}
|
||||||
|
plannerLog.insertBefore(li, plannerLog.firstChild);
|
||||||
|
};
|
||||||
|
var plannerBusy = function (busy) {
|
||||||
|
plannerStart.disabled = busy;
|
||||||
|
iconsStart.disabled = busy;
|
||||||
|
plannerStop.hidden = !busy;
|
||||||
|
if (busy) {
|
||||||
|
plannerStopRequested = false;
|
||||||
|
plannerProgress.hidden = false;
|
||||||
|
plannerLog.innerHTML = '';
|
||||||
|
plannerFill.style.width = '0%';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
plannerStart.addEventListener('click', async function () {
|
||||||
|
plannerBusy(true);
|
||||||
|
plannerText.textContent = 'Build-Planer von aion2hub wird gelesen …';
|
||||||
|
var plan = await post({ action: 'planner_plan' });
|
||||||
|
var found = {};
|
||||||
|
var status = { 'new': [], changed: [], same: 0 };
|
||||||
|
var specsText = '';
|
||||||
|
if (!plan.ok) {
|
||||||
|
plannerLogLine(plan.error, 'error');
|
||||||
|
} else {
|
||||||
|
var missing = function () {
|
||||||
|
return plan.expected.filter(function (name) { return !found[name]; });
|
||||||
|
};
|
||||||
|
for (var i = 0; i < plan.chunks.length && !plannerStopRequested && missing().length; i++) {
|
||||||
|
plannerText.textContent = 'Daten werden gesucht … Datei ' + (i + 1) + ' von ' + plan.chunks.length + ' (noch ' + missing().length + ' Datensätze)';
|
||||||
|
plannerFill.style.width = Math.round((i + 1) / plan.chunks.length * 100) + '%';
|
||||||
|
var result = await post({ action: 'planner_chunk', path: plan.chunks[i] });
|
||||||
|
if (!result.ok) {
|
||||||
|
plannerLogLine(result.error, 'error');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
result.found.forEach(function (name) { found[name] = true; });
|
||||||
|
Object.keys(result.stored).forEach(function (name) {
|
||||||
|
if (result.stored[name] === 'same') status.same++;
|
||||||
|
else status[result.stored[name]].push(name);
|
||||||
|
});
|
||||||
|
if (result.specs) {
|
||||||
|
var specs = result.specs;
|
||||||
|
var details = [];
|
||||||
|
if (specs.missing.length) details.push('Ohne Daten bei aion2hub: ' + specs.missing.join(', '));
|
||||||
|
if (specs.kr) details.push(specs.kr + ' Texte stammen dort aus den Korea-Daten (im Planer markiert).');
|
||||||
|
if (specs.warning) details.push(specs.warning);
|
||||||
|
specsText = specs.updated + ' aktualisiert, ' + specs.same + ' unverändert';
|
||||||
|
plannerLogLine('Spezialisierungen & Stigma-Boni (Stand ' + specs.built_at + '): ' + specsText + '.',
|
||||||
|
specs.missing.length || specs.warning ? 'changed' : 'new', details);
|
||||||
|
}
|
||||||
|
if (result.found.length) {
|
||||||
|
plannerLogLine(plan.chunks[i].split('/').pop() + ': ' + result.found.filter(function (name) { return name.indexOf(':') === -1; }).join(', '), 'info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var left = missing();
|
||||||
|
if (!plannerStopRequested) {
|
||||||
|
plannerLogLine('Neu: ' + (status['new'].length ? status['new'].join(', ') : '–') + ' · geändert: '
|
||||||
|
+ (status.changed.length ? status.changed.join(', ') : '–') + ' · unverändert: ' + status.same,
|
||||||
|
left.length ? 'changed' : 'new', left.length ? ['Nicht gefunden: ' + left.join(', ') + ' – hat sich der Planer von aion2hub geändert?'] : []);
|
||||||
|
await post({ action: 'planner_done', 'new': status['new'].join(','), changed: status.changed.join(','), same: status.same, specs: specsText, missing: left.join(',') });
|
||||||
|
plannerLogLine('Seite neu laden, um die Übersicht zu aktualisieren. Danach „Bilder laden“, falls Bilder fehlen.', 'info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plannerFill.style.width = '100%';
|
||||||
|
plannerText.textContent = plannerStopRequested ? 'Angehalten' : 'Fertig';
|
||||||
|
plannerBusy(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
iconsStart.addEventListener('click', async function () {
|
||||||
|
plannerBusy(true);
|
||||||
|
plannerText.textContent = 'Fehlende Bilder werden gesucht …';
|
||||||
|
var list = await post({ action: 'planner_icons' });
|
||||||
|
if (!list.ok) {
|
||||||
|
plannerLogLine(list.error, 'error');
|
||||||
|
} else if (!list.ids.length) {
|
||||||
|
plannerLogLine('Alle ' + list.total + ' Bilder sind schon da.', 'new');
|
||||||
|
} else {
|
||||||
|
var loaded = 0;
|
||||||
|
var failed = 0;
|
||||||
|
for (var i = 0; i < list.ids.length && !plannerStopRequested; i++) {
|
||||||
|
plannerText.textContent = 'Bild ' + (i + 1) + ' von ' + list.ids.length + ' …';
|
||||||
|
plannerFill.style.width = Math.round((i + 1) / list.ids.length * 100) + '%';
|
||||||
|
var result = await post({ action: 'planner_icon', id: list.ids[i] });
|
||||||
|
if (result.ok) {
|
||||||
|
loaded++;
|
||||||
|
} else {
|
||||||
|
failed++;
|
||||||
|
if (failed <= 10) plannerLogLine(result.error, 'error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plannerLogLine(loaded + ' Bilder geladen' + (failed ? ', ' + failed + ' fehlgeschlagen' : '') + '.', failed ? 'changed' : 'new');
|
||||||
|
}
|
||||||
|
plannerFill.style.width = '100%';
|
||||||
|
plannerText.textContent = plannerStopRequested ? 'Angehalten' : 'Fertig';
|
||||||
|
plannerBusy(false);
|
||||||
|
});
|
||||||
|
plannerStop.addEventListener('click', function () { plannerStopRequested = true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Einzelnen Gegenstand abgleichen: Unterschiede im Dialog, dann uebernehmen ----
|
// ---- Einzelnen Gegenstand abgleichen: Unterschiede im Dialog, dann uebernehmen ----
|
||||||
|
|
|
||||||
432
assets/js/gear-plans.js
Normal file
432
assets/js/gear-plans.js
Normal file
|
|
@ -0,0 +1,432 @@
|
||||||
|
/**
|
||||||
|
* Gear-Planer: die Seiten Arcana, Pets, Daevanion, Pantheon und Closet eines Sets (includes/gear_planner_view.php).
|
||||||
|
* Jede Aenderung speichert sofort (gear_action.php, save_plan); der Server prueft den Plan und schickt ihn samt
|
||||||
|
* neu berechneter Kaesten (data-plan-fragment) zurueck. Dazu Filter und Suche in den Listen, die Regeln der
|
||||||
|
* Daevanion-Bretter (vom Start aus angrenzend, Kristalle) und die Plaetze im Pantheon.
|
||||||
|
*/
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
if (!window.fetch || !window.FormData) return;
|
||||||
|
|
||||||
|
var statusEl = document.querySelector('[data-plan-status]');
|
||||||
|
var setStatus = function (text, kind) {
|
||||||
|
if (!statusEl) return;
|
||||||
|
statusEl.textContent = text;
|
||||||
|
statusEl.className = 'gear-save-status' + (kind ? ' is-' + kind : '');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Hinweis vom Speichern vor dem Neuladen (z.B. "Dekoration nur fuer die andere Seite") nach dem Laden zeigen
|
||||||
|
var noteKey = 'gear-plan-note';
|
||||||
|
try {
|
||||||
|
var note = window.sessionStorage.getItem(noteKey);
|
||||||
|
if (note) {
|
||||||
|
window.sessionStorage.removeItem(noteKey);
|
||||||
|
setStatus(note, 'error');
|
||||||
|
}
|
||||||
|
} catch (e) { /* ohne Speicher kein Hinweis */ }
|
||||||
|
|
||||||
|
var applyFragments = function (fragments) {
|
||||||
|
Object.keys(fragments || {}).forEach(function (key) {
|
||||||
|
document.querySelectorAll('[data-plan-fragment="' + key + '"]').forEach(function (el) { el.innerHTML = fragments[key]; });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---- Speichern: ein Formular, eine Anfrage nach der anderen ----
|
||||||
|
var setupForm = function (form, onState) {
|
||||||
|
var saving = false;
|
||||||
|
var again = null;
|
||||||
|
var timer = null;
|
||||||
|
form.querySelectorAll('[data-autosave-fallback]').forEach(function (button) { button.hidden = true; });
|
||||||
|
|
||||||
|
var save = function (extra, reload) {
|
||||||
|
clearTimeout(timer);
|
||||||
|
if (saving) {
|
||||||
|
again = { extra: extra, reload: reload };
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
saving = true;
|
||||||
|
setStatus('Speichert …', 'busy');
|
||||||
|
var body = new FormData(form);
|
||||||
|
if (extra) body.append(extra.name, extra.value);
|
||||||
|
fetch(form.getAttribute('action'), {
|
||||||
|
method: 'POST',
|
||||||
|
body: body,
|
||||||
|
credentials: 'same-origin',
|
||||||
|
headers: { 'X-Requested-With': 'fetch', 'Accept': 'application/json' }
|
||||||
|
})
|
||||||
|
.then(function (response) { return response.json(); })
|
||||||
|
.then(function (result) {
|
||||||
|
if (!result.ok) throw new Error(result.error || 'Speichern fehlgeschlagen');
|
||||||
|
if (reload) {
|
||||||
|
if (result.errors && result.errors.length) {
|
||||||
|
try { window.sessionStorage.setItem(noteKey, result.errors.join(' ')); } catch (e) { /* dann eben ohne */ }
|
||||||
|
}
|
||||||
|
window.location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
applyFragments(result.fragments);
|
||||||
|
var tabCount = document.querySelector('.gear-tab.is-active .gear-tab-count');
|
||||||
|
if (tabCount) tabCount.textContent = result.count || '';
|
||||||
|
if (onState && !again) onState(result.state || {});
|
||||||
|
if (result.errors && result.errors.length) setStatus(result.errors.join(' '), 'error');
|
||||||
|
else setStatus('✓ Gespeichert', 'ok');
|
||||||
|
})
|
||||||
|
.catch(function (error) { setStatus(error.message || 'Speichern fehlgeschlagen', 'error'); })
|
||||||
|
.then(function () {
|
||||||
|
saving = false;
|
||||||
|
if (again) {
|
||||||
|
var next = again;
|
||||||
|
again = null;
|
||||||
|
save(next.extra, next.reload);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var schedule = function (delay) {
|
||||||
|
clearTimeout(timer);
|
||||||
|
setStatus('Ungespeicherte Änderung …', 'busy');
|
||||||
|
timer = setTimeout(function () { save(null, false); }, delay);
|
||||||
|
};
|
||||||
|
|
||||||
|
form.addEventListener('change', function (event) {
|
||||||
|
if (event.target.closest('[data-plan-tools]')) return; // Suche und Filter speichern nichts
|
||||||
|
if (event.target.hasAttribute('data-plan-reload')) {
|
||||||
|
save(null, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
schedule(250);
|
||||||
|
});
|
||||||
|
form.addEventListener('input', function (event) {
|
||||||
|
if (event.target.matches('input[type="number"]')) schedule(700);
|
||||||
|
});
|
||||||
|
// Knoepfe mit Namen (z.B. "Alle aktivieren") schicken ihren Wert mit
|
||||||
|
form.addEventListener('click', function (event) {
|
||||||
|
var button = event.target.closest('button[type="submit"][name]');
|
||||||
|
if (!button || !form.contains(button)) return;
|
||||||
|
event.preventDefault();
|
||||||
|
save({ name: button.name, value: button.value }, false);
|
||||||
|
});
|
||||||
|
form.addEventListener('submit', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
save(null, false);
|
||||||
|
});
|
||||||
|
return { save: save, schedule: schedule };
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---- Filter und Suche in den Listen (Pets, Dekorationen, Skins) ----
|
||||||
|
var setupFilters = function (scope, extraTest) {
|
||||||
|
var items = Array.prototype.slice.call(scope.querySelectorAll('[data-filter-item]'));
|
||||||
|
if (!items.length) return null;
|
||||||
|
var buttons = scope.querySelectorAll('[data-plan-filter] button[data-filter-value]');
|
||||||
|
var tools = scope.querySelector('[data-plan-tools]');
|
||||||
|
var search = scope.querySelector('[data-filter-search]');
|
||||||
|
var domain = scope.querySelector('[data-filter-domain]');
|
||||||
|
var placed = scope.querySelector('[data-filter-placed]');
|
||||||
|
var key = '';
|
||||||
|
if (tools) tools.hidden = false;
|
||||||
|
var apply = function () {
|
||||||
|
var text = search ? search.value.trim().toLowerCase() : '';
|
||||||
|
var wantDomain = domain ? domain.value : '';
|
||||||
|
items.forEach(function (item) {
|
||||||
|
var show = (!key || item.dataset.filterKey === key)
|
||||||
|
&& (!text || (item.dataset.filterText || '').indexOf(text) !== -1)
|
||||||
|
&& (!wantDomain || (' ' + (item.dataset.domains || '') + ' ').indexOf(' ' + wantDomain + ' ') !== -1)
|
||||||
|
&& (!placed || !placed.checked || item.classList.contains('is-on'))
|
||||||
|
&& (!extraTest || extraTest(item));
|
||||||
|
item.hidden = !show;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
buttons.forEach(function (button) {
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
key = button.dataset.filterValue;
|
||||||
|
buttons.forEach(function (other) { other.classList.toggle('is-active', other === button); });
|
||||||
|
apply();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
[search, domain, placed].forEach(function (control) {
|
||||||
|
if (control) control.addEventListener(control === search ? 'input' : 'change', apply);
|
||||||
|
});
|
||||||
|
return { apply: apply, visible: function () { return items.filter(function (item) { return !item.hidden; }); } };
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---- Arcana: Skills je Karte nur einmal, Stufen zusammen hoechstens Plaetze + Aufwertung ----
|
||||||
|
var arcanaForm = document.querySelector('.gear-arcana-form[data-plan-form]');
|
||||||
|
if (arcanaForm) {
|
||||||
|
var paintArcana = function (box) {
|
||||||
|
var slot = box.closest('[data-arcana-slot]');
|
||||||
|
var enchant = slot.querySelector('[data-arcana-enchant]');
|
||||||
|
var budget = (parseInt(box.dataset.base, 10) || 0) + (enchant ? parseInt(enchant.value, 10) || 0 : 0);
|
||||||
|
var rows = Array.prototype.slice.call(box.querySelectorAll('.gear-arcana-skill-row'));
|
||||||
|
var used = 0;
|
||||||
|
rows.forEach(function (row) {
|
||||||
|
var skill = row.querySelector('[data-arcana-skill]');
|
||||||
|
if (skill.value !== '0') used += parseInt(row.querySelector('[data-arcana-level]').value, 10) || 0;
|
||||||
|
});
|
||||||
|
rows.forEach(function (row) {
|
||||||
|
var skill = row.querySelector('[data-arcana-skill]');
|
||||||
|
var level = row.querySelector('[data-arcana-level]');
|
||||||
|
var taken = rows.filter(function (other) { return other !== row; }).map(function (other) { return other.querySelector('[data-arcana-skill]').value; });
|
||||||
|
// Die gewaehlte Option bleibt immer frei - gesperrte schickt der Browser nicht mit (sinkt die
|
||||||
|
// Aufwertung, kuerzt der Server die Stufen von hinten)
|
||||||
|
Array.prototype.forEach.call(skill.options, function (option) {
|
||||||
|
option.disabled = !option.selected && option.value !== '0' && taken.indexOf(option.value) !== -1;
|
||||||
|
});
|
||||||
|
var picked = skill.options[skill.selectedIndex];
|
||||||
|
var max = parseInt(picked && picked.dataset.max ? picked.dataset.max : '4', 10) || 4;
|
||||||
|
var mine = skill.value !== '0' ? parseInt(level.value, 10) || 0 : 0;
|
||||||
|
Array.prototype.forEach.call(level.options, function (option) {
|
||||||
|
var value = parseInt(option.value, 10);
|
||||||
|
option.disabled = !option.selected && (value > max || (skill.value !== '0' && used - mine + value > budget));
|
||||||
|
});
|
||||||
|
level.disabled = skill.value === '0';
|
||||||
|
row.classList.toggle('is-on', skill.value !== '0');
|
||||||
|
});
|
||||||
|
var count = box.querySelector('[data-arcana-used]');
|
||||||
|
if (count) count.textContent = used + '/' + budget + ' Stufen';
|
||||||
|
box.classList.toggle('is-over', used > budget);
|
||||||
|
};
|
||||||
|
var arcanaBoxes = function () { return arcanaForm.querySelectorAll('[data-arcana-skills]'); };
|
||||||
|
setupForm(arcanaForm, function (state) {
|
||||||
|
// Gepruefter Stand vom Server (z.B. zu viele Stufen gekuerzt)
|
||||||
|
arcanaForm.querySelectorAll('[data-arcana-slot]').forEach(function (slot) {
|
||||||
|
var saved = (state.slots || {})[slot.dataset.arcanaSlot];
|
||||||
|
if (!saved) return;
|
||||||
|
var enchant = slot.querySelector('[data-arcana-enchant]');
|
||||||
|
if (enchant) enchant.value = String(saved.enchant);
|
||||||
|
slot.querySelectorAll('.gear-arcana-skill-row').forEach(function (row, i) {
|
||||||
|
var entry = saved.skills[i];
|
||||||
|
row.querySelector('[data-arcana-skill]').value = entry ? String(entry[0]) : '0';
|
||||||
|
if (entry) row.querySelector('[data-arcana-level]').value = String(entry[1]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
arcanaBoxes().forEach(paintArcana);
|
||||||
|
});
|
||||||
|
arcanaForm.addEventListener('change', function (event) {
|
||||||
|
var slot = event.target.closest('[data-arcana-slot]');
|
||||||
|
var box = slot && slot.querySelector('[data-arcana-skills]');
|
||||||
|
if (box) paintArcana(box);
|
||||||
|
}, true);
|
||||||
|
arcanaBoxes().forEach(paintArcana);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Pets ----
|
||||||
|
var petsForm = document.querySelector('.gear-pets-form[data-plan-form]');
|
||||||
|
if (petsForm) {
|
||||||
|
var petsSaver = setupForm(petsForm);
|
||||||
|
var petFilters = setupFilters(petsForm);
|
||||||
|
var petLevel = function (item) {
|
||||||
|
var input = item.querySelector('[data-pet-level]');
|
||||||
|
if (!input) return 0;
|
||||||
|
return input.type === 'checkbox' ? (input.checked ? 1 : 0) : parseInt(input.value, 10) || 0;
|
||||||
|
};
|
||||||
|
var paintPets = function () {
|
||||||
|
var owned = {};
|
||||||
|
var total = 0;
|
||||||
|
petsForm.querySelectorAll('.gear-pet').forEach(function (item) {
|
||||||
|
var on = petLevel(item) > 0;
|
||||||
|
item.classList.toggle('is-on', on);
|
||||||
|
if (on) {
|
||||||
|
total++;
|
||||||
|
owned[item.dataset.filterKey] = (owned[item.dataset.filterKey] || 0) + 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
petsForm.querySelectorAll('[data-filter-count]').forEach(function (count) {
|
||||||
|
var family = count.dataset.filterCount;
|
||||||
|
var all = count.textContent.split('/')[1];
|
||||||
|
count.textContent = (family ? owned[family] || 0 : total) + '/' + all;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
petsForm.addEventListener('change', function (event) {
|
||||||
|
if (event.target.matches('[data-pet-level]')) paintPets();
|
||||||
|
});
|
||||||
|
petsForm.querySelectorAll('[data-pets-bulk]').forEach(function (button) {
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
var max = button.dataset.petsBulk === 'max';
|
||||||
|
(petFilters ? petFilters.visible() : []).forEach(function (item) {
|
||||||
|
var input = item.querySelector('[data-pet-level]');
|
||||||
|
if (!input) return;
|
||||||
|
if (input.type === 'checkbox') input.checked = max;
|
||||||
|
else input.value = max ? input.options[input.options.length - 1].value : '0';
|
||||||
|
});
|
||||||
|
paintPets();
|
||||||
|
petsSaver.save(null, false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Pantheon: je Art nur so viele Dekorationen wie Plaetze ----
|
||||||
|
var pantheonForm = document.querySelector('.gear-pantheon-form[data-plan-form]');
|
||||||
|
if (pantheonForm) {
|
||||||
|
var slots = JSON.parse(pantheonForm.dataset.slots || '{}');
|
||||||
|
var decos = Array.prototype.slice.call(pantheonForm.querySelectorAll('.gear-deco'));
|
||||||
|
var paintPantheon = function () {
|
||||||
|
var used = {};
|
||||||
|
decos.forEach(function (deco) {
|
||||||
|
var box = deco.querySelector('input[type="checkbox"]');
|
||||||
|
deco.classList.toggle('is-on', box.checked);
|
||||||
|
if (box.checked) used[deco.dataset.decoUi] = (used[deco.dataset.decoUi] || 0) + 1;
|
||||||
|
});
|
||||||
|
decos.forEach(function (deco) {
|
||||||
|
var box = deco.querySelector('input[type="checkbox"]');
|
||||||
|
var full = !box.checked && (used[deco.dataset.decoUi] || 0) >= (slots[deco.dataset.decoUi] || 0);
|
||||||
|
box.disabled = full;
|
||||||
|
deco.classList.toggle('is-full', full);
|
||||||
|
deco.title = full ? 'Alle Plätze dieser Art sind belegt' : '';
|
||||||
|
});
|
||||||
|
pantheonForm.querySelectorAll('[data-pantheon-count]').forEach(function (count) {
|
||||||
|
count.textContent = (used[count.dataset.pantheonCount] || 0) + '/' + (slots[count.dataset.pantheonCount] || 0);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
setupForm(pantheonForm, function (state) {
|
||||||
|
var placed = (state.decos || []).map(String);
|
||||||
|
decos.forEach(function (deco) {
|
||||||
|
var box = deco.querySelector('input[type="checkbox"]');
|
||||||
|
box.checked = placed.indexOf(box.value) !== -1;
|
||||||
|
});
|
||||||
|
paintPantheon();
|
||||||
|
});
|
||||||
|
setupFilters(pantheonForm);
|
||||||
|
pantheonForm.addEventListener('change', function (event) {
|
||||||
|
if (event.target.matches('.gear-deco input')) paintPantheon();
|
||||||
|
}, true);
|
||||||
|
paintPantheon();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Closet: Punkte und Skins ----
|
||||||
|
document.querySelectorAll('.gear-closet-points[data-plan-form]').forEach(function (form) { setupForm(form); });
|
||||||
|
var skinsForm = document.querySelector('.gear-closet-skins[data-plan-form]');
|
||||||
|
if (skinsForm) {
|
||||||
|
var skinsSaver = setupForm(skinsForm);
|
||||||
|
var skinFilters = setupFilters(skinsForm);
|
||||||
|
var paintSkins = function () {
|
||||||
|
skinsForm.querySelectorAll('.gear-skin').forEach(function (skin) {
|
||||||
|
skin.classList.toggle('is-on', skin.querySelector('input').checked);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
skinsForm.addEventListener('change', paintSkins, true);
|
||||||
|
skinsForm.querySelectorAll('[data-closet-bulk]').forEach(function (button) {
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
var on = button.dataset.closetBulk === '1';
|
||||||
|
(skinFilters ? skinFilters.visible() : []).forEach(function (skin) { skin.querySelector('input').checked = on; });
|
||||||
|
paintSkins();
|
||||||
|
skinsSaver.save(null, false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Daevanion: Bretter als Reiter, Felder vom Start aus angrenzend freischalten ----
|
||||||
|
var dvRoot = document.querySelector('[data-daevanion], [data-daevanion-view]');
|
||||||
|
if (dvRoot) {
|
||||||
|
var boards = Array.prototype.slice.call(dvRoot.querySelectorAll('[data-dv-board]'));
|
||||||
|
var tabs = dvRoot.querySelector('[data-dv-tabs]');
|
||||||
|
var storeKey = 'gear-dv-board';
|
||||||
|
var showBoard = function (id) {
|
||||||
|
var found = boards.some(function (board) { return board.dataset.dvBoard === id; });
|
||||||
|
if (!found && boards.length) id = boards[0].dataset.dvBoard;
|
||||||
|
boards.forEach(function (board) { board.hidden = board.dataset.dvBoard !== id; });
|
||||||
|
tabs.querySelectorAll('[data-dv-tab]').forEach(function (tab) {
|
||||||
|
tab.classList.toggle('is-active', tab.dataset.dvTab === id);
|
||||||
|
tab.setAttribute('aria-selected', tab.dataset.dvTab === id ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
try { window.sessionStorage.setItem(storeKey, id); } catch (e) { /* ohne Speicher eben das erste Brett */ }
|
||||||
|
};
|
||||||
|
if (tabs && boards.length > 1) {
|
||||||
|
tabs.hidden = false;
|
||||||
|
tabs.querySelectorAll('[data-dv-tab]').forEach(function (tab) {
|
||||||
|
tab.addEventListener('click', function () { showBoard(tab.dataset.dvTab); });
|
||||||
|
});
|
||||||
|
var remembered = null;
|
||||||
|
try { remembered = window.sessionStorage.getItem(storeKey); } catch (e) { remembered = null; }
|
||||||
|
showBoard(remembered || boards[0].dataset.dvBoard);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Felder je Brett: Position, Kosten, Nachbarn
|
||||||
|
var model = boards.map(function (board) {
|
||||||
|
var nodes = Array.prototype.slice.call(board.querySelectorAll('[data-node]')).map(function (el) {
|
||||||
|
return {
|
||||||
|
el: el,
|
||||||
|
input: el.querySelector('input'),
|
||||||
|
id: el.dataset.node,
|
||||||
|
r: parseInt(el.dataset.r, 10),
|
||||||
|
c: parseInt(el.dataset.c, 10),
|
||||||
|
cost: parseInt(el.dataset.cost, 10) || 0,
|
||||||
|
type: el.dataset.type
|
||||||
|
};
|
||||||
|
});
|
||||||
|
var at = {};
|
||||||
|
nodes.forEach(function (node) { at[node.r + ',' + node.c] = node; });
|
||||||
|
nodes.forEach(function (node) {
|
||||||
|
node.right = at[node.r + ',' + (node.c + 1)] || null;
|
||||||
|
node.down = at[(node.r + 1) + ',' + node.c] || null;
|
||||||
|
node.links = [at[(node.r - 1) + ',' + node.c], at[(node.r + 1) + ',' + node.c], at[node.r + ',' + (node.c - 1)], at[node.r + ',' + (node.c + 1)]].filter(Boolean);
|
||||||
|
});
|
||||||
|
return { el: board, point: board.dataset.point, id: board.dataset.dvBoard, nodes: nodes };
|
||||||
|
});
|
||||||
|
var isOn = function (node) { return node.input ? node.input.checked : node.el.classList.contains('is-on'); };
|
||||||
|
var budgets = JSON.parse(dvRoot.dataset.budgets || '{}');
|
||||||
|
|
||||||
|
var paintDaevanion = function () {
|
||||||
|
var spent = {};
|
||||||
|
model.forEach(function (board) {
|
||||||
|
board.nodes.forEach(function (node) {
|
||||||
|
if (isOn(node)) spent[board.point] = (spent[board.point] || 0) + node.cost;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
model.forEach(function (board) {
|
||||||
|
var count = 0;
|
||||||
|
board.nodes.forEach(function (node) {
|
||||||
|
var on = isOn(node);
|
||||||
|
if (on) count++;
|
||||||
|
var open = !on && (node.type === 'start' || node.links.some(isOn))
|
||||||
|
&& (spent[board.point] || 0) + node.cost <= (budgets[board.point] || Infinity);
|
||||||
|
node.el.classList.toggle('is-on', on);
|
||||||
|
node.el.classList.toggle('is-open', open && !!node.input);
|
||||||
|
node.el.classList.toggle('link-r', on && !!node.right && isOn(node.right));
|
||||||
|
node.el.classList.toggle('link-d', on && !!node.down && isOn(node.down));
|
||||||
|
if (node.input) node.input.disabled = !on && !open;
|
||||||
|
});
|
||||||
|
var tabCount = tabs ? tabs.querySelector('[data-dv-tab="' + board.id + '"] [data-dv-tab-count]') : null;
|
||||||
|
if (tabCount) tabCount.textContent = count + '/' + board.nodes.length;
|
||||||
|
});
|
||||||
|
dvRoot.querySelectorAll('[data-dv-budget]').forEach(function (budget) {
|
||||||
|
var value = budget.querySelector('[data-dv-spent]');
|
||||||
|
if (value) value.textContent = spent[budget.dataset.dvBudget] || 0;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Nach dem Entfernen: alles, was vom Start aus nicht mehr ueber gewaehlte Felder erreichbar ist, faellt weg
|
||||||
|
var prune = function (board) {
|
||||||
|
var reached = {};
|
||||||
|
var queue = board.nodes.filter(function (node) { return node.type === 'start' && isOn(node); });
|
||||||
|
while (queue.length) {
|
||||||
|
var node = queue.shift();
|
||||||
|
if (reached[node.id]) continue;
|
||||||
|
reached[node.id] = true;
|
||||||
|
node.links.forEach(function (next) {
|
||||||
|
if (isOn(next) && !reached[next.id]) queue.push(next);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
board.nodes.forEach(function (node) {
|
||||||
|
if (node.input && node.input.checked && !reached[node.id]) node.input.checked = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dvRoot.hasAttribute('data-daevanion')) {
|
||||||
|
setupForm(dvRoot, function (state) {
|
||||||
|
var chosen = (state.nodes || []).map(String);
|
||||||
|
model.forEach(function (board) {
|
||||||
|
board.nodes.forEach(function (node) { if (node.input) node.input.checked = chosen.indexOf(node.id) !== -1; });
|
||||||
|
});
|
||||||
|
paintDaevanion();
|
||||||
|
});
|
||||||
|
dvRoot.addEventListener('change', function (event) {
|
||||||
|
var el = event.target.closest('[data-node]');
|
||||||
|
if (!el) return;
|
||||||
|
var board = model.filter(function (b) { return b.el.contains(el); })[0];
|
||||||
|
if (board && !event.target.checked) prune(board);
|
||||||
|
paintDaevanion();
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
paintDaevanion();
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
@ -231,6 +231,10 @@
|
||||||
var level = levelOf(card);
|
var level = levelOf(card);
|
||||||
card.classList.toggle('is-planned', level > 0);
|
card.classList.toggle('is-planned', level > 0);
|
||||||
card.classList.toggle('is-bonus', card.dataset.kind !== 'stigma' && level > selfMax);
|
card.classList.toggle('is-bonus', card.dataset.kind !== 'stigma' && level > selfMax);
|
||||||
|
// Mehr als Skillpunkte + Boni aus Daevanion/Arcana (nur wenn dort etwas geplant ist)
|
||||||
|
if (card.dataset.bonus !== undefined) {
|
||||||
|
card.classList.toggle('is-short', level > selfMax + (parseInt(card.dataset.bonus, 10) || 0));
|
||||||
|
}
|
||||||
var badge = card.querySelector('[data-skill-badge]');
|
var badge = card.querySelector('[data-skill-badge]');
|
||||||
if (badge) badge.textContent = level > 0 ? String(level) : '';
|
if (badge) badge.textContent = level > 0 ? String(level) : '';
|
||||||
card.querySelectorAll('[data-stigma-perks] i').forEach(function (pip) {
|
card.querySelectorAll('[data-stigma-perks] i').forEach(function (pip) {
|
||||||
|
|
|
||||||
76
gear.php
76
gear.php
|
|
@ -4,11 +4,14 @@
|
||||||
* /gear.php Uebersicht der eigenen Sets
|
* /gear.php Uebersicht der eigenen Sets
|
||||||
* /gear.php?set=ID[&slot=KEY] ein Set: Ausruestung (eigene bearbeitbar, fremde nur wenn aufs Profil freigegeben)
|
* /gear.php?set=ID[&slot=KEY] ein Set: Ausruestung (eigene bearbeitbar, fremde nur wenn aufs Profil freigegeben)
|
||||||
* /gear.php?set=ID&tab=skills|stigma Unterseiten Skills und Stigmen des Sets (includes/gear_skills_view.php)
|
* /gear.php?set=ID&tab=skills|stigma Unterseiten Skills und Stigmen des Sets (includes/gear_skills_view.php)
|
||||||
|
* /gear.php?set=ID&tab=arcana|pets|daevanion|pantheon|closet die Seiten nach dem aion2hub-Planer
|
||||||
|
* (includes/gear_planner_view.php)
|
||||||
* /gear.php?compare[]=ID&… 2-4 Sets nebeneinander
|
* /gear.php?compare[]=ID&… 2-4 Sets nebeneinander
|
||||||
*/
|
*/
|
||||||
require_once __DIR__ . '/includes/bootstrap.php';
|
require_once __DIR__ . '/includes/bootstrap.php';
|
||||||
require_once __DIR__ . '/includes/gear.php';
|
require_once __DIR__ . '/includes/gear.php';
|
||||||
require_once __DIR__ . '/includes/gear_skills_view.php';
|
require_once __DIR__ . '/includes/gear_skills_view.php';
|
||||||
|
require_once __DIR__ . '/includes/gear_planner_view.php';
|
||||||
require_permission('gear.view');
|
require_permission('gear.view');
|
||||||
|
|
||||||
$me = current_user();
|
$me = current_user();
|
||||||
|
|
@ -88,10 +91,10 @@ include __DIR__ . '/includes/header.php';
|
||||||
<div>
|
<div>
|
||||||
<h1>Gear-Planer</h1>
|
<h1>Gear-Planer</h1>
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
Stell Ausrüstungssets zusammen, plane die Skills deiner Klasse und vergleiche sie. Grundwerte,
|
Stell Ausrüstungssets zusammen, plane Skills, Arcana, Pets, Daevanion-Bretter, Pantheon und Closet
|
||||||
Sockel, die Werte bei voller Aufwertung und die Skill-Listen stammen aus dem Spielclient (Global)
|
deiner Klasse und vergleiche sie. Grundwerte, Sockel, die Werte bei voller Aufwertung, die Skill-Listen
|
||||||
und werden von der Leitung abgeglichen; Werte mit <span class="gear-estimated">≈</span> sind für
|
und die Daten der Planer-Seiten stammen aus dem Spielclient (Global) und werden von der Leitung abgeglichen;
|
||||||
Zwischenstufen hochgerechnet.
|
Werte mit <span class="gear-estimated">≈</span> sind für Zwischenstufen hochgerechnet.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="gear-head-actions">
|
<div class="gear-head-actions">
|
||||||
|
|
@ -145,6 +148,21 @@ include __DIR__ . '/includes/header.php';
|
||||||
return [$ia === false ? 99 : $ia, $allKeys[$a]['unit'], $a] <=> [$ib === false ? 99 : $ib, $allKeys[$b]['unit'], $b];
|
return [$ia === false ? 99 : $ia, $allKeys[$a]['unit'], $a] <=> [$ib === false ? 99 : $ib, $allKeys[$b]['unit'], $b];
|
||||||
});
|
});
|
||||||
$first = (int) $compare[0]['id'];
|
$first = (int) $compare[0]['id'];
|
||||||
|
// Kampfwerte aus Arcana, Pets, Daevanion, Pantheon und Closet (je Set zusammengezaehlt)
|
||||||
|
$comparePlans = gear_set_plans(array_column($compare, 'id'));
|
||||||
|
$planTotals = [];
|
||||||
|
$planKeys = [];
|
||||||
|
foreach ($compare as $c) {
|
||||||
|
$sum = [];
|
||||||
|
foreach (gear_plan_stat_totals($c, $comparePlans[(int) $c['id']] ?? []) as $sectionTotals) {
|
||||||
|
foreach ($sectionTotals as $stat => $value) {
|
||||||
|
gear_stats_add($sum, (string) $stat, (float) $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$planTotals[(int) $c['id']] = $sum;
|
||||||
|
$planKeys += $sum;
|
||||||
|
}
|
||||||
|
$planKeys = array_keys(gear_stats_sorted($planKeys));
|
||||||
?>
|
?>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2>Vergleich</h2>
|
<h2>Vergleich</h2>
|
||||||
|
|
@ -200,6 +218,25 @@ include __DIR__ . '/includes/header.php';
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<?php if ($planKeys): ?>
|
||||||
|
<tr class="gear-compare-group"><th colspan="<?= count($compare) + 1 ?>">Werte aus Arcana, Pets, Daevanion, Pantheon & Closet</th></tr>
|
||||||
|
<?php foreach ($planKeys as $stat): ?>
|
||||||
|
<?php $base = $planTotals[$first][$stat] ?? 0.0; ?>
|
||||||
|
<tr>
|
||||||
|
<th><?= e(gear_stat_label((string) $stat)) ?></th>
|
||||||
|
<?php foreach ($compare as $index => $c): ?>
|
||||||
|
<?php $value = $planTotals[(int) $c['id']][$stat] ?? null; $diff = ($value ?? 0.0) - $base; ?>
|
||||||
|
<td>
|
||||||
|
<?= $value !== null ? e(gear_stat_value((string) $stat, (float) $value)) : '<span class="text-muted">–</span>' ?>
|
||||||
|
<?php if ($index > 0 && abs($diff) > 0.001): ?>
|
||||||
|
<?php $better = in_array($stat, GEAR_STAT_LOWER_BETTER, true) ? $diff < 0 : $diff > 0; ?>
|
||||||
|
<span class="gear-diff <?= $better ? 'is-up' : 'is-down' ?>"><?= e(gear_stat_value((string) $stat, $diff)) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
<?php if ($compareSkillRows): ?>
|
<?php if ($compareSkillRows): ?>
|
||||||
<tr class="gear-compare-group"><th colspan="<?= count($compare) + 1 ?>">Skills</th></tr>
|
<tr class="gear-compare-group"><th colspan="<?= count($compare) + 1 ?>">Skills</th></tr>
|
||||||
<?php foreach ($compareSkillRows as $skillId => $skill): ?>
|
<?php foreach ($compareSkillRows as $skillId => $skill): ?>
|
||||||
|
|
@ -246,6 +283,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
$totals = gear_set_totals($slots);
|
$totals = gear_set_totals($slots);
|
||||||
$itemLevel = gear_set_item_level($slots);
|
$itemLevel = gear_set_item_level($slots);
|
||||||
$plannedSkills = gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [];
|
$plannedSkills = gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [];
|
||||||
|
$setPlans = gear_set_plans([(int) $set['id']])[(int) $set['id']] ?? [];
|
||||||
?>
|
?>
|
||||||
<div class="panel gear-set-head">
|
<div class="panel gear-set-head">
|
||||||
<div class="gear-set-title">
|
<div class="gear-set-title">
|
||||||
|
|
@ -261,7 +299,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
<div class="gear-set-actions">
|
<div class="gear-set-actions">
|
||||||
<?php if (!empty($set['build_url']) && gear_build_host((string) $set['build_url']) !== null): ?>
|
<?php if (!empty($set['build_url']) && gear_build_host((string) $set['build_url']) !== null): ?>
|
||||||
<a class="button button-secondary" href="<?= e($set['build_url']) ?>" target="_blank" rel="noopener noreferrer nofollow"
|
<a class="button button-secondary" href="<?= e($set['build_url']) ?>" target="_blank" rel="noopener noreferrer nofollow"
|
||||||
title="Skills, Stigmen und Daevanion auf <?= e(gear_build_host((string) $set['build_url'])) ?>">Skill- & Daevanion-Plan ↗</a>
|
title="Build auf <?= e(gear_build_host((string) $set['build_url'])) ?>">Build-Link ↗</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($isOwn): ?>
|
<?php if ($isOwn): ?>
|
||||||
<button type="button" class="button button-secondary" data-modal-open="gear-set-edit"><?= icon('edit') ?> Bearbeiten</button>
|
<button type="button" class="button button-secondary" data-modal-open="gear-set-edit"><?= icon('edit') ?> Bearbeiten</button>
|
||||||
|
|
@ -288,12 +326,15 @@ include __DIR__ . '/includes/header.php';
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Reiter: Ausruestung, Skills, Stigmen - jede eine eigene Seite
|
// Reiter: Ausruestung, Arcana, Pets, Skills, Stigmen, Daevanion, Pantheon, Closet - jede eine eigene Seite
|
||||||
$tabCounts = [
|
$tabCounts = [
|
||||||
'gear' => count(array_filter($slots, static fn (array $row): bool => !empty($row['item']))) . '/' . count(GEAR_SLOTS),
|
'gear' => count(array_filter($slots, static fn (array $row): bool => !empty($row['item']))) . '/' . count(GEAR_SLOTS),
|
||||||
'skills' => (string) count(gear_skills_of_tab($plannedSkills, 'skills')),
|
'skills' => (string) count(gear_skills_of_tab($plannedSkills, 'skills')),
|
||||||
'stigma' => count(gear_skills_of_tab($plannedSkills, 'stigma')) . '/' . GEAR_STIGMA_SLOTS,
|
'stigma' => count(gear_skills_of_tab($plannedSkills, 'stigma')) . '/' . GEAR_STIGMA_SLOTS,
|
||||||
];
|
];
|
||||||
|
foreach (array_keys(GEAR_PLAN_SECTIONS) as $section) {
|
||||||
|
$tabCounts[$section] = gear_plan_tab_count($setPlans, $section);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<nav class="gear-tabs" aria-label="Bereiche des Sets">
|
<nav class="gear-tabs" aria-label="Bereiche des Sets">
|
||||||
<?php foreach (GEAR_SET_TABS as $tabKey => $tabLabel): ?>
|
<?php foreach (GEAR_SET_TABS as $tabKey => $tabLabel): ?>
|
||||||
|
|
@ -303,8 +344,22 @@ include __DIR__ . '/includes/header.php';
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<?php if ($tab !== 'gear'): ?>
|
<?php if (isset(GEAR_PLAN_SECTIONS[$tab])): ?>
|
||||||
<?php gear_render_skill_tab($set, $tab, $isOwn, $canManage); ?>
|
<?php
|
||||||
|
// Eigene andere Sets, aus denen sich diese Seite uebernehmen laesst
|
||||||
|
$copySets = [];
|
||||||
|
if ($isOwn) {
|
||||||
|
$otherPlans = gear_set_plans(array_column($mySets, 'id'));
|
||||||
|
foreach ($mySets as $other) {
|
||||||
|
if ((int) $other['id'] !== (int) $set['id'] && isset($otherPlans[(int) $other['id']][$tab])) {
|
||||||
|
$copySets[(int) $other['id']] = $other;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gear_render_plan_tab($set, $tab, $setPlans[$tab] ?? [], $isOwn, $canManage, $copySets);
|
||||||
|
?>
|
||||||
|
<?php elseif ($tab !== 'gear'): ?>
|
||||||
|
<?php gear_render_skill_tab($set, $tab, $isOwn, $canManage, $setPlans); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="gear-layout">
|
<div class="gear-layout">
|
||||||
<div class="panel gear-slots-panel">
|
<div class="panel gear-slots-panel">
|
||||||
|
|
@ -556,10 +611,10 @@ include __DIR__ . '/includes/header.php';
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</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>Notiz <input type="text" name="note" maxlength="255" value="<?= e((string) $set['note']) ?>" placeholder="z.B. PvP, Raid, Ziel-Ausrüstung …"></label>
|
||||||
<label>Link zum Skill- & Daevanion-Plan <span class="text-muted">(optional)</span>
|
<label>Link zu einem Build <span class="text-muted">(optional)</span>
|
||||||
<input type="url" name="build_url" maxlength="<?= GEAR_BUILD_URL_MAX ?>" value="<?= e((string) ($set['build_url'] ?? '')) ?>" placeholder="https://aion2hub.com/…">
|
<input type="url" name="build_url" maxlength="<?= GEAR_BUILD_URL_MAX ?>" value="<?= e((string) ($set['build_url'] ?? '')) ?>" placeholder="https://aion2hub.com/…">
|
||||||
</label>
|
</label>
|
||||||
<p class="field-hint">Die Skillstufen planst du direkt hier im Set. Daevanion-Bretter (und was die Website sonst noch nicht kennt) planst du auf einer Planer-Seite (<?= e(implode(', ', GEAR_BUILD_HOSTS)) ?>) und fügst hier den Link ein - er erscheint beim Set und auf deiner Profilseite.</p>
|
<p class="field-hint">Skills, Arcana, Pets, Daevanion, Pantheon und Closet planst du direkt hier im Set. Für das, was die Website noch nicht kennt (z. B. Titel oder Flügel), kannst du einen Build auf einer Planer-Seite (<?= e(implode(', ', GEAR_BUILD_HOSTS)) ?>) verlinken – der Link erscheint beim Set und auf deiner Profilseite.</p>
|
||||||
<label class="checkbox-label"><input type="checkbox" name="show_on_profile" value="1"<?= $set['show_on_profile'] ? ' checked' : '' ?>> Auf meiner Profilseite zeigen</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">
|
<div class="actions">
|
||||||
<button type="submit" class="button">Speichern</button>
|
<button type="submit" class="button">Speichern</button>
|
||||||
|
|
@ -633,4 +688,5 @@ include __DIR__ . '/includes/header.php';
|
||||||
|
|
||||||
<script src="<?= e(asset_url('/assets/js/item-picker.js')) ?>"></script>
|
<script src="<?= e(asset_url('/assets/js/item-picker.js')) ?>"></script>
|
||||||
<script src="<?= e(asset_url('/assets/js/gear.js')) ?>"></script>
|
<script src="<?= e(asset_url('/assets/js/gear.js')) ?>"></script>
|
||||||
|
<?php if ($set && isset(GEAR_PLAN_SECTIONS[$tab])): ?><script src="<?= e(asset_url('/assets/js/gear-plans.js')) ?>"></script><?php endif; ?>
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Gear-Planer: Sets anlegen, bearbeiten, kopieren, loeschen, Slots belegen und Skillstufen samt
|
* Gear-Planer: Sets anlegen, bearbeiten, kopieren, loeschen, Slots belegen, Skillstufen samt
|
||||||
* Spezialisierungen planen. Jedes Mitglied bearbeitet nur seine eigenen Sets.
|
* Spezialisierungen planen und die Seiten Arcana, Pets, Daevanion, Pantheon und Closet speichern.
|
||||||
|
* Jedes Mitglied bearbeitet nur seine eigenen Sets.
|
||||||
*/
|
*/
|
||||||
require_once __DIR__ . '/includes/bootstrap.php';
|
require_once __DIR__ . '/includes/bootstrap.php';
|
||||||
require_once __DIR__ . '/includes/gear.php';
|
require_once __DIR__ . '/includes/gear.php';
|
||||||
require_once __DIR__ . '/includes/gear_skills_view.php'; // GEAR_SET_TABS
|
require_once __DIR__ . '/includes/gear_skills_view.php'; // GEAR_SET_TABS
|
||||||
|
require_once __DIR__ . '/includes/gear_planner_view.php'; // gear_plan_fragments
|
||||||
require_permission('gear.view');
|
require_permission('gear.view');
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||||
|
|
@ -131,6 +133,8 @@ switch ($action) {
|
||||||
)->execute([$newId, $set['id']]);
|
)->execute([$newId, $set['id']]);
|
||||||
$pdo->prepare('INSERT INTO gear_set_skills (set_id, skill_id, level, specs) SELECT ?, skill_id, level, specs FROM gear_set_skills WHERE set_id = ?')
|
$pdo->prepare('INSERT INTO gear_set_skills (set_id, skill_id, level, specs) SELECT ?, skill_id, level, specs FROM gear_set_skills WHERE set_id = ?')
|
||||||
->execute([$newId, $set['id']]);
|
->execute([$newId, $set['id']]);
|
||||||
|
$pdo->prepare('INSERT INTO gear_set_plans (set_id, section, data, updated_at) SELECT ?, section, data, NOW() FROM gear_set_plans WHERE set_id = ?')
|
||||||
|
->execute([$newId, $set['id']]);
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
set_flash('success', 'Set kopiert - jetzt kannst du Varianten ausprobieren.');
|
set_flash('success', 'Set kopiert - jetzt kannst du Varianten ausprobieren.');
|
||||||
redirect('/gear.php?set=' . $newId);
|
redirect('/gear.php?set=' . $newId);
|
||||||
|
|
@ -376,6 +380,62 @@ switch ($action) {
|
||||||
set_flash('success', GEAR_SET_TABS[$tab] . ' gespeichert.');
|
set_flash('success', GEAR_SET_TABS[$tab] . ' gespeichert.');
|
||||||
}
|
}
|
||||||
redirect($back);
|
redirect($back);
|
||||||
|
|
||||||
|
case 'save_plan':
|
||||||
|
// Eine der Seiten Arcana, Pets, Daevanion, Pantheon, Closet (Formularfelder: includes/gear_planner_view.php,
|
||||||
|
// Pruefung: gear_plan_input in includes/gear_planner.php). Mit JavaScript kommen der gepruefte Plan und
|
||||||
|
// die neu berechneten Kaesten zurueck (assets/js/gear-plans.js).
|
||||||
|
$set = $ownSet();
|
||||||
|
$section = (string) ($_POST['section'] ?? '');
|
||||||
|
if (!isset(GEAR_PLAN_SECTIONS[$section])) {
|
||||||
|
$fail('Unbekannte Seite.', '/gear.php?set=' . (int) $set['id']);
|
||||||
|
}
|
||||||
|
$back = '/gear.php?set=' . (int) $set['id'] . '&tab=' . $section
|
||||||
|
. ($section === 'closet' && is_string($_POST['cat'] ?? null) ? '&cat=' . rawurlencode($_POST['cat']) : '')
|
||||||
|
. (($_POST['part'] ?? '') === 'skins' ? '#closet-skins' : '');
|
||||||
|
$class = !empty($set['class_name']) ? (string) $set['class_name'] : null;
|
||||||
|
if (!gear_plan_ready($section, $class)) {
|
||||||
|
$fail($section === 'daevanion' && $class === null ? 'Wähle zuerst eine Klasse für das Set.' : 'Die Daten für ' . GEAR_PLAN_SECTIONS[$section] . ' fehlen noch.', $back);
|
||||||
|
}
|
||||||
|
[$plan, $notes] = gear_plan_input($section, $_POST, gear_set_plan((int) $set['id'], $section), $set);
|
||||||
|
gear_set_plan_store($set, $section, $plan);
|
||||||
|
$touch((int) $set['id']);
|
||||||
|
if ($wantsJson) {
|
||||||
|
$json([
|
||||||
|
'ok' => true,
|
||||||
|
'state' => $plan,
|
||||||
|
'count' => gear_plan_tab_count(gear_set_plans([(int) $set['id']])[(int) $set['id']], $section),
|
||||||
|
'fragments' => gear_plan_fragments($section, $set, $plan),
|
||||||
|
'errors' => $notes,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if ($notes) {
|
||||||
|
set_flash('error', 'Gespeichert, aber nicht alles übernommen: ' . implode(' ', $notes));
|
||||||
|
} else {
|
||||||
|
set_flash('success', GEAR_PLAN_SECTIONS[$section] . ' gespeichert.');
|
||||||
|
}
|
||||||
|
redirect($back);
|
||||||
|
|
||||||
|
case 'copy_plan':
|
||||||
|
// Seite aus einem anderen eigenen Set uebernehmen (ersetzt die bisherige), passend gemacht fuer dieses Set
|
||||||
|
$set = $ownSet();
|
||||||
|
$section = (string) ($_POST['section'] ?? '');
|
||||||
|
$from = gear_set((int) ($_POST['from_set'] ?? 0));
|
||||||
|
if (!isset(GEAR_PLAN_SECTIONS[$section])) {
|
||||||
|
$fail('Unbekannte Seite.', '/gear.php?set=' . (int) $set['id']);
|
||||||
|
}
|
||||||
|
$back = '/gear.php?set=' . (int) $set['id'] . '&tab=' . $section;
|
||||||
|
if (!$from || (int) $from['user_id'] !== $userId || (int) $from['id'] === (int) $set['id']) {
|
||||||
|
$fail('Dieses Set gibt es nicht (mehr).', $back);
|
||||||
|
}
|
||||||
|
if (!gear_plan_ready($section, !empty($set['class_name']) ? (string) $set['class_name'] : null)) {
|
||||||
|
$fail('Die Daten für ' . GEAR_PLAN_SECTIONS[$section] . ' fehlen noch.', $back);
|
||||||
|
}
|
||||||
|
gear_set_plan_store($set, $section, gear_plan_normalize($section, gear_set_plan((int) $from['id'], $section), $set));
|
||||||
|
$touch((int) $set['id']);
|
||||||
|
set_flash('success', GEAR_PLAN_SECTIONS[$section] . ' aus „' . $from['name'] . '“ übernommen.'
|
||||||
|
. ($from['class_name'] !== $set['class_name'] && in_array($section, ['arcana', 'daevanion'], true) ? ' Was nicht zur Klasse passt, ist weggefallen.' : ''));
|
||||||
|
redirect($back);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_flash('error', 'Unbekannte Aktion.');
|
set_flash('error', 'Unbekannte Aktion.');
|
||||||
|
|
|
||||||
1182
includes/gear_planner.php
Normal file
1182
includes/gear_planner.php
Normal file
File diff suppressed because it is too large
Load diff
600
includes/gear_planner_source.php
Normal file
600
includes/gear_planner_source.php
Normal file
|
|
@ -0,0 +1,600 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gear-Planer: die Daten der Seiten Arcana, Pets, Daevanion, Pantheon und Closet aus dem Build-Planer von
|
||||||
|
* aion2hub.com (Global-Client) auslesen. Sie stecken als Module in den JavaScript-Dateien der Seite
|
||||||
|
* (/_next/static/chunks/…js): ",<Nr>,(a,e,t)=>{e.exports=JSON.parse('…')}" oder "…=>{e.exports={…}}" als
|
||||||
|
* JavaScript-Objekt. Welche Datei welches Modul enthaelt und wie die Module nummeriert sind, aendert sich mit
|
||||||
|
* jeder neuen Version der Seite - erkannt wird ein Datensatz deshalb an seinem Inhalt.
|
||||||
|
*
|
||||||
|
* Uebernommen wird von /admin/gear_items.php aus (admin/gear_items_action.php, planner_chunk), gespeichert
|
||||||
|
* in gear_planner_data (includes/gear_planner.php).
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once __DIR__ . '/gear_source.php';
|
||||||
|
|
||||||
|
// Klassen der Website => Name der Klasse in den Daten des Planers
|
||||||
|
const GEAR_PLANNER_CLASS_KEYS = [
|
||||||
|
'Templer' => 'Templar',
|
||||||
|
'Gladiator' => 'Gladiator',
|
||||||
|
'Assassine' => 'Assassin',
|
||||||
|
'Jäger' => 'Ranger',
|
||||||
|
'Magier' => 'Sorcerer',
|
||||||
|
'Beschwörer' => 'Elementalist',
|
||||||
|
'Kleriker' => 'Cleric',
|
||||||
|
'Kantor' => 'Chanter',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Seltenheit als Zahl (Gegenstaende, Daevanion-Felder) => Name wie in GEAR_GRADES
|
||||||
|
const GEAR_PLANNER_GRADE_NUMBERS = [0 => 'Common', 1 => 'Common', 2 => 'Rare', 3 => 'Epic', 4 => 'Unique', 5 => 'Heroic', 6 => 'Special'];
|
||||||
|
|
||||||
|
// ---- JavaScript-Objekte lesen ----
|
||||||
|
|
||||||
|
/** Leerzeichen und Zeilenumbrueche ueberspringen. */
|
||||||
|
function gear_planner_js_skip(string $js, int &$i): void
|
||||||
|
{
|
||||||
|
$i += strspn($js, " \t\r\n", $i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Einen JavaScript-Wert ab Position $i lesen, wie er in den Daten-Modulen vorkommt: Objekte (Schluessel ohne
|
||||||
|
* Anfuehrungszeichen), Listen, Texte, Zahlen (auch 0x…), !0 / !1, true, false, null und void 0. Funktionen
|
||||||
|
* und alles andere brechen mit einer RuntimeException ab.
|
||||||
|
*/
|
||||||
|
function gear_planner_js_value(string $js, int &$i, int $depth = 0): mixed
|
||||||
|
{
|
||||||
|
if ($depth > 40) {
|
||||||
|
throw new RuntimeException('Zu tief verschachtelt.');
|
||||||
|
}
|
||||||
|
gear_planner_js_skip($js, $i);
|
||||||
|
$ch = $js[$i] ?? '';
|
||||||
|
if ($ch === '{') {
|
||||||
|
$i++;
|
||||||
|
$out = [];
|
||||||
|
while (true) {
|
||||||
|
gear_planner_js_skip($js, $i);
|
||||||
|
if (($js[$i] ?? '') === '}') {
|
||||||
|
$i++;
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
$key = gear_planner_js_key($js, $i);
|
||||||
|
gear_planner_js_skip($js, $i);
|
||||||
|
if (($js[$i] ?? '') !== ':') {
|
||||||
|
throw new RuntimeException('Doppelpunkt erwartet.');
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
$out[$key] = gear_planner_js_value($js, $i, $depth + 1);
|
||||||
|
gear_planner_js_skip($js, $i);
|
||||||
|
$sep = $js[$i] ?? '';
|
||||||
|
$i++;
|
||||||
|
if ($sep === '}') {
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
if ($sep !== ',') {
|
||||||
|
throw new RuntimeException('Komma erwartet.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($ch === '[') {
|
||||||
|
$i++;
|
||||||
|
$out = [];
|
||||||
|
while (true) {
|
||||||
|
gear_planner_js_skip($js, $i);
|
||||||
|
if (($js[$i] ?? '') === ']') {
|
||||||
|
$i++;
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
$out[] = gear_planner_js_value($js, $i, $depth + 1);
|
||||||
|
gear_planner_js_skip($js, $i);
|
||||||
|
$sep = $js[$i] ?? '';
|
||||||
|
$i++;
|
||||||
|
if ($sep === ']') {
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
if ($sep !== ',') {
|
||||||
|
throw new RuntimeException('Komma erwartet.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($ch === '"' || $ch === "'") {
|
||||||
|
$text = gear_source_js_unescape($js, $i + 1, $ch, $end);
|
||||||
|
$i = (int) $end + 1;
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
foreach (['!0' => true, '!1' => false, 'true' => true, 'false' => false, 'null' => null, 'void 0' => null] as $word => $value) {
|
||||||
|
if (substr_compare($js, $word, $i, strlen($word)) === 0) {
|
||||||
|
$i += strlen($word);
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (preg_match('/\G-?(?:0[xX][0-9a-fA-F]+|(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/', $js, $m, 0, $i)) {
|
||||||
|
$i += strlen($m[0]);
|
||||||
|
$number = ltrim($m[0], '-');
|
||||||
|
$sign = $m[0][0] === '-' ? -1 : 1;
|
||||||
|
if (stripos($number, '0x') === 0) {
|
||||||
|
return $sign * hexdec(substr($number, 2));
|
||||||
|
}
|
||||||
|
return preg_match('/[.eE]/', $number) ? $sign * (float) $number : $sign * (int) $number;
|
||||||
|
}
|
||||||
|
throw new RuntimeException('Unbekannter Wert.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Schluessel eines JavaScript-Objekts: Name, Text oder Zahl. */
|
||||||
|
function gear_planner_js_key(string $js, int &$i): string
|
||||||
|
{
|
||||||
|
$ch = $js[$i] ?? '';
|
||||||
|
if ($ch === '"' || $ch === "'") {
|
||||||
|
$key = gear_source_js_unescape($js, $i + 1, $ch, $end);
|
||||||
|
$i = (int) $end + 1;
|
||||||
|
return $key;
|
||||||
|
}
|
||||||
|
if (preg_match('/\G(?:[A-Za-z_$][\w$]*|\d+(?:\.\d+)?)/', $js, $m, 0, $i)) {
|
||||||
|
$i += strlen($m[0]);
|
||||||
|
return $m[0];
|
||||||
|
}
|
||||||
|
throw new RuntimeException('Schlüssel erwartet.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ende eines JSON-Objekts, das bei $open ("{") beginnt - Klammern in Texten zaehlen nicht mit.
|
||||||
|
* Gibt die Position nach der schliessenden Klammer zurueck oder null.
|
||||||
|
*/
|
||||||
|
function gear_planner_json_object_end(string $text, int $open): ?int
|
||||||
|
{
|
||||||
|
$depth = 0;
|
||||||
|
$len = strlen($text);
|
||||||
|
for ($i = $open; $i < $len; $i++) {
|
||||||
|
$ch = $text[$i];
|
||||||
|
if ($ch === '"') {
|
||||||
|
// Text ueberspringen (mit \" darin)
|
||||||
|
for ($i++; $i < $len && $text[$i] !== '"'; $i++) {
|
||||||
|
if ($text[$i] === '\\') {
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($ch === '{' || $ch === '[') {
|
||||||
|
$depth++;
|
||||||
|
} elseif ($ch === '}' || $ch === ']') {
|
||||||
|
$depth--;
|
||||||
|
if ($depth === 0) {
|
||||||
|
return $i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Datensaetze erkennen ----
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alle Datensaetze in einer JavaScript-Datei des Build-Planers, die die Website braucht - schon in die Form
|
||||||
|
* gebracht, in der sie gespeichert werden (siehe gear_planner_data in includes/gear_planner.php). Grosse
|
||||||
|
* Module werden nur ausgepackt, wenn ihr Anfang passt - die Datei mit allen Gegenstaenden hat ueber 4 MB.
|
||||||
|
*
|
||||||
|
* @return array{parts: array<string, array{data: array, built_at: string}>, specs: ?array}
|
||||||
|
*/
|
||||||
|
function gear_planner_source_extract(string $js): array
|
||||||
|
{
|
||||||
|
$parts = [];
|
||||||
|
$specs = null;
|
||||||
|
$labels = null;
|
||||||
|
$percent = null;
|
||||||
|
$add = static function (string $name, array $data, array $raw = []) use (&$parts): void {
|
||||||
|
$parts[$name] = ['data' => $data, 'built_at' => mb_substr((string) ($raw['builtAt'] ?? ''), 0, 20)];
|
||||||
|
};
|
||||||
|
|
||||||
|
preg_match_all('/[,\[](\d+),\((\w+),(\w+),(\w+)\)=>\{\3\.exports=(JSON\.parse\(\'|\{)/', $js, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
|
||||||
|
foreach ($matches as $match) {
|
||||||
|
$start = (int) $match[5][1];
|
||||||
|
try {
|
||||||
|
if ($match[5][0] === '{') {
|
||||||
|
// JavaScript-Objekt: nur die bekannten Datensaetze lesen
|
||||||
|
$peek = substr($js, $start, 400);
|
||||||
|
$kind = match (true) {
|
||||||
|
(bool) preg_match('/^\{(?:Feral|Intellect|Nature|Trans|Special)_01:\{\d+:\{/', $peek) => 'pet_stats',
|
||||||
|
str_starts_with($peek, '{builtAt:') && str_contains($peek, 'categories:{') && str_contains($peek, 'perPoint') => 'closet_stats',
|
||||||
|
str_contains($peek, 'sets:[{key:"Arcana_') => 'arcana_sets',
|
||||||
|
default => '',
|
||||||
|
};
|
||||||
|
if ($kind === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$i = $start;
|
||||||
|
$raw = gear_planner_js_value($js, $i);
|
||||||
|
if (!is_array($raw)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$data = match ($kind) {
|
||||||
|
'pet_stats' => gear_planner_pet_stats($raw),
|
||||||
|
'closet_stats' => gear_planner_closet_stats($raw),
|
||||||
|
'arcana_sets' => gear_planner_arcana_sets($raw),
|
||||||
|
};
|
||||||
|
if ($data) {
|
||||||
|
$add($kind, $data, $raw);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = gear_source_js_unescape($js, $start + strlen("JSON.parse('"), "'");
|
||||||
|
$head = substr($text, 0, 300);
|
||||||
|
if (str_contains($text, '"slotUnlock":{"Mastery"')) {
|
||||||
|
$specs = gear_source_planner_specs_from((array) json_decode($text, true));
|
||||||
|
} elseif (str_starts_with($head, '{"EStat::')) {
|
||||||
|
// Namen ("EStat::CombatSpeed":"Combat Speed") und Einheiten ({"kind":"percent","divisor":100})
|
||||||
|
$raw = (array) json_decode($text, true);
|
||||||
|
if (is_string(reset($raw))) {
|
||||||
|
$labels = gear_planner_stat_labels($raw);
|
||||||
|
} else {
|
||||||
|
$percent = gear_planner_stat_percent($raw);
|
||||||
|
}
|
||||||
|
} elseif (str_starts_with($head, '{"Arcana_EnchantEffect_')) {
|
||||||
|
$add('arcana_enchant', gear_planner_arcana_enchant((array) json_decode($text, true)));
|
||||||
|
} elseif (str_contains($head, '"groups":{"Arcana_Skill_Random_')) {
|
||||||
|
$raw = (array) json_decode($text, true);
|
||||||
|
$add('arcana_pools', gear_planner_arcana_pools($raw), $raw);
|
||||||
|
} elseif (str_contains($head, '"soulCount"') && str_contains($head, '"pets"')) {
|
||||||
|
$raw = (array) json_decode($text, true);
|
||||||
|
$add('pets', gear_planner_pets($raw), $raw);
|
||||||
|
} elseif (str_contains($head, '"slotsByLevel"')) {
|
||||||
|
$raw = (array) json_decode($text, true);
|
||||||
|
$add('genus', gear_planner_genus($raw), $raw);
|
||||||
|
} elseif (str_contains($head, '"maxPointsByClass"')) {
|
||||||
|
$raw = (array) json_decode($text, true);
|
||||||
|
foreach (gear_planner_daevanion($raw) as $name => $data) {
|
||||||
|
$add($name, $data, $raw);
|
||||||
|
}
|
||||||
|
} elseif (str_contains($head, '"gradeWeight"')) {
|
||||||
|
$raw = (array) json_decode($text, true);
|
||||||
|
$add('closet', gear_planner_closet($raw), $raw);
|
||||||
|
} elseif (str_contains($head, '"slots":{"Large"')) {
|
||||||
|
$raw = (array) json_decode($text, true);
|
||||||
|
$add('pantheon', gear_planner_pantheon($raw), $raw);
|
||||||
|
} elseif (str_contains($text, '"slot":"Arcana"')) {
|
||||||
|
$cards = gear_planner_arcana_cards($text);
|
||||||
|
if ($cards) {
|
||||||
|
$add('arcana_cards', ['cards' => $cards]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (RuntimeException | ValueError $e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($labels !== null) {
|
||||||
|
$add('stats', ['labels' => $labels, 'percent' => $percent ?? []]);
|
||||||
|
}
|
||||||
|
// Datensaetze ohne eigenen Stand (z.B. Punkte je Aufwertung) haben den der anderen aus derselben Datei
|
||||||
|
$builtAt = max(array_merge([''], array_column($parts, 'built_at'), [(string) ($specs['built_at'] ?? '')]));
|
||||||
|
foreach ($parts as &$part) {
|
||||||
|
$part['built_at'] = $part['built_at'] !== '' ? $part['built_at'] : $builtAt;
|
||||||
|
}
|
||||||
|
unset($part);
|
||||||
|
return ['parts' => array_filter($parts, static fn (array $part): bool => $part['data'] !== []), 'specs' => $specs];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Datensaetze in unsere Form bringen ----
|
||||||
|
|
||||||
|
/** {"EStat::CombatSpeed":"Combat Speed", …} => ['CombatSpeed' => 'Combat Speed'] */
|
||||||
|
function gear_planner_stat_labels(array $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ($raw as $key => $label) {
|
||||||
|
if (str_starts_with((string) $key, 'EStat::') && is_string($label)) {
|
||||||
|
$out[substr((string) $key, 7)] = mb_substr($label, 0, 80);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prozentwerte und ihr Teiler: ['CombatSpeed' => 100] (150 = 1,5 %). Feste Werte fehlen. */
|
||||||
|
function gear_planner_stat_percent(array $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ($raw as $key => $kind) {
|
||||||
|
if (str_starts_with((string) $key, 'EStat::') && ($kind['kind'] ?? '') === 'percent') {
|
||||||
|
$out[substr((string) $key, 7)] = max(1, (int) ($kind['divisor'] ?? 100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Werte-Liste [{stat, value}] => [[stat, value], …] */
|
||||||
|
function gear_planner_stat_pairs(mixed $list): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ((array) $list as $entry) {
|
||||||
|
if (is_array($entry) && is_string($entry['stat'] ?? null) && is_numeric($entry['value'] ?? null)) {
|
||||||
|
$out[] = [$entry['stat'], $entry['value'] + 0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Arcana-Karten aus der Liste aller Gegenstaende (JSON-Text), ohne die ganze Liste auszupacken. */
|
||||||
|
function gear_planner_arcana_cards(string $text): array
|
||||||
|
{
|
||||||
|
$cards = [];
|
||||||
|
$offset = 0;
|
||||||
|
while (($pos = strpos($text, '"slot":"Arcana"', $offset)) !== false) {
|
||||||
|
$offset = $pos + 1;
|
||||||
|
// Eintrag: "810130001":{"name":"Chalice of Vigor","slot":"Arcana",…}
|
||||||
|
$open = strrpos($text, '":{"name":', $pos - strlen($text));
|
||||||
|
if ($open === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$idStart = $open;
|
||||||
|
while ($idStart > 0 && ctype_digit($text[$idStart - 1])) {
|
||||||
|
$idStart--;
|
||||||
|
}
|
||||||
|
$id = (int) substr($text, $idStart, $open - $idStart);
|
||||||
|
$end = gear_planner_json_object_end($text, $open + 2);
|
||||||
|
$item = $end !== null ? json_decode(substr($text, $open + 2, $end - $open - 2), true) : null;
|
||||||
|
if ($id <= 0 || !is_array($item) || !str_starts_with((string) ($item['category'] ?? ''), 'Arcana')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$cards[] = [
|
||||||
|
'id' => $id,
|
||||||
|
'name' => mb_substr((string) ($item['name'] ?? ''), 0, 100),
|
||||||
|
'type' => substr((string) $item['category'], 6), // "ArcanaGrail" => "Grail"
|
||||||
|
'grade' => GEAR_PLANNER_GRADE_NUMBERS[(int) ($item['grade'] ?? 1)] ?? 'Common',
|
||||||
|
'level' => (int) ($item['itemLevel'] ?? 0),
|
||||||
|
'req' => (int) ($item['reqLevel'] ?? 0),
|
||||||
|
'main' => gear_planner_stat_pairs($item['mainStats'] ?? []),
|
||||||
|
'enchant' => (string) ($item['enchantEffectGroup'] ?? ''),
|
||||||
|
'sets' => array_values(array_filter((array) ($item['setNames'] ?? []), 'is_string')),
|
||||||
|
'pool' => (string) ($item['skillGroup'] ?? ''),
|
||||||
|
'slots' => (int) ($item['arcanaSlots'] ?? 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Punkte je Aufwertungsstufe: ['Arcana_EnchantEffect_Grail_Unique_1' => [1 => [['Time', 1]], …]] */
|
||||||
|
function gear_planner_arcana_enchant(array $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ($raw as $group => $levels) {
|
||||||
|
if (!str_starts_with((string) $group, 'Arcana_EnchantEffect_') || !is_array($levels)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($levels as $level => $stats) {
|
||||||
|
if (is_numeric($level)) {
|
||||||
|
$out[$group][(int) $level] = gear_planner_stat_pairs($stats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Skills, die eine Karte praegen kann: ['Arcana_Skill_Random_…' => ['Chanter' => [[Skill-ID, Name, max], …]]] */
|
||||||
|
function gear_planner_arcana_pools(array $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ((array) ($raw['groups'] ?? []) as $group => $classes) {
|
||||||
|
if (!str_starts_with((string) $group, 'Arcana_Skill_Random_') || !is_array($classes)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($classes as $class => $skills) {
|
||||||
|
foreach ((array) $skills as $skill) {
|
||||||
|
if (is_numeric($skill['id'] ?? null)) {
|
||||||
|
$out[$group][$class][] = [(int) $skill['id'], mb_substr((string) ($skill['name'] ?? ''), 0, 100), max(1, (int) ($skill['max'] ?? 4))];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Arcana-Sets mit Boni bei 2 und 4 Teilen (nur die des Global-Clients). */
|
||||||
|
function gear_planner_arcana_sets(array $raw): array
|
||||||
|
{
|
||||||
|
$sets = [];
|
||||||
|
foreach ((array) ($raw['sets'] ?? []) as $set) {
|
||||||
|
if (($set['type'] ?? '') !== 'Arcana' || !is_string($set['key'] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$bonuses = [];
|
||||||
|
foreach ((array) ($set['bonuses'] ?? []) as $bonus) {
|
||||||
|
if (is_numeric($bonus['pieces'] ?? null)) {
|
||||||
|
$bonuses[] = [(int) $bonus['pieces'], mb_substr((string) ($bonus['effect'] ?? ''), 0, 300)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sets[$set['key']] = [
|
||||||
|
'name' => mb_substr((string) ($set['name'] ?? $set['key']), 0, 100),
|
||||||
|
'members' => array_values(array_map('intval', array_column((array) ($set['members'] ?? []), 'id'))),
|
||||||
|
'bonuses' => $bonuses,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $sets ? ['sets' => $sets] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Pets: [['id', 'name', 'group', 'item', 'special'], …] */
|
||||||
|
function gear_planner_pets(array $raw): array
|
||||||
|
{
|
||||||
|
$pets = [];
|
||||||
|
foreach ((array) ($raw['pets'] ?? []) as $pet) {
|
||||||
|
if (!is_numeric($pet['id'] ?? null) || !is_string($pet['group'] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$pets[] = [
|
||||||
|
'id' => (int) $pet['id'],
|
||||||
|
'name' => mb_substr((string) ($pet['name'] ?? ''), 0, 100),
|
||||||
|
'group' => $pet['group'],
|
||||||
|
'item' => (int) ($pet['item'] ?? 0),
|
||||||
|
'special' => !empty($pet['special']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $pets ? ['pets' => $pets] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Besitz-Effekt der Pets je Gattung und Stufe: ['Feral_01' => [1 => ['GroundVehicleSpeed' => 1], …]] */
|
||||||
|
function gear_planner_pet_stats(array $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ($raw as $group => $levels) {
|
||||||
|
foreach ((array) $levels as $level => $stats) {
|
||||||
|
if (!is_numeric($level)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$out[$group][(int) $level] = [];
|
||||||
|
foreach ((array) $stats as $stat => $value) {
|
||||||
|
if (is_numeric($value)) {
|
||||||
|
$out[$group][(int) $level][(string) $stat] = $value + 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gattungs-Einsicht: Plaetze je Stufe, Verteilung der Seltenheit, Werte-Pools je Platz. */
|
||||||
|
function gear_planner_genus(array $raw): array
|
||||||
|
{
|
||||||
|
if (!is_array($raw['pools'] ?? null) || !is_array($raw['slotsByLevel'] ?? null)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$pools = [];
|
||||||
|
foreach ($raw['pools'] as $family => $slots) {
|
||||||
|
foreach ((array) $slots as $slot => $grades) {
|
||||||
|
foreach ((array) $grades as $grade => $entries) {
|
||||||
|
foreach ((array) $entries as $entry) {
|
||||||
|
if (is_string($entry['stat'] ?? null) && is_numeric($entry['max'] ?? null)) {
|
||||||
|
$pools[$family][(int) $slot][$grade][] = [$entry['stat'], $entry['min'] + 0, $entry['max'] + 0, (int) ($entry['prob'] ?? 0)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'families' => array_values(array_filter((array) ($raw['families'] ?? []), 'is_string')),
|
||||||
|
'max_level' => (int) ($raw['maxLevel'] ?? 10),
|
||||||
|
'slots_by_level' => array_map('intval', $raw['slotsByLevel']),
|
||||||
|
'grade_dist' => (array) ($raw['gradeDist'] ?? []),
|
||||||
|
'pools' => $pools,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Daevanion-Bretter: 'daevanion' (Kristalle, Bretter je Klasse) und je Klasse 'daevanion:<Klasse>' mit den
|
||||||
|
* Feldern (sonst waeren es bei jedem Seitenaufruf ueber 600 KB).
|
||||||
|
*/
|
||||||
|
function gear_planner_daevanion(array $raw): array
|
||||||
|
{
|
||||||
|
$boards = (array) ($raw['boards'] ?? []);
|
||||||
|
$out = ['daevanion' => ['max_points' => array_map('intval', (array) ($raw['maxPoints'] ?? [])), 'classes' => []]];
|
||||||
|
foreach (GEAR_PLANNER_CLASS_KEYS as $class => $key) {
|
||||||
|
$classBoards = [];
|
||||||
|
foreach ((array) ($raw['byClass'][$key] ?? []) as $boardId) {
|
||||||
|
$board = $boards[(string) $boardId] ?? null;
|
||||||
|
if (!is_array($board) || !is_array($board['nodes'] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$nodes = [];
|
||||||
|
foreach ($board['nodes'] as $node) {
|
||||||
|
if (!is_numeric($node['id'] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$nodes[] = [
|
||||||
|
'id' => (int) $node['id'],
|
||||||
|
'r' => (int) ($node['row'] ?? 0),
|
||||||
|
'c' => (int) ($node['col'] ?? 0),
|
||||||
|
'g' => (int) ($node['grade'] ?? 1),
|
||||||
|
'cost' => (int) ($node['cost'] ?? 0),
|
||||||
|
'type' => in_array($node['type'] ?? '', ['start', 'skill'], true) ? $node['type'] : 'stat',
|
||||||
|
't' => mb_substr((string) ($node['title'] ?? ''), 0, 80),
|
||||||
|
's' => gear_planner_stat_pairs($node['stats'] ?? []),
|
||||||
|
'skill' => (int) ($node['skillId'] ?? 0),
|
||||||
|
'plus' => (int) ($node['plus'] ?? 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$classBoards[] = [
|
||||||
|
'id' => (int) $board['id'],
|
||||||
|
'order' => (int) ($board['order'] ?? 0),
|
||||||
|
'need' => (int) ($board['needLevel'] ?? 0),
|
||||||
|
'title' => mb_substr((string) ($board['title'] ?? ''), 0, 60),
|
||||||
|
'point' => (string) ($board['pointType'] ?? 'DaevanionCrystal'),
|
||||||
|
'nodes' => $nodes,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if ($classBoards) {
|
||||||
|
$out['daevanion']['classes'][$class] = array_column($classBoards, 'title', 'id');
|
||||||
|
$out['daevanion:' . $class] = ['boards' => $classBoards, 'max_points' => array_map('intval', (array) ($raw['maxPointsByClass'][$key] ?? []))];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out['daevanion']['classes'] ? $out : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Closet: Gewicht je Seltenheit, Kategorien und alle Skins als [ID, Name, Kategorie, Seltenheit, Gewichts-Seltenheit, Icon]. */
|
||||||
|
function gear_planner_closet(array $raw): array
|
||||||
|
{
|
||||||
|
$items = [];
|
||||||
|
foreach ((array) ($raw['items'] ?? []) as $item) {
|
||||||
|
if (is_numeric($item['id'] ?? null) && is_string($item['cat'] ?? null)) {
|
||||||
|
$items[] = [(int) $item['id'], mb_substr((string) ($item['name'] ?? ''), 0, 100), $item['cat'], (string) ($item['grade'] ?? 'Common'),
|
||||||
|
(string) ($item['gradeInternal'] ?? $item['grade'] ?? 'Common'), (int) ($item['icon'] ?? 0)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$items) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'grade_weight' => array_map('intval', (array) ($raw['gradeWeight'] ?? [])),
|
||||||
|
'max' => (int) ($raw['maxPoints'] ?? 500),
|
||||||
|
'estimated' => !empty($raw['estimated']),
|
||||||
|
'categories' => array_map(static fn ($cat): array => ['top' => (string) ($cat['top'] ?? ''), 'stats' => array_values((array) ($cat['stats'] ?? []))], (array) ($raw['categories'] ?? [])),
|
||||||
|
'items' => $items,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Closet: Werte je Sammelpunkt einer Kategorie ("uniform") bzw. Stufen. */
|
||||||
|
function gear_planner_closet_stats(array $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ((array) ($raw['categories'] ?? []) as $cat => $def) {
|
||||||
|
$out[$cat] = [
|
||||||
|
'max' => (int) ($def['max'] ?? 500),
|
||||||
|
'per_point' => !empty($def['uniform']) ? gear_planner_stat_pairs($def['perPoint'] ?? []) : [],
|
||||||
|
'points' => array_values(array_map(static fn ($step): array => ['p' => (int) ($step['p'] ?? 0), 's' => gear_planner_stat_pairs($step['st'] ?? [])], (array) ($def['points'] ?? []))),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Pantheon: Plaetze je Art, Domaenen mit Umrechnung in Kampfwerte, Dekorationen. */
|
||||||
|
function gear_planner_pantheon(array $raw): array
|
||||||
|
{
|
||||||
|
$domains = [];
|
||||||
|
foreach ((array) ($raw['domains'] ?? []) as $domain) {
|
||||||
|
if (!is_string($domain['id'] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$domains[] = [
|
||||||
|
'id' => $domain['id'],
|
||||||
|
'name' => mb_substr((string) ($domain['name'] ?? $domain['id']), 0, 60),
|
||||||
|
'cap' => (int) ($domain['cap'] ?? 200),
|
||||||
|
'converts' => array_values(array_map(static fn ($c): array => [(string) ($c['stat'] ?? ''), $c['per'] + 0], array_filter((array) ($domain['converts'] ?? []), static fn ($c): bool => is_numeric($c['per'] ?? null)))),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$items = [];
|
||||||
|
foreach ((array) ($raw['items'] ?? []) as $item) {
|
||||||
|
if (!is_numeric($item['decoId'] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$items[] = [
|
||||||
|
'id' => (int) $item['decoId'],
|
||||||
|
'item' => (int) ($item['item'] ?? 0),
|
||||||
|
'type' => (string) ($item['type'] ?? ''),
|
||||||
|
'ui' => (string) ($item['uiType'] ?? ''),
|
||||||
|
'grade' => (string) ($item['grade'] ?? 'Common'),
|
||||||
|
'name' => mb_substr((string) ($item['name'] ?? ''), 0, 100),
|
||||||
|
'race' => (string) ($item['race'] ?? 'All'),
|
||||||
|
'domains' => array_map(static fn ($v): int => (int) $v, (array) ($item['domains'] ?? [])),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (!$items || !$domains) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return ['slots' => array_map('intval', (array) ($raw['slots'] ?? [])), 'domains' => $domains, 'items' => $items];
|
||||||
|
}
|
||||||
986
includes/gear_planner_view.php
Normal file
986
includes/gear_planner_view.php
Normal file
|
|
@ -0,0 +1,986 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gear-Planer: die Seiten Arcana, Pets, Daevanion, Pantheon und Closet eines Sets anzeigen (eingebunden von
|
||||||
|
* gear.php). Rechnen: includes/gear_planner.php. Speichern: gear_action.php (save_plan) - mit JavaScript sofort
|
||||||
|
* (assets/js/gear-plans.js), die Kaesten mit data-plan-fragment kommen dann frisch vom Server zurueck.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once __DIR__ . '/gear_planner.php';
|
||||||
|
|
||||||
|
/** Kampfwerte als Liste (Name, Wert) - englischer Name von aion2hub als Tooltip. */
|
||||||
|
function gear_plan_stats_html(array $totals, string $empty = ''): string
|
||||||
|
{
|
||||||
|
$totals = gear_stats_sorted($totals);
|
||||||
|
if (!$totals) {
|
||||||
|
return $empty !== '' ? '<p class="text-muted gear-plan-empty">' . e($empty) . '</p>' : '';
|
||||||
|
}
|
||||||
|
$html = '<dl class="gear-plan-stats">';
|
||||||
|
foreach ($totals as $stat => $value) {
|
||||||
|
$label = gear_stat_label((string) $stat);
|
||||||
|
$english = gear_stat_english((string) $stat);
|
||||||
|
$html .= '<div><dt' . ($english !== null && $english !== $label ? ' title="' . e($english) . '"' : '') . '>' . e($label) . '</dt>'
|
||||||
|
. '<dd' . ($value < 0 ? ' class="is-minus"' : '') . '>' . e(gear_stat_value((string) $stat, (float) $value)) . '</dd></div>';
|
||||||
|
}
|
||||||
|
return $html . '</dl>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Kleines Bild eines Gegenstands aus den Planer-Daten oder ein Platzhalter mit Anfangsbuchstaben. */
|
||||||
|
function gear_plan_icon_html(int $itemId, string $name, string $grade, int $size = 40): string
|
||||||
|
{
|
||||||
|
$url = gear_planner_icon_url($itemId);
|
||||||
|
$class = 'gear-plan-icon ' . gear_grade_class($grade);
|
||||||
|
if ($url !== null) {
|
||||||
|
return '<span class="' . e($class) . '" style="width:' . $size . 'px;height:' . $size . 'px"><img src="' . e($url) . '" alt="" loading="lazy"></span>';
|
||||||
|
}
|
||||||
|
return '<span class="' . e($class) . ' is-empty" style="width:' . $size . 'px;height:' . $size . 'px">' . e(mb_substr($name, 0, 1)) . '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Kopf einer Seite: Titel, Kurzfassung (schon als HTML, aus gear_plan_fragments), Speicherstatus. */
|
||||||
|
function gear_plan_head_html(array $set, string $section, string $summaryHtml, bool $isOwn): string
|
||||||
|
{
|
||||||
|
return '<div class="gear-skills-head">'
|
||||||
|
. '<h3>' . e(GEAR_PLAN_SECTIONS[$section]) . (!empty($set['class_name']) ? ' · ' . e($set['class_name']) : '') . '</h3>'
|
||||||
|
. '<span class="text-muted" data-plan-fragment="' . e($section) . '-line">' . $summaryHtml . '</span>'
|
||||||
|
. ($isOwn ? '<span class="gear-save-status" data-plan-status aria-live="polite"></span>' : '')
|
||||||
|
. '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Versteckte Felder eines Formulars zum Speichern einer Seite. */
|
||||||
|
function gear_plan_form_fields(array $set, string $section, array $extra = []): string
|
||||||
|
{
|
||||||
|
$html = csrf_field()
|
||||||
|
. '<input type="hidden" name="action" value="save_plan">'
|
||||||
|
. '<input type="hidden" name="set_id" value="' . (int) $set['id'] . '">'
|
||||||
|
. '<input type="hidden" name="section" value="' . e($section) . '">';
|
||||||
|
foreach ($extra as $name => $value) {
|
||||||
|
$html .= '<input type="hidden" name="' . e($name) . '" value="' . e((string) $value) . '">';
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Knopf fuer ohne JavaScript (mit JavaScript speichert jede Aenderung sofort, der Knopf verschwindet). */
|
||||||
|
function gear_plan_submit_html(): string
|
||||||
|
{
|
||||||
|
return '<div class="actions gear-skills-actions"><button type="submit" class="button" data-autosave-fallback>Speichern</button></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seite aus einem anderen eigenen Set uebernehmen (Pets, Pantheon und Closet sind meist in allen Sets gleich).
|
||||||
|
*
|
||||||
|
* @param array<int, array> $otherSets eigene Sets mit dieser Seite: [Set-ID => Set]
|
||||||
|
*/
|
||||||
|
function gear_plan_copy_html(array $set, string $section, array $otherSets): string
|
||||||
|
{
|
||||||
|
if (!$otherSets) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$html = '<form method="post" action="/gear_action.php" class="gear-plan-copy" data-confirm="'
|
||||||
|
. e(GEAR_PLAN_SECTIONS[$section]) . ' dieses Sets durch die aus dem gewählten Set ersetzen?" data-confirm-title="Übernehmen" data-confirm-ok="Übernehmen">'
|
||||||
|
. csrf_field()
|
||||||
|
. '<input type="hidden" name="action" value="copy_plan">'
|
||||||
|
. '<input type="hidden" name="set_id" value="' . (int) $set['id'] . '">'
|
||||||
|
. '<input type="hidden" name="section" value="' . e($section) . '">'
|
||||||
|
. '<select name="from_set" aria-label="Aus Set übernehmen" required><option value="">Aus anderem Set übernehmen …</option>';
|
||||||
|
foreach ($otherSets as $other) {
|
||||||
|
$html .= '<option value="' . (int) $other['id'] . '">' . e($other['name']) . ($other['class_name'] ? ' (' . e($other['class_name']) . ')' : '') . '</option>';
|
||||||
|
}
|
||||||
|
return $html . '</select><button type="submit" class="button button-secondary button-small">Übernehmen</button></form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Hinweis, wenn die Daten von aion2hub noch fehlen. */
|
||||||
|
function gear_plan_missing_html(string $what, bool $canManage): string
|
||||||
|
{
|
||||||
|
return '<p class="text-muted">Die Daten für ' . e($what) . ' sind noch nicht da' . ($canManage ? '' : ' – die Leitung muss sie erst übernehmen') . '.'
|
||||||
|
. ($canManage ? ' <a href="/admin/gear_items.php#planner">Jetzt von aion2hub übernehmen</a>' : '') . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eine der fuenf Seiten eines Sets.
|
||||||
|
*
|
||||||
|
* @param array<int, array> $copySets eigene andere Sets mit dieser Seite (zum Uebernehmen)
|
||||||
|
*/
|
||||||
|
function gear_render_plan_tab(array $set, string $section, array $plan, bool $isOwn, bool $canManage, array $copySets): void
|
||||||
|
{
|
||||||
|
$class = !empty($set['class_name']) ? (string) $set['class_name'] : null;
|
||||||
|
echo '<div class="panel gear-plan gear-plan-' . e($section) . '" id="plan">';
|
||||||
|
if (!gear_plan_ready($section, $class)) {
|
||||||
|
echo gear_plan_head_html($set, $section, '', false);
|
||||||
|
if ($section === 'daevanion' && $class === null) {
|
||||||
|
echo '<p class="text-muted">' . ($isOwn ? 'Wähle unter „Bearbeiten“ eine Klasse für das Set – die Daevanion-Bretter hängen von der Klasse ab.' : 'Für dieses Set ist keine Klasse gewählt.') . '</p>';
|
||||||
|
} else {
|
||||||
|
echo gear_plan_missing_html(GEAR_PLAN_SECTIONS[$section], $canManage);
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
match ($section) {
|
||||||
|
'arcana' => gear_render_arcana($set, $plan, $isOwn),
|
||||||
|
'pets' => gear_render_pets($set, $plan, $isOwn),
|
||||||
|
'daevanion' => gear_render_daevanion($set, $plan, $isOwn),
|
||||||
|
'pantheon' => gear_render_pantheon($set, $plan, $isOwn),
|
||||||
|
'closet' => gear_render_closet($set, $plan, $isOwn),
|
||||||
|
};
|
||||||
|
if ($isOwn) {
|
||||||
|
echo gear_plan_copy_html($set, $section, $copySets);
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kaesten, die sich beim Speichern aendern (Kurzfassung, Summen) - fuer gear.php und die Antwort von save_plan.
|
||||||
|
*
|
||||||
|
* @return array<string, string> [data-plan-fragment => HTML]
|
||||||
|
*/
|
||||||
|
function gear_plan_fragments(string $section, array $set, array $plan): array
|
||||||
|
{
|
||||||
|
$class = !empty($set['class_name']) ? (string) $set['class_name'] : null;
|
||||||
|
switch ($section) {
|
||||||
|
case 'arcana':
|
||||||
|
$data = gear_arcana_data();
|
||||||
|
$totals = gear_arcana_totals($plan, $data);
|
||||||
|
$out = ['arcana-line' => e(gear_arcana_line($plan, $totals, $data)), 'arcana-summary' => gear_arcana_summary_html($totals, $data, $class)];
|
||||||
|
// Je Platz: Name mit Aufwertung und Punkte der Karte (aendern sich mit der Aufwertung)
|
||||||
|
foreach ($data['types'] as $type) {
|
||||||
|
$slot = $plan['slots'][$type] ?? null;
|
||||||
|
$card = $slot ? ($data['cards'][(int) $slot['card']] ?? null) : null;
|
||||||
|
$out['arcana-title-' . $type] = gear_arcana_title_html($type, $card, $card ? (int) $slot['enchant'] : 0);
|
||||||
|
$out['arcana-points-' . $type] = $card ? gear_arcana_points_html($card, (int) $slot['enchant'], $data) : '';
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
case 'pets':
|
||||||
|
$data = gear_pets_data();
|
||||||
|
$totals = gear_pets_totals($plan, $data);
|
||||||
|
return ['pets-line' => e(gear_pets_line($totals, $data)), 'pets-summary' => gear_pets_summary_html($totals, $data)];
|
||||||
|
case 'daevanion':
|
||||||
|
$totals = gear_daevanion_totals($plan, (string) $class);
|
||||||
|
$out = ['daevanion-line' => e(gear_daevanion_line($totals, (string) $class)), 'daevanion-summary' => gear_daevanion_summary_html($totals, $class)];
|
||||||
|
foreach (gear_daevanion_boards((string) $class) as $board) {
|
||||||
|
$out['dv-board-' . $board['id']] = gear_daevanion_board_side_html($board, $totals, $class);
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
case 'pantheon':
|
||||||
|
$data = gear_pantheon_data();
|
||||||
|
$totals = gear_pantheon_totals($plan, $data);
|
||||||
|
return ['pantheon-line' => e(gear_pantheon_line($totals, $data)), 'pantheon-summary' => gear_pantheon_summary_html($totals, $data)];
|
||||||
|
case 'closet':
|
||||||
|
$data = gear_closet_data();
|
||||||
|
$totals = gear_closet_totals($plan, $class, $data);
|
||||||
|
$out = ['closet-line' => e(gear_closet_line($totals)), 'closet-summary' => gear_closet_summary_html($totals, $data)];
|
||||||
|
// Je Kategorie: Punkte, Wert und abgehakte Skins (aendern sich mit den Skins)
|
||||||
|
foreach ($totals['cats'] as $cat => $row) {
|
||||||
|
$out['closet-points-' . $cat] = gear_closet_points_cell_html($row, $data);
|
||||||
|
$out['closet-stat-' . $cat] = gear_closet_stat_cell_html((string) $cat, $row, $data);
|
||||||
|
$out['closet-count-' . $cat] = $row['owned'] . '/' . $row['total'];
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Namen und Icons der Skills einer Klasse (fuer Arcana- und Daevanion-Boni): [ID => Skill-Zeile] */
|
||||||
|
function gear_plan_class_skills(?string $class): array
|
||||||
|
{
|
||||||
|
static $cache = [];
|
||||||
|
return $cache[$class ?? ''] ??= gear_skills_for_class($class, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Name eines Skills: deutsch, wenn die Leitung ihn eingetragen hat, sonst wie bei aion2hub. */
|
||||||
|
function gear_plan_skill_name(int $skillId, ?string $class, string $fallback): string
|
||||||
|
{
|
||||||
|
$skill = gear_plan_class_skills($class)[$skillId] ?? null;
|
||||||
|
return $skill ? gear_skill_display_name($skill) : ($fallback !== '' ? $fallback : 'Skill ' . $skillId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Skill-Boni als Liste: [Skill-ID => +n] */
|
||||||
|
function gear_plan_skill_bonus_html(array $skills, ?string $class, array $names = []): string
|
||||||
|
{
|
||||||
|
if (!$skills) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$rows = [];
|
||||||
|
foreach ($skills as $skillId => $plus) {
|
||||||
|
$rows[] = [gear_plan_skill_name((int) $skillId, $class, (string) ($names[$skillId] ?? '')), (int) $plus, gear_skill_icon_url(gear_plan_class_skills($class)[(int) $skillId] ?? null)];
|
||||||
|
}
|
||||||
|
usort($rows, static fn (array $a, array $b): int => [-$a[1], $a[0]] <=> [-$b[1], $b[0]]);
|
||||||
|
$html = '<ul class="gear-plan-skill-bonus">';
|
||||||
|
foreach ($rows as [$name, $plus, $icon]) {
|
||||||
|
$html .= '<li>' . ($icon ? '<img src="' . e($icon) . '" alt="" width="22" height="22" loading="lazy">' : '<span class="gear-plan-skill-dot"></span>')
|
||||||
|
. '<span>' . e($name) . '</span><strong>+' . $plus . '</strong></li>';
|
||||||
|
}
|
||||||
|
return $html . '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Arcana ----
|
||||||
|
|
||||||
|
function gear_arcana_line(array $plan, array $totals, array $data): string
|
||||||
|
{
|
||||||
|
$count = count($plan['slots'] ?? []);
|
||||||
|
if ($count === 0) {
|
||||||
|
return 'Noch keine Karte eingesetzt.';
|
||||||
|
}
|
||||||
|
return $count . ' von ' . count($data['types']) . ' Plätzen belegt · ' . (int) array_sum($totals['domains']) . ' Domänenpunkte'
|
||||||
|
. ($totals['skills'] ? ' · ' . array_sum($totals['skills']) . ' Skillstufen' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Kopf eines Arcana-Platzes: Art, Karte mit Aufwertung, Seltenheit und Stufe. */
|
||||||
|
function gear_arcana_title_html(string $type, ?array $card, int $enchant): string
|
||||||
|
{
|
||||||
|
$html = '<span class="gear-arcana-type">' . e(GEAR_ARCANA_TYPES[$type] ?? $type) . '</span>';
|
||||||
|
if (!$card) {
|
||||||
|
return $html . '<span class="text-muted">leer</span>';
|
||||||
|
}
|
||||||
|
return $html . '<strong class="' . e(gear_grade_class($card['grade'])) . '">' . e($card['name']) . ($enchant > 0 ? ' +' . $enchant : '') . '</strong>'
|
||||||
|
. '<span class="text-muted">' . e($card['grade']) . ' · Stufe ' . (int) $card['level'] . ($card['req'] ? ' · ab Charakterstufe ' . (int) $card['req'] : '') . '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Domaenenpunkte einer Karte bei ihrer Aufwertung und ihr Set. */
|
||||||
|
function gear_arcana_points_html(array $card, int $enchant, array $data): string
|
||||||
|
{
|
||||||
|
$html = '';
|
||||||
|
foreach (gear_arcana_card_points($card, $enchant, $data) as $domain => $value) {
|
||||||
|
$html .= '<span class="gear-plan-chip">' . e(gear_domain_label((string) $domain)) . ' <strong>' . (int) $value . '</strong></span>';
|
||||||
|
}
|
||||||
|
foreach ($card['sets'] as $setKey) {
|
||||||
|
if (isset($data['sets'][$setKey])) {
|
||||||
|
$html .= '<span class="gear-plan-chip gear-plan-chip-set" title="Set">◇ ' . e($data['sets'][$setKey]['name']) . '</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_arcana_summary_html(array $totals, array $data, ?string $class): string
|
||||||
|
{
|
||||||
|
$html = '<h4 class="gear-skills-kind">Domänen</h4>';
|
||||||
|
if (!$totals['domains']) {
|
||||||
|
$html .= '<p class="text-muted gear-plan-empty">Setz eine Karte ein – jede gibt Punkte in einer Domäne der Götter.</p>';
|
||||||
|
} else {
|
||||||
|
$html .= '<dl class="gear-plan-stats">';
|
||||||
|
foreach (array_keys(GEAR_DOMAINS) as $domain) {
|
||||||
|
if (!empty($totals['domains'][$domain])) {
|
||||||
|
$html .= '<div><dt>' . e(gear_domain_label($domain)) . '</dt><dd>' . (int) $totals['domains'][$domain] . '</dd></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$html .= '</dl>';
|
||||||
|
}
|
||||||
|
$html .= '<h4 class="gear-skills-kind">Kampfwerte</h4>' . gear_plan_stats_html($totals['stats'], 'Noch keine.');
|
||||||
|
if ($totals['skills']) {
|
||||||
|
$names = [];
|
||||||
|
foreach ($data['pools'] as $classes) {
|
||||||
|
foreach ($classes[GEAR_PLANNER_CLASS_KEYS[$class ?? ''] ?? ''] ?? [] as [$id, $name]) {
|
||||||
|
$names[$id] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$html .= '<h4 class="gear-skills-kind">Skill-Boni</h4>' . gear_plan_skill_bonus_html($totals['skills'], $class, $names);
|
||||||
|
}
|
||||||
|
if ($totals['sets']) {
|
||||||
|
$html .= '<h4 class="gear-skills-kind">Set-Effekte</h4>';
|
||||||
|
foreach ($totals['sets'] as $key => $pieces) {
|
||||||
|
$set = $data['sets'][$key] ?? null;
|
||||||
|
if (!$set) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$html .= '<div class="gear-arcana-set-bonus"><strong>' . e($set['name']) . '</strong> <span class="text-muted">· ' . (int) $pieces . ' ' . ($pieces === 1 ? 'Teil' : 'Teile') . '</span><ul>';
|
||||||
|
foreach ($set['bonuses'] as [$need, $effect]) {
|
||||||
|
$html .= '<li class="' . ($pieces >= $need ? 'is-on' : '') . '"><span>' . (int) $need . '</span>' . e($effect) . '</li>';
|
||||||
|
}
|
||||||
|
$html .= '</ul></div>';
|
||||||
|
}
|
||||||
|
$html .= '<p class="gear-hint text-muted">Set-Effekte sind Bedingungs-Boni im Kampf (Text von aion2hub) und zählen nicht in die Werte.</p>';
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_render_arcana(array $set, array $plan, bool $isOwn): void
|
||||||
|
{
|
||||||
|
$data = gear_arcana_data();
|
||||||
|
$class = !empty($set['class_name']) ? (string) $set['class_name'] : null;
|
||||||
|
$fragments = gear_plan_fragments('arcana', $set, $plan);
|
||||||
|
$totals = gear_arcana_totals($plan, $data);
|
||||||
|
echo gear_plan_head_html($set, 'arcana', $fragments['arcana-line'], $isOwn);
|
||||||
|
?>
|
||||||
|
<p class="gear-hint text-muted gear-skills-legend">
|
||||||
|
Arcana-Karten geben Punkte in einer Domäne der Götter (z. B. Zeit [Siel]), die in Kampfwerte umgerechnet werden. Beim Aufwerten
|
||||||
|
prägt jede Karte zufällig Skills deiner Klasse – so viele Skillstufen wie die Karte Plätze hat plus die Aufwertung, je Skill bis +4.
|
||||||
|
Karten eines Sets geben mit 2 und 4 Teilen einen Set-Effekt.
|
||||||
|
</p>
|
||||||
|
<details class="gear-skills-details">
|
||||||
|
<summary>Stand der Daten</summary>
|
||||||
|
<p class="gear-hint text-muted">
|
||||||
|
Karten, Punkte je Aufwertung, Skill-Pools und Sets aus dem Global-Client (über den Build-Planer von aion2hub). Auf Global gibt es
|
||||||
|
bisher <?= count($data['types']) ?> Kartenarten mit je vier Seltenheiten – weitere Plätze erscheinen hier, sobald es Karten dafür gibt.
|
||||||
|
Namen der Karten und Set-Effekte sind englisch wie bei aion2hub.
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
<div class="gear-plan-layout">
|
||||||
|
<div class="gear-plan-main">
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<form method="post" action="/gear_action.php" class="gear-arcana-form" data-plan-form>
|
||||||
|
<?= gear_plan_form_fields($set, 'arcana') ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($isOwn && $class === null): ?>
|
||||||
|
<p class="gear-hint text-muted">Wähle unter „Bearbeiten“ eine Klasse für das Set – erst dann lassen sich die geprägten Skills auswählen.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="gear-arcana-grid">
|
||||||
|
<?php foreach ($data['types'] as $type): ?>
|
||||||
|
<?php
|
||||||
|
$slot = $plan['slots'][$type] ?? null;
|
||||||
|
$card = $slot ? ($data['cards'][(int) $slot['card']] ?? null) : null;
|
||||||
|
$enchant = $card ? (int) $slot['enchant'] : 0;
|
||||||
|
if (!$isOwn && !$card) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$typeLabel = GEAR_ARCANA_TYPES[$type] ?? $type;
|
||||||
|
?>
|
||||||
|
<div class="gear-arcana-slot<?= $card ? ' is-filled ' . e(gear_grade_class($card['grade'])) : '' ?>" data-arcana-slot="<?= e($type) ?>">
|
||||||
|
<div class="gear-arcana-head">
|
||||||
|
<?= $card ? gear_plan_icon_html((int) $card['id'], $card['name'], $card['grade'], 44) : '<span class="gear-plan-icon is-empty" style="width:44px;height:44px">' . e(mb_substr($typeLabel, 0, 1)) . '</span>' ?>
|
||||||
|
<div class="gear-arcana-title" data-plan-fragment="arcana-title-<?= e($type) ?>"><?= gear_arcana_title_html($type, $card, $enchant) ?></div>
|
||||||
|
</div>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<div class="gear-arcana-pick">
|
||||||
|
<select name="slot[<?= e($type) ?>][card]" aria-label="Karte für <?= e($typeLabel) ?>" data-plan-reload>
|
||||||
|
<option value="0">– keine Karte –</option>
|
||||||
|
<?php foreach ($data['by_type'][$type] as $cardId): ?>
|
||||||
|
<?php $option = $data['cards'][$cardId]; ?>
|
||||||
|
<option value="<?= (int) $cardId ?>"<?= $card && (int) $card['id'] === $cardId ? ' selected' : '' ?>><?= e($option['name']) ?> (<?= e($option['grade']) ?>)</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<?php if ($card && (int) $card['max'] > 0): ?>
|
||||||
|
<select name="slot[<?= e($type) ?>][enchant]" aria-label="Aufwertung" data-arcana-enchant>
|
||||||
|
<?php for ($level = 0; $level <= (int) $card['max']; $level++): ?>
|
||||||
|
<option value="<?= $level ?>"<?= $enchant === $level ? ' selected' : '' ?>>+<?= $level ?></option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($card): ?>
|
||||||
|
<div class="gear-arcana-points" data-plan-fragment="arcana-points-<?= e($type) ?>"><?= gear_arcana_points_html($card, $enchant, $data) ?></div>
|
||||||
|
<?php
|
||||||
|
$pool = gear_arcana_pool($card, $class, $data);
|
||||||
|
$budget = gear_arcana_skill_budget($card, $enchant);
|
||||||
|
$chosen = array_values((array) ($slot['skills'] ?? []));
|
||||||
|
$used = array_sum(array_map(static fn (array $entry): int => (int) $entry[1], $chosen));
|
||||||
|
$levelMax = $pool ? max(array_map(static fn (array $entry): int => (int) $entry[1], $pool)) : 0;
|
||||||
|
?>
|
||||||
|
<?php if ($pool && ((int) $card['slots'] > 0) && ($isOwn || $chosen)): ?>
|
||||||
|
<div class="gear-arcana-skills" data-arcana-skills data-budget="<?= $budget ?>" data-base="<?= (int) $card['slots'] ?>">
|
||||||
|
<div class="gear-arcana-skills-head">
|
||||||
|
<span>Geprägte Skills</span>
|
||||||
|
<span class="gear-parts-count" data-arcana-used><?= $used ?>/<?= $budget ?> Stufen</span>
|
||||||
|
</div>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<?php for ($i = 0; $i < (int) $card['slots']; $i++): ?>
|
||||||
|
<?php [$pickId, $pickLevel] = [(int) ($chosen[$i][0] ?? 0), (int) ($chosen[$i][1] ?? 1)]; ?>
|
||||||
|
<div class="gear-arcana-skill-row">
|
||||||
|
<select name="slot[<?= e($type) ?>][skill][<?= $i ?>]" aria-label="Skill <?= $i + 1 ?>" data-arcana-skill>
|
||||||
|
<option value="0">– kein Skill –</option>
|
||||||
|
<?php foreach ($pool as $skillId => [$skillName, $skillMax]): ?>
|
||||||
|
<option value="<?= (int) $skillId ?>" data-max="<?= (int) $skillMax ?>"<?= $pickId === $skillId ? ' selected' : '' ?>><?= e(gear_plan_skill_name((int) $skillId, $class, $skillName)) ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<select name="slot[<?= e($type) ?>][level][<?= $i ?>]" aria-label="Stufe von Skill <?= $i + 1 ?>" data-arcana-level>
|
||||||
|
<?php for ($level = 1; $level <= $levelMax; $level++): ?>
|
||||||
|
<option value="<?= $level ?>"<?= $pickLevel === $level ? ' selected' : '' ?>>+<?= $level ?></option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<?php endfor; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= gear_plan_skill_bonus_html(array_column($chosen, 1, 0), $class, array_map(static fn (array $entry): string => $entry[0], $pool)) ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php if (!$isOwn && !$plan): ?><p class="text-muted">Keine Arcana geplant.</p><?php endif; ?>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<?= gear_plan_submit_html() ?>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<aside class="gear-plan-summary" data-plan-fragment="arcana-summary"><?= $fragments['arcana-summary'] ?></aside>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Pets ----
|
||||||
|
|
||||||
|
function gear_pets_line(array $totals, array $data): string
|
||||||
|
{
|
||||||
|
$insight = count(array_filter($totals['families']));
|
||||||
|
return $totals['owned'] . ' von ' . count($data['pets']) . ' Pets' . ($insight ? ' · Einsicht in ' . $insight . ($insight === 1 ? ' Gattung' : ' Gattungen') : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_pets_summary_html(array $totals, array $data): string
|
||||||
|
{
|
||||||
|
return '<h4 class="gear-skills-kind">Besitz-Effekte <span class="gear-skills-kind-count">' . $totals['owned'] . ' von ' . count($data['pets']) . ' Pets</span></h4>'
|
||||||
|
. gear_plan_stats_html($totals['pets'], 'Setz ein Pet auf Stufe 1 oder höher – dann wirkt sein Besitz-Effekt immer.')
|
||||||
|
. '<h4 class="gear-skills-kind">Gattungs-Einsicht</h4>'
|
||||||
|
. gear_plan_stats_html($totals['insight'], 'Noch keine Einsicht geplant.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Ein Pet in der Sammlung: Bild, Name, Gattung, Stufe (eigenes Set: Auswahl, besondere Pets: haben oder nicht). */
|
||||||
|
function gear_pet_card_html(array $pet, int $level, int $maxLevel, bool $isOwn): string
|
||||||
|
{
|
||||||
|
$html = '<div class="gear-pet' . ($level > 0 ? ' is-on' : '') . '" data-filter-item data-filter-key="' . e($pet['family']) . '" data-filter-text="' . e(mb_strtolower($pet['name'])) . '">'
|
||||||
|
. gear_plan_icon_html((int) $pet['item'], $pet['name'], $pet['special'] ? 'Unique' : 'Common', 36)
|
||||||
|
. '<span class="gear-pet-info"><span class="gear-pet-name">' . e($pet['name']) . '</span>'
|
||||||
|
. '<span class="gear-pet-family">' . e(GEAR_PET_FAMILIES[$pet['family']] ?? $pet['family']) . ($pet['special'] ? ' · immer +' . $maxLevel : '') . '</span></span>';
|
||||||
|
if (!$isOwn) {
|
||||||
|
return $html . '<span class="gear-pet-level">' . ($level >= $maxLevel ? 'Max' : 'Stufe ' . $level) . '</span></div>';
|
||||||
|
}
|
||||||
|
if ($pet['special']) {
|
||||||
|
return $html . '<label class="gear-pet-toggle"><input type="checkbox" name="pet[' . (int) $pet['id'] . ']" value="' . $maxLevel . '"' . ($level > 0 ? ' checked' : '') . ' data-pet-level> Habe ich</label></div>';
|
||||||
|
}
|
||||||
|
$html .= '<select name="pet[' . (int) $pet['id'] . ']" aria-label="Stufe von ' . e($pet['name']) . '" data-pet-level><option value="0">–</option>';
|
||||||
|
for ($l = 1; $l <= $maxLevel; $l++) {
|
||||||
|
$html .= '<option value="' . $l . '"' . ($level === $l ? ' selected' : '') . '>' . ($l === $maxLevel ? $l . ' Max' : $l) . '</option>';
|
||||||
|
}
|
||||||
|
return $html . '</select></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_render_pets(array $set, array $plan, bool $isOwn): void
|
||||||
|
{
|
||||||
|
$data = gear_pets_data();
|
||||||
|
$fragments = gear_plan_fragments('pets', $set, $plan);
|
||||||
|
$families = gear_pet_families($data);
|
||||||
|
$maxLevel = (int) $data['max_level'];
|
||||||
|
$genus = $data['genus'];
|
||||||
|
echo gear_plan_head_html($set, 'pets', $fragments['pets-line'], $isOwn);
|
||||||
|
?>
|
||||||
|
<p class="gear-hint text-muted gear-skills-legend">
|
||||||
|
Jedes Pet, das du auf Stufe 1–<?= $maxLevel ?> bringst, gibt dauerhaft einen Besitz-Effekt – je nach Gattung (Cogni, Fera, Natura,
|
||||||
|
Varian). Besondere Pets hat man oder nicht, sie zählen immer mit Stufe <?= $maxLevel ?>. Die Gattungs-Einsicht würfelt je Gattung
|
||||||
|
zusätzliche Werte (unten).
|
||||||
|
</p>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<form method="post" action="/gear_action.php" class="gear-pets-form" data-plan-form>
|
||||||
|
<?= gear_plan_form_fields($set, 'pets') ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="gear-plan-layout">
|
||||||
|
<div class="gear-plan-main">
|
||||||
|
<?php
|
||||||
|
$owned = $plan['pets'] ?? [];
|
||||||
|
$counts = [];
|
||||||
|
foreach ($data['pets'] as $pet) {
|
||||||
|
$counts[$pet['family']] ??= [0, 0];
|
||||||
|
$counts[$pet['family']][1]++;
|
||||||
|
if (!empty($owned[$pet['id']])) {
|
||||||
|
$counts[$pet['family']][0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="gear-plan-filter" data-plan-filter="pet" role="group" aria-label="Gattung">
|
||||||
|
<button type="button" class="gear-tab is-active" data-filter-value="">Alle <span class="gear-tab-count" data-filter-count=""><?= count(array_filter($owned)) ?>/<?= count($data['pets']) ?></span></button>
|
||||||
|
<?php foreach ($families as $family): ?>
|
||||||
|
<button type="button" class="gear-tab" data-filter-value="<?= e($family) ?>"><?= e(GEAR_PET_FAMILIES[$family]) ?> <span class="gear-tab-count" data-filter-count="<?= e($family) ?>"><?= $counts[$family][0] ?>/<?= $counts[$family][1] ?></span></button>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<div class="gear-plan-tools" data-plan-tools hidden>
|
||||||
|
<input type="search" placeholder="Pet suchen …" aria-label="Pet suchen" data-filter-search>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<button type="button" class="button button-secondary button-small" data-pets-bulk="max">Gezeigte auf Max</button>
|
||||||
|
<button type="button" class="button button-secondary button-small" data-pets-bulk="0">Gezeigte leeren</button>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="gear-pet-grid">
|
||||||
|
<?php
|
||||||
|
// Ueber 200 Pets: als kompakte Zeilen (gear_pet_card_html), sonst waere die Seite zur Haelfte Einrueckung
|
||||||
|
foreach ($data['pets'] as $pet) {
|
||||||
|
$level = (int) ($owned[$pet['id']] ?? 0);
|
||||||
|
if ($isOwn || $level > 0) {
|
||||||
|
echo gear_pet_card_html($pet, $level, $maxLevel, $isOwn), "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php if (!$isOwn && !$owned): ?><p class="text-muted">Keine Pets geplant.</p><?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($genus): ?>
|
||||||
|
<h4 class="gear-skills-kind">Gattungs-Einsicht</h4>
|
||||||
|
<p class="gear-hint text-muted">
|
||||||
|
Je Gattung eine Stufe 1–<?= (int) $genus['max_level'] ?>: jede Stufe öffnet Plätze, jeder Platz würfelt einen Wert in einer Seltenheit
|
||||||
|
(je höher die Stufe, desto öfter besser). Gezeigt wird jeweils der beste Wurf – als Obergrenze zum Planen, nicht dein genauer Wurf.
|
||||||
|
</p>
|
||||||
|
<div class="gear-insight-grid">
|
||||||
|
<?php foreach ($genus['families'] as $family): ?>
|
||||||
|
<?php
|
||||||
|
$entry = $plan['insight'][$family] ?? ['level' => 0, 'slots' => []];
|
||||||
|
$level = (int) $entry['level'];
|
||||||
|
$slotCount = gear_genus_slots($genus, $level);
|
||||||
|
if (!$isOwn && $level === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$grades = gear_genus_grades($genus, $family, $level);
|
||||||
|
?>
|
||||||
|
<fieldset class="gear-fieldset gear-insight">
|
||||||
|
<legend><?= e(GEAR_PET_FAMILIES[$family] ?? $family) ?></legend>
|
||||||
|
<div class="gear-insight-level">
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<label>Stufe
|
||||||
|
<select name="insight[<?= e($family) ?>][level]" data-plan-reload>
|
||||||
|
<option value="0">–</option>
|
||||||
|
<?php for ($l = 1; $l <= (int) $genus['max_level']; $l++): ?>
|
||||||
|
<option value="<?= $l ?>"<?= $level === $l ? ' selected' : '' ?>><?= $l ?></option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<?php else: ?>
|
||||||
|
<span>Stufe <?= $level ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<span class="text-muted"><?= $slotCount ?> <?= $slotCount === 1 ? 'Platz' : 'Plätze' ?></span>
|
||||||
|
</div>
|
||||||
|
<?php for ($slot = 1; $slot <= $slotCount; $slot++): ?>
|
||||||
|
<?php [$pickGrade, $pickStat] = $entry['slots'][$slot] ?? ['', '']; ?>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<select name="insight[<?= e($family) ?>][slot][<?= $slot ?>]" aria-label="Platz <?= $slot ?>" class="gear-insight-slot">
|
||||||
|
<option value="">Platz <?= $slot ?>: –</option>
|
||||||
|
<?php foreach ($grades as $grade => $share): ?>
|
||||||
|
<optgroup label="<?= e($grade . ' · ' . gear_format_value($share / 100) . ' %') ?>">
|
||||||
|
<?php foreach (gear_genus_pool($genus, $family, $slot, $grade) as $stat => [$min, $max]): ?>
|
||||||
|
<option value="<?= e($grade . '|' . $stat) ?>"<?= $pickGrade === $grade && $pickStat === $stat ? ' selected' : '' ?>><?= e(gear_stat_label($stat) . ' ' . gear_stat_value($stat, (float) $max)) ?> (<?= e($grade) ?>)</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</optgroup>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<?php elseif ($pickStat !== ''): ?>
|
||||||
|
<?php $max = gear_genus_pool($genus, $family, $slot, $pickGrade)[$pickStat][1] ?? 0; ?>
|
||||||
|
<div class="gear-insight-pick"><span class="<?= e(gear_grade_class($pickGrade)) ?>"><?= e($pickGrade) ?></span> <?= e(gear_stat_label($pickStat) . ' ' . gear_stat_value($pickStat, (float) $max)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</fieldset>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($isOwn): ?><?= gear_plan_submit_html() ?><?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<aside class="gear-plan-summary" data-plan-fragment="pets-summary"><?= $fragments['pets-summary'] ?></aside>
|
||||||
|
</div>
|
||||||
|
<?php if ($isOwn): ?></form><?php endif; ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Daevanion ----
|
||||||
|
|
||||||
|
function gear_daevanion_line(array $totals, string $class): string
|
||||||
|
{
|
||||||
|
$parts = [];
|
||||||
|
foreach ($totals['spent'] as $point => $spent) {
|
||||||
|
$parts[] = $spent . '/' . gear_daevanion_max((string) $point, $class) . ' ' . gear_daevanion_point_label((string) $point);
|
||||||
|
}
|
||||||
|
if (!$parts) {
|
||||||
|
return 'Noch nichts aktiviert.';
|
||||||
|
}
|
||||||
|
return implode(' · ', $parts) . ($totals['skills'] ? ' · ' . array_sum($totals['skills']) . ' Skillstufen' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Rechte Spalte eines Bretts: Felder, Werte und Skill-Boni dieses Bretts. */
|
||||||
|
function gear_daevanion_board_side_html(array $board, array $totals, ?string $class): string
|
||||||
|
{
|
||||||
|
$boardTotals = $totals['boards'][(int) $board['id']] ?? ['count' => 0, 'total' => count($board['nodes']), 'stats' => [], 'skills' => []];
|
||||||
|
$names = [];
|
||||||
|
foreach ($board['nodes'] as $node) {
|
||||||
|
if ($node['type'] === 'skill') {
|
||||||
|
$names[$node['skill']] = $node['t'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '<p class="gear-dv-count"><strong>' . $boardTotals['count'] . '</strong> von ' . $boardTotals['total'] . ' Feldern</p>'
|
||||||
|
. gear_plan_stats_html($boardTotals['stats'])
|
||||||
|
. gear_plan_skill_bonus_html($boardTotals['skills'], $class, $names);
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_daevanion_summary_html(array $totals, ?string $class): string
|
||||||
|
{
|
||||||
|
$names = [];
|
||||||
|
foreach (gear_daevanion_boards((string) $class) as $board) {
|
||||||
|
foreach ($board['nodes'] as $node) {
|
||||||
|
if ($node['type'] === 'skill') {
|
||||||
|
$names[$node['skill']] = $node['t'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '<h4 class="gear-skills-kind">Werte aller Bretter</h4>' . gear_plan_stats_html($totals['stats'], 'Noch nichts aktiviert.')
|
||||||
|
. ($totals['skills'] ? '<h4 class="gear-skills-kind">Skill-Boni</h4>' . gear_plan_skill_bonus_html($totals['skills'], $class, $names) : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Tooltip eines Feldes: "Epic · Kampfgeschwindigkeit +1,5 % · 4 Kristalle" */
|
||||||
|
function gear_daevanion_node_title(array $node, ?string $class): string
|
||||||
|
{
|
||||||
|
$grade = GEAR_PLANNER_GRADE_NUMBERS[(int) $node['g']] ?? 'Common';
|
||||||
|
if ($node['type'] === 'start') {
|
||||||
|
return 'Startfeld';
|
||||||
|
}
|
||||||
|
$cost = (int) $node['cost'] . ' ' . ((int) $node['cost'] === 1 ? 'Kristall' : 'Kristalle');
|
||||||
|
if ($node['type'] === 'skill') {
|
||||||
|
return $grade . ' · ' . gear_plan_skill_name((int) $node['skill'], $class, (string) $node['t']) . ' +' . (int) $node['plus'] . ' · ' . $cost;
|
||||||
|
}
|
||||||
|
$stats = array_map(static fn (array $s): string => gear_stat_label((string) $s[0]) . ' ' . gear_stat_value((string) $s[0], (float) $s[1]), $node['s']);
|
||||||
|
return $grade . ' · ' . implode(', ', $stats) . ' · ' . $cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ein Feld eines Bretts (eigenes Set: zum Anhaken). Position im Raster, Seltenheit als Farbe, Linien zu
|
||||||
|
* aktiven Nachbarn rechts/unten (link-r/link-d), Skillfelder mit dem Icon des Skills.
|
||||||
|
*
|
||||||
|
* @param array<int, true> $chosen gewaehlte Felder
|
||||||
|
* @param array<string, int> $at Feld-ID je "Reihe,Spalte"
|
||||||
|
*/
|
||||||
|
function gear_daevanion_node_html(array $node, int $minR, int $minC, array $chosen, array $at, array $skills, ?string $class, bool $isOwn): string
|
||||||
|
{
|
||||||
|
$id = (int) $node['id'];
|
||||||
|
$on = isset($chosen[$id]);
|
||||||
|
$right = $at[$node['r'] . ',' . ($node['c'] + 1)] ?? null;
|
||||||
|
$down = $at[($node['r'] + 1) . ',' . $node['c']] ?? null;
|
||||||
|
$grade = strtolower(GEAR_PLANNER_GRADE_NUMBERS[(int) $node['g']] ?? 'Common');
|
||||||
|
$classes = 'gear-dv-node grade-' . $grade . ' is-' . $node['type'] . ($on ? ' is-on' : '')
|
||||||
|
. ($on && $right !== null && isset($chosen[$right]) ? ' link-r' : '') . ($on && $down !== null && isset($chosen[$down]) ? ' link-d' : '');
|
||||||
|
$skillIcon = $node['type'] === 'skill' ? gear_skill_icon_url($skills[(int) $node['skill']] ?? null) : null;
|
||||||
|
$inner = match (true) {
|
||||||
|
$skillIcon !== null => '<img src="' . e($skillIcon) . '" alt="" loading="lazy">',
|
||||||
|
$node['type'] === 'start' => '◆',
|
||||||
|
$node['type'] === 'skill' => '<i class="gear-dv-skill-dot"></i>',
|
||||||
|
default => '<i class="gear-dv-dot"></i>',
|
||||||
|
};
|
||||||
|
$title = e(gear_daevanion_node_title($node, $class));
|
||||||
|
$tag = $isOwn ? 'label' : 'span';
|
||||||
|
return '<' . $tag . ' class="' . $classes . '" style="grid-area:' . ($node['r'] - $minR + 1) . '/' . ($node['c'] - $minC + 1) . '" title="' . $title . '"'
|
||||||
|
. ' data-node="' . $id . '" data-r="' . (int) $node['r'] . '" data-c="' . (int) $node['c'] . '" data-cost="' . ($node['type'] === 'start' ? 0 : (int) $node['cost']) . '" data-type="' . e($node['type']) . '">'
|
||||||
|
. ($isOwn ? '<input type="checkbox" name="node[]" value="' . $id . '"' . ($on ? ' checked' : '') . ' aria-label="' . $title . '">' : '')
|
||||||
|
. '<span class="gear-dv-cell">' . $inner . '</span></' . $tag . '>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_render_daevanion(array $set, array $plan, bool $isOwn): void
|
||||||
|
{
|
||||||
|
$class = (string) $set['class_name'];
|
||||||
|
$boards = gear_daevanion_boards($class);
|
||||||
|
$totals = gear_daevanion_totals($plan, $class);
|
||||||
|
$fragments = gear_plan_fragments('daevanion', $set, $plan);
|
||||||
|
$chosen = array_flip(array_map('intval', $plan['nodes'] ?? []));
|
||||||
|
$skills = gear_plan_class_skills($class);
|
||||||
|
$pointTypes = [];
|
||||||
|
foreach ($boards as $board) {
|
||||||
|
$pointTypes[$board['point']] = gear_daevanion_max($board['point'], $class);
|
||||||
|
}
|
||||||
|
echo gear_plan_head_html($set, 'daevanion', $fragments['daevanion-line'], $isOwn);
|
||||||
|
?>
|
||||||
|
<p class="gear-hint text-muted gear-skills-legend">
|
||||||
|
Starte in der Mitte (◆) und schalte angrenzende Felder frei – waagerecht oder senkrecht. Wertefelder geben Kampfwerte, Skillfelder
|
||||||
|
(mit dem Icon des Skills) je +1 Stufe. Entfernst du ein Feld, fällt alles weg, was nur darüber erreichbar war. Die ersten vier Bretter
|
||||||
|
teilen sich die Daevanion-Kristalle, das Saison-Brett hat eigene.
|
||||||
|
</p>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<form method="post" action="/gear_action.php" class="gear-dv-form" data-plan-form data-daevanion
|
||||||
|
data-budgets="<?= e((string) json_encode($pointTypes)) ?>">
|
||||||
|
<?= gear_plan_form_fields($set, 'daevanion') ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="gear-dv-form" data-daevanion-view>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="gear-dv-budgets">
|
||||||
|
<?php foreach ($pointTypes as $point => $max): ?>
|
||||||
|
<span class="gear-dv-budget" data-dv-budget="<?= e($point) ?>"><?= e(gear_daevanion_point_label($point)) ?>
|
||||||
|
<strong data-dv-spent><?= (int) ($totals['spent'][$point] ?? 0) ?></strong>/<?= $max ?></span>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<div class="gear-tabs gear-dv-tabs" role="tablist" data-dv-tabs hidden>
|
||||||
|
<?php foreach ($boards as $index => $board): ?>
|
||||||
|
<?php $boardTotals = $totals['boards'][(int) $board['id']]; ?>
|
||||||
|
<button type="button" class="gear-tab<?= $index === 0 ? ' is-active' : '' ?>" role="tab" data-dv-tab="<?= (int) $board['id'] ?>"
|
||||||
|
title="<?= e($board['title'] . ' · ab Stufe ' . (int) $board['need'] . ' · ' . gear_daevanion_point_label($board['point'])) ?>">
|
||||||
|
<?= e($board['title']) ?> <span class="gear-tab-count" data-dv-tab-count><?= $boardTotals['count'] ?>/<?= $boardTotals['total'] ?></span>
|
||||||
|
</button>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php foreach ($boards as $board): ?>
|
||||||
|
<?php
|
||||||
|
$rows = array_column($board['nodes'], 'r');
|
||||||
|
$cols = array_column($board['nodes'], 'c');
|
||||||
|
[$minR, $minC] = [min($rows), min($cols)];
|
||||||
|
$at = [];
|
||||||
|
foreach ($board['nodes'] as $node) {
|
||||||
|
$at[$node['r'] . ',' . $node['c']] = (int) $node['id'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<section class="gear-dv-board" data-dv-board="<?= (int) $board['id'] ?>" data-point="<?= e($board['point']) ?>">
|
||||||
|
<div class="gear-dv-board-head">
|
||||||
|
<h4><?= e($board['title']) ?> <span class="text-muted">· ab Stufe <?= (int) $board['need'] ?> · <?= e(gear_daevanion_point_label($board['point'])) ?></span></h4>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<span class="gear-dv-actions">
|
||||||
|
<button type="submit" name="board_all" value="<?= (int) $board['id'] ?>" class="button button-secondary button-small">Alle aktivieren</button>
|
||||||
|
<button type="submit" name="board_reset" value="<?= (int) $board['id'] ?>" class="button button-secondary button-small">Zurücksetzen</button>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="gear-dv-layout">
|
||||||
|
<div class="gear-dv-scroll">
|
||||||
|
<div class="gear-dv-grid" style="--cols: <?= max($cols) - $minC + 1 ?>; --rows: <?= max($rows) - $minR + 1 ?>">
|
||||||
|
<?php
|
||||||
|
foreach ($board['nodes'] as $node) {
|
||||||
|
echo gear_daevanion_node_html($node, $minR, $minC, $chosen, $at, $skills, $class, $isOwn), "\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="gear-dv-side" data-plan-fragment="dv-board-<?= (int) $board['id'] ?>"><?= $fragments['dv-board-' . $board['id']] ?></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<?= gear_plan_submit_html() ?>
|
||||||
|
</form>
|
||||||
|
<?php else: ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="gear-plan-summary gear-dv-summary" data-plan-fragment="daevanion-summary"><?= $fragments['daevanion-summary'] ?></div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Pantheon ----
|
||||||
|
|
||||||
|
function gear_pantheon_line(array $totals, array $data): string
|
||||||
|
{
|
||||||
|
$placed = array_sum($totals['placed']);
|
||||||
|
if ($placed === 0) {
|
||||||
|
return 'Noch nichts aufgestellt.';
|
||||||
|
}
|
||||||
|
return $placed . ' von ' . array_sum($data['slots']) . ' Plätzen belegt · ' . array_sum($totals['domains']) . ' Domänenpunkte';
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_pantheon_summary_html(array $totals, array $data): string
|
||||||
|
{
|
||||||
|
$html = '<h4 class="gear-skills-kind">Domänen</h4><div class="gear-pantheon-domains">';
|
||||||
|
foreach ($data['domains'] as $id => $domain) {
|
||||||
|
$points = (int) ($totals['domains'][$id] ?? 0);
|
||||||
|
$cap = max(1, (int) $domain['cap']);
|
||||||
|
$html .= '<div class="gear-pantheon-domain' . ($points > 0 ? '' : ' is-empty') . '">'
|
||||||
|
. '<span class="gear-pantheon-domain-name">' . e(gear_domain_label((string) $id)) . '</span>'
|
||||||
|
. '<span class="gear-pantheon-domain-value">' . $points . '<span class="text-muted">/' . $cap . '</span></span>'
|
||||||
|
. '<span class="gear-pantheon-bar"><i style="width:' . min(100, round($points / $cap * 100)) . '%"></i></span></div>';
|
||||||
|
}
|
||||||
|
$html .= '</div><h4 class="gear-skills-kind">Kampfwerte</h4>'
|
||||||
|
. gear_plan_stats_html($totals['stats'], 'Stell eine Dekoration auf – jeder Domänenpunkt gibt zwei Kampfwerte.');
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Eine Dekoration: Bild, Name, Art und Seltenheit, Domaenenpunkte (eigenes Set: zum Aufstellen anhaken). */
|
||||||
|
function gear_pantheon_deco_html(array $item, bool $on, bool $isOwn): string
|
||||||
|
{
|
||||||
|
$domainText = implode(' ', array_map(static fn (string $d): string => mb_strtolower(gear_domain_label($d)), array_keys($item['domains'])));
|
||||||
|
$tag = $isOwn ? 'label' : 'div';
|
||||||
|
$chips = '';
|
||||||
|
foreach ($item['domains'] as $domain => $points) {
|
||||||
|
$chips .= '<span class="gear-plan-chip" data-domain="' . e((string) $domain) . '">' . e(GEAR_DOMAINS[$domain][0] ?? (string) $domain) . ' +' . (int) $points . '</span>';
|
||||||
|
}
|
||||||
|
return '<' . $tag . ' class="gear-deco' . ($on ? ' is-on' : '') . '" data-filter-item data-filter-key="' . e($item['ui']) . '" data-deco-ui="' . e($item['ui']) . '"'
|
||||||
|
. ' data-filter-text="' . e(mb_strtolower($item['name']) . ' ' . $domainText) . '" data-domains="' . e(implode(' ', array_keys($item['domains']))) . '">'
|
||||||
|
. ($isOwn ? '<input type="checkbox" name="deco[]" value="' . (int) $item['id'] . '"' . ($on ? ' checked' : '') . '>' : '')
|
||||||
|
. gear_plan_icon_html((int) $item['item'], $item['name'], $item['grade'], 38)
|
||||||
|
. '<span class="gear-deco-info"><span class="gear-deco-name ' . e(gear_grade_class($item['grade'])) . '">' . e($item['name']) . '</span>'
|
||||||
|
. '<span class="gear-deco-meta">' . e((GEAR_PANTHEON_TYPES[$item['ui']][0] ?? $item['ui']) . ' · ' . $item['grade'])
|
||||||
|
. ($item['race'] !== 'All' ? ' · ' . e(GEAR_PANTHEON_FACTIONS[$item['race']] ?? $item['race']) : '') . '</span>'
|
||||||
|
. '<span class="gear-deco-domains">' . ($chips !== '' ? $chips : '<span class="text-muted">nur Deko, keine Werte</span>') . '</span></span>'
|
||||||
|
. ($isOwn ? '<span class="gear-deco-check" aria-hidden="true">' . icon('check') . '</span>' : '')
|
||||||
|
. '</' . $tag . '>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_render_pantheon(array $set, array $plan, bool $isOwn): void
|
||||||
|
{
|
||||||
|
$data = gear_pantheon_data();
|
||||||
|
$plan += ['faction' => 'Light', 'decos' => []];
|
||||||
|
$totals = gear_pantheon_totals($plan, $data);
|
||||||
|
$fragments = gear_plan_fragments('pantheon', $set, $plan);
|
||||||
|
$placed = array_flip(array_map('intval', $plan['decos']));
|
||||||
|
echo gear_plan_head_html($set, 'pantheon', $fragments['pantheon-line'], $isOwn);
|
||||||
|
?>
|
||||||
|
<p class="gear-hint text-muted gear-skills-legend">
|
||||||
|
Stell Dekorationen aus deiner Sammlung im Pantheon auf: Platz für <?= gear_pantheon_slots($data, 'Colossus') ?> Koloss,
|
||||||
|
<?= gear_pantheon_slots($data, 'Statue') ?> Statuen und <?= gear_pantheon_slots($data, 'Artwork') ?> Kunstwerke. Jede gibt Punkte in
|
||||||
|
Domänen der Götter (je Domäne höchstens <?= (int) (reset($data['domains'])['cap'] ?? 200) ?>), jeder Punkt wird in zwei Kampfwerte umgerechnet.
|
||||||
|
Manche Dekorationen gibt es nur für Elyos oder Asmodier.
|
||||||
|
</p>
|
||||||
|
<div class="gear-plan-layout">
|
||||||
|
<div class="gear-plan-main">
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<form method="post" action="/gear_action.php" class="gear-pantheon-form" data-plan-form data-pantheon
|
||||||
|
data-slots="<?= e((string) json_encode(array_map(static fn (string $ui): int => gear_pantheon_slots($data, $ui), array_combine(array_keys(GEAR_PANTHEON_TYPES), array_keys(GEAR_PANTHEON_TYPES))))) ?>">
|
||||||
|
<?= gear_plan_form_fields($set, 'pantheon') ?>
|
||||||
|
<div class="gear-plan-toggle" role="radiogroup" aria-label="Seite">
|
||||||
|
<?php foreach (GEAR_PANTHEON_FACTIONS as $faction => $factionLabel): ?>
|
||||||
|
<label class="gear-tab<?= $plan['faction'] === $faction ? ' is-active' : '' ?>"><input type="radio" name="faction" value="<?= e($faction) ?>"<?= $plan['faction'] === $faction ? ' checked' : '' ?> data-plan-reload> <?= e($factionLabel) ?></label>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="text-muted"><?= e(GEAR_PANTHEON_FACTIONS[$plan['faction']] ?? '') ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="gear-plan-filter" data-plan-filter="deco" role="group" aria-label="Art">
|
||||||
|
<button type="button" class="gear-tab is-active" data-filter-value="">Alle</button>
|
||||||
|
<?php foreach (GEAR_PANTHEON_TYPES as $ui => [$uiLabel]): ?>
|
||||||
|
<button type="button" class="gear-tab" data-filter-value="<?= e($ui) ?>"><?= e($uiLabel) ?>
|
||||||
|
<span class="gear-tab-count" data-pantheon-count="<?= e($ui) ?>"><?= (int) $totals['placed'][$ui] ?>/<?= gear_pantheon_slots($data, $ui) ?></span></button>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<div class="gear-plan-tools" data-plan-tools hidden>
|
||||||
|
<input type="search" placeholder="Name oder Domäne suchen …" aria-label="Dekoration suchen" data-filter-search>
|
||||||
|
<select aria-label="Domäne" data-filter-domain>
|
||||||
|
<option value="">Alle Domänen</option>
|
||||||
|
<?php foreach ($data['domains'] as $id => $domain): ?>
|
||||||
|
<option value="<?= e((string) $id) ?>"><?= e(gear_domain_label((string) $id)) ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<?php if ($isOwn): ?><label class="checkbox-label"><input type="checkbox" data-filter-placed> nur aufgestellte</label><?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="gear-deco-grid">
|
||||||
|
<?php
|
||||||
|
foreach ($data['items'] as $item) {
|
||||||
|
$on = isset($placed[(int) $item['id']]);
|
||||||
|
if (($isOwn || $on) && ($item['race'] === 'All' || $item['race'] === $plan['faction'])) {
|
||||||
|
echo gear_pantheon_deco_html($item, $on, $isOwn), "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php if (!$isOwn && !$plan['decos']): ?><p class="text-muted">Nichts aufgestellt.</p><?php endif; ?>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<?= gear_plan_submit_html() ?>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<aside class="gear-plan-summary" data-plan-fragment="pantheon-summary"><?= $fragments['pantheon-summary'] ?></aside>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Closet ----
|
||||||
|
|
||||||
|
function gear_closet_line(array $totals): string
|
||||||
|
{
|
||||||
|
$points = array_sum(array_column($totals['cats'], 'points'));
|
||||||
|
$cats = count(array_filter(array_column($totals['cats'], 'points')));
|
||||||
|
return $points > 0 ? $points . ' Sammelpunkte in ' . $cats . ($cats === 1 ? ' Kategorie' : ' Kategorien') : 'Noch keine Sammelpunkte.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Punkte einer Kategorie: "350/500" und ob selbst eingetragen oder aus den Skins geschaetzt. */
|
||||||
|
function gear_closet_points_cell_html(array $row, array $data): string
|
||||||
|
{
|
||||||
|
$html = '<strong>' . (int) $row['points'] . '</strong><span class="text-muted">/' . (int) $data['max'] . '</span>';
|
||||||
|
if ($row['set']) {
|
||||||
|
return $html . '<span class="gear-plan-badge is-set" title="Selbst eingetragen">eigene</span>';
|
||||||
|
}
|
||||||
|
return $html . ($row['points'] > 0 ? '<span class="gear-plan-badge" title="Aus ' . (int) $row['owned'] . ' abgehakten Skins geschätzt">geschätzt</span>' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Wert einer Kategorie bei ihren Punkten (ohne Punkte: je Punkt). */
|
||||||
|
function gear_closet_stat_cell_html(string $cat, array $row, array $data): string
|
||||||
|
{
|
||||||
|
$stats = gear_closet_cat_stats($cat, max(1, (int) $row['points']), $data);
|
||||||
|
$text = implode(', ', array_map(static fn (string $stat, float $value): string => gear_stat_label($stat) . ' ' . gear_stat_value($stat, $value), array_keys($stats), array_values($stats)));
|
||||||
|
return e($text) . ((int) $row['points'] === 0 ? ' <span class="text-muted">je Punkt</span>' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_closet_summary_html(array $totals, array $data): string
|
||||||
|
{
|
||||||
|
return '<h4 class="gear-skills-kind">Kampfwerte aus der Sammlung</h4>' . gear_plan_stats_html($totals['stats'], 'Noch keine – trag Sammelpunkte ein oder hake Skins ab.');
|
||||||
|
}
|
||||||
|
|
||||||
|
function gear_render_closet(array $set, array $plan, bool $isOwn): void
|
||||||
|
{
|
||||||
|
$data = gear_closet_data();
|
||||||
|
$class = !empty($set['class_name']) ? (string) $set['class_name'] : null;
|
||||||
|
$totals = gear_closet_totals($plan, $class, $data);
|
||||||
|
$fragments = gear_plan_fragments('closet', $set, $plan);
|
||||||
|
$cats = array_keys($totals['cats']);
|
||||||
|
$cat = (string) ($_GET['cat'] ?? '');
|
||||||
|
if (!in_array($cat, $cats, true)) {
|
||||||
|
$cat = $cats[0] ?? '';
|
||||||
|
}
|
||||||
|
$owned = array_flip(array_map('intval', $plan['skins'] ?? []));
|
||||||
|
$weights = $data['grade_weight'];
|
||||||
|
echo gear_plan_head_html($set, 'closet', $fragments['closet-line'], $isOwn);
|
||||||
|
?>
|
||||||
|
<p class="gear-hint text-muted gear-skills-legend">
|
||||||
|
Gesammelte Skins geben je Kategorie Sammelpunkte (bis <?= (int) $data['max'] ?>) – jeder Punkt bringt +0,1 % auf den Wert der Kategorie,
|
||||||
|
z. B. Verteidigung des Helms. Waffen zählen nur für die Waffe deiner Klasse<?= $class === null ? ' (für das Set ist keine Klasse gewählt)' : '' ?>.
|
||||||
|
Am genauesten ist es, die Punkte aus dem Spiel einzutragen; hakst du Skins ab, schätzen wir die Punkte aus der Seltenheit.
|
||||||
|
</p>
|
||||||
|
<?php if ($data['estimated']): ?>
|
||||||
|
<details class="gear-skills-details">
|
||||||
|
<summary>Wie wir schätzen</summary>
|
||||||
|
<p class="gear-hint text-muted">
|
||||||
|
Die genauen Punkte je Skin stehen nicht in den Daten – aion2hub schätzt sie aus der Seltenheit:
|
||||||
|
<?= e(implode(', ', array_map(static fn (string $grade, int $weight): string => $grade . ' ' . $weight, array_keys($weights), $weights))) ?>
|
||||||
|
(interne Namen). Ein eingetragener Wert ersetzt die Schätzung der Kategorie.
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="gear-plan-layout">
|
||||||
|
<div class="gear-plan-main">
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<form method="post" action="/gear_action.php" class="gear-closet-points" data-plan-form>
|
||||||
|
<?= gear_plan_form_fields($set, 'closet', ['part' => 'points', 'cat' => $cat]) ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="table-scroll">
|
||||||
|
<table class="gear-closet-table">
|
||||||
|
<thead><tr><th>Kategorie</th><th>Punkte</th><th>Wert</th><?php if ($isOwn): ?><th>Aus dem Spiel</th><?php endif; ?></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($totals['cats'] as $catKey => $row): ?>
|
||||||
|
<tr class="<?= $row['points'] > 0 ? 'is-on' : '' ?>">
|
||||||
|
<th><?= e(GEAR_CLOSET_CATEGORIES[$catKey] ?? $catKey) ?></th>
|
||||||
|
<td class="gear-closet-points-cell" data-plan-fragment="closet-points-<?= e($catKey) ?>"><?= gear_closet_points_cell_html($row, $data) ?></td>
|
||||||
|
<td class="gear-closet-stat" data-plan-fragment="closet-stat-<?= e($catKey) ?>"><?= gear_closet_stat_cell_html($catKey, $row, $data) ?></td>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<td><input type="number" name="points[<?= e($catKey) ?>]" min="0" max="<?= (int) $data['max'] ?>" inputmode="numeric"
|
||||||
|
value="<?= $row['set'] ? (int) $plan['points'][$catKey] : '' ?>" placeholder="<?= $row['derived'] ?: '–' ?>"
|
||||||
|
aria-label="Sammelpunkte <?= e(GEAR_CLOSET_CATEGORIES[$catKey] ?? $catKey) ?> aus dem Spiel"></td>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php if ($isOwn): ?>
|
||||||
|
<?= gear_plan_submit_html() ?>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($isOwn && $cat !== ''): ?>
|
||||||
|
<h4 class="gear-skills-kind">Skins abhaken</h4>
|
||||||
|
<nav class="gear-plan-filter" aria-label="Kategorie">
|
||||||
|
<?php foreach ($totals['cats'] as $catKey => $row): ?>
|
||||||
|
<a class="gear-tab<?= $catKey === $cat ? ' is-active' : '' ?>" href="/gear.php?set=<?= (int) $set['id'] ?>&tab=closet&cat=<?= e(rawurlencode($catKey)) ?>#closet-skins"<?= $catKey === $cat ? ' aria-current="page"' : '' ?>>
|
||||||
|
<?= e(GEAR_CLOSET_CATEGORIES[$catKey] ?? $catKey) ?> <span class="gear-tab-count" data-plan-fragment="closet-count-<?= e($catKey) ?>"><?= $row['owned'] ?>/<?= $row['total'] ?></span>
|
||||||
|
</a>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</nav>
|
||||||
|
<form method="post" action="/gear_action.php" class="gear-closet-skins" id="closet-skins" data-plan-form>
|
||||||
|
<?= gear_plan_form_fields($set, 'closet', ['part' => 'skins', 'cat' => $cat]) ?>
|
||||||
|
<div class="gear-plan-tools" data-plan-tools hidden>
|
||||||
|
<input type="search" placeholder="Skin suchen …" aria-label="Skin suchen" data-filter-search>
|
||||||
|
<button type="button" class="button button-secondary button-small" data-closet-bulk="1">Gezeigte abhaken</button>
|
||||||
|
<button type="button" class="button button-secondary button-small" data-closet-bulk="0">Gezeigte entfernen</button>
|
||||||
|
</div>
|
||||||
|
<div class="gear-skin-grid">
|
||||||
|
<?php
|
||||||
|
foreach ($data['items'] as $item) {
|
||||||
|
if ($item['cat'] !== $cat) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$grade = e(gear_grade_class($item['grade']));
|
||||||
|
echo '<label class="gear-skin', isset($owned[$item['id']]) ? ' is-on' : '', '" data-filter-item data-filter-text="', e(mb_strtolower($item['name'])), '">',
|
||||||
|
'<input type="checkbox" name="skin[]" value="', (int) $item['id'], '"', isset($owned[$item['id']]) ? ' checked' : '', '>',
|
||||||
|
'<span class="gear-skin-grade ', $grade, '"></span><span class="gear-skin-name">', e($item['name']), '</span>',
|
||||||
|
'<span class="gear-skin-meta ', $grade, '">', e($item['grade']), ' · +', (int) $item['weight'], '</span></label>', "\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?= gear_plan_submit_html() ?>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<aside class="gear-plan-summary" data-plan-fragment="closet-summary"><?= $fragments['closet-summary'] ?></aside>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
@ -7,8 +7,12 @@ declare(strict_types=1);
|
||||||
* Speichern: gear_action.php (save_skills), sofort per assets/js/gear.js.
|
* Speichern: gear_action.php (save_skills), sofort per assets/js/gear.js.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Unterseiten eines Sets: Schluessel (gear.php?tab=…) => Beschriftung
|
// Unterseiten eines Sets in der Reihenfolge des aion2hub-Planers: Schluessel (gear.php?tab=…) => Beschriftung.
|
||||||
const GEAR_SET_TABS = ['gear' => 'Ausrüstung', 'skills' => 'Skills', 'stigma' => 'Stigmen'];
|
// Arcana, Pets, Daevanion, Pantheon und Closet: includes/gear_planner_view.php (GEAR_PLAN_SECTIONS)
|
||||||
|
const GEAR_SET_TABS = [
|
||||||
|
'gear' => 'Ausrüstung', 'arcana' => 'Arcana', 'pets' => 'Pets', 'skills' => 'Skills', 'stigma' => 'Stigmen',
|
||||||
|
'daevanion' => 'Daevanion', 'pantheon' => 'Pantheon', 'closet' => 'Closet',
|
||||||
|
];
|
||||||
|
|
||||||
/** Auswahl der Stufe eines Skills (0 = nicht geplant). */
|
/** Auswahl der Stufe eines Skills (0 = nicht geplant). */
|
||||||
function gear_skill_level_select(array $skill, int $level, bool $disabled): string
|
function gear_skill_level_select(array $skill, int $level, bool $disabled): string
|
||||||
|
|
@ -96,9 +100,10 @@ function gear_stigma_perk_list_html(array $skill, int $level): string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Eine Unterseite ("skills" oder "stigma") eines Sets.
|
* Eine Unterseite ("skills" oder "stigma") eines Sets. $plans = Plaene der Seiten Arcana, Daevanion usw.
|
||||||
|
* (gear_set_plans) - deren Skill-Boni stehen an den Skills.
|
||||||
*/
|
*/
|
||||||
function gear_render_skill_tab(array $set, string $tab, bool $isOwn, bool $canManage): void
|
function gear_render_skill_tab(array $set, string $tab, bool $isOwn, bool $canManage, array $plans = []): void
|
||||||
{
|
{
|
||||||
$rows = gear_set_skill_rows((int) $set['id']);
|
$rows = gear_set_skill_rows((int) $set['id']);
|
||||||
$kinds = $tab === 'stigma' ? ['stigma'] : ['active', 'passive'];
|
$kinds = $tab === 'stigma' ? ['stigma'] : ['active', 'passive'];
|
||||||
|
|
@ -111,6 +116,9 @@ function gear_render_skill_tab(array $set, string $tab, bool $isOwn, bool $canMa
|
||||||
$planned = gear_skills_of_tab(gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [], $tab);
|
$planned = gear_skills_of_tab(gear_set_skills_for_sets([$set])[(int) $set['id']] ?? [], $tab);
|
||||||
[$summary, $costs] = gear_skill_tab_summary($planned, $tab);
|
[$summary, $costs] = gear_skill_tab_summary($planned, $tab);
|
||||||
$stigmaPlanned = $tab === 'stigma' ? count($planned) : 0;
|
$stigmaPlanned = $tab === 'stigma' ? count($planned) : 0;
|
||||||
|
// Boni aus Daevanion-Brettern und Arcana-Karten (nur aktive und passive Skills bekommen welche)
|
||||||
|
$bonuses = $tab === 'skills' ? gear_plan_skill_bonuses($set, $plans) : [];
|
||||||
|
$bonusPlanned = $tab === 'skills' && (isset($plans['daevanion']) || isset($plans['arcana']));
|
||||||
?>
|
?>
|
||||||
<div class="panel gear-skills" id="skills">
|
<div class="panel gear-skills" id="skills">
|
||||||
<div class="gear-skills-head">
|
<div class="gear-skills-head">
|
||||||
|
|
@ -205,9 +213,18 @@ function gear_render_skill_tab(array $set, string $tab, bool $isOwn, bool $canMa
|
||||||
$skillIcon = gear_skill_icon_url($skill);
|
$skillIcon = gear_skill_icon_url($skill);
|
||||||
$unlisted = (int) $skill['is_listed'] !== 1;
|
$unlisted = (int) $skill['is_listed'] !== 1;
|
||||||
$displayName = gear_skill_display_name($skill);
|
$displayName = gear_skill_display_name($skill);
|
||||||
|
$bonus = $bonuses[(int) $skill['id']] ?? [];
|
||||||
|
$bonusTotal = (int) array_sum($bonus);
|
||||||
|
$short = $bonusPlanned && $level > GEAR_SKILL_LEVEL_SELF + $bonusTotal;
|
||||||
|
$bonusParts = [];
|
||||||
|
foreach (['daevanion' => 'Daevanion', 'arcana' => 'Arcana'] as $source => $sourceLabel) {
|
||||||
|
if (!empty($bonus[$source])) {
|
||||||
|
$bonusParts[] = $sourceLabel . ' +' . $bonus[$source];
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="gear-skill<?= $level > 0 ? ' is-planned' : '' ?><?= gear_skill_is_bonus($kind, $level) ? ' is-bonus' : '' ?><?= $unlisted ? ' is-unlisted' : '' ?>"
|
<div class="gear-skill<?= $level > 0 ? ' is-planned' : '' ?><?= gear_skill_is_bonus($kind, $level) ? ' is-bonus' : '' ?><?= $unlisted ? ' is-unlisted' : '' ?><?= $short ? ' is-short' : '' ?>"
|
||||||
data-skill data-skill-id="<?= (int) $skill['id'] ?>" data-kind="<?= e($kind) ?>">
|
data-skill data-skill-id="<?= (int) $skill['id'] ?>" data-kind="<?= e($kind) ?>"<?= $bonusPlanned ? ' data-bonus="' . $bonusTotal . '"' : '' ?>>
|
||||||
<span class="gear-skill-icon">
|
<span class="gear-skill-icon">
|
||||||
<?php if ($skillIcon): ?>
|
<?php if ($skillIcon): ?>
|
||||||
<img src="<?= e($skillIcon) ?>" alt="" width="36" height="36" loading="lazy">
|
<img src="<?= e($skillIcon) ?>" alt="" width="36" height="36" loading="lazy">
|
||||||
|
|
@ -215,6 +232,10 @@ function gear_render_skill_tab(array $set, string $tab, bool $isOwn, bool $canMa
|
||||||
<span class="gear-skill-initial"><?= e(mb_substr($displayName, 0, 1)) ?></span>
|
<span class="gear-skill-initial"><?= e(mb_substr($displayName, 0, 1)) ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<span class="gear-skill-level" data-skill-badge><?= $level > 0 ? $level : '' ?></span>
|
<span class="gear-skill-level" data-skill-badge><?= $level > 0 ? $level : '' ?></span>
|
||||||
|
<?php if ($bonusTotal > 0): ?>
|
||||||
|
<?php // Boni aus Daevanion und Arcana oben links am Icon ?>
|
||||||
|
<span class="gear-skill-plus" title="<?= e('Boni aus den Planer-Seiten: ' . implode(', ', $bonusParts) . ' – mit Skillpunkten (bis ' . GEAR_SKILL_LEVEL_SELF . ') also bis Stufe ' . min(GEAR_SKILL_LEVEL_MAX, GEAR_SKILL_LEVEL_SELF + $bonusTotal)) ?>">+<?= $bonusTotal ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
</span>
|
</span>
|
||||||
<span class="gear-skill-info">
|
<span class="gear-skill-info">
|
||||||
<span class="gear-skill-name" title="<?= e($displayName !== $skill['name'] ? $displayName . ' (' . $skill['name'] . ')' : $displayName) ?>"><?= e($displayName) ?></span>
|
<span class="gear-skill-name" title="<?= e($displayName !== $skill['name'] ? $displayName . ' (' . $skill['name'] . ')' : $displayName) ?>"><?= e($displayName) ?></span>
|
||||||
|
|
|
||||||
|
|
@ -295,30 +295,40 @@ function gear_source_planner_chunks(string $html): array
|
||||||
return array_values(array_unique($m[0]));
|
return array_values(array_unique($m[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Einen JavaScript-String (Inhalt zwischen den Anfuehrungszeichen) so auswerten wie der Browser. */
|
/**
|
||||||
function gear_source_js_unescape(string $js, int $start, string $quote): string
|
* Einen JavaScript-String (Inhalt zwischen den Anfuehrungszeichen) so auswerten wie der Browser. Springt
|
||||||
|
* von Backslash zu Backslash statt Zeichen fuer Zeichen - die Datei mit den Gegenstaenden hat ueber 4 MB.
|
||||||
|
*/
|
||||||
|
function gear_source_js_unescape(string $js, int $start, string $quote, ?int &$end = null): string
|
||||||
{
|
{
|
||||||
$out = '';
|
$out = '';
|
||||||
$len = strlen($js);
|
$len = strlen($js);
|
||||||
|
$stop = $quote . '\\';
|
||||||
$pendingHigh = null; // erste Haelfte eines UTF-16-Paars (😀)
|
$pendingHigh = null; // erste Haelfte eines UTF-16-Paars (😀)
|
||||||
for ($i = $start; $i < $len; $i++) {
|
$i = $start;
|
||||||
$ch = $js[$i];
|
while ($i < $len) {
|
||||||
if ($ch === $quote) {
|
$plain = strcspn($js, $stop, $i);
|
||||||
return $out;
|
if ($plain > 0) {
|
||||||
|
$out .= substr($js, $i, $plain);
|
||||||
|
$i += $plain;
|
||||||
|
$pendingHigh = null;
|
||||||
|
if ($i >= $len) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if ($ch !== '\\') {
|
}
|
||||||
$out .= $ch;
|
if ($js[$i] === $quote) {
|
||||||
continue;
|
$end = $i; // Position des schliessenden Anfuehrungszeichens
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
$next = $js[++$i] ?? '';
|
$next = $js[++$i] ?? '';
|
||||||
if ($next === 'u') {
|
if ($next === 'u') {
|
||||||
if (($js[$i + 1] ?? '') === '{') {
|
if (($js[$i + 1] ?? '') === '{') {
|
||||||
$end = strpos($js, '}', $i);
|
$end = strpos($js, '}', $i);
|
||||||
$code = hexdec(substr($js, $i + 2, (int) $end - $i - 2));
|
$code = hexdec(substr($js, $i + 2, (int) $end - $i - 2));
|
||||||
$i = (int) $end;
|
$i = (int) $end + 1;
|
||||||
} else {
|
} else {
|
||||||
$code = hexdec(substr($js, $i + 1, 4));
|
$code = hexdec(substr($js, $i + 1, 4));
|
||||||
$i += 4;
|
$i += 5;
|
||||||
}
|
}
|
||||||
if ($code >= 0xD800 && $code <= 0xDBFF) {
|
if ($code >= 0xD800 && $code <= 0xDBFF) {
|
||||||
$pendingHigh = $code;
|
$pendingHigh = $code;
|
||||||
|
|
@ -331,16 +341,20 @@ function gear_source_js_unescape(string $js, int $start, string $quote): string
|
||||||
$out .= mb_chr((int) $code, 'UTF-8');
|
$out .= mb_chr((int) $code, 'UTF-8');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$pendingHigh = null;
|
||||||
|
if ($next === 'x') {
|
||||||
|
// \xHH ist wie \u00HH ein Zeichen, kein einzelnes Byte
|
||||||
|
$out .= mb_chr((int) hexdec(substr($js, $i + 1, 2)), 'UTF-8');
|
||||||
|
$i += 3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$out .= match ($next) {
|
$out .= match ($next) {
|
||||||
'n' => "\n", 'r' => "\r", 't' => "\t", 'b' => "\x08", 'f' => "\f", 'v' => "\v", '0' => "\0",
|
'n' => "\n", 'r' => "\r", 't' => "\t", 'b' => "\x08", 'f' => "\f", 'v' => "\v", '0' => "\0",
|
||||||
'x' => chr((int) hexdec(substr($js, $i + 1, 2))),
|
|
||||||
default => $next, // \\ \' \" und alles andere steht fuer sich selbst
|
default => $next, // \\ \' \" und alles andere steht fuer sich selbst
|
||||||
};
|
};
|
||||||
if ($next === 'x') {
|
$i++;
|
||||||
$i += 2;
|
|
||||||
}
|
}
|
||||||
}
|
throw new RuntimeException('Datensatz im Build-Planer nicht vollständig - hat sich der Planer geändert?');
|
||||||
throw new RuntimeException('Datensatz der Spezialisierungen nicht vollständig - hat sich der Planer geändert?');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -362,7 +376,13 @@ function gear_source_parse_planner_specs(string $js): ?array
|
||||||
throw new RuntimeException('Spezialisierungen gefunden, aber nicht lesbar - hat sich der Planer geändert?');
|
throw new RuntimeException('Spezialisierungen gefunden, aber nicht lesbar - hat sich der Planer geändert?');
|
||||||
}
|
}
|
||||||
$data = json_decode(gear_source_js_unescape($js, $open + strlen("JSON.parse('"), "'"), true);
|
$data = json_decode(gear_source_js_unescape($js, $open + strlen("JSON.parse('"), "'"), true);
|
||||||
if (!is_array($data) || !is_array($data['byParent'] ?? null)) {
|
return gear_source_planner_specs_from(is_array($data) ? $data : []);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Den ausgepackten Datensatz der Spezialisierungen in die Form von gear_source_parse_planner_specs bringen. */
|
||||||
|
function gear_source_planner_specs_from(array $data): array
|
||||||
|
{
|
||||||
|
if (!is_array($data['byParent'] ?? null)) {
|
||||||
throw new RuntimeException('Datensatz der Spezialisierungen nicht lesbar - hat sich der Planer geändert?');
|
throw new RuntimeException('Datensatz der Spezialisierungen nicht lesbar - hat sich der Planer geändert?');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,20 @@ const PATCHNOTE_TYPES = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const PATCHNOTES = [
|
const PATCHNOTES = [
|
||||||
|
[
|
||||||
|
'id' => '2026-09-23-e',
|
||||||
|
'date' => '2026-09-23',
|
||||||
|
'title' => 'Gear-Planer: Arcana, Pets, Daevanion, Pantheon und Closet',
|
||||||
|
'summary' => 'Jedes Set hat fünf neue Seiten nach dem Vorbild des aion2hub-Planers - mit allen Werten, die sie bringen.',
|
||||||
|
'changes' => [
|
||||||
|
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Arcana: Pro Kartenart (Kelch, Pergament, Kompass, Glocke, Spiegel) setzt du eine Karte mit Aufwertung ein und wählst, welche Skills sie prägt - so viele Stufen, wie die Karte Plätze hat plus die Aufwertung, je Skill bis +4. Du siehst die Domänenpunkte, die umgerechneten Kampfwerte, die Skill-Boni und die Set-Effekte ab 2 und 4 Teilen.'],
|
||||||
|
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Pets: Alle 208 Pets mit Stufe 1-3 (besondere Pets hat man oder nicht) und ihren Besitz-Effekten, mit Filter nach Gattung und Suche. Dazu die Gattungs-Einsicht: je Gattung Stufe 1-10, je Platz Seltenheit und Wert - gerechnet mit dem besten Wurf.'],
|
||||||
|
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Daevanion: Die fünf Bretter deiner Klasse wie im Spiel - vom Start in der Mitte aus Feld für Feld freischalten, Entfernen nimmt alles mit, was nur darüber erreichbar war. Kristalle, Werte und Skill-Boni je Brett und gesamt, dazu „Alle aktivieren“ und „Zurücksetzen“.'],
|
||||||
|
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Pantheon: Koloss, Statuen und Kunstwerke aufstellen (Elyos oder Asmodier), die Domänenpunkte bis 200 je Domäne und die Kampfwerte daraus. Closet: Sammelpunkte je Kategorie aus dem Spiel eintragen oder Skins abhaken, dazu die Werte (+0,1 % je Punkt).'],
|
||||||
|
['type' => 'verbessert', 'area' => 'Gear-Planer', 'text' => 'Die Reiter stehen jetzt in der Reihenfolge des aion2hub-Planers. Auf der Skills-Seite siehst du an jedem Skill die Boni aus Daevanion und Arcana; liegt eine geplante Stufe über Skillpunkten plus diesen Boni, ist sie markiert. Der Vergleich zeigt die Werte aus allen fünf Seiten, „Kopieren“ nimmt sie mit, und Pets, Pantheon und Co. lassen sich aus einem anderen eigenen Set übernehmen.'],
|
||||||
|
['type' => 'neu', 'area' => 'Gear-Planer', 'text' => 'Die Daten holt die Leitung unter „Gegenstände & Skills verwalten“ → „Planer-Daten übernehmen“ aus dem Build-Planer von aion2hub (bringt auch die Spezialisierungen mit), danach einmal „Bilder laden“ (ca. 6 Minuten).', 'audience' => 'leitung'],
|
||||||
|
],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'id' => '2026-09-23-d',
|
'id' => '2026-09-23-d',
|
||||||
'date' => '2026-09-23',
|
'date' => '2026-09-23',
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
|
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
|
||||||
const SCHEMA_VERSION = 39;
|
const SCHEMA_VERSION = 40;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
|
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
|
||||||
|
|
@ -181,6 +181,33 @@ CREATE TABLE IF NOT EXISTS gear_set_skills (
|
||||||
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE,
|
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE,
|
||||||
FOREIGN KEY (skill_id) REFERENCES gear_skills(id) ON DELETE CASCADE
|
FOREIGN KEY (skill_id) REFERENCES gear_skills(id) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
SQL,
|
||||||
|
// Gear-Planer: Daten der Seiten Arcana, Pets, Daevanion, Pantheon, Closet von aion2hub (includes/gear_planner.php)
|
||||||
|
'gear_planner_data' => <<<'SQL'
|
||||||
|
CREATE TABLE IF NOT EXISTS gear_planner_data (
|
||||||
|
-- arcana_cards, pets, genus, daevanion, daevanion:<Klasse>, pantheon, closet, stats … (GEAR_PLANNER_PARTS)
|
||||||
|
name VARCHAR(40) NOT NULL PRIMARY KEY,
|
||||||
|
-- Stand bei aion2hub ("builtAt"), leer wenn der Datensatz keinen hat
|
||||||
|
built_at VARCHAR(20) NOT NULL DEFAULT '',
|
||||||
|
-- JSON in der Form aus includes/gear_planner_source.php
|
||||||
|
data MEDIUMTEXT NOT NULL,
|
||||||
|
-- Letzte Aenderung des Inhalts bzw. letzter Abgleich
|
||||||
|
updated_at DATETIME NOT NULL,
|
||||||
|
checked_at DATETIME NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
SQL,
|
||||||
|
// Gear-Planer: was ein Set auf diesen Seiten plant
|
||||||
|
'gear_set_plans' => <<<'SQL'
|
||||||
|
CREATE TABLE IF NOT EXISTS gear_set_plans (
|
||||||
|
set_id INT UNSIGNED NOT NULL,
|
||||||
|
-- arcana, pets, daevanion, pantheon oder closet (GEAR_PLAN_SECTIONS)
|
||||||
|
section VARCHAR(20) NOT NULL,
|
||||||
|
-- JSON: was geplant ist (Karten, Pet-Stufen, Felder, Dekorationen, Skins) samt "_count" fuer den Reiter
|
||||||
|
data MEDIUMTEXT NOT NULL,
|
||||||
|
updated_at DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (set_id, section),
|
||||||
|
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
SQL,
|
SQL,
|
||||||
// "Angemeldet bleiben" (includes/auth.php)
|
// "Angemeldet bleiben" (includes/auth.php)
|
||||||
'auth_tokens' => <<<'SQL'
|
'auth_tokens' => <<<'SQL'
|
||||||
|
|
|
||||||
|
|
@ -721,6 +721,31 @@ CREATE TABLE IF NOT EXISTS gear_set_skills (
|
||||||
FOREIGN KEY (skill_id) REFERENCES gear_skills(id) ON DELETE CASCADE
|
FOREIGN KEY (skill_id) REFERENCES gear_skills(id) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
-- Gear-Planer: Daten der Seiten Arcana, Pets, Daevanion, Pantheon, Closet von aion2hub (includes/gear_planner.php)
|
||||||
|
CREATE TABLE IF NOT EXISTS gear_planner_data (
|
||||||
|
-- arcana_cards, pets, genus, daevanion, daevanion:<Klasse>, pantheon, closet, stats … (GEAR_PLANNER_PARTS)
|
||||||
|
name VARCHAR(40) NOT NULL PRIMARY KEY,
|
||||||
|
-- Stand bei aion2hub ("builtAt"), leer wenn der Datensatz keinen hat
|
||||||
|
built_at VARCHAR(20) NOT NULL DEFAULT '',
|
||||||
|
-- JSON in der Form aus includes/gear_planner_source.php
|
||||||
|
data MEDIUMTEXT NOT NULL,
|
||||||
|
-- Letzte Aenderung des Inhalts bzw. letzter Abgleich
|
||||||
|
updated_at DATETIME NOT NULL,
|
||||||
|
checked_at DATETIME NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
-- Gear-Planer: was ein Set auf diesen Seiten plant
|
||||||
|
CREATE TABLE IF NOT EXISTS gear_set_plans (
|
||||||
|
set_id INT UNSIGNED NOT NULL,
|
||||||
|
-- arcana, pets, daevanion, pantheon oder closet (GEAR_PLAN_SECTIONS)
|
||||||
|
section VARCHAR(20) NOT NULL,
|
||||||
|
-- JSON: was geplant ist (Karten, Pet-Stufen, Felder, Dekorationen, Skins) samt "_count" fuer den Reiter
|
||||||
|
data MEDIUMTEXT NOT NULL,
|
||||||
|
updated_at DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (set_id, section),
|
||||||
|
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
-- Lumipunkte fuer "Ich bin da" beim Aktivitaetscheck (die Checks selbst liegen beim Bot)
|
-- Lumipunkte fuer "Ich bin da" beim Aktivitaetscheck (die Checks selbst liegen beim Bot)
|
||||||
CREATE TABLE IF NOT EXISTS activity_settings (
|
CREATE TABLE IF NOT EXISTS activity_settings (
|
||||||
-- ID des Aktivitaetschecks beim Bot
|
-- ID des Aktivitaetschecks beim Bot
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue