mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-09 22:20:24 +00:00
[Bug] Item Purchase Offset when multiple buyers are buying at the same time. (#4628)
* [Bug] Item Purchase Offset when multiple buyers are buying at the same time. - Much of the code lifted from TAKP/P2002 and adapted - Needs Testing - This should help prevent situations where multiple people are purchasing items from a merchant and both attempt to purchase the same temp merchant or limited item, it should result in the later person recieving a notice that the item no longer exists and refreshes the merchant table. - Updated strings * fix formatting * Push * Update client.cpp * Update database_update_manifest.cpp * Update database_update_manifest.cpp * Update database_update_manifest.cpp * Update client.cpp --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com> Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
@@ -5950,3 +5950,53 @@ std::vector<NPC*> EntityList::GetExcludedNPCsByIDs(std::vector<uint32> npc_ids)
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
void EntityList::SendMerchantEnd(Mob* merchant)
|
||||
{
|
||||
for (const auto& e : client_list) {
|
||||
Client* c = e.second;
|
||||
|
||||
if (!c) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c->GetMerchantSessionEntityID() == merchant->GetID()) {
|
||||
c->SendMerchantEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::SendMerchantInventory(Mob* m, int32 slot_id, bool is_delete)
|
||||
{
|
||||
if (!m || !m->IsNPC()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& e : client_list) {
|
||||
Client* c = e.second;
|
||||
|
||||
if (!c) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c->GetMerchantSessionEntityID() == m->GetID()) {
|
||||
if (!is_delete) {
|
||||
c->BulkSendMerchantInventory(m->CastToNPC()->MerchantType, m->GetNPCTypeID());
|
||||
} else {
|
||||
auto app = new EQApplicationPacket(OP_ShopDelItem, sizeof(Merchant_DelItem_Struct));
|
||||
auto d = (Merchant_DelItem_Struct*)app->pBuffer;
|
||||
|
||||
d->itemslot = slot_id;
|
||||
d->npcid = m->GetID();
|
||||
d->playerid = c->GetID();
|
||||
|
||||
app->priority = 6;
|
||||
|
||||
c->QueuePacket(app);
|
||||
safe_delete(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user