aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/GameObject
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/Entities/GameObject
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/Entities/GameObject')
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp22
1 files changed, 6 insertions, 16 deletions
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;