[10813] Use ObjectGuid for aura holder cast item guid.

Still exist 7 GUID_LOPART uses in code.
This commit is contained in:
VladimirMangos 2010-12-02 07:59:21 +03:00
parent 0a964e43a9
commit 957c9331a9
6 changed files with 15 additions and 15 deletions

View file

@ -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 " 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')", "('%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], damage[EFFECT_INDEX_0], damage[EFFECT_INDEX_1], damage[EFFECT_INDEX_2],
maxduration[EFFECT_INDEX_0], maxduration[EFFECT_INDEX_1], maxduration[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], remaintime[EFFECT_INDEX_0], remaintime[EFFECT_INDEX_1], remaintime[EFFECT_INDEX_2],

View file

@ -7370,7 +7370,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellInfo->Id); SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellInfo->Id);
for (SpellAuraHolderMap::const_iterator iter = spair.first; iter != spair.second; ++iter) 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; found = true;
break; 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 " 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')", "('%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], damage[EFFECT_INDEX_0], damage[EFFECT_INDEX_1], damage[EFFECT_INDEX_2],
maxduration[EFFECT_INDEX_0], maxduration[EFFECT_INDEX_1], maxduration[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], remaintime[EFFECT_INDEX_0], remaintime[EFFECT_INDEX_1], remaintime[EFFECT_INDEX_2],

View file

@ -971,7 +971,7 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode )
{ {
// only applied by self or aura caster // only applied by self or aura caster
if (itr->second->GetCasterGuid() == target->GetObjectGuid()) 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()) else if (itr->second->GetCasterGuid() == GetCasterGuid())
affectedAuraCaster.insert(itr->second->GetId()); affectedAuraCaster.insert(itr->second->GetId());
} }
@ -7762,7 +7762,7 @@ bool Aura::IsLastAuraOnHolder()
} }
SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem) : 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_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_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) 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) 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); ((Player*)caster)->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true);
} }
} }
@ -8159,7 +8159,7 @@ Unit* SpellAuraHolder::GetCaster() const
bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref) bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref)
{ {
// only item casted spells // only item casted spells
if (!GetCastItemGUID()) if (GetCastItemGuid().IsEmpty())
return false; return false;
// Exclude Debuffs // Exclude Debuffs
@ -8178,7 +8178,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref)
if (m_target->GetTypeId() != TYPEID_PLAYER || m_target->GetObjectGuid() != GetCasterGuid()) if (m_target->GetTypeId() != TYPEID_PLAYER || m_target->GetObjectGuid() != GetCasterGuid())
return false; return false;
Item* castItem = ((Player*)m_target)->GetItemByGuid(GetCastItemGUID()); Item* castItem = ((Player*)m_target)->GetItemByGuid(GetCastItemGuid());
if (!castItem) if (!castItem)
return false; return false;
@ -8188,7 +8188,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref)
return false; return false;
// form different weapons // form different weapons
return ref->GetCastItemGUID() && ref->GetCastItemGUID() != GetCastItemGUID(); return !ref->GetCastItemGuid().IsEmpty() && ref->GetCastItemGuid() != GetCastItemGuid();
} }
bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const

View file

@ -71,7 +71,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder
uint64 const& GetCasterGUID() const { return m_casterGuid.GetRawValue(); } uint64 const& GetCasterGUID() const { return m_casterGuid.GetRawValue(); }
ObjectGuid const& GetCasterGuid() const { return m_casterGuid; } ObjectGuid const& GetCasterGuid() const { return m_casterGuid; }
void SetCasterGuid(ObjectGuid guid) { m_casterGuid = guid; } void SetCasterGuid(ObjectGuid guid) { m_casterGuid = guid; }
uint64 GetCastItemGUID() const { return m_castItemGuid; } ObjectGuid const& GetCastItemGuid() const { return m_castItemGuid; }
Unit* GetCaster() const; Unit* GetCaster() const;
Unit* GetTarget() const { return m_target; } Unit* GetTarget() const { return m_target; }
void SetTarget(Unit* target) { m_target = 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) void SetLoadedState(ObjectGuid casterGUID, ObjectGuid itemGUID, int32 stackAmount, int32 charges)
{ {
m_casterGuid = casterGUID; m_casterGuid = casterGUID;
m_castItemGuid = itemGUID.GetRawValue(); m_castItemGuid = itemGUID;
m_procCharges = charges; m_procCharges = charges;
m_stackAmount = stackAmount; m_stackAmount = stackAmount;
} }
@ -160,7 +160,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder
private: private:
Unit* m_target; Unit* m_target;
ObjectGuid m_casterGuid; 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; time_t m_applyTime;
SpellEntry const* m_spellProto; SpellEntry const* m_spellProto;
@ -375,7 +375,7 @@ class MANGOS_DLL_SPEC Aura
SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); }
uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } 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. 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(); } ObjectGuid GetCasterGuid() const { return GetHolder()->GetCasterGuid(); }
Unit* GetCaster() const { return GetHolder()->GetCaster(); } Unit* GetCaster() const { return GetHolder()->GetCaster(); }

View file

@ -4579,7 +4579,7 @@ void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
SpellAuraHolderBounds bounds = GetSpellAuraHolderBounds(spellId); SpellAuraHolderBounds bounds = GetSpellAuraHolderBounds(spellId);
for (SpellAuraHolderMap::iterator iter = bounds.first; iter != bounds.second; ) for (SpellAuraHolderMap::iterator iter = bounds.first; iter != bounds.second; )
{ {
if (iter->second->GetCastItemGUID() == castItem->GetGUID()) if (iter->second->GetCastItemGuid() == castItem->GetObjectGuid())
{ {
RemoveSpellAuraHolder(iter->second); RemoveSpellAuraHolder(iter->second);
bounds = GetSpellAuraHolderBounds(spellId); bounds = GetSpellAuraHolderBounds(spellId);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10812" #define REVISION_NR "10813"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__