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 LethalGym v3.5.0
LethalGym/LethalGym.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalGym.NetcodePatcher; using LethalGym.Scripts; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalGym")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalGym")] [assembly: AssemblyTitle("LethalGym")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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; } } } public class Equipment : NetworkBehaviour { public PlayerActions playerActions; public InteractTrigger trigger; public Animator animator; public TMP_Text nameText; public TMP_Text repsText; public GameObject[] weights; public string EquipmentName; public int playerStrengthLevel; public AnimatorOverrideController overrideController; public AnimationClip equipmentEnter; public AnimationClip equipmentRep; public static AnimationClip benchEnter; public static AnimationClip benchRep; public static AnimationClip squatEnter; public static AnimationClip squatRep; public int reps; public bool inUse; public bool isRepping; public PlayerControllerB playerController; public PlayerStrengthLevel psl; public void Awake() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) inUse = false; playerActions = new PlayerActions(); MovementActions movement = playerActions.Movement; ((MovementActions)(ref movement)).Enable(); trigger = ((Component)this).GetComponent<InteractTrigger>(); } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) MovementActions movement = playerActions.Movement; ((MovementActions)(ref movement)).Interact.performed += BackOut; movement = playerActions.Movement; ((MovementActions)(ref movement)).Use.performed += Rep; } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) MovementActions movement = playerActions.Movement; ((MovementActions)(ref movement)).Interact.performed -= BackOut; movement = playerActions.Movement; ((MovementActions)(ref movement)).Use.performed -= Rep; } public void Start() { nameText.text = "Enter Bench"; repsText.text = "To Start Count"; if (EquipmentName == "Bench") { equipmentEnter = benchEnter; equipmentRep = benchRep; } else if (EquipmentName == "Squat") { equipmentEnter = squatEnter; equipmentRep = squatRep; } else { Debug.LogError((object)"No Name?"); } } public void Update() { if ((Object)(object)nameText != (Object)null && (Object)(object)repsText != (Object)null && (Object)(object)psl != (Object)null) { nameText.text = playerController.playerUsername + "'s"; repsText.text = "Reps:" + psl.currentRepsInLevel; } } public void Rep(CallbackContext context) { if (inUse && !isRepping && playerController.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId) { RepServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void RepServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: 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(208976721u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 208976721u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(playRep()); reps++; RepClientRpc(reps); } } } [ClientRpc] public void RepClientRpc(int serverReps) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2906675056u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, serverReps); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2906675056u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { reps = serverReps; ((MonoBehaviour)this).StartCoroutine(playRep()); ((Component)playerController).gameObject.GetComponent<PlayerStrengthLevel>().addRep(this); } } } public IEnumerator playRep() { playerController.playerBodyAnimator.Play("SpecialAnimations.TypeOnTerminal2", -1, 0f); animator.Play("Base Layer.EquipmentRepAnimation", -1, 0f); isRepping = true; yield return (object)new WaitForSeconds(1f); isRepping = false; } public void OnEnter(PlayerControllerB player) { Debug.LogWarning((object)"Entered"); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; OnEnterServerRpc(localPlayerController.playerClientId); } [ServerRpc(RequireOwnership = false)] public void OnEnterServerRpc(ulong playerInBenchID) { //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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1953265794u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerInBenchID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1953265794u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } inUse = true; PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { if (val3.playerClientId == playerInBenchID) { playerController = val3; overrideController = (AnimatorOverrideController)val3.playerBodyAnimator.runtimeAnimatorController; psl = ((Component)val3).GetComponent<PlayerStrengthLevel>(); playerStrengthLevel = ((Component)val3).GetComponent<PlayerStrengthLevel>().playerStrength; break; } } if ((Object)(object)equipmentEnter == (Object)null) { Debug.LogError((object)"equipmentEnter is null"); } else { Debug.LogError((object)((Object)equipmentEnter).name.ToString()); } if ((Object)(object)equipmentRep == (Object)null) { Debug.LogError((object)"equipmentRep is null"); } else { Debug.LogError((object)((Object)equipmentRep).name.ToString()); } Debug.LogError((object)((Object)overrideController).name.ToString()); overrideController["TypeOnTerminal"] = equipmentEnter; overrideController["TypeOnTermina2"] = equipmentRep; SetWeights(playerStrengthLevel); Debug.LogError((object)playerStrengthLevel); animator.ResetTrigger("EquipmentRep"); animator.SetTrigger("EquipmentRep"); reps = 1; OnEnterClientRpc(playerInBenchID); } [ClientRpc] public void OnEnterClientRpc(ulong playerInBenchID) { //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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4277572156u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerInBenchID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4277572156u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } inUse = true; PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { if (val3.playerClientId == playerInBenchID) { playerController = val3; overrideController = (AnimatorOverrideController)val3.playerBodyAnimator.runtimeAnimatorController; psl = ((Component)val3).GetComponent<PlayerStrengthLevel>(); if ((Object)(object)psl == (Object)null) { Debug.LogWarning((object)"no psl"); } playerStrengthLevel = ((Component)val3).GetComponent<PlayerStrengthLevel>().playerStrength; break; } } if ((Object)(object)equipmentEnter == (Object)null) { Debug.LogError((object)"equipmentEnter is null"); } else { Debug.LogError((object)((Object)equipmentEnter).name.ToString()); } if ((Object)(object)equipmentRep == (Object)null) { Debug.LogError((object)"equipmentRep is null"); } else { Debug.LogError((object)((Object)equipmentRep).name.ToString()); } if ((Object)(object)overrideController == (Object)null) { Debug.LogError((object)"no overridecontroller"); } overrideController["TypeOnTerminal"] = equipmentEnter; overrideController["TypeOnTerminal2"] = equipmentRep; SetWeights(playerStrengthLevel); Debug.LogError((object)playerStrengthLevel); animator.ResetTrigger("EquipmentRep"); animator.SetTrigger("EquipmentRep"); reps = 1; ((Component)playerController).gameObject.GetComponent<PlayerStrengthLevel>().addRep(this); } public void BackOut(CallbackContext context) { if (inUse && playerController.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId) { StopSpecialAnimation(); BackOutServerRpc(); } } public void StopSpecialAnimation() { trigger.StopSpecialAnimation(); } [ServerRpc(RequireOwnership = false)] public void BackOutServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: 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(1102693684u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1102693684u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Debug.LogWarning((object)"BACKOUT CONFIRM"); LeaveEquipment(); BackOutClientRpc(); } } } [ClientRpc] public void BackOutClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3160475806u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3160475806u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Debug.LogWarning((object)"BACKOUT CONFIRM"); LeaveEquipment(); } } } public void LeaveEquipment() { animator.SetTrigger("StopAnimation"); inUse = false; playerController = null; psl = null; } public void SetWeights(int levelNumber) { for (int i = 0; i < weights.Length; i++) { if (i == 0) { weights[i].SetActive(true); } else { weights[i].SetActive(false); } } if (levelNumber == 1) { weights[0].SetActive(true); } if (levelNumber >= 2) { weights[1].SetActive(true); } if (levelNumber >= 3) { weights[2].SetActive(true); } if (levelNumber >= 4) { weights[3].SetActive(true); } if (levelNumber >= 5) { weights[4].SetActive(true); } if (levelNumber >= 6) { weights[5].SetActive(true); } } [ServerRpc(RequireOwnership = false)] public void BeginTerminalServerRPC(ulong 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4209962670u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4209962670u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { if (val3.playerClientId == playerID) { AnimatorOverrideController controller = (AnimatorOverrideController)val3.playerBodyAnimator.runtimeAnimatorController; resetAnimations(controller); break; } } BeginTerminalClientRPC(playerID); } [ClientRpc] public void BeginTerminalClientRPC(ulong 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2769116482u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2769116482u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { if (val3.playerClientId == playerID) { AnimatorOverrideController controller = (AnimatorOverrideController)val3.playerBodyAnimator.runtimeAnimatorController; resetAnimations(controller); break; } } } public static void resetAnimations(AnimatorOverrideController controller) { List<KeyValuePair<AnimationClip, AnimationClip>> list = new List<KeyValuePair<AnimationClip, AnimationClip>>(controller.overridesCount); controller.GetOverrides(list); for (int i = 0; i < list.Count; i++) { list[i] = new KeyValuePair<AnimationClip, AnimationClip>(list[i].Key, null); } controller.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Equipment() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(208976721u, new RpcReceiveHandler(__rpc_handler_208976721)); NetworkManager.__rpc_func_table.Add(2906675056u, new RpcReceiveHandler(__rpc_handler_2906675056)); NetworkManager.__rpc_func_table.Add(1953265794u, new RpcReceiveHandler(__rpc_handler_1953265794)); NetworkManager.__rpc_func_table.Add(4277572156u, new RpcReceiveHandler(__rpc_handler_4277572156)); NetworkManager.__rpc_func_table.Add(1102693684u, new RpcReceiveHandler(__rpc_handler_1102693684)); NetworkManager.__rpc_func_table.Add(3160475806u, new RpcReceiveHandler(__rpc_handler_3160475806)); NetworkManager.__rpc_func_table.Add(4209962670u, new RpcReceiveHandler(__rpc_handler_4209962670)); NetworkManager.__rpc_func_table.Add(2769116482u, new RpcReceiveHandler(__rpc_handler_2769116482)); } private static void __rpc_handler_208976721(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((Equipment)(object)target).RepServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2906675056(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 serverReps = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref serverReps); target.__rpc_exec_stage = (__RpcExecStage)2; ((Equipment)(object)target).RepClientRpc(serverReps); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1953265794(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) { ulong playerInBenchID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerInBenchID); target.__rpc_exec_stage = (__RpcExecStage)1; ((Equipment)(object)target).OnEnterServerRpc(playerInBenchID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4277572156(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) { ulong playerInBenchID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerInBenchID); target.__rpc_exec_stage = (__RpcExecStage)2; ((Equipment)(object)target).OnEnterClientRpc(playerInBenchID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1102693684(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((Equipment)(object)target).BackOutServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3160475806(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Equipment)(object)target).BackOutClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4209962670(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) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((Equipment)(object)target).BeginTerminalServerRPC(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2769116482(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) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)2; ((Equipment)(object)target).BeginTerminalClientRPC(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Equipment"; } } public class PlayerStrengthLevel : NetworkBehaviour { public int playerStrength = 1; public int currentRepsInLevel = 0; public static int repsNeededL1 = 25; public static int repsNeededL2 = 50; public static int repsNeededL3 = 75; public static int repsNeededL4 = 100; public static int repsNeededL5 = 200; public bool canGrab; public bool canDrop; public static bool strongerBodyStatus; public float originalCarryWeight; public PlayerControllerB playerController; public void Start() { originalCarryWeight = 1f; canGrab = true; canDrop = true; } public void Update() { } public void UpdateConfigs(bool nStrongerBodyStatus) { strongerBodyStatus = nStrongerBodyStatus; } public void addRep(Equipment bench) { currentRepsInLevel++; Debug.LogWarning((object)currentRepsInLevel.ToString()); if (playerStrength == 1 && currentRepsInLevel >= repsNeededL1) { playerStrength++; currentRepsInLevel = 0; bench.SetWeights(playerStrength); Debug.Log((object)(playerStrength + " PlayerUpgraded!")); } if (playerStrength == 2 && currentRepsInLevel >= repsNeededL2) { playerStrength++; currentRepsInLevel = 0; bench.SetWeights(playerStrength); Debug.Log((object)(playerStrength + " PlayerUpgraded!")); } if (playerStrength == 3 && currentRepsInLevel >= repsNeededL3) { playerStrength++; currentRepsInLevel = 0; bench.SetWeights(playerStrength); Debug.Log((object)(playerStrength + " PlayerUpgraded!")); } if (playerStrength == 4 && currentRepsInLevel >= repsNeededL4) { playerStrength++; currentRepsInLevel = 0; bench.SetWeights(playerStrength); Debug.Log((object)(playerStrength + " PlayerUpgraded!")); } if (playerStrength == 5 && currentRepsInLevel >= repsNeededL5) { bench.repsText.text = "MAXED OUT"; Debug.Log((object)"Bro is maxed out"); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "PlayerStrengthLevel"; } } namespace LethalGym { [BepInPlugin("Dryedcoolbro.LethalGym", "LethalGym", "1.0.0.0")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Dryedcoolbro.LethalGym"; private const string modName = "LethalGym"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Dryedcoolbro.LethalGym"); private static Plugin Instance; internal static ManualLogSource Logger; public static AssetBundle assetBundle; public static AnimationClip pushupAnimation; public static UnlockablesList unlockablesList; public static Config Config { get; private set; } public static bool IsModLoaded(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Config = new Config(((BaseUnityPlugin)this).Config); 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); } } } Logger = Logger.CreateLogSource("Dryedcoolbro.LethalGym"); assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalequipment")); LoadAnimations(); if ((Object)(object)pushupAnimation == (Object)null) { Logger.LogError((object)"pushupAnim not exist!"); } else { Logger.LogInfo((object)((Object)pushupAnimation).name); } if ((Object)(object)assetBundle == (Object)null) { Logger.LogError((object)"Assetbundle not exist!"); } else { Logger.LogInfo((object)((object)assetBundle).ToString()); Logger.LogInfo((object)((Object)assetBundle).name); } harmony.PatchAll(); NetworkObjectManager.assetBundle = assetBundle; unlockablesList = assetBundle.LoadAsset<UnlockablesList>("Assets/MyAssets/Unlockables.asset"); unlockablesList = unlockablesList; LoadNetworkPrefabs(); RegisterUnlockables(); } public static void LoadAnimations() { Equipment.benchEnter = assetBundle.LoadAsset<AnimationClip>("Assets/MyAssets/Bench/BenchPressStart.anim"); Equipment.benchRep = assetBundle.LoadAsset<AnimationClip>("Assets/MyAssets/Bench/BenchRep.anim"); Equipment.squatEnter = assetBundle.LoadAsset<AnimationClip>("Assets/MyAssets/SquatRack/SquatEnter.anim"); Equipment.squatRep = assetBundle.LoadAsset<AnimationClip>("Assets/MyAssets/SquatRack/SquatRep.anim"); } public static void LoadNetworkPrefabs() { NetworkPrefabs.RegisterNetworkPrefab(unlockablesList.unlockables[0].prefabObject); NetworkPrefabs.RegisterNetworkPrefab(unlockablesList.unlockables[1].prefabObject); } public static void RegisterUnlockables() { ConfigApply.unlockablesList = unlockablesList; Unlockables.RegisterUnlockable(unlockablesList.unlockables[0], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, 60); Unlockables.RegisterUnlockable(unlockablesList.unlockables[1], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, 60); } } [DataContract] public class Config : SyncedInstance<Config> { [DataMember] public bool strongerBody { get; private set; } [DataMember] public bool overridePrices { get; private set; } [DataMember] public int benchPrice { get; private set; } [DataMember] public int squatPrice { get; private set; } public Config(ConfigFile cfg) { InitInstance(this); strongerBody = cfg.Bind<bool>("General", "Stronger Body", false, "More strength levels you have, the faster you can walk while carrying heavy items").Value; overridePrices = cfg.Bind<bool>("Prices", "Override Prices", false, "If set to true, all prices underneath will be set as the price no matter what.").Value; benchPrice = cfg.Bind<int>("Prices", "Bench Price", 60, "Default is 60").Value; squatPrice = cfg.Bind<int>("Prices", "Squat Rack Price", 60, "Default is 60").Value; } public static void RequestSync() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } FastBufferWriter stream = default(FastBufferWriter); ((FastBufferWriter)(ref stream))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.SendMessage("ModName_OnRequestConfigSync", 0uL, stream); } finally { ((IDisposable)(FastBufferWriter)(ref stream)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) if (!SyncedInstance<Config>.IsHost) { return; } Plugin.Logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter stream = default(FastBufferWriter); ((FastBufferWriter)(ref stream))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref stream)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref stream)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.SendMessage("ModName_OnReceiveConfigSync", clientId, stream); } catch (Exception arg) { Plugin.Logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref stream)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_002d: 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) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.Logger.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)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.Logger.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (SyncedInstance<Config>.IsHost) { SyncedInstance<Config>.MessageManager.RegisterNamedMessageHandler("ModName_OnRequestConfigSync", new HandleNamedMessageDelegate(OnRequestSync)); SyncedInstance<Config>.Synced = true; } else { SyncedInstance<Config>.Synced = false; SyncedInstance<Config>.MessageManager.RegisterNamedMessageHandler("ModName_OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveSync)); RequestSync(); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; [NonSerialized] private static readonly DataContractSerializer serializer = new DataContractSerializer(typeof(T)); internal static bool Synced; [NonSerialized] private static int MAX_BUFFER_SIZE = 1300; public static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; public static bool IsClient => NetworkManager.Singleton.IsClient; public static bool IsHost => NetworkManager.Singleton.IsHost; internal static T Default { get; private set; } internal static T Instance { get; private set; } protected void InitInstance(T instance, int maxSize = 1024) { Default = instance; Instance = instance; IntSize = 4; if (maxSize < 1300) { MAX_BUFFER_SIZE = maxSize; } } 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) { using MemoryStream memoryStream = new MemoryStream(); try { serializer.WriteObject(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { using MemoryStream stream = new MemoryStream(data); try { return (T)serializer.ReadObject(stream); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } internal static void SendMessage(string label, ulong clientId, FastBufferWriter stream) { //IL_0017: 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_0052: Unknown result type (might be due to invalid IL or missing references) bool flag = ((FastBufferWriter)(ref stream)).Capacity > MAX_BUFFER_SIZE; NetworkDelivery val = (NetworkDelivery)(flag ? 4 : 2); if (flag) { Plugin.Logger.LogDebug((object)($"Size of stream ({((FastBufferWriter)(ref stream)).Capacity}) was past the max buffer size.\n" + "Config instance will be sent in fragments to avoid overflowing the buffer.")); } MessageManager.SendNamedMessage(label, clientId, stream, val); } } } namespace LethalGym.Scripts { [HarmonyPatch] internal class MoreEmotesPatcher { public static bool moreEmotes; [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPostfix] public static void ApplyPatch() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown if (!Plugin.IsModLoaded("MoreEmotes") || !Chainloader.PluginInfos.TryGetValue("MoreEmotes", out var value)) { return; } Assembly assembly = ((object)value.Instance).GetType().Assembly; if (assembly != null) { Plugin.Logger.LogWarning((object)"Applying compatibility patch for More_Emotes"); Type type = assembly.GetType("MoreEmotes.Patch.EmotePatch"); FieldInfo field = type.GetField("local", BindingFlags.Static | BindingFlags.Public); RuntimeAnimatorController val = (RuntimeAnimatorController)field.GetValue(null); if ((Object)(object)val != (Object)null && !(val is AnimatorOverrideController)) { field.SetValue(null, (object?)new AnimatorOverrideController(val)); } FieldInfo field2 = type.GetField("others", BindingFlags.Static | BindingFlags.Public); RuntimeAnimatorController val2 = (RuntimeAnimatorController)field2.GetValue(null); if ((Object)(object)val2 != (Object)null && !(val2 is AnimatorOverrideController)) { field2.SetValue(null, (object?)new AnimatorOverrideController(val2)); } moreEmotes = true; } } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] public static void AddEmote(StartOfRound __instance) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown __instance.localClientAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(__instance.localClientAnimatorController); __instance.otherClientsAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(__instance.otherClientsAnimatorController); } } public class EquipmentNetworkHandler : NetworkBehaviour { public static bool strongerBody; public static bool overridePrices; public static int benchPrce; public static int squatPrice; public static EquipmentNetworkHandler Instance { get; private set; } public override void OnNetworkSpawn() { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { EquipmentNetworkHandler instance = Instance; if (instance != null) { ((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } [ServerRpc(RequireOwnership = false)] public void SyncStrengthValuesServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(445641438u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 445641438u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { PlayerStrengthLevel component = ((Component)val3).GetComponent<PlayerStrengthLevel>(); SyncStrengthValuesClientRpc(val3.playerClientId, component.playerStrength, component.currentRepsInLevel, component.originalCarryWeight, strongerBody); } } } [ClientRpc] public void SyncStrengthValuesClientRpc(ulong playerID, int playerStrength, int currentRepsInLevel, float carryWeight, bool strongerBody) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2633422452u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, playerStrength); BytePacker.WriteValueBitPacked(val2, currentRepsInLevel); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref carryWeight, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref strongerBody, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2633422452u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { if (val3.playerClientId == playerID) { PlayerStrengthLevel playerStrengthLevel = ((Component)val3).GetComponent<PlayerStrengthLevel>(); if ((Object)(object)playerStrengthLevel == (Object)null) { playerStrengthLevel = ((Component)val3).gameObject.AddComponent<PlayerStrengthLevel>(); } playerStrengthLevel.playerStrength = playerStrength; playerStrengthLevel.currentRepsInLevel = currentRepsInLevel; playerStrengthLevel.originalCarryWeight = carryWeight; PlayerStrengthLevel.strongerBodyStatus = strongerBody; } } } public void DoubleCheckGrabFunction(PlayerStrengthLevel psl, bool GrabOrDrop) { ((MonoBehaviour)this).StartCoroutine(DoubleCheckGrab(psl, GrabOrDrop)); } public IEnumerator DoubleCheckGrab(PlayerStrengthLevel psl, bool GrabOrDrop) { yield return (object)new WaitForSeconds(0.1f); if (GrabOrDrop) { psl.canGrab = true; } else { psl.canDrop = true; } } public void ChangeWeightsFunction(PlayerControllerB player, PlayerStrengthLevel psl) { ((MonoBehaviour)this).StartCoroutine(ChangeWeights(player, psl)); } public IEnumerator ChangeWeights(PlayerControllerB player, PlayerStrengthLevel psl) { yield return (object)new WaitForSeconds(0.1f); switch (psl.playerStrength) { case 1: player.carryWeight = psl.originalCarryWeight / 1f; break; case 2: player.carryWeight = psl.originalCarryWeight / 1.05f; break; case 3: player.carryWeight = psl.originalCarryWeight / 1.1f; break; case 4: player.carryWeight = psl.originalCarryWeight / 1.3f; break; case 5: player.carryWeight = psl.originalCarryWeight / 1.5f; break; } Debug.LogError((object)("(Grab) Middle instance: " + player.carryWeight)); if (player.carryWeight < 1f) { player.carryWeight = 1f; psl.originalCarryWeight = 1f; Debug.LogWarning((object)"Carry weight less than 1.0"); } Debug.LogError((object)("(grab) Last original: " + psl.originalCarryWeight)); Debug.LogError((object)("(Grab) Last instance: " + player.carryWeight)); DoubleCheckGrabFunction(psl, GrabOrDrop: false); psl.canDrop = false; } public static void setConfigs(bool strongerBodyValue) { strongerBody = strongerBodyValue; PlayerStrengthLevel[] array = Object.FindObjectsOfType<PlayerStrengthLevel>(); PlayerStrengthLevel[] array2 = array; foreach (PlayerStrengthLevel playerStrengthLevel in array2) { playerStrengthLevel.UpdateConfigs(strongerBody); } } [ServerRpc] public void GrabWeightServerRpc(ulong playerID, float grabbedObjectWeight) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2569922344u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2569922344u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } PlayerControllerB val3 = null; PlayerStrengthLevel playerStrengthLevel = null; PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val4 in array2) { if (val4.playerClientId == playerID) { val3 = val4; playerStrengthLevel = ((Component)val3).GetComponent<PlayerStrengthLevel>(); break; } } GrabWeightClientRpc(playerID, grabbedObjectWeight); } [ClientRpc] public void GrabWeightClientRpc(ulong playerID, float grabbedObjectWeight) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(895823418u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 895823418u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlayerControllerB val3 = null; PlayerStrengthLevel playerStrengthLevel = null; PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val4 in array2) { if (val4.playerClientId == playerID) { val3 = val4; playerStrengthLevel = ((Component)val3).GetComponent<PlayerStrengthLevel>(); break; } } playerStrengthLevel.originalCarryWeight += Mathf.Clamp(grabbedObjectWeight - 1f, 0f, 10f); switch (playerStrengthLevel.playerStrength) { case 1: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1f; break; case 2: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.05f; break; case 3: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.1f; break; case 4: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.3f; break; case 5: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.5f; break; } if (val3.carryWeight < 1f) { val3.carryWeight = 1f; playerStrengthLevel.originalCarryWeight = 1f; } Debug.LogWarning((object)playerStrengthLevel.originalCarryWeight.ToString()); } [ServerRpc] public void DropWeightServerRpc(ulong playerID, float grabbedObjectWeight) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2151574417u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2151574417u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } PlayerControllerB val3 = null; PlayerStrengthLevel playerStrengthLevel = null; PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val4 in array2) { if (val4.playerClientId == playerID) { val3 = val4; playerStrengthLevel = ((Component)val3).GetComponent<PlayerStrengthLevel>(); break; } } DropWeightClientRpc(playerID, grabbedObjectWeight); } [ClientRpc] public void DropWeightClientRpc(ulong playerID, float grabbedObjectWeight) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(56241821u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 56241821u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlayerControllerB val3 = null; PlayerStrengthLevel playerStrengthLevel = null; PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val4 in array2) { if (val4.playerClientId == playerID) { val3 = val4; playerStrengthLevel = ((Component)val3).GetComponent<PlayerStrengthLevel>(); break; } } playerStrengthLevel.originalCarryWeight -= Mathf.Clamp(grabbedObjectWeight - 1f, 0f, 10f); switch (playerStrengthLevel.playerStrength) { case 1: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1f; break; case 2: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.05f; break; case 3: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.1f; break; case 4: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.3f; break; case 5: val3.carryWeight = playerStrengthLevel.originalCarryWeight / 1.5f; break; } if (val3.carryWeight < 1f) { val3.carryWeight = 1f; playerStrengthLevel.originalCarryWeight = 1f; } Debug.LogWarning((object)playerStrengthLevel.originalCarryWeight.ToString()); Debug.LogWarning((object)playerStrengthLevel.originalCarryWeight.ToString()); } public void UpdateDecorPriceStart(UnlockablesList unlockablesList) { ((MonoBehaviour)this).StartCoroutine(UpdateDecorPrice(unlockablesList)); } public IEnumerator UpdateDecorPrice(UnlockablesList unlockablesList) { yield return (object)new WaitForSeconds(2f); if (!SyncedInstance<Config>.Instance.overridePrices) { if (SyncedInstance<Config>.Instance.strongerBody) { for (int k = 0; k < Unlockables.registeredUnlockables.Count; k++) { if (Unlockables.registeredUnlockables[k].unlockable == unlockablesList.unlockables[0]) { Unlockables.UpdateUnlockablePrice(Unlockables.registeredUnlockables[k].unlockable, 299); } else if (Unlockables.registeredUnlockables[k].unlockable == unlockablesList.unlockables[1]) { Unlockables.UpdateUnlockablePrice(Unlockables.registeredUnlockables[k].unlockable, 299); } } } else { for (int j = 0; j < Unlockables.registeredUnlockables.Count; j++) { if (Unlockables.registeredUnlockables[j].unlockable == unlockablesList.unlockables[0]) { Unlockables.UpdateUnlockablePrice(Unlockables.registeredUnlockables[j].unlockable, 60); } else if (Unlockables.registeredUnlockables[j].unlockable == unlockablesList.unlockables[1]) { Unlockables.UpdateUnlockablePrice(Unlockables.registeredUnlockables[j].unlockable, 60); } } } } else { for (int i = 0; i < Unlockables.registeredUnlockables.Count; i++) { if (Unlockables.registeredUnlockables[i].unlockable == unlockablesList.unlockables[0]) { Unlockables.UpdateUnlockablePrice(Unlockables.registeredUnlockables[i].unlockable, SyncedInstance<Config>.Instance.benchPrice); } else if (Unlockables.registeredUnlockables[i].unlockable == unlockablesList.unlockables[1]) { Unlockables.UpdateUnlockablePrice(Unlockables.registeredUnlockables[i].unlockable, SyncedInstance<Config>.Instance.squatPrice); } } } setConfigs(SyncedInstance<Config>.Instance.strongerBody); } [ServerRpc(RequireOwnership = false)] public void BeginTerminalServerRPC(ulong 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1945757694u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1945757694u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { if (val3.playerClientId == playerID) { AnimatorOverrideController controller = (AnimatorOverrideController)val3.playerBodyAnimator.runtimeAnimatorController; Debug.LogWarning((object)((object)val3.playerBodyAnimator.runtimeAnimatorController).ToString()); resetAnimations(controller); break; } } BeginTerminalClientRPC(playerID); } [ClientRpc] public void BeginTerminalClientRPC(ulong 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3487933852u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3487933852u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val3 in array2) { if (val3.playerClientId == playerID) { AnimatorOverrideController controller = (AnimatorOverrideController)val3.playerBodyAnimator.runtimeAnimatorController; resetAnimations(controller); break; } } } public static void resetAnimations(AnimatorOverrideController controller) { List<KeyValuePair<AnimationClip, AnimationClip>> list = new List<KeyValuePair<AnimationClip, AnimationClip>>(controller.overridesCount); controller.GetOverrides(list); for (int i = 0; i < list.Count; i++) { list[i] = new KeyValuePair<AnimationClip, AnimationClip>(list[i].Key, null); } controller.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_EquipmentNetworkHandler() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(445641438u, new RpcReceiveHandler(__rpc_handler_445641438)); NetworkManager.__rpc_func_table.Add(2633422452u, new RpcReceiveHandler(__rpc_handler_2633422452)); NetworkManager.__rpc_func_table.Add(2569922344u, new RpcReceiveHandler(__rpc_handler_2569922344)); NetworkManager.__rpc_func_table.Add(895823418u, new RpcReceiveHandler(__rpc_handler_895823418)); NetworkManager.__rpc_func_table.Add(2151574417u, new RpcReceiveHandler(__rpc_handler_2151574417)); NetworkManager.__rpc_func_table.Add(56241821u, new RpcReceiveHandler(__rpc_handler_56241821)); NetworkManager.__rpc_func_table.Add(1945757694u, new RpcReceiveHandler(__rpc_handler_1945757694)); NetworkManager.__rpc_func_table.Add(3487933852u, new RpcReceiveHandler(__rpc_handler_3487933852)); } private static void __rpc_handler_445641438(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((EquipmentNetworkHandler)(object)target).SyncStrengthValuesServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2633422452(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_0056: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int playerStrength = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerStrength); int currentRepsInLevel = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref currentRepsInLevel); float carryWeight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref carryWeight, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((EquipmentNetworkHandler)(object)target).SyncStrengthValuesClientRpc(playerID, playerStrength, currentRepsInLevel, carryWeight, flag); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2569922344(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); float grabbedObjectWeight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EquipmentNetworkHandler)(object)target).GrabWeightServerRpc(playerID, grabbedObjectWeight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_895823418(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); float grabbedObjectWeight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((EquipmentNetworkHandler)(object)target).GrabWeightClientRpc(playerID, grabbedObjectWeight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2151574417(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); float grabbedObjectWeight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EquipmentNetworkHandler)(object)target).DropWeightServerRpc(playerID, grabbedObjectWeight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_56241821(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); float grabbedObjectWeight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref grabbedObjectWeight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((EquipmentNetworkHandler)(object)target).DropWeightClientRpc(playerID, grabbedObjectWeight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1945757694(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) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((EquipmentNetworkHandler)(object)target).BeginTerminalServerRPC(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3487933852(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) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)2; ((EquipmentNetworkHandler)(object)target).BeginTerminalClientRPC(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "EquipmentNetworkHandler"; } } [HarmonyPatch] internal class LethalGymPatches { public static AnimationClip benchEnter; public static AnimationClip benchRep; public static AnimationClip term1; public static AnimationClip term2; [HarmonyPatch(typeof(Terminal), "BeginUsingTerminal")] [HarmonyPostfix] public static void ResetAnimation(Terminal __instance) { EquipmentNetworkHandler equipmentNetworkHandler = Object.FindObjectOfType<EquipmentNetworkHandler>(); if ((Object)(object)equipmentNetworkHandler != (Object)null) { equipmentNetworkHandler.BeginTerminalServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId); } } [HarmonyPatch(typeof(ShipBuildModeManager), "StoreShipObjectClientRpc")] [HarmonyPrefix] public static void KickPlayerOutClientRpc() { Equipment equipment = Object.FindObjectOfType<Equipment>(); if ((Object)(object)equipment != (Object)null) { equipment.LeaveEquipment(); equipment.StopSpecialAnimation(); } } [HarmonyPatch(typeof(ShipBuildModeManager), "StoreObjectServerRpc")] [HarmonyPrefix] public static void KickPlayerOutServerRpc() { Equipment equipment = Object.FindObjectOfType<Equipment>(); if ((Object)(object)equipment != (Object)null) { equipment.LeaveEquipment(); } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPrefix] public static void CheckLiftName() { Equipment[] array = Object.FindObjectsOfType<Equipment>(); Equipment[] array2 = array; foreach (Equipment equipment in array2) { if (equipment.EquipmentName == "Bench") { equipment.equipmentEnter = Equipment.benchEnter; equipment.equipmentRep = Equipment.benchRep; } else if (equipment.EquipmentName == "Squat") { equipment.equipmentEnter = Equipment.squatEnter; equipment.equipmentRep = Equipment.squatRep; } else { Debug.LogError((object)"No Name?"); } } } } [HarmonyPatch] internal class NetworkObjectManager { public static AssetBundle assetBundle; private static GameObject networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = (GameObject)assetBundle.LoadAsset("Assets/MyAssets/EquipmentNetworkHandlerPrefab.prefab"); networkPrefab.AddComponent<EquipmentNetworkHandler>(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //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] internal class StrengthValuesSaveAndLoad : NetworkBehaviour { private static StrengthValuesSaveAndLoad Instance; public void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } [HarmonyPatch(typeof(GameNetworkManager), "SaveGameValues")] [HarmonyPostfix] private static void SaveStrengthValues(GameNetworkManager __instance) { PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val in array2) { PlayerStrengthLevel component = ((Component)val).GetComponent<PlayerStrengthLevel>(); if ((Object)(object)component != (Object)null) { ES3.Save<int>("PlayerStrength" + val.playerSteamId, component.playerStrength, __instance.currentSaveFileName); ES3.Save<int>("PlayerReps" + val.playerSteamId, component.currentRepsInLevel, __instance.currentSaveFileName); Debug.LogWarning((object)val.playerSteamId.ToString()); Debug.LogWarning((object)(component.playerStrength + " " + component.currentRepsInLevel)); } } } [HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesClientRpc")] [HarmonyPostfix] private static void LoadStrengthValues(PlayerControllerB __instance) { PlayerStrengthLevel playerStrengthLevel = ((Component)__instance).gameObject.GetComponent<PlayerStrengthLevel>(); if ((Object)(object)((Component)__instance).gameObject.GetComponent<PlayerStrengthLevel>() == (Object)null) { playerStrengthLevel = ((Component)__instance).gameObject.AddComponent<PlayerStrengthLevel>(); } if ((Object)(object)playerStrengthLevel != (Object)null) { Debug.LogWarning((object)"psl not null"); playerStrengthLevel.playerController = __instance; string currentSaveFileName = Object.FindObjectOfType<GameNetworkManager>().currentSaveFileName; Debug.LogWarning((object)currentSaveFileName); while (__instance.playerSteamId == 0) { } playerStrengthLevel.playerStrength = ES3.Load<int>("PlayerStrength" + __instance.playerSteamId, currentSaveFileName, 1); playerStrengthLevel.currentRepsInLevel = ES3.Load<int>("PlayerReps" + __instance.playerSteamId, currentSaveFileName, 0); Debug.LogWarning((object)__instance.playerSteamId.ToString()); Debug.LogWarning((object)(playerStrengthLevel.playerStrength + " " + playerStrengthLevel.currentRepsInLevel)); } Object.FindObjectOfType<EquipmentNetworkHandler>().SyncStrengthValuesServerRpc(); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "StrengthValuesSaveAndLoad"; } } [HarmonyPatch] internal class StrengthPatches : NetworkBehaviour { [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPostfix] private static void BeginGrab(PlayerControllerB __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown PlayerStrengthLevel component = ((Component)__instance).GetComponent<PlayerStrengthLevel>(); GrabbableObject val = (GrabbableObject)Traverse.Create((object)__instance).Field("currentlyGrabbingObject").GetValue(); if (component.canGrab && PlayerStrengthLevel.strongerBodyStatus) { Object.FindObjectOfType<EquipmentNetworkHandler>().DoubleCheckGrabFunction(component, GrabOrDrop: true); Object.FindObjectOfType<EquipmentNetworkHandler>().GrabWeightServerRpc(__instance.playerClientId, val.itemProperties.weight); component.canGrab = false; } } [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] [HarmonyPrefix] private static void BeginDrop(PlayerControllerB __instance, bool placeObject = false, NetworkObject parentObjectTo = null, Vector3 placePosition = default(Vector3), bool matchRotationOfParent = true) { PlayerStrengthLevel component = ((Component)__instance).GetComponent<PlayerStrengthLevel>(); if (component.canDrop && PlayerStrengthLevel.strongerBodyStatus) { Object.FindObjectOfType<EquipmentNetworkHandler>().ChangeWeightsFunction(__instance, component); Object.FindObjectOfType<EquipmentNetworkHandler>().DropWeightServerRpc(__instance.playerClientId, __instance.currentlyHeldObjectServer.itemProperties.weight); component.canDrop = false; } } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] private static void ChangeHUDWeight(HUDManager __instance) { if (PlayerStrengthLevel.strongerBodyStatus) { PlayerStrengthLevel component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<PlayerStrengthLevel>(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)"no psl?>?>"); } float num = Mathf.RoundToInt(Mathf.Clamp(component.originalCarryWeight - 1f, 0f, 100f) * 105f); ((TMP_Text)__instance.weightCounter).text = $"{num} lb"; __instance.weightCounterAnimator.SetFloat("weight", num / 130f); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "StrengthPatches"; } } [HarmonyPatch] internal class ConfigApply : NetworkBehaviour { public static UnlockablesList unlockablesList; [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void UpdateBenchPriceController() { Object.FindObjectOfType<EquipmentNetworkHandler>().UpdateDecorPriceStart(unlockablesList); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "ConfigApply"; } } } namespace LethalGym.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }