Scripts/HallsOfOrigination: Some work on Halls of Origination.

Temple Guardian Anhuur's script added.
ToDo: Make the triggers invisible.

Merry Christmas folks!
This commit is contained in:
Subv committed 2012-12-24 18:25:57 -05:00
1 parent 81fee56bfe
commit f9e592e9c7
9 files changed
+725 -21

No files matched your search

@@ -110,6 +110,9 @@ set(scripts_STAT_SRCS
Kalimdor/OnyxiasLair/boss_onyxia.cpp
Kalimdor/OnyxiasLair/onyxias_lair.h
Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
Kalimdor/HallsOfOrigination/halls_of_origination.h
Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp
Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp
)
message(" -> Prepared: Kalimdor")
@@ -0,0 +1,402 @@
/*
* Copyright (C) 2008-2012 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 "SpellAuras.h"
#include "halls_of_origination.h"
#include "Player.h"
enum Texts
{
SAY_AGGRO = 0,
SAY_SHIELD = 1,
EMOTE_SHIELD = 2,
EMOTE_UNSHIELD = 3,
SAY_KILL = 4,
SAY_DEATH = 5
};
enum Events
{
EVENT_DIVINE_RECKONING = 1,
EVENT_BURNING_LIGHT = 2,
EVENT_SEAR = 3,
};
enum Spells
{
SPELL_DIVINE_RECKONING = 75592,
SPELL_BURNING_LIGHT = 75115,
SPELL_REVERBERATING_HYMN = 75322,
SPELL_SHIELD_OF_LIGHT = 74938,
SPELL_ACTIVATE_BEACONS = 76599,
SPELL_TELEPORT = 74969,
SPELL_SHIELD_VISUAL_RIGHT = 83698,
SPELL_BEAM_OF_LIGHT_RIGHT = 76573,
SPELL_SHIELD_VISUAL_LEFT = 83697,
SPELL_BEAM_OF_LIGHT_LEFT = 74930,
SPELL_SEARING_LIGHT = 75194,
};
enum Phases
{
PHASE_SHIELDED = 0,
PHASE_FIRST_SHIELD = 1, // Ready to be shielded for the first time
PHASE_SECOND_SHIELD = 2, // First shield already happened, ready to be shielded a second time
PHASE_FINAL = 3 // Already shielded twice, ready to finish the encounter normally.
};
enum Actions
{
ACTION_DISABLE_BEACON,
};
class boss_temple_guardian_anhuur : public CreatureScript
{
public:
boss_temple_guardian_anhuur() : CreatureScript("boss_temple_guardian_anhuur") { }
struct boss_temple_guardian_anhuurAI : public BossAI
{
boss_temple_guardian_anhuurAI(Creature* creature) : BossAI(creature, DATA_TEMPLE_GUARDIAN_ANHUUR) { }
void CleanStalkers()
{
std::list<Creature*> stalkers;
GetCreatureListWithEntryInGrid(stalkers, me, NPC_CAVE_IN_STALKER, 100.0f);
for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
{
(*itr)->RemoveAurasDueToSpell(SPELL_BEAM_OF_LIGHT_RIGHT);
(*itr)->RemoveAurasDueToSpell(SPELL_BEAM_OF_LIGHT_LEFT);
}
}
void Reset()
{
_phase = PHASE_FIRST_SHIELD;
_oldPhase = PHASE_FIRST_SHIELD;
_beacons = 0;
_Reset();
CleanStalkers();
me->RemoveAurasDueToSpell(SPELL_SHIELD_OF_LIGHT);
events.ScheduleEvent(EVENT_DIVINE_RECKONING, urand(10000, 12000));
events.ScheduleEvent(EVENT_BURNING_LIGHT, 12000);
}
void DamageTaken(Unit* /*attacker*/, uint32& damage)
{
if ((me->HealthBelowPctDamaged(66, damage) && _phase == PHASE_FIRST_SHIELD) ||
(me->HealthBelowPctDamaged(33, damage) && _phase == PHASE_SECOND_SHIELD))
{
_beacons = 2;
_phase++; // Increase the phase
_oldPhase = _phase;
_phase = PHASE_SHIELDED;
me->InterruptNonMeleeSpells(true);
me->AttackStop();
DoCast(me, SPELL_TELEPORT);
DoCast(me, SPELL_SHIELD_OF_LIGHT);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_31);
DoCastAOE(SPELL_ACTIVATE_BEACONS);
std::list<Creature*> stalkers;
GameObject* door = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ANHUUR_DOOR));
GetCreatureListWithEntryInGrid(stalkers, me, NPC_CAVE_IN_STALKER, 100.0f);
stalkers.remove_if(Trinity::HeightDifferenceCheck(door, 0.0f, false)); // Target only the bottom ones
for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
{
if ((*itr)->GetPositionX() > door->GetPositionX())
{
(*itr)->CastSpell((*itr), SPELL_SHIELD_VISUAL_LEFT, true);
(*itr)->CastSpell((*itr), SPELL_BEAM_OF_LIGHT_LEFT, true);
}
else
{
(*itr)->CastSpell((*itr), SPELL_SHIELD_VISUAL_RIGHT, true);
(*itr)->CastSpell((*itr), SPELL_BEAM_OF_LIGHT_RIGHT, true);
}
}
DoCast(me, SPELL_REVERBERATING_HYMN);
Talk(EMOTE_SHIELD);
Talk(SAY_SHIELD);
}
}
void DoAction(int32 const action)
{
if (action == ACTION_DISABLE_BEACON)
{
--_beacons;
if (!_beacons)
{
me->RemoveAurasDueToSpell(SPELL_SHIELD_OF_LIGHT);
Talk(EMOTE_UNSHIELD);
_phase = _oldPhase;
}
}
}
void EnterCombat(Unit* /*who*/)
{
instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1);
Talk(SAY_AGGRO);
_EnterCombat();
}
void JustDied(Unit* /*killer*/)
{
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
Talk(SAY_DEATH);
_JustDied();
}
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
Talk(SAY_KILL);
}
void JustReachedHome()
{
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
_JustReachedHome();
instance->SetBossState(DATA_TEMPLE_GUARDIAN_ANHUUR, FAIL);
}
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim() || !CheckInRoom() || me->GetCurrentSpell(CURRENT_CHANNELED_SPELL) || _phase == PHASE_SHIELDED)
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_DIVINE_RECKONING:
DoCastVictim(SPELL_DIVINE_RECKONING);
events.ScheduleEvent(EVENT_DIVINE_RECKONING, urand(10000, 12000));
break;
case EVENT_BURNING_LIGHT:
{
Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me));
if (!unit)
unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
DoCast(unit, SPELL_BURNING_LIGHT);
events.ScheduleEvent(EVENT_SEAR, 2000);
events.ScheduleEvent(EVENT_BURNING_LIGHT, 12000);
break;
}
case EVENT_SEAR:
{
Unit* target = me->FindNearestCreature(NPC_SEARING_LIGHT, 100.0f);
if (!target)
break;
std::list<Creature*> stalkers;
GetCreatureListWithEntryInGrid(stalkers, me, NPC_CAVE_IN_STALKER, 100.0f);
stalkers.remove_if(Trinity::HeightDifferenceCheck(ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ANHUUR_DOOR)), 5.0f, true));
if (stalkers.empty())
break;
stalkers.sort(Trinity::ObjectDistanceOrderPred(target));
// Get the closest statue face (any of its eyes)
Creature* eye1 = stalkers.front();
stalkers.remove(eye1); // Remove the eye.
stalkers.sort(Trinity::ObjectDistanceOrderPred(eye1)); // Find the second eye.
Creature* eye2 = stalkers.front();
eye1->CastSpell(eye1, SPELL_SEARING_LIGHT, true);
eye2->CastSpell(eye2, SPELL_SEARING_LIGHT, true);
break;
}
}
}
DoMeleeAttackIfReady();
}
private:
uint8 _phase;
uint8 _oldPhase;
uint8 _beacons;
};
CreatureAI* GetAI(Creature* creature) const
{
return GetHallsOfOriginationAI<boss_temple_guardian_anhuurAI>(creature);
}
};
class spell_anhuur_shield_of_light : public SpellScriptLoader
{
public:
spell_anhuur_shield_of_light() : SpellScriptLoader("spell_anhuur_shield_of_light") { }
class spell_anhuur_shield_of_light_SpellScript : public SpellScript
{
PrepareSpellScript(spell_anhuur_shield_of_light_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
{
if (InstanceScript* const script = instance->GetInstanceScript())
{
if (GameObject* go = ObjectAccessor::GetGameObject(*GetCaster(), script->GetData64(DATA_ANHUUR_DOOR)))
{
targets.remove_if(Trinity::HeightDifferenceCheck(go, 5.0f, false));
targets.remove(GetCaster());
targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
targets.resize(2);
}
}
}
}
void Register()
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_anhuur_shield_of_light_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_anhuur_shield_of_light_SpellScript();
}
};
class spell_anhuur_disable_beacon_beams : public SpellScriptLoader
{
public:
spell_anhuur_disable_beacon_beams() : SpellScriptLoader("spell_anhuur_disable_beacon_beams") { }
class spell_anhuur_disable_beacon_beams_SpellScript : public SpellScript
{
PrepareSpellScript(spell_anhuur_disable_beacon_beams_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->RemoveAurasDueToSpell(GetEffectValue());
}
void Notify(SpellEffIndex /*index*/)
{
if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
if (InstanceScript* const script = instance->GetInstanceScript())
if (Creature* anhuur = instance->GetCreature(script->GetData64(DATA_ANHUUR_GUID)))
anhuur->AI()->DoAction(ACTION_DISABLE_BEACON);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_anhuur_disable_beacon_beams_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHit += SpellEffectFn(spell_anhuur_disable_beacon_beams_SpellScript::Notify, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_anhuur_disable_beacon_beams_SpellScript();
}
};
class spell_anhuur_activate_beacons : public SpellScriptLoader
{
public:
spell_anhuur_activate_beacons() : SpellScriptLoader("spell_anhuur_activate_beacons") { }
class spell_anhuur_activate_beacons_SpellScript : public SpellScript
{
PrepareSpellScript(spell_anhuur_activate_beacons_SpellScript);
void Activate(SpellEffIndex index)
{
PreventHitDefaultEffect(index);
GetHitGObj()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_anhuur_activate_beacons_SpellScript::Activate, EFFECT_0, SPELL_EFFECT_ACTIVATE_OBJECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_anhuur_activate_beacons_SpellScript();
}
};
class spell_anhuur_divine_reckoning : public SpellScriptLoader
{
public:
spell_anhuur_divine_reckoning() : SpellScriptLoader("spell_anhuur_divine_reckoning") { }
class spell_anhuur_divine_reckoning_AuraScript : public AuraScript
{
PrepareAuraScript(spell_anhuur_divine_reckoning_AuraScript);
void OnPeriodic(AuraEffect const* aurEff)
{
if (Unit* caster = GetCaster())
{
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
caster->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, values, GetTarget());
}
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_anhuur_divine_reckoning_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_anhuur_divine_reckoning_AuraScript();
}
};
void AddSC_boss_temple_guardian_anhuur()
{
new boss_temple_guardian_anhuur();
new spell_anhuur_shield_of_light();
new spell_anhuur_disable_beacon_beams();
new spell_anhuur_activate_beacons();
new spell_anhuur_divine_reckoning();
}
@@ -0,0 +1,70 @@
/*
* Copyright (C) 2008-2012 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 HALLS_OF_ORIGINATION_H
#define HALLS_OF_ORIGINATION_H
#define HoOScriptName "instance_halls_of_origination"
uint32 const EncounterCount = 7;
enum Data
{
// Bosses
DATA_TEMPLE_GUARDIAN_ANHUUR,
DATA_EARTHRAGER_PTAH,
DATA_ANRAPHET,
DATA_ISISET,
DATA_AMMUNAE,
DATA_SETESH,
DATA_RAJH,
// Temple Guardian Anhuur
DATA_ANHUUR_GUID,
DATA_ANHUUR_LEFT_BEACON,
DATA_ANHUUR_RIGHT_BEACON,
DATA_ANHUUR_BRIDGE,
DATA_ANHUUR_DOOR,
};
enum Creatures
{
BOSS_TEMPLE_GUARDIAN_ANHUUR = 39425,
NPC_CAVE_IN_STALKER = 40183,
NPC_SEARING_LIGHT = 40283,
};
enum GameObjects
{
GO_ANHUURS_BRIDGE = 206506,
GO_DOODAD_ULDUM_ELEVATOR_COL01 = 207725,
GO_ANHUURS_DOOR = 202307,
GO_ANHUURS_RIGHT_BEACON = 203136,
GO_ANHUURS_LEFT_BEACON = 203133,
};
template<class AI>
CreatureAI* GetHallsOfOriginationAI(Creature* creature)
{
if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
if (instance->GetInstanceScript())
if (instance->GetScriptId() == sObjectMgr->GetScriptId(HoOScriptName))
return new AI(creature);
return NULL;
}
#endif // HALLS_OF_ORIGINATION_H
@@ -0,0 +1,167 @@
/*
* Copyright (C) 2008-2012 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 "InstanceScript.h"
#include "ScriptedCreature.h"
#include "Map.h"
#include "PoolMgr.h"
#include "AccountMgr.h"
#include "halls_of_origination.h"
#include "Player.h"
#include "WorldPacket.h"
#include "WorldSession.h"
DoorData const doorData[] =
{
{GO_ANHUURS_DOOR, DATA_TEMPLE_GUARDIAN_ANHUUR, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
{GO_ANHUURS_BRIDGE, DATA_TEMPLE_GUARDIAN_ANHUUR, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
{GO_DOODAD_ULDUM_ELEVATOR_COL01, DATA_TEMPLE_GUARDIAN_ANHUUR, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
{0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE }
};
class instance_halls_of_origination : public InstanceMapScript
{
public:
instance_halls_of_origination() : InstanceMapScript(HoOScriptName, 644) { }
struct instance_halls_of_origination_InstanceMapScript : public InstanceScript
{
instance_halls_of_origination_InstanceMapScript(InstanceMap* map) : InstanceScript(map)
{
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
TempleGuardianAnhuurGUID = 0;
AnhuursBridgeGUID = 0;
AnhuursDoorGUID = 0;
AnhuurRightBeaconGUID = 0;
AnhuurLeftBeaconGUID = 0;
}
void OnGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_ANHUURS_BRIDGE:
AnhuursBridgeGUID = go->GetGUID();
case GO_DOODAD_ULDUM_ELEVATOR_COL01:
AddDoor(go, true);
break;
case GO_ANHUURS_DOOR:
AnhuursDoorGUID = go->GetGUID();
AddDoor(go, true);
break;
case GO_ANHUURS_RIGHT_BEACON:
AnhuurRightBeaconGUID = go->GetGUID();
break;
case GO_ANHUURS_LEFT_BEACON:
AnhuurLeftBeaconGUID = go->GetGUID();
break;
}
}
void OnCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
case BOSS_TEMPLE_GUARDIAN_ANHUUR:
TempleGuardianAnhuurGUID = creature->GetGUID();
break;
}
}
uint64 GetData64(uint32 index) const
{
switch (index)
{
case DATA_ANHUUR_BRIDGE:
return AnhuursBridgeGUID;
case DATA_ANHUUR_DOOR:
return AnhuursDoorGUID;
case DATA_ANHUUR_LEFT_BEACON:
return AnhuurLeftBeaconGUID;
case DATA_ANHUUR_RIGHT_BEACON:
return AnhuurRightBeaconGUID;
case DATA_ANHUUR_GUID:
return TempleGuardianAnhuurGUID;
}
return 0;
}
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "H O " << GetBossSaveData();
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void Load(const char* 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 == 'H' && dataHead2 == 'O')
{
for (uint32 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 TempleGuardianAnhuurGUID;
uint64 AnhuursBridgeGUID;
uint64 AnhuursDoorGUID;
uint64 AnhuurRightBeaconGUID;
uint64 AnhuurLeftBeaconGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_halls_of_origination_InstanceMapScript(map);
}
};
void AddSC_instance_halls_of_origination()
{
new instance_halls_of_origination();
}
@@ -383,25 +383,6 @@ class NecroticPlagueTargetCheck : public std::unary_function<Unit*, bool>
uint32 _notAura2;
};
class HeightDifferenceCheck
{
public:
HeightDifferenceCheck(GameObject* go, float diff, bool reverse)
: _baseObject(go), _difference(diff), _reverse(reverse)
{
}
bool operator()(WorldObject* unit) const
{
return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse;
}
private:
GameObject* _baseObject;
float _difference;
bool _reverse;
};
class FrozenThroneResetWorker
{
public:
@@ -1535,7 +1516,7 @@ class npc_valkyr_shadowguard : public CreatureScript
{
std::list<Creature*> triggers;
GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 150.0f);
triggers.remove_if(HeightDifferenceCheck(platform, 5.0f, true));
triggers.remove_if(Trinity::HeightDifferenceCheck(platform, 5.0f, true));
if (triggers.empty())
return;
@@ -2325,7 +2306,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM)))
targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false));
targets.remove_if(Trinity::HeightDifferenceCheck(platform, 5.0f, false));
}
void HandleSendEvent(SpellEffIndex /*effIndex*/)