diff --git a/GrepolisRemoteControl.user.js b/GrepolisRemoteControl.user.js index c3a088e..5219c1b 100644 --- a/GrepolisRemoteControl.user.js +++ b/GrepolisRemoteControl.user.js @@ -85,6 +85,12 @@ const player = uw.Game?.player_name || ''; const player_id = uw.Game?.player_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 world = uw.Game?.world_id || ''; @@ -262,6 +268,7 @@ has_premium, bonuses, wonder_points, + alliance_name, }; }); diff --git a/static/js/components/townViewer.js b/static/js/components/townViewer.js index 21afbd6..4699eed 100644 --- a/static/js/components/townViewer.js +++ b/static/js/components/townViewer.js @@ -173,12 +173,20 @@ window.renderTownDetails = function() { const godName = t.god ? t.god.charAt(0).toUpperCase() + t.god.slice(1) : 'Κανένας'; const seaStr = t.sea != null ? `Θ${t.sea}` : '—'; const coordStr = (t.x != null && t.y != null) ? ` (${Math.round(t.x)}:${Math.round(t.y)})` : ''; + + let allianceHtml = ''; + if (t.alliance_name) { + allianceHtml = `
Συμμαχία: ${t.alliance_name}
`; + } else if (t.alliance_id) { + allianceHtml = `
Συμμαχία: ID ${t.alliance_id}
`; + } + document.getElementById('td-general').innerHTML = `
Πόντοι: ${t.points}${t.wonder_points ? ` / Θαύμα: ${t.wonder_points}` : ''}
Θεός: ${godName}
Θάλασσα: ${seaStr}${coordStr}
Παίκτης: ${t.player}${t.has_premium ? ' ' : ''}
- ${t.alliance_id ? `
Συμμαχία: ${t.alliance_id}
` : ''} + ${allianceHtml} `; // ---- Researches ----