fix time
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Grepolis Remote Control
|
// @name Grepolis Remote Control
|
||||||
// @namespace http://tampermonkey.net/
|
// @namespace http://tampermonkey.net/
|
||||||
// @version 1.7
|
// @version 1.8
|
||||||
// @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 || buildDataRaw[k].time || buildDataRaw[k].building_time || buildDataRaw[k].real_build_time || 0
|
build_time: buildDataRaw[k].building_time || ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -18,17 +18,6 @@ window.renderBuildingDropdown = function() {
|
|||||||
|
|
||||||
const currentVal = bSelect.value;
|
const currentVal = bSelect.value;
|
||||||
bSelect.innerHTML = '';
|
bSelect.innerHTML = '';
|
||||||
|
|
||||||
// Helper to format seconds -> "1h 30m" or "4m 15s"
|
|
||||||
const formatTime = (secs) => {
|
|
||||||
if (!secs) return '';
|
|
||||||
const h = Math.floor(secs / 3600);
|
|
||||||
const m = Math.floor((secs % 3600) / 60);
|
|
||||||
const s = secs % 60;
|
|
||||||
if (h > 0) return `${h}h ${m}m`;
|
|
||||||
if (m > 0) return `${m}m ${s}s`;
|
|
||||||
return `${s}s`;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const [key, nameGr] of Object.entries(window.BUILDING_NAMES_GR)) {
|
for (const [key, nameGr] of Object.entries(window.BUILDING_NAMES_GR)) {
|
||||||
const level = bLevels[key] !== undefined ? bLevels[key] : "?";
|
const level = bLevels[key] !== undefined ? bLevels[key] : "?";
|
||||||
@@ -40,7 +29,8 @@ window.renderBuildingDropdown = function() {
|
|||||||
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);
|
let t = data.build_time || '';
|
||||||
|
if (t.startsWith('00:')) t = t.substring(3); // make '00:06:00' cleaner as '06:00'
|
||||||
|
|
||||||
// Only show costs if the prerequisites are fulfilled
|
// Only show costs if the prerequisites are fulfilled
|
||||||
text += ` — Ξ:${w} Π:${st} Α:${i} · ⏱ ${t}`;
|
text += ` — Ξ:${w} Π:${st} Α:${i} · ⏱ ${t}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user