Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of TweakAI v1.3.2
TweakAI.dll
Decompiled a year agousing System; 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.RoR2; 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("TweakAI")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c1df24952a302d0c9e66b8b5600f40b4679e6244")] [assembly: AssemblyProduct("TweakAI")] [assembly: AssemblyTitle("TweakAI")] [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 TweakAI { [BepInPlugin("com.Nuxlar.TweakAI", "TweakAI", "1.3.2")] public class TweakAI : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_IsPositionOffScreen <>9__0_0; public static Func<Instruction, bool> <>9__1_0; public static Func<HurtBox, bool> <>9__1_2; public static Func<IEnumerable<HurtBox>, BaseAI, IEnumerable<HurtBox>> <>9__1_1; internal bool <Awake>b__0_0(orig_IsPositionOffScreen orig, Vector3 position, float offScreenThreshold, float minDistance, float maxDistance) { return false; } internal bool <TargetMainlyPlayers>b__1_0(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<BullseyeSearch>(x, "GetResults"); } internal IEnumerable<HurtBox> <TargetMainlyPlayers>b__1_1(IEnumerable<HurtBox> results, BaseAI instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.body.teamComponent) && (int)instance.body.teamComponent.teamIndex != 1) { IEnumerable<HurtBox> enumerable = results.Where(delegate(HurtBox hurtBox) { GameObject val = HurtBox.FindEntityObject(hurtBox); CharacterBody val2 = default(CharacterBody); return Object.op_Implicit((Object)(object)val) && val.TryGetComponent<CharacterBody>(ref val2) && val2.isPlayerControlled; }); if (!enumerable.Any()) { return results; } return enumerable; } return results; } internal bool <TargetMainlyPlayers>b__1_2(HurtBox hurtBox) { GameObject val = HurtBox.FindEntityObject(hurtBox); CharacterBody val2 = default(CharacterBody); if (Object.op_Implicit((Object)(object)val) && val.TryGetComponent<CharacterBody>(ref val2)) { return val2.isPlayerControlled; } return false; } } public void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown BaseAI.FindEnemyHurtBox += new Manipulator(TargetMainlyPlayers); BaseAI.FindEnemyHurtBox += new hook_FindEnemyHurtBox(InfiniVision); object obj = <>c.<>9__0_0; if (obj == null) { hook_IsPositionOffScreen val = (orig_IsPositionOffScreen orig, Vector3 position, float offScreenThreshold, float minDistance, float maxDistance) => false; <>c.<>9__0_0 = val; obj = (object)val; } OffScreenMissHelper.IsPositionOffScreen += (hook_IsPositionOffScreen)obj; } private void TargetMainlyPlayers(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: 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 x) => ILPatternMatchingExt.MatchCallOrCallvirt<BullseyeSearch>(x, "GetResults") })) { return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<IEnumerable<HurtBox>, BaseAI, IEnumerable<HurtBox>>>((Func<IEnumerable<HurtBox>, BaseAI, IEnumerable<HurtBox>>)delegate(IEnumerable<HurtBox> results, BaseAI instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.body.teamComponent) && (int)instance.body.teamComponent.teamIndex != 1) { IEnumerable<HurtBox> enumerable = results.Where(delegate(HurtBox hurtBox) { GameObject val2 = HurtBox.FindEntityObject(hurtBox); CharacterBody val3 = default(CharacterBody); return Object.op_Implicit((Object)(object)val2) && val2.TryGetComponent<CharacterBody>(ref val3) && val3.isPlayerControlled; }); if (!enumerable.Any()) { return results; } return enumerable; } return results; }); } private HurtBox InfiniVision(orig_FindEnemyHurtBox orig, BaseAI self, float maxDistance, bool full360Vision, bool filterByLoS) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body.teamComponent) && (int)self.body.teamComponent.teamIndex != 1) { maxDistance = float.PositiveInfinity; filterByLoS = false; full360Vision = true; } return orig.Invoke(self, maxDistance, full360Vision, filterByLoS); } } }