TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TradePackets.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 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 TradePackets_h__
19 #define TradePackets_h__
20 
21 #include "ItemPackets.h"
22 
23 namespace WorldPackets
24 {
25  namespace Trade
26  {
27  class AcceptTrade final : public ClientPacket
28  {
29  public:
30  AcceptTrade(WorldPacket&& packet) : ClientPacket(CMSG_ACCEPT_TRADE, std::move(packet)) { }
31 
32  void Read() override;
33 
35  };
36 
37  class BeginTrade final : public ClientPacket
38  {
39  public:
40  BeginTrade(WorldPacket&& packet) : ClientPacket(CMSG_BEGIN_TRADE, std::move(packet)) { }
41 
42  void Read() override { }
43  };
44 
45  class BusyTrade final : public ClientPacket
46  {
47  public:
48  BusyTrade(WorldPacket&& packet) : ClientPacket(CMSG_BUSY_TRADE, std::move(packet)) { }
49 
50  void Read() override { }
51  };
52 
53  class CancelTrade final : public ClientPacket
54  {
55  public:
56  CancelTrade(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_TRADE, std::move(packet)) { }
57 
58  void Read() override { }
59  };
60 
61  class ClearTradeItem final : public ClientPacket
62  {
63  public:
65 
66  void Read() override;
67 
69  };
70 
71  class IgnoreTrade final : public ClientPacket
72  {
73  public:
74  IgnoreTrade(WorldPacket&& packet) : ClientPacket(CMSG_IGNORE_TRADE, std::move(packet)) { }
75 
76  void Read() override { }
77  };
78 
79  class InitiateTrade final : public ClientPacket
80  {
81  public:
83 
84  void Read() override;
85 
87  };
88 
89  class SetTradeCurrency final : public ClientPacket
90  {
91  public:
93 
94  void Read() override;
95 
96  uint32 Type = 0;
98  };
99 
100  class SetTradeGold final : public ClientPacket
101  {
102  public:
104 
105  void Read() override;
106 
108  };
109 
110  class SetTradeItem final : public ClientPacket
111  {
112  public:
114 
115  void Read() override;
116 
120  };
121 
122  class UnacceptTrade final : public ClientPacket
123  {
124  public:
126 
127  void Read() override { }
128  };
129 
130  class TradeStatus final : public ServerPacket
131  {
132  public:
133  TradeStatus() : ServerPacket(SMSG_TRADE_STATUS, 1 + 1 + 16 + 4 + 4 + 1 + 4 + 4 + 4 + 1) { }
134 
135  WorldPacket const* Write() override;
136 
143  bool FailureForYou = false;
146  uint32 ID = 0;
148  };
149 
150  class TradeUpdated final : public ServerPacket
151  {
152  public:
154  {
160  bool Lock = false;
164  };
165 
166  struct TradeItem
167  {
168  uint8 Slot = 0;
173  };
174 
175  TradeUpdated() : ServerPacket(SMSG_TRADE_UPDATED, 8 + 4 + 1 + 4 + 7 * sizeof(UnwrappedTradeItem) + 4 + 4 + 4 + 4) { }
176 
177  WorldPacket const* Write() override;
178 
183  std::vector<TradeItem> Items;
185  uint32 ID = 0;
188  };
189  }
190 }
191 
192 #endif // TradePackets_h__
#define MAX_GEM_SOCKETS
Definition: Item.h:195
int32 ProposedEnchantment
Definition: TradePackets.h:186
UnacceptTrade(WorldPacket &&packet)
Definition: TradePackets.h:125
Definition: Opcodes.h:1579
uint32 ID
Definition: TradePackets.h:185
CancelTrade(WorldPacket &&packet)
Definition: TradePackets.h:56
Definition: SharedDefines.h:4650
InitiateTrade(WorldPacket &&packet)
Definition: TradePackets.h:82
uint64 Gold
Definition: TradePackets.h:179
Definition: TradePackets.h:150
uint8 WhichPlayer
Definition: TradePackets.h:181
Definition: TradePackets.h:27
ClearTradeItem(WorldPacket &&packet)
Definition: TradePackets.h:64
void Read() override
Definition: TradePackets.cpp:40
Definition: TradePackets.h:89
BusyTrade(WorldPacket &&packet)
Definition: TradePackets.h:48
Definition: TradePackets.h:45
int32 Charges
Definition: TradePackets.h:159
uint8 TradeSlot
Definition: TradePackets.h:138
void Read() override
Definition: TradePackets.h:50
STL namespace.
uint8 TradeSlot
Definition: TradePackets.h:68
uint64 Coinage
Definition: TradePackets.h:107
ObjectGuid Partner
Definition: TradePackets.h:140
Optional< UnwrappedTradeItem > Unwrapped
Definition: TradePackets.h:172
int32 StackCount
Definition: TradePackets.h:170
ObjectGuid GiftCreator
Definition: TradePackets.h:171
uint8 PackSlot
Definition: TradePackets.h:118
uint32 ItemID
Definition: TradePackets.h:145
Definition: TradePackets.h:79
int32 CurrencyType
Definition: TradePackets.h:184
TradeUpdated()
Definition: TradePackets.h:175
Definition: Opcodes.h:119
Definition: Opcodes.h:1580
void Read() override
Definition: TradePackets.h:127
void Read() override
Definition: TradePackets.h:58
int32 SocketEnchant[MAX_GEM_SOCKETS]
Definition: TradePackets.h:163
BeginTrade(WorldPacket &&packet)
Definition: TradePackets.h:40
int32 CurrencyQuantity
Definition: TradePackets.h:142
Definition: Opcodes.h:216
WorldPacket const * Write() override
Definition: TradePackets.cpp:50
uint8 TradeSlot
Definition: TradePackets.h:117
Definition: Packet.h:59
SetTradeCurrency(WorldPacket &&packet)
Definition: TradePackets.h:92
TradeStatus()
Definition: TradePackets.h:133
Definition: Opcodes.h:109
uint32 MaxDurability
Definition: TradePackets.h:161
Definition: Opcodes.h:640
Definition: Opcodes.h:639
int32 OnUseEnchantmentID
Definition: TradePackets.h:157
Definition: TradePackets.h:100
Definition: Packet.h:46
AcceptTrade(WorldPacket &&packet)
Definition: TradePackets.h:30
uint32 Durability
Definition: TradePackets.h:162
Definition: Opcodes.h:50
WorldPackets::Item::ItemInstance Item
Definition: TradePackets.h:155
SetTradeGold(WorldPacket &&packet)
Definition: TradePackets.h:103
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
Definition: TradePackets.h:71
int32 CurrencyQuantity
Definition: TradePackets.h:187
void Read() override
Definition: TradePackets.cpp:20
boost::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Common.h:170
Definition: TradePackets.h:53
int32 CurrencyType
Definition: TradePackets.h:141
std::vector< TradeItem > Items
Definition: TradePackets.h:183
Definition: Opcodes.h:641
Definition: Opcodes.h:693
ObjectGuid PartnerAccount
Definition: TradePackets.h:139
Definition: TradePackets.h:61
Definition: TradePackets.h:110
Definition: TradePackets.h:166
Definition: TradePackets.h:122
Definition: BattlegroundMgr.h:57
Definition: Opcodes.h:152
uint32 ClientStateIndex
Definition: TradePackets.h:182
Definition: TradePackets.h:130
IgnoreTrade(WorldPacket &&packet)
Definition: TradePackets.h:74
uint32 Quantity
Definition: TradePackets.h:97
int32 EnchantID
Definition: TradePackets.h:156
Definition: Opcodes.h:352
uint8 Slot
Definition: TradePackets.h:168
void Read() override
Definition: TradePackets.cpp:35
Definition: Opcodes.h:349
Definition: TradePackets.h:37
ObjectGuid Creator
Definition: TradePackets.h:158
uint32 StateIndex
Definition: TradePackets.h:34
::TradeStatus Status
Definition: TradePackets.h:137
uint8_t uint8
Definition: Define.h:152
ObjectGuid Guid
Definition: TradePackets.h:86
bool FailureForYou
Definition: TradePackets.h:143
int32 EntryID
Definition: TradePackets.h:169
Definition: ItemPackets.h:40
uint8 ItemSlotInPack
Definition: TradePackets.h:119
Definition: ObjectGuid.h:189
void Read() override
Definition: TradePackets.cpp:45
uint32 CurrentStateIndex
Definition: TradePackets.h:180
int32 BagResult
Definition: TradePackets.h:144
WorldPacket const * Write() override
Definition: TradePackets.cpp:113
Type
Type of JSON value.
Definition: rapidjson.h:642
void Read() override
Definition: TradePackets.h:42
void Read() override
Definition: TradePackets.cpp:30
Definition: WorldPacket.h:26
void Read() override
Definition: TradePackets.cpp:25
bool PartnerIsSameBnetAccount
Definition: TradePackets.h:147
void Read() override
Definition: TradePackets.h:76
SetTradeItem(WorldPacket &&packet)
Definition: TradePackets.h:113
uint32 ID
Definition: TradePackets.h:146