Bug - Fixed Using a tomb ratchet when the wheel hasn't been placed advances pyramidPosition

lostcalpolydude

Developer
Staff member
When you haven't placed the wheel in the pyramid yet, using a tomb ratchet places the wheel in the middle chamber without changing the lower chamber. However, mafia calls PyramidRequest.advancePyramidPosition() anyway. Unfortunately, the response text from using a tomb ratchet is the same either way, so the only way to handle everything is to also track whether the wheel is placed. That would either be set when the first ratchet is used, or when the noncombat is found in the middle chamber (text is a large block, found here on the wiki). I expect it would be stored in lastPyramidWheelPlaced or something similar, though a pyramidPosition of 0 could probably be made to work there.

Actually visiting the pyramid fixes pyramidPosition, of course.
 

lostcalpolydude

Developer
Staff member
I realized that mafia already starts with a pyramidPosition of 0 and updates it based on the lower chamber image, so that wasn't a reasonable option. Here is a patch that adds pyramidWheelPlaced, updates it when you see the choice adventure, and uses it to properly handle using tomb ratchets.

On another note, should PyramidRequest.ensureUpdatedPyramid() be called from ValhallaManager.resetPerAscensionCounters() ?
 

Attachments

  • pyramidWheelTracking.patch
    1.9 KB · Views: 31

nworbetan

Member
I appreciate this fix, especially since I had given up hope of fixing it myself when I realized that the tomb ratchet use text was the same whether the wheel had been placed or not. As part of this fix, I think pyramidWheelPlaced probably should also set to true if mafia happens to see pyramid3b.gif, just in case the wheel was originally placed outside of mafia.

It also might be nice to make sure pyramid3b.gif is displayed when the first tomb ratchet is used to place the wheel in the relay browser. I think that might belong somehwere in UseItemDecorator.java? Maybe?

Edit: Actually, it looks like pyramid3b.gif is never displayed by UseItemDecorator.java, which doesn't look right to me. I think it should be the case that pyramid3a.gif should never be displayed when a tomb ratchet has been used.
 
Last edited:

lostcalpolydude

Developer
Staff member
All cases where mafia calls PyramidRequest.pyramidHTML() are preceded by an action that places the wheel, so pyramid3a can just be replaced with pyramid3b in that function.
 

Veracity

Developer
Staff member
You know, I had no idea what you are talking about, so I went and looked at pyramid3a.gif and pyramid3b.gif.
I had never noticed the difference before. Cool.

You are correct, lost. Revision 10891.
 

Terion

Member
Fu... I saw this, thought "Oh, I'm going to open the Pyramid today and I've got several tangles of rat tails with the intent of getting ratchets; I can test this today."

Then, after opening the pyramid and getting the wheel in my first adventure in the upper chambers, I notice that Clancy wants to go the the middle chamber. "Hey, yeah, another minstrel level will help find ratchets." Go to the middle chambers, get the noncom to place and then turn the wheel, finally get Clancy's level.

Now to go get ratchets so I can test them before the wheel is... oh, damn.
 

lostcalpolydude

Developer
Staff member
I already tested using a ratchet before the wheel is placed and saw that it worked as it should (seeing the correct image in the relay browser, checking mafia's properties for appropriate settings). I was waiting to test using the noncombat to place the wheel before reporting back.
 

roippi

Developer
??

Just create a private static boolean pyramidWheelPlaced in PyramidRequest, and update it whenever we look at pyramid.php.
 

lostcalpolydude

Developer
Staff member
I suppose you're also setting this when a ratchet is used? What if someone begins a session by adventuring directly in the upper chamber (because they opened the pyramid during a previous session) and then uses ratchets without ever loading the pyramid?
 

roippi

Developer
You could not initialize the boolean and run a PyramidRequest if it's null when you look at it. Technically the preference saves a server hit there, but that's so marginal that I'm not sure it's worth it.
 

lostcalpolydude

Developer
Staff member
Here is the tracking done without a preference. I don't think you can initialize a boolean without a value (maybe I'm wrong), but the one time that there's an explicit check of the value when it's false is followed by setting it to true, so initializing it as false isn't a problem.

I'm not completely sure about the regex I used, though it seemed simple enough (along with examples right there) that it would be hard to mess up. Without mafia settings to check, it will be harder to see if I did it right.
 

Attachments

  • pyramidWheelTracking2.patch
    3.1 KB · Views: 18

roippi

Developer
I think there still might be a problem if you use a tomb ratchet first thing on login before you look at the pyramid. Even if you've set the wheel (in a previous session), the boolean will be false and pyramid progress won't increment.

You can initialize to null if you wrap it in a Boolean (big B).

Edit: nvm, I misunderstood something. Still, I like the idea of having it be null when you haven't set it, rather than it being false. Just in case some other function needs to use the value and expects it to behave sanely.
 
Last edited:

Terion

Member
I opened the Pyramid yesterday (in HC Boris) but I haven't adventured there yet. I have several rat tail tangles I am going to use for ratchets.

What is the best method or order of steps for me to provide useful testing information when I get home from work this evening?
 

Terion

Member
OK, doesn't seem to be working right.

I started out downloading r10906, the most current build. All adventuring was done in the relay browser. After some other work (starting the war, flyering, non-Pyramid stuff), I fought 6 tomb rat kings and ended up with 12 tomb ratchets (I did get the wheel in my first adventure in the Upper Chamber.) I then logged off, and closed the browser and Mafia, to get rid of any session variables. I have not yet adventured in the Middle Chamber, so the wheel is not set and nothing's turned.

I opened Mafia, and logged in. I entered "debug on" in the gCLI. In the relay browser, I opened the chat (I set the option back to the older style when the new tabbed chat rolled out, since it didn't work with Mafia) and did "/use ratchet" in the chat. The page that was returned had image pyramid4_2.gif for the Lower Chamber, which is what it would be after it had been turned once. I used the link to go Back to Desert Beach, and then clicked on A Small Pyramid. The image shown for the Lower Chamber when I returned was pyramid4_1.gif. I then entered "debug off" in the gCLI, and attached the resulting debug log. Hope it helps.
 

Attachments

  • DEBUG_20120411.txt
    76.9 KB · Views: 54

lostcalpolydude

Developer
Staff member
So the ratchet got used. Mafia didn't know whether the wheel was placed, so it loaded the pyramid to see if the wheel was placed. Using the ratchet placed the wheel, so it improperly passes that test and advances the pyramid state anyway.

The only way checking for the middle chamber image works is if it can check before using the ratchet (even in the relay browser). Otherwise we might have to go with a mafia property after all.
 
Top