Unify changing movement style for Units

This commit is contained in:
kid10 2012-08-20 21:21:54 +02:00 committed by Antz
parent b81725c43c
commit 56674de682
7 changed files with 698 additions and 785 deletions

View file

@ -764,7 +764,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
pCurrChar->CastSpell(pCurrChar, 20584, true); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) pCurrChar->CastSpell(pCurrChar, 20584, true); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
pCurrChar->CastSpell(pCurrChar, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) pCurrChar->CastSpell(pCurrChar, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
pCurrChar->SetMovement(MOVE_WATER_WALK); pCurrChar->SetWaterWalk(true);
} }
pCurrChar->ContinueTaxiFlight(); pCurrChar->ContinueTaxiFlight();

View file

@ -2554,7 +2554,32 @@ void Creature::SetLevitate(bool enable)
m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING); m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING);
else else
m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING); m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING);
WorldPacket data(enable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9); WorldPacket data(enable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);
data << GetPackGUID(); data << GetPackGUID();
SendMessageToSet(&data, true); SendMessageToSet(&data, true);
} }
void Creature::SetRoot(bool enable)
{
if (enable)
m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
else
m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT);
WorldPacket data(enable ? SMSG_SPLINE_MOVE_ROOT : SMSG_SPLINE_MOVE_UNROOT, 9);
data << GetPackGUID();
SendMessageToSet(&data, true);
}
void Creature::SetWaterWalk(bool enable)
{
if (enable)
m_movementInfo.AddMovementFlag(MOVEFLAG_WATERWALKING);
else
m_movementInfo.RemoveMovementFlag(MOVEFLAG_WATERWALKING);
WorldPacket data(enable ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK, 9);
data << GetPackGUID();
SendMessageToSet(&data, true);
}

View file

@ -535,6 +535,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
void SetWalk(bool enable); void SetWalk(bool enable);
void SetLevitate(bool enable); void SetLevitate(bool enable);
void SetRoot(bool enable) override;
void SetWaterWalk(bool enable) override;
uint32 GetShieldBlockValue() const override // dunno mob block value uint32 GetShieldBlockValue() const override // dunno mob block value
{ {

View file

@ -4998,9 +4998,9 @@ bool ChatHandler::HandleWaterwalkCommand(char* args)
return false; return false;
if (value) if (value)
player->SetMovement(MOVE_WATER_WALK); // ON player->SetWaterWalk(true); // ON
else else
player->SetMovement(MOVE_LAND_WALK); // OFF player->SetWaterWalk(false); // OFF
PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str()); PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
if (needReportToTarget(player)) if (needReportToTarget(player))

File diff suppressed because it is too large Load diff

View file

@ -401,14 +401,6 @@ enum RaidGroupError
ERR_RAID_GROUP_REQUIREMENTS_UNMATCH = 4 ERR_RAID_GROUP_REQUIREMENTS_UNMATCH = 4
}; };
enum PlayerMovementType
{
MOVE_ROOT = 1,
MOVE_UNROOT = 2,
MOVE_WATER_WALK = 3,
MOVE_LAND_WALK = 4
};
enum DrunkenState enum DrunkenState
{ {
DRUNKEN_SOBER = 0, DRUNKEN_SOBER = 0,
@ -1899,7 +1891,8 @@ class MANGOS_DLL_SPEC Player : public Unit
StopMirrorTimer(FIRE_TIMER); StopMirrorTimer(FIRE_TIMER);
} }
void SetMovement(PlayerMovementType pType); void SetRoot(bool enable) override;
void SetWaterWalk(bool enable) override;
void JoinedChannel(Channel* c); void JoinedChannel(Channel* c);
void LeftChannel(Channel* c); void LeftChannel(Channel* c);

View file

@ -1459,8 +1459,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
// recommend use MonsterMove/MonsterMoveWithSpeed for most case that correctly work with movegens // recommend use MonsterMove/MonsterMoveWithSpeed for most case that correctly work with movegens
// if used additional args in ... part then floats must explicitly casted to double // if used additional args in ... part then floats must explicitly casted to double
void SendHeartBeat(); void SendHeartBeat();
bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_LEVITATING);}
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE);} bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_LEVITATING); }
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE); }
bool IsRooted() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_ROOT); }
virtual void SetRoot(bool enabled) {}
virtual void SetWaterWalk(bool enabled) {}
void SetInFront(Unit const* target); void SetInFront(Unit const* target);
void SetFacingTo(float ori); void SetFacingTo(float ori);