diff --git a/zone/client.h b/zone/client.h index 7deab6e83..0bbee8af4 100644 --- a/zone/client.h +++ b/zone/client.h @@ -443,6 +443,8 @@ public: int64 ValidateBuyLineCost(std::map& 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(); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 5e3ededed..ee8d8777f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -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; diff --git a/zone/trading.cpp b/zone/trading.cpp index ec81bb273..f3aa0a55f 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -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(end_session->pBuffer); + data->action = Barter_BuyerInspectBegin; + + FastQueuePacket(&end_session); +} + +void Client::CancelTraderTradeWindow() +{ + auto end_session = new EQApplicationPacket(OP_ShopEnd); + FastQueuePacket(&end_session); +} diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 46e719e9f..ec83fa556 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -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(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;