In world with 3.1

This commit is contained in:
tomrus88 2009-02-25 20:52:47 +03:00
parent 5aad1e0169
commit d3872fa572
12 changed files with 156 additions and 152 deletions

View file

@ -142,7 +142,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
}
uint8 updatetype = UPDATETYPE_CREATE_OBJECT;
uint8 flags = m_updateFlag;
uint16 flags = m_updateFlag;
uint32 flags2 = 0;
/** lower flag1 **/
@ -256,7 +256,7 @@ void Object::DestroyForPlayer(Player *target) const
target->GetSession()->SendPacket( &data );
}
void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2) const
void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2) const
{
uint16 unk_flags = ((GetTypeId() == TYPEID_PLAYER) ? ((Player*)this)->m_movementInfo.unk1 : 0);
@ -264,7 +264,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
if(((Creature*)this)->isVehicle())
unk_flags |= 0x20; // always allow pitch
*data << (uint8)flags; // update flags
*data << (uint16)flags; // update flags
// 0x20
if (flags & UPDATEFLAG_LIVING)
@ -300,31 +300,13 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
*data << uint32(flags2); // movement flags
*data << uint16(unk_flags); // unknown 2.3.0
*data << uint32(getMSTime()); // time (in milliseconds)
}
// 0x40
if (flags & UPDATEFLAG_HAS_POSITION)
{
// 0x02
if(flags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
{
*data << (float)0;
*data << (float)0;
*data << (float)0;
*data << ((WorldObject *)this)->GetOrientation();
}
else
{
*data << ((WorldObject *)this)->GetPositionX();
*data << ((WorldObject *)this)->GetPositionY();
*data << ((WorldObject *)this)->GetPositionZ();
*data << ((WorldObject *)this)->GetOrientation();
}
}
// position
*data << ((WorldObject *)this)->GetPositionX();
*data << ((WorldObject *)this)->GetPositionY();
*data << ((WorldObject *)this)->GetPositionZ();
*data << ((WorldObject *)this)->GetOrientation();
// 0x20
if(flags & UPDATEFLAG_LIVING)
{
// 0x00000200
if(flags2 & MOVEMENTFLAG_ONTRANSPORT)
{
@ -412,23 +394,23 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(((Player*)this)->GetMotionMaster()->top());
uint32 flags3 = 0x00000300;
uint16 flags3 = 0x0000;
*data << uint32(flags3); // splines flag?
*data << uint16(flags3); // splines flag?
if(flags3 & 0x10000) // probably x,y,z coords there
if(flags3 & 0x80) // probably x,y,z coords there
{
*data << (float)0;
*data << (float)0;
*data << (float)0;
}
if(flags3 & 0x20000) // probably guid there
if(flags3 & 0x100) // probably guid there
{
*data << uint64(0);
}
if(flags3 & 0x40000) // may be orientation
if(flags3 & 0x200) // may be orientation
{
*data << (float)0;
}
@ -441,12 +423,20 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
uint32 inflighttime = uint32(path.GetPassedLength(fmg->GetCurrentNode(), x, y, z) * 32);
uint32 traveltime = uint32(path.GetTotalLength() * 32);
*data << uint8(0); // added in 3.1
*data << uint8(0); // added in 3.1
*data << uint32(inflighttime); // passed move time?
*data << uint32(traveltime); // full move time?
*data << uint32(0); // ticks count?
uint32 poscount = uint32(path.Size());
*data << float(0); // added in 3.1
*data << float(0); // added in 3.1
*data << float(0); // added in 3.1
*data << uint32(0); // added in 3.1
uint32 poscount = uint32(path.Size());
*data << uint32(poscount); // points count
for(uint32 i = 0; i < poscount; ++i)
@ -460,10 +450,10 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
/*for(uint32 i = 0; i < poscount; i++)
{
// path points
*data << (float)0;
*data << (float)0;
*data << (float)0;
// path points
*data << (float)0;
*data << (float)0;
*data << (float)0;
}*/
*data << path.GetNodes()[poscount-1].x;
@ -472,8 +462,45 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
// target position (path end)
/**data << ((Unit*)this)->GetPositionX();
*data << ((Unit*)this)->GetPositionY();
*data << ((Unit*)this)->GetPositionZ();*/
*data << ((Unit*)this)->GetPositionY();
*data << ((Unit*)this)->GetPositionZ();*/
}
}
else
{
if(flags & UPDATEFLAG_UNK1)
{
*data << uint8(0); // PGUID
*data << float(0);
*data << float(0);
*data << float(0);
*data << float(0);
*data << float(0);
*data << float(0);
*data << float(0);
*data << float(0);
}
else
{
// 0x40
if (flags & UPDATEFLAG_HAS_POSITION)
{
// 0x02
if(flags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
{
*data << (float)0;
*data << (float)0;
*data << (float)0;
*data << ((WorldObject *)this)->GetOrientation();
}
else
{
*data << ((WorldObject *)this)->GetPositionX();
*data << ((WorldObject *)this)->GetPositionY();
*data << ((WorldObject *)this)->GetPositionZ();
*data << ((WorldObject *)this)->GetOrientation();
}
}
}
}
@ -554,6 +581,12 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
*data << uint32(((Vehicle*)this)->GetVehicleId()); // vehicle id
*data << float(0); // facing adjustment
}
// 0x200
if(flags & UPDATEFLAG_UNK2)
{
*data << uint64(0);
}
}
void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *updateMask, Player *target) const