nice changes

This commit is contained in:
2026-04-20 00:41:01 +03:00
parent 9c1a05927a
commit 291b909c6f
3 changed files with 53 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name Grepolis Remote Control
// @namespace http://tampermonkey.net/
// @version 1.0
// @version 1.1
// @description Polls grepo.haunter-pets.top for remote commands and executes them in-game
// @author Dimitrios
// @match https://*.grepolis.com/game/*
@@ -92,6 +92,23 @@
const bo = town.buildingOrders?.();
if (bo?.models) buildQueue = bo.models.map(m => m.attributes);
} catch (e) {}
let buildDataMap = {};
try {
const buildDataRaw = uw.MM?.getModels?.()?.BuildingBuildData?.[town.id]?.attributes?.building_data || {};
for (const k in buildDataRaw) {
buildDataMap[k] = {
buildable: buildDataRaw[k].buildable,
dependencies: buildDataRaw[k].dependencies_fulfilled !== false,
wood: buildDataRaw[k].resources_for?.wood || 0,
stone: buildDataRaw[k].resources_for?.stone || 0,
iron: buildDataRaw[k].resources_for?.iron || 0,
pop: buildDataRaw[k].population_for || 0
};
}
} catch (e) {
log(`Failed to gather build data: ${e}`);
}
return {
town_id: town.id,
@@ -106,6 +123,7 @@
buildings,
units: unitsObj,
buildingOrder: buildQueue,
buildData: buildDataMap,
};
});