private LobbyServerReadyNotification LobbyServerReady(ClientConnection connection) { return(new LobbyServerReadyNotification { AccountData = PlayerUtils.GetAccountData(connection), AlertMissionData = new LobbyAlertMissionDataNotification(), CharacterDataList = DummyLobbyData.CreateCharacterDataList(), CommerceURL = "http://127.0.0.1/AtlasCommerce", EnvironmentType = EnvironmentType.External, FactionCompetitionStatus = new FactionCompetitionNotification(), FriendStatus = new FriendStatusNotification { FriendList = FriendListUtils.GetFriendList(connection.AccountId) }, GroupInfo = new LobbyPlayerGroupInfo { SelectedQueueType = GameType.Practice, MemberDisplayName = connection.UserName, // ChararacterInfo = DummyLobbyData.CreateLobbyCharacterInfo(CharacterType.Archer), Members = new List <UpdateGroupMemberData>() }, SeasonChapterQuests = new LobbySeasonQuestDataNotification { SeasonChapterQuests = new Dictionary <int, SeasonChapterQuests>() }, ServerQueueConfiguration = DummyLobbyData.CreateServerQueueConfiguration(), Status = new LobbyStatusNotification { AllowRelogin = false, ServerLockState = ServerLockState.Unlocked, ServerMessageOverrides = new ServerMessageOverrides(), ClientAccessLevel = ClientAccessLevel.Full, HasPurchasedGame = true, GameplayOverrides = DummyLobbyData.CreateLobbyGameplayOverrides(), UtcNow = DateTime.UtcNow, PacificNow = DateTime.Now, // TODO: Should be pacific time ErrorReportRate = TimeSpan.FromMinutes(3) } }); }
public async Task OnMessage(ClientConnection connection, object requestData) { /* * The clients sends this request everytime something important to loadout configuration changes * apparently it only sends in PlayerInfoUpdate the thing that was modified and everything else is is null * * ie: if the client changes freelancer, it only sends the new value of CharacterType and all other values are null */ PlayerInfoUpdateRequest request = (PlayerInfoUpdateRequest)requestData; if (request.GameType != null) { connection.SelectedGameType = request.GameType.Value; } if (request.PlayerInfoUpdate.ContextualReadyState != null) { if (request.PlayerInfoUpdate.ContextualReadyState.Value.ReadyState == ReadyState.Ready) { var practice = DummyLobbyData.CreatePracticeGameNotification(connection); Log.Print(LogType.Network, $"Responding {JsonConvert.SerializeObject(practice)}"); await connection.SendMessage(practice); var practiceGameInfo = DummyLobbyData.CreatePracticeGameInfoNotification(connection); Log.Print(LogType.Network, $"Responding {JsonConvert.SerializeObject(practiceGameInfo)}"); await connection.SendMessage(practiceGameInfo); return; } } // Change Selected Freelancer else if (request.PlayerInfoUpdate.CharacterType != null) { connection.SelectedCharacter = request.PlayerInfoUpdate.CharacterType.Value; PlayerData.SaveSelectedCharacter(connection.AccountId, (int)connection.SelectedCharacter); var accountDataUpdate = new PlayerAccountDataUpdateNotification { AccountData = PlayerUtils.GetAccountData(connection) }; Log.Print(LogType.Debug, $"Responding {JsonConvert.SerializeObject(accountDataUpdate)}"); await connection.SendMessage(accountDataUpdate); var response = new PlayerInfoUpdateResponse { CharacterInfo = DummyLobbyData.CreateLobbyCharacterInfo(connection.SelectedCharacter), OriginalPlayerInfoUpdate = request.PlayerInfoUpdate, ResponseId = request.RequestId }; await connection.SendMessage(response); return; } else if (request.PlayerInfoUpdate.CharacterSkin != null) { connection.Loadout.Skin = request.PlayerInfoUpdate.CharacterSkin.Value; } else if (request.PlayerInfoUpdate.CharacterCards != null) { connection.Loadout.Cards = request.PlayerInfoUpdate.CharacterCards.Value; } else if (request.PlayerInfoUpdate.CharacterMods != null) { connection.Loadout.Mods = request.PlayerInfoUpdate.CharacterMods.Value; } else if (request.PlayerInfoUpdate.CharacterAbilityVfxSwaps != null) { connection.Loadout.AbilityVfxSwaps = request.PlayerInfoUpdate.CharacterAbilityVfxSwaps.Value; } else if (request.PlayerInfoUpdate.CharacterLoadoutChanges != null) { // } /*if (request.PlayerInfoUpdate.CharacterType == null) * { * Log.Print(LogType.Warning, "CharacterType is null in PlayerInfoUpdateRequest"); * return; * }/ * * var accountDataUpdate = new PlayerAccountDataUpdateNotification * { * AccountData = PlayerUtils.GetAccountData(connection) * }; * accountDataUpdate.AccountData.AccountComponent.LastCharacter = request.PlayerInfoUpdate.CharacterType.Value; * Log.Print(LogType.Network, $"Responding {JsonConvert.SerializeObject(accountDataUpdate)}"); * await connection.SendMessage(accountDataUpdate); * * var response = new PlayerInfoUpdateResponse * { * CharacterInfo = DummyLobbyData.CreateLobbyCharacterInfo(request.PlayerInfoUpdate.CharacterType.Value), * // PlayerInfo = DummyLobbyData.CreateLobbyPlayerInfo(), * OriginalPlayerInfoUpdate = request.PlayerInfoUpdate, * ResponseId = request.RequestId * }; * * if (request.PlayerInfoUpdate.CharacterCards != null) * response.CharacterInfo.CharacterCards = request.PlayerInfoUpdate.CharacterCards.Value; * * if (request.PlayerInfoUpdate.CharacterMods != null) * response.CharacterInfo.CharacterMods = request.PlayerInfoUpdate.CharacterMods.Value; * * // response.PlayerInfo.PlayerId = request.PlayerInfoUpdate.PlayerId; * // response.PlayerInfo.CharacterInfo = response.CharacterInfo; * Log.Print(LogType.Network, $"Responding {JsonConvert.SerializeObject(response)}"); * await connection.SendMessage(response); */ /*try * { * var response = new PlayerInfoUpdateResponse * { * //PlayerInfo = null, * CharacterInfo = DummyLobbyData.CreateLobbyCharacterInfo(connection.SelectedCharacter), * OriginalPlayerInfoUpdate = request.PlayerInfoUpdate, * ResponseId = request.RequestId * }; * await connection.SendMessage(response); * } * catch(Exception e) { * Log.Print(LogType.Debug, e.Message); * } */ }
public async Task OnMessage(LobbyServerConnection connection, object requestData) { PlayerInfoUpdateRequest request = (PlayerInfoUpdateRequest)requestData; //if (request.GameType != null) // connection.PlayerInfo.SetGameType(request.GameType.Value); // Change ReadyState if (request.PlayerInfoUpdate.ContextualReadyState != null) { if (request.PlayerInfoUpdate.ContextualReadyState.Value.ReadyState == ReadyState.Ready) { //LobbyQueueManager.HandleReady(connection); Log.Print(LogType.Debug, "HANDLE CHANGE READYSTATE"); LobbyQueueManager.AddPlayerToQueue(connection); } else { Log.Print(LogType.Warning, "Contextual Ready state unhandled (PlayerInfoUpdateRequestHandler)"); } } // Change Selected Freelancer else if (request.PlayerInfoUpdate.CharacterType != null) { //connection.PlayerInfo.SetCharacterType(request.PlayerInfoUpdate.CharacterType.Value); //PlayerData.SaveSelectedCharacter(connection.PlayerInfo.GetAccountId(), (int)connection.PlayerInfo.GetCharacterType()); var accountDataUpdate = new PlayerAccountDataUpdateNotification { AccountData = PlayerUtils.GetAccountData(connection) }; await connection.SendMessage(accountDataUpdate); var response = new PlayerInfoUpdateResponse { //CharacterInfo = connection.PlayerInfo.GetLobbyPlayerInfo().CharacterInfo, OriginalPlayerInfoUpdate = request.PlayerInfoUpdate, ResponseId = request.RequestId }; await connection.SendMessage(response); return; } //Change Skin else if (request.PlayerInfoUpdate.CharacterSkin != null) { //connection.PlayerInfo.SetSkin(request.PlayerInfoUpdate.CharacterSkin.Value); } //Chnage Catalyst else if (request.PlayerInfoUpdate.CharacterCards != null) { //connection.PlayerInfo.SetCards(request.PlayerInfoUpdate.CharacterCards.Value); } // Chnage Mods else if (request.PlayerInfoUpdate.CharacterMods != null) { //connection.PlayerInfo.SetMods(request.PlayerInfoUpdate.CharacterMods.Value); } // Change Vfx else if (request.PlayerInfoUpdate.CharacterAbilityVfxSwaps != null) { //connection.PlayerInfo.SetAbilityVfxSwaps(request.PlayerInfoUpdate.CharacterAbilityVfxSwaps.Value); } // Chnage Loadout else if (request.PlayerInfoUpdate.CharacterLoadoutChanges != null) { Log.Print(LogType.Warning, "Changes in loadout not implemented yet(PlayerInfoUpdateRequestHandler.cs)"); } }