- $res): ?>
-
-
-
-
-
?v=">
-
- ">
-
-
-
-
-
+ $r): ?>
+
+
-
-
-
+
+
+
+
+
+
+
-
-
+
+
- Galaxie
- >
+
-
Univers
- - + +
+
+
+ Vue Galaxie
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
-
- Faction:
-
-
-
-
-
- Contrôle Orbital:
-
-
-
-
-
-
- $lvl):
- if ($lvl <= 0) continue;
- $fName = $factions_map[$fid]['name'] ?? 'Inconnue';
- $fColor = $factions_map[$fid]['color'] ?? '#88c0d0';
- ?>
-
-
-
- %
-
-
-
-
-
- Établissements:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $lvl):
- if ($lvl <= 0) continue;
- $fName = $factions_map[$fid]['name'] ?? 'Inconnue';
- $fColor = $factions_map[$fid]['color'] ?? '#88c0d0';
- ?>
-
-
-
-
- %
-
-
-
-
-
-
-
-
-
-
-
- :
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
SECTEUR
@@ -698,121 +415,118 @@ function isStatusBlinking($status, $statuses_map) {
const statusesMap = ;
function openPlanetModal(data) {
- if (!data) return;
-
- const typeInfo = typesMap[data.type] || {};
- const statusInfo = statusesMap[data.status] || {};
- const factionInfo = factionsMap[data.faction_id] || { name: 'Aucune', color: '#8c92a3' };
-
document.getElementById('m-planet-name').innerText = data.name;
+ const typeInfo = typesMap[data.type] || {};
document.getElementById('m-planet-type').innerText = typeInfo.name || data.type;
- document.getElementById('m-planet-img').src = typeInfo.image_url || '';
- document.getElementById('m-planet-status').innerText = statusInfo.name || data.status;
- document.getElementById('m-planet-status').style.background = statusInfo.color || 'rgba(255,255,255,0.1)';
- document.getElementById('m-planet-status').classList.toggle('blink', statusInfo.is_blinking == 1);
- document.getElementById('m-planet-faction').innerText = 'Faction dominante: ' + factionInfo.name;
- document.getElementById('m-planet-faction').style.color = factionInfo.color || '#fff';
- // Display modifiers instead of description
+ const statusInfo = statusesMap[data.status] || {};
+ const statusBadge = document.getElementById('m-planet-status');
+ statusBadge.innerText = statusInfo.name || data.status;
+ statusBadge.style.background = statusInfo.color || '#4c566a';
+ if (statusInfo.is_blinking == 1) statusBadge.classList.add('blink');
+ else statusBadge.classList.remove('blink');
+
+ const img = document.getElementById('m-planet-img');
+ img.src = typeInfo.image_url ? typeInfo.image_url + '?v=' + Date.now() : '';
+ img.style.display = typeInfo.image_url ? 'block' : 'none';
+
+ // Faction (Simple logic: majority control)
+ let dominantFaction = 'Aucune';
+ let maxOrb = 0;
+ for (let fid in data.orbital_controls) {
+ if (data.orbital_controls[fid] > maxOrb) {
+ maxOrb = data.orbital_controls[fid];
+ dominantFaction = factionsMap[fid] ? factionsMap[fid].name : 'Inconnue';
+ }
+ }
+ document.getElementById('m-planet-faction').innerText = 'Faction dominante (Orbital): ' + dominantFaction;
+
+ // Modifiers
const modContainer = document.getElementById('m-planet-mods');
modContainer.innerHTML = '';
- if (typeInfo.modifiers && typeInfo.modifiers.length > 0) {
- typeInfo.modifiers.forEach(m => {
- const modDiv = document.createElement('div');
- modDiv.className = 'mod-item ' + (m.type === 'bonus' ? 'mod-bonus' : 'mod-malus');
- modDiv.innerHTML = `
-
- ${m.name}: ${m.description}
- `;
- modContainer.appendChild(modDiv);
+ if (typeInfo.modifiers) {
+ typeInfo.modifiers.forEach(mod => {
+ const span = document.createElement('span');
+ span.className = 'mod-badge';
+ span.innerText = mod.name;
+ modContainer.appendChild(span);
});
- } else {
- modContainer.innerHTML = 'Aucun modificateur particulier.
';
}
- // Orbital Control
- const orbitalBar = document.getElementById('m-orbital-bar');
- const orbitalLegend = document.getElementById('m-orbital-legend');
- orbitalBar.innerHTML = '';
- orbitalLegend.innerHTML = '';
-
- if (typeInfo.orbital_control_enabled == 1 && data.orbital_controls && Object.keys(data.orbital_controls).length > 0) {
- document.getElementById('m-orbital-section').style.display = 'block';
- renderMultiBar(data.orbital_controls, orbitalBar, orbitalLegend);
- } else {
- document.getElementById('m-orbital-section').style.display = 'none';
- }
-
- // Terrestrial Control (Summary)
- const terrestrialBar = document.getElementById('m-terrestrial-bar');
- const terrestrialLegend = document.getElementById('m-terrestrial-legend');
- terrestrialBar.innerHTML = '';
- terrestrialLegend.innerHTML = '';
-
- if (typeInfo.terrestrial_control_enabled == 1 && data.terrestrial_controls && Object.keys(data.terrestrial_controls).length > 0) {
- document.getElementById('m-terrestrial-section').style.display = 'block';
- renderMultiBar(data.terrestrial_controls, terrestrialBar, terrestrialLegend);
- } else {
- document.getElementById('m-terrestrial-section').style.display = 'none';
- }
+ // Orbital Bar
+ renderControlBar('m-orbital-bar', 'm-orbital-legend', data.orbital_controls);
+ // Terrestrial Bar
+ renderControlBar('m-terrestrial-bar', 'm-terrestrial-legend', data.terrestrial_controls);
// Cities
- const citiesContainer = document.getElementById('m-cities-container');
- citiesContainer.innerHTML = '';
-
- if (typeInfo.terrestrial_control_enabled == 1 && data.cities && data.cities.length > 0) {
- document.getElementById('m-cities-section').style.display = 'block';
+ const cityContainer = document.getElementById('m-cities-container');
+ cityContainer.innerHTML = '';
+ if (data.cities && data.cities.length > 0) {
data.cities.forEach(city => {
- const card = document.createElement('div');
- card.className = 'settlement-card';
-
- const header = document.createElement('div');
- header.className = 'settlement-header';
- header.innerHTML = `${city.name}${city.type_name}`;
- card.appendChild(header);
-
- if (city.controls && Object.keys(city.controls).length > 0) {
- const bar = document.createElement('div');
- bar.className = 'multi-control-bar';
- const legend = document.createElement('div');
- legend.className = 'control-legend';
-
- renderMultiBar(city.controls, bar, legend);
-
- card.appendChild(bar);
- card.appendChild(legend);
+ const div = document.createElement('div');
+ div.className = 'city-item';
+ let controlDesc = '';
+ for (let fid in city.controls) {
+ if (factionsMap[fid]) {
+ controlDesc += `${factionsMap[fid].name}: ${city.controls[fid]}% `;
+ }
}
-
- citiesContainer.appendChild(card);
+ div.innerHTML = `
+
+ ${city.name}
+ ${city.type_name || 'Établissement'}
+
+ ${controlDesc}
+ `;
+ cityContainer.appendChild(div);
});
} else {
- document.getElementById('m-cities-section').style.display = 'none';
+ cityContainer.innerHTML = 'Aucun établissement répertorié.
';
}
document.getElementById('planetModal').style.display = 'flex';
}
- function renderMultiBar(controls, barElement, legendElement) {
- Object.entries(controls).forEach(([fid, lvl]) => {
- const level = parseInt(lvl);
- const fac = factionsMap[fid] || { name: 'Inconnue', color: '#88c0d0' };
-
- if (level <= 0) return;
+ function renderControlBar(barId, legendId, controls) {
+ const bar = document.getElementById(barId);
+ const legend = document.getElementById(legendId);
+ bar.innerHTML = '';
+ legend.innerHTML = '';
- // Segment
+ let total = 0;
+ for (let fid in controls) {
+ const val = parseInt(controls[fid]);
+ if (val > 0) {
+ total += val;
+ const faction = factionsMap[fid] || { name: 'Inconnue', color: '#4c566a' };
+ const segment = document.createElement('div');
+ segment.className = 'control-segment';
+ segment.style.width = val + '%';
+ segment.style.backgroundColor = faction.color;
+ segment.title = `${faction.name}: ${val}%`;
+ bar.appendChild(segment);
+
+ const tag = document.createElement('div');
+ tag.className = 'legend-tag';
+ tag.innerHTML = ` ${faction.name}: ${val}%`;
+ legend.appendChild(tag);
+ }
+ }
+
+ if (total < 100) {
+ const remain = 100 - total;
const segment = document.createElement('div');
segment.className = 'control-segment';
- segment.style.width = level + '%';
- segment.style.backgroundColor = fac.color || '#88c0d0';
- segment.title = `${fac.name}: ${level}%`;
- barElement.appendChild(segment);
+ segment.style.width = remain + '%';
+ segment.style.backgroundColor = '#2e3440';
+ segment.title = `Incontesté: ${remain}%`;
+ bar.appendChild(segment);
- // Legend
const tag = document.createElement('div');
tag.className = 'legend-tag';
- tag.innerHTML = ` ${fac.name}: ${level}%`;
- legendElement.appendChild(tag);
- });
+ tag.innerHTML = ` Incontesté: ${remain}%`;
+ legend.appendChild(tag);
+ }
}
function closePlanetModal() {
@@ -820,4 +534,4 @@ function isStatusBlinking($status, $statuses_map) {
}
-
+