/* * 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 . */ /* ScriptData SDName: Sunken_Temple SD%Complete: 100 SDComment: Area Trigger + Puzzle event support SDCategory: Sunken Temple EndScriptData */ /* ContentData at_malfurion_Stormrage_trigger EndContentData */ #include "ScriptMgr.h" #include "GameObject.h" #include "GameObjectAI.h" #include "InstanceScript.h" #include "Player.h" #include "SpellAuraEffects.h" #include "SpellScript.h" #include "sunken_temple.h" /*##### # at_malfurion_Stormrage_trigger #####*/ enum MalfurionMisc { NPC_MALFURION_STORMRAGE = 15362, QUEST_ERANIKUS_TYRANT_OF_DREAMS = 8733, QUEST_THE_CHARGE_OF_DRAGONFLIGHTS = 8555, }; class at_malfurion_stormrage : public AreaTriggerScript { public: at_malfurion_stormrage() : AreaTriggerScript("at_malfurion_stormrage") { } bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override { if (player->GetInstanceScript() && !player->FindNearestCreature(NPC_MALFURION_STORMRAGE, 15.0f) && player->GetQuestStatus(QUEST_THE_CHARGE_OF_DRAGONFLIGHTS) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_ERANIKUS_TYRANT_OF_DREAMS) != QUEST_STATUS_REWARDED) player->SummonCreature(NPC_MALFURION_STORMRAGE, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), -1.52f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 100s); return false; } }; /*##### # go_atalai_statue #####*/ class go_atalai_statue : public GameObjectScript { public: go_atalai_statue() : GameObjectScript("go_atalai_statue") { } struct go_atalai_statueAI : public GameObjectAI { go_atalai_statueAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { } InstanceScript* instance; bool OnGossipHello(Player* /*player*/) override { instance->SetData(EVENT_STATE, me->GetEntry()); return false; } }; GameObjectAI* GetAI(GameObject* go) const override { return GetSunkenTempleAI(go); } }; enum HexOfJammalan { SPELL_HEX_OF_JAMMALAN_TRANSFORM = 12480, SPELL_HEX_OF_JAMMALAN_CHARM = 12483 }; // 12479 - Hex of Jammal'an class spell_sunken_temple_hex_of_jammalan : public AuraScript { bool Validate(SpellInfo const* /*spellInfo*/) override { return ValidateSpellInfo({ SPELL_HEX_OF_JAMMALAN_TRANSFORM, SPELL_HEX_OF_JAMMALAN_CHARM }); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; Unit* target = GetTarget(); Unit* caster = GetCaster(); if (!caster || !caster->IsAlive()) return; caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_TRANSFORM, true); caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_CHARM, true); } void Register() override { AfterEffectRemove += AuraEffectRemoveFn(spell_sunken_temple_hex_of_jammalan::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; // 12480 - Hex of Jammal'an class spell_sunken_temple_hex_of_jammalan_transform : public AuraScript { bool Validate(SpellInfo const* /*spellInfo*/) override { return ValidateSpellInfo({ SPELL_HEX_OF_JAMMALAN_CHARM }); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { GetTarget()->RemoveAurasDueToSpell(SPELL_HEX_OF_JAMMALAN_CHARM); } void Register() override { AfterEffectRemove += AuraEffectRemoveFn(spell_sunken_temple_hex_of_jammalan_transform::AfterRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); } }; void AddSC_sunken_temple() { new at_malfurion_stormrage(); new go_atalai_statue(); RegisterSpellScript(spell_sunken_temple_hex_of_jammalan); RegisterSpellScript(spell_sunken_temple_hex_of_jammalan_transform); }