diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 023bbf5df5b..ea9190335ad 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4151,6 +4151,37 @@ void Unit::RefreshAurasByCasterSpell(uint32 spellId, uint64 casterGUID) } } +void Unit::SetAurasDurationByCasterSpell(uint32 spellId, uint64 casterGUID, int32 duration) +{ + for(uint8 i = 0; i < 3; ++i) + { + spellEffectPair spair = spellEffectPair(spellId, i); + for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr) + { + if(itr->second->GetCasterGUID()==casterGUID) + { + itr->second->SetAuraDuration(duration); + break; + } + } + } +} + +Aura* Unit::GetAuraByCasterSpell(uint32 spellId, uint64 casterGUID) +{ + // Returns first found aura from spell-use only in cases where effindex of spell doesn't matter! + for(uint8 i = 0; i < 3; ++i) + { + spellEffectPair spair = spellEffectPair(spellId, i); + for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr) + { + if(itr->second->GetCasterGUID()==casterGUID) + return itr->second; + } + } + return NULL; +} + void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler) { for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) @@ -5996,8 +6027,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if( spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && spellProto->SpellFamilyFlags[0] & 0x40000) { - (*itr)->SetAuraMaxDuration(GetSpellMaxDuration(spellProto)); - (*itr)->RefreshAura(); + RefreshAurasByCasterSpell(spellProto->Id, GetGUID()); return true; } } |