Skip to content

Commit 714e2f0

Browse files
DDuarteShauren
authored andcommitted
Core/Packets: CMSG_CANCEL_TRADE handler
(cherry picked from commit 4552e6a)
1 parent 1e7dfad commit 714e2f0

4 files changed

Lines changed: 46 additions & 2 deletions

File tree

src/server/game/Handlers/TradeHandler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "SpellMgr.h"
2929
#include "SocialMgr.h"
3030
#include "TradeData.h"
31+
#include "TradePackets.h"
3132
#include "World.h"
3233
#include "WorldPacket.h"
3334

@@ -578,7 +579,7 @@ void WorldSession::SendCancelTrade(TradeStatus status)
578579
SendTradeStatus(info);
579580
}
580581

581-
void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
582+
void WorldSession::HandleCancelTradeOpcode(WorldPackets::Trade::CancelTrade& /*cancelTrade*/)
582583
{
583584
// sended also after LOGOUT COMPLETE
584585
if (_player) // needed because STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT

src/server/game/Server/Packets/AllPackets.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "SystemPackets.h"
4141
#include "TalentPackets.h"
4242
#include "TotemPackets.h"
43+
#include "TradePackets.h"
4344
#include "WorldStatePackets.h"
4445

4546
#endif // AllPackets_h__
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
3+
*
4+
* This program is free software; you can redistribute it and/or modify it
5+
* under the terms of the GNU General Public License as published by the
6+
* Free Software Foundation; either version 2 of the License, or (at your
7+
* option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+
* more details.
13+
*
14+
* You should have received a copy of the GNU General Public License along
15+
* with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#ifndef TRINITYCORE_TRADE_PACKETS_H
19+
#define TRINITYCORE_TRADE_PACKETS_H
20+
21+
#include "Packet.h"
22+
23+
namespace WorldPackets
24+
{
25+
namespace Trade
26+
{
27+
class CancelTrade final : public ClientPacket
28+
{
29+
public:
30+
explicit CancelTrade(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_TRADE, std::move(packet)) { }
31+
32+
void Read() override { }
33+
};
34+
}
35+
}
36+
37+
#endif // TRINITYCORE_TRADE_PACKETS_H

src/server/game/Server/WorldSession.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ namespace WorldPackets
271271
{
272272
class TotemDestroyed;
273273
}
274+
275+
namespace Trade
276+
{
277+
class CancelTrade;
278+
}
274279
}
275280

276281
enum AccountDataType
@@ -899,7 +904,7 @@ class TC_GAME_API WorldSession
899904
void HandleAcceptTradeOpcode(WorldPacket& recvPacket);
900905
void HandleBeginTradeOpcode(WorldPacket& recvPacket);
901906
void HandleBusyTradeOpcode(WorldPacket& recvPacket);
902-
void HandleCancelTradeOpcode(WorldPacket& recvPacket);
907+
void HandleCancelTradeOpcode(WorldPackets::Trade::CancelTrade& cancelTrade);
903908
void HandleClearTradeItemOpcode(WorldPacket& recvPacket);
904909
void HandleIgnoreTradeOpcode(WorldPacket& recvPacket);
905910
void HandleInitiateTradeOpcode(WorldPacket& recvPacket);

0 commit comments

Comments
 (0)