Professions: members enter their characters' professions, a new page shows who can craft what
Asked for in Discord: profession management within the legion for a good balance. Aion 2 has five
crafting professions (Blacksmithing, Armorsmithing, Handicrafting, Alchemy, Cooking) with the stages
Beginner, Expert and Master; gathering is one shared skill for six raw materials that players
specialize in with points. Professions belong to characters, so they are entered per character.
- includes/professions.php: PROFESSIONS (German name, client name, icon, products, weapon classes),
PROFESSION_STAGES, GATHERING_MATERIALS, loading/saving, counts per member, targets and "wanted".
German names are not confirmed by the German client yet; only keys are stored.
- New table character_professions (stage, optional level, main profession - at most one per
character) and member_characters.gathering (schema version 57, also in sql/schema.sql).
- Profile editor: per character a professions fieldset (stage, level, main-profession tick - a
single profession becomes the main one) and the gathering specialization; saved with the
character (member_action.php), invalid levels are rejected.
- Profile page shows them per character; the member list shows icons on the cards (main
profession with a gold ring), gets a "Beruf" filter and finds professions in the search.
- New page professions.php ("Berufe" in the menu, members.view): per profession how many members
have it as main profession and at all, characters per stage, which classes' weapons it makes and
how many members play them, everyone with stage; below the gathering specializations.
- New permission professions.manage (initially for groups with roles.manage): targets per
profession (professions_action.php, setting profession_targets, audit log). Professions below
their target show as "Gerade gesucht" on the page and in the profile editor.
- Hammer icon; live updates for the new page, the member list and profile pages; the data export
includes professions per character; privacy policy (as of 26.09.), patch notes and README.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cf5f9966a7
commit
ee7a3a2e8e
20 changed files with 910 additions and 17 deletions
26
README.md
26
README.md
|
|
@ -955,6 +955,32 @@ ALTER TABLE roles ADD COLUMN roster_order INT NULL DEFAULT NULL AFTER is_system;
|
|||
Neue Berechtigung `members.view` muss ebenfalls nachträglich unter Berechtigungsgruppen
|
||||
angelegt/zugewiesen werden.
|
||||
|
||||
### Berufe
|
||||
|
||||
Wer in der Legion was herstellen kann (`includes/professions.php`). Aion 2 hat fünf Handwerksberufe -
|
||||
Waffenschmieden (Waffen für Gladiator, Templer, Assassine, Kleriker), Rüstungsschmieden, Handwerkskunst (Bögen,
|
||||
Stäbe, Schmuck), Alchemie (Zauberbücher, Orbs, Tränke, Manasteine) und Kochen - je mit den Stufen Anfänger,
|
||||
Fortgeschritten und Meister (`PROFESSIONS`, `PROFESSION_STAGES`). Sammeln ist kein eigener Beruf, sondern eine
|
||||
gemeinsame Fertigkeit für sechs Rohstoffe, auf die man sich mit Punkten spezialisiert (`GATHERING_MATERIALS`). Die
|
||||
deutschen Namen sind noch nicht aus dem Client bestätigt; gespeichert werden nur die Schlüssel, Umbenennen in
|
||||
`PROFESSIONS` genügt.
|
||||
|
||||
- **Eintragen** je Charakter unter Meine Profilseite → Charaktere (`member_edit.php`, gespeichert mit dem Charakter
|
||||
von `member_action.php`): je Beruf Stufe, optional Level (1-99) und der Haken „Hauptberuf“ (höchstens einer je
|
||||
Charakter; ist nur ein Beruf eingetragen, ist er es), dazu die Sammel-Spezialisierung. Tabelle
|
||||
`character_professions` (Schlüssel Charakter + Beruf, fällt mit dem Charakter weg), Spalte
|
||||
`member_characters.gathering` (Rohstoff-Schlüssel mit Komma).
|
||||
- **Anzeige:** auf der Profilseite je Charakter, in der Mitgliederliste als Symbole (Hauptberuf mit Goldrand) mit
|
||||
Filter „Beruf“ und in der Suche.
|
||||
- **Übersicht** `professions.php` (Menü „Berufe“, Recht `members.view`): je Beruf wie viele Mitglieder ihn als
|
||||
Hauptberuf haben und überhaupt ausüben (Mitglieder, nicht Charaktere), Charaktere je Stufe, für welche Klassen er
|
||||
die Waffen baut und wie viele Mitglieder diese Klassen als Main-Klasse spielen, dazu alle mit Stufe - Hauptberufe
|
||||
zuerst. Darunter die Sammel-Spezialisierungen je Rohstoff.
|
||||
- **Zielzahlen:** Mit `professions.manage` (anfangs für die Gruppen mit `roles.manage`) legt die Leitung dort fest,
|
||||
wie viele Mitglieder einen Beruf als Hauptberuf haben sollten (`professions_action.php`, Einstellung
|
||||
`profession_targets`, Änderungen im Audit-Log). Was darunter liegt, erscheint als „Gerade gesucht“ auf der
|
||||
Übersicht und beim Eintragen der Berufe - zugeteilt wird niemandem etwas.
|
||||
|
||||
## Profilbilder von Discord
|
||||
|
||||
Bei Konten mit Discord-Verknüpfung übernimmt die Website das Discord-Profilbild (ein
|
||||
|
|
|
|||
|
|
@ -5195,6 +5195,144 @@ a.member-card:hover { text-decoration: none; color: var(--text); }
|
|||
.character-current-image img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
|
||||
.character-current-image label { font-weight: 400; display: flex; align-items: center; gap: 0.3rem; }
|
||||
|
||||
/* ---- Berufe (includes/professions.php): Abzeichen, Eingabe beim Charakter, Uebersicht professions.php ---- */
|
||||
/* Stufen: Anfaenger gruenlich-grau, Fortgeschritten blau, Meister gold; der Hauptberuf mit Goldrand */
|
||||
.profession-badge {
|
||||
--stage-color: #9fb3a4;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
padding: 0.12rem 0.55rem 0.12rem 0.35rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
font-size: 0.8rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.profession-stage-1 { --stage-color: #9fb3a4; }
|
||||
.profession-stage-2 { --stage-color: #7fa8f0; }
|
||||
.profession-stage-3 { --stage-color: #e8c35a; }
|
||||
.profession-badge.is-main { border-color: rgba(201, 162, 39, 0.75); box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25); }
|
||||
.profession-icon { font-size: 1rem; line-height: 1; }
|
||||
.profession-name { color: var(--text); }
|
||||
.profession-stage { color: var(--stage-color); font-weight: 600; }
|
||||
.profession-badge.is-compact { justify-content: center; width: 1.9rem; height: 1.9rem; padding: 0; }
|
||||
.profession-badge.is-compact .profession-icon { font-size: 0.95rem; }
|
||||
.gathering-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
padding: 0.1rem 0.5rem;
|
||||
border: 1px dashed rgba(255, 255, 255, 0.18);
|
||||
border-radius: 999px;
|
||||
font-size: 0.78rem;
|
||||
color: #cfd6cf;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.character-professions-view { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
|
||||
.member-professions { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; }
|
||||
.members-head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
|
||||
/* "Gerade gesucht: …" (Uebersicht und Profil-Editor) */
|
||||
.profession-wanted {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.35rem 0.8rem;
|
||||
margin: 0.6rem 0 0.2rem;
|
||||
padding: 0.55rem 0.8rem;
|
||||
border: 1px solid rgba(201, 162, 39, 0.45);
|
||||
border-radius: 10px;
|
||||
background: rgba(201, 162, 39, 0.08);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.profession-wanted strong { color: var(--gold); }
|
||||
.profession-wanted-item { white-space: nowrap; }
|
||||
|
||||
/* Eingabe beim Charakter (member_edit.php): je Beruf Stufe, Level, Hauptberuf - darunter die Sammel-Spezialisierung */
|
||||
.character-professions { margin: 0; padding: 0.7rem 0.9rem 0.8rem; border: 1px solid var(--border); border-radius: 10px; }
|
||||
.character-professions legend { padding: 0 0.3rem; font-weight: 600; }
|
||||
.profession-rows { display: grid; gap: 0.4rem; }
|
||||
.profession-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(10rem, 1fr) minmax(9rem, 12rem) 5.5rem auto;
|
||||
align-items: center;
|
||||
gap: 0.4rem 0.7rem;
|
||||
padding: 0.25rem 0.4rem;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.profession-row.is-set { background: rgba(201, 162, 39, 0.07); }
|
||||
.profession-row-name { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
|
||||
.profession-row select, .profession-row input[type="number"] { margin: 0; }
|
||||
.profession-main-toggle { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; font-weight: 400; font-size: 0.88rem; white-space: nowrap; }
|
||||
.profession-main-toggle input { width: auto; margin: 0; accent-color: var(--gold); }
|
||||
.profession-gathering { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.9rem; margin-top: 0.7rem; }
|
||||
.profession-gathering-label { width: 100%; font-size: 0.88rem; color: var(--text-muted); }
|
||||
.profession-gathering-option { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; font-weight: 400; font-size: 0.9rem; }
|
||||
.profession-gathering-option input { width: auto; margin: 0; accent-color: var(--gold); }
|
||||
@media (max-width: 600px) {
|
||||
/* Schmal: Name oben, darunter Stufe (breit) und Level, darunter der Haken */
|
||||
.profession-row { grid-template-columns: minmax(0, 1fr) 5.2rem; }
|
||||
.profession-row-name, .profession-main-toggle { grid-column: 1 / -1; }
|
||||
}
|
||||
|
||||
/* Uebersicht professions.php */
|
||||
.profession-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
|
||||
.profession-grid .panel { margin-bottom: 0; }
|
||||
.profession-card { display: flex; flex-direction: column; gap: 0.75rem; }
|
||||
.profession-card.is-wanted { border-color: rgba(201, 162, 39, 0.6); box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.2); }
|
||||
.profession-card-head { display: flex; align-items: flex-start; gap: 0.75rem; }
|
||||
.profession-card-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: none;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
border: 1px solid rgba(201, 162, 39, 0.4);
|
||||
border-radius: 12px;
|
||||
background: rgba(201, 162, 39, 0.08);
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
.profession-card-title { flex: 1; min-width: 0; }
|
||||
.profession-card-title h2 { margin: 0; font-size: 1.2rem; }
|
||||
.profession-card-title p { margin: 0.2rem 0 0; font-size: 0.88rem; }
|
||||
.profession-card-en { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); }
|
||||
.profession-wanted-badge { flex: none; border-color: var(--gold); color: var(--gold); background: rgba(201, 162, 39, 0.12); }
|
||||
.profession-card-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; align-items: flex-end; }
|
||||
.profession-stat { display: flex; flex-direction: column; }
|
||||
.profession-stat strong { font-size: 1.5rem; line-height: 1.1; }
|
||||
.profession-stat-target { font-size: 1rem; color: var(--text-muted); font-weight: 600; }
|
||||
.profession-stat > span { font-size: 0.78rem; color: var(--text-muted); }
|
||||
.profession-stat-stages { flex-direction: row; flex-wrap: wrap; gap: 0.3rem 0.7rem; margin-left: auto; }
|
||||
.profession-stage-count { font-size: 0.8rem; color: var(--stage-color, var(--text-muted)); }
|
||||
.profession-stage-count strong { font-size: 0.95rem; color: var(--text); }
|
||||
.profession-progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
|
||||
.profession-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #b9892b, #edc863); }
|
||||
.profession-card-need { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; margin: 0; font-size: 0.85rem; }
|
||||
.profession-class { display: inline-flex; align-items: center; gap: 0.25rem; }
|
||||
.profession-people { display: grid; gap: 0.2rem; margin: 0; padding: 0; list-style: none; }
|
||||
.profession-people li { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.3rem 0.45rem; border-radius: 8px; }
|
||||
.profession-people li.is-main { background: rgba(201, 162, 39, 0.07); }
|
||||
.profession-people a { display: flex; align-items: center; gap: 0.5rem; min-width: 0; color: var(--text); }
|
||||
.profession-people a:hover { text-decoration: none; color: var(--gold); }
|
||||
.profession-person { display: flex; flex-direction: column; min-width: 0; }
|
||||
.profession-person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.profession-person-character { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; color: var(--text-muted); }
|
||||
.profession-person-stage { flex: none; font-size: 0.85rem; font-weight: 600; color: var(--stage-color); }
|
||||
.profession-main-star { margin-left: 0.2rem; color: var(--gold); }
|
||||
.profession-empty { margin: 0; font-size: 0.88rem; }
|
||||
.gathering-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 0.7rem; margin-top: 0.8rem; }
|
||||
.gathering-card { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 255, 255, 0.02); }
|
||||
.gathering-card-head { display: flex; align-items: center; gap: 0.45rem; }
|
||||
.gathering-card-head .badge { margin-left: auto; }
|
||||
.gathering-card-icon { font-size: 1.2rem; }
|
||||
.gathering-card p { margin: 0.4rem 0 0; font-size: 0.85rem; }
|
||||
.gathering-people { margin: 0.45rem 0 0; padding: 0; list-style: none; font-size: 0.88rem; }
|
||||
.gathering-people li + li { margin-top: 0.15rem; }
|
||||
.profession-targets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 0.6rem 1rem; margin: 0.6rem 0 0.9rem; }
|
||||
.profession-target { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin: 0; font-weight: 400; }
|
||||
.profession-target input { width: 5rem; margin: 0; text-align: center; }
|
||||
|
||||
.gallery-upload { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
|
||||
.gallery-upload input[type="text"] { flex: 1 1 200px; }
|
||||
.gallery-edit-grid { margin-top: 1rem; }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Mitgliederliste: Suche (Name, Charaktere, Gruppen), Filter nach Klasse und Gruppe (Chips),
|
||||
* Mitgliederliste: Suche (Name, Charaktere, Gruppen, Berufe), Filter nach Klasse, Gruppe und Beruf (Chips),
|
||||
* Sortierung und Umschalter Kacheln/Liste. Beim Sortieren nach Rang werden die Mitglieder
|
||||
* wie bisher in Abschnitte je Rang aufgeteilt. Sortierung und Darstellung merkt sich der Browser.
|
||||
*/
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
var empty = document.getElementById('members-empty');
|
||||
var count = document.getElementById('members-count');
|
||||
var reset = document.getElementById('members-reset');
|
||||
var state = { q: '', 'class': '', group: '', sort: 'rank', view: 'grid' };
|
||||
var state = { q: '', 'class': '', group: '', profession: '', sort: 'rank', view: 'grid' };
|
||||
|
||||
try {
|
||||
state.view = localStorage.getItem('lumina_members_view') || 'grid';
|
||||
|
|
@ -119,6 +119,7 @@
|
|||
var visible = cards.filter(function (c) {
|
||||
return (!q || c.dataset.search.indexOf(q) !== -1)
|
||||
&& (!state.group || c.dataset.groups.indexOf('|' + state.group + '|') !== -1)
|
||||
&& (!state.profession || (c.dataset.professions || '').indexOf('|' + state.profession + '|') !== -1)
|
||||
&& (!state['class'] || c.dataset.classes.indexOf('|' + state['class'] + '|') !== -1);
|
||||
}).sort(sorters[state.sort] || sorters.rank);
|
||||
|
||||
|
|
@ -139,7 +140,7 @@
|
|||
list.appendChild(panel);
|
||||
}
|
||||
|
||||
var filtered = q || state.group || state['class'];
|
||||
var filtered = q || state.group || state.profession || state['class'];
|
||||
empty.hidden = visible.length > 0;
|
||||
reset.hidden = !filtered;
|
||||
count.textContent = filtered
|
||||
|
|
@ -187,6 +188,7 @@
|
|||
reset.addEventListener('click', function () {
|
||||
state.q = '';
|
||||
state.group = '';
|
||||
state.profession = '';
|
||||
state['class'] = '';
|
||||
search.value = '';
|
||||
render();
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ include __DIR__ . '/includes/header.php';
|
|||
<?= $heading('mitgliederbereich') ?>
|
||||
<p>Im Mitgliederbereich verarbeiten wir, was du selbst einträgst oder was bei der Nutzung entsteht - je nach Funktion:</p>
|
||||
<ul>
|
||||
<li><strong>Profil:</strong> Anzeigename, Klassen und Main-Klasse, Profiltext und -hintergrund, Profilbild, deine Charaktere (Name, Klasse, Stufe, Notiz, Bilder), Galeriebilder mit Beschreibung (und ob eins davon auf der Startseite gezeigt wird), Kommentare und Reaktionen sowie Gear-Sets, die du auf deinem Profil zeigst.</li>
|
||||
<li><strong>Profil:</strong> Anzeigename, Klassen und Main-Klasse, Profiltext und -hintergrund, Profilbild, deine Charaktere (Name, Klasse, Stufe, Notiz, Bilder, Berufe mit Stufe und Hauptberuf, Sammel-Spezialisierung – die Berufe stehen auch in der Übersicht „Berufe“), Galeriebilder mit Beschreibung (und ob eins davon auf der Startseite gezeigt wird), Kommentare und Reaktionen sowie Gear-Sets, die du auf deinem Profil zeigst.</li>
|
||||
<li><strong>Aktivität:</strong> wann du dich zuletzt angemeldet hast und zuletzt aktiv warst (in der Mitgliederliste sichtbar), deine tägliche Lumipunkte-Belohnung, die Einführungstour, gelesene Patchnotes, wann du zuletzt in die Galerie und auf die Raid-Seite geschaut hast (für die Anzeige neuer Bilder und Raids) und die Reihenfolge deiner Menüpunkte.</li>
|
||||
<li><strong>Raids und Premades:</strong> deine Anmeldungen mit Klasse und Gruppe, deine Anwesenheit (anwesend, abwesend, entschuldigt) und die dafür vergebenen Lumipunkte; bei Raids, die du selbst anlegst, dass du ihr Raid-Lead bist (für alle sichtbar). Leitest du eine Premade, das Banner, das du für sie wählst oder hochlädst - eigene Bilder mit dem Vermerk, wer sie hochgeladen hat, und mit derselben Freigabe wie Galeriebilder.</li>
|
||||
<li><strong>Lumipunkte und Lumishop:</strong> Punktevergaben und -abzüge, deine Shop-Anträge mit Bemerkung (z. B. Charaktername) und deren Bearbeitung.</li>
|
||||
|
|
|
|||
|
|
@ -111,6 +111,8 @@ function data_export_collect(int $userId): array
|
|||
|
||||
$characters = data_export_strip(data_export_rows('SELECT * FROM member_characters WHERE user_id = ? ORDER BY sort_order, id', [$userId]), ['user_id']);
|
||||
foreach ($characters as &$character) {
|
||||
// Berufe des Charakters (includes/professions.php), die Sammel-Spezialisierung steht in "gathering"
|
||||
$character['berufe'] = data_export_rows('SELECT profession, stage, level, is_main FROM character_professions WHERE character_id = ?', [$character['id']]);
|
||||
foreach (['portrait_filename' => 'portrait', 'image_filename' => 'bild'] as $column => $suffix) {
|
||||
$path = data_export_file(PROFILE_UPLOAD_DIR, $character[$column] ?? null);
|
||||
if ($path !== null) {
|
||||
|
|
@ -357,8 +359,8 @@ function data_export_readme(array $export): string
|
|||
' konto dein Konto: Name, Discord-Verknüpfung, Klassen, Profiltext, Anmeldungen, Einstellungen',
|
||||
' gruppen deine Berechtigungsgruppen',
|
||||
' einzelrechte Berechtigungen, die dir einzeln (nicht über eine Gruppe) gegeben wurden',
|
||||
' charaktere, galerie deine Charaktere und Galeriebilder - auch eigene Profil-Hintergründe und hochgeladene',
|
||||
' Premade-Banner (premade_id) - mit den Bildern im Ordner bilder/',
|
||||
' charaktere, galerie deine Charaktere (samt Berufen und Sammel-Spezialisierung) und Galeriebilder - auch eigene',
|
||||
' Profil-Hintergründe und hochgeladene Premade-Banner (premade_id) - mit den Bildern im Ordner bilder/',
|
||||
' kommentare, reaktionen was du unter Galeriebildern geschrieben bzw. mit welchem Emoji du reagiert hast',
|
||||
' gemeldete_inhalte Inhalte, die du gemeldet hast',
|
||||
' gear_sets deine Ausrüstungssets samt Skills und Planung',
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ declare(strict_types=1);
|
|||
const SIDEBAR_NAV_MAIN = [
|
||||
'/dashboard.php', '/profile.php', '/members.php', '/gallery.php', '/contributions.php', '/shop.php', 'gap',
|
||||
'/wiki.php', '/raids.php', '/premades.php', '/calendar.php', '/events.php',
|
||||
'/map.php', '/gear.php', '/warehouse.php',
|
||||
'/map.php', '/gear.php', '/professions.php', '/warehouse.php',
|
||||
];
|
||||
// So viele zusaetzliche Trennlinien darf jedes Mitglied einfuegen
|
||||
const SIDEBAR_MAX_EXTRA_GAPS = 10;
|
||||
|
|
@ -165,6 +165,7 @@ function icon(string $name): string
|
|||
'sword' => '<path d="M14.5 17.5 3 6V3h3l11.5 11.5"/><path d="m13 19 6-6"/><path d="m16 16 4 4"/><path d="m19 21 2-2"/>',
|
||||
'bug' => '<rect x="8" y="6" width="8" height="14" rx="4"/><path d="M19 7l-3 2"/><path d="M5 7l3 2"/><path d="M19 19l-3-2"/><path d="M5 19l3-2"/><path d="M20 13h-4"/><path d="M4 13h4"/><path d="M10 4l1 2"/><path d="M14 4l-1 2"/>',
|
||||
'shield-check' => '<path d="M12 21c4.5-1.8 7-5.2 7-9.5V6l-7-3-7 3v5.5c0 4.3 2.5 7.7 7 9.5z"/><polyline points="9 12 11.2 14.2 15.5 9.8"/>',
|
||||
'hammer' => '<path d="m14.5 9.5-10 10"/><path d="M11 6l4-4 7 7-4 4z"/>',
|
||||
];
|
||||
|
||||
$path = $paths[$name] ?? '';
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ $isActivityActive = $currentScript === 'activity.php';
|
|||
$isMapActive = $currentScript === 'map.php';
|
||||
$isWarehouseActive = $currentScript === 'warehouse.php';
|
||||
$isGearActive = in_array($currentScript, ['gear.php', 'gear_items.php', 'gear_skills.php'], true);
|
||||
$isProfessionsActive = $currentScript === 'professions.php';
|
||||
$isContributionsActive = in_array($currentScript, ['contributions.php', 'contributions_award.php'], true);
|
||||
$isShopActive = in_array($currentScript, ['shop.php', 'shop_orders.php', 'shop_manage.php'], true);
|
||||
$isMembersActive = in_array($currentScript, ['members.php', 'member.php', 'member_edit.php', 'member_picture.php'], true);
|
||||
|
|
@ -81,6 +82,7 @@ $pageBackgrounds = [
|
|||
'map.php' => 'bg-map',
|
||||
'warehouse.php' => 'bg-warehouse',
|
||||
'gear.php' => 'bg-warehouse',
|
||||
'professions.php' => 'bg-warehouse',
|
||||
'gear_items.php' => 'bg-admin',
|
||||
'gear_skills.php' => 'bg-admin',
|
||||
'contributions.php' => 'bg-contributions',
|
||||
|
|
@ -256,7 +258,7 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => !i
|
|||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($canViewWiki || $canViewRaids || $canViewPremades || $canViewEvents || $canViewMap || $canViewWarehouse || $canViewGear): ?>
|
||||
<?php if ($canViewWiki || $canViewRaids || $canViewPremades || $canViewEvents || $canViewMap || $canViewWarehouse || $canViewGear || $canViewMembers): ?>
|
||||
<div class="sidebar-nav-gap" data-nav="gap"<?= $navOrder('gap') ?>></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($canViewWiki): ?>
|
||||
|
|
@ -294,6 +296,11 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => !i
|
|||
<?= icon('sword') ?><span class="label">Gear-Planer</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($canViewMembers): ?>
|
||||
<a href="/professions.php" data-nav="/professions.php"<?= $navOrder('/professions.php') ?> class="sidebar-link<?= $isProfessionsActive ? ' active' : '' ?>" title="Berufe: wer in der Legion was herstellen kann">
|
||||
<?= icon('hammer') ?><span class="label">Berufe</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($canViewWarehouse): ?>
|
||||
<a href="/warehouse.php" data-nav="/warehouse.php"<?= $navOrder('/warehouse.php') ?> class="sidebar-link<?= $isWarehouseActive ? ' active' : '' ?>" title="Lagerhaus">
|
||||
<?= icon('box') ?><span class="label">Lagerhaus</span>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
|
||||
// Stand der Datenschutzerklaerung - bei inhaltlichen Aenderungen an datenschutz.php mitziehen.
|
||||
const LEGAL_PRIVACY_UPDATED = '2026-09-25';
|
||||
const LEGAL_PRIVACY_UPDATED = '2026-09-26';
|
||||
|
||||
// Betreiber: ladungsfaehige Anschrift ueber den Impressum-Service Online-Impressum.de (Clear-Media UG,
|
||||
// nimmt Post an und leitet sie weiter; online-impressum.de/lumina-ascendes - die Seite dort heisst
|
||||
|
|
|
|||
|
|
@ -228,7 +228,8 @@ function live_fingerprint_parts(string $path, array $params, int $userId): ?arra
|
|||
$memberId = (int) ($params['id'] ?? 0);
|
||||
return [
|
||||
$sum('SELECT ' . $crc('status, username, display_name, class_name, classes, main_class, profile_bio, profile_background, avatar_filename, gallery_comments_enabled') . ' FROM users WHERE id = ?', [$memberId]),
|
||||
$sum('SELECT COUNT(*), ' . $crc('id, name, class_name, level, note, portrait_filename, image_filename, is_main, sort_order') . ' FROM member_characters WHERE user_id = ?', [$memberId]),
|
||||
$sum('SELECT COUNT(*), ' . $crc('id, name, class_name, level, note, gathering, portrait_filename, image_filename, is_main, sort_order') . ' FROM member_characters WHERE user_id = ?', [$memberId]),
|
||||
$sum('SELECT COUNT(*), ' . $crc('cp.character_id, cp.profession, cp.stage, cp.level, cp.is_main') . ' FROM character_professions cp JOIN member_characters c ON c.id = cp.character_id WHERE c.user_id = ?', [$memberId]),
|
||||
$sum('SELECT COUNT(*), ' . $crc('id, status, caption, sort_order, is_background') . ' FROM member_gallery WHERE user_id = ?', [$memberId]),
|
||||
$sum("SELECT COUNT(*), COALESCE(MAX(c.id), 0) FROM gallery_comments c JOIN member_gallery g ON g.id = c.gallery_id WHERE g.user_id = ? AND c.status = 'visible'", [$memberId]),
|
||||
$sum("SELECT COUNT(*), COALESCE(MAX(r.id), 0) FROM reactions r JOIN member_gallery g ON g.id = r.content_id WHERE r.content_type = 'picture' AND g.user_id = ?", [$memberId]),
|
||||
|
|
@ -243,9 +244,21 @@ function live_fingerprint_parts(string $path, array $params, int $userId): ?arra
|
|||
$sum("SELECT COUNT(*), " . $crc('id, username, display_name, avatar_filename, class_name, classes, main_class, discord_joined_at') . " FROM users WHERE status = 'active'"),
|
||||
$sum('SELECT COUNT(*), ' . $crc('user_id, role_id') . ' FROM user_roles'),
|
||||
$sum('SELECT COUNT(*), ' . $crc('id, user_id, name, class_name, level, is_main') . ' FROM member_characters'),
|
||||
$sum('SELECT COUNT(*), ' . $crc('character_id, profession, stage, level, is_main') . ' FROM character_professions'),
|
||||
$sum('SELECT ' . $crc('id, name, display_name, roster_order, tag_bg, tag_bg2, tag_color, tag_icon, tag_order') . ' FROM roles'),
|
||||
];
|
||||
|
||||
case '/professions.php':
|
||||
if (!user_has_permission('members.view')) {
|
||||
return null;
|
||||
}
|
||||
return [
|
||||
$sum('SELECT COUNT(*), ' . $crc('character_id, profession, stage, level, is_main') . ' FROM character_professions'),
|
||||
$sum('SELECT COUNT(*), ' . $crc('id, user_id, name, class_name, gathering') . ' FROM member_characters'),
|
||||
$sum("SELECT COUNT(*), " . $crc('id, username, display_name, avatar_filename, class_name') . " FROM users WHERE status = 'active'"),
|
||||
$sum("SELECT COUNT(*), " . $crc('value') . " FROM settings WHERE `key` = 'profession_targets'"),
|
||||
];
|
||||
|
||||
case '/calendar.php':
|
||||
if (!user_has_permission('raids.view') && !user_has_permission('events.view')) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,18 @@ const PATCHNOTE_TYPES = [
|
|||
];
|
||||
|
||||
const PATCHNOTES = [
|
||||
[
|
||||
'id' => '2026-09-26-a',
|
||||
'date' => '2026-09-26',
|
||||
'title' => 'Berufe: wer in der Legion was herstellen kann',
|
||||
'summary' => 'Trag bei deinen Charakteren ihre Berufe ein - die neue Seite „Berufe“ zeigt, wer was herstellen kann und welche Berufe die Legion gerade sucht.',
|
||||
'changes' => [
|
||||
['type' => 'neu', 'area' => 'Profil', 'text' => 'Bei jedem Charakter (Meine Profilseite → Charaktere → bearbeiten) trägst du jetzt seine Berufe ein: Waffenschmieden, Rüstungsschmieden, Handwerkskunst, Alchemie und Kochen, jeweils mit Stufe (Anfänger, Fortgeschritten, Meister) und auf Wunsch dem Level. Dazu, welcher davon sein Hauptberuf ist und worauf er sich beim Sammeln spezialisiert hat.'],
|
||||
['type' => 'neu', 'area' => 'Berufe', 'text' => 'Die neue Seite „Berufe“ im Menü zeigt je Beruf, wer ihn auf welcher Stufe ausübt, für welche Klassen er die Waffen baut und wer sich beim Sammeln worauf spezialisiert hat – so findest du schnell jemanden, der dir etwas herstellt.'],
|
||||
['type' => 'neu', 'area' => 'Mitglieder', 'text' => 'In der Mitgliederliste stehen die Berufe als Symbole auf den Karten, dazu gibt es den Filter „Beruf“, und die Suche findet Berufe auch.'],
|
||||
['type' => 'neu', 'area' => 'Verwaltung', 'text' => 'Auf der Seite „Berufe“ legt die Leitung Zielzahlen je Beruf fest (neues Recht professions.manage). Was darunter liegt, sehen alle als „Gerade gesucht“ – auch beim Eintragen der Berufe im Profil.', 'audience' => 'leitung'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => '2026-09-25-k',
|
||||
'date' => '2026-09-25',
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ const CORE_PERMISSIONS = [
|
|||
['key' => 'shop.view', 'description' => 'Lumishop: Angebot ansehen und Gegenstände gegen Lumipunkte beantragen'],
|
||||
['key' => 'shop.manage', 'description' => 'Lumishop: Kategorien, Gegenstände, Bestand und Preise verwalten, Anträge bewilligen oder ablehnen'],
|
||||
['key' => 'members.view', 'description' => 'Mitgliederliste einsehen'],
|
||||
['key' => 'professions.manage', 'description' => 'Berufe: Zielzahlen je Beruf festlegen - was darunter liegt, sehen alle als „Gerade gesucht“'],
|
||||
['key' => 'gear.view', 'description' => 'Gear-Planer: eigene Ausrüstungssets anlegen und vergleichen, freigegebene Sets anderer ansehen'],
|
||||
['key' => 'gear.manage', 'description' => 'Gear-Planer: Gegenstände und ihre Werte von aion2hub übernehmen, abgleichen und löschen'],
|
||||
['key' => 'calendar.leadership', 'description' => 'Kalender: Termine nur für die Leitung eintragen („Nur Leitung nimmt teil“ oder „Intern“), interne Termine sehen und bei Leitungs-Terminen teilnehmen'],
|
||||
|
|
|
|||
285
includes/professions.php
Normal file
285
includes/professions.php
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Berufe der Legion: welche Handwerksberufe die Charaktere der Mitglieder ausueben (Stufe, Hauptberuf) und worauf
|
||||
* sie sich beim Sammeln spezialisiert haben. Eingetragen unter "Meine Profilseite" → Charaktere (member_edit.php,
|
||||
* gespeichert von member_action.php), zu sehen auf der Profilseite, in der Mitgliederliste (Filter "Beruf") und in
|
||||
* der Uebersicht professions.php - dort legt die Leitung (professions.manage) Zielzahlen je Beruf fest, und was
|
||||
* darunter liegt, erscheint als "Gerade gesucht".
|
||||
*
|
||||
* Aion 2 (Global-Client, Stand September 2026): fuenf Handwerksberufe, je mit den Stufen Anfaenger, Fortgeschritten
|
||||
* und Meister. Sammeln ist kein eigener Beruf, sondern eine gemeinsame Fertigkeit (Essence Extraction) fuer sechs
|
||||
* Rohstoffe; mit ihren Punkten spezialisiert man sich auf einzelne (fuer alle reichen sie nicht). Die deutschen
|
||||
* Namen sind noch nicht aus dem Client bestaetigt - gespeichert werden nur die Schluessel, Umbenennen hier genuegt.
|
||||
*/
|
||||
|
||||
// Schluessel => Name, Name im englischen Client, Symbol, was der Beruf herstellt, fuer welche Klassen er die Waffe baut
|
||||
const PROFESSIONS = [
|
||||
'blacksmithing' => [
|
||||
'label' => 'Waffenschmieden', 'en' => 'Blacksmithing', 'icon' => '⚔️',
|
||||
'makes' => 'Schwerter, Zweihänder, Dolche, Streitkolben und Schilde',
|
||||
'classes' => ['Gladiator', 'Templer', 'Assassine', 'Kleriker'],
|
||||
],
|
||||
'armorsmithing' => [
|
||||
'label' => 'Rüstungsschmieden', 'en' => 'Armorsmithing', 'icon' => '🛡️',
|
||||
'makes' => 'Rüstungsteile und Umhänge für alle Klassen',
|
||||
'classes' => [],
|
||||
],
|
||||
'handicrafting' => [
|
||||
'label' => 'Handwerkskunst', 'en' => 'Handicrafting', 'icon' => '💍',
|
||||
'makes' => 'Bögen, Stäbe und Schmuck (Ringe, Ohrringe, Halsketten)',
|
||||
'classes' => ['Jäger', 'Kantor'],
|
||||
],
|
||||
'alchemy' => [
|
||||
'label' => 'Alchemie', 'en' => 'Alchemy', 'icon' => '⚗️',
|
||||
'makes' => 'Zauberbücher, Orbs, Tränke, Manasteine und Schriftrollen',
|
||||
'classes' => ['Magier', 'Beschwörer'],
|
||||
],
|
||||
'cooking' => [
|
||||
'label' => 'Kochen', 'en' => 'Cooking', 'icon' => '🍲',
|
||||
'makes' => 'Essen und Getränke mit Buffs',
|
||||
'classes' => [],
|
||||
],
|
||||
];
|
||||
|
||||
const PROFESSION_STAGES = [1 => 'Anfänger', 2 => 'Fortgeschritten', 3 => 'Meister'];
|
||||
// Level innerhalb einer Stufe (optional): Anfaenger geht bis 50, Fortgeschritten in Korea inzwischen bis 70
|
||||
const PROFESSION_LEVEL_MAX = 99;
|
||||
// Zielzahl je Beruf hoechstens
|
||||
const PROFESSION_TARGET_MAX = 99;
|
||||
|
||||
// Rohstoffe der Sammel-Fertigkeit (Essence Extraction) => Name, Symbol
|
||||
const GATHERING_MATERIALS = [
|
||||
'ore' => ['label' => 'Erz', 'icon' => '⛏️'],
|
||||
'gem' => ['label' => 'Edelsteine', 'icon' => '💎'],
|
||||
'wood' => ['label' => 'Holz', 'icon' => '🪵'],
|
||||
'herb' => ['label' => 'Kräuter', 'icon' => '🌿'],
|
||||
'ingredient' => ['label' => 'Kochzutaten', 'icon' => '🥕'],
|
||||
'odyle' => ['label' => 'Odyle (im Flug)', 'icon' => '✨'],
|
||||
];
|
||||
|
||||
/** Stufe als Text: "Meister" bzw. "Fortgeschritten 32" */
|
||||
function profession_stage_text(int $stage, ?int $level): string
|
||||
{
|
||||
return (PROFESSION_STAGES[$stage] ?? PROFESSION_STAGES[1]) . ($level !== null ? ' ' . $level : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Berufe von Charakteren: [Charakter-ID => [Beruf => ['stage' => 1-3, 'level' => ?int, 'main' => bool]]] -
|
||||
* Hauptberuf zuerst, dann nach Stufe.
|
||||
*
|
||||
* @param array<int, int|string> $characterIds
|
||||
*/
|
||||
function professions_for_characters(array $characterIds): array
|
||||
{
|
||||
$characterIds = array_values(array_unique(array_filter(array_map('intval', $characterIds))));
|
||||
if (!$characterIds) {
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
$stmt = db()->prepare(
|
||||
'SELECT character_id, profession, stage, level, is_main FROM character_professions
|
||||
WHERE character_id IN (' . implode(',', array_fill(0, count($characterIds), '?')) . ')
|
||||
ORDER BY is_main DESC, stage DESC, level DESC'
|
||||
);
|
||||
$stmt->execute($characterIds);
|
||||
} catch (PDOException $e) {
|
||||
return []; // Tabelle entsteht erst beim naechsten Schema-Abgleich
|
||||
}
|
||||
$out = [];
|
||||
foreach ($stmt->fetchAll() as $row) {
|
||||
if (isset(PROFESSIONS[$row['profession']])) {
|
||||
$out[(int) $row['character_id']][$row['profession']] = [
|
||||
'stage' => max(1, min(3, (int) $row['stage'])),
|
||||
'level' => $row['level'] !== null ? (int) $row['level'] : null,
|
||||
'main' => (bool) $row['is_main'],
|
||||
];
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/** Sammel-Spezialisierung aus member_characters.gathering: die gueltigen Rohstoff-Schluessel. */
|
||||
function gathering_parse(?string $value): array
|
||||
{
|
||||
return array_values(array_filter(
|
||||
explode(',', (string) $value),
|
||||
static fn (string $key): bool => isset(GATHERING_MATERIALS[$key])
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ein Beruf als Abzeichen: Symbol, Name und Stufe (der Hauptberuf leuchtet). $compact: nur das Symbol, der Rest
|
||||
* steht im Tooltip (Mitgliederliste).
|
||||
*/
|
||||
function profession_badge_html(string $key, array $entry, bool $compact = false): string
|
||||
{
|
||||
$profession = PROFESSIONS[$key];
|
||||
$stage = profession_stage_text($entry['stage'], $entry['level']);
|
||||
// Mitgliederliste: Stufe des besten Charakters (character), Hauptberuf ggf. eines anderen (main_character)
|
||||
$character = (string) ($entry['character'] ?? '');
|
||||
$mainCharacter = (string) ($entry['main_character'] ?? '');
|
||||
$title = $profession['label'] . ' · ' . $stage . ($character !== '' ? ' (' . $character . ')' : '')
|
||||
. ($entry['main'] ? ' · Hauptberuf' . ($mainCharacter !== '' && $mainCharacter !== $character ? ' von ' . $mainCharacter : '') : '');
|
||||
return '<span class="profession-badge profession-stage-' . (int) $entry['stage'] . ($entry['main'] ? ' is-main' : '') . ($compact ? ' is-compact' : '') . '"'
|
||||
. ' title="' . e($title) . '"' . ($compact ? ' role="img" aria-label="' . e($title) . '"' : '') . '>'
|
||||
. '<span class="profession-icon" aria-hidden="true">' . $profession['icon'] . '</span>'
|
||||
. ($compact ? '' : '<span class="profession-name">' . e($profession['label']) . '</span><span class="profession-stage">' . e($stage) . '</span>')
|
||||
. '</span>';
|
||||
}
|
||||
|
||||
/** Sammel-Spezialisierung als kleine Abzeichen. */
|
||||
function gathering_badges_html(array $materials): string
|
||||
{
|
||||
$html = '';
|
||||
foreach ($materials as $key) {
|
||||
$html .= '<span class="gathering-badge" title="Sammeln: ' . e(GATHERING_MATERIALS[$key]['label']) . '">'
|
||||
. '<span aria-hidden="true">' . GATHERING_MATERIALS[$key]['icon'] . '</span>' . e(GATHERING_MATERIALS[$key]['label']) . '</span>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Berufe aus dem Formular eines Charakters (member_edit.php): profession_stage[Beruf] = 0-3, profession_level[Beruf],
|
||||
* main_profession[] = Beruf (Haken - mit JavaScript immer nur einer, sonst zaehlt der erste), gathering[] = Rohstoffe.
|
||||
* Ohne Hauptberuf ist ein einzelner Beruf der Hauptberuf.
|
||||
*
|
||||
* @return array{0: array<string, array{stage: int, level: ?int, main: bool}>, 1: ?string, 2: string[]} Berufe, Sammeln, Fehler
|
||||
*/
|
||||
function professions_from_input(array $input): array
|
||||
{
|
||||
$stages = is_array($input['profession_stage'] ?? null) ? $input['profession_stage'] : [];
|
||||
$levels = is_array($input['profession_level'] ?? null) ? $input['profession_level'] : [];
|
||||
$mainKeys = is_array($input['main_profession'] ?? null) ? array_values(array_filter($input['main_profession'], 'is_string')) : [];
|
||||
$professions = [];
|
||||
$errors = [];
|
||||
foreach (PROFESSIONS as $key => $profession) {
|
||||
$stage = (int) ($stages[$key] ?? 0);
|
||||
if (!isset(PROFESSION_STAGES[$stage])) {
|
||||
continue;
|
||||
}
|
||||
$levelInput = is_string($levels[$key] ?? null) ? trim($levels[$key]) : '';
|
||||
$level = filter_var($levelInput, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'max_range' => PROFESSION_LEVEL_MAX]]);
|
||||
if ($levelInput !== '' && $level === false) {
|
||||
$errors[] = $profession['label'] . ': das Level muss zwischen 1 und ' . PROFESSION_LEVEL_MAX . ' liegen.';
|
||||
}
|
||||
$professions[$key] = ['stage' => $stage, 'level' => $level !== false ? $level : null, 'main' => false];
|
||||
}
|
||||
$main = null;
|
||||
foreach ($mainKeys as $key) {
|
||||
if (isset($professions[$key])) {
|
||||
$main = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($main === null && count($professions) === 1) {
|
||||
$main = array_key_first($professions);
|
||||
}
|
||||
if ($main !== null) {
|
||||
$professions[$main]['main'] = true;
|
||||
}
|
||||
$gathering = array_values(array_intersect(array_keys(GATHERING_MATERIALS), is_array($input['gathering'] ?? null) ? $input['gathering'] : []));
|
||||
return [$professions, $gathering ? implode(',', $gathering) : null, $errors];
|
||||
}
|
||||
|
||||
/** Berufe und Sammel-Spezialisierung eines Charakters speichern (ersetzt die bisherigen). */
|
||||
function professions_store(int $characterId, array $professions, ?string $gathering): void
|
||||
{
|
||||
$pdo = db();
|
||||
$pdo->prepare('DELETE FROM character_professions WHERE character_id = ?')->execute([$characterId]);
|
||||
$insert = $pdo->prepare('INSERT INTO character_professions (character_id, profession, stage, level, is_main) VALUES (?, ?, ?, ?, ?)');
|
||||
foreach ($professions as $key => $entry) {
|
||||
$insert->execute([$characterId, $key, $entry['stage'], $entry['level'], $entry['main'] ? 1 : 0]);
|
||||
}
|
||||
$pdo->prepare('UPDATE member_characters SET gathering = ? WHERE id = ?')->execute([$gathering, $characterId]);
|
||||
}
|
||||
|
||||
/** Zielzahlen der Leitung: [Beruf => Anzahl Mitglieder mit diesem Hauptberuf] (0 = kein Ziel). */
|
||||
function profession_targets(): array
|
||||
{
|
||||
$saved = json_decode(setting_get('profession_targets'), true);
|
||||
$targets = [];
|
||||
foreach (array_keys(PROFESSIONS) as $key) {
|
||||
$targets[$key] = max(0, min(PROFESSION_TARGET_MAX, (int) (is_array($saved) ? ($saved[$key] ?? 0) : 0)));
|
||||
}
|
||||
return $targets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle Berufe der aktiven Mitglieder mit Charakter und Mitglied - Grundlage der Uebersicht und der Zaehler.
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
function professions_all_rows(): array
|
||||
{
|
||||
try {
|
||||
return db()->query(
|
||||
"SELECT cp.profession, cp.stage, cp.level, cp.is_main, c.id AS character_id, c.name AS character_name,
|
||||
c.class_name AS character_class, u.id AS user_id, u.username, u.display_name, u.avatar_filename
|
||||
FROM character_professions cp
|
||||
JOIN member_characters c ON c.id = cp.character_id
|
||||
JOIN users u ON u.id = c.user_id
|
||||
WHERE u.status = 'active'
|
||||
ORDER BY cp.stage DESC, cp.level IS NULL, cp.level DESC, COALESCE(NULLIF(u.display_name, ''), u.username)"
|
||||
)->fetchAll();
|
||||
} catch (PDOException $e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wie viele Mitglieder einen Beruf haben: ['main' => als Hauptberuf, 'any' => ueberhaupt] je Beruf - jeweils Mitglieder,
|
||||
* nicht Charaktere (zwei Charaktere desselben Mitglieds zaehlen einmal).
|
||||
*
|
||||
* @param array<int, array<string, mixed>>|null $rows aus professions_all_rows()
|
||||
* @return array<string, array{main: int, any: int}>
|
||||
*/
|
||||
function profession_member_counts(?array $rows = null): array
|
||||
{
|
||||
$main = [];
|
||||
$any = [];
|
||||
foreach ($rows ?? professions_all_rows() as $row) {
|
||||
$any[$row['profession']][(int) $row['user_id']] = true;
|
||||
if ((int) $row['is_main'] === 1) {
|
||||
$main[$row['profession']][(int) $row['user_id']] = true;
|
||||
}
|
||||
}
|
||||
$counts = [];
|
||||
foreach (array_keys(PROFESSIONS) as $key) {
|
||||
$counts[$key] = ['main' => count($main[$key] ?? []), 'any' => count($any[$key] ?? [])];
|
||||
}
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Berufe, die die Legion gerade sucht: Hauptberufe unter der Zielzahl der Leitung - der groesste Mangel zuerst.
|
||||
*
|
||||
* @return array<string, array{have: int, target: int}>
|
||||
*/
|
||||
function professions_wanted(?array $counts = null): array
|
||||
{
|
||||
$counts ??= profession_member_counts();
|
||||
$wanted = [];
|
||||
foreach (profession_targets() as $key => $target) {
|
||||
if ($target > 0 && $counts[$key]['main'] < $target) {
|
||||
$wanted[$key] = ['have' => $counts[$key]['main'], 'target' => $target];
|
||||
}
|
||||
}
|
||||
uasort($wanted, static fn (array $a, array $b): int => ($b['target'] - $b['have']) <=> ($a['target'] - $a['have']));
|
||||
return $wanted;
|
||||
}
|
||||
|
||||
/** "Gerade gesucht: ⚗️ Alchemie (1 von 3), …" - leer, wenn nichts fehlt. */
|
||||
function professions_wanted_html(array $wanted): string
|
||||
{
|
||||
if (!$wanted) {
|
||||
return '';
|
||||
}
|
||||
$parts = [];
|
||||
foreach ($wanted as $key => $numbers) {
|
||||
$parts[] = '<span class="profession-wanted-item">' . PROFESSIONS[$key]['icon'] . ' ' . e(PROFESSIONS[$key]['label'])
|
||||
. ' <span class="text-muted">(' . $numbers['have'] . ' von ' . $numbers['target'] . ')</span></span>';
|
||||
}
|
||||
return '<p class="profession-wanted"><strong>Gerade gesucht:</strong> ' . implode(' ', $parts) . '</p>';
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
|
||||
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
|
||||
const SCHEMA_VERSION = 56;
|
||||
const SCHEMA_VERSION = 57;
|
||||
|
||||
/**
|
||||
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
|
||||
|
|
@ -705,6 +705,23 @@ CREATE TABLE IF NOT EXISTS item_db_names (
|
|||
item_id INT UNSIGNED NULL,
|
||||
checked_at DATETIME NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
SQL,
|
||||
// Berufe der Charaktere (includes/professions.php)
|
||||
'character_professions' => <<<'SQL'
|
||||
CREATE TABLE IF NOT EXISTS character_professions (
|
||||
character_id INT UNSIGNED NOT NULL,
|
||||
-- Schluessel aus PROFESSIONS (blacksmithing, armorsmithing, handicrafting, alchemy, cooking)
|
||||
profession VARCHAR(20) NOT NULL,
|
||||
-- 1 = Anfaenger, 2 = Fortgeschritten, 3 = Meister (PROFESSION_STAGES)
|
||||
stage TINYINT UNSIGNED NOT NULL DEFAULT 1,
|
||||
-- Level innerhalb der Stufe (optional)
|
||||
level TINYINT UNSIGNED NULL,
|
||||
-- 1 = Hauptberuf des Charakters (hoechstens einer)
|
||||
is_main TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (character_id, profession),
|
||||
FOREIGN KEY (character_id) REFERENCES member_characters(id) ON DELETE CASCADE,
|
||||
INDEX idx_character_professions_profession (profession, stage)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
SQL,
|
||||
];
|
||||
}
|
||||
|
|
@ -795,6 +812,10 @@ function schema_column_upgrades(): array
|
|||
// Platz des Tags (Berechtigungsgruppen -> Reihenfolge der Tags) - NULL = hinter den eingeordneten
|
||||
'tag_order' => "ALTER TABLE roles ADD COLUMN tag_order INT NULL AFTER tag_icon",
|
||||
],
|
||||
// Sammel-Spezialisierung eines Charakters (includes/professions.php): Rohstoff-Schluessel mit Komma
|
||||
'member_characters' => [
|
||||
'gathering' => "ALTER TABLE member_characters ADD COLUMN gathering VARCHAR(80) NULL AFTER note",
|
||||
],
|
||||
// Freigabe von Galeriebildern (Moderation) - vorhandene Bilder bleiben sichtbar
|
||||
'member_gallery' => [
|
||||
'status' => "ALTER TABLE member_gallery ADD COLUMN status VARCHAR(10) NOT NULL DEFAULT 'visible' AFTER caption",
|
||||
|
|
@ -1013,8 +1034,9 @@ function schema_sync_core_permissions(): void
|
|||
WHERE p.`key` = 'raids.manage'"
|
||||
)->execute([$newPermissionId]);
|
||||
}
|
||||
// Einzelrechte vergeben darf zunaechst, wer schon die Gruppen und ihre Rechte verwaltet.
|
||||
if ($permission['key'] === 'users.permissions') {
|
||||
// Einzelrechte vergeben und Zielzahlen der Berufe festlegen darf zunaechst, wer schon die Gruppen und ihre
|
||||
// Rechte verwaltet (die Leitung).
|
||||
if (in_array($permission['key'], ['users.permissions', 'professions.manage'], true)) {
|
||||
$pdo->prepare(
|
||||
"INSERT IGNORE INTO role_permissions (role_id, permission_id)
|
||||
SELECT rp.role_id, ? FROM role_permissions rp
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ require_once __DIR__ . '/includes/member_profile.php';
|
|||
require_once __DIR__ . '/includes/reactions.php';
|
||||
require_once __DIR__ . '/includes/wiki.php'; // wiki_render() fuer den Beschreibungstext
|
||||
require_once __DIR__ . '/includes/gear.php';
|
||||
require_once __DIR__ . '/includes/professions.php';
|
||||
require_permission('members.view');
|
||||
|
||||
$id = (int) ($_GET['id'] ?? 0);
|
||||
|
|
@ -105,6 +106,7 @@ include __DIR__ . '/includes/header.php';
|
|||
<div class="panel">
|
||||
<h2>Charaktere</h2>
|
||||
<div class="character-grid">
|
||||
<?php $characterProfessions = professions_for_characters(array_column($characters, 'id')); ?>
|
||||
<?php foreach ($characters as $character): ?>
|
||||
<?php $portrait = profile_image_url($character['portrait_filename']); $image = profile_image_url($character['image_filename']); ?>
|
||||
<article class="character-card<?= $character['is_main'] ? ' is-main' : '' ?>">
|
||||
|
|
@ -122,6 +124,13 @@ include __DIR__ . '/includes/header.php';
|
|||
</div>
|
||||
<?php if ($character['is_main']): ?><span class="badge badge-pending">Hauptcharakter</span><?php endif; ?>
|
||||
<?php if (!empty($character['note'])): ?><p><?= e($character['note']) ?></p><?php endif; ?>
|
||||
<?php $professions = $characterProfessions[(int) $character['id']] ?? []; $gathering = gathering_parse($character['gathering'] ?? null); ?>
|
||||
<?php if ($professions || $gathering): ?>
|
||||
<div class="character-professions-view">
|
||||
<?php foreach ($professions as $key => $entry): ?><?= profession_badge_html($key, $entry) ?><?php endforeach; ?>
|
||||
<?= gathering_badges_html($gathering) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($image): ?>
|
||||
<a class="character-image" href="<?= e($image) ?>" data-lightbox="characters" data-caption="<?= e($character['name']) ?>">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
require_once __DIR__ . '/includes/member_profile.php';
|
||||
require_once __DIR__ . '/includes/professions.php';
|
||||
require_permission('members.view');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
|
|
@ -76,6 +77,12 @@ switch ($action) {
|
|||
}
|
||||
$note = mb_substr(trim((string) ($_POST['note'] ?? '')), 0, 255);
|
||||
$isMain = !empty($_POST['is_main']) ? 1 : 0;
|
||||
// Berufe und Sammel-Spezialisierung (includes/professions.php)
|
||||
[$professions, $gathering, $professionErrors] = professions_from_input($_POST);
|
||||
if ($professionErrors) {
|
||||
set_flash('error', implode(' ', $professionErrors));
|
||||
redirect($back);
|
||||
}
|
||||
|
||||
$portrait = $existing['portrait_filename'] ?? null;
|
||||
$image = $existing['image_filename'] ?? null;
|
||||
|
|
@ -113,6 +120,7 @@ switch ($action) {
|
|||
$pdo->prepare(
|
||||
'UPDATE member_characters SET name = ?, class_name = ?, level = ?, note = ?, portrait_filename = ?, image_filename = ?, is_main = ? WHERE id = ?'
|
||||
)->execute([$name, $class, $level, $note !== '' ? $note : null, $portrait, $image, $isMain, $characterId]);
|
||||
professions_store($characterId, $professions, $gathering);
|
||||
$modLog('Charakter „' . $name . '“ bearbeitet');
|
||||
set_flash('success', '„' . $name . '“ gespeichert.');
|
||||
} else {
|
||||
|
|
@ -122,6 +130,7 @@ switch ($action) {
|
|||
'INSERT INTO member_characters (user_id, name, class_name, level, note, portrait_filename, image_filename, is_main, sort_order)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||
)->execute([$userId, $name, $class, $level, $note !== '' ? $note : null, $portrait, $image, $isMain, (int) $order->fetchColumn()]);
|
||||
professions_store((int) $pdo->lastInsertId(), $professions, $gathering);
|
||||
$modLog('Charakter „' . $name . '“ angelegt');
|
||||
set_flash('success', '„' . $name . '“ angelegt.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
require_once __DIR__ . '/includes/member_profile.php';
|
||||
require_once __DIR__ . '/includes/professions.php';
|
||||
require_permission('members.view');
|
||||
|
||||
$id = (int) ($_GET['id'] ?? current_user()['id']);
|
||||
|
|
@ -18,6 +19,12 @@ $name = $member['display_name'] !== '' ? $member['display_name'] : $member['user
|
|||
$isOwn = (int) current_user()['id'] === $id;
|
||||
|
||||
$characters = profile_characters_by_user($id)[$id] ?? [];
|
||||
$characterProfessions = professions_for_characters(array_column($characters, 'id'));
|
||||
foreach ($characters as &$character) {
|
||||
$character['professions'] = $characterProfessions[(int) $character['id']] ?? [];
|
||||
}
|
||||
unset($character);
|
||||
$wantedProfessions = professions_wanted();
|
||||
$galleryStmt = db()->prepare('SELECT * FROM member_gallery WHERE user_id = ? AND is_background = 0 ORDER BY sort_order, id');
|
||||
$galleryStmt->execute([$id]);
|
||||
$gallery = $galleryStmt->fetchAll();
|
||||
|
|
@ -52,6 +59,44 @@ function character_fields(array $c, string $prefix): void
|
|||
<label for="<?= $prefix ?>-note">Kurzbeschreibung (optional)</label>
|
||||
<input type="text" id="<?= $prefix ?>-note" name="note" maxlength="255" value="<?= e((string) ($c['note'] ?? '')) ?>" placeholder="z.B. Main für Raids, Twink zum Farmen">
|
||||
</div>
|
||||
<?php $gathering = gathering_parse($c['gathering'] ?? null); ?>
|
||||
<fieldset class="character-professions">
|
||||
<legend>Berufe <span class="text-muted">(optional)</span></legend>
|
||||
<div class="profession-rows">
|
||||
<?php foreach (PROFESSIONS as $key => $profession): ?>
|
||||
<?php $entry = $c['professions'][$key] ?? null; ?>
|
||||
<div class="profession-row<?= $entry ? ' is-set' : '' ?>">
|
||||
<span class="profession-row-name" title="<?= e($profession['en'] . ' – stellt her: ' . $profession['makes']) ?>">
|
||||
<span aria-hidden="true"><?= $profession['icon'] ?></span> <?= e($profession['label']) ?>
|
||||
</span>
|
||||
<select name="profession_stage[<?= $key ?>]" aria-label="<?= e($profession['label']) ?>: Stufe" data-profession-stage>
|
||||
<option value="0">– nicht –</option>
|
||||
<?php foreach (PROFESSION_STAGES as $stage => $stageLabel): ?>
|
||||
<option value="<?= $stage ?>"<?= $entry && $entry['stage'] === $stage ? ' selected' : '' ?>><?= e($stageLabel) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<input type="number" name="profession_level[<?= $key ?>]" min="1" max="<?= PROFESSION_LEVEL_MAX ?>" value="<?= $entry && $entry['level'] !== null ? (int) $entry['level'] : '' ?>"
|
||||
placeholder="Level" aria-label="<?= e($profession['label']) ?>: Level (optional)">
|
||||
<label class="profession-main-toggle" title="Der Beruf, auf den sich dieser Charakter konzentriert">
|
||||
<input type="checkbox" name="main_profession[]" value="<?= $key ?>"<?= $entry && $entry['main'] ? ' checked' : '' ?> data-profession-main> Hauptberuf
|
||||
</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="field-hint">
|
||||
Stufe und Level stehen im Spiel beim Beruf (Anfänger bis Level 50, danach Fortgeschritten, später Meister).
|
||||
Der Hauptberuf ist der, auf den sich dieser Charakter konzentriert – nach ihm richtet sich die Übersicht <a href="/professions.php">Berufe</a>.
|
||||
</div>
|
||||
<div class="profession-gathering">
|
||||
<span class="profession-gathering-label">Sammeln – spezialisiert auf:</span>
|
||||
<?php foreach (GATHERING_MATERIALS as $key => $material): ?>
|
||||
<label class="profession-gathering-option">
|
||||
<input type="checkbox" name="gathering[]" value="<?= $key ?>"<?= in_array($key, $gathering, true) ? ' checked' : '' ?>>
|
||||
<span aria-hidden="true"><?= $material['icon'] ?></span> <?= e($material['label']) ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="character-form-grid">
|
||||
<div>
|
||||
<label for="<?= $prefix ?>-portrait">Portrait</label>
|
||||
|
|
@ -100,8 +145,10 @@ include __DIR__ . '/includes/header.php';
|
|||
<div class="actions"><button type="submit">Speichern</button></div>
|
||||
</form>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel" id="charaktere">
|
||||
<h2>Charaktere</h2>
|
||||
<p class="text-muted">Bei jedem Charakter kannst du auch seine Berufe eintragen – so sieht die Legion, wer was herstellen kann.</p>
|
||||
<?= professions_wanted_html($wantedProfessions) ?>
|
||||
<?php foreach ($characters as $character): ?>
|
||||
<details class="character-edit">
|
||||
<summary>
|
||||
|
|
@ -109,6 +156,7 @@ include __DIR__ . '/includes/header.php';
|
|||
<strong><?= e($character['name']) ?></strong>
|
||||
<span class="text-muted"><?= e($character['class_name'] ?? '') ?><?= $character['level'] ? ' · Stufe ' . (int) $character['level'] : '' ?></span>
|
||||
<?php if ($character['is_main']): ?><span class="badge badge-pending">Hauptcharakter</span><?php endif; ?>
|
||||
<?php foreach ($character['professions'] as $key => $entry): ?><?= profession_badge_html($key, $entry, true) ?><?php endforeach; ?>
|
||||
<span class="character-edit-hint">bearbeiten ▾</span>
|
||||
</summary>
|
||||
<form method="post" action="/member_action.php" enctype="multipart/form-data">
|
||||
|
|
@ -280,6 +328,20 @@ $ownBackground = profile_background_image($id);
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// Berufe: nur ein Hauptberuf je Charakter; Hauptberuf ohne Stufe wird Anfaenger, "uebe ich nicht aus" nimmt den Haken weg
|
||||
document.addEventListener('change', function (event) {
|
||||
var target = event.target;
|
||||
var row = target.closest('.profession-row');
|
||||
if (!row) return;
|
||||
var main = row.querySelector('[data-profession-main]');
|
||||
var stage = row.querySelector('[data-profession-stage]');
|
||||
if (target === main && main.checked) {
|
||||
target.form.querySelectorAll('[data-profession-main]').forEach(function (box) { if (box !== main) box.checked = false; });
|
||||
if (stage.value === '0') stage.value = '1';
|
||||
}
|
||||
if (target === stage && stage.value === '0') main.checked = false;
|
||||
row.classList.toggle('is-set', stage.value !== '0');
|
||||
});
|
||||
// Auswahl sofort sichtbar markieren
|
||||
document.querySelectorAll('.background-picker input[type="radio"]').forEach(function (radio) {
|
||||
radio.addEventListener('change', function () {
|
||||
|
|
|
|||
64
members.php
64
members.php
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
require_once __DIR__ . '/includes/member_profile.php';
|
||||
require_once __DIR__ . '/includes/professions.php';
|
||||
require_permission('members.view');
|
||||
|
||||
// Rollen, die in der Mitgliederliste eine eigene Gruppe bekommen, aufsteigend
|
||||
|
|
@ -33,6 +34,11 @@ try {
|
|||
} catch (PDOException $e) {
|
||||
$charactersByUser = []; // Tabelle entsteht erst beim naechsten Schema-Abgleich
|
||||
}
|
||||
$professionsByCharacter = professions_for_characters(array_merge([], ...array_map(
|
||||
static fn (array $characters): array => array_column($characters, 'id'),
|
||||
array_values($charactersByUser)
|
||||
)));
|
||||
$professionOrder = array_flip(array_keys(PROFESSIONS));
|
||||
|
||||
// Rang jedes Mitglieds: die Gruppe mit der kleinsten Reihenfolge, die es ueber eine seiner
|
||||
// Rollen hat; ohne passende Rolle landet es in der allgemeinen Gruppe "Mitglieder".
|
||||
|
|
@ -50,6 +56,24 @@ foreach ($members as &$member) {
|
|||
}
|
||||
}
|
||||
$member['characters'] = $charactersByUser[(int) $member['id']] ?? [];
|
||||
// Berufe ueber alle Charaktere: je Beruf die hoechste Stufe (mit dem Charakter, der sie hat) - Hauptberuf, wenn
|
||||
// er es bei einem der Charaktere ist (main_character: bei welchem)
|
||||
$professions = [];
|
||||
foreach ($member['characters'] as $character) {
|
||||
foreach ($professionsByCharacter[(int) $character['id']] ?? [] as $key => $entry) {
|
||||
$best = $professions[$key] ?? null;
|
||||
if ($best === null || [$entry['stage'], $entry['level'] ?? 0] > [$best['stage'], $best['level'] ?? 0]) {
|
||||
$professions[$key] = ['character' => $character['name'], 'main_character' => $best['main_character'] ?? null] + $entry;
|
||||
}
|
||||
if ($entry['main']) {
|
||||
$professions[$key]['main_character'] = $character['name'];
|
||||
}
|
||||
$professions[$key]['main'] = $professions[$key]['main_character'] !== null;
|
||||
}
|
||||
}
|
||||
uksort($professions, static fn (string $a, string $b): int
|
||||
=> [!$professions[$a]['main'], $professionOrder[$a]] <=> [!$professions[$b]['main'], $professionOrder[$b]]);
|
||||
$member['professions'] = $professions;
|
||||
}
|
||||
unset($member);
|
||||
|
||||
|
|
@ -71,6 +95,11 @@ foreach ($members as $member) {
|
|||
}
|
||||
$allClasses = array_values(array_filter(AION_CLASSES, static fn ($c) => isset($allClasses[$c])));
|
||||
$allGroups = role_tags_sorted(array_keys($allGroups)); // Gruppenfilter in der Reihenfolge der Tags
|
||||
// Berufsfilter: die Berufe, die mindestens ein Charakter ausuebt
|
||||
$allProfessions = [];
|
||||
foreach ($members as $member) {
|
||||
$allProfessions += array_fill_keys(array_keys($member['professions']), true);
|
||||
}
|
||||
|
||||
/** Eine Mitglieds-Karte mit allen Daten fuer Suche, Filter und Sortierung (data-*). */
|
||||
/**
|
||||
|
|
@ -89,9 +118,13 @@ function member_card(array $member, array $rankRoleNames = []): string
|
|||
array_map(static fn ($c) => $c['class_name'], $member['characters'])
|
||||
))));
|
||||
|
||||
$professionKeys = array_keys($member['professions']);
|
||||
$professionLabels = array_map(static fn (string $key): string => PROFESSIONS[$key]['label'], $professionKeys);
|
||||
|
||||
$data = ' data-name="' . e(mb_strtolower($name)) . '"'
|
||||
. ' data-search="' . e(mb_strtolower($name . ' ' . $member['username'] . ' ' . implode(' ', $characterNames) . ' ' . implode(' ', $roles))) . '"'
|
||||
. ' data-search="' . e(mb_strtolower($name . ' ' . $member['username'] . ' ' . implode(' ', $characterNames) . ' ' . implode(' ', $roles) . ' ' . implode(' ', $professionLabels))) . '"'
|
||||
. ' data-groups="' . e('|' . implode('|', $roles) . '|') . '"'
|
||||
. ' data-professions="' . e('|' . implode('|', $professionKeys) . '|') . '"'
|
||||
. ' data-classes="' . e('|' . implode('|', $classes) . '|') . '"'
|
||||
. ' data-class="' . e((string) ($member['class_name'] ?? '')) . '"'
|
||||
. ' data-rank="' . (int) $member['rank'] . '"'
|
||||
|
|
@ -117,6 +150,14 @@ function member_card(array $member, array $rankRoleNames = []): string
|
|||
}
|
||||
$html .= '</div>';
|
||||
}
|
||||
if ($member['professions']) {
|
||||
// Berufe nur als Symbole (Hauptberuf mit Goldrand), Name und Stufe beim Drueberfahren
|
||||
$html .= '<div class="member-professions">';
|
||||
foreach ($member['professions'] as $key => $entry) {
|
||||
$html .= profession_badge_html($key, $entry, true);
|
||||
}
|
||||
$html .= '</div>';
|
||||
}
|
||||
$online = is_online($member['last_active'] ?? null);
|
||||
$html .= '<div class="member-last-seen' . ($online ? ' is-online' : '') . '" title="Zuletzt auf der Website aktiv">'
|
||||
. '<span class="online-dot"></span>' . ($online ? 'Online' : 'aktiv ' . e(last_active_label($member['last_active'] ?? null))) . '</div>';
|
||||
|
|
@ -138,14 +179,17 @@ include __DIR__ . '/includes/header.php';
|
|||
<div class="panel members-head">
|
||||
<div class="raid-header">
|
||||
<h1>Mitglieder</h1>
|
||||
<a class="button button-secondary" href="/member_edit.php"><?= icon('edit') ?> Meine Profilseite</a>
|
||||
<div class="members-head-actions">
|
||||
<a class="button button-secondary" href="/professions.php"><?= icon('hammer') ?> Berufe</a>
|
||||
<a class="button button-secondary" href="/member_edit.php"><?= icon('edit') ?> Meine Profilseite</a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-muted">Übersicht über alle Legionsmitglieder. Ein Klick auf ein Mitglied öffnet seine Profilseite.</p>
|
||||
|
||||
<div class="members-filter" id="members-filter">
|
||||
<label class="members-search">
|
||||
<?= icon('search') ?>
|
||||
<input type="search" id="members-search" placeholder="Name, Charakter oder Gruppe suchen …" aria-label="Mitglieder durchsuchen">
|
||||
<input type="search" id="members-search" placeholder="Name, Charakter, Gruppe oder Beruf suchen …" aria-label="Mitglieder durchsuchen">
|
||||
</label>
|
||||
|
||||
<?php if (!empty($allClasses)): ?>
|
||||
|
|
@ -174,6 +218,20 @@ include __DIR__ . '/includes/header.php';
|
|||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($allProfessions): ?>
|
||||
<div class="members-filter-row">
|
||||
<span class="members-filter-label">Beruf</span>
|
||||
<div class="members-chips" data-filter="profession" role="group" aria-label="Nach Beruf filtern">
|
||||
<button type="button" class="members-chip active" data-value="">Alle</button>
|
||||
<?php foreach (PROFESSIONS as $key => $profession): ?>
|
||||
<?php if (isset($allProfessions[$key])): ?>
|
||||
<button type="button" class="members-chip" data-value="<?= e($key) ?>"><span aria-hidden="true"><?= $profession['icon'] ?></span> <?= e($profession['label']) ?></button>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="members-filter-bottom">
|
||||
<div class="members-filter-row">
|
||||
<span class="members-filter-label"><?= icon('sort') ?> Sortieren</span>
|
||||
|
|
|
|||
198
professions.php
Normal file
198
professions.php
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
<?php
|
||||
/**
|
||||
* Berufe der Legion (includes/professions.php): je Handwerksberuf, wer ihn ausuebt (Stufe, Hauptberuf), fuer welche
|
||||
* Klassen er die Waffen baut und - von der Leitung festgelegt (professions.manage) - wie viele ihn als Hauptberuf
|
||||
* haben sollten; darunter die Sammel-Spezialisierungen. Eingetragen wird bei den Charakteren auf der eigenen
|
||||
* Profilseite (member_edit.php).
|
||||
*/
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
require_once __DIR__ . '/includes/professions.php';
|
||||
require_permission('members.view');
|
||||
|
||||
$canManage = user_has_permission('professions.manage');
|
||||
$rows = professions_all_rows();
|
||||
$counts = profession_member_counts($rows);
|
||||
$targets = profession_targets();
|
||||
$wanted = professions_wanted($counts);
|
||||
|
||||
// Je Beruf die Charaktere: Hauptberufe zuerst, sonst wie geladen (Stufe, Level, Name)
|
||||
$byProfession = array_fill_keys(array_keys(PROFESSIONS), []);
|
||||
$stageCounts = array_fill_keys(array_keys(PROFESSIONS), array_fill_keys(array_keys(PROFESSION_STAGES), 0));
|
||||
foreach ($rows as $row) {
|
||||
$byProfession[$row['profession']][] = $row;
|
||||
$stageCounts[$row['profession']][max(1, min(3, (int) $row['stage']))]++;
|
||||
}
|
||||
foreach ($byProfession as &$list) {
|
||||
usort($list, static fn (array $a, array $b): int => (int) $b['is_main'] <=> (int) $a['is_main']);
|
||||
}
|
||||
unset($list);
|
||||
|
||||
// Main-Klassen der aktiven Mitglieder - fuer "Waffen fuer …: so viele spielen sie"
|
||||
$classCounts = db()->query(
|
||||
"SELECT class_name, COUNT(*) FROM users WHERE status = 'active' AND class_name IS NOT NULL AND class_name <> '' GROUP BY class_name"
|
||||
)->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||
|
||||
// Sammeln: Charaktere je Rohstoff
|
||||
$byMaterial = array_fill_keys(array_keys(GATHERING_MATERIALS), []);
|
||||
try {
|
||||
$gatherRows = db()->query(
|
||||
"SELECT c.name AS character_name, c.gathering, u.id AS user_id, u.username, u.display_name, u.avatar_filename
|
||||
FROM member_characters c JOIN users u ON u.id = c.user_id
|
||||
WHERE u.status = 'active' AND c.gathering IS NOT NULL AND c.gathering <> ''
|
||||
ORDER BY COALESCE(NULLIF(u.display_name, ''), u.username), c.name"
|
||||
)->fetchAll();
|
||||
} catch (PDOException $e) {
|
||||
$gatherRows = []; // Spalte entsteht erst beim naechsten Schema-Abgleich
|
||||
}
|
||||
foreach ($gatherRows as $row) {
|
||||
foreach (gathering_parse($row['gathering']) as $material) {
|
||||
$byMaterial[$material][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$memberName = static fn (array $row): string => $row['display_name'] !== '' ? (string) $row['display_name'] : (string) $row['username'];
|
||||
|
||||
$pageTitle = 'Berufe';
|
||||
include __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
<div class="panel">
|
||||
<div class="raid-header">
|
||||
<h1>Berufe</h1>
|
||||
<a class="button button-secondary" href="/member_edit.php#charaktere"><?= icon('edit') ?> Meine Berufe eintragen</a>
|
||||
</div>
|
||||
<p class="text-muted">
|
||||
Wer in der Legion was herstellen kann. Eingetragen wird bei den Charakteren auf der eigenen Profilseite: Beruf, Stufe und
|
||||
welcher der Hauptberuf ist – also der, auf den sich ein Charakter konzentriert. Gezählt werden Mitglieder; hat jemand
|
||||
denselben Beruf auf mehreren Charakteren, zählt er einmal.
|
||||
</p>
|
||||
<?= professions_wanted_html($wanted) ?>
|
||||
</div>
|
||||
|
||||
<div class="profession-grid">
|
||||
<?php foreach (PROFESSIONS as $key => $profession): ?>
|
||||
<?php
|
||||
$list = $byProfession[$key];
|
||||
$target = $targets[$key];
|
||||
$count = $counts[$key];
|
||||
$players = array_sum(array_map(static fn (string $class): int => (int) ($classCounts[$class] ?? 0), $profession['classes']));
|
||||
?>
|
||||
<section class="panel profession-card<?= isset($wanted[$key]) ? ' is-wanted' : '' ?>" id="beruf-<?= e($key) ?>">
|
||||
<header class="profession-card-head">
|
||||
<span class="profession-card-icon" aria-hidden="true"><?= $profession['icon'] ?></span>
|
||||
<div class="profession-card-title">
|
||||
<h2><?= e($profession['label']) ?> <span class="profession-card-en"><?= e($profession['en']) ?></span></h2>
|
||||
<p class="text-muted"><?= e($profession['makes']) ?></p>
|
||||
</div>
|
||||
<?php if (isset($wanted[$key])): ?><span class="badge profession-wanted-badge">Gesucht</span><?php endif; ?>
|
||||
</header>
|
||||
<div class="profession-card-stats">
|
||||
<div class="profession-stat">
|
||||
<strong><?= $count['main'] ?><?= $target > 0 ? '<span class="profession-stat-target"> / ' . $target . '</span>' : '' ?></strong>
|
||||
<span>als Hauptberuf<?= $target > 0 ? ' (Ziel ' . $target . ')' : '' ?></span>
|
||||
</div>
|
||||
<div class="profession-stat">
|
||||
<strong><?= $count['any'] ?></strong>
|
||||
<span>üben ihn aus</span>
|
||||
</div>
|
||||
<div class="profession-stat profession-stat-stages">
|
||||
<?php foreach (array_reverse(PROFESSION_STAGES, true) as $stage => $stageLabel): ?>
|
||||
<span class="profession-stage-count profession-stage-<?= $stage ?>" title="Charaktere mit Stufe <?= e($stageLabel) ?>"><?= e($stageLabel) ?> <strong><?= $stageCounts[$key][$stage] ?></strong></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($target > 0): ?>
|
||||
<div class="profession-progress" role="img" aria-label="<?= $count['main'] ?> von <?= $target ?> als Hauptberuf">
|
||||
<span style="width: <?= min(100, (int) round($count['main'] / $target * 100)) ?>%"></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($profession['classes']): ?>
|
||||
<p class="profession-card-need">
|
||||
Waffen für
|
||||
<?php foreach ($profession['classes'] as $class): ?><span class="profession-class" title="<?= e($class) ?>"><?= class_badge_html($class, 18) ?><?= e($class) ?></span><?php endforeach; ?>
|
||||
<span class="text-muted">– <?= $players ?> <?= $players === 1 ? 'Mitglied spielt' : 'Mitglieder spielen' ?> sie als Main-Klasse</span>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ($list): ?>
|
||||
<ul class="profession-people">
|
||||
<?php foreach ($list as $row): ?>
|
||||
<?php $name = $memberName($row); ?>
|
||||
<li class="<?= (int) $row['is_main'] === 1 ? 'is-main' : '' ?>">
|
||||
<a href="/member.php?id=<?= (int) $row['user_id'] ?>">
|
||||
<?= avatar_html(['id' => $row['user_id'], 'username' => $row['username'], 'display_name' => $row['display_name'], 'avatar_filename' => $row['avatar_filename']], 26) ?>
|
||||
<span class="profession-person">
|
||||
<span class="profession-person-name"><?= e($name) ?></span>
|
||||
<?php if (mb_strtolower((string) $row['character_name']) !== mb_strtolower($name)): ?>
|
||||
<span class="profession-person-character"><?= class_badge_html($row['character_class'], 14) ?><?= e((string) $row['character_name']) ?></span>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</a>
|
||||
<span class="profession-person-stage profession-stage-<?= (int) $row['stage'] ?>">
|
||||
<?= e(profession_stage_text((int) $row['stage'], $row['level'] !== null ? (int) $row['level'] : null)) ?>
|
||||
<?php if ((int) $row['is_main'] === 1): ?><span class="profession-main-star" title="Hauptberuf">★</span><?php endif; ?>
|
||||
</span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p class="text-muted profession-empty">Noch niemand eingetragen.</p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="panel" id="sammeln">
|
||||
<h2>Sammeln</h2>
|
||||
<p class="text-muted">
|
||||
Sammeln ist in Aion 2 kein eigener Beruf, sondern eine gemeinsame Fertigkeit für alle Rohstoffe. Mit ihren Punkten
|
||||
spezialisiert man sich auf einzelne – für alle reichen sie nicht. Hier steht, wer sich worauf spezialisiert hat.
|
||||
</p>
|
||||
<div class="gathering-grid">
|
||||
<?php foreach (GATHERING_MATERIALS as $material => $info): ?>
|
||||
<?php $list = $byMaterial[$material]; ?>
|
||||
<div class="gathering-card">
|
||||
<div class="gathering-card-head">
|
||||
<span class="gathering-card-icon" aria-hidden="true"><?= $info['icon'] ?></span>
|
||||
<strong><?= e($info['label']) ?></strong>
|
||||
<span class="badge"><?= count($list) ?></span>
|
||||
</div>
|
||||
<?php if ($list): ?>
|
||||
<ul class="gathering-people">
|
||||
<?php foreach ($list as $row): ?>
|
||||
<?php $name = $memberName($row); ?>
|
||||
<li>
|
||||
<a href="/member.php?id=<?= (int) $row['user_id'] ?>"><?= e($name) ?></a>
|
||||
<?php if (mb_strtolower((string) $row['character_name']) !== mb_strtolower($name)): ?><span class="text-muted">· <?= e((string) $row['character_name']) ?></span><?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p class="text-muted">Noch niemand.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($canManage): ?>
|
||||
<div class="panel" id="ziele">
|
||||
<h2>Zielzahlen</h2>
|
||||
<p class="text-muted">
|
||||
Wie viele Mitglieder den Beruf als Hauptberuf haben sollten. Liegt ein Beruf darunter, steht er oben und beim Eintragen der
|
||||
Berufe im Profil als „Gerade gesucht“ – zugeteilt wird dadurch niemandem etwas. 0 = kein Ziel.
|
||||
</p>
|
||||
<form method="post" action="/professions_action.php" class="profession-targets">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="action" value="targets">
|
||||
<div class="profession-targets-grid">
|
||||
<?php foreach (PROFESSIONS as $key => $profession): ?>
|
||||
<label class="profession-target">
|
||||
<span><span aria-hidden="true"><?= $profession['icon'] ?></span> <?= e($profession['label']) ?></span>
|
||||
<input type="number" name="target[<?= e($key) ?>]" min="0" max="<?= PROFESSION_TARGET_MAX ?>" value="<?= $targets[$key] ?>" inputmode="numeric">
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="actions"><button type="submit">Zielzahlen speichern</button></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||
30
professions_action.php
Normal file
30
professions_action.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/** Zielzahlen je Beruf speichern (professions.php, Recht professions.manage) - Einstellung profession_targets. */
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
require_once __DIR__ . '/includes/professions.php';
|
||||
require_permission('professions.manage');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
redirect('/professions.php');
|
||||
}
|
||||
verify_csrf();
|
||||
|
||||
if (($_POST['action'] ?? '') === 'targets') {
|
||||
$input = is_array($_POST['target'] ?? null) ? $_POST['target'] : [];
|
||||
$old = profession_targets();
|
||||
$new = [];
|
||||
$changes = [];
|
||||
foreach (PROFESSIONS as $key => $profession) {
|
||||
$raw = is_string($input[$key] ?? null) ? trim($input[$key]) : '0';
|
||||
$new[$key] = max(0, min(PROFESSION_TARGET_MAX, (int) $raw));
|
||||
if ($new[$key] !== $old[$key]) {
|
||||
$changes[$profession['label']] = admin_log_change($old[$key] ?: 'kein Ziel', $new[$key] ?: 'kein Ziel');
|
||||
}
|
||||
}
|
||||
setting_set('profession_targets', (string) json_encode($new));
|
||||
if ($changes) {
|
||||
admin_log('🛠️ Zielzahlen der Berufe geändert', $changes);
|
||||
}
|
||||
set_flash('success', 'Zielzahlen gespeichert.');
|
||||
}
|
||||
redirect('/professions.php#ziele');
|
||||
|
|
@ -502,6 +502,8 @@ CREATE TABLE IF NOT EXISTS member_characters (
|
|||
class_name VARCHAR(30) NULL,
|
||||
level SMALLINT UNSIGNED NULL,
|
||||
note VARCHAR(255) NULL,
|
||||
-- Sammel-Spezialisierung: Rohstoff-Schluessel aus GATHERING_MATERIALS mit Komma (includes/professions.php)
|
||||
gathering VARCHAR(80) NULL,
|
||||
portrait_filename VARCHAR(120) NULL,
|
||||
image_filename VARCHAR(120) NULL,
|
||||
is_main TINYINT(1) NOT NULL DEFAULT 0,
|
||||
|
|
@ -511,6 +513,22 @@ CREATE TABLE IF NOT EXISTS member_characters (
|
|||
INDEX idx_member_characters_user (user_id, sort_order)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Berufe der Charaktere (includes/professions.php, Uebersicht professions.php)
|
||||
CREATE TABLE IF NOT EXISTS character_professions (
|
||||
character_id INT UNSIGNED NOT NULL,
|
||||
-- Schluessel aus PROFESSIONS (blacksmithing, armorsmithing, handicrafting, alchemy, cooking)
|
||||
profession VARCHAR(20) NOT NULL,
|
||||
-- 1 = Anfaenger, 2 = Fortgeschritten, 3 = Meister (PROFESSION_STAGES)
|
||||
stage TINYINT UNSIGNED NOT NULL DEFAULT 1,
|
||||
-- Level innerhalb der Stufe (optional)
|
||||
level TINYINT UNSIGNED NULL,
|
||||
-- 1 = Hauptberuf des Charakters (hoechstens einer)
|
||||
is_main TINYINT(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (character_id, profession),
|
||||
FOREIGN KEY (character_id) REFERENCES member_characters(id) ON DELETE CASCADE,
|
||||
INDEX idx_character_professions_profession (profession, stage)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS member_gallery (
|
||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT UNSIGNED NOT NULL,
|
||||
|
|
|
|||
Loading…
Reference in a new issue