mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11459] More ObjectGuid using in Aura/SpellAuraHolder code.
Also fix build in PetAI code. Thanks to rsa for fix code.
This commit is contained in:
parent
151e5eae9c
commit
44f2c26389
15 changed files with 104 additions and 96 deletions
|
|
@ -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<<spell->Dispel) & dispelMask) && (!casterGUID || casterGUID == itr->second->GetCasterGUID()))
|
||||
if (((1<<spell->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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue