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 NoHuntsman v1.0.0
BepInEx/plugins/NoHuntsman/NoHuntsman.dll
Decompiled 11 hours agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("NoHuntsman")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoHuntsman")] [assembly: AssemblyTitle("NoHuntsman")] [assembly: AssemblyVersion("1.0.0.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 NoHuntsman { [BepInPlugin("com.dg.nohuntsman", "No Huntsman", "1.0.1")] public sealed class NoHuntsmanPlugin : BaseUnityPlugin { public const string PluginGuid = "com.dg.nohuntsman"; public const string PluginName = "No Huntsman"; public const string PluginVersion = "1.0.1"; internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("com.dg.nohuntsman").PatchAll(); Log.LogInfo((object)"No Huntsman v1.0.1 loaded."); } } [HarmonyPatch(typeof(EnemyDirector), "PickEnemies")] internal static class EnemyDirectorPickEnemiesPatch { private static readonly string[] PoolFields = new string[3] { "enemiesDifficulty1", "enemiesDifficulty2", "enemiesDifficulty3" }; private const string HuntsmanSetupName = "Enemy - Hunter"; private static void Prefix(EnemyDirector __instance) { if (!((Object)(object)__instance == (Object)null)) { string[] poolFields = PoolFields; foreach (string fieldName in poolFields) { RemoveHuntsman(__instance, fieldName); } } } private static void RemoveHuntsman(EnemyDirector director, string fieldName) { FieldInfo fieldInfo = AccessTools.Field(typeof(EnemyDirector), fieldName); if (fieldInfo == null) { NoHuntsmanPlugin.Log.LogWarning((object)("Could not find EnemyDirector." + fieldName + ".")); return; } if (!(fieldInfo.GetValue(director) is IList list)) { NoHuntsmanPlugin.Log.LogWarning((object)("EnemyDirector." + fieldName + " is not an IList.")); return; } int num = 0; for (int num2 = list.Count - 1; num2 >= 0; num2--) { if (IsHuntsmanSetup(list[num2])) { list.RemoveAt(num2); num++; } } if (num > 0) { NoHuntsmanPlugin.Log.LogInfo((object)$"Removed {num} Huntsman setup(s) from {fieldName}."); } } private static bool IsHuntsmanSetup(object? entry) { if (entry == null) { return false; } return string.Equals(AccessTools.Property(entry.GetType(), "name")?.GetValue(entry, null) as string, "Enemy - Hunter", StringComparison.Ordinal); } } }