Bug - Fixed tavern() aborts with "Unable to find faucet" even though it does

picklish

Member
If I run the tavern() ash function, Mafia will adventure until it finds the faucet and then abort with "Unable to find faucet." This abort is not even caught by a try{} block. As far as I can tell, it aborts after it has successfully found the faucet.
 

picklish

Member
I'll post one the next time I go through the tavern in a day or so. I want to look a little more closely at exactly which calls are being made.
 

picklish

Member
Here's my session log, but it's not that interesting. Essentially, I just did this.

Code:
> ash tavern()
(Lots of adventuring, see below log)
[color=red]Unable to find faucet.[/color]
Returned: -1

> ash tavern()

Searching for faucet...
You acquire Typical Tavern swill (3)

[68] Tavern Cellar
Encounter: The Tavern Cellar
Baron found in row 5, column 3
Faucet found in row 4, column 1
Returned: 16

Here's the full log:

Code:
cast 1 Leash of Linguini
You acquire an effect: Leash of Linguini (duration: 10 Adventures)

tavern.php?place=barkeep

[45] Tavern Cellar
Encounter: The Tavern Cellar

[45] Tavern Cellar (row 1, col 4)
Encounter: drunken rat
Round 0: picklish loses initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 22 damage.
Round 2: picklish wins the fight!
You gain 13 Meat
You acquire an item: rat whisker
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 2 Muscleboundness
You gain 2 Enchantedness
You gain 8 Cheek

cast 1 Advanced Cocktailcrafting
You acquire an item: coconut shell

cast 1 Summon Party Favor
You acquire an item: divine noisemaker

cast 1 Summon Tasteful Items
You acquire an item: foam dart
You acquire an item: personalized coffee mug
You acquire an item: stick-on eyebrow piercing
You acquire an item: Loudmouth Larry Lamprey
You acquire an item: personal massager

cast 1 Summon Alice's Army Cards
You acquire an item: Pack of Alice's Army Cards
You acquire an item: Ye Wizard's Shack snack voucher

cast 1 Pastamastery
You acquire an item: dry noodles

cast 1 Advanced Saucecrafting
You acquire an item: scrumptious reagent

cast 1 Leash of Linguini
You acquire an effect: Leash of Linguini (duration: 10 Adventures)

cast 1 Empathy of the Newt
You acquire an effect: Empathy (duration: 5 Adventures)

[46] Tavern Cellar (row 1, col 3)
Encounter: drunken rat king
Round 0: picklish loses initiative!
You lose 15 hit points
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat king takes 29 damage.
You lose 11 hit points
Round 2: picklish attacks!
Round 3: drunken rat king takes 25 damage.
Round 3: picklish wins the fight!
You gain 55 Meat
You acquire an item: rat whisker
You acquire an item: rat whisker
You acquire an item: rat appendix
You acquire an item: tangle of rat tails
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 5 Muscleboundness
You gain 6 Enchantedness
You gain a Mysticality point!
You gain 10 Sarcasm
You gain a Moxie point!

cast 1 Tongue of the Walrus
You gain 36 hit points

[47] Tavern Cellar (row 1, col 2)
Encounter: Staring Down the Barrel
choice.php?whichchoice=513&option=1&pwd
You acquire ice-cold Willer (4)

[48] Tavern Cellar (row 1, col 1)
Encounter: Those Who Came Before You
choice.php?whichchoice=510&option=1&pwd
You acquire an item: moxie weed
You acquire hair spray (3)
You acquire an item: shiny ring

autosell: 1 moxie weed
You gain 100 Meat

[49] Tavern Cellar (row 2, col 1)
Encounter: 1984 Had Nothing on This Cellar
choice.php?whichchoice=514&option=1&pwd
You acquire rat whisker (4)

cast 1 Disco Aerobics
You acquire an effect: Disco State of Mind (duration: 5 Adventures)

cast 1 Moxie of the Mariachi
You acquire an effect: Mariachi Mood (duration: 5 Adventures)

cast 1 The Magical Mojomuscular Melody
You acquire an effect: The Magical Mojomuscular Melody (duration: 10 Adventures)

cast 1 The Moxious Madrigal
You acquire an effect: The Moxious Madrigal (duration: 10 Adventures)

[50] Tavern Cellar (row 3, col 1)
Encounter: Crate Expectations
choice.php?whichchoice=496&option=1&pwd
You acquire bottle of rum (2)
You acquire an item: bottle of vodka

[51] Tavern Cellar (row 4, col 1)
Encounter: Of Course!
choice.php?whichchoice=509&option=1&pwd

[52] Tavern Cellar (row 5, col 1)
Encounter: Crate Expectations
choice.php?whichchoice=496&option=1&pwd
You acquire bottle of whiskey (2)
You acquire an item: bottle of rum

[53] Tavern Cellar (row 5, col 2)
Encounter: Crate Expectations
choice.php?whichchoice=496&option=1&pwd
You acquire an item: bottle of whiskey
You acquire an item: boxed wine
You acquire an item: bottle of vodka

[54] Tavern Cellar (row 5, col 3)
Encounter: If it's Tiny, is it Still a Mansion?
choice.php?whichchoice=511&option=2&pwd

[54] Tavern Cellar (row 5, col 4)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 22 damage.
Round 2: picklish wins the fight!
You gain 18 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 5 Fortitude
You gain a Muscle point!
You gain 1 Wizardliness
You gain 5 Chutzpah

cast 1 Disco Aerobics
You acquire an effect: Disco State of Mind (duration: 5 Adventures)

cast 1 Moxie of the Mariachi
You acquire an effect: Mariachi Mood (duration: 5 Adventures)

[55] Tavern Cellar (row 5, col 5)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 27 damage.
Round 2: picklish wins the fight!
You gain 16 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 4 Muscleboundness
You gain 2 Magicalness
You gain 6 Chutzpah

[56] Tavern Cellar (row 4, col 2)
Encounter: Crate Expectations
choice.php?whichchoice=496&option=1&pwd
You acquire an item: boxed wine
You acquire an item: bottle of vodka
You acquire an item: bottle of gin

[57] Tavern Cellar (row 3, col 2)
Encounter: drunken rat
Round 0: picklish loses initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 18 damage.
Round 2: picklish wins the fight!
You gain 16 Meat
You acquire an item: rat whisker
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 2 Muscleboundness
You gain 4 Wizardliness
You gain 5 Chutzpah

[58] Tavern Cellar (row 2, col 2)
Encounter: Staring Down the Barrel
choice.php?whichchoice=513&option=1&pwd
You acquire ice-cold Willer (3)

[59] Tavern Cellar (row 2, col 3)
Encounter: drunken rat
Round 0: picklish loses initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 27 damage.
Round 2: picklish wins the fight!
Your familiar gains a pound: Smuster, the 4 lb. Frumious Bandersnatch
You gain 18 Meat
You acquire an item: rat whisker
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 4 Strengthliness
You gain 5 Mysteriousness
You gain 3 Chutzpah

cast 1 Disco Aerobics
You acquire an effect: Disco State of Mind (duration: 5 Adventures)

cast 1 Moxie of the Mariachi
You acquire an effect: Mariachi Mood (duration: 5 Adventures)

cast 1 The Magical Mojomuscular Melody
You acquire an effect: The Magical Mojomuscular Melody (duration: 10 Adventures)

cast 1 The Moxious Madrigal
You acquire an effect: The Moxious Madrigal (duration: 10 Adventures)

[60] Tavern Cellar (row 3, col 3)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 17 damage.
Round 2: picklish attacks!
Round 3: drunken rat takes 18 damage.
Round 3: picklish wins the fight!
You gain 13 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 2 Muscleboundness
You gain 4 Mysteriousness
You gain 5 Sarcasm
 > PCKLSH: Trying to eat fortune cookie

buy 1 fortune cookie at market price from Market Demon
You acquire an item: fortune cookie
You spent 40 Meat

eat 1 fortune cookie
You gain 1 Adventure
Lucky numbers: 11, 119, 36

[61] Tavern Cellar (row 4, col 3)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 22 damage.
Round 2: picklish wins the fight!
You gain 16 Meat
You acquire an item: rat whisker
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 3 Strengthliness
You gain 2 Magicalness
You gain 7 Sarcasm
You gain a Moxie point!

[62] Tavern Cellar (row 4, col 4)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 37 damage.
Round 2: picklish wins the fight!
You gain 16 Meat
You acquire an item: rat whisker
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 3 Mysteriousness
You gain 9 Chutzpah

[63] Tavern Cellar (row 3, col 4)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 20 damage.
Round 2: picklish wins the fight!
You gain 13 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 3 Strongness
You gain 3 Wizardliness
You gain a Mysticality point!
You gain 6 Sarcasm

[64] Tavern Cellar (row 2, col 4)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 16 damage.
Round 2: picklish attacks!
You lose 4 hit points
Round 3: picklish attacks!
Round 4: drunken rat takes 21 damage.
Round 4: picklish wins the fight!
You gain 15 Meat
You acquire an item: rat whisker
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 4 Beefiness
You gain 3 Wizardliness
You gain 4 Cheek

cast 1 Disco Aerobics
You acquire an effect: Disco State of Mind (duration: 5 Adventures)

cast 1 Moxie of the Mariachi
You acquire an effect: Mariachi Mood (duration: 5 Adventures)

[65] Tavern Cellar (row 2, col 5)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 17 damage.
Round 2: picklish attacks!
Round 3: drunken rat takes 21 damage.
Round 3: picklish wins the fight!
You gain 16 Meat
You acquire an item: rat whisker
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 3 Strongness
You gain a Muscle point!
You gain 2 Mysteriousness
You gain 6 Roguishness

[66] Tavern Cellar (row 3, col 5)
Encounter: drunken rat
Round 0: picklish wins initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 16 damage.
Round 2: picklish attacks!
Round 3: drunken rat takes 18 damage.
Round 3: picklish wins the fight!
You gain 16 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 1 Strongness
You gain 3 Mysteriousness
You gain 7 Roguishness

[67] Tavern Cellar (row 4, col 5)
Encounter: drunken rat
Round 0: picklish loses initiative!
Round 1: picklish executes a macro!
Round 1: picklish attacks!
Round 2: drunken rat takes 37 damage.
Round 2: picklish wins the fight!
You gain 15 Meat
You acquire an item: rat whisker
You acquire an item: rat appendix
After Battle: Smuster greams happily, baring a mouthful of scarpy teeth.
You gain 5 Strongness
You gain 4 Enchantedness
You gain 2 Smarm
You gain a Moxie point!

tavern.php?place=barkeep
You acquire Typical Tavern swill (3)

[68] Tavern Cellar
Encounter: The Tavern Cellar
 

bumcheekcity

Active member
Tavern function to stop at the faucet.

I think the old behaviour of the tavern function was to stop at the faucet.

The current tavern function goes on to try to find the mansion.

Could possibly tavern() become the old behaviour or we get tavern(boolean continue) where if continue was true, would try to find and kill ratsworth (depending on our setting for the relavent choiceadv).

Either way, it would also be great if the tavern function could talk to Bart Ender afterwards.
 

dunsel8

New member
I second this, I expected tavern to stop at the faucet. Having the option to continue is nice, but I would expect it to stop at the faucet by default.
 

slyz

Developer
Does anyone have a gCLI output from running the tavern() command? It is supposed to stop when it finds the faucet.
 

Veracity

Developer
Staff member
Take a look at this big report which is probably related. They might even be the same issue; I am pretty sure the tavern command is supposed to stop at the faucet, and if it doesn't, that's a bug.

I keep forgetting to look at this when I ascend because I never use the "tavern" command to automate it for me.
 

Veracity

Developer
Staff member
I suspect that the issue is that we find the Choice adventures for the Faucet (and the Baron) but have already selected the choice (1 or 2, respectively) before we see the response text.

[51] Tavern Cellar (row 4, col 1)
Encounter: Of Course!
choice.php?whichchoice=509&option=1&pwd

[54] Tavern Cellar (row 5, col 3)
Encounter: If it's Tiny, is it Still a Mansion?
choice.php?whichchoice=511&option=2&pwd

TavernRequest.postTavernVisit() has this:

Code:
		if ( request.responseText.indexOf( "Of Course!" ) != -1 )
		{
			replacement = '3';
		}
		else if ( request.responseText.indexOf( "is it Still a Mansion" ) != -1 )
		{
			replacement = '4';
		}
		else if ( request.responseText.indexOf( "whichchoice" ) != -1 )
		{
			replacement = '2';
		}
but is that called BEFORE we take the choice? Or, perhaps, after we take the choice, does it mess up the square code in the tavern layout?
 

slyz

Developer
Code:
[68] Tavern Cellar
Encounter: The Tavern Cellar
Baron found in row 5, column 3
Faucet found in row 4, column 1
Returned: 16
It looks like tavernLayout knew where the faucet was. When KoLmafia.locateTavernFaucet() goes through the squares to find the faucet, it looks for the string "faucetoff" in the response text.
Code:
[51] Tavern Cellar (row 4, col 1)
Encounter: Of Course!
choice.php?whichchoice=509&option=1&pwd
Could it be that request.responseText contains the response text from after the faucet was turned off? In that case, I doubt it find the "faucetoff" string.

Since TavernRequest.postTavernVisit() will record the faucet's location, here is a patch that makes KoLmafia.locateTavernFaucet() look for the faucet in tavernLayout instead.

A debug log of visiting and turning off the faucet would help though. I'll try to remember that on my next run.

EDIT: ninja'd, and with the same doubt about the response text. Who to turn to now!
 

Attachments

  • Tavern.patch
    599 bytes · Views: 24
Last edited:

Veracity

Developer
Staff member
Revision 9489 revamps the tavern square detection for choice adventures. I happened to have a multi who'd been through the tavern before the revamp and had not ascended, so, guess what? The Tavern cellar was dark and unexplored. I explored it. Now, when I got to the rat faucet, it was already off - and the Baron was already slain - but it looks like it filled in the map ok for me.

I'll try it again today on my main, who will finish her current ascension, do Feast of Boris and aftercore stuff, and will then ascend and do day 1 of a new ascension on Feast of Boris. Satiation!

I will leave it to somebody else to try the tavern() function, though.
 

Veracity

Developer
Staff member
I manually went through the tavern today to find the faucet. Here is my Tavern Layout after doing so:

tavernLayout=2551110000100001300051000

So, we are definitely successfully updating the preference when you find various choice adventures now.

Looking at KoLmafia.locateTavernFaucet(), I see that it does this to locate the faucet:

Code:
		while ( !foundFaucet &&
			searchList.size() > 0 &&
			KoLmafia.permitsContinue() &&
			KoLCharacter.getCurrentHP() > 0 &&
			KoLCharacter.getAdventuresLeft() > 0 )
		{
			// Take the first square off of the list
			searchIndex = (Integer) searchList.remove( 0 );
			request.addFormField( "whichspot", searchIndex.toString() );
			request.addFormField( "action", "explore" );
			RequestThread.postRequest( adventure );

			String response = request.responseText;
			foundFaucet = response != null && response.indexOf( "faucetoff" ) != -1;
		}
...which is to say, it looks at the response text.

I have no idea what the "faucetoff" check thinks it is looking for. Especially since the faucet is now a choice adventure and KoLmafia will automatically take it and turn off the faucet, unless you manually set the choice option preference to not do so, for some reason.

I think this needs to either

1) Look for something which is REALLY in the response text or
2) Look at the preference: Preferences.getString( "tavernLayout" ).indexOf( "3" ) != -1;

I'll do the latter. Then, somebody can try it. :)
 

Veracity

Developer
Staff member
Revision 9495 does that. It also visits Bart Ender to claim your reward. Tell me if it works.
 
Top