mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Fix] Add check for simultaneous direct vendor and parcel Trader/Buyer Purchase (#4778)
This commit is contained in:
parent
3c2545cfaf
commit
e93785f885
@ -443,6 +443,8 @@ public:
|
||||
int64 ValidateBuyLineCost(std::map<uint32, BuylineItemDetails_Struct>& item_map);
|
||||
bool DoBarterBuyerChecks(BuyerLineSellItem_Struct& sell_line);
|
||||
bool DoBarterSellerChecks(BuyerLineSellItem_Struct& sell_line);
|
||||
void CancelBuyerTradeWindow();
|
||||
void CancelTraderTradeWindow();
|
||||
|
||||
void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
|
||||
bool ShouldISpawnFor(Client *c) { return !GMHideMe(c) && !IsHoveringForRespawn(); }
|
||||
|
||||
@ -15463,7 +15463,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app)
|
||||
);
|
||||
Message(
|
||||
Chat::Yellow,
|
||||
"Direct inventory delivey is not yet implemented. Please visit the vendor directly or purchase via parcel delivery."
|
||||
"Direct inventory delivery is not yet implemented. Please visit the vendor directly or purchase via parcel delivery."
|
||||
);
|
||||
in->method = BazaarByDirectToInventory;
|
||||
in->sub_action = Failed;
|
||||
|
||||
@ -1894,6 +1894,13 @@ void Client::SellToBuyer(const EQApplicationPacket *app)
|
||||
break;
|
||||
}
|
||||
|
||||
if (sell_line.purchase_method == BarterInBazaar && buyer->IsThereACustomer()) {
|
||||
auto customer = entity_list.GetClientByID(buyer->GetCustomerID());
|
||||
if (customer) {
|
||||
customer->CancelBuyerTradeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
if (!DoBarterBuyerChecks(sell_line)) {
|
||||
return;
|
||||
};
|
||||
@ -3825,3 +3832,18 @@ bool Client::DoBarterSellerChecks(BuyerLineSellItem_Struct &sell_line)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Client::CancelBuyerTradeWindow()
|
||||
{
|
||||
auto end_session = new EQApplicationPacket(OP_Barter, sizeof(BuyerRemoveItemFromMerchantWindow_Struct));
|
||||
auto data = reinterpret_cast<BuyerRemoveItemFromMerchantWindow_Struct *>(end_session->pBuffer);
|
||||
data->action = Barter_BuyerInspectBegin;
|
||||
|
||||
FastQueuePacket(&end_session);
|
||||
}
|
||||
|
||||
void Client::CancelTraderTradeWindow()
|
||||
{
|
||||
auto end_session = new EQApplicationPacket(OP_ShopEnd);
|
||||
FastQueuePacket(&end_session);
|
||||
}
|
||||
|
||||
@ -3786,6 +3786,13 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
return;
|
||||
}
|
||||
|
||||
if (trader_pc->IsThereACustomer()) {
|
||||
auto customer = entity_list.GetClientByID(trader_pc->GetCustomerID());
|
||||
if (customer) {
|
||||
customer->CancelTraderTradeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
auto item_sn = Strings::ToUnsignedBigInt(in->trader_buy_struct.serial_number);
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_Trader, sizeof(TraderBuy_Struct));
|
||||
auto data = (TraderBuy_Struct *) outapp->pBuffer;
|
||||
@ -3981,6 +3988,12 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
worldserver.SendPacket(pack);
|
||||
return;
|
||||
}
|
||||
if (buyer->IsThereACustomer()) {
|
||||
auto customer = entity_list.GetClientByID(buyer->GetCustomerID());
|
||||
if (customer) {
|
||||
customer->CancelBuyerTradeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
BuyerLineSellItem_Struct sell_line{};
|
||||
sell_line.item_id = in->buy_item_id;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user