using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; 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("AllHitscan")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AllHitscan")] [assembly: AssemblyTitle("AllHitscan")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } [BepInPlugin("com.flame.ultrakill.allhitscan", "All Hitscan Mod", "1.9.2")] public class AllHitscanPlugin : BaseUnityPlugin { public static AllHitscanPlugin Instance; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Instance = this; Harmony val = new Harmony("com.flame.ultrakill.allhitscan"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[All-Hitscan] MOD LOADED! Chainsaw tumble fix applied."); } public void LogDebug(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[All-Hitscan - DEBUG] " + message)); } } public class BeamFader : MonoBehaviour { private LineRenderer lr = null; private float alpha = 1f; private float fadeSpeed = 4f; private void Start() { lr = ((Component)this).GetComponent(); } private void Update() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) alpha -= Time.deltaTime * fadeSpeed; if (alpha <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Color startColor = lr.startColor; startColor.a = alpha; lr.startColor = startColor; lr.endColor = new Color(startColor.r, startColor.g, startColor.b, 0f); } } public static class HitscanHelper { public static Vector3 ProcessInstantHit(MonoBehaviour projectile) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_029c: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0108: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)projectile).transform.parent != (Object)null) { AllHitscanPlugin.Instance.LogDebug("Ignored " + ((Object)((Component)projectile).gameObject).name + " (It is charging on the weapon)."); return ((Component)projectile).transform.position; } AllHitscanPlugin.Instance.LogDebug("Intercepted Projectile: " + ((Object)((Component)projectile).gameObject).name); Vector3 position = ((Component)projectile).transform.position; Vector3 forward = ((Component)projectile).transform.forward; Grenade val = (Grenade)(object)((projectile is Grenade) ? projectile : null); bool flag = val != null && !val.rocket; bool flag2 = projectile is Cannonball; bool flag3 = projectile is Chainsaw; if (flag || flag2 || flag3) { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { forward = ((Component)main).transform.forward; } } Vector3 val2 = position + forward * 1000f; Vector3 position2 = val2; Ray val3 = default(Ray); ((Ray)(ref val3))..ctor(position, forward); RaycastHit[] array = Physics.RaycastAll(val3, 2000f); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); bool flag4 = false; RaycastHit[] array2 = array; for (int num = 0; num < array2.Length; num++) { RaycastHit val4 = array2[num]; if (!((RaycastHit)(ref val4)).collider.isTrigger && !((Object)((RaycastHit)(ref val4)).collider).name.Contains("Camera") && !((Object)((RaycastHit)(ref val4)).collider).name.Contains("Player") && !((Object)((RaycastHit)(ref val4)).collider).name.Contains("Projectile") && !((Object)(object)((Component)((RaycastHit)(ref val4)).collider).gameObject == (Object)(object)((Component)projectile).gameObject)) { val2 = ((RaycastHit)(ref val4)).point; position2 = ((!(((RaycastHit)(ref val4)).distance > 1.5f)) ? ((RaycastHit)(ref val4)).point : (((RaycastHit)(ref val4)).point - forward * 1.5f)); AllHitscanPlugin.Instance.LogDebug("VALID Hitscan struck: " + ((Object)((RaycastHit)(ref val4)).collider).name); flag4 = true; break; } } if (!flag4) { AllHitscanPlugin.Instance.LogDebug("Hitscan struck nothing (skybox)."); } ((Component)projectile).transform.position = position2; CreatePiercerVisual(position, val2); return val2; } private static void CreatePiercerVisual(Vector3 start, Vector3 end) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("HitscanBeamVisual"); LineRenderer val2 = val.AddComponent(); val2.SetPosition(0, start); val2.SetPosition(1, end); val2.startWidth = 0.1f; val2.endWidth = 0.02f; ((Renderer)val2).material = new Material(Shader.Find("Sprites/Default")); val2.startColor = new Color(1f, 0.8f, 0f, 1f); val2.endColor = new Color(1f, 0.5f, 0f, 1f); val.AddComponent(); } } public class RocketHijackBehavior : MonoBehaviour { private Grenade rocket = null; private void Start() { rocket = ((Component)this).GetComponent(); } private void Update() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) if (!((Object)(object)MonoSingleton.Instance != (Object)null) || MonoSingleton.Instance.rocketFrozen) { return; } AllHitscanPlugin.Instance.LogDebug("Parasite triggered! Hijacking unfreeze behavior."); Vector3 val = HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)rocket); if (rocket.playerRiding && (Object)(object)MonoSingleton.Instance != (Object)null) { AllHitscanPlugin.Instance.LogDebug("Player is riding! Commencing warp drive."); Vector3 position = val - ((Component)rocket).transform.forward * 2f; CharacterController component = ((Component)MonoSingleton.Instance).GetComponent(); if ((Object)(object)component != (Object)null) { ((Collider)component).enabled = false; } ((Component)MonoSingleton.Instance).transform.position = position; if ((Object)(object)component != (Object)null) { ((Collider)component).enabled = true; } } Object.Destroy((Object)(object)this); } } public class CoreEjectHijackBehavior : MonoBehaviour { private Grenade core = null; private void Start() { core = ((Component)this).GetComponent(); } private void Update() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)this).transform.parent == (Object)null) { AllHitscanPlugin.Instance.LogDebug("Core Eject detached! Firing hitscan."); HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)core); Object.Destroy((Object)(object)this); } } } [HarmonyPatch(typeof(Projectile), "Start")] public class ProjectilePatch { [HarmonyPrefix] public static void Prefix(Projectile __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)null && __instance.friendly) { HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)__instance); } } } [HarmonyPatch(typeof(Nail), "Start")] public class NailPatch { [HarmonyPrefix] public static void Prefix(Nail __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)__instance); } } [HarmonyPatch(typeof(Cannonball), "Start")] public class CannonballPatch { [HarmonyPrefix] public static void Prefix(Cannonball __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)__instance); } } [HarmonyPatch(typeof(Chainsaw), "Start")] public class ChainsawPatch { [HarmonyPrefix] public static void Prefix(Chainsaw __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)__instance); } } [HarmonyPatch(typeof(Harpoon), "Start")] public class HarpoonPatch { [HarmonyPrefix] public static void Prefix(Harpoon __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)__instance); } } [HarmonyPatch(typeof(Magnet), "Start")] public class MagnetPatch { [HarmonyPrefix] public static void Prefix(Magnet __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)__instance); } } [HarmonyPatch(typeof(Grenade), "Start")] public class GrenadePatch { [HarmonyPrefix] public static void Prefix(Grenade __instance) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (__instance.rocket && (Object)(object)MonoSingleton.Instance != (Object)null && MonoSingleton.Instance.rocketFrozen) { if ((Object)(object)((Component)__instance).transform.parent == (Object)null) { AllHitscanPlugin.Instance.LogDebug("Frozen rocket detected! Injecting hijack parasite."); ((Component)__instance).gameObject.AddComponent(); } } else if ((Object)(object)((Component)__instance).transform.parent != (Object)null) { AllHitscanPlugin.Instance.LogDebug("Charging grenade detected! Injecting core hijack parasite."); ((Component)__instance).gameObject.AddComponent(); } else { HitscanHelper.ProcessInstantHit((MonoBehaviour)(object)__instance); } } }