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);
243#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT_HIT
244#define HOOK_SPELL_HIT_END SPELL_SCRIPT_HOOK_AFTER_HIT + 1
258 template<
typename ScriptFunc>
266 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass>,
267 "CastHandler signature must be \"void HandleCast()\"");
272 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))();
278 return _safeWrapper(spellScript, _callImpl);
296 template<
typename ScriptFunc>
304 if constexpr (!std::is_void_v<ScriptClass>)
306 static_assert(std::is_invocable_r_v<SpellCastResult, ScriptFunc, ScriptClass>,
307 "CheckCastHandler signature must be \"SpellCastResult CheckCast()\"");
309 _callImpl = { .Member =
reinterpret_cast<decltype(SpellCheckCastFnType::Member)
>(handler) };
312 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))();
317 static_assert(std::is_invocable_r_v<SpellCastResult, ScriptFunc>,
318 "CheckCastHandler signature must be \"static SpellCastResult CheckCast()\"");
320 _callImpl = { .Static =
reinterpret_cast<decltype(SpellCheckCastFnType::Static)
>(handler) };
323 return reinterpret_cast<ScriptFunc
>(callImpl.Static)();
330 return _safeWrapper(spellScript, _callImpl);
347 bool CheckEffect(
SpellInfo const* spellInfo,
uint8 effIndex)
const override;
359 template<
typename ScriptFunc>
368 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellEffIndex>,
369 "EffectHandler signature must be \"void HandleEffect(SpellEffIndex effIndex)\"");
374 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))(effIndex);
380 return _safeWrapper(spellScript, effIndex, _callImpl);
394 template<
typename ScriptFunc>
402 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellMissInfo>,
403 "BeforeHitHandler signature must be \"void HandleBeforeHit(SpellMissInfo missInfo)\"");
408 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))(missInfo);
414 return _safeWrapper(spellScript, missInfo, _callImpl);
428 template<
typename ScriptFunc>
436 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass>,
437 "HitHandler signature must be \"void HandleHit()\"");
442 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))();
448 return _safeWrapper(spellScript, _callImpl);
461 void(*Static)(
Unit const* victim,
float& critChance);
466 template<
typename ScriptFunc>
474 if constexpr (!std::is_void_v<ScriptClass>)
476 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, Unit const*, float&>,
477 "OnCalcCritChanceHandler signature must be \"void CalcCritChance(Unit const* victim, float& critChance)\"");
479 _callImpl = { .Member =
reinterpret_cast<decltype(SpellOnCalcCritChanceFnType::Member)
>(handler) };
482 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(victim, critChance);
487 static_assert(std::is_invocable_r_v<void, ScriptFunc, Unit const*, float&>,
488 "OnCalcCritChanceHandler signature must be \"static void CalcCritChance(Unit const* victim, float& critChance)\"");
490 _callImpl = { .Static =
reinterpret_cast<decltype(SpellOnCalcCritChanceFnType::Static)
>(handler) };
493 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(victim, critChance);
500 return _safeWrapper(spellScript, victim, critChance, _callImpl);
516 bool CheckEffect(
SpellInfo const* spellInfo,
uint8 effIndex)
const override;
531 void(*Static)(std::list<WorldObject*>& targets);
536 template<
typename ScriptFunc>
538 :
TargetHook(effIndex, targetType, true, false)
545 if constexpr (!std::is_void_v<ScriptClass>)
547 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, std::list<WorldObject*>&>,
548 "ObjectAreaTargetSelectHandler signature must be \"void SetTargets(std::list<WorldObject*>& targets)\"");
550 _callImpl = { .Member =
reinterpret_cast<decltype(SpellObjectAreaTargetSelectFnType::Member)
>(handler) };
553 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(targets);
558 static_assert(std::is_invocable_r_v<void, ScriptFunc, std::list<WorldObject*>&>,
559 "ObjectAreaTargetSelectHandler signature must be \"static void SetTargets(std::list<WorldObject*>& targets)\"");
561 _callImpl = { .Static =
reinterpret_cast<decltype(SpellObjectAreaTargetSelectFnType::Static)
>(handler) };
564 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(targets);
571 return _safeWrapper(spellScript, targets, _callImpl);
589 template<
typename ScriptFunc>
591 :
TargetHook(effIndex, targetType, false, false)
598 if constexpr (!std::is_void_v<ScriptClass>)
600 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, WorldObject*&>,
601 "ObjectTargetSelectHandler signature must be \"void SetTarget(WorldObject*& target)\"");
603 _callImpl = { .Member =
reinterpret_cast<decltype(SpellObjectTargetSelectFnType::Member)
>(handler) };
606 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(target);
611 static_assert(std::is_invocable_r_v<void, ScriptFunc, WorldObject*&>,
612 "ObjectTargetSelectHandler signature must be \"static void SetTarget(WorldObject*& target)\"");
614 _callImpl = { .Static =
reinterpret_cast<decltype(SpellObjectTargetSelectFnType::Static)
>(handler) };
617 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(target);
624 return _safeWrapper(spellScript, target, _callImpl);
642 template<
typename ScriptFunc>
644 :
TargetHook(effIndex, targetType, false, true)
651 if constexpr (!std::is_void_v<ScriptClass>)
653 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, SpellDestination&>,
654 "DestinationTargetSelectHandler signature must be \"void SetTarget(SpellDestination& target)\"");
656 _callImpl = { .Member =
reinterpret_cast<decltype(SpellDestinationTargetSelectFnType::Member)
>(handler) };
659 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(target);
664 static_assert(std::is_invocable_r_v<void, ScriptFunc, SpellDestination&>,
665 "DestinationTargetSelectHandler signature must be \"static void SetTarget(SpellDestination& target)\"");
667 _callImpl = { .Static =
reinterpret_cast<decltype(SpellDestinationTargetSelectFnType::Static)
>(handler) };
670 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(target);
677 return _safeWrapper(spellScript, target, _callImpl);
690 void(*Static)(
Unit* victim,
int32& damageOrHealing,
int32& flatMod,
float& pctMod);
695 template<
typename ScriptFunc>
703 if constexpr (!std::is_void_v<ScriptClass>)
705 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, Unit*, int32&, int32&, float&>,
706 "DamageAndHealingCalcHandler signature must be \"void CalcDamage(Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
708 _callImpl = { .Member =
reinterpret_cast<decltype(DamageAndHealingCalcFnType::Member)
>(handler) };
711 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(victim, damageOrHealing, flatMod, pctMod);
716 static_assert(std::is_invocable_r_v<void, ScriptFunc, Unit*, int32&, int32&, float&>,
717 "DamageAndHealingCalcHandler signature must be \"static void CalcDamage(Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
719 _callImpl = { .Static =
reinterpret_cast<decltype(DamageAndHealingCalcFnType::Static)
>(handler) };
722 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(victim, damageOrHealing, flatMod, pctMod);
729 return _safeWrapper(spellScript, victim, damageOrHealing, flatMod, pctMod, _callImpl);
747 template<
typename ScriptFunc>
755 if constexpr (!std::is_void_v<ScriptClass>)
757 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, DamageInfo const&, uint32&, int32&>,
758 "OnCalculateResistAbsorbHandler signature must be \"void CalcAbsorbResist(DamageInfo const& damageInfo, uint32& resistAmount, int32& absorbAmount)\"");
760 _callImpl = { .Member =
reinterpret_cast<decltype(SpellOnResistAbsorbCalculateFnType::Member)
>(handler) };
763 return (
static_cast<ScriptClass*
>(spellScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(damageInfo, resistAmount, absorbAmount);
768 static_assert(std::is_invocable_r_v<void, ScriptFunc, DamageInfo const&, uint32&, int32&>,
769 "OnCalculateResistAbsorbHandler signature must be \"static void CalcAbsorbResist(DamageInfo const& damageInfo, uint32& resistAmount, int32& absorbAmount)\"");
771 _callImpl = { .Static =
reinterpret_cast<decltype(SpellOnResistAbsorbCalculateFnType::Static)
>(handler) };
774 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(damageInfo, resistAmount, absorbAmount);
781 return _safeWrapper(spellScript, damageInfo, resistAmount, absorbAmount, _callImpl);
789 #define PrepareSpellScript(CLASSNAME)
793 bool _Validate(
SpellInfo const* entry)
override;
794 bool _Load(
Spell* spell);
799 void _FinishScriptCall();
800 bool IsInCheckCastHook()
const;
801 bool IsAfterTargetSelectionPhase()
const;
802 bool IsInTargetHook()
const;
803 bool IsInModifiableHook()
const;
804 bool IsInHitPhase()
const;
805 bool IsInEffectHook()
const;
825 #define SpellCastFn(F) CastHandler(&F)
830 #define SpellCheckCastFn(F) CheckCastHandler(&F)
842 #define SpellEffectFn(F, I, N) EffectHandler(&F, I, N)
847 #define BeforeSpellHitFn(F) BeforeHitHandler(&F)
854 #define SpellHitFn(F) HitHandler(&F)
859 #define SpellOnCalcCritChanceFn(F) OnCalcCritChanceHandler(&F)
864 #define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandler(&F, I, N)
869 #define SpellObjectTargetSelectFn(F, I, N) ObjectTargetSelectHandler(&F, I, N)
874 #define SpellDestinationTargetSelectFn(F, I, N) DestinationTargetSelectHandler(&F, I, N)
879 #define SpellCalcDamageFn(F) DamageAndHealingCalcHandler(&F)
884 #define SpellCalcHealingFn(F) DamageAndHealingCalcHandler(&F)
889 #define SpellOnResistAbsorbCalculateFn(F) OnCalculateResistAbsorbHandler(&F)
919 Unit* GetCaster()
const;
921 Unit* GetOriginalCaster()
const;
946 Unit* GetExplTargetUnit()
const;
952 Item* GetExplTargetItem()
const;
962 Unit* GetHitUnit()
const;
966 Player* GetHitPlayer()
const;
968 Item* GetHitItem()
const;
972 Corpse* GetHitCorpse()
const;
977 int32 GetHitDamage()
const;
978 void SetHitDamage(
int32 damage);
982 int32 GetHitHeal()
const;
983 void SetHitHeal(
int32 heal);
986 bool IsHitCrit()
const;
989 Aura* GetHitAura(
bool dynObjAura =
false)
const;
991 void PreventHitAura();
1006 int32 GetEffectValue()
const;
1007 void SetEffectValue(
int32 value);
1008 float GetEffectVariance()
const;
1009 void SetEffectVariance(
float variance);
1012 Item* GetCastItem()
const;
1018 SpellInfo const* GetTriggeringSpell()
const;
1084 template<
typename ScriptFunc>
1092 if constexpr (!std::is_void_v<ScriptClass>)
1094 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ScriptClass, Unit*>,
1095 "CheckAreaTargetHandler signature must be \"bool CheckTarget(Unit* target)\"");
1097 _callImpl = { .Member =
reinterpret_cast<decltype(AuraCheckAreaTargetFnType::Member)
>(handler) };
1100 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(target);
1105 static_assert(std::is_invocable_r_v<bool, ScriptFunc, Unit*>,
1106 "CheckAreaTargetHandler signature must be \"static bool CheckTarget(Unit* target)\"");
1108 _callImpl = { .Static =
reinterpret_cast<decltype(AuraCheckAreaTargetFnType::Static)
>(handler) };
1111 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(target);
1118 return _safeWrapper(auraScript, target, _callImpl);
1136 template<
typename ScriptFunc>
1144 if constexpr (!std::is_void_v<ScriptClass>)
1146 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, DispelInfo*>,
1147 "AuraDispelHandler signature must be \"void HandleDispel(DispelInfo* dispelInfo)\"");
1149 _callImpl = { .Member =
reinterpret_cast<decltype(AuraDispelFnType::Member)
>(handler) };
1152 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(dispelInfo);
1157 static_assert(std::is_invocable_r_v<void, ScriptFunc, DispelInfo*>,
1158 "AuraDispelHandler signature must be \"static void HandleDispel(DispelInfo* dispelInfo)\"");
1160 _callImpl = { .Static =
reinterpret_cast<decltype(AuraDispelFnType::Static)
>(handler) };
1163 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(dispelInfo);
1170 return _safeWrapper(auraScript, dispelInfo, _callImpl);
1187 bool CheckEffect(
SpellInfo const* spellInfo,
uint8 effIndex)
const override;
1203 template<
typename ScriptFunc>
1212 if constexpr (!std::is_void_v<ScriptClass>)
1214 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*>,
1215 "EffectPeriodicHandler signature must be \"void HandlePeriodic(AuraEffect const* aurEff)\"");
1217 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectPeriodicFnType::Member)
>(handler) };
1220 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff);
1225 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*>,
1226 "EffectPeriodicHandler signature must be \"static void HandlePeriodic(AuraEffect const* aurEff)\"");
1228 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectPeriodicFnType::Static)
>(handler) };
1231 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff);
1238 return _safeWrapper(auraScript, aurEff, _callImpl);
1256 template<
typename ScriptFunc>
1265 if constexpr (!std::is_void_v<ScriptClass>)
1267 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*>,
1268 "EffectUpdatePeriodicHandler signature must be \"void HandleUpdatePeriodic(AuraEffect* aurEff)\"");
1270 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectUpdatePeriodicFnType::Member)
>(handler) };
1273 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff);
1278 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*>,
1279 "EffectUpdatePeriodicHandler signature must be \"static void HandleUpdatePeriodic(AuraEffect* aurEff)\"");
1281 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectUpdatePeriodicFnType::Static)
>(handler) };
1284 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff);
1291 return _safeWrapper(auraScript, aurEff, _callImpl);
1309 template<
typename ScriptFunc>
1318 if constexpr (!std::is_void_v<ScriptClass>)
1320 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, int32&, bool&>,
1321 "EffectCalcAmountHandler signature must be \"void CalcAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)\"");
1323 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcAmountFnType::Member)
>(handler) };
1326 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, amount, canBeRecalculated);
1331 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, int32&, bool&>,
1332 "EffectCalcAmountHandler signature must be \"static void CalcAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)\"");
1334 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcAmountFnType::Static)
>(handler) };
1337 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, amount, canBeRecalculated);
1344 return _safeWrapper(auraScript, aurEff, amount, canBeRecalculated, _callImpl);
1362 template<
typename ScriptFunc>
1371 if constexpr (!std::is_void_v<ScriptClass>)
1373 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, bool&, int32&>,
1374 "EffectCalcPeriodicHandler signature must be \"void CalcPeriodic(AuraEffect const* aurEff, bool& isPeriodic, int32& periodicTimer)\"");
1376 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcPeriodicFnType::Member)
>(handler) };
1379 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, isPeriodic, periodicTimer);
1384 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, bool&, int32&>,
1385 "EffectCalcPeriodicHandler signature must be \"static void CalcPeriodic(AuraEffect const* aurEff, bool& isPeriodic, int32& periodicTimer)\"");
1387 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcPeriodicFnType::Static)
>(handler) };
1390 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, isPeriodic, periodicTimer);
1397 return _safeWrapper(auraScript, aurEff, isPeriodic, periodicTimer, _callImpl);
1415 template<
typename ScriptFunc>
1424 if constexpr (!std::is_void_v<ScriptClass>)
1426 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, SpellModifier*&>,
1427 "EffectCalcSpellModHandler signature must be \"void CalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)\"");
1429 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcSpellModFnType::Member)
>(handler) };
1432 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, spellMod);
1437 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, SpellModifier*&>,
1438 "EffectCalcSpellModHandler signature must be \"static void CalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)\"");
1440 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcSpellModFnType::Static)
>(handler) };
1443 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, spellMod);
1450 return _safeWrapper(auraScript, aurEff, spellMod, _callImpl);
1468 template<
typename ScriptFunc>
1477 if constexpr (!std::is_void_v<ScriptClass>)
1479 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, Unit const*, float&>,
1480 "EffectCalcCritChanceHandler signature must be \"void CalcCritChance(AuraEffect const* aurEff, Unit const* victim, float& critChance)\"");
1482 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectCalcCritChanceFnType::Member)
>(handler) };
1485 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, victim, critChance);
1490 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, Unit const*, float&>,
1491 "EffectCalcCritChanceHandler signature must be \"static void CalcCritChance(AuraEffect const* aurEff, Unit const* victim, float& critChance)\"");
1493 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectCalcCritChanceFnType::Static)
>(handler) };
1496 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, victim, critChance);
1503 return _safeWrapper(auraScript, aurEff, victim, critChance, _callImpl);
1521 template<
typename ScriptFunc>
1530 if constexpr (!std::is_void_v<ScriptClass>)
1532 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, Unit*, int32&, int32&, float&>,
1533 "EffectCalcDamageAndHealingHandler signature must be \"void CalcDamageAndHealing(AuraEffect const* aurEff, Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
1535 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectDamageAndHealingCalcFnType::Member)
>(handler) };
1538 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, victim, damageOrHealing, flatMod, pctMod);
1543 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, Unit*, int32&, int32&, float&>,
1544 "EffectCalcDamageAndHealingHandler signature must be \"static void CalcDamageAndHealing(AuraEffect const* aurEff, Unit* victim, int32& damageOrHealing, int32& flatMod, float& pctMod)\"");
1546 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectDamageAndHealingCalcFnType::Static)
>(handler) };
1549 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, victim, damageOrHealing, flatMod, pctMod);
1556 return _safeWrapper(auraScript, aurEff, victim, damageOrHealing, flatMod, pctMod, _callImpl);
1574 template<
typename ScriptFunc>
1576 :
EffectBase(effIndex, auraType), _mode(mode)
1583 if constexpr (!std::is_void_v<ScriptClass>)
1585 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect const*, AuraEffectHandleModes>,
1586 "EffectApplyHandler signature must be \"void HandleApplyOrRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode)\"");
1588 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectApplicationModeFnType::Member)
>(handler) };
1591 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, mode);
1596 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect const*, AuraEffectHandleModes>,
1597 "EffectApplyHandler signature must be \"static void HandleApplyOrRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode)\"");
1599 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectApplicationModeFnType::Static)
>(handler) };
1602 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, mode);
1609 if (!(_mode & mode))
1612 return _safeWrapper(auraScript, aurEff, mode, _callImpl);
1631 template<
typename ScriptFunc>
1640 if constexpr (!std::is_void_v<ScriptClass>)
1642 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*, DamageInfo&, uint32&>,
1643 "EffectAbsorbHandler signature must be \"void HandleAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)\"");
1645 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectAbsorbFnType::Member)
>(handler) };
1648 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, dmgInfo, absorbAmount);
1653 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*, DamageInfo&, uint32&>,
1654 "EffectAbsorbHandler signature must be \"static void HandleAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)\"");
1656 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectAbsorbFnType::Static)
>(handler) };
1659 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, dmgInfo, absorbAmount);
1666 return _safeWrapper(auraScript, aurEff, dmgInfo, absorbAmount, _callImpl);
1684 template<
typename ScriptFunc>
1693 if constexpr (!std::is_void_v<ScriptClass>)
1695 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*, HealInfo&, uint32&>,
1696 "EffectAbsorbHealHandler signature must be \"void HandleAbsorb(AuraEffect* aurEff, HealInfo& healInfo, uint32& absorbAmount)\"");
1698 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectAbsorbHealFnType::Member)
>(handler) };
1701 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, healInfo, absorbAmount);
1706 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*, HealInfo&, uint32&>,
1707 "EffectAbsorbHealHandler signature must be \"static void HandleAbsorb(AuraEffect* aurEff, HealInfo& healInfo, uint32& absorbAmount)\"");
1709 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectAbsorbHealFnType::Static)
>(handler) };
1712 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, healInfo, absorbAmount);
1719 return _safeWrapper(auraScript, aurEff, healInfo, absorbAmount, _callImpl);
1737 template<
typename ScriptFunc>
1745 if constexpr (!std::is_void_v<ScriptClass>)
1747 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ScriptClass, ProcEventInfo&>,
1748 "CheckProcHandler signature must be \"bool CheckProc(ProcEventInfo& eventInfo)\"");
1750 _callImpl = { .Member =
reinterpret_cast<decltype(AuraCheckProcFnType::Member)
>(handler) };
1753 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(eventInfo);
1758 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ProcEventInfo&>,
1759 "CheckProcHandler signature must be \"static bool CheckProc(ProcEventInfo& eventInfo)\"");
1761 _callImpl = { .Static =
reinterpret_cast<decltype(AuraCheckProcFnType::Static)
>(handler) };
1764 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(eventInfo);
1771 return _safeWrapper(auraScript, eventInfo, _callImpl);
1789 template<
typename ScriptFunc>
1798 if constexpr (!std::is_void_v<ScriptClass>)
1800 static_assert(std::is_invocable_r_v<bool, ScriptFunc, ScriptClass, AuraEffect const*, ProcEventInfo&>,
1801 "CheckEffectProcHandler signature must be \"bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)\"");
1803 _callImpl = { .Member =
reinterpret_cast<decltype(AuraCheckEffectProcFnType::Member)
>(handler) };
1806 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, eventInfo);
1811 static_assert(std::is_invocable_r_v<bool, ScriptFunc, AuraEffect const*, ProcEventInfo&>,
1812 "CheckEffectProcHandler signature must be \"static bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)\"");
1814 _callImpl = { .Static =
reinterpret_cast<decltype(AuraCheckEffectProcFnType::Static)
>(handler) };
1817 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, eventInfo);
1824 return _safeWrapper(auraScript, aurEff, eventInfo, _callImpl);
1842 template<
typename ScriptFunc>
1850 if constexpr (!std::is_void_v<ScriptClass>)
1852 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, ProcEventInfo&>,
1853 "AuraProcHandler signature must be \"void HandleProc(ProcEventInfo& eventInfo)\"");
1855 _callImpl = { .Member =
reinterpret_cast<decltype(AuraProcFnType::Member)
>(handler) };
1858 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(eventInfo);
1863 static_assert(std::is_invocable_r_v<void, ScriptFunc, ProcEventInfo&>,
1864 "AuraProcHandler signature must be \"static void HandleProc(ProcEventInfo& eventInfo)\"");
1866 _callImpl = { .Member =
reinterpret_cast<decltype(AuraProcFnType::Member)
>(handler) };
1869 return reinterpret_cast<ScriptFunc
>(callImpl.Member)(eventInfo);
1876 return _safeWrapper(auraScript, eventInfo, _callImpl);
1894 template<
typename ScriptFunc>
1903 if constexpr (!std::is_void_v<ScriptClass>)
1905 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, AuraEffect*, ProcEventInfo&>,
1906 "EffectProcHandler signature must be \"void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)\"");
1908 _callImpl = { .Member =
reinterpret_cast<decltype(AuraEffectProcFnType::Member)
>(handler) };
1911 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl.Member))(aurEff, eventInfo);
1916 static_assert(std::is_invocable_r_v<void, ScriptFunc, AuraEffect*, ProcEventInfo&>,
1917 "EffectProcHandler signature must be \"static void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)\"");
1919 _callImpl = { .Static =
reinterpret_cast<decltype(AuraEffectProcFnType::Static)
>(handler) };
1922 return reinterpret_cast<ScriptFunc
>(callImpl.Static)(aurEff, eventInfo);
1929 return _safeWrapper(auraScript, aurEff, eventInfo, _callImpl);
1943 template<
typename ScriptFunc>
1951 static_assert(std::is_invocable_r_v<void, ScriptFunc, ScriptClass, bool>,
1952 "EnterLeaveCombatHandler signature must be \"void HandleEnterLeaveCombat(bool isNowInCombat)\"");
1957 return (
static_cast<ScriptClass*
>(auraScript)->*
reinterpret_cast<ScriptFunc
>(callImpl))(isNowInCombat);
1963 return _safeWrapper(auraScript, isNowInCombat, _callImpl);
1971 #define PrepareAuraScript(CLASSNAME)
1976 bool _Validate(
SpellInfo const* entry)
override;
1977 bool _Load(
Aura* aura);
1979 void _FinishScriptCall();
1980 bool _IsDefaultActionPrevented()
const;
1993 : _auraApplication(auraApplication), _currentScriptState(currentScriptState), _defaultActionPrevented(defaultActionPrevented)
2008 #define AuraCheckAreaTargetFn(F) CheckAreaTargetHandler(&F)
2018 #define AuraDispelFn(F) AuraDispelHandler(&F)
2029 #define AuraEffectApplyFn(F, I, N, M) EffectApplyHandler(&F, I, N, M)
2040 #define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandler(&F, I, N, M)
2046 #define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandler(&F, I, N)
2052 #define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandler(&F, I, N)
2058 #define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandler(&F, I, N)
2064 #define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandler(&F, I, N)
2070 #define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandler(&F, I, N)
2076 #define AuraEffectCalcCritChanceFn(F, I, N) EffectCalcCritChanceHandler(&F, I, N)
2083 #define AuraEffectCalcDamageFn(F, I, N) EffectCalcDamageAndHealingHandler(&F, I, N)
2084 #define AuraEffectCalcHealingFn(F, I, N) EffectCalcDamageAndHealingHandler(&F, I, N)
2090 #define AuraEffectAbsorbFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_SCHOOL_ABSORB)
2091 #define AuraEffectAbsorbOverkillFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_SCHOOL_ABSORB_OVERKILL)
2102 #define AuraEffectAbsorbHealFn(F, I) EffectAbsorbHealHandler(&F, I, SPELL_AURA_SCHOOL_HEAL_ABSORB)
2113 #define AuraEffectManaShieldFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_MANA_SHIELD)
2124 #define AuraEffectSplitFn(F, I) EffectAbsorbHandler(&F, I, SPELL_AURA_SPLIT_DAMAGE_PCT)
2130 #define AuraCheckProcFn(F) CheckProcHandler(&F)
2136 #define AuraCheckEffectProcFn(F, I, N) CheckEffectProcHandler(&F, I, N)
2150 #define AuraProcFn(F) AuraProcHandler(&F)
2160 #define AuraEffectProcFn(F, I, N) EffectProcHandler(&F, I, N)
2166 #define AuraEnterLeaveCombatFn(F) EnterLeaveCombatHandler(&F)
2171 void PreventDefaultAction();
2184 Unit* GetCaster()
const;
2190 Unit* GetUnitOwner()
const;
2197 Aura* GetAura()
const;
2203 int32 GetDuration()
const;
2204 void SetDuration(
int32 duration,
bool withMods =
false);
2206 void RefreshDuration();
2207 time_t GetApplyTime()
const;
2208 int32 GetMaxDuration()
const;
2209 void SetMaxDuration(
int32 duration);
2210 int32 CalcMaxDuration()
const;
2212 bool IsExpired()
const;
2214 bool IsPermanent()
const;
2217 uint8 GetCharges()
const;
2218 void SetCharges(
uint8 charges);
2219 uint8 CalcMaxCharges()
const;
2225 uint8 GetStackAmount()
const;
2226 void SetStackAmount(
uint8 num);
2230 bool IsPassive()
const;
2232 bool IsDeathPersistent()
const;
2235 bool HasEffect(
uint8 effIndex)
const;
2240 bool HasEffectType(
AuraType type)
const;
2248 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_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_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
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< 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)
DamageAndHealingCalcHandler(ScriptFunc handler)
void Call(SpellScript *spellScript, Unit *victim, int32 &damageOrHealing, int32 &flatMod, float &pctMod) const
DamageAndHealingCalcFnType _callImpl
void(*)(SpellScript *spellScript, 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
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
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
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< 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< 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)