[9523] Stacking Auras from dual wild weapons.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Sarjuuk 2010-03-05 08:36:20 +03:00 committed by VladimirMangos
parent da30ea5ed8
commit 0ca87c50a6
4 changed files with 41 additions and 3 deletions

View file

@ -983,7 +983,8 @@ void Aura::_AddAura()
for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr)
{
// allow use single slot only by auras from same caster
if(itr->second->GetCasterGUID()==GetCasterGUID())
if(itr->second->GetCasterGUID()==GetCasterGUID() &&
!isWeaponBuffCoexistableWith(itr->second))
{
slot = itr->second->GetAuraSlot();
secondaura = true;
@ -1412,6 +1413,37 @@ void Aura::ReapplyAffectedPassiveAuras()
ReapplyAffectedPassiveAuras(member, false);
}
bool Aura::isWeaponBuffCoexistableWith(Aura* ref)
{
// Exclude Debuffs
if (!IsPositive())
return false;
// Exclude Non-generic Buffs [ie: Runeforging] and Executioner-Enchant
if (GetSpellProto()->SpellFamilyName != SPELLFAMILY_GENERIC || GetId() == 42976)
return false;
// Exclude Stackable Buffs [ie: Blood Reserve]
if (GetSpellProto()->StackAmount)
return false;
// only self applied player buffs
if (m_target->GetTypeId() != TYPEID_PLAYER || m_target->GetGUID() != GetCasterGUID())
return false;
Item* castItem = ((Player*)m_target)->GetItemByGuid(GetCastItemGUID());
if (!castItem)
return false;
// Limit to Weapon-Slots
if (!castItem->IsEquipped() ||
(castItem->GetSlot() != EQUIPMENT_SLOT_MAINHAND && castItem->GetSlot() != EQUIPMENT_SLOT_OFFHAND))
return false;
// form different weapons
return ref->GetCastItemGUID() != GetCastItemGUID();
}
/*********************************************************/
/*** BASIC AURA FUNCTION ***/
/*********************************************************/