using System;
using System.Collections.Generic;
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 ULTRAKILL.Portal;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ClassLibrary3")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ClassLibrary3")]
[assembly: AssemblyTitle("ClassLibrary3")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ClassLibrary3
{
[BepInPlugin("you.whipprojectile", "WhipProjectile", "0.9.2")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
new Harmony("you.whipprojectile").PatchAll();
Log.LogInfo((object)"WhipProjectile loaded");
}
}
internal static class WhipHold
{
private class PendingKill
{
public EnemyIdentifier eid;
public float until;
}
internal const float CatchRadius = 3f;
internal const float BoundaryRadius = 5f;
internal const float AnchorYOffset = 0.3f;
internal const float PullSpeed = 70f;
internal const float PullTimeout = 3f;
internal const float SpringH = 6f;
internal const float SpringV = 3f;
internal const float RelDrag = 0.25f;
internal const float MagnetStrength = 40f;
internal const float MagnetDamping = 3f;
internal const float MaxLeash = 12f;
internal const float MinThrowSpeed = 100f;
internal const float MaxThrowSpeed = 160f;
internal const float ThrowGain = 3f;
internal const float PlayerBounce = 0.5f;
internal const float PlayerPadding = 0.05f;
internal const bool KeepArmVisible = true;
internal const int ReturnedStylePoints = 100;
internal const string ReturnedStyleText = "<color=green>RETURNED</color>";
internal static bool ReplaceFriendlyFire = false;
internal const float KillWatchSeconds = 0.5f;
internal static Projectile Held;
private static Rigidbody heldRb;
private static LineRenderer rope;
private static bool entered;
private static Vector3 ballPos;
private static Vector3 ballVel;
private static float projRadius;
private static float pullTime;
private static CapsuleCollider playerCol;
private static bool holding;
private static GameObject parriedHitObject;
private static readonly HashSet<Projectile> thrown = new HashSet<Projectile>();
private static readonly List<PendingKill> pending = new List<PendingKill>();
internal static EnemyIdentifier ThrownTarget;
internal static bool ThrownTargetDead;
internal static bool Relabeled;
private static int thrownContextFrame = -1;
internal static bool ThrownContextActive => Object.op_Implicit((Object)(object)ThrownTarget) && thrownContextFrame == Time.frameCount;
internal static bool CanGrab(Projectile p)
{
if (!Object.op_Implicit((Object)(object)p))
{
return false;
}
return !p.friendly && !p.playerBullet && !p.parried && !p.decorative && !p.hittingPlayer && !p.undeflectable && !p.unparryable && (Object)(object)((Component)p).GetComponent<Rigidbody>() != (Object)null;
}
private static Transform Cam()
{
return ((Component)MonoSingleton<CameraController>.Instance).transform;
}
internal static void Grab(Projectile p)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
Held = p;
heldRb = ((Component)p).GetComponent<Rigidbody>();
Collider componentInChildren = ((Component)p).GetComponentInChildren<Collider>();
float num;
if (!Object.op_Implicit((Object)(object)componentInChildren))
{
num = 0.3f;
}
else
{
Bounds bounds = componentInChildren.bounds;
Vector3 extents = ((Bounds)(ref bounds)).extents;
num = Mathf.Min(((Vector3)(ref extents)).magnitude, 1.5f);
}
projRadius = num;
entered = false;
holding = true;
pullTime = 0f;
ballPos = ((Component)p).transform.position;
ballVel = Vector3.zero;
NewMovement instance = MonoSingleton<NewMovement>.Instance;
playerCol = (Object.op_Implicit((Object)(object)instance) ? ((Component)instance).GetComponent<CapsuleCollider>() : null);
if (Object.op_Implicit((Object)(object)heldRb) && !heldRb.isKinematic)
{
heldRb.velocity = Vector3.zero;
}
ConvertBeams(p);
CreateRope();
Plugin.Log.LogInfo((object)("Grabbed " + ((Object)p).name));
}
internal static void Tick()
{
try
{
ProcessPending();
}
catch (Exception ex)
{
Plugin.Log.LogError((object)("Pending kills failed: " + ex));
pending.Clear();
}
try
{
TickInner();
}
catch (Exception ex2)
{
Plugin.Log.LogError((object)("Tick failed: " + ex2));
EndHold();
}
}
private static void TickInner()
{
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_033e: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_0428: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_043e: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)Held))
{
EndHold();
return;
}
OptionsManager instance = MonoSingleton<OptionsManager>.Instance;
if (!Object.op_Implicit((Object)(object)instance) || instance.paused)
{
return;
}
HookArm instance2 = MonoSingleton<HookArm>.Instance;
NewMovement instance3 = MonoSingleton<NewMovement>.Instance;
if (!Object.op_Implicit((Object)(object)instance2) || !instance2.equipped || !Object.op_Implicit((Object)(object)instance3))
{
Release();
return;
}
float num = Mathf.Min(Time.deltaTime, 0.05f);
if (num <= 0f)
{
return;
}
Vector3 val = ((Component)instance3).transform.position + Vector3.up * 0.3f;
Vector3 val2 = (Object.op_Implicit((Object)(object)instance3.rb) ? instance3.rb.velocity : Vector3.zero);
if (!entered)
{
pullTime += num;
ballPos = Vector3.MoveTowards(ballPos, val, 70f * num);
if (Vector3.Distance(ballPos, val) + projRadius <= 5f)
{
entered = true;
ballVel = val2;
Plugin.Log.LogInfo((object)"Projectile is inside the sphere, swing it with your movement");
}
else if (pullTime > 3f)
{
Release();
return;
}
}
else
{
Vector3 val3 = ballPos - val;
float magnitude = ((Vector3)(ref val3)).magnitude;
Vector3 val4 = ((magnitude > 0.0001f) ? (val3 / magnitude) : Vector3.up);
float num2 = Mathf.Max(5f - projRadius, 0.5f);
Vector3 val5 = default(Vector3);
((Vector3)(ref val5))..ctor(-6f * val3.x, -3f * val3.y, -6f * val3.z);
if (magnitude > num2)
{
float num3 = magnitude - num2;
val5 -= val4 * (40f * num3);
float num4 = Vector3.Dot(ballVel - val2, val4);
if (num4 > 0f)
{
ballVel -= val4 * (num4 * Mathf.Clamp01(3f * num3 * num));
}
}
ballVel += val5 * num;
ballVel = val2 + (ballVel - val2) * Mathf.Exp(-0.25f * num);
ballPos += ballVel * num;
Vector3 val6 = ballPos - val;
float magnitude2 = ((Vector3)(ref val6)).magnitude;
if (magnitude2 > 12f)
{
Vector3 val7 = val6 / magnitude2;
ballPos = val + val7 * 12f;
Vector3 val8 = ballVel - val2;
float num5 = Vector3.Dot(val8, val7);
if (num5 > 0f)
{
val8 -= val7 * num5;
}
ballVel = val2 + val8;
}
if (((Vector3)(ref ballVel)).sqrMagnitude > 1f)
{
((Component)Held).transform.forward = ((Vector3)(ref ballVel)).normalized;
}
}
CollideWithPlayer(val2);
((Component)Held).transform.position = ballPos;
if (Object.op_Implicit((Object)(object)heldRb))
{
if (!heldRb.isKinematic)
{
heldRb.velocity = Vector3.zero;
}
heldRb.position = ballPos;
}
if (Object.op_Implicit((Object)(object)rope))
{
Vector3 val9 = (Object.op_Implicit((Object)(object)instance2.hand) ? instance2.hand.position : Cam().position);
rope.SetPosition(0, val9);
rope.SetPosition(1, ballPos);
}
}
internal static void OnHookPressed()
{
if (entered)
{
Release();
}
}
private static void CollideWithPlayer(Vector3 playerVel)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: 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_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)playerCol))
{
return;
}
Transform transform = ((Component)playerCol).transform;
Vector3 lossyScale = transform.lossyScale;
float num = playerCol.radius * Mathf.Max(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.z));
float num2 = playerCol.height * Mathf.Abs(lossyScale.y);
float num3 = Mathf.Max(num2 * 0.5f - num, 0f);
Vector3 val = ((playerCol.direction == 0) ? transform.right : ((playerCol.direction == 2) ? transform.forward : transform.up));
Vector3 val2 = transform.TransformPoint(playerCol.center);
float num4 = Mathf.Clamp(Vector3.Dot(ballPos - val2, val), 0f - num3, num3);
Vector3 val3 = val2 + val * num4;
Vector3 val4 = ballPos - val3;
float magnitude = ((Vector3)(ref val4)).magnitude;
float num5 = num + projRadius + 0.05f;
if (!(magnitude >= num5))
{
Vector3 val5 = ((magnitude > 0.0001f) ? (val4 / magnitude) : ((((Vector3)(ref ballVel)).sqrMagnitude > 0.01f) ? (-((Vector3)(ref ballVel)).normalized) : Vector3.up));
ballPos = val3 + val5 * num5;
Vector3 val6 = ballVel - playerVel;
float num6 = Vector3.Dot(val6, val5);
if (num6 < 0f)
{
val6 -= val5 * num6 * 1.5f;
}
ballVel = playerVel + val6;
}
}
internal static void SetThrownContext(EnemyIdentifier eid)
{
ThrownTarget = eid;
ThrownTargetDead = false;
thrownContextFrame = Time.frameCount;
}
internal static void ClearThrownContext()
{
ThrownTarget = null;
ThrownTargetDead = false;
thrownContextFrame = -1;
}
internal static bool IsThrown(Projectile p)
{
return Object.op_Implicit((Object)(object)p) && thrown.Contains(p);
}
internal static void WatchKill(EnemyIdentifier eid)
{
if (!Object.op_Implicit((Object)(object)eid))
{
return;
}
if (eid.dead)
{
Award(eid);
return;
}
foreach (PendingKill item in pending)
{
if ((Object)(object)item.eid == (Object)(object)eid)
{
return;
}
}
PendingKill pendingKill = new PendingKill();
pendingKill.eid = eid;
pendingKill.until = Time.time + 0.5f;
pending.Add(pendingKill);
}
private static void ProcessPending()
{
if (thrown.Count > 0)
{
thrown.RemoveWhere((Projectile x) => !Object.op_Implicit((Object)(object)x));
}
if (pending.Count == 0)
{
return;
}
for (int num = pending.Count - 1; num >= 0; num--)
{
PendingKill pendingKill = pending[num];
if (!Object.op_Implicit((Object)(object)pendingKill.eid))
{
pending.RemoveAt(num);
}
else if (pendingKill.eid.dead)
{
Award(pendingKill.eid);
pending.RemoveAt(num);
}
else if (Time.time > pendingKill.until)
{
pending.RemoveAt(num);
}
}
}
private static void Award(EnemyIdentifier eid)
{
StyleHUD instance = MonoSingleton<StyleHUD>.Instance;
if (Object.op_Implicit((Object)(object)instance))
{
instance.AddPoints(100, "<color=green>RETURNED</color>", (GameObject)null, eid, -1, "", "");
Plugin.Log.LogInfo((object)("Style: <color=green>RETURNED</color> +" + 100));
}
}
private static void EndHold()
{
Held = null;
Cleanup();
if (!holding)
{
return;
}
holding = false;
try
{
HookArm instance = MonoSingleton<HookArm>.Instance;
if (Object.op_Implicit((Object)(object)instance))
{
instance.CatchOver();
}
}
catch (Exception)
{
}
}
private static void Release()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
Projectile held = Held;
EndHold();
if (Object.op_Implicit((Object)(object)held))
{
NewMovement instance = MonoSingleton<NewMovement>.Instance;
Vector3 val = ((Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.rb)) ? instance.rb.velocity : Vector3.zero);
float num;
if (!entered)
{
num = 0f;
}
else
{
Vector3 val2 = ballVel - val;
num = ((Vector3)(ref val2)).magnitude;
}
float num2 = num;
float speed = Mathf.Clamp(100f + num2 * 3f, 100f, 160f);
Vector3 throwDirection = GetThrowDirection(((Component)held).transform.position);
ApplyParry(held, throwDirection, speed);
thrown.Add(held);
Plugin.Log.LogInfo((object)("Thrown " + ((Object)held).name + " speed=" + speed.ToString("0")));
}
}
private static GameObject GetParriedHitObject()
{
if (Object.op_Implicit((Object)(object)parriedHitObject))
{
return parriedHitObject;
}
FistControl instance = MonoSingleton<FistControl>.Instance;
if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.currentPunch) && Object.op_Implicit((Object)(object)instance.currentPunch.parriedProjectileHitObject))
{
parriedHitObject = instance.currentPunch.parriedProjectileHitObject;
}
else
{
Punch[] array = Object.FindObjectsOfType<Punch>(true);
foreach (Punch val in array)
{
if (Object.op_Implicit((Object)(object)val.parriedProjectileHitObject))
{
parriedHitObject = val.parriedProjectileHitObject;
break;
}
}
}
return parriedHitObject;
}
private static void ApplyParry(Projectile p, Vector3 dir, float speed)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
p.hittingPlayer = false;
p.friendly = true;
p.parried = true;
p.homingType = (HomingType)0;
p.alreadyHitEnemies.Clear();
GameObject val = GetParriedHitObject();
if (Object.op_Implicit((Object)(object)val))
{
p.explosionEffect = val;
}
p.precheckForCollisions = true;
if (Object.op_Implicit((Object)(object)p.portalTraveler))
{
p.SetPortalTravellerType((PortalTravellerType)2);
}
if (Object.op_Implicit((Object)(object)p.parryChallenge))
{
p.parryChallenge.Done();
}
ConvertBeams(p);
Rigidbody component = ((Component)p).GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)component))
{
component.constraints = (RigidbodyConstraints)112;
if (component.isKinematic)
{
component.isKinematic = false;
}
}
if (p.explosive)
{
p.explosive = false;
}
p.speed = speed;
((Component)p).transform.forward = dir;
if (Object.op_Implicit((Object)(object)component))
{
component.velocity = dir * speed;
}
if (p.spreaded)
{
ProjectileSpread componentInParent = ((Component)p).GetComponentInParent<ProjectileSpread>();
if ((Object)(object)componentInParent != (Object)null)
{
componentInParent.ParriedProjectile();
}
}
((Component)p).transform.SetParent((Transform)null, true);
}
private static void ConvertBeams(Projectile p)
{
List<ContinuousBeam> list = new List<ContinuousBeam>();
if (p.connectedBeams != null && p.connectedBeams.Count > 0)
{
list.AddRange(p.connectedBeams);
}
ContinuousBeam[] componentsInChildren = ((Component)p).GetComponentsInChildren<ContinuousBeam>();
foreach (ContinuousBeam item in componentsInChildren)
{
if (!list.Contains(item))
{
list.Add(item);
}
}
foreach (ContinuousBeam item2 in list)
{
if (!((Object)(object)item2 == (Object)null))
{
if (item2.enemy)
{
item2.parryMultiplier = 2.5f;
}
item2.enemy = false;
item2.canHitEnemy = true;
item2.canHitPlayer = false;
}
}
}
private static Vector3 GetThrowDirection(Vector3 from)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
Transform val = Cam();
Vector3 val2 = val.position + val.forward * 200f;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val.position, val.forward, ref val3, 200f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3)), (QueryTriggerInteraction)1))
{
val2 = ((RaycastHit)(ref val3)).point;
}
Vector3 val4 = val2 - from;
return ((Vector3)(ref val4)).normalized;
}
private static void Cleanup()
{
if (Object.op_Implicit((Object)(object)rope))
{
Object.Destroy((Object)(object)((Component)rope).gameObject);
}
}
private static LineRenderer HookLr()
{
HookArm instance = MonoSingleton<HookArm>.Instance;
return Object.op_Implicit((Object)(object)instance) ? Traverse.Create((object)instance).Field("lr").GetValue<LineRenderer>() : null;
}
private static void CreateRope()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)rope))
{
LineRenderer val = HookLr();
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
{
GameObject val2 = new GameObject("WhipProjectileRope");
rope = val2.AddComponent<LineRenderer>();
((Renderer)rope).sharedMaterial = ((Renderer)val).sharedMaterial;
rope.widthMultiplier = val.widthMultiplier;
rope.positionCount = 2;
rope.useWorldSpace = true;
}
}
}
}
[HarmonyPatch(typeof(HookArm), "Update")]
internal static class HookUpdatePatch
{
private static bool Prefix(HookArm __instance)
{
try
{
if (!Object.op_Implicit((Object)(object)WhipHold.Held) || !__instance.equipped)
{
return true;
}
OptionsManager instance = MonoSingleton<OptionsManager>.Instance;
if (!Object.op_Implicit((Object)(object)instance) || instance.paused)
{
return true;
}
InputManager instance2 = MonoSingleton<InputManager>.Instance;
if (Object.op_Implicit((Object)(object)instance2) && instance2.InputSource.Hook.WasPerformedThisFrame)
{
WhipHold.OnHookPressed();
return false;
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)("Hook prefix failed: " + ex));
}
return true;
}
private static void Postfix()
{
WhipHold.Tick();
}
}
[HarmonyPatch(typeof(HookArm), "CatchOver")]
internal static class CatchOverPatch
{
private static bool Prefix()
{
return !Object.op_Implicit((Object)(object)WhipHold.Held);
}
}
[HarmonyPatch(typeof(HookArm), "FixedUpdate")]
internal static class HookCatchPatch
{
private static void Postfix(HookArm __instance, Vector3 ___hookPoint)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)WhipHold.Held) || (int)__instance.state != 1)
{
return;
}
Collider[] array = Physics.OverlapSphere(___hookPoint, 3f, -1, (QueryTriggerInteraction)2);
Collider[] array2 = array;
foreach (Collider val in array2)
{
Projectile componentInParent = ((Component)val).GetComponentInParent<Projectile>();
if (WhipHold.CanGrab(componentInParent))
{
WhipHold.Grab(componentInParent);
__instance.StopThrow(0f, false);
break;
}
}
}
}
[HarmonyPatch(typeof(Projectile), "Collided")]
internal static class ThrownHitPatch
{
private static void Prefix(Projectile __instance, Collider other, out EnemyIdentifier __state)
{
__state = null;
WhipHold.Relabeled = false;
WhipHold.ClearThrownContext();
try
{
if (Object.op_Implicit((Object)(object)other) && WhipHold.IsThrown(__instance) && Traverse.Create((object)__instance).Field("active").GetValue<bool>() && (((Component)other).CompareTag("Head") || ((Component)other).CompareTag("Body") || ((Component)other).CompareTag("Limb") || ((Component)other).CompareTag("EndLimb")) && !((Component)other).CompareTag("Armor"))
{
EnemyIdentifierIdentifier componentInParent = ((Component)other).GetComponentInParent<EnemyIdentifierIdentifier>();
EnemyIdentifier val = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.eid : null);
if (Object.op_Implicit((Object)(object)val) && !val.dead && !__instance.alreadyHitEnemies.Contains(val))
{
__state = val;
WhipHold.SetThrownContext(val);
}
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)("Thrown hit prefix failed: " + ex));
}
}
private static void Postfix(EnemyIdentifier __state)
{
try
{
if (Object.op_Implicit((Object)(object)__state) && !WhipHold.Relabeled)
{
WhipHold.WatchKill(__state);
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)("Thrown hit postfix failed: " + ex));
}
WhipHold.ClearThrownContext();
}
}
[HarmonyPatch(typeof(StyleCalculator), "HitCalculator")]
internal static class StyleHitPatch
{
private static void Prefix(string hitter, bool dead, EnemyIdentifier eid)
{
if (WhipHold.ThrownContextActive && hitter == "projectile" && (Object)(object)eid == (Object)(object)WhipHold.ThrownTarget)
{
WhipHold.ThrownTargetDead = dead;
}
}
}
[HarmonyPatch(typeof(StyleHUD), "AddPoints")]
internal static class StyleAddPointsPatch
{
private static bool Prefix(ref int points, ref string pointID)
{
try
{
if (!WhipHold.ReplaceFriendlyFire)
{
return true;
}
if (pointID != "ultrakill.friendlyfire" || !WhipHold.ThrownContextActive)
{
return true;
}
if (!WhipHold.ThrownTargetDead)
{
return false;
}
pointID = "<color=green>RETURNED</color>";
points = 100;
WhipHold.Relabeled = true;
}
catch (Exception ex)
{
Plugin.Log.LogError((object)("Style replace failed: " + ex));
}
return true;
}
}
[HarmonyPatch]
internal static class SkipIfHeld
{
private static IEnumerable<MethodBase> TargetMethods()
{
yield return AccessTools.Method(typeof(Projectile), "Update", (Type[])null, (Type[])null);
yield return AccessTools.Method(typeof(Projectile), "FixedUpdate", (Type[])null, (Type[])null);
yield return AccessTools.Method(typeof(Projectile), "Collided", (Type[])null, (Type[])null);
}
private static bool Prefix(Projectile __instance)
{
return (Object)(object)__instance != (Object)(object)WhipHold.Held;
}
}
}