This commit is contained in:
2026-04-23 23:42:46 +03:00
parent 80acf211b8
commit 102cdfdcce

View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name Grepolis Remote Control
// @namespace http://tampermonkey.net/
// @version 3.5.6
// @version 3.5.7
// @description Polls grepo.haunter-pets.top for remote commands and executes them in-game (Multi-Player)
// @author Dimitrios
// @match https://*.grepolis.com/game/*
@@ -553,14 +553,14 @@
for (let i = 0; i < islandList.length; i++) {
const island_id = islandList[i];
const townIds = islandTownsMap[island_id];
let selected_town_id = null;
let lowest_total_res = Infinity;
for (const t_id of townIds) {
const t = uw.ITowns?.towns?.[t_id];
if (!t) continue;
let storageCapacity = t.getStorageCapacity?.() || 0;
if (!storageCapacity) {
const buildings = t.buildings?.()?.attributes || {};
@@ -568,17 +568,17 @@
const gd = uw.GameData?.buildingData?.storage;
storageCapacity = gd?.max_storage?.[storageLevel] || gd?.storage?.[storageLevel] || 0;
}
const res = t.resources?.() || {};
const w = res.wood || 0;
const s = res.stone || 0;
const ir = res.iron || 0;
// If completely full (all 3 resources >= max storage), skip this town
if (storageCapacity > 0 && w >= storageCapacity && s >= storageCapacity && ir >= storageCapacity) {
continue;
}
// Pick town with most space (lowest total resources)
const total_res = w + s + ir;
if (total_res < lowest_total_res) {
@@ -586,11 +586,11 @@
selected_town_id = t_id;
}
}
if (!selected_town_id) {
if (!selected_town_id) {
log(`Farm: Skipping island ${island_id} (All towns are 100% full)`);
skipped++;
continue;
skipped++;
continue;
}
const town_id = selected_town_id;