Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Improbable Quest Tracker
// ==UserScript==
// @name Improbable Quest Tracker
// @namespace http://www.shadedraco.com/improbablequests
// @include http://improbableisland.com/*
// @include http://www.improbableisland.com/*
// ==/UserScript==
var Content = document.evaluate("//td[@class='content']", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
if (Content) {
Content = Content.innerHTML;
var Defeated = Content.match(/<span class="colDkRed">You have defeated the (.*)!!!\.<\/span><br>/);
var FoundItem1 = Content.match(/After a bit of digging, you find the (.*)! It did take a little longer than you thought, however\.<br>/);
var FoundItem2 = Content.match(/He's giving you the (.*) you needed for Dan! How lucky you are!<br>/);
var FoundItem3 = Content.match(/It's the (.*)! You think how incredibly lucky you are as you pick it up and make your way back to the path\.<br>/);
var NewStep = Content.match(/(?:You need to seek out and kill the |So first, you'll need to go and kill the )<b>(.*)<\/b>(?:, which you'll find in the jungle immediately around |, which, from what we can gather, is hanging out in the jungles around )<b>(.*)<\/b>\./);
var NewStepItem = Content.match(/You need to go and find the <b>(.*)<\/b>, (?:in the jungle around|down in the jungles of) <b>(.*)<\/b>\./);
var LastStep = Content.match(/'It's time I told you the name of this foe\. It is known as the <b>(.*)<\/b>, and is very powerful\. This foe is immortal, so you cannot defeat him\. However, there is another way to rid the world of its evil\. Once you beat it down to unconsciousness, you must seal it into another dimension\. This will rid the world of it without killing it\.'<br>\n?<br>\n?\n?'You can find this last one in the jungles around <b>(.*)<\/b>\./m);
var Finished = Content.match(/<span class="colDkRed"><b>You have completed this quest!<\/b><\/span>/);
if (Defeated) {
GM_setValue('QuestName', Defeated[1]);
GM_setValue('QuestComplete', true);
} else if (FoundItem1) {
GM_setValue('QuestName', FoundItem1[1]);
GM_setValue('QuestComplete', true);
} else if (FoundItem2) {
GM_setValue('QuestName', FoundItem2[1]);
GM_setValue('QuestComplete', true);
} else if (FoundItem3) {
GM_setValue('QuestName', FoundItem3[1]);
GM_setValue('QuestComplete', true);
} else if (NewStep) {
GM_setValue('QuestName', NewStep[1]);
GM_setValue('QuestLocation', NewStep[2]);
GM_setValue('QuestComplete', false);
GM_setValue('QuestStep', (GM_getValue('QuestStep')||0) + 1);
GM_setValue('QuestLast', false);
} else if (NewStepItem) {
GM_setValue('QuestName', NewStepItem[1]);
GM_setValue('QuestLocation', NewStepItem[2]);
GM_setValue('QuestComplete', false);
GM_setValue('QuestStep', (GM_getValue('QuestStep')||0) + 1);
GM_setValue('QuestLast', false);
} else if (LastStep) {
GM_setValue('QuestName', LastStep[1]);
GM_setValue('QuestLocation', LastStep[2]);
GM_setValue('QuestComplete', false);
GM_setValue('QuestStep', (GM_getValue('QuestStep')||0) + 1);
GM_setValue('QuestLast', true);
} else if (Finished) {
GM_deleteValue('QuestName');
GM_deleteValue('QuestLocation');
GM_deleteValue('QuestComplete');
GM_deleteValue('QuestStep');
GM_deleteValue('QuestLast');
}
}
var CharInfo = document.evaluate("//table[@class='charinfo']", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
if (CharInfo) {
if (GM_getValue('QuestName')) {
CharInfo.innerHTML += "<tr><td class='charhead' colspan='2'><b>Quest</b><td></tr>";
CharInfo.innerHTML += "<tr><td class='charinfo' colspan='2'><span class='colLtYellow'>"+(GM_getValue('QuestLast')?"<b>":"")+GM_getValue('QuestName')+(GM_getValue('QuestLast')?"</b>":"")+"</span><td></tr>";
CharInfo.innerHTML += "<tr><td class='charinfo'><b><span class='colLtWhite'>Location</span></b></td><td class='charinfo'><span class='colLtYellow'>"+GM_getValue('QuestLocation')+"</span><td></tr>";
CharInfo.innerHTML += "<tr><td class='charinfo'><b><span class='colLtWhite'>Step</span></b></td><td class='charinfo'><span class='colLtYellow'>"+GM_getValue('QuestStep')+"</span><td></tr>";
if (GM_getValue('QuestComplete')) {
CharInfo.innerHTML += "<tr><td class='charinfo'><b><span class='colLtWhite'>Status</span></b></td><td class='charinfo'><span class='colLtGreen'>Complete</span><td></tr>";
} else {
CharInfo.innerHTML += "<tr><td class='charinfo'><b><span class='colLtWhite'>Status</span></b></td><td class='charinfo'><span class='colLtYellow'>In Progress</span><td></tr>";
}
} else {
CharInfo.innerHTML += "<tr><td class='charhead' colspan='2'><b>Quest</b><td></tr>";
CharInfo.innerHTML += "<tr><td class='charinfo' colspan='2'><span class='colLtWhite'>None</span><td></tr>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.