Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void LOGIN(TcpConnection connection, ClientMessage message)
- {
- string username = message.ReadNextArgument();
- string password = message.ReadNextArgument();
- User user = UserManager.GetUser(username);
- ServerMessage response;
- if (user != null)
- {
- if (user.Password == password)
- {
- connection.User = user;
- if (connection.User.Hand == null)
- connection.User.Hand = new UserHand(connection.User.Id);
- response = new ServerMessage("U_RTS");
- response.AppendBreakObj("fuse_performance_panel");
- connection.SendMessage(response);
- try
- {
- string roomEntryData = message.ReadNextArgument();
- if (roomEntryData == "0")
- {
- connection.User.Room = RoomManager.GetRoom(37302);
- #region Objects
- response = new ServerMessage("OBJECTS WORLD");
- response.Append(" 0 " + connection.User.Room.Model);
- response.Append("{13}r2112 roommatic 21 12 1 4{13}r2212 roommatic 22 12 1 4{13}r2312 roommatic 23 12 1 4{13}r2412 roommatic 24 12 1 4".Replace("{13}", (char)13 + ""));
- connection.SendMessage(response);
- #endregion
- #region Heightmap
- response = new ServerMessage("HEIGHTMAP");
- response.AppendBreakObj(connection.User.Room.Map.SerializeHeightmap(connection.User.Room));
- connection.SendMessage(response);
- #endregion
- #region Users
- response = new ServerMessage("USERS");
- foreach (RoomUser roomUser in connection.User.Room.RoomUsers.Values)
- {
- roomUser.Serialize(response);
- }
- connection.SendMessage(response);
- connection.User.Room.AddUser(connection);
- connection.User.RoomUser = connection.User.Room.RoomUsers[connection.User.Name];
- response = new ServerMessage("STATUS");
- connection.User.RoomUser.SerializeStatus(response);
- connection.User.Room.SendMessage(response);
- response = new ServerMessage("USERS");
- connection.User.RoomUser.Serialize(response);
- connection.User.Room.SendMessage(response);
- #endregion
- }
- }
- catch
- {
- }
- }
- else
- {
- response = new ServerMessage("ERROR:");
- response.AppendDelimObj("login incorrect", ' ');
- connection.SendMessage(response);
- }
- }
- else
- {
- response = new ServerMessage("ERROR:");
- response.AppendDelimObj("login incorrect", ' ');
- connection.SendMessage(response);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement