Tavern

From Kolmafia
Revision as of 20:46, 10 March 2010 by imported>Bale (wrote BEAUTIFUL code sample. Answered RFI.)
Jump to navigation Jump to search

Function Syntax

int tavern()

Attempts to complete the level 3 tavern quest, stopping when it finds the rat faucet. Returns the number of squares visited.

  • It will stop before actually turning off the faucet.
  • If the quest was already completed, it will return the number of explored squares.
  • If you run out of turns, it will return the number of explored squares.

    Code Sample

    Solve the Typical Tavern.

if(get_property("lastTavernAscension").to_int() == my_ascensions()) {
   print("You've already turned off the Rat Faucet!");
} else {
   int turns = tavern();
   if(get_property("tavernLayout").contains_text("3")) {
      print("Found the Rat Faucet in "+ turns+ " adventures.");
      if(available_amount($item[Baron von Ratsworth's monocle]) == 0
      && available_amount($item[Baron von Ratsworth's money clip]) == 0
      && available_amount($item[Baron von Ratsworth's tophat]) == 0
      && user_confirm("Do you want to fight Baron Von Ratsworth?")) {
        print("You'll have to do the next bit yourself. Sorry.", "red");
      } else {
        visit_url("rats.php?action=faucetoff");
      }
   } else print("Spent "+ turns+ " adventures searching, but did not find the rat faucet.", "red");
}

CLI Equivalent

The CLI command "tavern" functions similarly.

See Also

chamber() | entryway() | guardians() | hedgemaze()

Special

The function will turn off the faucet, and will not attempt to find and / or fight the baron.