ismail farm

auto farm script for tribalwars.

当前为 2023-01-30 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name ismail farm
// @author ismail.yankayis
// @version 1.0.0
// @grant Public
// @description auto farm script for tribalwars.
// @include        http*://*.tribalwars.net/*screen=am_farm*
// @include        https*://*.klanlar.org/*screen=am_farm*
// @namespace https://greasyfork.org/users/1019070
// @license MIT
// ==/UserScript==

var botProtect = $('body').data('bot-protect');
if (document.URL.indexOf('screen=am_farm') == -1)
    console.log('Você deve executar o script no assistente de farm!');
else if (botProtect !== undefined) {
    alert('Alerta Captcha!');
}
else {
    var count = 1,
        menu = $('#am_widget_Farm a.farm_icon_a'),
        attackInterval = 500,
        minhaVar = "",
        changeVillage = true,
        changeVillageInterval = 300000,
        refreshPage = false,
        refreshPageInterval = 25000,
        lootAssistantPageSize = 100,
        boxCaptcha = $("#bot_check");

    var randomTime = function (superior, inferior) {
        var numPosibilidades = superior - inferior,
            aleat = Math.random() * numPosibilidades;

        return Math.round(parseInt(inferior) + aleat);
    };

    if (attackInterval === "random") {
        attackInterval = randomTime(5000, 10000);
    }
    if (refreshPageInterval === "random") {
        refreshPageInterval = randomTime(700000, 800000);
    }

    $('img').each(function () {
        var tempStr = $(this).attr('src');
        if (tempStr.indexOf('attack') != -1)
            $(this).addClass('tooltip');
    });

    if (refreshPage === true) {
        setInterval(function () {
            window.location.reload();
        }, refreshPageInterval);
    }

    if (changeVillageInterval !== false) {
        if (changeVillageInterval === true)
            if ($('#light').text() >= 1)
                changeVillageInterval = randomTime(100000, 150000);
            else
                changeVillageInterval = randomTime(3000, 5000);
        else
            changeVillageInterval = parseInt(changeVillageInterval) + parseInt(randomTime(500, 1000));
    }
}

for (i = 0; i < lootAssistantPageSize; i++) {
    // wall level control
    //if(parseInt($('#plunder_list tr:not(:first)').eq(i + 1).find('td').eq(6).text()) == 0 || isNaN($('#plunder_list tr:not(:first)').eq(i + 1).find('td').eq(6).text()) == true){
    $(menu).eq(i).each(function () {
        var intervalOfNexAttack = attackInterval * count;
        setTimeout(function (minhaVar) {
            if ($('#light').text() >= 5) {
                $(minhaVar).click();
            }
        }, intervalOfNexAttack, this);
        ++count;
    });
    // }
}


if (changeVillage === true) {
    var altVillage = setInterval(function () {
        $('.arrowRight, .groupRight').click();

        clearInterval(altVillage);
    }, changeVillageInterval);
}


var checkCaptcha = setInterval(function () {
    if (boxCaptcha.length) {
        alert('Captcha found!');
        clearInterval(checkCaptcha);
        clearInterval(altVillage);
    }
}, 100);