From b0fe236265465a0f39aa98a8cee2916d1ccfaa02 Mon Sep 17 00:00:00 2001 From: QAston Date: Tue, 26 Jul 2011 23:09:28 +0200 Subject: 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 --- src/server/game/Entities/GameObject/GameObject.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/server/game/Entities/GameObject') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 3a47729dea6..a48f1c774fe 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -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; -- cgit v1.2.3