Core/Movement:

- Don't abort relocation if movementflag restrictions were violated. There might be lag between client and server and even different parts of the core that made this approach improper.
- MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING, but it's a valid flag to receive from client.
- Fix falling to ground when unapplying fly/waterwalk aura. NOTE: This is a client-side initiated fall, in the future this should be initiated and updated by the server. (Working on it)
- Rename MOVEMENTFLAG_FALLING to MOVEMENTFLAG_FALLING_FAR
- Rename MOVEMENTFLAG_JUMPING to MOVEMENTFLAG_FALLING

Closes #5751
This commit is contained in:
Machiavelli
2012-03-17 20:36:12 +01:00
parent 01f3620d45
commit 41cc704bf8
13 changed files with 94 additions and 110 deletions
@@ -2855,13 +2855,21 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
//! Not entirely sure if this should be sent for creatures as well, but I don't think so.
target->SetCanFly(apply);
if (!apply)
{
target->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING);
target->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
target->m_movementInfo.SetFallTime(0);
}
Player* player = target->ToPlayer();
if (!player)
player = target->m_movedPlayer;
if (player)
player->SendMovementCanFlyChange();
//! We still need to initiate a server-side MoveFall here,
//! which requires MSG_MOVE_FALL_LAND on landing.
}
void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -2880,11 +2888,13 @@ void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode,
if (apply)
target->AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
else
else
{
target->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
target->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
target->SendMovementWaterWalking();
}
void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -3242,13 +3252,21 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
{
target->SetCanFly(apply);
if (!apply)
{
target->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING);
target->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
target->m_movementInfo.SetFallTime(0);
}
Player* player = target->ToPlayer();
if (!player)
player = target->m_movedPlayer;
if (player)
player->SendMovementCanFlyChange();
//! We still need to initiate a server-side MoveFall here,
//! which requires MSG_MOVE_FALL_LAND on landing.
}
//! Someone should clean up these hacks and remove it from this function. It doesn't even belong here.
+2 -2
View File
@@ -3505,7 +3505,7 @@ void Spell::update(uint32 difftime)
// check if the player caster has moved before the spell finished
if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) &&
m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) &&
(m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)))
(m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR)))
{
// don't cancel for melee, autorepeat, triggered and instant spells
if (!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !IsTriggered())
@@ -4756,7 +4756,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving())
{
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) &&
if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) &&
(IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0))
return SPELL_FAILED_MOVING;
}