Core/PacketIO: Fixed structure of "fake" SMSG_SPELL_GO sent when loading pets from db

Closes #25354
This commit is contained in:
Shauren
2020-08-28 23:59:17 +02:00
parent b928955185
commit bf7efe3ca0
3 changed files with 13 additions and 12 deletions

View File

@@ -31,6 +31,7 @@
#include "SpellAuras.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellPackets.h"
#include "Unit.h"
#include "Util.h"
#include "WorldPacket.h"
@@ -338,14 +339,13 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
/// @todo pets should be summoned from real cast instead of just faking it?
if (petInfo->CreatedBySpellId)
{
WorldPacket data(SMSG_SPELL_GO, (8+8+4+4+2));
data << owner->GetPackGUID();
data << owner->GetPackGUID();
data << uint8(0);
data << uint32(petInfo->CreatedBySpellId);
data << uint32(256); // CAST_FLAG_UNKNOWN3
data << uint32(0);
owner->SendMessageToSet(&data, true);
WorldPackets::Spells::SpellGo spellGo;
spellGo.Cast.CasterGUID = owner->GetGUID();
spellGo.Cast.CasterUnit = owner->GetGUID();
spellGo.Cast.SpellID = petInfo->CreatedBySpellId;
spellGo.Cast.CastFlags = CAST_FLAG_UNKNOWN_9;
spellGo.Cast.CastTime = GameTime::GetGameTimeMS();
owner->SendMessageToSet(spellGo.Write(), true);
}
owner->SetMinion(this, true);

View File

@@ -163,7 +163,11 @@ namespace WorldPackets
class SpellGo final : public ServerPacket
{
public:
SpellGo() : ServerPacket(SMSG_SPELL_GO) { }
SpellGo() : ServerPacket(SMSG_SPELL_GO)
{
Cast.HitTargets.emplace();
Cast.MissStatus.emplace();
}
WorldPacket const* Write() override;

View File

@@ -4431,9 +4431,6 @@ void Spell::UpdateSpellCastDataAmmo(WorldPackets::Spells::SpellAmmo& ammo)
/// Writes miss and hit targets for a SMSG_SPELL_GO packet
void Spell::UpdateSpellCastDataTargets(WorldPackets::Spells::SpellCastData& data)
{
data.HitTargets.emplace();
data.MissStatus.emplace();
// This function also fill data for channeled spells:
// m_needAliveTargetMask req for stop channelig if one target die
for (TargetInfo& targetInfo : m_UniqueTargetInfo)