Core/Packets: Added SMSG_SPELLNONMELEEDAMAGELOG

This commit is contained in:
Intel
2014-12-02 00:55:29 +02:00
parent 713488596f
commit e3fb937fdd
6 changed files with 113 additions and 17 deletions

View File

@@ -65,6 +65,7 @@
#include "ChatPackets.h"
#include "MovementPackets.h"
#include "CombatPackets.h"
#include "CombatLogPackets.h"
#include <cmath>
@@ -4728,22 +4729,20 @@ void Unit::RemoveAllGameObjects()
void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log)
{
WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size
data << log->target->GetPackGUID();
data << log->attacker->GetPackGUID();
data << uint32(log->SpellID);
data << uint32(log->damage); // damage amount
WorldPackets::CombatLog::SpellNonMeleeDamageLog packet;
packet.Me = log->target->GetGUID();
packet.CasterGUID = log->attacker->GetGUID();
packet.SpellID = log->SpellID;
packet.Damage = log->damage;
int32 overkill = log->damage - log->target->GetHealth();
data << uint32(overkill > 0 ? overkill : 0); // overkill
data << uint8 (log->schoolMask); // damage school
data << uint32(log->absorb); // AbsorbedDamage
data << uint32(log->resist); // resist
data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
data << uint8 (log->unused); // unused
data << uint32(log->blocked); // blocked
data << uint32(log->HitInfo);
data << uint8 (0); // flag to use extend data
SendMessageToSet(&data, true);
packet.Overkill = (overkill > 0 ? overkill : 0);
packet.SchoolMask = log->schoolMask;
packet.ShieldBlock = log->blocked;
packet.Resisted = log->resist;
packet.Absorbed = log->absorb;
packet.Periodic = false;
packet.Flags = log->HitInfo;
SendMessageToSet(packet.Write(), true);
}
void Unit::SendSpellNonMeleeDamageLog(Unit* target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit)

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
*
* 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 "CombatLogPackets.h"
#include "SpellPackets.h"
WorldPacket const* WorldPackets::CombatLog::SpellNonMeleeDamageLog::Write()
{
_worldPacket << Me;
_worldPacket << CasterGUID;
_worldPacket << SpellID;
_worldPacket << Damage;
_worldPacket << Overkill;
_worldPacket << SchoolMask;
_worldPacket << ShieldBlock;
_worldPacket << Resisted;
_worldPacket << Absorbed;
_worldPacket.WriteBit(Periodic);
_worldPacket.WriteBits(Flags, 9);
_worldPacket.WriteBit(false); // Debug info
_worldPacket.WriteBit(LogData.HasValue);
_worldPacket.FlushBits();
if (LogData.HasValue)
_worldPacket << LogData.Value;
return &_worldPacket;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
*
* 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/>.
*/
#ifndef CombatLogPackets_h__
#define CombatLogPackets_h__
#include "Packet.h"
#include "SpellPackets.h"
namespace WorldPackets
{
namespace CombatLog
{
class SpellNonMeleeDamageLog final : public ServerPacket
{
public:
SpellNonMeleeDamageLog() : ServerPacket(SMSG_SPELLNONMELEEDAMAGELOG, 60) { }
WorldPacket const* Write() override;
int32 Absorbed;
int32 ShieldBlock;
ObjectGuid Me;
int32 SpellID;
int32 Resisted;
bool Periodic;
uint8 SchoolMask;
ObjectGuid CasterGUID;
Optional<Spells::SpellCastLogData> LogData;
int32 Damage;
// Optional<SpellNonMeleeDamageLogDebugInfo> Debug Info;
int32 Flags;
int32 Overkill;
};
}
}
#endif // CombatLogPackets_h__

View File

@@ -391,6 +391,8 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con
if (spellCastData.ProjectileVisual.HasValue)
data << spellCastData.ProjectileVisual.Value;
return data;
}
WorldPacket const* WorldPackets::Spells::SpellStart::Write()

View File

@@ -299,7 +299,7 @@ namespace WorldPackets
ObjectGuid CasterUnit;
uint32 SpellID = 0;
uint8 Reason = 0;
uint16 Reason = 0;
uint8 CastID = 0;
};

View File

@@ -1307,7 +1307,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLINTERRUPTLOG, STATUS_UNHANDLED);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLLOGEXECUTE, STATUS_UNHANDLED);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLLOGMISS, STATUS_UNHANDLED);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLNONMELEEDAMAGELOG, STATUS_UNHANDLED);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLNONMELEEDAMAGELOG, STATUS_NEVER);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLORDAMAGE_IMMUNE, STATUS_UNHANDLED);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLSTEALLOG, STATUS_UNHANDLED);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_CATEGORY_COOLDOWN, STATUS_NEVER);