aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_account.cpp12
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp28
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp8
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp49
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp12
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp497
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp266
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h6
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp4
10 files changed, 433 insertions, 455 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 332169ebd00..45ab88e9688 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -450,12 +450,12 @@ public:
uint32 pwConfig = sWorld->getIntConfig(CONFIG_ACC_PASSCHANGESEC); // 0 - PW_NONE, 1 - PW_EMAIL, 2 - PW_RBAC
// Command is supposed to be: .account password [$oldpassword] [$newpassword] [$newpasswordconfirmation] [$emailconfirmation]
- char* oldPassword = strtok((char*)args, " "); // This extracts [$oldpassword]
- char* newPassword = strtok(NULL, " "); // This extracts [$newpassword]
- char* passwordConfirmation = strtok(NULL, " "); // This extracts [$newpasswordconfirmation]
- const char* emailConfirmation; // This defines the emailConfirmation variable, which is optional depending on sec type.
- if (!(emailConfirmation = strtok(NULL, " "))) // This extracts [$emailconfirmation]. If it doesn't exist, however...
- emailConfirmation = ""; // ... it's simply "" for emailConfirmation.
+ char* oldPassword = strtok((char*)args, " "); // This extracts [$oldpassword]
+ char* newPassword = strtok(NULL, " "); // This extracts [$newpassword]
+ char* passwordConfirmation = strtok(NULL, " "); // This extracts [$newpasswordconfirmation]
+ char const* emailConfirmation = strtok(NULL, " "); // This defines the emailConfirmation variable, which is optional depending on sec type.
+ if (!emailConfirmation) // This extracts [$emailconfirmation]. If it doesn't exist, however...
+ emailConfirmation = ""; // ... it's simply "" for emailConfirmation.
//Is any of those variables missing for any reason ? We return false.
if (!oldPassword || !newPassword || !passwordConfirmation)
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 6c831520d59..f33e583522e 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -31,6 +31,7 @@ EndScriptData */
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "GossipDef.h"
+#include "Transport.h"
#include "Language.h"
#include <fstream>
@@ -91,6 +92,7 @@ public:
{ "areatriggers", rbac::RBAC_PERM_COMMAND_DEBUG_AREATRIGGERS, false, &HandleDebugAreaTriggersCommand, "", NULL },
{ "los", rbac::RBAC_PERM_COMMAND_DEBUG_LOS, false, &HandleDebugLoSCommand, "", NULL },
{ "moveflags", rbac::RBAC_PERM_COMMAND_DEBUG_MOVEFLAGS, false, &HandleDebugMoveflagsCommand, "", NULL },
+ { "transport", rbac::RBAC_PERM_COMMAND_DEBUG_TRANSPORT, false, &HandleDebugTransportCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
@@ -179,7 +181,7 @@ public:
return false;
}
- if (handler->GetSession()->GetPlayer()->GetSelection())
+ if (handler->GetSession()->GetPlayer()->GetTarget())
unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer());
else
unit->PlayDirectSound(soundId, handler->GetSession()->GetPlayer());
@@ -1363,6 +1365,30 @@ public:
handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
return true;
}
+
+ static bool HandleDebugTransportCommand(ChatHandler* handler, char const* args)
+ {
+ Transport* transport = handler->GetSession()->GetPlayer()->GetTransport();
+ if (!transport)
+ return false;
+
+ bool start = false;
+ if (!stricmp(args, "stop"))
+ transport->EnableMovement(false);
+ else if (!stricmp(args, "start"))
+ {
+ transport->EnableMovement(true);
+ start = true;
+ }
+ else
+ {
+ handler->PSendSysMessage("Transport %s is %s", transport->GetName().c_str(), transport->GetGoState() == GO_STATE_READY ? "stopped" : "moving");
+ return true;
+ }
+
+ handler->PSendSysMessage("Transport %s %s", transport->GetName().c_str(), start ? "started" : "stopped");
+ return true;
+ }
};
void AddSC_debug_commandscript()
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 513d378287b..3d531cee1f5 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -529,7 +529,7 @@ public:
{
Unit* target = handler->getSelectedUnit();
- if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
@@ -597,7 +597,7 @@ public:
static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
{
- uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
+ uint64 guid = handler->GetSession()->GetPlayer()->GetTarget();
if (guid == 0)
{
@@ -1762,7 +1762,7 @@ public:
// accept only explicitly selected target (not implicitly self targeting case)
Unit* target = handler->getSelectedUnit();
- if (player->GetSelection() && target)
+ if (player->GetTarget() && target)
{
if (target->GetTypeId() != TYPEID_UNIT || target->IsPet())
{
@@ -2107,7 +2107,7 @@ public:
}
Unit* target = handler->getSelectedUnit();
- if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index f10a929c675..a1b23fd5935 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -245,24 +245,22 @@ public:
float o = chr->GetOrientation();
Map* map = chr->GetMap();
- if (chr->GetTransport())
+ if (Transport* trans = chr->GetTransport())
{
- uint32 tguid = chr->GetTransport()->AddNPCPassenger(0, id, chr->GetTransOffsetX(), chr->GetTransOffsetY(), chr->GetTransOffsetZ(), chr->GetTransOffsetO());
- if (tguid > 0)
- {
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_TRANSPORT);
+ uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
+ CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
+ data.id = id;
+ data.phaseMask = chr->GetPhaseMaskForSpawn();
+ data.posX = chr->GetTransOffsetX();
+ data.posY = chr->GetTransOffsetY();
+ data.posZ = chr->GetTransOffsetZ();
+ data.orientation = chr->GetTransOffsetO();
- stmt->setInt32(0, int32(tguid));
- stmt->setInt32(1, int32(id));
- stmt->setInt32(2, int32(chr->GetTransport()->GetEntry()));
- stmt->setFloat(3, chr->GetTransOffsetX());
- stmt->setFloat(4, chr->GetTransOffsetY());
- stmt->setFloat(5, chr->GetTransOffsetZ());
- stmt->setFloat(6, chr->GetTransOffsetO());
+ Creature* creature = trans->CreateNPCPassenger(guid, &data);
- WorldDatabase.Execute(stmt);
- }
+ creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn());
+ sObjectMgr->AddCreatureToGrid(guid, &data);
return true;
}
@@ -899,17 +897,6 @@ public:
return false;
}
- if (target->GetTransport() && target->GetGUIDTransport())
- {
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_TRANSPORT_EMOTE);
-
- stmt->setInt32(0, int32(emote));
- stmt->setInt32(1, target->GetTransport()->GetEntry());
- stmt->setInt32(2, target->GetGUIDTransport());
-
- WorldDatabase.Execute(stmt);
- }
-
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, emote);
return true;
@@ -1297,22 +1284,17 @@ public:
char* receiver_str = strtok((char*)args, " ");
char* text = strtok(NULL, "");
- uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
- Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(guid);
-
+ Creature* creature = handler->getSelectedCreature();
if (!creature || !receiver_str || !text)
- {
return false;
- }
- uint64 receiver_guid= atol(receiver_str);
+ uint64 receiver_guid = atol(receiver_str);
// check online security
if (handler->HasLowerSecurity(ObjectAccessor::FindPlayer(receiver_guid), 0))
return false;
creature->MonsterWhisper(text, receiver_guid);
-
return true;
}
@@ -1342,7 +1324,8 @@ public:
{
if (!*args)
return false;
- char* charID = strtok((char*)args, " ");
+
+ char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
if (!charID)
return false;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index fb2d8374c18..1b5d0a80eda 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -580,7 +580,11 @@ public:
Map::PlayerList const& players = me->GetMap()->GetPlayers();
if (!players.isEmpty())
- sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 285);
+ {
+ if (Group* group = players.begin()->GetSource()->GetGroup())
+ if (group->isLFGGroup())
+ sLFGMgr->FinishDungeon(group->GetGUID(), 285);
+ }
}
void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
index d8dfa2f5cf6..19024172aa0 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
@@ -196,7 +196,7 @@ public:
TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance The Black Morass: Starting event.");
InitWorldState();
m_auiEncounter[1] = IN_PROGRESS;
- Events.ScheduleEvent(EVENT_NEXT_PORTAL, 15000);
+ ScheduleEventNextPortal(15000);
}
if (data == DONE)
@@ -228,7 +228,7 @@ public:
if (data == SPECIAL)
{
if (mRiftPortalCount < 7)
- Events.ScheduleEvent(EVENT_NEXT_PORTAL, 5000);
+ ScheduleEventNextPortal(5000);
}
else
m_auiEncounter[1] = data;
@@ -336,10 +336,16 @@ public:
++mRiftPortalCount;
DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount);
DoSpawnPortal();
- Events.ScheduleEvent(EVENT_NEXT_PORTAL, RiftWaves[GetRiftWaveId()].NextPortalTime);
+ ScheduleEventNextPortal(RiftWaves[GetRiftWaveId()].NextPortalTime);
}
}
+ void ScheduleEventNextPortal(uint32 nextPortalTime)
+ {
+ if (nextPortalTime > 0)
+ Events.RescheduleEvent(EVENT_NEXT_PORTAL, nextPortalTime);
+ }
+
protected:
EventMap Events;
};
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
index 2f01cc734e6..e0098570923 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "Player.h"
#include "ahnkahet.h"
enum Spells
@@ -29,11 +30,9 @@ enum Spells
SPELL_FLAME_SPHERE_SPAWN_EFFECT = 55891,
SPELL_FLAME_SPHERE_VISUAL = 55928,
SPELL_FLAME_SPHERE_PERIODIC = 55926,
- H_SPELL_FLAME_SPHERE_PERIODIC = 59508,
SPELL_FLAME_SPHERE_DEATH_EFFECT = 55947,
SPELL_BEAM_VISUAL = 60342,
SPELL_EMBRACE_OF_THE_VAMPYR = 55959,
- H_SPELL_EMBRACE_OF_THE_VAMPYR = 59513,
SPELL_VANISH = 55964,
CREATURE_FLAME_SPHERE = 30106,
H_CREATURE_FLAME_SPHERE_1 = 31686,
@@ -48,8 +47,8 @@ enum Misc
DATA_SPHERE_DISTANCE = 15
};
-#define DATA_SPHERE_ANGLE_OFFSET 0.7f
-#define DATA_GROUND_POSITION_Z 11.30809f
+#define DATA_SPHERE_ANGLE_OFFSET 0.7f
+#define DATA_GROUND_POSITION_Z 11.30809f
enum Yells
{
@@ -61,315 +60,299 @@ enum Yells
SAY_FEED = 5,
SAY_VANISH = 6
};
-enum CombatPhase
+
+enum Events
+{
+ EVENT_CASTING_FLAME_SPHERES = 1,
+ EVENT_JUST_VANISHED,
+ EVENT_VANISHED,
+ EVENT_FEEDING,
+
+ EVENT_BLOODTHIRST,
+ EVENT_FLAME_SPHERE,
+ EVENT_VANISH
+};
+
+enum Phase
{
- NORMAL,
- CASTING_FLAME_SPHERES,
- JUST_VANISHED,
- VANISHED,
- FEEDING
+ PHASE_NORMAL = 1,
+ PHASE_SPECIAL = 2
};
class boss_taldaram : public CreatureScript
{
-public:
- boss_taldaram() : CreatureScript("boss_taldaram") { }
+ public:
+ boss_taldaram() : CreatureScript("boss_taldaram") { }
- struct boss_taldaramAI : public ScriptedAI
- {
- boss_taldaramAI(Creature* creature) : ScriptedAI(creature)
+ struct boss_taldaramAI : public BossAI
{
- instance = creature->GetInstanceScript();
- me->SetDisableGravity(true);
- }
-
- uint32 uiBloodthirstTimer;
- uint32 uiVanishTimer;
- uint32 uiWaitTimer;
- uint32 uiEmbraceTimer;
- uint32 uiEmbraceTakenDamage;
- uint32 uiFlamesphereTimer;
- uint32 uiPhaseTimer;
+ boss_taldaramAI(Creature* creature) : BossAI(creature, DATA_PRINCE_TALDARAM)
+ {
+ me->SetDisableGravity(true);
+ }
- uint64 uiEmbraceTarget;
+ void Reset() OVERRIDE
+ {
+ _Reset();
+ _embraceTargetGUID = 0;
+ _embraceTakenDamage = 0;
+ }
- CombatPhase Phase;
+ void EnterCombat(Unit* /*who*/) OVERRIDE
+ {
+ _EnterCombat();
+ Talk(SAY_AGGRO);
+ events.SetPhase(PHASE_NORMAL);
+ events.ScheduleEvent(EVENT_BLOODTHIRST, 10000);
+ events.ScheduleEvent(EVENT_VANISH, urand(25000, 35000));
+ events.ScheduleEvent(EVENT_FLAME_SPHERE, 5000);
+ }
- InstanceScript* instance;
+ void UpdateAI(uint32 diff) OVERRIDE
+ {
+ if (!UpdateVictim())
+ return;
- void Reset() OVERRIDE
- {
- uiBloodthirstTimer = 10*IN_MILLISECONDS;
- uiVanishTimer = urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS);
- uiEmbraceTimer = 20*IN_MILLISECONDS;
- uiFlamesphereTimer = 5*IN_MILLISECONDS;
- uiEmbraceTakenDamage = 0;
- Phase = NORMAL;
- uiPhaseTimer = 0;
- uiEmbraceTarget = 0;
- if (instance)
- instance->SetBossState(DATA_PRINCE_TALDARAM, NOT_STARTED);
- }
+ events.Update(diff);
- void EnterCombat(Unit* /*who*/) OVERRIDE
- {
- if (instance)
- instance->SetBossState(DATA_PRINCE_TALDARAM, IN_PROGRESS);
- Talk(SAY_AGGRO);
- }
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- void UpdateAI(uint32 diff) OVERRIDE
- {
- if (!UpdateVictim())
- return;
- if (uiPhaseTimer <= diff)
- {
- switch (Phase)
+ while (uint32 eventId = events.ExecuteEvent())
{
- case CASTING_FLAME_SPHERES:
+ switch (eventId)
{
- Creature* pSpheres[3];
-
- //DoCast(me, SPELL_FLAME_SPHERE_SUMMON_1);
- pSpheres[0] = DoSpawnCreature(CREATURE_FLAME_SPHERE, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS);
- Unit* pSphereTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
- if (pSphereTarget && pSpheres[0])
- {
- float angle, x, y;
- angle = pSpheres[0]->GetAngle(pSphereTarget);
- x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle);
- y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle);
- pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ());
- }
- if (IsHeroic())
+ if (events.IsInPhase(PHASE_NORMAL))
{
- //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_1);
- pSpheres[1] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_1, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS);
- //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_2);
- pSpheres[2] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_2, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS);
- if (pSphereTarget && pSpheres[1] && pSpheres[2])
+ case EVENT_BLOODTHIRST:
+ DoCast(me, SPELL_BLOODTHIRST);
+ events.ScheduleEvent(EVENT_BLOODTHIRST, 10000);
+ break;
+ case EVENT_FLAME_SPHERE:
+ DoCastVictim(SPELL_CONJURE_FLAME_SPHERE);
+ events.SetPhase(PHASE_SPECIAL);
+ events.ScheduleEvent(EVENT_CASTING_FLAME_SPHERES, 3000);
+ events.ScheduleEvent(EVENT_FLAME_SPHERE, 15000);
+ break;
+ case EVENT_VANISH:
{
- float angle, x, y;
- angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET;
- x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
- y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
- pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ());
- angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET;
- x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
- y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
- pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ());
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
+ uint32 targets = 0;
+ for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
+ {
+ Player* player = i->GetSource();
+ if (player && player->IsAlive())
+ ++targets;
+ }
+
+ if (targets > 2)
+ {
+ Talk(SAY_VANISH);
+ DoCast(me, SPELL_VANISH);
+ events.SetPhase(PHASE_SPECIAL);
+ events.ScheduleEvent(EVENT_JUST_VANISHED, 500);
+ if (Unit* embraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
+ _embraceTargetGUID = embraceTarget->GetGUID();
+ }
+ events.ScheduleEvent(EVENT_VANISH, urand(25000, 35000));
+ break;
}
}
-
- Phase = NORMAL;
- uiPhaseTimer = 0;
- break;
- }
- case JUST_VANISHED:
- if (Unit* pEmbraceTarget = GetEmbraceTarget())
- {
- me->GetMotionMaster()->Clear();
- me->SetSpeed(MOVE_WALK, 2.0f, true);
- me->GetMotionMaster()->MoveChase(pEmbraceTarget);
- }
- Phase = VANISHED;
- uiPhaseTimer = 1300;
- break;
- case VANISHED:
- if (Unit* pEmbraceTarget = GetEmbraceTarget())
- DoCast(pEmbraceTarget, DUNGEON_MODE(SPELL_EMBRACE_OF_THE_VAMPYR, H_SPELL_EMBRACE_OF_THE_VAMPYR));
- Talk(SAY_FEED);
- me->GetMotionMaster()->Clear();
- me->SetSpeed(MOVE_WALK, 1.0f, true);
- me->GetMotionMaster()->MoveChase(me->GetVictim());
- Phase = FEEDING;
- uiPhaseTimer = 20*IN_MILLISECONDS;
- break;
- case FEEDING:
- Phase = NORMAL;
- uiPhaseTimer = 0;
- uiEmbraceTarget = 0;
- break;
- case NORMAL:
- if (uiBloodthirstTimer <= diff)
+ case EVENT_CASTING_FLAME_SPHERES:
{
- DoCast(me, SPELL_BLOODTHIRST);
- uiBloodthirstTimer = 10*IN_MILLISECONDS;
- } else uiBloodthirstTimer -= diff;
+ events.SetPhase(PHASE_NORMAL);
+ Unit* sphereTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
+ if (!sphereTarget)
+ break;
- if (uiFlamesphereTimer <= diff)
- {
- // because TARGET_UNIT_TARGET_ENEMY we need a target selected to cast
- DoCastVictim(SPELL_CONJURE_FLAME_SPHERE);
- Phase = CASTING_FLAME_SPHERES;
- uiPhaseTimer = 3*IN_MILLISECONDS + diff;
- uiFlamesphereTimer = 15*IN_MILLISECONDS;
- } else uiFlamesphereTimer -= diff;
-
- if (uiVanishTimer <= diff)
- {
- //Count alive players
- Unit* target = NULL;
- std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
- std::vector<Unit*> target_list;
- for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ float angle, x, y;
+
+ //DoCast(me, SPELL_FLAME_SPHERE_SUMMON_1);
+ if (Creature* sphere = DoSpawnCreature(CREATURE_FLAME_SPHERE, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS))
{
- target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
- // exclude pets & totems
- if (target && target->GetTypeId() == TYPEID_PLAYER && target->IsAlive())
- target_list.push_back(target);
- target = NULL;
+ angle = sphere->GetAngle(sphereTarget);
+ x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle);
+ y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle);
+ sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ());
}
- //He only vanishes if there are 3 or more alive players
- if (target_list.size() > 2)
- {
- Talk(SAY_VANISH);
- DoCast(me, SPELL_VANISH);
- Phase = JUST_VANISHED;
- uiPhaseTimer = 500;
- if (Unit* pEmbraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- uiEmbraceTarget = pEmbraceTarget->GetGUID();
+ if (IsHeroic())
+ {
+ //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_1);
+ if (Creature* sphere = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_1, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS))
+ {
+ angle = sphere->GetAngle(sphereTarget) + DATA_SPHERE_ANGLE_OFFSET;
+ x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
+ y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
+ sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ());
+ }
+
+ //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_2);
+ if (Creature* sphere = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_2, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS))
+ {
+ angle = sphere->GetAngle(sphereTarget) - DATA_SPHERE_ANGLE_OFFSET;
+ x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
+ y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
+ sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ());
+ }
}
- uiVanishTimer = urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS);
- } else uiVanishTimer -= diff;
-
- DoMeleeAttackIfReady();
- break;
+ break;
+ }
+ case EVENT_JUST_VANISHED:
+ if (Unit* embraceTarget = GetEmbraceTarget())
+ {
+ me->GetMotionMaster()->Clear();
+ me->SetSpeed(MOVE_WALK, 2.0f, true);
+ me->GetMotionMaster()->MoveChase(embraceTarget);
+ }
+ events.ScheduleEvent(EVENT_VANISHED, 1300);
+ break;
+ case EVENT_VANISHED:
+ if (Unit* embraceTarget = GetEmbraceTarget())
+ DoCast(embraceTarget, SPELL_EMBRACE_OF_THE_VAMPYR);
+ Talk(SAY_FEED);
+ me->GetMotionMaster()->Clear();
+ me->SetSpeed(MOVE_WALK, 1.0f, true);
+ me->GetMotionMaster()->MoveChase(me->GetVictim());
+ events.ScheduleEvent(EVENT_FEEDING, 20000);
+ break;
+ case EVENT_FEEDING:
+ _embraceTargetGUID = 0;
+ events.SetPhase(PHASE_NORMAL);
+ break;
+ default:
+ break;
+ }
}
- } else uiPhaseTimer -= diff;
- }
- void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE
- {
- Unit* pEmbraceTarget = GetEmbraceTarget();
+ DoMeleeAttackIfReady();
+ }
- if (Phase == FEEDING && pEmbraceTarget && pEmbraceTarget->IsAlive())
+ void DamageTaken(Unit* /*doneBy*/, uint32& damage) OVERRIDE
{
- uiEmbraceTakenDamage += damage;
- if (uiEmbraceTakenDamage > (uint32) DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
- {
- Phase = NORMAL;
- uiPhaseTimer = 0;
- uiEmbraceTarget = 0;
- me->CastStop();
- }
+ Unit* embraceTarget = GetEmbraceTarget();
+
+ if (events.IsInPhase(PHASE_SPECIAL) && embraceTarget && embraceTarget->IsAlive())
+ {
+ _embraceTakenDamage += damage;
+ if (_embraceTakenDamage > DUNGEON_MODE<uint32>(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
+ {
+ _embraceTargetGUID = 0;
+ events.SetPhase(PHASE_NORMAL);
+ me->CastStop();
+ }
+ }
}
- }
- void JustDied(Unit* /*killer*/) OVERRIDE
- {
- Talk(SAY_DEATH);
+ void JustDied(Unit* /*killer*/) OVERRIDE
+ {
+ Talk(SAY_DEATH);
+ _JustDied();
+ }
- if (instance)
- instance->SetBossState(DATA_PRINCE_TALDARAM, DONE);
- }
+ void KilledUnit(Unit* victim) OVERRIDE
+ {
+ if (victim->GetTypeId() != TYPEID_PLAYER)
+ return;
- void KilledUnit(Unit* victim) OVERRIDE
- {
- if (victim->GetTypeId() != TYPEID_PLAYER)
- return;
+ Unit* embraceTarget = GetEmbraceTarget();
+ if (events.IsInPhase(PHASE_SPECIAL) && embraceTarget && victim == embraceTarget)
+ {
+ _embraceTargetGUID = 0;
+ events.SetPhase(PHASE_NORMAL);
+ }
+ Talk(SAY_SLAY);
+ }
- Unit* pEmbraceTarget = GetEmbraceTarget();
- if (Phase == FEEDING && pEmbraceTarget && victim == pEmbraceTarget)
+ bool CheckSpheres()
{
- Phase = NORMAL;
- uiPhaseTimer = 0;
- uiEmbraceTarget = 0;
- }
- Talk(SAY_SLAY);
- }
+ for (uint8 i = 0; i < 2; ++i)
+ if (!instance->GetData(DATA_SPHERE_1 + i))
+ return false;
- bool CheckSpheres()
- {
- for (uint8 i = 0; i < 2; ++i)
- if (!instance->GetData(DATA_SPHERE_1 + i))
- return false;
+ RemovePrison();
+ return true;
+ }
- RemovePrison();
- return true;
- }
+ Unit* GetEmbraceTarget()
+ {
+ if (_embraceTargetGUID)
+ return ObjectAccessor::GetUnit(*me, _embraceTargetGUID);
- Unit* GetEmbraceTarget()
- {
- if (!uiEmbraceTarget)
return NULL;
+ }
- return Unit::GetUnit(*me, uiEmbraceTarget);
- }
+ void RemovePrison()
+ {
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->RemoveAurasDueToSpell(SPELL_BEAM_VISUAL);
+ me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation());
+ DoCast(SPELL_HOVER_FALL);
+ me->SetDisableGravity(false);
+ me->GetMotionMaster()->MovePoint(0, me->GetHomePosition());
+ Talk(SAY_WARNING);
+ instance->HandleGameObject(instance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM), true);
+ }
+
+ private:
+ uint64 _embraceTargetGUID;
+ uint32 _embraceTakenDamage;
+ };
- void RemovePrison()
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
- if (!instance)
- return;
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- me->RemoveAurasDueToSpell(SPELL_BEAM_VISUAL);
- me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation());
- DoCast(SPELL_HOVER_FALL);
- me->SetDisableGravity(false);
- me->GetMotionMaster()->MovePoint(0, me->GetHomePosition());
- Talk(SAY_WARNING);
- uint64 prison_GUID = instance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM);
- instance->HandleGameObject(prison_GUID, true);
+ return GetAhnKahetAI<boss_taldaramAI>(creature);
}
- };
-
- CreatureAI* GetAI(Creature* creature) const OVERRIDE
- {
- return GetAhnKahetAI<boss_taldaramAI>(creature);
- }
};
class npc_taldaram_flamesphere : public CreatureScript
{
-public:
- npc_taldaram_flamesphere() : CreatureScript("npc_taldaram_flamesphere") { }
+ public:
+ npc_taldaram_flamesphere() : CreatureScript("npc_taldaram_flamesphere") { }
- struct npc_taldaram_flamesphereAI : public ScriptedAI
- {
- npc_taldaram_flamesphereAI(Creature* creature) : ScriptedAI(creature)
+ struct npc_taldaram_flamesphereAI : public ScriptedAI
{
- instance = creature->GetInstanceScript();
- }
+ npc_taldaram_flamesphereAI(Creature* creature) : ScriptedAI(creature)
+ {
+ }
- uint32 uiDespawnTimer;
- InstanceScript* instance;
+ void Reset() OVERRIDE
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ //! HACK: Creature's can't have MOVEMENTFLAG_FLYING
+ me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
+ me->setFaction(16);
+ me->SetObjectScale(1.0f);
+ DoCast(me, SPELL_FLAME_SPHERE_VISUAL);
+ DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT);
+ DoCast(me, SPELL_FLAME_SPHERE_PERIODIC);
+ _despawnTimer = 10 * IN_MILLISECONDS;
+ }
- void Reset() OVERRIDE
- {
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- //! HACK: Creature's can't have MOVEMENTFLAG_FLYING
- me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
- me->setFaction(16);
- me->SetObjectScale(1.0f);
- DoCast(me, SPELL_FLAME_SPHERE_VISUAL);
- DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT);
- DoCast(me, SPELL_FLAME_SPHERE_PERIODIC);
- uiDespawnTimer = 10*IN_MILLISECONDS;
- }
+ void EnterCombat(Unit* /*who*/) OVERRIDE { }
+ void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
- void EnterCombat(Unit* /*who*/) OVERRIDE {}
- void MoveInLineOfSight(Unit* /*who*/) OVERRIDE {}
+ void JustDied(Unit* /*killer*/) OVERRIDE
+ {
+ DoCast(me, SPELL_FLAME_SPHERE_DEATH_EFFECT);
+ }
+ void UpdateAI(uint32 diff) OVERRIDE
+ {
+ if (_despawnTimer <= diff)
+ me->DisappearAndDie();
+ else
+ _despawnTimer -= diff;
+ }
- void JustDied(Unit* /*killer*/) OVERRIDE
- {
- DoCast(me, SPELL_FLAME_SPHERE_DEATH_EFFECT);
- }
+ private:
+ uint32 _despawnTimer;
+ };
- void UpdateAI(uint32 diff) OVERRIDE
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
- if (uiDespawnTimer <= diff)
- me->DisappearAndDie();
- else
- uiDespawnTimer -= diff;
+ return new npc_taldaram_flamesphereAI(creature);
}
- };
-
- CreatureAI* GetAI(Creature* creature) const OVERRIDE
- {
- return new npc_taldaram_flamesphereAI(creature);
- }
};
class prince_taldaram_sphere : public GameObjectScript
@@ -377,7 +360,7 @@ class prince_taldaram_sphere : public GameObjectScript
public:
prince_taldaram_sphere() : GameObjectScript("prince_taldaram_sphere") { }
- bool OnGossipHello(Player* /*player*/, GameObject* go)
+ bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE
{
InstanceScript* instance = go->GetInstanceScript();
if (!instance)
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
index 987807c2080..04145b8784e 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -181,7 +181,7 @@ enum Events
EVENT_ESCAPE_13,
EVENT_ESCAPE_14,
EVENT_ESCAPE_15,
- EVENT_ESCAPE_16,
+ //EVENT_ESCAPE_16,
EVENT_ESCAPE_17,
EVENT_ESCAPE_18,
EVENT_ESCAPE_19,
@@ -226,7 +226,7 @@ enum Spells
SPELL_SOUL_REAPER = 69409, // Lich King Soul Reaper
SPELL_FURY_OF_FROSTMOURNE = 70063, // Lich King Fury of FrostMourne
SPELL_JAINA_DESTROY_ICE_WALL = 69784, // Jaina
- SPELL_SYLVANAS_DESTROY_ICE_WALL = 70225, // Sylvanas
+ SPELL_SYLVANAS_DESTROY_ICE_WALL = 70224, // Sylvanas
SPELL_SYLVANAS_JUMP = 68339, // Sylvanas Jump
SPELL_RAISE_DEAD = 69818,
SPELL_HARVEST_SOUL = 70070,
@@ -234,16 +234,16 @@ enum Spells
SPELL_SUMMON_LUMBERING_ABOMINATION = 69835,
SPELL_SUMMON_ICE_WALL = 69768, // Visual effect and icewall summoning
- //Raging gnoul
+ // Raging Ghoul
SPELL_EMERGE_VISUAL = 50142,
SPELL_GHOUL_JUMP = 70150,
- //Witch Doctor
+ // Witch Doctor
SPELL_COURSE_OF_DOOM = 70144,
SPELL_SHADOW_BOLT_VOLLEY = 70145,
SPELL_SHADOW_BOLT = 70080,
- //Lumbering Abomination
+ // Lumbering Abomination
SPELL_ABON_STRIKE = 40505,
SPELL_VOMIT_SPRAY = 70176,
};
@@ -344,6 +344,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
void UpdateAI(uint32 diff) OVERRIDE
{
_events.Update(diff);
+
switch (_events.ExecuteEvent())
{
case EVENT_WALK_INTRO1:
@@ -398,7 +399,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_A2_5, 2000);
break;
case EVENT_INTRO_A2_5:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_A2_1);
_events.ScheduleEvent(EVENT_INTRO_A2_6, 3000);
break;
@@ -407,7 +408,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_A2_7, 7000);
break;
case EVENT_INTRO_A2_7:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_A2_2);
_events.ScheduleEvent(EVENT_INTRO_A2_8, 7000);
break;
@@ -416,7 +417,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_A2_9, 1200);
break;
case EVENT_INTRO_A2_9:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_A2_3);
_events.ScheduleEvent(EVENT_INTRO_A2_10, 11000);
break;
@@ -425,7 +426,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_A2_11, 6000);
break;
case EVENT_INTRO_A2_11:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_A2_4);
_events.ScheduleEvent(EVENT_INTRO_A2_12, 12000);
break;
@@ -434,7 +435,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_A2_13, 6000);
break;
case EVENT_INTRO_A2_13:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_A2_5);
_events.ScheduleEvent(EVENT_INTRO_A2_14, 13000);
break;
@@ -443,12 +444,12 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_A2_15, 12000);
break;
case EVENT_INTRO_A2_15:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_A2_6);
_events.ScheduleEvent(EVENT_INTRO_A2_16, 25000);
break;
case EVENT_INTRO_A2_16:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_A2_7);
_events.ScheduleEvent(EVENT_INTRO_A2_17, 6000);
break;
@@ -457,7 +458,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_A2_18, 5000);
break;
case EVENT_INTRO_A2_18:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
{
uther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
uther->AI()->Talk(SAY_UTHER_INTRO_A2_8);
@@ -494,7 +495,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_H2_5, 2000);
break;
case EVENT_INTRO_H2_5:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_H2_1);
_events.ScheduleEvent(EVENT_INTRO_H2_6, 11000);
break;
@@ -503,7 +504,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_H2_7, 3000);
break;
case EVENT_INTRO_H2_7:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_H2_2);
_events.ScheduleEvent(EVENT_INTRO_H2_8, 6000);
break;
@@ -512,7 +513,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_H2_9, 5000);
break;
case EVENT_INTRO_H2_9:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_H2_3);
_events.ScheduleEvent(EVENT_INTRO_H2_10, 19000);
break;
@@ -521,7 +522,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_H2_11, 1500);
break;
case EVENT_INTRO_H2_11:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_H2_4);
_events.ScheduleEvent(EVENT_INTRO_H2_12, 19500);
break;
@@ -530,7 +531,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_H2_13, 2000);
break;
case EVENT_INTRO_H2_13:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
{
uther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
uther->AI()->Talk(SAY_UTHER_INTRO_H2_5);
@@ -538,7 +539,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_H2_14, 12000);
break;
case EVENT_INTRO_H2_14:
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
uther->AI()->Talk(SAY_UTHER_INTRO_H2_6);
_events.ScheduleEvent(EVENT_INTRO_H2_15, 8000);
break;
@@ -557,7 +558,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_OPEN_FROSTWORN_DOOR, 0);
_events.ScheduleEvent(EVENT_CLOSE_FROSTWORN_DOOR, 4000);
}
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
{
uther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER);
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
@@ -568,13 +569,13 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_LK_2, 10000);
break;
case EVENT_INTRO_LK_2:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->AI()->Talk(SAY_LK_INTRO_1);
_events.ScheduleEvent(EVENT_INTRO_LK_3, 1000);
break;
case EVENT_INTRO_LK_3:
// The Lich King banishes Uther to the abyss.
- if (Creature* uther = me->GetCreature(*me, _utherGUID))
+ if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID))
{
uther->CastSpell(uther, SPELL_UTHER_DESPAWN, true);
uther->DespawnOrUnsummon(5000);
@@ -584,7 +585,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
break;
case EVENT_INTRO_LK_4:
// He steps forward and removes the runeblade from the heap of skulls.
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (GameObject* frostmourne = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_FROSTMOURNE)))
frostmourne->SetPhaseMask(2, true);
@@ -594,7 +595,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_LK_5, 8000);
break;
case EVENT_INTRO_LK_5:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->AI()->Talk(SAY_LK_INTRO_2);
_events.ScheduleEvent(EVENT_INTRO_LK_6, 10000);
break;
@@ -610,7 +611,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true);
marwyn->SetVisible(true);
}
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->AI()->Talk(SAY_LK_INTRO_3);
lichking->SetWalk(true);
@@ -653,7 +654,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_LK_11, 5000);
break;
case EVENT_INTRO_LK_11:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
lichking->AI()->Talk(SAY_LK_JAINA_INTRO_END);
@@ -666,7 +667,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
if (_instance)
_instance->SetData(DATA_INTRO_EVENT, DONE);
// Loralen or Koreln disappearAndDie()
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->DespawnOrUnsummon(5000);
_lichkingGUID = 0;
@@ -702,7 +703,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
- return new npc_jaina_or_sylvanas_horAI(creature);
+ return GetHallsOfReflectionAI<npc_jaina_or_sylvanas_horAI>(creature);
}
};
@@ -716,9 +717,8 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
{
npc_jaina_or_sylvanas_escape_horAI(Creature* creature) : ScriptedAI(creature),
_instance(creature->GetInstanceScript()), _lichkingGUID(0), _walltargetGUID(0),
- _icewallGUID(0), _icewall(0), _isattackingwall(0)
+ _icewallGUID(0), _icewall(0)
{
- _instance = me->GetInstanceScript();
}
InstanceScript* _instance;
@@ -726,33 +726,29 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
uint64 _walltargetGUID; // dummy
uint64 _icewallGUID; // object
uint32 _icewall; // icewall number
- uint32 _isattackingwall; //sylvannas attacking icewall
EventMap _events;
-
void Reset() OVERRIDE
{
_events.Reset();
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->DespawnOrUnsummon(1);
_lichkingGUID = 0;
_walltargetGUID = 0;
_icewallGUID = 0;
_icewall = 0;
- _isattackingwall = false;
_events.ScheduleEvent(EVENT_ESCAPE, 0);
}
void JustDied(Unit* /*Killer*/) OVERRIDE
{
- if (_instance)
_instance->SetData(DATA_ESCAPE_EVENT, FAIL);
}
- void DoAction(int32 actionID) OVERRIDE
+ void DoAction(int32 actionId) OVERRIDE
{
- switch (actionID)
+ switch (actionId)
{
case ACTION_START_ESCAPING: // called by InstanceScript when we need to start the escaping event
_events.ScheduleEvent(EVENT_ESCAPE_1, 1000);
@@ -760,10 +756,9 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
case ACTION_WALL_BROKEN:
_icewall++;
if (_icewall != 4)
- _events.ScheduleEvent(EVENT_ESCAPE_17,3000);
+ _events.ScheduleEvent(EVENT_ESCAPE_17, 3000);
else
- _events.ScheduleEvent(EVENT_ESCAPE_23,3000);
- _isattackingwall = false;
+ _events.ScheduleEvent(EVENT_ESCAPE_23, 3000);
break;
}
}
@@ -781,6 +776,19 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
}
}
+ void DestroyIceWall()
+ {
+ if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
+ me->RemoveAurasDueToSpell(SPELL_JAINA_DESTROY_ICE_WALL);
+ else
+ me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL);
+
+ _instance->HandleGameObject(_icewallGUID, true);
+
+ if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _walltargetGUID))
+ wallTarget->DespawnOrUnsummon();
+ }
+
void UpdateAI(uint32 diff) OVERRIDE
{
_events.Update(diff);
@@ -792,21 +800,21 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
case EVENT_ESCAPE:
if (Creature* lichking = me->SummonCreature(NPC_LICH_KING_PART2, LichKingSpawnPos2, TEMPSUMMON_MANUAL_DESPAWN))
{
- me->Attack(lichking,true);
- lichking->Attack(me,true);
+ me->Attack(lichking, true);
+ lichking->Attack(me, true);
me->SetReactState(REACT_PASSIVE);
lichking->SetReactState(REACT_PASSIVE);
_lichkingGUID = lichking->GetGUID();
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->DoCast(me, SPELL_JAINA_ICEBARRIER);
+ DoCast(me, SPELL_JAINA_ICEBARRIER);
else
- me->AI()->DoCast(me, SPELL_SYLVANAS_CLOAKOFDARKNESS);
+ DoCast(me, SPELL_SYLVANAS_CLOAKOFDARKNESS);
}
me->SetHealth(252000);
break;
case EVENT_ESCAPE_1:
_instance->SetData(DATA_ESCAPE_EVENT, IN_PROGRESS);
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
lichking->AI()->Talk(SAY_LK_ESCAPE_1);
@@ -817,30 +825,27 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
break;
case EVENT_ESCAPE_2:
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->DoCast(me,SPELL_CAST_VISUAL,true);
+ DoCast(me, SPELL_CAST_VISUAL, true);
else
- me->AI()->DoCast(me,SPELL_SYLVANAS_JUMP,true);
+ DoCast(me, SPELL_SYLVANAS_JUMP, true);
_events.ScheduleEvent(EVENT_ESCAPE_3, 1000);
break;
case EVENT_ESCAPE_3:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
- {
- if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- lichking->AI()->DoCast(lichking, SPELL_JAINA_ICEPRISON, true);
- else
- lichking->AI()->DoCast(lichking, SPELL_SYLVANAS_DARKBINDING, true);
- }
+ if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
+ DoCastAOE(SPELL_JAINA_ICEPRISON, true);
+ else
+ DoCastAOE(SPELL_SYLVANAS_DARKBINDING, true);
_events.ScheduleEvent(EVENT_ESCAPE_4, 2000);
break;
case EVENT_ESCAPE_4:
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->Talk(SAY_JAINA_ESCAPE_1);
+ Talk(SAY_JAINA_ESCAPE_1);
else
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_1);
+ Talk(SAY_SYLVANAS_ESCAPE_1);
_events.ScheduleEvent(EVENT_ESCAPE_5, 2000);
break;
case EVENT_ESCAPE_5:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->CombatStop();
me->GetMotionMaster()->MovePoint(0, JainaShadowThroneDoor);
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
@@ -853,7 +858,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER);
break;
case EVENT_ESCAPE_7:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
lichking->RemoveAurasDueToSpell(SPELL_JAINA_ICEPRISON);
@@ -863,13 +868,13 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
_events.ScheduleEvent(EVENT_ESCAPE_8, 1000);
break;
case EVENT_ESCAPE_8:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->HandleEmoteCommand(TEXT_EMOTE_ROAR);
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]);
_events.ScheduleEvent(EVENT_ESCAPE_9, 3000);
break;
case EVENT_ESCAPE_9:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]);
_events.ScheduleEvent(EVENT_ESCAPE_10, 1000);
break;
@@ -879,39 +884,39 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
break;
case EVENT_ESCAPE_11:
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[2]);
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->GetMotionMaster()->MovePoint(0, LichKingFirstSummon);
_events.ScheduleEvent(EVENT_ESCAPE_12, 6000);
break;
case EVENT_ESCAPE_12:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->AI()->Talk(SAY_LK_ESCAPE_3);
lichking->AI()->DoCast(me, SPELL_RAISE_DEAD);
- lichking->Attack(me,true);
+ lichking->Attack(me, true);
}
_events.ScheduleEvent(EVENT_ESCAPE_13, 4000);
break;
case EVENT_ESCAPE_13:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->AI()->DoCast(lichking, SPELL_REMORSELESS_WINTER, true);
lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR);
lichking->GetMotionMaster()->MoveIdle();
lichking->GetMotionMaster()->MoveChase(me);
}
- if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL,IceWalls[0].GetPositionX(), IceWalls[0].GetPositionY(), IceWalls[0].GetPositionZ(), IceWalls[0].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 720000))
+ if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL, IceWalls[0], TEMPSUMMON_MANUAL_DESPAWN, 720000))
{
_walltargetGUID = walltarget->GetGUID();
walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL);
walltarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->Attack(walltarget,false);
+ me->Attack(walltarget, false);
}
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[3]);
_events.ScheduleEvent(EVENT_ESCAPE_14, 8000);
break;
case EVENT_ESCAPE_14:
- if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID))
+ if (Creature* walltarget = ObjectAccessor::GetCreature(*me, _walltargetGUID))
{
if (GameObject* icewall = walltarget->FindNearestGameObject(GO_ICE_WALL, 50.00f))
{
@@ -919,61 +924,42 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
icewall->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
_instance->HandleGameObject(0, false, icewall);
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->Talk(SAY_JAINA_ESCAPE_2);
+ Talk(SAY_JAINA_ESCAPE_2);
else
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_2);
+ Talk(SAY_SYLVANAS_ESCAPE_2);
}
}
_events.ScheduleEvent(EVENT_ESCAPE_15, 1000);
break;
case EVENT_ESCAPE_15:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->GetMotionMaster()->MoveIdle();
lichking->GetMotionMaster()->MoveChase(me);
lichking->SetReactState(REACT_PASSIVE);
}
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, false);
+ DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, true);
else
- {
- _isattackingwall = true;
- me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false);
- _events.ScheduleEvent(EVENT_ESCAPE_16, 1000);
- }
- break;
- case EVENT_ESCAPE_16:
- if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE)
- {
- me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false);
- if (_isattackingwall)
- _events.ScheduleEvent(EVENT_ESCAPE_16, 1000);
- }
+ DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, true);
break;
case EVENT_ESCAPE_17:// ICEWALL BROKEN
me->GetMotionMaster()->MoveIdle();
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->StopMoving();
lichking->AI()->Talk(SAY_LK_ESCAPE_3);
lichking->AI()->DoCast(me, SPELL_RAISE_DEAD);
}
- if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID))
- walltarget->DespawnOrUnsummon(0);
- if (GameObject* icewall = ObjectAccessor::GetGameObject(*me, _icewallGUID))
- {
- _instance->HandleGameObject(0 ,true, icewall);
- if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->RemoveAurasDueToSpell(SPELL_JAINA_DESTROY_ICE_WALL);
- else
- me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL);
- }
+
+ DestroyIceWall();
+
if (_icewall && _icewall < 4)
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[_icewall + 3]);
_events.ScheduleEvent(EVENT_ESCAPE_18, 2000);
break;
case EVENT_ESCAPE_18:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->GetMotionMaster()->MoveIdle();
lichking->GetMotionMaster()->MoveChase(me);
@@ -981,29 +967,29 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
_events.ScheduleEvent(EVENT_ESCAPE_19, 6000);
break;
case EVENT_ESCAPE_19:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (_icewall && _icewall < 4)
lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR);
lichking->GetMotionMaster()->MoveIdle();
lichking->GetMotionMaster()->MoveChase(me);
lichking->SetReactState(REACT_PASSIVE);
- lichking->Attack(me,true);
+ lichking->Attack(me, true);
}
if (_icewall < 4)
{
- if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL, IceWalls[_icewall].GetPositionX(), IceWalls[_icewall].GetPositionY(), IceWalls[_icewall].GetPositionZ(), IceWalls[_icewall].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 720000))
+ if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL, IceWalls[_icewall], TEMPSUMMON_MANUAL_DESPAWN, 720000))
{
_walltargetGUID = walltarget->GetGUID();
walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL);
walltarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->Attack(walltarget,false);
+ me->Attack(walltarget, false);
}
}
_events.ScheduleEvent(EVENT_ESCAPE_20, 3000);
break;
case EVENT_ESCAPE_20:
- if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID))
+ if (Creature* walltarget = ObjectAccessor::GetCreature(*me, _walltargetGUID))
{
if (GameObject* icewall = walltarget->FindNearestGameObject(GO_ICE_WALL, 50.00f))
{
@@ -1013,24 +999,24 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
{
if (_icewall == 1)
- me->AI()->Talk(SAY_JAINA_ESCAPE_3);
+ Talk(SAY_JAINA_ESCAPE_3);
else if (_icewall == 2)
- me->AI()->Talk(SAY_JAINA_ESCAPE_4);
+ Talk(SAY_JAINA_ESCAPE_4);
else if (_icewall == 3)
- me->AI()->Talk(SAY_JAINA_ESCAPE_5);
+ Talk(SAY_JAINA_ESCAPE_5);
}
else if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE)
{
if (_icewall == 1)
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_3);
+ Talk(SAY_SYLVANAS_ESCAPE_3);
else if (_icewall == 2)
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_4);
+ Talk(SAY_SYLVANAS_ESCAPE_4);
else if (_icewall == 3)
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_5);
+ Talk(SAY_SYLVANAS_ESCAPE_5);
}
}
}
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (_icewall && _icewall < 3)
lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR);
@@ -1044,53 +1030,37 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
break;
case EVENT_ESCAPE_21:
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, false);
+ DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, true);
else
- {
- me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false);
- _isattackingwall = true;
- _events.ScheduleEvent(EVENT_ESCAPE_22, 1000);
- }
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, true);
+
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (_icewall == 1)
lichking->AI()->DoCast(lichking, SPELL_SUMMON_LUMBERING_ABOMINATION);
else if (_icewall > 1 && _icewall < 4)
+ {
lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR);
+ _events.ScheduleEvent(EVENT_ESCAPE_22, 1000);
+ }
}
break;
case EVENT_ESCAPE_22:
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
if (_icewall >= 2 && _icewall < 4)
lichking->AI()->DoCast(lichking, SPELL_SUMMON_LUMBERING_ABOMINATION);
}
- if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE)
- {
- me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false);
- if (_isattackingwall)
- _events.ScheduleEvent(EVENT_ESCAPE_22, 1000);
- }
break;
+ case EVENT_ESCAPE_23: // FINAL PART
+ DestroyIceWall();
- case EVENT_ESCAPE_23:// FINAL PART
- if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID))
- walltarget->DespawnOrUnsummon(0);
- if (GameObject* icewall = ObjectAccessor::GetGameObject(*me, _icewallGUID))
- {
- _instance->HandleGameObject(0 ,true, icewall);
- if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- {
- me->RemoveAurasDueToSpell(SPELL_JAINA_DESTROY_ICE_WALL);
- me->AI()->Talk(SAY_JAINA_ESCAPE_6);
- }
- else
- {
- me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL);
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_6);
- }
- }
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
+ Talk(SAY_JAINA_ESCAPE_6);
+ else
+ Talk(SAY_SYLVANAS_ESCAPE_6);
+
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->GetMotionMaster()->MovePoint(0, LichKingFinalPos);
lichking->AI()->Talk(SAY_LK_ESCAPE_11);
@@ -1100,21 +1070,21 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
break;
case EVENT_ESCAPE_24:
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->Talk(SAY_JAINA_ESCAPE_8);
+ Talk(SAY_JAINA_ESCAPE_8);
else
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_8);
+ Talk(SAY_SYLVANAS_ESCAPE_8);
_events.ScheduleEvent(EVENT_ESCAPE_25, 5000);
break;
case EVENT_ESCAPE_25:
- if (GameObject* cave = _instance->instance->GetGameObject(_instance->GetData64(DATA_CAVE_IN)))
- cave->SetGoState(GO_STATE_READY);
+ if (GameObject* cave = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_CAVE_IN)))
+ cave->SetGoState(GO_STATE_READY);
_events.ScheduleEvent(EVENT_ESCAPE_26, 4000);
break;
case EVENT_ESCAPE_26:
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- me->AI()->Talk(SAY_JAINA_ESCAPE_10);
+ Talk(SAY_JAINA_ESCAPE_10);
else
- me->AI()->Talk(SAY_SYLVANAS_ESCAPE_9);
+ Talk(SAY_SYLVANAS_ESCAPE_9);
_events.ScheduleEvent(EVENT_ESCAPE_27, 4000);
break;
case EVENT_ESCAPE_27:
@@ -1123,7 +1093,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
else
me->SummonGameObject(GO_CAPTAIN_CHEST_3, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000);
me->SummonGameObject(GO_PORTAL, FinalPortalPos.GetPositionX(), FinalPortalPos.GetPositionY(), FinalPortalPos.GetPositionZ(), FinalPortalPos.GetOrientation(), 0, 0, 0, 0, 720000);
- if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
lichking->DespawnOrUnsummon(1);
break;
}
@@ -1133,7 +1103,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
- return new npc_jaina_or_sylvanas_escape_horAI(creature);
+ return GetHallsOfReflectionAI<npc_jaina_or_sylvanas_escape_horAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
index 3223ecf66a5..d8d4f2d5524 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
@@ -175,4 +175,10 @@ struct boss_horAI : ScriptedAI
}
};
+template<class AI>
+AI* GetHallsOfReflectionAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, HoRScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp
index 532ede3f849..3a2d5c592fe 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -1815,7 +1815,7 @@ class spell_fetch_ingredient_aura : public SpellScriptLoader
}
};
-enum StormCloud
+enum StormCloud
{
STORM_COULD = 29939,
HEALING_WINDS = 55549,
@@ -1842,7 +1842,7 @@ public:
{
Reset();
}
-
+
void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE
{
if (spell->Id != GYMERS_GRAB)