mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[c12646] Fix client movement freeze after map change
This commit is contained in:
parent
bb2e19caeb
commit
94e26af71d
5 changed files with 24 additions and 20 deletions
|
|
@ -1073,11 +1073,11 @@ bool ChatHandler::HandleModifyASpeedCommand(char* args)
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||||
|
|
||||||
chr->UpdateSpeed(MOVE_WALK, true, modSpeed);
|
chr->UpdateSpeed(MOVE_WALK, true, modSpeed, true);
|
||||||
chr->UpdateSpeed(MOVE_RUN, true, modSpeed);
|
chr->UpdateSpeed(MOVE_RUN, true, modSpeed, true);
|
||||||
chr->UpdateSpeed(MOVE_SWIM, true, modSpeed);
|
chr->UpdateSpeed(MOVE_SWIM, true, modSpeed, true);
|
||||||
// chr->UpdateSpeed(MOVE_TURN, true, modSpeed);
|
// chr->UpdateSpeed(MOVE_TURN, true, modSpeed);
|
||||||
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed);
|
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1121,7 +1121,7 @@ bool ChatHandler::HandleModifySpeedCommand(char* args)
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||||
|
|
||||||
chr->UpdateSpeed(MOVE_RUN, true, modSpeed);
|
chr->UpdateSpeed(MOVE_RUN, true, modSpeed, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1166,7 +1166,7 @@ bool ChatHandler::HandleModifySwimCommand(char* args)
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||||
|
|
||||||
chr->UpdateSpeed(MOVE_SWIM, true, modSpeed);
|
chr->UpdateSpeed(MOVE_SWIM, true, modSpeed, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1211,7 +1211,7 @@ bool ChatHandler::HandleModifyBWalkCommand(char* args)
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||||
|
|
||||||
chr->UpdateSpeed(MOVE_RUN_BACK, true, modSpeed);
|
chr->UpdateSpeed(MOVE_RUN_BACK, true, modSpeed, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1247,7 +1247,7 @@ bool ChatHandler::HandleModifyFlyCommand(char* args)
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||||
|
|
||||||
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed);
|
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20434,6 +20434,10 @@ void Player::SendInitialPacketsAfterAddToMap()
|
||||||
SendAurasForTarget(this);
|
SendAurasForTarget(this);
|
||||||
SendEnchantmentDurations(); // must be after add to map
|
SendEnchantmentDurations(); // must be after add to map
|
||||||
SendItemDurations(); // must be after add to map
|
SendItemDurations(); // must be after add to map
|
||||||
|
|
||||||
|
UpdateSpeed(MOVE_RUN, true, 1.0f, true);
|
||||||
|
UpdateSpeed(MOVE_SWIM, true, 1.0f, true);
|
||||||
|
UpdateSpeed(MOVE_FLIGHT, true, 1.0f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SendUpdateToOutOfRangeGroupMembers()
|
void Player::SendUpdateToOutOfRangeGroupMembers()
|
||||||
|
|
|
||||||
|
|
@ -8650,7 +8650,7 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
|
void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio, bool ignoreChange)
|
||||||
{
|
{
|
||||||
// not in combat pet have same speed as owner
|
// not in combat pet have same speed as owner
|
||||||
switch (mtype)
|
switch (mtype)
|
||||||
|
|
@ -8662,7 +8662,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
|
||||||
{
|
{
|
||||||
if (Unit* owner = GetOwner())
|
if (Unit* owner = GetOwner())
|
||||||
{
|
{
|
||||||
SetSpeedRate(mtype, owner->GetSpeedRate(mtype), forced);
|
SetSpeedRate(mtype, owner->GetSpeedRate(mtype), forced, ignoreChange);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8790,7 +8790,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSpeedRate(mtype, speed * ratio, forced);
|
SetSpeedRate(mtype, speed * ratio, forced, ignoreChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Unit::GetSpeed(UnitMoveType mtype) const
|
float Unit::GetSpeed(UnitMoveType mtype) const
|
||||||
|
|
@ -8800,19 +8800,19 @@ float Unit::GetSpeed(UnitMoveType mtype) const
|
||||||
|
|
||||||
struct SetSpeedRateHelper
|
struct SetSpeedRateHelper
|
||||||
{
|
{
|
||||||
explicit SetSpeedRateHelper(UnitMoveType _mtype, bool _forced) : mtype(_mtype), forced(_forced) {}
|
explicit SetSpeedRateHelper(UnitMoveType _mtype, bool _forced, bool _ignoreChange) : mtype(_mtype), forced(_forced), ignoreChange(_ignoreChange) {}
|
||||||
void operator()(Unit* unit) const { unit->UpdateSpeed(mtype, forced); }
|
void operator()(Unit* unit) const { unit->UpdateSpeed(mtype, forced, 1.0f, ignoreChange); }
|
||||||
UnitMoveType mtype;
|
UnitMoveType mtype;
|
||||||
bool forced;
|
bool forced, ignoreChange;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
|
void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced, bool ignoreChange)
|
||||||
{
|
{
|
||||||
if (rate < 0)
|
if (rate < 0)
|
||||||
rate = 0.0f;
|
rate = 0.0f;
|
||||||
|
|
||||||
// Update speed only on change
|
// Update speed only on change
|
||||||
if (m_speed_rate[mtype] != rate)
|
if (m_speed_rate[mtype] != rate || ignoreChange)
|
||||||
{
|
{
|
||||||
m_speed_rate[mtype] = rate;
|
m_speed_rate[mtype] = rate;
|
||||||
propagateSpeedChange();
|
propagateSpeedChange();
|
||||||
|
|
@ -9023,7 +9023,7 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
|
||||||
SendMessageToSet(&data, false);
|
SendMessageToSet(&data, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallForAllControlledUnits(SetSpeedRateHelper(mtype, forced), CONTROLLED_PET | CONTROLLED_GUARDIANS | CONTROLLED_CHARM | CONTROLLED_MINIPET);
|
CallForAllControlledUnits(SetSpeedRateHelper(mtype, forced, ignoreChange), CONTROLLED_PET | CONTROLLED_GUARDIANS | CONTROLLED_CHARM | CONTROLLED_MINIPET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SetDeathState(DeathState s)
|
void Unit::SetDeathState(DeathState s)
|
||||||
|
|
|
||||||
|
|
@ -1896,10 +1896,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
void CalculateAbsorbResistBlock(Unit* pCaster, SpellNonMeleeDamage* damageInfo, SpellEntry const* spellProto, WeaponAttackType attType = BASE_ATTACK);
|
void CalculateAbsorbResistBlock(Unit* pCaster, SpellNonMeleeDamage* damageInfo, SpellEntry const* spellProto, WeaponAttackType attType = BASE_ATTACK);
|
||||||
void CalculateHealAbsorb(uint32 heal, uint32* absorb);
|
void CalculateHealAbsorb(uint32 heal, uint32* absorb);
|
||||||
|
|
||||||
void UpdateSpeed(UnitMoveType mtype, bool forced, float ratio = 1.0f);
|
void UpdateSpeed(UnitMoveType mtype, bool forced, float ratio = 1.0f, bool ignoreChange = false);
|
||||||
float GetSpeed(UnitMoveType mtype) const;
|
float GetSpeed(UnitMoveType mtype) const;
|
||||||
float GetSpeedRate(UnitMoveType mtype) const { return m_speed_rate[mtype]; }
|
float GetSpeedRate(UnitMoveType mtype) const { return m_speed_rate[mtype]; }
|
||||||
void SetSpeedRate(UnitMoveType mtype, float rate, bool forced = false);
|
void SetSpeedRate(UnitMoveType mtype, float rate, bool forced = false, bool ignoreChange = false);
|
||||||
|
|
||||||
void KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpeed);
|
void KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpeed);
|
||||||
void KnockBackWithAngle(float angle, float horizontalSpeed, float verticalSpeed);
|
void KnockBackWithAngle(float angle, float horizontalSpeed, float verticalSpeed);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12645"
|
#define REVISION_NR "12646"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue