Okay finally merchant buying works -.-

This commit is contained in:
KimLS
2015-04-07 16:28:28 -07:00
parent 7341ecc185
commit 56e7d1b0dc
5 changed files with 31 additions and 14 deletions
+3 -1
View File
@@ -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<EQEmu::ItemInstance> inst, bool client_update = false);
//
// class Client::TextLink
+5 -7
View File
@@ -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);
+21
View File
@@ -3353,3 +3353,24 @@ bool Client::SummonItem(uint32 item_id,
return res;
}
bool Client::PutItemInInventory(const EQEmu::InventorySlot &slot, std::shared_ptr<EQEmu::ItemInstance> 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();
}