From 892e7dfa5d95558b9939fb05b6d4d7053a5d04d6 Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 27 Dec 2024 09:58:01 +0100 Subject: [PATCH] Creature: Reimplement sentry totem behaviour as CreatureStaticFlags::COMBAT_PING --- src/game/AI/BaseAI/CreatureAI.cpp | 12 ++++++++++++ src/game/AI/BaseAI/TotemAI.h | 1 - .../Scripts/Scripting/ClassScripts/Shaman.cpp | 14 -------------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/game/AI/BaseAI/CreatureAI.cpp b/src/game/AI/BaseAI/CreatureAI.cpp index 106353e774a..dc3ba479dec 100644 --- a/src/game/AI/BaseAI/CreatureAI.cpp +++ b/src/game/AI/BaseAI/CreatureAI.cpp @@ -73,6 +73,18 @@ void CreatureAI::EnterCombat(Unit* enemy) void CreatureAI::AttackStart(Unit* who) { + if (m_creature->GetSettings().HasFlag(CreatureStaticFlags::COMBAT_PING)) + { + if (Player* owner = dynamic_cast(m_creature->GetSpawner())) + { + WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4)); + data << m_creature->GetObjectGuid(); + data << m_creature->GetPositionX(); + data << m_creature->GetPositionY(); + owner->SendDirectMessage(data); + } + } + if (!who || HasReactState(REACT_PASSIVE)) return; diff --git a/src/game/AI/BaseAI/TotemAI.h b/src/game/AI/BaseAI/TotemAI.h index d306048bd4d..7741b7f93ec 100644 --- a/src/game/AI/BaseAI/TotemAI.h +++ b/src/game/AI/BaseAI/TotemAI.h @@ -34,7 +34,6 @@ class TotemAI : public CreatureEventAI void SpellHit(Unit* unit, const SpellEntry* spellInfo) override; void MoveInLineOfSight(Unit* who) override; - void AttackStart(Unit* who) override; void EnterEvadeMode() override; bool IsVisible(Unit* who) const override; diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp index b4adbd33123..642fd0f6423 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp @@ -56,20 +56,6 @@ struct SentryTotemAI : public TotemAI { using TotemAI::TotemAI; - void AttackStart(Unit* who) override - { - TotemAI::AttackStart(who); - // Sentry totem sends ping on attack - if (Player* owner = dynamic_cast(m_creature->GetSpawner())) - { - WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4)); - data << m_creature->GetObjectGuid(); - data << m_creature->GetPositionX(); - data << m_creature->GetPositionY(); - owner->SendDirectMessage(data); - } - } - void RemoveAura() { if (Unit* spawner = m_creature->GetSpawner())