using System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Networking; [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("LethalPush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalPush")] [assembly: AssemblyTitle("LethalPush")] [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; } } } namespace LethalPush { [BepInPlugin("com.YourName.LethalPush", "Lethal Push", "1.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.YourName.LethalPush"); private void Awake() { harmony.PatchAll(typeof(PushPatch)); ((MonoBehaviour)this).StartCoroutine(LoadCustomAudio()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Lethal Push Mod loaded (Custom Audio & Debug enabled)!"); } private IEnumerator LoadCustomAudio() { string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string audioFilePath = Path.Combine(folderPath, "bump.mp3"); if (!File.Exists(audioFilePath)) { ((BaseUnityPlugin)this).Logger.LogError((object)("Could not find audio file at: " + audioFilePath)); yield break; } string url = "file://" + audioFilePath.Replace("\\", "/"); UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)13); try { yield return www.SendWebRequest(); if ((int)www.result == 2 || (int)www.result == 3) { ((BaseUnityPlugin)this).Logger.LogError((object)("Error loading custom audio: " + www.error)); yield break; } PushPatch.bumpClip = DownloadHandlerAudioClip.GetContent(www); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded custom bump.mp3!"); } finally { ((IDisposable)www)?.Dispose(); } } } internal class PushPatch { private static bool isMessageHandlerRegistered; private static float currentCooldown; private const float MAX_COOLDOWN = 3f; public static AudioClip? bumpClip; [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] private static void InitNetworkPatch() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown if ((Object)(object)NetworkManager.Singleton != (Object)null && !isMessageHandlerRegistered) { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("LethalPush_ServerReceive", new HandleNamedMessageDelegate(OnServerReceivePush)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("LethalPush_ClientReceive", new HandleNamedMessageDelegate(OnClientReceivePush)); isMessageHandlerRegistered = true; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdatePatch(PlayerControllerB __instance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0158: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled) { return; } if (currentCooldown > 0f) { currentCooldown -= Time.deltaTime; } if (!Mouse.current.middleButton.wasPressedThisFrame || !(currentCooldown <= 0f)) { return; } RaycastHit[] array = Physics.RaycastAll(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward, 3f); RaycastHit[] array2 = array; FastBufferWriter val2 = default(FastBufferWriter); for (int i = 0; i < array2.Length; i++) { RaycastHit val = array2[i]; PlayerControllerB componentInParent = ((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)__instance) { currentCooldown = 3f; Vector3 forward = ((Component)__instance.gameplayCamera).transform.forward; forward.y = 0f; ((Vector3)(ref forward)).Normalize(); ((FastBufferWriter)(ref val2))..ctor(20, (Allocator)2, -1); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref componentInParent.playerClientId, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward.x, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward.y, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward.z, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("LethalPush_ServerReceive", 0uL, val2, (NetworkDelivery)3); if ((Object)(object)bumpClip != (Object)null) { AudioSource.PlayClipAtPoint(bumpClip, ((Component)componentInParent).transform.position, 1f); } break; } } } private static void OnServerReceivePush(ulong senderClientId, FastBufferReader reader) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00c0: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num3, default(ForPrimitives)); float num4 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num4, default(ForPrimitives)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref num2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref num3, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref num4, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("LethalPush_ClientReceive", num, val, (NetworkDelivery)3); } } private static void OnClientReceivePush(ulong senderClientId, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_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_0072: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num3, default(ForPrimitives)); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, num2, num3); float num4 = 500f; localPlayerController.externalForces += val * num4; if ((Object)(object)bumpClip != (Object)null) { AudioSource.PlayClipAtPoint(bumpClip, ((Component)localPlayerController).transform.position, 1f); } } } } }