Skip to content

Commit

Permalink
Creature: Reimplement sentry totem behaviour as CreatureStaticFlags::…
Browse files Browse the repository at this point in the history
…COMBAT_PING
  • Loading branch information
killerwife committed Dec 27, 2024
1 parent cda5f88 commit 892e7df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
12 changes: 12 additions & 0 deletions src/game/AI/BaseAI/CreatureAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Player*>(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;

Expand Down
1 change: 0 additions & 1 deletion src/game/AI/BaseAI/TotemAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 0 additions & 14 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Player*>(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())
Expand Down

0 comments on commit 892e7df

Please sign in to comment.