- Raids: "Max. Spieler" only whole numbers up to groups x 5 (max. 10 groups / 50), gearscore only a number; fixed +1 Lumipunkt per participation, other values only with the new raids.points permission; pick an existing premade per group when creating a raid; unchanged legacy values no longer block editing - Raid page updates itself every 15 s while visible (raids_live.php, cards rendered by includes/raid_card.php), open editors and confirm dialogs are kept - Restore takes the new raid_id from the bot (archived messages are now deleted in Discord) and moves settings, attendance and awards; website signups send the server display name - Premades: dissolve by leadership needs a reason, lead gets DMs on join/assign/decline/remove (source/actor_id sent to the bot), transfer picker skips players who already lead a group, website accept keeps the one-group rule, no commas in names - Site-wide Lumina dialog (assets/js/confirm-dialog.js) replaces confirm/prompt/alert via data-confirm; error flashes are a dialog you confirm with OK - Calendar: audience per entry (all / leadership takes part / internal) with the new calendar.leadership permission; day cells list all entries and scroll - Gear planner: main-hand picker filtered by the set's class, mismatches marked, "keine Klasse" option, link to an external skill/Daevanion plan per set - Map: correct kisk icons (Elyos on Verteron/Abyss, Altgard fixed), per-map max zoom and bounded panning, German texts, data source note - Tactics: toolbar as a uniform grid, whole-tactic copy, automatic versions with restore and a 90-day trash, official tactics protected - Global thin gold scrollbars, readable hover colours, "Sedes Luminis" spelling, patch notes and README, schema version 34 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
142 lines
No EOL
4.3 KiB
JavaScript
142 lines
No EOL
4.3 KiB
JavaScript
/**
|
|
* MapData - Model for map information and markers
|
|
*/
|
|
|
|
class MapData {
|
|
constructor() {
|
|
this.maps = []; // List of available maps
|
|
this.currentMap = null; // Currently selected map info
|
|
this.markers = []; // Markers for current map
|
|
this.categories = {}; // Category metadata (group/name -> info)
|
|
this.visibleCategories = new Set();
|
|
this.extractedAt = ''; // Stand der Markerdaten (extracted_at_utc), fuer den Hinweis unter den Kategorien
|
|
}
|
|
|
|
/**
|
|
* Add a map to the available maps list
|
|
*/
|
|
addMap(mapInfo) {
|
|
this.maps.push({
|
|
id: mapInfo.id,
|
|
slug: mapInfo.slug,
|
|
name: mapInfo.name,
|
|
zone: mapInfo.zone || 'Unknown'
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Set the current map and clear markers
|
|
*/
|
|
setCurrentMap(slug) {
|
|
const map = this.maps.find(m => m.slug === slug);
|
|
if (map) {
|
|
this.currentMap = map;
|
|
this.markers = [];
|
|
this.categories = {};
|
|
this.visibleCategories.clear();
|
|
this.extractedAt = '';
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/**
|
|
* Load markers for the current map from JSON data
|
|
*/
|
|
loadMarkers(jsonData) {
|
|
if (!this.currentMap) return;
|
|
|
|
// Parse and normalize marker data
|
|
const rawMarkers = jsonData.markers || [];
|
|
this.extractedAt = jsonData.extracted_at_utc || '';
|
|
|
|
this.markers = rawMarkers.map(m => ({
|
|
id: m.id,
|
|
name: m.name,
|
|
description: m.description,
|
|
group_name: m.group_name,
|
|
category_name: m.category_name,
|
|
worldX: m.coordinates ? m.coordinates[1] : 0,
|
|
worldY: m.coordinates ? m.coordinates[0] : 0,
|
|
color: m.properties?.primary_color || '#FFFFFF',
|
|
iconText: m.properties?.icon_text || '',
|
|
nt: m.properties?.nt || '',
|
|
iconName: m.properties?.icon_name || '',
|
|
iconImage: this.iconPath(m.properties?.icon_image)
|
|
}));
|
|
|
|
// Build category metadata
|
|
this.markers.forEach(m => {
|
|
const key = `${m.group_name}/${m.category_name}`;
|
|
if (!this.categories[key]) {
|
|
this.categories[key] = {
|
|
group: m.group_name,
|
|
name: m.category_name,
|
|
count: 0,
|
|
color: CONFIG.CATEGORY_COLORS[m.group_name] || '#FFFFFF',
|
|
iconImage: m.iconImage || ''
|
|
};
|
|
}
|
|
this.categories[key].count++;
|
|
});
|
|
|
|
// Anfangs sind alle Kategorien versteckt - man blendet gezielt ein, was man sucht
|
|
// (einzeln, per Gruppe oder mit "Alle anzeigen").
|
|
}
|
|
|
|
/**
|
|
* Icon-Pfad aus den Markerdaten ohne ?... - ueber CONFIG.ICON_ALIASES auf die passende Datei
|
|
* in data/icons umgebogen. Karte und Kategorienliste lesen beide iconImage.
|
|
*/
|
|
iconPath(raw) {
|
|
if (!raw) return '';
|
|
const path = String(raw).split('?')[0];
|
|
return CONFIG.ICON_ALIASES[path] || path;
|
|
}
|
|
|
|
/**
|
|
* Toggle visibility of a category
|
|
*/
|
|
toggleCategory(key, visible) {
|
|
if (visible) {
|
|
this.visibleCategories.add(key);
|
|
} else {
|
|
this.visibleCategories.delete(key);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Toggle all categories in a group
|
|
*/
|
|
toggleGroup(groupName, visible) {
|
|
Object.entries(this.categories).forEach(([key, cat]) => {
|
|
if (cat.group === groupName) {
|
|
this.toggleCategory(key, visible);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Check if all categories in a group are visible
|
|
*/
|
|
isGroupFullyVisible(groupName) {
|
|
return Object.entries(this.categories)
|
|
.filter(([key, cat]) => cat.group === groupName)
|
|
.every(([key]) => this.visibleCategories.has(key));
|
|
}
|
|
|
|
/**
|
|
* Check if any category in a group is visible
|
|
*/
|
|
isGroupPartiallyVisible(groupName) {
|
|
return Object.entries(this.categories)
|
|
.filter(([key, cat]) => cat.group === groupName)
|
|
.some(([key]) => this.visibleCategories.has(key));
|
|
}
|
|
|
|
/**
|
|
* Get marker count for a category
|
|
*/
|
|
getCategoryCount(key) {
|
|
return this.categories[key]?.count || 0;
|
|
}
|
|
} |