public static void FireOnCharacterAuthenticationResultArrivedEvent(SecretNetworkResponseType response, string sessionKey, string accountName, string character, uint accountId) { if (OnCharacterAuthenticationResultArrived != null) { OnCharacterAuthenticationResultArrived(response, sessionKey, accountName, character, accountId); } }
public void SendAuthenticationResponse(SecretNetworkResponseType response) { OutMessage.Reset(); OutMessage.AddByte((byte)SecretNetworkPacketType.Authentication); OutMessage.AddByte((byte)response); if (response != SecretNetworkResponseType.Success) { OutMessage.DisconnectAfterMessage = true; } Send(OutMessage); }
public static void CheckCharacterAuthenticity(string sessionKey, string character) { if (ConfigManager.Instance[ConfigBool.UseExternalLoginServer]) { } else { uint accountId; string accountName; SecretNetworkResponseType response = LoginSecretCommunication.CheckCharacterAuthenticity(sessionKey, character, out accountName, out accountId); FireOnCharacterAuthenticationResultArrivedEvent(response, sessionKey, accountName, character, accountId); } }
private static void ProcessAuthenticationPacket() { SecretNetworkResponseType response = (SecretNetworkResponseType)Instance.InMessage.GetByte(); if (response == SecretNetworkResponseType.Success) { Instance.IsServerApproved = true; } else { Logger.Log(LogLevels.Error, "SECRET CONNECTION REFUSED WITH: " + response + "! PLEASE FIX!!!"); Program.ExitApplication(); } }
public static SecretNetworkResponseType CheckCharacterAuthenticity(string sessionKey, string character, out string accountName, out uint accountId) { accountId = 0; accountName = string.Empty; SecretNetworkResponseType response = SecretNetworkResponseType.Success; AccountModel account = LoginServerData.RetrieveAccountData(sessionKey); if (account == null) { response = SecretNetworkResponseType.SessionCouldNotBeFound; } else { accountId = account.AccountId; accountName = account.AccountName; if (LoginServer.OnlineCharactersByAccount.ContainsKey(account.AccountName) && !LoginServer.OnlineCharactersByAccount[account.AccountName].Equals(character)) { response = SecretNetworkResponseType.AnotherCharacterOnline; } else { bool isCharacterFound = false; for (int i = 0; i < account.Characters.Count; i++) { if (account.Characters[i].CharacterName.Equals(character, StringComparison.InvariantCulture)) { isCharacterFound = true; LoginServerData.SetCharacterOnline(sessionKey, character); break; } } if (!isCharacterFound) { response = SecretNetworkResponseType.CharacterCouldNotBeFound; } } } return(response); }