예제 #1
0
 public static void HandleCreate(byte[] Buffer, GameClient client)
 {
     if (client.Action == 1)
     {
         var CE = new CMsgRegister();
         CE.Deserialize(Buffer);
         foreach (char p in CE.Name)
         {
             if (Constants.InvalidCharacters.Contains(p))
             {
                 client.Send(new CMsgTalk(Color.Orange, ChatType.PopUP, "Invalid Characters in the name!", "", "ALLUSERS"));
                 return;
             }
         }
         // TODO : Check if the name exists in the database.
         if (PlayerTable.CheckName(CE.Name, client.MyServer))
         {
             client.Send(new CMsgTalk(Color.Orange, ChatType.PopUP, "Choose another name!", "", "ALLUSERS"));
             return;
         }
         // IF DONE
         client.Player           = new Player();
         client.Player.UID       = client.CreatedUID;
         client.Player.Name      = CE.Name;
         client.Player.Level     = 1;
         client.Player.Spouse    = "";
         client.Player.Class     = GetClass(CE.Class);
         client.Player.Body      = CE.Body;
         client.Player.Face      = 150;
         client.Player.Hairstyle = 537;
         client.Player.Mesh      = (uint)((10000 * client.Player.Face) + client.Player.Body);
         PlayerTable.Insert(client.Player);
         client.Send(new CMsgTalk(Color.Orange, ChatType.PopUP, "ANSWER_OK", "", "ALLUSERS"));
         client.Send(new CMsgUserInfo(client.Player));
         Console.WriteLine($"[{client.IP}] {client.Player.Name} has been created!");
     }
 }