2014-11-14 02:00:34 +01:00
|
|
|
/*
|
2015-01-01 00:27:46 +01:00
|
|
|
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
2014-11-14 02:00:34 +01: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 "SpellPackets.h"
|
2014-11-29 12:48:12 +01:00
|
|
|
#include "SpellAuraEffects.h"
|
2014-11-30 15:37:11 +01:00
|
|
|
#include "MovementPackets.h"
|
2014-11-14 02:00:34 +01:00
|
|
|
|
2015-01-26 12:59:18 +01:00
|
|
|
void WorldPackets::Spells::CancelAura::Read()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket >> SpellID;
|
|
|
|
|
_worldPacket >> CasterGUID;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-30 15:37:11 +01:00
|
|
|
WorldPacket const* WorldPackets::Spells::CategoryCooldown::Write()
|
2014-11-14 02:00:34 +01:00
|
|
|
{
|
|
|
|
|
_worldPacket.reserve(4 + 8 * CategoryCooldowns.size());
|
|
|
|
|
|
|
|
|
|
_worldPacket << uint32(CategoryCooldowns.size());
|
|
|
|
|
|
|
|
|
|
for (CategoryCooldownInfo const& cooldown : CategoryCooldowns)
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << uint32(cooldown.Category);
|
|
|
|
|
_worldPacket << int32(cooldown.ModCooldown);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-30 15:37:11 +01:00
|
|
|
WorldPacket const* WorldPackets::Spells::SendKnownSpells::Write()
|
2014-11-14 02:00:34 +01:00
|
|
|
{
|
|
|
|
|
_worldPacket.reserve(1 + 4 * KnownSpells.size());
|
|
|
|
|
|
|
|
|
|
_worldPacket.WriteBit(InitialLogin);
|
|
|
|
|
_worldPacket << uint32(KnownSpells.size());
|
|
|
|
|
|
|
|
|
|
for (uint32 spellId : KnownSpells)
|
|
|
|
|
_worldPacket << uint32(spellId);
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
2014-11-29 12:48:12 +01:00
|
|
|
|
2014-11-30 15:37:11 +01:00
|
|
|
WorldPacket const* WorldPackets::Spells::UpdateActionButtons::Write()
|
2014-11-16 02:09:27 +02:00
|
|
|
{
|
|
|
|
|
for (uint32 i = 0; i < MAX_ACTION_BUTTONS; ++i)
|
|
|
|
|
_worldPacket << ActionButtons[i];
|
|
|
|
|
|
|
|
|
|
_worldPacket << Reason;
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 02:03:06 +02:00
|
|
|
void WorldPackets::Spells::SetActionButton::Read()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket >> Action;
|
|
|
|
|
_worldPacket >> Index;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-30 15:37:11 +01:00
|
|
|
WorldPacket const* WorldPackets::Spells::SendUnlearnSpells::Write()
|
2014-11-16 02:09:27 +02:00
|
|
|
{
|
|
|
|
|
_worldPacket << uint32(Spells.size());
|
2014-11-16 06:08:46 +01:00
|
|
|
for (uint32 spellId : Spells)
|
|
|
|
|
_worldPacket << uint32(spellId);
|
2014-11-16 02:09:27 +02:00
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-30 20:13:23 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData)
|
2014-11-19 00:30:31 +02:00
|
|
|
{
|
|
|
|
|
data << spellCastLogData.Health;
|
|
|
|
|
data << spellCastLogData.AttackPower;
|
|
|
|
|
data << spellCastLogData.SpellPower;
|
|
|
|
|
data << int32(spellCastLogData.PowerData.size());
|
2014-11-30 15:37:11 +01:00
|
|
|
for (WorldPackets::Spells::SpellLogPowerData const& powerData : spellCastLogData.PowerData)
|
2014-11-19 00:30:31 +02:00
|
|
|
{
|
|
|
|
|
data << powerData.PowerType;
|
|
|
|
|
data << powerData.Amount;
|
|
|
|
|
}
|
|
|
|
|
data.WriteBit(false);
|
|
|
|
|
// data << float // Unk data if bit is true
|
|
|
|
|
data.FlushBits();
|
2014-11-19 21:09:30 +01:00
|
|
|
|
|
|
|
|
return data;
|
2014-11-19 00:30:31 +02:00
|
|
|
}
|
|
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
WorldPacket const* WorldPackets::Spells::AuraUpdate::Write()
|
2014-11-29 12:48:12 +01:00
|
|
|
{
|
2015-01-02 15:15:59 +01:00
|
|
|
_worldPacket.WriteBit(UpdateAll);
|
|
|
|
|
_worldPacket << UnitGUID;
|
|
|
|
|
_worldPacket << uint32(Auras.size());
|
|
|
|
|
for (auto& aura : Auras)
|
2014-11-30 15:37:11 +01:00
|
|
|
{
|
2015-01-02 15:15:59 +01:00
|
|
|
_worldPacket << aura.Slot;
|
|
|
|
|
if (_worldPacket.WriteBit(aura.AuraData.HasValue))
|
|
|
|
|
{
|
|
|
|
|
AuraDataInfo const& data = aura.AuraData.Value;
|
|
|
|
|
_worldPacket << uint32(data.SpellID);
|
|
|
|
|
_worldPacket << uint8(data.Flags);
|
|
|
|
|
_worldPacket << uint32(data.ActiveFlags);
|
|
|
|
|
_worldPacket << uint16(data.CastLevel);
|
|
|
|
|
_worldPacket << uint8(data.Applications);
|
|
|
|
|
_worldPacket << uint32(data.EstimatedPoints.size());
|
|
|
|
|
_worldPacket << uint32(data.Points.size());
|
2014-11-29 12:48:12 +01:00
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
if (!data.EstimatedPoints.empty())
|
|
|
|
|
_worldPacket.append(data.EstimatedPoints.data(), data.EstimatedPoints.size());
|
2014-11-29 12:48:12 +01:00
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
if (!data.Points.empty())
|
|
|
|
|
_worldPacket.append(data.Points.data(), data.Points.size());
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
_worldPacket.WriteBit(data.CastUnit.HasValue);
|
|
|
|
|
_worldPacket.WriteBit(data.Duration.HasValue);
|
|
|
|
|
_worldPacket.WriteBit(data.Remaining.HasValue);
|
2014-11-29 12:48:12 +01:00
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
if (data.CastUnit.HasValue)
|
|
|
|
|
_worldPacket << data.CastUnit.Value;
|
2014-11-29 12:48:12 +01:00
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
if (data.Duration.HasValue)
|
|
|
|
|
_worldPacket << uint32(data.Duration.Value);
|
2014-11-29 12:48:12 +01:00
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
if (data.Remaining.HasValue)
|
|
|
|
|
_worldPacket << uint32(data.Remaining.Value);
|
2014-11-29 12:48:12 +01:00
|
|
|
}
|
|
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
_worldPacket.FlushBits();
|
2014-11-29 12:48:12 +01:00
|
|
|
}
|
|
|
|
|
|
2015-01-02 15:15:59 +01:00
|
|
|
return &_worldPacket;
|
2014-11-29 12:48:12 +01:00
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::TargetLocation& location)
|
2014-11-30 15:37:11 +01:00
|
|
|
{
|
2015-01-30 23:58:16 +01:00
|
|
|
buffer >> location.Transport;
|
|
|
|
|
buffer >> location.Location.m_positionX;
|
|
|
|
|
buffer >> location.Location.m_positionY;
|
|
|
|
|
buffer >> location.Location.m_positionZ;
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::SpellTargetData& targetData)
|
|
|
|
|
{
|
|
|
|
|
buffer.ResetBitPos();
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
targetData.Flags = buffer.ReadBits(21);
|
|
|
|
|
targetData.SrcLocation.HasValue = buffer.ReadBit();
|
|
|
|
|
targetData.DstLocation.HasValue = buffer.ReadBit();
|
|
|
|
|
targetData.Orientation.HasValue = buffer.ReadBit();
|
|
|
|
|
uint32 nameLength = buffer.ReadBits(7);
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
buffer >> targetData.Unit;
|
|
|
|
|
buffer >> targetData.Item;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
if (targetData.SrcLocation.HasValue)
|
|
|
|
|
buffer >> targetData.SrcLocation.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
if (targetData.DstLocation.HasValue)
|
|
|
|
|
buffer >> targetData.DstLocation.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
if (targetData.Orientation.HasValue)
|
|
|
|
|
buffer >> targetData.Orientation.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
targetData.Name = buffer.ReadString(nameLength);
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
return buffer;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::MissileTrajectoryRequest& trajectory)
|
|
|
|
|
{
|
|
|
|
|
buffer >> trajectory.Pitch;
|
|
|
|
|
buffer >> trajectory.Speed;
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::SpellCastRequest& request)
|
|
|
|
|
{
|
|
|
|
|
buffer >> request.CastID;
|
|
|
|
|
buffer >> request.SpellID;
|
|
|
|
|
buffer >> request.Misc;
|
|
|
|
|
buffer >> request.Target;
|
|
|
|
|
buffer >> request.MissileTrajectory;
|
|
|
|
|
buffer >> request.Charmer;
|
|
|
|
|
|
|
|
|
|
buffer.ResetBitPos();
|
|
|
|
|
request.SendCastFlags = buffer.ReadBits(5);
|
|
|
|
|
request.MoveUpdate.HasValue = buffer.ReadBit();
|
|
|
|
|
request.Weight.resize(buffer.ReadBits(2));
|
|
|
|
|
|
|
|
|
|
if (request.MoveUpdate.HasValue)
|
|
|
|
|
buffer >> request.MoveUpdate.Value;
|
|
|
|
|
|
|
|
|
|
for (WorldPackets::Spells::SpellWeight& weight : request.Weight)
|
2014-11-30 15:37:11 +01:00
|
|
|
{
|
2015-01-30 23:58:16 +01:00
|
|
|
buffer.ResetBitPos();
|
|
|
|
|
weight.Type = buffer.ReadBits(2);
|
|
|
|
|
buffer >> weight.ID;
|
|
|
|
|
buffer >> weight.Quantity;
|
2014-11-30 15:37:11 +01:00
|
|
|
}
|
|
|
|
|
|
2015-01-30 23:58:16 +01:00
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WorldPackets::Spells::CastSpell::Read()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket >> Cast;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WorldPackets::Spells::PetCastSpell::Read()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket >> PetGUID;
|
|
|
|
|
_worldPacket >> Cast;
|
2014-11-30 15:37:11 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::TargetLocation const& targetLocation)
|
2014-11-30 15:37:11 +01:00
|
|
|
{
|
2014-12-02 00:07:36 +02:00
|
|
|
data << targetLocation.Transport;
|
|
|
|
|
data << targetLocation.Location.m_positionX;
|
|
|
|
|
data << targetLocation.Location.m_positionY;
|
|
|
|
|
data << targetLocation.Location.m_positionZ;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData const& spellTargetData)
|
|
|
|
|
{
|
|
|
|
|
data.WriteBits(spellTargetData.Flags, 21);
|
|
|
|
|
data.WriteBit(spellTargetData.SrcLocation.HasValue);
|
|
|
|
|
data.WriteBit(spellTargetData.DstLocation.HasValue);
|
|
|
|
|
data.WriteBit(spellTargetData.Orientation.HasValue);
|
|
|
|
|
data.WriteBits(spellTargetData.Name.size(), 7);
|
|
|
|
|
data.FlushBits();
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
data << spellTargetData.Unit;
|
|
|
|
|
data << spellTargetData.Item;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
if (spellTargetData.SrcLocation.HasValue)
|
|
|
|
|
data << spellTargetData.SrcLocation.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
if (spellTargetData.DstLocation.HasValue)
|
|
|
|
|
data << spellTargetData.DstLocation.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
if (spellTargetData.Orientation.HasValue)
|
|
|
|
|
data << spellTargetData.Orientation.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
data.WriteString(spellTargetData.Name);
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellMissStatus const& spellMissStatus)
|
|
|
|
|
{
|
|
|
|
|
data.WriteBits(spellMissStatus.Reason, 4);
|
|
|
|
|
data.WriteBits(spellMissStatus.ReflectStatus, 4);
|
|
|
|
|
// No need to flush bits as we written exactly 8 bits (1 byte)
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellPowerData const& spellPowerData)
|
|
|
|
|
{
|
|
|
|
|
data << spellPowerData.Cost;
|
|
|
|
|
data << spellPowerData.Type;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::RuneData const& runeData)
|
|
|
|
|
{
|
|
|
|
|
data << runeData.Start;
|
|
|
|
|
data << runeData.Count;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
data.WriteBits(runeData.Cooldowns.size(), 3);
|
|
|
|
|
data.FlushBits();
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
for (uint8 cd : runeData.Cooldowns)
|
|
|
|
|
data << cd;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::MissileTrajectoryResult const& missileTrajectory)
|
|
|
|
|
{
|
|
|
|
|
data << missileTrajectory.TravelTime;
|
|
|
|
|
data << missileTrajectory.Pitch;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellAmmo const& spellAmmo)
|
|
|
|
|
{
|
|
|
|
|
data << spellAmmo.DisplayID;
|
|
|
|
|
data << spellAmmo.InventoryType;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::ProjectileVisualData const& projectileVisual)
|
|
|
|
|
{
|
|
|
|
|
data << projectileVisual.ID[0];
|
|
|
|
|
data << projectileVisual.ID[1];
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::CreatureImmunities const& immunities)
|
|
|
|
|
{
|
|
|
|
|
data << immunities.School;
|
|
|
|
|
data << immunities.Value;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellHealPrediction const& spellPred)
|
|
|
|
|
{
|
|
|
|
|
data << spellPred.Points;
|
|
|
|
|
data << spellPred.Type;
|
|
|
|
|
data << spellPred.BeaconGUID;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData const& spellCastData)
|
|
|
|
|
{
|
|
|
|
|
data << spellCastData.CasterGUID;
|
|
|
|
|
data << spellCastData.CasterUnit;
|
|
|
|
|
data << spellCastData.CastID;
|
|
|
|
|
data << spellCastData.SpellID;
|
|
|
|
|
data << spellCastData.CastFlags;
|
|
|
|
|
data << spellCastData.CastTime;
|
|
|
|
|
data << uint32(spellCastData.HitTargets.size());
|
|
|
|
|
data << uint32(spellCastData.MissTargets.size());
|
|
|
|
|
data << uint32(spellCastData.MissStatus.size());
|
|
|
|
|
data << spellCastData.Target;
|
|
|
|
|
data << uint32(spellCastData.RemainingPower.size());
|
|
|
|
|
data << spellCastData.MissileTrajectory;
|
|
|
|
|
data << spellCastData.Ammo;
|
|
|
|
|
data << spellCastData.DestLocSpellCastIndex;
|
|
|
|
|
data << uint32(spellCastData.TargetPoints.size());
|
|
|
|
|
data << spellCastData.Immunities;
|
|
|
|
|
data << spellCastData.Predict;
|
|
|
|
|
|
|
|
|
|
for (ObjectGuid const& target : spellCastData.HitTargets)
|
|
|
|
|
data << target;
|
|
|
|
|
|
|
|
|
|
for (ObjectGuid const& target : spellCastData.MissTargets)
|
|
|
|
|
data << target;
|
|
|
|
|
|
|
|
|
|
for (WorldPackets::Spells::SpellMissStatus const& status : spellCastData.MissStatus)
|
|
|
|
|
data << status;
|
|
|
|
|
|
|
|
|
|
for (WorldPackets::Spells::SpellPowerData const& power : spellCastData.RemainingPower)
|
|
|
|
|
data << power;
|
|
|
|
|
|
|
|
|
|
for (WorldPackets::Spells::TargetLocation const& targetLoc : spellCastData.TargetPoints)
|
|
|
|
|
data << targetLoc;
|
|
|
|
|
|
|
|
|
|
data.WriteBits(spellCastData.CastFlagsEx, 18);
|
|
|
|
|
data.WriteBit(spellCastData.RemainingRunes.HasValue);
|
|
|
|
|
data.WriteBit(spellCastData.ProjectileVisual.HasValue);
|
|
|
|
|
data.FlushBits();
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
if (spellCastData.RemainingRunes.HasValue)
|
|
|
|
|
data << spellCastData.RemainingRunes.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
if (spellCastData.ProjectileVisual.HasValue)
|
|
|
|
|
data << spellCastData.ProjectileVisual.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:55:29 +02:00
|
|
|
return data;
|
2014-12-02 00:07:36 +02:00
|
|
|
}
|
2014-11-30 15:37:11 +01:00
|
|
|
|
2014-12-02 00:07:36 +02:00
|
|
|
WorldPacket const* WorldPackets::Spells::SpellStart::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << Cast;
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Spells::SpellGo::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << Cast;
|
|
|
|
|
|
|
|
|
|
_worldPacket.WriteBit(LogData.HasValue);
|
|
|
|
|
_worldPacket.FlushBits();
|
|
|
|
|
|
|
|
|
|
if (LogData.HasValue)
|
|
|
|
|
_worldPacket << LogData.Value;
|
2014-11-30 15:37:11 +01:00
|
|
|
|
|
|
|
|
return &_worldPacket;
|
2014-11-30 18:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Spells::LearnedSpells::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << uint32(SpellID.size());
|
|
|
|
|
for (int32 spell : SpellID)
|
|
|
|
|
_worldPacket << spell;
|
|
|
|
|
|
|
|
|
|
_worldPacket.WriteBit(SuppressMessaging);
|
|
|
|
|
_worldPacket.FlushBits();
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
2014-11-30 20:13:23 +02:00
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Spells::SpellFailure::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << CasterUnit;
|
|
|
|
|
_worldPacket << CastID;
|
|
|
|
|
_worldPacket << SpellID;
|
|
|
|
|
_worldPacket << Reason;
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Spells::SpellFailedOther::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << CasterUnit;
|
|
|
|
|
_worldPacket << CastID;
|
|
|
|
|
_worldPacket << SpellID;
|
|
|
|
|
_worldPacket << Reason;
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-05 00:33:21 +02:00
|
|
|
WorldPacket const* WorldPackets::Spells::CastFailed::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << SpellID;
|
|
|
|
|
_worldPacket << Reason;
|
|
|
|
|
_worldPacket << FailedArg1;
|
|
|
|
|
_worldPacket << FailedArg2;
|
|
|
|
|
_worldPacket << CastID;
|
|
|
|
|
|
2014-11-30 20:13:23 +02:00
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellModifierData const& spellModifierData)
|
|
|
|
|
{
|
|
|
|
|
data << spellModifierData.ModifierValue;
|
|
|
|
|
data << spellModifierData.ClassIndex;
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellModifier const& spellModifier)
|
|
|
|
|
{
|
|
|
|
|
data << spellModifier.ModIndex;
|
|
|
|
|
data << uint32(spellModifier.ModifierData.size());
|
|
|
|
|
for (WorldPackets::Spells::SpellModifierData const& modData : spellModifier.ModifierData)
|
|
|
|
|
data << modData;
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Spells::SetSpellModifier::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << uint32(Modifiers.size());
|
|
|
|
|
for (WorldPackets::Spells::SpellModifier const& spellMod : Modifiers)
|
|
|
|
|
_worldPacket << spellMod;
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|
2014-12-04 19:23:35 +01:00
|
|
|
|
2015-02-01 20:52:05 +01:00
|
|
|
WorldPacket const* WorldPackets::Spells::UnlearnedSpells::Write()
|
2014-12-04 19:23:35 +01:00
|
|
|
{
|
2015-02-01 20:52:05 +01:00
|
|
|
_worldPacket << uint32(SpellID.size());
|
|
|
|
|
for (uint32 spellId : SpellID)
|
2014-12-04 19:23:35 +01:00
|
|
|
_worldPacket << uint32(spellId);
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
2014-12-04 19:24:09 +01:00
|
|
|
}
|
2015-02-11 23:09:56 +00:00
|
|
|
|
|
|
|
|
WorldPacket const* WorldPackets::Spells::CooldownEvent::Write()
|
|
|
|
|
{
|
|
|
|
|
_worldPacket << CasterGUID;
|
|
|
|
|
_worldPacket << int32(SpellID);
|
|
|
|
|
|
|
|
|
|
return &_worldPacket;
|
|
|
|
|
}
|