add new function farm quests

This commit is contained in:
2026-04-24 21:29:55 +03:00
parent f6f4df05bf
commit 6a4217234b
4 changed files with 110 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name Grepolis Remote Control
// @namespace http://tampermonkey.net/
// @version 3.5.7
// @version 3.6.0
// @description Polls grepo.haunter-pets.top for remote commands and executes them in-game (Multi-Player)
// @author Dimitrios
// @match https://*.grepolis.com/game/*
@@ -814,6 +814,75 @@
}
}
// Auto Bandit Camp: if enabled, attack/claim when ready
if (farmSettings.bandit_camp_enabled) {
try {
const spotModels = uw.MM.getModels().PlayerAttackSpot;
if (spotModels) {
const spotId = Object.keys(spotModels)[0];
if (spotId) {
const spot = spotModels[spotId];
const nowTs = Math.floor(Date.now() / 1000);
const townId = spot.attributes.town_id;
if (spot.attributes.reward_available) {
log('⚔️ Bandit Camp: Reward available! Waiting before claiming...');
await sleep(randInt(8000, 24000));
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
model_url: `PlayerAttackSpot/${spotId}`,
action_name: 'useReward',
captcha: null,
arguments: {},
town_id: townId,
nl_init: true
});
log('⚔️ Bandit Camp: Reward claimed!');
} else if (spot.attributes.cooldown_at <= nowTs) {
// Check if there are active movements to make sure troops are home
let hasMovements = false;
try {
const movements = uw.MM.getOnlyCollectionByName('MovementCommand')?.models || [];
hasMovements = movements.length > 0;
} catch (e) {}
if (!hasMovements) {
// Gather troops
const town = uw.ITowns?.getTown?.(townId) || uw.ITowns?.towns?.[townId];
if (town) {
const myUnits = town.units() || {};
const allowedUnits = ['sword', 'slinger', 'archer', 'hoplite', 'rider', 'chariot', 'catapult'];
const sendUnits = {};
let totalUnits = 0;
for (let u of allowedUnits) {
if (myUnits[u] > 0) {
sendUnits[u] = myUnits[u];
totalUnits += myUnits[u];
}
}
if (totalUnits > 0) {
log(`⚔️ Bandit Camp: Cooldown over! Preparing to attack with ${totalUnits} units...`);
await sleep(randInt(8000, 24000));
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
model_url: `PlayerAttackSpot/${spotId}`,
action_name: 'attack',
captcha: null,
arguments: sendUnits,
town_id: townId,
nl_init: true
});
log('⚔️ Bandit Camp: Attack sent!');
}
}
}
}
}
}
} catch (e) {
log(`Bandit camp error: ${e.message}`);
}
}
if (cmdData.sync_requested) {
log('Sync requested by server — pushing state immediately');
pushState();