private void OnPlayerPositionRotation(PlayerPositionRotationPacket p) { if (PlayerPositionRotation != null) PlayerPositionRotation.Invoke(this, new PacketEventArgs<PlayerPositionRotationPacket>(p)); }
public static void HandlePacketPlayerPositionRotation(Client client, PlayerPositionRotationPacket packet) { //client.Logger.Log(Chraft.Logger.LogLevel.Info, "Player position: {0} {1} {2}", packet.X, packet.Y, packet.Z); client.Owner.MoveTo(packet.X, packet.Y - Player.EyeGroundOffset, packet.Z, packet.Yaw, packet.Pitch); client.OnGround = packet.OnGround; client.Stance = packet.Stance; client.CheckAndUpdateChunks(packet.X, packet.Z); }
public static void ReadPlayerPositionRotation(Client client, PacketReader reader) { PlayerPositionRotationPacket ppr = new PlayerPositionRotationPacket(); ppr.Read(reader); if (!reader.Failed) Client.HandlePacketPlayerPositionRotation(client, ppr); }
public static void HandlePacketPlayerPositionRotation(TestClient client, PlayerPositionRotationPacket ppr) { client.Position = new AbsWorldCoords(ppr.X, ppr.Y, ppr.Z); client.SendPacket(ppr); client.WaitInitialPositionRequest = false; }
public static void HandlePacketPlayerPositionRotation(Client client, PlayerPositionRotationPacket packet) { double feetY = packet.Y - client.Owner.EyeHeight; if(client.WaitForInitialPosAck) { AbsWorldCoords coords = new AbsWorldCoords(packet.X, feetY, packet.Z); if(coords == client.Owner.LoginPosition) { client.WaitForInitialPosAck = false; client.SendSecondLoginSequence(); } } else { double threshold = 0.001; double diffX = Math.Abs(client.Owner.Position.X - packet.X); double diffY = Math.Abs(client.Owner.Position.Y - feetY); double diffZ = Math.Abs(client.Owner.Position.Z - packet.Z); if (diffX < threshold && diffY < threshold && diffZ < threshold) return; client.Owner.MoveTo(new AbsWorldCoords(packet.X, feetY, packet.Z), packet.Yaw, packet.Pitch); client.OnGround = packet.OnGround; client.Stance = packet.Stance; client.CheckAndUpdateChunks(packet.X, packet.Z); } }
public static void HandlePacketPlayerPositionRotation(TestClient client, PlayerPositionRotationPacket ppr) { client.Position = new AbsWorldCoords(ppr.X, ppr.Y, ppr.Z); }