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 EarlyTier2Elites v1.0.0
plugin/EarlyTier2Elites/EarlyTier2Elites.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Linq; 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; using R2API; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EarlyTier2Elites")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d94bbf0c83093373994234ccabc832f967ca37aa")] [assembly: AssemblyProduct("EarlyTier2Elites")] [assembly: AssemblyTitle("EarlyTier2Elites")] [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 EarlyTier2Elites { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("acats.EarlyTier2Elites", "EarlyTier2Elites", "1.0.0")] public class EarlyTier2Elites : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<EliteRules, bool> <>9__6_3; public static Action <>9__6_0; public static hook_PopulateScene <>9__6_1; internal void <Awake>b__6_0() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown <>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0(); EliteTierDef eliteTier = EliteTier2; CS$<>8__locals0.eliteBlacklist = EarlyTier2ElitesConfig.EliteBlacklist.Value.Replace(" ", "").Split(','); EliteDef[] eliteTypes = eliteTier.eliteTypes.Where((EliteDef elite) => !CS$<>8__locals0.eliteBlacklist.Contains(((Object)elite).name)).ToArray(); earlyTier2 = new EliteTierDef { costMultiplier = eliteTier.costMultiplier, eliteTypes = eliteTypes, isAvailable = delegate(EliteRules rules) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 if (Run.instance.loopClearCount > 0) { return false; } if (disabled) { return false; } if (Run.instance.stageClearCount + 1 < EarlyTier2ElitesConfig.MinStage.Value) { return false; } return (int)rules <= 0; }, canSelectWithoutAvailableEliteDef = false }; EliteAPI.AddCustomEliteTier(earlyTier2); } internal bool <Awake>b__6_3(EliteRules rules) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 if (Run.instance.loopClearCount > 0) { return false; } if (disabled) { return false; } if (Run.instance.stageClearCount + 1 < EarlyTier2ElitesConfig.MinStage.Value) { return false; } if ((int)rules > 0) { return false; } return true; } internal void <Awake>b__6_1(orig_PopulateScene orig, SceneDirector self) { disabled = true; orig.Invoke(self); disabled = false; } } [CompilerGenerated] private sealed class <>c__DisplayClass6_0 { public string[] eliteBlacklist; internal bool <Awake>b__2(EliteDef elite) { return !eliteBlacklist.Contains(((Object)elite).name); } } public const string PluginGUID = "acats.EarlyTier2Elites"; public const string PluginAuthor = "acats"; public const string PluginName = "EarlyTier2Elites"; public const string PluginVersion = "1.0.0"; private static bool disabled; private static EliteTierDef earlyTier2; public static EliteTierDef EliteTier2 { get { EliteTierDef[] eliteTiers = CombatDirector.eliteTiers; foreach (EliteTierDef val in eliteTiers) { if (val != null && val.eliteTypes.Length != 0 && val.eliteTypes.Contains(Elites.Poison)) { return val; } } return null; } } public void Awake() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); EarlyTier2ElitesConfig.Init(((BaseUnityPlugin)this).Config); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown EliteTierDef eliteTier = EliteTier2; string[] eliteBlacklist = EarlyTier2ElitesConfig.EliteBlacklist.Value.Replace(" ", "").Split(','); EliteDef[] eliteTypes = eliteTier.eliteTypes.Where((EliteDef elite) => !eliteBlacklist.Contains(((Object)elite).name)).ToArray(); earlyTier2 = new EliteTierDef { costMultiplier = eliteTier.costMultiplier, eliteTypes = eliteTypes, isAvailable = delegate(EliteRules rules) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 if (Run.instance.loopClearCount > 0) { return false; } if (disabled) { return false; } if (Run.instance.stageClearCount + 1 < EarlyTier2ElitesConfig.MinStage.Value) { return false; } return (int)rules <= 0; }, canSelectWithoutAvailableEliteDef = false }; EliteAPI.AddCustomEliteTier(earlyTier2); }); if (!EarlyTier2ElitesConfig.AllowedForWorldSpawns.Value) { object obj = <>c.<>9__6_1; if (obj == null) { hook_PopulateScene val = delegate(orig_PopulateScene orig, SceneDirector self) { disabled = true; orig.Invoke(self); disabled = false; }; <>c.<>9__6_1 = val; obj = (object)val; } SceneDirector.PopulateScene += (hook_PopulateScene)obj; } if (EarlyTier2ElitesConfig.EnemyBlacklist.Value.Length <= 0) { return; } string[] blacklist = EarlyTier2ElitesConfig.EnemyBlacklist.Value.Replace(" ", "").Split(','); CombatDirector.PrepareNewMonsterWave += (hook_PrepareNewMonsterWave)delegate(orig_PrepareNewMonsterWave orig, CombatDirector self, DirectorCard card) { if (!disabled && blacklist.Contains(((Object)card.spawnCard).name.ToLowerInvariant())) { disabled = true; orig.Invoke(self, card); disabled = false; } else { orig.Invoke(self, card); } }; } } internal static class EarlyTier2ElitesConfig { public static ConfigEntry<int> MinStage; public static ConfigEntry<bool> AllowedForWorldSpawns; public static ConfigEntry<string> EnemyBlacklist; public static ConfigEntry<string> EliteBlacklist; internal static void Init(ConfigFile config) { MinStage = config.Bind<int>("General", "Minimum Stage", 3, "The earliest stage that tier 2 elites are allowed to spawn on"); AllowedForWorldSpawns = config.Bind<bool>("General", "Allowed For World Spawns", false, "Whether tier 2 elites should be able to spawn as part of the initial group of monsters that are there when you enter a stage\r\nDisabled by default since stages 4 and 5 get extra credits which makes T2s way too common in my opinion"); EnemyBlacklist = config.Bind<string>("General", "Enemy Blacklist", "cscminimushroom", "Enemies that should not be able to spawn as tier 2 elites before looping\r\nTier 2 elite mini mushrums can soft lock you if you have low damage and they're picked as a horde of many since they heal when low"); EliteBlacklist = config.Bind<string>("General", "Elite Blacklist", "", "Tier 2 elites that should not be allowed to spawn before looping\r\nMalachite is edPoison, Celestine is edHaunted and Twisted is edBead"); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }