Core/Auras:

Fix a crash with spell 33499 - BIG thanks to Shauren for finding the reason of this crash
 Corrections in managing stacked auras which change unit model.
This commit is contained in:
QAston
2010-12-31 18:12:20 +01:00
parent 72a115f242
commit 42d3130a56
3 changed files with 128 additions and 136 deletions
+34
View File
@@ -14212,6 +14212,40 @@ void Unit::SetDisplayId(uint32 modelId)
}
}
void Unit::RestoreDisplayId()
{
AuraEffect* handledAura = NULL;
// try to receive model from transform auras
Unit::AuraEffectList const& transforms = GetAuraEffectsByType(SPELL_AURA_TRANSFORM);
if (!transforms.empty())
{
// iterate over already applied transform auras - from newest to oldest
for (Unit::AuraEffectList::const_reverse_iterator i = transforms.rbegin(); i != transforms.rend(); ++i)
{
if (AuraApplication const * aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
{
if (aurApp->IsPositive())
handledAura = (*i);
// prefer negative auras
else
{
handledAura = (*i);
break;
}
}
}
}
// transform aura was found
if (handledAura)
handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
// we've found shapeshift
else if (uint32 modelId = GetModelForForm(GetShapeshiftForm()))
SetDisplayId(modelId);
// no auras found - set modelid to default
else
SetDisplayId(GetNativeDisplayId());
}
void Unit::ClearComboPointHolders()
{
while (!m_ComboPointHolders.empty())