Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
SpellScript.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "Spell.h"
7#include "SpellAuras.h"
8#include "SpellMgr.h"
9#include "SpellScript.h"
10#include <string>
11
13{
14 if (!Validate(entry))
15 {
16 SF_LOG_ERROR("scripts", "Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str());
17 return false;
18 }
19 return true;
20}
21
28
35
36void _SpellScript::_Init(std::string const* scriptname, uint32 spellId)
37{
39 m_scriptName = scriptname;
40 m_scriptSpellId = spellId;
41}
42
43std::string const* _SpellScript::_GetScriptName() const
44{
45 return m_scriptName;
46}
47
49{
50 // effect index must be in range <0;2>, allow use of special effindexes
51 ASSERT(_effIndex == EFFECT_ALL || _effIndex == EFFECT_FIRST_FOUND || _effIndex < MAX_SPELL_EFFECTS);
52 effIndex = _effIndex;
53}
54
56{
57 uint8 mask = 0;
59 {
60 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
61 {
62 if ((effIndex == EFFECT_FIRST_FOUND) && mask)
63 return mask;
64 if (CheckEffect(spellEntry, i))
65 mask |= (uint8)1 << i;
66 }
67 }
68 else
69 {
70 if (CheckEffect(spellEntry, effIndex))
71 mask |= (uint8)1 << effIndex;
72 }
73 return mask;
74}
75
77{
78 return GetAffectedEffectsMask(spellEntry) & 1 << effIndex;
79}
80
82{
83 switch (effIndex)
84 {
85 case EFFECT_ALL:
86 return "EFFECT_ALL";
88 return "EFFECT_FIRST_FOUND";
89 case EFFECT_0:
90 return "EFFECT_0";
91 case EFFECT_1:
92 return "EFFECT_1";
93 case EFFECT_2:
94 return "EFFECT_2";
95 }
96 return "Invalid Value";
97}
98
99bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
100{
101 if (!spellEntry->Effects[effIndex].Effect && !effName)
102 return true;
103 if (!spellEntry->Effects[effIndex].Effect)
104 return false;
105 return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].Effect == effName);
106}
107
109{
110 switch (effName)
111 {
112 case SPELL_EFFECT_ANY:
113 return "SPELL_EFFECT_ANY";
114 default:
115 char num[10];
116 snprintf(num, sizeof(num), "%u", effName);
117 return num;
118 }
119}
120
122{
123 if (!spellEntry->Effects[effIndex].ApplyAuraName && !effAurName)
124 return true;
125 if (!spellEntry->Effects[effIndex].ApplyAuraName)
126 return false;
127 return (effAurName == SPELL_AURA_ANY) || (spellEntry->Effects[effIndex].ApplyAuraName == effAurName);
128}
129
131{
132 switch (effAurName)
133 {
134 case SPELL_AURA_ANY:
135 return "SPELL_AURA_ANY";
136 default:
137 char num[10];
138 snprintf(num, sizeof(num), "%u", effAurName);
139 return num;
140 }
141}
142
143SpellScript::CastHandler::CastHandler(SpellCastFnType _pCastHandlerScript)
144{
145 pCastHandlerScript = _pCastHandlerScript;
146}
147
149{
150 (spellScript->*pCastHandlerScript)();
151}
152
153SpellScript::CheckCastHandler::CheckCastHandler(SpellCheckCastFnType checkCastHandlerScript)
154{
155 _checkCastHandlerScript = checkCastHandlerScript;
156}
157
162
163SpellScript::EffectHandler::EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
164 : _SpellScript::EffectNameCheck(_effName), _SpellScript::EffectHook(_effIndex)
165{
166 pEffectHandlerScript = _pEffectHandlerScript;
167}
168
170{
171 return "Index: " + EffIndexToString() + " Name: " + _SpellScript::EffectNameCheck::ToString();
172}
173
178
183
184SpellScript::HitHandler::HitHandler(SpellHitFnType _pHitHandlerScript)
185{
186 pHitHandlerScript = _pHitHandlerScript;
187}
188
190{
191 (spellScript->*pHitHandlerScript)();
192}
193
194SpellScript::TargetHook::TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area)
195 : _SpellScript::EffectHook(_effectIndex), targetType(_targetType), area(_area) { }
196
198{
199 std::ostringstream oss;
200 oss << "Index: " << EffIndexToString() << " Target: " << targetType;
201 return oss.str();
202}
203
205{
206 if (!targetType)
207 return false;
208
209 if (spellEntry->Effects[effIndex].TargetA.GetTarget() != targetType &&
210 spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType)
211 return false;
212
214 switch (targetInfo.GetSelectionCategory())
215 {
216 case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE
217 return !area;
219 return true;
220 case TARGET_SELECT_CATEGORY_CONE: // AREA
221 case TARGET_SELECT_CATEGORY_AREA: // AREA
222 return area;
224 switch (targetInfo.GetObjectType())
225 {
226 case TARGET_OBJECT_TYPE_SRC: // EMPTY
227 case TARGET_OBJECT_TYPE_DEST: // EMPTY
228 return false;
229 default:
230 switch (targetInfo.GetReferenceType())
231 {
232 case TARGET_REFERENCE_TYPE_CASTER: // SINGLE
233 return !area;
234 case TARGET_REFERENCE_TYPE_TARGET: // BOTH
235 return true;
236 default:
237 break;
238 }
239 break;
240 }
241 break;
242 default:
243 break;
244 }
245
246 return false;
247}
248
249SpellScript::ObjectAreaTargetSelectHandler::ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType)
250 : TargetHook(_effIndex, _targetType, true)
251{
252 pObjectAreaTargetSelectHandlerScript = _pObjectAreaTargetSelectHandlerScript;
253}
254
255void SpellScript::ObjectAreaTargetSelectHandler::Call(SpellScript* spellScript, std::list<WorldObject*>& targets)
256{
257 (spellScript->*pObjectAreaTargetSelectHandlerScript)(targets);
258}
259
260SpellScript::ObjectTargetSelectHandler::ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType)
261 : TargetHook(_effIndex, _targetType, false)
262{
263 pObjectTargetSelectHandlerScript = _pObjectTargetSelectHandlerScript;
264}
265
267{
268 (spellScript->*pObjectTargetSelectHandlerScript)(target);
269}
270
272{
273 for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr)
274 if (!(*itr).GetAffectedEffectsMask(entry))
275 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
276
277 for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr)
278 if (!(*itr).GetAffectedEffectsMask(entry))
279 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
280
281 for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr)
282 if (!(*itr).GetAffectedEffectsMask(entry))
283 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
284
285 for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr)
286 if (!(*itr).GetAffectedEffectsMask(entry))
287 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
288
289 for (std::list<ObjectAreaTargetSelectHandler>::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr)
290 if (!(*itr).GetAffectedEffectsMask(entry))
291 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
292
293 for (std::list<ObjectTargetSelectHandler>::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr)
294 if (!(*itr).GetAffectedEffectsMask(entry))
295 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
296
297 return _SpellScript::_Validate(entry);
298}
299
301{
302 m_spell = spell;
304 bool load = Load();
306 return load;
307}
308
314
319
324
330{
331 switch (m_currentScriptState)
332 {
338 return true;
339 }
340 return false;
341}
346
351
353{
354 return m_spell->GetCaster();
355}
356
358{
359 return m_spell->GetOriginalCaster();
360}
361
363{
364 return m_spell->GetSpellInfo();
365}
366
368{
369 if (m_spell->m_targets.HasDst())
370 return m_spell->m_targets.GetDstPos();
371 return NULL;
372}
373
375{
376 m_spell->m_targets.SetDst(loc);
377}
378
380{
381 return m_spell->m_targets.GetObjectTarget();
382}
383
385{
386 return m_spell->m_targets.GetUnitTarget();
387}
388
390{
391 return m_spell->m_targets.GetGOTarget();
392}
393
395{
396 return m_spell->m_targets.GetItemTarget();
397}
398
400{
401 if (!IsInTargetHook())
402 {
403 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
404 return NULL;
405 }
406 return m_spell->unitTarget;
407}
408
410{
411 if (!IsInTargetHook())
412 {
413 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
414 return NULL;
415 }
416 if (m_spell->unitTarget)
417 return m_spell->unitTarget->ToCreature();
418 else
419 return NULL;
420}
421
423{
424 if (!IsInTargetHook())
425 {
426 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
427 return NULL;
428 }
429 if (m_spell->unitTarget)
430 return m_spell->unitTarget->ToPlayer();
431 else
432 return NULL;
433}
434
436{
437 if (!IsInTargetHook())
438 {
439 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
440 return NULL;
441 }
442 return m_spell->itemTarget;
443}
444
446{
447 if (!IsInTargetHook())
448 {
449 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
450 return NULL;
451 }
452 return m_spell->gameObjTarget;
453}
454
456{
457 if (!IsInEffectHook())
458 {
459 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitDest was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
460 return NULL;
461 }
462 return m_spell->destTarget;
463}
464
466{
467 if (!IsInTargetHook())
468 {
469 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
470 return 0;
471 }
472 return m_spell->m_damage;
473}
474
476{
477 if (!IsInTargetHook())
478 {
479 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
480 return;
481 }
482 m_spell->m_damage = damage;
483}
484
486{
487 if (!IsInTargetHook())
488 {
489 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
490 return 0;
491 }
492 return m_spell->m_healing;
493}
494
496{
497 if (!IsInTargetHook())
498 {
499 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
500 return;
501 }
502 m_spell->m_healing = heal;
503}
504
506{
507 if (!IsInTargetHook())
508 {
509 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
510 return NULL;
511 }
512 if (!m_spell->m_spellAura)
513 return NULL;
514 if (m_spell->m_spellAura->IsRemoved())
515 return NULL;
516 return m_spell->m_spellAura;
517}
518
520{
521 if (!IsInTargetHook())
522 {
523 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
524 return;
525 }
526 if (m_spell->m_spellAura)
527 m_spell->m_spellAura->Remove();
528}
529
531{
532 if (!IsInHitPhase() && !IsInEffectHook())
533 {
534 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
535 return;
536 }
537 m_hitPreventEffectMask |= 1 << effIndex;
538 PreventHitDefaultEffect(effIndex);
539}
540
542{
543 if (!IsInHitPhase() && !IsInEffectHook())
544 {
545 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
546 return;
547 }
548 m_hitPreventDefaultEffectMask |= 1 << effIndex;
549}
550
552{
553 if (!IsInEffectHook())
554 {
555 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
556 return 0;
557 }
558 return m_spell->damage;
559}
560
562{
563 return m_spell->m_CastItem;
564}
565
567{
568 m_spell->DoCreateItem(effIndex, itemId);
569}
570
572{
573 return m_spell->m_triggeredByAuraSpell;
574}
575
577{
578 m_spell->SendCastResult(result);
579 m_spell->finish(result == SpellCastResult::SPELL_CAST_OK);
580}
581
583{
584 if (!IsInCheckCastHook())
585 {
586 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId);
587 return;
588 }
589
590 m_spell->m_customError = result;
591}
592
594{
595 return m_spell->m_spellValue;
596}
597
599{
600 for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
602 SF_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
603
604 for (std::list<AuraDispelHandler>::iterator itr = OnDispel.begin(); itr != OnDispel.end(); ++itr)
605 if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
606 SF_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
607
608 for (std::list<AuraDispelHandler>::iterator itr = AfterDispel.begin(); itr != AfterDispel.end(); ++itr)
609 if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
610 SF_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
611
612 for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
613 if (!(*itr).GetAffectedEffectsMask(entry))
614 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
615
616 for (std::list<EffectApplyHandler>::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end(); ++itr)
617 if (!(*itr).GetAffectedEffectsMask(entry))
618 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
619
620 for (std::list<EffectApplyHandler>::iterator itr = AfterEffectApply.begin(); itr != AfterEffectApply.end(); ++itr)
621 if (!(*itr).GetAffectedEffectsMask(entry))
622 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
623
624 for (std::list<EffectApplyHandler>::iterator itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end(); ++itr)
625 if (!(*itr).GetAffectedEffectsMask(entry))
626 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
627
628 for (std::list<EffectPeriodicHandler>::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end(); ++itr)
629 if (!(*itr).GetAffectedEffectsMask(entry))
630 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
631
632 for (std::list<EffectUpdatePeriodicHandler>::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end(); ++itr)
633 if (!(*itr).GetAffectedEffectsMask(entry))
634 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
635
636 for (std::list<EffectCalcAmountHandler>::iterator itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end(); ++itr)
637 if (!(*itr).GetAffectedEffectsMask(entry))
638 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
639
640 for (std::list<EffectCalcPeriodicHandler>::iterator itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end(); ++itr)
641 if (!(*itr).GetAffectedEffectsMask(entry))
642 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
643
644 for (std::list<EffectCalcSpellModHandler>::iterator itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end(); ++itr)
645 if (!(*itr).GetAffectedEffectsMask(entry))
646 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
647
648 for (std::list<EffectAbsorbHandler>::iterator itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end(); ++itr)
649 if (!(*itr).GetAffectedEffectsMask(entry))
650 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
651
652 for (std::list<EffectAbsorbHandler>::iterator itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end(); ++itr)
653 if (!(*itr).GetAffectedEffectsMask(entry))
654 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
655
656 for (std::list<EffectManaShieldHandler>::iterator itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end(); ++itr)
657 if (!(*itr).GetAffectedEffectsMask(entry))
658 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
659
660 for (std::list<EffectManaShieldHandler>::iterator itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end(); ++itr)
661 if (!(*itr).GetAffectedEffectsMask(entry))
662 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
663
664 for (std::list<EffectSplitHandler>::iterator itr = OnEffectSplit.begin(); itr != OnEffectSplit.end(); ++itr)
665 if (!(*itr).GetAffectedEffectsMask(entry))
666 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
667
668 for (std::list<CheckProcHandler>::iterator itr = DoCheckProc.begin(); itr != DoCheckProc.end(); ++itr)
669 if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
670 SF_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
671
672 for (std::list<AuraProcHandler>::iterator itr = DoPrepareProc.begin(); itr != DoPrepareProc.end(); ++itr)
673 if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
674 SF_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
675
676 for (std::list<AuraProcHandler>::iterator itr = OnProc.begin(); itr != OnProc.end(); ++itr)
677 if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
678 SF_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
679
680 for (std::list<AuraProcHandler>::iterator itr = AfterProc.begin(); itr != AfterProc.end(); ++itr)
681 if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
682 SF_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
683
684 for (std::list<EffectProcHandler>::iterator itr = OnEffectProc.begin(); itr != OnEffectProc.end(); ++itr)
685 if (!(*itr).GetAffectedEffectsMask(entry))
686 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
687
688 for (std::list<EffectProcHandler>::iterator itr = AfterEffectProc.begin(); itr != AfterEffectProc.end(); ++itr)
689 if (!(*itr).GetAffectedEffectsMask(entry))
690 SF_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
691
692 return _SpellScript::_Validate(entry);
693}
694
695AuraScript::CheckAreaTargetHandler::CheckAreaTargetHandler(AuraCheckAreaTargetFnType _pHandlerScript)
696{
697 pHandlerScript = _pHandlerScript;
698}
699
701{
702 return (auraScript->*pHandlerScript)(_target);
703}
704
706{
707 pHandlerScript = _pHandlerScript;
708}
709
711{
712 (auraScript->*pHandlerScript)(_dispelInfo);
713}
714
717
722
724{
725 return "Index: " + EffIndexToString() + " AuraName: " + _SpellScript::EffectAuraNameCheck::ToString();
726}
727
728AuraScript::EffectPeriodicHandler::EffectPeriodicHandler(AuraEffectPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
729 : AuraScript::EffectBase(_effIndex, _effName)
730{
731 pEffectHandlerScript = _pEffectHandlerScript;
732}
733
735{
736 (auraScript->*pEffectHandlerScript)(_aurEff);
737}
738
739AuraScript::EffectUpdatePeriodicHandler::EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
740 : AuraScript::EffectBase(_effIndex, _effName)
741{
742 pEffectHandlerScript = _pEffectHandlerScript;
743}
744
746{
747 (auraScript->*pEffectHandlerScript)(aurEff);
748}
749
750AuraScript::EffectCalcAmountHandler::EffectCalcAmountHandler(AuraEffectCalcAmountFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
751 : AuraScript::EffectBase(_effIndex, _effName)
752{
753 pEffectHandlerScript = _pEffectHandlerScript;
754}
755
756void AuraScript::EffectCalcAmountHandler::Call(AuraScript* auraScript, AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
757{
758 (auraScript->*pEffectHandlerScript)(aurEff, amount, canBeRecalculated);
759}
760
761AuraScript::EffectCalcPeriodicHandler::EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
762 : AuraScript::EffectBase(_effIndex, _effName)
763{
764 pEffectHandlerScript = _pEffectHandlerScript;
765}
766
767void AuraScript::EffectCalcPeriodicHandler::Call(AuraScript* auraScript, AuraEffect const* aurEff, bool& isPeriodic, int32& periodicTimer)
768{
769 (auraScript->*pEffectHandlerScript)(aurEff, isPeriodic, periodicTimer);
770}
771
772AuraScript::EffectCalcSpellModHandler::EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
773 : AuraScript::EffectBase(_effIndex, _effName)
774{
775 pEffectHandlerScript = _pEffectHandlerScript;
776}
777
779{
780 (auraScript->*pEffectHandlerScript)(aurEff, spellMod);
781}
782
783AuraScript::EffectApplyHandler::EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode)
784 : AuraScript::EffectBase(_effIndex, _effName)
785{
786 pEffectHandlerScript = _pEffectHandlerScript;
787 mode = _mode;
788}
789
791{
792 if (_mode & mode)
793 (auraScript->*pEffectHandlerScript)(_aurEff, _mode);
794}
795
796AuraScript::EffectAbsorbHandler::EffectAbsorbHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex)
798{
799 pEffectHandlerScript = _pEffectHandlerScript;
800}
801
802void AuraScript::EffectAbsorbHandler::Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
803{
804 (auraScript->*pEffectHandlerScript)(aurEff, dmgInfo, absorbAmount);
805}
806
807AuraScript::EffectManaShieldHandler::EffectManaShieldHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex)
809{
810 pEffectHandlerScript = _pEffectHandlerScript;
811}
812
813void AuraScript::EffectManaShieldHandler::Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
814{
815 (auraScript->*pEffectHandlerScript)(aurEff, dmgInfo, absorbAmount);
816}
817
818AuraScript::EffectSplitHandler::EffectSplitHandler(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex)
820{
821 pEffectHandlerScript = _pEffectHandlerScript;
822}
823
824void AuraScript::EffectSplitHandler::Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount)
825{
826 (auraScript->*pEffectHandlerScript)(aurEff, dmgInfo, splitAmount);
827}
828
829AuraScript::CheckProcHandler::CheckProcHandler(AuraCheckProcFnType handlerScript)
830{
831 _HandlerScript = handlerScript;
832}
833
835{
836 return (auraScript->*_HandlerScript)(eventInfo);
837}
838
840{
841 _HandlerScript = handlerScript;
842}
843
845{
846 (auraScript->*_HandlerScript)(eventInfo);
847}
848
849AuraScript::EffectProcHandler::EffectProcHandler(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName)
850 : AuraScript::EffectBase(effIndex, effName)
851{
852 _EffectHandlerScript = effectHandlerScript;
853}
854
855void AuraScript::EffectProcHandler::Call(AuraScript* auraScript, AuraEffect const* aurEff, ProcEventInfo& eventInfo)
856{
857 (auraScript->*_EffectHandlerScript)(aurEff, eventInfo);
858}
859
861{
862 m_aura = aura;
864 bool load = Load();
866 return load;
867}
868
876
885
887{
888 switch (m_currentScriptState)
889 {
899 default:
900 ASSERT(false && "AuraScript::_IsDefaultActionPrevented is called in a wrong place");
901 return false;
902 }
903}
904
906{
907 switch (m_currentScriptState)
908 {
918 break;
919 default:
920 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
921 break;
922 }
923}
924
926{
927 return m_aura->GetSpellInfo();
928}
929
931{
932 return m_aura->GetId();
933}
934
936{
937 return m_aura->GetCasterGUID();
938}
939
941{
942 return m_aura->GetCaster();
943}
944
946{
947 return m_aura->GetOwner();
948}
949
951{
952 return m_aura->GetUnitOwner();
953}
954
956{
957 return m_aura->GetDynobjOwner();
958}
959
961{
962 m_aura->Remove((AuraRemoveMode)removeMode);
963}
964
966{
967 return m_aura;
968}
969
971{
972 return m_aura->GetType();
973}
974
976{
977 return m_aura->GetDuration();
978}
979
980void AuraScript::SetDuration(int32 duration, bool withMods)
981{
982 m_aura->SetDuration(duration, withMods);
983}
984
986{
987 m_aura->RefreshDuration();
988}
989
991{
992 return m_aura->GetApplyTime();
993}
994
996{
997 return m_aura->GetMaxDuration();
998}
999
1001{
1002 m_aura->SetMaxDuration(duration);
1003}
1004
1006{
1007 return m_aura->CalcMaxDuration();
1008}
1009
1011{
1012 return m_aura->IsExpired();
1013}
1014
1016{
1017 return m_aura->IsPermanent();
1018}
1019
1021{
1022 return m_aura->GetCharges();
1023}
1024
1026{
1027 m_aura->SetCharges(charges);
1028}
1029
1031{
1032 return m_aura->CalcMaxCharges();
1033}
1034
1035bool AuraScript::ModCharges(int8 num, AuraRemoveMode removeMode /*= AURA_REMOVE_BY_DEFAULT*/)
1036{
1037 return m_aura->ModCharges(num, removeMode);
1038}
1039
1041{
1042 return m_aura->DropCharge(removeMode);
1043}
1044
1046{
1047 return m_aura->GetStackAmount();
1048}
1049
1051{
1052 m_aura->SetStackAmount(num);
1053}
1054
1056{
1057 return m_aura->ModStackAmount(num, removeMode);
1058}
1059
1061{
1062 return m_aura->IsPassive();
1063}
1064
1066{
1067 return m_aura->IsDeathPersistent();
1068}
1069
1070bool AuraScript::HasEffect(uint8 effIndex) const
1071{
1072 return m_aura->HasEffect(effIndex);
1073}
1074
1076{
1077 return m_aura->GetEffect(effIndex);
1078}
1079
1081{
1082 return m_aura->HasEffectType(type);
1083}
1084
1086{
1087 switch (m_currentScriptState)
1088 {
1105 return m_auraApplication->GetTarget();
1106 default:
1107 SF_LOG_ERROR("scripts", "Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
1108 }
1109
1110 return NULL;
1111}
1112
#define MAX_SPELL_EFFECTS
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::int8_t int8
Definition Define.h:75
std::uint64_t uint64
Definition Define.h:76
std::uint16_t uint16
Definition Define.h:78
#define ASSERT
Definition Errors.h:29
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define EFFECT_FIRST_FOUND
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ SPELL_EFFECT_APPLY_AURA
SpellCustomErrors
#define EFFECT_ALL
SpellCastResult
@ SPELL_AURA_MANA_SHIELD
@ SPELL_AURA_SPLIT_DAMAGE_PCT
@ SPELL_AURA_SCHOOL_ABSORB
AuraEffectHandleModes
AuraObjectType
AuraScriptHookType
@ AURA_SCRIPT_HOOK_EFFECT_REMOVE
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD
@ AURA_SCRIPT_HOOK_PREPARE_PROC
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE
@ AURA_SCRIPT_HOOK_AFTER_PROC
@ AURA_SCRIPT_HOOK_EFFECT_MANASHIELD
@ AURA_SCRIPT_HOOK_PROC
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB
@ AURA_SCRIPT_HOOK_EFFECT_APPLY
@ AURA_SCRIPT_HOOK_EFFECT_PERIODIC
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC
@ AURA_SCRIPT_HOOK_EFFECT_ABSORB
@ AURA_SCRIPT_HOOK_EFFECT_PROC
@ AURA_SCRIPT_HOOK_EFFECT_SPLIT
@ AURA_SCRIPT_HOOK_CHECK_PROC
@ SPELL_SCRIPT_STATE_NONE
Definition SpellScript.h:35
@ SPELL_SCRIPT_STATE_LOADING
Definition SpellScript.h:37
@ SPELL_SCRIPT_STATE_UNLOADING
Definition SpellScript.h:38
@ SPELL_SCRIPT_STATE_REGISTRATION
Definition SpellScript.h:36
#define HOOK_SPELL_HIT_START
#define HOOK_SPELL_HIT_END
SpellScriptHookType
@ SPELL_SCRIPT_HOOK_AFTER_HIT
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH
@ SPELL_SCRIPT_HOOK_BEFORE_HIT
@ SPELL_SCRIPT_HOOK_CHECK_CAST
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET
@ SPELL_SCRIPT_HOOK_HIT
@ SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET
#define SPELL_EFFECT_ANY
Definition SpellScript.h:30
#define SPELL_AURA_ANY
Definition SpellScript.h:31
@ TARGET_SELECT_CATEGORY_CONE
@ TARGET_SELECT_CATEGORY_AREA
@ TARGET_SELECT_CATEGORY_DEFAULT
@ TARGET_SELECT_CATEGORY_NEARBY
@ TARGET_SELECT_CATEGORY_CHANNEL
@ TARGET_OBJECT_TYPE_DEST
@ TARGET_OBJECT_TYPE_SRC
@ TARGET_REFERENCE_TYPE_TARGET
@ TARGET_REFERENCE_TYPE_CASTER
AuraRemoveMode
Definition Unit.h:405
EffectAuraNameCheck(uint16 _effAurName)
Definition SpellScript.h:86
bool Check(SpellInfo const *spellInfo, uint8 effIndex)
uint8 GetAffectedEffectsMask(SpellInfo const *spellInfo)
EffectHook(uint8 _effIndex)
bool IsEffectAffected(SpellInfo const *spellInfo, uint8 effIndex)
std::string EffIndexToString()
virtual bool CheckEffect(SpellInfo const *spellInfo, uint8 effIndex)=0
bool Check(SpellInfo const *spellInfo, uint8 effIndex)
EffectNameCheck(uint16 _effName)
Definition SpellScript.h:76
std::string const * m_scriptName
Definition SpellScript.h:94
uint8 m_currentScriptState
Definition SpellScript.h:93
virtual void _Unload()
virtual bool Validate(SpellInfo const *)
virtual void Register()=0
virtual bool Load()
std::string const * _GetScriptName() const
virtual void Unload()
virtual void _Register()
uint32 m_scriptSpellId
Definition SpellScript.h:95
virtual void _Init(std::string const *scriptname, uint32 spellId)
virtual bool _Validate(SpellInfo const *entry)
void Call(AuraScript *auraScript, DispelInfo *dispelInfo)
AuraDispelHandler(AuraDispelFnType pHandlerScript)
AuraDispelFnType pHandlerScript
AuraProcHandler(AuraProcFnType handlerScript)
void Call(AuraScript *auraScript, ProcEventInfo &eventInfo)
AuraProcFnType _HandlerScript
CheckAreaTargetHandler(AuraCheckAreaTargetFnType pHandlerScript)
AuraCheckAreaTargetFnType pHandlerScript
bool Call(AuraScript *auraScript, Unit *target)
CheckProcHandler(AuraCheckProcFnType handlerScript)
bool Call(AuraScript *auraScript, ProcEventInfo &eventInfo)
AuraCheckProcFnType _HandlerScript
EffectAbsorbHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex)
AuraEffectAbsorbFnType pEffectHandlerScript
void Call(AuraScript *auraScript, AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &absorbAmount)
void Call(AuraScript *auraScript, AuraEffect const *_aurEff, AuraEffectHandleModes _mode)
EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode)
AuraEffectHandleModes mode
AuraEffectApplicationModeFnType pEffectHandlerScript
bool CheckEffect(SpellInfo const *spellInfo, uint8 effIndex)
EffectBase(uint8 _effIndex, uint16 _effName)
void Call(AuraScript *auraScript, AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
EffectCalcAmountHandler(AuraEffectCalcAmountFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
AuraEffectCalcAmountFnType pEffectHandlerScript
EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
AuraEffectCalcPeriodicFnType pEffectHandlerScript
void Call(AuraScript *auraScript, AuraEffect const *aurEff, bool &isPeriodic, int32 &periodicTimer)
AuraEffectCalcSpellModFnType pEffectHandlerScript
void Call(AuraScript *auraScript, AuraEffect const *aurEff, SpellModifier *&spellMod)
EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
AuraEffectAbsorbFnType pEffectHandlerScript
EffectManaShieldHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex)
void Call(AuraScript *auraScript, AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &absorbAmount)
AuraEffectPeriodicFnType pEffectHandlerScript
void Call(AuraScript *auraScript, AuraEffect const *_aurEff)
EffectPeriodicHandler(AuraEffectPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
EffectProcHandler(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName)
AuraEffectProcFnType _EffectHandlerScript
void Call(AuraScript *auraScript, AuraEffect const *aurEff, ProcEventInfo &eventInfo)
AuraEffectSplitFnType pEffectHandlerScript
EffectSplitHandler(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex)
void Call(AuraScript *auraScript, AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &splitAmount)
AuraEffectUpdatePeriodicFnType pEffectHandlerScript
void Call(AuraScript *auraScript, AuraEffect *aurEff)
EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
AuraApplication const * _auraApplication
bool IsPermanent() const
HookList< EffectManaShieldHandler > AfterEffectManaShield
void PreventDefaultAction()
AuraObjectType GetType() const
void Remove(uint32 removeMode=0)
bool IsExpired() const
void SetMaxDuration(int32 duration)
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
AuraApplication const * GetTargetApplication() const
int32 GetDuration() const
HookList< EffectApplyHandler > AfterEffectRemove
AuraApplication const * m_auraApplication
bool ModCharges(int8 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
HookList< EffectPeriodicHandler > OnEffectPeriodic
bool m_defaultActionPrevented
SpellInfo const * GetSpellInfo() const
WorldObject * GetOwner() const
uint8 CalcMaxCharges() const
HookList< EffectApplyHandler > AfterEffectApply
HookList< EffectProcHandler > AfterEffectProc
int32 GetMaxDuration() const
time_t GetApplyTime() const
void SetCharges(uint8 charges)
HookList< EffectAbsorbHandler > AfterEffectAbsorb
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
uint64 GetCasterGUID() const
Unit * GetCaster() const
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
HookList< EffectCalcSpellModHandler > DoEffectCalcSpellMod
void SetDuration(int32 duration, bool withMods=false)
void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const *aurApp=NULL)
bool DropCharge(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
HookList< EffectManaShieldHandler > OnEffectManaShield
AuraEffect * GetEffect(uint8 effIndex) const
bool HasEffectType(AuraType type) const
HookList< EffectAbsorbHandler > OnEffectAbsorb
bool _Validate(SpellInfo const *entry)
Aura * GetAura() const
HookList< CheckAreaTargetHandler > DoCheckAreaTarget
Unit * GetTarget() const
void RefreshDuration()
bool IsDeathPersistent() const
Aura * m_aura
bool _IsDefaultActionPrevented()
HookList< AuraProcHandler > AfterProc
HookList< AuraDispelHandler > OnDispel
HookList< CheckProcHandler > DoCheckProc
bool _Load(Aura *aura)
HookList< EffectApplyHandler > OnEffectRemove
HookList< AuraDispelHandler > AfterDispel
ScriptStateStack m_scriptStates
int32 CalcMaxDuration() const
uint8 GetCharges() const
void SetStackAmount(uint8 num)
HookList< EffectProcHandler > OnEffectProc
Unit * GetUnitOwner() const
HookList< AuraProcHandler > DoPrepareProc
HookList< AuraProcHandler > OnProc
HookList< EffectSplitHandler > OnEffectSplit
void _FinishScriptCall()
bool HasEffect(uint8 effIndex) const
uint8 GetStackAmount() const
HookList< EffectApplyHandler > OnEffectApply
DynamicObject * GetDynobjOwner() const
bool IsPassive() const
uint32 GetId() const
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Item.h:202
uint32 ApplyAuraName
Definition SpellInfo.h:90
SpellImplicitTargetInfo TargetA
Definition SpellInfo.h:102
SpellImplicitTargetInfo TargetB
Definition SpellInfo.h:103
Definition Spell.h:289
SpellTargetReferenceTypes GetReferenceType() const
SpellTargetSelectionCategories GetSelectionCategory() const
SpellTargetObjectTypes GetObjectType() const
SpellEffectInfo Effects[MAX_SPELL_EFFECTS]
Definition SpellInfo.h:255
uint32 Id
Definition SpellInfo.h:160
bool HasAreaAuraEffect() const
bool HasEffect(SpellEffects effect) const
SpellCastFnType pCastHandlerScript
CastHandler(SpellCastFnType _pCastHandlerScript)
void Call(SpellScript *spellScript)
SpellCastResult Call(SpellScript *spellScript)
CheckCastHandler(SpellCheckCastFnType checkCastHandlerScript)
SpellCheckCastFnType _checkCastHandlerScript
void Call(SpellScript *spellScript, SpellEffIndex effIndex)
SpellEffectFnType pEffectHandlerScript
bool CheckEffect(SpellInfo const *spellInfo, uint8 effIndex)
EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
void Call(SpellScript *spellScript)
HitHandler(SpellHitFnType _pHitHandlerScript)
SpellHitFnType pHitHandlerScript
SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript
void Call(SpellScript *spellScript, std::list< WorldObject * > &targets)
ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType)
void Call(SpellScript *spellScript, WorldObject *&targets)
SpellObjectTargetSelectFnType pObjectTargetSelectHandlerScript
ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType)
bool CheckEffect(SpellInfo const *spellInfo, uint8 effIndex)
TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area)
Creature * GetHitCreature()
Aura * GetHitAura()
Unit * GetExplTargetUnit()
WorldLocation const * GetExplTargetDest()
Player * GetHitPlayer()
Item * GetExplTargetItem()
void SetExplTargetDest(WorldLocation &loc)
bool IsInEffectHook() const
void FinishCast(SpellCastResult result)
bool _Load(Spell *spell)
SpellInfo const * GetSpellInfo()
bool IsInTargetHook() const
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
bool IsInHitPhase() const
uint8 m_hitPreventEffectMask
Item * GetCastItem()
HookList< EffectHandler > OnEffectHitTarget
void PreventHitEffect(SpellEffIndex effIndex)
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
Unit * GetHitUnit()
WorldLocation * GetHitDest()
int32 GetEffectValue()
WorldObject * GetExplTargetWorldObject()
SpellInfo const * GetTriggeringSpell()
Spell * m_spell
void SetCustomCastResultMessage(SpellCustomErrors result)
GameObject * GetHitGObj()
void CreateItem(uint32 effIndex, uint32 itemId)
HookList< EffectHandler > OnEffectLaunchTarget
GameObject * GetExplTargetGObj()
uint8 m_hitPreventDefaultEffectMask
Item * GetHitItem()
void SetHitDamage(int32 damage)
bool IsInCheckCastHook() const
HookList< EffectHandler > OnEffectLaunch
void SetHitHeal(int32 heal)
Unit * GetOriginalCaster()
SpellValue const * GetSpellValue()
void PreventHitAura()
int32 GetHitHeal()
Unit * GetCaster()
void _PrepareScriptCall(SpellScriptHookType hookType)
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void _FinishScriptCall()
bool _Validate(SpellInfo const *entry)
int32 GetHitDamage()
Definition Unit.h:1367