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:
@@ -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())
|
||||
|
||||
@@ -1858,6 +1858,7 @@ class Unit : public WorldObject
|
||||
uint32 GetDisplayId() { return GetUInt32Value(UNIT_FIELD_DISPLAYID); }
|
||||
void SetDisplayId(uint32 modelId);
|
||||
uint32 GetNativeDisplayId() { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }
|
||||
void RestoreDisplayId();
|
||||
void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); }
|
||||
void setTransForm(uint32 spellid) { m_transform = spellid;}
|
||||
uint32 getTransForm() const { return m_transform;}
|
||||
|
||||
Reference in New Issue
Block a user