private static void AppendConnect(CMsgConnect connect, GameClient client) { client.CreatedUID = connect.Identifier; GameClient confirmationClient; // Prevent logged on clients to login again. if (client.MyServer.ConfirmationPool.TryRemove(connect.Identifier, out confirmationClient) || client.MyServer.GamePool.TryRemove(connect.Identifier, out confirmationClient)) { confirmationClient.Disconnect(); client.Send(new CMsgTalk(Color.Orange, ChatType.Dialog, "You're already logged in.", "", "ALLUSERS")); client.Disconnect(); return; } if (!client.IsCreating) { client.MyServer.ConfirmationPool.TryAdd(connect.Identifier, client); } else { client.IsCreating = false; } if (!PlayerTable.Load(client.CreatedUID, ref client.Player, client.MyServer)) { client.IsCreating = true; client.Send(new CMsgTalk(Color.Orange, ChatType.Dialog, "NEW_ROLE", "", "ALLUSERS")); return; } // BELOW IS ONLY IF THE ACCOUNT IS VALID client.Send(new CMsgTalk(Color.Orange, ChatType.Dialog, "ANSWER_OK", "", "ALLUSERS")); client.Send(new CMsgUserInfo(client.Player)); client.MyServer.ConfirmationPool.TryRemove(connect.Identifier, out confirmationClient); }
public static void HandleConnect(byte[] packet, GameClient client) { if (client.Action == 1) { CMsgConnect connect = new CMsgConnect(); connect.Deserialize(packet); AppendConnect(connect, client); } else { client.Disconnect(); } }