Please disclose if any significant portion of your mod was created 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 SemiHands v0.1.1
SemiHands.dll
Decompiled 7 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; [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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("NotezyTeam")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1")] [assembly: AssemblyProduct("SemiHands")] [assembly: AssemblyTitle("SemiHands")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SemiHands { public class LocalPlayerHands : MonoBehaviour { [CompilerGenerated] private sealed class <LeftPunchAnimationCoroutine>d__41 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LocalPlayerHands <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LeftPunchAnimationCoroutine>d__41(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0068: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.leftArmAnimationSpeed = 15f; <>4__this.SetLeftArmPose(LeftArmWindUpPose); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.leftArmAnimationSpeed = 25f; <>4__this.SetLeftArmPose(LeftArmPunchPose, PunchLeftArmPos); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.leftArmAnimationSpeed = 15f; <>4__this.SetLeftArmPose(LeftArmCombatPose); 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 <RightPunchAnimationCoroutine>d__42 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LocalPlayerHands <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RightPunchAnimationCoroutine>d__42(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0068: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.rightArmAnimationSpeed = 15f; <>4__this.SetRightArmPose(RightArmWindUpPose); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.rightArmAnimationSpeed = 25f; <>4__this.SetRightArmPose(RightArmPunchPose, PunchRightArmPos); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.rightArmAnimationSpeed = 15f; <>4__this.SetRightArmPose(RightArmCombatPose); 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 static LocalPlayerHands Instance = null; public PlayerFightController FightController = null; public PlayerLocalCamera CameraController = null; public Transform LeftArmTransform = null; public Transform RightArmTransform = null; private Vector3 leftArmPoseTarget = Vector3.zero; private Vector3 rightArmPoseTarget = Vector3.zero; private Vector3 leftArmTargetPos = Vector3.zero; private Vector3 rightArmTargetPos = Vector3.zero; public static Vector3 DefultRightArmPos = new Vector3(0.2f, 0f, -0.1f); public static Vector3 RightArmCombatPose = new Vector3(-11f, 10f, -10f); public static Vector3 RightArmWindUpPose = new Vector3(-10f, 30f, -50f); public static Vector3 RightArmPunchPose = new Vector3(6f, -25f, 66f); public static Vector3 PunchRightArmPos = new Vector3(0.2f, 0f, 0.2f); public static Vector3 DefultLeftArmPos = new Vector3(0f - DefultRightArmPos.x, DefultRightArmPos.y, DefultRightArmPos.z); public static Vector3 LeftArmCombatPose = new Vector3(RightArmCombatPose.x, 0f - RightArmCombatPose.y, 0f - RightArmCombatPose.z); public static Vector3 LeftArmWindUpPose = new Vector3(RightArmWindUpPose.x, 0f - RightArmWindUpPose.y, 0f - RightArmWindUpPose.z); public static Vector3 LeftArmPunchPose = new Vector3(RightArmPunchPose.x, 0f - RightArmPunchPose.y, 0f - RightArmPunchPose.z); public static Vector3 PunchLeftArmPos = new Vector3(0f - PunchRightArmPos.x, PunchRightArmPos.y, PunchRightArmPos.z); private float leftArmAnimationSpeed = 15f; private float rightArmAnimationSpeed = 15f; private float visibilityTarget = 0f; private float visibilityCurrent = 0f; private float visibilityVelocity = 0f; private Vector3 hiddenPosition = new Vector3(0f, -0.5f, -0.5f); private Vector3 visiblePosition = new Vector3(0.006f, -0.184f, 0f); public float visibilitySmoothTime = 0.2f; private float showDelayTimer = 0f; private const float SHOW_DELAY = 0.25f; private float cameraVerticalRotation = 0f; public float verticalRotationInfluence = 0.7f; private void Start() { //IL_0024: 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_0037: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) Instance = this; visibilityCurrent = 0f; visibilityTarget = 0f; ((Component)this).transform.localPosition = hiddenPosition; SetLeftArmPose(LeftArmCombatPose); SetRightArmPose(RightArmCombatPose); CameraController = ((Component)this).GetComponentInParent<PlayerLocalCamera>(); } private void Update() { if ((Object)(object)FightController == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); Debug.LogWarning((object)"LocalPlayerHands: FightController is null, destroying hands object."); return; } UpdateCameraRotationTracking(); UpdateVisibility(); if (FightController.IsInFistsMode) { AnimateLeftArm(); AnimateRightArm(); } } private void UpdateCameraRotationTracking() { //IL_001e: 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_0061: 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) if (!((Object)(object)CameraController == (Object)null)) { float num = ((Component)CameraController).transform.localEulerAngles.x; if (num > 180f) { num -= 360f; } cameraVerticalRotation = num; Quaternion localRotation = Quaternion.Euler((0f - cameraVerticalRotation) * verticalRotationInfluence, 0f, 0f); ((Component)this).transform.localRotation = localRotation; } } private void UpdateVisibility() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_00c9: 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) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_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) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0121: Unknown result type (might be due to invalid IL or missing references) if (!FightController.IsInFistsMode) { visibilityTarget = 0f; showDelayTimer = 0f; } else { showDelayTimer += Time.deltaTime; if ((int)FightController.PlayerAvatar.flashlightController.currentState == 0) { showDelayTimer = 1f; } if (showDelayTimer >= 0.25f) { visibilityTarget = 1f; } else { visibilityTarget = 0f; } } visibilityCurrent = Mathf.SmoothDamp(visibilityCurrent, visibilityTarget, ref visibilityVelocity, visibilitySmoothTime); Vector3 localPosition = ((Component)this).transform.localPosition; Vector3 val = Vector3.Lerp(hiddenPosition, visiblePosition, visibilityCurrent); ((Component)this).transform.localPosition = new Vector3(val.x, val.y, val.z); Vector3 localScale = Vector3.one * visibilityCurrent; ((Component)this).transform.localScale = localScale; } public void SetLeftArmPose(Vector3 newPose, Vector3 targetPos = default(Vector3)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) leftArmPoseTarget = newPose; leftArmTargetPos = targetPos; } public void SetRightArmPose(Vector3 newPose, Vector3 targetPos = default(Vector3)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) rightArmPoseTarget = newPose; rightArmTargetPos = targetPos; } private void AnimateLeftArm() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002e: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_007e: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)LeftArmTransform == (Object)null)) { Quaternion val = Quaternion.Euler(leftArmPoseTarget); LeftArmTransform.localRotation = Quaternion.Slerp(LeftArmTransform.localRotation, val, Time.deltaTime * leftArmAnimationSpeed); if (leftArmTargetPos == Vector3.zero) { leftArmTargetPos = DefultLeftArmPos; } LeftArmTransform.localPosition = Vector3.Lerp(LeftArmTransform.localPosition, leftArmTargetPos, Time.deltaTime * 25f); } } private void AnimateRightArm() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002e: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_007e: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)RightArmTransform == (Object)null)) { Quaternion val = Quaternion.Euler(rightArmPoseTarget); RightArmTransform.localRotation = Quaternion.Slerp(RightArmTransform.localRotation, val, Time.deltaTime * rightArmAnimationSpeed); if (rightArmTargetPos == Vector3.zero) { rightArmTargetPos = DefultRightArmPos; } RightArmTransform.localPosition = Vector3.Lerp(RightArmTransform.localPosition, rightArmTargetPos, Time.deltaTime * 25f); } } public void PlayLeftPunchAnimation() { ((MonoBehaviour)this).StartCoroutine(LeftPunchAnimationCoroutine()); } public void PlayRightPunchAnimation() { ((MonoBehaviour)this).StartCoroutine(RightPunchAnimationCoroutine()); } [IteratorStateMachine(typeof(<LeftPunchAnimationCoroutine>d__41))] private IEnumerator LeftPunchAnimationCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LeftPunchAnimationCoroutine>d__41(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<RightPunchAnimationCoroutine>d__42))] private IEnumerator RightPunchAnimationCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RightPunchAnimationCoroutine>d__42(0) { <>4__this = this }; } } public class PlayerFightController : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass41_0 { public PlayerFightController <>4__this; public float startTime; internal bool <WaitCheckLocal>b__0() { return (Object)(object)<>4__this.photonView != (Object)null || Time.time - startTime > 30f; } } [CompilerGenerated] private sealed class <AnimateLeftArmZPosition>d__56 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerAvatarLeftArm leftArm; public PlayerFightController <>4__this; private float <OriginalLeftArmZPosition>5__1; private float <CurrentLeftArmZPosition>5__2; private float <duration>5__3; private float <startTime>5__4; private float <startTimeB>5__5; private float <t>5__6; private float <t>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateLeftArmZPosition>d__56(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <OriginalLeftArmZPosition>5__1 = leftArm.leftArmTransform.localPosition.z; <CurrentLeftArmZPosition>5__2 = 0.114f; <duration>5__3 = 0.1f; <startTime>5__4 = Time.time; goto IL_00fb; case 1: <>1__state = -1; goto IL_00fb; case 2: { <>1__state = -1; break; } IL_00fb: if (Time.time - <startTime>5__4 < <duration>5__3) { <t>5__6 = (Time.time - <startTime>5__4) / <duration>5__3; leftArm.leftArmTransform.localPosition = new Vector3(leftArm.leftArmTransform.localPosition.x, leftArm.leftArmTransform.localPosition.y, Mathf.Lerp(<OriginalLeftArmZPosition>5__1, <CurrentLeftArmZPosition>5__2, <t>5__6)); <>2__current = null; <>1__state = 1; return true; } <startTimeB>5__5 = Time.time; break; } if (Time.time - <startTimeB>5__5 < <duration>5__3) { <t>5__7 = (Time.time - <startTimeB>5__5) / <duration>5__3; leftArm.leftArmTransform.localPosition = new Vector3(leftArm.leftArmTransform.localPosition.x, leftArm.leftArmTransform.localPosition.y, Mathf.Lerp(<CurrentLeftArmZPosition>5__2, <OriginalLeftArmZPosition>5__1, <t>5__7)); <>2__current = null; <>1__state = 2; return true; } leftArm.leftArmTransform.localPosition = new Vector3(leftArm.leftArmTransform.localPosition.x, leftArm.leftArmTransform.localPosition.y, <OriginalLeftArmZPosition>5__1); <>4__this.LeftArmZPositionCoroutine = null; 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 <AnimateRightArmZPosition>d__54 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerAvatarRightArm rightArm; public PlayerFightController <>4__this; private float <OriginalRightArmZPosition>5__1; private float <CurrentRightArmZPosition>5__2; private float <duration>5__3; private float <startTime>5__4; private float <startTimeB>5__5; private float <t>5__6; private float <t>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateRightArmZPosition>d__54(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <OriginalRightArmZPosition>5__1 = rightArm.rightArmTransform.localPosition.z; <CurrentRightArmZPosition>5__2 = 0.114f; <duration>5__3 = 0.1f; <startTime>5__4 = Time.time; goto IL_00fb; case 1: <>1__state = -1; goto IL_00fb; case 2: { <>1__state = -1; break; } IL_00fb: if (Time.time - <startTime>5__4 < <duration>5__3) { <t>5__6 = (Time.time - <startTime>5__4) / <duration>5__3; rightArm.rightArmTransform.localPosition = new Vector3(rightArm.rightArmTransform.localPosition.x, rightArm.rightArmTransform.localPosition.y, Mathf.Lerp(<OriginalRightArmZPosition>5__1, <CurrentRightArmZPosition>5__2, <t>5__6)); <>2__current = null; <>1__state = 1; return true; } <startTimeB>5__5 = Time.time; break; } if (Time.time - <startTimeB>5__5 < <duration>5__3) { <t>5__7 = (Time.time - <startTimeB>5__5) / <duration>5__3; rightArm.rightArmTransform.localPosition = new Vector3(rightArm.rightArmTransform.localPosition.x, rightArm.rightArmTransform.localPosition.y, Mathf.Lerp(<CurrentRightArmZPosition>5__2, <OriginalRightArmZPosition>5__1, <t>5__7)); <>2__current = null; <>1__state = 2; return true; } rightArm.rightArmTransform.localPosition = new Vector3(rightArm.rightArmTransform.localPosition.x, rightArm.rightArmTransform.localPosition.y, <OriginalRightArmZPosition>5__1); <>4__this.RightArmZPositionCoroutine = null; 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 <LeftArmPunchAnimationCoroutine>d__55 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerFightController <>4__this; private PlayerAvatarLeftArm <leftArm>5__1; private float <OriginalLeftArmZPosition>5__2; private float <StoredDamping>5__3; private float <StoredSpeed>5__4; private float <StoredSpeedB>5__5; private AnimationCurve <StoredCurve>5__6; private AnimationCurve <linearCurve>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LeftArmPunchAnimationCoroutine>d__55(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <leftArm>5__1 = null; <StoredCurve>5__6 = null; <linearCurve>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_030d: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.LeftArmPunching = true; <leftArm>5__1 = ((Component)<>4__this.PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarLeftArm>(); <OriginalLeftArmZPosition>5__2 = <leftArm>5__1.leftArmTransform.localPosition.z; <StoredDamping>5__3 = <leftArm>5__1.poseSpring.damping; <StoredSpeed>5__4 = <leftArm>5__1.poseSpring.speed; <StoredSpeedB>5__5 = <leftArm>5__1.poseSpeed; <StoredCurve>5__6 = <leftArm>5__1.poseCurve; <leftArm>5__1.poseSpring.damping = 1f; <leftArm>5__1.poseSpring.speed = 50f; <leftArm>5__1.poseSpeed = 12f; <linearCurve>5__7 = new AnimationCurve(); <linearCurve>5__7.AddKey(0f, 0f); <linearCurve>5__7.AddKey(1f, 1f); <leftArm>5__1.poseCurve = <linearCurve>5__7; <>4__this.CurLeftArmCombatRotation = SemiHands.LeftArmWindUpPose; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.CurLeftArmCombatRotation = SemiHands.LeftArmPunchPose; if ((Object)(object)<leftArm>5__1 != (Object)null) { if (<>4__this.LeftArmZPositionCoroutine != null) { ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.LeftArmZPositionCoroutine); } <>4__this.LeftArmZPositionCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateLeftArmZPosition(<leftArm>5__1)); } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; if ((Object)(object)<>4__this.LeftArmHurtCollider != (Object)null) { ((Component)<>4__this.LeftArmHurtCollider).gameObject.SetActive(true); } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 3; return true; case 3: <>1__state = -1; if ((Object)(object)<>4__this.LeftArmHurtCollider != (Object)null) { ((Component)<>4__this.LeftArmHurtCollider).gameObject.SetActive(false); } <>4__this.CurLeftArmCombatRotation = SemiHands.LeftArmCombatPose; if (<>4__this.LeftArmZPositionCoroutine != null) { ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.LeftArmZPositionCoroutine); <>4__this.LeftArmZPositionCoroutine = null; if ((Object)(object)<leftArm>5__1 != (Object)null) { <leftArm>5__1.leftArmTransform.localPosition = new Vector3(<leftArm>5__1.leftArmTransform.localPosition.x, <leftArm>5__1.leftArmTransform.localPosition.y, <OriginalLeftArmZPosition>5__2); } } <>4__this.LeftArmPunching = false; if ((Object)(object)<leftArm>5__1 != (Object)null) { <leftArm>5__1.poseSpring.damping = <StoredDamping>5__3; <leftArm>5__1.poseSpring.speed = <StoredSpeed>5__4; <leftArm>5__1.poseCurve = <StoredCurve>5__6; <leftArm>5__1.poseSpeed = <StoredSpeedB>5__5; } <>4__this.PunchLAnimationCoroutine = null; 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 <RightArmPunchAnimationCoroutine>d__53 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerFightController <>4__this; private PlayerAvatarRightArm <rightArm>5__1; private float <OriginalRightArmZPosition>5__2; private float <StoredDamping>5__3; private float <StoredSpeed>5__4; private float <StoredSpeedB>5__5; private AnimationCurve <StoredCurve>5__6; private AnimationCurve <linearCurve>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RightArmPunchAnimationCoroutine>d__53(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rightArm>5__1 = null; <StoredCurve>5__6 = null; <linearCurve>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_030d: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.RightArmPunching = true; <rightArm>5__1 = ((Component)<>4__this.PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarRightArm>(); <OriginalRightArmZPosition>5__2 = <rightArm>5__1.rightArmTransform.localPosition.z; <StoredDamping>5__3 = <rightArm>5__1.grabberSteerSpring.damping; <StoredSpeed>5__4 = <rightArm>5__1.grabberSteerSpring.speed; <StoredSpeedB>5__5 = <rightArm>5__1.poseSpeed; <StoredCurve>5__6 = <rightArm>5__1.poseCurve; <rightArm>5__1.grabberSteerSpring.damping = 1f; <rightArm>5__1.grabberSteerSpring.speed = 50f; <rightArm>5__1.poseSpeed = 12f; <linearCurve>5__7 = new AnimationCurve(); <linearCurve>5__7.AddKey(0f, 0f); <linearCurve>5__7.AddKey(1f, 1f); <rightArm>5__1.poseCurve = <linearCurve>5__7; <>4__this.CurRightArmCombatRotation = SemiHands.RightArmWindUpPose; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.CurRightArmCombatRotation = SemiHands.RightArmPunchPose; if ((Object)(object)<rightArm>5__1 != (Object)null) { if (<>4__this.RightArmZPositionCoroutine != null) { ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.RightArmZPositionCoroutine); } <>4__this.RightArmZPositionCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateRightArmZPosition(<rightArm>5__1)); } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; if ((Object)(object)<>4__this.RightArmHurtCollider != (Object)null) { ((Component)<>4__this.RightArmHurtCollider).gameObject.SetActive(true); } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 3; return true; case 3: <>1__state = -1; if ((Object)(object)<>4__this.RightArmHurtCollider != (Object)null) { ((Component)<>4__this.RightArmHurtCollider).gameObject.SetActive(false); } <>4__this.CurRightArmCombatRotation = SemiHands.RightArmCombatPose; if (<>4__this.RightArmZPositionCoroutine != null) { ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.RightArmZPositionCoroutine); <>4__this.RightArmZPositionCoroutine = null; if ((Object)(object)<rightArm>5__1 != (Object)null) { <rightArm>5__1.rightArmTransform.localPosition = new Vector3(<rightArm>5__1.rightArmTransform.localPosition.x, <rightArm>5__1.rightArmTransform.localPosition.y, <OriginalRightArmZPosition>5__2); } } <>4__this.RightArmPunching = false; if ((Object)(object)<rightArm>5__1 != (Object)null) { <rightArm>5__1.grabberSteerSpring.damping = <StoredDamping>5__3; <rightArm>5__1.grabberSteerSpring.speed = <StoredSpeed>5__4; <rightArm>5__1.poseCurve = <StoredCurve>5__6; <rightArm>5__1.poseSpeed = <StoredSpeedB>5__5; } <>4__this.PunchRAnimationCoroutine = null; 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 <WaitCheckLocal>d__41 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerFightController <>4__this; private <>c__DisplayClass41_0 <>8__1; private Exception <e>5__2; private Exception <e>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitCheckLocal>d__41(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <e>5__2 = null; <e>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass41_0(); <>8__1.<>4__this = <>4__this; <>8__1.startTime = Time.time; <>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>8__1.<>4__this.photonView != (Object)null || Time.time - <>8__1.startTime > 30f)); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this.photonView == (Object)null) { <>4__this.CheckLocalCoroutine = null; return false; } try { if (SemiFunc.IsMultiplayer()) { <>4__this.SetUpHurtColliders(); } } catch (Exception ex) { <e>5__2 = ex; SemiHands.Logger.LogError((object)$"Error setting up HurtColliders: {<e>5__2}"); } if (<>4__this.isLocal && (Object)(object)<>4__this.hands == (Object)null) { try { <>4__this.SetUpLocalHands(); if (!SemiFunc.IsMultiplayer()) { <>4__this.SetUpHurtColliders(); } } catch (Exception ex) { <e>5__3 = ex; SemiHands.Logger.LogError((object)$"Error setting up LocalPlayerHands: {<e>5__3}"); } } <>4__this.CheckLocalCoroutine = null; 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 PhotonView photonView = null; public PlayerAvatar PlayerAvatar = null; public LocalPlayerHands hands = null; public float PunchLeftCooldown; public float PunchRightCooldown = 0f; public float CooldownSpeed = 1f; public float CooldownDuration = 0.5f; private Coroutine CheckLocalCoroutine = null; public bool AutoPunchEnabled = false; private bool lastPunchWasLeft = false; public Vector3 CurRightArmCombatRotation = Vector3.zero; public Vector3 CurLeftArmCombatRotation = Vector3.zero; public bool LeftArmPunching = false; public bool RightArmPunching = false; public Vector3 LeftArmAnimVelocity = Vector3.zero; public Vector3 RightArmAnimVelocity = Vector3.zero; private Coroutine LeftArmZPositionCoroutine = null; private Coroutine RightArmZPositionCoroutine = null; private Coroutine PunchLAnimationCoroutine = null; private Coroutine PunchRAnimationCoroutine = null; public HurtCollider LeftArmHurtCollider = null; public HurtCollider RightArmHurtCollider = null; private float autoDropCheckTimer = 0f; public static PlayerFightController Instance { get; private set; } public bool IsInFistsMode { get; set; } = false; private bool isLocal => GameManager.instance.gameMode == 0 || (Object)(object)photonView == (Object)null || photonView.IsMine; public int EnemyPunchDamage => Mathf.RoundToInt((float)SemiHands.EnemyPunchDamage.Value * GetStrengthMultiplier()); public int PlayerPunchDamage => Mathf.RoundToInt((float)SemiHands.PlayerPunchDamage.Value * GetStrengthMultiplier()); public void Start() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //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_002a: Unknown result type (might be due to invalid IL or missing references) photonView = ((Component)this).GetComponent<PhotonView>(); PlayerAvatar = ((Component)this).GetComponent<PlayerAvatar>(); CurLeftArmCombatRotation = SemiHands.LeftArmCombatPose; CurRightArmCombatRotation = SemiHands.RightArmCombatPose; if (!SemiFunc.IsMultiplayer() || isLocal) { Instance = this; } if (isLocal && SemiFunc.IsMasterClientOrSingleplayer()) { ServerConfig.SyncAllServerConfigs(); } } public void OnEnable() { if ((Object)(object)SemiHands.Instance != (Object)null) { SemiHands.Instance.FightControllers[((Component)this).GetComponent<PlayerAvatar>()] = this; } if (CheckLocalCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(CheckLocalCoroutine); } CheckLocalCoroutine = ((MonoBehaviour)this).StartCoroutine(WaitCheckLocal()); } public void OnDisable() { if ((Object)(object)SemiHands.Instance != (Object)null) { SemiHands.Instance.FightControllers.Remove(((Component)this).GetComponent<PlayerAvatar>()); } if (CheckLocalCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(CheckLocalCoroutine); } if (isLocal && (Object)(object)hands != (Object)null) { Object.Destroy((Object)(object)((Component)hands).gameObject); hands = null; SemiHands.Logger.LogDebug((object)"LocalPlayerHands object destroyed on disabling FightController."); } if ((Object)(object)LeftArmHurtCollider != (Object)null) { Object.Destroy((Object)(object)((Component)LeftArmHurtCollider).gameObject); LeftArmHurtCollider = null; SemiHands.Logger.LogDebug((object)"LeftArmHurtCollider destroyed on disabling FightController."); } if ((Object)(object)RightArmHurtCollider != (Object)null) { Object.Destroy((Object)(object)((Component)RightArmHurtCollider).gameObject); RightArmHurtCollider = null; SemiHands.Logger.LogDebug((object)"RightArmHurtCollider destroyed on disabling FightController."); } } public void Update() { //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_0108: 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_0138: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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) if ((Object)(object)LeftArmHurtCollider != (Object)null && (Object)(object)RightArmHurtCollider != (Object)null) { RightArmHurtCollider.enemyDamage = EnemyPunchDamage; LeftArmHurtCollider.enemyDamage = EnemyPunchDamage; RightArmHurtCollider.playerDamage = PlayerPunchDamage; LeftArmHurtCollider.playerDamage = PlayerPunchDamage; RightArmHurtCollider.ignoreLocalPlayer = isLocal; LeftArmHurtCollider.ignoreLocalPlayer = isLocal; } if ((Object)(object)PlayerAvatar != (Object)null && (Object)(object)LeftArmHurtCollider != (Object)null && (Object)(object)RightArmHurtCollider != (Object)null) { if (PlayerAvatar.isCrouching && !PlayerAvatar.isCrawling) { Vector3 position = ((Component)RightArmHurtCollider).transform.position; position.y = 0.6f; ((Component)RightArmHurtCollider).transform.position = position; Vector3 position2 = ((Component)LeftArmHurtCollider).transform.position; position2.y = 0.6f; ((Component)LeftArmHurtCollider).transform.position = position2; } else if (PlayerAvatar.isCrawling) { Vector3 position3 = ((Component)RightArmHurtCollider).transform.position; position3.y = 0.25f; ((Component)RightArmHurtCollider).transform.position = position3; Vector3 position4 = ((Component)LeftArmHurtCollider).transform.position; position4.y = 0.25f; ((Component)LeftArmHurtCollider).transform.position = position4; } else { Vector3 position5 = ((Component)RightArmHurtCollider).transform.position; position5.y = 1.226f; ((Component)RightArmHurtCollider).transform.position = position5; Vector3 position6 = ((Component)LeftArmHurtCollider).transform.position; position6.y = 1.226f; ((Component)LeftArmHurtCollider).transform.position = position6; } } if (!isLocal) { return; } CheckFistModeInput(); if (IsInFistsMode) { CheckLeftPunchInput(); CheckRightPunchInput(); PlayerAvatar.physGrabber.grabDisableTimer = 0.1f; if (AutoPunchEnabled) { AutoPunch(); } if (autoDropCheckTimer >= 0.25f) { if (PlayerAvatar.physGrabber.grabbed) { PlayerAvatar.physGrabber.ReleaseObject(-1, 0.1f); SemiHands.Logger.LogDebug((object)"Auto-releasing grabbed object due to fists mode."); } } else { autoDropCheckTimer += Time.deltaTime; } if (PlayerAvatar.isTumbling) { SwitchFistModes(mode: false); } } PunchLeftCooldown = Mathf.Max(0f, PunchLeftCooldown - Time.deltaTime * CooldownSpeed); PunchRightCooldown = Mathf.Max(0f, PunchRightCooldown - Time.deltaTime * CooldownSpeed); } [IteratorStateMachine(typeof(<WaitCheckLocal>d__41))] private IEnumerator WaitCheckLocal() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitCheckLocal>d__41(0) { <>4__this = this }; } public void SetUpLocalHands() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) PlayerAvatarLeftArm componentInChildren = ((Component)PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarLeftArm>(); PlayerAvatarRightArm componentInChildren2 = ((Component)PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarRightArm>(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren2 != (Object)null) { GameObject val = new GameObject("LocalPlayerHands"); val.transform.SetParent(((Component)PlayerAvatar.localCamera).transform); val.transform.localPosition = new Vector3(0.006f, -0.184f, 0.28f); val.transform.localEulerAngles = new Vector3(0f, 0f, 0f); GameObject val2 = Object.Instantiate<GameObject>(((Component)componentInChildren.leftArmTransform).gameObject, val.transform); val2.transform.localPosition = new Vector3(-0.3039f, 0f, -0.054f); val2.transform.localEulerAngles = new Vector3(0.04f, 349.9f, 359.97f); GameObject val3 = Object.Instantiate<GameObject>(((Component)componentInChildren2.rightArmTransform).gameObject, val.transform); val3.transform.localPosition = new Vector3(0.3039f, 0f, -0.054f); val3.transform.localEulerAngles = new Vector3(0.04f, 10.03f, 359.97f); Collider[] componentsInChildren = val2.GetComponentsInChildren<Collider>(); foreach (Collider val4 in componentsInChildren) { Object.Destroy((Object)(object)val4); } Collider[] componentsInChildren2 = val3.GetComponentsInChildren<Collider>(); foreach (Collider val5 in componentsInChildren2) { Object.Destroy((Object)(object)val5); } MeshRenderer[] componentsInChildren3 = val2.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val6 in componentsInChildren3) { ((Renderer)val6).shadowCastingMode = (ShadowCastingMode)0; } MeshRenderer[] componentsInChildren4 = val3.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val7 in componentsInChildren4) { ((Renderer)val7).shadowCastingMode = (ShadowCastingMode)0; } hands = val.AddComponent<LocalPlayerHands>(); hands.FightController = this; hands.LeftArmTransform = val2.transform; hands.RightArmTransform = val3.transform; SemiHands.Logger.LogDebug((object)"LocalPlayerHands set up for local player."); } else { SemiHands.Logger.LogWarning((object)"Could not find PlayerAvatar arms to link LocalPlayerHands."); } } public void SetUpHurtColliders() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0180: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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) PlayerAvatarLeftArm componentInChildren = ((Component)PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarLeftArm>(); PlayerAvatarRightArm componentInChildren2 = ((Component)PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarRightArm>(); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren2 == (Object)null) { SemiHands.Logger.LogWarning((object)"Could not find PlayerAvatar arm components to link HurtColliders."); return; } Transform val = (Transform)((!SemiFunc.IsMultiplayer()) ? ((object)hands.LeftArmTransform) : ((object)componentInChildren.leftArmTransform)); Transform val2 = (Transform)((!SemiFunc.IsMultiplayer()) ? ((object)hands.RightArmTransform) : ((object)componentInChildren2.rightArmTransform)); val = ((Component)PlayerAvatar).transform; val2 = ((Component)PlayerAvatar).transform; Vector3 size = default(Vector3); ((Vector3)(ref size))..ctor(0.5f, 1f, 0.5f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0f, 1.226f, 0.626f); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { GameObject val4 = new GameObject("LeftArmHurtCollider"); val4.transform.SetParent(val); val4.transform.localPosition = new Vector3(0f - val3.x, val3.y, val3.z); val4.transform.localEulerAngles = Vector3.zero; BoxCollider val5 = val4.AddComponent<BoxCollider>(); val5.size = size; ((Collider)val5).isTrigger = true; LeftArmHurtCollider = val4.AddComponent<HurtCollider>(); SetUpHurtColider(LeftArmHurtCollider); GameObject val6 = new GameObject("RightArmHurtCollider"); val6.transform.SetParent(val2); val6.transform.localPosition = val3; val6.transform.localEulerAngles = Vector3.zero; BoxCollider val7 = val6.AddComponent<BoxCollider>(); val7.size = size; ((Collider)val7).isTrigger = true; RightArmHurtCollider = val6.AddComponent<HurtCollider>(); SetUpHurtColider(RightArmHurtCollider); SemiHands.Logger.LogDebug((object)("HurtColliders set up for " + (isLocal ? "local player" : ("player " + photonView.Owner.NickName)))); } else { SemiHands.Logger.LogWarning((object)"Could not find PlayerAvatar arms to link HurtColliders."); } void SetUpHurtColider(HurtCollider collider) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown collider.playerLogic = true; collider.playerKill = false; collider.playerDamage = PlayerPunchDamage; collider.playerDamageCooldown = 999f; collider.playerHitForce = 5f; collider.playerRayCast = true; collider.physLogic = true; collider.physDestroy = false; collider.physHingeDestroy = false; collider.physHingeBreak = EnemyPunchDamage > 25; collider.physDamageCooldown = 999f; collider.physHitForce = 1f; collider.physHitTorque = 1f; collider.physRayCast = true; collider.enemyKill = false; collider.enemyStun = false; collider.enemyStunTime = 1f; collider.enemyDamage = EnemyPunchDamage; collider.enemyDamageCooldown = 999f; collider.hitSpread = 30f; ((Component)collider).gameObject.SetActive(false); collider.onImpactAny = new UnityEvent(); collider.onImpactEnemy = new UnityEvent(); collider.onImpactPhysObject = new UnityEvent(); collider.onImpactPlayer = new UnityEvent(); collider.onImpactAny.AddListener(new UnityAction(OnPunchHit)); } } public void CheckFistModeInput() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(SemiHands.FistsModeKey.Value)) { SwitchFistModes(!IsInFistsMode); } } public void SwitchFistModes(bool mode) { IsInFistsMode = mode; SemiHands.Logger.LogInfo((object)("Fists mode toggled: " + (IsInFistsMode ? "ON" : "OFF"))); if (SemiFunc.IsMultiplayer()) { photonView.RPC("SwitchFistModesRpc", (RpcTarget)1, new object[1] { IsInFistsMode }); } } [PunRPC] public void SwitchFistModesRpc(bool mode) { IsInFistsMode = mode; SemiHands.Logger.LogInfo((object)("[" + photonView.Owner.NickName + " RPC] Fists mode toggled: " + (IsInFistsMode ? "ON" : "OFF"))); } public void CheckLeftPunchInput() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyUp(SemiHands.PunchLeftArmKey.Value) || !CanLeftArmPunch() || !(PunchLeftCooldown <= 0f)) { return; } if (PunchLAnimationCoroutine != null) { SemiHands.Logger.LogWarning((object)"Left arm punch attempted while previous punch animation still playing."); return; } PunchLeftCooldown = CooldownDuration; if (SemiFunc.IsMultiplayer()) { photonView.RPC("PunchLeftRpc", (RpcTarget)0, Array.Empty<object>()); } else { PunchLeftRpc(); } } public void CheckRightPunchInput() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyUp(SemiHands.PunchRightArmKey.Value) || !CanRightArmPunch() || !(PunchRightCooldown <= 0f)) { return; } if (PunchRAnimationCoroutine != null) { SemiHands.Logger.LogWarning((object)"Right arm punch attempted while previous punch animation still playing."); return; } PunchRightCooldown = CooldownDuration; if (SemiFunc.IsMultiplayer()) { photonView.RPC("PunchRightRpc", (RpcTarget)0, Array.Empty<object>()); } else { PunchRightRpc(); } } [PunRPC] public void PunchRightRpc() { if (isLocal && (Object)(object)hands != (Object)null) { hands.PlayRightPunchAnimation(); } PunchRAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(RightArmPunchAnimationCoroutine()); } [PunRPC] public void PunchLeftRpc() { if (isLocal && (Object)(object)hands != (Object)null) { hands.PlayLeftPunchAnimation(); } PunchLAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(LeftArmPunchAnimationCoroutine()); } public void CheckAutoPunchToggle() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(SemiHands.AutoPunchKey.Value)) { AutoPunchEnabled = !AutoPunchEnabled; SemiHands.Logger.LogInfo((object)("Auto-punch toggled: " + (AutoPunchEnabled ? "ON" : "OFF") + " (Alternating punches for max DPS)")); } } public void AutoPunch() { if (!lastPunchWasLeft && CanLeftArmPunch() && PunchLeftCooldown <= 0f) { PunchLeftCooldown = CooldownDuration; if (SemiFunc.IsMultiplayer()) { photonView.RPC("PunchLeftRpc", (RpcTarget)0, Array.Empty<object>()); } else { PunchLeftRpc(); } lastPunchWasLeft = true; } else if (lastPunchWasLeft && CanRightArmPunch() && PunchRightCooldown <= 0f) { PunchRightCooldown = CooldownDuration; if (SemiFunc.IsMultiplayer()) { photonView.RPC("PunchRightRpc", (RpcTarget)0, Array.Empty<object>()); } else { PunchRightRpc(); } lastPunchWasLeft = false; } } [IteratorStateMachine(typeof(<RightArmPunchAnimationCoroutine>d__53))] private IEnumerator RightArmPunchAnimationCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RightArmPunchAnimationCoroutine>d__53(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<AnimateRightArmZPosition>d__54))] private IEnumerator AnimateRightArmZPosition(PlayerAvatarRightArm rightArm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateRightArmZPosition>d__54(0) { <>4__this = this, rightArm = rightArm }; } [IteratorStateMachine(typeof(<LeftArmPunchAnimationCoroutine>d__55))] private IEnumerator LeftArmPunchAnimationCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LeftArmPunchAnimationCoroutine>d__55(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<AnimateLeftArmZPosition>d__56))] private IEnumerator AnimateLeftArmZPosition(PlayerAvatarLeftArm leftArm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateLeftArmZPosition>d__56(0) { <>4__this = this, leftArm = leftArm }; } public void OnPunchHit() { if (LeftArmPunching && RightArmPunching && isLocal) { SemiFunc.CameraShake(1.5f, 0.25f); SemiHands.Logger.LogInfo((object)"Punch hit registered."); } } public bool CanRightArmPunch() { return (Object)(object)PlayerAvatar != (Object)null && !PlayerAvatar.isTumbling && IsInFistsMode; } public bool CanLeftArmPunch() { return (Object)(object)PlayerAvatar != (Object)null && !PlayerAvatar.isTumbling && IsInFistsMode; } public float GetStrengthMultiplier() { if ((Object)(object)PlayerAvatar == (Object)null || (Object)(object)PlayerAvatar.physGrabber == (Object)null) { return 1f; } float grabStrength = PlayerAvatar.physGrabber.grabStrength; float value = SemiHands.StrengthUpgradeMultiplier.Value; return 1f + (grabStrength - 1f) * value; } [ContextMenu("Copy L arm rotation")] public void CopyLeftArmRotation() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) PlayerAvatarLeftArm componentInChildren = ((Component)PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarLeftArm>(); string text = $"new Vector3({componentInChildren.leftArmTransform.localEulerAngles.x}f, {componentInChildren.leftArmTransform.localEulerAngles.y}f, {componentInChildren.leftArmTransform.localEulerAngles.z}f)"; SemiHands.Logger.LogInfo((object)(text + ";")); GUIUtility.systemCopyBuffer = text; } [ContextMenu("Copy R arm rotation")] public void CopyRightArmRotation() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) PlayerAvatarRightArm componentInChildren = ((Component)PlayerAvatar.playerAvatarVisuals).GetComponentInChildren<PlayerAvatarRightArm>(); string text = $"new Vector3({componentInChildren.rightArmTransform.localEulerAngles.x}f, {componentInChildren.rightArmTransform.localEulerAngles.y}f, {componentInChildren.rightArmTransform.localEulerAngles.z}f)"; SemiHands.Logger.LogInfo((object)(text + ";")); GUIUtility.systemCopyBuffer = text; } [PunRPC] public void SyncServerConfigsRpc(byte[] data, PhotonMessageInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && !info.Sender.IsMasterClient) { SemiHands.Logger.LogError((object)("SyncServerConfigsRpc can only be called by the host/server. Was instead called by " + info.Sender.NickName)); } else { ServerConfig.ReceiveConfigSync(data); } } } [BepInPlugin("NoteBoxz.SemiHands", "SemiHands", "0.1.1")] public class SemiHands : BaseUnityPlugin { public Dictionary<PlayerAvatar, PlayerFightController> FightControllers = new Dictionary<PlayerAvatar, PlayerFightController>(); public static Vector3 LeftArmCombatPose = new Vector3(0f, 25f, 0f); public static Vector3 LeftArmWindUpPose = new Vector3(-90f, 25f, 0f); public static Vector3 LeftArmPunchPose = new Vector3(20f, 2.5f, 0f); public static Vector3 RightArmCombatPose = new Vector3(LeftArmCombatPose.x, 0f - LeftArmCombatPose.y, LeftArmCombatPose.z); public static Vector3 RightArmWindUpPose = new Vector3(LeftArmWindUpPose.x, 0f - LeftArmWindUpPose.y, LeftArmWindUpPose.z); public static Vector3 RightArmPunchPose = new Vector3(LeftArmPunchPose.x, 0f - LeftArmPunchPose.y, LeftArmPunchPose.z); internal static SemiHands Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } public static ConfigEntry<KeyCode> FistsModeKey { get; private set; } = null; public static ConfigEntry<KeyCode> PunchLeftArmKey { get; private set; } = null; public static ConfigEntry<KeyCode> PunchRightArmKey { get; private set; } = null; public static ServerConfigEntry<int> EnemyPunchDamage { get; private set; } = null; public static ServerConfigEntry<int> PlayerPunchDamage { get; private set; } = null; public static ServerConfigEntry<float> StrengthUpgradeMultiplier { get; private set; } = null; public static ConfigEntry<KeyCode> AutoPunchKey { get; private set; } = null; private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); BindConfigs(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } private void Start() { PlayerAvatar[] array = Resources.FindObjectsOfTypeAll<PlayerAvatar>(); Logger.LogInfo((object)$"Found {array.Length} PlayerAvatar instances in resources"); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)((Component)val).gameObject.GetComponent<PlayerFightController>() == (Object)null) { ((Component)val).gameObject.AddComponent<PlayerFightController>(); Logger.LogDebug((object)("Added PlayerFightController to " + ((Object)val).name)); } } } internal void BindConfigs() { FistsModeKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Fight Key", (KeyCode)106, "Key to switch to fighting mode."); PunchLeftArmKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Punch Left Arm Key", (KeyCode)323, "Key to punch with the left arm."); PunchRightArmKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Punch Right Arm Key", (KeyCode)324, "Key to punch with the right arm."); EnemyPunchDamage = new ServerConfigEntry<int>(((BaseUnityPlugin)this).Config.Bind<int>("Host Only", "Enemy Punch Damage", 5, "Base damage dealt to enemies per punch.")); PlayerPunchDamage = new ServerConfigEntry<int>(((BaseUnityPlugin)this).Config.Bind<int>("Host Only", "Player Punch Damage", 1, "Base damage dealt to other players per punch.")); StrengthUpgradeMultiplier = new ServerConfigEntry<float>(((BaseUnityPlugin)this).Config.Bind<float>("Host Only", "Strength Upgrade Multiplier", 1.5f, "Damage increase per strength level. Formula: BaseDamage + (StrengthLevel - 1) * Multiplier. Example: With 1.5 multiplier, level 2 adds +2 damage, level 3 adds +3 damage.")); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } public static class ServerConfig { private static readonly List<IServerConfigEntry> _registeredEntries = new List<IServerConfigEntry>(); private static bool _initialized = false; public static string RpcToCall => "SyncServerConfigsRpc"; public static PhotonView SyncingView => PlayerFightController.Instance.photonView; public static ManualLogSource Logger => SemiHands.Logger; internal static void RegisterEntry<T>(ServerConfigEntry<T> entry) { _registeredEntries.Add(entry); Logger.LogDebug((object)("Registered server config entry: " + ((ConfigEntryBase)entry.ConfigEntry).Definition.Key)); } public static void Initialize() { if (!_initialized) { _initialized = true; } } public static void OnServerConfigChanged() { SyncAllServerConfigs(); } public static void SyncAllServerConfigs() { if ((Object)(object)SyncingView != (Object)null && SemiFunc.IsMasterClientOrSingleplayer()) { if (SemiFunc.IsMultiplayer()) { object[] array = _registeredEntries.Select((IServerConfigEntry e) => e.GetSerializedValue()).ToArray(); byte[] array2 = SerializeConfigValues(array); SyncingView.RPC(RpcToCall, (RpcTarget)3, new object[1] { array2 }); Logger.LogDebug((object)$"Synced {array.Length} server config entries to all clients."); } } else { if ((Object)(object)SyncingView == (Object)null) { Logger.LogWarning((object)"Cannot sync server configs: SyncingView is null."); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Logger.LogWarning((object)"Cannot sync server configs: Not the master client."); } } } public static void UpdateCachedValues(object[] values) { if (values.Length != _registeredEntries.Count) { Logger.LogWarning((object)$"Received {values.Length} config values but have {_registeredEntries.Count} registered entries. Sync may be incomplete."); return; } for (int i = 0; i < _registeredEntries.Count; i++) { object serializedValue = _registeredEntries[i].GetSerializedValue(); _registeredEntries[i].SetFromSerialized(values[i]); object serializedValue2 = _registeredEntries[i].GetSerializedValue(); Logger.LogDebug((object)$"Updated config entry {i}: {serializedValue} -> {serializedValue2}"); } Logger.LogDebug((object)$"Updated {values.Length} server config values from RPC."); } public static void ReceiveConfigSync(byte[] data) { object[] values = DeserializeConfigValues(data); UpdateCachedValues(values); } private static byte[] SerializeConfigValues(object[] values) { using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(values.Length); foreach (object obj in values) { if (obj is int value) { binaryWriter.Write((byte)0); binaryWriter.Write(value); } else if (obj is float value2) { binaryWriter.Write((byte)1); binaryWriter.Write(value2); } else if (obj is bool value3) { binaryWriter.Write((byte)2); binaryWriter.Write(value3); } else if (obj is string text) { binaryWriter.Write((byte)3); binaryWriter.Write(text ?? ""); } else { Logger.LogWarning((object)("Unsupported config type: " + (obj?.GetType().Name ?? "null"))); } } return memoryStream.ToArray(); } private static object[] DeserializeConfigValues(byte[] data) { List<object> list = new List<object>(); using (MemoryStream input = new MemoryStream(data)) { using BinaryReader binaryReader = new BinaryReader(input); int num = binaryReader.ReadInt32(); for (int i = 0; i < num; i++) { byte b = binaryReader.ReadByte(); switch (b) { case 0: list.Add(binaryReader.ReadInt32()); break; case 1: list.Add(binaryReader.ReadSingle()); break; case 2: list.Add(binaryReader.ReadBoolean()); break; case 3: list.Add(binaryReader.ReadString()); break; default: Logger.LogWarning((object)$"Unknown type marker: {b}"); break; } } } return list.ToArray(); } } internal interface IServerConfigEntry { object GetSerializedValue(); void SetFromSerialized(object value); } public class ServerConfigEntry<T> : IServerConfigEntry { private readonly ConfigEntry<T> _configEntry; private T _cachedValue; public T Value { get { return _cachedValue; } set { _cachedValue = value; if (_configEntry != null && SemiFunc.IsMasterClientOrSingleplayer()) { _configEntry.Value = value; } } } public ConfigEntry<T> ConfigEntry => _configEntry; public ServerConfigEntry(ConfigEntry<T> configEntry) { _configEntry = configEntry; _cachedValue = configEntry.Value; ServerConfig.RegisterEntry(this); _configEntry.SettingChanged += delegate { if (SemiFunc.IsMasterClientOrSingleplayer()) { _cachedValue = _configEntry.Value; ServerConfig.OnServerConfigChanged(); } }; } internal void UpdateCachedValue(T value) { _cachedValue = value; } public object GetSerializedValue() { return _cachedValue; } public void SetFromSerialized(object value) { if (value is T) { T value2 = (T)value; if (true) { UpdateCachedValue(value2); } } } } } namespace SemiHands.Patches { [HarmonyPatch(typeof(FlashlightController), "Idle")] public class FlashlightController_IdleTranspiler { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo fieldInfo = AccessTools.Field(AccessTools.TypeByName("PlayerAvatar"), "isTumbling"); FieldInfo fieldInfo2 = AccessTools.Field(AccessTools.TypeByName("PlayerAvatar"), "isSliding"); if (fieldInfo == null) { SemiHands.Logger.LogError((object)"SemiHands: Could not find PlayerAvatar.isTumbling field"); return list; } if (fieldInfo2 == null) { SemiHands.Logger.LogError((object)"SemiHands: Could not find PlayerAvatar.isSliding field"); return list; } Label? label = default(Label?); for (int i = 0; i < list.Count - 1; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false) && CodeInstructionExtensions.Branches(list[i + 1], ref label)) { List<CodeInstruction> list2 = new List<CodeInstruction>(); list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list2.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(FlashlightController_UpdateTranspiler), "Check", (Type[])null, (Type[])null))); list2.Add(new CodeInstruction(OpCodes.Or, (object)null)); List<CodeInstruction> collection = list2; list.InsertRange(i + 1, collection); SemiHands.Logger.LogInfo((object)"SemiHands: Patched FlashlightController.Idle to include fists mode check"); break; } } return list; } } [HarmonyPatch(typeof(FlashlightController), "Update")] public class FlashlightController_UpdateTranspiler { public static bool Check(FlashlightController __instance) { PlayerFightController value; return SemiHands.Instance.FightControllers.TryGetValue(__instance.PlayerAvatar, out value) && value.IsInFistsMode; } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo fieldInfo = AccessTools.Field(AccessTools.TypeByName("PlayerAvatar"), "isTumbling"); FieldInfo fieldInfo2 = AccessTools.Field(AccessTools.TypeByName("PlayerAvatar"), "isSliding"); if (fieldInfo == null) { SemiHands.Logger.LogError((object)"SemiHands: Could not find PlayerAvatar.isTumbling field"); return list; } if (fieldInfo2 == null) { SemiHands.Logger.LogError((object)"SemiHands: Could not find PlayerAvatar.isSliding field"); return list; } int num = 0; Label? label = default(Label?); for (int i = 0; i < list.Count - 1; i++) { bool flag = CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false); bool flag2 = CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false); if ((flag || flag2) && CodeInstructionExtensions.Branches(list[i + 1], ref label)) { List<CodeInstruction> list2 = new List<CodeInstruction>(); list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list2.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(FlashlightController_UpdateTranspiler), "Check", (Type[])null, (Type[])null))); list2.Add(new CodeInstruction(OpCodes.Or, (object)null)); List<CodeInstruction> list3 = list2; list.InsertRange(i + 1, list3); num++; SemiHands.Logger.LogInfo((object)string.Format("SemiHands: Patched {0} if statement in FlashlightController.Update (patch #{1})", flag2 ? "inner" : "outer", num)); i += list3.Count; } } if (num > 0) { SemiHands.Logger.LogInfo((object)$"SemiHands: Successfully applied {num} patches to FlashlightController.Update"); } else { SemiHands.Logger.LogWarning((object)"SemiHands: No patches were applied to FlashlightController.Update"); } return list; } } [HarmonyPatch(typeof(PlayerAvatarLeftArm), "Update")] public class PlayerAvatarLeftArm_UpdateTranspiler { public static bool CheckL(PlayerAvatar avatar) { PlayerFightController value; return SemiHands.Instance.FightControllers.TryGetValue(avatar, out value) && value.CanLeftArmPunch(); } public static void HandleCombatPose(PlayerAvatarLeftArm __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Vector3 pose = SemiHands.LeftArmCombatPose; if (SemiHands.Instance.FightControllers.TryGetValue(__instance.playerAvatar, out PlayerFightController value)) { pose = value.CurLeftArmCombatRotation; } else { SemiHands.Logger.LogWarning((object)"HandleCombatPose: No FightController found for PlayerAvatar"); } __instance.SetPose(pose); __instance.HeadAnimate(false); __instance.AnimatePose(); } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerAvatarLeftArm_UpdateTranspiler), "CheckL", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(PlayerAvatarLeftArm_UpdateTranspiler), "HandleCombatPose", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(PlayerAvatarLeftArm), "SetPose", (Type[])null, (Type[])null); MethodInfo methodInfo4 = AccessTools.Method(typeof(PlayerAvatarLeftArm), "AnimatePose", (Type[])null, (Type[])null); int num = -1; int num2 = -1; for (int num3 = list.Count - 1; num3 >= 0; num3--) { if (list[num3].opcode == OpCodes.Call && list[num3].operand is MethodInfo methodInfo5) { if (methodInfo5 == methodInfo3 && num == -1) { num = num3; } else if (methodInfo5 == methodInfo4 && num != -1 && num2 == -1) { num2 = num3; break; } } } if (num == -1) { SemiHands.Logger.LogError((object)"LeftArmTranspiler: Could not find SetPose call"); return list; } int num4 = num; while (num4 > 0 && list[num4].opcode != OpCodes.Ldarg_0) { num4--; } int num5 = ((num2 != -1) ? (num2 + 1) : (num + 1)); Label label = il.DefineLabel(); Label label2 = il.DefineLabel(); list[num4].labels.Add(label); if (num5 < list.Count) { list[num5].labels.Add(label2); } List<CodeInstruction> list2 = new List<CodeInstruction>(); list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list2.Add(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlayerAvatarLeftArm), "playerAvatar"))); list2.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo)); list2.Add(new CodeInstruction(OpCodes.Brfalse_S, (object)label)); list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list2.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); list2.Add(new CodeInstruction(OpCodes.Br_S, (object)label2)); List<CodeInstruction> collection = list2; list.InsertRange(num4, collection); SemiHands.Logger.LogInfo((object)"LeftArmTranspiler: Successfully patched Update method"); return list; } } [HarmonyPatch(typeof(PlayerAvatarRightArm), "Update")] public class PlayerAvatarRightArm_UpdateTranspiler { public static bool CheckR(PlayerAvatar avatar) { PlayerFightController value; return SemiHands.Instance.FightControllers.TryGetValue(avatar, out value) && value.CanRightArmPunch(); } public static void HandleCombatPose(PlayerAvatarRightArm __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Vector3 pose = SemiHands.RightArmCombatPose; if (SemiHands.Instance.FightControllers.TryGetValue(__instance.playerAvatar, out PlayerFightController value)) { pose = value.CurRightArmCombatRotation; } else { SemiHands.Logger.LogWarning((object)"HandleCombatPose: No FightController found for PlayerAvatar"); } __instance.SetPose(pose); __instance.HeadAnimate(false); __instance.AnimatePose(); } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerAvatarRightArm_UpdateTranspiler), "CheckR", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(PlayerAvatarRightArm_UpdateTranspiler), "HandleCombatPose", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(PlayerAvatarRightArm), "SetPose", (Type[])null, (Type[])null); MethodInfo methodInfo4 = AccessTools.Method(typeof(PlayerAvatarRightArm), "AnimatePose", (Type[])null, (Type[])null); int num = -1; int num2 = -1; for (int num3 = list.Count - 1; num3 >= 0; num3--) { if (list[num3].opcode == OpCodes.Call && list[num3].operand is MethodInfo methodInfo5) { if (methodInfo5 == methodInfo3 && num == -1) { num = num3; } else if (methodInfo5 == methodInfo4 && num != -1 && num2 == -1) { num2 = num3; break; } } } if (num == -1) { SemiHands.Logger.LogError((object)"RightArmTranspiler: Could not find SetPose call"); return list; } int num4 = num; while (num4 > 0 && list[num4].opcode != OpCodes.Ldarg_0) { num4--; } int num5 = ((num2 != -1) ? (num2 + 1) : (num + 1)); Label label = il.DefineLabel(); Label label2 = il.DefineLabel(); list[num4].labels.Add(label); if (num5 < list.Count) { list[num5].labels.Add(label2); } List<CodeInstruction> list2 = new List<CodeInstruction>(); list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list2.Add(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlayerAvatarRightArm), "playerAvatar"))); list2.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo)); list2.Add(new CodeInstruction(OpCodes.Brfalse_S, (object)label)); list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list2.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); list2.Add(new CodeInstruction(OpCodes.Br_S, (object)label2)); List<CodeInstruction> collection = list2; list.InsertRange(num4, collection); SemiHands.Logger.LogInfo((object)"RightArmTranspiler: Successfully patched Update method"); return list; } } }