GM fix for autoturning evil plushy items
Posted: Wed Dec 08, 2010 10:35 pm
Modified two functions to run on elephants. I don't know about compatibility with different versions, but these /should/ work if you just replace what's the there. If you want it to work for a plushy other than the elephants, replace 1428 with the item number of the plushy you want.
function stepToNextCombat() {
var searchy = find('.//td[contains(.,"Patrol again")]');
if (searchy != null) {
var linkk = find('.//a',searchy);
var strat = document.getElementById('Strat');
if(strat[strat.SelectedIndex])
GM_setValue('selectedStrat',strat[strat.SelectedIndex].value);
window.location = linkk;}
searchy = find('.//td[contains(.,"Back to inventory")]');
if (searchy != null)
{
GM_xmlhttpRequest({
method: "GET",
url: "http://www.twilightheroes.com/use.php",
headers: {"User-Agent": navigator.userAgent },
onload: function(r) {
var rsp = r.responseText;
var pat = /(use\.php\?which=1428&pwd=.{40,40})/; //replace 1428 with item number if not elephant
if (!r.responseXML)
r.responseXML = new DOMParser().parseFromString(rsp,"text/xml");
var cfv = pat(rsp);
window.location = cfv[1];}});
}
GM_setValue('roundNumber',-1);}
function endOfTurn() {
var searchy = find('.//td[contains(.,"Patrol again")]');
if (searchy != null) {
var linkk = find('.//a',searchy);
if (linkk != null) {
return true;}}
searchy = find('.//td[contains(.,"Back to inventory")]');
if(searchy != null)
{
return true;
}
return false;}
function stepToNextCombat() {
var searchy = find('.//td[contains(.,"Patrol again")]');
if (searchy != null) {
var linkk = find('.//a',searchy);
var strat = document.getElementById('Strat');
if(strat[strat.SelectedIndex])
GM_setValue('selectedStrat',strat[strat.SelectedIndex].value);
window.location = linkk;}
searchy = find('.//td[contains(.,"Back to inventory")]');
if (searchy != null)
{
GM_xmlhttpRequest({
method: "GET",
url: "http://www.twilightheroes.com/use.php",
headers: {"User-Agent": navigator.userAgent },
onload: function(r) {
var rsp = r.responseText;
var pat = /(use\.php\?which=1428&pwd=.{40,40})/; //replace 1428 with item number if not elephant
if (!r.responseXML)
r.responseXML = new DOMParser().parseFromString(rsp,"text/xml");
var cfv = pat(rsp);
window.location = cfv[1];}});
}
GM_setValue('roundNumber',-1);}
function endOfTurn() {
var searchy = find('.//td[contains(.,"Patrol again")]');
if (searchy != null) {
var linkk = find('.//a',searchy);
if (linkk != null) {
return true;}}
searchy = find('.//td[contains(.,"Back to inventory")]');
if(searchy != null)
{
return true;
}
return false;}