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)
|
||||
|
||||
@@ -2125,7 +2125,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
|
||||
|
||||
@@ -1699,20 +1699,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)
|
||||
{
|
||||
@@ -2061,7 +2048,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)
|
||||
|
||||
Reference in new issue
Block a user