TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
_SpellScript::EffectHook Class Referenceabstract

#include <SpellScript.h>

Public Member Functions

 EffectHook (uint8 _effIndex)
 
virtual ~EffectHook ()
 
uint32 GetAffectedEffectsMask (SpellInfo const *spellInfo)
 
bool IsEffectAffected (SpellInfo const *spellInfo, uint8 effIndex)
 
virtual bool CheckEffect (SpellInfo const *spellInfo, uint8 effIndex)=0
 
std::string EffIndexToString ()
 

Protected Attributes

uint8 effIndex
 

Constructor & Destructor Documentation

_SpellScript::EffectHook::EffectHook ( uint8  _effIndex)
61 {
62  // effect index must be in range <0;2>, allow use of special effindexes
63  ASSERT(_effIndex == EFFECT_ALL || _effIndex == EFFECT_FIRST_FOUND || _effIndex < MAX_SPELL_EFFECTS);
64  effIndex = _effIndex;
65 }
uint8 effIndex
Definition: SpellScript.h:82
#define EFFECT_ALL
Definition: SharedDefines.h:64
#define ASSERT
Definition: Errors.h:55
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
#define EFFECT_FIRST_FOUND
Definition: SharedDefines.h:63
virtual _SpellScript::EffectHook::~EffectHook ( )
inlinevirtual
75 { }

Member Function Documentation

virtual bool _SpellScript::EffectHook::CheckEffect ( SpellInfo const spellInfo,
uint8  effIndex 
)
pure virtual
std::string _SpellScript::EffectHook::EffIndexToString ( )
94 {
95  switch (effIndex)
96  {
97  case EFFECT_ALL:
98  return "EFFECT_ALL";
99  case EFFECT_FIRST_FOUND:
100  return "EFFECT_FIRST_FOUND";
101  case EFFECT_0:
102  return "EFFECT_0";
103  case EFFECT_1:
104  return "EFFECT_1";
105  case EFFECT_2:
106  return "EFFECT_2";
107  }
108  return "Invalid Value";
109 }
Definition: SharedDefines.h:29
Definition: SharedDefines.h:28
uint8 effIndex
Definition: SpellScript.h:82
#define EFFECT_ALL
Definition: SharedDefines.h:64
#define EFFECT_FIRST_FOUND
Definition: SharedDefines.h:63
Definition: SharedDefines.h:30
uint32 _SpellScript::EffectHook::GetAffectedEffectsMask ( SpellInfo const spellInfo)
68 {
69  uint32 mask = 0;
71  {
72  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
73  {
74  if ((effIndex == EFFECT_FIRST_FOUND) && mask)
75  return mask;
76  if (CheckEffect(spellEntry, i))
77  mask |= 1 << i;
78  }
79  }
80  else
81  {
82  if (CheckEffect(spellEntry, effIndex))
83  mask |= 1 << effIndex;
84  }
85  return mask;
86 }
virtual bool CheckEffect(SpellInfo const *spellInfo, uint8 effIndex)=0
uint8 effIndex
Definition: SpellScript.h:82
uint32_t uint32
Definition: Define.h:150
#define EFFECT_ALL
Definition: SharedDefines.h:64
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
#define EFFECT_FIRST_FOUND
Definition: SharedDefines.h:63
bool _SpellScript::EffectHook::IsEffectAffected ( SpellInfo const spellInfo,
uint8  effIndex 
)
89 {
90  return (GetAffectedEffectsMask(spellEntry) & 1 << effIndexToCheck) != 0;
91 }
uint32 GetAffectedEffectsMask(SpellInfo const *spellInfo)
Definition: SpellScript.cpp:67

Member Data Documentation

uint8 _SpellScript::EffectHook::effIndex
protected

The documentation for this class was generated from the following files: