mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 08:00:48 +01:00
Scripts/Auchindoun: Last one, hopefully. Remove reliance on large grid searchers by integrating with instance script.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user