Skip to content

Commit

Permalink
Fix RichPresence showing the expedition number even if it's supposed …
Browse files Browse the repository at this point in the history
…to be hidden
  • Loading branch information
AuriRex committed Sep 15, 2023
1 parent cfc65ff commit 2418439
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
5 changes: 4 additions & 1 deletion TheArchive.Core/Core/Managers/PresenceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ public static string CharacterName
[FallbackPresenceFormatProvider(nameof(ExpeditionTierIsSpecial), true)]
public static bool ExpeditionTierIsSpecial { get; set; } = false; // True on R6 Extended Levels

[FallbackPresenceFormatProvider(nameof(ExpeditionSkipExpNumberInName), true)]
public static bool ExpeditionSkipExpNumberInName { get; set; } = false;

[FallbackPresenceFormatProvider(nameof(ExpeditionNumber))]
public static string ExpeditionNumber { get; set; } = string.Empty; // 1, 2, 3, 4

Expand Down Expand Up @@ -327,7 +330,7 @@ public static string Expedition
{
get
{
if(Get<bool>(nameof(ExpeditionTierIsSpecial)))
if(Get<bool>(nameof(ExpeditionSkipExpNumberInName)))
return $"{Get(nameof(ExpeditionTier))}";
return $"{ExpeditionWithNumber}";
}
Expand Down
45 changes: 44 additions & 1 deletion TheArchive.IL2CPP/Features/Presence/RichPresenceCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using SNetwork;
using System;
using System.Linq;
using System.Runtime.CompilerServices;
using TheArchive.Core.Attributes;
using TheArchive.Core.FeaturesAPI;
using TheArchive.Core.Managers;
Expand Down Expand Up @@ -209,7 +210,49 @@ public static string ExpeditionTier
}

[PresenceFormatProvider(nameof(PresenceManager.ExpeditionTierIsSpecial))]
public static bool ExpeditionTierIsSpecial => (RundownManager.ActiveExpedition?.Descriptive?.Prefix ?? "?").EndsWith("X");
public static bool ExpeditionTierIsSpecial
{
get
{
#if IL2CPP
if (Is.R6OrLater)
return IsActiveExpeditionSpecial();
#endif
return false;
}
}

[PresenceFormatProvider(nameof(PresenceManager.ExpeditionSkipExpNumberInName))]
public static bool ExpeditionSkipExpNumberInName
{
get
{
#if IL2CPP
try
{
if (Is.R6OrLater)
return ShouldSkipExpNumberInName();
}
catch { }
#endif
return false;
}
}

#if IL2CPP
[MethodImpl(MethodImplOptions.NoInlining)]
public static bool IsActiveExpeditionSpecial()
{
return RundownManager.ActiveExpedition?.Descriptive?.IsExtraExpedition ?? false;
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static bool ShouldSkipExpNumberInName()
{
return RundownManager.ActiveExpedition?.Descriptive?.SkipExpNumberInName ?? false;
}
#endif


[PresenceFormatProvider(nameof(PresenceManager.ExpeditionNumber))]
public static int ExpeditionNumber { get; set; } = 0;
Expand Down

0 comments on commit 2418439

Please sign in to comment.