From 430868a6e8d7b9e775989f728142c616ad6402a8 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 22 Feb 2026 03:02:18 +0000 Subject: [PATCH] Alpha V0.2 --- admin.php | 441 ++++++++++++++++++++++++++++------- db/migrate_dynamic_types.php | 88 +++++++ gm_console.php | 372 +++++++++++++++++++++++++++++ index.php | 358 +++++++--------------------- 4 files changed, 902 insertions(+), 357 deletions(-) create mode 100644 db/migrate_dynamic_types.php create mode 100644 gm_console.php diff --git a/admin.php b/admin.php index 57b2cd9..03f9c45 100644 --- a/admin.php +++ b/admin.php @@ -1,119 +1,396 @@ exec("UPDATE cities SET current_red_percentage = 100, is_liberated = 0"); - $db->exec("UPDATE planets SET terrestrial_control = 0, status = 'hostile'"); - header("Location: admin.php?success=reset"); +// Auth Check: Must be logged in and be admin +if (!isset($_SESSION['user_id'])) { + header("Location: auth.php?page=login"); exit; } -$total_planets = $db->query("SELECT COUNT(*) FROM planets")->fetchColumn(); -$liberated_planets = $db->query("SELECT COUNT(*) FROM planets WHERE status = 'stable'")->fetchColumn(); -$total_cities = $db->query("SELECT COUNT(*) FROM cities")->fetchColumn(); -$liberated_cities = $db->query("SELECT COUNT(*) FROM cities WHERE is_liberated = 1")->fetchColumn(); +$user_id = $_SESSION['user_id']; +$user_stmt = $db->prepare("SELECT role FROM users WHERE id = ?"); +$user_stmt->execute([$user_id]); +$current_user = $user_stmt->fetch(); -$planets_stats = $db->query("SELECT * FROM planets ORDER BY terrestrial_control DESC")->fetchAll(); +if (!$current_user || $current_user['role'] !== 'admin') { + die("Accès refusé. Cette console est réservée aux Administrateurs."); +} + +$tab = isset($_GET['tab']) ? $_GET['tab'] : 'users'; + +// --- HANDLERS --- + +// Handle User Role Update +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'update_user_role') { + $target_user_id = (int)$_POST['target_user_id']; + $new_role = $_POST['new_role']; + if (in_array($new_role, ['user', 'gm', 'admin'])) { + $stmt = $db->prepare("UPDATE users SET role = ? WHERE id = ?"); + $stmt->execute([$new_role, $target_user_id]); + } + header("Location: admin.php?tab=users&success=1"); + exit; +} + +// Handle Celestial Object Type CRUD +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'upsert_object_type') { + $id = (int)$_POST['id']; + $name = $_POST['name']; + $slug = $_POST['slug']; + $icon = $_POST['icon']; + $description = $_POST['description']; + + if ($id > 0) { + $stmt = $db->prepare("UPDATE celestial_object_types SET name = ?, slug = ?, icon = ?, description = ? WHERE id = ?"); + $stmt->execute([$name, $slug, $icon, $description, $id]); + } else { + $stmt = $db->prepare("INSERT INTO celestial_object_types (name, slug, icon, description) VALUES (?, ?, ?, ?)"); + $stmt->execute([$name, $slug, $icon, $description]); + } + header("Location: admin.php?tab=objects&success=1"); + exit; +} + +if (isset($_GET['delete_object'])) { + $id = (int)$_GET['delete_object']; + $db->prepare("DELETE FROM celestial_object_types WHERE id = ?")->execute([$id]); + header("Location: admin.php?tab=objects&success=1"); + exit; +} + +// Handle Status CRUD +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'upsert_status') { + $id = (int)$_POST['id']; + $name = $_POST['name']; + $slug = $_POST['slug']; + $color = $_POST['color']; + $description = $_POST['description']; + + if ($id > 0) { + $stmt = $db->prepare("UPDATE celestial_object_statuses SET name = ?, slug = ?, color = ?, description = ? WHERE id = ?"); + $stmt->execute([$name, $slug, $color, $description, $id]); + } else { + $stmt = $db->prepare("INSERT INTO celestial_object_statuses (name, slug, color, description) VALUES (?, ?, ?, ?)"); + $stmt->execute([$name, $slug, $color, $description]); + } + header("Location: admin.php?tab=statuses&success=1"); + exit; +} + +if (isset($_GET['delete_status'])) { + $id = (int)$_GET['delete_status']; + $db->prepare("DELETE FROM celestial_object_statuses WHERE id = ?")->execute([$id]); + header("Location: admin.php?tab=statuses&success=1"); + exit; +} + +// Handle Settlement Type CRUD +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'upsert_settlement') { + $id = (int)$_POST['id']; + $name = $_POST['name']; + $slug = $_POST['slug']; + $description = $_POST['description']; + + if ($id > 0) { + $stmt = $db->prepare("UPDATE settlement_types SET name = ?, slug = ?, description = ? WHERE id = ?"); + $stmt->execute([$name, $slug, $description, $id]); + } else { + $stmt = $db->prepare("INSERT INTO settlement_types (name, slug, description) VALUES (?, ?, ?)"); + $stmt->execute([$name, $slug, $description]); + } + header("Location: admin.php?tab=settlements&success=1"); + exit; +} + +if (isset($_GET['delete_settlement'])) { + $id = (int)$_GET['delete_settlement']; + $db->prepare("DELETE FROM settlement_types WHERE id = ?")->execute([$id]); + header("Location: admin.php?tab=settlements&success=1"); + exit; +} + +// --- DATA FETCHING --- +$users_list = []; +$objects_list = []; +$statuses_list = []; +$settlements_list = []; + +if ($tab === 'users') { + $users_list = $db->query("SELECT id, username, email, role FROM users ORDER BY username ASC")->fetchAll(); +} elseif ($tab === 'objects') { + $objects_list = $db->query("SELECT * FROM celestial_object_types ORDER BY name ASC")->fetchAll(); +} elseif ($tab === 'statuses') { + $statuses_list = $db->query("SELECT * FROM celestial_object_statuses ORDER BY name ASC")->fetchAll(); +} elseif ($tab === 'settlements') { + $settlements_list = $db->query("SELECT * FROM settlement_types ORDER BY name ASC")->fetchAll(); +} -// Mock Resources -$resources = [ - 'Metal' => ['val' => '136 053', 'max' => '1 210 000', 'prod' => '+1 980', 'icon' => 'fa-cube'], - 'Crystal' => ['val' => '127 322', 'max' => '1 010 000', 'prod' => '+1 703', 'icon' => 'fa-gem'], - 'Deuterium' => ['val' => '32 277', 'max' => '50 000', 'prod' => '+28', 'icon' => 'fa-flask'], - 'Energy' => ['val' => '2 100', 'max' => '2 100', 'prod' => '', 'icon' => 'fa-bolt'], - 'Dark Matter' => ['val' => '4 930', 'max' => '', 'prod' => '', 'icon' => 'fa-atom'] -]; ?> - - Console MJ + Console Admin - Nexus -
-
- $res): ?> -
-
-
- -
- +
+
+

CONSOLE ADMIN

+ +
+
+
-
-
- Retour au Secteur -

Console de Commandement MJ

- -
-
-
Planètes Libérées
-
/
-
-
-
Villes Libérées
-
/
-
-
-
- -
-
-
+
+ +
Opération effectuée avec succès.
+ + + + +

Gestion des Rôles

- - - - - - - + - + - - - - - + + + +
PlanèteTypeStatutContrôle SolAction
UtilisateurEmailRôle ActuelNouveau Rôle
%Localiser + + + + +
+ + + + +
+
-
-
+ + +

Objets Célestes

+
+

Ajouter / Modifier un Objet

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ + +
+
+ + + + + + + + + + + + + +
IcôneNomSlugActions
+ + Suppr +
+ + +

Statuts / États

+
+

Ajouter / Modifier un Statut

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ + +
+
+ + + + + + + + + + + + + +
CouleurNomSlugActions
+ + Suppr +
+ + +

Villes / Avant-postes

+
+

Ajouter / Modifier un Type d'Établissement

+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ + +
+
+ + + + + + + + + + + + + +
NomSlugDescriptionActions
+ + Suppr +
+ +
+ + - + \ No newline at end of file diff --git a/db/migrate_dynamic_types.php b/db/migrate_dynamic_types.php new file mode 100644 index 0000000..e0a6204 --- /dev/null +++ b/db/migrate_dynamic_types.php @@ -0,0 +1,88 @@ +exec("CREATE TABLE IF NOT EXISTS celestial_object_types ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + slug VARCHAR(50) NOT NULL UNIQUE, + icon VARCHAR(50) NOT NULL, + description TEXT + )"); + + // 2. Create celestial_object_statuses table + $db->exec("CREATE TABLE IF NOT EXISTS celestial_object_statuses ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + slug VARCHAR(50) NOT NULL UNIQUE, + color VARCHAR(20) NOT NULL, + description TEXT + )"); + + // 3. Create settlement_types table + $db->exec("CREATE TABLE IF NOT EXISTS settlement_types ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + slug VARCHAR(50) NOT NULL UNIQUE, + description TEXT + )"); + + // 4. Seed initial data + $object_types = [ + ['Planète', 'planet', 'fa-earth-europe', 'Une planète habitable ou non.'], + ['Champ d\'astéroïdes', 'asteroid', 'fa-mountain', 'Riche en minerais.'], + ['Trou noir', 'black_hole', 'fa-circle-dot', 'Phénomène gravitationnel extrême.'], + ['Pulsar', 'pulsar', 'fa-bolt', 'Étoile à neutrons hautement magnétisée.'], + ['Étoile', 'star', 'fa-sun', 'Étoile centrale d\'un système.'], + ['Comète', 'comet', 'fa-comet', 'Petit corps céleste de glace et de poussière.'], + ['Vaisseau abandonné', 'wreckage', 'fa-ship', 'Épave dérivant dans l\'espace.'], + ['Champ de bataille', 'battlefield', 'fa-burst', 'Vestiges d\'un affrontement spatial.'], + ['Vortex', 'vortex', 'fa-whirlpool', 'Anomalie spatio-temporelle.'], + ]; + + $stmt = $db->prepare("INSERT IGNORE INTO celestial_object_types (name, slug, icon, description) VALUES (?, ?, ?, ?)"); + foreach ($object_types as $ot) { + $stmt->execute($ot); + } + + $statuses = [ + ['Inhabité / Vide', 'empty', 'rgba(255,255,255,0.05)', 'Aucune présence détectée.'], + ['Hostile', 'hostile', '#ef4444', 'Zone contrôlée par des ennemis.'], + ['Stable / Allié', 'stable', '#a3be8c', 'Zone sûre et amicale.'], + ['Contrôlé', 'controlled', '#5e81ac', 'Zone sous contrôle total.'], + ['Contesté', 'contested', '#ebcb8b', 'Zone de conflit actif.'], + ['Ressources', 'resource', '#f59e0b', 'Zone riche en ressources exploitables.'], + ['PNA', 'pna', '#d08770', 'Pacte de Non-Agression en vigueur.'], + ['Vortex', 'vortex', '#8b5cf6', 'Zone instable.'], + ['Inhabité (Neutre)', 'inhabited', '#eceff4', 'Présence neutre ou civile.'], + ]; + + $stmt = $db->prepare("INSERT IGNORE INTO celestial_object_statuses (name, slug, color, description) VALUES (?, ?, ?, ?)"); + foreach ($statuses as $s) { + $stmt->execute($s); + } + + $settlement_types = [ + ['Avant-poste', 'avant-poste', 'Petite base avancée.'], + ['Petite ville', 'petite', 'Établissement mineur.'], + ['Moyenne ville', 'moyenne', 'Établissement standard.'], + ['Grande ville', 'grande', 'Métropole importante.'], + ['Mégacité', 'mégacité', 'Centre urbain colossal.'], + ]; + + $stmt = $db->prepare("INSERT IGNORE INTO settlement_types (name, slug, description) VALUES (?, ?, ?)"); + foreach ($settlement_types as $st) { + $stmt->execute($st); + } + + // 5. Update planets and cities tables to use IDs (optional but better for integrity) + // For now, let's just make sure the tables exist and can be managed. + // We will update the code to use these tables for the select options. + + echo "Migration completed successfully."; +} catch (PDOException $e) { + echo "Error: " . $e->getMessage(); +} + diff --git a/gm_console.php b/gm_console.php new file mode 100644 index 0000000..5f87b06 --- /dev/null +++ b/gm_console.php @@ -0,0 +1,372 @@ +prepare("SELECT role FROM users WHERE id = ?"); +$user_stmt->execute([$user_id]); +$current_user = $user_stmt->fetch(); + +if (!$current_user || ($current_user['role'] !== 'admin' && $current_user['role'] !== 'gm')) { + die("Accès refusé. Vous devez être un Maître du Jeu (MJ) pour accéder à cette console."); +} + +$is_admin = ($current_user['role'] === 'admin'); + +// Fetch Dynamic Types and Statuses +$object_types_db = $db->query("SELECT * FROM celestial_object_types ORDER BY id ASC")->fetchAll(PDO::FETCH_ASSOC); +$statuses_db = $db->query("SELECT * FROM celestial_object_statuses ORDER BY id ASC")->fetchAll(PDO::FETCH_ASSOC); +$settlement_types_db = $db->query("SELECT * FROM settlement_types ORDER BY id ASC")->fetchAll(PDO::FETCH_ASSOC); + +$object_types_map = []; foreach($object_types_db as $ot) $object_types_map[$ot['slug']] = $ot; +$statuses_map = []; foreach($statuses_db as $s) $statuses_map[$s['slug']] = $s; + +// Handle Planet/Slot Update +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'update_slot') { + $slot_id = (int)$_POST['slot_id']; + $galaxy_id = (int)$_POST['galaxy_id']; + $sector_id = (int)$_POST['sector_id']; + $slot_num = (int)$_POST['slot_num']; + $name = $_POST['name']; + $type = $_POST['type']; + $status = $_POST['status']; + $orbital = (int)$_POST['orbital_control']; + $terrestrial = (int)$_POST['terrestrial_control']; + + if ($type === 'empty') { + if ($slot_id > 0) { + $db->prepare("DELETE FROM planets WHERE id = ?")->execute([$slot_id]); + } + } else { + if ($slot_id > 0) { + $stmt = $db->prepare("UPDATE planets SET name = ?, type = ?, status = ?, orbital_control = ?, terrestrial_control = ? WHERE id = ?"); + $stmt->execute([$name, $type, $status, $orbital, $terrestrial, $slot_id]); + $planet_id = $slot_id; + } else { + $stmt = $db->prepare("INSERT INTO planets (galaxy_id, sector_id, slot, name, type, status, orbital_control, terrestrial_control) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$galaxy_id, $sector_id, $slot_num, $name, $type, $status, $orbital, $terrestrial]); + $planet_id = $db->lastInsertId(); + } + + // Handle Settlement (City) + if (!empty($_POST['city_name'])) { + $c_name = $_POST['city_name']; + $c_type = $_POST['city_type']; + // Simple check if city exists for this planet + $stmt = $db->prepare("SELECT id FROM cities WHERE planet_id = ?"); + $stmt->execute([$planet_id]); + $city = $stmt->fetch(); + if ($city) { + $db->prepare("UPDATE cities SET name = ?, type = ? WHERE id = ?")->execute([$c_name, $c_type, $city['id']]); + } else { + $db->prepare("INSERT INTO cities (planet_id, name, type) VALUES (?, ?, ?)")->execute([$planet_id, $c_name, $c_type]); + } + } + } + header("Location: gm_console.php?view=sector&galaxy_id=$galaxy_id§or_id=$sector_id&success=1"); + exit; +} + +// Handle Sector Update +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'update_sector') { + $sector_id = (int)$_POST['sector_id']; + $galaxy_id = (int)$_POST['galaxy_id']; + $s_name = $_POST['sector_name']; + $s_status = $_POST['sector_status']; + + $stmt = $db->prepare("SELECT id FROM sectors WHERE id = ?"); + $stmt->execute([$sector_id]); + if ($stmt->fetch()) { + $db->prepare("UPDATE sectors SET name = ?, status = ? WHERE id = ?")->execute([$s_name, $s_status, $sector_id]); + } else { + $db->prepare("INSERT INTO sectors (id, name, status, galaxy_id) VALUES (?, ?, ?, ?)")->execute([$sector_id, $s_name, $s_status, $galaxy_id]); + } + header("Location: gm_console.php?view=sector&galaxy_id=$galaxy_id§or_id=$sector_id&success=1"); + exit; +} + +$view = isset($_GET['view']) ? $_GET['view'] : 'galaxy'; +$galaxy_id = isset($_GET['galaxy_id']) ? (int)$_GET['galaxy_id'] : 1; +$sector_id = isset($_GET['sector_id']) ? (int)$_GET['sector_id'] : 1; +$grid_size = 36; + +if ($view === 'sector') { + // Fetch planets AND their cities + $stmt = $db->prepare("SELECT p.*, c.name as city_name, c.type as city_type FROM planets p LEFT JOIN cities c ON p.id = c.planet_id WHERE p.galaxy_id = ? AND p.sector_id = ? AND p.slot BETWEEN 1 AND ?"); + $stmt->execute([$galaxy_id, $sector_id, $grid_size]); + $objects_raw = $stmt->fetchAll(); + $grid = array_fill(1, $grid_size, null); + foreach ($objects_raw as $obj) { + $grid[$obj['slot']] = $obj; + } + $stmt = $db->prepare("SELECT * FROM sectors WHERE id = ?"); + $stmt->execute([$sector_id]); + $sector_info = $stmt->fetch(); +} elseif ($view === 'galaxy') { + $stmt = $db->prepare("SELECT sector_id, slot, status, type FROM planets WHERE galaxy_id = ? ORDER BY sector_id, slot ASC"); + $stmt->execute([$galaxy_id]); + $all_planets = $stmt->fetchAll(); + $sector_data = []; + foreach ($all_planets as $p) { + $sector_data[$p['sector_id']][$p['slot']] = ['status' => $p['status'], 'type' => $p['type']]; + } + $stmt = $db->prepare("SELECT id, status FROM sectors WHERE galaxy_id = ?"); + $stmt->execute([$galaxy_id]); + $global_sector_statuses = $stmt->fetchAll(PDO::FETCH_KEY_PAIR); +} + +function getStatusColor($status, $type, $statuses_map, $object_types_map) { + if (isset($statuses_map[$status])) return $statuses_map[$status]['color']; + return 'rgba(255,255,255,0.05)'; +} +?> + + + + + Console MJ - Nexus + + + + + +
+
+

CONSOLE MJ

+ +
+
+ Maître du Jeu: + +
+
+ +
+ +

Sélecteur de Secteur

+ + + +
+
+ Retour +

Secteur :

+
+ +
+ +
+ +
+ + +
+ + +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + + + \ No newline at end of file diff --git a/index.php b/index.php index ae011fc..2bd18cc 100644 --- a/index.php +++ b/index.php @@ -3,16 +3,29 @@ require_once 'db/config.php'; session_start(); $db = db(); +$user_role = 'user'; +if (isset($_SESSION['user_id'])) { + $stmt = $db->prepare("SELECT role FROM users WHERE id = ?"); + $stmt->execute([$_SESSION['user_id']]); + $u_data = $stmt->fetch(); + $user_role = $u_data['role'] ?? 'user'; +} + $view = isset($_GET['view']) ? $_GET['view'] : 'sector'; $galaxy_id = isset($_GET['galaxy_id']) ? (int)$_GET['galaxy_id'] : 1; $sector_id = isset($_GET['sector_id']) ? (int)$_GET['sector_id'] : 1; +// Fetch Dynamic Types and Statuses +$object_types_db = $db->query("SELECT * FROM celestial_object_types")->fetchAll(PDO::FETCH_ASSOC); +$statuses_db = $db->query("SELECT * FROM celestial_object_statuses")->fetchAll(PDO::FETCH_ASSOC); + +$object_types_map = []; foreach($object_types_db as $ot) $object_types_map[$ot['slug']] = $ot; +$statuses_map = []; foreach($statuses_db as $s) $statuses_map[$s['slug']] = $s; + // Grid size: 6x6 = 36 slots per sector $grid_size = 36; -$grid_cols = 6; -$grid_rows = 6; -// Mock Resources (Following the screenshot's style) +// Mock Resources $resources = [ 'Metal' => ['val' => '136 053', 'max' => '1 210 000', 'prod' => '+1 980', 'icon' => 'fa-cube'], 'Crystal' => ['val' => '127 322', 'max' => '1 010 000', 'prod' => '+1 703', 'icon' => 'fa-gem'], @@ -22,50 +35,33 @@ $resources = [ ]; if ($view === 'sector') { - // Fetch Objects for the current sector (6x6 grid = 36 slots) - $stmt = $db->prepare("SELECT * FROM planets WHERE galaxy_id = ? AND sector_id = ? AND slot BETWEEN 1 AND ?"); + $stmt = $db->prepare("SELECT p.*, c.name as city_name, c.type as city_type FROM planets p LEFT JOIN cities c ON p.id = c.planet_id WHERE p.galaxy_id = ? AND p.sector_id = ? AND p.slot BETWEEN 1 AND ?"); $stmt->execute([$galaxy_id, $sector_id, $grid_size]); $objects_raw = $stmt->fetchAll(); - $grid = array_fill(1, $grid_size, null); - foreach ($objects_raw as $obj) { - if ($obj['slot'] >= 1 && $obj['slot'] <= $grid_size) { - $grid[$obj['slot']] = $obj; - } - } - $page_title = "Secteur $sector_id [G$galaxy_id]"; + foreach ($objects_raw as $obj) { $grid[$obj['slot']] = $obj; } + + $stmt = $db->prepare("SELECT name FROM sectors WHERE id = ?"); + $stmt->execute([$sector_id]); + $sector_info = $stmt->fetch(); + $sector_display_name = $sector_info['name'] ?? "Secteur $sector_id"; + $page_title = "$sector_display_name [G$galaxy_id]"; } else { - // Galaxy View: Fetch all planets in this galaxy to build mini-maps $stmt = $db->prepare("SELECT sector_id, slot, status, type FROM planets WHERE galaxy_id = ? ORDER BY sector_id, slot ASC"); $stmt->execute([$galaxy_id]); $all_planets = $stmt->fetchAll(); - $sector_data = []; $active_sectors = []; foreach ($all_planets as $p) { - $sector_data[$p['sector_id']][$p['slot']] = [ - 'status' => $p['status'], - 'type' => $p['type'] - ]; - if (!in_array($p['sector_id'], $active_sectors)) { - $active_sectors[] = (int)$p['sector_id']; - } + $sector_data[$p['sector_id']][$p['slot']] = ['status' => $p['status'], 'type' => $p['type']]; + if (!in_array($p['sector_id'], $active_sectors)) { $active_sectors[] = (int)$p['sector_id']; } } $page_title = "Galaxie $galaxy_id"; } -function getStatusColor($status, $type = 'planet') { - if ($status == 'hostile') return '#ef4444'; // Rouge - if ($status == 'controlled' || $status == 'contested') return '#5e81ac'; // Bleu cassé - if ($status == 'allied' || $status == 'stable') return '#a3be8c'; // Vert cassé - if ($status == 'resource' || $type == 'asteroid') return '#f59e0b'; // Ressources / Orange - if ($status == 'pna') return '#d08770'; // PNA - if ($status == 'vortex' || $type == 'black_hole') return '#8b5cf6'; // Vortex / Violet - if ($status == 'empty' || $type == 'empty') return 'rgba(255,255,255,0.05)'; - if ($status == 'inhabited') return '#eceff4'; // Planète inhabitée (Blanc cassé) - return 'rgba(255,255,255,0.05)'; // Fallback to empty +function getStatusColor($status, $statuses_map) { + return $statuses_map[$status]['color'] ?? 'rgba(255,255,255,0.05)'; } - ?> @@ -76,215 +72,51 @@ function getStatusColor($status, $type = 'planet') { @@ -315,36 +147,21 @@ function getStatusColor($status, $type = 'planet') {
- -
@@ -352,16 +169,16 @@ function getStatusColor($status, $type = 'planet') {
- - + + + + +
@@ -369,51 +186,42 @@ function getStatusColor($status, $type = 'planet') {
-
-
-
Système vide
-
Planète inhabitée
-
Planète hostile
-
Ressources
-
Planète en PNA
-
Planète alliée / stable
-
Planète contrôlée
-
Vortex
+ +
+
- Console MJ + + + - + \ No newline at end of file