From 957c9331a914bfeba573f2655278edecddc63f84 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 2 Dec 2010 07:59:21 +0300 Subject: [PATCH] [10813] Use ObjectGuid for aura holder cast item guid. Still exist 7 GUID_LOPART uses in code. --- src/game/Pet.cpp | 2 +- src/game/Player.cpp | 4 ++-- src/game/SpellAuras.cpp | 12 ++++++------ src/game/SpellAuras.h | 8 ++++---- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 4c7410d6b..4e99b3524 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1343,7 +1343,7 @@ void Pet::_SaveAuras() CharacterDatabase.PExecute("INSERT INTO pet_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, basepoints0, basepoints1, basepoints2, maxduration0, maxduration1, maxduration2, remaintime0, remaintime1, remaintime2, effIndexMask) VALUES " "('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%u')", - m_charmInfo->GetPetNumber(), holder->GetCasterGUID(), GUID_LOPART(holder->GetCastItemGUID()), holder->GetId(), holder->GetStackAmount(), holder->GetAuraCharges(), + m_charmInfo->GetPetNumber(), holder->GetCasterGuid().GetRawValue(), holder->GetCastItemGuid().GetCounter(), holder->GetId(), holder->GetStackAmount(), holder->GetAuraCharges(), damage[EFFECT_INDEX_0], damage[EFFECT_INDEX_1], damage[EFFECT_INDEX_2], maxduration[EFFECT_INDEX_0], maxduration[EFFECT_INDEX_1], maxduration[EFFECT_INDEX_2], remaintime[EFFECT_INDEX_0], remaintime[EFFECT_INDEX_1], remaintime[EFFECT_INDEX_2], diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5260b2902..e66d52bcb 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7370,7 +7370,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellInfo->Id); for (SpellAuraHolderMap::const_iterator iter = spair.first; iter != spair.second; ++iter) { - if(!item || iter->second->GetCastItemGUID() == item->GetGUID()) + if(!item || iter->second->GetCastItemGuid() == item->GetObjectGuid()) { found = true; break; @@ -17144,7 +17144,7 @@ void Player::_SaveAuras() CharacterDatabase.PExecute("INSERT INTO character_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, basepoints0, basepoints1, basepoints2, maxduration0, maxduration1, maxduration2, remaintime0, remaintime1, remaintime2, effIndexMask) VALUES " "('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%u')", - GetGUIDLow(), holder->GetCasterGUID(), GUID_LOPART(holder->GetCastItemGUID()), holder->GetId(), holder->GetStackAmount(), holder->GetAuraCharges(), + GetGUIDLow(), holder->GetCasterGuid().GetRawValue(), holder->GetCastItemGuid().GetCounter(), holder->GetId(), holder->GetStackAmount(), holder->GetAuraCharges(), damage[EFFECT_INDEX_0], damage[EFFECT_INDEX_1], damage[EFFECT_INDEX_2], maxduration[EFFECT_INDEX_0], maxduration[EFFECT_INDEX_1], maxduration[EFFECT_INDEX_2], remaintime[EFFECT_INDEX_0], remaintime[EFFECT_INDEX_1], remaintime[EFFECT_INDEX_2], diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a57b0bc8a..09cace496 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -971,7 +971,7 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) { // only applied by self or aura caster if (itr->second->GetCasterGuid() == target->GetObjectGuid()) - affectedSelf[itr->second->GetId()] = itr->second->GetCastItemGUID(); + affectedSelf[itr->second->GetId()] = itr->second->GetCastItemGuid(); else if (itr->second->GetCasterGuid() == GetCasterGuid()) affectedAuraCaster.insert(itr->second->GetId()); } @@ -7762,7 +7762,7 @@ bool Aura::IsLastAuraOnHolder() } SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem) : -m_target(target), m_castItemGuid(castItem?castItem->GetGUID():0), +m_target(target), m_castItemGuid(castItem ? castItem->GetObjectGuid() : ObjectGuid()), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), m_stackAmount(1), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) @@ -7863,7 +7863,7 @@ void SpellAuraHolder::_AddSpellAuraHolder() { if (m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE) { - Item* castItem = m_castItemGuid ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL; + Item* castItem = !m_castItemGuid.IsEmpty() ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL; ((Player*)caster)->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true); } } @@ -8159,7 +8159,7 @@ Unit* SpellAuraHolder::GetCaster() const bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref) { // only item casted spells - if (!GetCastItemGUID()) + if (GetCastItemGuid().IsEmpty()) return false; // Exclude Debuffs @@ -8178,7 +8178,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref) if (m_target->GetTypeId() != TYPEID_PLAYER || m_target->GetObjectGuid() != GetCasterGuid()) return false; - Item* castItem = ((Player*)m_target)->GetItemByGuid(GetCastItemGUID()); + Item* castItem = ((Player*)m_target)->GetItemByGuid(GetCastItemGuid()); if (!castItem) return false; @@ -8188,7 +8188,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref) return false; // form different weapons - return ref->GetCastItemGUID() && ref->GetCastItemGUID() != GetCastItemGUID(); + return !ref->GetCastItemGuid().IsEmpty() && ref->GetCastItemGuid() != GetCastItemGuid(); } bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index cf1607db6..271457bed 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -71,7 +71,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder uint64 const& GetCasterGUID() const { return m_casterGuid.GetRawValue(); } ObjectGuid const& GetCasterGuid() const { return m_casterGuid; } void SetCasterGuid(ObjectGuid guid) { m_casterGuid = guid; } - uint64 GetCastItemGUID() const { return m_castItemGuid; } + ObjectGuid const& GetCastItemGuid() const { return m_castItemGuid; } Unit* GetCaster() const; Unit* GetTarget() const { return m_target; } void SetTarget(Unit* target) { m_target = target; } @@ -148,7 +148,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder void SetLoadedState(ObjectGuid casterGUID, ObjectGuid itemGUID, int32 stackAmount, int32 charges) { m_casterGuid = casterGUID; - m_castItemGuid = itemGUID.GetRawValue(); + m_castItemGuid = itemGUID; m_procCharges = charges; m_stackAmount = stackAmount; } @@ -160,7 +160,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder private: Unit* m_target; ObjectGuid m_casterGuid; - uint64 m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted + ObjectGuid m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted time_t m_applyTime; SpellEntry const* m_spellProto; @@ -375,7 +375,7 @@ class MANGOS_DLL_SPEC Aura SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } - uint64 GetCastItemGUID() const { return GetHolder()->GetCastItemGUID(); } + uint64 GetCastItemGUID() const { return GetHolder()->GetCastItemGuid().GetRawValue(); } 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 GetCasterGuid() const { return GetHolder()->GetCasterGuid(); } Unit* GetCaster() const { return GetHolder()->GetCaster(); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 804dce95d..7d643382e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4579,7 +4579,7 @@ void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId) SpellAuraHolderBounds bounds = GetSpellAuraHolderBounds(spellId); for (SpellAuraHolderMap::iterator iter = bounds.first; iter != bounds.second; ) { - if (iter->second->GetCastItemGUID() == castItem->GetGUID()) + if (iter->second->GetCastItemGuid() == castItem->GetObjectGuid()) { RemoveSpellAuraHolder(iter->second); bounds = GetSpellAuraHolderBounds(spellId); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e5262c87a..58d2fe710 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 "10812" + #define REVISION_NR "10813" #endif // __REVISION_NR_H__