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,6 +4607,9 @@ void Client::SummonItemIntoInventory(
return; return;
} }
// Try stacking first if the item is stackable, then fall back to finding a free slot
if (!PutItemInInventoryWithStacking(inst)) {
// PutItemInInventoryWithStacking failed, fall back to original behavior
const bool is_arrow = inst->GetItem()->ItemType == EQ::item::ItemTypeArrow; const bool is_arrow = inst->GetItem()->ItemType == EQ::item::ItemTypeArrow;
const int16 slot_id = m_inv.FindFreeSlot( const int16 slot_id = m_inv.FindFreeSlot(
inst->IsClassBag(), inst->IsClassBag(),
@ -4629,6 +4632,9 @@ void Client::SummonItemIntoInventory(
); );
} }
safe_delete(inst);
}
bool Client::HasItemOnCorpse(uint32 item_id) bool Client::HasItemOnCorpse(uint32 item_id)
{ {
auto corpses = CharacterCorpsesRepository::GetWhere(database, fmt::format("charid = {}", CharacterID())); auto corpses = CharacterCorpsesRepository::GetWhere(database, fmt::format("charid = {}", CharacterID()));