1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/*
* 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/>.
*/
/* 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_atalai_statueAI>(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);
}
|