I believe it is (or was) also an issue with switching outfits, but I don't really remember. Something with mafia parsing kol's result text (list of newly equipped items, then list of newly unequipped items) not being ready for the case when a 1-handed weapon has not been reported by kol at all (because outfit says it should be equipped and it is), desyncing mafia's idea of which weapon is in which hand? Maybe it needed something else to manifest too?
The code in EquipmentRequest (from roughly line 1876 on) looks like if
1) a custom outfit is saved with weapon X in mainhand and a different weapon Y in offhand
2) I equip a duplicate of the weapon Y in my mainhand (so I am wielding two copies of the weapon)
3) the custom oufit is restored
kol will say it unequips weapon Y (but it won't say it's being unequipped from mainhand)
mafia will see that I have weapon Y in offhand and deduce that it is therefore being unequipped from offhand:
Code:
if ( newEquipment[ EquipmentManager.OFFHAND ].equals( item ) )
{
slot = EquipmentManager.OFFHAND;
}
(I just checked this in vanilla kol, and KoL *did* equip X into mainhand; so it at least *can* happen, even if it doesn't happen always)
mafia started (before step 3, correctly) at "1 X in inventory, 1 Y in mainhand, 1 Y in offhand"
then it saw "equip X, unequip Y - both incorrectly in offhand"
kol knows I have 1 Y in inventory, 1 X in mainhand, 1 Y in offhand
mafia thinks I have 1 Y in inventory, 1 Y in mainhand, 1 X in offhand
if I now unequip offhand, mafia will see from kol's response that 1 Y entered inventory (and it will forget about the X that was in the offhand)
Result: extra copy of Y in mafia's inventory model (and a missing X)
Conversely, if
1) save the same custom outfit (mainhand X, offhand Y)
2) equip a second X in offhand
3) restore the outfit
kol will say it unequips X and equips Y (Y ended up in offhand this time in kol)
mafia will see that I did *not* already have Y in offhand, so it will think it's being put into mainhand
mafia goes from "1 Y in inventory, 1 X in mainhand, 1 X in offhand"
then sees "equip Y, unequip X - incorrectly in mainhand"
kol knows I have 1 X in inventory, 1 X in mainhand, 1 Y in offhand
mafia thinks I have 1 X in inventory, 1 Y in mainhand, 1 Y in offhand
if I know unequip mainhand, mafia will see from kol's response that 1 X and 1 Y entered inventory
Result: extra Y in mafia's inventory model (and a missing X)
(the difference is, in the first case I needed to start with 2 of the "duplicated" items; in the second case I only need to start with 2 of the other item, which means that it can "duplicate" even a quest item like a s'n's sword)
Does this work? I can check later in mafia, now I am only conjecturing from vanilla kol and mafia sources.