public void RxMsgFromClient(Player.Player player, byte[] msg) { if (msg[0] == 0x01 && msg.Length == 1) { // Keepalive byte[] omsg = { 0xFF }; player.SendMsgToClient(omsg); } else if (msg[0] == 0x01 && msg.Length == 75) { // Save login information. int pos = 3; string accountid = FLMsgType.GetUnicodeStringLen16(msg, ref pos); //string accDirPath = player.Runner.Server.AcctPath + Path.DirectorySeparatorChar + // FLMsgType.FLNameToFile(accountid); // If the account directory does not exist, create it and save the account id file. //if (!Directory.Exists(accDirPath)) // Directory.CreateDirectory(accDirPath); //FLUtility.WriteAccountID(accDirPath, accountid); byte[] omsg = { 0x02, 0x02 }; // If the account is banned kick the player. var accs = Old.CharacterDB.Database.GetAccount(accountid); //TODO: check if banning works; possibly make separate table for ID bans bool isbanned = false; if (accs != null) { if (accs[0].IsBanned) { isbanned = true; } } //if (File.Exists(accDirPath + Path.DirectorySeparatorChar + "banned")) //{ // FLMsgType.AddUInt8(ref omsg, FLMsgType.MSG_TYPE_LOGIN_REPORT_TYPE_BANNED); //} // If the account is already logged in, reject the login // fixme: this is not thread safe //else if (isbanned) { FLMsgType.AddUInt8(ref omsg, FLMsgType.MSG_TYPE_LOGIN_REPORT_TYPE_BANNED); } else if (player.Runner.Server.FindPlayerByAccountID(accountid) != null) { FLMsgType.AddUInt8(ref omsg, FLMsgType.MSG_TYPE_LOGIN_REPORT_TYPE_INUSE); } else { FLMsgType.AddUInt8(ref omsg, FLMsgType.MSG_TYPE_LOGIN_REPORT_TYPE_OKAY); } player.AccountID = accountid; player.SendMsgToClient(omsg); } else if (msg[0] == 0x05 && msg[1] == 0x03) { // char info request player.SaveCharFile(); player.SetState(DPCSelectingCharacterState.Instance()); } else { // Unexpected packet. Log and ignore it. player.Log.AddLog(LogType.FL_MSG, "Unexpected message: client rx", player.DPSess, msg); } }