mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
Scripts/Outland: Implement Hellfire event in Honor Hold
This commit is contained in:
@@ -31,10 +31,14 @@ npc_fel_guard_hound
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "CellImpl.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Log.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
/*######
|
||||
@@ -1037,6 +1041,206 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum WatchCommanderLeonus
|
||||
{
|
||||
SAY_COVER = 0,
|
||||
EVENT_LEONUS_TALK = 1,
|
||||
EVENT_INFERNAL_RAIN_ATTACK = 2,
|
||||
EVENT_FEAR_CONTROLLER_CAST = 3,
|
||||
EVENT_ACTIVE_FALSE = 4,
|
||||
NPC_INFERNAL_RAIN = 18729,
|
||||
SPELL_INFERNAL_RAIN = 33814,
|
||||
NPC_FEAR_CONTROLLER = 19393,
|
||||
DATA_ACTIVE = 1,
|
||||
};
|
||||
|
||||
struct npc_watch_commander_leonus : public ScriptedAI
|
||||
{
|
||||
npc_watch_commander_leonus(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_events.Reset();
|
||||
_events.ScheduleEvent(EVENT_LEONUS_TALK, Minutes(2), Minutes(10));
|
||||
_events.ScheduleEvent(EVENT_INFERNAL_RAIN_ATTACK, Minutes(2), Minutes(10));
|
||||
_events.ScheduleEvent(EVENT_FEAR_CONTROLLER_CAST, Minutes(2), Minutes(10));
|
||||
}
|
||||
|
||||
void SetData(uint32 /*type*/, uint32 data) override
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case DATA_ACTIVE:
|
||||
_events.ScheduleEvent(EVENT_ACTIVE_FALSE, Seconds(1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_LEONUS_TALK:
|
||||
Talk(SAY_COVER);
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_SHOUT);
|
||||
break;
|
||||
case EVENT_INFERNAL_RAIN_ATTACK:
|
||||
{
|
||||
std::list<Creature*> infernalrainList;
|
||||
Trinity::AllCreaturesOfEntryInRange checkerInfernalrain(me, NPC_INFERNAL_RAIN, 200.0f);
|
||||
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcherInfernal(me, infernalrainList, checkerInfernalrain);
|
||||
Cell::VisitAllObjects(me, searcherInfernal, 200.0f);
|
||||
|
||||
for (Creature* infernal : infernalrainList)
|
||||
if (!infernal->isMoving() && infernal->GetPositionZ() > 118.0f)
|
||||
infernal->AI()->SetData(DATA_ACTIVE, DATA_ACTIVE);
|
||||
|
||||
break;
|
||||
}
|
||||
case EVENT_FEAR_CONTROLLER_CAST:
|
||||
{
|
||||
std::list<Creature*> fearcontrollerList;
|
||||
Trinity::AllCreaturesOfEntryInRange checkerFear(me, NPC_FEAR_CONTROLLER, 200.0f);
|
||||
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcherFear(me, fearcontrollerList, checkerFear);
|
||||
Cell::VisitAllObjects(me, searcherFear, 200.0f);
|
||||
|
||||
for (Creature* fearController : fearcontrollerList)
|
||||
fearController->AI()->SetData(DATA_ACTIVE, DATA_ACTIVE);
|
||||
|
||||
break;
|
||||
}
|
||||
case EVENT_ACTIVE_FALSE:
|
||||
_events.ScheduleEvent(EVENT_LEONUS_TALK, Hours(1));
|
||||
_events.ScheduleEvent(EVENT_INFERNAL_RAIN_ATTACK, Hours(1));
|
||||
_events.ScheduleEvent(EVENT_FEAR_CONTROLLER_CAST, Hours(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
enum InfernalRainHellfire
|
||||
{
|
||||
EVENT_INFERNAL_RAIN_CAST = 1,
|
||||
EVENT_INFERNAL_RAIN_STOP = 2,
|
||||
NPC_WATCH_COMMANDER_LEONUS = 19392
|
||||
};
|
||||
|
||||
struct npc_infernal_rain_hellfire : public ScriptedAI
|
||||
{
|
||||
npc_infernal_rain_hellfire(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void SetData(uint32 /*type*/, uint32 data) override
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case DATA_ACTIVE:
|
||||
_events.ScheduleEvent(EVENT_INFERNAL_RAIN_CAST, Seconds(1), Seconds(2));
|
||||
_events.ScheduleEvent(EVENT_INFERNAL_RAIN_STOP, Seconds(60));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_INFERNAL_RAIN_CAST:
|
||||
{
|
||||
std::list<Creature*> infernalrainList;
|
||||
Trinity::AllCreaturesOfEntryInRange checker(me, NPC_INFERNAL_RAIN, 200.0f);
|
||||
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, infernalrainList, checker);
|
||||
Cell::VisitAllObjects(me, searcher, 200.0f);
|
||||
|
||||
if (!infernalrainList.empty())
|
||||
{
|
||||
Creature* random = Trinity::Containers::SelectRandomContainerElement(infernalrainList);
|
||||
if (random->isMoving() && random->GetPositionZ() < 118.0f)
|
||||
{
|
||||
me->CastSpell(random, SPELL_INFERNAL_RAIN, true);
|
||||
}
|
||||
}
|
||||
|
||||
_events.ScheduleEvent(EVENT_INFERNAL_RAIN_CAST, Seconds(1), Seconds(2));
|
||||
break;
|
||||
}
|
||||
case EVENT_INFERNAL_RAIN_STOP:
|
||||
_events.CancelEvent(EVENT_INFERNAL_RAIN_CAST);
|
||||
if (Creature* watchcommanderLeonus = me->FindNearestCreature(NPC_WATCH_COMMANDER_LEONUS, 200))
|
||||
watchcommanderLeonus->AI()->SetData(DATA_ACTIVE, DATA_ACTIVE);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
enum fear_controller
|
||||
{
|
||||
EVENT_FEAR_CAST = 1,
|
||||
EVENT_FEAR_STOP = 2,
|
||||
SPELL_FEAR = 33815 // Serverside spell
|
||||
};
|
||||
|
||||
struct npc_fear_controller : public ScriptedAI
|
||||
{
|
||||
npc_fear_controller(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void SetData(uint32 /*type*/, uint32 data) override
|
||||
{
|
||||
if (data == DATA_ACTIVE)
|
||||
{
|
||||
_events.ScheduleEvent(EVENT_FEAR_CAST, Seconds(1));
|
||||
_events.ScheduleEvent(EVENT_FEAR_STOP, Seconds(60));
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_FEAR_CAST:
|
||||
DoCastAOE(SPELL_FEAR);
|
||||
_events.Repeat(Seconds(10));
|
||||
break;
|
||||
case EVENT_FEAR_STOP:
|
||||
_events.CancelEvent(EVENT_FEAR_CAST);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
void AddSC_hellfire_peninsula()
|
||||
{
|
||||
new npc_aeranas();
|
||||
@@ -1046,4 +1250,7 @@ void AddSC_hellfire_peninsula()
|
||||
new npc_colonel_jules();
|
||||
new npc_barada();
|
||||
new npc_magister_aledis();
|
||||
RegisterCreatureAI(npc_watch_commander_leonus);
|
||||
RegisterCreatureAI(npc_infernal_rain_hellfire);
|
||||
RegisterCreatureAI(npc_fear_controller);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user