TrinityCore
Loading...
Searching...
No Matches
MailPackets.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 MailPackets_h__
19#define MailPackets_h__
20
21#include "Packet.h"
22#include "ItemDefines.h"
23#include "Mail.h"
24#include "Optional.h"
25#include "PacketUtilities.h"
26
27namespace WorldPackets
28{
29 namespace Mail
30 {
32 {
33 MailAttachedItem(::Item const* item, uint8 pos);
34
35 static constexpr std::size_t GetPacketSize()
36 {
37 return sizeof(uint8) + sizeof(int32) + sizeof(int32) + MAX_INSPECTED_ENCHANTMENT_SLOT * (sizeof(int32) + sizeof(int32) + sizeof(int32))
38 + sizeof(int32) + sizeof(int32) + sizeof(int32) + sizeof(int32) + sizeof(uint32) + sizeof(int32) + sizeof(bool);
39 }
40
50 bool Unlocked = false;
51 std::array<uint32, MAX_INSPECTED_ENCHANTMENT_SLOT> EnchantmentID = { };
52 std::array<uint32, MAX_INSPECTED_ENCHANTMENT_SLOT> EnchantmentDuration = { };
53 std::array<uint32, MAX_INSPECTED_ENCHANTMENT_SLOT> EnchantmentCharges = { };
54 };
55
57 {
58 MailListEntry(::Mail const* mail, ::Player* player);
59
60 std::size_t GetPacketSize() const;
61
71 float DaysLeft = 0.0f;
73 std::string_view Subject;
74 std::string_view Body;
75 std::vector<MailAttachedItem> Attachments;
76 };
77
79 {
80 public:
82
83 void Read() override;
84
86 };
87
89 {
90 public:
92
93 WorldPacket const* Write() override;
94
95 void AddMail(::Mail const* mail, Player* player);
96
98 std::vector<MailListEntry> Mails;
99
100 private:
102 };
103
114
143
158
170
172 {
173 public:
175
176 void Read() override;
177
180 };
181
183 {
184 public:
186
187 void Read() override;
188
192 };
193
195 {
196 public:
198
199 void Read() override;
200
204 };
205
207 {
208 public:
210
211 void Read() override;
212
215 };
216
218 {
219 public:
221
222 void Read() override { }
223 };
224
226 {
227 public:
238
240
241 WorldPacket const* Write() override;
242
243 float NextMailTime = 0.0f;
244 std::vector<MailNextTimeEntry> Next;
245 };
246
248 {
249 public:
251
252 WorldPacket const* Write() override;
253
254 float Delay = 0.0f;
255 };
256
258 {
259 public:
261
262 WorldPacket const* Write() override;
263
265 };
266 }
267}
268
269#endif // MailPackets_h__
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ MAX_INSPECTED_ENCHANTMENT_SLOT
Definition Item.h:62
WorldPacket const * Write() override
MailCreateTextItem(WorldPacket &&packet)
MailDelete(WorldPacket &&packet)
MailGetList(WorldPacket &&packet)
Definition MailPackets.h:81
WorldPacket const * Write() override
std::vector< MailListEntry > Mails
Definition MailPackets.h:98
void AddMail(::Mail const *mail, Player *player)
MailMarkAsRead(WorldPacket &&packet)
MailQueryNextMailTime(WorldPacket &&packet)
WorldPacket const * Write() override
std::vector< MailNextTimeEntry > Next
MailReturnToSender(WorldPacket &&packet)
MailTakeItem(WorldPacket &&packet)
MailTakeMoney(WorldPacket &&packet)
WorldPacket const * Write() override
SendMail(WorldPacket &&packet)
WorldPacket const * Write() override
@ CMSG_SEND_MAIL
Definition Opcodes.h:597
@ CMSG_MAIL_TAKE_MONEY
Definition Opcodes.h:610
@ SMSG_RECEIVED_MAIL
Definition Opcodes.h:674
@ CMSG_MAIL_CREATE_TEXT_ITEM
Definition Opcodes.h:615
@ CMSG_MAIL_MARK_AS_READ
Definition Opcodes.h:612
@ CMSG_MAIL_DELETE
Definition Opcodes.h:614
@ CMSG_MAIL_TAKE_ITEM
Definition Opcodes.h:611
@ CMSG_MAIL_RETURN_TO_SENDER
Definition Opcodes.h:613
@ SMSG_SHOW_MAILBOX
Definition Opcodes.h:692
@ MSG_QUERY_NEXT_MAIL_TIME
Definition Opcodes.h:673
@ SMSG_SEND_MAIL_RESULT
Definition Opcodes.h:598
@ CMSG_GET_MAIL_LIST
Definition Opcodes.h:599
STL namespace.
Definition Mail.h:167
std::array< uint32, MAX_INSPECTED_ENCHANTMENT_SLOT > EnchantmentID
Definition MailPackets.h:51
static constexpr std::size_t GetPacketSize()
Definition MailPackets.h:35
std::array< uint32, MAX_INSPECTED_ENCHANTMENT_SLOT > EnchantmentCharges
Definition MailPackets.h:53
std::array< uint32, MAX_INSPECTED_ENCHANTMENT_SLOT > EnchantmentDuration
Definition MailPackets.h:52
Optional< ObjectGuid > SenderCharacter
Definition MailPackets.h:64
std::vector< MailAttachedItem > Attachments
Definition MailPackets.h:75
String< 255, Strings::NoHyperlinks > Subject
String< 7999, Strings::NoHyperlinks > Body
Array< MailAttachment, MAX_MAIL_ITEMS > Attachments