*Update function _AddAura code. only check aura state for first aura.
--HG-- branch : trunk
This commit is contained in:
+19
-15
@@ -809,7 +809,7 @@ void Aura::_AddAura()
|
|||||||
// Second aura if some spell
|
// Second aura if some spell
|
||||||
bool secondaura = false;
|
bool secondaura = false;
|
||||||
// Try find slot for aura
|
// Try find slot for aura
|
||||||
uint8 slot = NULL_AURA_SLOT;
|
uint8 slot = MAX_AURAS;
|
||||||
// Lookup for auras already applied from spell
|
// Lookup for auras already applied from spell
|
||||||
for(uint8 i = 0; i < 3; ++i)
|
for(uint8 i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
@@ -828,14 +828,17 @@ void Aura::_AddAura()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit::VisibleAuraMap const *visibleAuras = m_target->GetVisibleAuras();
|
// Register Visible Aura
|
||||||
if(visibleAuras->size() < MAX_AURAS || slot < MAX_AURAS) // got free slot
|
|
||||||
{
|
|
||||||
AuraSlotEntry *entry = NULL;
|
AuraSlotEntry *entry = NULL;
|
||||||
|
if(slot < MAX_AURAS)
|
||||||
// Lookup free slot
|
entry = m_target->GetVisibleAura(slot);
|
||||||
if (!secondaura)
|
else
|
||||||
{
|
{
|
||||||
|
Unit::VisibleAuraMap const *visibleAuras = m_target->GetVisibleAuras();
|
||||||
|
if(visibleAuras->size() < MAX_AURAS)
|
||||||
|
{
|
||||||
|
// Even if this is the second aura and slot == MAX_AURAS,
|
||||||
|
// it is still possible that a free slot can be founded
|
||||||
Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin();
|
Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin();
|
||||||
for(int freeSlot = 0; freeSlot < MAX_AURAS; ++itr, ++freeSlot)
|
for(int freeSlot = 0; freeSlot < MAX_AURAS; ++itr, ++freeSlot)
|
||||||
{
|
{
|
||||||
@@ -845,18 +848,20 @@ void Aura::_AddAura()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(slot < MAX_AURAS); // assert that we find a slot and it is valid
|
|
||||||
|
|
||||||
|
assert(slot < MAX_AURAS); // assert that we find a slot and it is valid
|
||||||
entry = m_target->GetVisibleAuraSlot(slot);
|
entry = m_target->GetVisibleAuraSlot(slot);
|
||||||
entry->m_Flags=(IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE) | ((GetCasterGUID() == m_target->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE) | ((GetAuraMaxDuration() > 0) ? AFLAG_DURATION : AFLAG_NONE);
|
|
||||||
|
entry->m_Flags = (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE) |
|
||||||
|
(GetCasterGUID() == m_target->GetGUID() ? AFLAG_CASTER : AFLAG_NONE) |
|
||||||
|
(GetAuraMaxDuration() > 0 ? AFLAG_DURATION : AFLAG_NONE);
|
||||||
entry->m_Level = (caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
|
entry->m_Level = (caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||||
entry->m_spellId = GetId();
|
entry->m_spellId = GetId();
|
||||||
//init pointers-prevent unexpected behaviour
|
//init pointers-prevent unexpected behaviour
|
||||||
for(uint8 i = 0; i < 3; ++i)
|
for(uint8 i = 0; i < 3; ++i)
|
||||||
entry->m_slotAuras[i] = NULL;
|
entry->m_slotAuras[i] = NULL;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
entry = m_target->GetVisibleAura(slot);
|
|
||||||
|
|
||||||
if(entry)
|
if(entry)
|
||||||
{
|
{
|
||||||
@@ -869,17 +874,17 @@ void Aura::_AddAura()
|
|||||||
m_target->UpdateAuraForGroup(slot);
|
m_target->UpdateAuraForGroup(slot);
|
||||||
sLog.outDebug("Aura: %u Effect: %d put to unit visible auras slot: %u",GetId(), GetEffIndex(), slot);
|
sLog.outDebug("Aura: %u Effect: %d put to unit visible auras slot: %u",GetId(), GetEffIndex(), slot);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
sLog.outDebug("Aura: %u Effect: %d could not find empty unit visible slot",GetId(), GetEffIndex());
|
sLog.outDebug("Aura: %u Effect: %d could not find empty unit visible slot",GetId(), GetEffIndex());
|
||||||
|
|
||||||
|
if(secondaura)
|
||||||
|
return;
|
||||||
|
|
||||||
//*****************************************************
|
//*****************************************************
|
||||||
// Update target aura state flag
|
// Update target aura state flag
|
||||||
// TODO: Make it easer
|
// TODO: Make it easer
|
||||||
//*****************************************************
|
//*****************************************************
|
||||||
|
|
||||||
if (!secondaura)
|
|
||||||
{
|
|
||||||
// Sitdown on apply aura req seated
|
// Sitdown on apply aura req seated
|
||||||
if (m_spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED && !m_target->IsSitState())
|
if (m_spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED && !m_target->IsSitState())
|
||||||
m_target->SetStandState(UNIT_STAND_STATE_SIT);
|
m_target->SetStandState(UNIT_STAND_STATE_SIT);
|
||||||
@@ -899,7 +904,6 @@ void Aura::_AddAura()
|
|||||||
else if(Unit* caster = GetCaster())
|
else if(Unit* caster = GetCaster())
|
||||||
m_target->AddAura(*itr, m_target);
|
m_target->AddAura(*itr, m_target);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Update Seals information
|
// Update Seals information
|
||||||
if (IsSealSpell(m_spellProto))
|
if (IsSealSpell(m_spellProto))
|
||||||
|
|||||||
Reference in New Issue
Block a user