TrinityCore
TalentPackets.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 "TalentPackets.h"
19
21{
22 data >> pvpTalent.PvPTalentID;
23 data >> pvpTalent.Slot;
24 return data;
25}
26
28{
29 data << uint16(pvpTalent.PvPTalentID);
30 data << uint8(pvpTalent.Slot);
31 return data;
32}
33
35{
39
40 for (auto& talentGroupInfo : Info.TalentGroups)
41 {
42 _worldPacket << uint32(talentGroupInfo.SpecID);
43 _worldPacket << uint32(talentGroupInfo.TalentIDs.size());
44 _worldPacket << uint32(talentGroupInfo.PvPTalents.size());
45
46 for (uint16 talent : talentGroupInfo.TalentIDs)
47 _worldPacket << uint16(talent);
48
49 for (PvPTalent talent : talentGroupInfo.PvPTalents)
50 _worldPacket << talent;
51 }
52
53 return &_worldPacket;
54}
55
57{
58 Talents.resize(_worldPacket.ReadBits(6));
59 for (uint32 i = 0; i < Talents.size(); ++i)
60 _worldPacket >> Talents[i];
61}
62
64{
65 _worldPacket << int8(RespecType);
66 _worldPacket << uint32(Cost);
67 _worldPacket << RespecMaster;
68 return &_worldPacket;
69}
70
72{
73 _worldPacket >> RespecMaster;
74 _worldPacket >> RespecType;
75}
76
78{
79 _worldPacket.WriteBits(Reason, 4);
80 _worldPacket << int32(SpellID);
81 _worldPacket << uint32(Talents.size());
82 if (!Talents.empty())
83 _worldPacket.append(Talents.data(), Talents.size());
84
85 return &_worldPacket;
86}
87
89{
90 data << uint32(glyphBinding.SpellID);
91 data << uint16(glyphBinding.GlyphID);
92 return data;
93}
94
96{
97 _worldPacket << uint32(Glyphs.size());
98 for (GlyphBinding const& glyph : Glyphs)
99 _worldPacket << glyph;
100
101 _worldPacket.WriteBit(IsFullUpdate);
102 _worldPacket.FlushBits();
103
104 return &_worldPacket;
105}
106
108{
109 Talents.resize(_worldPacket.read<uint32>());
110 for (uint32 i = 0; i < Talents.size(); ++i)
111 _worldPacket >> Talents[i];
112}
113
115{
116 _worldPacket.WriteBits(Reason, 4);
117 _worldPacket << int32(SpellID);
118 _worldPacket << uint32(Talents.size());
119 for (PvPTalent pvpTalent : Talents)
120 _worldPacket << pvpTalent;
121
122 return &_worldPacket;
123}
uint8_t uint8
Definition: Define.h:144
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
ByteBuffer & operator<<(ByteBuffer &data, WorldPackets::Talent::PvPTalent const &pvpTalent)
ByteBuffer & operator>>(ByteBuffer &data, WorldPackets::Talent::PvPTalent &pvpTalent)
void WriteBits(std::size_t value, int32 bits)
Definition: ByteBuffer.h:203
WorldPacket _worldPacket
Definition: Packet.h:43
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
ByteBuffer & operator<<(ByteBuffer &data, Movement::MonsterSplineFilterKey const &monsterSplineFilterKey)
std::vector< TalentGroupInfo > TalentGroups
Definition: TalentPackets.h:47