From 87b8a1d1ceb4fbded8fef68c8438c4c55c1149b4 Mon Sep 17 00:00:00 2001 From: "C:/Program Files (x86)/git/dev/rsa" Date: Fri, 19 Nov 2010 15:25:01 +0300 Subject: [PATCH] [10745] Use ObjectGuid in spellauraholders instead uint64 (based on rsa's repo commit 06342c1) Signed-off-by: VladimirMangos --- src/game/Player.cpp | 4 +-- src/game/SpellAuras.cpp | 54 ++++++++++++++++++++-------------------- src/game/SpellAuras.h | 15 +++++------ src/shared/revision_nr.h | 2 +- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index dfb2d32ec..920a377d7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15748,7 +15748,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) do { Field *fields = result->Fetch(); - uint64 caster_guid = fields[0].GetUInt64(); + ObjectGuid caster_guid = fields[0].GetUInt64(); uint32 item_lowguid = fields[1].GetUInt64(); uint32 spellid = fields[2].GetUInt32(); uint32 stackcount = fields[3].GetUInt32(); @@ -15808,7 +15808,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) if (!holder->IsEmptyHolder()) { // reset stolen single target auras - if (caster_guid != GetGUID() && holder->IsSingleTarget()) + if (caster_guid != GetObjectGuid() && holder->IsSingleTarget()) holder->SetIsSingleTarget(false); holder->SetLoadedState(caster_guid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 57b791b11..be5e8285a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -744,7 +744,7 @@ void AreaAura::Update(uint32 diff) break; case AREA_AURA_RAID: // non caster self-casted auras (stacked from diff. casters) - if(aur->GetModifier()->m_auraname != SPELL_AURA_NONE || i->second->GetCasterGUID() == GetCasterGUID()) + if(aur->GetModifier()->m_auraname != SPELL_AURA_NONE || i->second->GetCasterGuid() == GetCasterGuid()) apply = false; break; default: @@ -970,9 +970,9 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) isAffectedOnSpell(itr->second->GetSpellProto())) { // only applied by self or aura caster - if (itr->second->GetCasterGUID() == target->GetGUID()) + if (itr->second->GetCasterGuid() == target->GetObjectGuid()) affectedSelf[itr->second->GetId()] = itr->second->GetCastItemGUID(); - else if (itr->second->GetCasterGUID() == GetCasterGUID()) + else if (itr->second->GetCasterGuid() == GetCasterGuid()) affectedAuraCaster.insert(itr->second->GetId()); } } @@ -7756,7 +7756,7 @@ bool Aura::IsLastAuraOnHolder() } SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem) : -m_target(target), m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), +m_target(target), m_castItemGuid(castItem?castItem->GetGUID():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_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) @@ -7765,12 +7765,12 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element"); if(!caster) - m_caster_guid = target->GetGUID(); + m_casterGuid = target->GetObjectGuid(); else { // remove this assert when not unit casters will be supported MANGOS_ASSERT(caster->GetObjectGuid().IsUnit()) - m_caster_guid = caster->GetGUID(); + m_casterGuid = caster->GetObjectGuid(); } m_applyTime = time(NULL); @@ -7782,7 +7782,7 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) if (GetSpellMaxDuration(m_spellProto) == -1 || (m_isPassive && m_spellProto->DurationIndex == 0)) m_permanent = true; - m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && + m_isRemovedOnShapeLost = (GetCasterGuid() == m_target->GetObjectGuid() && m_spellProto->Stances && !(m_spellProto->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && !(m_spellProto->Attributes & SPELL_ATTR_NOT_SHAPESHIFT)); @@ -7868,7 +7868,7 @@ void SpellAuraHolder::_AddSpellAuraHolder() if (m_auras[i]) flags |= (1 << i); } - flags |= ((GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_NOT_CASTER : AFLAG_NONE) | ((GetSpellMaxDuration(m_spellProto) > 0) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE); + flags |= ((GetCasterGuid() == GetTarget()->GetObjectGuid()) ? AFLAG_NOT_CASTER : AFLAG_NONE) | ((GetSpellMaxDuration(m_spellProto) > 0) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE); SetAuraFlags(flags); SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)); @@ -8141,12 +8141,12 @@ void SpellAuraHolder::SetStackAmount(uint32 stackAmount) Unit* SpellAuraHolder::GetCaster() const { - if(m_caster_guid == m_target->GetGUID()) + if(GetCasterGuid() == m_target->GetObjectGuid()) return m_target; //return ObjectAccessor::GetUnit(*m_target,m_caster_guid); //must return caster even if it's in another grid/map - Unit *unit = ObjectAccessor::GetUnitInWorld(*m_target,m_caster_guid); + Unit *unit = ObjectAccessor::GetUnitInWorld(*m_target, m_casterGuid); return unit && unit->IsInWorld() ? unit : NULL; } @@ -8169,7 +8169,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref) return false; // only self applied player buffs - if (m_target->GetTypeId() != TYPEID_PLAYER || m_target->GetGUID() != GetCasterGUID()) + if (m_target->GetTypeId() != TYPEID_PLAYER || m_target->GetObjectGuid() != GetCasterGuid()) return false; Item* castItem = ((Player*)m_target)->GetItemByGuid(GetCastItemGUID()); @@ -8222,7 +8222,7 @@ void SpellAuraHolder::SendAuraUpdate(bool remove) if(!(auraFlags & AFLAG_NOT_CASTER)) { - data.appendPackGUID(GetCasterGUID()); + data << GetCasterGuid().WriteAsPacked(); } if(auraFlags & AFLAG_DURATION) @@ -8369,7 +8369,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // If target still has one of Warrior's bleeds, do nothing Unit::AuraList const& PeriodicDamage = m_target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator i = PeriodicDamage.begin(); i != PeriodicDamage.end(); ++i) - if( (*i)->GetCasterGUID() == GetCasterGUID() && + if( (*i)->GetCasterGuid() == GetCasterGuid() && (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARRIOR && (*i)->GetSpellProto()->Mechanic == MECHANIC_BLEED) return; @@ -8608,7 +8608,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // Only process on player casting paladin aura // all aura bonuses applied also in aura area effect way to caster - if (GetCasterGUID() != m_target->GetGUID() || !IS_PLAYER_GUID(GetCasterGUID())) + if (GetCasterGuid() != m_target->GetObjectGuid() || !GetCasterGuid().IsPlayer()) return; if (GetSpellSpecific(m_spellProto->Id) != SPELL_AURA) @@ -8655,7 +8655,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) } if (heal_pct) - m_target->CastCustomSpell(m_target, 63611, &heal_pct, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + m_target->CastCustomSpell(m_target, 63611, &heal_pct, NULL, NULL, true, NULL, NULL, GetCasterGuid()); else m_target->RemoveAurasDueToSpell(63611); } @@ -8706,7 +8706,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) } if (stamina_pct) - m_target->CastCustomSpell(m_target, 61261, &stamina_pct, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + m_target->CastCustomSpell(m_target, 61261, &stamina_pct, NULL, NULL, true, NULL, NULL, GetCasterGuid()); else m_target->RemoveAurasDueToSpell(61261); } @@ -8735,8 +8735,8 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (power_pct) { int32 bp = 5; - m_target->CastCustomSpell(m_target, 63622, &bp, &bp, &bp, true, NULL, NULL, GetCasterGUID()); - m_target->CastCustomSpell(m_target, 65095, &bp, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + m_target->CastCustomSpell(m_target, 63622, &bp, &bp, &bp, true, NULL, NULL, GetCasterGuid()); + m_target->CastCustomSpell(m_target, 65095, &bp, NULL, NULL, true, NULL, NULL, GetCasterGuid()); } else { @@ -8759,7 +8759,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) return; int32 bp = aura->GetModifier()->m_amount; - m_target->CastCustomSpell(m_target, 63611, &bp, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + m_target->CastCustomSpell(m_target, 63611, &bp, NULL, NULL, true, NULL, NULL, GetCasterGuid()); } else m_target->RemoveAurasDueToSpell(63611); @@ -8777,7 +8777,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) return; int32 bp = aura->GetModifier()->m_amount; - m_target->CastCustomSpell(m_target, 61261, &bp, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + m_target->CastCustomSpell(m_target, 61261, &bp, NULL, NULL, true, NULL, NULL, GetCasterGuid()); } else m_target->RemoveAurasDueToSpell(61261); @@ -8791,8 +8791,8 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (apply && m_target->HasAura(48265)) { int32 bp = 5; - m_target->CastCustomSpell(m_target, 63622, &bp, &bp, &bp, true, NULL, NULL, GetCasterGUID()); - m_target->CastCustomSpell(m_target, 65095, &bp, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + m_target->CastCustomSpell(m_target, 63622, &bp, &bp, &bp, true, NULL, NULL, GetCasterGuid()); + m_target->CastCustomSpell(m_target, 65095, &bp, NULL, NULL, true, NULL, NULL, GetCasterGuid()); } else { @@ -8819,13 +8819,13 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (apply || cast_at_remove) { if (spellId1) - m_target->CastSpell(m_target, spellId1, true, NULL, NULL, GetCasterGUID()); + m_target->CastSpell(m_target, spellId1, true, NULL, NULL, GetCasterGuid()); if (spellId2 && !IsDeleted()) - m_target->CastSpell(m_target, spellId2, true, NULL, NULL, GetCasterGUID()); + m_target->CastSpell(m_target, spellId2, true, NULL, NULL, GetCasterGuid()); if (spellId3 && !IsDeleted()) - m_target->CastSpell(m_target, spellId3, true, NULL, NULL, GetCasterGUID()); + m_target->CastSpell(m_target, spellId3, true, NULL, NULL, GetCasterGuid()); if (spellId4 && !IsDeleted()) - m_target->CastSpell(m_target, spellId4, true, NULL, NULL, GetCasterGUID()); + m_target->CastSpell(m_target, spellId4, true, NULL, NULL, GetCasterGuid()); } else { @@ -8857,7 +8857,7 @@ void SpellAuraHolder::Update(uint32 diff) aura->UpdateAura(diff); // Channeled aura required check distance from caster - if(IsChanneledSpell(m_spellProto) && m_caster_guid != m_target->GetGUID()) + if(IsChanneledSpell(m_spellProto) && GetCasterGuid() != m_target->GetObjectGuid()) { Unit* caster = GetCaster(); if(!caster) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 2b8d1a621..cf1607db6 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -68,8 +68,9 @@ 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_caster_guid; } - void SetCasterGUID(uint64 guid) { m_caster_guid = guid; } + 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; } Unit* GetCaster() const; Unit* GetTarget() const { return m_target; } @@ -105,7 +106,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder void UpdateHolder(uint32 diff) { SetInUse(true); Update(diff); SetInUse(false); } void Update(uint32 diff); void RefreshHolder(); - + bool IsSingleTarget() {return m_isSingleTarget; } void SetIsSingleTarget(bool val) { m_isSingleTarget = val; } void UnregisterSingleCastHolder(); @@ -144,9 +145,9 @@ class MANGOS_DLL_SPEC SpellAuraHolder void SetVisibleAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); } void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; } - void SetLoadedState(uint64 casterGUID, ObjectGuid itemGUID, int32 stackAmount, int32 charges) + void SetLoadedState(ObjectGuid casterGUID, ObjectGuid itemGUID, int32 stackAmount, int32 charges) { - m_caster_guid = casterGUID; + m_casterGuid = casterGUID; m_castItemGuid = itemGUID.GetRawValue(); m_procCharges = charges; m_stackAmount = stackAmount; @@ -158,7 +159,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder ~SpellAuraHolder(); private: Unit* m_target; - uint64 m_caster_guid; + ObjectGuid m_casterGuid; uint64 m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted time_t m_applyTime; @@ -376,7 +377,7 @@ class MANGOS_DLL_SPEC Aura uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } uint64 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 GetCasterGuid() const { return GetHolder()->GetCasterGUID(); } + ObjectGuid GetCasterGuid() const { return GetHolder()->GetCasterGuid(); } Unit* GetCaster() const { return GetHolder()->GetCaster(); } Unit* GetTarget() const { return GetHolder()->GetTarget(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2632e0251..c222bfe47 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 "10744" + #define REVISION_NR "10745" #endif // __REVISION_NR_H__