From 05b3c8972928c6c4a1bafd7f7fa226a2b50e6743 Mon Sep 17 00:00:00 2001 From: Trust Date: Wed, 13 Nov 2019 22:51:33 +0000 Subject: [PATCH 1/3] Mobs will not trade anymore if they are currently in combat. --- zone/client_packet.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0bb319a20..24e1d35c9 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -14099,16 +14099,25 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) #else else if (tradee && (tradee->IsNPC() || tradee->IsBot())) { #endif - //npcs always accept - trade->Start(msg->to_mob_id); + // If the NPC is engaged, we cannot trade with it. + // Note that this work as intended, if the NPC is charmed + // you can still trade with it. + if (tradee->IsEngaged()) { + Message(0, "Your target cannot trade with you at this moment."); + } + // If it not engaged, it will automatically accept the trade. + else { + //npcs always accept + trade->Start(msg->to_mob_id); - auto outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct)); - TradeRequest_Struct* acc = (TradeRequest_Struct*)outapp->pBuffer; - acc->from_mob_id = msg->to_mob_id; - acc->to_mob_id = msg->from_mob_id; - FastQueuePacket(&outapp); - safe_delete(outapp); - } + EQApplicationPacket *outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct)); + TradeRequest_Struct *acc = (TradeRequest_Struct *) outapp->pBuffer; + acc->from_mob_id = msg->to_mob_id; + acc->to_mob_id = msg->from_mob_id; + FastQueuePacket(&outapp); + safe_delete(outapp); + } + } return; } From 0fcaf82038937f958543d3e3913c23c49553104b Mon Sep 17 00:00:00 2001 From: Trust Date: Wed, 13 Nov 2019 23:46:36 +0000 Subject: [PATCH 2/3] Per comment, removing message and simplified. --- zone/client_packet.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 24e1d35c9..03b6a9c58 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -14099,17 +14099,8 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) #else else if (tradee && (tradee->IsNPC() || tradee->IsBot())) { #endif - // If the NPC is engaged, we cannot trade with it. - // Note that this work as intended, if the NPC is charmed - // you can still trade with it. - if (tradee->IsEngaged()) { - Message(0, "Your target cannot trade with you at this moment."); - } - // If it not engaged, it will automatically accept the trade. - else { - //npcs always accept + if (tradee->!IsEngaged()) { trade->Start(msg->to_mob_id); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct)); TradeRequest_Struct *acc = (TradeRequest_Struct *) outapp->pBuffer; acc->from_mob_id = msg->to_mob_id; From b567e57971a8e0240bc5d5e676512dc4d68a7b6f Mon Sep 17 00:00:00 2001 From: Trust Date: Thu, 14 Nov 2019 02:15:35 +0000 Subject: [PATCH 3/3] Fixed incorrect logic --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 03b6a9c58..4b9fce1b3 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -14099,7 +14099,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) #else else if (tradee && (tradee->IsNPC() || tradee->IsBot())) { #endif - if (tradee->!IsEngaged()) { + if (!tradee->IsEngaged()) { trade->Start(msg->to_mob_id); EQApplicationPacket *outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct)); TradeRequest_Struct *acc = (TradeRequest_Struct *) outapp->pBuffer;