Bug Is it a bug or a feature that Mafia remakes an equipped ice bucket over rollover?

lostcalpolydude

Developer
Staff member
I have that set to acquire and re-equip. Any item affected by that setting needs special code to handle it, I believe. Also, mafia can only recognize an item breaking if it sees a message indicating it broke. If you close and reopen mafia, there should be no knowledge that you were wearing it before.

Is the ice nine in any of your outfits, particularly the Backup outfit? I guess it's probably too late to check now.
 

Razorsoup

Member
I have that set to acquire and re-equip. Any item affected by that setting needs special code to handle it, I believe. Also, mafia can only recognize an item breaking if it sees a message indicating it broke. If you close and reopen mafia, there should be no knowledge that you were wearing it before.

Is the ice nine in any of your outfits, particularly the Backup outfit? I guess it's probably too late to check now.

It is too late to check now, but I can force a character to have ice nine in an outfit named Backup over tomorrow's rollover and try to have it not in an outfit the next rollover and see what happens.
 

Darzil

Developer
Have you got a login script that equips an outfit ?
What is your breakfast configured to do ?
Was it logged in your CLI / session logs ?
 

Razorsoup

Member
Have you got a login script that equips an outfit ?
What is your breakfast configured to do ?
Was it logged in your CLI / session logs ?

It hadn't gotten to the login script yet and my login script doesn't equip any outfits. My login script actually wouldn't even run today due to an error (bad function name) caused by a change I made the day before. It was logged in my CLI (but I neglected to copy it down because I had a different error distract me) but I can't find it in my session log. Mafia tried to recreate the ice nine but couldn't because I am in hardcore and didn't have enough ice harvests. Mafia did not abort when it failed to create the ice nine. My breakfast settings are:KoLmafia breafast settings.png

I have a multi waiting for rollover with the ice nine equipped. This character has no outfit named Backup, only has one custom outfit and that outfit does not contain ice nine. I'll report back after rollover to let you know if mafia tries to recreate the ice nine, unless you need me to change something about this character's state to test anything.
 
Last edited:

Veracity

Developer
Staff member
Looking at the code, BreakfastManager.getBreakfast() does SpecialOutfit.createImplicitCheckpoint() at the top and SpecialOutfit.restoreImplicitCheckpoint() at the end. If the first call thought you had an ice bucket equipped, the second call would make sure you had one available - via creation, if necessary.

The question is why KoLmafia would think you had an ice bucket available for the first call but had figred out you didn't actually have one by the second call.

We get your equipment every time we call api.php. That is one of the first thing we do when you log in. It is also called after many internal requests - whenever KoL would have the browser refresh the charpane.

What happens if you log into KoL in a plain browser after rollover with an ice item that melted? Does it, perhaps, give you a message when it loads main.php to tell you that your item has melted? If so, this could be analogous to your Pen Pal: you get a message in kmail each day, but it is not actually in your inventory (as retrieved by api.php) until you go to main.php and it tells you that you've received a message from your Pen Pal - at which point, if you refresh inventoy, you have the item.

Conjecture: if you have an ice item equipped at rollover, when you log in with KoLmafia, the initial api.php shows the item in your equipment array. If you then open the relay browser, say, KoL tells you that your item has melted - and a subsequent api.php call will not find the item.

If there is nothing in the normal set of calls we do at login that makes KoL tell you that you've lost the item, when we run breakfast, the saved outfit has the ice item.
If something done during breakfast makes KoL tell you that you've lost the item - and we load api.php during breakfast, as we certainly will - when we restore the checkpoint, we'll try to re-make the item.

I'd like to see this:

Uncheck the "run breakfast" checkbox on the Login Frame
Open the gCLI and say "debug on"
Log in via KoLmafia
-> that will let us see what api.php returns
Open the Relay Browser
-> Tell us if KoL says something about your ice item melting
Click the "refresh" button at the bottom of the Green Sidepane of KoLmafia's GUI
-> that will run api.php again and we can see what the new equipment array is
Open the gCLI and say "debug off".

And we can look at the DEBUG log and see if my conjectures have any truth to them. Any "veracity", you might say.
 

lostcalpolydude

Developer
Staff member
Looking at the code, BreakfastManager.getBreakfast() does SpecialOutfit.createImplicitCheckpoint() at the top and SpecialOutfit.restoreImplicitCheckpoint() at the end. If the first call thought you had an ice bucket equipped, the second call would make sure you had one available - via creation, if necessary.

I thought that the code shouldn't work that way, and staring at it now it still seems like it doesn't. Either InventoryManager.getAccessibleCount() should return 0 for the item (if mafia thinks it isn't equipped, since it doesn't count stuff that you can craft), or isWearing() (called from SpecialOutfit.retrieve()) should be true and retrieveItem() shouldn't be called there. If there's some path where mafia will try to create equipment when you try to equip it still, that could be changed, but I can't find it.

Of course, it's also possible that the suggested main.php hit on login in the other thread would fix this issue. Maybe the reason I can't reproduce the issue is that I have the relay browser set to open when I log in. Which matches most of what your post says, of course.
 

Veracity

Developer
Staff member
I just equipped an ice bucket. I'll do what I suggested next time I log in after rollover, just to see if api.php is reporting different things before and after main.php, as I conjecture. If it does, then we can investigate why, apparently, we are calling retrieveItem on the melted item, although a main.php hit at log in would, in fact, solve this issue.
 

Veracity

Developer
Staff member
I thought that the code shouldn't work that way, and staring at it now it still seems like it doesn't. Either InventoryManager.getAccessibleCount() should return 0 for the item (if mafia thinks it isn't equipped, since it doesn't count stuff that you can craft), or isWearing() (called from SpecialOutfit.retrieve()) should be true and retrieveItem() shouldn't be called there.
SpecialOutfit.retrieve is only called if you try to put on a named outfit - Backup, say. SpecialOutfit.restoreCheckpoint restores the outfit one piece at a time - exactly as we see happening in the posted session log, where it does "equip ice bucket", not "outfit Backup".

If there's some path where mafia will try to create equipment when you try to equip it still, that could be changed, but I can't find it.
EquipmentRequest.run() called with CHANGE_ITEM calls InventoryManager.retrieveItem( this.changeItem ). If you say "equip ice bucket" in the gCLI (as I did when setting up for rollover tonight), I WANT it to create the item, as it did, and then equip it for me.
 

Razorsoup

Member
I'd like to see this:

Uncheck the "run breakfast" checkbox on the Login Frame
Open the gCLI and say "debug on"
Log in via KoLmafia
-> that will let us see what api.php returns
Open the Relay Browser
-> Tell us if KoL says something about your ice item melting
Click the "refresh" button at the bottom of the Green Sidepane of KoLmafia's GUI
-> that will run api.php again and we can see what the new equipment array is
Open the gCLI and say "debug off".

And we can look at the DEBUG log and see if my conjectures have any truth to them. Any "veracity", you might say.

I will try this after rollover. Also, :rolleyes:, nice pun.
 

Bale

Minion
If a main.php hit is necessary to cause an item to melt, then that is a KoL bug. Someone without a main.php hit could use lemoney scales gear every day without it breaking to help win "The Candy Witch and the Relentless Child Thieves."

Is it right to force that main.php hit to solve this when disabling that setting for melting gear is perfectly viable solution? Or is there a moral responsibility to ensure that we correct a KoL bug?

I'd suggest that we report the bug, explain what KoLmafia can do and not force a main.php hit yet. Let's see if Gemeli wants us to fix it for KoL or if Jick will have CDM change the code so that these things happen on login without forcing a main.php hit.
 

Razorsoup

Member
I'd like to see this:

Uncheck the "run breakfast" checkbox on the Login Frame
Open the gCLI and say "debug on"
Log in via KoLmafia
-> that will let us see what api.php returns
Open the Relay Browser
-> Tell us if KoL says something about your ice item melting
Click the "refresh" button at the bottom of the Green Sidepane of KoLmafia's GUI
-> that will run api.php again and we can see what the new equipment array is
Open the gCLI and say "debug off".

And we can look at the DEBUG log and see if my conjectures have any truth to them. Any "veracity", you might say.

Did this. KoL didn't give any message about the ice nine melting. Also, KoLmafia didn't try to recreate it this time. Here's the debug log.
View attachment 8161
 

Attachments

  • DEBUG_20140130.txt
    296.4 KB · Views: 784

Veracity

Developer
Staff member
I think you hit "refresh" on the charpane, not the refresh button on the green sidepane.

I did this:

api.php right after login:

Code:
"weapon":"1325","offhand":"7084","acc1":"5460"
The Gear Changer said that I was wearing an ice bucket.

Open Relay Browser and hit main.php.
TheGear Changer still said I was wearing an ice bucket.
Hit the refresh button and force another api.php hit:

Code:
"weapon":"1325","acc1":"5460"
...nothing listed in offhand slot.

My conjecture is confirmed.
 

Winterbay

Active member
I wonder if you go adventure without hitting main.php if you get the benefit from the thing that should've been gone or if it is removed somehow anyway...
 

lostcalpolydude

Developer
Staff member
I wonder if you go adventure without hitting main.php if you get the benefit from the thing that should've been gone or if it is removed somehow anyway...

Since charsheet.php doesn't show it, it's likely false data from api.php. I've heard Eleron complain about stale data from there occasionally (though not in a long time).
 

Veracity

Developer
Staff member
I think we should create a new setting - _mainCalled - and hit main.php as the first request of a refresh or timein if we haven't doesn't it yet today. One extra server hit each day (that a non-KoLmafia user will do every time they log in) doesn't seem too painful, it will catch things like this year's Crimbotown daily unlock with no additional effort on out part, and it won't require us to wait for KoL to fix its own stale api.php bugs.
 

Bale

Minion
If you do it that way, it will still leave a problem with Crimbotown since idling out and then relogging in will leave Crimbotown locked again. (Crimbotown needed to be unlocked each and every time you log in.) I'm not sure if this is also true for Halloween also. So there is a reason to skip the new setting and just add the main.php hit every time KoL logs in. One extra server hit each time the player logs in is still reasonably painless.

More on that subject here.
 

Veracity

Developer
Staff member
Seriously? Gods, what a sucky implementation.

Fine. I was just suggesting an alternate suggestion to Bale's idea that we hit main.php if (specific-list-of-things-that require-a-main.php-hit) is applicable, so as to avoid coding that specific list. :)
 
Top