diff --git a/GrepolisRemoteControl.user.js b/GrepolisRemoteControl.user.js index 292459b..ceb695a 100644 --- a/GrepolisRemoteControl.user.js +++ b/GrepolisRemoteControl.user.js @@ -99,6 +99,7 @@ wood: res.wood, stone: res.stone, iron: res.iron, + storage: res.storage || res.storage_capacity || 0, population: res.population, points: town.getPoints?.() ?? 0, god: town.god?.() ?? null, diff --git a/routes/dashboard.py b/routes/dashboard.py index 6e000a6..ef7e853 100644 --- a/routes/dashboard.py +++ b/routes/dashboard.py @@ -42,6 +42,7 @@ def get_towns(): 'wood': d.get('wood', 0), 'stone': d.get('stone', 0), 'iron': d.get('iron', 0), + 'storage': d.get('storage', 0), 'population': d.get('population', 0), }, 'buildings': d.get('buildings', {}), diff --git a/templates/dashboard.html b/templates/dashboard.html index 8f3dbf5..e50ef0d 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -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 = ` -
${RES_ICONS.wood} Ξύλο: ${fmt(t.resources.wood)}
-
${RES_ICONS.stone} Πέτρα: ${fmt(t.resources.stone)}
-
${RES_ICONS.iron} Ασήμι: ${fmt(t.resources.iron)}
-
${RES_ICONS.pop} Πληθυσμός: ${t.resources.population}
+
Χωρητικότητα: ${capFmt}
+
${RES_ICONS.wood} Ξύλο: ${fmt(t.resources.wood)}
+
${RES_ICONS.stone} Πέτρα: ${fmt(t.resources.stone)}
+
${RES_ICONS.iron} Ασήμι: ${fmt(t.resources.iron)}
+
${RES_ICONS.pop} Πληθυσμός: ${t.resources.population}
`; const godName = t.god ? t.god.charAt(0).toUpperCase() + t.god.slice(1) : 'Κανένας';