Display case refresh?

ckb

Minion
Staff member
Is there any way to get Mafia to refresh your display case (other than logging off and back in)?
I would like to refresh the items in the case AND the shelves I have.

refresh all does not do it.
visiting /viewing your display case does not do it.
I do not see any refresh button on 'Museum display'

Am I missing something?
 

Veracity

Developer
Staff member
Why do you need to do this? Is it getting out of synch, somehow?
If so, what did you do to make it get out of synch?
I'd rather fix the bug than put in a button to recover after a bug has happened.
 

Theraze

Active member
If I follow the twisty turns of mafia code properly, a visit_url to managecollectionshelves.php MIGHT cause a display case refresh. As long as you don't actually manage anything there.

Logic:
ResponseTextParser.externalUpdate has a capture on managecollectionshelves.php that calls DisplayCaseRequest.parseDisplayArrangement.
DisplayCaseRequest.parseDisplayArrangement will call DisplayCaseManager.update IF it doesn't find action=arrange in the url string.
DisplayCaseManager.update will call DisplayCaseManager.updateShelves as its first step.
DisplayCaseManager.updateShelves calls DisplayCaseManager.clearCache as its first step.
DisplayCaseManager.clearCache wipes KoLConstants.collection and sets DisplayCaseManager.collectionRetrieved to false, which means that it will actually re-parse your display case. It also wipes your headers and shelves.

Based on all that, it appears the only current way to wipe your display case is to either hit the managecollectionshelves page without re-arranging your shelves, or logging out.

Edit: But as Veracity says, it shouldn't be needed. Since it gets updated when you log in, and you shouldn't be able to update it from outside mafia without forcing another log-in afterwards.
 

Bale

Minion
Why do you need to do this? Is it getting out of synch, somehow?
If so, what did you do to make it get out of synch?
I'd rather fix the bug than put in a button to recover after a bug has happened.

Follow these steps to replicate the bug:
  1. You need to have an item in the display case. To simplify the example I will call this item a "stuffed Hodgman," but it may actually be any item that is already in the display case.
  2. Have one or more stuffed Hodgmen in the display case.
  3. In the item manager, highlight "stuffed Hodgman" and click the "display case" button.
  4. Add one or more stuffed Hodgmen to the number already in the display case.
  5. This will add the item to the display case, but for some reason KoLmafia does not indicate the increased quantity of stuffed Hodgmen.
This bug will not occur if you use the museum display frame instead of the item manager.
 
Last edited:

Veracity

Developer
Staff member
To clarify:

- you had already opened the display case frame, so KoLmafia knew about your shelf structure.
- you move things from inventory to the display case using the item manager
- the display case frame does not show the appropriate shelf - if any - where the item went.

Correct?

We have a single list - KoLConstants.collection - of every item you have in the case. The shelf structure is applied over that, so to speak. Until you look at the the display, via the frame, or via refreshing the display via ASH display_amount(), say - we don't know the actual amount of items and where they are located.
 

Bale

Minion
To clarify:

- you had already opened the display case frame, so KoLmafia knew about your shelf structure.
- you move things from inventory to the display case using the item manager

These two are correct.

- the display case frame does not show the appropriate shelf - if any - where the item went.

The display case frame shows the already existing quantity of the item on the correct shelf.
 
Top