gladiatus auto dungeon
当前为
// ==UserScript==
// @name Gladiatus Auto Dungeon click
// @description gladiatus auto dungeon
// @include https://s*.gladiatus.gameforge.*/game/index.php?mod=dungeon*
// @include https://s*.gladiatus.gameforge.*/game/index.php?mod=reports&submod=showCombatReport*t=1*
// @author ZaharX97
// @version 0.94
// @namespace https://greasyfork.org/users/104906
// ==/UserScript==
window.addEventListener("load", main);
console.log("gladiatus auto dungeon running");
function main () {
//myElem = document.getElementById("cooldown_bar_fill_dungeon");
var elemLink, dungeonLink, time, x, elemFights, elemDungeons;
elemLink = document.getElementsByClassName("cooldown_bar_link");
dungeonLink = elemLink[1].href;
time = getRemainingTime();
if(isNaN(time)){
if(window.location.href != dungeonLink){
x = getRndInteger( 0, 2899 );
setTimeout(function(){ console.log("[GAD]: going to dungeon link"); window.location.assign(dungeonLink); }, 2510 + x);
return;
}
elemFights = document.getElementsByTagName("area");
//console.log("fights length= " + elemFights.length );
x = getRndInteger( 0, 3281 );
if(elemFights.length)
setTimeout( function(){ clickNextFight(elemFights[elemFights.length - 1]); }, x);
else{
elemDungeons = document.getElementsByClassName("button1");
for(var i = elemDungeons.length - 1 ; i >= 0 ; i--)
if( elemDungeons[i].type == "submit" ){
setTimeout( function(){ clickNextFight(elemDungeons[i]); }, x);
return;
}
}
}
else setTimeout( function(){ console.log( "[GAD]: " + time + " passed, reloading" ); window.location.reload(); }, time );
}
function getRemainingTime(){
var elemTime, timeText, x, time;
elemTime = document.getElementById("cooldown_bar_text_dungeon");
timeText = elemTime.innerText;
x = getRndInteger( 1, 4 );
time = timeText[0]*3600 + timeText[2]*10*60 + timeText[3]*60 + timeText[5]*10 + timeText[6]*1 + x*1;
//console.log( timeText[0]*3600 + " " + timeText[2]*10*60 + " " + timeText[3]*60 + " " + timeText[5]*10 + " " + timeText[6] + " " + x + " timp= " + time);
time = time*1000;
console.log( "[GAD]: reloading after " + time + "ms" );
return time;
}
function clickNextFight(elemFight){
elemFight.click();
}
function getRndInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1) ) + min;
}