using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;
[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("PullAnyone")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PullAnyone")]
[assembly: AssemblyTitle("PullAnyone")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.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]
[Microsoft.CodeAnalysis.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]
[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 PullAnyone
{
[BepInPlugin("dev.apelsin.pullanyone", "Whiplash Pulls Everyone", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("dev.apelsin.pullanyone").PatchAll();
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "Awake")]
public static class EnemyGlobalOverridePatch
{
[HarmonyPostfix]
public static void Postfix(EnemyIdentifier __instance)
{
if ((Object)(object)__instance != (Object)null)
{
__instance.hookIgnore = false;
}
}
}
[HarmonyPatch(typeof(HookArm), "Start")]
public static class WhiplashListClearPatch
{
private static readonly FieldInfo LightEnemiesField = AccessTools.Field(typeof(HookArm), "lightEnemies");
private static readonly FieldInfo DeadIgnoreTypesField = AccessTools.Field(typeof(HookArm), "deadIgnoreTypes");
[HarmonyPostfix]
public static void Postfix(HookArm __instance)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
List<EnemyType> list = (List<EnemyType>)(LightEnemiesField?.GetValue(__instance));
List<EnemyType> list2 = (List<EnemyType>)(DeadIgnoreTypesField?.GetValue(__instance));
if (list != null)
{
foreach (EnemyType value in Enum.GetValues(typeof(EnemyType)))
{
if (!list.Contains(value))
{
list.Add(value);
}
}
}
list2?.Clear();
}
}
[HarmonyPatch(typeof(HookArm), "FixedUpdate")]
public static class WhiplashPhysicsOverridePatch
{
private static readonly FieldInfo CaughtEidField = AccessTools.Field(typeof(HookArm), "caughtEid");
private static readonly FieldInfo EnemyRigidbodyField = AccessTools.Field(typeof(HookArm), "enemyRigidbody");
private static readonly FieldInfo LightTargetField = AccessTools.Field(typeof(HookArm), "lightTarget");
[HarmonyPrefix]
public static void Prefix(HookArm __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Invalid comparison between Unknown and I4
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
if ((int)__instance.state != 2 && (int)__instance.state != 3)
{
return;
}
EnemyIdentifier val = (EnemyIdentifier)(CaughtEidField?.GetValue(__instance));
if (!((Object)(object)val != (Object)null))
{
return;
}
val.hookIgnore = false;
LightTargetField?.SetValue(__instance, true);
NavMeshAgent val2 = ((Component)val).GetComponent<NavMeshAgent>() ?? ((Component)val).GetComponentInParent<NavMeshAgent>();
MaliciousFace val3 = ((Component)val).GetComponent<MaliciousFace>() ?? ((Component)val).GetComponentInParent<MaliciousFace>();
Animator val4 = ((Component)val).GetComponent<Animator>() ?? ((Component)val).GetComponentInParent<Animator>();
if ((Object)(object)val2 != (Object)null && ((Behaviour)val2).enabled)
{
((Behaviour)val2).enabled = false;
}
Rigidbody val5 = (Rigidbody)(EnemyRigidbodyField?.GetValue(__instance));
object obj = (object)val5;
if ((int)val5 == 0)
{
obj = ((Component)val).GetComponent<Rigidbody>() ?? ((Component)val).GetComponentInParent<Rigidbody>();
}
Rigidbody val6 = (Rigidbody)obj;
if ((Object)(object)val6 != (Object)null)
{
EnemyRigidbodyField?.SetValue(__instance, val6);
val6.isKinematic = false;
val6.useGravity = false;
}
if ((int)__instance.state == 3)
{
if ((Object)(object)val3 != (Object)null && ((Behaviour)val3).enabled)
{
((Behaviour)val3).enabled = false;
}
if ((Object)(object)val4 != (Object)null && val4.applyRootMotion)
{
val4.applyRootMotion = false;
}
Transform transform = ((Component)val).transform;
Vector3 position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
transform.position = Vector3.MoveTowards(transform.position, position, 65f * Time.fixedDeltaTime);
}
}
[HarmonyPostfix]
public static void Postfix(HookArm __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
if ((int)__instance.state != 0)
{
return;
}
EnemyIdentifier val = (EnemyIdentifier)(CaughtEidField?.GetValue(__instance));
if ((Object)(object)val != (Object)null)
{
MaliciousFace val2 = ((Component)val).GetComponent<MaliciousFace>() ?? ((Component)val).GetComponentInParent<MaliciousFace>();
Animator val3 = ((Component)val).GetComponent<Animator>() ?? ((Component)val).GetComponentInParent<Animator>();
NavMeshAgent val4 = ((Component)val).GetComponent<NavMeshAgent>() ?? ((Component)val).GetComponentInParent<NavMeshAgent>();
if ((Object)(object)val2 != (Object)null && !((Behaviour)val2).enabled)
{
((Behaviour)val2).enabled = true;
}
if ((Object)(object)val3 != (Object)null && !val3.applyRootMotion)
{
val3.applyRootMotion = true;
}
if ((Object)(object)val4 != (Object)null && !((Behaviour)val4).enabled)
{
((Behaviour)val4).enabled = true;
}
}
}
}
}