The Hacker's Guide to the Kingdom - The Book of Boozerbear

Author: Boozerbear

Chapter Two
(Colossal Closet Exploits)

Look in your Colossal Closet. Notice that you can take one, 10 or all of an item. (assuming you have at least 10 of that item) take a look at one of these links. [mouse over the "10" link and right-click, then select "Copy Shortcut" from the menu] You can copy that link over to the "goto" box on the frameset page and you'll get something that looks like this:

http://www.kingdomofloathing.com/closet.php?action=take&howmany=10&whichitem=548 (Item #548 being the 668 Scroll)

Now to see a neat and useful trick, change the "howmany" variable in your url from "10" to "100" (make sure you have 100 of the item in your closet first. It won't take out more of the item than you actually have.) Then click the "Go" button.

Yay! you just hacked KoL! Not that this little trick nets you anything but a savings of time and clicks when getting something more than 10 or less than all of an item out of your closet, but it illustrates an important example: VARIABLES CAN BE MANIPULATED, AND OFTEN INTERESTING THINGS WILL HAPPEN WHEN THEY *ARE* MANIPULATED.

To carry this further, suppose you take that url and give it a nonsensical value for "howmany" such as "-1"? suppose further that you gave it a nonsensical value for "whichitem", like "666" (this item isn't *supposed to* exist, maybe due to Jick's superstitious nature.)

http://www.kingdomofloathing.com/closet.php?action=take&howmany=-1&whichitem=666

Well, of course it berates you now, because this particular exploit was turned in and fixed. However, it used to do an interesting thing: it would take -1 of that item, even if you did not have that item in your closet ( -1 of a particular thing certainly is less than or equal to 0 of that thing) and depositing 0 of that item into your inventory. Thus the url above would have put 0 of item #666 into your inventory, even though you didn't have it in your closet, and even though it was not an item that ever drops in the game itself!

You may ask how useful this is and the answer would be "very" *and* "not very". Very useful, because you had the item description available to you to click and examine and learn from, but "not very" because, according to the game, you had zero of the item, thus you couldn't trade, sell, transfer or even toss it back in the closet. It was stuck in your inventory until Jick eventually cleaned it out.

The very clever among you will immediately think "oh, it would be nice to get zero of *every item from 1 to X that exists* so I can make a complete list if every item!" and that's exactly what I did:

[code]
<?php

$z=(integer)$_GET['z'];

print <<<EOF
<html>
<head>
<title>KOL Closet Hack [get zero of everything!]</title>
</head>
<body>
<b>KOL Closet Hack [get zero of everything!]</b>
<br>
<br>
<br>
EOF;
if ($z < 1) { $z = 1; }

for($x=$z;$x<=$z+100;$x++){
print <<<EOF
Getting 0 of Item: #$x<br>
<iframe src="http://www.kingdomofloathing.com/closet.php?action=take&howmany=-1&whichitem=$x" width="0" height="0">
</iframe>
EOF;
}

print <<<EOF
<a href="$PHP_SELF?z=$x">next 100</a>
</body>
</html>
EOF;
?>
[/code]

[ and no, you can't have a copy of my list of KoL items. (: ]