aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp36
-rw-r--r--src/server/game/Entities/Unit/Unit.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp17
3 files changed, 29 insertions, 26 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index ce88d138cee..3e6be7289ec 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -10564,13 +10564,13 @@ void Unit::SetDisplayId(uint32 modelId, float displayScale /*= 1.f*/)
void Unit::RestoreDisplayId(bool ignorePositiveAurasPreventingMounting /*= false*/)
{
- 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()))
{
@@ -10591,16 +10591,23 @@ void Unit::RestoreDisplayId(bool ignorePositiveAurasPreventingMounting /*= false
}
}
}
+
+ 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()))
+ else if (!shapeshiftAura.empty()) // we've found shapeshift
{
- if (!ignorePositiveAurasPreventingMounting || !IsDisallowedMountForm(0, GetShapeshiftForm(), modelId))
- SetDisplayId(modelId);
- else
- SetDisplayId(GetNativeDisplayId());
+ // only one such aura possible at a time
+ if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
+ {
+ if (!ignorePositiveAurasPreventingMounting || !IsDisallowedMountForm(0, GetShapeshiftForm(), modelId))
+ SetDisplayId(modelId);
+ else
+ SetDisplayId(GetNativeDisplayId());
+ }
}
// no auras found - set modelid to default
else
@@ -12363,8 +12370,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 (Player const* thisPlayer = ToPlayer())
{
if (Aura* artifactAura = GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index d955bce211e..d22a4fdbb72 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1928,7 +1928,7 @@ class TC_GAME_API Unit : public WorldObject
void AddPetAura(PetAura const* petSpell);
void RemovePetAura(PetAura const* petSpell);
- uint32 GetModelForForm(ShapeshiftForm form) const;
+ uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const;
// Redirect Threat
void SetRedirectThreat(ObjectGuid guid, uint32 pct) { _redirectThreadInfo.Set(guid, pct); }
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 81ea02ba490..ddf7dd8ad4e 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1683,22 +1683,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
Unit* target = aurApp->GetTarget();
ShapeshiftForm form = ShapeshiftForm(GetMiscValue());
- uint32 modelid = 0;
-
- switch (GetId())
- {
- // Bear Form
- case 7090:
- modelid = 29414;
- break;
- // Roc Form
- case 35200:
- modelid = 4877;
- break;
- default:
- modelid = target->GetModelForForm(form);
- break;
- }
+ uint32 modelid = target->GetModelForForm(form, GetId());
if (apply)
{