First Commit

For Azeroth!
This commit is contained in:
Yehonal
2016-06-26 10:39:44 +02:00
commit e8e94a0a66
3777 changed files with 1419268 additions and 0 deletions

View File

@@ -0,0 +1,270 @@
/*
REWRITTEN BY XINEF
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "gruuls_lair.h"
enum Yells
{
SAY_AGGRO = 0,
SAY_SLAM = 1,
SAY_SHATTER = 2,
SAY_SLAY = 3,
SAY_DEATH = 4,
EMOTE_GROW = 5
};
enum Spells
{
SPELL_GROWTH = 36300,
SPELL_CAVE_IN = 36240,
SPELL_GROUND_SLAM = 33525,
SPELL_REVERBERATION = 36297,
SPELL_HURTFUL_STRIKE = 33813,
SPELL_SHATTER = 33654,
SPELL_SHATTER_EFFECT = 33671,
SPELL_STONED = 33652,
};
enum Events
{
EVENT_GROWTH = 1,
EVENT_CAVE_IN = 2,
EVENT_GROUND_SLAM = 3,
EVENT_HURTFUL_STRIKE = 4,
EVENT_REVERBERATION = 5,
EVENT_SHATTER = 6,
EVENT_RECENTLY_SPOKEN = 7
};
class boss_gruul : public CreatureScript
{
public:
boss_gruul() : CreatureScript("boss_gruul") { }
struct boss_gruulAI : public BossAI
{
boss_gruulAI(Creature* creature) : BossAI(creature, DATA_GRUUL) { }
void Reset()
{
_Reset();
_caveInTimer = 29000;
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_GROWTH, 30000);
events.ScheduleEvent(EVENT_CAVE_IN, _caveInTimer);
events.ScheduleEvent(EVENT_REVERBERATION, 20000);
events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 10000);
events.ScheduleEvent(EVENT_GROUND_SLAM, 35000);
}
void KilledUnit(Unit* who)
{
if (events.GetNextEventTime(EVENT_RECENTLY_SPOKEN) == 0)
{
events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000);
Talk(SAY_SLAY);
}
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
Talk(SAY_DEATH);
}
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_GROWTH:
Talk(EMOTE_GROW);
DoCast(me, SPELL_GROWTH);
events.ScheduleEvent(EVENT_GROWTH, 30000);
break;
case EVENT_CAVE_IN:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
me->CastSpell(target, SPELL_CAVE_IN, false);
_caveInTimer -= 1500;
events.ScheduleEvent(EVENT_CAVE_IN, _caveInTimer);
break;
case EVENT_REVERBERATION:
me->CastSpell(me, SPELL_REVERBERATION, false);
events.ScheduleEvent(EVENT_REVERBERATION, 22000);
break;
case EVENT_HURTFUL_STRIKE:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 5.0f))
me->CastSpell(target, SPELL_HURTFUL_STRIKE, false);
events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 15000);
break;
case EVENT_GROUND_SLAM:
Talk(SAY_SLAM);
me->CastSpell(me, SPELL_GROUND_SLAM, false);
events.DelayEvents(8001);
events.ScheduleEvent(EVENT_GROUND_SLAM, 60000);
events.ScheduleEvent(EVENT_SHATTER, 8000);
break;
case EVENT_SHATTER:
Talk(SAY_SHATTER);
me->CastSpell(me, SPELL_SHATTER, false);
break;
}
DoMeleeAttackIfReady();
}
private:
uint32 _caveInTimer;
};
CreatureAI* GetAI(Creature* creature) const
{
return GetInstanceAI<boss_gruulAI>(creature);
}
};
class spell_gruul_ground_slam : public SpellScriptLoader
{
public:
spell_gruul_ground_slam() : SpellScriptLoader("spell_gruul_ground_slam") { }
class spell_gruul_ground_slam_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gruul_ground_slam_SpellScript);
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
target->KnockbackFrom(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), 15.0f, 15.0f);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_gruul_ground_slam_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_gruul_ground_slam_SpellScript();
}
};
class spell_gruul_ground_slam_trigger : public SpellScriptLoader
{
public:
spell_gruul_ground_slam_trigger() : SpellScriptLoader("spell_gruul_ground_slam_trigger") { }
class spell_gruul_ground_slam_trigger_AuraScript : public AuraScript
{
PrepareAuraScript(spell_gruul_ground_slam_trigger_AuraScript);
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (GetUnitOwner()->GetAuraCount(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell) == 5)
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_STONED, true);
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_gruul_ground_slam_trigger_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_gruul_ground_slam_trigger_AuraScript();
}
};
class spell_gruul_shatter : public SpellScriptLoader
{
public:
spell_gruul_shatter() : SpellScriptLoader("spell_gruul_shatter") { }
class spell_gruul_shatter_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gruul_shatter_SpellScript);
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
target->RemoveAurasDueToSpell(SPELL_STONED);
target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_gruul_shatter_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_gruul_shatter_SpellScript();
}
};
class spell_gruul_shatter_effect : public SpellScriptLoader
{
public:
spell_gruul_shatter_effect() : SpellScriptLoader("spell_gruul_shatter_effect") { }
class spell_gruul_shatter_effect_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gruul_shatter_effect_SpellScript);
void CalculateDamage()
{
if (!GetHitUnit())
return;
float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
if (!radius)
return;
float distance = GetCaster()->GetDistance2d(GetHitUnit());
if (distance > 1.0f)
SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius)));
}
void Register()
{
OnHit += SpellHitFn(spell_gruul_shatter_effect_SpellScript::CalculateDamage);
}
};
SpellScript* GetSpellScript() const
{
return new spell_gruul_shatter_effect_SpellScript();
}
};
void AddSC_boss_gruul()
{
new boss_gruul();
new spell_gruul_ground_slam();
new spell_gruul_ground_slam_trigger();
new spell_gruul_shatter();
new spell_gruul_shatter_effect();
}

View File

@@ -0,0 +1,505 @@
/*
REWRITTEN BY XINEF
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "gruuls_lair.h"
enum HighKingMaulgar
{
SAY_AGGRO = 0,
SAY_ENRAGE = 1,
SAY_OGRE_DEATH = 2,
SAY_SLAY = 3,
SAY_DEATH = 4,
// High King Maulgar
SPELL_ARCING_SMASH = 39144,
SPELL_MIGHTY_BLOW = 33230,
SPELL_WHIRLWIND = 33238,
SPELL_BERSERKER_C = 26561,
SPELL_ROAR = 16508,
SPELL_FLURRY = 33232,
// Olm the Summoner
SPELL_DARK_DECAY = 33129,
SPELL_DEATH_COIL = 33130,
SPELL_SUMMON_WFH = 33131,
// Kiggler the Craed
SPELL_GREATER_POLYMORPH = 33173,
SPELL_LIGHTNING_BOLT = 36152,
SPELL_ARCANE_SHOCK = 33175,
SPELL_ARCANE_EXPLOSION = 33237,
// Blindeye the Seer
SPELL_GREATER_PW_SHIELD = 33147,
SPELL_HEAL = 33144,
SPELL_PRAYER_OH = 33152,
// Krosh Firehand
SPELL_GREATER_FIREBALL = 33051,
SPELL_SPELLSHIELD = 33054,
SPELL_BLAST_WAVE = 33061,
ACTION_ADD_DEATH = 1
};
enum HKMEvents
{
EVENT_RECENTLY_SPOKEN = 1,
EVENT_ARCING_SMASH = 2,
EVENT_MIGHTY_BLOW = 3,
EVENT_WHIRLWIND = 4,
EVENT_CHARGING = 5,
EVENT_ROAR = 6,
EVENT_CHECK_HEALTH = 7,
EVENT_ADD_ABILITY1 = 10,
EVENT_ADD_ABILITY2 = 11,
EVENT_ADD_ABILITY3 = 12,
EVENT_ADD_ABILITY4 = 13
};
class boss_high_king_maulgar : public CreatureScript
{
public:
boss_high_king_maulgar() : CreatureScript("boss_high_king_maulgar") { }
struct boss_high_king_maulgarAI : public BossAI
{
boss_high_king_maulgarAI(Creature* creature) : BossAI(creature, DATA_MAULGAR) { }
void Reset()
{
_Reset();
me->SetLootMode(0);
}
void KilledUnit(Unit* victim)
{
if (events.GetNextEventTime(EVENT_RECENTLY_SPOKEN) == 0)
{
events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000);
Talk(SAY_SLAY);
}
}
void JustDied(Unit* /*killer*/)
{
Talk(SAY_DEATH);
if (instance->GetData(DATA_ADDS_KILLED) == MAX_ADD_NUMBER)
_JustDied();
}
void DoAction(int32 actionId)
{
if (me->IsAlive())
{
Talk(SAY_OGRE_DEATH);
if (actionId == MAX_ADD_NUMBER)
me->SetLootMode(1);
}
else if (actionId == MAX_ADD_NUMBER)
{
me->loot.clear();
me->loot.FillLoot(me->GetCreatureTemplate()->lootid, LootTemplates_Creature, me->GetLootRecipient(), false, false, 1);
me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
_JustDied();
}
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_ARCING_SMASH, 6000);
events.ScheduleEvent(EVENT_MIGHTY_BLOW, 20000);
events.ScheduleEvent(EVENT_WHIRLWIND, 30000);
events.ScheduleEvent(EVENT_CHECK_HEALTH, 500);
}
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_ARCING_SMASH:
me->CastSpell(me->GetVictim(), SPELL_ARCING_SMASH, false);
events.ScheduleEvent(EVENT_ARCING_SMASH, 10000);
break;
case EVENT_MIGHTY_BLOW:
me->CastSpell(me->GetVictim(), SPELL_MIGHTY_BLOW, false);
events.ScheduleEvent(EVENT_MIGHTY_BLOW, 16000);
break;
case EVENT_WHIRLWIND:
events.DelayEvents(15000);
me->CastSpell(me, SPELL_WHIRLWIND, false);
events.ScheduleEvent(EVENT_WHIRLWIND, 54000);
break;
case EVENT_CHECK_HEALTH:
if (me->HealthBelowPct(50))
{
Talk(SAY_ENRAGE);
me->CastSpell(me, SPELL_FLURRY, true);
events.ScheduleEvent(EVENT_CHARGING, 0);
events.ScheduleEvent(EVENT_ROAR, 3000);
break;
}
events.ScheduleEvent(EVENT_CHECK_HEALTH, 500);
break;
case EVENT_ROAR:
me->CastSpell(me, SPELL_ROAR, false);
events.ScheduleEvent(EVENT_ROAR, 40000);
break;
case EVENT_CHARGING:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
me->CastSpell(target, SPELL_BERSERKER_C, false);
events.ScheduleEvent(EVENT_CHARGING, 35000);
break;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const
{
return GetInstanceAI<boss_high_king_maulgarAI>(creature);
}
};
class boss_olm_the_summoner : public CreatureScript
{
public:
boss_olm_the_summoner() : CreatureScript("boss_olm_the_summoner") { }
struct boss_olm_the_summonerAI : public ScriptedAI
{
boss_olm_the_summonerAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
instance = creature->GetInstanceScript();
}
EventMap events;
SummonList summons;
InstanceScript* instance;
void Reset()
{
events.Reset();
summons.DespawnAll();
instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
}
void AttackStart(Unit* who)
{
if (!who)
return;
if (me->Attack(who, true))
me->GetMotionMaster()->MoveChase(who, 25.0f);
}
void EnterCombat(Unit* /*who*/)
{
me->SetInCombatWithZone();
instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 10000);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 15000);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000);
}
void JustDied(Unit* /*killer*/)
{
instance->SetData(DATA_ADDS_KILLED, 1);
}
void JustSummoned(Creature* summon)
{
summons.Summon(summon);
}
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_ADD_ABILITY1:
me->CastSpell(me->GetVictim(), SPELL_DARK_DECAY, false);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 20000);
break;
case EVENT_ADD_ABILITY2:
me->CastSpell(me, SPELL_SUMMON_WFH, false);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 30000);
break;
case EVENT_ADD_ABILITY3:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
me->CastSpell(target, SPELL_DEATH_COIL, false);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000);
break;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const
{
return GetInstanceAI<boss_olm_the_summonerAI>(creature);
}
};
class boss_kiggler_the_crazed : public CreatureScript
{
public:
boss_kiggler_the_crazed() : CreatureScript("boss_kiggler_the_crazed") { }
struct boss_kiggler_the_crazedAI : public ScriptedAI
{
boss_kiggler_the_crazedAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
}
EventMap events;
InstanceScript* instance;
void Reset()
{
events.Reset();
instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/)
{
me->SetInCombatWithZone();
instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 5000);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 10000);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000);
events.ScheduleEvent(EVENT_ADD_ABILITY4, 30000);
}
void JustDied(Unit* /*killer*/)
{
instance->SetData(DATA_ADDS_KILLED, 1);
}
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_ADD_ABILITY1:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
me->CastSpell(target, SPELL_GREATER_POLYMORPH, false);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 20000);
break;
case EVENT_ADD_ABILITY2:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
me->CastSpell(target, SPELL_LIGHTNING_BOLT, false);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 15000);
break;
case EVENT_ADD_ABILITY3:
me->CastSpell(me->GetVictim(), SPELL_ARCANE_SHOCK, false);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000);
break;
case EVENT_ADD_ABILITY4:
me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false);
events.ScheduleEvent(EVENT_ADD_ABILITY4, 30000);
break;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const
{
return GetInstanceAI<boss_kiggler_the_crazedAI>(creature);
}
};
class boss_blindeye_the_seer : public CreatureScript
{
public:
boss_blindeye_the_seer() : CreatureScript("boss_blindeye_the_seer") { }
struct boss_blindeye_the_seerAI : public ScriptedAI
{
boss_blindeye_the_seerAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
}
EventMap events;
InstanceScript* instance;
void Reset()
{
events.Reset();
instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/)
{
me->SetInCombatWithZone();
instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 5000);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 10000);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000);
}
void JustDied(Unit* /*killer*/)
{
instance->SetData(DATA_ADDS_KILLED, 1);
}
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_ADD_ABILITY1:
me->CastSpell(me, SPELL_GREATER_PW_SHIELD, false);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 30000);
break;
case EVENT_ADD_ABILITY2:
if (Unit* target = DoSelectLowestHpFriendly(60.0f, 50000))
me->CastSpell(target, SPELL_HEAL, false);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 25000);
break;
case EVENT_ADD_ABILITY3:
me->CastSpell(me, SPELL_PRAYER_OH, false);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 30000);
break;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const
{
return GetInstanceAI<boss_blindeye_the_seerAI>(creature);
}
};
class boss_krosh_firehand : public CreatureScript
{
public:
boss_krosh_firehand() : CreatureScript("boss_krosh_firehand") { }
struct boss_krosh_firehandAI : public ScriptedAI
{
boss_krosh_firehandAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
}
EventMap events;
InstanceScript* instance;
void Reset()
{
events.Reset();
instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
}
void AttackStart(Unit* who)
{
if (!who)
return;
if (me->Attack(who, true))
me->GetMotionMaster()->MoveChase(who, 25.0f);
}
void EnterCombat(Unit* /*who*/)
{
me->SetInCombatWithZone();
instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 1000);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 5000);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000);
}
void JustDied(Unit* /*killer*/)
{
instance->SetData(DATA_ADDS_KILLED, 1);
}
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_ADD_ABILITY1:
me->CastSpell(me->GetVictim(), SPELL_GREATER_FIREBALL, false);
events.ScheduleEvent(EVENT_ADD_ABILITY1, 3500);
break;
case EVENT_ADD_ABILITY2:
me->CastSpell(me, SPELL_SPELLSHIELD, false);
events.ScheduleEvent(EVENT_ADD_ABILITY2, 40000);
break;
case EVENT_ADD_ABILITY3:
me->CastSpell(me, SPELL_BLAST_WAVE, false);
events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000);
break;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const
{
return GetInstanceAI<boss_krosh_firehandAI>(creature);
}
};
void AddSC_boss_high_king_maulgar()
{
new boss_high_king_maulgar();
new boss_kiggler_the_crazed();
new boss_blindeye_the_seer();
new boss_olm_the_summoner();
new boss_krosh_firehand();
}

View File

@@ -0,0 +1,33 @@
/*
REWRITTEN BY XINEF
*/
#ifndef GRUULS_LAIR_H_
#define GRUULS_LAIR_H_
enum DataTypes
{
DATA_MAULGAR = 0,
DATA_GRUUL = 1,
MAX_ENCOUNTER = 2,
DATA_ADDS_KILLED = 10,
MAX_ADD_NUMBER = 4
};
enum CreatureIds
{
NPC_MAULGAR = 18831,
NPC_KROSH_FIREHAND = 18832,
NPC_OLM_THE_SUMMONER = 18834,
NPC_KIGGLER_THE_CRAZED = 18835,
NPC_BLINDEYE_THE_SEER = 18836
};
enum GameObjectIds
{
GO_MAULGAR_DOOR = 184468,
GO_GRUUL_DOOR = 184662
};
#endif // GRUULS_LAIR_H_

View File

@@ -0,0 +1,175 @@
/*
REWRITTEN BY XINEF
*/
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "gruuls_lair.h"
DoorData const doorData[] =
{
{ GO_MAULGAR_DOOR, DATA_MAULGAR, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
{ GO_GRUUL_DOOR, DATA_GRUUL, DOOR_TYPE_ROOM, BOUNDARY_NONE },
{ 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END
};
MinionData const minionData[] =
{
{ NPC_MAULGAR, DATA_MAULGAR },
{ NPC_KROSH_FIREHAND, DATA_MAULGAR },
{ NPC_OLM_THE_SUMMONER, DATA_MAULGAR },
{ NPC_KIGGLER_THE_CRAZED, DATA_MAULGAR },
{ NPC_BLINDEYE_THE_SEER, DATA_MAULGAR }
};
class instance_gruuls_lair : public InstanceMapScript
{
public:
instance_gruuls_lair() : InstanceMapScript("instance_gruuls_lair", 565) { }
struct instance_gruuls_lair_InstanceMapScript : public InstanceScript
{
instance_gruuls_lair_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetBossNumber(MAX_ENCOUNTER);
LoadDoorData(doorData);
LoadMinionData(minionData);
_maulgarGUID = 0;
_addsKilled = 0;
}
void OnCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
case NPC_MAULGAR:
_maulgarGUID = creature->GetGUID();
// no break;
case NPC_KROSH_FIREHAND:
case NPC_OLM_THE_SUMMONER:
case NPC_KIGGLER_THE_CRAZED:
case NPC_BLINDEYE_THE_SEER:
AddMinion(creature, true);
break;
}
}
void OnCreatureRemove(Creature* creature)
{
switch (creature->GetEntry())
{
case NPC_MAULGAR:
case NPC_KROSH_FIREHAND:
case NPC_OLM_THE_SUMMONER:
case NPC_KIGGLER_THE_CRAZED:
case NPC_BLINDEYE_THE_SEER:
AddMinion(creature, false);
break;
}
}
void OnGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_MAULGAR_DOOR:
case GO_GRUUL_DOOR:
AddDoor(go, true);
break;
}
}
void OnGameObjectRemove(GameObject* go)
{
switch (go->GetEntry())
{
case GO_MAULGAR_DOOR:
case GO_GRUUL_DOOR:
AddDoor(go, false);
break;
}
}
bool SetBossState(uint32 id, EncounterState state)
{
if (!InstanceScript::SetBossState(id, state))
return false;
if (id == DATA_MAULGAR && state == NOT_STARTED)
_addsKilled = 0;
return true;
}
void SetData(uint32 type, uint32 id)
{
if (type == DATA_ADDS_KILLED)
if (Creature* maulgar = instance->GetCreature(_maulgarGUID))
maulgar->AI()->DoAction(++_addsKilled);
}
uint32 GetData(uint32 type) const
{
if (type == DATA_ADDS_KILLED)
return _addsKilled;
return 0;
}
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "G L " << GetBossSaveData();
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void Load(char const* str)
{
if (!str)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(str);
char dataHead1, dataHead2;
std::istringstream loadStream(str);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'G' && dataHead2 == 'L')
{
for (uint32 i = 0; i < MAX_ENCOUNTER; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
}
else
OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
}
protected:
uint32 _addsKilled;
uint64 _maulgarGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_gruuls_lair_InstanceMapScript(map);
}
};
void AddSC_instance_gruuls_lair()
{
new instance_gruuls_lair();
}