diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 6ed7809e3..800bea9fb 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -2832,7 +2832,7 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf uint32 talentCost = GetTalentSpellCost(id); bool talent = (talentCost > 0); - bool passive = IsPassiveSpell(id); + bool passive = IsPassiveSpell(spellInfo); bool active = target && target->HasAura(id); // unit32 used to prevent interpreting uint8 as char at output diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 191fd3b24..5a6492a80 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1084,9 +1084,8 @@ void Object::BuildUpdateData( UpdateDataMapType& /*update_players */) } WorldObject::WorldObject() - : m_currMap(NULL), m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), - m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f), - m_isActiveObject(false) + : m_isActiveObject(false), m_currMap(NULL), m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), + m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f) { } diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index c077d0a4b..395ea51ed 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1313,7 +1313,7 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel if(active == ACT_DECIDE) //active was not used before, so we save it's autocast/passive state here { - if(IsPassiveSpell(spell_id)) + if(IsPassiveSpell(spellInfo)) newspell.active = ACT_PASSIVE; else newspell.active = ACT_DISABLED; @@ -1369,7 +1369,7 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel m_spells[spell_id] = newspell; - if (IsPassiveSpell(spell_id)) + if (IsPassiveSpell(spellInfo)) CastSpell(this, spell_id, true); else m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active)); diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 77b018a52..57356b38a 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -191,7 +191,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) } // do not cast not learned spells - if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid)) + if(!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo)) return; pet->clearUnitState(UNIT_STAT_MOVING); @@ -626,7 +626,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ) } // do not cast not learned spells - if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid)) + if (!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo)) return; SpellCastTargets targets; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c8a0f4aad..2af1cd7ca 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3063,7 +3063,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if(active) { - if (IsPassiveSpell(spell_id) && IsNeedCastPassiveSpellAtLearn(spellInfo)) + if (IsPassiveSpell(spellInfo) && IsNeedCastPassiveSpellAtLearn(spellInfo)) CastSpell (this, spell_id, true); } else if(IsInWorld()) @@ -3254,7 +3254,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen CastSpell(this, spell_id, true); } // also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks - else if (IsPassiveSpell(spell_id)) + else if (IsPassiveSpell(spellInfo)) { if (IsNeedCastPassiveSpellAtLearn(spellInfo)) CastSpell(this, spell_id, true); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6597d88e4..0094ef6cd 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4253,7 +4253,7 @@ SpellCastResult Spell::CheckCast(bool strict) // auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode // this case can be triggered if rank not found (too low-level target for first rank) - if (m_caster->GetTypeId() == TYPEID_PLAYER && !IsPassiveSpell(m_spellInfo->Id) && !m_CastItem) + if (m_caster->GetTypeId() == TYPEID_PLAYER && !IsPassiveSpell(m_spellInfo) && !m_CastItem) { for(int i = 0; i < MAX_EFFECT_INDEX; ++i) { @@ -4448,7 +4448,7 @@ SpellCastResult Spell::CheckCast(bool strict) // not let players cast spells at mount (and let do it to creatures) if (m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell && - !IsPassiveSpell(m_spellInfo->Id) && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_MOUNTED)) + !IsPassiveSpell(m_spellInfo) && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_MOUNTED)) { if (m_caster->isInFlight()) return SPELL_FAILED_NOT_ON_TAXI; @@ -4457,7 +4457,7 @@ SpellCastResult Spell::CheckCast(bool strict) } // always (except passive spells) check items (focus object can be required for any type casts) - if (!IsPassiveSpell(m_spellInfo->Id)) + if (!IsPassiveSpell(m_spellInfo)) { SpellCastResult castResult = CheckItems(); if(castResult != SPELL_CAST_OK) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c99639ee2..47619f796 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -386,7 +386,7 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false) m_currentBasePoints = currentBasePoints ? *currentBasePoints : m_spellProto->CalculateSimpleValue(eff); - m_isPassive = IsPassiveSpell(GetId()); + m_isPassive = IsPassiveSpell(GetSpellProto()); m_positive = IsPositiveEffect(GetId(), m_effIndex); m_isSingleTargetAura = IsSingleTargetSpell(m_spellProto); @@ -633,7 +633,7 @@ void Aura::Update(uint32 diff) Unit* caster = GetCaster(); if(!caster) { - m_target->RemoveAura(GetId(), GetEffIndex()); + m_target->RemoveAurasByCasterSpell(GetId(), GetEffIndex(), GetCasterGUID()); return; } @@ -648,7 +648,7 @@ void Aura::Update(uint32 diff) if(!caster->IsWithinDistInMap(m_target, max_range)) { - m_target->RemoveAura(GetId(), GetEffIndex()); + m_target->RemoveAurasByCasterSpell(GetId(), GetEffIndex(), GetCasterGUID()); return; } } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index f42a18c11..641ac3573 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -332,7 +332,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) if (mover->GetTypeId()==TYPEID_PLAYER) { // not have spell in spellbook or spell passive and not casted by client - if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) ) + if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellInfo)) { sLog.outError("World: Player %u casts spell %u which he shouldn't have", mover->GetGUIDLow(), spellId); //cheater? kick? ban? @@ -343,7 +343,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) else { // not have spell in spellbook or spell passive and not casted by client - if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellId) ) + if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellInfo)) { //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index a4c9651ae..aa7d320d2 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -283,6 +283,11 @@ bool IsPassiveSpell(uint32 spellId) SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) return false; + return IsPassiveSpell(spellInfo); +} + +bool IsPassiveSpell(SpellEntry const *spellInfo) +{ return (spellInfo->Attributes & SPELL_ATTR_PASSIVE) != 0; } @@ -1607,7 +1612,7 @@ bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellI bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo) { - if(IsPassiveSpell(spellInfo->Id)) // ranked passive spell + if(IsPassiveSpell(spellInfo)) // ranked passive spell return false; if(spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH) return false; @@ -2214,7 +2219,7 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const { // ignore passive spells - if(IsPassiveSpell(spellInfo->Id)) + if(IsPassiveSpell(spellInfo)) return spellInfo; bool needRankSelection = false; @@ -2588,7 +2593,7 @@ void SpellMgr::LoadSpellLearnSpells() // talent or passive spells or skill-step spells auto-casted and not need dependent learning, // pet teaching spells don't must be dependent learning (casted) // other required explicit dependent learning - dbc_node.autoLearned = entry->EffectImplicitTargetA[i]==TARGET_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(spell) || IsSpellHaveEffect(entry,SPELL_EFFECT_SKILL_STEP); + dbc_node.autoLearned = entry->EffectImplicitTargetA[i]==TARGET_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(entry) || IsSpellHaveEffect(entry,SPELL_EFFECT_SKILL_STEP); SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell); @@ -3974,4 +3979,4 @@ SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty) SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellDiff->spellId[difficulty]); return spellEntry; -} +} \ No newline at end of file diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 0108e78d3..2640b447d 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -210,10 +210,11 @@ bool IsSingleFromSpellSpecificSpellRanksPerTarget(SpellSpecific spellSpec1,Spell bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific spellSpec2); bool IsPassiveSpell(uint32 spellId); +bool IsPassiveSpell(SpellEntry const* spellProto); inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto) { - if(!IsPassiveSpell(spellProto->Id)) + if(!IsPassiveSpell(spellProto)) return false; return !IsSpellHaveEffect(spellProto,SPELL_EFFECT_APPLY_AURA); @@ -371,12 +372,9 @@ inline bool IsAreaAuraEffect(uint32 effect) inline bool IsDispelSpell(SpellEntry const *spellInfo) { - if (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_DISPEL || - spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_DISPEL || - spellInfo->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_DISPEL ) - return true; - return false; + return IsSpellHaveEffect(spellInfo, SPELL_EFFECT_DISPEL); } + inline bool isSpellBreakStealth(SpellEntry const* spellInfo) { return !(spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_BREAK_STEALTH); @@ -1064,4 +1062,4 @@ class SpellMgr }; #define sSpellMgr SpellMgr::Instance() -#endif +#endif \ No newline at end of file diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 048f7d6a1..9f22d733c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4006,7 +4006,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) SpellEffectIndex effIndex = Aur->GetEffIndex(); // passive spell special case (only non stackable with ranks) - if(IsPassiveSpell(spellId)) + if(IsPassiveSpell(spellProto)) { if(IsPassiveSpellStackableWithRanks(spellProto)) return true; @@ -4029,7 +4029,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) uint32 i_spellId = i_spellProto->Id; // early checks that spellId is passive non stackable spell - if(IsPassiveSpell(i_spellId)) + if(IsPassiveSpell(i_spellProto)) { // passive non-stackable spells not stackable only for same caster if(Aur->GetCasterGUID()!=i->second->GetCasterGUID()) @@ -8610,7 +8610,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) { if(itr->second.state == PLAYERSPELL_REMOVED) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - if (!spellInfo || !IsPassiveSpell(itr->first)) continue; + if (!spellInfo || !IsPassiveSpell(spellInfo)) continue; if (spellInfo->CasterAuraState == flag) CastSpell(this, itr->first, true, NULL); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a01f657a1..55d41e6ae 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 "10073" + #define REVISION_NR "10074" #endif // __REVISION_NR_H__