Decompiled source of Lethal Company Randomizer v1.12.0
LCRandomizerMod.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCRandomizerMod.Core.Config; using LCRandomizerMod.Core.Interfaces; using LCRandomizerMod.EnemyPatches; using LCRandomizerMod.Patches; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LCRandomizerMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCRandomizerMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("81438bbd-e163-458c-8a9e-317926231070")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LCRandomizerMod { internal class ClockDataContainer : MonoBehaviour { public int secondsPassed = 0; public int minutesPassed = 0; public bool tickOrTock = true; public float timeOfLastSecond; } internal class CrewInfo { private string name; private bool isDead; private bool isInsideFactory; private int enemyCount = 0; public string Name => name; public bool IsDead => isDead; public bool IsInsideFactory => isInsideFactory; public int EnemyCount => enemyCount; public CrewInfo(string name, bool isDead, bool isInsideFactory, Vector3 playerPos) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) this.name = name; this.isDead = isDead; this.isInsideFactory = isInsideFactory; enemyCount = GetEnemyCountAtPlayer(playerPos); } private int GetEnemyCountAtPlayer(Vector3 playerPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(playerPos, 20f, 2621448, (QueryTriggerInteraction)2); List<EnemyAI> list = new List<EnemyAI>(); if (array.Length != 0) { Collider[] array2 = array; foreach (Collider val in array2) { EnemyAI componentInParent = ((Component)val).gameObject.GetComponentInParent<EnemyAI>(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isEnemyDead && !list.Contains(componentInParent)) { list.Add(componentInParent); } } RandomizerModBase.mls.LogError((object)("ENEMY COUNT: " + list.Count)); } return list.Count; } } internal class CustomUI : NetworkBehaviour { private enum LookContext { InteractShipTP, InTerminalMenu, None } private GameObject canvasObject; private GameObject canvasTextObject; private Text canvasText; private Coroutine fadeCoroutine; private PlayerControllerB ownerPlayer; private LookContext context = LookContext.None; private bool updateOverridden = false; private void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00c1: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) canvasObject = new GameObject(); canvasObject.transform.parent = ((Component)this).transform; ((Object)canvasObject).name = "CustomUICanvas"; Canvas val = canvasObject.AddComponent<Canvas>(); canvasObject.SetActive(false); val.renderMode = (RenderMode)0; canvasObject.AddComponent<CanvasScaler>(); CanvasGroup val2 = canvasObject.AddComponent<CanvasGroup>(); val2.blocksRaycasts = false; canvasObject.AddComponent<GraphicRaycaster>(); canvasTextObject = new GameObject(); ((Object)canvasTextObject).name = "CustomUICanvasText"; Text val3 = (canvasText = canvasTextObject.AddComponent<Text>()); Transform transform = canvasTextObject.transform; Rect rect = ((Component)val).GetComponent<RectTransform>().rect; float num = ((Rect)(ref rect)).width / 2f - 20f; rect = ((Component)val).GetComponent<RectTransform>().rect; transform.localPosition = new Vector3(num, ((Rect)(ref rect)).height / 2f - 50f, 0f); val3.text = ""; val3.font = RandomizerModBase.modFont; val3.alignment = (TextAnchor)7; ((Graphic)val3).rectTransform.sizeDelta = new Vector2(500f, 400f); val3.fontSize = 26; ((Component)val3).transform.parent = canvasObject.transform; val3.supportRichText = true; ownerPlayer = GameNetworkManager.Instance.localPlayerController; } public static void BroadcastMessage(string msg, int fadeDuration = 0, bool includeServer = true) { //IL_0036: 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_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { char[] array = msg.ToCharArray(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4 + 2 * array.Length + 4, (Allocator)2, -1); int num = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); for (int i = 0; i < array.Length; i++) { ((FastBufferWriter)(ref val)).WriteValueSafe<char>(ref array[i], default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref fadeDuration, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBroadcastMsg", val, (NetworkDelivery)2); if (includeServer) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage(msg, fadeDuration); } } } public static void BroadcastMessage(string msg, int fadeDuration = 0, bool includeServer = true, params ulong[] clients) { //IL_0036: 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_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) if (NetworkManager.Singleton.IsServer) { char[] array = msg.ToCharArray(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4 + 2 * array.Length + 4, (Allocator)2, -1); int num = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); for (int i = 0; i < array.Length; i++) { ((FastBufferWriter)(ref val)).WriteValueSafe<char>(ref array[i], default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref fadeDuration, default(ForPrimitives)); foreach (ulong num2 in clients) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.lcrandomizermod_ClientReceivesBroadcastMsg", num2, val, (NetworkDelivery)2); } if (includeServer) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage(msg, fadeDuration); } } } public static void ProcessBroadcastMessage(ulong _, FastBufferReader reader) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) string text = ""; int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); char c = default(char); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe<char>(ref c, default(ForPrimitives)); text += c; } int duration = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref duration, default(ForPrimitives)); CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage(text, duration); } private void Update() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (updateOverridden || !ownerPlayer.isInHangarShipRoom) { return; } context = LookContext.None; RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)ownerPlayer.gameplayCamera).transform.position, ((Component)ownerPlayer.gameplayCamera).transform.forward, ref val, 3f, 2816)) { if ((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<Terminal>() != (Object)null && !ownerPlayer.inTerminalMenu) { context = LookContext.InTerminalMenu; SetText(RandomizerValues.mapRandomizedInTerminal ? "<color=red>Terminal Recalculating...</color>" : "<color=white>Available Commands\nRandom\nRevive</color>", overrideUpdate: false); Show(show: true); } else if ((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponentInParent<ShipTeleporter>() != (Object)null) { GrabbableObject currentlyHeldObjectServer = ownerPlayer.currentlyHeldObjectServer; object obj; if (currentlyHeldObjectServer == null) { obj = null; } else { GameObject gameObject = ((Component)currentlyHeldObjectServer).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<LungProp>() : null); } if ((Object)obj != (Object)null) { context = LookContext.InteractShipTP; SetText("<color=white>Insert Apparatus</color>", overrideUpdate: false); Show(show: true); } } } if (context == LookContext.None) { Show(show: false); } } public void SetText(string text, bool overrideUpdate = true) { canvasText.text = text; updateOverridden = overrideUpdate; } public void Show(bool show) { canvasObject.SetActive(show); } public void FadeOut(int duration = 0) { if (fadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(fadeCoroutine); } fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeTextOutCoroutine(duration)); } public void ShowLocalMessage(string msg, int duration = 0) { SetText(msg); Show(show: true); FadeOut(duration); } private IEnumerator FadeTextOutCoroutine(int duration) { float alpha = 1f; ((Graphic)canvasText).canvasRenderer.SetAlpha(alpha); yield return (object)new WaitForSeconds((float)duration); while (alpha > 0f) { alpha -= 0.01f; ((Graphic)canvasText).canvasRenderer.SetAlpha(alpha); yield return null; } Show(show: false); ((Graphic)canvasText).canvasRenderer.SetAlpha(1f); updateOverridden = false; } } internal class LidBehaviorCustom : MonoBehaviour, ICustomValue { private LidSaveData lidProperties = new LidSaveData(); private static Vector3 DefaultOffset = Vector3.zero; private GrabbableObject objectScript; private Item properties; private bool heldUp = false; private bool negatedDamage = false; private bool isBeingRaised = false; private bool isCurrentlyDiscarded = true; private Coroutine transitionCoroutine; private PlayerControllerB previousGuardedPlayer; public PlayerControllerB PreviousGuardedPlayer => previousGuardedPlayer; public int HP { get { return lidProperties.HP; } set { lidProperties.HP = value; } } public bool IsBroken { get { return lidProperties.IsBroken; } set { lidProperties.IsBroken = value; } } private void Awake() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) objectScript = ((Component)this).gameObject.GetComponent<GrabbableObject>(); properties = objectScript.itemProperties; if (!RandomizerValues.customGLids.ContainsKey(((NetworkBehaviour)objectScript).NetworkObjectId) && !RandomizerValues.startupInitializing) { RandomizerValues.customGLids.Add(((NetworkBehaviour)objectScript).NetworkObjectId, lidProperties); } if (DefaultOffset == Vector3.zero) { DefaultOffset = properties.positionOffset; } } private void Update() { if (negatedDamage) { lidProperties.HP--; negatedDamage = !negatedDamage; SyncNewHP(); if (lidProperties.HP < 1) { BreakLid(); } } if (objectScript.isBeingUsed) { if (!lidProperties.IsBroken) { SetGarbageLidUsed(!heldUp); isCurrentlyDiscarded = false; } else if ((Object)(object)objectScript.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage("<color=red>Garbage Lid is broken!</color>", 2); } objectScript.isBeingUsed = false; } if ((Object)(object)objectScript.playerHeldBy == (Object)null && !isCurrentlyDiscarded) { heldUp = false; if ((Object)(object)previousGuardedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { RandomizerModBase.mls.LogWarning((object)("Invalidated protection of: " + previousGuardedPlayer.playerUsername)); RandomizerValues.guardedByLid = false; } if (transitionCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(transitionCoroutine); } isBeingRaised = false; SetGarbageLidUsed(up: false, smoothRaise: false); isCurrentlyDiscarded = true; } } private void SetGarbageLidUsed(bool up, bool smoothRaise = true) { //IL_0030: 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) if (!isBeingRaised) { if (smoothRaise) { transitionCoroutine = ((MonoBehaviour)this).StartCoroutine(SmoothTransitionToNewPos(up)); } else { properties.positionOffset = DefaultOffset; } SetLidAsGuardingPlayer(up); heldUp = up; } } private void SyncNewHP() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0073: 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) if (NetworkManager.Singleton.IsServer) { SendHPToClients(((NetworkBehaviour)objectScript).NetworkObjectId, lidProperties.HP); return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)objectScript).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); int hP = lidProperties.HP; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref hP, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.lcrandomizermod_ServerReceivesLidHPSyncRQ", 0uL, val, (NetworkDelivery)2); } private void SyncBrokenState() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { SendBrokenStateToClients(((NetworkBehaviour)objectScript).NetworkObjectId); return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)objectScript).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.lcrandomizermod_ServerReceivesLidBrokenSyncRQ", 0uL, val, (NetworkDelivery)2); } private IEnumerator SmoothTransitionToNewPos(bool translateUp) { isBeingRaised = true; if (translateUp) { float limit = properties.positionOffset.y + 0.3f; while (properties.positionOffset.y <= limit) { Item obj = properties; obj.positionOffset += new Vector3(0f, 0.1f, 0f) * Time.deltaTime * 3.5f; yield return null; } } else { while (properties.positionOffset.y >= 0.2f) { Item obj2 = properties; obj2.positionOffset -= new Vector3(0f, 0.1f, 0f) * Time.deltaTime * 3.5f; yield return null; } } isBeingRaised = false; } private void BreakLid(bool sync = true) { if (!lidProperties.IsBroken) { SetGarbageLidUsed(lidProperties.IsBroken); lidProperties.IsBroken = true; if ((Object)(object)objectScript.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage("<color=red>You have broken your garbage lid.</color>", 2); } RandomizerModBase.mls.LogError((object)"LID BROKE"); if (sync) { SyncBrokenState(); } } } private void SetLidAsGuardingPlayer(bool active) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)(object)objectScript.playerHeldBy) { RandomizerValues.guardedByLid = active; previousGuardedPlayer = localPlayerController; } } public void NegateDamage() { if (!negatedDamage) { negatedDamage = true; } } public static void SetReceivedHPClient(ulong _, FastBufferReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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 (!NetworkManager.Singleton.IsServer) { ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); int hP = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref hP, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; GrabbableObject componentInChildren = ((Component)val).GetComponentInChildren<GrabbableObject>(); ((Component)componentInChildren).gameObject.GetComponent<LidBehaviorCustom>().HP = hP; RandomizerModBase.mls.LogError((object)("Set new hp of lid to: " + hP)); } } public static void SendReceivedHPToClients(ulong _, FastBufferReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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 (NetworkManager.Singleton.IsServer) { ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives)); int num2 = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num2, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[num]; GrabbableObject componentInChildren = ((Component)val).GetComponentInChildren<GrabbableObject>(); ((Component)componentInChildren).gameObject.GetComponent<LidBehaviorCustom>().HP = num2; RandomizerModBase.mls.LogError((object)("Received hp from client: " + num2 + " sent over network")); SendHPToClients(num, num2); } } private static void SendHPToClients(ulong id, int hp) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref id, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref hp, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesLidHPSync", val, (NetworkDelivery)2); } private static void SendBrokenStateToClients(ulong id) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref id, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesLidBrokenSync", val, (NetworkDelivery)2); } public static void SetLidBrokenSync(ulong _, FastBufferReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; GrabbableObject componentInChildren = ((Component)val).GetComponentInChildren<GrabbableObject>(); ((Component)componentInChildren).gameObject.GetComponent<LidBehaviorCustom>().BreakLid(sync: false); } } public static void ServerHandleLidBroken(ulong _, FastBufferReader reader) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; GrabbableObject componentInChildren = ((Component)val).GetComponentInChildren<GrabbableObject>(); LidBehaviorCustom component = ((Component)componentInChildren).gameObject.GetComponent<LidBehaviorCustom>(); component.BreakLid(sync: false); SendBrokenStateToClients(((NetworkBehaviour)component.objectScript).NetworkObjectId); } } public static void PostLoginSyncClient(ulong _, FastBufferReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); bool isBroken = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isBroken, default(ForPrimitives)); int hP = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref hP, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; GrabbableObject componentInChildren = ((Component)val).GetComponentInChildren<GrabbableObject>(); LidBehaviorCustom component = ((Component)componentInChildren).gameObject.GetComponent<LidBehaviorCustom>(); component.HP = hP; component.IsBroken = isBroken; } } public void SaveOnExit() { if (RandomizerValues.customGLids.Count > 0) { try { RandomizerModBase.mls.LogWarning((object)$"Saving {RandomizerValues.customGLids.Count} garbage lid states..."); ES3.Save<Dictionary<ulong, LidSaveData>>("glidCustom", RandomizerValues.customGLids, GameNetworkManager.Instance.currentSaveFileName); if (!RandomizerValues.keysToLoad.Contains("glidCustom")) { RandomizerValues.keysToLoad.Add("glidCustom"); } return; } catch (Exception ex) { RandomizerModBase.mls.LogError((object)("Exception caught during custom value serialization. [LidBehaviorCustom] " + ex.Message)); return; } } if (RandomizerValues.keysToLoad.Contains("glidCustom")) { RandomizerValues.keysToLoad.Remove("glidCustom"); } } public void ReloadStats() { if (RandomizerValues.customGLids.Count > 0) { RandomizerModBase.mls.LogInfo((object)$"Reloading {RandomizerValues.customGLids.Count} custom garbage lid states from list."); List<LidSaveData> list = RandomizerValues.customGLids.Values.ToList(); RandomizerValues.customGLids.Clear(); List<GrabbableObject> list2 = Object.FindObjectsOfType<GrabbableObject>().ToList(); List<GrabbableObject> list3 = list2.FindAll((GrabbableObject x) => ((Object)x).name.Contains("GarbageLid")); foreach (GrabbableObject item in list3) { ((Component)item).gameObject.AddComponent<LidBehaviorCustom>(); } int num = 0; { foreach (GrabbableObject item2 in list3) { if (num >= list.Count) { break; } LidBehaviorCustom component = ((Component)item2).gameObject.GetComponent<LidBehaviorCustom>(); component.lidProperties = new LidSaveData(list[num].IsBroken, list[num].HP); RandomizerValues.customGLids.Add(((NetworkBehaviour)component.objectScript).NetworkObjectId, component.lidProperties); num++; } return; } } RandomizerModBase.mls.LogInfo((object)"No custom garbage lid states to reload."); } public void SyncStatsWithClients() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); foreach (KeyValuePair<ulong, LidSaveData> customGLid in RandomizerValues.customGLids) { ((FastBufferWriter)(ref val))..ctor(13, (Allocator)2, -1); ulong key = customGLid.Key; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref key, default(ForPrimitives)); bool isBroken = customGLid.Value.IsBroken; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isBroken, default(ForPrimitives)); int hP = customGLid.Value.HP; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref hP, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesLidLoginSync", val, (NetworkDelivery)2); } } } internal class LidSaveData { [SerializeField] private bool isBroken; [SerializeField] private int hp; public bool IsBroken { get { return isBroken; } set { isBroken = value; } } public int HP { get { return hp; } set { hp = value; } } public LidSaveData() { isBroken = false; hp = new Random().Next(1, 6); } public LidSaveData(bool broken, int hp) { isBroken = broken; this.hp = hp; } } public class PandorasBoxItem : GrabbableObject { public void Awake() { base.itemProperties = GeneralExtensions.GetValueSafe<string, Item>(RandomizerValues.modItemsDict, "PandorasBoxItem"); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); ((GrabbableObject)this).EnableItemMeshes(true); ((MonoBehaviour)this).StartCoroutine(TeleportPlayer(this)); } public override void EquipItem() { RandomizerModBase.mls.LogError((object)"Picked up"); TestClientRpc(); } [ClientRpc] public void TestClientRpc() { if (NetworkManager.Singleton.IsServer) { RandomizerModBase.mls.LogError((object)"CLIENTRPC CALLED ON SERVER"); } else { RandomizerModBase.mls.LogError((object)"CLIENTRPC CALLED ON CLIENT"); } } public static IEnumerator TeleportPlayer(PandorasBoxItem pandorasBoxItem) { for (int i = 0; i < 10; i++) { GameNetworkManager.Instance.localPlayerController.TeleportPlayer(((Component)pandorasBoxItem).transform.position, false, 0f, true, true); yield return null; } } } [BepInPlugin("Tibnan.lcrandomizermod", "Lethal Company Randomizer Mod", "1.12.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RandomizerModBase : BaseUnityPlugin { public const string modName = "Lethal Company Randomizer Mod"; public const string modVersion = "1.12.0"; public const string modGUID = "Tibnan.lcrandomizermod"; private readonly Harmony harmony = new Harmony("Tibnan.lcrandomizermod"); public static ManualLogSource mls; private static RandomizerModBase Instance; public static Font modFont; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Lethal Company Randomizer Mod"); harmony.PatchAll(typeof(RandomizerModBase)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(TimeOfDayPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(TetraChemicalItemPatch)); harmony.PatchAll(typeof(ShotgunItemPatch)); harmony.PatchAll(typeof(MouthDogAIPatch)); harmony.PatchAll(typeof(SandSpiderAIPatch)); harmony.PatchAll(typeof(LandminePatch)); harmony.PatchAll(typeof(ForestGiantAIPatch)); harmony.PatchAll(typeof(JetpackItemPatch)); harmony.PatchAll(typeof(HoarderBugAIPatch)); harmony.PatchAll(typeof(ButlerAIPatch)); harmony.PatchAll(typeof(JesterAIPatch)); harmony.PatchAll(typeof(BaboonBirdAIPatch)); harmony.PatchAll(typeof(BlobAIPatch)); harmony.PatchAll(typeof(CrawlerAIPatch)); harmony.PatchAll(typeof(DressGirlAIPatch)); harmony.PatchAll(typeof(RadMechAIPatch)); harmony.PatchAll(typeof(NutcrackerAIPatch)); harmony.PatchAll(typeof(FlowermanAIPatch)); harmony.PatchAll(typeof(PufferAIPatch)); harmony.PatchAll(typeof(CentipedeAIPatch)); harmony.PatchAll(typeof(FlowerSnakeEnemyPatch)); harmony.PatchAll(typeof(SpringManAIPatch)); harmony.PatchAll(typeof(DoublewingAIPatch)); harmony.PatchAll(typeof(RedLocustBeesPatch)); harmony.PatchAll(typeof(ExtensionLadderItemPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(KnifeItemPatch)); harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(ShovelPatch)); harmony.PatchAll(typeof(TurretPatch)); harmony.PatchAll(typeof(WhoopieCushionItemPatch)); harmony.PatchAll(typeof(BoomboxItemPatch)); harmony.PatchAll(typeof(SpikeRoofTrapPatch)); harmony.PatchAll(typeof(GiftBoxItemPatch)); harmony.PatchAll(typeof(DeadBodyInfoPatch)); harmony.PatchAll(typeof(PreInitSceneScriptPatch)); harmony.PatchAll(typeof(FlashlightItemPatch)); harmony.PatchAll(typeof(KeyItemPatch)); harmony.PatchAll(typeof(ShipTeleporterPatch)); harmony.PatchAll(typeof(ShipAlarmCordPatch)); harmony.PatchAll(typeof(EntranceTeleportPatch)); harmony.PatchAll(typeof(RadMechMissilePatch)); harmony.PatchAll(typeof(VehicleControllerPatch)); harmony.PatchAll(typeof(ClaySurgeonAIPatch)); harmony.PatchAll(typeof(SprayPaintItemPatch)); harmony.PatchAll(typeof(CaveDwellerAIPatch)); harmony.PatchAll(typeof(MineshaftElevatorControllerPatch)); mls.LogInfo((object)"Patched all base classes."); mls.LogInfo((object)"Loading asset bundle."); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lcrm")); if ((Object)(object)val != (Object)null) { AudioClip val2 = val.LoadAsset<AudioClip>("Assets\\lcrm\\LCRM_audio.mp3"); if ((Object)(object)val2 == (Object)null) { mls.LogError((object)"Failed to load audio file."); } else { RandomizerValues.introAudio = val2; } VideoClip val3 = val.LoadAsset<VideoClip>("Assets\\lcrm\\LCRM_video.mp4"); if ((Object)(object)val3 == (Object)null) { mls.LogError((object)"Failed to load video file."); } else { RandomizerValues.introVideo = val3; } modFont = val.LoadAsset<Font>("Assets\\lcrm\\PerfectDOSVGA437.ttf"); } else { mls.LogError((object)"Failed to load asset bundle."); } RandomizerValues.SetupConfiguration(); mls.LogInfo((object)"Lethal Company Randomizer Mod Initialized!"); } } internal class RandomCarProperties { [SerializeField] private Vector3 scale; [SerializeField] private Color headlightColor; [SerializeField] private Color carColor; public Vector3 Scale => scale; public Color HeadlightColor => headlightColor; public Color CarColor => carColor; public RandomCarProperties() { Regenerate(); } public void Regenerate() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) //IL_0074: 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_00ca: Unknown result type (might be due to invalid IL or missing references) float num = Convert.ToSingle(new Random().Next(50, 151)) / 100f; scale = new Vector3(num, num, num); float num2 = (float)new Random().Next(1, 101) / 100f; float num3 = (float)new Random().Next(1, 101) / 100f; float num4 = (float)new Random().Next(1, 101) / 100f; headlightColor = new Color(num2, num3, num4); num2 = (float)new Random().Next(1, 301) / 100f; num3 = (float)new Random().Next(1, 301) / 100f; num4 = (float)new Random().Next(1, 301) / 100f; carColor = new Color(num2, num3, num4); RandomizerValues.randomCarProperties = this; RandomizerValues.randomizedCar = true; } } public enum ConfigurationKey { Baboon, Blob, BushWolf, Butler, CaveDweller, Centipede, ClaySurgeon, Crawler, Doublewing, DressGirl, Flowerman, FlowerSnake, ForestGiant, Hoarder, Jester, Dog, Nutcracker, Puffer, RadMech, RedLocust, SandSpider, SpringMan } internal static class RandomizerValues { public static bool isClientSynced = false; public static bool startupInitializing; public static List<string> keysToLoad = new List<string>(); public static Dictionary<string, AudioClip> audioDict = new Dictionary<string, AudioClip>(); public static bool audioDictLoaded = false; public static Dictionary<ulong, Vector3> itemResizeDict = new Dictionary<ulong, Vector3>(); public static AudioClip introAudio; public static VideoClip introVideo; public static Dictionary<string, Item> modItemsDict = new Dictionary<string, Item>(); public static Dictionary<ulong, Light> playerLightsDict = new Dictionary<ulong, Light>(); public static ConfigFile config = (ConfigFile)(((object)config) ?? ((object)new ConfigFile("Tibnan.lcrandomizermod", true))); public static Dictionary<ConfigurationKey, Action<Configuration>> configActions = new Dictionary<ConfigurationKey, Action<Configuration>> { { ConfigurationKey.Baboon, delegate(Configuration conf) { baboonConfig = conf; } }, { ConfigurationKey.Blob, delegate(Configuration conf) { blobConfig = conf; } }, { ConfigurationKey.BushWolf, delegate { } }, { ConfigurationKey.Butler, delegate(Configuration conf) { butlerConfig = conf; } }, { ConfigurationKey.CaveDweller, delegate(Configuration conf) { babyConfig = conf; } }, { ConfigurationKey.Centipede, delegate(Configuration conf) { centConfig = conf; } }, { ConfigurationKey.ClaySurgeon, delegate(Configuration conf) { surgeonConfig = conf as ClaySurgeonConfig; } }, { ConfigurationKey.Crawler, delegate(Configuration conf) { crawlerConfig = conf; } }, { ConfigurationKey.Doublewing, delegate(Configuration conf) { dWingConfig = conf; } }, { ConfigurationKey.DressGirl, delegate(Configuration conf) { girlConfig = conf; } }, { ConfigurationKey.Flowerman, delegate(Configuration conf) { flowerConfig = conf; } }, { ConfigurationKey.FlowerSnake, delegate(Configuration conf) { tulipConfig = conf; } }, { ConfigurationKey.ForestGiant, delegate(Configuration conf) { giantConfig = conf; } }, { ConfigurationKey.Hoarder, delegate(Configuration conf) { hoarderConfig = conf; } }, { ConfigurationKey.Jester, delegate(Configuration conf) { jesterConfig = conf; } }, { ConfigurationKey.Dog, delegate(Configuration conf) { dogConfig = conf; } }, { ConfigurationKey.Nutcracker, delegate(Configuration conf) { nutConfig = conf; } }, { ConfigurationKey.Puffer, delegate(Configuration conf) { puffConfig = conf; } }, { ConfigurationKey.RadMech, delegate(Configuration conf) { mechConfig = conf; } }, { ConfigurationKey.RedLocust, delegate(Configuration conf) { beeConfig = conf; } }, { ConfigurationKey.SandSpider, delegate(Configuration conf) { spiderConfig = conf as SandSpiderConfig; } }, { ConfigurationKey.SpringMan, delegate(Configuration conf) { springConfig = conf; } } }; public static bool voiceDistortion = true; public static Vector3 defaultPlayerScale = new Vector3(1f, 1f, 1f); public static uint defaultPlayerMaskLayer; public const float defaultPlayerPitch = 1f; public static Vector3 defaultPlayerHeadScale; public static Vector3 defaultPlayerBillboardScale; public static Vector3 defaultPlayerBillboardPos; public static Color defaultPlayerColor; public static float sprintRand; public static int healthRand; public static float movementSpeedRand; public static float sinkMultiplierRand; public static int currentMaxHP; public static Dictionary<ulong, Vector3> playerScaleDict = new Dictionary<ulong, Vector3>(); public static int quotaRand; public static int deadlineRand; public static bool firstTimeShow; public static float shipDoorAnimatorSpeed; public static Dictionary<string, Item> allItemsListDict = new Dictionary<string, Item>(); public static Dictionary<int, float> unlockableLuckDict = new Dictionary<int, float>(); public static int randomizedWeatherIdx; public static float factorySizeMultiplierRand; public static Configuration dogConfig = new Configuration(30, 200, 1, 6, 5, 400, ConfigurationKey.Dog); public static Dictionary<ulong, float> dogSpeedsDict = new Dictionary<ulong, float>(); public static Vector3 defaultDogScale = new Vector3(1f, 1f, 1f); public static int scrapValue; public static ulong scrapReference; public static float scrapWeight; public static SandSpiderConfig spiderConfig = new SandSpiderConfig(35, 100, 1, 7, 1, 30, 4, 13); public static Dictionary<ulong, float> spiderSpeedsDict = new Dictionary<ulong, float>(); public static Vector3 defaultSpiderScale = new Vector3(1f, 1f, 1f); public static Configuration giantConfig = new Configuration(20, 140, 1, 10, 5, 400, ConfigurationKey.ForestGiant); public static Dictionary<ulong, float> giantSpeedsDict = new Dictionary<ulong, float>(); public static Vector3 defaultGiantScale = new Vector3(1f, 1f, 1f); public static Dictionary<ulong, Tuple<float, float>> jetpackPropertiesDict = new Dictionary<ulong, Tuple<float, float>>(); public static Configuration hoarderConfig = new Configuration(20, 200, 1, 10, 1, 130, ConfigurationKey.Hoarder); public static Dictionary<ulong, float> hoarderBugSpeedsDict = new Dictionary<ulong, float>(); public static Configuration butlerConfig = new Configuration(5, 200, 1, 10, 5, 300, ConfigurationKey.Butler); public static Dictionary<ulong, float> butlerSpeedsDict = new Dictionary<ulong, float>(); public static Configuration jesterConfig = new Configuration(20, 200, 1, 10, 5, 30, ConfigurationKey.Jester); public static Dictionary<ulong, float> jesterSpeedsDict = new Dictionary<ulong, float>(); public static Configuration baboonConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.Baboon); public static Dictionary<ulong, float> baboonSpeedsDict = new Dictionary<ulong, float>(); public static Configuration blobConfig = new Configuration(5, 70, 1, 10, 5, 130, ConfigurationKey.Blob); public static Dictionary<ulong, float> blobSpeedsDict = new Dictionary<ulong, float>(); public static Configuration crawlerConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.Crawler); public static Dictionary<ulong, float> crawlerSpeedsDict = new Dictionary<ulong, float>(); public static Configuration girlConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.DressGirl); public static Dictionary<ulong, float> dressGirlSpeedsDict = new Dictionary<ulong, float>(); public static Configuration mechConfig = new Configuration(20, 200, 1, 10, 1, 30, ConfigurationKey.RadMech); public static Dictionary<ulong, float> radMechSpeedsDict = new Dictionary<ulong, float>(); public static int spawnedMechCount = 0; public static List<float> spawnedMechScales = new List<float>(); public static Configuration nutConfig = new Configuration(5, 2000, 1, 10, 1, 30, ConfigurationKey.Nutcracker); public static Dictionary<ulong, float> nutcrackerSpeedsDict = new Dictionary<ulong, float>(); public static Configuration flowerConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.Flowerman); public static Dictionary<ulong, float> flowermanSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<FlowermanAI, Coroutine> slowedFlowermen = new Dictionary<FlowermanAI, Coroutine>(); public static Configuration puffConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.Puffer); public static Dictionary<ulong, float> pufferSpeedsDict = new Dictionary<ulong, float>(); public static Configuration centConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.Centipede); public static Dictionary<ulong, float> centipedeSpeedsDict = new Dictionary<ulong, float>(); public static Configuration tulipConfig = new Configuration(20, 200, 1, 10, 5, 30, ConfigurationKey.FlowerSnake); public static Dictionary<ulong, float> flowerSnakeSpeedsDict = new Dictionary<ulong, float>(); public static Configuration springConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.SpringMan); public static Dictionary<ulong, float> springManSpeedsDict = new Dictionary<ulong, float>(); public static Configuration dWingConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.Doublewing); public static Dictionary<ulong, float> doublewingSpeedsDict = new Dictionary<ulong, float>(); public static Configuration beeConfig = new Configuration(20, 200, 1, 10, 5, 20, ConfigurationKey.RedLocust); public static Dictionary<ulong, float> redLocustSpeedsDict = new Dictionary<ulong, float>(); public static bool isRandomized = false; public static bool mapRandomizedInTerminal = false; public static Vector3 defaultTerminalScale; public static bool unblockResetRun = true; public static Dictionary<ulong, int> knifeDamageDict = new Dictionary<ulong, int>(); public static Dictionary<ulong, int> shovelDamageDict = new Dictionary<ulong, int>(); public static Dictionary<ulong, float> boomboxPitchDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, RFlashlightProperties> flashlightPropertyDict = new Dictionary<ulong, RFlashlightProperties>(); public static Dictionary<ulong, ChemicalEffects> chemicalEffectsDict = new Dictionary<ulong, ChemicalEffects>(); public static Dictionary<ulong, object> coroutineStorage = new Dictionary<ulong, object>(); public static bool blockAnims = false; public static List<ulong> superchargedKeys = new List<ulong>(); public static bool blockDespawn = false; public static Dictionary<bool, float> teleporterCooldowns = new Dictionary<bool, float>(); public static bool connectCoroutinePlaying = false; public static bool blockDrop = false; public static float cordPitch; public static bool entranceTPCoroutinePlaying = false; public static List<EntranceTeleport> blockedFireExits = new List<EntranceTeleport>(); public static RandomCarProperties randomCarProperties; public static bool randomizedCar = false; public static ClaySurgeonConfig surgeonConfig = new ClaySurgeonConfig(20, 200, 0, 0, 5, 20, 1, 5); public static Dictionary<ulong, float> surgeonSpeedDict = new Dictionary<ulong, float>(); public static Configuration babyConfig = new Configuration(3, 120, 1, 10, 25, 230, ConfigurationKey.CaveDweller); public static Dictionary<ulong, float> babySpeedDict = new Dictionary<ulong, float>(); public static bool elevatorMalfunctioned = false; public static Coroutine waitJumpCoroutine = null; public static Coroutine waitJumpLandCoroutine = null; public static Dictionary<ulong, int> clockSecondsToAdd = new Dictionary<ulong, int>(); public static bool guardedByLid = false; public static Dictionary<ulong, LidSaveData> customGLids = new Dictionary<ulong, LidSaveData>(); public static void ReleaseResources(bool deleteAll) { dogSpeedsDict.Clear(); spiderSpeedsDict.Clear(); giantSpeedsDict.Clear(); hoarderBugSpeedsDict.Clear(); butlerSpeedsDict.Clear(); jesterSpeedsDict.Clear(); baboonSpeedsDict.Clear(); blobSpeedsDict.Clear(); crawlerSpeedsDict.Clear(); dressGirlSpeedsDict.Clear(); radMechSpeedsDict.Clear(); nutcrackerSpeedsDict.Clear(); flowermanSpeedsDict.Clear(); pufferSpeedsDict.Clear(); centipedeSpeedsDict.Clear(); flowerSnakeSpeedsDict.Clear(); springManSpeedsDict.Clear(); doublewingSpeedsDict.Clear(); redLocustSpeedsDict.Clear(); spawnedMechScales.Clear(); itemResizeDict.Clear(); blockedFireExits.Clear(); playerScaleDict.Clear(); slowedFlowermen.Clear(); surgeonSpeedDict.Clear(); babySpeedDict.Clear(); if (deleteAll) { knifeDamageDict.Clear(); shovelDamageDict.Clear(); jetpackPropertiesDict.Clear(); boomboxPitchDict.Clear(); flashlightPropertyDict.Clear(); superchargedKeys.Clear(); chemicalEffectsDict.Clear(); coroutineStorage.Clear(); teleporterCooldowns.Clear(); playerLightsDict.Clear(); customGLids.Clear(); unlockableLuckDict.Clear(); blockAnims = false; blockDespawn = false; blockDrop = false; connectCoroutinePlaying = false; spawnedMechCount = 0; entranceTPCoroutinePlaying = false; randomizedCar = false; randomCarProperties = null; elevatorMalfunctioned = false; guardedByLid = false; mapRandomizedInTerminal = false; } } public static void ResetConfiguration() { giantConfig.Reset(); } public static void SetupConfiguration() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown ConfigEntry<bool> voiceConf = config.Bind<bool>("General", "Voice Distortion", true, "Enables voice distortion based on player size."); voiceDistortion = voiceConf.Value; voiceConf.SettingChanged += delegate { voiceDistortion = voiceConf.Value; }; BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(voiceConf, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); IEnumerable<Type> enumerable = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IConfigurable).IsAssignableFrom(t) && !t.IsInterface select t; foreach (Type item in enumerable) { IConfigurable configurable = (IConfigurable)Activator.CreateInstance(item); configurable.SetupConfig(); } } public static void TransferHostConfig(ulong receiver) { TransferInternal(receiver); } private static void TransferInternal(ulong receiver) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_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_009e: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(2, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref mapRandomizedInTerminal, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref voiceDistortion, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.lcrandomizermod_ClientReceivesGenHostConfig", receiver, val, (NetworkDelivery)2); ((FastBufferWriter)(ref val)).Dispose(); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(32, (Allocator)2, -1); int num = 1; ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<Configuration>(ref giantConfig, default(ForNetworkSerializable)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.lcrandomizermod_ClientReceivesHostConfig", receiver, val2, (NetworkDelivery)2); } public static void SetHostConfig(ulong _, FastBufferReader reader) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0057: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref mapRandomizedInTerminal, default(ForPrimitives)); RandomizerModBase.mls.LogInfo((object)("Terminal state now: " + mapRandomizedInTerminal)); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref voiceDistortion, default(ForPrimitives)); RandomizerModBase.mls.LogInfo((object)("Voice distortion: " + voiceDistortion)); } } public static void SetConfiguration(ulong _, FastBufferReader reader) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { int num = 0; ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); Configuration configuration = default(Configuration); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe<Configuration>(ref configuration, default(ForNetworkSerializable)); configActions[configuration.Key](configuration); } } } } internal class RFlashlightProperties { [SerializeField] private Color bulbColor; [SerializeField] private Color flashlightBodyColor; [SerializeField] private float intensity; public Color BulbColor => bulbColor; public Color FlashlightBodyColor => flashlightBodyColor; public float Intensity => intensity; public RFlashlightProperties() { //IL_004b: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) float num = (float)new Random().Next(1, 101) / 100f; float num2 = (float)new Random().Next(1, 101) / 100f; float num3 = (float)new Random().Next(1, 101) / 100f; bulbColor = new Color(num, num2, num3); num = (float)new Random().Next(1, 101) / 100f; num2 = (float)new Random().Next(1, 101) / 100f; num3 = (float)new Random().Next(1, 101) / 100f; flashlightBodyColor = new Color(num, num2, num3); intensity = (float)new Random().Next(1, 21) / 10f; } public RFlashlightProperties(Color bulbColor, Color flashlightBodyColor, float intensity) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) this.bulbColor = bulbColor; this.flashlightBodyColor = flashlightBodyColor; this.intensity = intensity; } public override string ToString() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) string[] obj = new string[6] { "BulbColor: ", null, null, null, null, null }; Color val = bulbColor; obj[1] = ((object)(Color)(ref val)).ToString(); obj[2] = " FlashlightBodyColor: "; val = flashlightBodyColor; obj[3] = ((object)(Color)(ref val)).ToString(); obj[4] = " Intensity: "; obj[5] = intensity.ToString(); return string.Concat(obj); } } public class SaveProcessor<T> where T : NetworkBehaviour { private static object buffer; private static int idx; public static void Save(string key) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) SaveAtPoint(((Component)(object)Object.FindObjectOfType<T>()).transform.position, key); } private static void SaveAtPoint(Vector3 pos, string key) { //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) switch (key) { case "knifeStatsDict": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "jetpackDict": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "shovelStatsDict": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "boomboxStatsDict": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "flashlightDict": RearrangeDictionary<ulong, RFlashlightProperties>(RandomizerValues.flashlightPropertyDict, pos); SaveOrderedDict(key, RandomizerValues.flashlightPropertyDict, pos); break; case "tzpChemDict": RearrangeDictionary<ulong, ChemicalEffects>(RandomizerValues.chemicalEffectsDict, pos); SaveOrderedDict(key, RandomizerValues.chemicalEffectsDict, pos); break; case "superKeys": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "tpCooldowns": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "randomCarProps": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "glidCustom": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "luckDict": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; case "mapRandomized": RearrangeDictionary<ulong, float>(RandomizerValues.boomboxPitchDict, pos); break; default: throw new ArgumentException("Invalid key."); } } private static List<ulong> GetSaveItemIDs(Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(pos, 10f); List<ulong> list = new List<ulong>(); Collider[] array2 = array; foreach (Collider val in array2) { T component = ((Component)val).gameObject.GetComponent<T>(); if ((Object)(object)component != (Object)null) { list.Add(((NetworkBehaviour)component).NetworkObjectId); } } return list; } private static void SaveOrderedDict<TKey, TValue>(string key, Dictionary<TKey, TValue> dict, Vector3 pos) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (dict.Count > 0) { RandomizerModBase.mls.LogWarning((object)string.Format("[SaveProcessor]: Saving {0}" + typeof(T).Name + " entries", dict.Count)); try { ES3.Save<Dictionary<TKey, TValue>>(key, dict, GameNetworkManager.Instance.currentSaveFileName); ES3.Save<Vector3>(key + "_pos", pos, GameNetworkManager.Instance.currentSaveFileName); if (!RandomizerValues.keysToLoad.Contains(key)) { RandomizerValues.keysToLoad.Add(key); } foreach (KeyValuePair<TKey, TValue> item in dict) { RandomizerModBase.mls.LogError((object)("Saving " + typeof(T).Name + " entry: " + item.Key?.ToString() + " " + item.Value.ToString())); } return; } catch (Exception ex) { RandomizerModBase.mls.LogError((object)("Exception caught during custom value serialization. [FlahlightItem (SaveProcessor)] " + ex.Message)); return; } } if (RandomizerValues.keysToLoad.Contains(key)) { RandomizerValues.keysToLoad.Remove(key); } } private static void RearrangeDictionary<TKey, TValue>(Dictionary<ulong, TValue> dict, Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) dict.OrderBy((KeyValuePair<ulong, TValue> x) => Vector3.Distance(pos, ((Component)(object)Object.FindObjectsOfType<T>().First((T y) => ((NetworkBehaviour)y).NetworkObjectId == x.Key)).transform.position)); } public static void Load(string key) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_005b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ES3.Load<Vector3>(key + "_pos", GameNetworkManager.Instance.currentSaveFileName); ManualLogSource mls = RandomizerModBase.mls; string obj = typeof(T)?.ToString(); Vector3 val2 = val; mls.LogError((object)("Loaded load point for type " + obj + " at " + ((object)(Vector3)(ref val2)).ToString())); LoadAtPoint(val, key); } private static void LoadAtPoint(Vector3 pos, string key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) LoadOrderedItems(pos, key); } private static void LoadOrderedItems(Vector3 pos, string key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(pos, 10f); Collider[] array2 = array; foreach (Collider val in array2) { T component = ((Component)val).gameObject.GetComponent<T>(); if ((Object)(object)component != (Object)null) { ReloadItem(component, GetActionByKey(key)); } } buffer = null; idx = 0; } private static Action<T> GetActionByKey(string key) { if (!(key == "flashlightDict")) { if (key == "tzpChemDict") { return delegate(T x) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00d2: Unknown result type (might be due to invalid IL or missing references) object obj2 = x; TetraChemicalItem val2 = (TetraChemicalItem)((obj2 is TetraChemicalItem) ? obj2 : null); switch ((buffer as List<ChemicalEffects>).ElementAt(idx)) { case ChemicalEffects.ShrinkPlayer: ((Renderer)((GrabbableObject)val2).mainObjectRenderer).material.color = new Color(0f, 0f, 0.5f); break; case ChemicalEffects.HealPlayer: ((Renderer)((GrabbableObject)val2).mainObjectRenderer).material.color = new Color(0.5f, 0f, 0f); break; case ChemicalEffects.MakePlayerGlow: ((Renderer)((GrabbableObject)val2).mainObjectRenderer).material.color = new Color(0.5f, 0.5f, 0f); break; case ChemicalEffects.DamagePlayer: ((Renderer)((GrabbableObject)val2).mainObjectRenderer).material.color = new Color(0.5f, 0f, 0.5f); break; } idx++; }; } return delegate { }; } return delegate(T x) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (buffer == null) { buffer = RandomizerValues.flashlightPropertyDict.Values.ToList(); RandomizerValues.flashlightPropertyDict.Clear(); } RandomizerModBase.mls.LogError((object)("Reloading flashlight with counter: " + idx + " buffer length: " + (buffer as List<RFlashlightProperties>).Count)); object obj = x; FlashlightItem val = (FlashlightItem)((obj is FlashlightItem) ? obj : null); RFlashlightProperties rFlashlightProperties = (buffer as List<RFlashlightProperties>).ElementAt(idx); RandomizerModBase.mls.LogError((object)("Loading flashlight props for item " + idx + " " + rFlashlightProperties.ToString())); val.flashlightBulb.color = rFlashlightProperties.BulbColor; val.flashlightBulb.intensity = rFlashlightProperties.Intensity; ((Renderer)((GrabbableObject)val).mainObjectRenderer).material.color = rFlashlightProperties.FlashlightBodyColor; RandomizerValues.flashlightPropertyDict.Add(((NetworkBehaviour)val).NetworkObjectId, rFlashlightProperties); idx++; }; } private static void ReloadItem(T component, Action<T> action) { action(component); } } internal class WeedKillerFlowermanInteract : NetworkBehaviour { private SprayPaintItem wkScript; private float cooldown = 0f; public void Start() { wkScript = ((Component)this).gameObject.GetComponent<SprayPaintItem>(); } public void Update() { Traverse val = Traverse.Create((object)wkScript); if (!(val.Field("sprayCanTank").GetValue<float>() <= 0f) && !(val.Field("sprayCanShakeMeter").GetValue<float>() <= 0f) && !((Object)(object)((GrabbableObject)wkScript).playerHeldBy == (Object)null)) { if (((GrabbableObject)wkScript).isBeingUsed && cooldown <= 0f) { DoFlowermanHit(); } if (cooldown > 0f) { cooldown -= Time.deltaTime; } } } private void DoFlowermanHit() { //IL_0016: 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_0050: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(((Component)((GrabbableObject)wkScript).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)wkScript).playerHeldBy.gameplayCamera).transform.forward, ref val, 5f, 524288)) { return; } Collider[] array = Physics.OverlapSphere(((RaycastHit)(ref val)).point, 2f, 524288, (QueryTriggerInteraction)2); FlowermanAI val2 = null; Collider[] array2 = array; foreach (Collider val3 in array2) { FlowermanAI componentInParent = ((Component)((Component)val3).transform).GetComponentInParent<FlowermanAI>(); if ((Object)(object)componentInParent != (Object)null && !((EnemyAI)componentInParent).isEnemyDead) { val2 = componentInParent; break; } } if ((Object)(object)val2 != (Object)null && !((EnemyAI)val2).isEnemyDead) { ((EnemyAI)val2).HitEnemy(1, ((GrabbableObject)wkScript).playerHeldBy, false, -1); if (!RandomizerValues.slowedFlowermen.ContainsKey(val2)) { RandomizerValues.slowedFlowermen.Add(val2, ((MonoBehaviour)this).StartCoroutine(RemoveFlowermanWithDelay(val2))); } else { ((MonoBehaviour)this).StopCoroutine(GeneralExtensions.GetValueSafe<FlowermanAI, Coroutine>(RandomizerValues.slowedFlowermen, val2)); RandomizerValues.slowedFlowermen[val2] = ((MonoBehaviour)this).StartCoroutine(RemoveFlowermanWithDelay(val2)); } cooldown = 1f; } } private IEnumerator RemoveFlowermanWithDelay(FlowermanAI flowerman) { yield return (object)new WaitForSeconds(2f); RandomizerValues.slowedFlowermen.Remove(flowerman); } } } namespace LCRandomizerMod.Patches { [HarmonyPatch(typeof(BoomboxItem))] internal class BoomboxItemPatch : ICustomValue { [HarmonyPatch("StartMusic")] [HarmonyPostfix] public static void PitchOverride(BoomboxItem __instance) { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) __instance.boomboxAudio.Stop(); __instance.boomboxAudio.PlayOneShot(__instance.stopAudios[Random.Range(0, __instance.stopAudios.Length)]); if (NetworkManager.Singleton.IsServer && !RandomizerValues.boomboxPitchDict.ContainsKey(((NetworkBehaviour)__instance).NetworkObjectId)) { __instance.boomboxAudio.pitch = (float)new Random().Next(50, 301) / 100f; int num = __instance.musicRandomizer.Next(0, __instance.musicAudios.Length); __instance.boomboxAudio.clip = __instance.musicAudios[num]; RandomizerValues.boomboxPitchDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, __instance.boomboxAudio.pitch); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); float pitch = __instance.boomboxAudio.pitch; ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitch, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBoomboxPitch", val, (NetworkDelivery)2); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(12, (Allocator)2, -1); networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref num, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBoomboxMChange", val2, (NetworkDelivery)2); __instance.boomboxAudio.Play(); } else { __instance.boomboxAudio.pitch = GeneralExtensions.GetValueSafe<ulong, float>(RandomizerValues.boomboxPitchDict, ((NetworkBehaviour)__instance).NetworkObjectId); if (NetworkManager.Singleton.IsServer && ((GrabbableObject)__instance).isBeingUsed) { RandomizerModBase.mls.LogError((object)("SENDING MUSIC SWITCH!!" + ((GrabbableObject)__instance).isBeingUsed + " " + __instance.isPlayingMusic)); ChangeMusicAndSend(((NetworkBehaviour)__instance).NetworkObjectId); } else if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController && ((GrabbableObject)__instance).isBeingUsed) { FastBufferWriter val3 = default(FastBufferWriter); ((FastBufferWriter)(ref val3))..ctor(8, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val3)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.lcrandomizermod_ServerInvokeMusicChange", 0uL, val3, (NetworkDelivery)2); } } } public static void SetBoomboxPitch(ulong _, FastBufferReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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 (!NetworkManager.Singleton.IsServer) { ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives)); if (!RandomizerValues.boomboxPitchDict.ContainsKey(key)) { RandomizerValues.boomboxPitchDict.Add(key, num); } NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; BoomboxItem componentInChildren = ((Component)val).gameObject.GetComponentInChildren<BoomboxItem>(); componentInChildren.boomboxAudio.pitch = num; } } public void SaveOnExit() { if (RandomizerValues.boomboxPitchDict.Count > 0) { try { ES3.Save<Dictionary<ulong, float>>("boomboxStatsDict", RandomizerValues.boomboxPitchDict, GameNetworkManager.Instance.currentSaveFileName); if (!RandomizerValues.keysToLoad.Contains("boomboxStatsDict")) { RandomizerValues.keysToLoad.Add("boomboxStatsDict"); } return; } catch (Exception ex) { RandomizerModBase.mls.LogError((object)("Exception caught during custom value serialization. [BoomboxItem] " + ex.Message)); return; } } if (RandomizerValues.keysToLoad.Contains("boomboxStatsDict")) { RandomizerValues.keysToLoad.Remove("boomboxStatsDict"); } } public void ReloadStats() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown if (RandomizerValues.boomboxPitchDict.Count > 0) { int num = 0; RandomizerModBase.mls.LogInfo((object)$"Reloading {RandomizerValues.boomboxPitchDict.Count} boombox entry from dictionary. "); List<float> list = RandomizerValues.boomboxPitchDict.Values.ToList(); RandomizerValues.boomboxPitchDict.Clear(); List<Object> list2 = Object.FindObjectsByType(typeof(BoomboxItem), (FindObjectsSortMode)0).ToList(); foreach (Object item in list2) { BoomboxItem val = (BoomboxItem)item; RandomizerModBase.mls.LogInfo((object)((NetworkBehaviour)val).NetworkObjectId); if (num >= list.Count) { break; } val.boomboxAudio.pitch = list.ElementAt(num); RandomizerValues.boomboxPitchDict.Add(((NetworkBehaviour)val).NetworkObjectId, list.ElementAt(num)); num++; } RandomizerModBase.mls.LogInfo((object)"Reloaded boombox stats from dictionary."); } else { RandomizerModBase.mls.LogInfo((object)"No boombox stats to reload."); } } public void SyncStatsWithClients() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_006b: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); foreach (KeyValuePair<ulong, float> item in RandomizerValues.boomboxPitchDict) { ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ulong key = item.Key; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref key, default(ForPrimitives)); float value = item.Value; ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref value, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBoomboxPitch", val, (NetworkDelivery)2); } } public static void ClientChangeMusic(ulong _, FastBufferReader reader) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0036: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; BoomboxItem componentInChildren = ((Component)val).gameObject.GetComponentInChildren<BoomboxItem>(); RandomizerModBase.mls.LogError((object)("CLIENT RECEIVED MUSIC CHANGE!!" + ((GrabbableObject)componentInChildren).isBeingUsed + " " + componentInChildren.isPlayingMusic)); componentInChildren.boomboxAudio.clip = componentInChildren.musicAudios[num]; componentInChildren.boomboxAudio.Play(); } } public static void ChangeMusicAndSend(ulong boomboxID) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) RandomizerModBase.mls.LogError((object)"CHANGING MUSIC AND SENDING"); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[boomboxID]; BoomboxItem componentInChildren = ((Component)val).gameObject.GetComponentInChildren<BoomboxItem>(); int num = componentInChildren.musicRandomizer.Next(0, componentInChildren.musicAudios.Length); componentInChildren.boomboxAudio.clip = componentInChildren.musicAudios[num]; componentInChildren.boomboxAudio.Play(); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(12, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)componentInChildren).NetworkObjectId; ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref num, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBoomboxMChange", val2, (NetworkDelivery)2); } public static void ServerReceivesMusicChangeRequest(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ulong boomboxID = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref boomboxID, default(ForPrimitives)); RandomizerModBase.mls.LogError((object)"SERVER RECEIVED MUSIC CHANGE REQUEST"); ChangeMusicAndSend(boomboxID); } } [HarmonyPatch(typeof(ClockProp))] internal class ClockPropPatch { [HarmonyPatch("__initializeVariables")] [HarmonyPostfix] public static void SpeedUpClockRandomly(ClockProp __instance) { if (NetworkManager.Singleton.IsServer) { RandomizerModBase.mls.LogError((object)"Speeding up 1 clock"); if (!RandomizerValues.clockSecondsToAdd.ContainsKey(((NetworkBehaviour)__instance).NetworkObjectId)) { ((Component)__instance).gameObject.AddComponent<ClockDataContainer>(); RandomizerValues.clockSecondsToAdd.Add(((NetworkBehaviour)__instance).NetworkObjectId, new Random().Next(0, 2)); } } } [HarmonyPatch("Update")] [HarmonyPrefix] public static bool AddSeconds(ClockProp __instance) { ((Component)__instance).gameObject.GetComponentInChildren<GrabbableObject>().Update(); ClockDataContainer component = ((Component)__instance).gameObject.GetComponent<ClockDataContainer>(); if (Time.realtimeSinceStartup - component.timeOfLastSecond > 0.5f) { __instance.secondHand.Rotate(-6f, 0f, 0f, (Space)1); component.secondsPassed++; if (component.secondsPassed >= 60) { component.secondsPassed = 0; component.minutesPassed++; __instance.minuteHand.Rotate(-6f, 0f, 0f, (Space)1); } if (component.minutesPassed > 60) { component.minutesPassed = 0; __instance.hourHand.Rotate(-30f, 0f, 0f, (Space)1); } component.timeOfLastSecond = Time.realtimeSinceStartup; component.tickOrTock = !component.tickOrTock; __instance.tickAudio.PlayOneShot(component.tickOrTock ? __instance.tickSFX : __instance.tockSFX); } return false; } } [HarmonyPatch(typeof(DeadBodyInfo))] internal class DeadBodyInfoPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void ResizeDeadBody(DeadBodyInfo __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ((Component)__instance).gameObject.transform.localScale = ((Component)__instance.playerScript).gameObject.transform.localScale; ((Component)__instance).gameObject.GetComponentInChildren<Renderer>().material.color = ((Renderer)__instance.playerScript.thisPlayerModel).material.color; } } [HarmonyPatch(typeof(EntranceTeleport))] internal class EntranceTeleportPatch { private enum FireExitBehaviour { ShowShipSafetyStatus, TeleportPlayerToShip, TempStaminaBoost, DropAllHeldItems, PermanentlyBlockExit, ReceiveCrewData, KillPlayer, TempBlindness } private enum ShipSafetyState { Safe, Dangerous, Caution } [HarmonyPatch("TeleportPlayer")] [HarmonyPrefix] public static bool RunRandomBehaviourOnUse(EntranceTeleport __instance) { //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) if (RandomizerValues.blockedFireExits.Contains(__instance)) { HUDManager.Instance.DisplayTip("Obstructed", "The other end appears to be blocked.", false, false, "LC_Tip1"); return false; } if (RandomizerValues.entranceTPCoroutinePlaying) { return true; } RandomizerModBase.mls.LogWarning((object)"Current state:"); RandomizerModBase.mls.LogWarning((object)("entrance id: " + __instance.entranceId)); RandomizerModBase.mls.LogWarning((object)("player in factory? " + GameNetworkManager.Instance.localPlayerController.isInsideFactory)); if (__instance.entranceId != 0 && GameNetworkManager.Instance.localPlayerController.isInsideFactory && new Random().Next(1, 6) == 1) { FireExitBehaviour[] array = Enum.GetValues(typeof(FireExitBehaviour)) as FireExitBehaviour[]; switch (array[new Random().Next(0, array.Length)]) { case FireExitBehaviour.ShowShipSafetyStatus: if (!RandomizerValues.entranceTPCoroutinePlaying) { RandomizerValues.entranceTPCoroutinePlaying = true; ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ShowShipSafetyStatusCoroutine()); } break; case FireExitBehaviour.TeleportPlayerToShip: GameNetworkManager.Instance.localPlayerController.TeleportPlayer(TerminalPatch.GetPlayerSpawnPosition((int)GameNetworkManager.Instance.localPlayerController.playerClientId), false, 0f, false, true); break; case FireExitBehaviour.TempStaminaBoost: if (!RandomizerValues.entranceTPCoroutinePlaying) { RandomizerValues.entranceTPCoroutinePlaying = true; ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(GiveTemporaryStaminaBoost()); } break; case FireExitBehaviour.DropAllHeldItems: GameNetworkManager.Instance.localPlayerController.DropAllHeldItems(true, false); break; case FireExitBehaviour.PermanentlyBlockExit: { if (NetworkManager.Singleton.IsServer) { PermanentlyBlockExitLocal(__instance); SendBlockedExit(__instance); break; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.lcrandomizermod_ServerBlockExit", 0uL, val, (NetworkDelivery)2); break; } case FireExitBehaviour.ReceiveCrewData: if (!RandomizerValues.entranceTPCoroutinePlaying) { RandomizerValues.entranceTPCoroutinePlaying = true; ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(DisplayCrewStatusCoroutine()); } break; case FireExitBehaviour.KillPlayer: GameNetworkManager.Instance.localPlayerController.KillPlayer(GameNetworkManager.Instance.localPlayerController.velocityLastFrame, true, (CauseOfDeath)0, 0, default(Vector3)); break; case FireExitBehaviour.TempBlindness: if (!RandomizerValues.entranceTPCoroutinePlaying) { RandomizerValues.entranceTPCoroutinePlaying = true; ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(GiveTemporaryBlindness()); } break; } } return true; } public static IEnumerator ShowShipSafetyStatusCoroutine() { CustomUI playerUI = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); switch (GetShipSafety()) { case ShipSafetyState.Safe: playerUI.ShowLocalMessage("<color=blue>Ship Status</color>\n<color=green>Safe</color>", 3); RandomizerValues.entranceTPCoroutinePlaying = false; break; case ShipSafetyState.Caution: playerUI.ShowLocalMessage("<color=blue>Ship Status</color>\n<color=yellow>Excercise caution</color>", 3); RandomizerValues.entranceTPCoroutinePlaying = false; break; case ShipSafetyState.Dangerous: playerUI.ShowLocalMessage("<color=blue>Ship Status</color>\n<color=red>Dangerous</color>", 3); RandomizerValues.entranceTPCoroutinePlaying = false; break; } yield break; } private static ShipSafetyState GetShipSafety() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(((Component)Object.FindObjectOfType<Terminal>()).transform.position, 50f, 2621448, (QueryTriggerInteraction)2); List<EnemyAI> list = new List<EnemyAI>(); if (array.Length != 0) { Collider[] array2 = array; foreach (Collider val in array2) { EnemyAI componentInParent = ((Component)val).gameObject.GetComponentInParent<EnemyAI>(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isEnemyDead && !componentInParent.enemyType.isDaytimeEnemy) { RandomizerModBase.mls.LogError((object)componentInParent.enemyType.enemyName); if (!list.Contains(componentInParent)) { list.Add(componentInParent); } } } if (list.Count == 1) { return ShipSafetyState.Caution; } if (list.Count > 1) { return ShipSafetyState.Dangerous; } return ShipSafetyState.Safe; } return ShipSafetyState.Safe; } public static IEnumerator GiveTemporaryStaminaBoost() { RandomizerModBase.mls.LogWarning((object)"RUNNING COROUTINE"); PlayerControllerB localPlayer = GameNetworkManager.Instance.localPlayerController; float origSpeed = localPlayer.movementSpeed; localPlayer.movementSpeed *= 2f; CustomUI playerUI = ((Component)localPlayer).gameObject.GetComponent<CustomUI>(); int timer = 30; playerUI.SetText($"Speed Boost: {timer}"); playerUI.Show(show: true); while (timer > 0) { timer--; playerUI.SetText($"Speed Boost: {timer}"); yield return (object)new WaitForSeconds(1f); } localPlayer.movementSpeed = origSpeed; playerUI.FadeOut(); RandomizerModBase.mls.LogError((object)"Coroutine ended"); RandomizerValues.entranceTPCoroutinePlaying = false; } public static void ServerBlockExitAndSync(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; EntranceTeleport componentInChildren = ((Component)val).gameObject.GetComponentInChildren<EntranceTeleport>(); PermanentlyBlockExitLocal(componentInChildren); SendBlockedExit(componentInChildren); } public static void SendBlockedExit(EntranceTeleport __instance) { //IL_0018: 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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ExitHasBeenBlocked", val, (NetworkDelivery)2); } public static void ClientExitIDResolver(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; EntranceTeleport componentInChildren = ((Component)val).gameObject.GetComponentInChildren<EntranceTeleport>(); PermanentlyBlockExitLocal(componentInChildren); } public static void PermanentlyBlockExitLocal(EntranceTeleport __instance) { RandomizerModBase.mls.LogError((object)("BEFORE: " + RandomizerValues.blockedFireExits.Count)); RandomizerModBase.mls.LogWarning((object)("ID: " + __instance.entranceId)); RandomizerValues.blockedFireExits.Add(__instance); EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); EntranceTeleport[] array2 = array; foreach (EntranceTeleport val in array2) { if (val.entranceId == __instance.entranceId && !RandomizerValues.blockedFireExits.Contains(val)) { RandomizerModBase.mls.LogError((object)("Blocked entrance of exit point: " + __instance.entranceId)); RandomizerValues.blockedFireExits.Add(val); break; } } RandomizerModBase.mls.LogError((object)("AFTER: " + RandomizerValues.blockedFireExits.Count)); } public static IEnumerator DisplayCrewStatusCoroutine() { RandomizerValues.entranceTPCoroutinePlaying = true; PlayerControllerB localPlayer = GameNetworkManager.Instance.localPlayerController; CustomUI playerUI = ((Component)localPlayer).gameObject.GetComponent<CustomUI>(); List<CrewInfo> crewInfo = CollectCrewInfo(); StringBuilder sb = new StringBuilder(); foreach (CrewInfo member in crewInfo) { sb.Append(member.Name); sb.Append(": "); sb.Append(member.IsDead ? "<color=red>DECEASED</color>" : "<color=green>ALIVE</color>"); sb.Append(", "); sb.Append(member.IsInsideFactory ? "IN BUILDING, " : "OUTSIDE, "); sb.Append((member.EnemyCount > 1) ? "<color=red>IN DANGER</color>" : "<color=green>SAFE</color>"); sb.Append("\n"); } RandomizerModBase.mls.LogWarning((object)("RESULT: " + sb.ToString())); playerUI.SetText($"<color=blue>Crew Status:</color>\n{sb.ToString()}"); playerUI.Show(show: true); int timer = 10; while (timer > 0) { timer--; yield return (object)new WaitForSeconds(1f); } playerUI.FadeOut(); RandomizerValues.entranceTPCoroutinePlaying = false; } private static List<CrewInfo> CollectCrewInfo() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) List<CrewInfo> list = new List<CrewInfo>(); RandomizerModBase.mls.LogInfo((object)("ALL PLAYER SCRIPTS: " + StartOfRound.Instance.allPlayerScripts.Length)); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled || val.isPlayerDead) { list.Add(new CrewInfo(val.playerUsername, val.isPlayerDead, val.isInsideFactory, ((Component)val).transform.position)); } } RandomizerModBase.mls.LogInfo((object)("Returning dict with " + list.Count + " entries")); return list; } public static IEnumerator GiveTemporaryBlindness() { RandomizerModBase.mls.LogWarning((object)"RUNNING COROUTINE"); CustomUI playerUI = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); Color origDirectColor = TimeOfDay.Instance.sunDirect.color; Color origIndirectColor = TimeOfDay.Instance.sunIndirect.color; TimeOfDay.Instance.sunIndirect.color = Color.black; TimeOfDay.Instance.sunDirect.color = Color.black; float origPlaneValue = GameNetworkManager.Instance.localPlayerController.gameplayCamera.farClipPlane; GameNetworkManager.Instance.localPlayerController.gameplayCamera.farClipPlane = 60f; int timer = 10; playerUI.SetText("Blindness: " + timer); playerUI.Show(show: true); while (timer > 0) { timer--; playerUI.SetText("Blindness: " + timer); yield return (object)new WaitForSeconds(1f); } TimeOfDay.Instance.sunIndirect.color = origIndirectColor; TimeOfDay.Instance.sunDirect.color = origDirectColor; GameNetworkManager.Instance.localPlayerController.gameplayCamera.farClipPlane = origPlaneValue; playerUI.FadeOut(); RandomizerValues.entranceTPCoroutinePlaying = false; } } [HarmonyPatch(typeof(ExtensionLadderItem))] internal class ExtensionLadderItemPatch { [HarmonyPatch("Update")] [HarmonyPostfix] public static void ExtensionAmountOverride(ExtensionLadderItem __instance) { if (NetworkManager.Singleton.IsServer && !RandomizerValues.isRandomized) { __instance.ladderAnimator.SetFloat("extensionAmount", (float)new Random().Next(10, 900)); } } } [HarmonyPatch(typeof(FlashlightItem))] internal class FlashlightItemPatch : ICustomValue { [HarmonyPatch("Start")] [HarmonyPostfix] public static void ChangeFlashlightColor(FlashlightItem __instance) { //IL_0047: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00fc: 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_0118: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) if (!RandomizerValues.flashlightPropertyDict.ContainsKey(((NetworkBehaviour)__instance).NetworkObjectId) && NetworkManager.Singleton.IsServer) { RFlashlightProperties rFlashlightProperties = new RFlashlightProperties(); RandomizerValues.flashlightPropertyDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, rFlashlightProperties); __instance.flashlightBulb.color = rFlashlightProperties.BulbColor; __instance.flashlightBulb.intensity = rFlashlightProperties.Intensity; ((Renderer)((GrabbableObject)__instance).mainObjectRenderer).material.color = rFlashlightProperties.FlashlightBodyColor; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(36, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, defau