AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
UnitScript Class Reference

#include "UnitScript.h"

Inheritance diagram for UnitScript:
ScriptObject

Public Member Functions

virtual void OnHeal (Unit *, Unit *, uint32 &)
 
virtual void OnDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifyPeriodicDamageAurasTick (Unit *, Unit *, uint32 &, SpellInfo const *)
 
virtual void ModifyMeleeDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifySpellDamageTaken (Unit *, Unit *, int32 &, SpellInfo const *)
 
virtual void ModifyHealReceived (Unit *, Unit *, uint32 &, SpellInfo const *)
 
virtual uint32 DealDamage (Unit *, Unit *, uint32 damage, DamageEffectType)
 
virtual void OnBeforeRollMeleeOutcomeAgainst (Unit const *, Unit const *, WeaponAttackType, int32 &, int32 &, int32 &, int32 &, int32 &, int32 &, int32 &, int32 &, int32 &)
 
virtual void OnAuraApply (Unit *, Aura *)
 
virtual void OnAuraRemove (Unit *, AuraApplication *, AuraRemoveMode)
 
virtual bool IfNormalReaction (Unit const *, Unit const *, ReputationRank &)
 
virtual bool IsNeedModSpellDamagePercent (Unit const *, AuraEffect *, float &, SpellInfo const *)
 
virtual bool IsNeedModMeleeDamagePercent (Unit const *, AuraEffect *, float &, SpellInfo const *)
 
virtual bool IsNeedModHealPercent (Unit const *, AuraEffect *, float &, SpellInfo const *)
 
virtual bool CanSetPhaseMask (Unit const *, uint32, bool)
 
virtual bool IsCustomBuildValuesUpdate (Unit const *, uint8, ByteBuffer &, Player const *, uint16)
 
virtual bool ShouldTrackValuesUpdatePosByIndex (Unit const *, uint8, uint16)
 
virtual void OnPatchValuesUpdate (Unit const *, ByteBuffer &, BuildValuesCachePosPointers &, Player *)
 
virtual void OnUnitUpdate (Unit *, uint32)
 This hook runs in Unit::Update. More...
 
virtual void OnDisplayIdChange (Unit *, uint32)
 
virtual void OnUnitEnterEvadeMode (Unit *, uint8)
 
virtual void OnUnitEnterCombat (Unit *, Unit *)
 
virtual void OnUnitDeath (Unit *, Unit *)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Protected Member Functions

 UnitScript (const char *name, bool addToScripts=true, std::vector< uint16 > enabledHooks=std::vector< uint16 >())
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ UnitScript()

UnitScript::UnitScript ( const char *  name,
bool  addToScripts = true,
std::vector< uint16 enabledHooks = std::vector<uint16>() 
)
protected
153{
154 if (addToScripts)
155 {
156 // If empty - enable all available hooks.
157 if (enabledHooks.empty())
158 for (uint16 i = 0; i < UNITHOOK_END; ++i)
159 enabledHooks.emplace_back(i);
160
161 ScriptRegistry<UnitScript>::AddScript(this, std::move(enabledHooks));
162 }
163}
std::uint16_t uint16
Definition: Define.h:108
@ UNITHOOK_END
Definition: UnitScript.h:48
static void AddScript(TScript *const script, std::vector< uint16 > enabledHooks={})
Definition: ScriptMgr.h:737
Definition: ScriptObject.h:44

References ScriptRegistry< TScript >::AddScript(), and UNITHOOK_END.

Member Function Documentation

◆ CanSetPhaseMask()

virtual bool UnitScript::CanSetPhaseMask ( Unit const *  ,
uint32  ,
bool   
)
inlinevirtual
97{ return true; }

◆ DealDamage()

virtual uint32 UnitScript::DealDamage ( Unit ,
Unit ,
uint32  damage,
DamageEffectType   
)
inlinevirtual
81{ return damage; }

◆ IfNormalReaction()

virtual bool UnitScript::IfNormalReaction ( Unit const *  ,
Unit const *  ,
ReputationRank  
)
inlinevirtual
89{ return true; }

◆ IsCustomBuildValuesUpdate()

virtual bool UnitScript::IsCustomBuildValuesUpdate ( Unit const *  ,
uint8  ,
ByteBuffer ,
Player const *  ,
uint16   
)
inlinevirtual
99{ return false; }

◆ IsNeedModHealPercent()

virtual bool UnitScript::IsNeedModHealPercent ( Unit const *  ,
AuraEffect ,
float &  ,
SpellInfo const *   
)
inlinevirtual
95{ return true; }

◆ IsNeedModMeleeDamagePercent()

virtual bool UnitScript::IsNeedModMeleeDamagePercent ( Unit const *  ,
AuraEffect ,
float &  ,
SpellInfo const *   
)
inlinevirtual
93{ return true; }

◆ IsNeedModSpellDamagePercent()

virtual bool UnitScript::IsNeedModSpellDamagePercent ( Unit const *  ,
AuraEffect ,
float &  ,
SpellInfo const *   
)
inlinevirtual
91{ return true; }

◆ ModifyHealReceived()

virtual void UnitScript::ModifyHealReceived ( Unit ,
Unit ,
uint32 ,
SpellInfo const *   
)
inlinevirtual
78{ }

◆ ModifyMeleeDamage()

virtual void UnitScript::ModifyMeleeDamage ( Unit ,
Unit ,
uint32  
)
inlinevirtual
72{ }

◆ ModifyPeriodicDamageAurasTick()

virtual void UnitScript::ModifyPeriodicDamageAurasTick ( Unit ,
Unit ,
uint32 ,
SpellInfo const *   
)
inlinevirtual
69{ }

◆ ModifySpellDamageTaken()

virtual void UnitScript::ModifySpellDamageTaken ( Unit ,
Unit ,
int32 ,
SpellInfo const *   
)
inlinevirtual
75{ }

◆ OnAuraApply()

virtual void UnitScript::OnAuraApply ( Unit ,
Aura  
)
inlinevirtual
85{ }

◆ OnAuraRemove()

virtual void UnitScript::OnAuraRemove ( Unit ,
AuraApplication ,
AuraRemoveMode   
)
inlinevirtual
87{ }

◆ OnBeforeRollMeleeOutcomeAgainst()

virtual void UnitScript::OnBeforeRollMeleeOutcomeAgainst ( Unit const *  ,
Unit const *  ,
WeaponAttackType  ,
int32 ,
int32 ,
int32 ,
int32 ,
int32 ,
int32 ,
int32 ,
int32 ,
int32  
)
inlinevirtual
83{ };

◆ OnDamage()

virtual void UnitScript::OnDamage ( Unit ,
Unit ,
uint32  
)
inlinevirtual
65{ }

◆ OnDisplayIdChange()

virtual void UnitScript::OnDisplayIdChange ( Unit ,
uint32   
)
inlinevirtual
113{ }

◆ OnHeal()

virtual void UnitScript::OnHeal ( Unit ,
Unit ,
uint32  
)
inlinevirtual
62{ }

◆ OnPatchValuesUpdate()

virtual void UnitScript::OnPatchValuesUpdate ( Unit const *  ,
ByteBuffer ,
BuildValuesCachePosPointers ,
Player  
)
inlinevirtual
103{ }

◆ OnUnitDeath()

virtual void UnitScript::OnUnitDeath ( Unit ,
Unit  
)
inlinevirtual
117{ }

◆ OnUnitEnterCombat()

virtual void UnitScript::OnUnitEnterCombat ( Unit ,
Unit  
)
inlinevirtual
116{ }

◆ OnUnitEnterEvadeMode()

virtual void UnitScript::OnUnitEnterEvadeMode ( Unit ,
uint8   
)
inlinevirtual
115{ }

◆ OnUnitUpdate()

virtual void UnitScript::OnUnitUpdate ( Unit ,
uint32   
)
inlinevirtual

This hook runs in Unit::Update.

Parameters
unitContains information about the Unit
diffContains information about the diff time
111{ }

◆ ShouldTrackValuesUpdatePosByIndex()

virtual bool UnitScript::ShouldTrackValuesUpdatePosByIndex ( Unit const *  ,
uint8  ,
uint16   
)
inlinevirtual
101{ return false; }