diff options
| author | ForesterDev <11771800+ForesterDev@users.noreply.github.com> | 2020-03-12 20:06:15 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-12 17:06:15 +0100 |
| commit | af6d207addfef177fb5ac3e7fa61ec93ced83d16 (patch) | |
| tree | b13c33d01ada684127a9576c8a60b9352d590dde /src/server/game/Entities/Unit | |
| parent | 535206594ce10c1d2f5547fc70bec3b715020dfa (diff) | |
Core/PacketIO: update some combat packets to new system (#24236)
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7518977c4e1..627d0c7228e 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -26,6 +26,7 @@ #include "Chat.h" #include "ChatPackets.h" #include "ChatTextBuilder.h" +#include "CombatPackets.h" #include "Common.h" #include "ConditionMgr.h" #include "CreatureAI.h" @@ -2275,30 +2276,20 @@ float Unit::CalculateSpellpowerCoefficientLevelPenalty(SpellInfo const* spellInf void Unit::SendMeleeAttackStart(Unit* victim) { - WorldPacket data(SMSG_ATTACKSTART, 8 + 8); - data << uint64(GetGUID()); - data << uint64(victim->GetGUID()); - SendMessageToSet(&data, true); - TC_LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTART"); + WorldPackets::Combat::AttackStart packet; + packet.Attacker = GetGUID(); + packet.Victim = victim->GetGUID(); + SendMessageToSet(packet.Write(), true); } void Unit::SendMeleeAttackStop(Unit* victim) { - WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); - data << GetPackGUID(); - if (victim) - data << victim->GetPackGUID(); - else - data << uint8(0); - - data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation - SendMessageToSet(&data, true); - TC_LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP"); + SendMessageToSet(WorldPackets::Combat::SAttackStop(this, victim).Write(), true); if (victim) - TC_LOG_DEBUG("entities.unit", "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUID().GetCounter(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUID().GetCounter()); + TC_LOG_DEBUG("entities.unit", "%s stopped attacking %s", GetGUID().ToString().c_str(), victim->GetGUID().ToString().c_str()); else - TC_LOG_DEBUG("entities.unit", "%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUID().GetCounter()); + TC_LOG_DEBUG("entities.unit", "%s stopped attacking", GetGUID().ToString().c_str()); } bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType) |
