using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2.UI; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("EclipseLevel")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+54cab3b32e0fd6b5d296610714d4883f93994836")] [assembly: AssemblyProduct("EclipseLevel")] [assembly: AssemblyTitle("EclipseLevel")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EclipseLevelInCharacterSelection { public sealed class Config { private readonly ConfigFile file; private readonly ConfigEntry onlyShowInEclipseLobby; private readonly ConfigEntry iconSizePercentage; private readonly ConfigEntry showUpcomingLevel; public bool OnlyShowInEclipseLobby => onlyShowInEclipseLobby.Value; public float IconSizePercentage => iconSizePercentage.Value; public bool ShowUpcomingLevel => showUpcomingLevel.Value; public Config(ConfigFile config) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown file = config; onlyShowInEclipseLobby = config.Bind("Options", "OnlyShowInEclipseLobby", true, "Only show survivor eclipse icons in Eclipse lobbies."); iconSizePercentage = config.Bind("Options", "IconSizePercentage", 0.65f, new ConfigDescription("Size of the eclipse icon relative to the survivor icon.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); showUpcomingLevel = config.Bind("Options", "ShowUpcomingLevel", true, "Show the upcoming eclipse level instead of the highest completed eclipse level in the eclipse icon."); } } [BepInPlugin("depression_church.EclipseLevelInCharacterSelection", "EclipseLevelInCharacterSelection", "2.1.0")] public class EclipseLevelInCharacterSelection : BaseUnityPlugin { public const string PluginGUID = "depression_church.EclipseLevelInCharacterSelection"; public const string PluginAuthor = "depression_church"; public const string PluginName = "EclipseLevelInCharacterSelection"; public const string PluginVersion = "2.1.0"; private static Texture _GoldE8Icon; private static Texture GoldE8Icon => _GoldE8Icon ?? (_GoldE8Icon = Addressables.LoadAssetAsync((object)"RoR2/Base/EclipseRun/texDifficultyEclipse8IconGold.png").WaitForCompletion()); internal static Config Config { get; private set; } private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Config = new Config(((BaseUnityPlugin)this).Config); SurvivorIconController.Rebuild += new hook_Rebuild(SurvivorIconController_Rebuild); Log.LogInfo("Awake done."); } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown SurvivorIconController.Rebuild -= new hook_Rebuild(SurvivorIconController_Rebuild); } private void SurvivorIconController_Rebuild(orig_Rebuild orig, SurvivorIconController self) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); try { Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; bool flag = name == "eclipseworld" || ((Object)(object)PreGameController.instance != (Object)null && PreGameController.instance.gameModeIndex == GameModeCatalog.FindGameModeIndex("EclipseRun")); if ((Config.OnlyShowInEclipseLobby && !flag) || name == "infinitetowerworld") { return; } int num = EclipseRun.GetLocalUserSurvivorCompletedEclipseLevel(self.GetLocalUser(), self.survivorDef); if (Config.ShowUpcomingLevel) { num++; } if (num >= EclipseRun.minEclipseLevel) { DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(EclipseRun.GetEclipseDifficultyIndex(Mathf.Clamp(num, EclipseRun.minEclipseLevel, EclipseRun.maxEclipseLevel))); if (difficultyDef == null) { Log.LogWarning("Failed to get difficultyDef for " + self.survivorDef.cachedName); return; } RawImage orAddEclipseIcon = GetOrAddEclipseIcon(self.survivorIcon); orAddEclipseIcon.texture = (Texture)((num > EclipseRun.maxEclipseLevel) ? ((object)GoldE8Icon) : ((object)difficultyDef.GetIconSprite().texture)); ((Component)orAddEclipseIcon).gameObject.SetActive(((Graphic)self.survivorIcon).color != Color.black); } } catch (Exception data) { Log.LogError(data); } } private RawImage GetOrAddEclipseIcon(RawImage survivorIcon) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) RawImage[] componentsInChildren = ((Component)survivorIcon).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)(object)survivorIcon) { return componentsInChildren[i]; } } GameObject val = new GameObject("EclipseIcon", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)survivorIcon).transform); val.layer = ((Component)survivorIcon).gameObject.layer; RectTransform component = val.GetComponent(); ((Transform)component).localPosition = Vector3.zero; ((Transform)component).localScale = Vector3.one; ((Transform)component).localRotation = Quaternion.identity; Vector2 val2 = (component.anchorMax = Vector2.zero); Vector2 pivot = (component.anchorMin = val2); component.pivot = pivot; Vector2 one = Vector2.one; Rect rect = ((Graphic)survivorIcon).rectTransform.rect; component.sizeDelta = one * ((Rect)(ref rect)).width * Config.IconSizePercentage; return val.AddComponent(); } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } }