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:
QAston
2011-07-26 23:09:28 +02:00
parent 29c228a801
commit b0fe236265
195 changed files with 4630 additions and 6929 deletions
@@ -928,21 +928,11 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
return;
SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
SpellInfo const* trapSpell = sSpellMgr->GetSpellInfo(trapInfo->trap.spellId);
if (!trapSpell) // checked at load already
return;
float range;
SpellRangeEntry const* srentry = sSpellRangeStore.LookupEntry(trapSpell->rangeIndex);
if (GetSpellMaxRangeForHostile(srentry) == GetSpellMaxRangeForFriend(srentry))
range = GetSpellMaxRangeForHostile(srentry);
else
// get owner to check hostility of GameObject
if (Unit *owner = GetOwner())
range = (float)owner->GetSpellMaxRangeForTarget(target, srentry);
else
// if no owner assume that object is hostile to target
range = GetSpellMaxRangeForHostile(srentry);
float range = float(target->GetSpellMaxRangeForTarget(GetOwner(), trapSpell));
// search nearest linked GO
GameObject* trapGO = NULL;
@@ -1593,7 +1583,7 @@ void GameObject::Use(Unit* user)
if (!spellId)
return;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
@@ -1611,14 +1601,14 @@ void GameObject::Use(Unit* user)
void GameObject::CastSpell(Unit* target, uint32 spellId)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return;
bool self = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
if (spellInfo->Effects[i].TargetA == TARGET_UNIT_CASTER)
{
self = true;
break;
@@ -1633,7 +1623,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
}
//summon world trigger
Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, GetSpellCastTime(spellInfo) + 100);
Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, spellInfo->CalcCastTime() + 100);
if (!trigger)
return;