Core/Scripts: Move Ruby Sanctum and Obsidian Sanctum into a combined Chamber of Aspects folder.

Also fixed compile from last commit.
This commit is contained in:
kaelima
2011-05-30 14:43:40 +02:00
parent c143319b05
commit ee794c5b1c
9 changed files with 10 additions and 10 deletions
@@ -0,0 +1,146 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptPCH.h"
#include "obsidian_sanctum.h"
#define MAX_ENCOUNTER 1
/* Obsidian Sanctum encounters:
0 - Sartharion
*/
class instance_obsidian_sanctum : public InstanceMapScript
{
public:
instance_obsidian_sanctum() : InstanceMapScript("instance_obsidian_sanctum", 615) { }
InstanceScript* GetInstanceScript(InstanceMap* pMap) const
{
return new instance_obsidian_sanctum_InstanceMapScript(pMap);
}
struct instance_obsidian_sanctum_InstanceMapScript : public InstanceScript
{
instance_obsidian_sanctum_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {}
uint32 m_auiEncounter[MAX_ENCOUNTER];
uint64 m_uiSartharionGUID;
uint64 m_uiTenebronGUID;
uint64 m_uiShadronGUID;
uint64 m_uiVesperonGUID;
bool m_bTenebronKilled;
bool m_bShadronKilled;
bool m_bVesperonKilled;
void Initialize()
{
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
m_uiSartharionGUID = 0;
m_uiTenebronGUID = 0;
m_uiShadronGUID = 0;
m_uiVesperonGUID = 0;
m_bTenebronKilled = false;
m_bShadronKilled = false;
m_bVesperonKilled = false;
}
bool IsEncounterInProgress() const
{
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false;
}
void OnCreatureCreate(Creature* creature)
{
switch(creature->GetEntry())
{
case NPC_SARTHARION:
m_uiSartharionGUID = creature->GetGUID();
break;
//three dragons below set to active state once created.
//we must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences
case NPC_TENEBRON:
m_uiTenebronGUID = creature->GetGUID();
creature->setActive(true);
break;
case NPC_SHADRON:
m_uiShadronGUID = creature->GetGUID();
creature->setActive(true);
break;
case NPC_VESPERON:
m_uiVesperonGUID = creature->GetGUID();
creature->setActive(true);
break;
}
}
void SetData(uint32 uiType, uint32 uiData)
{
if (uiType == TYPE_SARTHARION_EVENT)
m_auiEncounter[0] = uiData;
else if(uiType == TYPE_TENEBRON_PREKILLED)
m_bTenebronKilled = true;
else if(uiType == TYPE_SHADRON_PREKILLED)
m_bShadronKilled = true;
else if(uiType == TYPE_VESPERON_PREKILLED)
m_bVesperonKilled = true;
}
uint32 GetData(uint32 uiType)
{
if (uiType == TYPE_SARTHARION_EVENT)
return m_auiEncounter[0];
else if(uiType == TYPE_TENEBRON_PREKILLED)
return m_bTenebronKilled;
else if(uiType == TYPE_SHADRON_PREKILLED)
return m_bShadronKilled;
else if(uiType == TYPE_VESPERON_PREKILLED)
return m_bVesperonKilled;
return 0;
}
uint64 GetData64(uint32 uiData)
{
switch(uiData)
{
case DATA_SARTHARION:
return m_uiSartharionGUID;
case DATA_TENEBRON:
return m_uiTenebronGUID;
case DATA_SHADRON:
return m_uiShadronGUID;
case DATA_VESPERON:
return m_uiVesperonGUID;
}
return 0;
}
};
};
void AddSC_instance_obsidian_sanctum()
{
new instance_obsidian_sanctum();
}
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEF_OBSIDIAN_SANCTUM_H
#define DEF_OBSIDIAN_SANCTUM_H
enum eTypes
{
TYPE_SARTHARION_EVENT = 1,
TYPE_TENEBRON_PREKILLED = 2,
TYPE_SHADRON_PREKILLED = 3,
TYPE_VESPERON_PREKILLED = 4,
DATA_SARTHARION = 10,
DATA_TENEBRON = 11,
DATA_SHADRON = 12,
DATA_VESPERON = 13,
NPC_SARTHARION = 28860,
NPC_TENEBRON = 30452,
NPC_SHADRON = 30451,
NPC_VESPERON = 30449,
GO_TWILIGHT_PORTAL = 193988
};
#endif
@@ -0,0 +1,390 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "ruby_sanctum.h"
enum Texts
{
SAY_BALTHARUS_INTRO = 0, // Your power wanes, ancient one.... Soon you will join your friends.
SAY_AGGRO = 1, // Ah, the entertainment has arrived.
SAY_KILL = 2, // Baltharus leaves no survivors! - This world has enough heroes.
SAY_CLONE = 3, // Twice the pain and half the fun.
SAY_DEATH = 4, // I... didn't see that coming....
};
enum Spells
{
SPELL_BARRIER_CHANNEL = 76221,
SPELL_ENERVATING_BRAND = 74502,
SPELL_SIPHONED_MIGHT = 74507,
SPELL_CLEAVE = 40504,
SPELL_BLADE_TEMPEST = 75125,
SPELL_CLONE = 74511,
SPELL_REPELLING_WAVE = 74509,
SPELL_CLEAR_DEBUFFS = 34098,
SPELL_SPAWN_EFFECT = 64195,
};
enum Events
{
EVENT_BLADE_TEMPEST = 1,
EVENT_CLEAVE = 2,
EVENT_ENERVATING_BRAND = 3,
EVENT_INTRO_TALK = 4,
EVENT_OOC_CHANNEL = 5,
};
enum Actions
{
ACTION_CLONE = 1,
};
enum Phases
{
PHASE_ALL = 0,
PHASE_INTRO = 1,
PHASE_COMBAT = 2,
PHASE_INTRO_MASK = 1 << PHASE_INTRO,
};
class boss_baltharus_the_warborn : public CreatureScript
{
public:
boss_baltharus_the_warborn() : CreatureScript("boss_baltharus_the_warborn") { }
struct boss_baltharus_the_warbornAI : public BossAI
{
boss_baltharus_the_warbornAI(Creature* creature) : BossAI(creature, DATA_BALTHARUS_THE_WARBORN)
{
_introDone = false;
}
void Reset()
{
_Reset();
events.SetPhase(PHASE_INTRO);
events.ScheduleEvent(EVENT_OOC_CHANNEL, 0, 0, PHASE_INTRO);
_cloneCount = RAID_MODE<uint8>(1, 2, 2, 2);
instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetMaxHealth());
}
void DoAction(int32 const action)
{
switch(action)
{
case ACTION_INTRO_TRIGGER:
if (_introDone)
return;
_introDone = true;
me->setActive(true);
events.ScheduleEvent(EVENT_INTRO_TALK, 7000, 0, PHASE_INTRO);
break;
case ACTION_CLONE:
{
DoCast(me, SPELL_CLEAR_DEBUFFS);
DoCast(me, SPELL_CLONE);
DoCast(me, SPELL_REPELLING_WAVE);
Talk(SAY_CLONE);
--_cloneCount;
break;
}
default:
break;
}
}
void EnterCombat(Unit* /*who*/)
{
me->InterruptNonMeleeSpells(false);
_EnterCombat();
events.SetPhase(PHASE_COMBAT);
events.ScheduleEvent(EVENT_CLEAVE, 11000, 0, PHASE_COMBAT);
events.ScheduleEvent(EVENT_ENERVATING_BRAND, 13000, 0, PHASE_COMBAT);
events.ScheduleEvent(EVENT_BLADE_TEMPEST, 15000, 0, PHASE_COMBAT);
Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
Talk(SAY_DEATH);
if (Creature* xerestrasza = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XERESTRASZA)))
xerestrasza->AI()->DoAction(ACTION_BALTHARUS_DEATH);
}
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
Talk(SAY_KILL);
}
void JustSummoned(Creature* summon)
{
summons.Summon(summon);
summon->SetHealth(me->GetHealth());
summon->CastSpell(summon, SPELL_SPAWN_EFFECT, true);
}
void DamageTaken(Unit* /*attacker*/, uint32& damage)
{
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
{
if (me->HealthBelowPctDamaged(50, damage) && _cloneCount == 1)
DoAction(ACTION_CLONE);
}
else
{
if (me->HealthBelowPctDamaged(66, damage) && _cloneCount == 2)
DoAction(ACTION_CLONE);
else if (me->HealthBelowPctDamaged(33, damage) && _cloneCount == 1)
DoAction(ACTION_CLONE);
}
if (me->GetHealth() - damage > 0)
instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage);
}
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
return;
if (!(events.GetPhaseMask() & PHASE_INTRO_MASK))
me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH));
events.Update(diff);
if (me->HasUnitState(UNIT_STAT_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_INTRO_TALK:
Talk(SAY_BALTHARUS_INTRO);
break;
case EVENT_OOC_CHANNEL:
if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CRYSTAL_CHANNEL_TARGET)))
DoCast(channelTarget, SPELL_BARRIER_CHANNEL);
events.ScheduleEvent(EVENT_OOC_CHANNEL, 7000, 0, PHASE_INTRO);
break;
case EVENT_CLEAVE:
DoCastVictim(SPELL_CLEAVE);
events.ScheduleEvent(EVENT_CLEAVE, 24000, 0, PHASE_COMBAT);
break;
case EVENT_BLADE_TEMPEST:
DoCast(me, SPELL_BLADE_TEMPEST);
events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000, 0, PHASE_COMBAT);
break;
case EVENT_ENERVATING_BRAND:
for (uint8 i = 0; i < RAID_MODE<uint8>(4, 8, 8, 10); i++)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true))
DoCast(target, SPELL_ENERVATING_BRAND);
events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000, 0, PHASE_COMBAT);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
uint8 _cloneCount;
bool _introDone;
};
CreatureAI* GetAI(Creature* creature) const
{
return GetRubySanctumAI<boss_baltharus_the_warbornAI>(creature);
}
};
class npc_baltarhus_the_warborn_clone : public CreatureScript
{
public:
npc_baltarhus_the_warborn_clone() : CreatureScript("npc_baltarhus_the_warborn_clone") { }
struct npc_baltarhus_the_warborn_cloneAI : public ScriptedAI
{
npc_baltarhus_the_warborn_cloneAI(Creature* creature) : ScriptedAI(creature)
{
_instance = (InstanceScript*)creature->GetInstanceScript();
}
void EnterCombat(Unit* /*who*/)
{
DoZoneInCombat();
_events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000));
_events.ScheduleEvent(EVENT_BLADE_TEMPEST, urand(18000, 25000));
}
void DamageTaken(Unit* /*attacker*/, uint32& damage)
{
// Setting DATA_BALTHARUS_SHARED_HEALTH to 0 when killed would bug the boss.
if (_instance && me->GetHealth() - damage > 0)
_instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage);
}
void JustDied(Unit* killer)
{
// This is here because DamageTaken wont trigger if the damage is deadly.
if (_instance)
if (Creature* baltarhus = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_BALTHARUS_THE_WARBORN)))
killer->Kill(baltarhus);
}
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
if (_instance)
me->SetHealth(_instance->GetData(DATA_BALTHARUS_SHARED_HEALTH));
_events.Update(diff);
if (me->HasUnitState(UNIT_STAT_CASTING))
return;
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_CLEAVE:
DoCastVictim(SPELL_CLEAVE);
_events.ScheduleEvent(EVENT_CLEAVE, 24000);
break;
case EVENT_BLADE_TEMPEST:
DoCastVictim(SPELL_BLADE_TEMPEST);
_events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
EventMap _events;
InstanceScript* _instance;
};
CreatureAI* GetAI(Creature* creature) const
{
return GetRubySanctumAI<npc_baltarhus_the_warborn_cloneAI>(creature);
}
};
class spell_baltharus_enervating_brand : public SpellScriptLoader
{
public:
spell_baltharus_enervating_brand() : SpellScriptLoader("spell_baltharus_enervating_brand") { }
class spell_baltharus_enervating_brand_AuraScript : public AuraScript
{
PrepareAuraScript(spell_baltharus_enervating_brand_AuraScript);
void HandleTriggerSpell(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* target = GetTarget())
{
uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
target->CastSpell(target, triggerSpellId, true);
if (target->GetDistance(GetCaster()) <= 12.0f)
target->CastSpell(GetCaster(), SPELL_SIPHONED_MIGHT, true);
}
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_baltharus_enervating_brand_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_baltharus_enervating_brand_AuraScript();
}
};
class EnervatingBrandSelector
{
public:
explicit EnervatingBrandSelector(Unit* caster) : _caster(caster) {}
bool operator()(Unit* unit)
{
if (_caster->GetDistance(unit) > 12.0f)
return true;
if (unit->GetTypeId() != TYPEID_PLAYER)
return true;
return false;
}
private:
Unit* _caster;
};
class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader
{
public:
spell_baltharus_enervating_brand_trigger() : SpellScriptLoader("spell_baltharus_enervating_brand_trigger") { }
class spell_baltharus_enervating_brand_trigger_SpellScript : public SpellScript
{
PrepareSpellScript(spell_baltharus_enervating_brand_trigger_SpellScript);
void FilterTargets(std::list<Unit*>& unitList)
{
unitList.remove_if(EnervatingBrandSelector(GetCaster()));
unitList.push_back(GetCaster());
}
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_baltharus_enervating_brand_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_AREA_ALLY_SRC);
OnUnitTargetSelect += SpellUnitTargetFn(spell_baltharus_enervating_brand_trigger_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_AREA_ALLY_SRC);
}
};
SpellScript* GetSpellScript() const
{
return new spell_baltharus_enervating_brand_trigger_SpellScript();
}
};
void AddSC_boss_baltharus_the_warborn()
{
new boss_baltharus_the_warborn();
new npc_baltarhus_the_warborn_clone();
new spell_baltharus_enervating_brand();
new spell_baltharus_enervating_brand_trigger();
}
@@ -0,0 +1,264 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptPCH.h"
#include "ruby_sanctum.h"
enum Texts
{
SAY_AGGRO = 0, // You will sssuffer for this intrusion! (17528)
SAY_CONFLAGRATION = 1, // Burn in the master's flame! (17532)
EMOTE_ENRAGED = 2, // %s becomes enraged!
SAY_KILL = 3, // Halion will be pleased. (17530) - As it should be.... (17529)
};
enum Spells
{
SPELL_CONFLAGRATION = 74452,
SPELL_FLAME_BEACON = 74453,
SPELL_CONFLAGRATION_2 = 74454, // Unknown dummy effect
SPELL_ENRAGE = 78722,
SPELL_FLAME_BREATH = 74403,
};
enum Events
{
EVENT_ENRAGE = 1,
EVENT_FLIGHT = 2,
EVENT_FLAME_BREATH = 3,
EVENT_CONFLAGRATION = 4,
// Event group
EVENT_GROUP_LAND_PHASE = 1,
};
enum MovementPoints
{
POINT_FLIGHT = 1,
POINT_LAND = 2,
};
enum Misc
{
SOUND_ID_DEATH = 17531,
};
Position const SavianaRagefireFlyPos = {3155.51f, 683.844f, 95.20f, 4.69f};
Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 79.54f, 4.69f};
class boss_saviana_ragefire : public CreatureScript
{
public:
boss_saviana_ragefire() : CreatureScript("boss_saviana_ragefire") { }
struct boss_saviana_ragefireAI : public BossAI
{
boss_saviana_ragefireAI(Creature* creature) : BossAI(creature, DATA_SAVIANA_RAGEFIRE)
{
}
void Reset()
{
_Reset();
me->SetReactState(REACT_AGGRESSIVE);
events.ScheduleEvent(EVENT_ENRAGE, 20000, EVENT_GROUP_LAND_PHASE);
events.ScheduleEvent(EVENT_FLAME_BREATH, 30000, EVENT_GROUP_LAND_PHASE);
events.ScheduleEvent(EVENT_FLIGHT, 50000);
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
me->PlayDirectSound(SOUND_ID_DEATH);
}
void MovementInform(uint32 type, uint32 point)
{
if (type != POINT_MOTION_TYPE)
return;
switch (point)
{
case POINT_FLIGHT:
events.ScheduleEvent(EVENT_CONFLAGRATION, 1000);
Talk(SAY_CONFLAGRATION);
break;
case POINT_LAND:
me->SetFlying(false);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->SetReactState(REACT_AGGRESSIVE);
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired();
DoStartMovement(me->getVictim());
break;
default:
break;
}
}
void JustReachedHome()
{
_JustReachedHome();
me->SetFlying(false);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
}
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
Talk(SAY_KILL);
}
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STAT_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_FLIGHT:
{
me->SetFlying(true);
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyPos);
events.ScheduleEvent(EVENT_FLIGHT, 50000);
events.DelayEvents(12500, EVENT_GROUP_LAND_PHASE);
break;
}
case EVENT_CONFLAGRATION:
DoCast(me, SPELL_CONFLAGRATION, true);
break;
case EVENT_ENRAGE:
DoCast(me, SPELL_ENRAGE);
Talk(EMOTE_ENRAGED);
events.ScheduleEvent(EVENT_ENRAGE, urand(15000, 20000), EVENT_GROUP_LAND_PHASE);
break;
case EVENT_FLAME_BREATH:
DoCastVictim(SPELL_FLAME_BREATH);
events.ScheduleEvent(EVENT_FLAME_BREATH, urand(20000, 30000), EVENT_GROUP_LAND_PHASE);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const
{
return GetRubySanctumAI<boss_saviana_ragefireAI>(creature);
}
};
class ConflagrationTargetSelector
{
public:
ConflagrationTargetSelector() { }
bool operator()(Unit* unit)
{
return unit->GetTypeId() != TYPEID_PLAYER;
}
};
class spell_saviana_conflagration_init : public SpellScriptLoader
{
public:
spell_saviana_conflagration_init() : SpellScriptLoader("spell_saviana_conflagration_init") { }
class spell_saviana_conflagration_init_SpellScript : public SpellScript
{
PrepareSpellScript(spell_saviana_conflagration_init_SpellScript);
void FilterTargets(std::list<Unit*>& unitList)
{
unitList.remove_if(ConflagrationTargetSelector());
uint8 maxSize = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 3);
if (unitList.size() > maxSize)
Trinity::RandomResizeList(unitList, maxSize);
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->CastSpell(GetHitUnit(), SPELL_FLAME_BEACON, true);
GetCaster()->CastSpell(GetHitUnit(), SPELL_CONFLAGRATION_2, true);
}
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_saviana_conflagration_init_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_AREA_ENEMY_SRC);
OnEffect += SpellEffectFn(spell_saviana_conflagration_init_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_saviana_conflagration_init_SpellScript();
}
};
class spell_saviana_conflagration_throwback : public SpellScriptLoader
{
public:
spell_saviana_conflagration_throwback() : SpellScriptLoader("spell_saviana_conflagration_throwback") { }
class spell_saviana_conflagration_throwback_SpellScript : public SpellScript
{
PrepareSpellScript(spell_saviana_conflagration_throwback_SpellScript);
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireLandPos);
}
void Register()
{
OnEffect += SpellEffectFn(spell_saviana_conflagration_throwback_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_saviana_conflagration_throwback_SpellScript();
}
};
void AddSC_boss_saviana_ragefire()
{
new boss_saviana_ragefire();
new spell_saviana_conflagration_init();
new spell_saviana_conflagration_throwback();
}
@@ -0,0 +1,256 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptPCH.h"
#include "ruby_sanctum.h"
DoorData const doorData[] =
{
{GO_FIRE_FIELD, DATA_BALTHARUS_THE_WARBORN, DOOR_TYPE_PASSAGE, BOUNDARY_E },
{0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE},
};
class instance_ruby_sanctum : public InstanceMapScript
{
public:
instance_ruby_sanctum() : InstanceMapScript("instance_ruby_sanctum", 724) { }
struct instance_ruby_sanctum_InstanceMapScript : public InstanceScript
{
instance_ruby_sanctum_InstanceMapScript(InstanceMap* map) : InstanceScript(map)
{
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
BaltharusTheWarbornGUID = 0;
GeneralZarithrianGUID = 0;
SavianaRagefireGUID = 0;
HalionGUID = 0;
CrystalChannelTargetGUID = 0;
XerestraszaGUID = 0;
BaltharusSharedHealth = 0;
FlameWallsGUID = 0;
}
void OnCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
case NPC_BALTHARUS_THE_WARBORN:
BaltharusTheWarbornGUID = creature->GetGUID();
break;
case NPC_GENERAL_ZARITHRIAN:
GeneralZarithrianGUID = creature->GetGUID();
break;
case NPC_SAVIANA_RAGEFIRE:
SavianaRagefireGUID = creature->GetGUID();
break;
case NPC_HALION:
HalionGUID = creature->GetGUID();
break;
case NPC_BALTHARUS_TARGET:
CrystalChannelTargetGUID = creature->GetGUID();
break;
case NPC_XERESTRASZA:
XerestraszaGUID = creature->GetGUID();
break;
default:
break;
}
}
void OnGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_FIRE_FIELD:
AddDoor(go, true);
break;
case GO_FLAME_WALLS:
FlameWallsGUID = go->GetGUID();
break;
default:
break;
}
}
void OnGameObjectRemove(GameObject* go)
{
switch (go->GetEntry())
{
case GO_FIRE_FIELD:
AddDoor(go, false);
break;
default:
break;
}
}
uint64 GetData64(uint32 type)
{
switch (type)
{
case DATA_BALTHARUS_THE_WARBORN:
return BaltharusTheWarbornGUID;
case DATA_GENERAL_ZARITHRIAN:
return GeneralZarithrianGUID;
case DATA_SAVIANA_RAGEFIRE:
return SavianaRagefireGUID;
case DATA_HALION:
return HalionGUID;
case DATA_CRYSTAL_CHANNEL_TARGET:
return CrystalChannelTargetGUID;
case DATA_XERESTRASZA:
return XerestraszaGUID;
default:
break;
}
return 0;
}
bool SetBossState(uint32 type, EncounterState state)
{
if (!InstanceScript::SetBossState(type, state))
return false;
switch (type)
{
case DATA_BALTHARUS_THE_WARBORN:
{
if (state == DONE && GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE)
{
// GO_FLAME_WALLS
if (GameObject* flameWalls = instance->GetGameObject(FlameWallsGUID))
{
flameWalls->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
flameWalls->SetGoState(GO_STATE_READY);
}
if (Creature* zarithrian = instance->GetCreature(GeneralZarithrianGUID))
zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE);
}
break;
}
case DATA_SAVIANA_RAGEFIRE:
{
if (state == DONE && GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE)
{
if (GameObject* flameWalls = instance->GetGameObject(FlameWallsGUID))
{
flameWalls->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
flameWalls->SetGoState(GO_STATE_READY);
}
if (Creature* zarithrian = instance->GetCreature(GeneralZarithrianGUID))
zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE);
}
break;
}
default:
break;
}
return true;
}
void SetData(uint32 type, uint32 data)
{
switch (type)
{
case DATA_BALTHARUS_SHARED_HEALTH:
BaltharusSharedHealth = data;
break;
}
}
uint32 GetData(uint32 type)
{
switch (type)
{
case DATA_BALTHARUS_SHARED_HEALTH:
return BaltharusSharedHealth;
default:
break;
}
return 0;
}
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "R S " << 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 == 'R' && dataHead2 == 'S')
{
for (uint8 i = 0; i < EncounterCount; ++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:
uint64 BaltharusTheWarbornGUID;
uint64 GeneralZarithrianGUID;
uint64 SavianaRagefireGUID;
uint64 HalionGUID;
uint64 CrystalChannelTargetGUID;
uint64 XerestraszaGUID;
uint64 FlameWallsGUID;
uint32 BaltharusSharedHealth;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_ruby_sanctum_InstanceMapScript(map);
}
};
void AddSC_instance_ruby_sanctum()
{
new instance_ruby_sanctum();
}
@@ -0,0 +1,169 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptPCH.h"
#include "ruby_sanctum.h"
enum Texts
{
SAY_XERESTRASZA_EVENT = 0,
SAY_XERESTRASZA_EVENT_1 = 1,
SAY_XERESTRASZA_EVENT_2 = 2,
SAY_XERESTRASZA_EVENT_3 = 3,
SAY_XERESTRASZA_EVENT_4 = 4,
SAY_XERESTRASZA_EVENT_5 = 5,
SAY_XERESTRASZA_EVENT_6 = 6,
SAY_XERESTRASZA_EVENT_7 = 7,
SAY_XERESTRASZA_INTRO = 8,
};
enum Events
{
EVENT_XERESTRASZA_EVENT_1 = 1,
EVENT_XERESTRASZA_EVENT_2 = 2,
EVENT_XERESTRASZA_EVENT_3 = 3,
EVENT_XERESTRASZA_EVENT_4 = 4,
EVENT_XERESTRASZA_EVENT_5 = 5,
EVENT_XERESTRASZA_EVENT_6 = 6,
EVENT_XERESTRASZA_EVENT_7 = 7,
};
Position const xerestraszaMovePos = {3151.236f, 379.8733f, 86.31996f, 0.0f};
class npc_xerestrasza : public CreatureScript
{
public:
npc_xerestrasza() : CreatureScript("npc_xerestrasza") { }
struct npc_xerestraszaAI : public ScriptedAI
{
npc_xerestraszaAI(Creature* creature) : ScriptedAI(creature)
{
_isIntro = true;
_introDone = false;
}
void Reset()
{
_events.Reset();
me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER);
}
void DoAction(int32 const action)
{
if (action == ACTION_BALTHARUS_DEATH)
{
me->setActive(true);
_isIntro = false;
Talk(SAY_XERESTRASZA_EVENT);
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->GetMotionMaster()->MovePoint(0, xerestraszaMovePos);
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_1, 16000);
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_2, 25000);
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_3, 32000);
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_4, 42000);
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_5, 51000);
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_6, 61000);
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_7, 69000);
}
else if (action == ACTION_INTRO_TRIGGER && !_introDone)
{
_introDone = true;
Talk(SAY_XERESTRASZA_INTRO);
}
}
void UpdateAI(uint32 const diff)
{
if (_isIntro)
return;
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_XERESTRASZA_EVENT_1:
Talk(SAY_XERESTRASZA_EVENT_1);
break;
case EVENT_XERESTRASZA_EVENT_2:
Talk(SAY_XERESTRASZA_EVENT_2);
break;
case EVENT_XERESTRASZA_EVENT_3:
Talk(SAY_XERESTRASZA_EVENT_3);
break;
case EVENT_XERESTRASZA_EVENT_4:
Talk(SAY_XERESTRASZA_EVENT_4);
break;
case EVENT_XERESTRASZA_EVENT_5:
Talk(SAY_XERESTRASZA_EVENT_5);
break;
case EVENT_XERESTRASZA_EVENT_6:
Talk(SAY_XERESTRASZA_EVENT_6);
break;
case EVENT_XERESTRASZA_EVENT_7:
me->SetFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER);
Talk(SAY_XERESTRASZA_EVENT_7);
me->setActive(false);
break;
default:
break;
}
}
}
private:
EventMap _events;
bool _isIntro;
bool _introDone;
};
CreatureAI* GetAI(Creature* creature) const
{
return GetRubySanctumAI<npc_xerestraszaAI>(creature);
}
};
class at_baltharus_plateau : public AreaTriggerScript
{
public:
at_baltharus_plateau() : AreaTriggerScript("at_baltharus_plateau") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
{
// Only trigger once
if (InstanceScript* instance = player->GetInstanceScript())
{
if (Creature* xerestrasza = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_XERESTRASZA)))
xerestrasza->AI()->DoAction(ACTION_INTRO_TRIGGER);
if (Creature* baltharus = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_BALTHARUS_THE_WARBORN)))
baltharus->AI()->DoAction(ACTION_INTRO_TRIGGER);
}
return true;
}
};
void AddSC_ruby_sanctum()
{
new npc_xerestrasza();
new at_baltharus_plateau();
}
@@ -0,0 +1,105 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RUBY_SANCTUM_H_
#define RUBY_SANCTUM_H_
#include "SpellScript.h"
#include "Map.h"
#include "Creature.h"
#define RSScriptName "instance_ruby_sanctum"
uint32 const EncounterCount = 4;
enum DataTypes
{
// Encounter States/Boss GUIDs
DATA_BALTHARUS_THE_WARBORN = 0,
DATA_GENERAL_ZARITHRIAN = 1,
DATA_SAVIANA_RAGEFIRE = 2,
DATA_HALION = 3,
// Etc
DATA_XERESTRASZA = 4,
DATA_CRYSTAL_CHANNEL_TARGET = 5,
DATA_BALTHARUS_SHARED_HEALTH = 6,
};
enum SharedActions
{
ACTION_INTRO_TRIGGER = -3975101,
ACTION_BALTHARUS_DEATH = -3975102,
};
enum CreaturesIds
{
// Baltharus the Warborn
NPC_BALTHARUS_THE_WARBORN = 39751,
NPC_BALTHARUS_THE_WARBORN_CLONE = 39899,
NPC_BALTHARUS_TARGET = 26712,
// General Zarithrian
NPC_GENERAL_ZARITHRIAN = 39746,
NPC_ONYX_FLAMECALLER = 39814,
NPC_ZARITHIAN_SPAWN_STALKER = 39794,
// Saviana Ragefire
NPC_SAVIANA_RAGEFIRE = 39747,
// Halion
NPC_HALION = 39863,
NPC_HALION_TWILIGHT = 40142,
NPC_HALION_CONTROLLER = 40146,
NPC_LIVING_INFERNO = 40681,
NPC_LIVING_EMBER = 40683,
NPC_ORB_CARRIER = 40081,
NPC_ORB_ROTATION_FOCUS = 40091,
NPC_SHADOW_ORB_N = 40083,
NPC_SHADOW_ORB_S = 40100,
// Xerestrasza
NPC_XERESTRASZA = 40429,
};
enum GameObjectsIds
{
GO_HALION_PORTAL_1 = 202794, // Unknown spell 75074, should be somehow be linked to 74807
GO_HALION_PORTAL_2 = 202795, // Also spell 75074
GO_HALION_PORTAL_EXIT = 202796, // Leave Twilight Realm (74812)
GO_FIRE_FIELD = 203005,
GO_FLAME_WALLS = 203006,
GO_FLAME_RING = 203007,
};
enum WorldStatesRS
{
WORLDSTATE_UNK_1 = 5049, // Halion corporeality amount - normal phase
WORLDSTATE_UNK_2 = 5050, // Halion corporeality amount - twilight phase
WORLDSTATE_UNK_3 = 5051, // Halion corporeality toggle show
};
template<class AI>
CreatureAI* GetRubySanctumAI(Creature* creature)
{
if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
if (instance->GetInstanceScript())
if (instance->GetScriptId() == GetScriptId(RSScriptName))
return new AI(creature);
return NULL;
}
#endif // RUBY_SANCTUM_H_