diff options
Diffstat (limited to 'src')
4 files changed, 306 insertions, 0 deletions
diff --git a/src/server/scripts/Zandalar/KingsRest/instance_kings_rest.cpp b/src/server/scripts/Zandalar/KingsRest/instance_kings_rest.cpp new file mode 100644 index 00000000000..d770aee54d4 --- /dev/null +++ b/src/server/scripts/Zandalar/KingsRest/instance_kings_rest.cpp @@ -0,0 +1,79 @@ +/* + * 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 "InstanceScript.h" +#include "ScriptMgr.h" +#include "kings_rest.h" + +ObjectData const creatureData[] = +{ + { BOSS_GOLDEN_SERPENT, DATA_GOLDEN_SERPENT }, + { BOSS_MCHIMBA_THE_EMBALMER, DATA_MCHIMBA_THE_EMBALMER }, + { BOSS_AKAALI_THE_CONQUEROR, DATA_AKAALI_THE_CONQUEROR }, + { BOSS_ZANAZAL_THE_WISE, DATA_ZANAZAL_THE_WISE }, + { BOSS_KULA_THE_BUTCHER, DATA_KULA_THE_BUTCHER }, + { BOSS_KING_DAZAR, DATA_KING_DAZAR }, + { 0, 0 } // END +}; + +DoorData const doorData[] = +{ + { GO_KINGS_REST_SERPENT_POST_DOOR, DATA_GOLDEN_SERPENT, EncounterDoorBehavior::OpenWhenDone }, + { 0, 0, EncounterDoorBehavior::OpenWhenNotInProgress } // END +}; + +ObjectData const objectData[] = +{ + { GO_KINGS_REST_ENTRYWAY_DOOR, DATA_KINGS_REST_INTRO_DOOR }, + { 0, 0 } // END +}; + +DungeonEncounterData const encounters[] = +{ + { DATA_GOLDEN_SERPENT, {{ 2139 }} }, + { DATA_COUNCIL_OF_TRIBES, {{ 2140 }} }, + { DATA_MCHIMBA_THE_EMBALMER, {{ 2142 }} }, + { DATA_KING_DAZAR, {{ 2143 }} }, +}; + +class instance_kings_rest : public InstanceMapScript +{ +public: + instance_kings_rest() : InstanceMapScript(KingsRestScriptName, 1762) { } + + struct instance_kings_rest_InstanceMapScript : public InstanceScript + { + instance_kings_rest_InstanceMapScript(InstanceMap* map) : InstanceScript(map) + { + SetHeaders(DataHeader); + SetBossNumber(EncounterCount); + LoadObjectData(creatureData, objectData); + LoadDoorData(doorData); + LoadDungeonEncounterData(encounters); + } + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const override + { + return new instance_kings_rest_InstanceMapScript(map); + } +}; + +void AddSC_instance_kings_rest() +{ + new instance_kings_rest(); +} diff --git a/src/server/scripts/Zandalar/KingsRest/kings_rest.cpp b/src/server/scripts/Zandalar/KingsRest/kings_rest.cpp new file mode 100644 index 00000000000..190c189f5f8 --- /dev/null +++ b/src/server/scripts/Zandalar/KingsRest/kings_rest.cpp @@ -0,0 +1,149 @@ +/* + * 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 "GameObject.h" +#include "InstanceScript.h" +#include "TemporarySummon.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "Unit.h" +#include "kings_rest.h" + +enum KingsRestData +{ + // Creature + NPC_SHADOW_OF_ZUL = 137020, + + // DisplayIDs + DISPLAY_INVISIBLE_ZUL = 11686, + + // Spell Visuals + SPELL_VISUAL_ZUL_OPEN_GOB = 77330, + + // Conversation + CONV_ZUL_KINGS_REST_INTRO = 7690, + + // Spells + SPELL_ZUL_SHADOWFORM = 269058 +}; + +constexpr Position ShadowOfZulIntroSpawnPosition = { -944.9617f, 2646.5268f, 832.8684f, 4.716575f }; + +// XX - KingsRest - Trigger Intro Event with Shadow of Zul +struct at_kings_rest_trigger_intro_event_with_zul : AreaTriggerAI +{ + at_kings_rest_trigger_intro_event_with_zul(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + if (!unit->IsPlayer()) + return; + + Conversation::CreateConversation(CONV_ZUL_KINGS_REST_INTRO, unit, unit->GetPosition(), unit->GetGUID()); + at->Remove(); + } +}; + +// 7690 - Shadow of Zul - KingsRest Intro +class conversation_kings_rest_intro : public ConversationScript +{ +public: + conversation_kings_rest_intro() : ConversationScript("conversation_kings_rest_intro") { } + + enum KingsRestIntroConversationData + { + CONVO_ACTOR_INTRO_ZUL = 64206, + + CONVO_LINE_INTRO_DOOR = 17526 + }; + + enum KingsRestIntroEventData + { + EVENT_ZUL_OPEN_INTRO_DOOR = 1, + EVENT_ZUL_INTRO_DESPAWN, + }; + + void OnConversationCreate(Conversation* conversation, Unit* /*creator*/) override + { + TempSummon* shadowOfZul = conversation->SummonCreature(NPC_SHADOW_OF_ZUL, ShadowOfZulIntroSpawnPosition, TEMPSUMMON_MANUAL_DESPAWN); + if (!shadowOfZul) + return; + + conversation->AddActor(CONVO_ACTOR_INTRO_ZUL, 0, shadowOfZul->GetGUID()); + conversation->Start(); + } + + void OnConversationStart(Conversation* conversation) override + { + _events.ScheduleEvent(EVENT_ZUL_OPEN_INTRO_DOOR, conversation->GetLineEndTime(DEFAULT_LOCALE, CONVO_LINE_INTRO_DOOR)); + } + + void OnConversationUpdate(Conversation* conversation, uint32 diff) override + { + _events.Update(diff); + + switch (_events.ExecuteEvent()) + { + case EVENT_ZUL_OPEN_INTRO_DOOR: + { + Creature* shadowOfZul = conversation->GetActorCreature(0); + if (!shadowOfZul) + break; + + shadowOfZul->RemoveAurasDueToSpell(SPELL_ZUL_SHADOWFORM); + _events.ScheduleEvent(EVENT_ZUL_INTRO_DESPAWN, 1s); + + if (InstanceScript* instance = conversation->GetInstanceScript()) + { + if (GameObject* gate = instance->GetGameObject(DATA_KINGS_REST_INTRO_DOOR)) + { + gate->SetGoState(GO_STATE_ACTIVE); + gate->SetSpellVisualId(SPELL_VISUAL_ZUL_OPEN_GOB); + } + } + break; + } + case EVENT_ZUL_INTRO_DESPAWN: + { + Creature* shadowOfZul = conversation->GetActorCreature(0); + if (!shadowOfZul) + break; + + shadowOfZul->SetDisplayId(DISPLAY_INVISIBLE_ZUL); + shadowOfZul->DespawnOrUnsummon(1s); + break; + } + default: + break; + } + } + +private: + EventMap _events; +}; + +void AddSC_kings_rest() +{ + // Areatrigger + RegisterAreaTriggerAI(at_kings_rest_trigger_intro_event_with_zul); + + // Conversation + new conversation_kings_rest_intro(); +} diff --git a/src/server/scripts/Zandalar/KingsRest/kings_rest.h b/src/server/scripts/Zandalar/KingsRest/kings_rest.h new file mode 100644 index 00000000000..b959bdb02b7 --- /dev/null +++ b/src/server/scripts/Zandalar/KingsRest/kings_rest.h @@ -0,0 +1,70 @@ +/* + * 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_KINGS_REST_H_ +#define DEF_KINGS_REST_H_ + +#include "CreatureAIImpl.h" + +#define DataHeader "KingsRest" +#define KingsRestScriptName "instance_kings_rest" + +uint32 const EncounterCount = 4; + +enum KingsRestDataTypes +{ + // Encounters + DATA_GOLDEN_SERPENT = 0, + DATA_MCHIMBA_THE_EMBALMER, + DATA_COUNCIL_OF_TRIBES, + DATA_KING_DAZAR, + + // Council of Tribes + DATA_AKAALI_THE_CONQUEROR, + DATA_ZANAZAL_THE_WISE, + DATA_KULA_THE_BUTCHER, + + // GameObjects + DATA_KINGS_REST_INTRO_DOOR, +}; + +enum KingsRestCreatureIds +{ + // Bosses + BOSS_GOLDEN_SERPENT = 135322, + BOSS_AKAALI_THE_CONQUEROR = 135470, + BOSS_ZANAZAL_THE_WISE = 135472, + BOSS_KULA_THE_BUTCHER = 135475, + BOSS_MCHIMBA_THE_EMBALMER = 134993, + BOSS_KING_DAZAR = 136160 +}; + +enum KingsRestGameObjectIds +{ + GO_KINGS_REST_ENTRYWAY_DOOR = 282652, + GO_KINGS_REST_SERPENT_POST_DOOR = 287392 +}; + +template <class AI, class T> +inline AI* GetKingsRestAI(T* obj) +{ + return GetInstanceAI<AI>(obj, KingsRestScriptName); +} + +#define RegisterKingsRestCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetKingsRestAI) + +#endif diff --git a/src/server/scripts/Zandalar/zandalar_script_loader.cpp b/src/server/scripts/Zandalar/zandalar_script_loader.cpp index 2822c02be62..bc16599fbb8 100644 --- a/src/server/scripts/Zandalar/zandalar_script_loader.cpp +++ b/src/server/scripts/Zandalar/zandalar_script_loader.cpp @@ -22,6 +22,10 @@ void AddSC_instance_underrot(); void AddSC_boss_elder_leaxa(); void AddSC_boss_cragmaw_the_infested(); +// KingsRest +void AddSC_instance_kings_rest(); +void AddSC_kings_rest(); + // The name of this function should match: // void Add${NameOfDirectory}Scripts() void AddZandalarScripts() @@ -30,4 +34,8 @@ void AddZandalarScripts() AddSC_instance_underrot(); AddSC_boss_elder_leaxa(); AddSC_boss_cragmaw_the_infested(); + + //KingsRest + AddSC_instance_kings_rest(); + AddSC_kings_rest(); } |
