fix time and cost v1

This commit is contained in:
2026-04-20 16:04:20 +03:00
parent 6d545df2a8
commit 6117dc75dd
2 changed files with 6 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Grepolis Remote Control // @name Grepolis Remote Control
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 1.6 // @version 1.7
// @description Polls grepo.haunter-pets.top for remote commands and executes them in-game // @description Polls grepo.haunter-pets.top for remote commands and executes them in-game
// @author Dimitrios // @author Dimitrios
// @match https://*.grepolis.com/game/* // @match https://*.grepolis.com/game/*
@@ -107,7 +107,7 @@
stone: buildDataRaw[k].resources_for?.stone || 0, stone: buildDataRaw[k].resources_for?.stone || 0,
iron: buildDataRaw[k].resources_for?.iron || 0, iron: buildDataRaw[k].resources_for?.iron || 0,
pop: buildDataRaw[k].population_for || 0, pop: buildDataRaw[k].population_for || 0,
build_time: buildDataRaw[k].build_time || 0 build_time: buildDataRaw[k].build_time || buildDataRaw[k].time || buildDataRaw[k].building_time || buildDataRaw[k].real_build_time || 0
}; };
} }
} catch (e) { } catch (e) {

View File

@@ -35,30 +35,20 @@ window.renderBuildingDropdown = function() {
const data = bData[key]; const data = bData[key];
let text = `${nameGr} [Επίπεδο ${level}]`; let text = `${nameGr} [Επίπεδο ${level}]`;
let buildable = true;
if (data) { if (data && data.dependencies) {
const w = window.fmt(data.wood || 0); const w = window.fmt(data.wood || 0);
const st = window.fmt(data.stone || 0); const st = window.fmt(data.stone || 0);
const i = window.fmt(data.iron || 0); const i = window.fmt(data.iron || 0);
const t = formatTime(data.build_time); const t = formatTime(data.build_time);
buildable = data.buildable;
// Only show costs if the prerequisites are fulfilled and it's not max level // Only show costs if the prerequisites are fulfilled
if (data.dependencies) { text += ` — Ξ:${w} Π:${st} Α:${i} · ⏱ ${t}`;
text += ` — Ξ:${w} Π:${st} Α:${i} · ⏱ ${t}`;
} else {
text += ` — (Μη διαθέσιμο)`;
}
} }
const option = document.createElement('option'); const option = document.createElement('option');
option.value = key; option.value = key;
option.textContent = (!buildable && data?.dependencies) ? `${text}` : text; option.textContent = text;
if (!buildable) {
option.style.color = '#aa5555';
}
bSelect.appendChild(option); bSelect.appendChild(option);
} }