update
This commit is contained in:
@@ -99,6 +99,7 @@
|
|||||||
wood: res.wood,
|
wood: res.wood,
|
||||||
stone: res.stone,
|
stone: res.stone,
|
||||||
iron: res.iron,
|
iron: res.iron,
|
||||||
|
storage: res.storage || res.storage_capacity || 0,
|
||||||
population: res.population,
|
population: res.population,
|
||||||
points: town.getPoints?.() ?? 0,
|
points: town.getPoints?.() ?? 0,
|
||||||
god: town.god?.() ?? null,
|
god: town.god?.() ?? null,
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ def get_towns():
|
|||||||
'wood': d.get('wood', 0),
|
'wood': d.get('wood', 0),
|
||||||
'stone': d.get('stone', 0),
|
'stone': d.get('stone', 0),
|
||||||
'iron': d.get('iron', 0),
|
'iron': d.get('iron', 0),
|
||||||
|
'storage': d.get('storage', 0),
|
||||||
'population': d.get('population', 0),
|
'population': d.get('population', 0),
|
||||||
},
|
},
|
||||||
'buildings': d.get('buildings', {}),
|
'buildings': d.get('buildings', {}),
|
||||||
|
|||||||
@@ -463,11 +463,22 @@ function renderTownDetails() {
|
|||||||
|
|
||||||
document.getElementById('td-name').textContent = t.town_name;
|
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 = `
|
document.getElementById('td-resources').innerHTML = `
|
||||||
<div>${RES_ICONS.wood} Ξύλο: <strong>${fmt(t.resources.wood)}</strong></div>
|
<div style="font-size:0.75rem; color:#aaa; margin-bottom: 4px;">Χωρητικότητα: <strong style="color:#eee">${capFmt}</strong></div>
|
||||||
<div>${RES_ICONS.stone} Πέτρα: <strong>${fmt(t.resources.stone)}</strong></div>
|
<div>${RES_ICONS.wood} Ξύλο: <strong style="${getCol(t.resources.wood)}">${fmt(t.resources.wood)}</strong></div>
|
||||||
<div>${RES_ICONS.iron} Ασήμι: <strong>${fmt(t.resources.iron)}</strong></div>
|
<div>${RES_ICONS.stone} Πέτρα: <strong style="${getCol(t.resources.stone)}">${fmt(t.resources.stone)}</strong></div>
|
||||||
<div>${RES_ICONS.pop} Πληθυσμός: <strong>${t.resources.population}</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) : 'Κανένας';
|
const godName = t.god ? t.god.charAt(0).toUpperCase() + t.god.slice(1) : 'Κανένας';
|
||||||
|
|||||||
Reference in New Issue
Block a user