18#ifndef TRINITY_SPELL_SCRIPT_H
19#define TRINITY_SPELL_SCRIPT_H
27#ifdef TRINITY_API_USE_DYNAMIC_LINKING
58#define SPELL_EFFECT_ANY ((uint16)-1)
59#define SPELL_AURA_ANY ((uint16)-1)
68#define SPELL_SCRIPT_STATE_END (SPELL_SCRIPT_STATE_UNLOADING + 1)
86 void _Init(std::string
const& scriptname,
uint32 spellId);
87 std::string_view GetScriptName()
const;
90 virtual bool _Validate(
SpellInfo const* entry);
103 bool IsEffectAffected(
SpellInfo const* spellInfo,
uint8 effIndex)
const;
105 std::string EffIndexToString()
const;
117 template<
typename Return,
typename Class,
typename... Args>
123 template<
typename Return,
typename Class,
typename... Args>
129 template<
typename ScriptFunc>
138#ifdef TRINITY_API_USE_DYNAMIC_LINKING
141 std::shared_ptr<ModuleReference> m_moduleReference;
157 virtual bool Load() {
return true; }
164 return ValidateSpellInfoImpl(spellIds.begin(), spellIds.end());
170 return ValidateSpellInfoImpl(std::cbegin(spellIds), std::cend(spellIds));
175 return ValidateSpellEffectsImpl(effects.begin(), effects.end());
181 return ValidateSpellEffectsImpl(std::cbegin(spellEffects), std::cend(spellEffects));
185 template<
typename Iterator>
188 bool allValid =
true;
191 if (!ValidateSpellInfoImpl(*begin))
199 template<
typename Iterator>
202 bool allValid =
true;
205 if (!ValidateSpellEffectImpl(begin->first, begin->second))
213 static bool ValidateSpellInfoImpl(
uint32 spellId);
245#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT_HIT
246#define HOOK_SPELL_HIT_END SPELL_SCRIPT_HOOK_AFTER_HIT + 1
260 template<
typename ScriptFunc>
268 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass>,
269 "CastHandler signature must be \"void HandleCast()\"");
274 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))();
280 return _safeWrapper(spellScript, _callImpl);
298 template<
typename ScriptFunc>
306 if constexpr (!std::is_void_v<ScriptClass>)
308 static_assert(std::is_invocable_r_v<SpellCastResult, ScriptFunc, ScriptClass>,
309 "CheckCastHandler signature must be \"SpellCastResult CheckCast()\"");
311 _callImpl = { .Member =
reinterpret_cast<decltype(SpellCheckCastFnType::Member)
>(handler) };
314 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))();
319 static_assert(std::is_invocable_r_v<SpellCastResult, ScriptFunc>,
320 "CheckCastHandler signature must be \"static SpellCastResult CheckCast()\"");
322 _callImpl = { .Static =
reinterpret_cast<decltype(SpellCheckCastFnType::Static)
>(handler) };
325 return reinterpret_cast<ScriptFunc
>(callImpl.Static)();
332 return _safeWrapper(spellScript, _callImpl);
349 bool CheckEffect(
SpellInfo const* spellInfo,
uint8 effIndex)
const override;
361 template<
typename ScriptFunc>
370 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellEffIndex>,
371 "EffectHandler signature must be \"void HandleEffect(SpellEffIndex effIndex)\"");
376 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))(effIndex);
382 return _safeWrapper(spellScript, effIndex, _callImpl);
396 template<
typename ScriptFunc>
404 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellMissInfo>,
405 "BeforeHitHandler signature must be \"void HandleBeforeHit(SpellMissInfo missInfo)\"");
410 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))(missInfo);
416 return _safeWrapper(spellScript, missInfo, _callImpl);
430 template<
typename ScriptFunc>
438 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass>,
439 "HitHandler signature must be \"void HandleHit()\"");
444 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))();
450 return _safeWrapper(spellScript, _callImpl);
463 void(*Static)(
Unit const* victim,
float& critChance);
468 template<
typename ScriptFunc>
476 if constexpr (!std::is_void_v<ScriptClass>)
478 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, Unit const*, float&>,
479 "OnCalcCritChanceHandler signature must be \"void CalcCritChance(Unit const* victim, float& critChance)\"");
481 _callImpl = { .Member =
reinterpret_cast<decltype(SpellOnCalcCritChanceFnType::Member)
>(handler) };
484 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(victim, critChance);
489 static_assert(std::is_invocable_r_v<void, ScriptFunc, Unit const*, float&>,
490 "OnCalcCritChanceHandler signature must be \"static void CalcCritChance(Unit const* victim, float& critChance)\"");
492 _callImpl = { .Static =
reinterpret_cast<decltype(SpellOnCalcCritChanceFnType::Static)
>(handler) };
495 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(victim, critChance);
502 return _safeWrapper(spellScript, victim, critChance, _callImpl);
518 bool CheckEffect(
SpellInfo const* spellInfo,
uint8 effIndex)
const override;
533 void(*Static)(std::list<WorldObject*>& targets);
538 template<
typename ScriptFunc>
540 :
TargetHook(effIndex, targetType, true, false)
547 if constexpr (!std::is_void_v<ScriptClass>)
549 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, std::list<WorldObject*>&>,
550 "ObjectAreaTargetSelectHandler signature must be \"void SetTargets(std::list<WorldObject*>& targets)\"");
552 _callImpl = { .Member =
reinterpret_cast<decltype(SpellObjectAreaTargetSelectFnType::Member)
>(handler) };
555 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(targets);
560 static_assert(std::is_invocable_r_v<void, ScriptFunc, std::list<WorldObject*>&>,
561 "ObjectAreaTargetSelectHandler signature must be \"static void SetTargets(std::list<WorldObject*>& targets)\"");
563 _callImpl = { .Static =
reinterpret_cast<decltype(SpellObjectAreaTargetSelectFnType::Static)
>(handler) };
566 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(targets);
573 return _safeWrapper(spellScript, targets, _callImpl);
596 template<
typename ScriptFunc>
598 :
TargetHook(effIndex, targetType, false, false)
605 if constexpr (!std::is_void_v<ScriptClass>)
607 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, WorldObject*&>,
608 "ObjectTargetSelectHandler signature must be \"void SetTarget(WorldObject*& target)\"");
610 _callImpl = { .Member =
reinterpret_cast<decltype(SpellObjectTargetSelectFnType::Member)
>(handler) };
613 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(target);
618 static_assert(std::is_invocable_r_v<void, ScriptFunc, WorldObject*&>,
619 "ObjectTargetSelectHandler signature must be \"static void SetTarget(WorldObject*& target)\"");
621 _callImpl = { .Static =
reinterpret_cast<decltype(SpellObjectTargetSelectFnType::Static)
>(handler) };
624 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(target);
631 return _safeWrapper(spellScript, target, _callImpl);
654 template<
typename ScriptFunc>
656 :
TargetHook(effIndex, targetType, false, true)
663 if constexpr (!std::is_void_v<ScriptClass>)
665 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellDestination&>,
666 "DestinationTargetSelectHandler signature must be \"void SetTarget(SpellDestination& target)\"");
668 _callImpl = { .Member =
reinterpret_cast<decltype(SpellDestinationTargetSelectFnType::Member)
>(handler) };
671 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(target);
676 static_assert(std::is_invocable_r_v<void, ScriptFunc, SpellDestination&>,
677 "DestinationTargetSelectHandler signature must be \"static void SetTarget(SpellDestination& target)\"");
679 _callImpl = { .Static =
reinterpret_cast<decltype(SpellDestinationTargetSelectFnType::Static)
>(handler) };
682 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(target);
689 return _safeWrapper(spellScript, target, _callImpl);
707 template<
typename ScriptFunc>
715 if constexpr (!std::is_void_v<ScriptClass>)
717 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellEffectInfo const&, Unit*, int32&, int32&, float&>,
718 "DamageAndHealingCalcHandler signature must be \"void CalcDamage(SpellEffectInfo const& spellEffectInfo, Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
720 _callImpl = { .Member =
reinterpret_cast<decltype(DamageAndHealingCalcFnType::Member)
>(handler) };
723 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(spellEffectInfo, victim, damageOrHealing, flatMod, pctMod);
728 static_assert(std::is_invocable_r_v<void, ScriptFunc, SpellEffectInfo const&, Unit*, int32&, int32&, float&>,
729 "DamageAndHealingCalcHandler signature must be \"static void CalcDamage(SpellEffectInfo const& spellEffectInfo, Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
731 _callImpl = { .Static =
reinterpret_cast<decltype(DamageAndHealingCalcFnType::Static)
>(handler) };
734 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(spellEffectInfo, victim, damageOrHealing, flatMod, pctMod);
741 return _safeWrapper(spellScript, spellEffectInfo, victim, damageOrHealing, flatMod, pctMod, _callImpl);
759 template<
typename ScriptFunc>
767 if constexpr (!std::is_void_v<ScriptClass>)
769 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, DamageInfo const&, uint32&, int32&>,
770 "OnCalculateResistAbsorbHandler signature must be \"void CalcAbsorbResist(DamageInfo const& damageInfo, uint32& resistAmount, int32& absorbAmount)\"");
772 _callImpl = { .Member =
reinterpret_cast<decltype(SpellOnResistAbsorbCalculateFnType::Member)
>(handler) };
775 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(damageInfo, resistAmount, absorbAmount);
780 static_assert(std::is_invocable_r_v<void, ScriptFunc, DamageInfo const&, uint32&, int32&>,
781 "OnCalculateResistAbsorbHandler signature must be \"static void CalcAbsorbResist(DamageInfo const& damageInfo, uint32& resistAmount, int32& absorbAmount)\"");
783 _callImpl = { .Static =
reinterpret_cast<decltype(SpellOnResistAbsorbCalculateFnType::Static)
>(handler) };
786 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(damageInfo, resistAmount, absorbAmount);
793 return _safeWrapper(spellScript, damageInfo, resistAmount, absorbAmount, _callImpl);
807 template<
typename ScriptFunc>
815 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, int32>,
816 "EmpowerStageCompleted/EmpowerCompleted signature must be \"void HandleEmpowerStageCompleted(int32 completedStagesCount)\"");
821 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))(completedStagesCount);
827 return _safeWrapper(spellScript, _callImpl, completedStagesCount);
835 #define PrepareSpellScript(CLASSNAME)
839 bool _Validate(
SpellInfo const* entry)
override;
840 bool _Load(
Spell* spell);
845 void _FinishScriptCall();
846 bool IsInCheckCastHook()
const;
847 bool IsAfterTargetSelectionPhase()
const;
848 bool IsInTargetHook()
const;
849 bool IsInModifiableHook()
const;
850 bool IsInHitPhase()
const;
851 bool IsInEffectHook()
const;
871 #define SpellCastFn(F) CastHandler(&F)
876 #define SpellCheckCastFn(F) CheckCastHandler(&F)
888 #define SpellEffectFn(F, I, N) EffectHandler(&F, I, N)
893 #define BeforeSpellHitFn(F) BeforeHitHandler(&F)
900 #define SpellHitFn(F) HitHandler(&F)
905 #define SpellOnCalcCritChanceFn(F) OnCalcCritChanceHandler(&F)
910 #define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandler(&F, I, N)
915 #define SpellObjectTargetSelectFn(F, I, N) ObjectTargetSelectHandler(&F, I, N)
920 #define SpellDestinationTargetSelectFn(F, I, N) DestinationTargetSelectHandler(&F, I, N)
925 #define SpellCalcDamageFn(F) DamageAndHealingCalcHandler(&F)
930 #define SpellCalcHealingFn(F) DamageAndHealingCalcHandler(&F)
935 #define SpellOnResistAbsorbCalculateFn(F) OnCalculateResistAbsorbHandler(&F)
940 #define SpellOnEmpowerStageCompletedFn(F) EmpowerStageCompletedHandler(&F)
945 #define SpellOnEmpowerCompletedFn(F) EmpowerStageCompletedHandler(&F)
977 Unit* GetCaster()
const;
979 Unit* GetOriginalCaster()
const;
1004 Unit* GetExplTargetUnit()
const;
1010 Item* GetExplTargetItem()
const;
1020 Unit* GetHitUnit()
const;
1024 Player* GetHitPlayer()
const;
1026 Item* GetHitItem()
const;
1030 Corpse* GetHitCorpse()
const;
1035 int32 GetHitDamage()
const;
1036 void SetHitDamage(
int32 damage);
1040 int32 GetHitHeal()
const;
1041 void SetHitHeal(
int32 heal);
1044 bool IsHitCrit()
const;
1047 Aura* GetHitAura(
bool dynObjAura =
false)
const;
1049 void PreventHitAura();
1064 int32 GetEffectValue()
const;
1065 void SetEffectValue(
int32 value);
1066 float GetEffectVariance()
const;
1067 void SetEffectVariance(
float variance);
1070 Item* GetCastItem()
const;
1076 SpellInfo const* GetTriggeringSpell()
const;
1143 template<
typename ScriptFunc>
1151 if constexpr (!std::is_void_v<ScriptClass>)
1153 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ScriptClass, Unit*>,
1154 "CheckAreaTargetHandler signature must be \"bool CheckTarget(Unit* target)\"");
1156 _callImpl = { .Member =
reinterpret_cast<decltype(AuraCheckAreaTargetFnType::Member)
>(handler) };
1159 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(target);
1164 static_assert(std::is_invocable_r_v<bool, ScriptFunc, Unit*>,
1165 "CheckAreaTargetHandler signature must be \"static bool CheckTarget(Unit* target)\"");
1167 _callImpl = { .Static =
reinterpret_cast<decltype(AuraCheckAreaTargetFnType::Static)
>(handler) };
1170 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(target);
1177 return _safeWrapper(auraScript, target, _callImpl);
1195 template<
typename ScriptFunc>
1203 if constexpr (!std::is_void_v<ScriptClass>)
1205 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, DispelInfo*>,
1206 "AuraDispelHandler signature must be \"void HandleDispel(DispelInfo* dispelInfo)\"");
1208 _callImpl = { .Member =
reinterpret_cast<decltype(AuraDispelFnType::Member)
>(handler) };
1211 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(dispelInfo);
1216 static_assert(std::is_invocable_r_v<void, ScriptFunc, DispelInfo*>,
1217 "AuraDispelHandler signature must be \"static void HandleDispel(DispelInfo* dispelInfo)\"");
1219 _callImpl = { .Static =
reinterpret_cast<decltype(AuraDispelFnType::Static)
>(handler) };
1222 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(dispelInfo);
1229 return _safeWrapper(auraScript, dispelInfo, _callImpl);
1247 template<
typename ScriptFunc>
1255 if constexpr (!std::is_void_v<ScriptClass>)
1257 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass>,
1258 "AuraHeartbeat signature must be \"void HandleHeartbeat()\"");
1260 _callImpl = { .Member =
reinterpret_cast<decltype(AuraHeartbeatFnType::Member)
>(handler) };
1263 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))();
1268 static_assert(std::is_invocable_r_v<void, ScriptFunc>,
1269 "AuraHeartbeatHandler signature must be \"static void HandleHeartbeat()\"");
1271 _callImpl = { .Static =
reinterpret_cast<decltype(AuraHeartbeatFnType::Static)
>(handler) };
1274 return reinterpret_cast<ScriptFunc
>(callImpl.Static)();
1281 return _safeWrapper(auraScript, _callImpl);
1298 bool CheckEffect(
SpellInfo const* spellInfo,
uint8 effIndex)
const override;
1314 template<
typename ScriptFunc>
1323 if constexpr (!std::is_void_v<ScriptClass>)
1325 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*>,
1326 "EffectPeriodicHandler signature must be \"void HandlePeriodic(AuraEffect const* aurEff)\"");
1328 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectPeriodicFnType::Member)
>(handler) };
1331 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff);
1336 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*>,
1337 "EffectPeriodicHandler signature must be \"static void HandlePeriodic(AuraEffect const* aurEff)\"");
1339 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectPeriodicFnType::Static)
>(handler) };
1342 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff);
1349 return _safeWrapper(auraScript, aurEff, _callImpl);
1367 template<
typename ScriptFunc>
1376 if constexpr (!std::is_void_v<ScriptClass>)
1378 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*>,
1379 "EffectUpdatePeriodicHandler signature must be \"void HandleUpdatePeriodic(AuraEffect* aurEff)\"");
1381 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectUpdatePeriodicFnType::Member)
>(handler) };
1384 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff);
1389 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*>,
1390 "EffectUpdatePeriodicHandler signature must be \"static void HandleUpdatePeriodic(AuraEffect* aurEff)\"");
1392 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectUpdatePeriodicFnType::Static)
>(handler) };
1395 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff);
1402 return _safeWrapper(auraScript, aurEff, _callImpl);
1420 template<
typename ScriptFunc>
1429 if constexpr (!std::is_void_v<ScriptClass>)
1431 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, int32&, bool&>,
1432 "EffectCalcAmountHandler signature must be \"void CalcAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)\"");
1434 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcAmountFnType::Member)
>(handler) };
1437 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, amount, canBeRecalculated);
1442 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, int32&, bool&>,
1443 "EffectCalcAmountHandler signature must be \"static void CalcAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)\"");
1445 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcAmountFnType::Static)
>(handler) };
1448 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, amount, canBeRecalculated);
1455 return _safeWrapper(auraScript, aurEff, amount, canBeRecalculated, _callImpl);
1473 template<
typename ScriptFunc>
1482 if constexpr (!std::is_void_v<ScriptClass>)
1484 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, bool&, int32&>,
1485 "EffectCalcPeriodicHandler signature must be \"void CalcPeriodic(AuraEffect const* aurEff, bool& isPeriodic, int32& periodicTimer)\"");
1487 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcPeriodicFnType::Member)
>(handler) };
1490 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, isPeriodic, periodicTimer);
1495 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, bool&, int32&>,
1496 "EffectCalcPeriodicHandler signature must be \"static void CalcPeriodic(AuraEffect const* aurEff, bool& isPeriodic, int32& periodicTimer)\"");
1498 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcPeriodicFnType::Static)
>(handler) };
1501 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, isPeriodic, periodicTimer);
1508 return _safeWrapper(auraScript, aurEff, isPeriodic, periodicTimer, _callImpl);
1526 template<
typename ScriptFunc>
1535 if constexpr (!std::is_void_v<ScriptClass>)
1537 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, SpellModifier*&>,
1538 "EffectCalcSpellModHandler signature must be \"void CalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)\"");
1540 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcSpellModFnType::Member)
>(handler) };
1543 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, spellMod);
1548 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, SpellModifier*&>,
1549 "EffectCalcSpellModHandler signature must be \"static void CalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)\"");
1551 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcSpellModFnType::Static)
>(handler) };
1554 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, spellMod);
1561 return _safeWrapper(auraScript, aurEff, spellMod, _callImpl);
1579 template<
typename ScriptFunc>
1588 if constexpr (!std::is_void_v<ScriptClass>)
1590 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, Unit const*, float&>,
1591 "EffectCalcCritChanceHandler signature must be \"void CalcCritChance(AuraEffect const* aurEff, Unit const* victim, float& critChance)\"");
1593 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcCritChanceFnType::Member)
>(handler) };
1596 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, victim, critChance);
1601 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, Unit const*, float&>,
1602 "EffectCalcCritChanceHandler signature must be \"static void CalcCritChance(AuraEffect const* aurEff, Unit const* victim, float& critChance)\"");
1604 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcCritChanceFnType::Static)
>(handler) };
1607 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, victim, critChance);
1614 return _safeWrapper(auraScript, aurEff, victim, critChance, _callImpl);
1632 template<
typename ScriptFunc>
1641 if constexpr (!std::is_void_v<ScriptClass>)
1643 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, Unit*, int32&, int32&, float&>,
1644 "EffectCalcDamageAndHealingHandler signature must be \"void CalcDamageAndHealing(AuraEffect const* aurEff, Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
1646 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectDamageAndHealingCalcFnType::Member)
>(handler) };
1649 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, victim, damageOrHealing, flatMod, pctMod);
1654 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, Unit*, int32&, int32&, float&>,
1655 "EffectCalcDamageAndHealingHandler signature must be \"static void CalcDamageAndHealing(AuraEffect const* aurEff, Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
1657 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectDamageAndHealingCalcFnType::Static)
>(handler) };
1660 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, victim, damageOrHealing, flatMod, pctMod);
1667 return _safeWrapper(auraScript, aurEff, victim, damageOrHealing, flatMod, pctMod, _callImpl);
1685 template<
typename ScriptFunc>
1687 :
EffectBase(effIndex, auraType), _mode(mode)
1694 if constexpr (!std::is_void_v<ScriptClass>)
1696 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, AuraEffectHandleModes>,
1697 "EffectApplyHandler signature must be \"void HandleApplyOrRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode)\"");
1699 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectApplicationModeFnType::Member)
>(handler) };
1702 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, mode);
1707 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, AuraEffectHandleModes>,
1708 "EffectApplyHandler signature must be \"static void HandleApplyOrRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode)\"");
1710 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectApplicationModeFnType::Static)
>(handler) };
1713 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, mode);
1720 if (!(_mode & mode))
1723 return _safeWrapper(auraScript, aurEff, mode, _callImpl);
1742 template<
typename ScriptFunc>
1751 if constexpr (!std::is_void_v<ScriptClass>)
1753 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*, DamageInfo&, uint32&>,
1754 "EffectAbsorbHandler signature must be \"void HandleAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)\"");
1756 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectAbsorbFnType::Member)
>(handler) };
1759 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, dmgInfo, absorbAmount);
1764 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*, DamageInfo&, uint32&>,
1765 "EffectAbsorbHandler signature must be \"static void HandleAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)\"");
1767 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectAbsorbFnType::Static)
>(handler) };
1770 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, dmgInfo, absorbAmount);
1777 return _safeWrapper(auraScript, aurEff, dmgInfo, absorbAmount, _callImpl);
1795 template<
typename ScriptFunc>
1804 if constexpr (!std::is_void_v<ScriptClass>)
1806 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*, HealInfo&, uint32&>,
1807 "EffectAbsorbHealHandler signature must be \"void HandleAbsorb(AuraEffect* aurEff, HealInfo& healInfo, uint32& absorbAmount)\"");
1809 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectAbsorbHealFnType::Member)
>(handler) };
1812 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, healInfo, absorbAmount);
1817 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*, HealInfo&, uint32&>,
1818 "EffectAbsorbHealHandler signature must be \"static void HandleAbsorb(AuraEffect* aurEff, HealInfo& healInfo, uint32& absorbAmount)\"");
1820 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectAbsorbHealFnType::Static)
>(handler) };
1823 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, healInfo, absorbAmount);
1830 return _safeWrapper(auraScript, aurEff, healInfo, absorbAmount, _callImpl);
1848 template<
typename ScriptFunc>
1856 if constexpr (!std::is_void_v<ScriptClass>)
1858 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ScriptClass, ProcEventInfo&>,
1859 "CheckProcHandler signature must be \"bool CheckProc(ProcEventInfo& eventInfo)\"");
1861 _callImpl = { .Member =
reinterpret_cast<decltype(AuraCheckProcFnType::Member)
>(handler) };
1864 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(eventInfo);
1869 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ProcEventInfo&>,
1870 "CheckProcHandler signature must be \"static bool CheckProc(ProcEventInfo& eventInfo)\"");
1872 _callImpl = { .Static =
reinterpret_cast<decltype(AuraCheckProcFnType::Static)
>(handler) };
1875 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(eventInfo);
1882 return _safeWrapper(auraScript, eventInfo, _callImpl);
1900 template<
typename ScriptFunc>
1909 if constexpr (!std::is_void_v<ScriptClass>)
1911 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ScriptClass, AuraEffect const*, ProcEventInfo&>,
1912 "CheckEffectProcHandler signature must be \"bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)\"");
1914 _callImpl = { .Member =
reinterpret_cast<decltype(AuraCheckEffectProcFnType::Member)
>(handler) };
1917 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, eventInfo);
1922 static_assert(std::is_invocable_r_v<bool, ScriptFunc, AuraEffect const*, ProcEventInfo&>,
1923 "CheckEffectProcHandler signature must be \"static bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)\"");
1925 _callImpl = { .Static =
reinterpret_cast<decltype(AuraCheckEffectProcFnType::Static)
>(handler) };
1928 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, eventInfo);
1935 return _safeWrapper(auraScript, aurEff, eventInfo, _callImpl);
1953 template<
typename ScriptFunc>
1961 if constexpr (!std::is_void_v<ScriptClass>)
1963 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, ProcEventInfo&>,
1964 "AuraProcHandler signature must be \"void HandleProc(ProcEventInfo& eventInfo)\"");
1966 _callImpl = { .Member =
reinterpret_cast<decltype(AuraProcFnType::Member)
>(handler) };
1969 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(eventInfo);
1974 static_assert(std::is_invocable_r_v<void, ScriptFunc, ProcEventInfo&>,
1975 "AuraProcHandler signature must be \"static void HandleProc(ProcEventInfo& eventInfo)\"");
1977 _callImpl = { .Member =
reinterpret_cast<decltype(AuraProcFnType::Member)
>(handler) };
1980 return reinterpret_cast<ScriptFunc
>(callImpl.Member)(eventInfo);
1987 return _safeWrapper(auraScript, eventInfo, _callImpl);
2005 template<
typename ScriptFunc>
2014 if constexpr (!std::is_void_v<ScriptClass>)
2016 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*, ProcEventInfo&>,
2017 "EffectProcHandler signature must be \"void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)\"");
2019 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectProcFnType::Member)
>(handler) };
2022 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, eventInfo);
2027 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*, ProcEventInfo&>,
2028 "EffectProcHandler signature must be \"static void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)\"");
2030 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectProcFnType::Static)
>(handler) };
2033 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, eventInfo);
2040 return _safeWrapper(auraScript, aurEff, eventInfo, _callImpl);
2054 template<
typename ScriptFunc>
2062 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, bool>,
2063 "EnterLeaveCombatHandler signature must be \"void HandleEnterLeaveCombat(bool isNowInCombat)\"");
2068 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))(isNowInCombat);
2074 return _safeWrapper(auraScript, isNowInCombat, _callImpl);
2082 #define PrepareAuraScript(CLASSNAME)
2087 bool _Validate(
SpellInfo const* entry)
override;
2088 bool _Load(
Aura* aura);
2090 void _FinishScriptCall();
2091 bool _IsDefaultActionPrevented()
const;
2104 : _auraApplication(auraApplication), _currentScriptState(currentScriptState), _defaultActionPrevented(defaultActionPrevented)
2119 #define AuraCheckAreaTargetFn(F) CheckAreaTargetHandler(&F)
2129 #define AuraDispelFn(F) AuraDispelHandler(&F)
2135 #define AuraHeartbeatFn(F) AuraHeartbeatHandler(&F)
2146 #define AuraEffectApplyFn(F, I, N, M) EffectApplyHandler(&F, I, N, M)
2157 #define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandler(&F, I, N, M)
2163 #define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandler(&F, I, N)
2169 #define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandler(&F, I, N)
2175 #define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandler(&F, I, N)
2181 #define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandler(&F, I, N)
2187 #define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandler(&F, I, N)
2193 #define AuraEffectCalcCritChanceFn(F, I, N) EffectCalcCritChanceHandler(&F, I, N)
2200 #define AuraEffectCalcDamageFn(F, I, N) EffectCalcDamageAndHealingHandler(&F, I, N)
2201 #define AuraEffectCalcHealingFn(F, I, N) EffectCalcDamageAndHealingHandler(&F, I, N)
2207 #define AuraEffectAbsorbFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_SCHOOL_ABSORB)
2208 #define AuraEffectAbsorbOverkillFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_SCHOOL_ABSORB_OVERKILL)
2219 #define AuraEffectAbsorbHealFn(F, I) EffectAbsorbHealHandler(&F, I, SPELL_AURA_SCHOOL_HEAL_ABSORB)
2230 #define AuraEffectManaShieldFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_MANA_SHIELD)
2241 #define AuraEffectSplitFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_SPLIT_DAMAGE_PCT)
2247 #define AuraCheckProcFn(F) CheckProcHandler(&F)
2253 #define AuraCheckEffectProcFn(F, I, N) CheckEffectProcHandler(&F, I, N)
2267 #define AuraProcFn(F) AuraProcHandler(&F)
2277 #define AuraEffectProcFn(F, I, N) EffectProcHandler(&F, I, N)
2283 #define AuraEnterLeaveCombatFn(F) EnterLeaveCombatHandler(&F)
2288 void PreventDefaultAction();
2301 Unit* GetCaster()
const;
2307 Unit* GetUnitOwner()
const;
2314 Aura* GetAura()
const;
2320 int32 GetDuration()
const;
2321 void SetDuration(
int32 duration,
bool withMods =
false);
2323 void RefreshDuration();
2324 time_t GetApplyTime()
const;
2325 int32 GetMaxDuration()
const;
2326 void SetMaxDuration(
int32 duration);
2327 int32 CalcMaxDuration()
const;
2329 bool IsExpired()
const;
2331 bool IsPermanent()
const;
2334 uint8 GetCharges()
const;
2335 void SetCharges(
uint8 charges);
2336 uint8 CalcMaxCharges()
const;
2342 uint8 GetStackAmount()
const;
2343 void SetStackAmount(
uint8 num);
2347 bool IsPassive()
const;
2349 bool IsDeathPersistent()
const;
2352 bool HasEffect(
uint8 effIndex)
const;
2357 bool HasEffectType(
AuraType type)
const;
2365 Unit* GetTarget()
const;
@ AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC
@ AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC
@ AURA_SCRIPT_HOOK_EFFECT_CALC_DAMAGE_AND_HEALING
@ AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT
@ AURA_SCRIPT_HOOK_EFFECT_REMOVE
@ AURA_SCRIPT_HOOK_EFFECT_CALC_CRIT_CHANCE
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD
@ AURA_SCRIPT_HOOK_PREPARE_PROC
@ AURA_SCRIPT_HOOK_ON_HEARTBEAT
@ 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_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_ENTER_LEAVE_COMBAT
@ AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC
@ SPELL_SCRIPT_STATE_NONE
@ SPELL_SCRIPT_STATE_LOADING
@ SPELL_SCRIPT_STATE_UNLOADING
@ SPELL_SCRIPT_STATE_REGISTRATION
#define SPELL_SCRIPT_STATE_END
@ SPELL_SCRIPT_HOOK_AFTER_CAST
@ SPELL_SCRIPT_HOOK_EFFECT_HIT
@ SPELL_SCRIPT_HOOK_AFTER_HIT
@ SPELL_SCRIPT_HOOK_EFFECT_SUCCESSFUL_DISPEL
@ SPELL_SCRIPT_HOOK_CALC_HEALING
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH
@ SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT
@ SPELL_SCRIPT_HOOK_BEFORE_HIT
@ SPELL_SCRIPT_HOOK_CALC_DAMAGE
@ SPELL_SCRIPT_HOOK_CHECK_CAST
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET
@ SPELL_SCRIPT_HOOK_CALC_CAST_TIME
@ SPELL_SCRIPT_HOOK_EMPOWER_STAGE_COMPLETED
@ SPELL_SCRIPT_HOOK_EMPOWER_COMPLETED
@ SPELL_SCRIPT_HOOK_BEFORE_CAST
@ SPELL_SCRIPT_HOOK_ON_RESIST_ABSORB_CALCULATION
@ SPELL_SCRIPT_HOOK_DESTINATION_TARGET_SELECT
@ SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT
@ SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET
@ SPELL_SCRIPT_HOOK_CALC_CRIT_CHANCE
@ SPELL_SCRIPT_HOOK_ON_CAST
@ SPELL_SCRIPT_HOOK_ON_PRECAST
SafeWrapperType _safeWrapper
void(*)(AuraScript *auraScript, DispelInfo *dispelInfo, AuraDispelFnType callImpl) SafeWrapperType
AuraDispelHandler(ScriptFunc handler)
void Call(AuraScript *auraScript, DispelInfo *dispelInfo) const
AuraDispelFnType _callImpl
SafeWrapperType _safeWrapper
AuraHeartbeatFnType _callImpl
void Call(AuraScript *auraScript) const
AuraHeartbeatHandler(ScriptFunc handler)
void(*)(AuraScript *auraScript, AuraHeartbeatFnType callImpl) SafeWrapperType
SafeWrapperType _safeWrapper
AuraProcHandler(ScriptFunc handler)
void(*)(AuraScript *auraScript, ProcEventInfo &eventInfo, AuraProcFnType callImpl) SafeWrapperType
void Call(AuraScript *auraScript, ProcEventInfo &eventInfo) const
bool(*)(AuraScript *auraScript, Unit *target, AuraCheckAreaTargetFnType callImpl) SafeWrapperType
bool Call(AuraScript *auraScript, Unit *target) const
AuraCheckAreaTargetFnType _callImpl
CheckAreaTargetHandler(ScriptFunc handler)
SafeWrapperType _safeWrapper
AuraCheckEffectProcFnType _callImpl
SafeWrapperType _safeWrapper
CheckEffectProcHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
bool Call(AuraScript *auraScript, AuraEffect const *aurEff, ProcEventInfo &eventInfo) const
bool(*)(AuraScript *auraScript, AuraEffect const *aurEff, ProcEventInfo &eventInfo, AuraCheckEffectProcFnType callImpl) SafeWrapperType
AuraCheckProcFnType _callImpl
bool Call(AuraScript *auraScript, ProcEventInfo &eventInfo) const
bool(*)(AuraScript *auraScript, ProcEventInfo &eventInfo, AuraCheckProcFnType callImpl) SafeWrapperType
SafeWrapperType _safeWrapper
CheckProcHandler(ScriptFunc handler)
void(*)(AuraScript *auraScript, AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &absorbAmount, AuraEffectAbsorbFnType callImpl) SafeWrapperType
void Call(AuraScript *auraScript, AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &absorbAmount) const
EffectAbsorbHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
AuraEffectAbsorbFnType _callImpl
SafeWrapperType _safeWrapper
EffectAbsorbHealHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
AuraEffectAbsorbHealFnType _callImpl
SafeWrapperType _safeWrapper
void(*)(AuraScript *auraScript, AuraEffect *aurEff, HealInfo &healInfo, uint32 &absorbAmount, AuraEffectAbsorbHealFnType callImpl) SafeWrapperType
void Call(AuraScript *auraScript, AuraEffect *aurEff, HealInfo &healInfo, uint32 &absorbAmount) const
void(*)(AuraScript *auraScript, AuraEffect const *aurEff, AuraEffectHandleModes mode, AuraEffectApplicationModeFnType callImpl) SafeWrapperType
void Call(AuraScript *auraScript, AuraEffect const *aurEff, AuraEffectHandleModes mode) const
SafeWrapperType _safeWrapper
AuraEffectApplicationModeFnType _callImpl
EffectApplyHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType, AuraEffectHandleModes mode)
AuraEffectHandleModes _mode
EffectBase & operator=(EffectBase const &right)=delete
EffectBase & operator=(EffectBase &&right) noexcept
EffectBase(EffectBase &&right) noexcept
EffectBase(EffectBase const &right)=delete
AuraEffectCalcAmountFnType _callImpl
EffectCalcAmountHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
void(*)(AuraScript *auraScript, AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated, AuraEffectCalcAmountFnType callImpl) SafeWrapperType
SafeWrapperType _safeWrapper
void Call(AuraScript *auraScript, AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated) const
SafeWrapperType _safeWrapper
void Call(AuraScript *auraScript, AuraEffect const *aurEff, Unit const *victim, float &critChance) const
EffectCalcCritChanceHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
AuraEffectCalcCritChanceFnType _callImpl
void(*)(AuraScript *auraScript, AuraEffect const *aurEff, Unit const *victim, float &critChance, AuraEffectCalcCritChanceFnType callImpl) SafeWrapperType
void(*)(AuraScript *auraScript, AuraEffect const *aurEff, Unit *victim, int32 &damageOrHealing, int32 &flatMod, float &pctMod, AuraEffectDamageAndHealingCalcFnType callImpl) SafeWrapperType
AuraEffectDamageAndHealingCalcFnType _callImpl
EffectCalcDamageAndHealingHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
void Call(AuraScript *auraScript, AuraEffect const *aurEff, Unit *victim, int32 &damageOrHealing, int32 &flatMod, float &pctMod) const
SafeWrapperType _safeWrapper
void(*)(AuraScript *auraScript, AuraEffect const *aurEff, bool &isPeriodic, int32 &periodicTimer, AuraEffectCalcPeriodicFnType callImpl) SafeWrapperType
EffectCalcPeriodicHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
SafeWrapperType _safeWrapper
AuraEffectCalcPeriodicFnType _callImpl
void Call(AuraScript *auraScript, AuraEffect const *aurEff, bool &isPeriodic, int32 &periodicTimer) const
SafeWrapperType _safeWrapper
EffectCalcSpellModHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
void(*)(AuraScript *auraScript, AuraEffect const *aurEff, SpellModifier *&spellMod, AuraEffectCalcSpellModFnType callImpl) SafeWrapperType
AuraEffectCalcSpellModFnType _callImpl
void Call(AuraScript *auraScript, AuraEffect const *aurEff, SpellModifier *&spellMod) const
void Call(AuraScript *auraScript, AuraEffect const *aurEff) const
AuraEffectPeriodicFnType _callImpl
EffectPeriodicHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
SafeWrapperType _safeWrapper
void(*)(AuraScript *auraScript, AuraEffect const *aurEff, AuraEffectPeriodicFnType callImpl) SafeWrapperType
SafeWrapperType _safeWrapper
EffectProcHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
void Call(AuraScript *auraScript, AuraEffect *aurEff, ProcEventInfo &eventInfo) const
void(*)(AuraScript *auraScript, AuraEffect *aurEff, ProcEventInfo &eventInfo, AuraEffectProcFnType callImpl) SafeWrapperType
AuraEffectProcFnType _callImpl
void Call(AuraScript *auraScript, AuraEffect *aurEff) const
void(*)(AuraScript *auraScript, AuraEffect *aurEff, AuraEffectUpdatePeriodicFnType callImpl) SafeWrapperType
AuraEffectUpdatePeriodicFnType _callImpl
EffectUpdatePeriodicHandler(ScriptFunc handler, uint8 effIndex, uint16 auraType)
SafeWrapperType _safeWrapper
void(AuraScript::*)(bool isNowInCombat) AuraEnterLeaveCombatFnType
void Call(AuraScript *auraScript, bool isNowInCombat) const
SafeWrapperType _safeWrapper
EnterLeaveCombatHandler(ScriptFunc handler)
AuraEnterLeaveCombatFnType _callImpl
void(*)(AuraScript *auraScript, bool isNowInCombat, AuraEnterLeaveCombatFnType callImpl) SafeWrapperType
ScriptStateStore(uint8 currentScriptState, AuraApplication const *auraApplication, bool defaultActionPrevented)
bool _defaultActionPrevented
uint8 _currentScriptState
AuraApplication const * _auraApplication
HookList< EffectAbsorbHandler > OnEffectManaShield
HookList< EffectCalcDamageAndHealingHandler > DoEffectCalcDamageAndHealing
HookList< EffectAbsorbHealHandler > OnEffectAbsorbHeal
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
HookList< AuraHeartbeatHandler > OnHeartbeat
HookList< EffectApplyHandler > AfterEffectRemove
AuraApplication const * m_auraApplication
HookList< CheckEffectProcHandler > DoCheckEffectProc
HookList< EffectPeriodicHandler > OnEffectPeriodic
bool m_defaultActionPrevented
HookList< EffectApplyHandler > AfterEffectApply
HookList< EffectProcHandler > AfterEffectProc
HookList< EffectAbsorbHandler > AfterEffectAbsorb
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
HookList< EffectCalcSpellModHandler > DoEffectCalcSpellMod
HookList< EnterLeaveCombatHandler > OnEnterLeaveCombat
HookList< EffectAbsorbHandler > OnEffectAbsorb
std::stack< ScriptStateStore > ScriptStateStack
HookList< EffectCalcCritChanceHandler > DoEffectCalcCritChance
HookList< EffectAbsorbHandler > AfterEffectManaShield
HookList< CheckAreaTargetHandler > DoCheckAreaTarget
HookList< EffectAbsorbHealHandler > AfterEffectAbsorbHeal
HookList< AuraProcHandler > AfterProc
HookList< AuraDispelHandler > OnDispel
HookList< CheckProcHandler > DoCheckProc
HookList< EffectApplyHandler > OnEffectRemove
HookList< AuraDispelHandler > AfterDispel
ScriptStateStack m_scriptStates
HookList< EffectProcHandler > OnEffectProc
HookList< AuraProcHandler > DoPrepareProc
HookList< AuraProcHandler > OnProc
HookList< EffectApplyHandler > OnEffectApply
HookList< EffectAbsorbHandler > OnEffectSplit
EffectHook & operator=(EffectHook &&right) noexcept
EffectHook(EffectHook const &right)=delete
EffectHook(EffectHook &&right) noexcept
virtual bool CheckEffect(SpellInfo const *spellInfo, uint8 effIndex) const =0
EffectHook & operator=(EffectHook const &right)=delete
SpellScriptBase(SpellScriptBase const &right)=delete
uint8 m_currentScriptState
virtual void Register()=0
virtual bool Validate(SpellInfo const *spellInfo)
std::string_view m_scriptName
static bool ValidateSpellEffect(T const &spellEffects)
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
static bool ValidateSpellInfo(T const &spellIds)
static bool ValidateSpellEffectsImpl(Iterator begin, Iterator end)
static bool ValidateSpellInfoImpl(Iterator begin, Iterator end)
typename GetScriptClass< ScriptFunc >::type GetScriptClass_t
SpellScriptBase & operator=(SpellScriptBase &&right)=delete
SpellScriptBase(SpellScriptBase &&right)=delete
virtual ~SpellScriptBase()
SpellScriptBase & operator=(SpellScriptBase const &right)=delete
void Call(SpellScript *spellScript, SpellMissInfo missInfo) const
void(SpellScript::*)(SpellMissInfo missInfo) SpellBeforeHitFnType
BeforeHitHandler(ScriptFunc handler)
SafeWrapperType _safeWrapper
SpellBeforeHitFnType _callImpl
void(*)(SpellScript *spellScript, SpellMissInfo missInfo, SpellBeforeHitFnType callImpl) SafeWrapperType
CastHandler(ScriptFunc handler)
void Call(SpellScript *spellScript) const
SafeWrapperType _safeWrapper
void(SpellScript::*)() SpellCastFnType
void(*)(SpellScript *spellScript, SpellCastFnType callImpl) SafeWrapperType
SpellCastFnType _callImpl
SpellCheckCastFnType _callImpl
SafeWrapperType _safeWrapper
SpellCastResult(*)(SpellScript *spellScript, SpellCheckCastFnType callImpl) SafeWrapperType
SpellCastResult Call(SpellScript *spellScript) const
CheckCastHandler(ScriptFunc handler)
void Call(SpellScript *spellScript, SpellEffectInfo const &spellEffectInfo, Unit *victim, int32 &damageOrHealing, int32 &flatMod, float &pctMod) const
DamageAndHealingCalcHandler(ScriptFunc handler)
DamageAndHealingCalcFnType _callImpl
void(*)(SpellScript *spellScript, SpellEffectInfo const &spellEffectInfo, Unit *victim, int32 &damageOrHealing, int32 &flatMod, float &pctMod, DamageAndHealingCalcFnType callImpl) SafeWrapperType
SafeWrapperType _safeWrapper
void(*)(SpellScript *spellScript, SpellDestination &target, SpellDestinationTargetSelectFnType callImpl) SafeWrapperType
DestinationTargetSelectHandler(ScriptFunc handler, uint8 effIndex, uint16 targetType)
SpellDestinationTargetSelectFnType _callImpl
SafeWrapperType _safeWrapper
void Call(SpellScript *spellScript, SpellDestination &target) const
EffectBase(EffectBase const &right)=delete
EffectBase(EffectBase &&right) noexcept
EffectBase & operator=(EffectBase const &right)=delete
EffectBase & operator=(EffectBase &&right) noexcept
EffectHandler(ScriptFunc handler, uint8 effIndex, uint16 effName)
SpellEffectFnType _callImpl
void(*)(SpellScript *spellScript, SpellEffIndex effIndex, SpellEffectFnType callImpl) SafeWrapperType
void(SpellScript::*)(SpellEffIndex effIndex) SpellEffectFnType
void Call(SpellScript *spellScript, SpellEffIndex effIndex) const
SafeWrapperType _safeWrapper
EmpowerStageFnType _callImpl
EmpowerStageCompletedHandler(ScriptFunc handler)
void(SpellScript::*)(int32) EmpowerStageFnType
SafeWrapperType _safeWrapper
void Call(SpellScript *spellScript, int32 completedStagesCount) const
void(*)(SpellScript *spellScript, EmpowerStageFnType callImpl, int32 completedStagesCount) SafeWrapperType
void(SpellScript::*)() SpellHitFnType
SafeWrapperType _safeWrapper
void Call(SpellScript *spellScript) const
void(*)(SpellScript *spellScript, SpellHitFnType callImpl) SafeWrapperType
HitHandler(ScriptFunc handler)
void Call(SpellScript *spellScript, std::list< WorldObject * > &targets) const
bool HasSameTargetFunctionAs(ObjectAreaTargetSelectHandler const &other) const
SafeWrapperType _safeWrapper
ObjectAreaTargetSelectHandler(ScriptFunc handler, uint8 effIndex, uint16 targetType)
SpellObjectAreaTargetSelectFnType _callImpl
void(*)(SpellScript *spellScript, std::list< WorldObject * > &targets, SpellObjectAreaTargetSelectFnType callImpl) SafeWrapperType
void(*)(SpellScript *spellScript, WorldObject *&target, SpellObjectTargetSelectFnType callImpl) SafeWrapperType
bool HasSameTargetFunctionAs(ObjectTargetSelectHandler const &other) const
ObjectTargetSelectHandler(ScriptFunc handler, uint8 effIndex, uint16 targetType)
SpellObjectTargetSelectFnType _callImpl
void Call(SpellScript *spellScript, WorldObject *&target) const
SafeWrapperType _safeWrapper
void(*)(SpellScript *spellScript, Unit const *victim, float &critChance, SpellOnCalcCritChanceFnType callImpl) SafeWrapperType
SpellOnCalcCritChanceFnType _callImpl
void Call(SpellScript *spellScript, Unit const *victim, float &critChance) const
OnCalcCritChanceHandler(ScriptFunc handler)
SafeWrapperType _safeWrapper
OnCalculateResistAbsorbHandler(ScriptFunc handler)
SpellOnResistAbsorbCalculateFnType _callImpl
void Call(SpellScript *spellScript, DamageInfo const &damageInfo, uint32 &resistAmount, int32 &absorbAmount) const
SafeWrapperType _safeWrapper
void(*)(SpellScript *spellScript, DamageInfo const &damageInfo, uint32 &resistAmount, int32 &absorbAmount, SpellOnResistAbsorbCalculateFnType callImpl) SafeWrapperType
TargetHook(TargetHook &&right) noexcept
TargetHook & operator=(TargetHook &&right) noexcept
TargetHook(TargetHook const &right)=delete
TargetHook & operator=(TargetHook const &right)=delete
bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) const
HookList< DamageAndHealingCalcHandler > CalcDamage
HookList< CastHandler > AfterCast
HookList< CheckCastHandler > OnCheckCast
HookList< EmpowerStageCompletedHandler > OnEmpowerStageCompleted
HookList< HitHandler > AfterHit
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
bool _IsEffectPrevented(SpellEffIndex effIndex) const
uint32 m_hitPreventDefaultEffectMask
HookList< HitHandler > OnHit
uint32 m_hitPreventEffectMask
HookList< EffectHandler > OnEffectHit
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
HookList< CastHandler > OnCast
HookList< OnCalculateResistAbsorbHandler > OnCalculateResistAbsorb
HookList< CastHandler > BeforeCast
virtual int32 CalcCastTime(int32 castTime)
HookList< EffectHandler > OnEffectLaunchTarget
HookList< BeforeHitHandler > BeforeHit
HookList< EffectHandler > OnEffectSuccessfulDispel
HookList< OnCalcCritChanceHandler > OnCalcCritChance
HookList< EmpowerStageCompletedHandler > OnEmpowerCompleted
HookList< EffectHandler > OnEffectLaunch
HookList< DamageAndHealingCalcHandler > CalcHealing
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TC_GAME_API uint32 GetId(std::string_view username)
std::string ToString(Type &&val, Params &&... params)
void Remove(VignetteData &vignette, WorldObject const *owner)
void(* Static)(std::list< WorldObject * > &targets)
void(SpellScript::* Member)(std::list< WorldObject * > &targets)
void(SpellScript::* Member)(WorldObject *&target)
void(* Static)(WorldObject *&target)