Alpha V2.1
This commit is contained in:
parent
55ea72e13a
commit
9810d7fd7c
BIN
assets/pasted-20260226-160010-19739a80.png
Normal file
BIN
assets/pasted-20260226-160010-19739a80.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 157 KiB |
@ -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; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -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); }
|
||||
?>
|
||||
<div class="mini-dot" style="background-color: <?php echo $dotColor; ?>;"></div>
|
||||
<div class="mini-dot <?php echo (isset($sector_data[$s][$p]) && ($statuses_map[$sector_data[$s][$p]["status"]]["is_blinking"] ?? 0)) ? "blink-effect" : ""; ?>" style="background-color: <?php echo $dotColor; ?>;"></div>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
<div style="font-size: 14px; font-weight: bold; margin-top: 5px;">SECTEUR <?php echo $s; ?></div>
|
||||
@ -520,7 +550,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="object-icon">
|
||||
<div class="object-icon <?php echo ($statuses_map[$obj['status']]['is_blinking'] ?? 0) ? 'blink-effect' : ''; ?>">
|
||||
<?php
|
||||
$icon = $type_info['icon'] ?? 'fa-circle';
|
||||
$color = getStatusColor($obj['status'], $obj['type'], $statuses_map, $object_types_map);
|
||||
@ -540,6 +570,14 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="legend">
|
||||
<?php foreach($statuses_db as $s): ?>
|
||||
<div class="legend-item">
|
||||
<span class="dot <?php echo $s["is_blinking"] ? 'blink-effect' : ''; ?>" style="background: <?php echo str_replace('\;blink', '', str_replace(' ;blink', '', $s['color'])); ?>;"></span>
|
||||
<?php echo htmlspecialchars($s["name"]); ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SECTOR EDIT MODAL -->
|
||||
@ -781,4 +819,4 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
function closeSectorModal() { document.getElementById('sectorModal').style.display = 'none'; }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user