public void TryLogin(string username, string password) { if (Settings.LoginDebug) { ConsoleUtils.Write(ConsoleMsgType.Info, "User {0} is trying to login\n", username); } Database db = new Database(Server.AuthDbConString); MySqlDataReader reader = db.ReaderQuery( "SELECT `account_id`, `permission` FROM `login` WHERE `userid` = @userid AND `password` = @password", new string[] { "userid", "password" }, new object[] { username, password } ); if (!reader.HasRows) { ClientPacketHandler.send_LoginResult(this, Packets.LoginResult.LOGINRESULT_FAIL); if (Settings.LoginDebug) { ConsoleUtils.Write(ConsoleMsgType.Info, "User {0} login refused (Invalid Credentials)\n", username); } return; } reader.Read(); this.AccountId = (int)reader["account_id"]; this.Permission = (byte)reader["permission"]; this.UserId = (String)username; if (Settings.LoginDebug) { ConsoleUtils.Write(ConsoleMsgType.Info, "User {0} login accepted\n", username); } ClientPacketHandler.send_LoginResult(this, Packets.LoginResult.LOGINRESULT_SUCCESS); }
private void UserJoinGame(Client client, byte server_index) { byte[] key = { 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; // TODO : Generate a key ServerPacketHandler.send_ClientJoin(ServerList[server_index], client, key); ClientPacketHandler.send_JoinGame(client, key); }
public NetworkManager() { ServerPacketHandler.Start(); ClientPacketHandler.Start(); }
internal static void OnUserRequestServerList(Client client) { ClientPacketHandler.send_ServerList(client, Server.Instance.ServerList); }
private void PacketReceived(Client p, PacketStream data) { ClientPacketHandler.PacketReceived(p, data); }