diff --git a/common/inventory.cpp b/common/inventory.cpp index 2c10c84ba..1451bcef5 100644 --- a/common/inventory.cpp +++ b/common/inventory.cpp @@ -506,10 +506,6 @@ bool EQEmu::Inventory::PopFromCursorBuffer() { return false; } -EQEmu::InventorySlot EQEmu::Inventory::PutItemInInventory(std::shared_ptr inst, bool try_worn, bool try_cursor) { - return EQEmu::InventorySlot(); -} - EQEmu::InventorySlot EQEmu::Inventory::FindFreeSlot(bool for_bag, bool try_cursor, int min_size, bool is_arrow) { //check basic inventory for(int i = EQEmu::PersonalSlotGeneral1; i < EQEmu::PersonalSlotGeneral10; ++i) { diff --git a/common/inventory.h b/common/inventory.h index 2562c1f21..c3d7d11e9 100644 --- a/common/inventory.h +++ b/common/inventory.h @@ -34,7 +34,8 @@ namespace EQEmu InvTypeCursorBuffer, InvTypeTribute, InvTypeTrophyTribute, - InvTypeGuildTribute + InvTypeGuildTribute, + InvTypeMerchant }; enum PersonaInventorySlot : int @@ -139,7 +140,6 @@ namespace EQEmu bool Summon(const InventorySlot &slot, std::shared_ptr inst); bool PushToCursorBuffer(std::shared_ptr inst); bool PopFromCursorBuffer(); - InventorySlot PutItemInInventory(std::shared_ptr inst, bool try_worn, bool try_cursor); InventorySlot FindFreeSlot(bool for_bag, bool try_cursor, int min_size = 0, bool is_arrow = false); //utility diff --git a/zone/client.h b/zone/client.h index 0b188dd64..54cf45f12 100644 --- a/zone/client.h +++ b/zone/client.h @@ -827,7 +827,8 @@ public: void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); - //New Inventory + //inv2: New Inventory methods, will probably move these to Mob in a future update as there's + //little reason for them to be in client except for simplicity of implementation atm bool SwapItem(const EQEmu::InventorySlot &src, const EQEmu::InventorySlot &dest, int number_in_stack); bool SummonItem(uint32 item_id, int16 charges, @@ -842,6 +843,7 @@ public: uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); + bool PutItemInInventory(const EQEmu::InventorySlot &slot, std::shared_ptr inst, bool client_update = false); // // class Client::TextLink diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f22958575..697a693ba 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12075,11 +12075,9 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) } if(free_slot.IsCursor()) { - if(m_inventory.Get(EQEmu::InventorySlot(EQEmu::InvTypePersonal, EQEmu::PersonalSlotCursor))) { - Message(13, "You do not have room for any more items."); - safe_delete(outapp); - return; - } + Message(13, "You do not have room for any more items."); + safe_delete(outapp); + return; } if(!stacked && !free_slot.IsValid()) @@ -12091,7 +12089,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) std::string packet; if(!stacked && inst) { - //PutItemInInventory(free_slot, inst); + PutItemInInventory(free_slot, inst); SendItemPacket(free_slot, inst, ItemPacketTrade); } else if (!stacked){ @@ -12119,7 +12117,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) inst->SetMerchantSlot(mp->itemslot); inst->SetMerchantCount(new_charges); - //SendItemPacket(mp->itemslot, inst, ItemPacketMerchant); + SendItemPacket(EQEmu::InventorySlot(EQEmu::InvTypeMerchant, mp->itemslot), inst, ItemPacketMerchant); } } safe_delete(outapp); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index e3db7047b..95f0f267d 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -3353,3 +3353,24 @@ bool Client::SummonItem(uint32 item_id, return res; } + +bool Client::PutItemInInventory(const EQEmu::InventorySlot &slot, std::shared_ptr inst, bool client_update) { + if(!inst) + return false; + + if(!slot.IsValid()) { + return false; + } + + Log.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %s", inst->GetBaseItem()->Name, inst->GetBaseItem()->ID, slot.ToString().c_str()); + + if(!m_inventory.Summon(slot, inst)) { + return false; + } + + if(client_update) { + SendItemPacket(slot, inst, slot.IsCursor() ? ItemPacketSummonItem : ItemPacketTrade); + } + + CalcBonuses(); +}