mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user