hl
This commit is contained in:
parent
9691e36417
commit
f4a1794123
@ -8,9 +8,9 @@ const tooltip = document.getElementById("map-tooltip");
|
||||
const tooltipCache = {};
|
||||
|
||||
const buildingModules = {
|
||||
11: loadCharacterHouse, // Tabs ausblenden, eigenes UI
|
||||
11: loadCharacterHouse, // Tabs ausblenden, eigenes UI
|
||||
12: loadBlackmarket, // Tabs ausblenden, eigenes UI
|
||||
10: loadMine, // Tabs bleiben sichtbar, nur Aktionen-Tab befüllen
|
||||
10: loadMine, // Tabs bleiben sichtbar, nur Aktionen-Tab befüllen
|
||||
};
|
||||
|
||||
// Gebäude die ihre eigenen Tabs behalten sollen
|
||||
@ -62,7 +62,7 @@ async function openBuildingPopup(url) {
|
||||
<div class="popup-stat-row"><span class="popup-stat-key">Punkte</span><span class="popup-stat-val">${data.points} / ${data.nextLevelPoints}</span></div>
|
||||
<p class="popup-desc" style="color:#cccccc !important;font-size:13px;line-height:1.8;">${data.description}</p>
|
||||
<div class="popup-xp-wrap">
|
||||
<div class="popup-xp-label">Fortschritt zum nächsten Level</div>
|
||||
|
||||
<div class="popup-xp-track">
|
||||
<div class="popup-xp-fill" style="width:${Math.min((data.points / data.nextLevelPoints) * 100, 100)}%">
|
||||
<div class="popup-xp-shimmer"></div>
|
||||
@ -82,7 +82,7 @@ async function openBuildingPopup(url) {
|
||||
tabs.style.display = "none";
|
||||
infoTab.innerHTML = `<div class="building-ui"></div>`;
|
||||
}
|
||||
buildingModules[buildingType](url.split('/').pop());
|
||||
buildingModules[buildingType](url.split("/").pop());
|
||||
}
|
||||
|
||||
// Punkte-Check: Upgrade nur möglich wenn genug Punkte vorhanden
|
||||
@ -116,8 +116,8 @@ async function openBuildingPopup(url) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="popup-upgrade-btn" id="upgrade-btn" data-building="${url.split('/').pop()}"
|
||||
${!canUpgrade ? 'disabled style="opacity:0.4;cursor:not-allowed;"' : ''}>
|
||||
<button class="popup-upgrade-btn" id="upgrade-btn" data-building="${url.split("/").pop()}"
|
||||
${!canUpgrade ? 'disabled style="opacity:0.4;cursor:not-allowed;"' : ""}>
|
||||
⚒ UPGRADE STARTEN ⚒
|
||||
</button>
|
||||
${!hasEnoughPoints ? `<p style="color:#ff6666;font-size:12px;margin-top:8px;text-align:center;">Noch ${data.upgradeRequiredPoints - data.points} Punkte bis zum Upgrade.</p>` : ""}
|
||||
@ -158,7 +158,11 @@ document.addEventListener("click", async (e) => {
|
||||
const data = await res.json();
|
||||
|
||||
if (!res.ok || data.error) {
|
||||
window.showNotification(data.error || "Upgrade fehlgeschlagen.", "Upgrade", "⚒️");
|
||||
window.showNotification(
|
||||
data.error || "Upgrade fehlgeschlagen.",
|
||||
"Upgrade",
|
||||
"⚒️",
|
||||
);
|
||||
btn.disabled = false;
|
||||
btn.textContent = "⚒ UPGRADE STARTEN ⚒";
|
||||
return;
|
||||
@ -167,7 +171,7 @@ document.addEventListener("click", async (e) => {
|
||||
window.showNotification(
|
||||
`Upgrade erfolgreich!\nNeues Level: ${data.newLevel}\n\nKosten: ${data.cost.wood} Holz, ${data.cost.stone} Stein, ${data.cost.gold} Gold`,
|
||||
"Upgrade",
|
||||
"⚒️"
|
||||
"⚒️",
|
||||
);
|
||||
|
||||
// Popup mit frischen Daten neu laden
|
||||
@ -175,10 +179,13 @@ document.addEventListener("click", async (e) => {
|
||||
|
||||
// HUD aktualisieren
|
||||
import("/js/hud.js").then(({ loadHud }) => loadHud());
|
||||
|
||||
} catch (err) {
|
||||
console.error("Upgrade Fehler:", err);
|
||||
window.showNotification("Fehler beim Upgrade. Bitte erneut versuchen.", "Fehler", "⚠️");
|
||||
window.showNotification(
|
||||
"Fehler beim Upgrade. Bitte erneut versuchen.",
|
||||
"Fehler",
|
||||
"⚠️",
|
||||
);
|
||||
btn.disabled = false;
|
||||
btn.textContent = "⚒ UPGRADE STARTEN ⚒";
|
||||
}
|
||||
@ -259,7 +266,7 @@ document.querySelectorAll(".building").forEach((building) => {
|
||||
if (y + th > window.innerHeight - 10) y = e.clientY - th - 10;
|
||||
|
||||
tooltip.style.left = x + "px";
|
||||
tooltip.style.top = y + "px";
|
||||
tooltip.style.top = y + "px";
|
||||
});
|
||||
|
||||
building.addEventListener("mouseleave", () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user