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 LethalEnergy v1.2.4
LC_LethalEnergy.dll
Decompiled 10 months 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.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LC_LethalEnergy.NetcodePatcher; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LC_LethalEnergy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LC_LethalEnergy")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("45290088-3404-4593-9b10-989b1ca3aae7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace LC_LethalEnergy { public class DrinkCase : GrabbableObject { [CompilerGenerated] private sealed class <RequestData>d__8 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public DrinkCase <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RequestData>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(8f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!<>4__this.loaded) { <>4__this.RequestCanDataServerRpc(); } 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 <SendOutData>d__7 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public DrinkCase <>4__this; private int <cans>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SendOutData>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <cans>5__1 = Mathf.Clamp(Random.Range(1, 7) + Random.Range(1, 7), <>4__this.minimumCans, 12); <>4__this.SendCansClientRpc(<cans>5__1); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.SendCansServerRpc(<cans>5__1); 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 <SetValue>d__9 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public DrinkCase <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetValue>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.value = Random.Range(((GrabbableObject)<>4__this).itemProperties.minValue, ((GrabbableObject)<>4__this).itemProperties.maxValue + 1); <>4__this.UpdateScrapValue(); 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 <waitForCanToSpawnOnClient>d__13 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public NetworkObjectReference netObjectRef; public Vector3 vector; public DrinkCase <>4__this; private NetworkObject <netObject>5__1; private float <startTime>5__2; private GrabbableObject <component>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <waitForCanToSpawnOnClient>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <netObject>5__1 = null; <component>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <netObject>5__1 = null; <startTime>5__2 = Time.realtimeSinceStartup; goto IL_0064; case 1: <>1__state = -1; goto IL_0064; case 2: { <>1__state = -1; <component>5__3 = ((Component)<netObject>5__1).GetComponent<GrabbableObject>(); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel -= (float)((GrabbableObject)<>4__this).scrapValue; RoundManager instance2 = RoundManager.Instance; instance2.totalScrapValueInLevel += (float)<component>5__3.scrapValue; <component>5__3.startFallingPosition = vector; <component>5__3.fallTime = 0f; <component>5__3.hasHitGround = false; <component>5__3.reachedFloorTarget = false; if ((Object)(object)((GrabbableObject)<>4__this).playerHeldBy != (Object)null && ((GrabbableObject)<>4__this).playerHeldBy.isInHangarShipRoom) { ((GrabbableObject)<>4__this).playerHeldBy.SetItemInElevator(true, true, <component>5__3); } return false; } IL_0064: if (Time.realtimeSinceStartup - <startTime>5__2 < 8f && !((NetworkObjectReference)(ref netObjectRef)).TryGet(ref <netObject>5__1, (NetworkManager)null)) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } if ((Object)(object)<netObject>5__1 == (Object)null) { Debug.Log((object)"No network object found"); return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } 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 GameObject canPrefab; public int cansHeld; public Transform[] cans; private int minimumCans = 5; private int value = 0; public bool loaded = false; public override void Start() { ((GrabbableObject)this).Start(); GameObject gameObject = ((Component)((Component)this).transform.Find("DrinkContainer")).gameObject; cans = (Transform[])(object)new Transform[gameObject.transform.childCount]; for (int i = 0; i < gameObject.transform.childCount; i++) { cans[i] = gameObject.transform.GetChild(i); } ((MonoBehaviour)this).StartCoroutine(SetValue()); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(SendOutData()); } else { ((MonoBehaviour)this).StartCoroutine(RequestData()); } } [IteratorStateMachine(typeof(<SendOutData>d__7))] public IEnumerator SendOutData() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SendOutData>d__7(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<RequestData>d__8))] public IEnumerator RequestData() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RequestData>d__8(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<SetValue>d__9))] public IEnumerator SetValue() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetValue>d__9(0) { <>4__this = this }; } public void UpdateScrapValue() { ((GrabbableObject)this).SetScrapValue(value + cansHeld * 10); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && cansHeld > 0) { cansHeld--; UpdateCans(); SendCansServerRpc(cansHeld); SpawnCanServerRpc(); } } public void UpdateCans() { if (value != 0) { UpdateScrapValue(); } cansHeld = Mathf.Clamp(cansHeld, 0, cans.Length); for (int i = 0; i < cans.Length; i++) { ((Component)cans[i]).gameObject.SetActive(i < cansHeld); } } [IteratorStateMachine(typeof(<waitForCanToSpawnOnClient>d__13))] public IEnumerator waitForCanToSpawnOnClient(NetworkObjectReference netObjectRef, Vector3 vector) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <waitForCanToSpawnOnClient>d__13(0) { <>4__this = this, netObjectRef = netObjectRef, vector = vector }; } [ServerRpc(RequireOwnership = false)] public void SendCansServerRpc(int cans) { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2178516310u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, cans); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2178516310u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SendCansClientRpc(cans); } } } [ClientRpc] public void SendCansClientRpc(int cans) { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3972762219u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, cans); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3972762219u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { cansHeld = cans; UpdateCans(); loaded = true; } } } [ServerRpc(RequireOwnership = false)] public void SpawnCanServerRpc() { //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) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(336232444u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 336232444u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Transform val3 = ((((!((Object)(object)base.playerHeldBy != (Object)null) || !base.playerHeldBy.isInElevator) && !StartOfRound.Instance.inShipPhase) || !((Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer); Vector3 val4 = ((Component)this).transform.position + Vector3.up * 0.25f; GameObject val5 = Object.Instantiate<GameObject>(canPrefab, val4, Quaternion.identity, val3); GrabbableObject component = val5.GetComponent<GrabbableObject>(); component.targetFloorPosition = component.GetItemFloorPosition(((Component)this).transform.position); if ((Object)(object)base.playerHeldBy != (Object)null && base.playerHeldBy.isInHangarShipRoom) { base.playerHeldBy.SetItemInElevator(true, true, component); } ((NetworkBehaviour)component).NetworkObject.Spawn(false); SpawnCanClientRpc(NetworkObjectReference.op_Implicit(val5.GetComponent<NetworkObject>()), val4.x, val4.y, val4.z, cansHeld); } } [ClientRpc] public void SpawnCanClientRpc(NetworkObjectReference netObjectRef, float x, float y, float z, int cans) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1260893740u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref x, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref y, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref z, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, cans); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1260893740u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { cansHeld = cans; UpdateCans(); ((MonoBehaviour)this).StartCoroutine(waitForCanToSpawnOnClient(netObjectRef, new Vector3(x, y, z))); } } } [ServerRpc(RequireOwnership = false)] public void RequestCanDataServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3319284306u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3319284306u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { RequestCanDataClientRpc(); } } } [ClientRpc] public void RequestCanDataClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2097148857u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2097148857u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer) { SendCansServerRpc(cansHeld); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_DrinkCase() { //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 NetworkManager.__rpc_func_table.Add(2178516310u, new RpcReceiveHandler(__rpc_handler_2178516310)); NetworkManager.__rpc_func_table.Add(3972762219u, new RpcReceiveHandler(__rpc_handler_3972762219)); NetworkManager.__rpc_func_table.Add(336232444u, new RpcReceiveHandler(__rpc_handler_336232444)); NetworkManager.__rpc_func_table.Add(1260893740u, new RpcReceiveHandler(__rpc_handler_1260893740)); NetworkManager.__rpc_func_table.Add(3319284306u, new RpcReceiveHandler(__rpc_handler_3319284306)); NetworkManager.__rpc_func_table.Add(2097148857u, new RpcReceiveHandler(__rpc_handler_2097148857)); } private static void __rpc_handler_2178516310(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 num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); target.__rpc_exec_stage = (__RpcExecStage)1; ((DrinkCase)(object)target).SendCansServerRpc(num); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3972762219(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 num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); target.__rpc_exec_stage = (__RpcExecStage)2; ((DrinkCase)(object)target).SendCansClientRpc(num); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_336232444(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; ((DrinkCase)(object)target).SpawnCanServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1260893740(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_008f: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable)); float x = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref x, default(ForPrimitives)); float y = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref y, default(ForPrimitives)); float z = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref z, default(ForPrimitives)); int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); target.__rpc_exec_stage = (__RpcExecStage)2; ((DrinkCase)(object)target).SpawnCanClientRpc(netObjectRef, x, y, z, num); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3319284306(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; ((DrinkCase)(object)target).RequestCanDataServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2097148857(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; ((DrinkCase)(object)target).RequestCanDataClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "DrinkCase"; } } public class LethalCan : GrabbableObject { [CompilerGenerated] private sealed class <CrushCan>d__28 : IEnumerator<WaitForSeconds>, IDisposable, IEnumerator { private int <>1__state; private WaitForSeconds <>2__current; public LethalCan <>4__this; private Vector3 <origin>5__1; private Vector3 <target>5__2; private float <time>5__3; WaitForSeconds IEnumerator<WaitForSeconds>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CrushCan>d__28(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <origin>5__1 = Vector3.one; <target>5__2 = new Vector3(1f, 0.3f, 1f); <time>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<time>5__3 < 1f) { ((Component)<>4__this).transform.localScale = Vector3.Lerp(<origin>5__1, <target>5__2, <time>5__3); <time>5__3 += Time.deltaTime * 4f; <>2__current = null; <>1__state = 1; return true; } ((GrabbableObject)<>4__this).originalScale = <target>5__2; 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 <RequestData>d__23 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LethalCan <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RequestData>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!<>4__this.loaded) { <>4__this.RequestFillDataServerRpc(); } 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 <StartDrink>d__27 : IEnumerator<WaitForSeconds>, IDisposable, IEnumerator { private int <>1__state; private WaitForSeconds <>2__current; public LethalCan <>4__this; WaitForSeconds IEnumerator<WaitForSeconds>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartDrink>d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = new WaitForSeconds(<>4__this.timeToStart); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.drinking = true; <>4__this.audio.PlayOneShot(drinkingSFX, 0.75f); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public bool drinking; public float fill = 1f; public float duration = 20f; public float timeToDrink = 2f; public float timeToStart = 0.75f; public AudioSource audio; public Coroutine DrinkCoroutine; public PlayerControllerB previousPlayerHeldBy; public const string DrinkAnimation = "HoldMask"; public static Item normalProp; public static Item storeProp; public static Vector3 normalPos; public static Vector3 normalRot; public static Item drinkingProp; public static Vector3 drinkingPos; public static Vector3 drinkingRot; private float animationLerp; private const int baseValue = 8; public const int emptyValue = 1; public static AudioClip drinkingSFX; public bool loaded = false; public bool store = false; public override void Start() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0063: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!store) { ((GrabbableObject)this).SetScrapValue(8); } if ((Object)(object)normalProp == (Object)null) { if (!store) { normalProp = base.itemProperties; } normalPos = base.itemProperties.positionOffset; normalRot = base.itemProperties.rotationOffset; drinkingPos = drinkingProp.positionOffset; drinkingRot = drinkingProp.rotationOffset; } ((GrabbableObject)this).Start(); base.fallTime = 1f; base.hasHitGround = true; audio = ((Component)this).GetComponent<AudioSource>(); if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(RequestData()); } } [IteratorStateMachine(typeof(<RequestData>d__23))] public IEnumerator RequestData() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RequestData>d__23(0) { <>4__this = this }; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { base.isBeingUsed = true; if (fill <= 0f) { previousPlayerHeldBy.playerBodyAnimator.SetTrigger("shakeItem"); return; } previousPlayerHeldBy.activatingItem = true; previousPlayerHeldBy.playerBodyAnimator.SetBool("HoldMask", true); previousPlayerHeldBy = base.playerHeldBy; DrinkCoroutine = ((MonoBehaviour)this).StartCoroutine((IEnumerator)StartDrink()); } else { base.isBeingUsed = false; if (DrinkCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(DrinkCoroutine); } Stop(); } } public override void Update() { //IL_0100: 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_0110: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (!base.isHeld || !((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController)) { return; } if (base.playerHeldBy.playerBodyAnimator.GetBool("HoldMask")) { animationLerp = Mathf.MoveTowards(animationLerp, 1f, Time.deltaTime * 3f / timeToStart); } else { animationLerp = Mathf.MoveTowards(animationLerp, 0f, Time.deltaTime * 3f / timeToStart); } animationLerp = Mathf.Clamp01(animationLerp); if (animationLerp > 0.1f) { ChangeItem(drinkingProp); } else { ChangeItem((!store) ? normalProp : storeProp); } if ((Object)(object)base.itemProperties == (Object)(object)drinkingProp) { drinkingProp.positionOffset = Vector3.Lerp(normalPos, drinkingPos, animationLerp); drinkingProp.rotationOffset = Vector3.Lerp(normalRot, drinkingRot, animationLerp); } if (drinking) { if ((Object)(object)previousPlayerHeldBy == (Object)null || !base.isHeld || fill <= 0f) { Stop(); base.itemUsedUp = true; } fill -= Time.deltaTime / timeToDrink; PlayerPatches.Caffeine += Time.deltaTime / timeToDrink; PlayerPatches.Duration += duration * Time.deltaTime / timeToDrink; } } public void ChangeItem(Item to) { if ((Object)(object)base.itemProperties != (Object)(object)to) { base.itemProperties = to; } } [IteratorStateMachine(typeof(<StartDrink>d__27))] private IEnumerator<WaitForSeconds> StartDrink() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartDrink>d__27(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<CrushCan>d__28))] public IEnumerator<WaitForSeconds> CrushCan() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CrushCan>d__28(0) { <>4__this = this }; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if ((Object)(object)base.playerHeldBy != (Object)null) { previousPlayerHeldBy = base.playerHeldBy; } } public override void DiscardItem() { animationLerp = 0f; if (DrinkCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(DrinkCoroutine); } Stop(); SendFillServerRpc(fill); if ((Object)(object)previousPlayerHeldBy != (Object)null) { previousPlayerHeldBy.activatingItem = false; } ((GrabbableObject)this).DiscardItem(); } public void Stop() { drinking = false; previousPlayerHeldBy.activatingItem = false; audio.Stop(); base.playerHeldBy.playerBodyAnimator.ResetTrigger("shakeItem"); previousPlayerHeldBy.playerBodyAnimator.SetBool("HoldMask", false); } [ServerRpc(RequireOwnership = false)] public void SendFillServerRpc(float fill) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1564617918u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref fill, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1564617918u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SendFillClientRpc(fill); } } } [ClientRpc] public void SendFillClientRpc(float Fill) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3072911950u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref Fill, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3072911950u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { loaded = true; fill = Fill; if (fill <= 0f) { ((GrabbableObject)this).SetScrapValue(1); base.itemUsedUp = true; ((MonoBehaviour)this).StartCoroutine((IEnumerator)CrushCan()); } } } [ServerRpc(RequireOwnership = false)] public void RequestFillDataServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2400585966u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2400585966u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { RequestFillDataClientRpc(); } } } [ClientRpc] public void RequestFillDataClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3583883871u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3583883871u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer) { SendFillServerRpc(fill); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LethalCan() { //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 NetworkManager.__rpc_func_table.Add(1564617918u, new RpcReceiveHandler(__rpc_handler_1564617918)); NetworkManager.__rpc_func_table.Add(3072911950u, new RpcReceiveHandler(__rpc_handler_3072911950)); NetworkManager.__rpc_func_table.Add(2400585966u, new RpcReceiveHandler(__rpc_handler_2400585966)); NetworkManager.__rpc_func_table.Add(3583883871u, new RpcReceiveHandler(__rpc_handler_3583883871)); } private static void __rpc_handler_1564617918(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalCan)(object)target).SendFillServerRpc(num); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3072911950(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalCan)(object)target).SendFillClientRpc(num); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2400585966(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; ((LethalCan)(object)target).RequestFillDataServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3583883871(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; ((LethalCan)(object)target).RequestFillDataClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LethalCan"; } } public static class PlayerPatches { public static float BaseSpeed; public static float Caffeine; public static float DecayRate = 5f; public static float Duration; public static bool warn; public static bool kill; public static float Boost = 0.25f; [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] public static void StartPatch(PlayerControllerB __instance) { BaseSpeed = __instance.movementSpeed; Caffeine = 0f; Duration = 0f; } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void UpdatePatch(PlayerControllerB __instance) { //IL_00b1: 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_010b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)StartOfRound.Instance.localPlayerController) { return; } __instance.movementSpeed = BaseSpeed + BaseSpeed * Caffeine * Boost; if (Caffeine > 0f) { if (Duration > 0f) { Duration -= Time.deltaTime; } else { Caffeine -= Time.deltaTime / DecayRate; } if (Caffeine > 3f && !warn) { warn = true; __instance.DamagePlayer(10, true, true, (CauseOfDeath)8, 1, false, default(Vector3)); HUDManager.Instance.DisplayTip("Warning", "High caffeine blood content", true, false, "LC_Tip1"); } if (Caffeine > 4f && !kill) { kill = true; __instance.DamagePlayer(9999, true, true, (CauseOfDeath)8, 1, false, Vector3.up); } Caffeine = Mathf.Clamp(Caffeine, 0f, 5f); } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPostfix] public static void ResetCaffine(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.health <= 0) { warn = false; kill = false; Caffeine = 0f; Duration = 0f; } } [HarmonyPatch(typeof(RoundManager), "LoadNewLevelWait")] [HarmonyPostfix] public static void ResetCaffeine() { warn = false; kill = false; Caffeine = 0f; Duration = 0f; } } [BepInPlugin("Mellowdy.LethalEnergy", "LethalEnergy", "1.2.0")] public class LethalEnergyMod : BaseUnityPlugin { private const string modGUID = "Mellowdy.LethalEnergy"; private const string modName = "LethalEnergy"; private const string modVersion = "1.2.0"; private readonly Harmony harmony = new Harmony("Mellowdy.LethalEnergy"); public static ManualLogSource mls; private static LethalEnergyMod instance; public static AssetBundle assets; public static string assetName = "monster.energy"; public static string canPrefabName = "monstercan.prefab"; public static string casePrefabName = "monstercase.prefab"; public static string drinkSoundName = "drinking.wav"; public static string fridgePrefabName = "Fridge.prefab"; public static string fridgeUnlockableName = "Unlockable.asset"; public static int rarity = 30; private bool runonce = false; private void Awake() { if (!runonce) { RunNetcodePatcher(); } if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("Mellowdy.LethalEnergy"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, assetName).Replace("\\", "/"); assets = AssetBundle.LoadFromFile(text); GameObject val = assets.LoadAsset<GameObject>(casePrefabName); Item val2 = assets.LoadAsset<Item>("case.asset"); val2.spawnPrefab = val; DrinkCase drinkCase = val.AddComponent<DrinkCase>(); ((GrabbableObject)drinkCase).itemProperties = val2; ((GrabbableObject)drinkCase).grabbable = true; ((GrabbableObject)drinkCase).useCooldown = 0.5f; Item val3 = assets.LoadAsset<Item>("Can.asset"); GameObject canPrefab = (val3.spawnPrefab = GetCan(assets.LoadAsset<GameObject>(canPrefabName), val3)); LethalCan.drinkingSFX = assets.LoadAsset<AudioClip>(drinkSoundName); LethalCan.drinkingProp = assets.LoadAsset<Item>("Drinking.asset"); DrinkCase.canPrefab = canPrefab; Item val4 = assets.LoadAsset<Item>("BuyCan.asset"); val4.spawnPrefab = GetCan(assets.LoadAsset<GameObject>("boughtcan.prefab"), val4); LethalCan.storeProp = val4; LethalCan component = val4.spawnPrefab.GetComponent<LethalCan>(); component.store = true; int value = ((BaseUnityPlugin)this).Config.Bind<int>("Shop", "Can Price", 10, "Price for a can of monster in the shop").Value; GameObject val5 = assets.LoadAsset<GameObject>(fridgePrefabName); int value2 = ((BaseUnityPlugin)this).Config.Bind<int>("Shop", "Mini-fridge Price", 85, "Price for the mini-fridge").Value; bool value3 = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Mini-fridge is decor", true, "Decides if the fridge is considered décor that rotates every quota or a ship upgrade that is always available for purchase.").Value; NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val5); Items.RegisterItem(val4); Items.RegisterShopItem(val4, value); UnlockableItem val6 = assets.LoadAsset<UnlockablesList>(fridgeUnlockableName).unlockables[0]; val6.alwaysInStock = !value3; Unlockables.RegisterUnlockable(val6, (StoreType)((!value3) ? 1 : 2), (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, value2); LevelTypes[] array = new LevelTypes[8]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); LevelTypes[] array2 = (LevelTypes[])(object)array; int[] array3 = new int[8] { 0, 10, 8, 10, 5, 2, 15, 20 }; rarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "Base Rarity", 20, "Rarity for all moons not otherwise listed").Value; for (int i = 0; i < array2.Length; i++) { string text2 = ((object)(LevelTypes)(ref array2[i])).ToString().Replace("Level", ""); array3[i] = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", text2 ?? "", array3[i], "Rarity for " + text2).Value; Items.RegisterScrap(val2, array3[i], array2[i]); } Items.RegisterScrap(val3, 0, (LevelTypes)1, (string[])null); Items.RegisterScrap(val2, rarity, (LevelTypes)1024); harmony.PatchAll(); harmony.PatchAll(typeof(PlayerPatches)); mls.LogInfo((object)"LethalEnergy has been loaded"); } public static GameObject GetCan(GameObject g, Item itemProp) { LethalCan lethalCan = g.AddComponent<LethalCan>(); ((GrabbableObject)lethalCan).itemProperties = itemProp; ((GrabbableObject)lethalCan).grabbable = true; return g; } public void RunNetcodePatcher() { runonce = true; 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); } } } } } } namespace LC_LethalEnergy.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }