aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp26
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp40
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h9
3 files changed, 62 insertions, 13 deletions
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
index c6c8fb8f63f..4bc96ef64f4 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
@@ -27,7 +27,6 @@
enum BlackheartTheInciter
{
- NPC_BLACKHEART = 18667,
SPELL_INCITE_CHAOS = 33676,
SPELL_INCITE_CHAOS_B = 33684, //debuff applied to each member of party
SPELL_CHARGE = 33709,
@@ -80,7 +79,7 @@ class BlackheartCharmedPlayerAI : public SimpleCharmedPlayerAI
void OnCharmed(bool apply) override
{
SimpleCharmedPlayerAI::OnCharmed(apply);
- if (Creature* blackheart = me->FindNearestCreature(NPC_BLACKHEART, 50000.0f))
+ if (Creature* blackheart = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetGuidData(DATA_BLACKHEART_THE_INCITER)))
{
blackheart->AI()->SetData(0, apply);
blackheart->GetThreatManager().AddThreat(me, 0.0f);
@@ -183,24 +182,25 @@ struct boss_blackheart_the_inciter_mc_dummy : public NullCreatureAI
{
using NullCreatureAI::NullCreatureAI;
void InitializeAI() override { me->SetReactState(REACT_PASSIVE); }
- static const uint32 FIRST_DUMMY = 19300, LAST_DUMMY = 19304;
+ static const uint32 FIRST_DUMMY = NPC_BLACKHEART_DUMMY1, LAST_DUMMY = NPC_BLACKHEART_DUMMY5;
void IsSummonedBy(Unit* who) override
{
me->CastSpell(who, SPELL_INCITE_CHAOS_B, true);
// ensure everyone is in combat with everyone
- for (uint32 entry = FIRST_DUMMY; entry <= LAST_DUMMY; ++entry)
- if (entry != me->GetEntry())
- if (Creature* trigger = me->FindNearestCreature(entry, 50000.0f))
- {
- me->GetThreatManager().AddThreat(trigger, 0.0f);
- trigger->GetThreatManager().AddThreat(who, 0.0f);
- for (Unit* other : trigger->m_Controlled)
+ if (auto* dummies = GetBlackheartDummies(me->GetInstanceScript()))
+ for (ObjectGuid const& guid : *dummies)
+ if (Creature* trigger = ObjectAccessor::GetCreature(*me, guid))
+ if (me->GetEntry() != trigger->GetEntry())
{
- me->GetThreatManager().AddThreat(other, 0.0f);
- other->GetThreatManager().AddThreat(who, 0.0f);
+ me->GetThreatManager().AddThreat(trigger, 0.0f);
+ trigger->GetThreatManager().AddThreat(who, 0.0f);
+ for (Unit* other : trigger->m_Controlled)
+ {
+ me->GetThreatManager().AddThreat(other, 0.0f);
+ other->GetThreatManager().AddThreat(who, 0.0f);
+ }
}
- }
}
void UpdateAI(uint32 /*diff*/) override
{
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
index c5ddb8e6b50..709b3569134 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
@@ -53,6 +53,16 @@ class instance_shadow_labyrinth : public InstanceMapScript
case NPC_AMBASSADOR_HELLMAW:
AmbassadorHellmawGUID = creature->GetGUID();
break;
+ case NPC_BLACKHEART:
+ BlackheartGUID = creature->GetGUID();
+ break;
+ case NPC_BLACKHEART_DUMMY1:
+ case NPC_BLACKHEART_DUMMY2:
+ case NPC_BLACKHEART_DUMMY3:
+ case NPC_BLACKHEART_DUMMY4:
+ case NPC_BLACKHEART_DUMMY5:
+ BlackheartDummyGUIDs.insert(creature->GetGUID());
+ break;
case NPC_GRANDMASTER_VORPIL:
GrandmasterVorpilGUID = creature->GetGUID();
break;
@@ -69,6 +79,22 @@ class instance_shadow_labyrinth : public InstanceMapScript
}
}
+ void OnCreatureRemove(Creature* creature) override
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_BLACKHEART_DUMMY1:
+ case NPC_BLACKHEART_DUMMY2:
+ case NPC_BLACKHEART_DUMMY3:
+ case NPC_BLACKHEART_DUMMY4:
+ case NPC_BLACKHEART_DUMMY5:
+ BlackheartDummyGUIDs.erase(creature->GetGUID());
+ break;
+ default:
+ break;
+ }
+ }
+
void OnGameObjectCreate(GameObject* go) override
{
switch (go->GetEntry())
@@ -128,6 +154,8 @@ class instance_shadow_labyrinth : public InstanceMapScript
{
switch (type)
{
+ case DATA_BLACKHEART_THE_INCITER:
+ return BlackheartGUID;
case DATA_GRANDMASTER_VORPIL:
return GrandmasterVorpilGUID;
default:
@@ -136,8 +164,12 @@ class instance_shadow_labyrinth : public InstanceMapScript
return ObjectGuid::Empty;
}
+ GuidUnorderedSet const& GetBlackheartDummies() const { return BlackheartDummyGUIDs; }
+
protected:
ObjectGuid AmbassadorHellmawGUID;
+ ObjectGuid BlackheartGUID;
+ GuidUnorderedSet BlackheartDummyGUIDs;
ObjectGuid GrandmasterVorpilGUID;
uint32 FelOverseerCount;
};
@@ -148,6 +180,14 @@ class instance_shadow_labyrinth : public InstanceMapScript
}
};
+GuidUnorderedSet const* GetBlackheartDummies(InstanceScript const* s)
+{
+ if (auto* script = dynamic_cast<instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript const*>(s))
+ return &script->GetBlackheartDummies();
+ return nullptr;
+
+}
+
void AddSC_instance_shadow_labyrinth()
{
new instance_shadow_labyrinth();
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h
index 0c7e7b5afca..262a7b9c494 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h
@@ -19,6 +19,7 @@
#define SHADOW_LABYRINTH_H_
#include "CreatureAIImpl.h"
+#include "ObjectGuid.h"
#define SLScriptName "instance_shadow_labyrinth"
#define DataHeader "SL"
@@ -40,6 +41,12 @@ enum SLDataTypes
enum SLCreatureIds
{
NPC_AMBASSADOR_HELLMAW = 18731,
+ NPC_BLACKHEART = 18667,
+ NPC_BLACKHEART_DUMMY1 = 19300,
+ NPC_BLACKHEART_DUMMY2 = 19301,
+ NPC_BLACKHEART_DUMMY3 = 19302,
+ NPC_BLACKHEART_DUMMY4 = 19303,
+ NPC_BLACKHEART_DUMMY5 = 19304,
NPC_GRANDMASTER_VORPIL = 18732,
NPC_FEL_OVERSEER = 18796
};
@@ -56,6 +63,8 @@ enum SLMisc
ACTION_AMBASSADOR_HELLMAW_BANISH = 2,
};
+GuidUnorderedSet const* GetBlackheartDummies(InstanceScript const* s);
+
template <class AI, class T>
inline AI* GetShadowLabyrinthAI(T* obj)
{