TrinityCore
Loading...
Searching...
No Matches
ToyPackets.cpp
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
#include "
ToyPackets.h
"
19
#include "
PacketOperators.h
"
20
21
namespace
WorldPackets::Toy
22
{
23
void
AddToy::Read
()
24
{
25
_worldPacket
>>
Guid
;
26
}
27
28
void
UseToy::Read
()
29
{
30
_worldPacket
>>
Cast
;
31
}
32
33
WorldPacket
const
*
AccountToyUpdate::Write
()
34
{
35
_worldPacket << Bits<1>(
IsFullUpdate
);
36
_worldPacket
.
FlushBits
();
37
38
// all lists have to have the same size
39
_worldPacket << Size<uint32>(*
Toys
);
// ids
40
_worldPacket << Size<uint32>(*
Toys
);
// favorites
41
_worldPacket << Size<uint32>(*
Toys
);
// fanfare
42
43
for
(
auto
const
& [itemId, _] : *
Toys
)
44
_worldPacket
<<
uint32
(itemId);
45
46
for
(
auto
const
& [_,
flags
] : *
Toys
)
47
_worldPacket
<< Bits<1>(
flags
.HasFlag(
ToyFlags::Favorite
));
48
49
for
(
auto
const
& [_,
flags
] : *
Toys
)
50
_worldPacket
<< Bits<1>(
flags
.HasFlag(
ToyFlags::HasFanfare
));
51
52
_worldPacket
.
FlushBits
();
53
54
return
&
_worldPacket
;
55
}
56
57
void
ToyClearFanfare::Read
()
58
{
59
_worldPacket
>>
ItemID
;
60
}
61
}
ToyFlags::Favorite
@ Favorite
ToyFlags::HasFanfare
@ HasFanfare
uint32
uint32_t uint32
Definition
Define.h:154
flags
uint16 flags
Definition
DisableMgr.cpp:49
PacketOperators.h
ToyPackets.h
ByteBuffer::FlushBits
void FlushBits()
Definition
ByteBuffer.h:141
WorldPacket
Definition
WorldPacket.h:26
WorldPackets::Packet::_worldPacket
WorldPacket _worldPacket
Definition
Packet.h:43
WorldPackets::Toy::AccountToyUpdate::Toys
ToyBoxContainer const * Toys
Definition
ToyPackets.h:56
WorldPackets::Toy::AccountToyUpdate::Write
WorldPacket const * Write() override
Definition
ToyPackets.cpp:33
WorldPackets::Toy::AccountToyUpdate::IsFullUpdate
bool IsFullUpdate
Definition
ToyPackets.h:55
WorldPackets::Toy::AddToy::Guid
ObjectGuid Guid
Definition
ToyPackets.h:35
WorldPackets::Toy::AddToy::Read
void Read() override
Definition
ToyPackets.cpp:23
WorldPackets::Toy::ToyClearFanfare::Read
void Read() override
Definition
ToyPackets.cpp:57
WorldPackets::Toy::ToyClearFanfare::ItemID
uint32 ItemID
Definition
ToyPackets.h:66
WorldPackets::Toy::UseToy::Read
void Read() override
Definition
ToyPackets.cpp:28
WorldPackets::Toy::UseToy::Cast
WorldPackets::Spells::SpellCastRequest Cast
Definition
ToyPackets.h:45
WorldPackets::Toy
Definition
ToyPackets.cpp:22
server
game
Server
Packets
ToyPackets.cpp
Generated on Sun May 10 2026 02:09:03 for TrinityCore by
1.9.8