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 No Void Fiend Drone Healing v1.0.3
plugins/NoVoidFiendHealingDroneTarget.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; using System.Security.Permissions; using BepInEx; using IL.RoR2.CharacterAI; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Drone.DroneWeapon; using On.RoR2.CharacterAI; using RoR2; using RoR2.CharacterAI; 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("ZakyB")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Prevents Healing Drones, Emergency Drones, and DOC from targeting Void Fiend.")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3+3e860cb2851e067acb732421e5748b744fc174df")] [assembly: AssemblyProduct("NoVoidFiendHealingDroneTarget")] [assembly: AssemblyTitle("NoVoidFiendHealingDroneTarget")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] [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 NoVoidFiendHealingDroneTarget { [BepInPlugin("com.zaky.novoidfiendhealingdronetarget", "No Void Fiend Drone Healing", "1.0.3")] public sealed class Plugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_EvaluateSingleSkillDriver <0>__RejectVoidFiendEvaluation; public static hook_IsHurt <1>__ExcludeVoidFiendFromHealBeamSearch; } public const string PluginGuid = "com.zaky.novoidfiendhealingdronetarget"; public const string PluginName = "No Void Fiend Drone Healing"; public const string PluginVersion = "1.0.3"; 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_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_002c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown BaseAI.FindEnemyHurtBox += new Manipulator(FilterHealingDroneSearchResults); object obj = <>O.<0>__RejectVoidFiendEvaluation; if (obj == null) { hook_EvaluateSingleSkillDriver val = RejectVoidFiendEvaluation; <>O.<0>__RejectVoidFiendEvaluation = val; obj = (object)val; } BaseAI.EvaluateSingleSkillDriver += (hook_EvaluateSingleSkillDriver)obj; object obj2 = <>O.<1>__ExcludeVoidFiendFromHealBeamSearch; if (obj2 == null) { hook_IsHurt val2 = ExcludeVoidFiendFromHealBeamSearch; <>O.<1>__ExcludeVoidFiendFromHealBeamSearch = val2; obj2 = (object)val2; } StartHealBeam.IsHurt += (hook_IsHurt)obj2; ((BaseUnityPlugin)this).Logger.LogInfo((object)"No Void Fiend Drone Healing 1.0.3 loaded."); } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //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_002c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown BaseAI.FindEnemyHurtBox -= new Manipulator(FilterHealingDroneSearchResults); object obj = <>O.<0>__RejectVoidFiendEvaluation; if (obj == null) { hook_EvaluateSingleSkillDriver val = RejectVoidFiendEvaluation; <>O.<0>__RejectVoidFiendEvaluation = val; obj = (object)val; } BaseAI.EvaluateSingleSkillDriver -= (hook_EvaluateSingleSkillDriver)obj; object obj2 = <>O.<1>__ExcludeVoidFiendFromHealBeamSearch; if (obj2 == null) { hook_IsHurt val2 = ExcludeVoidFiendFromHealBeamSearch; <>O.<1>__ExcludeVoidFiendFromHealBeamSearch = val2; obj2 = (object)val2; } StartHealBeam.IsHurt -= (hook_IsHurt)obj2; } private void FilterHealingDroneSearchResults(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCallOrCallvirt<BullseyeSearch>(instruction, "GetResults") })) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not patch BaseAI.FindEnemyHurtBox; the game method may have changed."); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<IEnumerable<HurtBox>, BaseAI, IEnumerable<HurtBox>>>((Func<IEnumerable<HurtBox>, BaseAI, IEnumerable<HurtBox>>)((IEnumerable<HurtBox> results, BaseAI ai) => (IEnumerable<HurtBox>)((!IsHealingDrone(ai)) ? ((IEnumerable)results) : ((IEnumerable)results.Where((HurtBox hurtBox) => !IsVoidFiend(hurtBox?.healthComponent?.body)))))); } private static SkillDriverEvaluation? RejectVoidFiendEvaluation(orig_EvaluateSingleSkillDriver orig, BaseAI self, ref SkillDriverEvaluation currentSkillDriverEvaluation, AISkillDriver aiSkillDriver, float myHealthFraction) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) SkillDriverEvaluation? result = orig.Invoke(self, ref currentSkillDriverEvaluation, aiSkillDriver, myHealthFraction); if (!result.HasValue || !IsHealingDrone(self)) { return result; } Target target = result.Value.target; GameObject obj = ((target != null) ? target.gameObject : null); if (!IsVoidFiend((obj != null) ? obj.GetComponent<CharacterBody>() : null)) { return result; } return null; } private static bool ExcludeVoidFiendFromHealBeamSearch(orig_IsHurt orig, HurtBox hurtBox) { if (!IsVoidFiend(hurtBox?.healthComponent?.body)) { return orig.Invoke(hurtBox); } return false; } private static bool IsHealingDrone(BaseAI? ai) { object obj; if (ai == null) { obj = null; } else { CharacterBody body = ai.body; obj = ((body != null) ? ((Object)body).name : null); } string text = (string)obj; if (text == null) { return false; } if (!text.StartsWith("Drone2Body", StringComparison.Ordinal) && !text.StartsWith("EmergencyDroneBody", StringComparison.Ordinal)) { return text.StartsWith("DTHealingDroneBody", StringComparison.Ordinal); } return true; } private static bool IsVoidFiend(CharacterBody? body) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null) { return body.bodyIndex == BodyCatalog.FindBodyIndex("VoidSurvivorBody"); } return false; } } }