diff --git a/assets/css/style.css b/assets/css/style.css index d685bb7..b55df1b 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -6668,9 +6668,25 @@ button.gear-guide-skill:hover { border-color: var(--gold); transform: translateY .gear-guide-skill-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.8rem; } .gear-guide-kind { padding: 0.05rem 0.45rem; border-radius: 4px; background: rgba(255, 255, 255, 0.08); color: var(--text-muted); } .gear-guide-priority { padding: 0.05rem 0.55rem; border-radius: 999px; background: rgba(201, 162, 39, 0.2); color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.7rem; } -.gear-guide-specs { margin: 0 0 0.6rem; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; } -.gear-guide-specs li { display: flex; align-items: baseline; gap: 0.45rem; padding: 0.35rem 0.6rem; border: 1px solid rgba(201, 162, 39, 0.3); border-radius: 6px; background: rgba(201, 162, 39, 0.06); } -.gear-guide-spec-no { min-width: 1.6rem; font-weight: 700; color: var(--gold); } +.gear-guide-specs-title { margin: 0.4rem 0 0.5rem; font-size: 0.85rem; } +.gear-guide-specs { margin: 0 0 0.75rem; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.86rem; } +.gear-guide-specs li { display: grid; grid-template-columns: 30px 2.6rem minmax(0, 1fr); align-items: center; gap: 0.6rem; padding: 0.4rem 0.6rem; border: 1px solid transparent; border-radius: 8px; } +.gear-guide-specs li.is-on { border-color: rgba(201, 162, 39, 0.45); background: rgba(255, 255, 255, 0.05); color: var(--text); font-weight: 600; } +.gear-guide-specs li.is-off { color: var(--text-muted); } +.gear-guide-spec-icon { position: relative; display: inline-flex; width: 26px; height: 26px; } +.gear-guide-spec-shield { width: 26px; height: 26px; } +.gear-guide-spec-shield-body { fill: #3a3f4a; stroke: #5a606c; stroke-width: 1.2; } +.gear-guide-spec-shield-mark { fill: none; stroke: #7d8390; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; } +.gear-guide-spec-shield.is-on .gear-guide-spec-shield-body { fill: #3f8f46; stroke: #8fd893; } +.gear-guide-spec-shield.is-on .gear-guide-spec-shield-mark { stroke: #e8f6e9; } +.gear-guide-specs li.is-off .gear-guide-spec-icon { opacity: 0.6; } +.gear-guide-spec-priority { position: absolute; top: -6px; right: -7px; display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: #f2d27a; color: #1a1a1a; font-size: 0.62rem; font-weight: 700; box-shadow: 0 0 0 2px var(--bg-panel); } +.gear-guide-spec-from { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; } +.gear-guide-spec-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; font-size: 0.82rem; } +.gear-guide-spec-edit label { display: inline-flex; flex-direction: row; align-items: center; gap: 0.35rem; margin: 0; max-width: 100%; } +.gear-guide-spec-edit .gear-guide-spec-shield { width: 20px; height: 20px; flex-shrink: 0; } +.gear-guide-spec-edit-text { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.gear-guide-spec-edit input { width: 3.5rem; } .gear-guide-why { padding: 0.6rem 0.75rem; border-left: 3px solid var(--gold); border-radius: 0; background: rgba(255, 255, 255, 0.03); font-size: 0.9rem; line-height: 1.55; } .gear-guide-why strong { display: block; margin-bottom: 0.2rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gold); } .gear-guide-why p { margin: 0 0 0.5rem; } diff --git a/includes/gear.php b/includes/gear.php index a4f131f..82d8b6d 100644 --- a/includes/gear.php +++ b/includes/gear.php @@ -622,8 +622,9 @@ function gear_public_sets(?string $className = null): array } /** - * Klassenmeister je Klasse: aktive Mitglieder, denen gear.publish ueber eine Gruppe oder einzeln gegeben wurde - * (Administratoren haben alle Rechte, zaehlen hier aber nur, wenn sie es ausdruecklich haben), bei ihrer Main-Klasse. + * Klassenmeister je Klasse: aktive Mitglieder, denen gear.publish ueber eine Gruppe oder einzeln gegeben wurde, bei ihrer + * Main-Klasse. Nicht ueber die Gruppe "Administrator" (die bekommt jedes neue Recht automatisch, schema_sync_core_permissions) + * und nicht nur ueber is_admin - Administratoren zaehlen nur, wenn sie das Recht ausdruecklich haben. * * @return array> */ @@ -634,8 +635,9 @@ function gear_class_masters(): array "SELECT u.id, u.class_name, COALESCE(NULLIF(u.display_name, ''), u.username) AS name FROM users u WHERE u.status = 'active' AND u.class_name IS NOT NULL - AND (EXISTS (SELECT 1 FROM user_roles ur JOIN role_permissions rp ON rp.role_id = ur.role_id - JOIN permissions p ON p.id = rp.permission_id WHERE ur.user_id = u.id AND p.`key` = 'gear.publish') + AND (EXISTS (SELECT 1 FROM user_roles ur JOIN roles r ON r.id = ur.role_id JOIN role_permissions rp ON rp.role_id = ur.role_id + JOIN permissions p ON p.id = rp.permission_id + WHERE ur.user_id = u.id AND p.`key` = 'gear.publish' AND r.name <> 'Administrator') OR EXISTS (SELECT 1 FROM user_permissions up JOIN permissions p2 ON p2.id = up.permission_id WHERE up.user_id = u.id AND p2.`key` = 'gear.publish')) ORDER BY name" diff --git a/includes/gear_guide.php b/includes/gear_guide.php index aed3c04..202e72a 100644 --- a/includes/gear_guide.php +++ b/includes/gear_guide.php @@ -74,8 +74,16 @@ function gear_guide_normalize(array $raw): array } $order = is_numeric($note['order'] ?? null) ? max(0, min(GEAR_GUIDE_ORDER_MAX, (int) $note['order'])) : 0; $why = gear_guide_text($note['why'] ?? '', GEAR_GUIDE_WHY_LENGTH); - if ($order > 0 || $why !== '') { - $skills[(int) $skillId] = ['order' => $order, 'why' => $why]; + // Reihenfolge der Spezialisierungen: [Nr => Prioritaet] + $specOrder = []; + foreach (is_array($note['specs'] ?? null) ? $note['specs'] : [] as $no => $priority) { + if (isset(GEAR_SKILL_SPECS[(int) $no]) && is_numeric($priority) && (int) $priority > 0) { + $specOrder[(int) $no] = min(9, (int) $priority); + } + } + ksort($specOrder); + if ($order > 0 || $why !== '' || $specOrder) { + $skills[(int) $skillId] = ['order' => $order, 'why' => $why, 'specs' => $specOrder]; } } // Je Taste der Skill-Leiste: Erklaerung @@ -367,6 +375,30 @@ function gear_guide_level_sources(array $entry): string return $parts ? (int) ($entry['own'] ?? $entry['level']) . ' selbst · ' . implode(' · ', $parts) : ''; } +/** + * Gewaehlte bzw. erreichte Spezialisierungen eines geplanten Skills: aktive Skills die im Skills-Reiter gewaehlten + * (soweit die Stufe sie zulaesst), Stigmen die Boni bis zur erreichten Stufe. + * + * @return int[] Nummern + */ +function gear_guide_chosen_parts(array $entry): array +{ + $skill = $entry['skill']; + $level = (int) $entry['level']; + if (gear_skill_has_specs($skill['kind'])) { + return gear_skill_spec_numbers(gear_skill_specs_clean((int) ($entry['specs'] ?? 0), $level)); + } + return array_keys(array_filter(gear_skill_part_levels($skill['kind']), static fn (int $from): bool => $level >= $from)); +} + +/** Schild-Emblem einer Spezialisierung (wie im Spiel): farbig, wenn gewaehlt, sonst grau. */ +function gear_guide_spec_icon(bool $on): string +{ + return ''; +} + /** Details eines Skills fuer das Feld neben den Kacheln: Name, Ziel-Stufe, Prioritaet, Spezialisierungen, Begruendung. */ function gear_guide_skill_detail(array $entry, array $notes, bool $visible): string { @@ -374,7 +406,8 @@ function gear_guide_skill_detail(array $entry, array $notes, bool $visible): str $id = (int) $skill['id']; $level = (int) $entry['level']; $note = $notes[$id] ?? ['order' => 0, 'why' => '']; - $specs = gear_skill_has_specs($skill['kind']) ? gear_skill_spec_numbers(gear_skill_specs_clean((int) ($entry['specs'] ?? 0), $level)) : []; + $parts = gear_skill_parts($skill); + $chosen = gear_guide_chosen_parts($entry); $english = !empty($skill['name_de']) && $skill['name_de'] !== $skill['name'] ? (string) $skill['name'] : ''; $html = '
' . '
' . gear_guide_skill_icon($skill) . '
' @@ -384,11 +417,17 @@ function gear_guide_skill_detail(array $entry, array $notes, bool $visible): str . '' . e(GEAR_SKILL_KINDS[$skill['kind']] ?? $skill['kind']) . '' . ($note['order'] > 0 ? 'Priorität ' . (int) $note['order'] . '' : '') . '
'; - if ($specs) { - $html .= '