From 74733de50a6da8c0049bd4fba922b5e69d6a01ae Mon Sep 17 00:00:00 2001 From: PWall <34860495+PWall2222@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:58:10 +0100 Subject: [PATCH] fix: incognito via party id --- NOWT/Helpers/LiveMatch.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/NOWT/Helpers/LiveMatch.cs b/NOWT/Helpers/LiveMatch.cs index 5b9b7dd..b324080 100644 --- a/NOWT/Helpers/LiveMatch.cs +++ b/NOWT/Helpers/LiveMatch.cs @@ -133,7 +133,7 @@ private async Task GetPrePlayerInfo(RiotPrePlayer riotPlayer, sbyte inde player.IdentityData = cardTask.Result; player.RankData = historyTask.Result; player.PlayerUiData = presenceTask.Result; - player.IgnData = await GetIgcUsernameAsync(riotPlayer.Subject, riotPlayer.PlayerIdentity.Incognito, player.PlayerUiData.PartyUuid).ConfigureAwait(false); + player.IgnData = await GetIgcUsernameAsync(riotPlayer.Subject, riotPlayer.PlayerIdentity.Incognito, false).ConfigureAwait(false); player.AccountLevel = !riotPlayer.PlayerIdentity.HideAccountLevel ? riotPlayer.PlayerIdentity.AccountLevel.ToString() : "-"; player.TeamId = "Blue"; player.Active = Visibility.Visible; @@ -162,7 +162,7 @@ private async Task GetLivePlayerInfo(RiotLivePlayer riotPlayer, sbyte in player.RankData = playerTask.Result; player.SkinData = skinTask.Result; player.PlayerUiData = presenceTask.Result; - player.IgnData = await GetIgcUsernameAsync(riotPlayer.Subject, riotPlayer.PlayerIdentity.Incognito, player.PlayerUiData.PartyUuid).ConfigureAwait(false); + player.IgnData = await GetIgcUsernameAsync(riotPlayer.Subject, riotPlayer.PlayerIdentity.Incognito, false).ConfigureAwait(false); player.AccountLevel = !riotPlayer.PlayerIdentity.HideAccountLevel ? riotPlayer.PlayerIdentity.AccountLevel.ToString() : "-"; player.TeamId = riotPlayer.TeamId; player.Active = Visibility.Visible; @@ -312,7 +312,7 @@ private async Task GetPartyPlayerInfo(Member riotPlayer, sbyte index, Gu PartyColour = "Transparent", Puuid = riotPlayer.PlayerIdentity.Subject }; - player.IgnData = await GetIgcUsernameAsync(riotPlayer.Subject, false, player.PlayerUiData.PartyUuid).ConfigureAwait(false); + player.IgnData = await GetIgcUsernameAsync(riotPlayer.Subject, false, true).ConfigureAwait(false); player.AccountLevel = !riotPlayer.PlayerIdentity.HideAccountLevel ? riotPlayer.PlayerIdentity.AccountLevel.ToString() : "-"; player.TeamId = "Blue"; player.Active = Visibility.Visible; @@ -346,13 +346,13 @@ public async Task> PartyOutputAsync() return playerList; } - private static async Task GetIgcUsernameAsync(Guid puuid, bool isIncognito, Guid partyId) + private static async Task GetIgcUsernameAsync(Guid puuid, bool isIncognito, bool inParty) { IgnData ignData = new(); ignData.TrackerEnabled = Visibility.Hidden; ignData.TrackerDisabled = Visibility.Visible; - if (isIncognito && partyId != Constants.PPartyId) + if (isIncognito && !inParty) { ignData.Username = "----"; return ignData; @@ -877,6 +877,9 @@ private async Task GetPresenceInfoAsync(Guid puuid, PresencesRespo MatchInfo.GameModeImage = new Uri(Constants.LocalAppDataPath + $"\\ValAPI\\gamemodeimg\\{gameModeId}.png"); } + catch (InvalidOperationException) { + return playerUiData; + } catch (Exception e) { Constants.Log.Error("GetPresenceInfoAsync Failed; To Base 64 failed: {Exception}", e);