aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellScript.cpp
diff options
context:
space:
mode:
authorQAston <qaston@gmail.com>2011-07-26 23:09:28 +0200
committerQAston <qaston@gmail.com>2011-07-26 23:09:28 +0200
commitb0fe236265465a0f39aa98a8cee2916d1ccfaa02 (patch)
tree77ed4bde46de983c280a542d657a30b24865638c /src/server/game/Spells/SpellScript.cpp
parent29c228a80170e4264129d4e3bed4d2fc41aca5a7 (diff)
Core: Use new SpellInfo class in core. Sadly, this commit is not compatibile with some of the custom code. To make your code work again you may need to change:
*SpellEntry is now SpellInfo *GetSpellProto is now GetSpellInfo *SpellEntry::Effect*[effIndex] is now avalible under SpellInfo.Effects[effIndex].* *sSpellStore.LookupEntry is no longer valid, use sSpellMgr->GetSpellInfo() *SpellFunctions from SpellMgr.h like DoSpellStuff(spellId) are now: spellInfo->DoStuff() *SpellMgr::CalculateEffectValue and similar functions are now avalible in SpellEffectInfo class. *GET_SPELL macro is removed, code which used it is moved to SpellMgr::LoadDbcDataCorrections *code which affected dbc data in SpellMgr::LoadSpellCustomAttr is now moved to LoadDbcDataCorrections
Diffstat (limited to 'src/server/game/Spells/SpellScript.cpp')
-rwxr-xr-xsrc/server/game/Spells/SpellScript.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 0fe75da3da1..2edf040223a 100755
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -21,7 +21,7 @@
#include "SpellScript.h"
#include "SpellMgr.h"
-bool _SpellScript::_Validate(SpellEntry const* entry)
+bool _SpellScript::_Validate(SpellInfo const* entry)
{
if (!Validate(entry))
{
@@ -59,7 +59,7 @@ _SpellScript::EffectHook::EffectHook(uint8 _effIndex)
effIndex = _effIndex;
}
-uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const* spellEntry)
+uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEntry)
{
uint8 mask = 0;
if ((effIndex == EFFECT_ALL) || (effIndex == EFFECT_FIRST_FOUND))
@@ -80,7 +80,7 @@ uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const* spellEn
return mask;
}
-bool _SpellScript::EffectHook::IsEffectAffected(SpellEntry const* spellEntry, uint8 effIndex)
+bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex)
{
return GetAffectedEffectsMask(spellEntry) & 1<<effIndex;
}
@@ -103,13 +103,13 @@ std::string _SpellScript::EffectHook::EffIndexToString()
return "Invalid Value";
}
-bool _SpellScript::EffectNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
+bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
{
- if (!spellEntry->Effect[effIndex] && !effName)
+ if (!spellEntry->Effects[effIndex].Effect && !effName)
return true;
- if (!spellEntry->Effect[effIndex])
+ if (!spellEntry->Effects[effIndex].Effect)
return false;
- return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effect[effIndex] == effName);
+ return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].Effect == effName);
}
std::string _SpellScript::EffectNameCheck::ToString()
@@ -125,13 +125,13 @@ std::string _SpellScript::EffectNameCheck::ToString()
}
}
-bool _SpellScript::EffectAuraNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
+bool _SpellScript::EffectAuraNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
{
- if (!spellEntry->EffectApplyAuraName[effIndex] && !effAurName)
+ if (!spellEntry->Effects[effIndex].ApplyAuraName && !effAurName)
return true;
- if (!spellEntry->EffectApplyAuraName[effIndex])
+ if (!spellEntry->Effects[effIndex].ApplyAuraName)
return false;
- return (effAurName == SPELL_EFFECT_ANY) || (spellEntry->EffectApplyAuraName[effIndex] == effAurName);
+ return (effAurName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].ApplyAuraName == effAurName);
}
std::string _SpellScript::EffectAuraNameCheck::ToString()
@@ -168,7 +168,7 @@ 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(SpellInfo const* spellEntry, uint8 effIndex)
{
return _SpellScript::EffectNameCheck::Check(spellEntry, effIndex);
}
@@ -201,11 +201,11 @@ std::string SpellScript::UnitTargetHandler::ToString()
return oss.str();
}
-bool SpellScript::UnitTargetHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
+bool SpellScript::UnitTargetHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
if (!targetType)
return false;
- return (effIndex == EFFECT_ALL) || (spellEntry->EffectImplicitTargetA[effIndex] == targetType || spellEntry->EffectImplicitTargetB[effIndex] == targetType);
+ return (effIndex == EFFECT_ALL) || (spellEntry->Effects[effIndex].TargetA == targetType || spellEntry->Effects[effIndex].TargetB == targetType);
}
void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Unit*>& unitTargets)
@@ -213,7 +213,7 @@ void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Un
(spellScript->*pUnitTargetHandlerScript)(unitTargets);
}
-bool SpellScript::_Validate(SpellEntry const* entry)
+bool SpellScript::_Validate(SpellInfo const* entry)
{
for (std::list<EffectHandler>::iterator itr = OnEffect.begin(); itr != OnEffect.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
@@ -261,7 +261,7 @@ Unit* SpellScript::GetOriginalCaster()
return m_spell->GetOriginalCaster();
}
-SpellEntry const* SpellScript::GetSpellInfo()
+SpellInfo const* SpellScript::GetSpellInfo()
{
return m_spell->GetSpellInfo();
}
@@ -472,10 +472,10 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result)
m_spell->m_customError = result;
}
-bool AuraScript::_Validate(SpellEntry const* entry)
+bool AuraScript::_Validate(SpellInfo const* entry)
{
for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
- if (!HasAreaAuraEffect(entry))
+ if (!entry->HasAreaAuraEffect())
sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
@@ -548,7 +548,7 @@ AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
{
}
-bool AuraScript::EffectBase::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
+bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
}
@@ -703,9 +703,9 @@ void AuraScript::PreventDefaultAction()
}
}
-SpellEntry const* AuraScript::GetSpellProto() const
+SpellInfo const* AuraScript::GetSpellInfo() const
{
- return m_aura->GetSpellProto();
+ return m_aura->GetSpellInfo();
}
uint32 AuraScript::GetId() const