mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Get rid of monster movement flags, since it's really spline flags.
Thanks to Ralek for research.
This commit is contained in:
parent
4a3081e7d5
commit
db547a008a
20 changed files with 206 additions and 182 deletions
|
|
@ -124,7 +124,7 @@ void MovementInfo::Read(ByteBuffer &data)
|
|||
|
||||
data >> fallTime;
|
||||
|
||||
if(HasMovementFlag(MOVEFLAG_JUMPING))
|
||||
if(HasMovementFlag(MOVEFLAG_FALLING))
|
||||
{
|
||||
data >> j_velocity;
|
||||
data >> j_sinAngle;
|
||||
|
|
@ -132,7 +132,7 @@ void MovementInfo::Read(ByteBuffer &data)
|
|||
data >> j_xyspeed;
|
||||
}
|
||||
|
||||
if(HasMovementFlag(MOVEFLAG_SPLINE))
|
||||
if(HasMovementFlag(MOVEFLAG_SPLINE_ELEVATION))
|
||||
{
|
||||
data >> u_unk1;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ void MovementInfo::Write(ByteBuffer &data)
|
|||
|
||||
data << fallTime;
|
||||
|
||||
if(HasMovementFlag(MOVEFLAG_JUMPING))
|
||||
if(HasMovementFlag(MOVEFLAG_FALLING))
|
||||
{
|
||||
data << j_velocity;
|
||||
data << j_sinAngle;
|
||||
|
|
@ -178,7 +178,7 @@ void MovementInfo::Write(ByteBuffer &data)
|
|||
data << j_xyspeed;
|
||||
}
|
||||
|
||||
if(HasMovementFlag(MOVEFLAG_SPLINE))
|
||||
if(HasMovementFlag(MOVEFLAG_SPLINE_ELEVATION))
|
||||
{
|
||||
data << u_unk1;
|
||||
}
|
||||
|
|
@ -362,7 +362,7 @@ bool Unit::haveOffhandWeapon() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, MonsterMovementFlags flags, uint32 Time, Player* player)
|
||||
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, SplineFlags flags, uint32 Time, Player* player)
|
||||
{
|
||||
float moveTime = Time;
|
||||
|
||||
|
|
@ -375,27 +375,27 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
|
|||
data << uint8(type); // unknown
|
||||
switch(type)
|
||||
{
|
||||
case 0: // normal packet
|
||||
case SPLINETYPE_NORMAL: // normal packet
|
||||
break;
|
||||
case 1: // stop packet (raw pos?)
|
||||
case SPLINETYPE_STOP: // stop packet (raw pos?)
|
||||
SendMessageToSet( &data, true );
|
||||
return;
|
||||
case 2: // facing spot, not used currently
|
||||
case SPLINETYPE_FACINGSPOT: // facing spot, not used currently
|
||||
data << float(0);
|
||||
data << float(0);
|
||||
data << float(0);
|
||||
break;
|
||||
case 3: // not used currently
|
||||
case SPLINETYPE_FACINGTARGET: // not used currently
|
||||
data << uint64(0); // probably target guid (facing target?)
|
||||
break;
|
||||
case 4: // not used currently
|
||||
case SPLINETYPE_FACINGANGLE: // not used currently
|
||||
data << float(0); // facing angle
|
||||
break;
|
||||
}
|
||||
|
||||
data << uint32(flags);
|
||||
|
||||
if(flags & MONSTER_MOVE_WALK)
|
||||
if(flags & SPLINEFLAG_WALKMODE)
|
||||
moveTime *= 1.05f;
|
||||
|
||||
data << uint32(moveTime); // Time in between points
|
||||
|
|
@ -408,7 +408,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
|
|||
SendMessageToSet( &data, true );
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, MonsterMovementFlags flags)
|
||||
void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, SplineFlags flags)
|
||||
{
|
||||
uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32);
|
||||
|
||||
|
|
@ -10573,26 +10573,26 @@ struct UpdateWalkModeHelper
|
|||
void Unit::UpdateWalkMode(Unit* source, bool self)
|
||||
{
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->CallForAllControlledUnits(UpdateWalkModeHelper(source),false,true,true,true);
|
||||
((Player*)this)->CallForAllControlledUnits(UpdateWalkModeHelper(source), false, true, true, true);
|
||||
else if (self)
|
||||
{
|
||||
bool on = source->GetTypeId() == TYPEID_PLAYER
|
||||
? ((Player*)source)->HasMovementFlag(MOVEFLAG_WALK_MODE)
|
||||
: ((Creature*)source)->HasMonsterMoveFlag(MONSTER_MOVE_WALK);
|
||||
: ((Creature*)source)->HasSplineFlag(SPLINEFLAG_WALKMODE);
|
||||
|
||||
if (on)
|
||||
{
|
||||
if (((Creature*)this)->isPet() && hasUnitState(UNIT_STAT_FOLLOW))
|
||||
((Creature*)this)->AddMonsterMoveFlag(MONSTER_MOVE_WALK);
|
||||
((Creature*)this)->AddSplineFlag(SPLINEFLAG_WALKMODE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((Creature*)this)->isPet())
|
||||
((Creature*)this)->RemoveMonsterMoveFlag(MONSTER_MOVE_WALK);
|
||||
((Creature*)this)->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
|
||||
}
|
||||
}
|
||||
else
|
||||
CallForAllControlledUnits(UpdateWalkModeHelper(source),false,true,true);
|
||||
CallForAllControlledUnits(UpdateWalkModeHelper(source), false, true, true);
|
||||
}
|
||||
|
||||
void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
|
|
@ -10603,11 +10603,11 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
|||
case MOVE_RUN:
|
||||
case MOVE_WALK:
|
||||
case MOVE_SWIM:
|
||||
if (GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isPet() && hasUnitState(UNIT_STAT_FOLLOW))
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet() && hasUnitState(UNIT_STAT_FOLLOW))
|
||||
{
|
||||
if(Unit* owner = GetOwner())
|
||||
{
|
||||
SetSpeedRate(mtype,owner->GetSpeedRate(mtype),forced);
|
||||
SetSpeedRate(mtype, owner->GetSpeedRate(mtype), forced);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -12449,13 +12449,13 @@ void Unit::StopMoving()
|
|||
clearUnitState(UNIT_STAT_MOVING);
|
||||
|
||||
// send explicit stop packet
|
||||
// player expected for correct work MONSTER_MOVE_WALK
|
||||
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, GetTypeId()==TYPEID_PLAYER ? MONSTER_MOVE_WALK : MONSTER_MOVE_NONE, 0);
|
||||
// player expected for correct work SPLINEFLAG_WALKMODE
|
||||
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, GetTypeId() == TYPEID_PLAYER ? SPLINEFLAG_WALKMODE : SPLINEFLAG_NONE, 0);
|
||||
|
||||
// update position and orientation for near players
|
||||
WorldPacket data;
|
||||
BuildHeartBeatMsg(&data);
|
||||
SendMessageToSet(&data,false);
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
void Unit::SetFeared(bool apply, uint64 const& casterGUID, uint32 spellID, uint32 time)
|
||||
|
|
@ -12468,7 +12468,7 @@ void Unit::SetFeared(bool apply, uint64 const& casterGUID, uint32 spellID, uint3
|
|||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
|
||||
GetMotionMaster()->MovementExpired(false);
|
||||
CastStop(GetGUID()==casterGUID ? spellID : 0);
|
||||
CastStop(GetGUID() == casterGUID ? spellID : 0);
|
||||
|
||||
Unit* caster = ObjectAccessor::GetUnit(*this,casterGUID);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue