Created
October 21, 2014 06:33
-
-
Save user19/a9d8bcb465af612f4789 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function xhrStart(method,url,data,requestHeader,callback){ | |
var xhr = new XMLHttpRequest(); | |
xhr.onload = function(){ | |
callback(xhr.response); | |
} | |
xhr.open(method,url); | |
if(requestHeader !== null) | |
for(key in requestHeader) | |
xhr.setRequestHeader(key,requestHeader[key]); | |
xhr.responseType = "document"; | |
xhr.send(data); | |
} | |
var battleFinish = function(document){ | |
var n = Number(document.getElementsByClassName('status_numeric x-small')[0].innerHTML.slice(0,-3)); | |
if(n >= 1) | |
battleStart(); | |
} | |
var battleAttack = function(document){ | |
var n = Number(document.getElementsByClassName('status_numeric x-small')[0].innerHTML.slice(0,-3)); | |
if(n >= 0) | |
xhrStart('POST','http://uni.priget.com/s/app/quest/enemy_battle_exec.php?guid=ON','battle=%E6%88%A6%E9%97%98&qid=90023',{'Content-Type':'application/x-www-form-urlencoded'},battleFinish); | |
} | |
var battleStart = function(){ | |
xhrStart('GET','http://uni.priget.com/s/app/quest/enemy_encount_exec.php?guid=ON&qid=90023',null,null,battleAttack); | |
} | |
var trainingFinish = function(document){ | |
var n = Number(document.getElementsByClassName('padding5 small')[0].innerHTML.slice(3,-3)); | |
if(n >= 1) | |
trainingStart(); | |
} | |
var trainingStart = function(){ | |
xhrStart('POST','http://uni.priget.com/s/app/training/training_solo_exec.php?GUID=ON',null,{'Content-Type':'application/x-www-form-urlencoded'},trainingFinish); | |
} | |
battleStart(); | |
trainingStart(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment