forgot version

This commit is contained in:
2026-04-22 20:50:36 +03:00
parent c1cc8ceb7a
commit f7016f5f0d

View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Grepolis Remote Control // @name Grepolis Remote Control
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 2.8 // @version 2.9
// @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/*
@@ -163,7 +163,7 @@
const marketLevel = buildings.market ?? 0; const marketLevel = buildings.market ?? 0;
const gd = uw.GameData?.buildingData?.market; const gd = uw.GameData?.buildingData?.market;
marketCapacity = gd?.capacity_per_level?.[marketLevel] || 0; marketCapacity = gd?.capacity_per_level?.[marketLevel] || 0;
// Add Trade Office bonus if present // Add Trade Office bonus if present
if (buildings.trade_office && buildings.trade_office > 0) { if (buildings.trade_office && buildings.trade_office > 0) {
marketCapacity += (uw.GameData?.buildingData?.trade_office?.capacity_extra_per_level || 500) * marketLevel; marketCapacity += (uw.GameData?.buildingData?.trade_office?.capacity_extra_per_level || 500) * marketLevel;
@@ -193,13 +193,13 @@
let unitDataMap = {}; let unitDataMap = {};
try { try {
const gdUnits = uw.GameData?.units || {}; const gdUnits = uw.GameData?.units || {};
for (const u in gdUnits) { for (const u in gdUnits) {
if (u === 'militia') continue; if (u === 'militia') continue;
const reqBuildings = gdUnits[u].building_dependencies || {}; const reqBuildings = gdUnits[u].building_dependencies || {};
const reqResearch = gdUnits[u].research_dependencies || []; const reqResearch = gdUnits[u].research_dependencies || [];
let missing_deps = {}; let missing_deps = {};
for (const reqB in reqBuildings) { for (const reqB in reqBuildings) {
if ((buildings[reqB] || 0) < reqBuildings[reqB]) { if ((buildings[reqB] || 0) < reqBuildings[reqB]) {
@@ -211,15 +211,15 @@
missing_deps[reqR] = { name: reqR, needed_level: 'Έρευνα' }; missing_deps[reqR] = { name: reqR, needed_level: 'Έρευνα' };
} }
} }
const cost = gdUnits[u].resources || {}; const cost = gdUnits[u].resources || {};
const w = cost.wood || 0; const w = cost.wood || 0;
const s = cost.stone || 0; const s = cost.stone || 0;
const i = cost.iron || 0; const i = cost.iron || 0;
let enough = true; let enough = true;
if (res.wood < w || res.stone < s || res.iron < i) enough = false; if (res.wood < w || res.stone < s || res.iron < i) enough = false;
unitDataMap[u] = { unitDataMap[u] = {
wood: w, wood: w,
stone: s, stone: s,
@@ -316,7 +316,7 @@
setInterval(() => { setInterval(() => {
const win = document.getElementById('hcaptcha_window'); const win = document.getElementById('hcaptcha_window');
let isVisible = false; let isVisible = false;
if (win) { if (win) {
// Check if it's actually visible on screen (not display: none by the game) // Check if it's actually visible on screen (not display: none by the game)
const style = window.getComputedStyle(win); const style = window.getComputedStyle(win);
@@ -324,14 +324,14 @@
isVisible = true; isVisible = true;
} }
} }
if (isVisible && !captchaActive) { if (isVisible && !captchaActive) {
captchaActive = true; captchaActive = true;
paused = true; paused = true;
const label = document.getElementById('grc_label'); const label = document.getElementById('grc_label');
const btn = document.getElementById('grc_btn'); const btn = document.getElementById('grc_btn');
if (label) label.textContent = '⚠ CAPTCHA'; if (label) label.textContent = '⚠ CAPTCHA';
if (btn) btn.style.filter = 'brightness(70%) sepia(100%) hue-rotate(300deg) saturate(1000%) contrast(0.8)'; if (btn) btn.style.filter = 'brightness(70%) sepia(100%) hue-rotate(300deg) saturate(1000%) contrast(0.8)';
log('⚠ CAPTCHA detected — bot paused, alerting server'); log('⚠ CAPTCHA detected — bot paused, alerting server');
reportCaptcha(true); reportCaptcha(true);
} else if (!isVisible && captchaActive) { } else if (!isVisible && captchaActive) {
@@ -478,9 +478,9 @@
} }
// Build queue, Recruit queue and Market queue are independent // Build queue, Recruit queue and Market queue are independent
const buildCmd = cmdData.build; const buildCmd = cmdData.build;
const recruitCmd = cmdData.recruit; const recruitCmd = cmdData.recruit;
const marketCmd = cmdData.market; const marketCmd = cmdData.market;
if (cmdData.sync_requested) { if (cmdData.sync_requested) {
log('Sync requested by server — pushing state immediately'); log('Sync requested by server — pushing state immediately');
@@ -492,7 +492,7 @@
log(`Executing command #${cmd.id} — type:${cmd.type} town:${cmd.town_id}`); log(`Executing command #${cmd.id} — type:${cmd.type} town:${cmd.town_id}`);
let result; let result;
try { try {
if (cmd.type === 'build') result = await executeBuild(cmd); if (cmd.type === 'build') result = await executeBuild(cmd);
else if (cmd.type === 'recruit') result = await executeRecruit(cmd); else if (cmd.type === 'recruit') result = await executeRecruit(cmd);
else if (cmd.type === 'market_offer') result = await executeMarketOffer(cmd); else if (cmd.type === 'market_offer') result = await executeMarketOffer(cmd);
else result = { ok: false, msg: `Unknown type: ${cmd.type}` }; else result = { ok: false, msg: `Unknown type: ${cmd.type}` };