(not the redundancy, but waiting to reset things until they become relevant)
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.
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.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.
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" );
// 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?
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.