7lym / KillerAge

// ==UserScript==
// @name        KillerAge
// @namespace   www.kingsage.ro
// @description mda
// @include     http://*.kingsage.*game.php*
// @version     1
// @grant       none
// ==/UserScript==







var coords = ["449|414",
"453|414",
"459|414",
"454|415",
"450|417",
"448|418",
"455|418",
"451|419",
"451|420",
"453|420",
"455|420",
"456|420",
"449|421",
"454|423",
"456|423",
"449|424",
"452|424",
"452|425",
"455|426",
"458|426"];
var max = coords.length - 1;
var min = 0;

function executa( buton,  ora2)
{
   buton.disabled = false;
    buton.focus();
   if (ora2 == "00" || ora2 == "01" ||ora2 == "02" ||ora2 == "03" ||ora2 == "04" ||ora2 == "05" ||ora2 == "06" ||ora2 == "07" )
      
     window.history.back();
    else
      buton.click();
}

var buton = document.getElementById("attack_protect");
if (buton !== null)
  {
   
   // window.location.reload(history.go(-1));

 var ora = document.getElementById("countup-time").innerHTML;
    var ora2 = ora.substring(ora.length - 10,ora.length-8);

var rrr = setTimeout(executa(buton, ora2), 1000);
    
 clearTimeout(rrr);   
    
   
   

    //alert(ora2);
   
  }
else 
  {
var err = document.getElementsByClassName('error');
if (err.length === 0)
{
  document.getElementsByName("kata")[0].value = "1";
  document.getElementsByName("spy")[0].value = "1";
  document.getElementsByName("bow")[0].value = "88";
  var cc = coords[Math.floor(Math.random()*(max-min+1)+min)];
  var cc1 = cc.substring(0,3);
  var cc2 = cc.substring(4,7);
  
  document.getElementById("send_x").value = cc1;
  document.getElementById("send_y").value = cc2;
  
  
  
  document.getElementsByName("attack")[0].click();
 
}
else
  {
    document.getElementsByName("kata")[0].value = "999";
  alert("invalid !!");
  }
  }