From 1db8d744c8957513cfdbee5e38d876d41e82377d Mon Sep 17 00:00:00 2001 From: haunter Date: Wed, 29 Apr 2026 22:05:57 +0300 Subject: [PATCH] fix for buildinds --- GrepolisRemoteControl.user.js | 16 ++++++++--- bot_modules/05_main.js | 15 ++++++++-- grepo.db | Bin 20480 -> 20480 bytes routes/api.py | 50 ++++++++++++++++++++++++++++++++-- 4 files changed, 71 insertions(+), 10 deletions(-) diff --git a/GrepolisRemoteControl.user.js b/GrepolisRemoteControl.user.js index c2df43f..84da835 100644 --- a/GrepolisRemoteControl.user.js +++ b/GrepolisRemoteControl.user.js @@ -833,8 +833,8 @@ return; } - // Build queue, Recruit queue and Market queue are independent - const buildCmd = cmdData.build; + // Build queue: one command per town (all towns build in the same poll cycle) + const buildCmds = cmdData.builds || []; const recruitCmd = cmdData.recruit; const marketCmd = cmdData.market; const researchCmd = cmdData.research; @@ -873,8 +873,16 @@ reportResult(cmd.id, finalStatus, result.msg); }; - // Run sequentially — humans cannot perform 3 actions simultaneously! - await execute(buildCmd); + // Execute ALL town build commands (one per town, sequential with inter-town delay) + for (let i = 0; i < buildCmds.length; i++) { + await execute(buildCmds[i]); + if (i < buildCmds.length - 1) { + // Random gap between towns so it doesn't look like a macro + const gap = randInt(1500, 3000); + log(`Build: town done. Waiting ${gap}ms before next town...`); + await sleep(gap); + } + } await execute(recruitCmd); await execute(marketCmd); await execute(researchCmd); diff --git a/bot_modules/05_main.js b/bot_modules/05_main.js index 7b9c313..8d9fb03 100644 --- a/bot_modules/05_main.js +++ b/bot_modules/05_main.js @@ -22,7 +22,8 @@ async function pollAndExecute() { const farmOn = features.includes('farm'); const adminOn = features.includes('admin'); - const buildCmd = adminOn ? cmdData.build : null; + // Build: one command per town (server returns an array) + const buildCmds = adminOn ? (cmdData.builds || []) : []; const recruitCmd = adminOn ? cmdData.recruit : null; const marketCmd = adminOn ? cmdData.market : null; const researchCmd = adminOn ? cmdData.research : null; @@ -60,8 +61,16 @@ async function pollAndExecute() { reportResult(cmd.id, finalStatus, result.msg); }; - // Run sequentially — humans cannot perform 3 actions simultaneously! - await execute(buildCmd); + // Execute one build command per town (simultaneous queue draining across all villages) + for (let i = 0; i < buildCmds.length; i++) { + await execute(buildCmds[i]); + if (i < buildCmds.length - 1) { + // Random inter-town gap — avoids looking like a macro + const gap = randInt(1500, 3000); + log(`Build: town done. Waiting ${gap}ms before next town...`); + await sleep(gap); + } + } await execute(recruitCmd); await execute(marketCmd); await execute(researchCmd); diff --git a/grepo.db b/grepo.db index 38c9f308fb31dfa2c2ecd1ab0576643f70e932a3..a66501166136dd45422fae30e469742311ff897c 100644 GIT binary patch delta 231 zcmZozz}T>Wae}lU2Ll5GD-go~$3z`tQ4R*ZvQA#!SOykO83s-n-c;^NUX6{7D>%4X zq8Qo5Wn~#V**72LwPTXkQ7FhstV}J6&rDGOfe_b-5Y1*CW_EE!MaDMe%@4TU8Dmiu zft2VdBLnh#*%-A035C43Xm0M7WrzUx=%_YtUqMUNa`%?UUnq YBUl(1m^?Q&x-uWae}lU69WSSD-go~(?lI(Q6>hxE)ibdSOymEYYe>Gc~iNs@oH=q6iDLc zYVv1h7gtndY{}f*%