Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
SpellScript.h
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#ifndef SF_SPELL_SCRIPT_H
7#define SF_SPELL_SCRIPT_H
8
9#include "SharedDefines.h"
10#include "Spell.h"
11#include "SpellAuraDefines.h"
12#include "Util.h"
13#include <stack>
14
15class Unit;
16class SpellInfo;
17class SpellScript;
18class Spell;
19class Aura;
20class AuraEffect;
21struct SpellModifier;
22class Creature;
23class GameObject;
24class DynamicObject;
25class Player;
26class Item;
27class WorldLocation;
28class WorldObject;
29
30#define SPELL_EFFECT_ANY (uint16)-1
31#define SPELL_AURA_ANY (uint16)-1
32
40#define SPELL_SCRIPT_STATE_END SPELL_SCRIPT_STATE_UNLOADING + 1
41
42// helper class from which SpellScript and SpellAura derive, use these classes instead
44{
45 // internal use classes & functions
46 // DO NOT OVERRIDE THESE IN SCRIPTS
47protected:
48 virtual bool _Validate(SpellInfo const* entry);
49
50public:
52 virtual ~_SpellScript() { }
53 virtual void _Register();
54 virtual void _Unload();
55 virtual void _Init(std::string const* scriptname, uint32 spellId);
56 std::string const* _GetScriptName() const;
57
58protected:
60 {
61 public:
62 EffectHook(uint8 _effIndex);
63 virtual ~EffectHook() { }
64
65 uint8 GetAffectedEffectsMask(SpellInfo const* spellInfo);
66 bool IsEffectAffected(SpellInfo const* spellInfo, uint8 effIndex);
67 virtual bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex) = 0;
68 std::string EffIndexToString();
69 protected:
71 };
72
74 {
75 public:
76 EffectNameCheck(uint16 _effName) { effName = _effName; }
77 bool Check(SpellInfo const* spellInfo, uint8 effIndex);
78 std::string ToString();
79 private:
81 };
82
84 {
85 public:
86 EffectAuraNameCheck(uint16 _effAurName) { effAurName = _effAurName; }
87 bool Check(SpellInfo const* spellInfo, uint8 effIndex);
88 std::string ToString();
89 private:
91 };
92
94 std::string const* m_scriptName;
96public:
97 //
98 // SpellScript/AuraScript interface base
99 // these functions are safe to override, see notes below for usage instructions
100 //
101 // Function in which handler functions are registered, must be implemented in script
102 virtual void Register() = 0;
103 // Function called on server startup, if returns false script won't be used in core
104 // use for: dbc/template data presence/correctness checks
105 virtual bool Validate(SpellInfo const* /*spellInfo*/) { return true; }
106 // Function called when script is created, if returns false script will be unloaded afterwards
107 // use for: initializing local script variables (DO NOT USE CONSTRUCTOR FOR THIS PURPOSE!)
108 virtual bool Load() { return true; }
109 // Function called when script is destroyed
110 // use for: deallocating memory allocated by script
111 virtual void Unload() { }
112};
113
114// SpellScript interface - enum used for runtime checks of script function calls
131
132#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT_HIT
133#define HOOK_SPELL_HIT_END SPELL_SCRIPT_HOOK_AFTER_HIT + 1
134#define HOOK_SPELL_START SPELL_SCRIPT_HOOK_EFFECT
135#define HOOK_SPELL_END SPELL_SCRIPT_HOOK_CHECK_CAST + 1
136#define HOOK_SPELL_COUNT HOOK_SPELL_END - HOOK_SPELL_START
137
139{
140 // internal use classes & functions
141 // DO NOT OVERRIDE THESE IN SCRIPTS
142public:
143#define SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) \
144 typedef SpellCastResult(CLASSNAME::*SpellCheckCastFnType)(); \
145 typedef void(CLASSNAME::*SpellEffectFnType)(SpellEffIndex); \
146 typedef void(CLASSNAME::*SpellHitFnType)(); \
147 typedef void(CLASSNAME::*SpellCastFnType)(); \
148 typedef void(CLASSNAME::*SpellObjectAreaTargetSelectFnType)(std::list<WorldObject*>&); \
149 typedef void(CLASSNAME::*SpellObjectTargetSelectFnType)(WorldObject*&);
150
152
154 {
155 public:
156 CastHandler(SpellCastFnType _pCastHandlerScript);
157 void Call(SpellScript* spellScript);
158 private:
159 SpellCastFnType pCastHandlerScript;
160 };
161
163 {
164 public:
165 CheckCastHandler(SpellCheckCastFnType checkCastHandlerScript);
166 SpellCastResult Call(SpellScript* spellScript);
167 private:
168 SpellCheckCastFnType _checkCastHandlerScript;
169 };
170
172 {
173 public:
174 EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
175 std::string ToString();
176 bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex);
177 void Call(SpellScript* spellScript, SpellEffIndex effIndex);
178 private:
179 SpellEffectFnType pEffectHandlerScript;
180 };
181
183 {
184 public:
185 HitHandler(SpellHitFnType _pHitHandlerScript);
186 void Call(SpellScript* spellScript);
187 private:
188 SpellHitFnType pHitHandlerScript;
189 };
190
192 {
193 public:
194 TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area);
195 bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex);
196 std::string ToString();
197 protected:
199 bool area;
200 };
201
203 {
204 public:
205 ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
206 void Call(SpellScript* spellScript, std::list<WorldObject*>& targets);
207 private:
208 SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript;
209 };
210
212 {
213 public:
214 ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
215 void Call(SpellScript* spellScript, WorldObject*& targets);
216 private:
217 SpellObjectTargetSelectFnType pObjectTargetSelectHandlerScript;
218 };
219
220#define SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \
221 class CastHandlerFunction : public SpellScript::CastHandler { public: CastHandlerFunction(SpellCastFnType _pCastHandlerScript) : SpellScript::CastHandler((SpellScript::SpellCastFnType)_pCastHandlerScript) { } }; \
222 class CheckCastHandlerFunction : public SpellScript::CheckCastHandler { public: CheckCastHandlerFunction(SpellCheckCastFnType _checkCastHandlerScript) : SpellScript::CheckCastHandler((SpellScript::SpellCheckCastFnType)_checkCastHandlerScript) { } }; \
223 class EffectHandlerFunction : public SpellScript::EffectHandler { public: EffectHandlerFunction(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : SpellScript::EffectHandler((SpellScript::SpellEffectFnType)_pEffectHandlerScript, _effIndex, _effName) { } }; \
224 class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) { } }; \
225 class ObjectAreaTargetSelectHandlerFunction : public SpellScript::ObjectAreaTargetSelectHandler { public: ObjectAreaTargetSelectHandlerFunction(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectAreaTargetSelectHandler((SpellScript::SpellObjectAreaTargetSelectFnType)_pObjectAreaTargetSelectHandlerScript, _effIndex, _targetType) { } }; \
226 class ObjectTargetSelectHandlerFunction : public SpellScript::ObjectTargetSelectHandler { public: ObjectTargetSelectHandlerFunction(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectTargetSelectHandler((SpellScript::SpellObjectTargetSelectFnType)_pObjectTargetSelectHandlerScript, _effIndex, _targetType) { } };
227
228#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
229public:
230 bool _Validate(SpellInfo const* entry);
231 bool _Load(Spell* spell);
232 void _InitHit();
233 bool _IsEffectPrevented(SpellEffIndex effIndex) const { return m_hitPreventEffectMask & (1 << effIndex); }
234 bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) const { return m_hitPreventDefaultEffectMask & (1 << effIndex); }
236 void _FinishScriptCall();
237 bool IsInCheckCastHook() const;
238 bool IsInTargetHook() const;
239 bool IsInHitPhase() const;
240 bool IsInEffectHook() const;
241private:
245public:
246 //
247 // SpellScript interface
248 // hooks to which you can attach your functions
249 //
250 // example: BeforeCast += SpellCastFn(class::function);
252 // example: OnCast += SpellCastFn(class::function);
254 // example: AfterCast += SpellCastFn(class::function);
256#define SpellCastFn(F) CastHandlerFunction(&F)
257
258 // example: OnCheckCast += SpellCheckCastFn();
259 // where function is SpellCastResult function()
261#define SpellCheckCastFn(F) CheckCastHandlerFunction(&F)
262
263 // example: OnEffect**** += SpellEffectFn(class::function, EffectIndexSpecifier, EffectNameSpecifier);
264 // where function is void function(SpellEffIndex effIndex)
269#define SpellEffectFn(F, I, N) EffectHandlerFunction(&F, I, N)
270
271 // example: BeforeHit += SpellHitFn(class::function);
273 // example: OnHit += SpellHitFn(class::function);
275 // example: AfterHit += SpellHitFn(class::function);
277 // where function is: void function()
278#define SpellHitFn(F) HitHandlerFunction(&F)
279
280// example: OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
281// where function is void function(std::list<WorldObject*>& targets)
283#define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandlerFunction(&F, I, N)
284
285 // example: OnObjectTargetSelect += SpellObjectTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
286 // where function is void function(WorldObject*& target)
288#define SpellObjectTargetSelectFn(F, I, N) ObjectTargetSelectHandlerFunction(&F, I, N)
289
290 // hooks are executed in following order, at specified event of spell:
291 // 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled
292 // 2. OnCheckCast - allows to override result of CheckCast function
293 // 3a. OnObjectAreaTargetSelect - executed just before adding selected targets to final target list (for area targets)
294 // 3b. OnObjectTargetSelect - executed just before adding selected target to final target list (for single unit targets)
295 // 4. OnCast - executed just before spell is launched (creates missile) or executed
296 // 5. AfterCast - executed after spell missile is launched and immediate spell actions are done
297 // 6. OnEffectLaunch - executed just before specified effect handler call - when spell missile is launched
298 // 7. OnEffectLaunchTarget - executed just before specified effect handler call - when spell missile is launched - called for each target from spell target map
299 // 8. OnEffectHit - executed just before specified effect handler call - when spell missile hits dest
300 // 9. BeforeHit - executed just before spell hits a target - called for each target from spell target map
301 // 10. OnEffectHitTarget - executed just before specified effect handler call - called for each target from spell target map
302 // 11. OnHit - executed just before spell deals damage and procs auras - when spell hits target - called for each target from spell target map
303 // 12. AfterHit - executed just after spell finishes all it's jobs for target - called for each target from spell target map
304
305 //
306 // methods allowing interaction with Spell object
307 //
308 // methods useable during all spell handling phases
309 Unit* GetCaster();
311 SpellInfo const* GetSpellInfo();
312 SpellValue const* GetSpellValue();
313
314 // methods useable after spell is prepared
315 // accessors to the explicit targets of the spell
316 // explicit target - target selected by caster (player, game client, or script - DoCast(explicitTarget, ...), required for spell to be cast
317 // examples:
318 // -shadowstep - explicit target is the unit you want to go behind of
319 // -chain heal - explicit target is the unit to be healed first
320 // -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected
321 // you can determine if spell requires explicit targets by dbc columns:
322 // - Targets - mask of explicit target types
323 // - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too
324
325 // returns: WorldLocation which was selected as a spell destination or NULL
327
329
330 // returns: WorldObject which was selected as an explicit spell target or NULL if there's no target
332
333 // returns: Unit which was selected as an explicit spell target or NULL if there's no target
335
336 // returns: GameObject which was selected as an explicit spell target or NULL if there's no target
338
339 // returns: Item which was selected as an explicit spell target or NULL if there's no target
341
342 // methods useable only during spell hit on target, or during spell launch on target:
343 // returns: target of current effect if it was Unit otherwise NULL
344 Unit* GetHitUnit();
345 // returns: target of current effect if it was Creature otherwise NULL
347 // returns: target of current effect if it was Player otherwise NULL
349 // returns: target of current effect if it was Item otherwise NULL
350 Item* GetHitItem();
351 // returns: target of current effect if it was GameObject otherwise NULL
353 // returns: destination of current effect
355 // setter/getter for for damage done by spell to target of spell hit
356 // returns damage calculated before hit, and real dmg done after hit
358 void SetHitDamage(int32 damage);
360 // setter/getter for for heal done by spell to target of spell hit
361 // returns healing calculated before hit, and real dmg done after hit
363 void SetHitHeal(int32 heal);
365 Spell* GetSpell() { return m_spell; }
366 // returns current spell hit target aura
367 Aura* GetHitAura();
368 // prevents applying aura on current spell hit target
369 void PreventHitAura();
370
371 // prevents effect execution on current spell hit target
372 // including other effect/hit scripts
373 // will not work on aura/damage/heal
374 // will not work if effects were already handled
375 void PreventHitEffect(SpellEffIndex effIndex);
376
377 // prevents default effect execution on current spell hit target
378 // will not work on aura/damage/heal effects
379 // will not work if effects were already handled
381
382 // method avalible only in EffectHandler method
384
385 // returns: cast item if present.
386 Item* GetCastItem();
387
388 // Creates item. Calls Spell::DoCreateItem method.
389 void CreateItem(uint32 effIndex, uint32 itemId);
390
391 // Returns SpellInfo from the spell that triggered the current one
393
394 // finishes spellcast prematurely with selected error message
395 void FinishCast(SpellCastResult result);
396
398};
399
400// AuraScript interface - enum used for runtime checks of script function calls
430/*
431#define HOOK_AURA_EFFECT_START HOOK_AURA_EFFECT_APPLY
432#define HOOK_AURA_EFFECT_END HOOK_AURA_EFFECT_CALC_SPELLMOD + 1
433#define HOOK_AURA_EFFECT_COUNT HOOK_AURA_EFFECT_END - HOOK_AURA_EFFECT_START
434*/
436{
437 // internal use classes & functions
438 // DO NOT OVERRIDE THESE IN SCRIPTS
439public:
440#define AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) \
441 typedef bool(CLASSNAME::*AuraCheckAreaTargetFnType)(Unit* target); \
442 typedef void(CLASSNAME::*AuraDispelFnType)(DispelInfo* dispelInfo); \
443 typedef void(CLASSNAME::*AuraEffectApplicationModeFnType)(AuraEffect const*, AuraEffectHandleModes); \
444 typedef void(CLASSNAME::*AuraEffectPeriodicFnType)(AuraEffect const*); \
445 typedef void(CLASSNAME::*AuraEffectUpdatePeriodicFnType)(AuraEffect*); \
446 typedef void(CLASSNAME::*AuraEffectCalcAmountFnType)(AuraEffect const*, int32 &, bool &); \
447 typedef void(CLASSNAME::*AuraEffectCalcPeriodicFnType)(AuraEffect const*, bool &, int32 &); \
448 typedef void(CLASSNAME::*AuraEffectCalcSpellModFnType)(AuraEffect const*, SpellModifier* &); \
449 typedef void(CLASSNAME::*AuraEffectAbsorbFnType)(AuraEffect*, DamageInfo &, uint32 &); \
450 typedef void(CLASSNAME::*AuraEffectSplitFnType)(AuraEffect*, DamageInfo &, uint32 &); \
451 typedef bool(CLASSNAME::*AuraCheckProcFnType)(ProcEventInfo&); \
452 typedef void(CLASSNAME::*AuraProcFnType)(ProcEventInfo&); \
453 typedef void(CLASSNAME::*AuraEffectProcFnType)(AuraEffect const*, ProcEventInfo&); \
454
456
458 {
459 public:
460 CheckAreaTargetHandler(AuraCheckAreaTargetFnType pHandlerScript);
461 bool Call(AuraScript* auraScript, Unit* target);
462 private:
463 AuraCheckAreaTargetFnType pHandlerScript;
464 };
466 {
467 public:
468 AuraDispelHandler(AuraDispelFnType pHandlerScript);
469 void Call(AuraScript* auraScript, DispelInfo* dispelInfo);
470 private:
471 AuraDispelFnType pHandlerScript;
472 };
474 {
475 public:
476 EffectBase(uint8 _effIndex, uint16 _effName);
477 std::string ToString();
478 bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex);
479 };
481 {
482 public:
483 EffectPeriodicHandler(AuraEffectPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
484 void Call(AuraScript* auraScript, AuraEffect const* _aurEff);
485 private:
486 AuraEffectPeriodicFnType pEffectHandlerScript;
487 };
489 {
490 public:
491 EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
492 void Call(AuraScript* auraScript, AuraEffect* aurEff);
493 private:
494 AuraEffectUpdatePeriodicFnType pEffectHandlerScript;
495 };
497 {
498 public:
499 EffectCalcAmountHandler(AuraEffectCalcAmountFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
500 void Call(AuraScript* auraScript, AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated);
501 private:
502 AuraEffectCalcAmountFnType pEffectHandlerScript;
503 };
505 {
506 public:
507 EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
508 void Call(AuraScript* auraScript, AuraEffect const* aurEff, bool& isPeriodic, int32& periodicTimer);
509 private:
510 AuraEffectCalcPeriodicFnType pEffectHandlerScript;
511 };
513 {
514 public:
515 EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
516 void Call(AuraScript* auraScript, AuraEffect const* aurEff, SpellModifier*& spellMod);
517 private:
518 AuraEffectCalcSpellModFnType pEffectHandlerScript;
519 };
521 {
522 public:
523 EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode);
524 void Call(AuraScript* auraScript, AuraEffect const* _aurEff, AuraEffectHandleModes _mode);
525 private:
526 AuraEffectApplicationModeFnType pEffectHandlerScript;
528 };
530 {
531 public:
532 EffectAbsorbHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex);
533 void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
534 private:
535 AuraEffectAbsorbFnType pEffectHandlerScript;
536 };
538 {
539 public:
540 EffectManaShieldHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex);
541 void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
542 private:
543 AuraEffectAbsorbFnType pEffectHandlerScript;
544 };
546 {
547 public:
548 EffectSplitHandler(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex);
549 void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount);
550 private:
551 AuraEffectSplitFnType pEffectHandlerScript;
552 };
554 {
555 public:
556 CheckProcHandler(AuraCheckProcFnType handlerScript);
557 bool Call(AuraScript* auraScript, ProcEventInfo& eventInfo);
558 private:
559 AuraCheckProcFnType _HandlerScript;
560 };
562 {
563 public:
564 AuraProcHandler(AuraProcFnType handlerScript);
565 void Call(AuraScript* auraScript, ProcEventInfo& eventInfo);
566 private:
567 AuraProcFnType _HandlerScript;
568 };
570 {
571 public:
572 EffectProcHandler(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName);
573 void Call(AuraScript* auraScript, AuraEffect const* aurEff, ProcEventInfo& eventInfo);
574 private:
575 AuraEffectProcFnType _EffectHandlerScript;
576 };
577
578#define AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \
579 class CheckAreaTargetFunction : public AuraScript::CheckAreaTargetHandler { public: CheckAreaTargetFunction(AuraCheckAreaTargetFnType _pHandlerScript) : AuraScript::CheckAreaTargetHandler((AuraScript::AuraCheckAreaTargetFnType)_pHandlerScript) { } }; \
580 class AuraDispelFunction : public AuraScript::AuraDispelHandler { public: AuraDispelFunction(AuraDispelFnType _pHandlerScript) : AuraScript::AuraDispelHandler((AuraScript::AuraDispelFnType)_pHandlerScript) { } }; \
581 class EffectPeriodicHandlerFunction : public AuraScript::EffectPeriodicHandler { public: EffectPeriodicHandlerFunction(AuraEffectPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectPeriodicHandler((AuraScript::AuraEffectPeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) { } }; \
582 class EffectUpdatePeriodicHandlerFunction : public AuraScript::EffectUpdatePeriodicHandler { public: EffectUpdatePeriodicHandlerFunction(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectUpdatePeriodicHandler((AuraScript::AuraEffectUpdatePeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) { } }; \
583 class EffectCalcAmountHandlerFunction : public AuraScript::EffectCalcAmountHandler { public: EffectCalcAmountHandlerFunction(AuraEffectCalcAmountFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcAmountHandler((AuraScript::AuraEffectCalcAmountFnType)_pEffectHandlerScript, _effIndex, _effName) { } }; \
584 class EffectCalcPeriodicHandlerFunction : public AuraScript::EffectCalcPeriodicHandler { public: EffectCalcPeriodicHandlerFunction(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcPeriodicHandler((AuraScript::AuraEffectCalcPeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) { } }; \
585 class EffectCalcSpellModHandlerFunction : public AuraScript::EffectCalcSpellModHandler { public: EffectCalcSpellModHandlerFunction(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcSpellModHandler((AuraScript::AuraEffectCalcSpellModFnType)_pEffectHandlerScript, _effIndex, _effName) { } }; \
586 class EffectApplyHandlerFunction : public AuraScript::EffectApplyHandler { public: EffectApplyHandlerFunction(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode) : AuraScript::EffectApplyHandler((AuraScript::AuraEffectApplicationModeFnType)_pEffectHandlerScript, _effIndex, _effName, _mode) { } }; \
587 class EffectAbsorbFunction : public AuraScript::EffectAbsorbHandler { public: EffectAbsorbFunction(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectAbsorbHandler((AuraScript::AuraEffectAbsorbFnType)_pEffectHandlerScript, _effIndex) { } }; \
588 class EffectManaShieldFunction : public AuraScript::EffectManaShieldHandler { public: EffectManaShieldFunction(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectManaShieldHandler((AuraScript::AuraEffectAbsorbFnType)_pEffectHandlerScript, _effIndex) { } }; \
589 class EffectSplitFunction : public AuraScript::EffectSplitHandler { public: EffectSplitFunction(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectSplitHandler((AuraScript::AuraEffectSplitFnType)_pEffectHandlerScript, _effIndex) { } }; \
590 class CheckProcHandlerFunction : public AuraScript::CheckProcHandler { public: CheckProcHandlerFunction(AuraCheckProcFnType handlerScript) : AuraScript::CheckProcHandler((AuraScript::AuraCheckProcFnType)handlerScript) { } }; \
591 class AuraProcHandlerFunction : public AuraScript::AuraProcHandler { public: AuraProcHandlerFunction(AuraProcFnType handlerScript) : AuraScript::AuraProcHandler((AuraScript::AuraProcFnType)handlerScript) { } }; \
592 class EffectProcHandlerFunction : public AuraScript::EffectProcHandler { public: EffectProcHandlerFunction(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName) : AuraScript::EffectProcHandler((AuraScript::AuraEffectProcFnType)effectHandlerScript, effIndex, effName) { } }; \
593
594#define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
595
596public:
599 bool _Validate(SpellInfo const* entry);
600 bool _Load(Aura* aura);
601 void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL);
602 void _FinishScriptCall();
604private:
608
610 {
611 public:
615 ScriptStateStore(uint8 currentScriptState, AuraApplication const* auraApplication, bool defaultActionPrevented)
616 : _auraApplication(auraApplication), _currentScriptState(currentScriptState), _defaultActionPrevented(defaultActionPrevented)
617 { }
618 };
619 typedef std::stack<ScriptStateStore> ScriptStateStack;
621
622public:
623 //
624 // AuraScript interface
625 // hooks to which you can attach your functions
626 //
627 // executed when area aura checks if it can be applied on target
628 // example: OnEffectApply += AuraEffectApplyFn(class::function);
629 // where function is: bool function (Unit* target);
631#define AuraCheckAreaTargetFn(F) CheckAreaTargetFunction(&F)
632
633 // executed when aura is dispelled by a unit
634 // example: OnDispel += AuraDispelFn(class::function);
635 // where function is: void function (DispelInfo* dispelInfo);
637 // executed after aura is dispelled by a unit
638 // example: AfterDispel += AuraDispelFn(class::function);
639 // where function is: void function (DispelInfo* dispelInfo);
641#define AuraDispelFn(F) AuraDispelFunction(&F)
642
643 // executed when aura effect is applied with specified mode to target
644 // should be used when when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe
645 // example: OnEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
646 // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
648 // executed after aura effect is applied with specified mode to target
649 // example: AfterEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
650 // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
652#define AuraEffectApplyFn(F, I, N, M) EffectApplyHandlerFunction(&F, I, N, M)
653
654 // executed after aura effect is removed with specified mode from target
655 // should be used when when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe
656 // example: OnEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
657 // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
659 // executed when aura effect is removed with specified mode from target
660 // example: AfterEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
661 // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
663#define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandlerFunction(&F, I, N, M)
664
665 // executed when periodic aura effect ticks on target
666 // example: OnEffectPeriodic += AuraEffectPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
667 // where function is: void function (AuraEffect const* aurEff);
669#define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandlerFunction(&F, I, N)
670
671 // executed when periodic aura effect is updated
672 // example: OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
673 // where function is: void function (AuraEffect* aurEff);
675#define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandlerFunction(&F, I, N)
676
677 // executed when aura effect calculates amount
678 // example: DoEffectCalcAmount += AuraEffectCalcAmounFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
679 // where function is: void function (AuraEffect* aurEff, int32& amount, bool& canBeRecalculated);
681#define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandlerFunction(&F, I, N)
682
683 // executed when aura effect calculates periodic data
684 // example: DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
685 // where function is: void function (AuraEffect const* aurEff, bool& isPeriodic, int32& amplitude);
687#define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandlerFunction(&F, I, N)
688
689 // executed when aura effect calculates spellmod
690 // example: DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
691 // where function is: void function (AuraEffect const* aurEff, SpellModifier*& spellMod);
693#define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandlerFunction(&F, I, N)
694
695 // executed when absorb aura effect is going to reduce damage
696 // example: OnEffectAbsorb += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
697 // where function is: void function (AuraEffect const* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
699#define AuraEffectAbsorbFn(F, I) EffectAbsorbFunction(&F, I)
700
701 // executed after absorb aura effect reduced damage to target - absorbAmount is real amount absorbed by aura
702 // example: AfterEffectAbsorb += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
703 // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
705
706 // executed when mana shield aura effect is going to reduce damage
707 // example: OnEffectManaShield += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
708 // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
710#define AuraEffectManaShieldFn(F, I) EffectManaShieldFunction(&F, I)
711
712 // executed after mana shield aura effect reduced damage to target - absorbAmount is real amount absorbed by aura
713 // example: AfterEffectManaShield += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
714 // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
716
717 // executed when the caster of some spell with split dmg aura gets damaged through it
718 // example: OnEffectSplit += AuraEffectSplitFn(class::function, EffectIndexSpecifier);
719 // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount);
721#define AuraEffectSplitFn(F, I) EffectSplitFunction(&F, I)
722
723 // executed when aura checks if it can proc
724 // example: DoCheckProc += AuraCheckProcFn(class::function);
725 // where function is: bool function (ProcEventInfo& eventInfo);
727#define AuraCheckProcFn(F) CheckProcHandlerFunction(&F)
728
729 // executed before aura procs (possibility to prevent charge drop/cooldown)
730 // example: DoPrepareProc += AuraProcFn(class::function);
731 // where function is: void function (ProcEventInfo& eventInfo);
733 // executed when aura procs
734 // example: OnProc += AuraProcFn(class::function);
735 // where function is: void function (ProcEventInfo& eventInfo);
737 // executed after aura proced
738 // example: AfterProc += AuraProcFn(class::function);
739 // where function is: void function (ProcEventInfo& eventInfo);
741#define AuraProcFn(F) AuraProcHandlerFunction(&F)
742
743 // executed when aura effect procs
744 // example: OnEffectProc += AuraEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
745 // where function is: void function (AuraEffect const* aurEff, ProcEventInfo& procInfo);
747 // executed after aura effect proced
748 // example: AfterEffectProc += AuraEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
749 // where function is: void function (AuraEffect const* aurEff, ProcEventInfo& procInfo);
751#define AuraEffectProcFn(F, I, N) EffectProcHandlerFunction(&F, I, N)
752
753 // AuraScript interface - hook/effect execution manipulators
754
755 // prevents default action of a hook from being executed (works only while called in a hook which default action can be prevented)
757
758 // AuraScript interface - functions which are redirecting to Aura class
759
760 // returns proto of the spell
761 SpellInfo const* GetSpellInfo() const;
762 // returns spellid of the spell
763 uint32 GetId() const;
764
765 // returns guid of object which casted the aura (m_originalCaster of the Spell class)
766 uint64 GetCasterGUID() const;
767 // returns unit which casted the aura or NULL if not avalible (caster logged out for example)
768 Unit* GetCaster() const;
769 // returns object on which aura was casted, target for non-area auras, area aura source for area auras
770 WorldObject* GetOwner() const;
771 // returns owner if it's unit or unit derived object, NULL otherwise (only for persistent area auras NULL is returned)
772 Unit* GetUnitOwner() const;
773 // returns owner if it's dynobj, NULL otherwise
775
776 // removes aura with remove mode (see AuraRemoveMode enum)
777 void Remove(uint32 removeMode = 0);
778 // returns aura object of script
779 Aura* GetAura() const;
780
781 // returns type of the aura, may be dynobj owned aura or unit owned aura
782 AuraObjectType GetType() const;
783
784 // aura duration manipulation - when duration goes to 0 aura is removed
785 int32 GetDuration() const;
786 void SetDuration(int32 duration, bool withMods = false);
787 // sets duration to maxduration
788 void RefreshDuration();
789 time_t GetApplyTime() const;
790 int32 GetMaxDuration() const;
791 void SetMaxDuration(int32 duration);
792 int32 CalcMaxDuration() const;
793 // expired - duration just went to 0
794 bool IsExpired() const;
795 // permament - has infinite duration
796 bool IsPermanent() const;
797
798 // charges manipulation - 0 - not charged aura
799 uint8 GetCharges() const;
800 void SetCharges(uint8 charges);
801 uint8 CalcMaxCharges() const;
803 // returns true if last charge dropped
805
806 // stack amount manipulation
807 uint8 GetStackAmount() const;
808 void SetStackAmount(uint8 num);
810
811 // passive - "working in background", not saved, not removed by immunities, not seen by player
812 bool IsPassive() const;
813 // death persistent - not removed on death
814 bool IsDeathPersistent() const;
815
816 // check if aura has effect of given effindex
817 bool HasEffect(uint8 effIndex) const;
818 // returns aura effect of given effect index or NULL
819 AuraEffect* GetEffect(uint8 effIndex) const;
820
821 // check if aura has effect of given aura type
822 bool HasEffectType(AuraType type) const;
823
824 // AuraScript interface - functions which are redirecting to AuraApplication class
825 // Do not call these in hooks in which AuraApplication is not avalible, otherwise result will differ from expected (the functions will return NULL)
826
827 // returns currently processed target of an aura
828 // Return value does not need to be NULL-checked, the only situation this will (always)
829 // return NULL is when the call happens in an unsupported hook, in other cases, it is always valid
830 Unit* GetTarget() const;
831 // returns AuraApplication object of currently processed target
833};
834
835//
836// definitions:
837//
838// EffectIndexSpecifier - specifies conditions for effects
839// EFFECT_0 - first effect matches
840// EFFECT_1 - second effect matches
841// EFFECT_2 - third effect matches
842// EFFECT_FIRST_FOUND - first effect matching other conditions matches
843// EFFECT_ALL - all effects of spell match
844//
845// EffectNameSpecifier - specifies conditions for spell effect names
846// SPELL_EFFECT_ANY - any effect but not 0 matches condition
847// SPELL_EFFECT_XXX - one of values of enum SpellEffects - effect with equal name matches
848//
849
850#endif // __SPELL_SCRIPT_H
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
SpellEffIndex
SpellCustomErrors
SpellCastResult
AuraEffectHandleModes
AuraObjectType
AuraScriptHookType
@ AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC
@ AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT
@ 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_CHECK_AREA_TARGET
@ AURA_SCRIPT_HOOK_EFFECT_MANASHIELD
@ AURA_SCRIPT_HOOK_PROC
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB
@ AURA_SCRIPT_HOOK_DISPEL
@ 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_EFFECT_CALC_SPELLMOD
@ AURA_SCRIPT_HOOK_AFTER_DISPEL
@ AURA_SCRIPT_HOOK_CHECK_PROC
@ AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC
#define AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME)
SpellScriptState
Definition SpellScript.h:34
@ 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 SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME)
#define SPELL_SCRIPT_STATE_END
Definition SpellScript.h:40
SpellScriptHookType
@ SPELL_SCRIPT_HOOK_AFTER_CAST
@ SPELL_SCRIPT_HOOK_EFFECT_HIT
@ SPELL_SCRIPT_HOOK_AFTER_HIT
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH
@ SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT
@ SPELL_SCRIPT_HOOK_BEFORE_HIT
@ SPELL_SCRIPT_HOOK_CHECK_CAST
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET
@ SPELL_SCRIPT_HOOK_HIT
@ SPELL_SCRIPT_HOOK_BEFORE_CAST
@ SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT
@ SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET
@ SPELL_SCRIPT_HOOK_ON_CAST
AuraRemoveMode
Definition Unit.h:405
@ AURA_REMOVE_BY_DEFAULT
Definition Unit.h:407
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 ~_SpellScript()
Definition SpellScript.h:52
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)
ScriptStateStore(uint8 currentScriptState, AuraApplication const *auraApplication, bool defaultActionPrevented)
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
std::stack< ScriptStateStore > ScriptStateStack
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
Definition Spell.h:289
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)
bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) const
Creature * GetHitCreature()
HookList< CastHandler > AfterCast
Aura * GetHitAura()
Unit * GetExplTargetUnit()
HookList< CheckCastHandler > OnCheckCast
WorldLocation const * GetExplTargetDest()
Player * GetHitPlayer()
Item * GetExplTargetItem()
void SetExplTargetDest(WorldLocation &loc)
bool IsInEffectHook() const
HookList< HitHandler > AfterHit
void FinishCast(SpellCastResult result)
bool _Load(Spell *spell)
SpellInfo const * GetSpellInfo()
bool _IsEffectPrevented(SpellEffIndex effIndex) const
HookList< HitHandler > OnHit
bool IsInTargetHook() const
void PreventHitDamage()
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
bool IsInHitPhase() const
uint8 m_hitPreventEffectMask
Item * GetCastItem()
HookList< EffectHandler > OnEffectHitTarget
void PreventHitEffect(SpellEffIndex effIndex)
void PreventHitHeal()
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
HookList< CastHandler > OnCast
Unit * GetHitUnit()
WorldLocation * GetHitDest()
int32 GetEffectValue()
HookList< CastHandler > BeforeCast
WorldObject * GetExplTargetWorldObject()
SpellInfo const * GetTriggeringSpell()
Spell * m_spell
Spell * GetSpell()
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
HookList< HitHandler > BeforeHit
void _FinishScriptCall()
bool _Validate(SpellInfo const *entry)
int32 GetHitDamage()
Definition Unit.h:1367