Core/Auras: tidy up one little hack
This commit is contained in:
1 parent
d99739cd8c
commit
7871583016
3 files changed
+27
-23
No files matched your search
@@ -13324,13 +13324,13 @@ void Unit::SetDisplayId(uint32 modelId)
|
||||
|
||||
void Unit::RestoreDisplayId()
|
||||
{
|
||||
AuraEffect* handledAura = NULL;
|
||||
AuraEffect* handledAura = nullptr;
|
||||
// try to receive model from transform auras
|
||||
Unit::AuraEffectList const& transforms = GetAuraEffectsByType(SPELL_AURA_TRANSFORM);
|
||||
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)
|
||||
for (auto i = transforms.rbegin(); i != transforms.rend(); ++i)
|
||||
{
|
||||
if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
|
||||
{
|
||||
@@ -13345,12 +13345,18 @@ void Unit::RestoreDisplayId()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AuraEffectList const& shapeshiftAura = GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
// 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);
|
||||
else if (!shapeshiftAura.empty()) // we've found shapeshift
|
||||
{
|
||||
// only one such aura possible at a time
|
||||
if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
|
||||
SetDisplayId(modelId);
|
||||
}
|
||||
// no auras found - set modelid to default
|
||||
else
|
||||
SetDisplayId(GetNativeDisplayId());
|
||||
@@ -15237,8 +15243,19 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c
|
||||
return CalculatePct(damage, percent);
|
||||
}
|
||||
|
||||
uint32 Unit::GetModelForForm(ShapeshiftForm form) const
|
||||
uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const
|
||||
{
|
||||
// Hardcoded cases
|
||||
switch (spellId)
|
||||
{
|
||||
case 7090: // Bear Form
|
||||
return 29414;
|
||||
case 35200: // Roc Form
|
||||
return 4877;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
switch (form)
|
||||
|
||||
Reference in new issue
Block a user