Bug - Fixed r17270 - "auto" button during NC takes you to the Monster Manuel

Magus_Prime

Well-known member
I'm not sure when this started happening but it's recent. It doesn't happen every time but if:

- adventuring in the relay browser
- a non-combat is encountered
- left-click on the "auto" button in the relay browser main window
- instead of processing the NC chain the relay browser goes to a Monster Manuel page

One person commented on this in the KOL forum thread.
 
Last edited:

Abbbo

New member
Confirmed. Starts about three days ago (i.e. Build #683 (Oct 8, 2016 9:26:09 PM) ) And I even don't have Manuel.

Most strange part is that it's sometimes works OK and sometimes not. Even when there is no choice at all (like turtles NC for TT).
 

Darzil

Developer
How very strange. It isn't doing so for me so far, and I'm out of turns for the day.

Would it be possible to post the html of the page before clicking auto?

Bizarre that it happened in #683, which I guess seems to be some sort of system build that is triggered by something other than a code change. Did it definitely not happen in #682 ?
 

Magus_Prime

Well-known member
It's not dependent on a specific NC, and it's not reliably replicable, but it happened three times to me today.

For the record the NCs were: ghost dog, spookyraven, and a turtle.
 

Darzil

Developer
I guess the other alternative is running debug log the whole time and then clipping the end of it when you hit the issue.
 

Darzil

Developer
I've found a piece of code that could do this, but only if KoL gives an adventure again link that points at Monster Manuel.

StationaryButtonDecorator.java
Code:
	private static final Pattern BODY_PATTERN = Pattern.compile( "<body>.*</body>", Pattern.DOTALL );
	private static final Pattern LOCATION_PATTERN = Pattern.compile( "<[aA] (id=\"againlink\" )?href=[\"']?([^\"'>]*)", Pattern.DOTALL );

	public static final String getAdventureAgainLocation( StringBuffer response )
	{
		// Get the "adventure again" link from the page.
		// Search only in the body of the page

		Matcher m = BODY_PATTERN.matcher( response );
		if ( !m.find() )
		{
			// This will not happen
			return "main.php";
		}

		boolean againLinkExists = response.indexOf( "id=againlink" ) != -1;

		m = LOCATION_PATTERN.matcher( m.group(0) );
		while ( m.find() )
		{
			// Skip Monster Manuel's link to a new factoid
			// questlog.php?which=6&vl=p#mon1429

			String again = m.group( 1 );
			String link = m.group( 2 );
			// If KoL says that this is the "adventure again" link, believe it
			if ( again != null )
			{
				return link;
			}

			if ( againLinkExists && again == null )
			{
				continue;
			}

			if ( !link.contains( "questlog.php" ) && 
			     !link.contains( "desc_item.php" ) &&
			     !link.contains( "showplayer.php" ) )
			{
				return link;
			}
		}

		// If there is none, perhaps we fought a monster as a result of
		// using an item.

		MonsterData monster = MonsterStatusTracker.getLastMonster();
		if ( monster != null )
		{
			String monsterName = monster.getName();

			if ( monsterName.equals( "giant sandworm" ) )
			{
				AdventureResult drumMachine = ItemPool.get( ItemPool.DRUM_MACHINE, 1 );
				if ( KoLConstants.inventory.contains( drumMachine ) )
				{
					return "inv_use.php?pwd=" + GenericRequest.passwordHash + "&which=3&whichitem=" + ItemPool.DRUM_MACHINE;
				}

				// Look for more drum machines in the Oasis
				return "adventure.php?snarfblat=122";
			}

			if ( monsterName.equals( "scary pirate" ) )
			{
				return "inv_use.php?pwd=" + GenericRequest.passwordHash +"&which=3&whichitem=" + ItemPool.CURSED_PIECE_OF_THIRTEEN;
			}
		}

		return "main.php";
	}
 

Abbbo

New member
Can it interact with ToT thingy? Or ToT+Snowglobe? (It's the only change in my setup since no problems time).
 

Bale

Minion
This happens to me from time to time. It makes no sense to me. Here's the image of the page with the "auto" button in the upper left of the page. Clicking that button takes me to the "G" page of the monster Manuel.

UabJSTg.png


It's worth noting that I have a choice adventure script that added some annotations to that choice adventure. I sometimes find it useful for troubleshooting. Now, here's the html for that:

I hate no idea why that would redirect to the "G" page of the monster Manuel so I made a debug log of me clicking the "auto" button.
 

Darzil

Developer
Any chance of repeating with "Verbosely log communication between KoLmafia and browser" switched on, so we can see the comms to and from KoL ?
 

Bale

Minion
I already did it with that option enabled. This isn't my first rodeo. Please look at the debug log again and you'll see that.
 

Darzil

Developer
Very strange then, as I see neither "Requesting: https://www.kingdomofloathing.com" nor "Retrieving server reply...", and all I see being got is a lot of guide and a picture of guard turtle from cache.

Maybe Pastebin is cutting it short for me or something
 

Capn

Member
Louvre It or Leave It -"Go to Goal" redirect to Monster Manuel

Ive noticed over my past few runs, when at the "Louvre It or Leave It" NC, that selecting "Go to Goal" is redirecting to the Monster Manuel.
Returning to the choice (which is still available), choosing "Go to Goal" a second time works as intended.
 

ckb

Minion
Staff member
It's worth noting that I have a choice adventure script that added some annotations to that choice adventure. I sometimes find it useful for troubleshooting.

Oooo... this! Can you post the script that adds those annotations? I would also find that most useful. Thanks!
 
Top