Enhance SummonItemIntoInventory to support stacking

Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-08-28 22:50:26 +00:00
parent 85d84bff75
commit a62aba3fc3

View File

@ -4607,26 +4607,32 @@ void Client::SummonItemIntoInventory(
return; return;
} }
const bool is_arrow = inst->GetItem()->ItemType == EQ::item::ItemTypeArrow; // Try stacking first if the item is stackable, then fall back to finding a free slot
const int16 slot_id = m_inv.FindFreeSlot( if (!PutItemInInventoryWithStacking(inst)) {
inst->IsClassBag(), // PutItemInInventoryWithStacking failed, fall back to original behavior
true, const bool is_arrow = inst->GetItem()->ItemType == EQ::item::ItemTypeArrow;
inst->GetItem()->Size, const int16 slot_id = m_inv.FindFreeSlot(
is_arrow inst->IsClassBag(),
); true,
inst->GetItem()->Size,
is_arrow
);
SummonItem( SummonItem(
item_id, item_id,
charges, charges,
aug1, aug1,
aug2, aug2,
aug3, aug3,
aug4, aug4,
aug5, aug5,
aug6, aug6,
is_attuned, is_attuned,
slot_id slot_id
); );
}
safe_delete(inst);
} }
bool Client::HasItemOnCorpse(uint32 item_id) bool Client::HasItemOnCorpse(uint32 item_id)