Fake bot Change Villa

Change villa every iteration

目前為 2025-01-21 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Fake bot Change Villa
// @version      1.35
// @description  Change villa every iteration
// @include      https://*/game.php*screen=place*
// @namespace https://greasyfork.org/users/1388863
// ==/UserScript==

(function() {
    'use strict';

    // Create UI container
    const container = document.createElement('div');
    container.style.position = 'fixed';
    container.style.bottom = '20px';
    container.style.right = '20px';
    container.style.backgroundColor = '#333';
    container.style.color = '#fff';
    container.style.padding = '10px';
    container.style.borderRadius = '5px';
    container.style.zIndex = '10000';
    container.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)';
    container.style.display = 'flex';
    container.style.flexDirection = 'column';
    container.style.gap = '10px';
    document.body.appendChild(container);

    // Remaining loops display
    const loopCounterDisplay = document.createElement('div');
    loopCounterDisplay.style.fontSize = '16px';
    loopCounterDisplay.style.textAlign = 'center';
    loopCounterDisplay.textContent = 'Remaining Loops: 0';
    container.appendChild(loopCounterDisplay);

    // Start/Stop button
    const startStopButton = document.createElement('button');
    startStopButton.textContent = 'Start';
    startStopButton.style.padding = '5px';
    startStopButton.style.fontSize = '16px';
    startStopButton.style.backgroundColor = '#4CAF50';
    startStopButton.style.color = '#fff';
    startStopButton.style.border = 'none';
    startStopButton.style.borderRadius = '3px';
    startStopButton.style.cursor = 'pointer';
    startStopButton.style.width = '100%';
    container.appendChild(startStopButton);

    // Set Loops button
    const loopButton = document.createElement('button');
    loopButton.textContent = 'Set Loops';
    loopButton.style.padding = '5px';
    loopButton.style.fontSize = '16px';
    loopButton.style.backgroundColor = '#FF9800';
    loopButton.style.color = '#fff';
    loopButton.style.border = 'none';
    loopButton.style.borderRadius = '3px';
    loopButton.style.cursor = 'pointer';
    loopButton.style.width = '100%';
    container.appendChild(loopButton);

    // Retrieve the last state from localStorage
    let isRunning = localStorage.getItem('botState') === 'running';
    let remainingLoops = parseFloat(localStorage.getItem('remainingLoops')) || 0;

    // Set initial button and loop counter state
    startStopButton.textContent = isRunning ? 'Stop' : 'Start';
    loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;

    // Start the bot if it was running
    if (isRunning) {
        startBot();
    }

    // Start/Stop button event
    startStopButton.addEventListener('click', () => {
        if (isRunning) {
            stopBot();
        } else {
            startBot();
        }
    });

    // Loop button event
    loopButton.addEventListener('click', () => {
        const loopsInput = parseInt(prompt("Enter the number of loops to run:", remainingLoops), 10);
        if (!isNaN(loopsInput) && loopsInput > 0) {
            remainingLoops = loopsInput;
            localStorage.setItem('remainingLoops', remainingLoops);
            loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;
            console.log(`Set loops to: ${remainingLoops}`);
        }
    });

    function startBot() {
        isRunning = true;
        localStorage.setItem('botState', 'running');
        startStopButton.textContent = 'Stop';
        startStopButton.style.backgroundColor = '#FF0000';
        console.log("Bot started");
        loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;
        runBotLoop();
    }

    function stopBot() {
        isRunning = false;
        localStorage.setItem('botState', 'stopped');
        startStopButton.textContent = 'Start';
        startStopButton.style.backgroundColor = '#4CAF50';
        console.log("Bot stopped");
    }

    function runBotLoop() {
        if (remainingLoops > 0) {
            console.log("Executing loop...");
            remainingLoops--;
            localStorage.setItem('remainingLoops', remainingLoops);
            loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;
            if (remainingLoops > 0) {
                setTimeout(runBotLoop, 2000); // Example delay
            } else {
                stopBot();
            }
        }
    }
})();