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