diff options
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 15 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 30 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 3 | ||||
-rw-r--r-- | src/server/game/Handlers/ArtifactHandler.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp | 1 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 4 |
6 files changed, 36 insertions, 19 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index fef5cbea434..456cd7d910e 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -22070,13 +22070,12 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc if (npc) { // not let cheating with start flight mounted - if (IsMounted()) - { - GetSession()->SendActivateTaxiReply(ERR_TAXIPLAYERALREADYMOUNTED); - return false; - } + RemoveAurasByType(SPELL_AURA_MOUNTED); + + if (GetDisplayId() != GetNativeDisplayId()) + RestoreDisplayId(true); - if (IsInDisallowedMountForm()) + if (IsDisallowedMountForm(getTransForm(), FORM_NONE, GetDisplayId())) { GetSession()->SendActivateTaxiReply(ERR_TAXIPLAYERSHAPESHIFTED); return false; @@ -22094,8 +22093,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc { RemoveAurasByType(SPELL_AURA_MOUNTED); - if (IsInDisallowedMountForm()) - RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + if (GetDisplayId() != GetNativeDisplayId()) + RestoreDisplayId(true); if (Spell* spell = GetCurrentSpell(CURRENT_GENERIC_SPELL)) if (spell->m_spellInfo->Id != spellid) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0b22fbfe0fa..fc77f1e191a 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9112,11 +9112,16 @@ bool Unit::IsInFeralForm() const bool Unit::IsInDisallowedMountForm() const { - if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm())) + return IsDisallowedMountForm(getTransForm(), GetShapeshiftForm(), GetDisplayId()); +} + +bool Unit::IsDisallowedMountForm(uint32 spellId, ShapeshiftForm form, uint32 displayId) const +{ + if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(spellId)) if (transformSpellInfo->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_MOUNTED)) return false; - if (ShapeshiftForm form = GetShapeshiftForm()) + if (form) { SpellShapeshiftFormEntry const* shapeshift = sSpellShapeshiftFormStore.LookupEntry(form); if (!shapeshift) @@ -9126,10 +9131,10 @@ bool Unit::IsInDisallowedMountForm() const return true; } - if (GetDisplayId() == GetNativeDisplayId()) + if (displayId == GetNativeDisplayId()) return false; - CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId()); + CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(displayId); if (!display) return true; @@ -10329,7 +10334,7 @@ void Unit::SetDisplayId(uint32 modelId) SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER, minfo->gender); } -void Unit::RestoreDisplayId() +void Unit::RestoreDisplayId(bool ignorePositiveAurasPreventingMounting /*= false*/) { AuraEffect* handledAura = NULL; // try to receive model from transform auras @@ -10342,7 +10347,13 @@ void Unit::RestoreDisplayId() if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID())) { if (!handledAura) - handledAura = (*i); + { + if (!ignorePositiveAurasPreventingMounting) + handledAura = (*i); + else if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate((*i)->GetMiscValue())) + if (!IsDisallowedMountForm((*i)->GetId(), FORM_NONE, sObjectMgr->ChooseDisplayId(ci))) + handledAura = (*i); + } // prefer negative auras if (!aurApp->IsPositive()) { @@ -10357,7 +10368,12 @@ void Unit::RestoreDisplayId() handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); // we've found shapeshift else if (uint32 modelId = GetModelForForm(GetShapeshiftForm())) - SetDisplayId(modelId); + { + if (!ignorePositiveAurasPreventingMounting || !IsDisallowedMountForm(0, GetShapeshiftForm(), modelId)) + SetDisplayId(modelId); + else + SetDisplayId(GetNativeDisplayId()); + } // no auras found - set modelid to default else SetDisplayId(GetNativeDisplayId()); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 8f9ed8d5e42..74e2ed60f77 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1592,6 +1592,7 @@ class TC_GAME_API Unit : public WorldObject bool IsInFeralForm() const; bool IsInDisallowedMountForm() const; + bool IsDisallowedMountForm(uint32 spellId, ShapeshiftForm form, uint32 displayId) const; float m_modMeleeHitChance; float m_modRangedHitChance; @@ -1676,7 +1677,7 @@ class TC_GAME_API Unit : public WorldObject uint32 GetDisplayId() const { return GetUInt32Value(UNIT_FIELD_DISPLAYID); } virtual void SetDisplayId(uint32 modelId); uint32 GetNativeDisplayId() const { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); } - void RestoreDisplayId(); + void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting = false); void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); } void setTransForm(uint32 spellid) { m_transform = spellid;} uint32 getTransForm() const { return m_transform;} diff --git a/src/server/game/Handlers/ArtifactHandler.cpp b/src/server/game/Handlers/ArtifactHandler.cpp index f572cbe6983..774dedff867 100644 --- a/src/server/game/Handlers/ArtifactHandler.cpp +++ b/src/server/game/Handlers/ArtifactHandler.cpp @@ -157,7 +157,7 @@ void WorldSession::HandleArtifactSetAppearance(WorldPackets::Artifact::ArtifactS // change druid form appearance if (artifactAppearance->OverrideShapeshiftDisplayID && artifactAppearance->OverrideShapeshiftFormID && _player->GetShapeshiftForm() == ShapeshiftForm(artifactAppearance->OverrideShapeshiftFormID)) - _player->RestoreDisplayId(); + _player->RestoreDisplayId(_player->IsMounted()); } } diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 41d505d3b42..51e54b3ba26 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -404,6 +404,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player) } player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); + player->RestoreDisplayId(); } #define PLAYER_FLIGHT_SPEED 30.0f diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1ae20f46693..ec89617c794 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1783,7 +1783,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo } if (modelid > 0) - target->RestoreDisplayId(); + target->RestoreDisplayId(target->IsMounted()); switch (form) { @@ -2042,7 +2042,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, if (target->getTransForm() == GetId()) target->setTransForm(0); - target->RestoreDisplayId(); + target->RestoreDisplayId(target->IsMounted()); // Dragonmaw Illusion (restore mount model) if (GetId() == 42016 && target->GetMountID() == 16314) |