2014-11-12 03:58:17 +02:00
|
|
|
/*
|
2017-01-01 16:21:30 +01:00
|
|
|
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
|
2014-11-12 03:58:17 +02:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
* option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
|
* more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "TalentPackets.h"
|
|
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Talent::UpdateTalentData::Write()
|
|
|
|
|
{
|
2016-06-09 21:33:18 +02:00
|
|
|
_worldPacket << uint8(Info.ActiveGroup);
|
|
|
|
|
_worldPacket << uint32(Info.PrimarySpecialization);
|
2014-11-12 03:58:17 +02:00
|
|
|
_worldPacket << uint32(Info.TalentGroups.size());
|
|
|
|
|
|
|
|
|
|
for (auto& talentGroupInfo : Info.TalentGroups)
|
|
|
|
|
{
|
2016-06-09 21:33:18 +02:00
|
|
|
_worldPacket << uint32(talentGroupInfo.SpecID);
|
2014-11-12 03:58:17 +02:00
|
|
|
_worldPacket << uint32(talentGroupInfo.TalentIDs.size());
|
2016-06-09 21:33:18 +02:00
|
|
|
_worldPacket << uint32(talentGroupInfo.PvPTalentIDs.size());
|
2014-11-12 03:58:17 +02:00
|
|
|
|
|
|
|
|
for (uint16 talentID : talentGroupInfo.TalentIDs)
|
2016-06-09 21:33:18 +02:00
|
|
|
_worldPacket << uint16(talentID);
|
|
|
|
|
|
|
|
|
|
for (uint16 talentID : talentGroupInfo.PvPTalentIDs)
|
|
|
|
|
_worldPacket << uint16(talentID);
|
2014-11-12 03:58:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
2014-11-16 00:05:42 +02:00
|
|
|
|
2015-01-18 23:56:01 +01:00
|
|
|
void WorldPackets::Talent::LearnTalents::Read()
|
2014-12-04 19:23:35 +01:00
|
|
|
{
|
2016-06-09 21:33:18 +02:00
|
|
|
Talents.resize(_worldPacket.ReadBits(6));
|
|
|
|
|
for (uint32 i = 0; i < Talents.size(); ++i)
|
|
|
|
|
_worldPacket >> Talents[i];
|
2016-01-30 23:56:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Talent::RespecWipeConfirm::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << int8(RespecType);
|
|
|
|
|
_worldPacket << uint32(Cost);
|
|
|
|
|
_worldPacket << RespecMaster;
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WorldPackets::Talent::ConfirmRespecWipe::Read()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket >> RespecMaster;
|
|
|
|
|
_worldPacket >> RespecType;
|
|
|
|
|
}
|
2016-06-09 21:33:18 +02:00
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Talent::LearnTalentsFailed::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket.WriteBits(Reason, 4);
|
|
|
|
|
_worldPacket << int32(SpellID);
|
|
|
|
|
_worldPacket << uint32(Talents.size());
|
|
|
|
|
if (!Talents.empty())
|
|
|
|
|
_worldPacket.append(Talents.data(), Talents.size());
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
2016-08-25 19:12:00 +02:00
|
|
|
|
|
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Talent::GlyphBinding const& glyphBinding)
|
|
|
|
|
{
|
|
|
|
|
data << uint32(glyphBinding.SpellID);
|
|
|
|
|
data << uint16(glyphBinding.GlyphID);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Talent::ActiveGlyphs::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << uint32(Glyphs.size());
|
|
|
|
|
for (GlyphBinding const& glyph : Glyphs)
|
|
|
|
|
_worldPacket << glyph;
|
|
|
|
|
|
|
|
|
|
_worldPacket.WriteBit(IsFullUpdate);
|
|
|
|
|
_worldPacket.FlushBits();
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|