// Tard's KoL Scripts // Copyright (c) 2006, Byung Kim // New releases Copyright (c) 2009-2013 by Hellion // Released under the GPL license // http://www.gnu.org/copyleft/gpl.html // autoUpdater used under Creative Commons License 3.0. // // ==UserScript== // @name Tard's Kol Scripts - Choice Adventure Rewards // @version 3.15 // @namespace http://kol.dashida.com // @author Tard // @author Hellion // @author Aelsa // @author Buzzy (autoupdate function; see http://userscripts.org/scripts/show/52251 ) // @include *kingdomofloathing.com/choice.php* // @include *kingdomofloathing.com/basement.php // @include *kingdomofloathing.com/friars.php* // @include *kingdomofloathing.com/bigisland.php* // @include *kingdomofloathing.com/postwarisland.php* // @include *kingdomofloathing.com/palinshelves.php // @include *kingdomofloathing.com/clan_viplounge.php* // @include *kingdomofloathing.com/clan_rumpus.php* // @include *kingdomofloathing.com/campground.php* // @include *kingdomofloathing.com/main.php // @include *127.0.0.1:*/clan_viplounge.php* // @include *127.0.0.1:*/clan_rumpus.php* // @include *127.0.0.1:*/main.php // @include *127.0.0.1:*/choice.php* // @include *127.0.0.1:*/basement.php // @include *127.0.0.1:*/friars.php* // @include *127.0.0.1:*/bigisland.php* // @include *127.0.0.1:*/postwarisland.php* // @include *127.0.0.1:*/palinshelves.php // @include *127.0.0.1:*/campground.php* // @include *127.0.0.1:*/main.php // @include *localhost:*/clan_viplounge.php* // @include *localhost:*/clan_rumpus.php* // @include *localhost:*/main.php // @include *localhost:*/choice.php* // @include *localhost:*/basement.php // @include *localhost:*/friars.php* // @include *localhost:*/bigisland.php* // @include *localhost:*/postwarisland.php* // @include *localhost:*/palinshelves.php // @include *localhost:*/campground.php* // @include *localhost:*/main.php // @grant GM_log // @grant GM_getValue // @grant GM_setValue // @grant GM_xmlhttpRequest // @grant GM_registerMenuCommand // @history 3.15 new Hidden City // @history 3.14 Dreadsylvania corrections, fix to updater // @history 3.13 updates for Dreadsylvania // @history 3.12 updates for AT nemesis, Vamping Out, more hobopolis stuff, parts of Violet fog, sea stuff // @history 3.11 updates for new giant castle, suspicious guy's psych jar // @history 3.10 refactor the actual addition of spoiler text to eliminate code duplication; add campground spoilers. // @history 3.09 updated for new level-9 quest stuff, bugbears/zombies, skeleton usage, etc. // @history 3.08 updated include list for new choice URL standard, added clan VIP swimming pool // @history 3.07 added Kloop, new spooky temple // @history 3.06 added Haunted Sorority house // @history 3.05 added safety maps // @history 3.04 added autoupdater // @history 3.03 added all choices through new knob // @history 3.02 added all antique maps through August 2010, and new Spooky Forest choice. // @history 3.01 added Billiards room SR, new > sign choice, Reflection of a map, nemesis map choice. // @history 3.00 major rewrite of detection logic. // @description Tard's Kol Scripts - Choice Adventure Rewards kol kingdomofloathing kingdomofloathing.com kingdom of loathing // @downloadURL https://update.greasyfork.icu/scripts/4091/Tard%27s%20Kol%20Scripts%20-%20Choice%20Adventure%20Rewards.user.js // @updateURL https://update.greasyfork.icu/scripts/4091/Tard%27s%20Kol%20Scripts%20-%20Choice%20Adventure%20Rewards.meta.js // ==/UserScript== var inputs = document.getElementsByTagName('input'); var adventureChoiceNumber = 0, SpoilerSet, imageName; var n = 0, sp_list = ""; var debug = false; if (window.location.pathname == "/main.php") { // just logged in, do certain stuff once. autoUpdate(68727,"3.15"); } if (window.name == "mainpane") { if (inputs.length === 0) {return;} //not in a place where we need to do anything. //get the adventure choice number. Could probably do this without the for-loop. for (n=0; n < inputs.length; n++) { if (inputs[n].name === "whichchoice") { adventureChoiceNumber = inputs[n].value; break; } } SpoilerSet = GetSpoilersForAdvNumber(adventureChoiceNumber); if (SpoilerSet === undefined || SpoilerSet === null) { //find the adventure's image. (in some cases this will not be the first image, //e.g. when you lose the Stone Wool effect when starting a Hidden Temple choice.) var imageName = ""; var images = document.getElementsByTagName('img'); for (var foo = 0; foo < images.length; foo++) { if (images[foo].src.indexOf('adventureimages') != -1) { imageName = images[foo].src.split('/')[4]; break; } } if (imageName != "") SpoilerSet = GetSpoilersForImageName(adventureChoiceNumber, imageName); if (SpoilerSet === undefined || SpoilerSet === null) { var bodyText = document.getElementsByTagName('body')[0].innerHTML; //textContent; var URL = window.location.pathname; SpoilerSet = GetSpoilersForBodyText(adventureChoiceNumber, URL, imageName, bodyText); } } if (SpoilerSet !== undefined && SpoilerSet !== null) { DisplaySpoilers(inputs, SpoilerSet); } else { // There's always something. Geez. SpoilerSet = CheckButtonText(inputs, adventureChoiceNumber); if (SpoilerSet !== undefined && SpoilerSet !== null) { DisplaySpoilersByButtonText(inputs, SpoilerSet); } else { if (debug) ShowButtonIDs(inputs); } } } return; function ShowButtonIDs(inputs) { var cval = -1, n; for (n=0; n 0)) { // modify button! inputs[n].value += " -- buttonID = " + cval + "."; } } } function CheckButtonText(inputs, cNum) { var advOptions = { "594":{"check out the mini-fridge":"enable glasses or pill bottle","turn on the tv":"enable glasses or comb","take a nap":"enable pill bottle or comb","pick up the glasses":"\nafter fridge and tv: acquire glasses","pick up the comb":"\nafter nap and tv: acquire unbreakable comb","open the pill bottle":"\nafter fridge and nap: acquire lost pill bottle","walk out and back in":"keep trying","walk into the room":"get started"}, "524":{"table of contents":"display chapter list","skip to your reward":"acquire skullheads's screw","quit reading":"leave"}, "546":{ "visit vlad's boutique":"proceed to vlad (acquire an effect (+weapon damage / +spell damage / +DR)", "visit isabella's":"proceed to isabella (gain stats or meat)", "visit the masquerade":"proceed to masquerade (acquire an item)", "you know what? never mind.":"leave", "visit the castle":"\ntoward +weapon dmg (if you have bum & medallion) / mesmerize (if you have bum)", "stalk the night":"\ntoward +spell damage (if you have bum & mesmerize) / bum (Go here first)", "skulk in the cemetery":"\ntoward medallion (if you have bum) / +DR (if you have bum + mesmerize)", "come up to the lab":"\nto lab (acquire +weapon dmg effect if you have bum & medallion)", "to the boudoir!":"to boudoir (acquire mesmerize if you have bum)", "wolf out":"\nwith hamethyst medallion: effect: there wolf (30 turns: +100% weapon damage)\nwithout: nothing", "feed the undead hussies":"\nwith a bum enthralled: learn mesmerize\nwithout: nothing", "go for the bum":"enthrall a bum", "follow the girl":"\nwith hypnosis: effect: bat attitude (30 turns) (+100% spell damage)\nwithout hypnosis: nothing", "check the mausoleum":"\nwith enthralled bum:acquire hamethyst medallion\nwithout: nothing", "rob the grave":"with hypnosis: effect: mistified (30 turns) (dr +30)\nwithout: nothing", "see where the night takes you":"get it started", "head back to vlad's":"back to starting point", "drain her dry":"+(4x mainstat) muscle (max 500)", "redirect your desire":"toward mus or mox", "tell her how you feel":"toward mys or mus or meat", "go party":"toward mus or mox", "go to the bar":"toward mox", "enjoy your vampness":"toward mys or meat", "brood in solitude":"toward mus or mox", "go for the jugular":"+(4x mainstat) mus (max 500)", "go for first base":"toward mox", "follow her, y'all":"toward mox", "drink the realblud":"+(4x mainstat) mox (max 500)", "listen to the cheeldren of the night":"+(4x mainstat) mys (max 500)", "search for human prey":"+111 meat, -1 to 2 HP", "find other prey":"+(4x mainstat) mys (max 500)", "go brood in solitude":"toward mus or mox", "take a walk":"toward mys or meat" }, "536":{ "down the hatch!":"To the Tavern", "have a drink":"to bar (toward pills/harness)", "check out the coat check":"to coat check (toward effect/EMU harness)", "go to your campsite, apparently":"to campsite (toward elven items/EMU helmet)", "go back to the glowy tavern":"back to start (Tavern)", "try that one door":"to Sleeping quarters (distention pill/dog hair pill/back to start)", "try the other door, man":"to Warehouse (HP regen effect/EMU harness/back to start)", "follow captain smirk":"distention pill", "follow the green girl":"synthetic dog hair pill", "take the glowing door":"back to start (tavern)", "cross to the cross":"effect: heal thy nanoself (10 turns: regen 10-20HP/turn)", "be the duke of the hazard":"to lab (EMU harness)", "down the hatch":"back to start (tavern)", "enter the transporter":"E.M.U. harness", "go back the way you came":"back to warehouse", "exit, stage left":"to warehouse (effect/EMU harness/start)", "stage right, even":"to hallway (hardtack&squeeze/EMU helmet)", "back to the tavern":"back to start (tavern)", "try the port door":"to closet (2 hardtack and 2 squeeze)", "try the starboard door":"to lab (EMU helmet)", "try the aft door":"back to start (tavern)", "go through the circle":"2 elven hardtack, 2 elven squeeze)", "step through the transporter":"EMU helmet", "take the silver door":"to sleeping quarters (distention/dog hair/back to start)", "take the purple door":"to hallway (toward EMU helmet/hardtack&squeeze)" } } if (advOptions[cNum] !== undefined) return advOptions[cNum]; else return null; } function DisplaySpoilersByButtonText(inputs, SpoilerSet) { var btn, bval, i, n; for (n = 0; n < inputs.length; n++) { btn = inputs[n]; if (btn.type === "submit") { bval = btn.value.toLowerCase(); i = bval.indexOf("["); if (i != -1) bval = bval.substring(0, i -1); if (debug && SpoilerSet[bval] === undefined) SpoilerSet[bval] = "(button #" + btn.value + ")"; btn.value += " -- " + SpoilerSet[bval]; } } } //all choice.php buttons have an "option=" setting in their form definition; //usually a number from 1-6, which corresponds to our array of spoiler text strings. //this allows us to handle choices where some buttons go missing depending on your game circumstance. //Buff areas, on the other hand, have no such values and must simply be updated in order. function DisplaySpoilers(inputs, SpoilerSet) { var cval = -1, n; var displayText = ""; for (n=0; n 0)) { // modify button! if (debug && SpoilerSet[cval] === undefined) displayText = "(button #" + cval + ")"; else if (SpoilerSet[cval] !== "") displayText = " -- " + SpoilerSet[cval]; inputs[n].value += displayText + ""; } } if (cval === -1) { // got here without setting a button value? not a Choice.php button set. cval = 1; // just run through all submit text and put in our info in sequence. for (n=0; n