From f5216efa2497b73a29783cc480069a5de1c71624 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 24 Dec 2008 15:06:06 -0600 Subject: *Fix the bug that owner learns pet spells when pet does not exist. --HG-- branch : trunk --- src/game/Spell.cpp | 18 +++++++++++------- src/game/SpellMgr.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c2276a24960..694ba2ceaa7 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -402,13 +402,11 @@ Spell::~Spell() void Spell::FillTargetMap() { - // TODO: ADD the correct target FILLS!!!!!! - - for(uint32 i=0;i<3;i++) + for(uint32 i = 0; i < 3; ++i) { // not call for empty effect. // Also some spells use not used effect targets for store targets for dummy effect in triggered spells - if(m_spellInfo->Effect[i]==0) + if(!m_spellInfo->Effect[i]) continue; // TODO: find a way so this is not needed? @@ -417,9 +415,13 @@ void Spell::FillTargetMap() AddUnitTarget(m_caster, i); std::list tmpUnitMap; + uint32 targetA = m_spellInfo->EffectImplicitTargetA[i]; + uint32 targetB = m_spellInfo->EffectImplicitTargetB[i]; - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + if(targetA) + SetTargetMap(i, targetA, tmpUnitMap); + if(targetB) // In very rare case !A && B + SetTargetMap(i, targetB, tmpUnitMap); if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT) { @@ -433,7 +435,9 @@ void Spell::FillTargetMap() continue; } - if(tmpUnitMap.empty()) + if(!targetA && !targetB) + AddUnitTarget(m_caster, i); + else if(tmpUnitMap.empty()) { // add here custom effects that need default target. // FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!! diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 705a69ea2a4..1e9ae3531dd 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -61,7 +61,7 @@ SpellMgr::SpellMgr() case SPELL_EFFECT_PARRY: // 0 case SPELL_EFFECT_BLOCK: // 0 case SPELL_EFFECT_SKILL: // always with dummy 3 as A - case SPELL_EFFECT_LEARN_SPELL: // 0 + //case SPELL_EFFECT_LEARN_SPELL: // 0 may be 5 pet case SPELL_EFFECT_TRADE_SKILL: // 0 or 1 case SPELL_EFFECT_PROFICIENCY: // 0 EffectTargetType[i] = SPELL_REQUIRE_NONE; -- cgit v1.2.3