// Unfun game player
// aka Petpet Battles AP
//
//
// ==UserScript==
// @name Petpet Battles Autoplayer
// @namespace neopets.com
// @description Does a not-completely terrible (but not great) job of playing petpet battles. This game is very much random, but this script can get you enough wins to level up and get a trophy
// @include http://www.neopets.com/games/petpet_battle/*
// ==/UserScript==
var useshield = Math.random()<.5; //random true/false so that you don't use shield every time you have it (slightly better odds)
var x = (Math.random() * 1000); //change the page delay here; 1000 = 1 second
function delay() {
//can't get points after 30 battles
if (document.body.innerHTML.indexOf("You have played more then 30 games today.") != -1)
{alert("Played more than 30 games")}
var thisInput, thisNumber, thisButton;
//if you have shield, maybe use it
if((document.body.innerHTML.indexOf("Shield Left:") != -1) && useshield){
thisNumber = Math.random();
thisButton = 'Shield'
if (document.body.innerHTML.indexOf("Click to play a new game.") !=-1) {thisButton = 'New Game'}
thisInput = document.evaluate('//input[@value="'+thisButton+'"]',document,null,null,null).iterateNext();
if (thisInput && document.body.innerHTML.indexOf("You have played more then 30 games today.") ==-1)
{thisInput.click();}
}
//headshot best shot?? Idk
else{
thisButton = 'Head Shot';
useshield = true;
if (document.body.innerHTML.indexOf("Click to play a new game.") !=-1) {thisButton = 'New Game'}
thisInput = document.evaluate('//input[@value="'+thisButton+'"]',document,null,null,null).iterateNext();
if (thisInput && document.body.innerHTML.indexOf("You have played more then 30 games today.") ==-1)
{thisInput.click();}
}
}window.setTimeout(delay, x);