enchance data

This commit is contained in:
2026-04-20 12:24:51 +03:00
parent 5d564de336
commit bb7d7392a8
5 changed files with 129 additions and 30 deletions

View File

@@ -253,6 +253,11 @@
<strong style="font-size: 0.75rem; color: #888; text-transform: uppercase;">Στρατος</strong>
<div id="td-units" style="font-size: 0.85rem; margin-top: 4px; line-height: 1.5; color: #a4c84a;"></div>
</div>
<div style="flex: 1; min-width: 130px;">
<strong style="font-size: 0.75rem; color: #888; text-transform: uppercase;">Ερευνες</strong>
<div id="td-researches" style="font-size: 0.8rem; margin-top: 4px; line-height: 1.5; color: #c8a44a;"></div>
</div>
</div>
</div>
@@ -474,8 +479,8 @@ function renderTowns() {
return `
<div class="town-card ${selected} ${stale ? 'town-stale' : ''}"
onclick="selectTown('${t.town_id}')">
<div class="town-name">${t.town_name}</div>
<div class="town-meta">${t.points} pts · ${t.god || 'No god'} · ${ageMin}m ago</div>
<div class="town-name">${t.town_name}${t.has_premium ? ' <span style="color:#c8a44a;font-size:0.7rem;">★</span>' : ''}</div>
<div class="town-meta">${t.sea != null ? `🌊 Θ${t.sea} · ` : ''}${t.points} pts · ${t.god || 'No god'} · ${ageMin}m ago</div>
<div class="town-res">
<div class="res-item"><div class="res-icon res-wood"></div>${fmt(t.resources.wood)}</div>
<div class="res-item"><div class="res-icon res-stone"></div>${fmt(t.resources.stone)}</div>
@@ -532,12 +537,29 @@ function renderTownDetails() {
`;
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)})` : '';
document.getElementById('td-general').innerHTML = `
<div>Πόντοι: <strong>${t.points}</strong></div>
<div>Πόντοι: <strong>${t.points}</strong>${t.wonder_points ? ` / Θαύμα: <strong>${t.wonder_points}</strong>` : ''}</div>
<div>Θεός: <strong>${godName}</strong></div>
<div>Παίκτης: <strong style="color:#aaa">${t.player}</strong></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>
${t.alliance_id ? `<div>Συμμαχία: <strong style="color:#aaa">${t.alliance_id}</strong></div>` : ''}
`;
// ---- Researches ----
const researchObj = t.researches || {};
const researchEntries = Object.entries(researchObj).filter(([, v]) => v === true || v === 1 || Number(v) > 0);
let resHtml = '';
if (researchEntries.length) {
resHtml = researchEntries.map(([k]) =>
`<div>✓ ${k.replace(/_/g, ' ')}</div>`
).join('');
} else {
resHtml = '<div style="color:#555">Καμία έρευνα</div>';
}
document.getElementById('td-researches').innerHTML = resHtml;
const unitsObj = t.units || {};
let unitsHtml = '';
for(const [unitKey, count] of Object.entries(unitsObj)) {