From 31ab577c25a3dd73a259e2c3d79d91b0082d6745 Mon Sep 17 00:00:00 2001 From: haunter Date: Mon, 20 Apr 2026 00:55:07 +0300 Subject: [PATCH] fix 2 --- templates/dashboard.html | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/templates/dashboard.html b/templates/dashboard.html index 527b26b..703c3db 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -506,30 +506,15 @@ function renderBuildingDropdown() { if (!town) return; const bSelect = document.getElementById('building-select'); const bLevels = town.buildings || {}; - const bData = town.build_data || {}; const currentVal = bSelect.value; bSelect.innerHTML = ''; for (const [key, nameGr] of Object.entries(BUILDING_NAMES_GR)) { const level = bLevels[key] !== undefined ? bLevels[key] : "?"; - let extraText = ''; - - if (bData[key]) { - const d = bData[key]; - const r = town.resources; - const resMissing = (r.wood < d.wood || r.stone < d.stone || r.iron < d.iron || r.population < d.pop); - - if (resMissing) { - extraText = ' (Λείπουν πόροι/πληθ.)'; - } else if (!d.buildable) { - extraText = ' (Κλειδωμένο / Πλήρες)'; - } - } - const option = document.createElement('option'); option.value = key; - option.textContent = `${nameGr} [Επίπεδο ${level}]${extraText}`; + option.textContent = `${nameGr} [Επίπεδο ${level}]`; bSelect.appendChild(option); } @@ -576,23 +561,7 @@ async function sendCommand() { let payload = {}; if (type === 'build') { - const bid = document.getElementById('building-select').value; - - if (town.build_data && town.build_data[bid]) { - const d = town.build_data[bid]; - const r = town.resources; - const resMissing = (r.wood < d.wood || r.stone < d.stone || r.iron < d.iron); - const popMissing = (r.population < d.pop); - - if (resMissing) return alert(`Αδυναμία: Δεν επαρκούν οι πόροι!\n\nΑπαιτεί:\nΞύλο: ${d.wood}\nΠέτρα: ${d.stone}\nΑσήμι: ${d.iron}`); - if (popMissing) return alert(`Αδυναμία: Δεν επαρκεί ο πληθυσμός! (Απαιτεί ${d.pop})`); - - if (!d.buildable) { - return alert("Αδυναμία: Το κτίριο είναι κλειδωμένο (απαιτούνται άλλα κτίρια) ή πλήρως αναβαθμισμένο."); - } - } - - payload = { building_id: bid }; + payload = { building_id: document.getElementById('building-select').value }; } else { payload = { unit_id: document.getElementById('unit-select').value,