732 lines
42 KiB
PHP
732 lines
42 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
/**
|
||
* Gear-Planer: Unterseite "Makro" eines Sets - Skill-Leiste und Skill-Makros aus dem Spiel nachgebaut (Skill-Fenster).
|
||
* Wie im Spiel hat jedes der drei Skill-Presets eine Skill-Leiste mit zwoelf Tasten (GEAR_MACRO_KEYS), auf jeder bis zu
|
||
* GEAR_MACRO_KEY_ROWS Skills (Reihen 0-3), und ein Makro mit bis zu GEAR_MACRO_MAX_ENTRIES Eintraegen: je eine Taste der
|
||
* Leiste und die Verzoegerung danach in Millisekunden. Ein Eintrag zeigt also auf eine Taste, nicht auf einen Skill -
|
||
* kommt das Makro an die Taste, nutzt das Spiel ihre Skills der Reihe nach (Reihe 0 zuerst, Skills in der Abklingzeit
|
||
* werden uebersprungen). Haelt man die Makro-Taste gedrueckt, laeuft das Makro von oben nach unten und faengt danach
|
||
* wieder oben an.
|
||
*
|
||
* Gespeichert wird wie die Planer-Seiten in gear_set_plans (section "macro"): {"presets": {"1": [{"k": Taste, "d":
|
||
* Verzoegerung}, …], "2": […], "3": […]}, "bars": {"1": {"Q": [Skill-ID Reihe 0, Reihe 1, …], …}, …}, "_count": "…"} -
|
||
* so kopiert "Kopieren" das Makro mit dem Set, die Datenauskunft enthaelt es und es verschwindet mit dem Set. Anfangs
|
||
* zeigten Eintraege direkt auf einen Skill ("s"); gear_macro_clean() legt solche Skills auf freie Tasten.
|
||
* gear_set_plans() laesst den Abschnitt aus (er steht nicht in GEAR_PLAN_SECTIONS), gelesen wird er mit
|
||
* gear_set_macro(). Speichern: gear_action.php (save_macro), mit JavaScript sofort (assets/js/gear-macro.js).
|
||
*/
|
||
|
||
const GEAR_MACRO_SECTION = 'macro';
|
||
const GEAR_MACRO_PRESETS = [1, 2, 3];
|
||
const GEAR_MACRO_MAX_ENTRIES = 20;
|
||
// Verzoegerung nach einem Eintrag in ms: 10 ist im Spiel das Minimum (frueher 50) und die uebliche Einstellung
|
||
const GEAR_MACRO_DELAY_MIN = 10;
|
||
const GEAR_MACRO_DELAY_MAX = 9999;
|
||
const GEAR_MACRO_DELAY_DEFAULT = 10;
|
||
// Die Plaetze der Skill-Leiste mit der Standardbelegung ihrer Tasten - im Spiel in drei Vierergruppen nebeneinander
|
||
const GEAR_MACRO_KEYS = [
|
||
'1' => 'Taste 1', '2' => 'Taste 2', '3' => 'Taste 3', '4' => 'Taste 4',
|
||
'5' => 'Taste 5', '6' => 'Taste 6', '7' => 'Taste 7', '8' => 'Taste 8',
|
||
'Q' => 'Taste Q', 'E' => 'Taste E', 'LM' => 'Taste R (linke Maustaste)', 'RM' => 'Taste T (rechte Maustaste)',
|
||
];
|
||
// Skills je Taste: die Reihen 0-3 im Skill-Fenster. Reihe 0 zeigt die Leiste, das Makro nutzt sie der Reihe nach.
|
||
const GEAR_MACRO_KEY_ROWS = 4;
|
||
|
||
/**
|
||
* Skills, die auf die Skill-Leiste duerfen: die aktiven und die Stigma-Skills der Klasse (auch die, die aion2hub nicht
|
||
* mehr listet, damit alte Eintraege gueltig bleiben).
|
||
*
|
||
* @return array<int, array> [Skill-ID => Zeile]
|
||
*/
|
||
function gear_macro_skills(?string $className): array
|
||
{
|
||
return array_filter(
|
||
gear_skills_for_class($className, false),
|
||
static fn (array $skill): bool => in_array($skill['kind'], ['active', 'stigma'], true)
|
||
);
|
||
}
|
||
|
||
/** Verzoegerung aus dem Formular oder dem Speicher: ganze Millisekunden in den Grenzen des Spiels. */
|
||
function gear_macro_delay(mixed $value): int
|
||
{
|
||
$number = is_numeric($value) ? (int) round((float) $value) : GEAR_MACRO_DELAY_DEFAULT;
|
||
return max(GEAR_MACRO_DELAY_MIN, min(GEAR_MACRO_DELAY_MAX, $number));
|
||
}
|
||
|
||
/** Taste aus Formular oder Speicher: '1'-'8', 'Q', 'E', 'LM' oder 'RM', sonst null. */
|
||
function gear_macro_key(mixed $value): ?string
|
||
{
|
||
$key = is_string($value) || is_int($value) ? strtoupper(trim((string) $value)) : '';
|
||
return $key !== '' && isset(GEAR_MACRO_KEYS[$key]) ? $key : null;
|
||
}
|
||
|
||
/** Feld der Skill-Leiste als "Taste:Reihe" (z.B. "E:1") → [Taste, Reihe], sonst null. */
|
||
function gear_macro_cell(mixed $value): ?array
|
||
{
|
||
$parts = explode(':', is_string($value) ? $value : '');
|
||
$key = gear_macro_key($parts[0]);
|
||
if ($key === null || count($parts) !== 2 || !ctype_digit($parts[1]) || (int) $parts[1] >= GEAR_MACRO_KEY_ROWS) {
|
||
return null;
|
||
}
|
||
return [$key, (int) $parts[1]];
|
||
}
|
||
|
||
/** Skill-Leiste eines Presets in Form bringen: [Taste => [Skill-ID, …]] fuer alle Tasten, je hoechstens GEAR_MACRO_KEY_ROWS verschiedene. */
|
||
function gear_macro_bar_clean(mixed $bar): array
|
||
{
|
||
$out = [];
|
||
foreach (array_keys(GEAR_MACRO_KEYS) as $key) {
|
||
$raw = is_array($bar) ? ($bar[$key] ?? []) : [];
|
||
$ids = [];
|
||
foreach (is_array($raw) ? $raw : [] as $id) {
|
||
$id = is_numeric($id) ? (int) $id : 0;
|
||
if ($id > 0 && !in_array($id, $ids, true)) {
|
||
$ids[] = $id;
|
||
}
|
||
}
|
||
$out[$key] = array_slice($ids, 0, GEAR_MACRO_KEY_ROWS);
|
||
}
|
||
return $out;
|
||
}
|
||
|
||
/**
|
||
* Makro aller Presets in Form bringen: ['presets' => [Preset => [['k' => Taste, 'd' => Verzoegerung], …]], 'bars' =>
|
||
* [Preset => Skill-Leiste (gear_macro_bar_clean)]]. Aeltere Eintraege mit einem Skill statt einer Taste ('s') bekommen die
|
||
* Taste, auf der der Skill in Reihe 0 liegt, sonst die naechste freie - ist keine mehr frei, fallen sie weg.
|
||
*/
|
||
function gear_macro_clean(array $data): array
|
||
{
|
||
$presets = is_array($data['presets'] ?? null) ? $data['presets'] : [];
|
||
$bars = is_array($data['bars'] ?? null) ? $data['bars'] : [];
|
||
$out = ['presets' => [], 'bars' => []];
|
||
foreach (GEAR_MACRO_PRESETS as $preset) {
|
||
$bar = gear_macro_bar_clean($bars[$preset] ?? []);
|
||
$entries = [];
|
||
foreach (is_array($presets[$preset] ?? null) ? $presets[$preset] : [] as $entry) {
|
||
if (!is_array($entry)) {
|
||
continue;
|
||
}
|
||
$key = gear_macro_key($entry['k'] ?? null);
|
||
if ($key === null && is_numeric($entry['s'] ?? null) && (int) $entry['s'] > 0) {
|
||
$key = gear_macro_bar_place($bar, (int) $entry['s']);
|
||
}
|
||
if ($key !== null) {
|
||
$entries[] = ['k' => $key, 'd' => gear_macro_delay($entry['d'] ?? GEAR_MACRO_DELAY_DEFAULT)];
|
||
}
|
||
}
|
||
$out['presets'][$preset] = array_slice($entries, 0, GEAR_MACRO_MAX_ENTRIES);
|
||
$out['bars'][$preset] = $bar;
|
||
}
|
||
return $out;
|
||
}
|
||
|
||
/** Taste, auf der der Skill in Reihe 0 liegt - sonst kommt er auf die naechste freie Taste (null: keine mehr frei). */
|
||
function gear_macro_bar_place(array &$bar, int $skillId): ?string
|
||
{
|
||
foreach ($bar as $key => $ids) {
|
||
if (($ids[0] ?? 0) === $skillId) {
|
||
return (string) $key;
|
||
}
|
||
}
|
||
foreach ($bar as $key => $ids) {
|
||
if ($ids === []) {
|
||
$bar[$key] = [$skillId];
|
||
return (string) $key;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
|
||
/** Makro eines Sets (alle drei Presets, siehe gear_macro_clean). */
|
||
function gear_set_macro(int $setId): array
|
||
{
|
||
$stmt = db()->prepare('SELECT data FROM gear_set_plans WHERE set_id = ? AND section = ?');
|
||
$stmt->execute([$setId, GEAR_MACRO_SECTION]);
|
||
$data = json_decode((string) $stmt->fetchColumn(), true);
|
||
return gear_macro_clean(is_array($data) ? $data : []);
|
||
}
|
||
|
||
/** Eintraege aller Presets zusammen (Zahl im Reiter). */
|
||
function gear_macro_count(array $macro): int
|
||
{
|
||
return (int) array_sum(array_map('count', $macro['presets']));
|
||
}
|
||
|
||
/** Makro speichern - ohne Eintraege und belegte Tasten wird der Eintrag geloescht. */
|
||
function gear_set_macro_store(int $setId, array $macro): void
|
||
{
|
||
$macro = gear_macro_clean($macro);
|
||
$count = gear_macro_count($macro);
|
||
// Nur belegte Tasten und Presets mit Leiste
|
||
$bars = array_filter(array_map(static fn (array $bar): array => array_filter($bar), $macro['bars']));
|
||
if ($count === 0 && $bars === []) {
|
||
db()->prepare('DELETE FROM gear_set_plans WHERE set_id = ? AND section = ?')->execute([$setId, GEAR_MACRO_SECTION]);
|
||
return;
|
||
}
|
||
db()->prepare(
|
||
'INSERT INTO gear_set_plans (set_id, section, data, updated_at) VALUES (?, ?, ?, NOW())
|
||
ON DUPLICATE KEY UPDATE data = VALUES(data), updated_at = NOW()'
|
||
)->execute([$setId, GEAR_MACRO_SECTION, json_encode(['presets' => $macro['presets'], 'bars' => $bars, '_count' => (string) $count], JSON_UNESCAPED_UNICODE)]);
|
||
}
|
||
|
||
/**
|
||
* Eine Aenderung an Makro oder Skill-Leiste eines Presets (Knoepfe im Formular, mit JavaScript genauso), Nr zaehlt ab 0.
|
||
* Eintraege: add:<Taste>, replace:<Nr>:<Taste>, remove:<Nr>, up:<Nr>, down:<Nr>. Leiste: slot:<Taste>:<Reihe>:<Skill-ID>
|
||
* (belegen oder austauschen), unslot:<Taste>:<Reihe>, slotup:<Taste>:<Reihe>, slotdown:<Taste>:<Reihe> und
|
||
* copybar:<Preset> (die Leiste eines anderen Presets uebernehmen). $bars = die Leisten aller Presets.
|
||
*
|
||
* @return array{0: array, 1: array, 2: ?string} neue Eintraege, neue Leiste und ggf. ein Hinweis, warum nichts passiert ist
|
||
*/
|
||
function gear_macro_apply(array $entries, array $bar, string $op, array $skills, array $bars): array
|
||
{
|
||
$parts = explode(':', $op);
|
||
$index = (int) ($parts[1] ?? -1);
|
||
switch ($parts[0]) {
|
||
case 'add':
|
||
case 'replace':
|
||
$key = gear_macro_key($parts[0] === 'add' ? ($parts[1] ?? null) : ($parts[2] ?? null));
|
||
if ($key === null) {
|
||
return [$entries, $bar, 'Diese Taste gibt es nicht.'];
|
||
}
|
||
if ($bar[$key] === []) {
|
||
return [$entries, $bar, 'Auf ' . GEAR_MACRO_KEYS[$key] . ' liegt noch kein Skill – belege sie zuerst in der Skill-Leiste.'];
|
||
}
|
||
if ($parts[0] === 'replace') {
|
||
if (isset($entries[$index])) {
|
||
$entries[$index]['k'] = $key;
|
||
}
|
||
break;
|
||
}
|
||
if (count($entries) >= GEAR_MACRO_MAX_ENTRIES) {
|
||
return [$entries, $bar, 'Mehr als ' . GEAR_MACRO_MAX_ENTRIES . ' Einträge gehen nicht – lösche erst einen.'];
|
||
}
|
||
$entries[] = ['k' => $key, 'd' => GEAR_MACRO_DELAY_DEFAULT];
|
||
break;
|
||
case 'remove':
|
||
if (isset($entries[$index])) {
|
||
array_splice($entries, $index, 1);
|
||
}
|
||
break;
|
||
case 'up':
|
||
case 'down':
|
||
$other = $parts[0] === 'up' ? $index - 1 : $index + 1;
|
||
if (isset($entries[$index], $entries[$other])) {
|
||
[$entries[$index], $entries[$other]] = [$entries[$other], $entries[$index]];
|
||
}
|
||
break;
|
||
case 'slot':
|
||
case 'unslot':
|
||
case 'slotup':
|
||
case 'slotdown':
|
||
$cell = gear_macro_cell(($parts[1] ?? '') . ':' . ($parts[2] ?? ''));
|
||
if ($cell === null) {
|
||
return [$entries, $bar, 'Dieses Feld der Skill-Leiste gibt es nicht.'];
|
||
}
|
||
[$key, $row] = $cell;
|
||
$ids = $bar[$key];
|
||
if ($parts[0] === 'slot') {
|
||
$skillId = (int) ($parts[3] ?? 0);
|
||
if (!isset($skills[$skillId])) {
|
||
return [$entries, $bar, 'Diesen Skill gibt es für die Klasse des Sets nicht.'];
|
||
}
|
||
$at = array_search($skillId, $ids, true);
|
||
if ($at !== false && $row < count($ids)) {
|
||
// Liegt schon auf der Taste: die beiden tauschen die Reihe
|
||
[$ids[$at], $ids[$row]] = [$ids[$row], $ids[$at]];
|
||
} elseif ($at !== false) {
|
||
array_splice($ids, $at, 1);
|
||
$ids[] = $skillId;
|
||
} elseif ($row < count($ids)) {
|
||
$ids[$row] = $skillId;
|
||
} elseif (count($ids) >= GEAR_MACRO_KEY_ROWS) {
|
||
return [$entries, $bar, 'Auf einer Taste liegen höchstens ' . GEAR_MACRO_KEY_ROWS . ' Skills.'];
|
||
} else {
|
||
$ids[] = $skillId;
|
||
}
|
||
} elseif ($parts[0] === 'unslot') {
|
||
if (isset($ids[$row])) {
|
||
array_splice($ids, $row, 1);
|
||
}
|
||
} else {
|
||
$other = $parts[0] === 'slotup' ? $row - 1 : $row + 1;
|
||
if (isset($ids[$row], $ids[$other])) {
|
||
[$ids[$row], $ids[$other]] = [$ids[$other], $ids[$row]];
|
||
}
|
||
}
|
||
$bar[$key] = array_values($ids);
|
||
break;
|
||
case 'copybar':
|
||
if (isset($bars[$index])) {
|
||
$bar = $bars[$index];
|
||
}
|
||
break;
|
||
}
|
||
return [array_values($entries), $bar, null];
|
||
}
|
||
|
||
/** Skills, die es fuer die Klasse des Sets nicht gibt, von der Leiste nehmen: [Leiste, Anzahl weggefallener Skills]. */
|
||
function gear_macro_bar_keep(array $bar, array $skills): array
|
||
{
|
||
$dropped = 0;
|
||
foreach ($bar as $key => $ids) {
|
||
$kept = array_values(array_filter($ids, static fn (int $id): bool => isset($skills[$id])));
|
||
$dropped += count($ids) - count($kept);
|
||
$bar[$key] = $kept;
|
||
}
|
||
return [$bar, $dropped];
|
||
}
|
||
|
||
/**
|
||
* Erreichte Stufe der Skills im Set (selbst gesteigert + Boni aus Daevanion und Arcana): [Skill-ID => Stufe].
|
||
* Aktive Skills haben im Spiel ab dem Lernen Stufe 1, Stigmen ohne Stufe sind nicht eingesetzt (0).
|
||
*/
|
||
function gear_macro_levels(array $set, array $skills, array $plans): array
|
||
{
|
||
$rows = gear_set_skill_rows((int) $set['id']);
|
||
$bonuses = gear_plan_skill_bonuses($set, $plans);
|
||
$levels = [];
|
||
foreach ($skills as $id => $skill) {
|
||
$own = min($rows[$id]['level'] ?? 0, gear_skill_level_max($skill['kind']));
|
||
$levels[$id] = $own > 0
|
||
? gear_skill_effective_level($skill['kind'], $own, (int) array_sum($bonuses[$id] ?? []))
|
||
: ($skill['kind'] === 'active' ? 1 : 0);
|
||
}
|
||
return $levels;
|
||
}
|
||
|
||
/** Skill-Symbol fuer Makro-Eintraege, Leiste und Auswahl (mit Stufe unten rechts wie im Spiel). */
|
||
function gear_macro_icon_html(?array $skill, int $level, int $size): string
|
||
{
|
||
$url = gear_skill_icon_url($skill);
|
||
$name = $skill !== null ? gear_skill_display_name($skill) : '?';
|
||
return ($url !== null
|
||
? '<img src="' . e($url) . '" alt="" width="' . $size . '" height="' . $size . '" loading="lazy">'
|
||
: '<span class="gear-macro-initial">' . e(mb_substr($name, 0, 1)) . '</span>')
|
||
. '<span class="gear-macro-lv">' . ($level > 0 ? 'Lv. ' . $level : '–') . '</span>';
|
||
}
|
||
|
||
/** Beschriftung einer Taste wie im Spiel: Ziffer bzw. Buchstabe, bei den Maustasten eine kleine Maus mit der Taste in Farbe. */
|
||
function gear_macro_key_html(string $key): string
|
||
{
|
||
if ($key !== 'LM' && $key !== 'RM') {
|
||
return '<span class="gear-macro-key">' . e($key) . '</span>';
|
||
}
|
||
// Im Spiel liegen die Maustasten auf R (links) und T (rechts): "R (Maus links)", "T (Maus rechts)"
|
||
$button = $key === 'LM' ? 'M5 1A4 4 0 0 0 1 5v1.5h4z' : 'M5 1a4 4 0 0 1 4 4v1.5H5z';
|
||
$letter = $key === 'LM' ? 'R' : 'T';
|
||
return '<span class="gear-macro-key is-mouse" role="img" aria-label="' . e(GEAR_MACRO_KEYS[$key]) . '" title="' . e(GEAR_MACRO_KEYS[$key]) . '">'
|
||
. $letter . '<span class="gear-macro-key-mouse">(<svg viewBox="0 0 10 14" width="10" height="14" aria-hidden="true"><path class="gear-macro-key-on" d="' . $button . '"/>'
|
||
. '<rect x="1" y="1" width="8" height="12" rx="4" fill="none" stroke="currentColor" stroke-width="1.2"/>'
|
||
. '<path d="M1 6.5h8M5 1v5.5" fill="none" stroke="currentColor" stroke-width="1"/></svg>)</span></span>';
|
||
}
|
||
|
||
/** Name eines Skills der Leiste (auch fuer Skills, die nicht zur Klasse gehoeren). */
|
||
function gear_macro_skill_name(int $skillId, array $skills): string
|
||
{
|
||
return isset($skills[$skillId]) ? gear_skill_display_name($skills[$skillId]) : 'Skill #' . $skillId;
|
||
}
|
||
|
||
/** Eine Taste als Text fuer "Als Text kopieren": "Taste E: Pfeilhagel (Stufe 10), dann Wirbelpfeil (Stufe 3)". */
|
||
function gear_macro_key_text(string $key, array $ids, array $skills, array $levels): string
|
||
{
|
||
$names = [];
|
||
foreach ($ids as $id) {
|
||
$level = $levels[$id] ?? 0;
|
||
$names[] = gear_macro_skill_name($id, $skills) . ($level > 0 ? ' (Stufe ' . $level . ')' : '');
|
||
}
|
||
return GEAR_MACRO_KEYS[$key] . ': ' . ($names ? implode(', dann ', $names) : 'leer');
|
||
}
|
||
|
||
/**
|
||
* Skill-Leiste eines Presets wie im Skill-Fenster: je Taste eine Spalte mit den Reihen 3 bis 0 (Reihe 0 unten, direkt
|
||
* ueber der Taste). Im eigenen Set ist jedes belegte Feld und das erste freie je Taste ein Knopf: ohne JavaScript schickt
|
||
* er das Formular mit cell=… ab und die Seite kommt mit der Skill-Auswahl fuer dieses Feld zurueck ($open = [Taste,
|
||
* Reihe]), mit JavaScript oeffnet gear-macro.js die Auswahl gleich darunter.
|
||
*/
|
||
function gear_macro_bar_html(array $set, int $preset, array $bars, array $skills, array $levels, bool $isOwn, ?array $open): string
|
||
{
|
||
$bar = $bars[$preset];
|
||
$className = (string) ($set['class_name'] ?? '');
|
||
$html = '<section class="gear-macro-bar" id="leiste-' . $preset . '" aria-label="Skill-Leiste Preset ' . $preset . '">'
|
||
. '<div class="gear-macro-bar-head"><h4>Skill-Leiste</h4><span class="gear-macro-bar-sub">bis zu ' . GEAR_MACRO_KEY_ROWS . ' Skills je Taste</span>';
|
||
if ($isOwn) {
|
||
$html .= '<span class="gear-save-status" data-macro-status aria-live="polite"></span>';
|
||
// Die Leiste eines anderen Presets uebernehmen - im Spiel liegen oft dieselben Skills auf denselben Tasten
|
||
foreach (GEAR_MACRO_PRESETS as $other) {
|
||
if ($other !== $preset && array_filter($bars[$other])) {
|
||
$html .= '<button type="submit" class="button button-secondary button-small gear-macro-bar-copy" name="op" value="copybar:' . $other . '"'
|
||
. (array_filter($bar) ? ' data-confirm="Die Skill-Leiste von Preset ' . $preset . ' wird durch die von Preset ' . $other . ' ersetzt." data-confirm-title="Leiste übernehmen?" data-confirm-ok="Übernehmen"' : '')
|
||
. '>Leiste von Preset ' . $other . ' übernehmen</button>';
|
||
}
|
||
}
|
||
}
|
||
$html .= '</div>';
|
||
|
||
$rowLabels = '';
|
||
for ($row = GEAR_MACRO_KEY_ROWS - 1; $row >= 0; $row--) {
|
||
$rowLabels .= '<span>' . $row . '</span>';
|
||
}
|
||
$html .= '<div class="gear-macro-bar-keys"><div class="gear-macro-bar-rows" aria-hidden="true">' . $rowLabels . '<span></span></div>';
|
||
$i = 0;
|
||
foreach ($bar as $key => $ids) {
|
||
$key = (string) $key;
|
||
if ($i === 6) {
|
||
// Auf schmalen Bildschirmen zwei Zeilen mit je sechs Tasten, jede mit den Reihennummern davor
|
||
$html .= '<span class="gear-macro-bar-break" aria-hidden="true"></span>'
|
||
. '<div class="gear-macro-bar-rows is-second" aria-hidden="true">' . $rowLabels . '<span></span></div>';
|
||
}
|
||
$html .= '<div class="gear-macro-bar-key' . ($i === 3 || $i === 7 ? ' is-group-end' : '') . '" role="group" aria-label="' . e(GEAR_MACRO_KEYS[$key]) . '">';
|
||
for ($row = GEAR_MACRO_KEY_ROWS - 1; $row >= 0; $row--) {
|
||
$html .= gear_macro_bar_cell_html($key, $row, $ids, $skills, $levels, $className, $isOwn, $open !== null && $open === [$key, $row]);
|
||
}
|
||
$html .= '<span class="gear-macro-bar-label">' . gear_macro_key_html($key) . '</span></div>';
|
||
$i++;
|
||
}
|
||
$html .= '</div>';
|
||
if ($isOwn) {
|
||
$html .= gear_macro_bar_picker_html($set, $preset, $bar, $skills, $levels, $open);
|
||
}
|
||
return $html . '</section>';
|
||
}
|
||
|
||
/** Ein Feld der Skill-Leiste: Skill-Symbol, im eigenen Set als Knopf; das erste freie Feld je Taste zum Hinzufuegen. */
|
||
function gear_macro_bar_cell_html(string $key, int $row, array $ids, array $skills, array $levels, string $className, bool $isOwn, bool $isOpen): string
|
||
{
|
||
$cell = $key . ':' . $row;
|
||
$label = GEAR_MACRO_KEYS[$key] . ', Reihe ' . $row;
|
||
$id = $ids[$row] ?? null;
|
||
if ($id === null) {
|
||
if (!$isOwn || $row !== count($ids)) {
|
||
return '<span class="gear-macro-cell is-empty"></span>';
|
||
}
|
||
return '<span class="gear-macro-cell is-empty is-add' . ($isOpen ? ' is-picking' : '') . '">'
|
||
. '<button type="submit" class="gear-macro-cell-button" name="cell" value="' . e($cell) . '" data-bar-cell="' . e($cell) . '"'
|
||
. ' data-bar-title="' . e($label . ': Skill wählen') . '" aria-label="' . e($label . ': Skill hinzufügen') . '" title="Skill auf ' . e(GEAR_MACRO_KEYS[$key]) . ' legen">+</button></span>';
|
||
}
|
||
$skill = $skills[$id] ?? null;
|
||
$name = gear_macro_skill_name($id, $skills);
|
||
$level = $levels[$id] ?? 0;
|
||
$warn = match (true) {
|
||
$skill === null => 'gehört nicht zu ' . ($className !== '' ? $className : 'der Klasse') . ($isOwn ? ' – fällt beim nächsten Speichern weg' : ''),
|
||
$skill['kind'] === 'stigma' && $level === 0 => 'Stigma im Set nicht gesteigert',
|
||
default => '',
|
||
};
|
||
$html = '<span class="gear-macro-cell' . ($skill === null ? ' is-warn' : ($warn !== '' ? ' is-unplanned' : '')) . ($isOpen ? ' is-picking' : '') . '"'
|
||
. ' data-skill' . ($skill !== null ? ' data-tip-ref="gear-macro-tip-' . $id . '"' : '') . '>';
|
||
$icon = gear_macro_icon_html($skill, $level, 44);
|
||
if (!$isOwn) {
|
||
return $html . '<span class="gear-macro-cell-button" data-skill-tip role="img" aria-label="' . e($label . ': ' . $name) . '"'
|
||
. ($warn !== '' ? ' title="' . e($warn) . '"' : '') . '>' . $icon . '</span></span>';
|
||
}
|
||
return $html . '<button type="submit" class="gear-macro-cell-button" name="cell" value="' . e($cell) . '" data-bar-cell="' . e($cell) . '"'
|
||
. ' data-bar-skill="' . $id . '"' . ($row === count($ids) - 1 ? ' data-bar-last' : '')
|
||
. ' data-bar-title="' . e($label . ': anderen Skill wählen') . '" data-skill-tip aria-label="' . e($label . ': ' . $name . ($warn !== '' ? ' (' . $warn . ')' : '') . ' – ändern') . '">'
|
||
. $icon . '</button></span>';
|
||
}
|
||
|
||
/**
|
||
* Skill-Auswahl fuer ein Feld der Leiste wie die Skill-Liste im Spiel: aktive Skills, dann die Stigmen (gesteigerte
|
||
* zuerst); Skills, die schon auf einer Taste liegen, tragen deren Beschriftung. Dazu Knoepfe, um den Skill der Taste
|
||
* frueher oder spaeter zu nutzen (Reihe tauschen) oder von der Taste zu nehmen. Ohne JavaScript nur fuer das Feld $open
|
||
* sichtbar, die Knoepfe tragen dann dessen Aenderung; mit JavaScript stellt gear-macro.js das Feld ein.
|
||
*/
|
||
function gear_macro_bar_picker_html(array $set, int $preset, array $bar, array $skills, array $levels, ?array $open): string
|
||
{
|
||
[$key, $row] = $open ?? ['', 0];
|
||
$cell = $open !== null ? $key . ':' . $row : '';
|
||
$ids = $open !== null ? $bar[$key] : [];
|
||
$current = $ids[$row] ?? null;
|
||
$onKeys = [];
|
||
foreach ($bar as $barKey => $list) {
|
||
foreach ($list as $id) {
|
||
$onKeys[$id][] = (string) $barKey;
|
||
}
|
||
}
|
||
$html = '<div class="gear-macro-picker gear-macro-bar-picker" data-bar-picker data-cell="' . e($cell) . '"' . ($open === null ? ' hidden' : '') . '>'
|
||
. '<div class="gear-macro-bar-picker-head">'
|
||
. '<p class="gear-macro-picker-title" data-bar-picker-title>'
|
||
. ($open !== null ? e(GEAR_MACRO_KEYS[$key] . ', Reihe ' . $row . ': ' . ($current !== null ? 'anderen Skill wählen' : 'Skill wählen')) : '') . '</p>'
|
||
. '<span class="gear-macro-bar-tools" data-bar-tools' . ($current === null ? ' hidden' : '') . '>'
|
||
. '<button type="submit" class="icon-button gear-macro-up" name="op" value="slotup:' . e($cell) . '" data-bar-op="slotup"'
|
||
. ' title="Früher nutzen (eine Reihe tiefer)" aria-label="Früher nutzen"' . ($row === 0 ? ' disabled' : '') . '>' . icon('chevron-down') . '</button>'
|
||
. '<button type="submit" class="icon-button" name="op" value="slotdown:' . e($cell) . '" data-bar-op="slotdown"'
|
||
. ' title="Später nutzen (eine Reihe höher)" aria-label="Später nutzen"' . ($row >= count($ids) - 1 ? ' disabled' : '') . '>' . icon('chevron-down') . '</button>'
|
||
. '<button type="submit" class="icon-button icon-button-danger" name="op" value="unslot:' . e($cell) . '" data-bar-op="unslot"'
|
||
. ' title="Von der Taste nehmen" aria-label="Von der Taste nehmen">' . icon('trash') . '</button>'
|
||
. '</span>'
|
||
. '<a class="icon-button gear-macro-bar-close" href="/gear.php?set=' . (int) $set['id'] . '&tab=macro&preset=' . $preset . '#leiste-' . $preset . '"'
|
||
. ' data-bar-close title="Schließen" aria-label="Auswahl schließen">' . icon('x') . '</a>'
|
||
. '</div>';
|
||
|
||
$groups = ['active' => [], 'stigma' => []];
|
||
foreach ($skills as $id => $skill) {
|
||
if ((int) $skill['is_listed'] === 1) {
|
||
$groups[$skill['kind']][$id] = $skill;
|
||
}
|
||
}
|
||
uksort($groups['stigma'], static fn (int $a, int $b): int => ($levels[$b] > 0) <=> ($levels[$a] > 0) ?: (int) $groups['stigma'][$a]['sort_order'] <=> (int) $groups['stigma'][$b]['sort_order']);
|
||
foreach (['active' => 'Aktive Skills', 'stigma' => 'Stigma-Skills'] as $kind => $label) {
|
||
if (!$groups[$kind]) {
|
||
continue;
|
||
}
|
||
$html .= '<div class="gear-macro-picker-group"><span class="gear-macro-picker-label">' . $label . '</span><div class="gear-macro-picker-grid">';
|
||
foreach ($groups[$kind] as $id => $skill) {
|
||
$name = gear_skill_display_name($skill);
|
||
$keys = $onKeys[$id] ?? [];
|
||
$html .= '<span class="gear-macro-pick-wrap' . ($kind === 'stigma' && $levels[$id] === 0 ? ' is-unplanned' : '') . '" data-skill data-tip-ref="gear-macro-tip-' . (int) $id . '">'
|
||
. '<button type="submit" class="gear-macro-pick' . ($id === $current ? ' is-current' : '') . '" name="op" value="slot:' . e($cell) . ':' . (int) $id . '"'
|
||
. ' data-pick-bar-skill="' . (int) $id . '" data-skill-tip aria-label="' . e($name . ($keys ? ' – liegt auf ' . implode(', ', array_map(static fn (string $k): string => GEAR_MACRO_KEYS[$k], $keys)) : '')) . '">'
|
||
. gear_macro_icon_html($skill, $levels[$id], 44)
|
||
. ($keys ? '<span class="gear-macro-pick-keys">' . implode('', array_map('gear_macro_key_html', $keys)) . '</span>' : '')
|
||
. '</button></span>';
|
||
}
|
||
$html .= '</div></div>';
|
||
}
|
||
return $html . '</div>';
|
||
}
|
||
|
||
/**
|
||
* Tasten-Auswahl fuer einen Makro-Eintrag wie im Spiel: die zwoelf Tasten der Leiste mit ihrem Skill aus Reihe 0 und
|
||
* wie viele Skills noch darauf liegen. Leere Tasten lassen sich nicht waehlen. Jeder Knopf fuegt ohne JavaScript die
|
||
* Taste hinzu (op=add:<Taste>); mit JavaScript tauscht er auch die Taste eines Eintrags aus.
|
||
*/
|
||
function gear_macro_key_picker_html(array $bar, array $skills, array $levels): string
|
||
{
|
||
$html = '<div class="gear-macro-picker"><p class="gear-macro-picker-title" data-macro-picker-title>Taste für den neuen Eintrag wählen</p>'
|
||
. '<div class="gear-macro-keys">';
|
||
$hasEmpty = false;
|
||
// In den Vierergruppen des Spiels (1-4, 5-8, Q/E/Maustasten), die nur als Ganzes umbrechen
|
||
foreach (array_chunk($bar, 4, true) as $group) {
|
||
$html .= '<div class="gear-macro-keys-group">';
|
||
foreach ($group as $key => $ids) {
|
||
$key = (string) $key;
|
||
$first = $ids[0] ?? null;
|
||
$skill = $first !== null ? ($skills[$first] ?? null) : null;
|
||
$more = max(0, count($ids) - 1);
|
||
$hasEmpty = $hasEmpty || $first === null;
|
||
$name = $first !== null ? gear_macro_skill_name($first, $skills) . ($more > 0 ? ' und ' . $more . ' weitere' : '') : 'leer';
|
||
$html .= '<span class="gear-macro-pick-wrap"' . ($skill !== null ? ' data-skill data-tip-ref="gear-macro-tip-' . (int) $first . '"' : '') . '>'
|
||
. '<button type="submit" class="gear-macro-pick gear-macro-key-pick' . ($first === null ? ' is-empty' : '') . '" name="op" value="add:' . e($key) . '"'
|
||
. ' data-pick-key="' . e($key) . '"' . ($skill !== null ? ' data-skill-tip' : '') . ($first === null ? ' disabled' : '')
|
||
. ' aria-label="' . e(GEAR_MACRO_KEYS[$key] . ': ' . $name) . '">'
|
||
. '<span class="gear-macro-keybadge">' . gear_macro_key_html($key) . '</span>'
|
||
. ($first !== null ? gear_macro_icon_html($skill, $levels[$first] ?? 0, 44) : '')
|
||
. ($more > 0 ? '<span class="gear-macro-more">+' . $more . '</span>' : '')
|
||
. '</button></span>';
|
||
}
|
||
$html .= '</div>';
|
||
}
|
||
$html .= '</div>';
|
||
if ($hasEmpty) {
|
||
$html .= '<p class="gear-macro-picker-hint">Leere Tasten belegst du oben in der Skill-Leiste.</p>';
|
||
}
|
||
return $html . '</div>';
|
||
}
|
||
|
||
/**
|
||
* Ein Preset: oben die Skill-Leiste, darunter das Makro-Fenster mit den nummerierten Eintraegen (Taste mit ihren Skills,
|
||
* Verzoegerung danach), fuers eigene Set mit Knoepfen zum Verschieben und Loeschen und darunter "Makro hinzufuegen" mit
|
||
* der Tasten-Auswahl. Ohne JavaScript schicken die Knoepfe das Formular mit op=… ab, mit JavaScript tauscht gear-macro.js
|
||
* das Preset aus. $open = das ohne JavaScript geoeffnete Feld der Leiste (gear_macro_bar_html).
|
||
*/
|
||
function gear_macro_preset_html(array $set, int $preset, array $macro, array $skills, array $levels, bool $isOwn, bool $visible, ?array $open = null): string
|
||
{
|
||
$className = (string) ($set['class_name'] ?? '');
|
||
$entries = $macro['presets'][$preset];
|
||
$bar = $macro['bars'][$preset];
|
||
$full = count($entries) >= GEAR_MACRO_MAX_ENTRIES;
|
||
$html = '<form method="post" action="/gear_action.php" class="gear-macro-form" data-macro-form data-preset="' . $preset . '"'
|
||
. ($visible ? '' : ' hidden') . '>';
|
||
if ($isOwn) {
|
||
$html .= csrf_field()
|
||
. '<input type="hidden" name="action" value="save_macro">'
|
||
. '<input type="hidden" name="set_id" value="' . (int) $set['id'] . '">'
|
||
. '<input type="hidden" name="preset" value="' . $preset . '">';
|
||
}
|
||
if ($isOwn || array_filter($bar)) {
|
||
$html .= gear_macro_bar_html($set, $preset, $macro['bars'], $skills, $levels, $isOwn, $open);
|
||
}
|
||
|
||
$html .= '<div class="gear-macro-window"><div class="gear-macro-title">Makro <span class="gear-macro-title-preset">Preset ' . $preset . '</span></div>';
|
||
if (!$entries) {
|
||
$html .= '<p class="gear-macro-empty">' . ($isOwn
|
||
? (array_filter($bar) ? 'Noch keine Einträge – füge unten die erste Taste hinzu.' : 'Noch keine Einträge – belege zuerst oben die Skill-Leiste, dann fügst du hier ihre Tasten hinzu.')
|
||
: 'In diesem Preset ist kein Makro angelegt.') . '</p>';
|
||
} else {
|
||
$html .= '<ol class="gear-macro-list">';
|
||
$last = count($entries) - 1;
|
||
foreach ($entries as $index => $entry) {
|
||
$key = $entry['k'];
|
||
$ids = $bar[$key];
|
||
$first = $ids[0] ?? null;
|
||
$skill = $first !== null ? ($skills[$first] ?? null) : null;
|
||
$name = $first !== null ? gear_macro_skill_name($first, $skills) : 'Keine Skills auf der Taste';
|
||
$level = $first !== null ? ($levels[$first] ?? 0) : 0;
|
||
$no = $index + 1;
|
||
$warn = match (true) {
|
||
$first === null => $isOwn ? 'Belege ' . GEAR_MACRO_KEYS[$key] . ' oben in der Skill-Leiste' : '',
|
||
$skill === null => 'gehört nicht zu ' . ($className !== '' ? $className : 'der Klasse') . ($isOwn ? ' – fällt beim nächsten Speichern weg' : ''),
|
||
$skill['kind'] === 'stigma' && $level === 0 => 'Stigma im Set nicht gesteigert',
|
||
default => '',
|
||
};
|
||
$html .= '<li class="gear-macro-entry' . ($warn !== '' || $first === null ? ' is-warn' : '') . '"'
|
||
. ($skill !== null ? ' data-skill data-tip-ref="gear-macro-tip-' . (int) $first . '"' : '') . ' data-macro-entry="' . $index . '"'
|
||
. ' data-macro-text="' . e(gear_macro_key_text($key, $ids, $skills, $levels)) . '">'
|
||
. '<span class="gear-macro-no">' . $no . '</span>'
|
||
. '<div class="gear-macro-skill">';
|
||
$icon = '<span class="gear-macro-keybadge">' . gear_macro_key_html($key) . '</span>'
|
||
. ($first !== null ? gear_macro_icon_html($skill, $level, 58) : '<span class="gear-macro-initial">✦</span>');
|
||
$html .= $isOwn
|
||
? '<button type="button" class="gear-macro-icon" data-macro-pick="' . $index . '"' . ($skill !== null ? ' data-skill-tip' : '')
|
||
. ' aria-label="' . e('Eintrag ' . $no . ': ' . GEAR_MACRO_KEYS[$key] . ' – ' . $name . ' – andere Taste wählen') . '" title="Klicken, um eine andere Taste zu wählen">' . $icon . '</button>'
|
||
: '<span class="gear-macro-icon"' . ($skill !== null ? ' data-skill-tip' : '') . '>' . $icon . '</span>';
|
||
$html .= '<span class="gear-macro-name">' . e($name) . '</span>';
|
||
if (count($ids) > 1) {
|
||
// Weitere Skills der Taste (Reihen 1-3): das Makro nutzt sie der Reihe nach
|
||
$html .= '<span class="gear-macro-stack"><span class="gear-macro-stack-label">dann</span>';
|
||
foreach (array_slice($ids, 1) as $id) {
|
||
$stackSkill = $skills[$id] ?? null;
|
||
$html .= '<span class="gear-macro-stack-icon' . ($stackSkill === null ? ' is-warn' : '') . '"'
|
||
. ($stackSkill !== null ? ' data-skill data-tip-ref="gear-macro-tip-' . $id . '"' : '') . '>'
|
||
. '<span class="gear-macro-stack-img"' . ($stackSkill !== null ? ' data-skill-tip' : '') . ' role="img" aria-label="' . e(gear_macro_skill_name($id, $skills)) . '">'
|
||
. (($url = gear_skill_icon_url($stackSkill)) !== null ? '<img src="' . e($url) . '" alt="" width="26" height="26" loading="lazy">' : e(mb_substr(gear_macro_skill_name($id, $skills), 0, 1)))
|
||
. '</span></span>';
|
||
}
|
||
$html .= '</span>';
|
||
}
|
||
$html .= ($warn !== '' ? '<span class="gear-macro-warn">' . e($warn) . '</span>' : '')
|
||
. '</div>';
|
||
if ($isOwn) {
|
||
$html .= '<div class="gear-macro-tools">'
|
||
. '<button type="submit" class="icon-button gear-macro-up" name="op" value="up:' . $index . '" title="Nach oben" aria-label="Eintrag ' . $no . ' nach oben"'
|
||
. ($index === 0 ? ' disabled' : '') . '>' . icon('chevron-down') . '</button>'
|
||
. '<button type="submit" class="icon-button" name="op" value="down:' . $index . '" title="Nach unten" aria-label="Eintrag ' . $no . ' nach unten"'
|
||
. ($index === $last ? ' disabled' : '') . '>' . icon('chevron-down') . '</button>'
|
||
. '<button type="submit" class="icon-button icon-button-danger" name="op" value="remove:' . $index . '" title="Löschen" aria-label="Eintrag ' . $no . ' löschen">'
|
||
. icon('trash') . '</button>'
|
||
. '</div>'
|
||
. '<input type="hidden" name="key[]" value="' . e($key) . '">'
|
||
. '<div class="gear-macro-delay"><label>Verzögerung'
|
||
. ' <input type="number" name="delay[]" value="' . (int) $entry['d'] . '" min="' . GEAR_MACRO_DELAY_MIN . '" max="' . GEAR_MACRO_DELAY_MAX . '" step="1"'
|
||
. ' inputmode="numeric" required aria-label="Verzögerung nach Eintrag ' . $no . ' in Millisekunden" data-macro-delay>'
|
||
. ' ms</label></div>';
|
||
} else {
|
||
$html .= '<div class="gear-macro-delay"><span>Verzögerung <strong>' . (int) $entry['d'] . '</strong> ms</span></div>';
|
||
}
|
||
$html .= '</li>';
|
||
}
|
||
$html .= '</ol>';
|
||
}
|
||
|
||
if ($isOwn) {
|
||
// Die Auswahl gibt es auch bei vollem Makro: mit JavaScript tauscht sie die Taste eines Eintrags aus
|
||
$html .= '<div class="gear-macro-foot">'
|
||
. '<details class="gear-macro-add" data-macro-picker' . ($full ? ' data-full' : '') . '>'
|
||
. '<summary class="gear-macro-add-button' . ($full ? ' is-disabled' : '') . '"' . ($full ? ' aria-disabled="true"' : '') . '>Makro hinzufügen</summary>'
|
||
. gear_macro_key_picker_html($bar, $skills, $levels)
|
||
. '</details>'
|
||
. ($full ? '<p class="gear-macro-full" data-macro-full>Die Höchstzahl von ' . GEAR_MACRO_MAX_ENTRIES . ' Einträgen ist erreicht. Lösche erst einen, bevor du einen neuen hinzufügst.</p>' : '')
|
||
. '<div class="gear-macro-save">'
|
||
. '<button type="submit" class="button button-secondary button-small" data-autosave-fallback>Verzögerungen speichern</button>'
|
||
. '<span class="gear-save-status" data-macro-status aria-live="polite"></span>'
|
||
. '</div></div>';
|
||
}
|
||
return $html . '</div></form>';
|
||
}
|
||
|
||
/**
|
||
* Die Unterseite "Makro": Presets 1-3 wie im Skill-Fenster des Spiels, darunter Skill-Leiste und Makro-Fenster des
|
||
* gewaehlten Presets. $plans = Plaene der Seiten Arcana, Daevanion usw. (fuer die erreichte Stufe der Skills), $cell =
|
||
* das ohne JavaScript geoeffnete Feld der Leiste ("Taste:Reihe").
|
||
*/
|
||
function gear_render_macro_tab(array $set, bool $isOwn, bool $canManage, array $plans, int $activePreset, string $cell = ''): void
|
||
{
|
||
$className = !empty($set['class_name']) ? (string) $set['class_name'] : null;
|
||
$skills = gear_macro_skills($className);
|
||
$macro = gear_set_macro((int) $set['id']);
|
||
$levels = gear_macro_levels($set, $skills, $plans);
|
||
if (!in_array($activePreset, GEAR_MACRO_PRESETS, true)) {
|
||
// Ohne Angabe das erste Preset mit Eintraegen, sonst das erste mit belegter Leiste
|
||
$activePreset = GEAR_MACRO_PRESETS[0];
|
||
foreach ([$macro['presets'], array_map('array_filter', $macro['bars'])] as $filled) {
|
||
$first = array_key_first(array_filter($filled));
|
||
if ($first !== null) {
|
||
$activePreset = (int) $first;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
$open = $isOwn ? gear_macro_cell($cell) : null;
|
||
// Info-Blasen der Skills je einmal (Leiste, Eintraege und Auswahl verweisen mit data-tip-ref darauf, siehe gear.js)
|
||
$tipIds = [];
|
||
foreach ($macro['bars'] as $bar) {
|
||
foreach ($bar as $ids) {
|
||
$tipIds += array_fill_keys($ids, true);
|
||
}
|
||
}
|
||
if ($isOwn) {
|
||
$tipIds += array_fill_keys(array_keys($skills), true);
|
||
}
|
||
?>
|
||
<div class="panel gear-skills gear-macro" id="makro" data-macro
|
||
data-macro-title="<?= e($set['name'] . ($className !== null ? ' · ' . $className : '')) ?>">
|
||
<div class="gear-skills-head">
|
||
<h3>Makro<?= $className !== null ? ' · ' . e($className) : '' ?></h3>
|
||
<?php if ($skills): ?>
|
||
<nav class="gear-macro-presets" aria-label="Skill-Presets">
|
||
<span class="gear-macro-presets-label">Preset</span>
|
||
<?php foreach (GEAR_MACRO_PRESETS as $preset): ?>
|
||
<?php $entryCount = count($macro['presets'][$preset]); ?>
|
||
<a class="gear-macro-preset<?= $preset === $activePreset ? ' is-active' : '' ?><?= $entryCount ? ' has-entries' : '' ?>"
|
||
href="/gear.php?set=<?= (int) $set['id'] ?>&tab=macro&preset=<?= $preset ?>#makro" data-macro-preset-link="<?= $preset ?>"
|
||
title="Preset <?= $preset ?><?= $entryCount ? ' – ' . $entryCount . ($entryCount === 1 ? ' Eintrag' : ' Einträge') : ' – leer' ?>"<?= $preset === $activePreset ? ' aria-current="true"' : '' ?>><?= $preset ?></a>
|
||
<?php endforeach; ?>
|
||
</nav>
|
||
<button type="button" class="button button-secondary button-small gear-macro-copy" data-macro-copy>Als Text kopieren</button>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if ($className === null): ?>
|
||
<p class="text-muted"><?= $isOwn ? 'Wähle unter „Bearbeiten“ eine Klasse für das Set – dann baust du hier ihre Makros.' : 'Für dieses Set ist keine Klasse gewählt.' ?></p>
|
||
<?php elseif (!$skills): ?>
|
||
<p class="text-muted">
|
||
Für <?= e($className) ?> sind noch keine Skills da<?= $canManage ? '' : ' – die Leitung muss sie erst übernehmen' ?>.
|
||
<?php if ($canManage): ?><a href="/admin/gear_items.php#skills">Jetzt von aion2hub übernehmen</a><?php endif; ?>
|
||
</p>
|
||
<?php else: ?>
|
||
<p class="gear-hint text-muted gear-skills-legend">
|
||
Wie im Spiel zeigt jeder Makro-Eintrag auf eine Taste deiner Skill-Leiste, nicht auf einen einzelnen Skill: Liegen auf der
|
||
Taste mehrere Skills (Reihen 0–3), nutzt das Makro sie der Reihe nach und überspringt die in der Abklingzeit. Nach jedem Eintrag
|
||
wartet es die Verzögerung ab – <?= GEAR_MACRO_DELAY_MIN ?> ms ist das Minimum und meist die beste Wahl.<?= $isOwn ? ' Ein Klick auf ein Feld der Leiste legt einen Skill darauf, ein Klick auf das Symbol eines Eintrags wählt eine andere Taste; alles wird sofort gespeichert.' : '' ?>
|
||
</p>
|
||
<details class="gear-skills-details">
|
||
<summary>So richtest du das Makro im Spiel ein</summary>
|
||
<p class="gear-hint text-muted">
|
||
Im Skill-Fenster (K) legst du fest, welche Skills auf welcher Taste deiner Skill-Leiste liegen – je Taste bis zu
|
||
<?= GEAR_MACRO_KEY_ROWS ?> in den Reihen 0 bis 3; Reihe 0 ist der Skill, den die Leiste zeigt. Jedes der drei Skill-Presets
|
||
hat seine eigene Leiste und ein Makro mit bis zu <?= GEAR_MACRO_MAX_ENTRIES ?> Einträgen. Oben rechts im Skill-Fenster geht es
|
||
zu „Makro“, daneben wählst du das Preset 1, 2 oder 3. „Makro hinzufügen“ legt einen Eintrag an, ein Klick auf sein Symbol
|
||
wählt eine Taste aus deiner Skill-Leiste, der Mülleimer löscht ihn. Die Tasten heißen hier wie in der Standardbelegung (1–8,
|
||
Q, E, linke und rechte Maustaste). Die Taste für das Makro selbst legst du in den Einstellungen bei der Tastenbelegung fest,
|
||
z. B. eine Maus-Seitentaste – solange du sie gedrückt hältst, läuft das Makro von oben nach unten und beginnt dann von vorn.
|
||
Auren und Dauer-Buffs gehören nicht ins Makro (erneut ausgelöst würden sie sich ausschalten), aufgeladene Skills drückst du
|
||
besser einzeln. Die Stufe an den Symbolen ist die, die du in diesem Set geplant hast (mit den Boni aus Daevanion, Arcana und Ausrüstung).
|
||
</p>
|
||
</details>
|
||
<div class="gear-macro-stage">
|
||
<?php foreach (GEAR_MACRO_PRESETS as $preset): ?>
|
||
<?= gear_macro_preset_html($set, $preset, $macro, $skills, $levels, $isOwn, $preset === $activePreset, $preset === $activePreset ? $open : null) ?>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<div hidden>
|
||
<?php foreach (array_keys($tipIds) as $skillId): ?>
|
||
<?php if (isset($skills[$skillId]) && ($tip = gear_skill_tip_html($skills[$skillId], $levels[$skillId] ?? 0)) !== ''): ?>
|
||
<div id="gear-macro-tip-<?= (int) $skillId ?>"><?= $tip ?></div>
|
||
<?php endif; ?>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php
|
||
}
|