TrinityCore
Loading...
Searching...
No Matches
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 TRINITYCORE_TRADE_PACKETS_H
19#define TRINITYCORE_TRADE_PACKETS_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:
33 explicit AcceptTrade(WorldPacket&& packet) : ClientPacket(CMSG_ACCEPT_TRADE, std::move(packet)) { }
34
35 void Read() override;
36
38 };
39
40 class BeginTrade final : public ClientPacket
41 {
42 public:
43 explicit 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 explicit 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:
59 explicit CancelTrade(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_TRADE, std::move(packet)) { }
60
61 void Read() override { }
62 };
63
64 class ClearTradeItem final : public ClientPacket
65 {
66 public:
67 explicit ClearTradeItem(WorldPacket&& packet) : ClientPacket(CMSG_CLEAR_TRADE_ITEM, std::move(packet)) { }
68
69 void Read() override;
70
72 };
73
74 class IgnoreTrade final : public ClientPacket
75 {
76 public:
77 explicit IgnoreTrade(WorldPacket&& packet) : ClientPacket(CMSG_IGNORE_TRADE, std::move(packet)) { }
78
79 void Read() override { }
80 };
81
82 class InitiateTrade final : public ClientPacket
83 {
84 public:
85 explicit InitiateTrade(WorldPacket&& packet) : ClientPacket(CMSG_INITIATE_TRADE, std::move(packet)) { }
86
87 void Read() override;
88
90 };
91
92 class SetTradeCurrency final : public ClientPacket
93 {
94 public:
95 explicit SetTradeCurrency(WorldPacket&& packet) : ClientPacket(CMSG_SET_TRADE_CURRENCY, std::move(packet)) { }
96
97 void Read() override;
98
101 };
102
103 class SetTradeGold final : public ClientPacket
104 {
105 public:
106 explicit SetTradeGold(WorldPacket&& packet) : ClientPacket(CMSG_SET_TRADE_GOLD, std::move(packet)) { }
107
108 void Read() override;
109
111 };
112
113 class SetTradeItem final : public ClientPacket
114 {
115 public:
116 explicit SetTradeItem(WorldPacket&& packet) : ClientPacket(CMSG_SET_TRADE_ITEM, std::move(packet)) { }
117
118 void Read() override;
119
123 };
124
125 class UnacceptTrade final : public ClientPacket
126 {
127 public:
128 explicit UnacceptTrade(WorldPacket&& packet) : ClientPacket(CMSG_UNACCEPT_TRADE, std::move(packet)) { }
129
130 void Read() override { }
131 };
132
133 class TradeStatus final : public ServerPacket
134 {
135 public:
136 explicit 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
164
173
174 class TradeUpdated final : public ServerPacket
175 {
176 public:
177 explicit TradeUpdated() : ServerPacket(SMSG_TRADE_UPDATED, 8 + 4 + 1 + 4 + 7 * sizeof(UnwrappedTradeItem) + 4 + 4 + 4 + 4) { }
178
179 WorldPacket const* Write() override;
180
185 std::vector<TradeItem> Items;
190 };
191 }
192}
193
194#endif // TRINITYCORE_TRADE_PACKETS_H
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
@ SMSG_TRADE_STATUS
Definition Opcodes.h:2386
@ SMSG_TRADE_UPDATED
Definition Opcodes.h:2387
@ CMSG_ACCEPT_TRADE
Definition Opcodes.h:42
@ CMSG_UNACCEPT_TRADE
Definition Opcodes.h:1010
@ CMSG_SET_TRADE_GOLD
Definition Opcodes.h:939
@ CMSG_CANCEL_TRADE
Definition Opcodes.h:174
@ CMSG_CLEAR_TRADE_ITEM
Definition Opcodes.h:249
@ CMSG_BUSY_TRADE
Definition Opcodes.h:144
@ CMSG_SET_TRADE_ITEM
Definition Opcodes.h:940
@ CMSG_SET_TRADE_CURRENCY
Definition Opcodes.h:938
@ CMSG_BEGIN_TRADE
Definition Opcodes.h:135
@ CMSG_IGNORE_TRADE
Definition Opcodes.h:505
@ CMSG_INITIATE_TRADE
Definition Opcodes.h:507
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
TradeStatus
@ TRADE_STATUS_INITIATED
AcceptTrade(WorldPacket &&packet)
BeginTrade(WorldPacket &&packet)
BusyTrade(WorldPacket &&packet)
CancelTrade(WorldPacket &&packet)
ClearTradeItem(WorldPacket &&packet)
IgnoreTrade(WorldPacket &&packet)
InitiateTrade(WorldPacket &&packet)
SetTradeCurrency(WorldPacket &&packet)
SetTradeGold(WorldPacket &&packet)
SetTradeItem(WorldPacket &&packet)
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< TradeItem > Items
UnacceptTrade(WorldPacket &&packet)
STL namespace.
Optional< UnwrappedTradeItem > Unwrapped
std::vector< Item::ItemGemData > Gems