['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'] ]; 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->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]"; } 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']; } } $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 } ?> <?php echo $page_title; ?>
$res): ?>
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