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 EclipseRevamped v1.3.4
plugins/EclipseRevamped/EclipseRevamped.dll
Decompiled 5 months agousing 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 HG.Reflection; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EclipseRevamped")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+faee66350eb448381f2947f4af9e7ba7a120c29b")] [assembly: AssemblyProduct("EclipseRevamped")] [assembly: AssemblyTitle("EclipseRevamped")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 EclipseRevamped { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber) { int num = callerPath.LastIndexOf("EclipseRevamped"); if (num >= 0) { callerPath = callerPath.Substring(num + "EclipseRevamped".Length + 1); } return $"{callerPath}:{callerLineNumber} ({callerMemberName}) "; } internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Error_NoCallerPrefix(object data) { _logSource.LogError(data); } internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Fatal_NoCallerPrefix(object data) { _logSource.LogFatal(data); } internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Info_NoCallerPrefix(object data) { _logSource.LogInfo(data); } internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Message_NoCallerPrefix(object data) { _logSource.LogMessage(data); } internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Warning_NoCallerPrefix(object data) { _logSource.LogWarning(data); } } [BepInPlugin("Nuxlar.EclipseRevamped", "EclipseRevamped", "1.3.4")] public class Main : BaseUnityPlugin { public const string PluginGUID = "Nuxlar.EclipseRevamped"; public const string PluginAuthor = "Nuxlar"; public const string PluginName = "EclipseRevamped"; public const string PluginVersion = "1.3.4"; public static ConfigEntry<bool> shouldChangeE1; public static ConfigEntry<bool> shouldChangeE2; public static ConfigEntry<bool> shouldChangeE3; public static ConfigEntry<bool> shouldChangeE4; public static ConfigEntry<bool> shouldChangeE5; public static ConfigEntry<bool> shouldChangeE6; internal static Main Instance { get; private set; } public static string PluginDirectory { get; private set; } private static ConfigFile ERConfig { get; set; } public void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown Instance = this; Stopwatch stopwatch = Stopwatch.StartNew(); Log.Init(((BaseUnityPlugin)this).Logger); ERConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.EclipseRevamped.cfg", true); shouldChangeE1 = ERConfig.Bind<bool>("General", "Enable E1 Changes", true, "Rework this Eclipse level"); shouldChangeE2 = ERConfig.Bind<bool>("General", "Enable E2 Changes", true, "Rework this Eclipse level"); shouldChangeE3 = ERConfig.Bind<bool>("General", "Enable E3 Changes", true, "Rework this Eclipse level"); shouldChangeE5 = ERConfig.Bind<bool>("General", "Enable E5 Changes", true, "Rework this Eclipse level"); shouldChangeE6 = ERConfig.Bind<bool>("General", "Enable E6 Changes", true, "Rework this Eclipse level"); ChangeDescriptions(); if (shouldChangeE1.Value) { CharacterMaster.OnBodyStart += new Manipulator(RemoveVanillaE1); ChargingState.OnEnter += new Manipulator(AddNewE1); } if (shouldChangeE2.Value) { HoldoutZoneController.DoUpdate += new Manipulator(RemoveVanillaE2); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AddNewE2)); } if (shouldChangeE3.Value) { GlobalEventManager.OnCharacterHitGroundServer += new Manipulator(RemoveVanillaE3); Run.Start += new hook_Start(AddNewE3); } if (shouldChangeE5.Value) { HealthComponent.Heal += new Manipulator(TweakVanillaE5); } if (shouldChangeE6.Value) { DeathRewards.OnKilledServer += new Manipulator(RemoveVanillaE6); } stopwatch.Stop(); Log.Info_NoCallerPrefix($"Initialized in {stopwatch.Elapsed.TotalSeconds:F2} seconds"); } private void AddNewE2() { for (int i = 0; i < DifficultyCatalog.difficultyDefs.Length; i++) { DifficultyDef val = DifficultyCatalog.difficultyDefs[i]; if (val.nameToken.Contains("ECLIPSE") && !val.nameToken.Contains("1")) { val.scalingValue = 3.5f; } } } private void AddNewE3(orig_Start orig, Run self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 orig.Invoke(self); if (Object.op_Implicit((Object)(object)Run.instance) && (int)Run.instance.selectedDifficulty >= 7) { EliteAPI.VanillaEliteTiers[1].costMultiplier = 4.8f; EliteAPI.VanillaEliteTiers[4].costMultiplier = 4.8f; } else { EliteAPI.VanillaEliteTiers[1].costMultiplier = 6f; EliteAPI.VanillaEliteTiers[4].costMultiplier = 6f; } } private void AddNewE1(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<TeleporterInteraction>(x, "get_shrineBonusStacks"), (Instruction x) => ILPatternMatchingExt.MatchAdd(x), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x) })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)((float stacks) => stacks + 0.5f)); } } private void RemoveVanillaE1(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.5f) })) { val.Next.Operand = 1f; } else { Log.Error("EclipseRevamped: Failed to remove vanilla E1", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\EclipseRevamped\\EclipseRevamped\\Main.cs", "RemoveVanillaE1", 134); } } private void RemoveVanillaE2(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.5f) })) { val.Next.Operand = 1f; } else { Log.Error("EclipseRevamped: Failed to remove vanilla E2", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\EclipseRevamped\\EclipseRevamped\\Main.cs", "RemoveVanillaE2", 145); } } private void RemoveVanillaE3(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5) })) { int index = val.Index + 1; val.Index = index; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int useless) => int.MaxValue)); } else { Log.Error("EclipseRevamped: Failed to remove vanilla E3", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\EclipseRevamped\\EclipseRevamped\\Main.cs", "RemoveVanillaE3", 158); } } private void TweakVanillaE5(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 2f), (Instruction x) => ILPatternMatchingExt.MatchDiv(x) })) { val.Next.Operand = 1.33f; } else { Log.Error("EclipseRevamped: Failed to tweak vanilla E5", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\EclipseRevamped\\EclipseRevamped\\Main.cs", "TweakVanillaE5", 170); } } private void RemoveVanillaE6(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.8f) })) { val.Next.Operand = 1f; } else { Log.Error("EclipseRevamped: Failed to remove vanilla E6", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\EclipseRevamped\\EclipseRevamped\\Main.cs", "RemoveVanillaE6", 181); } } private void ChangeDescriptions() { string text = "Starts at baseline Monsoon difficulty.\n"; string text2 = (shouldChangeE1.Value ? "\n<mspace=0.5em>(1)</mspace> Teleporter Enemies: <style=cIsHealth>+50%</style></style>" : "\n<mspace=0.5em>(1)</mspace> Ally Starting Health: <style=cIsHealth>-50%</style></style>"); string text3 = (shouldChangeE2.Value ? "\n<mspace=0.5em>(2)</mspace> Difficulty Scaling <style=cIsHealth>+25%</style></style>" : "\n<mspace=0.5em>(2)</mspace> Teleporter Radius: <style=cIsHealth>-50%</style></style>"); string text4 = (shouldChangeE3.Value ? "\n<mspace=0.5em>(3)</mspace> Enemy Elites: <style=cIsHealth>+20%</style></style>" : "\n<mspace=0.5em>(3)</mspace> Ally Fall Damage: <style=cIsHealth>+100% and lethal</style></style>"); string text5 = "\n<mspace=0.5em>(4)</mspace> Enemies: <style=cIsHealth>+40% Faster</style></style>"; string text6 = (shouldChangeE5.Value ? "\n<mspace=0.5em>(5)</mspace> Ally Healing: <style=cIsHealth>-25%</style></style>" : "\n<mspace=0.5em>(5)</mspace> Ally Healing: <style=cIsHealth>-50%</style></style>"); string text7 = (shouldChangeE6.Value ? "\n<mspace=0.5em>(6)</mspace><style=cIsHealth> Nothing</style></style>" : "\n<mspace=0.5em>(6)</mspace> Enemy Gold Drops: <style=cIsHealth>-20%</style></style>"); string text8 = "\n<mspace=0.5em>(7)</mspace> Enemy Cooldowns: <style=cIsHealth>-50%</style></style>"; string text9 = "\n<mspace=0.5em>(8)</mspace> Allies recieve <style=cIsHealth>permanent damage</style></style>"; string text10 = "\"You only celebrate in the light... because I allow it.\" \n\n"; LanguageAPI.Add("ECLIPSE_1_DESCRIPTION", text + text2); LanguageAPI.Add("ECLIPSE_2_DESCRIPTION", text + text2 + text3); LanguageAPI.Add("ECLIPSE_3_DESCRIPTION", text + text2 + text3 + text4); LanguageAPI.Add("ECLIPSE_4_DESCRIPTION", text + text2 + text3 + text4 + text5); LanguageAPI.Add("ECLIPSE_5_DESCRIPTION", text + text2 + text3 + text4 + text5 + text6); LanguageAPI.Add("ECLIPSE_6_DESCRIPTION", text + text2 + text3 + text4 + text5 + text6 + text7); LanguageAPI.Add("ECLIPSE_7_DESCRIPTION", text + text2 + text3 + text4 + text5 + text6 + text7 + text8); LanguageAPI.Add("ECLIPSE_8_DESCRIPTION", text10 + text + text2 + text3 + text4 + text5 + text6 + text7 + text8 + text9); } } }