Last active
April 5, 2020 15:54
-
-
Save XianThi/4299d1550c78469d3c96ea768dfc93f0 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
var wepquality; | |
var uselimit; | |
var prompttext; | |
var limitreset; | |
var intervalId = 1; | |
var side = 0; | |
var start = false; | |
var selectedbtn; | |
var hp = 100; | |
function gethtml(callback) { | |
httpRequest = new XMLHttpRequest(); | |
httpRequest.onreadystatechange = function() { | |
if (httpRequest.readyState === 4) { // request is done | |
if (httpRequest.status === 200) { // successfully | |
callback(httpRequest.responseText); // we're calling our method | |
} | |
} | |
}; | |
httpRequest.open('GET', [location.protocol, '//', location.host].join('') + "/limitsReset.html"); | |
httpRequest.send(); | |
} | |
function main() { | |
do { | |
if (wepquality === null) { | |
break; | |
} | |
wepquality = parseInt(window.prompt("Choose Wep Quality (0,1,2,3,4,5) : \n"), 10); | |
} while (isNaN(wepquality) || wepquality > 5 || wepquality < 0); | |
do { | |
if (uselimit === null) { | |
break; | |
} | |
uselimit = confirm("Use auto limits!"); | |
} while (isNaN(uselimit)); | |
gethtml(function(result) { | |
limitreset = result.replace(/['"]+/g, ''); | |
}); | |
var btncnt = $(".fightButton").length; | |
if (btncnt == 0) { | |
alert('You cannot fight this battle'); | |
} | |
if (btncnt > 2) { | |
do { | |
if (side === null) { | |
break; | |
} | |
side = parseInt(window.prompt("Choose Side (Deffender = 0 & Attacker = 1) : \n"), 10); | |
} while (isNaN(side) || side > 1 || side < 0); | |
start = true; | |
} | |
if (btncnt > 0 && btncnt < 3) { | |
start = true; | |
} | |
hp = Math.floor($("#actualHealth").text().replace(/['"]+/g, '')); | |
} | |
async function fight() { | |
selectedbtn.click(); | |
await new Promise(r => setTimeout(r, 1000)); | |
hp = Math.floor($("#actualHealth").text().replace(/['"]+/g, '')); | |
} | |
function funcint() { | |
$("#weaponQuality").val(wepquality); | |
$('#foodQuality').val(5); | |
$('#giftQuality').val(5); | |
if (side == 0) { | |
selectedbtn = $(".fightButton")[1]; | |
} else { | |
selectedbtn = $(".fightButton")[3]; | |
} | |
console.log(selectedbtn); | |
console.log(hp); | |
if(uselimit){ | |
$("#eatButton2")[0].click(); | |
$("#useGiftButton2")[0].click(); | |
hp = Math.floor($("#actualHealth").text().replace(/['"]+/g, '')); | |
} | |
do { | |
fight(); | |
} while (hp > 0); | |
clearInterval(intervalId); | |
var timer = limitreset * 1000; | |
intervalId = setInterval(funcint, timer); | |
$(".pico-overlay").remove(); | |
$(".pico-content").remove(); | |
} | |
main(); | |
if (start) { | |
intervalId = setInterval(funcint, 2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment