Auto Minting

Minting automatically at the academy at random intervals

当前为 2024-10-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Auto Minting
// @version      1
// @description  Minting automatically at the academy at random intervals
// @include      https://*/game.php*screen=snob*
// @namespace https://greasyfork.org/users/1388863
// ==/UserScript==

(function() {
    'use strict';

    let countdownInterval;
    let isMinting = true; 
    let countdownTime; 

    // Membuat tombol Start/Stop Minting
    let toggleButton = document.createElement("button");
    toggleButton.innerText = "Stop Minting"; 
    toggleButton.style.position = "fixed";
    toggleButton.style.bottom = "20px";
    toggleButton.style.right = "20px";
    toggleButton.style.padding = "8px 15px";
    toggleButton.style.fontSize = "16px";
    toggleButton.style.zIndex = "1000";
    toggleButton.style.backgroundColor = "#FF0000"; 
    toggleButton.style.color = "white";
    toggleButton.style.border = "none";
    toggleButton.style.borderRadius = "5px";
    toggleButton.style.cursor = "pointer";

    let countdownPopup = document.createElement("div");
    countdownPopup.style.position = "fixed";
    countdownPopup.style.bottom = "60px";
    countdownPopup.style.right = "20px";
    countdownPopup.style.padding = "8px 15px";
    countdownPopup.style.fontSize = "14px";
    countdownPopup.style.zIndex = "1000";
    countdownPopup.style.backgroundColor = "#333";
    countdownPopup.style.color = "white";
    countdownPopup.style.borderRadius = "5px";
    countdownPopup.style.display = "none"; 

    document.body.appendChild(toggleButton);
    document.body.appendChild(countdownPopup);


    function mintCoins() {
        const maxCoinElement = document.getElementById("coin_mint_fill_max");
        const maxCoinValue = maxCoinElement ? parseInt(maxCoinElement.textContent.match(/\((\d+)\)/)[1], 10) : null;

        if (maxCoinValue !== null) {
            document.getElementById("coin_mint_count").value = maxCoinValue;

            const mintButton = document.querySelector("input[type='submit'][value='Mint']");
            if (mintButton) {
                mintButton.click();
                console.log("Tombol 'Mint' diklik dengan nilai:", maxCoinValue);
            } else {
                console.log("Tombol 'Mint' tidak ditemukan.");
            }
        } else {
            console.log("Tidak dapat menemukan nilai maksimum.");
        }
    }

    function startCountdown() {
        countdownPopup.style.display = "block";
        countdownTime = Math.floor(Math.random() * (600 - 300 + 1)) + 300;

        countdownInterval = setInterval(() => {
            countdownTime--;
            const minutes = Math.floor(countdownTime / 60);
            const seconds = countdownTime % 60;
            countdownPopup.innerText = `Next mint in: ${minutes}m ${seconds}s`;

            if (countdownTime <= 0) {
                location.reload(); 
            }
        }, 1000);
    }

    function stopCountdown() {
        clearInterval(countdownInterval);
        countdownPopup.style.display = "none"; 
    }


    function toggleMinting() {
        if (isMinting) {
            stopCountdown();
            isMinting = false;
            toggleButton.innerText = "Start Minting";
            toggleButton.style.backgroundColor = "#4CAF50";
            console.log("Minting dihentikan.");
        } else {
            const delay = Math.floor(Math.random() * (5000 - 3000 + 1)) + 3000; 

            setTimeout(() => {
                mintCoins();
                startCountdown(); 
            }, delay);

            isMinting = true;
            toggleButton.innerText = "Stop Minting";
            toggleButton.style.backgroundColor = "#FF0000";
            console.log("Minting dimulai.");
        }
    }

    toggleButton.addEventListener("click", toggleMinting);

    const initialDelay = Math.floor(Math.random() * (5000 - 3000 + 1)) + 3000; 
    setTimeout(() => {
        mintCoins();
        startCountdown(); 
    }, initialDelay);
})();