academy mode
This commit is contained in:
@@ -787,6 +787,35 @@
|
||||
return { ok: true, msg: `Market offer posted: ${offer} ${offer_type} => ${demand} ${demand_type}` };
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Execute: Research (Academy)
|
||||
// ----------------------------------------------------------------
|
||||
async function executeResearch(cmd) {
|
||||
const { town_id, payload } = cmd;
|
||||
const { research_id } = payload;
|
||||
|
||||
const town = uw.ITowns?.getTown?.(town_id) || uw.ITowns?.towns?.[town_id];
|
||||
if (!town) {
|
||||
return { ok: false, msg: `Town ${town_id} not found` };
|
||||
}
|
||||
|
||||
const reactionMs = randInt(800, 2500);
|
||||
log(`Waiting ${reactionMs}ms before firing research (reaction time)...`);
|
||||
await sleep(reactionMs);
|
||||
|
||||
if (paused) return { ok: false, msg: 'Aborted due to pause/captcha' };
|
||||
|
||||
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
|
||||
model_url: 'ResearchOrder',
|
||||
action_name: 'research',
|
||||
arguments: { id: research_id },
|
||||
town_id: town_id
|
||||
});
|
||||
|
||||
await sleep(500);
|
||||
return { ok: true, msg: `Research ${research_id} queued` };
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Poll for and execute pending commands (build + recruit + market)
|
||||
// ----------------------------------------------------------------
|
||||
@@ -808,6 +837,7 @@
|
||||
const buildCmd = cmdData.build;
|
||||
const recruitCmd = cmdData.recruit;
|
||||
const marketCmd = cmdData.market;
|
||||
const researchCmd = cmdData.research;
|
||||
const farmCmd = cmdData.farm;
|
||||
const farmUpgradeCmd = cmdData.farm_upgrade;
|
||||
|
||||
@@ -826,6 +856,7 @@
|
||||
if (cmd.type === 'build') result = await executeBuild(cmd);
|
||||
else if (cmd.type === 'recruit') result = await executeRecruit(cmd);
|
||||
else if (cmd.type === 'market_offer') result = await executeMarketOffer(cmd);
|
||||
else if (cmd.type === 'research') result = await executeResearch(cmd);
|
||||
else if (cmd.type === 'farm_loot') result = await executeFarmLoot(cmd);
|
||||
else if (cmd.type === 'farm_upgrade') result = await executeFarmUpgrade(cmd);
|
||||
else result = { ok: false, msg: `Unknown type: ${cmd.type}` };
|
||||
@@ -841,6 +872,7 @@
|
||||
await execute(buildCmd);
|
||||
await execute(recruitCmd);
|
||||
await execute(marketCmd);
|
||||
await execute(researchCmd);
|
||||
await execute(farmCmd);
|
||||
await execute(farmUpgradeCmd);
|
||||
|
||||
@@ -867,7 +899,7 @@
|
||||
// Boot
|
||||
// ----------------------------------------------------------------
|
||||
window.addEventListener('load', () => {
|
||||
log('Grepolis Remote Control v3.5 loaded');
|
||||
log('Grepolis Remote Control v3.5.9 loaded');
|
||||
|
||||
// Start captcha watcher immediately
|
||||
detectCaptcha();
|
||||
|
||||
Reference in New Issue
Block a user