Transmog: outfit slots are saved to their own place

Saving an outfit walked the stored slots forward once and expected the
client's slots in the same order. The 1.60 client does not always send
them sorted, so a slot could be written over another one or the save
stopped early, and the armor slots of an outfit did not keep their new
look. Every outfit holds every slot at its slot index, so each slot is
now written there directly.

(cherry picked from commit a848dc6d1264cd977b30cf9436557183673a20ca)
This commit is contained in:
Karrz1
2026-11-12 00:46:40 +00:00
parent 0d27523771
commit 69fa45a12a
+10 -4
View File
@@ -32866,13 +32866,19 @@ void Player::UpdateTransmogOutfitSlots(uint32 id, std::span<WorldPackets::Transm
auto outfit = m_values.ModifyValue(&Player::m_activePlayerData)
.ModifyValue(&UF::ActivePlayerData::TransmogOutfits, id);
uint32 outfitSlotIndex = 0;
// Each slot is written to its own place in the outfit (every outfit holds every slot, at its SlotIndex, as CreateTransmogOutfit and
// _LoadTransmogOutfits lay it out). This walked the stored slots forward once and expected the client's slots in the same order,
// but the 1.60 client does not always send them sorted (see the price in HandleTransmogOutfitUpdateSlots): a slot that came after a
// higher one was written over the stored slot the walk stood on, and a slot past the last stored one ended the save. Weapons and
// the cloak kept their new look, the armor slots did not (likely cause of Discord, shredxgod 2026-11-11: a hunter's leather outfit went back to the
// worn gear after saving, and the slots showed warnings).
for (WorldPackets::Transmogrification::TransmogOutfitSlotData const& slot : slots)
{
while (std::pair(*transmogOutfit->Slots[outfitSlotIndex].Slot, *transmogOutfit->Slots[outfitSlotIndex].SlotOption) < std::pair(AsUnderlyingType(slot.Slot), AsUnderlyingType(slot.SlotOption)))
if (++outfitSlotIndex >= transmogOutfit->Slots.size())
return;
TransmogMgr::TransmogOutfitSlotAndOptionInfo const* slotInfo = TransmogMgr::GetSlotAndOption(slot.Slot, slot.SlotOption);
if (!slotInfo || slotInfo->SlotIndex >= transmogOutfit->Slots.size())
continue;
uint32 const outfitSlotIndex = slotInfo->SlotIndex;
auto viewedOutfitSlot = outfit.ModifyValue(&UF::TransmogOutfitData::Slots, outfitSlotIndex);
SetUpdateFieldValue(viewedOutfitSlot.ModifyValue(&UF::TransmogOutfitSlotData::Slot), AsUnderlyingType(slot.Slot));
SetUpdateFieldValue(viewedOutfitSlot.ModifyValue(&UF::TransmogOutfitSlotData::SlotOption), AsUnderlyingType(slot.SlotOption));