diff --git a/assets/pasted-20260226-160010-19739a80.png b/assets/pasted-20260226-160010-19739a80.png new file mode 100644 index 0000000..a53baf9 Binary files /dev/null and b/assets/pasted-20260226-160010-19739a80.png differ diff --git a/gm_console.php b/gm_console.php index daa7daf..56558ad 100644 --- a/gm_console.php +++ b/gm_console.php @@ -277,14 +277,29 @@ if ($view === 'sector') { $planet_ids = array_column($all_planets, 'id'); $orb_controls = []; + $terr_controls = []; $city_counts = []; if (!empty($planet_ids)) { $placeholders = implode(',', array_fill(0, count($planet_ids), '?')); + + // Orbital $o_stmt = $db->prepare("SELECT * FROM planet_faction_control WHERE planet_id IN ($placeholders)"); $o_stmt->execute($planet_ids); while($r = $o_stmt->fetch()) $orb_controls[$r['planet_id']][$r['faction_id']] = $r['control_level']; + // Terrestrial (Aggregated per planet) + $t_stmt = $db->prepare("SELECT c.planet_id, cfc.faction_id, SUM(cfc.control_level) as total_lvl + FROM city_faction_control cfc + JOIN cities c ON cfc.city_id = c.id + WHERE c.planet_id IN ($placeholders) + GROUP BY c.planet_id, cfc.faction_id"); + $t_stmt->execute($planet_ids); + while($r = $t_stmt->fetch()) { + $terr_controls[$r['planet_id']][$r['faction_id']] = $r['total_lvl']; + } + + // City counts $c_stmt = $db->prepare("SELECT planet_id, COUNT(*) as cnt FROM cities WHERE planet_id IN ($placeholders) GROUP BY planet_id"); $c_stmt->execute($planet_ids); while($r = $c_stmt->fetch()) $city_counts[$r['planet_id']] = $r['cnt']; @@ -294,8 +309,17 @@ if ($view === 'sector') { $active_sectors = []; foreach ($all_planets as $p) { $p['orbital_controls'] = $orb_controls[$p['id']] ?? []; - $p['terrestrial_controls'] = []; $p['cities'] = isset($city_counts[$p['id']]) ? array_fill(0, $city_counts[$p['id']], []) : []; + $p['terrestrial_controls'] = []; + + if (!empty($p['cities'])) { + $num_cities = count($p['cities']); + if (isset($terr_controls[$p['id']])) { + foreach ($terr_controls[$p['id']] as $fid => $total_lvl) { + $p['terrestrial_controls'][$fid] = round($total_lvl / $num_cities); + } + } + } $dynamic_status = calculateCelestialStatus($p, $db, $statuses_map); $sector_data[$p['sector_id']][$p['slot']] = ['status' => $dynamic_status, 'type' => $p['type']]; @@ -443,8 +467,14 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) { .sector-card:hover { border-color: #88c0d0; background: #1a202c; transform: translateY(-3px); } .mini-map { display: grid; grid-template-columns: repeat(6, 12px); gap: 4px; margin-bottom: 10px; background: #000; padding: 6px; } .mini-dot { width: 12px; height: 12px; border-radius: 1px; } + .blink-effect { animation: blinker 1.5s linear infinite; } + @keyframes blinker { 50% { opacity: 0.3; } } .faction-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; } + + .legend { margin-top: 30px; background: rgba(10, 15, 30, 0.95); border: 1px solid #2d3545; padding: 15px 25px; display: flex; gap: 20px; font-size: 11px; flex-wrap: wrap; max-width: 1000px; justify-content: center; border-radius: 8px; } + .legend-item { display: flex; align-items: center; gap: 8px; color: #8c92a3; } + .dot { width: 10px; height: 10px; border-radius: 2px; }
@@ -477,7 +507,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) { $dotColor = 'rgba(255,255,255,0.05)'; if (isset($sector_data[$s][$p])) { $dotColor = getStatusColor($sector_data[$s][$p]['status'], $sector_data[$s][$p]['type'], $statuses_map, $object_types_map); } ?> - +