diff --git a/common/patches/larion.cpp b/common/patches/larion.cpp index 7a2443296..4125c990b 100644 --- a/common/patches/larion.cpp +++ b/common/patches/larion.cpp @@ -3441,8 +3441,42 @@ namespace Larion buffer.WriteInt8(0); //u32 SubContentSize; + uint32 subitem_count = 0; - //SubItems + int16 SubSlotNumber = EQ::invbag::SLOT_INVALID; + + if (slot_id_in <= EQ::invslot::GENERAL_END && slot_id_in >= EQ::invslot::GENERAL_BEGIN) + SubSlotNumber = EQ::invbag::GENERAL_BAGS_BEGIN + ((slot_id_in - EQ::invslot::GENERAL_BEGIN) * EQ::invbag::SLOT_COUNT); + else if (slot_id_in == EQ::invslot::slotCursor) + SubSlotNumber = EQ::invbag::CURSOR_BAG_BEGIN; + else if (slot_id_in <= EQ::invslot::BANK_END && slot_id_in >= EQ::invslot::BANK_BEGIN) + SubSlotNumber = EQ::invbag::BANK_BAGS_BEGIN + ((slot_id_in - EQ::invslot::BANK_BEGIN) * EQ::invbag::SLOT_COUNT); + else if (slot_id_in <= EQ::invslot::SHARED_BANK_END && slot_id_in >= EQ::invslot::SHARED_BANK_BEGIN) + SubSlotNumber = EQ::invbag::SHARED_BANK_BAGS_BEGIN + ((slot_id_in - EQ::invslot::SHARED_BANK_BEGIN) * EQ::invbag::SLOT_COUNT); + else + SubSlotNumber = slot_id_in; // not sure if this is the best way to handle this..leaving for now + + if (SubSlotNumber != EQ::invbag::SLOT_INVALID) { + for (uint32 index = EQ::invbag::SLOT_BEGIN; index <= EQ::invbag::SLOT_END; ++index) { + EQ::ItemInstance* sub = inst->GetItem(index); + if (!sub) + continue; + + ++subitem_count; + } + + buffer.WriteUInt32(subitem_count); + + for (uint32 index = EQ::invbag::SLOT_BEGIN; index <= EQ::invbag::SLOT_END; ++index) { + EQ::ItemInstance* sub = inst->GetItem(index); + if (!sub) + continue; + + buffer.WriteUInt32(index); + + SerializeItem(buffer, sub, SubSlotNumber, (depth + 1), packet_type); + } + } //bool bCollected; buffer.WriteInt8(0); //unsupported atm