This commit is contained in:
2026-04-21 19:25:36 +03:00
parent b0d933c1a0
commit c41eebac87

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.5 // @version 2.6
// @description Polls grepo.haunter-pets.top for remote commands and executes them in-game // @description Polls grepo.haunter-pets.top for remote commands and executes them in-game
// @author Dimitrios // @author Dimitrios
// @match https://*.grepolis.com/game/* // @match https://*.grepolis.com/game/*
@@ -295,9 +295,19 @@
} }
function detectCaptcha() { function detectCaptcha() {
const observer = new MutationObserver(() => { setInterval(() => {
const hasWindow = !!document.getElementById('hcaptcha_window'); const win = document.getElementById('hcaptcha_window');
if (hasWindow && !captchaActive) { let isVisible = false;
if (win) {
// Check if it's actually visible on screen (not display: none by the game)
const style = window.getComputedStyle(win);
if (style.display !== 'none' && style.visibility !== 'hidden') {
isVisible = true;
}
}
if (isVisible && !captchaActive) {
captchaActive = true; captchaActive = true;
paused = true; paused = true;
const label = document.getElementById('grc_label'); const label = document.getElementById('grc_label');
@@ -306,14 +316,13 @@
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 (!hasWindow && captchaActive) { } else if (!isVisible && captchaActive) {
captchaActive = false; captchaActive = false;
// Don't auto-resume — let the user click the button manually // Don't auto-resume — let the user click the button manually
log('✅ Captcha resolved — alert cleared (bot remains paused)'); log('✅ Captcha resolved — alert cleared (bot remains paused)');
reportCaptcha(false); reportCaptcha(false);
} }
}); }, 1000);
observer.observe(document.body, { childList: true, subtree: false });
} }
// ---------------------------------------------------------------- // ----------------------------------------------------------------