diff --git a/GrepolisRemoteControl.user.js b/GrepolisRemoteControl.user.js index eb5876c..4e12c8f 100644 --- a/GrepolisRemoteControl.user.js +++ b/GrepolisRemoteControl.user.js @@ -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;