Bug - Fixed Tracking accessories when changing outfits with ajax=1

Veracity

Developer
Staff member
When you use a chat command to change an outfit, it does inv_equip.php?action=outfit&whichoutfit=xxx&ajax=1, which changes the outfit and puts up a "Results:" showing what was equipped and what was unequipped. KoLmafia currently modifies its model of your equipment by unequipping everything in the Unequipped list and then equipping everything in the equipped list. Unfortunately, accessories (and dual-wielded weapons) can be confusing: KoL does not necessarily list the accessories in the actual slot-order they end up in. (I believe that is the case with dual-wielding, too, although I only tested accessories today.)

Here are some custom outfits:

Test Outfit 1

Iron Beta of Industry
Bonerdagon necklace
bejeweled pledge pin

Test Outfit 2

pirate fledges
lucky rabbit's foot
monster bait

Test Outfit 3:

lucky rabbit's foot
lucky rabbit's foot

Test Outfit 4

Order of the Silver Wossname

These are all nothing but accessories, since it is accessory switching that is unclear to me. Here is what I see when switching outfits via chat

/outfit none
Results: All items unequipped.

/outfit Test Outfit 1
Results: You put on an Outfit: Test Outfit 1
Item equipped: Bonerdagon necklace
Item equipped: bejeweled pledge pin
Item equipped: Iron Beta of Industry
---> Inventory shows that accessories are in that order

*** When there are empty accessory slots, KoL fills from 1 to 3

/outfit Test Outfit 2
Results: You put on an Outfit: Test Outfit 2
Item equipped: monster bait
Item equipped: lucky rabbit's foot
Item equipped: pirate fledges
Item unequipped: Iron Beta of Industry
Item unequipped: bejeweled pledge pin
Item unequipped: Bonerdagon necklace
---> Inventory shows that accessories are in this order:
Accessory 1: pirate fledges
Accessory 2: lucky rabbit's foot
Accessory 3: monster bait

*** When there are no empty accessory slots, KoL reclaims them from 3 down to 1

/outfit Test Outfit 3
Results: You put on an Outfit: Test Outfit 3
Item equipped: lucky rabbit's foot
Item unequipped: monster bait
---> Inventory shows that accessories are in this order:
Accessory 1: pirate fledges
Accessory 2: lucky rabbit's foot
Accessory 3: lucky rabbit's foot

*** Same result: one accessory was already there, the duplicate went into slot 3

/outfit Test Outfit 4
Results: You put on an Outfit: Test Outfit 4
Item equipped: Order of the Silver Wossname
Item unequipped: lucky rabbit's foot
---> Inventory shows that accessories are in this order:
Accessory 1: pirate fledges
Accessory 2: lucky rabbit's foot
Accessory 3: Order of the Silver Wossname

*** Same result: remove accessory in slot 3

/outfit Test Outfit 2
Results: You put on an Outfit: Test Outfit 2
Item equipped: monster bait
Item unequipped: Order of the Silver Wossname
---> Inventory shows that accessories are in this order:
Accessory 1: pirate fledges
Accessory 2: lucky rabbit's foot
Accessory 3: monster bait

*** Same result: remove accessory in slot 3

/unequip Accessory2
Item unequipped: lucky rabbit's foot
---> Inventory shows that accessories are in this order:
Accessory 1: pirate fledges
Accessory 3: monster bait

/outfit Test Outfit 1
Results: You put on an Outfit: Test Outfit 1
Item equipped: Bonerdagon necklace
Item equipped: bejeweled pledge pin
Item equipped: Iron Beta of Industry
Item unequipped: monster bait
Item unequipped: pirate fledges
---> Inventory shows that accessories are in this order:
Accessory 1: Iron Beta of Industry
Accessory 2: Bonerdagon necklace
Accessory 3: bejeweled pledge pin

*** Three accessories are added. The first goes into the empty slot 2. The others replace accessories 3 and 1 in that order.

/outfit Test Outfit 4
Results: You put on an Outfit: Test Outfit 4
Item equipped: Order of the Silver Wossname
Item unequipped: bejeweled pledge pin
---> Inventory shows that accessories are in this order:
Accessory 1: Iron Beta of Industry
Accessory 2: Bonerdagon necklace
Accessory 3: Order of the Silver Wossname

*** Again, replace accessory in slot 3

/unequip Accessory1
Results: Item unequipped: Iron Beta of Industry
---> Inventory shows that accessories are in this order:
Accessory 2: Bonerdagon necklace
Accessory 3: Order of the Silver Wossname

/outfit Test Outfit 3
Results: You put on an Outfit: Test Outfit 3
Item equipped: lucky rabbit's foot
Item equipped: lucky rabbit's foot
Item unequipped: Order of the Silver Wossname
---> Inventory shows that accessories are in this order:
Accessory 1: lucky rabbit's foot
Accessory 2: Bonerdagon necklace
Accessory 3: lucky rabbit's foot

*** Again, first use empty slot 1 and then replace accessory in slot 3.
 

Veracity

Developer
Staff member
A long time ago, I asked CDM if he'd be willing to put in a little HTML comment in the Results: frame to show exactly which slot each Equipped or Unequipped item pertained to. He was sort-of-positive, but has obviously been busy with other things, so, we need to adapt our code to recognize KoL's algorithm. In particular, EquipmentManager.parseEquipmentChange has code inside "if ( action.equals( "outfit" ) )" which needs to change.

Having done this, we can do the following:

- Make all CHANGE_OUTFIT EquipmentRequests use ajax=1, which will eliminate a redirect and page load to refresh the whole equipment page after an outfit change.
- Fix outfit swapping for buying NPC items to eliminate a LOT of requests:
---> No longer need to save special outfit Backup (eliminate one request & response)
---> Simply change to KGE or Hippy or Bugbear or whatever, with ajax=1 (eliminate redirect and page load)
...do purchases
---> Change to "whichoutfit=last", with ajax-1 (eliminate redirect and page load)
...the end result of which would be the identical page loads to what people do with chat macros to restore MP via purchasing seltzers.
 
Last edited:

Bale

Minion
...the end result of which would be the identical page loads to what people do with chat macros to restore MP via purchasing seltzers.

Awesome! Though I think that this thread is more of a feature request than a bug report. :p
 

Veracity

Developer
Staff member
Awesome! Though I think that this thread is more of a feature request than a bug report. :p
Ha ha.

Well, that is exactly why I split the writeup into two parts. The first part describes a bug: KoL tells us such-and-such and the Gear Changer does NOT do the right thing.

The second part explains what we could do as a followup - AFTER fixing the bug! - which definitely does fall into the "feature request" camp.
 

Bale

Minion
Sorry, couldn't resist playfully chiding you for that.

It really does sound awesome though. Anything that makes mafia faster is awesome and purchasing seltzer/fruit is such a frequent occurrence that I imagine this will have a noticeable impact on lag for events.
 

xKiv

Active member
I would also note that the "Item Equipped"s here are listed in order of item ID.
In one thread I saw on the KoL forums, Antoinds says that item ID is what "which weapons goes where" is decided on with DFSS, but that might not be true any more - in another thread, CDMoyer says something about fixing that.
 

Veracity

Developer
Staff member
Revision 8648 should handle switching outfits with ajax=1, as happens when you use /outfit in chat. It also makes KoLmafia's internal outfit switching use ajax=1, which should eliminate the redirect & response when switching an outfit. I.e., half the page loads.

We still save "Backup" and restore "Backup" when buying from an NPC store that requires a particular outfit, rather than simply changing to the named outfit and restoring "last", but it is noticeably faster.

That's all I have time for today; eliminating use of Backup for seltzers and fruit purchases will have to wait, since that looks like a bigger job. Let me know how this change works for you, though.
 
Top