☰

taming.io

ngu

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.sleazyfork.org/scripts/593576/1916878/tamingio.js

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Taming.io Auto Farm
// @match        https://taming.io/*
// @grant        none
// ==UserScript==

(function() {
    'use strict';

    let autoFarm = true;
    let autoHeal = true;

    function pressKey(key) {
        document.dispatchEvent(new KeyboardEvent('keydown', { key: key }));
        setTimeout(() => {
            document.dispatchEvent(new KeyboardEvent('keyup', { key: key }));
        }, 100);
    }

    // Auto-farm resources every 500ms
    setInterval(() => {
        if (autoFarm) pressKey("e"); // Default hit/gather key
    }, 500);

    // Auto-heal when HP drops
    setInterval(() => {
        let hpElement = document.querySelector("#health-bar");
        if (hpElement && autoHeal) {
            let hp = parseInt(hpElement.style.width.replace("%", ""));
            if (hp < 30) pressKey("q"); // Consumes gapples/food
        }
    }, 1000);

    // Toggle controls
    document.addEventListener("keydown", (e) => {
        if (e.key === "f") autoFarm = !autoFarm;
        if (e.key === "h") autoHeal = !autoHeal;
    });
})();