Core/Entities: Use ObjectGuid class in game project

This commit is contained in:
Shauren committed 2014-09-14 16:14:12 +02:00
1 parent ce67a097bf
commit a0e50ea35f
256 files changed
+3334 -3833

No files matched your search

+119 -128
View File
@@ -158,7 +158,7 @@ ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget,
Unit::Unit(bool isWorldObject) :
WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0),
IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0),
IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(),
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()),
i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0),
m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this),
@@ -189,10 +189,10 @@ Unit::Unit(bool isWorldObject) :
m_currentSpells[i] = NULL;
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
m_SummonSlot[i] = 0;
m_SummonSlot[i].Clear();
for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
m_ObjectSlot[i] = 0;
m_ObjectSlot[i].Clear();
m_auraUpdateIterator = m_ownedAuras.end();
@@ -831,7 +831,7 @@ void Unit::CastStop(uint32 except_spellid)
InterruptSpell(CurrentSpellTypes(i), false);
}
void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
if (!spellInfo)
{
@@ -853,12 +853,12 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo
spell->prepare(&targets, triggeredByAura);
}
void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -870,19 +870,19 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags
CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/)
{
CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellCastTargets targets;
targets.SetUnitTarget(victim);
CastSpell(targets, spellInfo, NULL, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
if (bp0)
@@ -894,21 +894,21 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -922,7 +922,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -936,7 +936,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
CastSpell(targets, spellInfo, NULL, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -2916,7 +2916,7 @@ void Unit::_UpdateSpells(uint32 time)
{
if (!(*itr)->isSpawned())
{
(*itr)->SetOwnerGUID(0);
(*itr)->SetOwnerGUID(ObjectGuid::Empty);
(*itr)->SetRespawnTime(0);
(*itr)->Delete();
m_gameObj.erase(itr++);
@@ -3214,7 +3214,7 @@ void Unit::DeMorph()
SetDisplayId(GetNativeDisplayId());
}
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, ObjectGuid casterGUID /*= 0*/)
{
ASSERT(casterGUID || caster);
@@ -3226,12 +3226,12 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8
if (!newAura->IsMultiSlotAura())
{
// check if cast item changed
uint64 castItemGUID = 0;
ObjectGuid castItemGUID;
if (castItem)
castItemGUID = castItem->GetGUID();
// find current aura from spell and change it's stackamount, or refresh it's duration
if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (newAura->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : 0, 0))
if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (newAura->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0))
{
// effect masks do not match
// extremely rare case
@@ -3258,7 +3258,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8
// correct cast item guid if needed
if (castItemGUID != foundAura->GetCastItemGUID())
{
uint64* oldGUID = const_cast<uint64 *>(&foundAura->m_castItemGuid);
ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
*oldGUID = castItemGUID;
}
@@ -3567,7 +3567,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
i = m_ownedAuras.begin();
}
void Unit::RemoveOwnedAura(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
void Unit::RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
{
for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
@@ -3601,7 +3601,7 @@ void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode)
ASSERT(false);
}
Aura* Unit::GetOwnedAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, Aura* except) const
Aura* Unit::GetOwnedAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, Aura* except) const
{
AuraMapBounds range = m_ownedAuras.equal_range(spellId);
for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
@@ -3630,7 +3630,7 @@ void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode)
aura->Remove(mode);
}
void Unit::RemoveAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
void Unit::RemoveAura(uint32 spellId, ObjectGuid caster, uint8 reqEffMask, AuraRemoveMode removeMode)
{
AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
@@ -3690,7 +3690,7 @@ void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode)
RemoveAura(aurApp, mode);
}
void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
void Unit::RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
{
@@ -3706,7 +3706,7 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEff
}
}
void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode)
void Unit::RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID, AuraRemoveMode removeMode)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -3723,7 +3723,7 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode
}
}
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/)
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -3751,7 +3751,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
}
}
void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer)
void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, Unit* stealer)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -3827,7 +3827,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit*
}
}
void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid)
void Unit::RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
{
@@ -3841,7 +3841,7 @@ void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid)
}
}
void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura* except, bool negative, bool positive)
void Unit::RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID, Aura* except, bool negative, bool positive)
{
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
{
@@ -3942,7 +3942,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
UpdateInterruptMask();
}
void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID)
void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
{
@@ -4134,7 +4134,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2)
}
}
void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime)
void Unit::DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (; range.first != range.second; ++range.first)
@@ -4166,7 +4166,7 @@ void Unit::_ApplyAllAuraStatMods()
(*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
}
AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster) const
{
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
@@ -4180,7 +4180,7 @@ AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) c
return NULL;
}
AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 caster) const
AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid caster) const
{
uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
while (rankSpell)
@@ -4206,7 +4206,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico
return NULL;
}
AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID) const
AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID) const
{
AuraEffectList const& auras = GetAuraEffectsByType(type);
for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
@@ -4227,7 +4227,7 @@ AuraEffect* Unit::GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8
return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);
}
AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const
AuraApplication * Unit::GetAuraApplication(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const
{
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
for (; range.first != range.second; ++range.first)
@@ -4246,13 +4246,13 @@ AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, ui
return NULL;
}
Aura* Unit::GetAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const
Aura* Unit::GetAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
AuraApplication * aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp ? aurApp->GetBase() : NULL;
}
AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const
AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const
{
uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
while (rankSpell)
@@ -4264,7 +4264,7 @@ AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 c
return NULL;
}
Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const
Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
AuraApplication * aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp ? aurApp->GetBase() : NULL;
@@ -4309,7 +4309,7 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges
}
}
bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster) const
{
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
@@ -4339,7 +4339,7 @@ uint32 Unit::GetAuraCount(uint32 spellId) const
return count;
}
bool Unit::HasAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const
bool Unit::HasAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
return true;
@@ -4351,7 +4351,7 @@ bool Unit::HasAuraType(AuraType auraType) const
return (!m_modAuras[auraType].empty());
}
bool Unit::HasAuraTypeWithCaster(AuraType auratype, uint64 caster) const
bool Unit::HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
{
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
@@ -4387,7 +4387,7 @@ bool Unit::HasAuraTypeWithValue(AuraType auratype, int32 value) const
return false;
}
bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) const
bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, ObjectGuid guid) const
{
if (!(m_interruptMask & flag))
return false;
@@ -4399,7 +4399,7 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) const
return false;
}
bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) const
bool Unit::HasNegativeAuraWithAttribute(uint32 flag, ObjectGuid guid) const
{
for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
{
@@ -4439,7 +4439,7 @@ AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const
return NULL;
}
uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove)
uint32 Unit::GetDiseasesByCaster(ObjectGuid casterGUID, bool remove)
{
static const AuraType diseaseAuraTypes[] =
{
@@ -4472,7 +4472,7 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove)
return diseases;
}
uint32 Unit::GetDoTsByCaster(uint64 casterGUID) const
uint32 Unit::GetDoTsByCaster(ObjectGuid casterGUID) const
{
static const AuraType diseaseAuraTypes[] =
{
@@ -4848,7 +4848,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
if (!gameObj || gameObj->GetOwnerGUID() != 0)
if (!gameObj || gameObj->GetOwnerGUID())
return;
m_gameObj.push_back(gameObj);
@@ -4869,13 +4869,13 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
if (!gameObj || gameObj->GetOwnerGUID() != GetGUID())
return;
gameObj->SetOwnerGUID(0);
gameObj->SetOwnerGUID(ObjectGuid::Empty);
for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
{
if (m_ObjectSlot[i] == gameObj->GetGUID())
{
m_ObjectSlot[i] = 0;
m_ObjectSlot[i].Clear();
break;
}
}
@@ -4914,7 +4914,7 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
next = i;
if (spellid == 0 || (*i)->GetSpellId() == spellid)
{
(*i)->SetOwnerGUID(0);
(*i)->SetOwnerGUID(ObjectGuid::Empty);
if (del)
{
(*i)->SetRespawnTime(0);
@@ -4934,7 +4934,7 @@ void Unit::RemoveAllGameObjects()
while (!m_gameObj.empty())
{
GameObjectList::iterator i = m_gameObj.begin();
(*i)->SetOwnerGUID(0);
(*i)->SetOwnerGUID(ObjectGuid::Empty);
(*i)->SetRespawnTime(0);
(*i)->Delete();
m_gameObj.erase(i);
@@ -4992,7 +4992,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
WorldPacket data(SMSG_PERIODICAURALOG, 30);
data << GetPackGUID();
data.appendPackGUID(aura->GetCasterGUID());
data << aura->GetCasterGUID().WriteAsPacked();
data << uint32(aura->GetId()); // spellId
data << uint32(1); // count
data << uint32(aura->GetAuraType()); // auraId
@@ -5160,7 +5160,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// otherwise, it's the triggered_spell_id by default
Unit* target = victim;
int32 basepoints0 = 0;
uint64 originalCaster = 0;
ObjectGuid originalCaster;
switch (dummySpell->SpellFamilyName)
{
@@ -5618,7 +5618,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!target)
return false;
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
return true;
@@ -5626,7 +5626,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Glyph of Icy Veins
case 56374:
{
RemoveAurasByType(SPELL_AURA_HASTE_SPELLS, 0, 0, true, false);
RemoveAurasByType(SPELL_AURA_HASTE_SPELLS, ObjectGuid::Empty, 0, true, false);
RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
return true;
}
@@ -5843,7 +5843,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!target)
return false;
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
return true;
@@ -8670,19 +8670,12 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const
FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction());
if (!entry)
{
static uint64 guid = 0; // prevent repeating spam same faction problem
if (GetGUID() != guid)
{
if (Player const* player = ToPlayer())
TC_LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction());
else if (Creature const* creature = ToCreature())
TC_LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
else
TC_LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction());
guid = GetGUID();
}
if (Player const* player = ToPlayer())
TC_LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction());
else if (Creature const* creature = ToCreature())
TC_LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
else
TC_LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction());
}
return entry;
}
@@ -8998,7 +8991,7 @@ bool Unit::AttackStop()
m_attacking = NULL;
// Clear our target
SetTarget(0);
SetTarget(ObjectGuid::Empty);
ClearUnitState(UNIT_STATE_MELEE_ATTACKING);
@@ -9167,12 +9160,12 @@ bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit co
return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1));
}
void Unit::SetOwnerGUID(uint64 owner)
void Unit::SetOwnerGUID(ObjectGuid owner)
{
if (GetOwnerGUID() == owner)
return;
SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner);
SetGuidValue(UNIT_FIELD_SUMMONEDBY, owner);
if (!owner)
return;
@@ -9194,7 +9187,7 @@ void Unit::SetOwnerGUID(uint64 owner)
Unit* Unit::GetOwner() const
{
if (uint64 ownerGUID = GetOwnerGUID())
if (ObjectGuid ownerGUID = GetOwnerGUID())
return ObjectAccessor::GetUnit(*this, ownerGUID);
return NULL;
@@ -9202,7 +9195,7 @@ Unit* Unit::GetOwner() const
Unit* Unit::GetCharmer() const
{
if (uint64 charmerGUID = GetCharmerGUID())
if (ObjectGuid charmerGUID = GetCharmerGUID())
return ObjectAccessor::GetUnit(*this, charmerGUID);
return NULL;
@@ -9210,8 +9203,8 @@ Unit* Unit::GetCharmer() const
Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const
{
uint64 guid = GetCharmerOrOwnerGUID();
if (IS_PLAYER_GUID(guid))
ObjectGuid guid = GetCharmerOrOwnerGUID();
if (guid.IsPlayer())
return ObjectAccessor::GetPlayer(*this, guid);
return const_cast<Unit*>(this)->ToPlayer();
@@ -9230,14 +9223,14 @@ Player* Unit::GetAffectingPlayer() const
Minion *Unit::GetFirstMinion() const
{
if (uint64 pet_guid = GetMinionGUID())
if (ObjectGuid pet_guid = GetMinionGUID())
{
if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
return (Minion*)pet;
TC_LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid));
const_cast<Unit*>(this)->SetMinionGUID(0);
TC_LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion %s not exist.", pet_guid.ToString().c_str());
const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
}
return NULL;
@@ -9245,14 +9238,14 @@ Minion *Unit::GetFirstMinion() const
Guardian* Unit::GetGuardianPet() const
{
if (uint64 pet_guid = GetPetGUID())
if (ObjectGuid pet_guid = GetPetGUID())
{
if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
return (Guardian*)pet;
TC_LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid);
const_cast<Unit*>(this)->SetPetGUID(0);
TC_LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian %s not exist.", pet_guid.ToString().c_str());
const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
}
return NULL;
@@ -9260,13 +9253,13 @@ Guardian* Unit::GetGuardianPet() const
Unit* Unit::GetCharm() const
{
if (uint64 charm_guid = GetCharmGUID())
if (ObjectGuid charm_guid = GetCharmGUID())
{
if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
return pet;
TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid));
const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0);
TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %s not exist.", charm_guid.ToString().c_str());
const_cast<Unit*>(this)->SetGuidValue(UNIT_FIELD_CHARM, ObjectGuid::Empty);
}
return NULL;
@@ -9320,19 +9313,19 @@ void Unit::SetMinion(Minion *minion, bool apply)
else
oldPet->UnSummon();
SetPetGUID(minion->GetGUID());
SetMinionGUID(0);
SetMinionGUID(ObjectGuid::Empty);
}
}
else
{
SetPetGUID(minion->GetGUID());
SetMinionGUID(0);
SetMinionGUID(ObjectGuid::Empty);
}
}
if (minion->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
{
if (AddUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID()))
if (AddGuidValue(UNIT_FIELD_SUMMON, minion->GetGUID()))
{
}
}
@@ -9372,15 +9365,13 @@ void Unit::SetMinion(Minion *minion, bool apply)
m_Controlled.erase(minion);
if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
{
if (GetCritterGUID() == minion->GetGUID())
SetCritterGUID(0);
}
SetCritterGUID(ObjectGuid::Empty);
if (minion->IsGuardianPet())
{
if (GetPetGUID() == minion->GetGUID())
SetPetGUID(0);
SetPetGUID(ObjectGuid::Empty);
}
else if (minion->IsTotem())
{
@@ -9405,7 +9396,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
//if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
{
if (RemoveUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID()))
if (RemoveGuidValue(UNIT_FIELD_SUMMON, minion->GetGUID()))
{
// Check if there is another minion
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
@@ -9427,7 +9418,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
continue;
if (AddUInt64Value(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
{
// show another pet bar if there is no charm bar
if (GetTypeId() == TYPEID_PLAYER && !GetCharmGUID())
@@ -9476,7 +9467,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
{
if (GetTypeId() == TYPEID_PLAYER)
{
if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
TC_LOG_FATAL("entities.unit", "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
charm->m_ControlledByPlayer = true;
@@ -9489,7 +9480,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
// PvP, FFAPvP
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
TC_LOG_FATAL("entities.unit", "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
_isWalkingBeforeCharm = charm->IsWalking();
@@ -9505,11 +9496,11 @@ void Unit::SetCharm(Unit* charm, bool apply)
{
if (GetTypeId() == TYPEID_PLAYER)
{
if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
TC_LOG_FATAL("entities.unit", "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
}
if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
TC_LOG_FATAL("entities.unit", "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
if (charm->GetTypeId() == TYPEID_PLAYER)
@@ -9633,7 +9624,7 @@ Unit* Unit::GetFirstControlled() const
// Sequence: charmed, pet, other guardians
Unit* unit = GetCharm();
if (!unit)
if (uint64 guid = GetMinionGUID())
if (ObjectGuid guid = GetMinionGUID())
unit = ObjectAccessor::GetUnit(*this, guid);
return unit;
@@ -9666,7 +9657,7 @@ void Unit::RemoveAllControlled()
bool Unit::isPossessedByPlayer() const
{
return HasUnitState(UNIT_STATE_POSSESSED) && IS_PLAYER_GUID(GetCharmerGUID());
return HasUnitState(UNIT_STATE_POSSESSED) && GetCharmerGUID().IsPlayer();
}
bool Unit::isPossessing(Unit* u) const
@@ -10430,7 +10421,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto
{
//! Mobs can't crit with spells. Player Totems can
//! Fire Elemental (from totem) can too - but this part is a hack and needs more research
if (IS_CRE_OR_VEH_GUID(GetGUID()) && !(IsTotem() && IS_PLAYER_GUID(GetOwnerGUID())) && GetEntry() != 15438)
if (GetGUID().IsCreatureOrVehicle() && !(IsTotem() && GetOwnerGUID().IsPlayer()) && GetEntry() != 15438)
return 0.0f;
// not critting spell
@@ -12130,7 +12121,7 @@ bool Unit::IsAlwaysVisibleFor(WorldObject const* seer) const
return true;
// Always seen by owner
if (uint64 guid = GetCharmerOrOwnerGUID())
if (ObjectGuid guid = GetCharmerOrOwnerGUID())
if (seer->GetGUID() == guid)
return true;
@@ -12503,7 +12494,7 @@ bool Unit::CanHaveThreatList(bool skipAliveCheck) const
// return false;
// summons can not have a threat list, unless they are controlled by a creature
if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && IS_PLAYER_GUID(((Pet*)this)->GetOwnerGUID()))
if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Pet*)this)->GetOwnerGUID().IsPlayer())
return false;
return true;
@@ -13321,7 +13312,7 @@ float Unit::GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange typ
bool Unit::CanFreeMove() const
{
return !HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING | UNIT_STATE_IN_FLIGHT |
UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) && GetOwnerGUID() == 0;
UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) && GetOwnerGUID().IsEmpty();
}
void Unit::SetLevel(uint8 lvl)
@@ -13334,7 +13325,7 @@ void Unit::SetLevel(uint8 lvl)
if (player->GetGroup())
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL);
sWorld->UpdateCharacterNameDataLevel(GetGUIDLow(), lvl);
sWorld->UpdateCharacterNameDataLevel(GetGUID(), lvl);
}
}
@@ -14426,14 +14417,14 @@ SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
return SPELL_SCHOOL_MASK_NORMAL;
}
uint64 Unit::GetCharmerOrOwnerGUID() const
ObjectGuid Unit::GetCharmerOrOwnerGUID() const
{
return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID();
}
uint64 Unit::GetCharmerOrOwnerOrOwnGUID() const
ObjectGuid Unit::GetCharmerOrOwnerOrOwnGUID() const
{
if (uint64 guid = GetCharmerOrOwnerGUID())
if (ObjectGuid guid = GetCharmerOrOwnerGUID())
return guid;
return GetGUID();
}
@@ -14476,7 +14467,7 @@ void Unit::SendPetTalk(uint32 pettalk)
owner->ToPlayer()->GetSession()->SendPacket(&data);
}
void Unit::SendPetAIReaction(uint64 guid)
void Unit::SendPetAIReaction(ObjectGuid guid)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
@@ -14597,13 +14588,13 @@ void Unit::ClearComboPointHolders()
{
while (!m_ComboPointHolders.empty())
{
uint32 lowguid = *m_ComboPointHolders.begin();
ObjectGuid guid = *m_ComboPointHolders.begin();
Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
Player* player = ObjectAccessor::FindPlayer(guid);
if (player && player->GetComboTarget() == GetGUID()) // recheck for safe
player->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
else
m_ComboPointHolders.erase(lowguid); // or remove manually
m_ComboPointHolders.erase(guid); // or remove manually
}
}
@@ -15110,7 +15101,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
// aura can be deleted at casts
SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
int32 heal = triggeredByAura->GetAmount();
uint64 caster_guid = triggeredByAura->GetCasterGUID();
ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
// Currently only Prayer of Mending
if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
@@ -15169,7 +15160,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
return false;
}
uint64 caster_guid = triggeredByAura->GetCasterGUID();
ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
// jumps
int32 jumps = triggeredByAura->GetBase()->GetCharges()-1;
@@ -15586,7 +15577,7 @@ void Unit::SetStunned(bool apply)
{
if (apply)
{
SetTarget(0);
SetTarget(ObjectGuid::Empty);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
// MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING (tested 3.3.5a)
@@ -15685,7 +15676,7 @@ void Unit::SetFeared(bool apply)
{
if (apply)
{
SetTarget(0);
SetTarget(ObjectGuid::Empty);
Unit* caster = NULL;
Unit::AuraEffectList const& fearAuras = GetAuraEffectsByType(SPELL_AURA_MOD_FEAR);
@@ -15715,7 +15706,7 @@ void Unit::SetConfused(bool apply)
{
if (apply)
{
SetTarget(0);
SetTarget(ObjectGuid::Empty);
GetMotionMaster()->MoveConfused();
}
else
@@ -16058,14 +16049,14 @@ Creature* Unit::GetVehicleCreatureBase() const
return NULL;
}
uint64 Unit::GetTransGUID() const
ObjectGuid Unit::GetTransGUID() const
{
if (GetVehicle())
return GetVehicleBase()->GetGUID();
if (GetTransport())
return GetTransport()->GetGUID();
return 0;
return ObjectGuid::Empty;
}
TransportBase* Unit::GetDirectTransport() const
@@ -16222,7 +16213,7 @@ void Unit::SendPlaySpellVisual(uint32 id)
SendMessageToSet(&data, false);
}
void Unit::SendPlaySpellImpact(uint64 guid, uint32 id)
void Unit::SendPlaySpellImpact(ObjectGuid guid, uint32 id)
{
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4);
data << uint64(guid); // target
@@ -16794,7 +16785,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
uint64 origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->second.spellId);
// if (!spellEntry) should be checked at npc_spellclick load
@@ -17165,8 +17156,8 @@ void Unit::SendThreatListUpdate()
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data.appendPackGUID((*itr)->getUnitGuid());
data << uint32((*itr)->getThreat()*100);
data << (*itr)->getUnitGuid().WriteAsPacked();
data << uint32((*itr)->getThreat() * 100);
}
SendMessageToSet(&data, false);
}
@@ -17181,12 +17172,12 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
data << GetPackGUID();
data.appendPackGUID(pHostileReference->getUnitGuid());
data << pHostileReference->getUnitGuid().WriteAsPacked();
data << uint32(count);
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data.appendPackGUID((*itr)->getUnitGuid());
data << (*itr)->getUnitGuid().WriteAsPacked();
data << uint32((*itr)->getThreat());
}
SendMessageToSet(&data, false);
@@ -17206,7 +17197,7 @@ void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference)
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message");
WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
data << GetPackGUID();
data.appendPackGUID(pHostileReference->getUnitGuid());
data << pHostileReference->getUnitGuid().WriteAsPacked();
SendMessageToSet(&data, false);
}
@@ -17287,14 +17278,14 @@ void Unit::OutDebugInfo() const
std::ostringstream o;
o << "Summon Slot: ";
for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
o << m_SummonSlot[i] << ", ";
o << m_SummonSlot[i].ToString() << ", ";
TC_LOG_INFO("entities.unit", "%s", o.str().c_str());
o.str("");
o << "Controlled List: ";
for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
o << (*itr)->GetGUID() << ", ";
o << (*itr)->GetGUID().ToString() << ", ";
TC_LOG_INFO("entities.unit", "%s", o.str().c_str());
o.str("");
@@ -17309,7 +17300,7 @@ void Unit::OutDebugInfo() const
o << "Passenger List: ";
for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid))
o << passenger->GetGUID() << ", ";
o << passenger->GetGUID().ToString() << ", ";
TC_LOG_INFO("entities.unit", "%s", o.str().c_str());
}
@@ -17317,7 +17308,7 @@ void Unit::OutDebugInfo() const
TC_LOG_INFO("entities.unit", "On vehicle %u.", GetVehicleBase()->GetEntry());
}
uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
uint32 Unit::GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
{
uint32 amount = 0;
AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType);