using System;
using System.Collections.Generic;
using System.Diagnostics;
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 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;
using testModLethalCompany.Patches;
[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.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0")]
[assembly: AssemblyProduct("CoordinateForEasterEggs")]
[assembly: AssemblyTitle("CoordinateForEasterEggs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
namespace testModLethalCompany
{
public class CFEEInput : LcInputActions
{
[InputAction("<Keyboard>/f5", Name = "Toggle CFEE")]
public InputAction ToggleCFEE { get; set; }
[InputAction("<Keyboard>/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)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.ToggleCFEEWithInput();
}
if (Plugin.inputCfee.ToggleInfo.triggered)
{
HUDTextCfee.ToggleInfo();
}
if (Plugin.inputCfee.ToggleVirtualGenerationMode.triggered)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.ToggleVirtualGenerationModeWithInput();
}
if (Plugin.inputCfee.ClearTiles.triggered)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.ClearTilesWithInput();
}
if (Plugin.inputCfee.ClearConditions.triggered)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.ClearConditionsWithInput();
}
if (Plugin.inputCfee.StartGeneration.triggered)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.StartGenerationWithInput();
}
if (Plugin.inputCfee.StopGeneration.triggered)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.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>();
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<MeshRenderer>()).material = val5;
Collider component = eggPosObj.GetComponent<Collider>();
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, 1f, 0f, 0.75f);
}
else
{
val7.color = new Color(0f, 1f, 1f, 0.75f);
}
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<MeshRenderer>()).material = val7;
Collider component2 = highlightFloorObj.GetComponent<Collider>();
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(2657101790u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref egglinePos);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref explode, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2657101790u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
testModLethalCompany.Patches.CoordinateForEasterEggs.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(2657101790u, new RpcReceiveHandler(__rpc_handler_2657101790), "EggLinesClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_2657101790(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<bool>(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)"CheckSceneChange was initialized");
}
private static void OnSceneChanged(Scene oldScene, Scene newScene)
{
Plugin.mls.LogInfo((object)("Scene changed to: " + ((Scene)(ref newScene)).name));
if (((Scene)(ref newScene)).name == "MainMenu")
{
testModLethalCompany.Patches.CoordinateForEasterEggs.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 result2;
if (!testModLethalCompany.Patches.CoordinateForEasterEggs.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 <value(max: " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxLineRadius + ")>\nThis command changes the view distance of coordinates.\nDefault: 15"));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /view <value(max: " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxLineRadius + ")>\nThis command changes the view distance of coordinates.\nDefault: 15", false, false, "LC_Tip1");
}
else if (int.TryParse(text2, out result2))
{
if (result2 > testModLethalCompany.Patches.CoordinateForEasterEggs.maxLineRadius)
{
Plugin.mls.LogInfo((object)("View distance must be " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxLineRadius + " or less.\nDefault: 15"));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "View distance must be " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxLineRadius + " or less.\nDefault: 15", false, false, "LC_Tip1");
break;
}
if (result2 < testModLethalCompany.Patches.CoordinateForEasterEggs.minLineRadius)
{
Plugin.mls.LogInfo((object)("View distance must be " + testModLethalCompany.Patches.CoordinateForEasterEggs.minLineRadius + " or above.\nDefault: 15"));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "View distance must be " + testModLethalCompany.Patches.CoordinateForEasterEggs.minLineRadius + " or above.\nDefault: 15", false, false, "LC_Tip1");
break;
}
Plugin.mls.LogInfo((object)("View distance set to " + result2 + ".\nDefault: 15"));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "View distance set to " + result2 + ".\nDefault: 15", false, false, "LC_Tip1");
if (!testModLethalCompany.Patches.CoordinateForEasterEggs.isVirtualGenerationMode)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.ResetLine();
testModLethalCompany.Patches.CoordinateForEasterEggs.lineRadius = result2;
testModLethalCompany.Patches.CoordinateForEasterEggs.isRangeChanged = true;
HUDTextCfee.UpdateViewDistance();
}
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 <value(max: " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxLineRadius + ")>\nThis command changes the view distance of coordinates.\nDefault: 15"));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /view <value(max: " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxLineRadius + ")>\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 (!testModLethalCompany.Patches.CoordinateForEasterEggs.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)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.ToggleVirtualGenerationModeWithInput();
}
else if ((text2.ToLower() == "true" || text2.ToLower() == "tru") && text3 == null)
{
if (testModLethalCompany.Patches.CoordinateForEasterEggs.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;
}
testModLethalCompany.Patches.CoordinateForEasterEggs.isVirtualGenerationMode = true;
HUDTextCfee.UpdateVirtualGenMode();
testModLethalCompany.Patches.CoordinateForEasterEggs.virtualMapSeed = testModLethalCompany.Patches.CoordinateForEasterEggs.randomMapSeed;
testModLethalCompany.Patches.CoordinateForEasterEggs.ResetLine();
testModLethalCompany.Patches.CoordinateForEasterEggs.VirtualNewLevelGenerator(testModLethalCompany.Patches.CoordinateForEasterEggs.randomMapSeed, isDisplayTip: false);
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 (!testModLethalCompany.Patches.CoordinateForEasterEggs.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;
}
testModLethalCompany.Patches.CoordinateForEasterEggs.isVirtualGenerationMode = false;
HUDTextCfee.UpdateVirtualGenMode();
testModLethalCompany.Patches.CoordinateForEasterEggs.virtualMapSeed = -1;
testModLethalCompany.Patches.CoordinateForEasterEggs.ResetLine();
testModLethalCompany.Patches.CoordinateForEasterEggs.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 result3;
if (!testModLethalCompany.Patches.CoordinateForEasterEggs.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 (!testModLethalCompany.Patches.CoordinateForEasterEggs.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 (text2 == null || text3 != null)
{
Plugin.mls.LogInfo((object)"Usage: /seed <seed value>\n/seed random");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /seed <seed value>\n/seed random", false, false, "LC_Tip1");
}
else if (text2.ToLower() == "random" || text2.ToLower() == "rando" || text2.ToLower() == "rand" || text2.ToLower() == "ran")
{
testModLethalCompany.Patches.CoordinateForEasterEggs.VirtualNewLevelGeneratorWithConditions(100, isDisplayTip: true);
}
else if (int.TryParse(text2, out result3))
{
testModLethalCompany.Patches.CoordinateForEasterEggs.VirtualNewLevelGenerator(result3);
}
break;
}
case "/clear":
case "/clea":
case "/cle":
if (!testModLethalCompany.Patches.CoordinateForEasterEggs.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 (!testModLethalCompany.Patches.CoordinateForEasterEggs.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 (text2 != null)
{
Plugin.mls.LogInfo((object)"Usage: /clear");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /clear", false, false, "LC_Tip1");
break;
}
testModLethalCompany.Patches.CoordinateForEasterEggs.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 (testModLethalCompany.Patches.CoordinateForEasterEggs.isGeneratingSeed)
{
Plugin.mls.LogInfo((object)"Warning: The condition cannot be changed while generating.");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The condition cannot be changed 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
{
testModLethalCompany.Patches.CoordinateForEasterEggs.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")
{
testModLethalCompany.Patches.CoordinateForEasterEggs.isConditionedFactory = true;
testModLethalCompany.Patches.CoordinateForEasterEggs.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")
{
testModLethalCompany.Patches.CoordinateForEasterEggs.isConditionedMansion = true;
testModLethalCompany.Patches.CoordinateForEasterEggs.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")
{
testModLethalCompany.Patches.CoordinateForEasterEggs.isConditionedMineshaft = true;
testModLethalCompany.Patches.CoordinateForEasterEggs.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 result5))
{
if (text4 != null && text4 == "to")
{
if (text5 != null && int.TryParse(text5, out var result6))
{
if (text6 == null)
{
if (result5 < StartOfRound.Instance.currentLevel.minScrap)
{
result5 = StartOfRound.Instance.currentLevel.minScrap;
Plugin.mls.LogInfo((object)"Warning: minScraps adjusted to match the allowed range.");
}
if (result6 > StartOfRound.Instance.currentLevel.maxScrap - 1)
{
result6 = StartOfRound.Instance.currentLevel.maxScrap - 1;
Plugin.mls.LogInfo((object)"Warning: maxScraps adjusted to match the allowed range.");
}
if (result5 > result6)
{
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
{
testModLethalCompany.Patches.CoordinateForEasterEggs.conditionedMinScraps = result5;
testModLethalCompany.Patches.CoordinateForEasterEggs.conditionedMaxScraps = result6;
HUDTextCfee.UpdateScrapRange();
Plugin.mls.LogInfo((object)("Scrap conditions set to " + result5 + " to " + result6 + ".\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 " + result5 + " to " + result6 + ".\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 result7))
{
if (result7 < StartOfRound.Instance.currentLevel.minScrap)
{
result7 = StartOfRound.Instance.currentLevel.minScrap;
Plugin.mls.LogInfo((object)"Warning: minScraps adjusted to match the allowed range.");
}
if (result7 > StartOfRound.Instance.currentLevel.maxScrap - 1)
{
result7 = StartOfRound.Instance.currentLevel.maxScrap - 1;
Plugin.mls.LogInfo((object)"Warning: maxScraps adjusted to match the allowed range.");
}
testModLethalCompany.Patches.CoordinateForEasterEggs.conditionedMinScraps = result7;
testModLethalCompany.Patches.CoordinateForEasterEggs.conditionedMaxScraps = result7;
HUDTextCfee.UpdateScrapRange();
Plugin.mls.LogInfo((object)("Scrap conditions set to " + result7 + ".\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 " + result7 + ".\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;
testModLethalCompany.Patches.CoordinateForEasterEggs.conditionedMinScraps = conditionedMinScraps;
testModLethalCompany.Patches.CoordinateForEasterEggs.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--;
}
testModLethalCompany.Patches.CoordinateForEasterEggs.conditionedMinScraps = minScrap;
testModLethalCompany.Patches.CoordinateForEasterEggs.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 (!testModLethalCompany.Patches.CoordinateForEasterEggs.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)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.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)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.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 result))
{
if (float.IsNaN(result) || float.IsInfinity(result))
{
Plugin.mls.LogInfo((object)"Warning: Invalid value.");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Invalid value.", false, false, "LC_Tip1");
}
else if (text4 == null)
{
if (result < testModLethalCompany.Patches.CoordinateForEasterEggs.minGenerationTimeInterval || result > testModLethalCompany.Patches.CoordinateForEasterEggs.maxGenerationTimeInterval)
{
Plugin.mls.LogInfo((object)("Generation interval must be in the range of " + testModLethalCompany.Patches.CoordinateForEasterEggs.minGenerationTimeInterval + " to " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxGenerationTimeInterval));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation interval must be in the range of " + testModLethalCompany.Patches.CoordinateForEasterEggs.minGenerationTimeInterval + " to " + testModLethalCompany.Patches.CoordinateForEasterEggs.maxGenerationTimeInterval, false, false, "LC_Tip1");
break;
}
if (testModLethalCompany.Patches.CoordinateForEasterEggs.isGeneratingSeed)
{
Plugin.mls.LogInfo((object)"Warning: The generation interval cannot be changed while generating.");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The generation interval cannot be changed while generating.", false, false, "LC_Tip1");
break;
}
testModLethalCompany.Patches.CoordinateForEasterEggs.generationTimeInterval = result;
HUDTextCfee.UpdateGenerationInterval();
Plugin.mls.LogInfo((object)("Generation interval set to " + result + "."));
if (result >= 0.29f)
{
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation interval set to " + result + ".", false, false, "LC_Tip1");
}
else
{
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation interval set to " + result + ".\nWarning: Tiles far from the center may be ignored due to shorter generation interval!!", false, false, "LC_Tip1");
}
}
else
{
Plugin.mls.LogInfo((object)"Usage: /generation interval <float value(interval)>\nDefault: 0.3");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation interval <float value(interval)>\nDefault: 0.3", false, false, "LC_Tip1");
}
}
else
{
Plugin.mls.LogInfo((object)"Usage: /generation interval <float value(interval)>\nDefault: 0.3");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation interval <float value(interval)>\nDefault: 0.3", 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 result4))
{
break;
}
if (text3 == null)
{
if (!testModLethalCompany.Patches.CoordinateForEasterEggs.isGeneratingSeed)
{
if (result4 >= testModLethalCompany.Patches.CoordinateForEasterEggs.minNumberOfGenerations && result4 <= testModLethalCompany.Patches.CoordinateForEasterEggs.maxNumberOfGenerations)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.numberOfAttempts = result4;
HUDTextCfee.UpdateNumberOfAttempts();
Plugin.mls.LogInfo((object)("The number of attempts has been set to " + result4 + "."));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "The number of attempts has been set to " + result4 + ".", false, false, "LC_Tip1");
}
else
{
Plugin.mls.LogInfo((object)"Warning: The maximum number of attempts is 10000.");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The maximum number of attempts is 10000.", false, false, "LC_Tip1");
}
}
else
{
Plugin.mls.LogInfo((object)"Warning: The number of attempts cannot be changed while generating.");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The number of attempts cannot be changed while generating.", false, false, "LC_Tip1");
}
}
else
{
Plugin.mls.LogInfo((object)"Usage: /number <value(number of attempts)>");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /number <value(number of attempts)>", 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 (!testModLethalCompany.Patches.CoordinateForEasterEggs.isCFEEenabled)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.isVirtualGenerationMode = false;
HUDTextCfee.UpdateVirtualGenMode();
testModLethalCompany.Patches.CoordinateForEasterEggs.virtualMapSeed = -1;
testModLethalCompany.Patches.CoordinateForEasterEggs.ResetLine();
testModLethalCompany.Patches.CoordinateForEasterEggs.isForceToUpdateNext = true;
testModLethalCompany.Patches.CoordinateForEasterEggs.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 (testModLethalCompany.Patches.CoordinateForEasterEggs.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 (testModLethalCompany.Patches.CoordinateForEasterEggs.isCFEEenabled)
{
testModLethalCompany.Patches.CoordinateForEasterEggs.isVirtualGenerationMode = false;
HUDTextCfee.UpdateVirtualGenMode();
testModLethalCompany.Patches.CoordinateForEasterEggs.virtualMapSeed = -1;
testModLethalCompany.Patches.CoordinateForEasterEggs.DisableAllEgglines();
testModLethalCompany.Patches.CoordinateForEasterEggs.ResetLine();
testModLethalCompany.Patches.CoordinateForEasterEggs.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 <value(min)> to <value(max)>\n/condition scraps <value>\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 <value(min)> to <value(max)>\n/condition scraps <value>\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.2.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.2.0";
private static Harmony _harmony = new Harmony("kakeEdition.CFEE");
internal static ManualLogSource mls = Logger.CreateLogSource("kakeEdition.CFEE");
public ConfigEntry<int> viewDistanceAtStart;
public ConfigEntry<bool> enableCfeeAtStart;
public ConfigEntry<int> numberOfAttemptsAtStart;
public ConfigEntry<float> 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_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Expected O, but got Unknown
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: 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<int>("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<int>(1, 35), Array.Empty<object>()));
enableCfeeAtStart = ((BaseUnityPlugin)this).Config.Bind<bool>("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<int>("STARTUP SETTINGS", "Number of attempts", 100, new ConfigDescription("Number of generation attempts at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10000), Array.Empty<object>()));
generationIntervalAtStartup = ((BaseUnityPlugin)this).Config.Bind<float>("STARTUP SETTINGS", "Generation Interval", 0.3f, new ConfigDescription("Generation Interval at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
mls.LogInfo((object)"CoordinateForEasterEggs0.2.0 has loaded.");
testModLethalCompany.Patches.CoordinateForEasterEggs.networkPrefab = NetworkPrefabs.CreateNetworkPrefab("networkPrefab");
testModLethalCompany.Patches.CoordinateForEasterEggs.networkPrefab.AddComponent<EggLineSync>();
NetworkPrefabs.RegisterNetworkPrefab(testModLethalCompany.Patches.CoordinateForEasterEggs.networkPrefab);
mls.LogInfo((object)"Network registered.");
inputCfee = new CFEEInput();
testModLethalCompany.Patches.CoordinateForEasterEggs.InitLineRadiusConfigEntry(viewDistanceAtStart.Value);
testModLethalCompany.Patches.CoordinateForEasterEggs.InitIsCFEEenabledConfigEntry(enableCfeeAtStart.Value);
testModLethalCompany.Patches.CoordinateForEasterEggs.InitNumberOfAttemptsAtStart(numberOfAttemptsAtStart.Value);
testModLethalCompany.Patches.CoordinateForEasterEggs.InitGenerationIntervalAtStart(generationIntervalAtStartup.Value);
mls.LogInfo((object)("viewDistanceAtStart_ " + viewDistanceAtStart_));
PatchAllStuff();
}
private static void PatchAllStuff()
{
_harmony.PatchAll(typeof(testModLethalCompany.Patches.CoordinateForEasterEggs));
_harmony.PatchAll(typeof(CheckSceneChange));
_harmony.PatchAll(typeof(CommandReader));
_harmony.PatchAll(typeof(HUDTextCfee));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "CoordinateForEasterEggs";
public const string PLUGIN_NAME = "CoordinateForEasterEggs";
public const string PLUGIN_VERSION = "0.2.0";
}
}
namespace testModLethalCompany.Patches
{
internal class CoordinateForEasterEggs : NetworkBehaviour
{
private static bool isLocalPlayerServer;
internal static int randomMapSeed = -1;
private 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;
private static List<LineRenderer> linesX = new List<LineRenderer>();
private static List<LineRenderer> linesZ = new List<LineRenderer>();
private static List<List<GameObject>> tiles = new List<List<GameObject>>();
private static List<List<GameObject>> virtualTiles = new List<List<GameObject>>();
private static List<List<Vector3>> tilePos = new List<List<Vector3>>();
private static List<EggLine> eggLines = new List<EggLine>();
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];
internal static bool isCFEEenabled;
private static float toggleCFEENextTime = 0f;
private static 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 isGeneratingSeed = false;
internal static float generationTime = 0f;
internal static float generationTimeInterval;
internal static readonly float minGenerationTimeInterval = 0.1f;
internal static readonly float maxGenerationTimeInterval = 10f;
internal static readonly int minNumberOfGenerations = 1;
internal static readonly int maxNumberOfGenerations = 10000;
internal static int previousTimeInterval = 0;
internal static int attemptsCount = 0;
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 InitNumberOfAttemptsAtStart(int value)
{
numberOfAttempts = value;
}
public static void InitGenerationIntervalAtStart(float value)
{
generationTimeInterval = value;
}
private static void InitializeLines()
{
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Expected O, but got Unknown
//IL_00fe: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Expected O, but got Unknown
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Expected O, but got Unknown
//IL_01f7: 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)
if (!isCFEEenabled)
{
return;
}
if (linesX == null)
{
linesX = new List<LineRenderer>();
}
if (linesZ == null)
{
linesZ = new List<LineRenderer>();
}
if (tiles == null)
{
tiles = new List<List<GameObject>>();
}
if (virtualTiles == null)
{
virtualTiles = new List<List<GameObject>>();
}
if (tilePos == null)
{
tilePos = new List<List<Vector3>>();
}
if (eggLines == null)
{
eggLines = new List<EggLine>();
}
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;
}
Material material = new Material(val);
float num = 0.017f;
Color white = Color.white;
int positionCount = 2;
for (int i = 0; i < lineDiameter + 1; i++)
{
LineRenderer val2 = new LineRenderer();
GameObject val3 = new GameObject("LineObjZ" + i);
val2 = new LineRenderer();
val2 = val3.AddComponent<LineRenderer>();
val2.positionCount = positionCount;
val2.startWidth = num;
val2.endWidth = num;
((Renderer)val2).material = material;
val2.startColor = white;
val2.endColor = white;
linesZ.Add(val2);
}
for (int j = 0; j < lineDiameter + 1; j++)
{
LineRenderer val4 = new LineRenderer();
GameObject val5 = new GameObject("LineObjX" + j);
val4 = new LineRenderer();
val4 = val5.AddComponent<LineRenderer>();
val4.positionCount = positionCount;
val4.startWidth = num;
val4.endWidth = num;
((Renderer)val4).material = material;
val4.startColor = white;
val4.endColor = white;
linesX.Add(val4);
}
isInitializedLines = true;
Plugin.mls.LogInfo((object)"Initialized lines.");
}
private static void InitializeTiles()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_005b: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: 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;
}
Material val2 = new Material(val);
val2.color = new Color(1f, 0f, 0f, 0.2f);
Vector3 item = default(Vector3);
for (int i = 0; i < lineDiameter; i++)
{
List<GameObject> list = new List<GameObject>();
List<Vector3> list2 = new List<Vector3>();
for (int j = 0; j < lineDiameter; j++)
{
GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)5);
val3.transform.position = new Vector3(0f, 0f, 0f);
val3.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
val3.transform.localScale = new Vector3(1f, 1f, 1f);
((Renderer)val3.GetComponent<MeshRenderer>()).material = val2;
Collider component = val3.GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
list.Add(val3);
((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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_005b: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: 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;
}
Material val2 = new Material(val);
val2.color = new Color(1f, 0f, 1f, 0.2f);
Vector3 item = default(Vector3);
for (int i = 0; i < lineDiameter; i++)
{
List<GameObject> list = new List<GameObject>();
List<Vector3> list2 = new List<Vector3>();
for (int j = 0; j < lineDiameter; j++)
{
GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)5);
val3.transform.position = new Vector3(0f, 0f, 0f);
val3.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
val3.transform.localScale = new Vector3(1f, 1f, 1f);
((Renderer)val3.GetComponent<MeshRenderer>()).material = val2;
Collider component = val3.GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
list.Add(val3);
((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);
}
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<GameObject>(networkPrefab);
val.GetComponent<NetworkObject>().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 VirtualNewLevelGenerator(int mapSeed, bool isDisplayTip = true)
{
if (!isCFEEenabled)
{
return;
}
Random random = new Random(mapSeed + 5);
float num = 1f;
int num2 = (int)((float)random.Next(StartOfRound.Instance.currentLevel.minScrap, StartOfRound.Instance.currentLevel.maxScrap) * num);
Random random2 = new Random(mapSeed);
int num3 = 1;
int num4 = -1;
if (StartOfRound.Instance.currentLevel.dungeonFlowTypes.Length != 0)
{
List<int> list = new List<int>();
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(), random2);
num4 = RoundManager.Instance.currentLevel.dungeonFlowTypes[randomWeightedIndex].id;
num3 = num4;
}
string text = ((num3 == 0 || num3 == 2 || num3 == 3) ? new string("Factory") : (num3 switch
{
1 => new string("Mansion"),
4 => new string("MineShaft"),
_ => new string("Unknown"),
}));
if (isVirtualGenerationMode)
{
virtualMapSeed = mapSeed;
virtualDungeonType = num3;
virtualBaseScraps = num2;
}
isForceToUpdateNext = true;
if (isDisplayTip && !isVirtualGenerationMode)
{
Plugin.mls.LogInfo((object)("Current mapseed: " + randomMapSeed + "\nBase scraps: " + num2 + "\nInterior type: " + text));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Current mapseed: " + randomMapSeed + "\nBase scraps: " + num2 + "\nInterior type: " + text, false, false, "LC_Tip1");
}
if (isDisplayTip && isVirtualGenerationMode)
{
Plugin.mls.LogInfo((object)("Current mapseed: " + virtualMapSeed + "\nBase scraps: " + num2 + "\nInterior type: " + text));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Current mapseed: " + virtualMapSeed + "\nBase scraps: " + num2 + "\nInterior type: " + text, false, false, "LC_Tip1");
}
}
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;
ResetLine();
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();
ResetLine();
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;
ResetLine();
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 = randomMapSeed;
ResetLine();
VirtualNewLevelGenerator(randomMapSeed, isDisplayTip: false);
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()
{
isConditionedFactory = false;
isConditionedMansion = false;
isConditionedMineshaft = false;
isConditionedAnyDungeon = false;
conditionedMinScraps = -1;
conditionedMaxScraps = -1;
HUDTextCfee.UpdateScrapRange();
HUDTextCfee.UpdateInteriorType();
HUDTextCfee.ClearGenerationStatus();
Plugin.mls.LogInfo((object)"Conditions were cleared.");
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Conditions were cleared.", false, false, "LC_Tip1");
}
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)
{
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)
{
isGeneratingSeed = true;
attemptsCount = 0;
generationTime = 0f;
previousTimeInterval = 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;
generationTime = 0f;
previousTimeInterval = 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 UpdateGeneration()
{
if (!isCFEEenabled || !isGeneratingSeed || !isVirtualGenerationMode)
{
return;
}
if (generationTimeInterval != 0f)
{
int num = (int)(generationTime / generationTimeInterval);
if (num != previousTimeInterval)
{
VirtualNewLevelGeneratorWithConditions();
}
previousTimeInterval = num;
}
generationTime += Time.deltaTime;
if (previousTimeInterval >= numberOfAttempts)
{
StopGeneration(completed: true);
}
}
internal static void VirtualNewLevelGeneratorWithConditions(int maxTimes = 100, bool isDisplayTip = false)
{
if (!isCFEEenabled)
{
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;
}
bool flag = false;
int timeToSuccessful = 0;
string text = "unknown";
int num = -1;
int num2 = -1;
for (int i = 0; i < maxTimes; i++)
{
attemptsCount++;
num2 = Random.Range(1, 100000000);
Random random = new Random(num2 + 5);
float num3 = 1f;
num = (int)((float)random.Next(StartOfRound.Instance.currentLevel.minScrap, StartOfRound.Instance.currentLevel.maxScrap) * num3);
if ((conditionedMinScraps != -1 || conditionedMaxScraps != -1) && (conditionedMinScraps > num || conditionedMaxScraps < num))
{
continue;
}
Random random2 = new Random(num2);
int num4 = 1;
int num5 = -1;
if (StartOfRound.Instance.currentLevel.dungeonFlowTypes.Length != 0)
{
List<int> list = new List<int>();
for (int j = 0; j < StartOfRound.Instance.currentLevel.dungeonFlowTypes.Length; j++)
{
list.Add(StartOfRound.Instance.currentLevel.dungeonFlowTypes[j].rarity);
}
int randomWeightedIndex = RoundManager.Instance.GetRandomWeightedIndex(list.ToArray(), random2);
num5 = RoundManager.Instance.currentLevel.dungeonFlowTypes[randomWeightedIndex].id;
num4 = num5;
}
if (num4 == 0 || num4 == 2 || num4 == 3)
{
if (!isConditionedFactory && isConditionedAnyDungeon)
{
continue;
}
text = new string("Factory");
}
else
{
switch (num4)
{
case 1:
if (!isConditionedMansion && isConditionedAnyDungeon)
{
continue;
}
text = new string("Mansion");
break;
case 4:
if (!isConditionedMineshaft && isConditionedAnyDungeon)
{
continue;
}
text = new string("MineShaft");
break;
default:
text = new string("Unknown");
continue;
}
}
virtualMapSeed = num2;
virtualDungeonType = num4;
virtualBaseScraps = num;
timeToSuccessful = i + 1;
flag = true;
break;
}
if (flag)
{
int preTime = previousTimeInterval + 1;
Plugin.mls.LogInfo((object)("A valid mapseed after " + timeToSuccessful + " attempts. Mapseed: " + num2 + " Base scraps: " + num + " Interior type: " + text + " " + preTime + "/" + numberOfAttempts));
if (isDisplayTip)
{
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "A valid mapseed after " + timeToSuccessful + " attempts. Mapseed: " + num2 + " Base scraps: " + num + " Interior type: " + text, false, false, "LC_Tip1");
}
isForceToUpdateNext = true;
HUDTextCfee.UpdateGenerationStatus(virtualMapSeed, preTime, timeToSuccessful, text, num);
}
else
{
int num6 = previousTimeInterval + 1;
Plugin.mls.LogInfo((object)("Failed to generate a mapseed that meets the conditions after " + maxTimes + " attempts. " + num6 + "/" + numberOfAttempts));
HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Failed to generate a mapseed that meets the conditions after " + maxTimes + " attempts. " + num6 + "/" + numberOfAttempts, false, false, "LC_Tip1");
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void PlayerControllerUpdateExtension(PlayerControllerB __instance)
{
//IL_011a: 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_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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 (!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)
{
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();
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 due to some of 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_06fb: Unknown result type (might be due to invalid IL or missing references)
//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0730: 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 due to some of 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(CalculateExplodeEgg(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))
{
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_0704: Unknown result type (might be due to invalid IL or missing references)
//IL_0706: Unknown result type (might be due to invalid IL or missing references)
//IL_0708: Unknown result type (might be due to invalid IL or missing references)
//IL_0739: 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_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0624: Unknown result type (might be due to invalid IL or missing references)
if (tilePos == null || virtualTiles == null)
{
Plugin.mls.LogInfo((object)"Skipped UpdateTilePosition due to some of 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)
{
Vector3 val2 = default(Vector3);
for (int i = 0; i < lineDiameter; i++)
{
int num = 0;
while (num < lineDiameter)
{
if (!((Object)(object)virtualTiles[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;
virtualTiles[i][num].transform.position = tilePos[i][num];
if (i >= lineRadius - accurateTileDis && i <= lineRadius + accurateTileDis && num >= lineRadius - accurateTileDis && num <= lineRadius + accurateTileDis)
{
Vector3 position = virtualTiles[i][num].transform.position;
if (CalculateVirtualExplodeEgg(in position))
{
virtualTiles[i][num].SetActive(true);
}
}
num++;
continue;
}
goto IL_00bb;
}
continue;
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 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;
virtualTiles[j][k].transform.position = tilePos[j][k];
}
}
}
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 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;
virtualTiles[l][m].transform.position = tilePos[l][m];
}
}
}
}
else
{
if (!(previousClosestPos != closestPos))
{
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;
virtualTiles[n][num2].transform.position = tilePos[n][num2];
virtualTiles[n][num2].SetActive(false);
}
}
}
}
internal static void SetVirtualTilesToFalse()
{
for (int i = 0; i < lineDiameter; i++)
{
for (int j = 0; j < lineDiameter; 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(CalculateExplodeEgg(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)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
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];
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)
{
Vector3 position = virtualTiles[i][j].transform.position;
if (CalculateVirtualExplodeEgg(in position))
{
virtualTiles[i][j].SetActive(true);
}
}
}
}
}
private static bool CalculateExplodeEgg(in Vector3 position)
{
return (float)new Random(randomMapSeed + 10 + (int)position.x + (int)position.z).Next(0, 100) <= chanceToExplode;
}
private static bool CalculateVirtualExplodeEgg(in Vector3 position)
{
return (float)new Random(virtualMapSeed + 10 + (int)position.x + (int)position.z).Next(0, 100) <= chanceToExplode;
}
[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 explode)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing refere