using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CoordinateForEasterEggs.NetcodePatcher; using CoordinateForEasterEggs.Patches; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalLib.Modules; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("CoordinateForEasterEggs")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.3.0.0")] [assembly: AssemblyInformationalVersion("0.3.0")] [assembly: AssemblyProduct("CoordinateForEasterEggs")] [assembly: AssemblyTitle("CoordinateForEasterEggs")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] namespace testModLethalCompany { public static class PluginInfo { public const string PLUGIN_GUID = "CoordinateForEasterEggs"; public const string PLUGIN_NAME = "CoordinateForEasterEggs"; public const string PLUGIN_VERSION = "0.3.0"; } } namespace CoordinateForEasterEggs { public class CFEEInput : LcInputActions { [InputAction("/f5", Name = "Toggle CFEE")] public InputAction ToggleCFEE { get; set; } [InputAction("/f4", Name = "Toggle Info")] public InputAction ToggleInfo { get; set; } [InputAction("", Name = "Toggle Virtual generation mode")] public InputAction ToggleVirtualGenerationMode { get; set; } [InputAction("", Name = "Clear Tiles")] public InputAction ClearTiles { get; set; } [InputAction("", Name = "Clear Conditions")] public InputAction ClearConditions { get; set; } [InputAction("", Name = "Start Generation")] public InputAction StartGeneration { get; set; } [InputAction("", Name = "Stop Generation")] public InputAction StopGeneration { get; set; } public static void KeyInput() { if (Plugin.inputCfee == null) { Plugin.mls.LogInfo((object)"Error: inputCfee is null."); return; } if (Plugin.inputCfee.ToggleCFEE.triggered) { CFEEManager.ToggleCFEEWithInput(); } if (Plugin.inputCfee.ToggleInfo.triggered) { HUDTextCfee.ToggleInfo(); } if (Plugin.inputCfee.ToggleVirtualGenerationMode.triggered) { CFEEManager.ToggleVirtualGenerationModeWithInput(); } if (Plugin.inputCfee.ClearTiles.triggered) { CFEEManager.ClearTilesWithInput(); } if (Plugin.inputCfee.ClearConditions.triggered) { CFEEManager.ClearConditionsWithInput(); } if (Plugin.inputCfee.StartGeneration.triggered) { CFEEManager.StartGenerationWithInput(); } if (Plugin.inputCfee.StopGeneration.triggered) { CFEEManager.StopGenerationWithInput(); } if (!HUDTextCfee.initToggleText) { HUDTextCfee.UpdateToggleText(InputActionRebindingExtensions.GetBindingDisplayString(Plugin.inputCfee.ToggleInfo, 0, (DisplayStringOptions)0)); HUDTextCfee.initToggleText = true; Plugin.mls.LogInfo((object)("initToggleText: key name is " + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.inputCfee.ToggleInfo, 0, (DisplayStringOptions)0))); } } public static string GetToggleInfoBindingDispalyString() { if (Plugin.inputCfee == null) { Plugin.mls.LogInfo((object)"Error: inputCfee is null."); string text; return text = "Error text"; } return InputActionRebindingExtensions.GetBindingDisplayString(Plugin.inputCfee.ToggleInfo, 0, (DisplayStringOptions)0); } } internal class EggLine : MonoBehaviour { private LineRenderer lineRenderer; private GameObject eggPosObj; private GameObject highlightFloorObj; private Vector3 pos; private float aliveCount; private readonly float aliveTime = 12f; private readonly float lineLength = 15f; public bool isDisabled = false; public void InitAndSetPos(Vector3 eggPos, bool isExplode, in float floorHeight) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_007f: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) pos = eggPos; aliveCount = 0f; if ((Object)(object)lineRenderer == (Object)null) { lineRenderer = new LineRenderer(); } Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { Plugin.mls.LogInfo((object)"Error: Shader 'Sprites/Default' not found!!"); return; } Material material = new Material(val); float num = 0.017f; Color val2 = ((!isExplode) ? Color.cyan : Color.green); int positionCount = 2; GameObject val3 = new GameObject("EggLineObj"); lineRenderer = val3.AddComponent(); lineRenderer.positionCount = positionCount; lineRenderer.startWidth = num; lineRenderer.endWidth = num; ((Renderer)lineRenderer).material = material; lineRenderer.startColor = val2; lineRenderer.endColor = val2; if ((Object)(object)eggPosObj == (Object)null) { eggPosObj = GameObject.CreatePrimitive((PrimitiveType)3); } Shader val4 = Shader.Find("Sprites/Default"); if ((Object)(object)val4 == (Object)null) { Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found!!"); return; } Material val5 = new Material(val4); if (isExplode) { val5.color = new Color(0f, 1f, 0f, 0.25f); } else { val5.color = new Color(0f, 1f, 1f, 0.25f); } eggPosObj.transform.position = pos; eggPosObj.transform.rotation = Quaternion.Euler(0f, 0f, 0f); eggPosObj.transform.localScale = new Vector3(0.17f, 0.17f, 0.17f); ((Renderer)eggPosObj.GetComponent()).material = val5; Collider component = eggPosObj.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } if ((Object)(object)highlightFloorObj == (Object)null) { highlightFloorObj = GameObject.CreatePrimitive((PrimitiveType)4); } Shader val6 = Shader.Find("Sprites/Default"); if ((Object)(object)val4 == (Object)null) { Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found!!"); return; } Material val7 = new Material(val4); if (isExplode) { val7.color = new Color(0f, 0.6f, 0f, 0.9f); } else { val7.color = new Color(0f, 0.6f, 0.6f, 0.9f); } highlightFloorObj.transform.position = new Vector3(pos.x, floorHeight, pos.z); highlightFloorObj.transform.rotation = Quaternion.Euler(0f, 0f, 0f); highlightFloorObj.transform.localScale = new Vector3(0.006f, 1f, 0.006f); ((Renderer)highlightFloorObj.GetComponent()).material = val7; Collider component2 = highlightFloorObj.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } SetLine(); SetCube(); } public void UpdateEggLine(float floorHeightPosY) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (!isDisabled && !((Object)(object)highlightFloorObj == (Object)null) && !((Object)(object)eggPosObj == (Object)null) && !((Object)(object)lineRenderer == (Object)null)) { highlightFloorObj.transform.position = new Vector3(pos.x, floorHeightPosY, pos.z); if (highlightFloorObj.transform.position.y > pos.y + lineLength || highlightFloorObj.transform.position.y < pos.y - lineLength) { highlightFloorObj.SetActive(false); } else { highlightFloorObj.SetActive(true); } if (aliveCount >= aliveTime) { DisableIndicator(); } aliveCount += Time.deltaTime; } } private void SetLine() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0059: 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_0066: 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) if (!((Object)(object)lineRenderer == (Object)null)) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, lineLength, 0f); Vector3 val2 = pos + val; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0f, 0f - lineLength, 0f); Vector3 val4 = pos + val3; lineRenderer.SetPosition(0, val2); lineRenderer.SetPosition(1, val4); } } private void SetCube() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)eggPosObj == (Object)null)) { eggPosObj.transform.position = pos; } } internal void DisableIndicator() { isDisabled = true; Object.Destroy((Object)(object)lineRenderer); Object.Destroy((Object)(object)eggPosObj); Object.Destroy((Object)(object)highlightFloorObj); } } public class EggLineSync : NetworkBehaviour { public static EggLineSync Instance; public void Awake() { Plugin.mls.LogInfo((object)"Awake is called."); if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)Instance); } Instance = this; } [ClientRpc] public void EggLinesClientRpc(Vector3 egglinePos, bool explode) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3129578397u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref egglinePos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref explode, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3129578397u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; CFEEManager.GenerateEggLine(egglinePos, explode); } } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Plugin.mls.LogInfo((object)"NetworkPrefab Spawned."); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3129578397u, new RpcReceiveHandler(__rpc_handler_3129578397), "EggLinesClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3129578397(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 egglinePos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref egglinePos); bool explode = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref explode, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EggLineSync)(object)target).EggLinesClientRpc(egglinePos, explode); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "EggLineSync"; } } public struct HorizontalIntPos { public int x; public int z; public void InitToZero() { x = 0; z = 0; } public bool Equals(HorizontalIntPos other) { return x == other.x && z == other.z; } public override bool Equals(object obj) { if (obj is HorizontalIntPos other) { return Equals(other); } return false; } public override int GetHashCode() { return HashCode.Combine(x, z); } public static bool operator ==(HorizontalIntPos a, HorizontalIntPos b) { return a.x == b.x && a.z == b.z; } public static bool operator !=(HorizontalIntPos a, HorizontalIntPos b) { return !(a == b); } } public class CheckSceneChange { [HarmonyPatch(typeof(GameNetworkManager))] [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Init() { SceneManager.activeSceneChanged -= OnSceneChanged; SceneManager.activeSceneChanged += OnSceneChanged; Plugin.mls.LogInfo((object)"Initialized CheckSceneChange."); } private static void OnSceneChanged(Scene oldScene, Scene newScene) { Plugin.mls.LogInfo((object)("Changed scene to: " + ((Scene)(ref newScene)).name)); if (((Scene)(ref newScene)).name == "MainMenu") { CFEEManager.ResetAll(); HUDTextCfee.ClearGenerationStatus(); } } } internal class CommandReader { [HarmonyPatch(typeof(HUDManager))] [HarmonyPatch("AddTextToChatOnServer")] [HarmonyPostfix] private static void GetCommandFromChat(string chatMessage, int playerId = -1) { if (!chatMessage.StartsWith("/")) { return; } string[] array = chatMessage.Trim().Split(' '); string text = array[0]; string text2 = ((array.Length > 1) ? array[1] : null); string text3 = ((array.Length > 2) ? array[2] : null); string text4 = ((array.Length > 3) ? array[3] : null); string text5 = ((array.Length > 4) ? array[4] : null); string text6 = ((array.Length > 5) ? array[5] : null); if (text == null) { return; } switch (text.ToLower()) { case "/view": case "/vie": { int result4; if (!CFEEManager.isCFEEenabled) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1"); } else if (text2 == null || text3 != null) { Plugin.mls.LogInfo((object)("Usage: /view \nThis command changes the view distance of coordinates.\nDefault: 15")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /view \nThis command changes the view distance of coordinates.\nDefault: 15", false, false, "LC_Tip1"); } else if (int.TryParse(text2, out result4)) { if (result4 > CFEEManager.maxLineRadius || result4 < CFEEManager.minLineRadius) { Plugin.mls.LogInfo((object)("Warning: The configurable range is " + CFEEManager.minLineRadius + " to " + CFEEManager.maxLineRadius + ".\nDefault: 15")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The configurable range is " + CFEEManager.minLineRadius + " to " + CFEEManager.maxLineRadius + ".\nDefault: 15", false, false, "LC_Tip1"); } else if (!CFEEManager.isVirtualGenerationMode) { CFEEManager.DeleteLineAndTile(); CFEEManager.lineRadius = result4; CFEEManager.isRangeChanged = true; HUDTextCfee.UpdateViewDistance(); Plugin.mls.LogInfo((object)("View distance set to " + result4 + ".\nDefault: 15")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "View distance set to " + result4 + ".\nDefault: 15", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while Virtual Generation Mode is active."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while Virtual Generation Mode is active.", false, false, "LC_Tip1"); } } else { Plugin.mls.LogInfo((object)("Usage: /view \nThis command changes the view distance of coordinates.\nDefault: 15")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /view \nThis command changes the view distance of coordinates.\nDefault: 15", false, false, "LC_Tip1"); } break; } case "/virtual": case "/virtua": case "/virtu": case "/virt": case "/vir": if (!CFEEManager.isCFEEenabled) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1"); } else if (text2 == null) { CFEEManager.ToggleVirtualGenerationModeWithInput(); } else if ((text2.ToLower() == "true" || text2.ToLower() == "tru") && text3 == null) { if (CFEEManager.isVirtualGenerationMode) { Plugin.mls.LogInfo((object)"Warning: Virtual Generation Mode is already on."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Virtual Generation Mode is already on.", false, false, "LC_Tip1"); break; } CFEEManager.isVirtualGenerationMode = true; HUDTextCfee.UpdateVirtualGenMode(); CFEEManager.virtualMapSeed = -1; CFEEManager.DeleteLineAndTile(); Plugin.mls.LogInfo((object)"Virtual Generation Mode enabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode enabled.", false, false, "LC_Tip1"); } else if ((text2.ToLower() == "false" || text2.ToLower() == "fals" || text2.ToLower() == "fal") && text3 == null) { if (!CFEEManager.isVirtualGenerationMode) { Plugin.mls.LogInfo((object)"Warning: Virtual Generation Mode is already off."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Virtual Generation Mode is already off.", false, false, "LC_Tip1"); break; } CFEEManager.isVirtualGenerationMode = false; HUDTextCfee.UpdateVirtualGenMode(); CFEEManager.virtualMapSeed = -1; CFEEManager.DeleteLineAndTile(); CFEEManager.isLerpedColor = false; CFEEManager.DeleteAllTileChache(); CFEEManager.isForceToUpdateNext = true; Plugin.mls.LogInfo((object)"Virtual Generation Mode disabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode disabled.", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Usage: /virtual"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /virtual", false, false, "LC_Tip1"); } break; case "/seed": case "/see": { int result5; if (!CFEEManager.isCFEEenabled) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1"); } else if (!CFEEManager.isVirtualGenerationMode) { Plugin.mls.LogInfo((object)"Warning: This command is only available in Virtual Generation Mode."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is only available in Virtual Generation Mode.", false, false, "LC_Tip1"); } else if (CFEEManager.isGeneratingSeed) { Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1"); } else if (text2 == null || text3 != null) { Plugin.mls.LogInfo((object)"Usage: /seed \n/seed random"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /seed \n/seed random", false, false, "LC_Tip1"); } else if (text2.ToLower() == "random" || text2.ToLower() == "rando" || text2.ToLower() == "rand" || text2.ToLower() == "ran") { CFEEManager.SetVirtualTilesMatToDefault(); CFEEManager.VirtualNewLevelGeneratorWithConditions(300, isDisplayTip: true); } else if (int.TryParse(text2, out result5)) { CFEEManager.SetVirtualTilesMatToDefault(); CFEEManager.VirtualNewLevelGenerator(result5); } break; } case "/clear": case "/clea": case "/cle": if (!CFEEManager.isCFEEenabled) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1"); break; } if (!CFEEManager.isVirtualGenerationMode) { Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1"); break; } if (CFEEManager.isGeneratingSeed) { Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1"); break; } if (text2 != null) { Plugin.mls.LogInfo((object)"Usage: /clear"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /clear", false, false, "LC_Tip1"); break; } CFEEManager.SetVirtualTilesMatToDefault(); CFEEManager.SetVirtualTilesToFalse(); HUDTextCfee.ClearGenerationStatus(); Plugin.mls.LogInfo((object)"Cleared virtual tiles."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Cleared virtual tiles.", false, false, "LC_Tip1"); break; case "/conditions": case "/condition": case "/conditio": case "/conditi": case "/condit": case "/condi": case "/cond": case "/con": if (CFEEManager.isGeneratingSeed) { Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1"); } else if (text2 == null) { Plugin.mls.LogInfo((object)"Usage: /condition 'word'.\nword: interior, scraps, clear"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition 'word'.\nword: interior, scraps, clear", false, false, "LC_Tip1"); } else if (text2.ToLower() == "clear" || text2.ToLower() == "clea" || text2.ToLower() == "cle") { if (text3 != null) { Plugin.mls.LogInfo((object)"Usage: /condition clear"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition clear", false, false, "LC_Tip1"); } else { CFEEManager.ClearConditionsWithInput(); } } else if (text2.ToLower() == "dungeon" || text2.ToLower() == "dungeo" || text2.ToLower() == "dunge" || text2.ToLower() == "dung" || text2.ToLower() == "dun" || text2.ToLower() == "interior" || text2.ToLower() == "interio" || text2.ToLower() == "interi" || text2.ToLower() == "inter" || text2.ToLower() == "inte" || text2.ToLower() == "int") { if (text3 == null) { Plugin.mls.LogInfo((object)"Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft", false, false, "LC_Tip1"); } else if (text3.ToLower() == "factory" || text3.ToLower() == "factor" || text3.ToLower() == "facto" || text3.ToLower() == "fact" || text3.ToLower() == "fac" || text3.ToLower() == "facility" || text3.ToLower() == "facilit" || text3.ToLower() == "facili" || text3.ToLower() == "facil" || text3.ToLower() == "faci") { CFEEManager.isConditionedFactory = true; CFEEManager.isConditionedAnyDungeon = true; HUDTextCfee.UpdateInteriorType(); Plugin.mls.LogInfo((object)"Interior conditions set to Factory."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Interior conditions set to Factory.", false, false, "LC_Tip1"); } else if (text3.ToLower() == "mansion" || text3.ToLower() == "mansio" || text3.ToLower() == "mansi" || text3.ToLower() == "mans" || text3.ToLower() == "man") { CFEEManager.isConditionedMansion = true; CFEEManager.isConditionedAnyDungeon = true; HUDTextCfee.UpdateInteriorType(); Plugin.mls.LogInfo((object)"Interior conditions set to Mansion."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Interior conditions set to Mansion.", false, false, "LC_Tip1"); } else if (text3.ToLower() == "mineshaft" || text3.ToLower() == "mineshaf" || text3.ToLower() == "minesha" || text3.ToLower() == "minesh" || text3.ToLower() == "mines" || text3.ToLower() == "mine" || text3.ToLower() == "min") { CFEEManager.isConditionedMineshaft = true; CFEEManager.isConditionedAnyDungeon = true; HUDTextCfee.UpdateInteriorType(); Plugin.mls.LogInfo((object)"Interior conditions set to Mineshaft."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Interior conditions set to Mineshaft.", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft", false, false, "LC_Tip1"); } } else if (text2.ToLower() == "scraps" || text2.ToLower() == "scrap" || text2.ToLower() == "scra" || text2.ToLower() == "scr") { if (text3 != null && int.TryParse(text3, out var result)) { if (text4 != null && text4 == "to") { if (text5 != null && int.TryParse(text5, out var result2)) { if (text6 == null) { if (result < StartOfRound.Instance.currentLevel.minScrap) { result = StartOfRound.Instance.currentLevel.minScrap; Plugin.mls.LogInfo((object)"Warning: minScraps adjusted to match the allowed range."); } if (result2 > StartOfRound.Instance.currentLevel.maxScrap - 1) { result2 = StartOfRound.Instance.currentLevel.maxScrap - 1; Plugin.mls.LogInfo((object)"Warning: maxScraps adjusted to match the allowed range."); } if (result > result2) { Plugin.mls.LogInfo((object)("Warning: Min scraps must be less than max scraps.\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Min scraps must be less than max scraps.\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1"); } else { CFEEManager.conditionedMinScraps = result; CFEEManager.conditionedMaxScraps = result2; HUDTextCfee.UpdateScrapRange(); Plugin.mls.LogInfo((object)("Scrap conditions set to " + result + " to " + result2 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + result + " to " + result2 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1"); } } else { UsageConditionScraps(); } } else { UsageConditionScraps(); } } else if (text4 == null) { if (int.TryParse(text3, out var result3)) { if (result3 < StartOfRound.Instance.currentLevel.minScrap) { result3 = StartOfRound.Instance.currentLevel.minScrap; Plugin.mls.LogInfo((object)"Warning: minScraps adjusted to match the allowed range."); } if (result3 > StartOfRound.Instance.currentLevel.maxScrap - 1) { result3 = StartOfRound.Instance.currentLevel.maxScrap - 1; Plugin.mls.LogInfo((object)"Warning: maxScraps adjusted to match the allowed range."); } CFEEManager.conditionedMinScraps = result3; CFEEManager.conditionedMaxScraps = result3; HUDTextCfee.UpdateScrapRange(); Plugin.mls.LogInfo((object)("Scrap conditions set to " + result3 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + result3 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1"); } else { UsageConditionScraps(); } } else { UsageConditionScraps(); } } else if (text3 != null && (text3.ToLower() == "upper" || text3.ToLower() == "uppe" || text3.ToLower() == "upp") && text4 == null) { float num = ((float)StartOfRound.Instance.currentLevel.minScrap + (float)StartOfRound.Instance.currentLevel.maxScrap) / 2f; int conditionedMinScraps = (int)Math.Ceiling(num); int conditionedMaxScraps = StartOfRound.Instance.currentLevel.maxScrap - 1; CFEEManager.conditionedMinScraps = conditionedMinScraps; CFEEManager.conditionedMaxScraps = conditionedMaxScraps; HUDTextCfee.UpdateScrapRange(); Plugin.mls.LogInfo((object)("Scrap conditions set to " + conditionedMinScraps + " to " + conditionedMaxScraps + ".\n(Upper half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + conditionedMinScraps + " to " + conditionedMaxScraps + ".\n(Upper half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1"); } else if (text3 != null && (text3.ToLower() == "lower" || text3.ToLower() == "lowe" || text3.ToLower() == "low") && text4 == null) { float num2 = ((float)StartOfRound.Instance.currentLevel.minScrap + (float)StartOfRound.Instance.currentLevel.maxScrap) / 2f; int minScrap = StartOfRound.Instance.currentLevel.minScrap; int num3 = (int)Math.Floor(num2); if (num2 % 1f == 0f) { num3--; } CFEEManager.conditionedMinScraps = minScrap; CFEEManager.conditionedMaxScraps = num3; HUDTextCfee.UpdateScrapRange(); Plugin.mls.LogInfo((object)("Scrap conditions set to " + minScrap + " to " + num3 + ".\n(Lower half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + minScrap + " to " + num3 + ".\n(Lower half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1"); } else { UsageConditionScraps(); } } else { Plugin.mls.LogInfo((object)"Usage: /condition 'word'.\nword: interior, scraps, clear"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition 'word'.\nword: interior, scraps, clear", false, false, "LC_Tip1"); } break; case "/generations": case "/generation": case "/generatio": case "/generati": case "/generat": case "/genera": case "/gener": case "/gene": case "/gen": if (!CFEEManager.isCFEEenabled) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1"); } else if (text2 != null) { if (text2 == "start" || text2 == "star" || text2 == "sta") { if (text3 == null) { CFEEManager.StartGenerationWithInput(); break; } Plugin.mls.LogInfo((object)"Usage: /generation start"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation start", false, false, "LC_Tip1"); break; } if (text2 == "stop" || text2 == "sto") { if (text3 == null) { CFEEManager.StopGenerationWithInput(); break; } Plugin.mls.LogInfo((object)"Usage: /generation stop"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation stop", false, false, "LC_Tip1"); break; } switch (text2) { default: if (!(text2 == "int")) { Plugin.mls.LogInfo((object)"Usage: /generation start\n/generation stop\n/generation interval"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation start\n/generation stop\n/generation interval", false, false, "LC_Tip1"); break; } goto case "interval"; case "interval": case "interva": case "interv": case "inter": case "inte": { if (text3 != null && float.TryParse(text3, out var result7)) { if (float.IsNaN(result7) || float.IsInfinity(result7)) { Plugin.mls.LogInfo((object)"Warning: Invalid value."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Invalid value.", false, false, "LC_Tip1"); } else if (text4 == null) { if (result7 < CFEEManager.minGenerationTimeInterval || result7 > CFEEManager.maxGenerationTimeInterval) { Plugin.mls.LogInfo((object)("Warning: The configurable range is " + CFEEManager.minGenerationTimeInterval + " to " + CFEEManager.maxGenerationTimeInterval)); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The configurable range is " + CFEEManager.minGenerationTimeInterval + " to " + CFEEManager.maxGenerationTimeInterval, false, false, "LC_Tip1"); break; } if (CFEEManager.isGeneratingSeed) { Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1"); break; } CFEEManager.generationTimeInterval = result7; HUDTextCfee.UpdateGenerationInterval(); Plugin.mls.LogInfo((object)("Generation interval set to " + result7 + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation interval set to " + result7 + ".", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Usage: /generation interval \nDefault: 0.05"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation interval \nDefault: 0.1", false, false, "LC_Tip1"); } } else { Plugin.mls.LogInfo((object)"Usage: /generation interval \nDefault: 0.05"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation interval \nDefault: 0.1", false, false, "LC_Tip1"); } break; } } } else { Plugin.mls.LogInfo((object)"Usage: /generation start\n/generation stop\n/generation interval"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation start\n/generation stop\n/generation interval", false, false, "LC_Tip1"); } break; case "/number": case "/numbe": case "/numb": case "/num": { if (text2 != null && int.TryParse(text2, out var result6)) { if (text3 == null) { if (!CFEEManager.isGeneratingSeed) { if (result6 >= CFEEManager.minNumberOfAttempts && result6 <= CFEEManager.maxNumberOfAttempts) { CFEEManager.numberOfAttempts = result6; HUDTextCfee.UpdateNumberOfAttempts(); Plugin.mls.LogInfo((object)("The number of attempts has been set to " + result6 + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "The number of attempts has been set to " + result6 + ".", false, false, "LC_Tip1"); break; } Plugin.mls.LogInfo((object)("Warning: The configurable range is " + CFEEManager.minNumberOfAttempts + " to " + CFEEManager.maxNumberOfAttempts + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The configurable range is " + CFEEManager.minNumberOfAttempts + " to " + CFEEManager.maxNumberOfAttempts + ".", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1"); } } else { Plugin.mls.LogInfo((object)"Usage: /number "); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /number ", false, false, "LC_Tip1"); } } else { Plugin.mls.LogInfo((object)"Usage: /number "); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /number ", false, false, "LC_Tip1"); } break; } case "/enable": case "/enabl": case "/enab": case "/ena": if (text2 != null) { Plugin.mls.LogInfo((object)"Usage: /enable"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /enable", false, false, "LC_Tip1"); } else if (!CFEEManager.isCFEEenabled) { CFEEManager.isVirtualGenerationMode = false; HUDTextCfee.UpdateVirtualGenMode(); CFEEManager.virtualMapSeed = -1; CFEEManager.DeleteLineAndTile(); CFEEManager.isForceToUpdateNext = true; CFEEManager.isCFEEenabled = true; Plugin.mls.LogInfo((object)"CFEE enabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE enabled.", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Warning: CFEE is already enabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: CFEE is already enabled.", false, false, "LC_Tip1"); } break; case "/disable": case "/disabl": case "/disab": case "/disa": case "/dis": if (text2 != null) { Plugin.mls.LogInfo((object)"Usage: /disable"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /disable", false, false, "LC_Tip1"); } else if (CFEEManager.isVirtualGenerationMode) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while Virtual Generation Mode is active."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while Virtual Generation Mode is active.", false, false, "LC_Tip1"); } else if (CFEEManager.isCFEEenabled) { CFEEManager.isVirtualGenerationMode = false; HUDTextCfee.UpdateVirtualGenMode(); CFEEManager.virtualMapSeed = -1; CFEEManager.DisableAllEgglines(); CFEEManager.DeleteLineAndTile(); CFEEManager.isCFEEenabled = false; Plugin.mls.LogInfo((object)"CFEE disabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE disabled.", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Warning: CFEE is already disabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: CFEE is already disabled.", false, false, "LC_Tip1"); } break; case "/info": case "/inf": if (text2 == null) { HUDTextCfee.ToggleInfo(); break; } Plugin.mls.LogInfo((object)"Usage: /info"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /info", false, false, "LC_Tip1"); break; default: Plugin.mls.LogInfo((object)"Warning: Unknown command.\nUsage: /enable /disable /view /virtual /seed /clear /condition /number /generation /info"); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Unknown command.\nUsage: /enable /disable /view /virtual /seed /clear /condition /number /generation /info", false, false, "LC_Tip1"); break; } } private static void UsageConditionScraps() { Plugin.mls.LogInfo((object)("Usage: /condition scraps to \n/condition scraps \n/condition scraps upper\n/condition scraps lower\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".")); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition scraps to \n/condition scraps \n/condition scraps upper\n/condition scraps lower\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1"); } } [BepInPlugin("kakeEdition.CFEE", "CoordinateForEasterEggs", "0.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "kakeEdition.CFEE"; public const string modName = "CoordinateForEasterEggs"; public const string modVersion = "0.3.0"; private static Harmony _harmony = new Harmony("kakeEdition.CFEE"); internal static ManualLogSource mls = Logger.CreateLogSource("kakeEdition.CFEE"); public ConfigEntry viewDistanceAtStart; public ConfigEntry enableCfeeAtStart; public ConfigEntry numberOfAttemptsAtStart; public ConfigEntry generationIntervalAtStartup; public static int viewDistanceAtStart_; public static bool enableCfeeAtStart_; internal static CFEEInput inputCfee; private void Awake() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } viewDistanceAtStart = ((BaseUnityPlugin)this).Config.Bind("STARTUP SETTINGS", "View Distance", 15, new ConfigDescription("View distance of coordinate at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange(1, 35), Array.Empty())); enableCfeeAtStart = ((BaseUnityPlugin)this).Config.Bind("STARTUP SETTINGS", "Enable CFEE", false, "Whether CFEE is enabled at startup.(this value will not be updated even if changed via command)"); numberOfAttemptsAtStart = ((BaseUnityPlugin)this).Config.Bind("STARTUP SETTINGS", "Number of attempts", 1000, new ConfigDescription("Number of generation attempts at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange(10, 100000), Array.Empty())); generationIntervalAtStartup = ((BaseUnityPlugin)this).Config.Bind("STARTUP SETTINGS", "Generation Interval", 0.1f, new ConfigDescription("Generation Interval at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 10f), Array.Empty())); mls.LogInfo((object)"CoordinateForEasterEggs0.3.0 has loaded."); CFEEManager.networkPrefab = NetworkPrefabs.CreateNetworkPrefab("networkPrefab"); CFEEManager.networkPrefab.AddComponent(); NetworkPrefabs.RegisterNetworkPrefab(CFEEManager.networkPrefab); mls.LogInfo((object)"Network registered."); inputCfee = new CFEEInput(); CFEEManager.InitLineRadiusConfigEntry(viewDistanceAtStart.Value); CFEEManager.InitIsCFEEenabledConfigEntry(enableCfeeAtStart.Value); CFEEManager.InitNumberOfAttemptsConfigEntry(numberOfAttemptsAtStart.Value); CFEEManager.InitGenerationIntervalConfigEntry(generationIntervalAtStartup.Value); PatchAllStuff(); } private static void PatchAllStuff() { _harmony.PatchAll(typeof(CFEEManager)); _harmony.PatchAll(typeof(CheckSceneChange)); _harmony.PatchAll(typeof(CommandReader)); _harmony.PatchAll(typeof(HUDTextCfee)); } } } namespace CoordinateForEasterEggs.Patches { internal class LevelEmulator { internal static int EmulateNumberOfBaseScrapsSpawn(ref Random anomalyRandomRef) { return (int)((float)anomalyRandomRef.Next(StartOfRound.Instance.currentLevel.minScrap, StartOfRound.Instance.currentLevel.maxScrap) * RoundManager.Instance.scrapAmountMultiplier); } internal static int EmulateGenerateNewFloor(ref Random levelRandomRef) { int num = -1; int num2 = -1; if (StartOfRound.Instance.currentLevel.dungeonFlowTypes != null && StartOfRound.Instance.currentLevel.dungeonFlowTypes.Length != 0) { List list = new List(); for (int i = 0; i < StartOfRound.Instance.currentLevel.dungeonFlowTypes.Length; i++) { list.Add(StartOfRound.Instance.currentLevel.dungeonFlowTypes[i].rarity); } int randomWeightedIndex = RoundManager.Instance.GetRandomWeightedIndex(list.ToArray(), levelRandomRef); return RoundManager.Instance.currentLevel.dungeonFlowTypes[randomWeightedIndex].id; } return 0; } internal static bool EmulateExplodeEgg(in Vector3 position) { return (float)new Random(CFEEManager.randomMapSeed + 10 + (int)position.x + (int)position.z).Next(0, 100) <= CFEEManager.chanceToExplode; } internal static bool EmulateExplodeEggWithVirtualSeed(in Vector3 position) { return (float)new Random(CFEEManager.virtualMapSeed + 10 + (int)position.x + (int)position.z).Next(0, 100) <= CFEEManager.chanceToExplode; } internal static bool EmulateExplodeEggWithVirtualSeedAdditionXZ(int additionXZ) { return (float)new Random(CFEEManager.virtualMapSeed + 10 + additionXZ).Next(0, 100) <= CFEEManager.chanceToExplode; } internal static int EmulateChooseNewRandomMapSeed() { return Random.Range(1, 100000000); } } internal class CFEEManager : NetworkBehaviour { private static bool isLocalPlayerServer; internal static int randomMapSeed = -1; internal static readonly float chanceToExplode = 16f; private static HorizontalIntPos closestPos; private static HorizontalIntPos previousClosestPos; private static float previousPlayerFloorPosY; private static float lastUpdateTime; private static float playerFloorPosY; internal static GameObject CFEEcontainer; internal static bool isInitializedCFEEcontainer = false; private static List linesX = new List(); private static List linesZ = new List(); private static List> tiles = new List>(); private static List> virtualTiles = new List>(); private static Material lineMaterial; private static Material tileMaterial; private static Material virtualTileMaterial; private static Material virtualTileMaterial0to09; private static Material virtualTileMaterial1to9; private static Material virtualTileMaterial10to19; private static Material virtualTileMaterial20to29; private static Material virtualTileMaterial30to39; private static Material virtualTileMaterial40to49; private static Material virtualTileMaterial50to59; private static Material virtualTileMaterial60to69; private static Material virtualTileMaterial70to79; private static Material virtualTileMaterial80to89; private static Material virtualTileMaterial90to99; private static Material virtualTileMaterial100; private static List> tilePos = new List>(); private static List eggLines = new List(); internal static int lineRadius; private static int lineDiameter; internal static bool isRangeChanged = false; internal static bool isInitializedLines = false; internal static bool isInitializedVirtualTiles = false; internal static bool isInitializedTiles = false; private static readonly int accurateTileDis = 15; private static readonly int prioritizedTileDis1 = 25; private static readonly int prioritizedTileDis2 = 30; private static readonly int prioritizedTileDis3 = 35; private static readonly int prioritizedTileDis4 = 40; private static readonly int prioritizedTileDis5 = 44; private static readonly int prioritizedTileDis6 = 48; private static readonly int prioritizedTileDis7 = 50; internal static readonly int maxLineRadius = 35; internal static readonly int minLineRadius = 1; private static bool[] isProcessed = new bool[8]; private static bool isTransitioningLine = false; private static float transitionLineTimer = 0f; private static float transitionLineCurrentTime = 0f; private static Color transitionLineStartCol; private static Color transitionLineEndCol; private static Color transitionLineCurrentCol; private static readonly Color transitionColorToNormal = new Color(1f, 0.3f, 0.3f, 1f); private static readonly Color transitionColorToVirtual = new Color(0.3f, 0.3f, 1f, 1f); internal static bool isCFEEenabled; private static float toggleCFEENextTime = 0f; private static readonly float toggleCFEEInterval = 0.5f; internal static bool isVirtualGenerationMode = false; internal static bool isForceToUpdateNext = false; internal static int virtualMapSeed = -1; internal static int virtualBaseScraps = -1; internal static int virtualDungeonType = -1; internal static int numberOfAttempts; internal static bool isSuccessfulGen = false; internal static bool isGeneratingSeed = false; internal static float generationTime = 0f; internal static float generationpPreviousExcutedTime = -100f; internal static float generationTimeInterval; internal static int generationSuccessfulCount = 0; internal static readonly float minGenerationTimeInterval = 0.05f; internal static readonly float maxGenerationTimeInterval = 10f; internal static readonly int minNumberOfAttempts = 10; internal static readonly int maxNumberOfAttempts = 100000; internal static int attemptsCount = 0; internal static float previousUpdateTileTime = -100f; internal static readonly float updateTileInterval = 1f; internal static readonly float notificationInterval = 3f; internal static float notificationLastTime = 0f; internal static readonly float debugLogInterval = 1f; internal static float debugLogLastTime = 0f; internal static int failedToGenerateInARowCount = 0; internal static bool isLerpedColor = false; internal static List> addition_XZ = new List>(); internal static HashSet nonDuplicate_XZ = new HashSet(); internal static Dictionary noDuplicateDict = new Dictionary(); internal static bool isConditionedFactory = false; internal static bool isConditionedMansion = false; internal static bool isConditionedMineshaft = false; internal static bool isConditionedAnyDungeon = false; internal static int conditionedMinScraps = -1; internal static int conditionedMaxScraps = -1; internal static GameObject networkPrefab; public static void InitLineRadiusConfigEntry(int value) { lineRadius = value; } public static void InitIsCFEEenabledConfigEntry(bool flag) { isCFEEenabled = flag; } public static void InitNumberOfAttemptsConfigEntry(int value) { numberOfAttempts = value; } public static void InitGenerationIntervalConfigEntry(float value) { generationTimeInterval = value; } private static void InitializeContainerObj() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if ((Object)(object)CFEEcontainer == (Object)null) { CFEEcontainer = new GameObject("CFEEcontainer"); Plugin.mls.LogInfo((object)"Initialized CFEEcontainer"); } else { Plugin.mls.LogInfo((object)"Error: CFEEcontainer has already been initialized."); } isInitializedCFEEcontainer = true; } private static void InitializeLines() { //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) if (!isCFEEenabled) { return; } if (linesX == null) { linesX = new List(); } if (linesZ == null) { linesZ = new List(); } if (tiles == null) { tiles = new List>(); } if (virtualTiles == null) { virtualTiles = new List>(); } if (tilePos == null) { tilePos = new List>(); } if (eggLines == null) { eggLines = new List(); } ResetIsProcessed(); lineDiameter = lineRadius * 2; Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { Plugin.mls.LogInfo((object)"Error: Shader 'Sprites/Default' not found."); return; } if ((Object)(object)lineMaterial == (Object)null) { lineMaterial = new Material(val); } float num = 0.017f; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 1f, 1f, 1f); int positionCount = 2; for (int i = 0; i < lineDiameter + 1; i++) { LineRenderer val3 = new LineRenderer(); GameObject val4 = new GameObject("LineObjZ" + i); if ((Object)(object)CFEEcontainer != (Object)null) { val4.transform.SetParent(CFEEcontainer.transform); } val3 = new LineRenderer(); val3 = val4.AddComponent(); val3.positionCount = positionCount; val3.startWidth = num; val3.endWidth = num; ((Renderer)val3).sharedMaterial = lineMaterial; val3.startColor = val2; val3.endColor = val2; linesZ.Add(val3); } for (int j = 0; j < lineDiameter + 1; j++) { LineRenderer val5 = new LineRenderer(); GameObject val6 = new GameObject("LineObjX" + j); if ((Object)(object)CFEEcontainer != (Object)null) { val6.transform.SetParent(CFEEcontainer.transform); } val5 = new LineRenderer(); val5 = val6.AddComponent(); val5.positionCount = positionCount; val5.startWidth = num; val5.endWidth = num; ((Renderer)val5).sharedMaterial = lineMaterial; val5.startColor = val2; val5.endColor = val2; linesX.Add(val5); } if (isVirtualGenerationMode) { TransitionLineColor(transitionColorToVirtual, new Color(1f, 1f, 1f, 1f), 2.3f); } else { TransitionLineColor(transitionColorToNormal, new Color(1f, 1f, 1f, 1f), 2.3f); } isInitializedLines = true; Plugin.mls.LogInfo((object)"Initialized lines."); } private static void InitializeTiles() { //IL_0074: 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_005a: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) if (!isCFEEenabled) { return; } Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found."); return; } if ((Object)(object)tileMaterial == (Object)null) { tileMaterial = new Material(val); } tileMaterial.color = new Color(1f, 0f, 0f, 0.25f); Vector3 item = default(Vector3); for (int i = 0; i < lineDiameter; i++) { List list = new List(); List list2 = new List(); for (int j = 0; j < lineDiameter; j++) { GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)5); if ((Object)(object)CFEEcontainer != (Object)null) { val2.transform.SetParent(CFEEcontainer.transform); } val2.transform.position = new Vector3(0f, 0f, 0f); val2.transform.rotation = Quaternion.Euler(90f, 0f, 0f); val2.transform.localScale = new Vector3(1f, 1f, 1f); ((Renderer)val2.GetComponent()).sharedMaterial = tileMaterial; Collider component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } list.Add(val2); ((Vector3)(ref item))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)j, 0f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i); list2.Add(item); } tiles.Add(list); tilePos.Add(list2); } isInitializedTiles = true; Plugin.mls.LogInfo((object)"Initialized tiles."); } private static void InitializeVirtualTiles() { //IL_0074: 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_005a: Expected O, but got Unknown //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Expected O, but got Unknown //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Expected O, but got Unknown //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Expected O, but got Unknown //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Expected O, but got Unknown //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Expected O, but got Unknown //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Expected O, but got Unknown //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Expected O, but got Unknown //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Expected O, but got Unknown //IL_04d6: Unknown result type (might be due to invalid IL or missing references) if (!isCFEEenabled) { return; } Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found."); return; } if ((Object)(object)virtualTileMaterial == (Object)null) { virtualTileMaterial = new Material(val); } virtualTileMaterial.color = new Color(1f, 0f, 1f, 0.25f); Vector3 item = default(Vector3); for (int i = 0; i < lineDiameter; i++) { List list = new List(); List list2 = new List(); for (int j = 0; j < lineDiameter; j++) { GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)5); if ((Object)(object)CFEEcontainer != (Object)null) { val2.transform.SetParent(CFEEcontainer.transform); } val2.transform.position = new Vector3(0f, 0f, 0f); val2.transform.rotation = Quaternion.Euler(90f, 0f, 0f); val2.transform.localScale = new Vector3(1f, 1f, 1f); ((Renderer)val2.GetComponent()).sharedMaterial = virtualTileMaterial; Collider component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } list.Add(val2); ((Vector3)(ref item))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)j, 0f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i); list2.Add(item); } virtualTiles.Add(list); tilePos.Add(list2); } for (int k = 0; k < 12; k++) { float num = (float)k / 11f; float num2 = Mathf.Lerp(0.5f, 1f, num); Color color = Color.HSVToRGB(num2, 1f, 1f); color.a = 0.25f; switch (k) { case 0: if ((Object)(object)virtualTileMaterial0to09 != (Object)null) { return; } virtualTileMaterial0to09 = new Material(val); virtualTileMaterial0to09.color = color; break; case 1: if ((Object)(object)virtualTileMaterial1to9 != (Object)null) { return; } virtualTileMaterial1to9 = new Material(val); virtualTileMaterial1to9.color = color; break; case 2: if ((Object)(object)virtualTileMaterial10to19 != (Object)null) { return; } virtualTileMaterial10to19 = new Material(val); virtualTileMaterial10to19.color = color; break; case 3: if ((Object)(object)virtualTileMaterial20to29 != (Object)null) { return; } virtualTileMaterial20to29 = new Material(val); virtualTileMaterial20to29.color = color; break; case 4: if ((Object)(object)virtualTileMaterial30to39 != (Object)null) { return; } virtualTileMaterial30to39 = new Material(val); virtualTileMaterial30to39.color = color; break; case 5: if ((Object)(object)virtualTileMaterial40to49 != (Object)null) { return; } virtualTileMaterial40to49 = new Material(val); virtualTileMaterial40to49.color = color; break; case 6: if ((Object)(object)virtualTileMaterial50to59 != (Object)null) { return; } virtualTileMaterial50to59 = new Material(val); virtualTileMaterial50to59.color = color; break; case 7: if ((Object)(object)virtualTileMaterial60to69 != (Object)null) { return; } virtualTileMaterial60to69 = new Material(val); virtualTileMaterial60to69.color = color; break; case 8: if ((Object)(object)virtualTileMaterial70to79 != (Object)null) { return; } virtualTileMaterial70to79 = new Material(val); virtualTileMaterial70to79.color = color; break; case 9: if ((Object)(object)virtualTileMaterial80to89 != (Object)null) { return; } virtualTileMaterial80to89 = new Material(val); virtualTileMaterial80to89.color = color; break; case 10: if ((Object)(object)virtualTileMaterial90to99 != (Object)null) { return; } virtualTileMaterial90to99 = new Material(val); virtualTileMaterial90to99.color = color; break; case 11: if ((Object)(object)virtualTileMaterial100 != (Object)null) { return; } virtualTileMaterial100 = new Material(val); virtualTileMaterial100.color = color; break; } } SetVirtualTilesToFalse(); isInitializedVirtualTiles = true; Plugin.mls.LogInfo((object)"Initialized virtualTiles."); } [HarmonyPatch(typeof(StartOfRound))] [HarmonyPatch("Awake")] [HarmonyPostfix] private static void InitializeOnServer() { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate(networkPrefab); val.GetComponent().Spawn(true); Plugin.mls.LogInfo((object)"InitializedOnServer is called."); } } private static void ResetIsProcessed() { if (isProcessed == null) { isProcessed = new bool[8]; } for (int i = 0; i < isProcessed.Length; i++) { isProcessed[i] = false; } } [HarmonyPatch(typeof(RoundManager))] [HarmonyPatch("__rpc_handler_2729232387")] [HarmonyPostfix] private static void SetRandomMapSeed(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { randomMapSeed = StartOfRound.Instance.randomMapSeed; Plugin.mls.LogInfo((object)("Current mapseed is " + randomMapSeed)); VirtualNewLevelGenerator(randomMapSeed); } internal static void ToggleCFEEWithInput() { if (isVirtualGenerationMode) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while Virtual Generation Mode is active."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while Virtual Generation Mode is active.", false, false, "LC_Tip1"); } else if (Time.time >= toggleCFEENextTime) { toggleCFEENextTime = Time.time + toggleCFEEInterval; if (!isCFEEenabled) { isVirtualGenerationMode = false; HUDTextCfee.UpdateVirtualGenMode(); virtualMapSeed = -1; DeleteLineAndTile(); isForceToUpdateNext = true; isCFEEenabled = true; Plugin.mls.LogInfo((object)"CFEE enabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE enabled.", false, false, "LC_Tip1"); } else if (isCFEEenabled) { isVirtualGenerationMode = false; HUDTextCfee.UpdateVirtualGenMode(); virtualMapSeed = -1; DisableAllEgglines(); DeleteLineAndTile(); isCFEEenabled = false; Plugin.mls.LogInfo((object)"CFEE disabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE disabled.", false, false, "LC_Tip1"); } } } internal static void ToggleVirtualGenerationModeWithInput() { if (!isCFEEenabled) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1"); } else if (isVirtualGenerationMode) { isVirtualGenerationMode = false; HUDTextCfee.UpdateVirtualGenMode(); virtualMapSeed = -1; DeleteLineAndTile(); isLerpedColor = false; DeleteAllTileChache(); isForceToUpdateNext = true; Plugin.mls.LogInfo((object)"Virtual Generation Mode disabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode disabled.", false, false, "LC_Tip1"); } else if (!isVirtualGenerationMode) { isVirtualGenerationMode = true; HUDTextCfee.UpdateVirtualGenMode(); virtualMapSeed = -1; DeleteLineAndTile(); isForceToUpdateNext = true; Plugin.mls.LogInfo((object)"Virtual Generation Mode enabled."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode enabled.", false, false, "LC_Tip1"); } } internal static void ClearTilesWithInput() { if (!isCFEEenabled) { Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled\nTo enable CFEE, use the /enable command."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1"); return; } if (!isVirtualGenerationMode) { Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1"); return; } SetVirtualTilesToFalse(); HUDTextCfee.ClearGenerationStatus(); Plugin.mls.LogInfo((object)"Cleared virtual tiles."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Cleared virtual tiles.", false, false, "LC_Tip1"); } internal static void ClearConditionsWithInput(bool isNotification = true) { isConditionedFactory = false; isConditionedMansion = false; isConditionedMineshaft = false; isConditionedAnyDungeon = false; conditionedMinScraps = -1; conditionedMaxScraps = -1; HUDTextCfee.UpdateScrapRange(); HUDTextCfee.UpdateInteriorType(); HUDTextCfee.ClearGenerationStatus(); if (isNotification) { HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Conditions were cleared.", false, false, "LC_Tip1"); } Plugin.mls.LogInfo((object)"Conditions were cleared."); } [HarmonyPatch(typeof(StartOfRound))] [HarmonyPatch("ChangeLevel")] [HarmonyPostfix] private static void StopGenerationWhenChangeLevel() { if (isVirtualGenerationMode && isGeneratingSeed) { UpdateLerpedColorVirtualTiles(isReferGenSuccessfulCount: true); StopGeneration(completed: false); } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyPatch("ArriveAtLevel")] [HarmonyPostfix] private static void ClearConditionsWhenArriveAtLevel() { if (isCFEEenabled && (conditionedMinScraps != -1 || conditionedMaxScraps != -1 || isConditionedAnyDungeon)) { ClearConditionsWithInput(); } else { ClearConditionsWithInput(isNotification: false); } } internal static void StartGenerationWithInput() { if (isVirtualGenerationMode) { if (!isGeneratingSeed) { StartGeneration(); return; } Plugin.mls.LogInfo((object)"Warning: Generation has already started."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Generation has already started.", false, false, "LC_Tip1"); } else { Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1"); } } internal static void StopGenerationWithInput() { if (isVirtualGenerationMode) { if (isGeneratingSeed) { UpdateLerpedColorVirtualTiles(isReferGenSuccessfulCount: true); StopGeneration(completed: false); Plugin.mls.LogInfo((object)"Generation stopped."); } else { Plugin.mls.LogInfo((object)"Warning: Generation has not started."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Generation has not started.", false, false, "LC_Tip1"); } } else { Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1"); } } internal static void StartGeneration() { if (isCFEEenabled) { CreateTileChache(); isGeneratingSeed = true; attemptsCount = 0; generationTime = 0f; generationSuccessfulCount = 0; generationpPreviousExcutedTime = 0f; failedToGenerateInARowCount = 0; HUDTextCfee.ClearGenerationStatus(); Plugin.mls.LogInfo((object)"Generation started."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation started.", false, false, "LC_Tip1"); } } internal static void StopGeneration(bool completed) { isGeneratingSeed = false; isSuccessfulGen = false; generationTime = 0f; previousUpdateTileTime = -100f; generationpPreviousExcutedTime = 0f; failedToGenerateInARowCount = 0; if (completed) { Plugin.mls.LogInfo((object)"Generation completed."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation completed.", false, false, "LC_Tip1"); HUDTextCfee.UpdateSuccessRate(); } else { Plugin.mls.LogInfo((object)"Generation stopped."); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation stopped.", false, false, "LC_Tip1"); HUDTextCfee.UpdateSuccessRate(); } } private static void CreateTileChache() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) DeleteAllTileChache(); for (int i = 0; i < virtualTiles.Count; i++) { List list = new List(); for (int j = 0; j < virtualTiles[i].Count; j++) { int num = (int)virtualTiles[i][j].transform.position.x + (int)virtualTiles[i][j].transform.position.z; list.Add(num); noDuplicateDict[num] = 0; } addition_XZ.Add(list); } Plugin.mls.LogInfo((object)("Tile chache created. dictionary count: " + noDuplicateDict.Count + "\nKeys list:")); Plugin.mls.LogInfo((object)string.Join(", ", noDuplicateDict.Keys)); } internal static void DeleteAllTileChache() { noDuplicateDict.Clear(); addition_XZ.Clear(); Plugin.mls.LogInfo((object)"Tile chache deleted."); } private static void UpdateGeneration() { if (!isCFEEenabled || !isGeneratingSeed || !isVirtualGenerationMode) { return; } if (generationTimeInterval >= 0f) { if (generationTimeInterval <= generationTime - generationpPreviousExcutedTime) { for (int i = 0; i < 10; i++) { if (generationSuccessfulCount < numberOfAttempts) { VirtualNewLevelGeneratorWithConditions(); if (isSuccessfulGen) { UpdateNoDuplicateDict(); } } } generationpPreviousExcutedTime = generationTime; } } else { Plugin.mls.LogInfo((object)"Error: generationTimeInterval is less than 0."); } if (updateTileInterval <= generationTime - previousUpdateTileTime) { UpdateLerpedColorVirtualTiles(); previousUpdateTileTime = generationTime; } generationTime += Time.deltaTime; if (generationSuccessfulCount >= numberOfAttempts) { UpdateLerpedColorVirtualTiles(isReferGenSuccessfulCount: true); StopGeneration(completed: true); } } internal static void VirtualNewLevelGenerator(int mapSeed, bool isDisplayTip = true) { if (isCFEEenabled) { Random anomalyRandomRef = new Random(mapSeed + 5); int num = LevelEmulator.EmulateNumberOfBaseScrapsSpawn(ref anomalyRandomRef); Random levelRandomRef = new Random(mapSeed); int num2 = LevelEmulator.EmulateGenerateNewFloor(ref levelRandomRef); string text = ((num2 == 0 || num2 == 2 || num2 == 3) ? new string("Factory") : (num2 switch { 1 => new string("Mansion"), 4 => new string("MineShaft"), _ => new string("Unknown"), })); if (isVirtualGenerationMode) { virtualMapSeed = mapSeed; virtualDungeonType = num2; virtualBaseScraps = num; } isForceToUpdateNext = true; if (isDisplayTip && !isVirtualGenerationMode) { Plugin.mls.LogInfo((object)("Current mapseed: " + randomMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text)); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Current mapseed: " + randomMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text, false, false, "LC_Tip1"); } if (isDisplayTip && isVirtualGenerationMode) { Plugin.mls.LogInfo((object)("Current mapseed: " + virtualMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text)); HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Current mapseed: " + virtualMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text, false, false, "LC_Tip1"); } } } internal static void VirtualNewLevelGeneratorWithConditions(int maxTimes = 50, bool isDisplayTip = false) { if (!isCFEEenabled) { return; } if (!isVirtualGenerationMode) { if (UpdateAndCheckNotificationInterval()) { HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1"); } if (UpdateAndCheckDebugLogInterval()) { Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode."); } return; } isSuccessfulGen = false; int timeToSuccessful = 0; string text = "unknown"; int num = -1; int num2 = -1; for (int i = 0; i < maxTimes; i++) { attemptsCount++; num2 = LevelEmulator.EmulateChooseNewRandomMapSeed(); Random anomalyRandomRef = new Random(num2 + 5); num = LevelEmulator.EmulateNumberOfBaseScrapsSpawn(ref anomalyRandomRef); if ((conditionedMinScraps != -1 || conditionedMaxScraps != -1) && (num < conditionedMinScraps || num > conditionedMaxScraps)) { failedToGenerateInARowCount++; continue; } Random levelRandomRef = new Random(num2); int num3 = LevelEmulator.EmulateGenerateNewFloor(ref levelRandomRef); if (num3 == 0 || num3 == 2 || num3 == 3) { if (!isConditionedFactory && isConditionedAnyDungeon) { failedToGenerateInARowCount++; continue; } text = "Factory"; } else { switch (num3) { case 1: if (!isConditionedMansion && isConditionedAnyDungeon) { failedToGenerateInARowCount++; continue; } text = "Mansion"; break; case 4: if (!isConditionedMineshaft && isConditionedAnyDungeon) { failedToGenerateInARowCount++; continue; } text = "MineShaft"; break; default: failedToGenerateInARowCount++; continue; } } virtualMapSeed = num2; virtualDungeonType = num3; virtualBaseScraps = num; timeToSuccessful = i + 1; isSuccessfulGen = true; break; } if (isSuccessfulGen) { generationSuccessfulCount++; int num4 = failedToGenerateInARowCount + 1; if (UpdateAndCheckDebugLogInterval()) { Plugin.mls.LogInfo((object)("A valid mapseed after " + timeToSuccessful + " attempts. Mapseed: " + num2 + " Base scraps: " + num + " Interior type: " + text + " " + generationSuccessfulCount + "/" + numberOfAttempts)); } if (isDisplayTip && !isGeneratingSeed) { HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "A valid mapseed after " + timeToSuccessful + " attempts. Mapseed: " + num2 + " Base scraps: " + num + " Interior type: " + text, false, false, "LC_Tip1"); } failedToGenerateInARowCount = 0; isForceToUpdateNext = true; if (isGeneratingSeed) { HUDTextCfee.UpdateGenStatus(virtualMapSeed, generationSuccessfulCount, timeToSuccessful, text, num); } else { HUDTextCfee.UpdateGenStatusSingleAttempt(virtualMapSeed, timeToSuccessful, text, num); } } else { if (UpdateAndCheckDebugLogInterval()) { Plugin.mls.LogInfo((object)("Failed to generate a mapseed that meets the conditions after " + failedToGenerateInARowCount + " attempts. " + generationSuccessfulCount + "/" + numberOfAttempts)); } if (UpdateAndCheckNotificationInterval()) { HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Failed to generate a mapseed that meets the conditions after " + failedToGenerateInARowCount + " attempts. " + generationSuccessfulCount + "/" + numberOfAttempts, false, false, "LC_Tip1"); } } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch("Update")] [HarmonyPostfix] private static void PlayerControllerUpdateExtension(PlayerControllerB __instance) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { Plugin.mls.LogInfo((object)"Error: PlayerControllerB __instance is null."); } else { if ((Object)(object)__instance != (Object)(object)StartOfRound.Instance.localPlayerController || !__instance.isPlayerControlled) { return; } CFEEInput.KeyInput(); HUDTextCfee.HUDTextCfeeUpdate(); if (!isCFEEenabled) { return; } if (!isInitializedCFEEcontainer) { InitializeContainerObj(); } if (!isInitializedLines) { InitializeLines(); if (!isInitializedTiles && !isVirtualGenerationMode) { InitializeTiles(); } else if (!isInitializedVirtualTiles && isVirtualGenerationMode) { InitializeVirtualTiles(); closestPos.x = (int)Math.Round(((Component)__instance).transform.position.x); closestPos.z = (int)Math.Round(((Component)__instance).transform.position.z); } if (!isInitializedLines) { Plugin.mls.LogInfo((object)"Error: Failed to initialize Lines."); return; } } _ = ((Component)__instance).transform.position; if (false) { Plugin.mls.LogInfo((object)"Error: transform.position is null."); return; } playerFloorPosY = ((Component)__instance).transform.position.y; if (!isVirtualGenerationMode) { closestPos.x = (int)Math.Round(((Component)__instance).transform.position.x); closestPos.z = (int)Math.Round(((Component)__instance).transform.position.z); } UpdateGeneration(); UpdateLine(); UpdateTransitionLineColor(); if (!isVirtualGenerationMode) { UpdateTilePosition(); } else if (isVirtualGenerationMode) { UpdateTilePositionOnVirtualGenerationMode(); } UpdateEggLines(); previousClosestPos = closestPos; previousPlayerFloorPosY = playerFloorPosY; isLocalPlayerServer = ((NetworkBehaviour)__instance).IsServer; lastUpdateTime += Time.deltaTime; if (isRangeChanged) { isRangeChanged = false; } if (isForceToUpdateNext) { isForceToUpdateNext = false; } } } private static void UpdateLine() { //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) if (linesZ == null || linesX == null) { Plugin.mls.LogInfo((object)"Skipped UpdateLine because some variables are null."); return; } _ = previousClosestPos; if (false) { previousClosestPos.InitToZero(); } if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY && !isRangeChanged && !isForceToUpdateNext) { return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)closestPos.x - (float)(lineDiameter / 2), playerFloorPosY + 0.102f, (float)closestPos.z); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor((float)closestPos.x + (float)(lineDiameter / 2), playerFloorPosY + 0.102f, (float)closestPos.z); for (int i = 0; i < linesZ.Count; i++) { if ((Object)(object)linesZ[i] == (Object)null) { continue; } int num = 0; if (i != 0) { if (i % 2 == 0) { num = i / 2; num = -num; } else { num = (i + 1) / 2; } } Vector3 val3 = val; val3.z += num; Vector3 val4 = val2; val4.z += num; linesZ[i].SetPosition(0, val3); linesZ[i].SetPosition(1, val4); } Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor((float)closestPos.x, playerFloorPosY + 0.102f, (float)closestPos.z - (float)(lineDiameter / 2)); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor((float)closestPos.x, playerFloorPosY + 0.102f, (float)closestPos.z + (float)(lineDiameter / 2)); for (int j = 0; j < linesX.Count; j++) { if ((Object)(object)linesX[j] == (Object)null) { continue; } int num2 = 0; if (j != 0) { if (j % 2 == 0) { num2 = j / 2; num2 = -num2; } else { num2 = (j + 1) / 2; } } Vector3 val7 = val5; val7.x += num2; Vector3 val8 = val6; val8.x += num2; linesX[j].SetPosition(0, val7); linesX[j].SetPosition(1, val8); } } private static void UpdateTilePosition() { //IL_070c: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0741: 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_0120: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) if (tilePos == null || tiles == null) { Plugin.mls.LogInfo((object)"Skipped UpdateTilePosition because some variables are null."); } else if (randomMapSeed != -1) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)closestPos.x, 0f, (float)closestPos.z); if (previousClosestPos != closestPos || isRangeChanged || isForceToUpdateNext) { Vector3 val2 = default(Vector3); for (int i = 0; i < lineDiameter; i++) { int num = 0; while (num < lineDiameter) { if (!((Object)(object)tiles[i][num] == (Object)null)) { ((Vector3)(ref val2))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)num, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i); tilePos[i][num] = val + val2; tiles[i][num].transform.position = tilePos[i][num]; if (i >= lineRadius - accurateTileDis && i <= lineRadius + accurateTileDis && num >= lineRadius - accurateTileDis && num <= lineRadius + accurateTileDis) { GameObject obj = tiles[i][num]; Vector3 position = tiles[i][num].transform.position; obj.SetActive(LevelEmulator.EmulateExplodeEgg(in position)); } num++; continue; } goto IL_00bb; } continue; IL_00bb: Plugin.mls.LogInfo((object)"Error: Tile is null."); break; } lastUpdateTime = 0f; ResetIsProcessed(); isProcessed[0] = true; } else if (lastUpdateTime > 0.24f && isProcessed[7]) { if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY) { return; } Vector3 val3 = default(Vector3); for (int j = 0; j < lineDiameter; j++) { for (int k = 0; k < lineDiameter; k++) { ((Vector3)(ref val3))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)k, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)j); tilePos[j][k] = val + val3; tiles[j][k].transform.position = tilePos[j][k]; } } } else if (lastUpdateTime > 0.21f && !isProcessed[7] && isProcessed[6]) { ProcessTileUpdate(playerFloorPosY, prioritizedTileDis6, prioritizedTileDis7); isProcessed[7] = true; } else if (lastUpdateTime > 0.18f && !isProcessed[6] && isProcessed[5]) { ProcessTileUpdate(playerFloorPosY, prioritizedTileDis5, prioritizedTileDis6); isProcessed[6] = true; } else if (lastUpdateTime > 0.15f && !isProcessed[5] && isProcessed[4]) { ProcessTileUpdate(playerFloorPosY, prioritizedTileDis4, prioritizedTileDis5); isProcessed[5] = true; } else if (lastUpdateTime > 0.12f && !isProcessed[4] && isProcessed[3]) { ProcessTileUpdate(playerFloorPosY, prioritizedTileDis3, prioritizedTileDis4); isProcessed[4] = true; } else if (lastUpdateTime > 0.09f && !isProcessed[3] && isProcessed[2]) { ProcessTileUpdate(playerFloorPosY, prioritizedTileDis2, prioritizedTileDis3); isProcessed[3] = true; } else if (lastUpdateTime > 0.06f && !isProcessed[2] && isProcessed[1]) { ProcessTileUpdate(playerFloorPosY, prioritizedTileDis1, prioritizedTileDis2); isProcessed[2] = true; } else if (lastUpdateTime > 0.03f && !isProcessed[1] && isProcessed[0]) { ProcessTileUpdate(playerFloorPosY, accurateTileDis, prioritizedTileDis1); isProcessed[1] = true; } else { if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY) { return; } Vector3 val4 = default(Vector3); for (int l = 0; l < lineDiameter; l++) { for (int m = 0; m < lineDiameter; m++) { ((Vector3)(ref val4))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)m, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)l); tilePos[l][m] = val + val4; tiles[l][m].transform.position = tilePos[l][m]; } } } } else { if (!(previousClosestPos != closestPos) && !isRangeChanged && !isForceToUpdateNext) { return; } Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor((float)closestPos.x, 0f, (float)closestPos.z); Vector3 val6 = default(Vector3); for (int n = 0; n < lineDiameter; n++) { for (int num2 = 0; num2 < lineDiameter; num2++) { ((Vector3)(ref val6))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)num2, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)n); tilePos[n][num2] = val5 + val6; tiles[n][num2].transform.position = tilePos[n][num2]; tiles[n][num2].SetActive(false); } } } } private static void UpdateTilePositionOnVirtualGenerationMode() { //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: 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_0120: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) if (tilePos == null || virtualTiles == null) { Plugin.mls.LogInfo((object)"Skipped UpdateTilePosition because some variables are null."); } else if (virtualMapSeed != -1) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)closestPos.x, 0f, (float)closestPos.z); if (previousClosestPos != closestPos || isRangeChanged || isForceToUpdateNext) { int num = 0; Vector3 val2 = default(Vector3); while (true) { if (num < lineDiameter) { int num2 = 0; while (num2 < lineDiameter) { if (!((Object)(object)virtualTiles[num][num2] == (Object)null)) { ((Vector3)(ref val2))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)num2, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)num); tilePos[num][num2] = val + val2; virtualTiles[num][num2].transform.position = tilePos[num][num2]; num2++; continue; } goto IL_00bb; } num++; continue; } if (!isLerpedColor) { UpdateSingleColorVirtualTiles(); } break; IL_00bb: Plugin.mls.LogInfo((object)"Error: virtualTile is null."); break; } lastUpdateTime = 0f; ResetIsProcessed(); isProcessed[0] = true; } else if (lastUpdateTime > 0.24f && isProcessed[7]) { if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY) { return; } Vector3 val3 = default(Vector3); for (int i = 0; i < lineDiameter; i++) { for (int j = 0; j < lineDiameter; j++) { ((Vector3)(ref val3))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)j, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i); tilePos[i][j] = val + val3; virtualTiles[i][j].transform.position = tilePos[i][j]; } } } else if (lastUpdateTime > 0.21f && !isProcessed[7] && isProcessed[6]) { ProcessVirtualTileUpdate(playerFloorPosY, prioritizedTileDis6, prioritizedTileDis7); isProcessed[7] = true; } else if (lastUpdateTime > 0.18f && !isProcessed[6] && isProcessed[5]) { ProcessVirtualTileUpdate(playerFloorPosY, prioritizedTileDis5, prioritizedTileDis6); isProcessed[6] = true; } else if (lastUpdateTime > 0.15f && !isProcessed[5] && isProcessed[4]) { ProcessVirtualTileUpdate(playerFloorPosY, prioritizedTileDis4, prioritizedTileDis5); isProcessed[5] = true; } else if (lastUpdateTime > 0.12f && !isProcessed[4] && isProcessed[3]) { ProcessVirtualTileUpdate(playerFloorPosY, prioritizedTileDis3, prioritizedTileDis4); isProcessed[4] = true; } else if (lastUpdateTime > 0.09f && !isProcessed[3] && isProcessed[2]) { ProcessVirtualTileUpdate(playerFloorPosY, prioritizedTileDis2, prioritizedTileDis3); isProcessed[3] = true; } else if (lastUpdateTime > 0.06f && !isProcessed[2] && isProcessed[1]) { ProcessVirtualTileUpdate(playerFloorPosY, prioritizedTileDis1, prioritizedTileDis2); isProcessed[2] = true; } else if (lastUpdateTime > 0.03f && !isProcessed[1] && isProcessed[0]) { ProcessVirtualTileUpdate(playerFloorPosY, accurateTileDis, prioritizedTileDis1); isProcessed[1] = true; } else { if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY) { return; } Vector3 val4 = default(Vector3); for (int k = 0; k < lineDiameter; k++) { for (int l = 0; l < lineDiameter; l++) { ((Vector3)(ref val4))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)l, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)k); tilePos[k][l] = val + val4; virtualTiles[k][l].transform.position = tilePos[k][l]; } } } } else { if (!(previousClosestPos != closestPos) && !isRangeChanged && !isForceToUpdateNext) { return; } Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor((float)closestPos.x, 0f, (float)closestPos.z); Vector3 val6 = default(Vector3); for (int m = 0; m < lineDiameter; m++) { for (int n = 0; n < lineDiameter; n++) { ((Vector3)(ref val6))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)n, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)m); tilePos[m][n] = val5 + val6; virtualTiles[m][n].transform.position = tilePos[m][n]; virtualTiles[m][n].SetActive(false); } } } } internal static bool UpdateAndCheckNotificationInterval() { if (notificationInterval <= Time.time - notificationLastTime) { notificationLastTime = Time.time; return true; } return false; } internal static bool UpdateAndCheckDebugLogInterval() { if (debugLogInterval <= Time.time - debugLogLastTime) { debugLogLastTime = Time.time; return true; } return false; } internal static void SetVirtualTilesToFalse() { for (int i = 0; i < virtualTiles.Count; i++) { for (int j = 0; j < virtualTiles[i].Count; j++) { if ((Object)(object)virtualTiles[i][j] == (Object)null) { Plugin.mls.LogInfo((object)"Error: virtualTile is null."); return; } virtualTiles[i][j].SetActive(false); } } } private static void UpdateEggLines() { for (int i = 0; i < eggLines.Count; i++) { if ((Object)(object)eggLines[i] != (Object)null && !eggLines[i].isDisabled) { eggLines[i].UpdateEggLine(playerFloorPosY + 0.101f); if (eggLines[i].isDisabled) { Object.Destroy((Object)(object)((Component)eggLines[i]).gameObject); Object.Destroy((Object)(object)eggLines[i]); } } } } internal static void DisableAllEgglines() { for (int i = 0; i < eggLines.Count; i++) { if ((Object)(object)eggLines[i] != (Object)null && !eggLines[i].isDisabled) { eggLines[i].DisableIndicator(); if (eggLines[i].isDisabled) { Object.Destroy((Object)(object)((Component)eggLines[i]).gameObject); Object.Destroy((Object)(object)eggLines[i]); } } } } private static void ProcessTileUpdate(float playerPosY, int MinSize, int MaxSize) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0137: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)closestPos.x, 0f, (float)closestPos.z); Vector3 val2 = default(Vector3); for (int i = 0; i < lineDiameter; i++) { for (int j = 0; j < lineDiameter; j++) { ((Vector3)(ref val2))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)j, playerPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i); tilePos[i][j] = val + val2; tiles[i][j].transform.position = tilePos[i][j]; if ((i < lineRadius - MinSize || i > lineRadius + MinSize || j < lineRadius - MinSize || j > lineRadius + MinSize) && i >= lineRadius - MaxSize && i <= lineRadius + MaxSize && j >= lineRadius - MaxSize && j <= lineRadius + MaxSize) { GameObject obj = tiles[i][j]; Vector3 position = tiles[i][j].transform.position; obj.SetActive(LevelEmulator.EmulateExplodeEgg(in position)); } } } } private static void ProcessVirtualTileUpdate(float playerPosY, int MinSize, int MaxSize) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)closestPos.x, 0f, (float)closestPos.z); Vector3 val2 = default(Vector3); for (int i = 0; i < lineDiameter; i++) { for (int j = 0; j < lineDiameter; j++) { ((Vector3)(ref val2))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)j, playerPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i); tilePos[i][j] = val + val2; virtualTiles[i][j].transform.position = tilePos[i][j]; } } } private static void UpdateNoDuplicateDict() { foreach (int item in noDuplicateDict.Keys.ToList()) { if (LevelEmulator.EmulateExplodeEggWithVirtualSeedAdditionXZ(item)) { noDuplicateDict[item]++; } } } private static void UpdateSingleColorVirtualTiles() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (virtualTiles == null) { Plugin.mls.LogInfo((object)"Error: virtualTiles is null"); return; } if (isLerpedColor) { Plugin.mls.LogInfo((object)"Error: UpdateSingleColorVirtualTiles called when isLerpedColor is true"); return; } for (int i = 0; i < virtualTiles.Count; i++) { for (int j = 0; j < virtualTiles[i].Count; j++) { Vector3 position = virtualTiles[i][j].transform.position; if (LevelEmulator.EmulateExplodeEggWithVirtualSeed(in position)) { virtualTiles[i][j].SetActive(true); } } } } private static void UpdateLerpedColorVirtualTiles(bool isReferGenSuccessfulCount = false) { if (noDuplicateDict == null || virtualTiles == null || addition_XZ == null) { Plugin.mls.LogInfo((object)"Error: Some variables are null"); return; } if (!isLerpedColor) { isLerpedColor = true; Plugin.mls.LogInfo((object)"isLerpedColor is true."); } bool flag = false; for (int i = 0; i < virtualTiles.Count; i++) { for (int j = 0; j < virtualTiles[i].Count; j++) { int num = 0; if (noDuplicateDict.TryGetValue(addition_XZ[i][j], out var value)) { num = (isReferGenSuccessfulCount ? AssignMatIndex(value, isReferGenSuccessfulCount: true) : AssignMatIndex(value)); } else { Plugin.mls.LogInfo((object)"Error: Failed to TryGetValue with no DuplicateDict."); } switch (num) { case 0: virtualTiles[i][j].SetActive(false); break; case 1: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial0to09) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial0to09; } virtualTiles[i][j].SetActive(true); break; case 2: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial1to9) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial1to9; } virtualTiles[i][j].SetActive(true); break; case 3: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial10to19) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial10to19; } virtualTiles[i][j].SetActive(true); break; case 4: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial20to29) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial20to29; } virtualTiles[i][j].SetActive(true); break; case 5: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial30to39) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial30to39; } virtualTiles[i][j].SetActive(true); break; case 6: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial40to49) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial40to49; } virtualTiles[i][j].SetActive(true); break; case 7: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial50to59) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial50to59; } virtualTiles[i][j].SetActive(true); break; case 8: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial60to69) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial60to69; } virtualTiles[i][j].SetActive(true); break; case 9: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial70to79) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial70to79; } virtualTiles[i][j].SetActive(true); break; case 10: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial80to89) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial80to89; } virtualTiles[i][j].SetActive(true); break; case 11: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial90to99) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial90to99; } virtualTiles[i][j].SetActive(true); break; case 12: if ((Object)(object)((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial != (Object)(object)virtualTileMaterial100) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial100; } virtualTiles[i][j].SetActive(true); break; default: flag = true; break; } } } if (flag) { Plugin.mls.LogInfo((object)"Error: matIndex is invalid value."); } } internal static void SetVirtualTilesMatToDefault() { if (isGeneratingSeed) { Plugin.mls.LogInfo((object)"Error: SetVirtualTilesMatToDefault called when isGeneratingSeed is true."); } else { if (!isLerpedColor) { return; } for (int i = 0; i < virtualTiles.Count; i++) { for (int j = 0; j < virtualTiles[i].Count; j++) { ((Renderer)virtualTiles[i][j].gameObject.GetComponent()).sharedMaterial = virtualTileMaterial; } } isLerpedColor = false; DeleteAllTileChache(); Plugin.mls.LogInfo((object)"isLerpedColor is false."); } } private static int AssignMatIndex(int number, bool isReferGenSuccessfulCount = false) { if (number < 0) { Plugin.mls.LogInfo((object)"Error: numOfExplode is less than 0."); return -1; } int num = -1; if (numberOfAttempts <= 0) { Plugin.mls.LogInfo((object)"Error: numberOfAttempts is 0 or less."); return -1; } if (generationSuccessfulCount <= 0) { return 0; } float num2 = (float)number / (float)numberOfAttempts; num2 = (isReferGenSuccessfulCount ? ((float)number / (float)generationSuccessfulCount) : ((float)number / (float)numberOfAttempts)); if (number == 0) { num = 0; } else if (num2 <= 0.009f) { num = 1; } else if (num2 <= 0.09f) { num = 2; } else if (num2 <= 0.19f) { num = 3; } else if (num2 <= 0.29f) { num = 4; } else if (num2 <= 0.39f) { num = 5; } else if (num2 <= 0.49f) { num = 6; } else if (num2 <= 0.59f) { num = 7; } else if (num2 <= 0.69f) { num = 8; } else if (num2 <= 0.79f) { num = 9; } else if (num2 <= 0.89f) { num = 10; } else if (num2 <= 0.99f) { num = 11; } else if (num2 <= 1f) { num = 12; } else { Plugin.mls.LogInfo((object)"Error: chanceToExp is over 1.0f."); num = 12; } return num; } [HarmonyPatch(typeof(StunGrenadeItem))] [HarmonyPatch("__rpc_handler_1175066890")] [HarmonyPostfix] private static void SetExplodeOnThrowClinetRPCExtension(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (isCFEEenabled && isLocalPlayerServer) { StunGrenadeItem val = (StunGrenadeItem)(object)((target is StunGrenadeItem) ? target : null); if ((Object)(object)val == (Object)null) { Plugin.mls.LogInfo((object)"Error: NetworkBehaviour stunGrenadeTarget is null."); } else if ((Object)(object)EggLineSync.Instance == (Object)null) { Plugin.mls.LogInfo((object)"Error: EggLineSync is null."); } else if (isLocalPlayerServer) { EggLineSync.Instance.EggLinesClientRpc(((Component)val).transform.position, val.explodeOnThrow); } } } public static void GenerateEggLine(Vector3 egglinePos, bool isExplode) { //IL_0035: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (!isCFEEenabled) { return; } Vector3 val; if (isExplode && !isLerpedColor) { HUDManager instance = HUDManager.Instance; val = egglinePos; instance.DisplayTip("CoordinateForEasterEggs", "The easter egg will explode!!\nPicked it up from:\n" + ((object)(Vector3)(ref val)).ToString(), false, false, "LC_Tip1"); ManualLogSource mls = Plugin.mls; val = egglinePos; mls.LogInfo((object)("The easter egg will explode!!\nPicked it up from:\n" + ((object)(Vector3)(ref val)).ToString())); } else if (isLerpedColor) { int key = (int)egglinePos.x + (int)egglinePos.z; if (noDuplicateDict.TryGetValue(key, out var value)) { float num = (float)value / (float)generationSuccessfulCount * 100f; HUDManager instance2 = HUDManager.Instance; string text = num.ToString("F3"); val = egglinePos; instance2.DisplayTip("CoordinateForEasterEggs", "Chance to explode with the current conditions: " + text + "%\nPicked it up from:\n" + ((object)(Vector3)(ref val)).ToString(), false, false, "LC_Tip1"); ManualLogSource mls2 = Plugin.mls; string text2 = num.ToString("F3"); val = egglinePos; mls2.LogInfo((object)("Chance to explode with the current conditions: " + text2 + "%\nPicked it up from:\n" + ((object)(Vector3)(ref val)).ToString())); } } GameObject val2 = new GameObject("EggLine"); EggLine eggLine = val2.AddComponent(); eggLine.InitAndSetPos(egglinePos, isExplode, in playerFloorPosY); for (int i = 0; i < eggLines.Count; i++) { if ((Object)(object)eggLines[i] == (Object)null) { eggLines[i] = eggLine; Plugin.mls.LogInfo((object)("New EggLine is added at index " + i + ". Length is " + (eggLines.Count - 1))); return; } } eggLines.Add(eggLine); Plugin.mls.LogInfo((object)("New EggLine is added at index " + (eggLines.Count - 1) + " as new index")); } internal static void TransitionLineColor(Color colorStart, Color colorEnd, float timer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) isTransitioningLine = true; transitionLineTimer = timer; transitionLineCurrentTime = timer; transitionLineStartCol = colorStart; transitionLineEndCol = colorEnd; } internal static void UpdateTransitionLineColor() { //IL_00ab: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) if (!isTransitioningLine) { return; } if (transitionLineTimer <= 0f) { Plugin.mls.LogInfo((object)"Error: transitionLineTimer is 0f or less"); return; } float num = Mathf.Clamp01(1f - transitionLineCurrentTime / transitionLineTimer); float num2 = Mathf.Lerp(transitionLineStartCol.r, transitionLineEndCol.r, num); float num3 = Mathf.Lerp(transitionLineStartCol.g, transitionLineEndCol.g, num); float num4 = Mathf.Lerp(transitionLineStartCol.b, transitionLineEndCol.b, num); transitionLineCurrentCol = new Color(num2, num3, num4); for (int i = 0; i < linesZ.Count; i++) { if ((Object)(object)linesZ[i] == (Object)null) { continue; } int num5 = 0; if (i != 0) { if (i % 2 == 0) { num5 = i / 2; num5 = -num5; } else { num5 = (i + 1) / 2; } } linesZ[i].startColor = transitionLineCurrentCol; linesZ[i].endColor = transitionLineCurrentCol; } for (int j = 0; j < linesX.Count; j++) { if ((Object)(object)linesX[j] == (Object)null) { continue; } int num6 = 0; if (j != 0) { if (j % 2 == 0) { num6 = j / 2; num6 = -num6; } else { num6 = (j + 1) / 2; } } linesX[j].startColor = transitionLineCurrentCol; linesX[j].endColor = transitionLineCurrentCol; } if (transitionLineCurrentTime >= 0f) { transitionLineCurrentTime -= Time.deltaTime; return; } for (int k = 0; k < linesX.Count; k++) { if ((Object)(object)linesX[k] == (Object)null) { continue; } int num7 = 0; if (k != 0) { if (k % 2 == 0) { num7 = k / 2; num7 = -num7; } else { num7 = (k + 1) / 2; } } linesX[k].startColor = transitionLineEndCol; linesX[k].endColor = transitionLineEndCol; } for (int l = 0; l < linesZ.Count; l++) { if ((Object)(object)linesZ[l] == (Object)null) { continue; } int num8 = 0; if (l != 0) { if (l % 2 == 0) { num8 = l / 2; num8 = -num8; } else { num8 = (l + 1) / 2; } } linesZ[l].startColor = transitionLineEndCol; linesZ[l].endColor = transitionLineEndCol; } transitionLineCurrentTime = 0f; isTransitioningLine = false; transitionLineTimer = 0f; } public static void ResetAll() { DeleteLineAndTile(); DeleteAllTileChache(); eggLines = null; randomMapSeed = -1; closestPos.InitToZero(); isRangeChanged = false; previousClosestPos.InitToZero(); previousPlayerFloorPosY = 0f; lastUpdateTime = 0f; playerFloorPosY = 0f; isProcessed = null; isLocalPlayerServer = false; virtualMapSeed = -1; virtualBaseScraps = -1; virtualDungeonType = -1; isLerpedColor = false; isGeneratingSeed = false; generationTime = 0f; generationSuccessfulCount = 0; generationpPreviousExcutedTime = 0f; attemptsCount = 0; isVirtualGenerationMode = false; isSuccessfulGen = false; isConditionedFactory = false; isConditionedMansion = false; isConditionedMineshaft = false; isConditionedAnyDungeon = false; conditionedMinScraps = -1; conditionedMaxScraps = -1; isForceToUpdateNext = false; failedToGenerateInARowCount = 0; previousUpdateTileTime = -100f; notificationLastTime = 0f; debugLogLastTime = 0f; DeleteCFEEcontainer(); Plugin.mls.LogInfo((object)"ResetAll was called"); } public static void DeleteLineAndTile() { for (int i = 0; i < linesX.Count; i++) { if ((Object)(object)linesX[i] != (Object)null) { Object.Destroy((Object)(object)((Component)linesX[i]).gameObject); } } linesX.Clear(); for (int j = 0; j < linesZ.Count; j++) { if ((Object)(object)linesZ[j] != (Object)null) { Object.Destroy((Object)(object)((Component)linesZ[j]).gameObject); } } linesZ.Clear(); Object.Destroy((Object)(object)lineMaterial); lineMaterial = null; for (int k = 0; k < tiles.Count; k++) { for (int l = 0; l < tiles[k].Count; l++) { if ((Object)(object)tiles[k][l] != (Object)null) { Object.Destroy((Object)(object)tiles[k][l].gameObject); } } } tiles.Clear(); Object.Destroy((Object)(object)tileMaterial); tileMaterial = null; for (int m = 0; m < virtualTiles.Count; m++) { for (int n = 0; n < virtualTiles[m].Count; n++) { if ((Object)(object)virtualTiles[m][n] != (Object)null) { Object.Destroy((Object)(object)virtualTiles[m][n].gameObject); } } } virtualTiles.Clear(); Object.Destroy((Object)(object)virtualTileMaterial); virtualTileMaterial = null; DeleteVirtualTileMaterials(); tilePos.Clear(); isInitializedLines = false; isInitializedTiles = false; isInitializedVirtualTiles = false; lineDiameter = 0; Plugin.mls.LogInfo((object)"ResetLine was called"); } private static void DeleteVirtualTileMaterials() { Object.Destroy((Object)(object)virtualTileMaterial0to09); virtualTileMaterial0to09 = null; Object.Destroy((Object)(object)virtualTileMaterial1to9); virtualTileMaterial1to9 = null; Object.Destroy((Object)(object)virtualTileMaterial10to19); virtualTileMaterial10to19 = null; Object.Destroy((Object)(object)virtualTileMaterial20to29); virtualTileMaterial20to29 = null; Object.Destroy((Object)(object)virtualTileMaterial30to39); virtualTileMaterial30to39 = null; Object.Destroy((Object)(object)virtualTileMaterial40to49); virtualTileMaterial40to49 = null; Object.Destroy((Object)(object)virtualTileMaterial50to59); virtualTileMaterial50to59 = null; Object.Destroy((Object)(object)virtualTileMaterial60to69); virtualTileMaterial60to69 = null; Object.Destroy((Object)(object)virtualTileMaterial70to79); virtualTileMaterial70to79 = null; Object.Destroy((Object)(object)virtualTileMaterial80to89); virtualTileMaterial80to89 = null; Object.Destroy((Object)(object)virtualTileMaterial90to99); virtualTileMaterial90to99 = null; Object.Destroy((Object)(object)virtualTileMaterial100); virtualTileMaterial100 = null; } private static void DeleteCFEEcontainer() { Object.Destroy((Object)(object)CFEEcontainer); isInitializedCFEEcontainer = false; Plugin.mls.LogInfo((object)"ResetCFEEcontainer was called"); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "CFEEManager"; } } public class HUDTextCfee { internal static TextMeshProUGUI HUDText1; internal static TextMeshProUGUI HUDText2; internal static GameObject HUDTextGo1; internal static GameObject HUDTextGo2; internal static GameObject HUDTextGOBackground; internal static GameObject CFEEHUDcontainer; internal static bool toggleInfo; internal static bool updateHUDTextNext; internal static bool initToggleText; internal static string hudText1; internal static string hudText2; internal static string hudText3; internal static string hudText4; internal static string hudText5; internal static string hudText6; internal static string hudText7; internal static string hudText8; internal static string hudText9; internal static string hudText10; internal static string hudText11; internal static string hudText12; internal static string hudText13; internal static string hudText14; internal static string hudText15; internal static string hudVariableText1; internal static string hudVariableText2; internal static string hudVariableText3; internal static string hudVariableText4; internal static string hudVariableText5; internal static string hudVariableText6; internal static string hudVariableText7; internal static string hudVariableText8; internal static string hudVariableText9; internal static string hudVariableText10; internal static string hudVariableText11; public static void HUDTextCfeeUpdate() { if (updateHUDTextNext) { UpdateHUDText(); updateHUDTextNext = false; } } public static void ToggleInfo() { if (toggleInfo) { toggleInfo = false; } else if (!toggleInfo) { toggleInfo = true; } if (toggleInfo) { HUDTextGOBackground.SetActive(true); ((Behaviour)HUDText1).enabled = true; ((Behaviour)HUDText2).enabled = true; } else if (!toggleInfo) { HUDTextGOBackground.SetActive(false); ((Behaviour)HUDText1).enabled = false; ((Behaviour)HUDText2).enabled = false; } } private static void UpdateHUDText() { if ((Object)(object)HUDText1 == (Object)null) { Plugin.mls.LogInfo((object)"Error: HUDText1 is null"); return; } ((TMP_Text)HUDText1).text = hudText1 + hudText2 + hudText3 + hudVariableText6 + hudText4 + hudVariableText5 + hudText5 + hudVariableText3 + hudText6 + hudVariableText4 + hudText7 + hudText8 + hudVariableText1 + hudText9 + hudVariableText2 + hudText10 + hudVariableText7 + hudVariableText8 + hudVariableText9 + hudVariableText10 + hudVariableText11; } public static void UpdateViewDistance() { hudVariableText6 = "" + CFEEManager.lineRadius + ""; updateHUDTextNext = true; } public static void UpdateScrapRange() { if (CFEEManager.conditionedMinScraps == -1 || CFEEManager.conditionedMaxScraps == -1) { hudVariableText1 = "none"; } else if (CFEEManager.conditionedMinScraps != CFEEManager.conditionedMaxScraps) { hudVariableText1 = "" + CFEEManager.conditionedMinScraps + " to " + CFEEManager.conditionedMaxScraps + ""; } else { hudVariableText1 = "" + CFEEManager.conditionedMinScraps + ""; } updateHUDTextNext = true; } public static void UpdateInteriorType() { string text = "none"; if (CFEEManager.isConditionedFactory) { text = "Factory"; } if (CFEEManager.isConditionedMansion) { text = ((!(text == "none")) ? (text + ", Mansion") : "Mansion"); } if (CFEEManager.isConditionedMineshaft) { text = ((!(text == "none")) ? (text + ", Mineshaft") : "MineShaft"); } hudVariableText2 = "" + text + ""; updateHUDTextNext = true; } public static void UpdateNumberOfAttempts() { hudVariableText3 = "" + CFEEManager.numberOfAttempts + ""; updateHUDTextNext = true; } public static void UpdateGenerationInterval() { hudVariableText4 = "" + CFEEManager.generationTimeInterval + ""; updateHUDTextNext = true; } public static void UpdateVirtualGenMode() { hudVariableText5 = "" + CFEEManager.isVirtualGenerationMode + ""; updateHUDTextNext = true; } public static void UpdateGenStatus(int mapseed, int preTime, int timeToSuccessful, string dunType, int scraps) { float num = (float)preTime / (float)CFEEManager.numberOfAttempts * 100f; int num2 = (int)(num * 10f); num = (float)num2 / 10f; hudVariableText7 = "\nMap seed: " + mapseed; hudVariableText8 = "\nInterior type: " + dunType + " \nBase Scraps: " + scraps; hudVariableText9 = "\nValid seed after " + timeToSuccessful + " attempts."; hudVariableText10 = "\n" + preTime + "/" + CFEEManager.numberOfAttempts + " (" + num.ToString("F1") + "% Complete)"; updateHUDTextNext = true; } public static void UpdateGenStatusSingleAttempt(int mapseed, int timeToSuccessful, string dunType, int scraps) { ClearGenerationStatus(); hudVariableText7 = "\nMap seed: " + mapseed; hudVariableText8 = "\nInterior type: " + dunType + " \nBase Scraps: " + scraps; hudVariableText9 = "\nValid seed after " + timeToSuccessful + " attempts."; updateHUDTextNext = true; } public static void UpdateSuccessRate() { hudVariableText11 = "\nThe success rate of\ngenerated seeds: " + ((float)CFEEManager.numberOfAttempts / (float)CFEEManager.attemptsCount * 100f).ToString("F3") + "%"; } public static void UpdateToggleText(string text) { ((TMP_Text)HUDText2).text = "TOGGLE INFO: " + text; } public static void ClearGenerationStatus() { hudVariableText7 = "\n"; hudVariableText8 = "\n"; hudVariableText9 = "\n"; hudVariableText10 = "\n"; hudVariableText11 = "\n"; updateHUDTextNext = true; } [HarmonyPatch(typeof(HUDManager))] [HarmonyPatch("Start")] [HarmonyPostfix] private static void CreateHUDText(HUDManager __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)((Component)__instance.PTTIcon).transform.parent).gameObject; if ((Object)(object)gameObject == (Object)null) { Plugin.mls.LogInfo((object)"Error: PTTIcon.transform.parent is null.could not create CFEE HUD"); return; } CFEEHUDcontainer = new GameObject(); CFEEHUDcontainer.transform.SetParent(gameObject.transform, false); HUDTextGOBackground = new GameObject(); HUDTextGOBackground.transform.SetParent(CFEEHUDcontainer.transform, false); Image val = HUDTextGOBackground.AddComponent(); ((Graphic)val).color = new Color(0f, 0.4f, 0f, 0.7f); RectTransform component = HUDTextGOBackground.GetComponent(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0f, 1f); component.anchoredPosition = new Vector2(290f, 144f); component.sizeDelta = new Vector2(150f, 200f); Outline val2 = HUDTextGOBackground.AddComponent(); ((Shadow)val2).effectColor = new Color(0f, 0.3f, 0f, 0.7f); ((Shadow)val2).effectDistance = new Vector2(0.8f, -0.8f); ((Shadow)val2).useGraphicAlpha = true; HUDTextGo1 = Object.Instantiate(((Component)__instance.debugText).gameObject, CFEEHUDcontainer.transform); HUDTextGo2 = Object.Instantiate(((Component)__instance.debugText).gameObject, CFEEHUDcontainer.transform); HUDText1 = HUDTextGo1.GetComponent(); if ((Object)(object)HUDText1 != (Object)null) { ((TMP_Text)HUDText1).enableWordWrapping = false; ((TMP_Text)HUDText1).overflowMode = (TextOverflowModes)0; ((TMP_Text)HUDText1).transform.localPosition = new Vector3(436f, 64f, 0f); ((TMP_Text)HUDText1).alignment = (TextAlignmentOptions)257; ((TMP_Text)HUDText1).font = ((TMP_Text)__instance.newProfitQuotaText).font; ((TMP_Text)HUDText1).fontSize = 7f; ((Graphic)HUDText1).color = Color.green; ((TMP_Text)HUDText1).text = "---"; ((Behaviour)HUDText1).enabled = true; ((TMP_Text)HUDText1).transform.localScale = new Vector3(1.221f, 1.221f, 1.221f); } HUDText2 = HUDTextGo2.GetComponent(); if ((Object)(object)HUDText2 != (Object)null) { ((TMP_Text)HUDText2).enableWordWrapping = false; ((TMP_Text)HUDText2).overflowMode = (TextOverflowModes)0; ((TMP_Text)HUDText2).transform.localPosition = new Vector3(297f, -133f, 0f); ((TMP_Text)HUDText2).alignment = (TextAlignmentOptions)260; ((TMP_Text)HUDText2).font = ((TMP_Text)__instance.newProfitQuotaText).font; ((TMP_Text)HUDText2).fontSize = 6f; ((Graphic)HUDText2).color = new Color(0f, 1f, 0f, 0.7f); ((Behaviour)HUDText2).enabled = true; ((TMP_Text)HUDText2).transform.localScale = new Vector3(1.221f, 1.221f, 1.221f); } hudText1 = "==CFEE INFORMATION=="; hudText2 = "\n--Settings--"; hudText3 = "\nView distance: "; hudText4 = "\nVirtual Generation mode: "; hudText5 = "\nNumber of attempts: "; hudText6 = "\nGeneration interval: "; hudText7 = "\n\n--Conditions--"; hudText8 = "\nScrap range: "; hudText9 = "\nInterior type: "; hudText10 = "\n\n--Generation status--"; hudText11 = "---"; hudText12 = "---"; hudText13 = "---"; hudText14 = "---"; hudText15 = "---"; if (!toggleInfo) { HUDTextGOBackground.SetActive(false); ((Behaviour)HUDText1).enabled = false; ((Behaviour)HUDText2).enabled = false; } UpdateViewDistance(); UpdateScrapRange(); UpdateScrapRange(); UpdateInteriorType(); UpdateNumberOfAttempts(); UpdateGenerationInterval(); UpdateVirtualGenMode(); UpdateHUDText(); UpdateToggleText(CFEEInput.GetToggleInfoBindingDispalyString()); } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace CoordinateForEasterEggs.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }