update
This commit is contained in:
@@ -463,11 +463,22 @@ function renderTownDetails() {
|
||||
|
||||
document.getElementById('td-name').textContent = t.town_name;
|
||||
|
||||
const cap = t.resources.storage || 1;
|
||||
const getCol = (amt) => {
|
||||
const pct = amt / cap;
|
||||
if (pct >= 0.95) return 'color: #ff4a4a;'; // Red
|
||||
if (pct >= 0.85) return 'color: #ffa500;'; // Orange
|
||||
return 'color: #fff;';
|
||||
};
|
||||
|
||||
const capFmt = t.resources.storage ? fmt(t.resources.storage) : '?';
|
||||
|
||||
document.getElementById('td-resources').innerHTML = `
|
||||
<div>${RES_ICONS.wood} Ξύλο: <strong>${fmt(t.resources.wood)}</strong></div>
|
||||
<div>${RES_ICONS.stone} Πέτρα: <strong>${fmt(t.resources.stone)}</strong></div>
|
||||
<div>${RES_ICONS.iron} Ασήμι: <strong>${fmt(t.resources.iron)}</strong></div>
|
||||
<div>${RES_ICONS.pop} Πληθυσμός: <strong>${t.resources.population}</strong></div>
|
||||
<div style="font-size:0.75rem; color:#aaa; margin-bottom: 4px;">Χωρητικότητα: <strong style="color:#eee">${capFmt}</strong></div>
|
||||
<div>${RES_ICONS.wood} Ξύλο: <strong style="${getCol(t.resources.wood)}">${fmt(t.resources.wood)}</strong></div>
|
||||
<div>${RES_ICONS.stone} Πέτρα: <strong style="${getCol(t.resources.stone)}">${fmt(t.resources.stone)}</strong></div>
|
||||
<div>${RES_ICONS.iron} Ασήμι: <strong style="${getCol(t.resources.iron)}">${fmt(t.resources.iron)}</strong></div>
|
||||
<div style="margin-top: 6px;">${RES_ICONS.pop} Πληθυσμός: <strong style="color:#fff">${t.resources.population}</strong></div>
|
||||
`;
|
||||
|
||||
const godName = t.god ? t.god.charAt(0).toUpperCase() + t.god.slice(1) : 'Κανένας';
|
||||
|
||||
Reference in New Issue
Block a user