Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EclipseProgression v1.0.2
BepInEx/plugins/EclipseProgression/EclipseProgression.dll
Decompiled 9 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using On.RoR2.UI; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EclipseProgression")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+d842eec43267602435d466ff6e72c558c9fa5d92")] [assembly: AssemblyProduct("EclipseProgression")] [assembly: AssemblyTitle("EclipseProgression")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 EclipseProgression { [BepInPlugin("com.cirillom.eclipseprogression", "Eclipse Progression", "1.0.2")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.cirillom.eclipseprogression"; public const string PluginName = "Eclipse Progression"; public const string PluginVersion = "1.0.2"; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown CharacterSelectController.Awake += new hook_Awake(CharacterSelectControllerAwake); SurvivorIconController.Rebuild += new hook_Rebuild(SurvivorIconControllerRebuild); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Eclipse Progression loaded!"); } private void CharacterSelectControllerAwake(orig_Awake orig, CharacterSelectController self) { orig.Invoke(self); ((MonoBehaviour)this).StartCoroutine(CreateSummary(self)); } private IEnumerator CreateSummary(CharacterSelectController controller) { if (!IsEclipseRun()) { yield break; } RuleCategoryController difficulty = null; for (int frame = 0; frame < 120; frame++) { if (!Object.op_Implicit((Object)(object)controller)) { break; } if (!((Object)(object)difficulty == (Object)null)) { break; } yield return null; RuleBookViewer componentInChildren = ((Component)controller).GetComponentInChildren<RuleBookViewer>(true); if (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.categoryContainer)) { RuleCategoryController[] componentsInChildren = ((Component)componentInChildren.categoryContainer).GetComponentsInChildren<RuleCategoryController>(true); difficulty = ((IEnumerable<RuleCategoryController>)componentsInChildren).FirstOrDefault((Func<RuleCategoryController, bool>)delegate(RuleCategoryController category) { RuleCategoryDef currentCategory = category.currentCategory; return currentCategory != null && currentCategory.displayToken?.IndexOf("DIFFICULTY", StringComparison.OrdinalIgnoreCase) >= 0; }) ?? componentsInChildren.FirstOrDefault(); } } if (Object.op_Implicit((Object)(object)controller) && !((Object)(object)difficulty == (Object)null)) { GameObject val = new GameObject("EclipseProgressionSummary", new Type[3] { typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(LayoutElement) }) { layer = ((Component)difficulty).gameObject.layer }; val.transform.SetParent(((Component)difficulty).transform.parent, false); val.transform.SetSiblingIndex(((Component)difficulty).transform.GetSiblingIndex() + 1); val.GetComponent<LayoutElement>().preferredHeight = 126f; VerticalLayoutGroup component = val.GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component).spacing = 2f; ((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true; TextMeshProUGUI component2 = ((Component)difficulty.categoryHeaderLanguageController).GetComponent<TextMeshProUGUI>(); Image template = ((IEnumerable<Image>)difficulty.headerColorImages).FirstOrDefault((Func<Image, bool>)((Image image) => Object.op_Implicit((Object)(object)image))); Image template2 = (Object.op_Implicit((Object)(object)difficulty.framePanel) ? ((Component)difficulty.framePanel).GetComponent<Image>() : null); TextMeshProUGUI obj = CreateText(((Component)CreatePanel(val.transform, "Header", 42f, template, new Color(0.05f, 0.35f, 0.56f, 1f))).transform, component2, (TextAlignmentOptions)514); ((TMP_Text)obj).text = "ECLIPSE PROGRESS"; ((TMP_Text)obj).fontStyle = (FontStyles)1; ((TMP_Text)obj).fontSize = 20f; Image obj2 = CreatePanel(val.transform, "Body", 82f, template2, new Color(0.025f, 0.02f, 0.035f, 0.94f)); TextMeshProUGUI val2 = CreateText(((Component)obj2).transform, component2, (TextAlignmentOptions)514); ((TMP_Text)val2).rectTransform.anchorMin = new Vector2(0.03f, 0.5f); ((TMP_Text)val2).rectTransform.anchorMax = new Vector2(0.97f, 1f); ((TMP_Text)val2).rectTransform.offsetMin = Vector2.zero; ((TMP_Text)val2).rectTransform.offsetMax = Vector2.zero; ((TMP_Text)val2).enableAutoSizing = true; ((TMP_Text)val2).fontSizeMin = 13f; ((TMP_Text)val2).fontSizeMax = 22f; Image obj3 = CreateImage(((Component)obj2).transform, "ProgressBackground", new Color(0.22f, 0.24f, 0.27f, 1f)); ((Graphic)obj3).rectTransform.anchorMin = new Vector2(0.08f, 0.4f); ((Graphic)obj3).rectTransform.anchorMax = new Vector2(0.92f, 0.5f); Image progressFill = CreateImage(((Component)obj3).transform, "ProgressFill", new Color(0.2f, 0.7f, 0.95f, 1f)); TextMeshProUGUI val3 = CreateText(((Component)obj2).transform, component2, (TextAlignmentOptions)514); ((TMP_Text)val3).rectTransform.anchorMin = new Vector2(0.03f, 0f); ((TMP_Text)val3).rectTransform.anchorMax = new Vector2(0.97f, 0.38f); ((TMP_Text)val3).rectTransform.offsetMin = Vector2.zero; ((TMP_Text)val3).rectTransform.offsetMax = Vector2.zero; ((Graphic)val3).color = new Color(0.72f, 0.78f, 0.84f, 1f); ((TMP_Text)val3).enableAutoSizing = true; ((TMP_Text)val3).fontSizeMin = 10f; ((TMP_Text)val3).fontSizeMax = 14f; RefreshSummary(val2, val3, progressFill); } } private static Image CreatePanel(Transform parent, string name, float height, Image? template, Color fallbackColor) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(Image), typeof(LayoutElement) }) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); val.GetComponent<LayoutElement>().preferredHeight = height; Image component = val.GetComponent<Image>(); ((Graphic)component).raycastTarget = false; if ((Object)(object)template != (Object)null) { component.sprite = template.sprite; component.type = template.type; ((Graphic)component).material = ((Graphic)template).material; ((Graphic)component).color = ((Graphic)template).color; } else { ((Graphic)component).color = fallbackColor; } return component; } private static Image CreateImage(Transform parent, string name, Color color) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); Image component = val.GetComponent<Image>(); ((Graphic)component).color = color; ((Graphic)component).raycastTarget = false; ((Graphic)component).rectTransform.anchorMin = Vector2.zero; ((Graphic)component).rectTransform.anchorMax = Vector2.one; ((Graphic)component).rectTransform.offsetMin = Vector2.zero; ((Graphic)component).rectTransform.offsetMax = Vector2.zero; return component; } private static TextMeshProUGUI CreateText(Transform parent, TextMeshProUGUI? template, TextAlignmentOptions alignment) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).rectTransform.anchorMin = Vector2.zero; ((TMP_Text)component).rectTransform.anchorMax = Vector2.one; ((TMP_Text)component).rectTransform.offsetMin = new Vector2(8f, 2f); ((TMP_Text)component).rectTransform.offsetMax = new Vector2(-8f, -2f); ((TMP_Text)component).alignment = alignment; ((Graphic)component).color = Color.white; ((Graphic)component).raycastTarget = false; if ((Object)(object)template != (Object)null) { ((TMP_Text)component).font = ((TMP_Text)template).font; ((TMP_Text)component).fontSharedMaterial = ((TMP_Text)template).fontSharedMaterial; } return component; } private void SurvivorIconControllerRebuild(orig_Rebuild orig, SurvivorIconController self) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); CharacterSelectBarController componentInParent = ((Component)self).GetComponentInParent<CharacterSelectBarController>(); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.isEclipseRun && !((Object)(object)self.survivorDef == (Object)null)) { Transform val = ((Component)self).transform.Find("EclipseProgressionBadge"); TextMeshProUGUI component; if (Object.op_Implicit((Object)(object)val)) { component = ((Component)val).GetComponent<TextMeshProUGUI>(); } else { GameObject val2 = new GameObject("EclipseProgressionBadge", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }) { layer = ((Component)self).gameObject.layer }; val2.transform.SetParent(((Component)self).transform, false); component = val2.GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)component).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0f); rectTransform.anchorMax = new Vector2(1f, 1f); rectTransform.offsetMin = new Vector2(4f, 3f); rectTransform.offsetMax = new Vector2(-4f, -3f); ((TMP_Text)component).alignment = (TextAlignmentOptions)1028; ((Graphic)component).color = new Color(1f, 0.78f, 0.2f, 1f); ((TMP_Text)component).fontStyle = (FontStyles)1; ((TMP_Text)component).fontSize = 18f; ((Graphic)component).raycastTarget = false; } int completedLevel = GetCompletedLevel(self.survivorDef); ((TMP_Text)component).text = ((completedLevel == 8) ? "E8 ✓" : $"E{completedLevel}"); } } private static void RefreshSummary(TextMeshProUGUI stats, TextMeshProUGUI footer, Image progressFill) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) SurvivorDef[] eligibleSurvivors = GetEligibleSurvivors(); int num = ((IEnumerable<SurvivorDef>)eligibleSurvivors).Sum((Func<SurvivorDef, int>)GetCompletedLevel); int num2 = eligibleSurvivors.Length * 8; int num3 = eligibleSurvivors.Count((SurvivorDef survivor) => GetCompletedLevel(survivor) == 8); float num4 = ((num2 == 0) ? 0f : ((float)num / (float)num2)); float num5 = 100f * num4; ((TMP_Text)stats).text = $"<size=115%><b>{num}</b></size> <color=#A5B0BA>/ {num2} ECLIPSES</color> " + $"<color=#55C7FF><b>{num5:0.0}%</b></color>"; ((TMP_Text)footer).text = string.Format("{0} SURVIVOR{1} COMPLETED E8", num3, (num3 == 1) ? string.Empty : "S"); ((Graphic)progressFill).rectTransform.anchorMax = new Vector2(num4, 1f); } private static SurvivorDef[] GetEligibleSurvivors() { LocalUser localUser = LocalUserManager.GetFirstLocalUser(); if (localUser == null) { return Array.Empty<SurvivorDef>(); } return SurvivorCatalog.orderedSurvivorDefs.Where((SurvivorDef survivor) => (Object)(object)survivor != (Object)null && !survivor.hidden && SurvivorCatalog.SurvivorIsUnlockedOnThisClient(survivor.survivorIndex) && survivor.CheckRequiredExpansionEnabled((NetworkUser)null) && survivor.CheckUserHasRequiredEntitlement(localUser)).ToArray(); } private static int GetCompletedLevel(SurvivorDef survivor) { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser != null) { return Mathf.Clamp(EclipseRun.GetLocalUserSurvivorCompletedEclipseLevel(firstLocalUser, survivor), 0, 8); } return 0; } private static bool IsEclipseRun() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)PreGameController.instance)) { return PreGameController.instance.gameModeIndex == GameModeCatalog.FindGameModeIndex("EclipseRun"); } return false; } } }