Auto-Claim Cheddore and Additional Tasks

Automatically claims Cheddore and performs additional tasks in MouseHunt. Checks for Cheddore availability and Boulder health, and handles additional periodic tasks.

20.07.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Auto-Claim Cheddore and Additional Tasks
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  Automatically claims Cheddore and performs additional tasks in MouseHunt. Checks for Cheddore availability and Boulder health, and handles additional periodic tasks.
// @author       uzumymw
// @match        http://mousehuntgame.com/*
// @match        https://mousehuntgame.com/*
// @match        http://www.mousehuntgame.com/*
// @match        https://www.mousehuntgame.com/*
// @match        http://www.mousehuntgame.com/camp.php*
// @match        https://www.mousehuntgame.com/camp.php*
// @match        http://apps.facebook.com/mousehunt/*
// @match        https://apps.facebook.com/mousehunt/*
// @grant        unsafeWindow
// @grant        GM_info
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function isInMountainLocation() {
        const locationElement = document.querySelector('.mousehuntHud-environmentName');
        return locationElement && locationElement.textContent.trim() === "Mountain";
    }

    function isCheddoreReady() {
        return document.querySelector('.mousehuntActionButton.small') !== null;
    }

    function isBoulderReady() {
        const healthSpan = document.querySelector('.mountainHUD-miniBoulder-health-percent span');
        return healthSpan && parseInt(healthSpan.textContent.trim(), 10) <= 0;
    }

    function collectCheddore() {
        const cheddoreButton = document.querySelector('.mousehuntActionButton.small');
        if (cheddoreButton) {
            if (typeof unsafeWindow.hg !== 'undefined' && unsafeWindow.hg.views && unsafeWindow.hg.views.HeadsUpDisplayMountainView) {
                unsafeWindow.hg.views.HeadsUpDisplayMountainView.claimReward(cheddoreButton);
            } else {
                console.log("hg or HeadsUpDisplayMountainView is not defined.");
            }
        } else {
            console.log("Cheddore button not found.");
        }
    }

    function attemptToClaimCheddore() {
        if (isInMountainLocation()) {
            if (typeof unsafeWindow.hg !== 'undefined' && unsafeWindow.hg.views && unsafeWindow.hg.views.HeadsUpDisplayMountainView) {
                if (isBoulderReady() && isCheddoreReady()) {
                    collectCheddore();
                } else {
                    console.log("Cheddore not ready or boulder not claimable.");
                }
            } else {
                console.log("hg or HeadsUpDisplayMountainView not yet available. Retrying...");
                setTimeout(attemptToClaimCheddore, 1000); // Retry after 1 second
            }
        } else {
            console.log("Not in Mountain location. Skipping claim.");
        }
    }

    // Attempt to claim Cheddore immediately and set up periodic checks
    attemptToClaimCheddore();
    setInterval(attemptToClaimCheddore, 5 * 60 * 1000); // Check every 5 minutes

    function performAdditionalTask() {
        console.log("Performing additional task.");
    }

    // Perform the additional task every 10 minutes (as an example)
    setInterval(performAdditionalTask, 10 * 60 * 1000); // Every 10 minutes

    // Initial call for the additional task
    performAdditionalTask();
})();