ZType Bot

Bot for typing game ZType

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

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

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.

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

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!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

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

// ==UserScript==
// @name         ZType Bot
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Bot for typing game ZType
// @author       Deltaspace
// @match        https://zty.pe/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=zty.pe
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    window.addEventListener('keydown', function(e) {
        if (e.key !== ' ') {
            return;
        }
        if (!window.ig.game.currentTarget) {
            var nearestDistance = -1;
            var nearestTargetKey = null;
            Object.keys(window.ig.game.targets).forEach(function(key) {
                var potentialTargets = window.ig.game.targets[key];
                for (var i = 0; i < potentialTargets.length; i++) {
                    var distance = window.ig.game.player.distanceTo(potentialTargets[i]);
                    if (distance < nearestDistance || !nearestTargetKey) {
                        nearestDistance = distance;
                        nearestTargetKey = key;
                    }
                }
            });
            window.ig.game.bufferLetter(nearestTargetKey);
        } else {
            var currentTargetKey = window.ig.game.currentTarget.remainingWord.charAt(0);
            var letter = window.ig.game.translateUmlaut(currentTargetKey.toLowerCase());
            window.ig.game.bufferLetter(letter);
        }
    });
})();