Bug - Fixed Property pyramidBombUsed should reset on ascension.

Bale

Minion
Here's an easy fix for a change.

The property, pyramidBombUsed does not reset on ascension. It would be good if it was added to that list. It's managing to avoid calamity by resetting when the pyramid is looked at, but that does not work quite as well as I would like.
 

lostcalpolydude

Developer
Staff member
This makes PyramidRequest.ensureUpdatedPyramid() mostly redundant. There would have to be a transition period, but do we just remove that? The same type of thing is done in other places (not the redundancy, but waiting to reset things until they become relevant); I can't remember where else at the moment, but whatever is done here should probably be what gets done in other places too.
 

Bale

Minion
Eh, it's fine. This way KoL can fix the preference in case the player advances the pyramid outside of mafia. That's a good thing.


(not the redundancy, but waiting to reset things until they become relevant)


In this case, there was a narrow window between opening the pyramid and actually looking inside of it when I was having a problem because the preference wasn't reset.
 
Last edited:

lostcalpolydude

Developer
Staff member
Eh, it's fine. This way KoL can fix the preference in case the player advances the pyramid outside of mafia. That's a good thing.

That happens when you look at the pyramid no matter what. If you make progress outside of mafia and then log in with mafia (for the first time since ascending), mafia will set it to the default value, which probably isn't the current value, so it's completely irrelevant here. Now there are two different places where that gets done: one as soon as you ascend (or as soon as you use mafia after ascending), and again when you start doing stuff in the pyramid, which is pointless.

In this case, there was a narrow window between opening the pyramid and actually looking inside of it when I was having a problem because the preference wasn't reset.
I agree with resetting it when you ascend. I was just trying to get an idea of what to do about old code that should probably be deleted. Or maybe resetting those can be left to the function in PyramidRequest and that function called from ValhallaManager, and all the times where it's called in PyramidRequest could be removed.

Edit: Not that it should have been necessary, but checking lastPyramidReset would have worked for you.
 
Last edited:

Bale

Minion
Huh. I never even thought about a lastPyramidReset preference. When is that reset? Is that reset when the inside of the pyramid is looked at?

Apparently I misjudged what PyramidRequest does. I assumed it would look at the status of the bottom chamber to decide how to set the pyramidBombUsed preference. If not, then it should.
 

roippi

Developer
It does, but only when the wheel is in position 1. I suppose we could improve that logic:

Code:
	private static final Pattern IMAGE_PATTERN = Pattern.compile( "http://images.kingdomofloathing.com/otherimages/pyramid/pyramid4_([\\d,]+)(b)?.gif" );
	private static final Pattern WHEEL_PATTERN = Pattern
		.compile( "http://images.kingdomofloathing.com/otherimages/pyramid/pyramid3(a|b).gif" );

Code:
                // If we got here, we might just be visiting the pyramid.

		// Check whether the wheel is placed based on the Middle Chamber image
		Matcher wheelMatcher = PyramidRequest.WHEEL_PATTERN.matcher( responseText );
		if ( !wheelMatcher.find() )
		{
			return;
		}
		String wheel = wheelMatcher.group( 1 );
		PyramidRequest.setPyramidWheelPlaced( wheel.equals( "b" ) );

		Matcher matcher = PyramidRequest.IMAGE_PATTERN.matcher( responseText );
		if ( !matcher.find() )
		{
			return;
		}

		int position = StringUtilities.parseInt( matcher.group(1) );
		PyramidRequest.setPyramidPosition( position );
		if ( position == 1 )
		{
			PyramidRequest.setPyramidBombUsed( matcher.group(2) != null );
		}

If the wheel is in any other position, the bomb hasn't been used, right?

ensureUpdatedPyramid() is deprecated now, I suppose we could just delete it.
 

Bale

Minion
If the wheel is in any other position, the bomb hasn't been used, right?

Hmmm... I should match only if pyramid4_1b.gif is the current lower chamber. (That's the image that actually shows the Ed's Chamber.) But I'm not certain if this code does that. Maybe? I think it checks for the 1, but leaves the b optional. Unless I'm mistaken it only checks a|b for WHEEL_PATTERN, not IMAGE_PATTERN. If there is an image pyramid4_1a.gif that would break it, right?
 

roippi

Developer
There is no pyramid4_1a.gif, just _1 and _1b. No issue there.

What I was asking about was if the pyramid is in another state - pyramid4_2, whatever - that we know that the bomb hasn't been used.
 

Bale

Minion
What I was asking about was if the pyramid is in another state - pyramid4_2, whatever - that we know that the bomb hasn't been used.

After the bomb is used, the wheel is disabled now. (That wasn't always true, but thank goodness Jick disabled that potential error.) So we can be sure that after the bomb is used, it stays in that configuration.
 
Top