diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index a9066aea4..5e235746f 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -92,11 +92,18 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE SetFloatValue(DYNAMICOBJECT_RADIUS, radius); SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime()); // new 2.4.0 + SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId); + if (!spellProto) + { + sLog.outError("DynamicObject (spell %u) not created. Spell not exist!", spellId, GetPositionX(), GetPositionY()); + return false; + } + m_aliveDuration = duration; m_radius = radius; m_effIndex = effIndex; m_spellId = spellId; - m_positive = IsPositiveEffect(m_spellId, m_effIndex); + m_positive = IsPositiveEffect(spellProto, m_effIndex); return true; } diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index c7b119e83..897720912 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1301,7 +1301,7 @@ void Pet::_LoadAuras(uint32 timediff) if ((effIndexMask & (1 << i)) == 0) continue; - if (remaintime[i] != -1 && !IsPositiveEffect(spellid, SpellEffectIndex(i))) + if (remaintime[i] != -1 && !IsPositiveEffect(spellproto, SpellEffectIndex(i))) { if (remaintime[i]/IN_MILLISECONDS <= int32(timediff)) continue; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 1055a91f5..d594e3336 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15980,7 +15980,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) if ((effIndexMask & (1 << i)) == 0) continue; - if (remaintime[i] != -1 && !IsPositiveEffect(spellid, SpellEffectIndex(i))) + if (remaintime[i] != -1 && !IsPositiveEffect(spellproto, SpellEffectIndex(i))) { if (remaintime[i]/IN_MILLISECONDS <= int32(timediff)) continue; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c07b927eb..120b544fa 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -783,7 +783,7 @@ void Spell::prepareDataForTriggerSystem() // avoid triggering negative hit for only positive targets m_negativeEffectMask = 0x0; for (int i = 0; i < MAX_EFFECT_INDEX; ++i) - if (!IsPositiveEffect(m_spellInfo->Id, SpellEffectIndex(i))) + if (!IsPositiveEffect(m_spellInfo, SpellEffectIndex(i))) m_negativeEffectMask |= (1<Id, effIndex)) + if (IsPositiveEffect(m_spellInfo, effIndex)) targetB = SPELL_TARGETS_FRIENDLY; UnitList tempTargetUnitMap; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 1b938ed33..619c54fbb 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -385,7 +385,7 @@ m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder) bool isPassive = IsPassiveSpell(GetSpellProto()); bool isPermanent = false; - m_positive = IsPositiveEffect(spellproto->Id, m_effIndex); + m_positive = IsPositiveEffect(spellproto, m_effIndex); m_applyTime = time(NULL); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 80eda5c2d..c800bd09b 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -623,17 +623,13 @@ bool IsExplicitNegativeTarget(uint32 targetA) return false; } -bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex) +bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) { - SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); - if (!spellproto) - return false; - switch(spellproto->Effect[effIndex]) { case SPELL_EFFECT_DUMMY: // some explicitly required dummy effect sets - switch(spellId) + switch(spellproto->Id) { case 28441: // AB Effect 000 return false; @@ -708,7 +704,7 @@ bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex) case SPELL_AURA_ADD_TARGET_TRIGGER: return true; case SPELL_AURA_PERIODIC_TRIGGER_SPELL: - if (spellId != spellproto->EffectTriggerSpell[effIndex]) + if (spellproto->Id != spellproto->EffectTriggerSpell[effIndex]) { uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex]; SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId); @@ -720,8 +716,8 @@ bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex) { // if non-positive trigger cast targeted to positive target this main cast is non-positive // this will place this spell auras as debuffs - if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) && - !IsPositiveEffect(spellTriggeredId,SpellEffectIndex(i))) + if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex], spellTriggeredProto->EffectImplicitTargetB[effIndex]) && + !IsPositiveEffect(spellTriggeredProto, SpellEffectIndex(i))) return false; } } @@ -854,7 +850,7 @@ bool IsPositiveSpell(uint32 spellId) // spells with at least one negative effect are considered negative // some self-applied spells have negative effects but in self casting case negative check ignored. for (int i = 0; i < MAX_EFFECT_INDEX; ++i) - if (!IsPositiveEffect(spellId, SpellEffectIndex(i))) + if (spellproto->Effect[i] && !IsPositiveEffect(spellproto, SpellEffectIndex(i))) return false; return true; } @@ -2405,7 +2401,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo, IsAreaEffectPossitiveTarget(Targets(spellInfo->EffectImplicitTargetA[i])))) || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID) && - IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i))) + IsPositiveEffect(spellInfo, SpellEffectIndex(i))) { needRankSelection = true; break; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 2f67d27b8..7b2b69155 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -240,7 +240,7 @@ inline bool IsNonCombatSpell(SpellEntry const *spellInfo) } bool IsPositiveSpell(uint32 spellId); -bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex); +bool IsPositiveEffect(SpellEntry const *spellInfo, SpellEffectIndex effIndex); bool IsPositiveTarget(uint32 targetA, uint32 targetB); bool IsExplicitPositiveTarget(uint32 targetA); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1d6c9fdd2..b6957d086 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7195,7 +7195,7 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i for(AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) if (spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff ((*iter)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellInfo)) && // Check school - !IsPositiveEffect(spellInfo->Id, index)) // Harmful + !IsPositiveEffect(spellInfo, index)) // Harmful return true; } @@ -8751,7 +8751,7 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectInde // Find total mod value (negative bonus) int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic); // Modify from SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL aura for negative effects (stack always ?) - if (!IsPositiveEffect(spellProto->Id, effect_index)) + if (!IsPositiveEffect(spellProto, effect_index)) durationMod_always+=target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel); // Find max mod (negative bonus) int32 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, mechanic); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e80714943..5bdd3da3f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11287" + #define REVISION_NR "11288" #endif // __REVISION_NR_H__