Core/Packets: converted SMSG_SPELL_MISS_LOG to packet class
This commit is contained in:
1 parent
5e7ee94ccc
commit
6224558c8c
5 files changed
+64
-12
No files matched your search
@@ -21,6 +21,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "Chat.h"
|
||||
#include "CinematicMgr.h"
|
||||
#include "CombatLogPackets.h"
|
||||
#include "Common.h"
|
||||
#include "Creature.h"
|
||||
#include "DBCStores.h"
|
||||
@@ -2733,16 +2734,11 @@ SpellMissInfo WorldObject::SpellHitResult(Unit* victim, SpellInfo const* spellIn
|
||||
|
||||
void WorldObject::SendSpellMiss(Unit* target, uint32 spellID, SpellMissInfo missInfo)
|
||||
{
|
||||
WorldPacket data(SMSG_SPELLLOGMISS, (4 + 8 + 1 + 4 + 8 + 1));
|
||||
data << uint32(spellID);
|
||||
data << uint64(GetGUID());
|
||||
data << uint8(0); // can be 0 or 1
|
||||
data << uint32(1); // target count
|
||||
// for (i = 0; i < target count; ++i)
|
||||
data << uint64(target->GetGUID()); // target GUID
|
||||
data << uint8(missInfo);
|
||||
// end loop
|
||||
SendMessageToSet(&data, true);
|
||||
WorldPackets::CombatLog::SpellMissLog spellMissLog;
|
||||
spellMissLog.SpellID = spellID;
|
||||
spellMissLog.Caster = GetGUID();
|
||||
spellMissLog.Entries.emplace_back(target->GetGUID(), missInfo);
|
||||
SendMessageToSet(spellMissLog.Write(), true);
|
||||
}
|
||||
|
||||
FactionTemplateEntry const* WorldObject::GetFactionTemplateEntry() const
|
||||
|
||||
@@ -103,3 +103,32 @@ WorldPacket const* WorldPackets::CombatLog::SpellDamageShield::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::CombatLog::SpellLogMissDebug const& debug)
|
||||
{
|
||||
data << float(debug.HitRoll);
|
||||
data << float(debug.HitRollNeeded);
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::CombatLog::SpellLogMissEntry const& entry)
|
||||
{
|
||||
data << entry.Victim;
|
||||
data << uint8(entry.MissReason);
|
||||
if (entry.Debug.has_value())
|
||||
data << *entry.Debug;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::CombatLog::SpellMissLog::Write()
|
||||
{
|
||||
_worldPacket << int32(SpellID);
|
||||
_worldPacket << Caster;
|
||||
_worldPacket << uint8(0); // Debug
|
||||
_worldPacket << uint32(Entries.size());
|
||||
|
||||
for (SpellLogMissEntry const& entry : Entries)
|
||||
_worldPacket << entry;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
@@ -117,6 +117,33 @@ namespace WorldPackets
|
||||
int32 SchoolMask = 0;
|
||||
int32 LogAbsorbed = 0;
|
||||
};
|
||||
|
||||
struct SpellLogMissDebug
|
||||
{
|
||||
float HitRoll = 0.0f;
|
||||
float HitRollNeeded = 0.0f;
|
||||
};
|
||||
|
||||
struct SpellLogMissEntry
|
||||
{
|
||||
SpellLogMissEntry(ObjectGuid const& victim, uint8 missReason) : Victim(victim), MissReason(missReason) { }
|
||||
|
||||
ObjectGuid Victim;
|
||||
uint8 MissReason = 0;
|
||||
Optional<SpellLogMissDebug> Debug;
|
||||
};
|
||||
|
||||
class SpellMissLog final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
SpellMissLog() : ServerPacket(SMSG_SPELL_MISS_LOG) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 SpellID = 0;
|
||||
ObjectGuid Caster;
|
||||
std::vector<SpellLogMissEntry> Entries;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1226,7 +1226,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLINSTAKILLLOG, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLINTERRUPTLOG, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLLOGEXECUTE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLLOGMISS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_MISS_LOG, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLNONMELEEDAMAGELOG, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLORDAMAGE_IMMUNE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLSTEALLOG, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
|
||||
@@ -1185,7 +1185,7 @@ enum OpcodeServer
|
||||
SMSG_SPELLINSTAKILLLOG = 0x6216,
|
||||
SMSG_SPELLINTERRUPTLOG = 0x1DA7,
|
||||
SMSG_SPELLLOGEXECUTE = 0x0626,
|
||||
SMSG_SPELLLOGMISS = 0x0625,
|
||||
SMSG_SPELL_MISS_LOG = 0x0625,
|
||||
SMSG_SPELLNONMELEEDAMAGELOG = 0x4315,
|
||||
SMSG_SPELLORDAMAGE_IMMUNE = 0x4507,
|
||||
SMSG_SPELLSTEALLOG = 0x4E26,
|
||||
|
||||
Reference in new issue
Block a user