fix alliance name
This commit is contained in:
@@ -85,6 +85,12 @@
|
|||||||
const player = uw.Game?.player_name || '';
|
const player = uw.Game?.player_name || '';
|
||||||
const player_id = uw.Game?.player_id ?? null;
|
const player_id = uw.Game?.player_id ?? null;
|
||||||
const alliance_id = uw.Game?.alliance_id ?? null;
|
const alliance_id = uw.Game?.alliance_id ?? null;
|
||||||
|
let alliance_name = null;
|
||||||
|
try {
|
||||||
|
const pm = uw.MM.getModels().Player[player_id];
|
||||||
|
if (pm && pm.attributes) alliance_name = pm.attributes.alliance_name;
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
const total_points = uw.Game?.player_points ?? 0;
|
const total_points = uw.Game?.player_points ?? 0;
|
||||||
const world = uw.Game?.world_id || '';
|
const world = uw.Game?.world_id || '';
|
||||||
|
|
||||||
@@ -262,6 +268,7 @@
|
|||||||
has_premium,
|
has_premium,
|
||||||
bonuses,
|
bonuses,
|
||||||
wonder_points,
|
wonder_points,
|
||||||
|
alliance_name,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -173,12 +173,20 @@ window.renderTownDetails = function() {
|
|||||||
const godName = t.god ? t.god.charAt(0).toUpperCase() + t.god.slice(1) : 'Κανένας';
|
const godName = t.god ? t.god.charAt(0).toUpperCase() + t.god.slice(1) : 'Κανένας';
|
||||||
const seaStr = t.sea != null ? `Θ${t.sea}` : '—';
|
const seaStr = t.sea != null ? `Θ${t.sea}` : '—';
|
||||||
const coordStr = (t.x != null && t.y != null) ? ` (${Math.round(t.x)}:${Math.round(t.y)})` : '';
|
const coordStr = (t.x != null && t.y != null) ? ` (${Math.round(t.x)}:${Math.round(t.y)})` : '';
|
||||||
|
|
||||||
|
let allianceHtml = '';
|
||||||
|
if (t.alliance_name) {
|
||||||
|
allianceHtml = `<div>Συμμαχία: <strong style="color:#c8a44a">${t.alliance_name}</strong></div>`;
|
||||||
|
} else if (t.alliance_id) {
|
||||||
|
allianceHtml = `<div>Συμμαχία: ID <strong style="color:#aaa">${t.alliance_id}</strong></div>`;
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('td-general').innerHTML = `
|
document.getElementById('td-general').innerHTML = `
|
||||||
<div>Πόντοι: <strong>${t.points}</strong>${t.wonder_points ? ` / Θαύμα: <strong>${t.wonder_points}</strong>` : ''}</div>
|
<div>Πόντοι: <strong>${t.points}</strong>${t.wonder_points ? ` / Θαύμα: <strong>${t.wonder_points}</strong>` : ''}</div>
|
||||||
<div>Θεός: <strong>${godName}</strong></div>
|
<div>Θεός: <strong>${godName}</strong></div>
|
||||||
<div>Θάλασσα: <strong style="color:#6fcfcf">${seaStr}</strong><span style="color:#666;font-size:0.72rem">${coordStr}</span></div>
|
<div>Θάλασσα: <strong style="color:#6fcfcf">${seaStr}</strong><span style="color:#666;font-size:0.72rem">${coordStr}</span></div>
|
||||||
<div>Παίκτης: <strong style="color:#aaa">${t.player}</strong>${t.has_premium ? ' <span style="color:#c8a44a" title="Premium">★</span>' : ''}</div>
|
<div>Παίκτης: <strong style="color:#aaa">${t.player}</strong>${t.has_premium ? ' <span style="color:#c8a44a" title="Premium">★</span>' : ''}</div>
|
||||||
${t.alliance_id ? `<div>Συμμαχία: <strong style="color:#aaa">${t.alliance_id}</strong></div>` : ''}
|
${allianceHtml}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// ---- Researches ----
|
// ---- Researches ----
|
||||||
|
|||||||
Reference in New Issue
Block a user