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 NoAdaptiveNemesis v1.0.0
plugins/NoAdaptiveNemesis/NoAdaptiveNemesis.dll
Decompiled 18 hours 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 Microsoft.CodeAnalysis; using RoR2; using UnityEngine; using UnityEngine.Networking; [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("NoAdaptiveNemesis")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c988079955e49d627ea90ee7f89be9a0c0585f20")] [assembly: AssemblyProduct("NoAdaptiveNemesis")] [assembly: AssemblyTitle("NoAdaptiveNemesis")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 NoAdaptiveNemesis { 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("NoAdaptiveNemesis"); if (num >= 0) { callerPath = callerPath.Substring(num + "NoAdaptiveNemesis".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("Phreel.NoAdaptiveNemesis", "NoAdaptiveNemesis", "1.0.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "Phreel.NoAdaptiveNemesis"; public const string PluginAuthor = "Phreel"; public const string PluginName = "NoAdaptiveNemesis"; public const string PluginVersion = "1.0.0"; private const string NemesisMarkerItemName = "SS2UNemesisMarkerItem"; private static readonly string[] targetBodyNames = new string[3] { "NemCommandoBody", "NemMercBody", "SS2UNemmandoBody" }; public static ConfigEntry<bool> affectAllInvaders; private static ItemIndex nemesisMarkerItemIndex = (ItemIndex)(-1); private static BodyIndex[] targetBodyIndices = (BodyIndex[])(object)new BodyIndex[0]; internal static Main Instance { get; private set; } public void Awake() { Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); affectAllInvaders = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Affect All Invaders", false, "Remove Adaptive Armor from every nemesis invader (e.g. Nemesis Enforcer), not just Nemesis Commando and Nemesis Mercenary."); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad)); CharacterBody.onBodyInventoryChangedGlobal += OnBodyInventoryChanged; } private static void OnLoad() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected I4, but got Unknown nemesisMarkerItemIndex = ItemCatalog.FindItemIndex("SS2UNemesisMarkerItem"); if ((int)nemesisMarkerItemIndex == -1) { Log.Warning("Could not find SS2UNemesisMarkerItem, is Videogame Mod 2 Unofficial installed? Mod will do nothing.", "D:\\Games\\LostItems\\noadaptivenemesis\\NoAdaptiveNemesis\\Main.cs", "OnLoad", 49); } targetBodyIndices = (BodyIndex[])(object)new BodyIndex[targetBodyNames.Length]; for (int i = 0; i < targetBodyNames.Length; i++) { targetBodyIndices[i] = (BodyIndex)(int)BodyCatalog.FindBodyIndex(targetBodyNames[i]); } } private static void OnBodyInventoryChanged(CharacterBody body) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (int)nemesisMarkerItemIndex == -1) { return; } Inventory inventory = body.inventory; if (!Object.op_Implicit((Object)(object)inventory) || inventory.GetItemCountPermanent(nemesisMarkerItemIndex) <= 0 || (!affectAllInvaders.Value && Array.IndexOf(targetBodyIndices, body.bodyIndex) < 0)) { return; } int itemCountPermanent = inventory.GetItemCountPermanent(Items.AdaptiveArmor); if (itemCountPermanent > 0) { inventory.RemoveItemPermanent(Items.AdaptiveArmor, itemCountPermanent); if (Object.op_Implicit((Object)(object)body.healthComponent)) { body.healthComponent.adaptiveArmorValue = 0f; } Log.Info("Removed Adaptive Armor from " + body.GetDisplayName(), "D:\\Games\\LostItems\\noadaptivenemesis\\NoAdaptiveNemesis\\Main.cs", "OnBodyInventoryChanged", 76); } } } }