diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index ecbe56e0e..9a2a2e703 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -160,7 +160,7 @@ void DynamicObject::Delay(int32 delaytime) Unit *target = GetMap()->GetUnit((*iter)); if (target) { - SpellAuraHolder *holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid().GetRawValue()); + SpellAuraHolder *holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid()); if (!holder) { ++iter; @@ -183,7 +183,7 @@ void DynamicObject::Delay(int32 delaytime) continue; } - target->DelaySpellAuraHolder(m_spellId, delaytime, GetCasterGuid().GetRawValue()); + target->DelaySpellAuraHolder(m_spellId, delaytime, GetCasterGuid()); ++iter; } else diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index a03571384..4ddac7a3c 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -160,7 +160,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) // Apply PersistentAreaAura on target // in case 2 dynobject overlap areas for same spell, same holder is selected, so dynobjects share holder - SpellAuraHolder *holder = target->GetSpellAuraHolder(spellInfo->Id, i_dynobject.GetCasterGuid().GetRawValue()); + SpellAuraHolder *holder = target->GetSpellAuraHolder(spellInfo->Id, i_dynobject.GetCasterGuid()); if (holder) { diff --git a/src/game/Object.cpp b/src/game/Object.cpp index dfdcde2e5..a2523be28 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -603,7 +603,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * if (IsPerCasterAuraState) { // IsPerCasterAuraState set if related pet caster aura state set already - if (((Unit*)this)->HasAuraStateForCaster(AURA_STATE_CONFLAGRATE,target->GetGUID())) + if (((Unit*)this)->HasAuraStateForCaster(AURA_STATE_CONFLAGRATE, target->GetObjectGuid())) *data << m_uint32Values[index]; else *data << (m_uint32Values[index] & ~(1 << (AURA_STATE_CONFLAGRATE-1))); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 194add4d0..3ce0afa4c 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1398,7 +1398,7 @@ void Pet::_SaveAuras() //skip all holders from spells that are passive or channeled //do not save single target holders (unless they were cast by the player) - if (save && !holder->IsPassive() && !IsChanneledSpell(holder->GetSpellProto()) && (holder->GetCasterGUID() == GetGUID() || !holder->IsSingleTarget())) + if (save && !holder->IsPassive() && !IsChanneledSpell(holder->GetSpellProto()) && (holder->GetCasterGuid() == GetObjectGuid() || !holder->IsSingleTarget())) { int32 damage[MAX_EFFECT_INDEX]; uint32 periodicTime[MAX_EFFECT_INDEX]; @@ -1412,7 +1412,7 @@ void Pet::_SaveAuras() if (Aura *aur = holder->GetAuraByEffectIndex(SpellEffectIndex(i))) { // don't save not own area auras - if (aur->IsAreaAura() && holder->GetCasterGUID() != GetGUID()) + if (aur->IsAreaAura() && holder->GetCasterGuid() != GetObjectGuid()) continue; damage[i] = aur->GetModifier()->m_amount; diff --git a/src/game/PetAI.h b/src/game/PetAI.h index 4bf1a3216..492a039ad 100644 --- a/src/game/PetAI.h +++ b/src/game/PetAI.h @@ -20,6 +20,7 @@ #define MANGOS_PETAI_H #include "CreatureAI.h" +#include "ObjectGuid.h" #include "Timer.h" class Creature; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 6f17a8c49..1d4823ff2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17391,7 +17391,7 @@ void Player::_SaveAuras() SpellAuraHolder *holder = itr->second; //skip all holders from spells that are passive or channeled //do not save single target holders (unless they were cast by the player) - if (!holder->IsPassive() && !IsChanneledSpell(holder->GetSpellProto()) && (holder->GetCasterGUID() == GetGUID() || !holder->IsSingleTarget())) + if (!holder->IsPassive() && !IsChanneledSpell(holder->GetSpellProto()) && (holder->GetCasterGuid() == GetObjectGuid() || !holder->IsSingleTarget())) { int32 damage[MAX_EFFECT_INDEX]; uint32 periodicTime[MAX_EFFECT_INDEX]; @@ -17405,7 +17405,7 @@ void Player::_SaveAuras() if (Aura *aur = holder->GetAuraByEffectIndex(SpellEffectIndex(i))) { // don't save not own area auras - if (aur->IsAreaAura() && holder->GetCasterGUID() != GetGUID()) + if (aur->IsAreaAura() && holder->GetCasterGuid() != GetObjectGuid()) continue; damage[i] = aur->GetModifier()->m_amount; @@ -20736,7 +20736,7 @@ void Player::RemoveItemDependentAurasAndCasts( Item * pItem ) // skip passive (passive item dependent spells work in another way) and not self applied auras SpellEntry const* spellInfo = holder->GetSpellProto(); - if(holder->IsPassive() || holder->GetCasterGUID()!=GetGUID()) + if(holder->IsPassive() || holder->GetCasterGuid() != GetObjectGuid()) { ++itr; continue; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 114734ad3..5547d4b97 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2876,7 +2876,7 @@ void Spell::cancel() { Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit && unit->isAlive()) - unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); + unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid()); } } @@ -3971,12 +3971,12 @@ void Spell::SendChannelUpdate(uint32 time) { if(time == 0) { - m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); + m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid()); ObjectGuid target_guid = m_caster->GetChannelObjectGuid(); if (target_guid != m_caster->GetObjectGuid() && target_guid.IsUnit()) if (Unit* target = ObjectAccessor::GetUnit(*m_caster, target_guid)) - target->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); + target->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid()); m_caster->SetChannelObjectGuid(ObjectGuid()); m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0); @@ -4561,7 +4561,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(non_caster_target) { // target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds - if (m_spellInfo->TargetAuraState && !target->HasAuraStateForCaster(AuraState(m_spellInfo->TargetAuraState), m_caster->GetGUID()) && + if (m_spellInfo->TargetAuraState && !target->HasAuraStateForCaster(AuraState(m_spellInfo->TargetAuraState), m_caster->GetObjectGuid()) && !m_caster->IsIgnoreUnitState(m_spellInfo, m_spellInfo->TargetAuraState == AURA_STATE_FROZEN ? IGNORE_UNIT_TARGET_NON_FROZEN : IGNORE_UNIT_TARGET_STATE)) return SPELL_FAILED_TARGET_AURASTATE; @@ -6561,7 +6561,7 @@ void Spell::DelayedChannel() if ((*ihit).missCondition == SPELL_MISS_NONE) { if (Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID)) - unit->DelaySpellAuraHolder(m_spellInfo->Id, delaytime, unit->GetGUID()); + unit->DelaySpellAuraHolder(m_spellInfo->Id, delaytime, unit->GetObjectGuid()); } } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index afcd17e00..6e3579d54 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -718,7 +718,7 @@ void AreaAura::Update(uint32 diff) if(actualSpellInfo != GetSpellProto()) actualBasePoints = actualSpellInfo->CalculateSimpleValue(m_effIndex); - SpellAuraHolder *holder = (*tIter)->GetSpellAuraHolder(actualSpellInfo->Id, GetCasterGUID()); + SpellAuraHolder *holder = (*tIter)->GetSpellAuraHolder(actualSpellInfo->Id, GetCasterGuid()); bool addedToExisting = true; if (!holder) @@ -763,7 +763,7 @@ void AreaAura::Update(uint32 diff) caster->IsFriendlyTo(target) != needFriendly ) { - target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(),GetCasterGUID()); + target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } else if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group { @@ -777,10 +777,10 @@ void AreaAura::Update(uint32 diff) { Player* checkTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); if(!checkTarget || !pGroup->SameSubGroup(check, checkTarget)) - target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(),GetCasterGUID()); + target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } else - target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(),GetCasterGUID()); + target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } } else if( m_areaAuraType == AREA_AURA_RAID) // TODO: fix me! @@ -795,16 +795,16 @@ void AreaAura::Update(uint32 diff) { Player* checkTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); if(!checkTarget) - target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGUID()); + target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } else - target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGUID()); + target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } } else if (m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER) { if (target->GetObjectGuid() != caster->GetCharmerOrOwnerGuid()) - target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGUID()); + target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } } } @@ -9405,13 +9405,13 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) else { if (spellId1) - m_target->RemoveAurasByCasterSpell(spellId1, GetCasterGUID()); + m_target->RemoveAurasByCasterSpell(spellId1, GetCasterGuid()); if (spellId2) - m_target->RemoveAurasByCasterSpell(spellId2, GetCasterGUID()); + m_target->RemoveAurasByCasterSpell(spellId2, GetCasterGuid()); if (spellId3) - m_target->RemoveAurasByCasterSpell(spellId3, GetCasterGUID()); + m_target->RemoveAurasByCasterSpell(spellId3, GetCasterGuid()); if (spellId4) - m_target->RemoveAurasByCasterSpell(spellId4, GetCasterGUID()); + m_target->RemoveAurasByCasterSpell(spellId4, GetCasterGuid()); } SetInUse(false); @@ -9464,7 +9464,7 @@ void SpellAuraHolder::Update(uint32 diff) Unit* caster = GetCaster(); if(!caster) { - m_target->RemoveAurasByCasterSpell(GetId(), GetCasterGUID()); + m_target->RemoveAurasByCasterSpell(GetId(), GetCasterGuid()); return; } diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index f771dd743..ae6310202 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -69,7 +69,6 @@ class MANGOS_DLL_SPEC SpellAuraHolder uint32 GetId() const { return m_spellProto->Id; } SpellEntry const* GetSpellProto() const { return m_spellProto; } - uint64 const& GetCasterGUID() const { return m_casterGuid.GetRawValue(); } ObjectGuid const& GetCasterGuid() const { return m_casterGuid; } void SetCasterGuid(ObjectGuid guid) { m_casterGuid = guid; } ObjectGuid const& GetCastItemGuid() const { return m_castItemGuid; } @@ -383,7 +382,6 @@ class MANGOS_DLL_SPEC Aura SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } ObjectGuid const& GetCastItemGuid() const { return GetHolder()->GetCastItemGuid(); } - uint64 const& GetCasterGUID() const { return GetHolder()->GetCasterGUID(); }//can't be easy replaced by GetCasterGuid until AuraHolders backporting ig we don't want create additional problems for this. ObjectGuid const& GetCasterGuid() const { return GetHolder()->GetCasterGuid(); } Unit* GetCaster() const { return GetHolder()->GetCaster(); } Unit* GetTarget() const { return GetHolder()->GetTarget(); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 3debf089c..3a9a8138f 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -527,7 +527,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) // Glyph of Conflagrate if (!m_caster->HasAura(56235)) - unitTarget->RemoveAurasByCasterSpell(aura->GetId(), m_caster->GetGUID()); + unitTarget->RemoveAurasByCasterSpell(aura->GetId(), m_caster->GetObjectGuid()); break; } } @@ -627,7 +627,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) } if (needConsume) - unitTarget->RemoveAuraHolderFromStack(spellId, doses, m_caster->GetGUID()); + unitTarget->RemoveAuraHolderFromStack(spellId, doses, m_caster->GetObjectGuid()); damage *= doses; damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * doses); @@ -3182,7 +3182,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } // consume diseases - unitTarget->RemoveAurasWithDispelType(DISPEL_DISEASE, m_caster->GetGUID()); + unitTarget->RemoveAurasWithDispelType(DISPEL_DISEASE, m_caster->GetObjectGuid()); } break; } @@ -4868,7 +4868,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) bool foundDispelled = false; for (std::list >::iterator success_iter = success_list.begin(); success_iter != success_list.end(); ++success_iter) { - if (success_iter->first->GetId() == holder->GetId() && success_iter->first->GetCasterGUID() == holder->GetCasterGUID()) + if (success_iter->first->GetId() == holder->GetId() && success_iter->first->GetCasterGuid() == holder->GetCasterGuid()) { success_iter->second += 1; foundDispelled = true; @@ -4894,7 +4894,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) SpellAuraHolder* dispelledHolder = j->first; data << uint32(dispelledHolder->GetId()); // Spell Id data << uint8(0); // 0 - dispelled !=0 cleansed - unitTarget->RemoveAuraHolderDueToSpellByDispel(dispelledHolder->GetId(), j->second, dispelledHolder->GetCasterGUID(), m_caster); + unitTarget->RemoveAuraHolderDueToSpellByDispel(dispelledHolder->GetId(), j->second, dispelledHolder->GetCasterGuid(), m_caster); } m_caster->SendMessageToSet(&data, true); @@ -7346,7 +7346,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); if(spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000002)) && - (*itr).second->GetCasterGUID() == m_caster->GetGUID()) + (*itr).second->GetCasterGuid() == m_caster->GetObjectGuid()) (*itr).second->RefreshHolder(); } return; @@ -7378,7 +7378,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); if (spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) && - (*itr).second->GetCasterGUID() == m_caster->GetGUID()) + (*itr).second->GetCasterGuid() == m_caster->GetObjectGuid()) { (*itr).second->RefreshHolder(); return; @@ -7407,7 +7407,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) for(Unit::SpellAuraHolderMap::iterator i = Auras.begin(); i != Auras.end(); ++i) { SpellAuraHolder *holder = i->second; - if (holder->GetCasterGUID() != m_caster->GetGUID()) + if (holder->GetCasterGuid() != m_caster->GetObjectGuid()) continue; // Search only Serpent Sting, Viper Sting, Scorpid Sting auras @@ -8821,7 +8821,8 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx) if(!unitTarget || unitTarget==m_caster) // can't steal from self return; - std::vector steal_list; + typedef std::vector StealList; + StealList steal_list; // Create dispel mask by dispel type uint32 dispelMask = GetDispellMask( DispelType(m_spellInfo->EffectMiscValue[eff_idx]) ); Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap(); @@ -8838,7 +8839,8 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx) // Ok if exist some buffs for dispel try dispel it if (!steal_list.empty()) { - std::list < std::pair > success_list; + typedef std::list < std::pair > SuccessList; + SuccessList success_list; int32 list_size = steal_list.size(); // Dispell N = damage buffs (or while exist buffs for dispel) for (int32 count=0; count < damage && list_size > 0; ++count) @@ -8847,13 +8849,13 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx) SpellAuraHolder *holder = steal_list[urand(0, list_size-1)]; // Not use chance for steal // TODO possible need do it - success_list.push_back( std::pair(holder->GetId(),holder->GetCasterGUID())); + success_list.push_back(SuccessList::value_type(holder->GetId(),holder->GetCasterGuid())); // Remove buff from list for prevent doubles - for (std::vector::iterator j = steal_list.begin(); j != steal_list.end(); ) + for (StealList::iterator j = steal_list.begin(); j != steal_list.end(); ) { SpellAuraHolder *stealed = *j; - if (stealed->GetId() == holder->GetId() && stealed->GetCasterGUID() == holder->GetCasterGUID()) + if (stealed->GetId() == holder->GetId() && stealed->GetCasterGuid() == holder->GetCasterGuid()) { j = steal_list.erase(j); --list_size; @@ -8872,7 +8874,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx) data << uint32(m_spellInfo->Id); // Dispell spell id data << uint8(0); // not used data << uint32(count); // count - for (std::list >::iterator j = success_list.begin(); j != success_list.end(); ++j) + for (SuccessList::iterator j = success_list.begin(); j != success_list.end(); ++j) { SpellEntry const* spellInfo = sSpellStore.LookupEntry(j->first); data << uint32(spellInfo->Id); // Spell Id diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 39af52b8e..772bacbad 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -479,7 +479,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) SpellAuraHolder *holder = _player->GetSpellAuraHolder(spellId); // not own area auras can't be cancelled (note: maybe need to check for aura on holder and not general on spell) - if (holder && holder->GetCasterGUID() != _player->GetGUID() && HasAreaAuraEffect(holder->GetSpellProto())) + if (holder && holder->GetCasterGuid() != _player->GetObjectGuid() && HasAreaAuraEffect(holder->GetSpellProto())) return; // non channeled case diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7feec356b..1ad6a17dd 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3994,10 +3994,10 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) for (SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; ++iter) { SpellAuraHolder *foundHolder = iter->second; - if(foundHolder->GetCasterGUID() == holder->GetCasterGUID()) + if (foundHolder->GetCasterGuid() == holder->GetCasterGuid()) { // Aura can stack on self -> Stack it; - if(aurSpellInfo->StackAmount) + if (aurSpellInfo->StackAmount) { // can be created with >1 stack by some spell mods foundHolder->ModStackAmount(holder->GetStackAmount()); @@ -4241,7 +4241,7 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder) // single allowed spell specific from same caster or from any caster at target bool is_spellSpecPerTargetPerCaster = IsSingleFromSpellSpecificPerTargetPerCaster(spellId_spec,i_spellId_spec); bool is_spellSpecPerTarget = IsSingleFromSpellSpecificPerTarget(spellId_spec,i_spellId_spec); - if (is_spellSpecPerTarget || (is_spellSpecPerTargetPerCaster && holder->GetCasterGUID() == (*i).second->GetCasterGUID())) + if (is_spellSpecPerTarget || (is_spellSpecPerTargetPerCaster && holder->GetCasterGuid() == (*i).second->GetCasterGuid())) { // cannot remove higher rank if (sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId)) @@ -4267,7 +4267,7 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder) // spell with spell specific that allow single ranks for spell from diff caster // same caster case processed or early or later bool is_spellPerTarget = IsSingleFromSpellSpecificSpellRanksPerTarget(spellId_spec,i_spellId_spec); - if ( is_spellPerTarget && holder->GetCasterGUID() != (*i).second->GetCasterGUID() && sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId)) + if ( is_spellPerTarget && holder->GetCasterGuid() != (*i).second->GetCasterGuid() && sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId)) { // cannot remove higher rank if(CompareAuraRanks(spellId, i_spellId) < 0) @@ -4351,12 +4351,12 @@ void Unit::RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except) ++iter; } } -void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID) +void Unit::RemoveAurasByCasterSpell(uint32 spellId, ObjectGuid casterGuid) { SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId); for(SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; ) { - if (iter->second->GetCasterGUID() == casterGUID) + if (iter->second->GetCasterGuid() == casterGuid) { RemoveSpellAuraHolder(iter->second); spair = GetSpellAuraHolderBounds(spellId); @@ -4367,13 +4367,13 @@ void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID) } } -void Unit::RemoveSingleAuraFromSpellAuraHolder(uint32 spellId, SpellEffectIndex effindex, uint64 casterGUID, AuraRemoveMode mode) +void Unit::RemoveSingleAuraFromSpellAuraHolder(uint32 spellId, SpellEffectIndex effindex, ObjectGuid casterGuid, AuraRemoveMode mode) { SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId); for(SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; ) { Aura *aur = iter->second->m_auras[effindex]; - if (aur && aur->GetCasterGUID() == casterGUID) + if (aur && aur->GetCasterGuid() == casterGuid) { RemoveSingleAuraFromSpellAuraHolder(iter->second, effindex, mode); spair = GetSpellAuraHolderBounds(spellId); @@ -4384,7 +4384,7 @@ void Unit::RemoveSingleAuraFromSpellAuraHolder(uint32 spellId, SpellEffectIndex } } -void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, uint64 casterGUID, Unit *dispeller) +void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, ObjectGuid casterGuid, Unit *dispeller) { SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId); @@ -4392,32 +4392,32 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount // Unstable Affliction if(spellEntry->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellEntry->SpellFamilyFlags & UI64LIT(0x010000000000))) { - if (Aura* dotAura = GetAura(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_WARLOCK,UI64LIT(0x010000000000),0x00000000,casterGUID)) + if (Aura* dotAura = GetAura(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_WARLOCK,UI64LIT(0x010000000000), 0x00000000, casterGuid)) { // use clean value for initial damage int32 damage = dotAura->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_0); damage *= 9; // Remove spell auras from stack - RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL); + RemoveAuraHolderFromStack(spellId, stackAmount, casterGuid, AURA_REMOVE_BY_DISPEL); // backfire damage and silence - dispeller->CastCustomSpell(dispeller, 31117, &damage, NULL, NULL, true, NULL, NULL, casterGUID); + dispeller->CastCustomSpell(dispeller, 31117, &damage, NULL, NULL, true, NULL, NULL, casterGuid); return; } } // Lifebloom else if (spellEntry->SpellFamilyName == SPELLFAMILY_DRUID && (spellEntry->SpellFamilyFlags & UI64LIT(0x0000001000000000))) { - if (Aura* dotAura = GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, UI64LIT(0x0000001000000000), 0x00000000, casterGUID)) + if (Aura* dotAura = GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, UI64LIT(0x0000001000000000), 0x00000000, casterGuid)) { int32 amount = ( dotAura->GetModifier()->m_amount / dotAura->GetStackAmount() ) * stackAmount; - CastCustomSpell(this, 33778, &amount, NULL, NULL, true, NULL, dotAura, casterGUID); + CastCustomSpell(this, 33778, &amount, NULL, NULL, true, NULL, dotAura, casterGuid); if (Unit* caster = dotAura->GetCaster()) { int32 returnmana = (spellEntry->ManaCostPercentage * caster->GetCreateMana() / 100) * stackAmount / 2; - caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, dotAura, casterGUID); + caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, dotAura, casterGuid); } } } @@ -4427,7 +4427,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount Unit* caster = NULL; uint32 triggeredSpell = 0; - if (Aura* dotAura = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, UI64LIT(0x10000000), 0x00000000, casterGUID)) + if (Aura* dotAura = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, UI64LIT(0x10000000), 0x00000000, casterGuid)) caster = dotAura->GetCaster(); if (caster && !caster->isDead()) @@ -4447,7 +4447,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount } // Remove spell auras from stack - RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL); + RemoveAuraHolderFromStack(spellId, stackAmount, casterGuid, AURA_REMOVE_BY_DISPEL); // Haste if (triggeredSpell) @@ -4457,7 +4457,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount // Vampiric touch (first dummy aura) else if (spellEntry->SpellFamilyName == SPELLFAMILY_PRIEST && spellEntry->SpellFamilyFlags & UI64LIT(0x0000040000000000)) { - if (Aura *dot = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, UI64LIT(0x0000040000000000), 0x00000000, casterGUID)) + if (Aura *dot = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, UI64LIT(0x0000040000000000), 0x00000000, casterGuid)) { if (dot->GetCaster()) { @@ -4466,20 +4466,20 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount bp0 *= 8; // Remove spell auras from stack - RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL); + RemoveAuraHolderFromStack(spellId, stackAmount, casterGuid, AURA_REMOVE_BY_DISPEL); - CastCustomSpell(this, 64085, &bp0, NULL, NULL, true, NULL, NULL, casterGUID); + CastCustomSpell(this, 64085, &bp0, NULL, NULL, true, NULL, NULL, casterGuid); return; } } } - RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL); + RemoveAuraHolderFromStack(spellId, stackAmount, casterGuid, AURA_REMOVE_BY_DISPEL); } -void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer) +void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, Unit *stealer) { - SpellAuraHolder *holder = GetSpellAuraHolder(spellId, casterGUID); + SpellAuraHolder *holder = GetSpellAuraHolder(spellId, casterGuid); SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId); SpellAuraHolder *new_holder = CreateSpellAuraHolder(spellProto, stealer, this); @@ -4532,16 +4532,16 @@ void Unit::RemoveAurasDueToSpellByCancel(uint32 spellId) } } -void Unit::RemoveAurasWithDispelType( DispelType type, uint64 casterGUID ) +void Unit::RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid) { // Create dispel mask by dispel type uint32 dispelMask = GetDispellMask(type); // Dispel all existing auras vs current dispel type SpellAuraHolderMap& auras = GetSpellAuraHolderMap(); - for(SpellAuraHolderMap::iterator itr = auras.begin(); itr != auras.end(); ) + for (SpellAuraHolderMap::iterator itr = auras.begin(); itr != auras.end(); ) { SpellEntry const* spell = itr->second->GetSpellProto(); - if( ((1<Dispel) & dispelMask) && (!casterGUID || casterGUID == itr->second->GetCasterGUID())) + if (((1<Dispel) & dispelMask) && (casterGuid.IsEmpty() || casterGuid == itr->second->GetCasterGuid())) { // Dispel aura RemoveAurasDueToSpell(spell->Id); @@ -4552,12 +4552,12 @@ void Unit::RemoveAurasWithDispelType( DispelType type, uint64 casterGUID ) } } -void Unit::RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount, uint64 casterGUID, AuraRemoveMode mode) +void Unit::RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount, ObjectGuid casterGuid, AuraRemoveMode mode) { SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId); - for(SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; ++iter) + for (SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; ++iter) { - if (!casterGUID || iter->second->GetCasterGUID() == casterGUID) + if (casterGuid.IsEmpty() || iter->second->GetCasterGuid() == casterGuid) { if (iter->second->ModStackAmount(-int32(stackAmount))) { @@ -4671,7 +4671,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase) // remove from target if target found if (Unit* itr_target = GetMap()->GetUnit(itr_targetGuid)) - itr_target->RemoveAurasByCasterSpell(itr_spellEntry->Id, GetGUID()); + itr_target->RemoveAurasByCasterSpell(itr_spellEntry->Id, GetObjectGuid()); itr = scTargets.begin(); // list can be changed at remove aura continue; @@ -4685,7 +4685,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase) // remove from target if target found if (itr_target) - itr_target->RemoveAurasByCasterSpell(itr_spellEntry->Id, GetGUID()); + itr_target->RemoveAurasByCasterSpell(itr_spellEntry->Id, GetObjectGuid()); itr = scTargets.begin(); // list can be changed at remove aura continue; @@ -4858,14 +4858,14 @@ void Unit::RemoveAllAurasOnDeath() } } -void Unit::DelaySpellAuraHolder(uint32 spellId, int32 delaytime, uint64 casterGUID) +void Unit::DelaySpellAuraHolder(uint32 spellId, int32 delaytime, ObjectGuid casterGuid) { SpellAuraHolderBounds bounds = GetSpellAuraHolderBounds(spellId); for (SpellAuraHolderMap::iterator iter = bounds.first; iter != bounds.second; ++iter) { SpellAuraHolder* holder = iter->second; - if (casterGUID != holder->GetCasterGUID()) + if (casterGuid != holder->GetCasterGuid()) continue; if (holder->GetAuraDuration() < delaytime) @@ -5763,19 +5763,19 @@ void Unit::RemoveAllAttackers() } } -bool Unit::HasAuraStateForCaster(AuraState flag, uint64 caster) const +bool Unit::HasAuraStateForCaster(AuraState flag, ObjectGuid casterGuid) const { - if(!HasAuraState(flag)) + if (!HasAuraState(flag)) return false; // single per-caster aura state - if(flag == AURA_STATE_CONFLAGRATE) + if (flag == AURA_STATE_CONFLAGRATE) { Unit::AuraList const& dotList = GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator i = dotList.begin(); i != dotList.end(); ++i) + for (Unit::AuraList::const_iterator i = dotList.begin(); i != dotList.end(); ++i) { if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && - (*i)->GetCasterGUID() == caster && + (*i)->GetCasterGuid() == casterGuid && // Immolate (((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000004)) || // Shadowflame @@ -10734,11 +10734,17 @@ bool Unit::CheckAndIncreaseCastCounter() return true; } -SpellAuraHolder* Unit::GetSpellAuraHolder (uint32 spellid, uint64 casterGUID) +SpellAuraHolder* Unit::GetSpellAuraHolder (uint32 spellid) const { - SpellAuraHolderBounds bounds = GetSpellAuraHolderBounds(spellid); + SpellAuraHolderMap::const_iterator itr = m_spellAuraHolders.find(spellid); + return itr != m_spellAuraHolders.end() ? itr->second : NULL; +} + +SpellAuraHolder* Unit::GetSpellAuraHolder (uint32 spellid, ObjectGuid casterGuid) const +{ + SpellAuraHolderConstBounds bounds = GetSpellAuraHolderBounds(spellid); for (SpellAuraHolderMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter) - if (!casterGUID || iter->second->GetCasterGUID() == casterGUID) + if (iter->second->GetCasterGuid() == casterGuid) return iter->second; return NULL; diff --git a/src/game/Unit.h b/src/game/Unit.h index 8adbf60f6..d9f65148a 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1571,13 +1571,13 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except = NULL); void RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveSingleAuraFromSpellAuraHolder(SpellAuraHolder *holder, SpellEffectIndex index, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveSingleAuraFromSpellAuraHolder(uint32 id, SpellEffectIndex index, uint64 casterGUID, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveSingleAuraFromSpellAuraHolder(uint32 id, SpellEffectIndex index, ObjectGuid casterGuid, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); // removing specific aura stacks by diff reasons and selections void RemoveAurasDueToSpell(uint32 spellId, SpellAuraHolder* except = NULL, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); - void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID); - void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); + void RemoveAurasByCasterSpell(uint32 spellId, ObjectGuid casterGuid); + void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, Unit *stealer); void RemoveAurasDueToSpellByCancel(uint32 spellId); // removing unknown aura stacks by diff reasons and selections @@ -1589,16 +1589,16 @@ class MANGOS_DLL_SPEC Unit : public WorldObject bool RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder); void RemoveAurasWithInterruptFlags(uint32 flags); void RemoveAurasWithAttribute(uint32 flags); - void RemoveAurasWithDispelType( DispelType type, uint64 casterGUID = 0 ); + void RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid = ObjectGuid()); void RemoveAllAuras(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveArenaAuras(bool onleave = false); void RemoveAllAurasOnDeath(); // removing specific aura FROM stack by diff reasons and selections - void RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount = 1, uint64 casterGUID = 0, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, uint64 casterGUID, Unit *dispeller); + void RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount = 1, ObjectGuid casterGuid = ObjectGuid(), AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, ObjectGuid casterGuid, Unit *dispeller); - void DelaySpellAuraHolder(uint32 spellId, int32 delaytime, uint64 casterGUID); + void DelaySpellAuraHolder(uint32 spellId, int32 delaytime, ObjectGuid casterGuid); float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school ); } void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school,val); } @@ -1757,7 +1757,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject Aura* GetAura(uint32 spellId, SpellEffectIndex effindex); Aura* GetAura(AuraType type, SpellFamily family, uint64 familyFlag, uint32 familyFlag2 = 0, ObjectGuid casterGuid = ObjectGuid()); - SpellAuraHolder* GetSpellAuraHolder (uint32 spellid, uint64 casterGUID = 0); + SpellAuraHolder* GetSpellAuraHolder (uint32 spellid) const; + SpellAuraHolder* GetSpellAuraHolder (uint32 spellid, ObjectGuid casterGUID) const; SpellAuraHolderMap & GetSpellAuraHolderMap() { return m_spellAuraHolders; } SpellAuraHolderMap const& GetSpellAuraHolderMap() const { return m_spellAuraHolders; } @@ -1813,7 +1814,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject float GetAPMultiplier(WeaponAttackType attType, bool normalized); void ModifyAuraState(AuraState flag, bool apply); bool HasAuraState(AuraState flag) const { return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1)); } - bool HasAuraStateForCaster(AuraState flag, uint64 caster) const; + bool HasAuraStateForCaster(AuraState flag, ObjectGuid casterGuid) const; void UnsummonAllTotems(); Unit* SelectMagnetTarget(Unit *victim, Spell* spell = NULL, SpellEffectIndex eff = EFFECT_INDEX_0); diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index d4ace8b39..21117bd37 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -3731,10 +3731,10 @@ SpellAuraProcResult Unit::HandleMendingAuraProc( Unit* /*pVictim*/, uint32 /*dam // remove before apply next (locked against deleted) triggeredByAura->SetInUse(true); - RemoveAurasByCasterSpell(spellProto->Id,caster->GetGUID()); + RemoveAurasByCasterSpell(spellProto->Id,caster->GetObjectGuid()); caster->AddSpellMod(mod, true); - CastCustomSpell(target,spellProto->Id,&heal,NULL,NULL,true,NULL,triggeredByAura,caster->GetGUID()); + CastCustomSpell(target, spellProto->Id, &heal, NULL, NULL, true, NULL, triggeredByAura, caster->GetObjectGuid()); caster->AddSpellMod(mod, false); triggeredByAura->SetInUse(false); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3b1c4842d..367d18d2e 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 "11458" + #define REVISION_NR "11459" #endif // __REVISION_NR_H__