aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp4
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.h2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h2
-rw-r--r--src/server/game/Entities/Unit/Unit.h1
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp8
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp6
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp173
-rw-r--r--src/server/scripts/Northrend/zone_icecrown.cpp204
11 files changed, 353 insertions, 53 deletions
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index de12809fdde..759d84c2705 100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -121,7 +121,7 @@ void Corpse::SaveToDB()
stmt->setUInt32(index++, uint32(m_time)); // time
stmt->setUInt8 (index++, GetType()); // corpseType
stmt->setUInt32(index++, GetInstanceId()); // instanceId
- stmt->setUInt16(index++, GetPhaseMask()); // phaseMask
+ stmt->setUInt32(index++, GetPhaseMask()); // phaseMask
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -184,7 +184,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
m_time = time_t(fields[11].GetUInt32());
uint32 instanceId = fields[13].GetUInt32();
- uint32 phaseMask = fields[14].GetUInt16();
+ uint32 phaseMask = fields[14].GetUInt32();
// place
SetLocationInstanceId(instanceId);
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index e9adab4527e..779cffadf28 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -997,7 +997,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setUInt32(index++, GetEntry());
stmt->setUInt16(index++, uint16(mapid));
stmt->setUInt8(index++, spawnMask);
- stmt->setUInt16(index++, uint16(GetPhaseMask()));
+ stmt->setUInt32(index++, GetPhaseMask());
stmt->setUInt32(index++, displayId);
stmt->setInt32(index++, int32(GetCurrentEquipmentId()));
stmt->setFloat(index++, GetPositionX());
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index de826d3f310..bc7294a5f16 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -247,7 +247,7 @@ struct CreatureData
CreatureData() : dbData(true) {}
uint32 id; // entry in creature_template
uint16 mapid;
- uint16 phaseMask;
+ uint32 phaseMask;
uint32 displayid;
int8 equipmentId;
float posX;
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 62426e95987..3704530589e 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -713,7 +713,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setUInt32(index++, GetEntry());
stmt->setUInt16(index++, uint16(mapid));
stmt->setUInt8(index++, spawnMask);
- stmt->setUInt16(index++, uint16(GetPhaseMask()));
+ stmt->setUInt32(index++, GetPhaseMask());
stmt->setFloat(index++, GetPositionX());
stmt->setFloat(index++, GetPositionY());
stmt->setFloat(index++, GetPositionZ());
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 97c9f4a4650..d012088a6b7 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -583,7 +583,7 @@ struct GameObjectData
explicit GameObjectData() : dbData(true) {}
uint32 id; // entry in gamobject_template
uint16 mapid;
- uint16 phaseMask;
+ uint32 phaseMask;
float posX;
float posY;
float posZ;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index c595a0070c5..a9a3e4961ab 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1394,6 +1394,7 @@ class Unit : public WorldObject
int32 GetPower(Powers power) const;
int32 GetMinPower(Powers power) const { return power == POWER_ECLIPSE ? -100 : 0; }
int32 GetMaxPower(Powers power) const;
+ int32 CountPctFromMaxPower(Powers power, int32 pct) const { return CalculatePct(GetMaxPower(power), pct); }
void SetPower(Powers power, int32 val);
void SetMaxPower(Powers power, int32 val);
// returns the change in power
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 504c7f86654..75d0a8e7bb0 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1587,7 +1587,7 @@ void ObjectMgr::LoadCreatures()
data.curmana = fields[13].GetUInt32();
data.movementType = fields[14].GetUInt8();
data.spawnMask = fields[15].GetUInt8();
- data.phaseMask = fields[16].GetUInt16();
+ data.phaseMask = fields[16].GetUInt32();
int16 gameEvent = fields[17].GetInt8();
uint32 PoolId = fields[18].GetUInt32();
data.npcflag = fields[19].GetUInt32();
@@ -1939,9 +1939,9 @@ void ObjectMgr::LoadGameobjects()
if (data.spawnMask & ~spawnMasks[data.mapid])
TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
- data.phaseMask = fields[15].GetUInt16();
+ data.phaseMask = fields[15].GetUInt32();
int16 gameEvent = fields[16].GetInt8();
- uint32 PoolId = fields[17].GetUInt32();
+ uint32 PoolId = fields[17].GetUInt32();
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
{
@@ -2542,7 +2542,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.Name1 = fields[4].GetString();
itemTemplate.DisplayInfoID = fields[5].GetUInt32();
itemTemplate.Quality = uint32(fields[6].GetUInt8());
- itemTemplate.Flags = uint32(fields[7].GetUInt32());
+ itemTemplate.Flags = fields[7].GetUInt32();
itemTemplate.Flags2 = fields[8].GetUInt32();
itemTemplate.Unk430_1 = fields[9].GetFloat();
itemTemplate.Unk430_2 = fields[10].GetFloat();
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index e20c4a70417..4473000bc3b 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -279,8 +279,8 @@ public:
bool found = false;
float x, y, z, o;
- uint32 guidLow, id;
- uint16 mapId, phase;
+ uint32 guidLow, id, phase;
+ uint16 mapId;
uint32 poolId;
do
@@ -293,7 +293,7 @@ public:
z = fields[4].GetFloat();
o = fields[5].GetFloat();
mapId = fields[6].GetUInt16();
- phase = fields[7].GetUInt16();
+ phase = fields[7].GetUInt32();
poolId = sPoolMgr->IsPartOfAPool<GameObject>(guidLow);
if (!poolId || sPoolMgr->IsSpawnedObject<GameObject>(guidLow))
found = true;
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
index 9a96e787f87..481df79c890 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
@@ -216,7 +216,7 @@ public:
void SummonedCreatureDespawn(Creature* summon) OVERRIDE
{
- uint32 phase= summon->GetPhaseMask();
+ uint32 phase = summon->GetPhaseMask();
uint32 nextPhase = 0;
Summons.Despawn(summon);
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
index 173abfc2652..b1ecdc5904e 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
@@ -17,9 +17,11 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "forge_of_souls.h"
#include "Player.h"
#include "SpellInfo.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "forge_of_souls.h"
/*
* @todo
@@ -48,7 +50,10 @@ enum Spells
{
SPELL_PHANTOM_BLAST = 68982,
H_SPELL_PHANTOM_BLAST = 70322,
- SPELL_MIRRORED_SOUL = 69051,
+ SPELL_MIRRORED_SOUL_PROC_AURA = 69023,
+ SPELL_MIRRORED_SOUL_DAMAGE = 69034,
+ SPELL_MIRRORED_SOUL_TARGET_SELECTOR = 69048,
+ SPELL_MIRRORED_SOUL_BUFF = 69051,
SPELL_WELL_OF_SOULS = 68820,
SPELL_UNLEASHED_SOULS = 68939,
SPELL_WAILING_SOULS_STARTING = 68912, // Initial spell cast at begining of wailing souls phase
@@ -145,7 +150,6 @@ class boss_devourer_of_souls : public CreatureScript
summons.DespawnAll();
threeFaced = true;
- mirroredSoulTarget = 0;
instance->SetData(DATA_DEVOURER_EVENT, NOT_STARTED);
}
@@ -165,23 +169,6 @@ class boss_devourer_of_souls : public CreatureScript
instance->SetData(DATA_DEVOURER_EVENT, IN_PROGRESS);
}
- void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) OVERRIDE
- {
- if (mirroredSoulTarget && me->HasAura(SPELL_MIRRORED_SOUL))
- {
- if (Player* player = Unit::GetPlayer(*me, mirroredSoulTarget))
- {
- if (player->GetAura(SPELL_MIRRORED_SOUL))
- {
- int32 mirrorDamage = (uiDamage* 45)/100;
- me->CastCustomSpell(player, 69034, &mirrorDamage, 0, 0, true);
- }
- else
- mirroredSoulTarget = 0;
- }
- }
- }
-
void KilledUnit(Unit* victim) OVERRIDE
{
if (victim->GetTypeId() != TYPEID_PLAYER)
@@ -270,12 +257,8 @@ class boss_devourer_of_souls : public CreatureScript
events.ScheduleEvent(EVENT_PHANTOM_BLAST, 5000);
break;
case EVENT_MIRRORED_SOUL:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
- {
- mirroredSoulTarget = target->GetGUID();
- DoCast(target, SPELL_MIRRORED_SOUL);
- Talk(EMOTE_MIRRORED_SOUL);
- }
+ DoCastAOE(SPELL_MIRRORED_SOUL_TARGET_SELECTOR);
+ Talk(EMOTE_MIRRORED_SOUL);
events.ScheduleEvent(EVENT_MIRRORED_SOUL, urand(15000, 30000));
break;
case EVENT_WELL_OF_SOULS:
@@ -358,8 +341,6 @@ class boss_devourer_of_souls : public CreatureScript
float beamAngle;
float beamAngleDiff;
int8 wailingSoulTick;
-
- uint64 mirroredSoulTarget;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
@@ -368,6 +349,139 @@ class boss_devourer_of_souls : public CreatureScript
}
};
+// 69051 - Mirrored Soul
+class spell_devourer_of_souls_mirrored_soul : public SpellScriptLoader
+{
+ public:
+ spell_devourer_of_souls_mirrored_soul() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul") { }
+
+ class spell_devourer_of_souls_mirrored_soul_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_devourer_of_souls_mirrored_soul_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_PROC_AURA))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ target->CastSpell(GetCaster(), SPELL_MIRRORED_SOUL_PROC_AURA, true);
+ }
+
+ void Register() OVERRIDE
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_devourer_of_souls_mirrored_soul_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const OVERRIDE
+ {
+ return new spell_devourer_of_souls_mirrored_soul_SpellScript();
+ }
+};
+
+// 69023 - Mirrored Soul (Proc)
+class spell_devourer_of_souls_mirrored_soul_proc : public SpellScriptLoader
+{
+ public:
+ spell_devourer_of_souls_mirrored_soul_proc() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul_proc") { }
+
+ class spell_devourer_of_souls_mirrored_soul_proc_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_devourer_of_souls_mirrored_soul_proc_AuraScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_DAMAGE))
+ return false;
+ return true;
+ }
+
+ bool Load() OVERRIDE
+ {
+ _procTarget = NULL;
+ return true;
+ }
+
+ bool CheckProc(ProcEventInfo& /*eventInfo*/)
+ {
+ _procTarget = GetCaster();
+ return _procTarget && _procTarget->IsAlive();
+ }
+
+ void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
+ {
+ PreventDefaultAction();
+ int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), 45));
+ GetTarget()->CastCustomSpell(SPELL_MIRRORED_SOUL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, _procTarget, true);
+ }
+
+ void Register() OVERRIDE
+ {
+ DoCheckProc += AuraCheckProcFn(spell_devourer_of_souls_mirrored_soul_proc_AuraScript::CheckProc);
+ OnEffectProc += AuraEffectProcFn(spell_devourer_of_souls_mirrored_soul_proc_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
+ }
+
+ private:
+ Unit* _procTarget;
+ };
+
+ AuraScript* GetAuraScript() const OVERRIDE
+ {
+ return new spell_devourer_of_souls_mirrored_soul_proc_AuraScript();
+ }
+};
+
+// 69048 - Mirrored Soul (Target Selector)
+class spell_devourer_of_souls_mirrored_soul_target_selector : public SpellScriptLoader
+{
+ public:
+ spell_devourer_of_souls_mirrored_soul_target_selector() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul_target_selector") { }
+
+ class spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_BUFF))
+ return false;
+ return true;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ if (targets.empty())
+ return;
+
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ GetCaster()->CastSpell(target, SPELL_MIRRORED_SOUL_BUFF, false);
+ }
+
+ void Register() OVERRIDE
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnEffectHitTarget += SpellEffectFn(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const OVERRIDE
+ {
+ return new spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript();
+ }
+};
+
class achievement_three_faced : public AchievementCriteriaScript
{
public:
@@ -391,5 +505,8 @@ class achievement_three_faced : public AchievementCriteriaScript
void AddSC_boss_devourer_of_souls()
{
new boss_devourer_of_souls();
+ new spell_devourer_of_souls_mirrored_soul();
+ new spell_devourer_of_souls_mirrored_soul_proc();
+ new spell_devourer_of_souls_mirrored_soul_target_selector();
new achievement_three_faced();
}
diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp
index ef58138c653..a5d3ed7d0d5 100644
--- a/src/server/scripts/Northrend/zone_icecrown.cpp
+++ b/src/server/scripts/Northrend/zone_icecrown.cpp
@@ -16,17 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: Icecrown
-SD%Complete: 100
-SDComment: Quest support: 12807
-SDCategory: Icecrown
-EndScriptData */
-
-/* ContentData
-npc_arete
-EndContentData */
-
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
@@ -966,6 +955,197 @@ class npc_frostbrood_skytalon : public CreatureScript
}
};
+/*######
+## The Flesh Giant Champion - Id: 13235
+######*/
+enum FleshGiant
+{
+ QUEST_FLESH_GIANT_CHAMPION = 13235,
+
+ NPC_MORBIDUS = 30698,
+ NPC_LICH_KING = 31301,
+ NPC_OLAKIN = 31428,
+ NPC_DHAKAR = 31306,
+
+ FACTION_HOSTILE = 14,
+ FACTION_BASIC = 2102,
+
+ EVENT_INTRO = 1,
+ EVENT_LK_SAY_1 = 2,
+ EVENT_LK_SAY_2 = 3,
+ EVENT_LK_SAY_3 = 4,
+ EVENT_LK_SAY_4 = 5,
+ EVENT_LK_SAY_5 = 6,
+ EVENT_OUTRO = 7,
+ EVENT_START = 8,
+
+ SPELL_SIMPLE_TELEPORT = 64195,
+
+ SAY_DHAKAR_START = 0,
+ SAY_LK_1 = 0,
+ SAY_LK_2 = 1,
+ SAY_LK_3 = 2,
+ SAY_LK_4 = 3,
+ SAY_LK_5 = 4,
+ SAY_OLAKIN_PAY = 0
+};
+
+class npc_margrave_dhakar : public CreatureScript
+{
+ public:
+ npc_margrave_dhakar() : CreatureScript("npc_margrave_dhakar") { }
+
+ struct npc_margrave_dhakarAI : public ScriptedAI
+ {
+ npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKingGuid(0) { }
+
+ void Reset() OVERRIDE
+ {
+ me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
+
+ _events.Reset();
+ _summons.DespawnAll();
+ }
+
+ void sGossipSelect(Player* player, uint32 sender, uint32 action) OVERRIDE
+ {
+ if (player->GetQuestStatus(QUEST_FLESH_GIANT_CHAMPION) == QUEST_STATUS_INCOMPLETE && !player->IsInCombat())
+ {
+ if (me->GetCreatureTemplate()->GossipMenuId == sender && !action)
+ {
+ _events.ScheduleEvent(EVENT_INTRO, 1000);
+ me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ }
+ }
+ }
+
+ void UpdateAI(uint32 diff) OVERRIDE
+ {
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_INTRO:
+ {
+ Talk(SAY_DHAKAR_START);
+ me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
+
+ if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true))
+ {
+ Creature* lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ());
+ _lichKingGuid = lichKing->GetGUID();
+ lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ());
+ lichKing->SetFacingTo(morbidus->GetOrientation());
+ lichKing->CastSpell(lichKing, SPELL_SIMPLE_TELEPORT, true);
+ }
+
+ _events.ScheduleEvent(EVENT_LK_SAY_1, 5000);
+ break;
+ }
+ case EVENT_LK_SAY_1:
+ {
+ if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ lichKing->AI()->Talk(SAY_LK_1);
+ _events.ScheduleEvent(EVENT_LK_SAY_2, 5000);
+ break;
+ }
+ case EVENT_LK_SAY_2:
+ {
+ if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ lichKing->AI()->Talk(SAY_LK_2);
+ _events.ScheduleEvent(EVENT_LK_SAY_3, 5000);
+ break;
+ }
+ case EVENT_LK_SAY_3:
+ {
+ if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ lichKing->AI()->Talk(SAY_LK_3);
+ _events.ScheduleEvent(EVENT_LK_SAY_4, 5000);
+ break;
+ }
+ case EVENT_LK_SAY_4:
+ {
+ if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ lichKing->AI()->Talk(SAY_LK_4);
+ _events.ScheduleEvent(EVENT_OUTRO, 12000);
+ break;
+ }
+ case EVENT_LK_SAY_5:
+ {
+ if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ lichKing->AI()->Talk(SAY_LK_5);
+ _events.ScheduleEvent(EVENT_OUTRO, 8000);
+ break;
+ }
+ case EVENT_OUTRO:
+ {
+ if (Creature* olakin = me->FindNearestCreature(NPC_OLAKIN, 50.0f, true))
+ olakin->AI()->Talk(SAY_OLAKIN_PAY);
+
+ if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
+ lichKing->DespawnOrUnsummon(0);
+
+ _events.ScheduleEvent(EVENT_START, 5000);
+ break;
+ }
+ case EVENT_START:
+ {
+ if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true))
+ {
+ morbidus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_DISABLE_MOVE);
+ morbidus->setFaction(FACTION_HOSTILE);
+ }
+
+ break;
+ }
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ EventMap _events;
+ uint64 _lichKingGuid;
+ SummonList _summons;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
+ {
+ return new npc_margrave_dhakarAI(creature);
+ }
+};
+
+class npc_morbidus : public CreatureScript
+{
+ public:
+ npc_morbidus() : CreatureScript("npc_morbidus") { }
+
+ struct npc_morbidusAI : public ScriptedAI
+ {
+ npc_morbidusAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void Reset() OVERRIDE
+ {
+ if (Creature* dhakar = me->FindNearestCreature(NPC_DHAKAR, 50.0f, true))
+ dhakar->AI()->Reset();
+
+ // this will prevent the event to start without morbidus being alive
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->SetReactState(REACT_PASSIVE);
+ me->setFaction(FACTION_BASIC);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
+ {
+ return new npc_morbidusAI(creature);
+ }
+};
+
void AddSC_icecrown()
{
new npc_arete;
@@ -976,4 +1156,6 @@ void AddSC_icecrown()
new npc_tournament_training_dummy;
new npc_blessed_banner();
new npc_frostbrood_skytalon();
+ new npc_margrave_dhakar();
+ new npc_morbidus();
}