Decompiled source of Lethal Company Randomizer v1.10.6
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 BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCRandomizerMod.Patches; 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) { 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); } } } public interface ICustomValue { void ReloadStats(); void SyncStatsWithClients(); void SaveOnExit(); } 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.10.6")] public class RandomizerModBase : BaseUnityPlugin { public const string modName = "Lethal Company Randomizer Mod"; public const string modVersion = "1.10.6"; 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."); } 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; } } 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 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 int randomizedWeatherIdx; public static float factorySizeMultiplierRand; 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 Dictionary<ulong, float> spiderSpeedsDict = new Dictionary<ulong, float>(); public static Vector3 defaultSpiderScale = new Vector3(1f, 1f, 1f); 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 Dictionary<ulong, float> hoarderBugSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> butlerSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> jesterSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> baboonSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> blobSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> crawlerSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> dressGirlSpeedsDict = new Dictionary<ulong, float>(); 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 Dictionary<ulong, float> nutcrackerSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> flowermanSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<FlowermanAI, Coroutine> slowedFlowermen = new Dictionary<FlowermanAI, Coroutine>(); public static Dictionary<ulong, float> pufferSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> centipedeSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> flowerSnakeSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> springManSpeedsDict = new Dictionary<ulong, float>(); public static Dictionary<ulong, float> doublewingSpeedsDict = new Dictionary<ulong, float>(); 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 Dictionary<ulong, float> surgeonSpeedDict = new Dictionary<ulong, float>(); 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(); blockAnims = false; blockDespawn = false; blockDrop = false; connectCoroutinePlaying = false; spawnedMechCount = 0; entranceTPCoroutinePlaying = false; randomizedCar = false; randomCarProperties = null; elevatorMalfunctioned = false; guardedByLid = false; } } } 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; } } 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(BaboonBirdAI))] internal class BaboonBirdAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StatOverride(BaboonBirdAI __instance) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(20, 200)) / 10f; float num2 = Convert.ToSingle(new Random().Next(1, 11)); float num3 = Convert.ToSingle(new Random().Next(5, 21)) / 10f; RandomizerValues.baboonSpeedsDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, num); ((EnemyAI)__instance).enemyHP = (int)num2; ((Component)__instance).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)__instance).creatureAnimator.speed = num / 10f; ((EnemyAI)__instance).creatureSFX.pitch = Mathf.Lerp(2f, 0.5f, Mathf.Lerp(0.5f, 2f, num3)); ((EnemyAI)__instance).creatureVoice.pitch = Mathf.Lerp(2f, 0.5f, Mathf.Lerp(0.5f, 2f, num3)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(20, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num3, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBaboonData", val, (NetworkDelivery)2); ((FastBufferWriter)(ref val)).Dispose(); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void SpeedOverride(BaboonBirdAI __instance) { if (!((EnemyAI)__instance).isEnemyDead) { ((EnemyAI)__instance).agent.speed = GeneralExtensions.GetValueSafe<ulong, float>(RandomizerValues.baboonSpeedsDict, ((NetworkBehaviour)__instance).NetworkObjectId); } } public static void SetBaboonData(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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 value = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives)); float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); RandomizerValues.baboonSpeedsDict.Add(key, value); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; BaboonBirdAI componentInChildren = ((Component)val).gameObject.GetComponentInChildren<BaboonBirdAI>(); ((EnemyAI)componentInChildren).enemyHP = (int)num; ((Component)componentInChildren).transform.localScale = new Vector3(num2, num2, num2); ((EnemyAI)componentInChildren).creatureSFX.pitch = Mathf.Lerp(2f, 0.5f, Mathf.Lerp(0.5f, 2f, num2)); ((EnemyAI)componentInChildren).creatureVoice.pitch = Mathf.Lerp(2f, 0.5f, Mathf.Lerp(0.5f, 2f, num2)); RandomizerModBase.mls.LogInfo((object)("RECEIVED BABOON STATS: " + key + ", " + value + ", " + num + ", " + num2)); } } } [HarmonyPatch(typeof(BlobAI))] internal class BlobAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StatOverride(BlobAI __instance) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0147: 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_0164: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(5, 71)) / 10f; float num2 = Convert.ToSingle(new Random().Next(1, 11)); float num3 = Convert.ToSingle(new Random().Next(5, 131)) / 100f; RandomizerValues.blobSpeedsDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, num); ((EnemyAI)__instance).enemyHP = (int)num2; ((Component)__instance).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)__instance).creatureAnimator.speed = num / 10f; ((EnemyAI)__instance).creatureSFX.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 1.3f, num3)); ((EnemyAI)__instance).creatureVoice.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 1.3f, num3)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(20, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num3, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBlobData", val, (NetworkDelivery)2); ((FastBufferWriter)(ref val)).Dispose(); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void SpeedOverride(BlobAI __instance) { if (!((EnemyAI)__instance).isEnemyDead) { ((EnemyAI)__instance).agent.speed = GeneralExtensions.GetValueSafe<ulong, float>(RandomizerValues.blobSpeedsDict, ((NetworkBehaviour)__instance).NetworkObjectId); } } public static void SetBlobData(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); RandomizerValues.blobSpeedsDict.Add(key, num); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; BlobAI componentInChildren = ((Component)val).gameObject.GetComponentInChildren<BlobAI>(); ((EnemyAI)componentInChildren).enemyHP = (int)num2; ((Component)componentInChildren).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)componentInChildren).creatureAnimator.speed = num / 10f; ((EnemyAI)componentInChildren).creatureSFX.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 1.3f, num3)); ((EnemyAI)componentInChildren).creatureVoice.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 1.3f, num3)); RandomizerModBase.mls.LogInfo((object)("RECEIVED BLOB STATS: " + key + ", " + num + ", " + num2 + ", " + num3)); } } } [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(BushWolfEnemy))] internal class BushWolfEnemyPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void RandomizeWolf(BushWolfEnemy __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(5, 131)) / 100f; float num2 = Convert.ToSingle(new Random().Next(30, 201)) / 10f; int enemyHP = new Random().Next(1, 11); ((Component)__instance).transform.localScale = new Vector3(num, num, num); ((EnemyAI)__instance).enemyHP = enemyHP; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(20, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref enemyHP, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesWolfStats", val, (NetworkDelivery)2); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void SpeedOverride(BushWolfEnemy __instance) { if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).inSpecialAnimation) { } } public static void ClientSetWolfStats(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); int enemyHP = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref enemyHP, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; BushWolfEnemy componentInChildren = ((Component)val).gameObject.GetComponentInChildren<BushWolfEnemy>(); ((Component)componentInChildren).transform.localScale = new Vector3(num, num, num); ((EnemyAI)componentInChildren).enemyHP = enemyHP; } } } [HarmonyPatch(typeof(ButlerEnemyAI))] internal class ButlerAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StatOverride(ButlerEnemyAI __instance) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(5, 200)) / 10f; float num2 = Convert.ToSingle(new Random().Next(1, 11)); float num3 = Convert.ToSingle(new Random().Next(5, 301)) / 100f; RandomizerValues.butlerSpeedsDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, num); ((EnemyAI)__instance).enemyHP = (int)num2; ((Component)__instance).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)__instance).creatureAnimator.speed = num / 10f; ((EnemyAI)__instance).creatureSFX.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 3f, num3)); ((EnemyAI)__instance).creatureVoice.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 3f, num3)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(20, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num3, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesButlerData", val, (NetworkDelivery)2); ((FastBufferWriter)(ref val)).Dispose(); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void SpeedOverride(ButlerEnemyAI __instance) { if (!((EnemyAI)__instance).isEnemyDead) { ((EnemyAI)__instance).agent.speed = GeneralExtensions.GetValueSafe<ulong, float>(RandomizerValues.butlerSpeedsDict, ((NetworkBehaviour)__instance).NetworkObjectId); } } public static void SetButlerData(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); RandomizerValues.butlerSpeedsDict.Add(key, num); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; ButlerEnemyAI componentInChildren = ((Component)val).gameObject.GetComponentInChildren<ButlerEnemyAI>(); ((EnemyAI)componentInChildren).enemyHP = (int)num2; ((Component)componentInChildren).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)componentInChildren).creatureAnimator.speed = num / 10f; ((EnemyAI)componentInChildren).creatureSFX.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 3f, num3)); ((EnemyAI)componentInChildren).creatureVoice.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.05f, 3f, num3)); RandomizerModBase.mls.LogInfo((object)("RECEIVED BUTLER STATS: " + key + ", " + num + ", " + num2 + ", " + num3)); } } } [HarmonyPatch(typeof(CaveDwellerAI))] internal class CaveDwellerAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void RandomizeBaby(CaveDwellerAI __instance) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(25, 231)) / 100f; float value = Convert.ToSingle(new Random().Next(3, 121)) / 10f; RandomizerValues.babySpeedDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, value); ((Component)__instance).transform.localScale = new Vector3(num, num, num); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(16, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref value, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesBabyStat", val, (NetworkDelivery)2); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void SpeedOverride(CaveDwellerAI __instance) { if (!__instance.sittingDown && !((EnemyAI)__instance).isEnemyDead) { NavMeshAgent agent = ((EnemyAI)__instance).agent; agent.speed *= GeneralExtensions.GetValueSafe<ulong, float>(RandomizerValues.babySpeedDict, ((NetworkBehaviour)__instance).NetworkObjectId); } } public static void ClientSetBabyStats(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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)); float value = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives)); RandomizerValues.babySpeedDict.Add(key, value); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; CaveDwellerAI componentInChildren = ((Component)val).gameObject.GetComponentInChildren<CaveDwellerAI>(); ((Component)componentInChildren).transform.localScale = new Vector3(num, num, num); } } } [HarmonyPatch(typeof(CentipedeAI))] internal class CentipedeAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StatOverride(CentipedeAI __instance) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(20, 200)) / 10f; float num2 = Convert.ToSingle(new Random().Next(1, 11)); float num3 = Convert.ToSingle(new Random().Next(5, 21)) / 10f; RandomizerValues.centipedeSpeedsDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, num); ((EnemyAI)__instance).enemyHP = (int)num2; ((Component)__instance).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)__instance).creatureAnimator.speed = num / 10f; ((EnemyAI)__instance).creatureSFX.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.5f, 2f, num3)); ((EnemyAI)__instance).creatureVoice.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.5f, 2f, num3)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(20, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num3, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesCentipedeData", val, (NetworkDelivery)2); ((FastBufferWriter)(ref val)).Dispose(); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void SpeedOverride(CentipedeAI __instance) { if (!((EnemyAI)__instance).isEnemyDead) { ((EnemyAI)__instance).agent.speed = GeneralExtensions.GetValueSafe<ulong, float>(RandomizerValues.centipedeSpeedsDict, ((NetworkBehaviour)__instance).NetworkObjectId); } } public static void SetCentipedeData(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); RandomizerValues.centipedeSpeedsDict.Add(key, num); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; CentipedeAI componentInChildren = ((Component)val).gameObject.GetComponentInChildren<CentipedeAI>(); ((EnemyAI)componentInChildren).enemyHP = (int)num2; ((Component)componentInChildren).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)componentInChildren).creatureAnimator.speed = num / 10f; ((EnemyAI)componentInChildren).creatureSFX.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.5f, 2f, num3)); ((EnemyAI)componentInChildren).creatureVoice.pitch = Mathf.Lerp(3f, 0.01f, Mathf.InverseLerp(0.5f, 2f, num3)); RandomizerModBase.mls.LogInfo((object)("RECEIVED CENTIPEDE STATS: " + key + ", " + num + ", " + num2 + ", " + num3)); } } } [HarmonyPatch(typeof(ClaySurgeonAI))] internal class ClaySurgeonAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void RandomizeSurgeon(ClaySurgeonAI __instance) { if (NetworkManager.Singleton.IsServer) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(WaitUntilMasterIsChosen(__instance)); } } public static void SetSurgeonData(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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 value = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives)); float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); RandomizerValues.surgeonSpeedDict.Add(key, value); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; ClaySurgeonAI componentInChildren = ((Component)val).gameObject.GetComponentInChildren<ClaySurgeonAI>(); ((Component)componentInChildren).transform.localScale = new Vector3(num, num, num); componentInChildren.startingInterval = num2; componentInChildren.endingInterval = num2 / 10f; } } public static IEnumerator WaitUntilMasterIsChosen(ClaySurgeonAI __instance) { yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)__instance.master != (Object)null)); float speed = Convert.ToSingle(new Random().Next(20, 200)) / 10f; float scale = Convert.ToSingle(new Random().Next(5, 21)) / 10f; float startInterval; if ((Object)(object)__instance.master == (Object)(object)__instance) { startInterval = new Random().Next(1, 6); __instance.startingInterval = startInterval; __instance.endingInterval = startInterval / 10f; } else { startInterval = __instance.master.startingInterval; __instance.endingInterval = __instance.master.endingInterval; } RandomizerValues.surgeonSpeedDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, speed); ((Component)__instance).transform.localScale = new Vector3(scale, scale, scale); FastBufferWriter fastBufferWriter = new FastBufferWriter(20, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<float>(ref scale, default(ForPrimitives)); ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<float>(ref startInterval, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesSurgeonData", fastBufferWriter, (NetworkDelivery)2); } } [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(CrawlerAI))] internal class CrawlerAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StatOverride(CrawlerAI __instance) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(20, 200)) / 10f; float num2 = Convert.ToSingle(new Random().Next(1, 11)); float num3 = Convert.ToSingle(new Random().Next(5, 21)) / 10f; RandomizerValues.crawlerSpeedsDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, num); ((EnemyAI)__instance).enemyHP = (int)num2; ((Component)__instance).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)__instance).creatureAnimator.speed = num / 10f; ((EnemyAI)__instance).creatureSFX.pitch = Mathf.Lerp(2f, 0.5f, Mathf.InverseLerp(0.5f, 2f, num3)); ((EnemyAI)__instance).creatureVoice.pitch = Mathf.Lerp(2f, 0.5f, Mathf.InverseLerp(0.5f, 2f, num3)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(20, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref num3, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.lcrandomizermod_ClientReceivesCrawlerData", val, (NetworkDelivery)2); ((FastBufferWriter)(ref val)).Dispose(); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void SpeedOverride(CrawlerAI __instance) { if (!((EnemyAI)__instance).isEnemyDead) { ((EnemyAI)__instance).agent.speed = GeneralExtensions.GetValueSafe<ulong, float>(RandomizerValues.crawlerSpeedsDict, ((NetworkBehaviour)__instance).NetworkObjectId); } } public static void SetCrawlerData(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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); RandomizerValues.crawlerSpeedsDict.Add(key, num); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; CrawlerAI componentInChildren = ((Component)val).gameObject.GetComponentInChildren<CrawlerAI>(); ((EnemyAI)componentInChildren).enemyHP = (int)num2; ((Component)componentInChildren).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)componentInChildren).creatureAnimator.speed = num / 10f; ((EnemyAI)componentInChildren).creatureSFX.pitch = Mathf.Lerp(2f, 0.5f, Mathf.InverseLerp(0.5f, 2f, num3)); ((EnemyAI)componentInChildren).creatureVoice.pitch = Mathf.Lerp(2f, 0.5f, Mathf.InverseLerp(0.5f, 2f, num3)); RandomizerModBase.mls.LogInfo((object)("RECEIVED CRAWLER STATS: " + key + ", " + num + ", " + num2 + ", " + num3)); } } } [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(DoublewingAI))] internal class DoublewingAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StatOverride(DoublewingAI __instance) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { float num = Convert.ToSingle(new Random().Next(20, 200)) / 10f; float num2 = Convert.ToSingle(new Random().Next(1, 11)); float num3 = Convert.ToSingle(new Random().Next(5, 21)) / 10f; RandomizerValues.doublewingSpeedsDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, num); ((EnemyAI)__instance).enemyHP = (int)num2; ((Component)__instance).transform.localScale = new Vector3(num3, num3, num3); ((EnemyAI)__instance).creatureAnimator.speed = num / 10f; ((EnemyAI)__instanc