TrinityCore
TradePackets.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
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 TradePackets_h__
19#define TradePackets_h__
20
21#include "Packet.h"
22#include "ItemPacketsCommon.h"
23#include "ObjectGuid.h"
24#include "SharedDefines.h"
25
26namespace WorldPackets
27{
28 namespace Trade
29 {
30 class AcceptTrade final : public ClientPacket
31 {
32 public:
34
35 void Read() override;
36
38 };
39
40 class BeginTrade final : public ClientPacket
41 {
42 public:
43 BeginTrade(WorldPacket&& packet) : ClientPacket(CMSG_BEGIN_TRADE, std::move(packet)) { }
44
45 void Read() override { }
46 };
47
48 class BusyTrade final : public ClientPacket
49 {
50 public:
51 BusyTrade(WorldPacket&& packet) : ClientPacket(CMSG_BUSY_TRADE, std::move(packet)) { }
52
53 void Read() override { }
54 };
55
56 class CancelTrade final : public ClientPacket
57 {
58 public:
60
61 void Read() override { }
62 };
63
64 class ClearTradeItem final : public ClientPacket
65 {
66 public:
68
69 void Read() override;
70
72 };
73
74 class IgnoreTrade final : public ClientPacket
75 {
76 public:
78
79 void Read() override { }
80 };
81
82 class InitiateTrade final : public ClientPacket
83 {
84 public:
86
87 void Read() override;
88
90 };
91
92 class SetTradeCurrency final : public ClientPacket
93 {
94 public:
96
97 void Read() override;
98
101 };
102
103 class SetTradeGold final : public ClientPacket
104 {
105 public:
107
108 void Read() override;
109
111 };
112
113 class SetTradeItem final : public ClientPacket
114 {
115 public:
117
118 void Read() override;
119
123 };
124
125 class UnacceptTrade final : public ClientPacket
126 {
127 public:
129
130 void Read() override { }
131 };
132
133 class TradeStatus final : public ServerPacket
134 {
135 public:
136 TradeStatus() : ServerPacket(SMSG_TRADE_STATUS, 1 + 1 + 16 + 4 + 4 + 1 + 4 + 4 + 4 + 1) { }
137
138 WorldPacket const* Write() override;
139
146 bool FailureForYou = false;
151 };
152
154 {
160 bool Lock = false;
163 std::vector<Item::ItemGemData> Gems;
164 };
165
167 {
173 };
174
175 class TradeUpdated final : public ServerPacket
176 {
177 public:
178 TradeUpdated() : ServerPacket(SMSG_TRADE_UPDATED, 8 + 4 + 1 + 4 + 7 * sizeof(UnwrappedTradeItem) + 4 + 4 + 4 + 4) { }
179
180 WorldPacket const* Write() override;
181
186 std::vector<TradeItem> Items;
191 };
192 }
193}
194
195#endif // TradePackets_h__
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint32_t uint32
Definition: Define.h:142
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
TradeStatus
@ TRADE_STATUS_INITIATED
AcceptTrade(WorldPacket &&packet)
Definition: TradePackets.h:33
BeginTrade(WorldPacket &&packet)
Definition: TradePackets.h:43
BusyTrade(WorldPacket &&packet)
Definition: TradePackets.h:51
CancelTrade(WorldPacket &&packet)
Definition: TradePackets.h:59
ClearTradeItem(WorldPacket &&packet)
Definition: TradePackets.h:67
IgnoreTrade(WorldPacket &&packet)
Definition: TradePackets.h:77
InitiateTrade(WorldPacket &&packet)
Definition: TradePackets.h:85
SetTradeCurrency(WorldPacket &&packet)
Definition: TradePackets.h:95
SetTradeGold(WorldPacket &&packet)
Definition: TradePackets.h:106
SetTradeItem(WorldPacket &&packet)
Definition: TradePackets.h:116
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< TradeItem > Items
Definition: TradePackets.h:186
UnacceptTrade(WorldPacket &&packet)
Definition: TradePackets.h:128
@ CMSG_ACCEPT_TRADE
Definition: Opcodes.h:51
@ CMSG_UNACCEPT_TRADE
Definition: Opcodes.h:864
@ CMSG_SET_TRADE_GOLD
Definition: Opcodes.h:802
@ CMSG_CANCEL_TRADE
Definition: Opcodes.h:180
@ CMSG_CLEAR_TRADE_ITEM
Definition: Opcodes.h:248
@ CMSG_BUSY_TRADE
Definition: Opcodes.h:149
@ CMSG_SET_TRADE_ITEM
Definition: Opcodes.h:803
@ CMSG_SET_TRADE_CURRENCY
Definition: Opcodes.h:801
@ CMSG_BEGIN_TRADE
Definition: Opcodes.h:142
@ CMSG_IGNORE_TRADE
Definition: Opcodes.h:437
@ CMSG_INITIATE_TRADE
Definition: Opcodes.h:439
@ SMSG_TRADE_STATUS
Definition: Opcodes.h:2005
@ SMSG_TRADE_UPDATED
Definition: Opcodes.h:2006
STL namespace.
Optional< UnwrappedTradeItem > Unwrapped
Definition: TradePackets.h:172
WorldPackets::Item::ItemInstance Item
Definition: TradePackets.h:155
std::vector< Item::ItemGemData > Gems
Definition: TradePackets.h:163