Bug - Fixed "There is no swimming pool in this clan." always printed

fredg1

Member
GCLI:

[...]
Let's cannonball in the swimming pool.
There is no swimming pool in this clan.<<<
In the pool, flipping over.

Doing handstand in clan VIP swimming pool
In the pool, diving for treasure.

Diving for treasure in clan VIP swimming pool
You found a lost key in the VIP pool!
Preference _olympicSwimmingPoolItemFound changed from false to true
Getting out of the pool.

Getting out of clan VIP swimming pool
[...]

Appears every day.
Not such a big deal since the pool is still interacted with afterwards (the 'print' must simply be at a wrong place), but annoyingly false nonetheless.
 

Veracity

Developer
Staff member
Reproducible. From my DEBUG log:

Code:
Let's cannonball in the swimming pool.
class net.sourceforge.kolmafia.request.ClanLoungeRequest
Connecting to clan_viplounge.php...
Requesting: https://www.kingdomofloathing.com/clan_viplounge.php?preaction=goswimming&subaction=screwaround&whichfloor=2
...
Retrieved: https://www.kingdomofloathing.com/clan_viplounge.php?preaction=goswimming&subaction=screwaround&whichfloor=2
Field: Location = [choice.php?forceoption=0]
...
Connecting to choice.php...
Requesting: https://www.kingdomofloathing.com/choice.php?forceoption=0
...
Retrieved: https://www.kingdomofloathing.com/choice.php?forceoption=0
[choice page of things to do in the pool]
ClanLoungeRequest:

Code:
	@Override
	protected boolean shouldFollowRedirect()
	{
		return true;
	}
That is why it automatically followed the redirect. Also ClanLoungeRequest:

Code:
		case ClanLoungeRequest.SWIMMING_POOL:
			if ( this.redirectLocation != null && this.redirectLocation.startsWith( "choice.php" ) )
			{
				RequestLogger.printLine( "You start screwing around in the swimming pool." );
			}
...
			else if ( !responseText.contains( "vippool.gif" ) )
			{
				KoLmafia.updateDisplay( "There is no swimming pool in this clan." );
			}
It is coded assuming the redirect will NOT be followed.

Not sure when the redirect following was added (presumably to make something else work) but it made the swimming pool no longer "You start screwing around in the swimming pool." when you cannonball in to it.

A simple fix might be to change the "shouldFollowRedirect" method return false if the URL contains "subaction=screwaround". Or, since the check is in the run() method of ClanLoungeRequest, to simply assume that the request worked, if ( this.option == CANNONBALL ).

Hmm. I should finish my current Kingdom of Explathing run today and be able to test this in aftercore breakfast...
 

Veracity

Developer
Staff member
OK. There is code all over ClanLoungeRequest which assumes we do not follow redirects. Redirecting to the clan recruiter is how we detect that you are not in a clan, for example.

The shouldFollowRedirect override was added in revision 18488 when the "fortune" command was added.

I'm going to remove that method override and figure out what needs to be down to make that command work anyway. Probably as simple as adding a visit to choice.php at the place it will redirect...
 
Top