diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 31 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 17 |
3 files changed, 27 insertions, 23 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ea7ae059a9a..b1096c08e3a 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11454,13 +11454,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())) { @@ -11475,12 +11475,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()); @@ -13215,8 +13221,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) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 1703a0c9874..15c5e3cd535 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2151,7 +2151,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; uint32 GetModelForTotem(PlayerTotemType totemType); // Redirect Threat diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 8bfc571d800..fc9b03bc915 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1691,20 +1691,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo TC_LOG_ERROR("spells", "Auras: Unknown Shapeshift Type: %u", GetMiscValue()); } - switch (GetId()) - { - // Bear Form - case 7090: - modelid = 29414; - break; - // Roc Form - case 35200: - modelid = 4877; - break; - default: - modelid = target->GetModelForForm(form); - break; - } + modelid = target->GetModelForForm(form, GetId()); if (apply) { @@ -2078,7 +2065,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, uint32 model_id = 0; // choose a model, based on trigger flag - if (uint32 modelid = sObjectMgr->ChooseDisplayId(ci)) + if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci)) model_id = modelid; // Polymorph (sheep) |