TrinityCore
sunken_temple.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: Sunken_Temple
20SD%Complete: 100
21SDComment: Area Trigger + Puzzle event support
22SDCategory: Sunken Temple
23EndScriptData */
24
25/* ContentData
26at_malfurion_Stormrage_trigger
27EndContentData */
28
29#include "ScriptMgr.h"
30#include "GameObject.h"
31#include "GameObjectAI.h"
32#include "InstanceScript.h"
33#include "Player.h"
34#include "SpellAuraEffects.h"
35#include "SpellScript.h"
36#include "sunken_temple.h"
37
38/*#####
39# at_malfurion_Stormrage_trigger
40#####*/
41
43{
47};
48
50{
51 public:
52 at_malfurion_stormrage() : AreaTriggerScript("at_malfurion_stormrage") { }
53
54 bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
55 {
56 if (player->GetInstanceScript() && !player->FindNearestCreature(NPC_MALFURION_STORMRAGE, 15.0f) &&
59 return false;
60 }
61};
62
63/*#####
64# go_atalai_statue
65#####*/
66
68{
69 public:
70 go_atalai_statue() : GameObjectScript("go_atalai_statue") { }
71
73 {
74 go_atalai_statueAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
75
77
78 bool OnGossipHello(Player* /*player*/) override
79 {
81 return false;
82 }
83 };
84
85 GameObjectAI* GetAI(GameObject* go) const override
86 {
87 return GetSunkenTempleAI<go_atalai_statueAI>(go);
88 }
89};
90
92{
95};
96
97// 12479 - Hex of Jammal'an
99{
100 bool Validate(SpellInfo const* /*spellInfo*/) override
101 {
103 }
104
105 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
106 {
107 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
108 return;
109
110 Unit* target = GetTarget();
111 Unit* caster = GetCaster();
112
113 if (!caster || !caster->IsAlive())
114 return;
115
116 caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_TRANSFORM, true);
117 caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_CHARM, true);
118 }
119
120 void Register() override
121 {
123 }
124};
125
126// 12480 - Hex of Jammal'an
128{
129 bool Validate(SpellInfo const* /*spellInfo*/) override
130 {
132 }
133
134 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
135 {
137 }
138
139 void Register() override
140 {
142 }
143};
144
146{
148 new go_atalai_statue();
151}
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition: ObjectDefines.h:63
@ QUEST_STATUS_REWARDED
Definition: QuestDef.h:148
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_TRANSFORM
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
Unit * GetCaster() const
Unit * GetTarget() const
GameObject *const me
Definition: GameObjectAI.h:50
uint32 GetEntry() const
Definition: Object.h:161
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:16050
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Definition: Unit.h:627
bool IsAlive() const
Definition: Unit.h:1164
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
GameObjectAI * GetAI(GameObject *go) const override
bool Validate(SpellInfo const *) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetPositionZ() const
Definition: Position.h:78
bool OnGossipHello(Player *) override
MalfurionMisc
@ NPC_MALFURION_STORMRAGE
@ QUEST_ERANIKUS_TYRANT_OF_DREAMS
@ QUEST_THE_CHARGE_OF_DRAGONFLIGHTS
HexOfJammalan
@ SPELL_HEX_OF_JAMMALAN_TRANSFORM
@ SPELL_HEX_OF_JAMMALAN_CHARM
void AddSC_sunken_temple()
@ EVENT_STATE
Definition: sunken_temple.h:52