Last active
August 29, 2015 14:07
-
-
Save user19/0f5e90112d6747c60f27 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 s = document.getElementsByClassName('status_numeric x-small')[0].innerHTML; | |
if(Number(s.substr(0,1)) >= 1) | |
battleStart(); | |
} | |
var battleAttack = function(document){ | |
var s = document.getElementsByClassName('status_numeric x-small')[0].innerHTML; | |
if(Number(s.substr(0,1)) >= 0) | |
xhrStart('POST','http://uni.priget.com/s/app/quest/enemy_battle_exec.php?guid=ON','battle=%E6%88%A6%E9%97%98&qid='+ID,{'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='+ID,null,null,battleAttack); | |
} | |
var trainingFinish = function(document){ | |
var s = document.getElementsByClassName('padding5 small')[0].innerHTML; | |
if(Number(s.substr(3,1)) >= 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