Scripts/Examples: Corrected code style in spell script examples
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
bool _SpellScript::_Validate(SpellEntry const * entry)
|
||||
bool _SpellScript::_Validate(SpellEntry const* entry)
|
||||
{
|
||||
if (!Validate(entry))
|
||||
{
|
||||
@@ -44,7 +44,7 @@ void _SpellScript::_Unload()
|
||||
m_currentScriptState = SPELL_SCRIPT_STATE_NONE;
|
||||
}
|
||||
|
||||
void _SpellScript::_Init(const std::string * scriptname, uint32 spellId)
|
||||
void _SpellScript::_Init(std::string const* scriptname, uint32 spellId)
|
||||
{
|
||||
m_currentScriptState = SPELL_SCRIPT_STATE_NONE;
|
||||
m_scriptName = scriptname;
|
||||
@@ -58,7 +58,7 @@ _SpellScript::EffectHook::EffectHook(uint8 _effIndex)
|
||||
effIndex = _effIndex;
|
||||
}
|
||||
|
||||
uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const * spellEntry)
|
||||
uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const* spellEntry)
|
||||
{
|
||||
uint8 mask = 0;
|
||||
if ((effIndex == EFFECT_ALL) || (effIndex == EFFECT_FIRST_FOUND))
|
||||
@@ -79,7 +79,7 @@ uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const * spellE
|
||||
return mask;
|
||||
}
|
||||
|
||||
bool _SpellScript::EffectHook::IsEffectAffected(SpellEntry const * spellEntry, uint8 effIndex)
|
||||
bool _SpellScript::EffectHook::IsEffectAffected(SpellEntry const* spellEntry, uint8 effIndex)
|
||||
{
|
||||
return GetAffectedEffectsMask(spellEntry) & 1<<effIndex;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ std::string _SpellScript::EffectHook::EffIndexToString()
|
||||
return "Invalid Value";
|
||||
}
|
||||
|
||||
bool _SpellScript::EffectNameCheck::Check(SpellEntry const * spellEntry, uint8 effIndex)
|
||||
bool _SpellScript::EffectNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
|
||||
{
|
||||
if (!spellEntry->Effect[effIndex] && !effName)
|
||||
return true;
|
||||
@@ -124,7 +124,7 @@ std::string _SpellScript::EffectNameCheck::ToString()
|
||||
}
|
||||
}
|
||||
|
||||
bool _SpellScript::EffectAuraNameCheck::Check(SpellEntry const * spellEntry, uint8 effIndex)
|
||||
bool _SpellScript::EffectAuraNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
|
||||
{
|
||||
if (!spellEntry->EffectApplyAuraName[effIndex] && !effAurName)
|
||||
return true;
|
||||
@@ -167,12 +167,12 @@ std::string SpellScript::EffectHandler::ToString()
|
||||
return "Index: " + EffIndexToString() + " Name: " +_SpellScript::EffectNameCheck::ToString();
|
||||
}
|
||||
|
||||
bool SpellScript::EffectHandler::CheckEffect(SpellEntry const * spellEntry, uint8 effIndex)
|
||||
bool SpellScript::EffectHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
|
||||
{
|
||||
return _SpellScript::EffectNameCheck::Check(spellEntry, effIndex);
|
||||
}
|
||||
|
||||
void SpellScript::EffectHandler::Call(SpellScript * spellScript, SpellEffIndex effIndex)
|
||||
void SpellScript::EffectHandler::Call(SpellScript* spellScript, SpellEffIndex effIndex)
|
||||
{
|
||||
(spellScript->*pEffectHandlerScript)(effIndex);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ SpellScript::HitHandler::HitHandler(SpellHitFnType _pHitHandlerScript)
|
||||
pHitHandlerScript = _pHitHandlerScript;
|
||||
}
|
||||
|
||||
void SpellScript::HitHandler::Call(SpellScript * spellScript)
|
||||
void SpellScript::HitHandler::Call(SpellScript* spellScript)
|
||||
{
|
||||
(spellScript->*pHitHandlerScript)();
|
||||
}
|
||||
@@ -200,14 +200,14 @@ std::string SpellScript::UnitTargetHandler::ToString()
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
bool SpellScript::UnitTargetHandler::CheckEffect(SpellEntry const * spellEntry, uint8 effIndex)
|
||||
bool SpellScript::UnitTargetHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
|
||||
{
|
||||
if (!targetType)
|
||||
return false;
|
||||
return (effIndex == SPELL_EFFECT_ANY) || (spellEntry->EffectImplicitTargetA[effIndex] == targetType || spellEntry->EffectImplicitTargetB[effIndex] == targetType);
|
||||
}
|
||||
|
||||
void SpellScript::UnitTargetHandler::Call(SpellScript * spellScript, std::list<Unit*>& unitTargets)
|
||||
void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Unit*>& unitTargets)
|
||||
{
|
||||
(spellScript->*pUnitTargetHandlerScript)(unitTargets);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ bool SpellScript::_Validate(SpellEntry const * entry)
|
||||
return _SpellScript::_Validate(entry);
|
||||
}
|
||||
|
||||
bool SpellScript::_Load(Spell * spell)
|
||||
bool SpellScript::_Load(Spell* spell)
|
||||
{
|
||||
m_currentScriptState = SPELL_SCRIPT_STATE_LOADING;
|
||||
m_spell = spell;
|
||||
@@ -250,44 +250,44 @@ void SpellScript::_FinishScriptCall()
|
||||
m_currentScriptState = SPELL_SCRIPT_STATE_NONE;
|
||||
}
|
||||
|
||||
Unit * SpellScript::GetCaster()
|
||||
Unit* SpellScript::GetCaster()
|
||||
{
|
||||
return m_spell->GetCaster();
|
||||
}
|
||||
|
||||
Unit * SpellScript::GetOriginalCaster()
|
||||
Unit* SpellScript::GetOriginalCaster()
|
||||
{
|
||||
return m_spell->GetOriginalCaster();
|
||||
}
|
||||
|
||||
SpellEntry const * SpellScript::GetSpellInfo()
|
||||
SpellEntry const* SpellScript::GetSpellInfo()
|
||||
{
|
||||
return m_spell->GetSpellInfo();
|
||||
}
|
||||
|
||||
WorldLocation * SpellScript::GetTargetDest()
|
||||
WorldLocation* SpellScript::GetTargetDest()
|
||||
{
|
||||
if (m_spell->m_targets.HasDst())
|
||||
return &m_spell->m_targets.m_dstPos;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Unit * SpellScript::GetTargetUnit()
|
||||
Unit* SpellScript::GetTargetUnit()
|
||||
{
|
||||
return m_spell->m_targets.getUnitTarget();
|
||||
}
|
||||
|
||||
GameObject * SpellScript::GetTargetGObj()
|
||||
GameObject* SpellScript::GetTargetGObj()
|
||||
{
|
||||
return m_spell->m_targets.getGOTarget();
|
||||
}
|
||||
|
||||
Item * SpellScript::GetTargetItem()
|
||||
Item* SpellScript::GetTargetItem()
|
||||
{
|
||||
return m_spell->m_targets.getItemTarget();
|
||||
}
|
||||
|
||||
Unit * SpellScript::GetHitUnit()
|
||||
Unit* SpellScript::GetHitUnit()
|
||||
{
|
||||
if (!IsInHitPhase())
|
||||
{
|
||||
@@ -297,7 +297,7 @@ Unit * SpellScript::GetHitUnit()
|
||||
return m_spell->unitTarget;
|
||||
}
|
||||
|
||||
Creature * SpellScript::GetHitCreature()
|
||||
Creature* SpellScript::GetHitCreature()
|
||||
{
|
||||
if (!IsInHitPhase())
|
||||
{
|
||||
@@ -310,7 +310,7 @@ Creature * SpellScript::GetHitCreature()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Player * SpellScript::GetHitPlayer()
|
||||
Player* SpellScript::GetHitPlayer()
|
||||
{
|
||||
if (!IsInHitPhase())
|
||||
{
|
||||
@@ -323,7 +323,7 @@ Player * SpellScript::GetHitPlayer()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Item * SpellScript::GetHitItem()
|
||||
Item* SpellScript::GetHitItem()
|
||||
{
|
||||
if (!IsInHitPhase())
|
||||
{
|
||||
@@ -333,7 +333,7 @@ Item * SpellScript::GetHitItem()
|
||||
return m_spell->itemTarget;
|
||||
}
|
||||
|
||||
GameObject * SpellScript::GetHitGObj()
|
||||
GameObject* SpellScript::GetHitGObj()
|
||||
{
|
||||
if (!IsInHitPhase())
|
||||
{
|
||||
@@ -439,7 +439,7 @@ int32 SpellScript::GetEffectValue()
|
||||
return m_spell->damage;
|
||||
}
|
||||
|
||||
Item * SpellScript::GetCastItem()
|
||||
Item* SpellScript::GetCastItem()
|
||||
{
|
||||
return m_spell->m_CastItem;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
|
||||
{
|
||||
}
|
||||
|
||||
bool AuraScript::EffectBase::CheckEffect(SpellEntry const * spellEntry, uint8 effIndex)
|
||||
bool AuraScript::EffectBase::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
|
||||
{
|
||||
return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
|
||||
}
|
||||
@@ -536,7 +536,7 @@ AuraScript::EffectPeriodicHandler::EffectPeriodicHandler(AuraEffectPeriodicFnTyp
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
}
|
||||
|
||||
void AuraScript::EffectPeriodicHandler::Call(AuraScript * auraScript, AuraEffect const * _aurEff)
|
||||
void AuraScript::EffectPeriodicHandler::Call(AuraScript* auraScript, AuraEffect const* _aurEff)
|
||||
{
|
||||
(auraScript->*pEffectHandlerScript)(_aurEff);
|
||||
}
|
||||
@@ -547,7 +547,7 @@ AuraScript::EffectUpdatePeriodicHandler::EffectUpdatePeriodicHandler(AuraEffectU
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
}
|
||||
|
||||
void AuraScript::EffectUpdatePeriodicHandler::Call(AuraScript * auraScript, AuraEffect * aurEff)
|
||||
void AuraScript::EffectUpdatePeriodicHandler::Call(AuraScript* auraScript, AuraEffect* aurEff)
|
||||
{
|
||||
(auraScript->*pEffectHandlerScript)(aurEff);
|
||||
}
|
||||
@@ -558,41 +558,41 @@ AuraScript::EffectCalcAmountHandler::EffectCalcAmountHandler(AuraEffectCalcAmoun
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
}
|
||||
|
||||
void AuraScript::EffectCalcAmountHandler::Call(AuraScript * auraScript, AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated)
|
||||
void AuraScript::EffectCalcAmountHandler::Call(AuraScript* auraScript, AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
|
||||
{
|
||||
(auraScript->*pEffectHandlerScript)(aurEff, amount, canBeRecalculated);
|
||||
}
|
||||
|
||||
AuraScript::EffectCalcPeriodicHandler::EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
|
||||
AuraScript::EffectCalcPeriodicHandler::EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
|
||||
: AuraScript::EffectBase(_effIndex, _effName)
|
||||
{
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
}
|
||||
|
||||
void AuraScript::EffectCalcPeriodicHandler::Call(AuraScript * auraScript, AuraEffect const * aurEff, bool & isPeriodic, int32 & periodicTimer)
|
||||
void AuraScript::EffectCalcPeriodicHandler::Call(AuraScript* auraScript, AuraEffect const* aurEff, bool& isPeriodic, int32& periodicTimer)
|
||||
{
|
||||
(auraScript->*pEffectHandlerScript)(aurEff, isPeriodic, periodicTimer);
|
||||
}
|
||||
|
||||
AuraScript::EffectCalcSpellModHandler::EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
|
||||
AuraScript::EffectCalcSpellModHandler::EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName)
|
||||
: AuraScript::EffectBase(_effIndex, _effName)
|
||||
{
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
}
|
||||
|
||||
void AuraScript::EffectCalcSpellModHandler::Call(AuraScript * auraScript, AuraEffect const * aurEff, SpellModifier *& spellMod)
|
||||
void AuraScript::EffectCalcSpellModHandler::Call(AuraScript* auraScript, AuraEffect const* aurEff, SpellModifier*& spellMod)
|
||||
{
|
||||
(auraScript->*pEffectHandlerScript)(aurEff, spellMod);
|
||||
}
|
||||
|
||||
AuraScript::EffectApplyHandler::EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode)
|
||||
AuraScript::EffectApplyHandler::EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode)
|
||||
: AuraScript::EffectBase(_effIndex, _effName)
|
||||
{
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
mode = _mode;
|
||||
}
|
||||
|
||||
void AuraScript::EffectApplyHandler::Call(AuraScript * auraScript, AuraEffect const * _aurEff, AuraEffectHandleModes _mode)
|
||||
void AuraScript::EffectApplyHandler::Call(AuraScript* auraScript, AuraEffect const * _aurEff, AuraEffectHandleModes _mode)
|
||||
{
|
||||
if (_mode & mode)
|
||||
(auraScript->*pEffectHandlerScript)(_aurEff, _mode);
|
||||
@@ -604,23 +604,23 @@ AuraScript::EffectAbsorbHandler::EffectAbsorbHandler(AuraEffectAbsorbFnType _pEf
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
}
|
||||
|
||||
void AuraScript::EffectAbsorbHandler::Call(AuraScript * auraScript, AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
void AuraScript::EffectAbsorbHandler::Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
|
||||
{
|
||||
(auraScript->*pEffectHandlerScript)(aurEff, dmgInfo, absorbAmount);
|
||||
}
|
||||
|
||||
AuraScript::EffectManaShieldHandler::EffectManaShieldHandler(AuraEffectAbsorbFnType _pEffectHandlerScript,uint8 _effIndex)
|
||||
AuraScript::EffectManaShieldHandler::EffectManaShieldHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex)
|
||||
: AuraScript::EffectBase(_effIndex, SPELL_AURA_MANA_SHIELD)
|
||||
{
|
||||
pEffectHandlerScript = _pEffectHandlerScript;
|
||||
}
|
||||
|
||||
void AuraScript::EffectManaShieldHandler::Call(AuraScript * auraScript, AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
void AuraScript::EffectManaShieldHandler::Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
|
||||
{
|
||||
(auraScript->*pEffectHandlerScript)(aurEff, dmgInfo, absorbAmount);
|
||||
}
|
||||
|
||||
bool AuraScript::_Load(Aura * aura)
|
||||
bool AuraScript::_Load(Aura* aura)
|
||||
{
|
||||
m_currentScriptState = SPELL_SCRIPT_STATE_LOADING;
|
||||
m_aura = aura;
|
||||
@@ -629,7 +629,7 @@ bool AuraScript::_Load(Aura * aura)
|
||||
return load;
|
||||
}
|
||||
|
||||
void AuraScript::_PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const * aurApp)
|
||||
void AuraScript::_PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp)
|
||||
{
|
||||
m_currentScriptState = hookType;
|
||||
switch (m_currentScriptState)
|
||||
@@ -828,12 +828,12 @@ bool AuraScript::HasEffectType(AuraType type) const
|
||||
return m_aura->HasEffectType(type);
|
||||
}
|
||||
|
||||
Unit * AuraScript::GetTarget() const
|
||||
Unit* AuraScript::GetTarget() const
|
||||
{
|
||||
return m_auraApplication->GetTarget();
|
||||
}
|
||||
|
||||
AuraApplication const * AuraScript::GetTargetApplication() const
|
||||
AuraApplication const* AuraScript::GetTargetApplication() const
|
||||
{
|
||||
return m_auraApplication;
|
||||
}
|
||||
|
||||
@@ -55,45 +55,49 @@ class _SpellScript
|
||||
// internal use classes & functions
|
||||
// DO NOT OVERRIDE THESE IN SCRIPTS
|
||||
protected:
|
||||
virtual bool _Validate(SpellEntry const * entry);
|
||||
virtual bool _Validate(SpellEntry const* entry);
|
||||
|
||||
public:
|
||||
virtual ~_SpellScript() {}
|
||||
virtual void _Register();
|
||||
virtual void _Unload();
|
||||
virtual void _Init(const std::string * scriptname, uint32 spellId);
|
||||
virtual void _Init(std::string const* scriptname, uint32 spellId);
|
||||
|
||||
protected:
|
||||
class EffectHook
|
||||
{
|
||||
public:
|
||||
EffectHook(uint8 _effIndex);
|
||||
uint8 GetAffectedEffectsMask(SpellEntry const * spellEntry);
|
||||
bool IsEffectAffected(SpellEntry const * spellEntry, uint8 effIndex);
|
||||
virtual bool CheckEffect(SpellEntry const * spellEntry, uint8 effIndex) = 0;
|
||||
uint8 GetAffectedEffectsMask(SpellEntry const* spellEntry);
|
||||
bool IsEffectAffected(SpellEntry const* spellEntry, uint8 effIndex);
|
||||
virtual bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex) = 0;
|
||||
std::string EffIndexToString();
|
||||
protected:
|
||||
uint8 effIndex;
|
||||
};
|
||||
|
||||
class EffectNameCheck
|
||||
{
|
||||
public:
|
||||
EffectNameCheck(uint16 _effName) {effName = _effName;};
|
||||
bool Check(SpellEntry const * spellEntry, uint8 effIndex);
|
||||
bool Check(SpellEntry const* spellEntry, uint8 effIndex);
|
||||
std::string ToString();
|
||||
private:
|
||||
uint16 effName;
|
||||
};
|
||||
|
||||
class EffectAuraNameCheck
|
||||
{
|
||||
public:
|
||||
EffectAuraNameCheck(uint16 _effAurName) { effAurName = _effAurName; }
|
||||
bool Check(SpellEntry const * spellEntry, uint8 effIndex);
|
||||
bool Check(SpellEntry const* spellEntry, uint8 effIndex);
|
||||
std::string ToString();
|
||||
private:
|
||||
uint16 effAurName;
|
||||
};
|
||||
|
||||
uint8 m_currentScriptState;
|
||||
const std::string * m_scriptName;
|
||||
std::string const* m_scriptName;
|
||||
uint32 m_scriptSpellId;
|
||||
public:
|
||||
//
|
||||
@@ -104,13 +108,13 @@ class _SpellScript
|
||||
virtual void Register() = 0;
|
||||
// Function called on server startup, if returns false script won't be used in core
|
||||
// use for: dbc/template data presence/correctness checks
|
||||
virtual bool Validate(SpellEntry const * /*spellEntry*/) {return true;};
|
||||
virtual bool Validate(SpellEntry const* /*spellEntry*/) { return true; }
|
||||
// Function called when script is created, if returns false script will be unloaded afterwards
|
||||
// use for: initializing local script variables (DO NOT USE CONSTRUCTOR FOR THIS PURPOSE!)
|
||||
virtual bool Load() {return true;};
|
||||
virtual bool Load() { return true; }
|
||||
// Function called when script is destroyed
|
||||
// use for: deallocating memory allocated by script
|
||||
virtual void Unload() {};
|
||||
virtual void Unload() {}
|
||||
};
|
||||
|
||||
// SpellScript interface - enum used for runtime checks of script function calls
|
||||
@@ -123,6 +127,7 @@ enum SpellScriptHookType
|
||||
SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT,
|
||||
SPELL_SCRIPT_HOOK_CHECK_CAST,
|
||||
};
|
||||
|
||||
#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT
|
||||
#define HOOK_SPELL_HIT_END SPELL_SCRIPT_HOOK_AFTER_HIT + 1
|
||||
#define HOOK_SPELL_START SPELL_SCRIPT_HOOK_EFFECT
|
||||
@@ -156,8 +161,8 @@ class SpellScript : public _SpellScript
|
||||
public:
|
||||
EffectHandler(SpellEffectFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
|
||||
std::string ToString();
|
||||
bool CheckEffect(SpellEntry const * spellEntry, uint8 effIndex);
|
||||
void Call(SpellScript * spellScript, SpellEffIndex effIndex);
|
||||
bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex);
|
||||
void Call(SpellScript* spellScript, SpellEffIndex effIndex);
|
||||
private:
|
||||
SpellEffectFnType pEffectHandlerScript;
|
||||
};
|
||||
@@ -166,7 +171,7 @@ class SpellScript : public _SpellScript
|
||||
{
|
||||
public:
|
||||
HitHandler(SpellHitFnType _pHitHandlerScript);
|
||||
void Call(SpellScript * spellScript);
|
||||
void Call(SpellScript* spellScript);
|
||||
private:
|
||||
SpellHitFnType pHitHandlerScript;
|
||||
};
|
||||
@@ -176,8 +181,8 @@ class SpellScript : public _SpellScript
|
||||
public:
|
||||
UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType);
|
||||
std::string ToString();
|
||||
bool CheckEffect(SpellEntry const * spellEntry, uint8 targetType);
|
||||
void Call(SpellScript * spellScript, std::list<Unit*>& unitTargets);
|
||||
bool CheckEffect(SpellEntry const* spellEntry, uint8 targetType);
|
||||
void Call(SpellScript* spellScript, std::list<Unit*>& unitTargets);
|
||||
private:
|
||||
SpellUnitTargetFnType pUnitTargetHandlerScript;
|
||||
uint16 targetType;
|
||||
@@ -191,8 +196,8 @@ class SpellScript : public _SpellScript
|
||||
|
||||
#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
|
||||
public:
|
||||
bool _Validate(SpellEntry const * entry);
|
||||
bool _Load(Spell * spell);
|
||||
bool _Validate(SpellEntry const* entry);
|
||||
bool _Load(Spell* spell);
|
||||
void _InitHit();
|
||||
bool _IsEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventEffectMask & (1<<effIndex); }
|
||||
bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventDefaultEffectMask & (1<<effIndex); }
|
||||
@@ -202,7 +207,7 @@ class SpellScript : public _SpellScript
|
||||
bool IsInHitPhase() const { return (m_currentScriptState >= HOOK_SPELL_HIT_START && m_currentScriptState < HOOK_SPELL_HIT_END); }
|
||||
bool IsInEffectHook() const { return (m_currentScriptState == SPELL_SCRIPT_HOOK_EFFECT); }
|
||||
private:
|
||||
Spell * m_spell;
|
||||
Spell* m_spell;
|
||||
uint8 m_hitPreventEffectMask;
|
||||
uint8 m_hitPreventDefaultEffectMask;
|
||||
public:
|
||||
@@ -246,48 +251,48 @@ class SpellScript : public _SpellScript
|
||||
// methods allowing interaction with Spell object
|
||||
//
|
||||
// methods useable during all spell handling phases
|
||||
Unit * GetCaster();
|
||||
Unit * GetOriginalCaster();
|
||||
SpellEntry const * GetSpellInfo();
|
||||
Unit* GetCaster();
|
||||
Unit* GetOriginalCaster();
|
||||
SpellEntry const* GetSpellInfo();
|
||||
|
||||
// methods useable after spell targets are set
|
||||
// accessors to the "focus" targets of the spell
|
||||
// note: do not confuse these with spell hit targets
|
||||
// returns: WorldLocation which was selected as a spell destination or NULL
|
||||
WorldLocation * GetTargetDest();
|
||||
WorldLocation* GetTargetDest();
|
||||
|
||||
// returns: Unit which was selected as a spell target or NULL
|
||||
Unit * GetTargetUnit();
|
||||
Unit* GetTargetUnit();
|
||||
|
||||
// returns: GameObject which was selected as a spell target or NULL
|
||||
GameObject * GetTargetGObj();
|
||||
GameObject* GetTargetGObj();
|
||||
|
||||
// returns: Item which was selected as a spell target or NULL
|
||||
Item * GetTargetItem();
|
||||
Item* GetTargetItem();
|
||||
|
||||
// methods useable only during spell hit on target phase:
|
||||
|
||||
// returns: target of current effect if it was Unit otherwise NULL
|
||||
Unit * GetHitUnit();
|
||||
Unit* GetHitUnit();
|
||||
// returns: target of current effect if it was Creature otherwise NULL
|
||||
Creature * GetHitCreature();
|
||||
Creature* GetHitCreature();
|
||||
// returns: target of current effect if it was Player otherwise NULL
|
||||
Player * GetHitPlayer();
|
||||
Player* GetHitPlayer();
|
||||
// returns: target of current effect if it was Item otherwise NULL
|
||||
Item * GetHitItem();
|
||||
// returns: target of current effect if it was GameObject otherwise NULL
|
||||
GameObject * GetHitGObj();
|
||||
GameObject* GetHitGObj();
|
||||
// setter/getter for for damage done by spell to target of spell hit
|
||||
int32 GetHitDamage();
|
||||
void SetHitDamage(int32 damage);
|
||||
void PreventHitDamage() { SetHitDamage(0); };
|
||||
void PreventHitDamage() { SetHitDamage(0); }
|
||||
// setter/getter for for heal done by spell to target of spell hit
|
||||
int32 GetHitHeal();
|
||||
void SetHitHeal(int32 heal);
|
||||
void PreventHitHeal() { SetHitHeal(0); };
|
||||
void PreventHitHeal() { SetHitHeal(0); }
|
||||
|
||||
// returns current spell hit target aura
|
||||
Aura * GetHitAura();
|
||||
Aura* GetHitAura();
|
||||
// prevents applying aura on current spell hit target
|
||||
void PreventHitAura();
|
||||
|
||||
@@ -306,7 +311,7 @@ class SpellScript : public _SpellScript
|
||||
int32 GetEffectValue();
|
||||
|
||||
// returns: cast item if present.
|
||||
Item * GetCastItem();
|
||||
Item* GetCastItem();
|
||||
|
||||
// Creates item. Calls Spell::DoCreateItem method.
|
||||
void CreateItem(uint32 effIndex, uint32 itemId);
|
||||
|
||||
Reference in New Issue
Block a user