diff options
Diffstat (limited to 'src')
4 files changed, 383 insertions, 0 deletions
diff --git a/src/server/scripts/KhazAlgar/NerubarPalace/boss_ulgrax_the_devourer.cpp b/src/server/scripts/KhazAlgar/NerubarPalace/boss_ulgrax_the_devourer.cpp new file mode 100644 index 00000000000..1506141977d --- /dev/null +++ b/src/server/scripts/KhazAlgar/NerubarPalace/boss_ulgrax_the_devourer.cpp @@ -0,0 +1,160 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * 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 "AreaTrigger.h" +#include "AreaTriggerAI.h" +#include "Conversation.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "nerubar_palace.h" + +enum UlgraxTheDevourerSpells +{ + // Intro + SPELL_SWALLOWING_DARKNESS = 451409, + SPELL_SWALLOWING_DARKNESS_TELEPORT = 451411, + SPELL_SWALLOWING_DARKNESS_DAMAGE = 451412 +}; + +enum UlgraxTheDevourerConversations +{ + CONVERSATION_ULGRAX_INTRO = 24332 +}; + +enum UlgraxTheDevourerPoints +{ + POINT_ULGRAX_INTRO = 1 +}; + +constexpr Position UlgraxStartTeleportPosition = { -2991.9705f, -124.82639f, -1137.0024f }; +constexpr Position UlgraxStartCombatPosition = { -2862.7395f, -251.90973f, -1189.6f, 5.550147f }; + +// Id xxxx - Areatrigger +struct at_ulgrax_intro : AreaTriggerAI +{ + at_ulgrax_intro(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + InstanceScript* instance = at->GetInstanceScript(); + if (!instance) + return; + + Player* player = unit->ToPlayer(); + if (!player || player->IsGameMaster()) + return; + + if (Creature* queenAnsurek = instance->GetCreature(DATA_QUEEN_ANSUREK)) + Conversation::CreateConversation(CONVERSATION_ULGRAX_INTRO, queenAnsurek, queenAnsurek->GetPosition(), ObjectGuid::Empty); + + if (Creature* ulgrax = instance->GetCreature(DATA_ULGRAX_THE_DEVOURER)) + ulgrax->GetMotionMaster()->MovePoint(POINT_ULGRAX_INTRO, UlgraxStartTeleportPosition); + + at->Remove(); + } +}; + +// 215657 - Ulgrax the Devourer +struct boss_ulgrax_the_devourer : public BossAI +{ + boss_ulgrax_the_devourer(Creature* creature) : BossAI(creature, DATA_ULGRAX_THE_DEVOURER) { } + + void MovementInform(uint32 /*type*/, uint32 id) override + { + if (id == POINT_ULGRAX_INTRO) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_BATTLE_ROAR); + + scheduler.Schedule(2s, [this](TaskContext context) + { + DoCastSelf(SPELL_SWALLOWING_DARKNESS); + + context.Schedule(11s, [this](TaskContext /*context*/) + { + me->SetHomePosition(UlgraxStartCombatPosition); + me->SetImmuneToAll(false); + }); + }); + } + } + + void UpdateAI(uint32 diff) override + { + scheduler.Update(diff); + + if (!UpdateVictim()) + return; + } +}; + +// 451409 - Swallowing Darkness +class spell_ulgrax_the_devourer_swallowing_darkness_intro : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SWALLOWING_DARKNESS_TELEPORT }); + } + + void HandleHit(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, SPELL_SWALLOWING_DARKNESS_TELEPORT, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_ulgrax_the_devourer_swallowing_darkness_intro::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 451411 - Swallowing Darkness +class spell_ulgrax_the_devourer_swallowing_darkness_teleport : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SWALLOWING_DARKNESS_DAMAGE }); + } + + void SetDest(SpellDestination& dest) + { + dest.Relocate(UlgraxStartCombatPosition); + } + + void HandleAfterHit() + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, SPELL_SWALLOWING_DARKNESS_DAMAGE, true); + } + + void Register() override + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_ulgrax_the_devourer_swallowing_darkness_teleport::SetDest, EFFECT_0, TARGET_DEST_NEARBY_ENTRY); + AfterHit += SpellHitFn(spell_ulgrax_the_devourer_swallowing_darkness_teleport::HandleAfterHit); + } +}; + +void AddSC_boss_ulgrax_the_devourer() +{ + RegisterAreaTriggerAI(at_ulgrax_intro); + RegisterNerubarPalaceCreatureAI(boss_ulgrax_the_devourer); + RegisterSpellScript(spell_ulgrax_the_devourer_swallowing_darkness_intro); + RegisterSpellScript(spell_ulgrax_the_devourer_swallowing_darkness_teleport); +} diff --git a/src/server/scripts/KhazAlgar/NerubarPalace/instance_nerubar_palace.cpp b/src/server/scripts/KhazAlgar/NerubarPalace/instance_nerubar_palace.cpp new file mode 100644 index 00000000000..5eb404571b3 --- /dev/null +++ b/src/server/scripts/KhazAlgar/NerubarPalace/instance_nerubar_palace.cpp @@ -0,0 +1,121 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * 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 "AreaBoundary.h" +#include "Creature.h" +#include "CreatureGroups.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "ScriptMgr.h" +#include "nerubar_palace.h" + +static constexpr ObjectData creatureData[] = +{ + { BOSS_ULGRAX_THE_DEVOURER, DATA_ULGRAX_THE_DEVOURER }, + { BOSS_THE_BLOODBOUND_HORROR, DATA_THE_BLOODBOUND_HORROR }, + { BOSS_SIKRAN, DATA_SIKRAN }, + { BOSS_RASHANAN, DATA_RASHANAN }, + { BOSS_BROODTWISTER_OVINAX, DATA_BROODTWISTER_OVINAX }, + { BOSS_NEXUS_PRINCESS_KYVEZA, DATA_NEXUS_PRINCESS_KYVEZA }, + { BOSS_ANUBARASH, DATA_THE_SILKEN_COURT }, + { BOSS_QUEEN_ANSUREK, DATA_QUEEN_ANSUREK }, + { 0, 0 } // END +}; + +static constexpr DoorData doorData[] = +{ + { GO_WEB_BRIDGE_ULGRAX_INTRO, DATA_WEB_BRIDGE_ULGRAX_INTRO, EncounterDoorBehavior::OpenWhenNotInProgress }, + { 0, 0, EncounterDoorBehavior::OpenWhenNotInProgress } // END +}; + +static constexpr ObjectData objectData[] = +{ + { GO_NERUBAR_PALACE_DOOR_INTRO, DATA_NERUBAR_PALACE_DOOR_INTRO }, + { GO_WEB_BRIDGE_ULGRAX_INTRO, DATA_WEB_BRIDGE_ULGRAX_INTRO }, + { 0, 0 } // END +}; + +static BossBoundaryData const boundaries = +{ + { DATA_ULGRAX_THE_DEVOURER, new CircleBoundary(Position(-2862.7395f, -251.90973f), 150.0f) } +}; + +static constexpr DungeonEncounterData const encounters[] = +{ + { DATA_ULGRAX_THE_DEVOURER, {{ 2902 }} }, + { DATA_THE_BLOODBOUND_HORROR, {{ 2917 }} }, + { DATA_SIKRAN, {{ 2898 }} }, + { DATA_RASHANAN, {{ 2918 }} }, + { DATA_BROODTWISTER_OVINAX, {{ 2919 }} }, + { DATA_NEXUS_PRINCESS_KYVEZA, {{ 2920 }} }, + { DATA_THE_SILKEN_COURT, {{ 2921 }} }, + { DATA_QUEEN_ANSUREK, {{ 2922 }} } +}; + +class instance_nerubar_palace : public InstanceMapScript +{ +public: + instance_nerubar_palace() : InstanceMapScript(NPScriptName, 2657) { } + + struct instance_nerubar_palace_InstanceMapScript: public InstanceScript + { + instance_nerubar_palace_InstanceMapScript(InstanceMap* map) : InstanceScript(map) + { + SetHeaders(DataHeader); + SetBossNumber(EncounterCount); + LoadObjectData(creatureData, objectData); + LoadDoorData(doorData); + LoadBossBoundaries(boundaries); + LoadDungeonEncounterData(encounters); + + _entranceRoomCleared = false; + _ulgraxIntroDone = false; + } + + void OnCreatureGroupDepleted(CreatureGroup const* creatureGroup) override + { + if (!_entranceRoomCleared && creatureGroup->LeaderHasStringId("nerubar_palace_intro_trash")) + { + _entranceRoomCleared = true; + + if (GameObject* door = GetGameObject(DATA_NERUBAR_PALACE_DOOR_INTRO)) + door->UseDoorOrButton(); + } + else if (!_ulgraxIntroDone && creatureGroup->LeaderHasStringId("ulgrax_intro_trash")) + { + _ulgraxIntroDone = true; + + if (GameObject* webBridge = GetGameObject(DATA_WEB_BRIDGE_ULGRAX_INTRO)) + webBridge->UseDoorOrButton(); + } + } + + protected: + bool _entranceRoomCleared; + bool _ulgraxIntroDone; + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const override + { + return new instance_nerubar_palace_InstanceMapScript(map); + } +}; + +void AddSC_instance_nerubar_palace() +{ + new instance_nerubar_palace(); +} diff --git a/src/server/scripts/KhazAlgar/NerubarPalace/nerubar_palace.h b/src/server/scripts/KhazAlgar/NerubarPalace/nerubar_palace.h new file mode 100644 index 00000000000..8990daad1ca --- /dev/null +++ b/src/server/scripts/KhazAlgar/NerubarPalace/nerubar_palace.h @@ -0,0 +1,72 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * 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_NERUBAR_PALACE_H_ +#define DEF_NERUBAR_PALACE_H_ + +#include "CreatureAIImpl.h" + +#define NPScriptName "instance_nerubar_palace" +#define DataHeader "NerubarPalace" + +uint32 const EncounterCount = 8; + +enum NerubarPalaceDataTypes +{ + // Encounters + DATA_ULGRAX_THE_DEVOURER = 0, + DATA_THE_BLOODBOUND_HORROR = 1, + DATA_SIKRAN = 2, + DATA_RASHANAN = 3, + DATA_BROODTWISTER_OVINAX = 4, + DATA_NEXUS_PRINCESS_KYVEZA = 5, + DATA_THE_SILKEN_COURT = 6, + DATA_QUEEN_ANSUREK = 7, + + // Additional Data + DATA_NERUBAR_PALACE_DOOR_INTRO, + DATA_WEB_BRIDGE_ULGRAX_INTRO +}; + +enum NerubarPalaceCreatureIds +{ + // Bosses + BOSS_ULGRAX_THE_DEVOURER = 215657, + BOSS_THE_BLOODBOUND_HORROR = 214502, + BOSS_SIKRAN = 219853, + BOSS_RASHANAN = 224552, + BOSS_BROODTWISTER_OVINAX = 214506, + BOSS_NEXUS_PRINCESS_KYVEZA = 228470, + BOSS_ANUBARASH = 223779, + BOSS_QUEEN_ANSUREK = 219778 +}; + +enum NerubarPalaceGameObjectIds +{ + GO_NERUBAR_PALACE_DOOR_INTRO = 444355, + GO_WEB_BRIDGE_ULGRAX_INTRO = 437052 +}; + +template <class AI, class T> +inline AI* GetNerubarPalaceAI(T* obj) +{ + return GetInstanceAI<AI>(obj, NPScriptName); +} + +#define RegisterNerubarPalaceCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetNerubarPalaceAI) + +#endif diff --git a/src/server/scripts/KhazAlgar/khaz_algar_script_loader.cpp b/src/server/scripts/KhazAlgar/khaz_algar_script_loader.cpp new file mode 100644 index 00000000000..d67f17a6373 --- /dev/null +++ b/src/server/scripts/KhazAlgar/khaz_algar_script_loader.cpp @@ -0,0 +1,30 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * 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/>. + */ + +// This is where scripts' loading functions should be declared: +// Nerub'ar Palace +void AddSC_instance_nerubar_palace(); +void AddSC_boss_ulgrax_the_devourer(); + +// The name of this function should match: +// void Add${NameOfDirectory}Scripts() +void AddKhazAlgarScripts() +{ + // Nerub'ar Palace + AddSC_instance_nerubar_palace(); + AddSC_boss_ulgrax_the_devourer(); +} |
