diff options
author | Intel <chemicstry@gmail.com> | 2014-12-02 00:55:29 +0200 |
---|---|---|
committer | Intel <chemicstry@gmail.com> | 2014-12-02 00:55:29 +0200 |
commit | e3fb937fdd0a22b0959f186dfbdba638063f1e36 (patch) | |
tree | baf9b13af432e3fcf489b9656b249d89fac58ee6 /src | |
parent | 713488596f9cf726f6927c2a98a750b1ab3b1ee1 (diff) |
Core/Packets: Added SMSG_SPELLNONMELEEDAMAGELOG
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 29 | ||||
-rw-r--r-- | src/server/game/Server/Packets/CombatLogPackets.cpp | 43 | ||||
-rw-r--r-- | src/server/game/Server/Packets/CombatLogPackets.h | 52 | ||||
-rw-r--r-- | src/server/game/Server/Packets/SpellPackets.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Server/Packets/SpellPackets.h | 2 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 2 |
6 files changed, 113 insertions, 17 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5fbc6e7632c..2082dbaf300 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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) diff --git a/src/server/game/Server/Packets/CombatLogPackets.cpp b/src/server/game/Server/Packets/CombatLogPackets.cpp new file mode 100644 index 00000000000..128cc0d342f --- /dev/null +++ b/src/server/game/Server/Packets/CombatLogPackets.cpp @@ -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; +} diff --git a/src/server/game/Server/Packets/CombatLogPackets.h b/src/server/game/Server/Packets/CombatLogPackets.h new file mode 100644 index 00000000000..6cca0127ef6 --- /dev/null +++ b/src/server/game/Server/Packets/CombatLogPackets.h @@ -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__ diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp index 97c98e5e145..dddcbd3240b 100644 --- a/src/server/game/Server/Packets/SpellPackets.cpp +++ b/src/server/game/Server/Packets/SpellPackets.cpp @@ -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() diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h index 6e95efd63f2..6dffc6e2116 100644 --- a/src/server/game/Server/Packets/SpellPackets.h +++ b/src/server/game/Server/Packets/SpellPackets.h @@ -299,7 +299,7 @@ namespace WorldPackets ObjectGuid CasterUnit; uint32 SpellID = 0; - uint8 Reason = 0; + uint16 Reason = 0; uint8 CastID = 0; }; diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index f8df17eb3f7..1601a927555 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -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); |