-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathspell_scripts.cpp
More file actions
159 lines (134 loc) · 5.26 KB
/
spell_scripts.cpp
File metadata and controls
159 lines (134 loc) · 5.26 KB
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
152
153
154
155
156
157
158
159
/* This file is part of the ScriptDev2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Spell_Scripts
SD%Complete: 100
SDComment: Spell scripts for dummy effects (if script need access/interaction with parts of other AI or instance, add it in related source files)
SDCategory: Spell
EndScriptData */
/* ContentData
spell 8913
spell 10848
spell 17327
spell 19512
spell 21050
EndContentData */
#include "precompiled.h"
/* When you make a spell effect:
- always check spell id and effect index
- always return true when the spell is handled by script
*/
enum
{
// quest 6124/6129
SPELL_APPLY_SALVE = 19512,
SPELL_SICKLY_AURA = 19502,
NPC_SICKLY_DEER = 12298,
NPC_SICKLY_GAZELLE = 12296,
NPC_CURED_DEER = 12299,
NPC_CURED_GAZELLE = 12297,
// target morbent fel
SPELL_SACRED_CLEANSING = 8913,
NPC_MORBENT = 1200,
NPC_WEAKENED_MORBENT = 24782,
// npcs that are only interactable while dead
SPELL_SHROUD_OF_DEATH = 10848,
SPELL_SPIRIT_PARTICLES = 17327,
NPC_FRANCLORN_FORGEWRIGHT = 8888,
NPC_GAERIYAN = 9299,
// quest 6661
SPELL_MELODIOUS_RAPTURE = 21050,
SPELL_MELODIOUS_RAPTURE_VISUAL = 21051,
NPC_DEEPRUN_RAT = 13016,
NPC_ENTHRALLED_DEEPRUN_RAT = 13017,
};
bool EffectAuraDummy_spell_aura_dummy_npc(const Aura* pAura, bool bApply)
{
switch (pAura->GetId())
{
case SPELL_SHROUD_OF_DEATH:
case SPELL_SPIRIT_PARTICLES:
{
Creature* pCreature = (Creature*)pAura->GetTarget();
if (!pCreature || (pCreature->GetEntry() != NPC_FRANCLORN_FORGEWRIGHT && pCreature->GetEntry() != NPC_GAERIYAN))
return false;
if (bApply)
pCreature->m_AuraFlags |= UNIT_AURAFLAG_ALIVE_INVISIBLE;
else
pCreature->m_AuraFlags &= ~UNIT_AURAFLAG_ALIVE_INVISIBLE;
return false;
}
}
return false;
}
bool EffectDummyCreature_spell_dummy_npc(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
switch (uiSpellId)
{
case SPELL_APPLY_SALVE:
{
if (uiEffIndex == EFFECT_INDEX_0)
{
if (pCaster->GetTypeId() != TYPEID_PLAYER)
return true;
if (pCreatureTarget->GetEntry() != NPC_SICKLY_DEER && pCreatureTarget->GetEntry() != NPC_SICKLY_GAZELLE)
return true;
// Update entry, remove aura, set the kill credit and despawn
uint32 uiUpdateEntry = pCreatureTarget->GetEntry() == NPC_SICKLY_DEER ? NPC_CURED_DEER : NPC_CURED_GAZELLE;
pCreatureTarget->RemoveAurasDueToSpell(SPELL_SICKLY_AURA);
pCreatureTarget->UpdateEntry(uiUpdateEntry);
((Player*)pCaster)->KilledMonsterCredit(uiUpdateEntry);
pCreatureTarget->ForcedDespawn(20000);
return true;
}
return true;
}
case SPELL_SACRED_CLEANSING:
{
if (uiEffIndex == EFFECT_INDEX_1)
{
if (pCreatureTarget->GetEntry() != NPC_MORBENT)
return true;
pCreatureTarget->UpdateEntry(NPC_WEAKENED_MORBENT);
return true;
}
return true;
}
case SPELL_MELODIOUS_RAPTURE:
{
if (uiEffIndex == EFFECT_INDEX_0)
{
if (pCaster->GetTypeId() != TYPEID_PLAYER && pCreatureTarget->GetEntry() != NPC_DEEPRUN_RAT)
return true;
pCreatureTarget->UpdateEntry(NPC_ENTHRALLED_DEEPRUN_RAT);
pCreatureTarget->CastSpell(pCreatureTarget, SPELL_MELODIOUS_RAPTURE_VISUAL, false);
pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, frand(0.5f, 3.0f), frand(M_PI_F * 0.8f, M_PI_F * 1.2f));
((Player*)pCaster)->KilledMonsterCredit(NPC_ENTHRALLED_DEEPRUN_RAT);
}
return true;
}
}
return false;
}
void AddSC_spell_scripts()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "spell_dummy_npc";
pNewScript->pEffectDummyNPC = &EffectDummyCreature_spell_dummy_npc;
pNewScript->pEffectAuraDummy = &EffectAuraDummy_spell_aura_dummy_npc;
pNewScript->RegisterSelf();
}