Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LethalHands v23.0.1
plugins/LethalHands.dll
Decompiled 3 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EmotesAPI; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalEmotesAPI.ImportV2; using LethalHands; using LethalHands.NetcodePatcher; using LethalHands.Patches; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LethalHands")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalHands")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3b5b33b2-35bc-42cf-8244-b7242ac50309")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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; } } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { LethalHandsPlugin.Instance.manualLogSource.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { LethalHandsPlugin.Instance.manualLogSource.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } namespace LethalHands { internal class Animation { private static HumanBodyBones[] ignoredRootBones = (HumanBodyBones[])(object)new HumanBodyBones[2] { (HumanBodyBones)1, (HumanBodyBones)2 }; private static HumanBodyBones[] ignoredSoloBones; public static void instantiateAnimations() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown CustomEmoteParams val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("squareup.anim") }; val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("squaredupidle.anim") }; val.visible = false; val.audioLevel = 0f; val.audioLoops = false; val.allowJoining = false; val.thirdPerson = false; val.forceCameraMode = true; val.allowThirdPerson = false; val.displayName = " "; val.internalName = "squareup"; val.rootBonesToIgnore = ignoredRootBones; val.soloBonesToIgnore = ignoredSoloBones; val.useLocalTransforms = true; val.animateHealthbar = false; CustomEmoteParams val2 = val; val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("squaredown.anim") }; val.visible = false; val.audioLevel = 0f; val.audioLoops = false; val.allowJoining = false; val.thirdPerson = false; val.forceCameraMode = true; val.allowThirdPerson = false; val.displayName = " "; val.internalName = "squaredown"; val.rootBonesToIgnore = ignoredRootBones; val.soloBonesToIgnore = ignoredSoloBones; val.useLocalTransforms = true; val.animateHealthbar = false; CustomEmoteParams val3 = val; val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("lpunch.anim") }; val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("squaredupidle.anim") }; val.primaryAudioClips = (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("swing1.ogg"), Assets.Load<AudioClip>("swing2.ogg") }; val.visible = false; val.audioLevel = 0f; val.audioLoops = false; val.allowJoining = false; val.thirdPerson = false; val.forceCameraMode = true; val.allowThirdPerson = false; val.displayName = " "; val.internalName = "lpunch"; val.rootBonesToIgnore = ignoredRootBones; val.soloBonesToIgnore = ignoredSoloBones; val.useLocalTransforms = true; val.animateHealthbar = false; CustomEmoteParams val4 = val; val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("rpunch.anim") }; val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("squaredupidle.anim") }; val.primaryAudioClips = (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("swing1.ogg"), Assets.Load<AudioClip>("swing2.ogg") }; val.visible = false; val.audioLevel = 0f; val.audioLoops = false; val.allowJoining = false; val.thirdPerson = false; val.forceCameraMode = true; val.allowThirdPerson = false; val.displayName = " "; val.internalName = "rpunch"; val.rootBonesToIgnore = ignoredRootBones; val.soloBonesToIgnore = ignoredSoloBones; val.useLocalTransforms = true; val.animateHealthbar = false; CustomEmoteParams val5 = val; EmoteImporter.ImportEmote(val2); EmoteImporter.ImportEmote(val3); EmoteImporter.ImportEmote(val4); EmoteImporter.ImportEmote(val5); } static Animation() { HumanBodyBones[] array = new HumanBodyBones[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); ignoredSoloBones = (HumanBodyBones[])(object)array; } } public static class Assets { internal static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>(); private static readonly Dictionary<string, int> AssetIndices = new Dictionary<string, int>(); public static void LoadAssetBundlesFromFolder(string folderName) { folderName = Path.Combine(Path.GetDirectoryName(LethalHandsPlugin.PInfo.Location), folderName); string[] files = Directory.GetFiles(folderName); foreach (string text in files) { AssetBundle val = AssetBundle.LoadFromFile(text); int count = AssetBundles.Count; AssetBundles.Add(val); string[] allAssetNames = val.GetAllAssetNames(); foreach (string text2 in allAssetNames) { string text3 = text2.ToLowerInvariant(); if (text3.StartsWith("assets/")) { text3 = text3.Remove(0, "assets/".Length); } LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)$"paring [{text3}] with [{count}]"); AssetIndices[text3] = count; } LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)("Loaded AssetBundle: " + Path.GetFileName(text))); } } public static T Load<T>(string assetName) where T : Object { try { assetName = assetName.ToLowerInvariant(); if (assetName.Contains(":")) { string[] array = assetName.Split(new char[1] { ':' }); assetName = array[1].ToLowerInvariant(); } if (assetName.StartsWith("assets/")) { assetName = assetName.Remove(0, "assets/".Length); } int index = AssetIndices[assetName]; return AssetBundles[index].LoadAsset<T>("assets/" + assetName); } catch (Exception arg) { LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)$"Couldn't load asset [{assetName}] reason: {arg}"); return default(T); } } } public class EnemyFloatHealth { public static EnemyFloatHealth Instance; private Dictionary<EnemyAI, float> enemyHitCounter; public EnemyFloatHealth() { if (Instance == null) { Instance = this; } enemyHitCounter = new Dictionary<EnemyAI, float>(); } public void Reset() { enemyHitCounter.Clear(); } public int DamageEnemy(EnemyAI enemy) { if (!enemyHitCounter.ContainsKey(enemy)) { enemyHitCounter.Add(enemy, 0f); } int num = 0; if (enemy is NutcrackerEnemyAI) { NutcrackerEnemyAI val = (NutcrackerEnemyAI)(object)((enemy is NutcrackerEnemyAI) ? enemy : null); FieldInfo field = typeof(NutcrackerEnemyAI).GetField("isInspecting", BindingFlags.Instance | BindingFlags.NonPublic); if (!(bool)field.GetValue(val) && ((EnemyAI)val).currentBehaviourStateIndex != 2) { return 0; } } enemyHitCounter[enemy] += LethalHands.Instance.enemyPunchDamage; while (enemyHitCounter[enemy] >= 1f) { enemyHitCounter[enemy]--; num++; } LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)$"new damage : {num}"); return num; } } [Serializable] public class NetworkConfig : SyncedInstance<NetworkConfig> { public float punchRange; public float punchCooldown; public float enemyPunchDamage; public int playerPunchDamage; public int punchOffClingersChance; public bool punchingHaltsStaminaRegen; public int punchStaminaRequirement; public int staminaDrain; public ItemMode itemDropMode; public bool allowItems; public NetworkConfig() { InitInstance(this); punchRange = LocalConfig.punchRange.Value; punchCooldown = LocalConfig.punchCooldown.Value; enemyPunchDamage = LocalConfig.enemyPunchDamage.Value; playerPunchDamage = LocalConfig.playerPunchDamage.Value; punchOffClingersChance = LocalConfig.punchOffClingersChance.Value; staminaDrain = LocalConfig.staminaDrain.Value; punchStaminaRequirement = LocalConfig.staminaRequirement.Value; punchingHaltsStaminaRegen = LocalConfig.punchingHaltsStaminaRegen.Value; itemDropMode = LocalConfig.itemDropMode.Value; allowItems = LocalConfig.allowItems.Value; } public static void RequestSync() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<NetworkConfig>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<NetworkConfig>.IntSize, (Allocator)2, -1); try { SyncedInstance<NetworkConfig>.MessageManager.SendNamedMessage("SlapitNow.LethalHands_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0058: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<NetworkConfig>.IsHost) { return; } LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<NetworkConfig>.SerializeToBytes(SyncedInstance<NetworkConfig>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<NetworkConfig>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<NetworkConfig>.MessageManager.SendNamedMessage("SlapitNow.LethalHands_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<NetworkConfig>.IntSize)) { LethalHandsPlugin.Instance.manualLogSource.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { LethalHandsPlugin.Instance.manualLogSource.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<NetworkConfig>.SyncInstance(data); LethalHands.Instance.LoadConfigValues(); LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)"Successfully synced config with host."); } } internal class Input { public class SquareUpInput : LcInputActions { public static SquareUpInput Instance = new SquareUpInput(); [InputAction("<Keyboard>/j", Name = "Square up")] public InputAction SquareUpKey { get; set; } } } public class LethalHands : MonoBehaviour { [CompilerGenerated] private sealed class <LeftPunch>d__32 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LethalHands <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LeftPunch>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)"Left Punch"); <>4__this.playerControllerInstance.sprintMeter = Mathf.Max(<>4__this.playerControllerInstance.sprintMeter - <>4__this.staminaDrain, 0f); <>4__this.recordedStamina = <>4__this.playerControllerInstance.sprintMeter; <>4__this.freezeStaminaRegen = true; CustomEmotesAPI.PlayAnimation("SlapitNow.LethalHands__lpunch", -2); <>2__current = (object)new WaitForSeconds(<>4__this.punchConnectTime); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.PunchThrow(); <>2__current = (object)new WaitForSeconds(<>4__this.punchFinishingTime); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.punchingCoroutine = null; if (<>4__this.unfreezeStaminaRegenCoroutine != null) { ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.unfreezeStaminaRegenCoroutine); } <>4__this.unfreezeStaminaRegenCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.UnfreezeStaminaRegen()); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RightPunch>d__33 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LethalHands <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RightPunch>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)"Right Punch"); <>4__this.playerControllerInstance.sprintMeter = Mathf.Max(<>4__this.playerControllerInstance.sprintMeter - <>4__this.staminaDrain, 0f); <>4__this.recordedStamina = <>4__this.playerControllerInstance.sprintMeter; <>4__this.freezeStaminaRegen = true; CustomEmotesAPI.PlayAnimation("SlapitNow.LethalHands__rpunch", -2); <>2__current = (object)new WaitForSeconds(<>4__this.punchConnectTime); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.PunchThrow(); <>2__current = (object)new WaitForSeconds(<>4__this.punchFinishingTime); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.punchingCoroutine = null; if (<>4__this.unfreezeStaminaRegenCoroutine != null) { ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.unfreezeStaminaRegenCoroutine); } <>4__this.unfreezeStaminaRegenCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.UnfreezeStaminaRegen()); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <UnfreezeStaminaRegen>d__34 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LethalHands <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <UnfreezeStaminaRegen>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.freezeStaminaRegen = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public bool isSquaredUp = false; private static int shovelMask = 11012424; public PlayerControllerB playerControllerInstance = GameNetworkManager.Instance.localPlayerController; private static readonly string[] controlTips = new string[2] { "Left Punch : [Left Click]", "Right Punch : [Right Click]" }; private AudioClip[] hitSounds = (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("hit1.ogg"), Assets.Load<AudioClip>("hit2.ogg") }; public float recordedStamina = 1f; public bool freezeStaminaRegen = false; private Coroutine punchingCoroutine = null; private Coroutine unfreezeStaminaRegenCoroutine = null; private float punchRange = SyncedInstance<NetworkConfig>.Default.punchRange; private float punchDelay = SyncedInstance<NetworkConfig>.Default.punchCooldown; public float enemyPunchDamage = SyncedInstance<NetworkConfig>.Default.enemyPunchDamage; public int playerPunchDamage = SyncedInstance<NetworkConfig>.Default.playerPunchDamage; private int punchOffClingersChance = SyncedInstance<NetworkConfig>.Default.punchOffClingersChance; private float staminaDrain = (float)SyncedInstance<NetworkConfig>.Default.staminaDrain * 0.01f; public bool punchingHaltsStaminaRegen = SyncedInstance<NetworkConfig>.Default.punchingHaltsStaminaRegen; private float punchStaminaRequirement = (float)SyncedInstance<NetworkConfig>.Default.punchStaminaRequirement * 0.01f; private ItemMode itemMode = SyncedInstance<NetworkConfig>.Default.itemDropMode; public bool allowItems = SyncedInstance<NetworkConfig>.Default.allowItems; private float punchConnectTime = Mathf.Min(0.1f * SyncedInstance<NetworkConfig>.Default.punchCooldown, 0.1f); private float punchFinishingTime = Mathf.Min(0.9f * SyncedInstance<NetworkConfig>.Default.punchCooldown, 0.9f); public static LethalHands Instance { get; private set; } public void Awake() { if (!((Object)(object)Instance != (Object)null)) { Instance = this; Input.SquareUpInput.Instance.SquareUpKey.performed += SquareUpPerformed; } } public void LoadConfigValues() { punchRange = SyncedInstance<NetworkConfig>.Instance.punchRange; punchDelay = SyncedInstance<NetworkConfig>.Instance.punchCooldown * 4f; enemyPunchDamage = SyncedInstance<NetworkConfig>.Instance.enemyPunchDamage; playerPunchDamage = SyncedInstance<NetworkConfig>.Instance.playerPunchDamage; punchOffClingersChance = SyncedInstance<NetworkConfig>.Instance.punchOffClingersChance; staminaDrain = (float)SyncedInstance<NetworkConfig>.Instance.staminaDrain * 0.01f; punchingHaltsStaminaRegen = SyncedInstance<NetworkConfig>.Instance.punchingHaltsStaminaRegen; punchStaminaRequirement = (float)SyncedInstance<NetworkConfig>.Instance.punchStaminaRequirement * 0.01f; itemMode = SyncedInstance<NetworkConfig>.Instance.itemDropMode; allowItems = SyncedInstance<NetworkConfig>.Instance.allowItems; punchConnectTime = Mathf.Min(0.2f * SyncedInstance<NetworkConfig>.Instance.punchCooldown, 0.1f); } public void SquareUpPerformed(CallbackContext context) { if (((CallbackContext)(ref context)).performed && !playerControllerInstance.quickMenuManager.isMenuOpen && ((((NetworkBehaviour)playerControllerInstance).IsOwner && playerControllerInstance.isPlayerControlled && (!((NetworkBehaviour)playerControllerInstance).IsServer || playerControllerInstance.isHostPlayerObject)) || playerControllerInstance.isTestingPlayer) && !playerControllerInstance.inSpecialInteractAnimation && !playerControllerInstance.isTypingChat) { if (isSquaredUp) { SquareDown(animate: true); } else { SquareUp(); } } } public void LeftPunchPerformed(CallbackContext context) { if (((CallbackContext)(ref context)).performed && isSquaredUp && playerControllerInstance.sprintMeter >= punchStaminaRequirement && punchingCoroutine == null) { punchingCoroutine = ((MonoBehaviour)this).StartCoroutine(LeftPunch()); } } public void RightPunchPerformed(CallbackContext context) { if (((CallbackContext)(ref context)).performed && isSquaredUp && playerControllerInstance.sprintMeter >= punchStaminaRequirement && punchingCoroutine == null) { punchingCoroutine = ((MonoBehaviour)this).StartCoroutine(RightPunch()); } } public void SquareUp() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (isSquaredUp || playerControllerInstance.inSpecialInteractAnimation) { return; } switch (itemMode) { case ItemMode.All: playerControllerInstance.DropAllHeldItemsAndSync(); break; case ItemMode.MainSlots: DropMainItems((int)playerControllerInstance.playerClientId); LethalHandsNetworker.Instance.DropMainItemsServerRpc((int)playerControllerInstance.playerClientId); break; case ItemMode.Current: if (playerControllerInstance.isHoldingObject) { playerControllerInstance.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } break; } playerControllerInstance.performingEmote = false; playerControllerInstance.StopPerformingEmoteServerRpc(); playerControllerInstance.timeSinceStartingEmote = 0f; isSquaredUp = true; CustomEmotesAPI.PlayAnimation("SlapitNow.LethalHands__squareup", -2); IngamePlayerSettings.Instance.playerInput.actions.FindAction("ActivateItem", false).performed += LeftPunchPerformed; IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false).performed += RightPunchPerformed; HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(controlTips, false, (Item)null); LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)("Squaring up " + isSquaredUp)); } public void SquareDown(bool animate) { if (isSquaredUp) { IngamePlayerSettings.Instance.playerInput.actions.FindAction("ActivateItem", false).performed -= LeftPunchPerformed; IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false).performed -= RightPunchPerformed; if (animate) { CustomEmotesAPI.PlayAnimation("SlapitNow.LethalHands__squaredown", -2); } else { CustomEmotesAPI.PlayAnimation("none", -2); } HUDManager.Instance.ClearControlTips(); isSquaredUp = false; LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)("Squaring down " + isSquaredUp)); } } [IteratorStateMachine(typeof(<LeftPunch>d__32))] private IEnumerator LeftPunch() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LeftPunch>d__32(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<RightPunch>d__33))] private IEnumerator RightPunch() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RightPunch>d__33(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<UnfreezeStaminaRegen>d__34))] private IEnumerator UnfreezeStaminaRegen() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <UnfreezeStaminaRegen>d__34(0) { <>4__this = this }; } public void PunchThrow() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] source = Physics.SphereCastAll(((Component)playerControllerInstance.gameplayCamera).transform.position, 0.8f, ((Component)playerControllerInstance.gameplayCamera).transform.forward, punchRange, shovelMask, (QueryTriggerInteraction)2); List<RaycastHit> list = source.OrderBy((RaycastHit raycast) => ((RaycastHit)(ref raycast)).distance).ToList(); bool flag = false; int terrainIndex = -1; IHittable val = default(IHittable); RaycastHit val2 = default(RaycastHit); foreach (RaycastHit item in list) { RaycastHit current = item; if ((((Component)((RaycastHit)(ref current)).transform).gameObject.layer == 8 || ((Component)((RaycastHit)(ref current)).transform).gameObject.layer == 11) && !((RaycastHit)(ref current)).collider.isTrigger) { flag = true; string tag = ((Component)((RaycastHit)(ref current)).collider).gameObject.tag; for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++) { if (StartOfRound.Instance.footstepSurfaces[i].surfaceTag == tag) { terrainIndex = i; break; } } } else { if (!((Component)((RaycastHit)(ref current)).transform).TryGetComponent<IHittable>(ref val) || (!(((RaycastHit)(ref current)).point == Vector3.zero) && Physics.Linecast(((Component)playerControllerInstance.gameplayCamera).transform.position, ((RaycastHit)(ref current)).point, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) || (Object)(object)((RaycastHit)(ref current)).transform == (Object)(object)((Component)playerControllerInstance).transform) { continue; } flag = true; Vector3 forward = ((Component)playerControllerInstance.gameplayCamera).transform.forward; bool flag2 = punchOffClingersChance > 0 && Random.Range(0, 100) < punchOffClingersChance; if (!flag2) { BushWolfTongueCollider val3 = (BushWolfTongueCollider)(object)((val is BushWolfTongueCollider) ? val : null); if (val3 != null && (Object)(object)val3.bushWolfScript.draggingPlayer == (Object)(object)playerControllerInstance) { continue; } } EnemyAICollisionDetect val4 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null); if (val4 != null) { EnemyAI mainScript = val4.mainScript; if (mainScript.isEnemyDead) { continue; } if (!flag2) { CentipedeAI val5 = (CentipedeAI)(object)((mainScript is CentipedeAI) ? mainScript : null); if (val5 != null && (Object)(object)val5.clingingToPlayer == (Object)(object)playerControllerInstance) { continue; } } if (!flag2) { FlowerSnakeEnemy val6 = (FlowerSnakeEnemy)(object)((mainScript is FlowerSnakeEnemy) ? mainScript : null); if (val6 != null && (Object)(object)val6.clingingToPlayer == (Object)(object)playerControllerInstance) { continue; } } val4.onlyCollideWhenGrounded = false; } try { val.Hit(-22, forward, playerControllerInstance, true, -1); } catch { } break; } } if (flag) { int soundIndex = Random.Range(0, hitSounds.Length); LethalHandsNetworker.Instance.PunchHitSoundServerRpc((int)playerControllerInstance.playerClientId, soundIndex, terrainIndex); RoundManager.PlayRandomClip(playerControllerInstance.movementAudio, hitSounds, true, 1f, 0, 1000); RoundManager.Instance.PlayAudibleNoise(((Component)playerControllerInstance).transform.position, 10f, 0.5f, 0, false, 0); } } public void PunchHitSound(int playerID, int soundIndex, int terrainIndex) { AudioSource movementAudio = StartOfRound.Instance.allPlayerScripts[playerID].movementAudio; movementAudio.PlayOneShot(hitSounds[soundIndex]); WalkieTalkie.TransmitOneShotAudio(movementAudio, hitSounds[soundIndex], 1f); if (terrainIndex != -1) { movementAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[terrainIndex].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(movementAudio, StartOfRound.Instance.footstepSurfaces[terrainIndex].hitSurfaceSFX, 1f); } } public void Sleep() { Input.SquareUpInput.Instance.SquareUpKey.performed -= SquareUpPerformed; if (isSquaredUp) { IngamePlayerSettings.Instance.playerInput.actions.FindAction("ActivateItem", false).performed -= LeftPunchPerformed; IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false).performed -= RightPunchPerformed; } Instance = null; } public void DropMainItems(int playerID) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID]; for (int i = 0; i < 4; i++) { GrabbableObject val2 = val.ItemSlots[i]; if ((Object)(object)val2 != (Object)null) { val2.parentObject = null; val2.heldByPlayerOnServer = false; if (val.isInElevator) { ((Component)val2).transform.SetParent(val.playersManager.elevatorTransform, true); } else { ((Component)val2).transform.SetParent(val.playersManager.propsContainer, true); } val.SetItemInElevator(val.isInHangarShipRoom, val.isInElevator, val2); val2.EnablePhysics(true); val2.EnableItemMeshes(true); ((Component)val2).transform.localScale = val2.originalScale; val2.isHeld = false; val2.isPocketed = false; val2.startFallingPosition = ((Component)val2).transform.parent.InverseTransformPoint(((Component)val2).transform.position); val2.FallToGround(true, false, default(Vector3)); val2.fallTime = Random.Range(-0.3f, 0.05f); if (((NetworkBehaviour)val).IsOwner) { val2.DiscardItemOnClient(); } else if (!val2.itemProperties.syncDiscardFunction) { val2.playerHeldBy = null; } if (((NetworkBehaviour)val).IsOwner) { ((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false; ((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false; HUDManager.Instance.ClearControlTips(); val.activatingItem = false; } val.ItemSlots[i] = null; } } if (val.isHoldingObject && val.currentItemSlot < 4) { val.isHoldingObject = false; if ((Object)(object)val.currentlyHeldObjectServer != (Object)null) { ((object)val).GetType().GetMethod("SetSpecialGrabAnimationBool", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(val, new object[2] { false, val.currentlyHeldObjectServer }); } val.playerBodyAnimator.SetBool("cancelHolding", true); val.playerBodyAnimator.SetTrigger("Throw"); } val.activatingItem = false; val.twoHanded = false; val.carryWeight = 1f; val.currentlyHeldObjectServer = null; } } internal class LethalHandsNetworker : NetworkBehaviour { public static LethalHandsNetworker Instance { get; private set; } public override void OnNetworkSpawn() { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { LethalHandsNetworker instance = Instance; if (instance != null) { ((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } [ServerRpc(RequireOwnership = false)] public void PunchHitSoundServerRpc(int playerID, int soundIndex, int terrainIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3916256545u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, soundIndex); BytePacker.WriteValueBitPacked(val2, terrainIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3916256545u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PunchHitSoundClientRpc(playerID, soundIndex, terrainIndex); } } } [ClientRpc] public void PunchHitSoundClientRpc(int playerID, int soundIndex, int terrainIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3644235124u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, soundIndex); BytePacker.WriteValueBitPacked(val2, terrainIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3644235124u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; LethalHands.Instance.PunchHitSound(playerID, soundIndex, terrainIndex); } } } [ServerRpc(RequireOwnership = false)] public void DropMainItemsServerRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3328373009u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3328373009u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; DropMainItemsClientRpc(playerID); } } } [ClientRpc] public void DropMainItemsClientRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3232993959u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3232993959u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; LethalHands.Instance.DropMainItems(playerID); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3916256545u, new RpcReceiveHandler(__rpc_handler_3916256545), "PunchHitSoundServerRpc"); ((NetworkBehaviour)this).__registerRpc(3644235124u, new RpcReceiveHandler(__rpc_handler_3644235124), "PunchHitSoundClientRpc"); ((NetworkBehaviour)this).__registerRpc(3328373009u, new RpcReceiveHandler(__rpc_handler_3328373009), "DropMainItemsServerRpc"); ((NetworkBehaviour)this).__registerRpc(3232993959u, new RpcReceiveHandler(__rpc_handler_3232993959), "DropMainItemsClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3916256545(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int soundIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref soundIndex); int terrainIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref terrainIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalHandsNetworker)(object)target).PunchHitSoundServerRpc(playerID, soundIndex, terrainIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3644235124(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int soundIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref soundIndex); int terrainIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref terrainIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalHandsNetworker)(object)target).PunchHitSoundClientRpc(playerID, soundIndex, terrainIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3328373009(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalHandsNetworker)(object)target).DropMainItemsServerRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3232993959(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalHandsNetworker)(object)target).DropMainItemsClientRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LethalHandsNetworker"; } } public class LocalConfig { public static ConfigEntry<float> punchRange; public static ConfigEntry<float> punchCooldown; public static ConfigEntry<float> enemyPunchDamage; public static ConfigEntry<int> playerPunchDamage; public static ConfigEntry<int> punchOffClingersChance; public static ConfigEntry<int> staminaDrain; public static ConfigEntry<int> staminaRequirement; public static ConfigEntry<bool> punchingHaltsStaminaRegen; public static ConfigEntry<ItemMode> itemDropMode; public static ConfigEntry<bool> allowItems; public static NetworkConfig networkConfig; public LocalConfig(ConfigFile cfg) { punchRange = cfg.Bind<float>("Balancing", "PunchRange", 1.2f, "Range of the punch (for reference, shovels are 1.5 and knives are 0.75)"); punchCooldown = cfg.Bind<float>("Balancing", "PunchCooldown", 1f, "Cooldown (in seconds) between punches"); enemyPunchDamage = cfg.Bind<float>("Balancing", "EnemyPunchDamage", 0.5f, "Damage dealt by a punch to enemies"); playerPunchDamage = cfg.Bind<int>("Balancing", "PlayerPunchDamage", 10, "Damage dealt by a punch to other players"); punchOffClingersChance = cfg.Bind<int>("Balancing", "PunchOffClingersChance", 100, "How likely (%) your own punches are to hit snarefleas/tulip snakes/fox tongues that are attached to yourself"); staminaDrain = cfg.Bind<int>("Stamina Balancing", "StaminaDrain", 0, "Max stamina drained (%) per punch"); staminaRequirement = cfg.Bind<int>("Stamina Balancing", "StaminaRequirement", 0, "Max stamina required (%) to punch"); punchingHaltsStaminaRegen = cfg.Bind<bool>("Stamina Balancing", "PunchingHaltsStaminaRegen", false, "Whether punching should halt stamina regeneration for a brief period"); itemDropMode = cfg.Bind<ItemMode>("Item Interaction", "ItemDropMode", ItemMode.All, "Whether to drop all items, the 4 main slots items, only the current item, or no items upon squaring up"); allowItems = cfg.Bind<bool>("Item Interaction", "AllowItems", false, "Whether to allow items to be held while squared up"); networkConfig = new NetworkConfig(); } } public enum ItemMode { All, MainSlots, Current, None } [BepInPlugin("SlapitNow.LethalHands", "Lethal Hands", "23.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalHandsPlugin : BaseUnityPlugin { private const string modGUID = "SlapitNow.LethalHands"; private const string modName = "Lethal Hands"; private const string modVersion = "23.0.1"; public static LethalHandsPlugin Instance; private readonly Harmony harmony = new Harmony("SlapitNow.LethalHands"); public ManualLogSource manualLogSource; public static LocalConfig MyConfig { get; internal set; } public static PluginInfo PInfo { get; private set; } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } private void Awake() { Instance = this; PInfo = ((BaseUnityPlugin)this).Info; manualLogSource = Logger.CreateLogSource("SlapitNow.LethalHands"); Assets.LoadAssetBundlesFromFolder("assetbundles"); MyConfig = new LocalConfig(((BaseUnityPlugin)this).Config); harmony.PatchAll(typeof(LethalHandsPlugin)); harmony.PatchAll(typeof(NetworkingPatches)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(StartMatchLeverPatch)); harmony.PatchAll(typeof(HudManagerPatch)); harmony.PatchAll(typeof(InteractTriggerPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(VehicleControllerPatch)); Animation.instantiateAnimations(); NetcodePatcher(); manualLogSource.LogInfo((object)"Successfully caught these hands"); } } } namespace LethalHands.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HudManagerPatch { [HarmonyPatch("CanPlayerScan")] [HarmonyPostfix] private static void CanPlayerScanPostfix(ref bool __result) { if ((Object)(object)LethalHands.Instance != (Object)null) { __result = __result && !LethalHands.Instance.isSquaredUp; } } } internal class EnemyAIPatch { [HarmonyPatch(typeof(EnemyAI), "HitEnemyOnLocalClient")] [HarmonyPrefix] private static bool PreHitEnemyOnLocalClient(EnemyAI __instance, int force, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if (force != -22) { return true; } __instance.HitEnemy(EnemyFloatHealth.Instance.DamageEnemy(__instance), playerWhoHit, playHitSFX, hitID); __instance.HitEnemyServerRpc(force, (int)playerWhoHit.playerClientId, playHitSFX, hitID); return false; } [HarmonyPatch(typeof(EnemyAI), "HitEnemyClientRpc")] [HarmonyPrefix] private static void PreHitEnemyClientRpc(EnemyAI __instance, ref int force, int playerWhoHit) { if (force == -22 && playerWhoHit != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { force = EnemyFloatHealth.Instance.DamageEnemy(__instance); } } } [HarmonyPatch(typeof(InteractTrigger))] internal class InteractTriggerPatch { [HarmonyPatch("SetUsingLadderOnLocalClient")] [HarmonyPrefix] private static void PreSetUsingLadderOnLocalClient() { LethalHands.Instance.SquareDown(animate: false); } } internal class NetworkingPatches { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } private static GameObject networkPrefab; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] public static void Init() { if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = Assets.Load<GameObject>("lethalhandsnetworker.prefab"); networkPrefab.AddComponent<LethalHandsNetworker>(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] private static void SpawnLethalHandsNetworker() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void InitializeLocalPlayer() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //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_007d: Expected O, but got Unknown if ((Object)(object)LethalHands.Instance == (Object)null) { LethalHands lethalHands = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.AddComponent<LethalHands>(); } if (EnemyFloatHealth.Instance == null) { new EnemyFloatHealth(); } LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)"Player initialized, setting up config..."); if (SyncedInstance<NetworkConfig>.IsHost) { CustomMessagingManager messageManager = SyncedInstance<NetworkConfig>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = NetworkConfig.OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("SlapitNow.LethalHands_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<NetworkConfig>.Synced = true; return; } SyncedInstance<NetworkConfig>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<NetworkConfig>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = NetworkConfig.OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("SlapitNow.LethalHands_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); NetworkConfig.RequestSync(); } [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] [HarmonyPostfix] public static void PlayerLeave() { LethalHandsPlugin.Instance.manualLogSource.LogInfo((object)"Player disconnected, restoring config..."); LethalHands.Instance.Sleep(); SyncedInstance<NetworkConfig>.RevertSync(); EnemyFloatHealth.Instance = null; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("GrabObject")] [HarmonyPrefix] private static void PreGrabObject() { if (!LethalHands.Instance.allowItems) { LethalHands.Instance.SquareDown(animate: false); } } [HarmonyPatch("BeginGrabObject")] [HarmonyPostfix] private static void PostBeginGrabObject() { if (!LethalHands.Instance.allowItems && LethalHands.Instance.playerControllerInstance.isGrabbingObjectAnimation) { LethalHands.Instance.SquareDown(animate: false); } } [HarmonyPatch("SwitchToItemSlot")] [HarmonyPostfix] private static void PostSwitchToItemSlot() { if (!LethalHands.Instance.allowItems && LethalHands.Instance.playerControllerInstance.isHoldingObject) { LethalHands.Instance.SquareDown(animate: false); } } [HarmonyPatch("PerformEmote")] [HarmonyPrefix] private static void PrePerformEmote() { LethalHands.Instance.SquareDown(animate: false); } [HarmonyPatch("KillPlayer")] [HarmonyPostfix] private static void PostKillPlayer() { if (LethalHands.Instance.playerControllerInstance.isPlayerDead) { LethalHands.Instance.SquareDown(animate: false); } } [HarmonyPatch("CancelSpecialTriggerAnimations")] [HarmonyPrefix] private static void PreCancelSpecialTriggerAnimations() { LethalHands.Instance?.SquareDown(animate: false); } [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void PostLateUpdate() { if (!((Object)(object)LethalHands.Instance == (Object)null) && LethalHands.Instance.punchingHaltsStaminaRegen && LethalHands.Instance.freezeStaminaRegen) { LethalHands.Instance.playerControllerInstance.sprintMeter = Mathf.Clamp(LethalHands.Instance.playerControllerInstance.sprintMeter, 0f, LethalHands.Instance.recordedStamina); LethalHands.Instance.playerControllerInstance.sprintMeterUI.fillAmount = LethalHands.Instance.playerControllerInstance.sprintMeter; } } [HarmonyPatch("IHittable.Hit")] [HarmonyPrefix] private static bool PreHit(PlayerControllerB __instance, int force, Vector3 hitDirection, PlayerControllerB playerWhoHit) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (force != -22) { return true; } if (!__instance.AllowPlayerDeath()) { return false; } CentipedeAI[] array = Object.FindObjectsByType<CentipedeAI>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].clingingToPlayer == (Object)(object)__instance) { return false; } } if (Object.op_Implicit((Object)(object)__instance.inAnimationWithEnemy)) { return false; } __instance.DamagePlayerFromOtherClientServerRpc(LethalHands.Instance.playerPunchDamage, hitDirection, (int)playerWhoHit.playerClientId); return false; } } [HarmonyPatch(typeof(StartMatchLever))] internal class StartMatchLeverPatch { [HarmonyPatch("LeverAnimation")] [HarmonyPrefix] private static void PreLeverAnimation() { LethalHands.Instance.SquareDown(animate: false); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("StartGame")] [HarmonyPostfix] private static void PostStartGame() { EnemyFloatHealth.Instance.Reset(); } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("BeginUsingTerminal")] [HarmonyPrefix] private static void PreBeginUsingTerminal() { LethalHands.Instance.SquareDown(animate: false); } } [HarmonyPatch(typeof(VehicleController))] internal class VehicleControllerPatch { [HarmonyPatch("TakeControlOfVehicle")] [HarmonyPrefix] private static void PreTakeControlOfVehicle() { LethalHands.Instance.SquareDown(animate: false); } [HarmonyPatch("SetPassengerInCar")] [HarmonyPrefix] private static void PreSetPassengerInCar(PlayerControllerB player) { if ((Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController) { LethalHands.Instance.SquareDown(animate: false); } } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace LethalHands.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }