private bool HandleMovement(Item item) { if (this.room.GetRoomItemHandler().GetItem(item.Id) == null) { return(false); } Point newPoint = MovementManagement.HandleMovement(item.Coordinate, this.movement); int newRot = MovementManagement.HandleRotation(item.Rotation, this.rotation); if (newPoint != item.Coordinate || newRot != item.Rotation) { int OldX = item.GetX; int OldY = item.GetY; double OldZ = item.GetZ; if (this.room.GetRoomItemHandler().SetFloorItem(null, item, newPoint.X, newPoint.Y, newRot, false, false, (newRot != item.Rotation))) { ServerPacket Message = new ServerPacket(ServerPacketHeader.SlideObjectBundleMessageComposer); Message.WriteInteger(OldX); Message.WriteInteger(OldY); Message.WriteInteger(newPoint.X); Message.WriteInteger(newPoint.Y); Message.WriteInteger(1); Message.WriteInteger(item.Id); Message.WriteString(OldZ.ToString().Replace(',', '.')); Message.WriteString(item.GetZ.ToString().Replace(',', '.')); Message.WriteInteger(0); this.room.SendPacket(Message); } } return(false); }
private void HandleMovement(Item item) { if (room.GetRoomItemHandler().GetItem(item.Id) == null) { return; } RoomUser roomUser = room.GetGameMap().SquareHasUserNear(item.GetX, item.GetY); if (roomUser != null) { this.handler.TriggerCollision(roomUser, item); return; } item.movement = room.GetGameMap().GetEscapeMovement(item.GetX, item.GetY, item.movement); if (item.movement == MovementState.none) { return; } Point newPoint = MovementManagement.HandleMovement(item.Coordinate, item.movement); if (newPoint != item.Coordinate) { int OldX = item.GetX; int OldY = item.GetY; double OldZ = item.GetZ; if (this.room.GetRoomItemHandler().SetFloorItem(null, item, newPoint.X, newPoint.Y, item.Rotation, false, false, false)) { ServerPacket Message = new ServerPacket(ServerPacketHeader.SlideObjectBundleMessageComposer); Message.WriteInteger(OldX); Message.WriteInteger(OldY); Message.WriteInteger(newPoint.X); Message.WriteInteger(newPoint.Y); Message.WriteInteger(1); Message.WriteInteger(item.Id); Message.WriteString(OldZ.ToString().Replace(',', '.')); Message.WriteString(item.GetZ.ToString().Replace(',', '.')); Message.WriteInteger(0); //ServerMessage Message = new ServerMessage(Outgoing.UpdateItemOnRoom); //item.Serialize(Message, room.OwnerId); this.room.SendPacket(Message); } } return; }