Set Arrival Time Experimental

Set the desired arrival time in Tribal Wars and the script will automatically send the attack

目前為 2017-11-21 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name Set Arrival Time Experimental
// @description Set the desired arrival time in Tribal Wars and the script will automatically send the attack
// @author FunnyPocketBook
// @version 1.0
// @date 21-11-2017
// @namespace FunnyPocketBook
// @include https://uk*.tribalwars.co.uk/game.php?village=*&screen=place&try=confirm
// @include https://ch*.staemme.ch/game.php?village=*&screen=place&try=confirm
// @include https://frs*.guerretribale.fr/game.php?village=*&screen=place&try=confirm
// ==/UserScript==

// CHANGE THESE NUMBERS TO GET THE CORRECT ARRIVAL TIME - higher number means more delay. Change "windows.delayTime" before "intervalTime" and only change "intervalTime" if you can't get it quite correct with only "delayTime"
window.delayTime = 2; // Set delay in ms
window.intervalTime = 1; // Set interval in ms

// DON'T MESS WITH THIS IF YOU DON'T KNOW WHAT YOU ARE DOING
window.showArrTimeTr = document.createElement("tr"); // Create button called btn as a link because any button causes the attack to launch
window.showArrTimeTd = document.createElement("td");
var pEle = document.getElementById("troop_confirm_go"); // Button comes after this element
var btn = document.createElement("a"); // Create button called btn as a link because any button causes the attack to launch
btn.setAttribute("id", "arrTime"); // Set ID of btn
btn.setAttribute("style", "cursor:pointer;"); // Set cursor to pointer
pEle.parentNode.insertBefore(btn, pEle.nextElementSibling); // Place btn after pEle
var t = document.createTextNode("Set arrival time"); // btn has this text
btn.appendChild(t); // Append text to btn

btn.onclick = function() {
	"use strict";
	var time = document.getElementsByClassName("relative_time")[0].textContent.slice(-8);
	var lalau = document.getElementById("date_arrival");
	window.input = prompt("Please enter desired arrival time", time);
	window.ms = parseInt(prompt("Please enter approximate milliseconds", "000"));
	window.showArrTimeTr.appendChild(window.showArrTimeTd);
	lalau.parentNode.parentNode.insertBefore(window.showArrTimeTr, lalau.parentNode[1]);
	window.showArrTimeTd.innerHTML = "You set the arrival time to: ~" + window.input + ":" + window.ms;
	window.showArrTimeTd.setAttribute("colspan", "2");
	window.showArrTimeTd.setAttribute("id", "showArrTime");
};

setInterval(function captcha() {
    if(document.getElementsByClassName("rc-anchor-center-item").length > 0) {
		document.getElementsByClassName("rc-anchor-center-item")[0].click();
	} else{}
}, 10);

setInterval(function retime() {
	"use strict";
	var arrival = document.getElementsByClassName("relative_time")[0].textContent;
	if(arrival.slice(-8) === window.input)
		{
			setTimeout(function() {document.getElementById("troop_confirm_go").click();}, window.ms + window.delayTime);
		} else {}
}, window.intervalTime);