Decompiled source of LGTuner v1.3.3
LGTuner.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using AIGraph; using AmorLib.Dependencies; using AmorLib.Utils; using AmorLib.Utils.Extensions; using AssetShards; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Expedition; using GTFO.API; using GTFO.API.Assets; using GTFO.API.Attributes.ConfigModel; using GTFO.API.EventArg; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LGTuner.Configs; using LGTuner.Extensions; using LGTuner.Manager; using LGTuner.Utils; using LevelGeneration; using LevelGeneration.Core; using LogUtils; using Microsoft.CodeAnalysis; using SNetwork; using UnityEngine; using UnityEngine.SceneManagement; using XXHashing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("LGTuner")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b5fe756e5cfc0635316b21e9372f6bfa5d682578")] [assembly: AssemblyProduct("LGTuner")] [assembly: AssemblyTitle("LGTuner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LGTuner { public static class BuilderInfo { private static readonly List<Complex> _extraComplexResourceToLoad = new List<Complex>(); public static IEnumerable<Complex> ExtraComplexResourceToLoad => _extraComplexResourceToLoad; public static ComplexResourceSetDataBlock ComplexResourceSet { get; private set; } = null; public static int GridSize { get; private set; } public static int GridCenter { get; private set; } public static int GridZeroOffset { get; private set; } public static float AltitudeOffset { get; private set; } public static LayoutConfig MainLayer { get; private set; } = null; public static LayoutConfig SecondaryLayer { get; private set; } = null; public static LayoutConfig ThirdLayer { get; private set; } = null; public static LayoutConfig[] DimensionLayer { get; private set; } = Array.Empty<LayoutConfig>(); internal static void OnResourceSetSelected() { //IL_0197: Unknown result type (might be due to invalid IL or missing references) ComplexResourceSet = Builder.ComplexResourceSetBlock; GridSize = ComplexResourceSet.LevelGenConfig.GridSize; GridCenter = GridSize / 2; GridZeroOffset = -GridCenter; AltitudeOffset = ComplexResourceSet.LevelGenConfig.AltitudeOffset; MainLayer = null; SecondaryLayer = null; ThirdLayer = null; DimensionLayer = new LayoutConfig[Enum.GetValues(typeof(eDimensionIndex)).Length]; _extraComplexResourceToLoad.Clear(); ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; if (ConfigManager.TryGetConfig(activeExpedition.LevelLayoutData, out LayoutConfig config)) { MainLayer = config; } if (activeExpedition.SecondaryLayerEnabled && ConfigManager.TryGetConfig(activeExpedition.SecondaryLayout, out LayoutConfig config2)) { SecondaryLayer = config2; } if (activeExpedition.ThirdLayerEnabled && ConfigManager.TryGetConfig(activeExpedition.ThirdLayout, out LayoutConfig config3)) { ThirdLayer = config3; } Enumerator<Dimension> enumerator = Builder.CurrentFloor.m_dimensions.GetEnumerator(); LevelLayoutDataBlock val = default(LevelLayoutDataBlock); while (enumerator.MoveNext()) { Dimension current = enumerator.Current; if (!current.IsMainDimension && !current.IsArenaDimension && !current.DimensionData.IsStaticDimension && DataBlockUtil.TryGetBlock<LevelLayoutDataBlock>(current.DimensionData.LevelLayoutData, ref val) && ConfigManager.TryGetConfig(((GameDataBlockBase<LevelLayoutDataBlock>)(object)val).persistentID, out LayoutConfig config4)) { Logger.Verbose("loysimme dimension ja levellayoutin", (LogLevel)32); config4.Reset(((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)current.Grid).m_sizeX); DimensionLayer[current.DimensionIndex] = config4; } } MainLayer?.Reset(GridSize); SecondaryLayer?.Reset(GridSize); ThirdLayer?.Reset(GridSize); AddExtraShard(MainLayer); AddExtraShard(SecondaryLayer); AddExtraShard(ThirdLayer); Array.ForEach(DimensionLayer, delegate(LayoutConfig x) { AddExtraShard(x); }); } private static void AddExtraShard(LayoutConfig? layerConfig) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (layerConfig == null) { return; } Complex[] extraComplexResourceToLoad = layerConfig.ExtraComplexResourceToLoad; foreach (Complex item in extraComplexResourceToLoad) { if (!_extraComplexResourceToLoad.Contains(item)) { _extraComplexResourceToLoad.Add(item); } } } public static bool TryGetConfig(LG_Zone zone, out LayoutConfig config) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected I4, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) Dimension val = default(Dimension); if (!Dimension.GetDimension(zone.DimensionIndex, ref val)) { Logger.Error("dimension getter failed"); config = null; return false; } if (val.IsMainDimension) { LG_LayerType type = zone.Layer.m_type; LG_LayerType val2 = type; switch ((int)val2) { case 0: config = MainLayer; return MainLayer != null; case 1: config = SecondaryLayer; return SecondaryLayer != null; case 2: config = ThirdLayer; return ThirdLayer != null; } } else if (!val.DimensionData.IsStaticDimension) { Enumerator<Dimension> enumerator = Builder.CurrentFloor.m_dimensions.GetEnumerator(); LevelLayoutDataBlock val3 = default(LevelLayoutDataBlock); while (enumerator.MoveNext()) { Dimension current = enumerator.Current; if (!current.IsMainDimension && !current.DimensionData.IsStaticDimension && !current.IsArenaDimension && DataBlockUtil.TryGetBlock<LevelLayoutDataBlock>(current.DimensionData.LevelLayoutData, ref val3) && ConfigManager.TryGetConfig(((GameDataBlockBase<LevelLayoutDataBlock>)(object)val3).persistentID, out LayoutConfig config2)) { Logger.Verbose("found a dimension + levellayout", (LogLevel)32); config2.Reset(((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)current.Grid).m_sizeX); DimensionLayer[current.DimensionIndex] = config2; } } config = DimensionLayer[zone.DimensionIndex]; return config != null; } config = null; return false; } public static GameObject GetRandomPlug(uint seed, int plugHeight, SubComplex subcomplex, bool withGate) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) ComplexResourceSetDataBlock complexResourceSet = ComplexResourceSet; return (GameObject)(plugHeight switch { 0 => complexResourceSet.GetRandomPrefab(seed, withGate ? complexResourceSet.m_straightPlugsWithGates : complexResourceSet.m_straightPlugsNoGates, subcomplex), 1 => complexResourceSet.GetRandomPrefab(seed, withGate ? complexResourceSet.m_singleDropPlugsWithGates : complexResourceSet.m_singleDropPlugsNoGates, subcomplex), 2 => complexResourceSet.GetRandomPrefab(seed, withGate ? complexResourceSet.m_doubleDropPlugsWithGates : complexResourceSet.m_doubleDropPlugsNoGates, subcomplex), _ => null, }); } public static uint GetLayoutIdOfZone(LG_Zone zone) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) Dimension dimension = zone.Dimension; if (dimension.IsMainDimension) { LG_LayerType type = zone.Layer.m_type; ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; return (int)type switch { 0 => activeExpedition.LevelLayoutData, 1 => activeExpedition.SecondaryLayout, 2 => activeExpedition.ThirdLayout, _ => throw new NotSupportedException($"LayerType: {type} is not supported!"), }; } return dimension.DimensionData.LevelLayoutData; } } [BepInPlugin("LGTuner", "LGTuner", "1.3.3")] [BepInProcess("GTFO.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal sealed class EntryPoint : BasePlugin { public const string MODNAME = "LGTuner"; public override void Load() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) Logger.MLS = ((BasePlugin)this).Log; ConfigManager.Prepare(((BasePlugin)this).Config); new Harmony("LGTuner").PatchAll(); ConfigManager.Init(); Logger.Message("LGTuner is done loading!"); } } public static class LGExtensions { public static bool IsSame(this LG_GridPosition position, LG_GridPosition other) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return position.x == other.x && position.z == other.z; } public static LG_GridPosition ToNormalGrid(this LG_Tile tile, int gridSize) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return tile.m_shape.m_gridPosition.GetNormal(gridSize); } public static LG_GridPosition GetNormal(this LG_GridPosition position, int gridSize) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_006b: Unknown result type (might be due to invalid IL or missing references) if (gridSize < 0) { return new LG_GridPosition { x = position.x + BuilderInfo.GridZeroOffset, z = position.z + BuilderInfo.GridZeroOffset }; } int num = gridSize / 2; return new LG_GridPosition { x = position.x - num, z = position.z - num }; } public static Vector3 GetPositionNormal(this LG_Grid grid, int x, int z, int gridSize) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (gridSize < 0) { return ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).GetPosition(x - BuilderInfo.GridZeroOffset, z - BuilderInfo.GridZeroOffset); } int num = gridSize / 2; return ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).GetPosition(x + num, z + num); } public static int GetGridSize(this Dimension dimension) { return ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)dimension.Grid).m_sizeX; } public static bool TryGetDimension(this LG_Floor floor, int dimensionIndex, out Dimension dimension) { if (Enum.IsDefined(typeof(eDimensionIndex), dimensionIndex)) { return floor.GetDimension((eDimensionIndex)dimensionIndex, ref dimension); } dimension = null; return false; } public static bool TryGetDimension(this LG_Floor floor, eDimensionIndex dimensionIndex, out Dimension dimension) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Enum.IsDefined(typeof(eDimensionIndex), dimensionIndex)) { return floor.GetDimension(dimensionIndex, ref dimension); } dimension = null; return false; } } public enum DirectionType { Unknown, Forward, Backward, Left, Right } public enum RotateType { None, Flip, MoveTo_Left, MoveTo_Right, Towards_Random, Towards_Forward, Towards_Backward, Towards_Left, Towards_Right } public struct LG_PlugInfo { public static readonly Quaternion NoRotation = Quaternion.AngleAxis(0f, Vector3.up); public static readonly Quaternion RightRotation = Quaternion.AngleAxis(90f, Vector3.up); public static readonly Quaternion BackwardRotation = Quaternion.AngleAxis(180f, Vector3.up); public static readonly Quaternion LeftRotation = Quaternion.AngleAxis(270f, Vector3.up); public static readonly Vector3 FrontPlugPosition = Vector3.forward * 32f; public static readonly Vector3 BackPlugPosition = Vector3.back * 32f; public static readonly Vector3 LeftPlugPosition = Vector3.left * 32f; public static readonly Vector3 RightPlugPosition = Vector3.right * 32f; public bool IsValid { get; private set; } public DirectionType StartDirection { get; private set; } public int Count { get; private set; } public bool HasFront { get; private set; } public bool HasBack { get; private set; } public bool HasLeft { get; private set; } public bool HasRight { get; private set; } public readonly bool TryGetNewRotation(uint seed, RotateType rotate, out Quaternion rotation) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) DirectionType newDirection = GetNewDirection(seed, StartDirection, rotate); if (Count >= 4) { rotation = GetRotationOfDirection(newDirection); return true; } bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(67, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("You are rotating "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" side Geomorph, this could lead to level gen crash"); } Logger.Info(val); rotation = GetRotationOfDirection(newDirection); return true; } public readonly bool HasPlug(DirectionType direction) { if (!IsValid) { return false; } if (Count >= 4) { return true; } return direction switch { DirectionType.Forward => HasFront, DirectionType.Backward => HasBack, DirectionType.Left => HasLeft, DirectionType.Right => HasRight, _ => false, }; } public static LG_PlugInfo BuildPlugInfo(GameObject geoObject, Quaternion rotation) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected I4, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) LG_Geomorph component = geoObject.GetComponent<LG_Geomorph>(); if ((Object)(object)component == (Object)null) { return default(LG_PlugInfo); } Il2CppArrayBase<LG_Plug> componentsInChildren = geoObject.GetComponentsInChildren<LG_Plug>(); if (componentsInChildren == null) { return default(LG_PlugInfo); } if (componentsInChildren.Length < 1) { return default(LG_PlugInfo); } LG_PlugInfo result = default(LG_PlugInfo); foreach (LG_Plug item in componentsInChildren) { LG_PlugDir dir = item.m_dir; LG_PlugDir val = dir; switch (val - 2) { case 0: result.HasBack = true; result.Count++; break; case 2: result.HasFront = true; result.Count++; break; case 3: result.HasLeft = true; result.Count++; break; case 1: result.HasRight = true; result.Count++; break; } } result.IsValid = result.Count > 0; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; float num = Mathf.Round(eulerAngles.y); Logger.Verbose($"angle: {num}", (LogLevel)32); num = Mathf.Repeat(num, 360f); result.StartDirection = Mathf.RoundToInt(num / 90f) switch { 0 => DirectionType.Forward, 1 => DirectionType.Right, 2 => DirectionType.Backward, 3 => DirectionType.Left, _ => DirectionType.Unknown, }; return result; } public static DirectionType GetNewDirection(uint seed, DirectionType direction, RotateType rotate) { if (direction == DirectionType.Unknown) { return DirectionType.Unknown; } if (rotate == RotateType.Towards_Random) { rotate = new Random(seed.ToSeed()).Next(4) switch { 0 => RotateType.Towards_Forward, 1 => RotateType.Towards_Backward, 2 => RotateType.Towards_Left, 3 => RotateType.Towards_Right, _ => throw new IndexOutOfRangeException("Towards_Random: nextIndex was out of range?!"), }; } return rotate switch { RotateType.None => direction, RotateType.Flip => direction switch { DirectionType.Forward => DirectionType.Backward, DirectionType.Backward => DirectionType.Forward, DirectionType.Left => DirectionType.Right, DirectionType.Right => DirectionType.Left, _ => throw new ArgumentOutOfRangeException("direction"), }, RotateType.MoveTo_Left => direction switch { DirectionType.Forward => DirectionType.Left, DirectionType.Backward => DirectionType.Right, DirectionType.Left => DirectionType.Backward, DirectionType.Right => DirectionType.Forward, _ => throw new ArgumentOutOfRangeException("direction"), }, RotateType.MoveTo_Right => direction switch { DirectionType.Forward => DirectionType.Right, DirectionType.Backward => DirectionType.Left, DirectionType.Left => DirectionType.Forward, DirectionType.Right => DirectionType.Backward, _ => throw new ArgumentOutOfRangeException("direction"), }, RotateType.Towards_Forward => DirectionType.Forward, RotateType.Towards_Backward => DirectionType.Backward, RotateType.Towards_Left => DirectionType.Left, RotateType.Towards_Right => DirectionType.Right, _ => throw new ArgumentOutOfRangeException("direction"), }; } public static Quaternion GetRotationOfDirection(DirectionType direction) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) return (Quaternion)(direction switch { DirectionType.Forward => NoRotation, DirectionType.Backward => BackwardRotation, DirectionType.Left => LeftRotation, DirectionType.Right => RightRotation, _ => throw new ArgumentOutOfRangeException("direction"), }); } } internal static class Logger { public static ManualLogSource MLS { get; internal set; } public static void Error(BepInExErrorLogInterpolatedStringHandler handler) { MLS.LogError(handler); } public static void Error(string str) { MLS.LogError((object)str); } public static void Warn(BepInExWarningLogInterpolatedStringHandler handler) { MLS.LogWarning(handler); } public static void Warn(string str) { MLS.LogWarning((object)str); } public static void Message(BepInExMessageLogInterpolatedStringHandler handler) { MLS.LogMessage(handler); } public static void Message(string str) { MLS.LogMessage((object)str); } public static void Info(BepInExInfoLogInterpolatedStringHandler handler) { MLS.LogInfo(handler); } public static void Info(string str) { MLS.LogInfo((object)str); } public static void Debug(BepInExDebugLogInterpolatedStringHandler handler) { MLS.LogDebug(handler); } public static void Debug(string str) { MLS.LogDebug((object)str); } public static void Verbose(string str, LogLevel level = (LogLevel)32) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 if (!ConfigManager.General.VerboseEnabled.Value) { return; } if ((int)level <= 4) { if ((int)level != 2) { if ((int)level == 4) { Warn(str); } } else { Error(str); } } else if ((int)level != 8) { if ((int)level != 16) { if ((int)level == 32) { Debug(str); } } else { Info(str); } } else { Message(str); } } } } namespace LGTuner.Utils { internal static class JSON { private static readonly JsonSerializerOptions _setting; static JSON() { _setting = JsonSerializerUtil.CreateDefaultSettings(false, PartialData_Wrapper.IsLoaded, false); _setting.Converters.Add(new ListableConverter<LayoutConfig>()); } public static T Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, _setting); } public static object Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize(object value, Type type) { return JsonSerializer.Serialize(value, type, _setting); } } public class ListableConverter<T> : JsonConverter<List<T>> { public override List<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { List<T> list = new List<T>(); if (reader.TokenType == JsonTokenType.StartArray) { while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) { T item = JsonSerializer.Deserialize<T>(ref reader, options); list.Add(item); } } else if (reader.TokenType != JsonTokenType.Null) { T item2 = JsonSerializer.Deserialize<T>(ref reader, options); list.Add(item2); } return list; } public override void Write(Utf8JsonWriter writer, List<T> value, JsonSerializerOptions options) { writer.WriteStartArray(); foreach (T item in value) { JsonSerializer.Serialize(writer, item, options); } writer.WriteEndArray(); } } } namespace LGTuner.Manager { public static class ConfigManager { [Section("General")] internal static class General { [ConfigEntry("Enable verbose logging", false)] [Description("Toggles additional debug logging of information to the console")] public static ConfigEntry<bool> VerboseEnabled { get; private set; } [ConfigEntry("Toggle legacy geo fixes", true)] [Description("If enabled, apply geomorph fixes (see README for more info). Is internally disabled if BorkenCellGeoFix is also loaded")] public static ConfigEntry<bool> LegacyGeoFixesEnabled { get; private set; } [ConfigEntry("Precache LGTuner level assets", true)] [Description("Map level assets used in LGTuner overrides. This should help alleviate the game hanging when loading assets")] public static ConfigEntry<bool> PrecacheLevelAssets { get; private set; } [ConfigEntry("Version", 2)] public static ConfigEntry<int> Version { get; private set; } } public const string BCGF_GUID = "com.hirnukuono.BorkenCellGeoFix"; private static readonly HashSet<string> s_levelAssetsToLoad = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, HashSet<uint>> _lookups = new Dictionary<string, HashSet<uint>>(); private static readonly Dictionary<uint, LayoutConfig> _layouts = new Dictionary<uint, LayoutConfig>(); public static bool BCGF_IsLoaded { get; private set; } = false; internal static void Prepare(ConfigFile cfg) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("com.hirnukuono.BorkenCellGeoFix")) { Logger.Message("BCGF is loaded, legacy geo fixes will be force disabled"); BCGF_IsLoaded = true; } cfg.ConfigReloaded += delegate { Logger.Warn("Config file changed: " + cfg.ConfigFilePath); }; ConfigBinder.BindToType(cfg, typeof(ConfigManager), true); SafeFileSystemWatcher.Create(cfg); LevelAPI.OnLevelDataUpdated += new LevelDataUpdateEvent(OnLevelDataUpdated); AssetAPI.OnLoadLevelAssets += delegate(OnLoadLevelAssetsEventArgs args) { foreach (string item in s_levelAssetsToLoad.Where((string f) => !Utility.IsNullOrWhiteSpace(f))) { args.EnqueueAssetToLoad(item); } }; } private static void OnLevelDataUpdated(ActiveExpedition activeExp, ExpeditionInTierData expData) { s_levelAssetsToLoad.Clear(); if (expData == null || !General.PrecacheLevelAssets.Value) { return; } HashSet<uint> hashSet = new HashSet<uint> { expData.LevelLayoutData, expData.SecondaryLayout, expData.ThirdLayout }; Enumerator<DimensionInExpeditionData> enumerator = expData.DimensionDatas.GetEnumerator(); DimensionDataBlock val = default(DimensionDataBlock); while (enumerator.MoveNext()) { DimensionInExpeditionData current = enumerator.Current; if (current.Enabled && DataBlockUtil.TryGetBlock<DimensionDataBlock>(current.DimensionData, ref val)) { hashSet.Add(val.DimensionData.LevelLayoutData); } } foreach (uint item in hashSet) { if (TryGetConfig(item, out LayoutConfig config)) { s_levelAssetsToLoad.UnionWith(from g in config.ZoneOverrides.SelectMany((ZoneOverrideData z) => z.Geomorphs) select g.Geomorph); s_levelAssetsToLoad.UnionWith(config.ZoneOverrides.SelectMany((ZoneOverrideData z) => z.Plugs)); TileOverrideData[] tileOverrides = config.TileOverrides; foreach (TileOverrideData tileOverrideData in tileOverrides) { s_levelAssetsToLoad.Add(tileOverrideData.Geomorph); s_levelAssetsToLoad.Add(tileOverrideData.ForwardPlug); s_levelAssetsToLoad.Add(tileOverrideData.BackwardPlug); s_levelAssetsToLoad.Add(tileOverrideData.LeftPlug); s_levelAssetsToLoad.Add(tileOverrideData.RightPlug); } } } } internal static void Init() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown IEnumerable<string> enumerable = new string[2] { Path.Combine(Paths.BepInExRootPath, "Assets", "AssetBundles"), Path.Combine(Paths.ConfigPath, "Assets", "AssetBundles") }.Where(Directory.Exists).SelectMany((string dir) => Directory.GetFiles(dir, "*", SearchOption.AllDirectories)); string text = ".fdfd.manifest"; bool flag = default(bool); foreach (string item in enumerable) { if (!item.EndsWith(text, StringComparison.OrdinalIgnoreCase)) { continue; } string text2 = item; int length = text.Length; string text3 = text2.Substring(0, text2.Length - length); if (string.IsNullOrEmpty(Path.GetFileName(text3)) || File.Exists(text3)) { continue; } try { BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Renaming file to '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text3); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Message(val); File.Move(item, text3); } catch (Exception ex) { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(27, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to rename '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(item); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' to '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text3); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("':\n"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } Logger.Error(val2); } } if (!MTFO_Wrapper.IsLoaded || !MTFO_Wrapper.HasCustomContent) { return; } string text4 = Path.Combine(MTFO_Wrapper.CustomPath, "LGTuner"); string[] ext = new string[2] { "*.json", "*.jsonc" }; foreach (string item2 in from f in Directory.EnumerateFiles(text4, "*", SearchOption.AllDirectories) where ext.Contains<string>("*" + Path.GetExtension(f), StringComparer.OrdinalIgnoreCase) select f) { try { string content = File.ReadAllText(item2); ReadFileContent(item2, content); } catch (Exception ex2) { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(21, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error reading file "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(item2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(":\n"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex2.Message); } Logger.Error(val2); } } SafeFileSystemWatcher val3 = SafeFileSystemWatcher.Create(text4, ext, true); val3.OnCreated += FileCreatedOrChanged; val3.OnChanged += FileCreatedOrChanged; val3.OnDeleted += FileDeleted; val3.OnRenamed += FileRenamed; } private static void ReadFileContent(string file, string content) { HashSet<uint> orAddNew = CollectionExtensions.GetOrAddNew<string, HashSet<uint>>((IDictionary<string, HashSet<uint>>)_lookups, file); foreach (uint item in orAddNew) { _layouts.Remove(item); } orAddNew.Clear(); List<LayoutConfig> source = JSON.Deserialize<List<LayoutConfig>>(content) ?? new List<LayoutConfig>(); foreach (LayoutConfig item2 in source.Where((LayoutConfig d) => d != null && d.LevelLayoutID != 0)) { orAddNew.Add(item2.LevelLayoutID); _layouts[item2.LevelLayoutID] = item2; } } private static void FileCreatedOrChanged(FileEventArgs e) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LiveEdit file updated: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.FullPath); } Logger.Warn(val); ReadFileContent(e.FullPath, e.ReadContent((Encoding)null)); } private static void FileDeleted(FileEventArgs e) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LiveEdit file deleted: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.FullPath); } Logger.Warn(val); foreach (uint item in _lookups[e.FullPath]) { _layouts.Remove(item); } _lookups.Remove(e.FullPath); } private static void FileRenamed(FileRenamedEventArgs e) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown string oldFullPath = e.OldFullPath; string fullPath = ((FileEventArgs)e).FullPath; string key = oldFullPath; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LiveEdit file renamed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(fullPath); } Logger.Warn(val); if (_lookups.ContainsKey(key)) { _lookups[fullPath] = _lookups[key]; _lookups.Remove(key); } } public static bool TryGetConfig(uint layoutID, [MaybeNullWhen(false)] out LayoutConfig config) { return _layouts.TryGetValue(layoutID, out config); } } } namespace LGTuner.Inject { [HarmonyPatch] internal static class Inject_BuildGeomorph { private static LayoutConfig _configContext; private static LayoutConfig _configContext2; private static RotateType _nextRotateType; [HarmonyPatch(typeof(LG_LevelBuilder), "PlaceRoot")] [HarmonyPrefix] [HarmonyPriority(500)] [HarmonyWrapSafe] private static void Pre_PlaceRoot(LG_Tile tile, ref GameObject tilePrefab, ref bool forceAlignToVector, ref Vector3 alignVector, LG_Zone zone) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown _configContext = null; _nextRotateType = RotateType.None; forceAlignToVector = alignVector != Vector3.zero; int gridSize = zone.Dimension.GetGridSize(); LG_GridPosition val = tile.ToNormalGrid(gridSize); Logger.Verbose($"tile info: {val.x} {val.z} {((Object)tilePrefab).name} for {zone.LocalIndex} : {zone.DimensionIndex}", (LogLevel)32); if (!BuilderInfo.TryGetConfig(zone, out _configContext)) { return; } if (!_configContext.TryGetTileData(val, out TileOverrideData overrideData)) { overrideData = _configContext.PopulateTileOverrideForZone(zone, val); } if (overrideData == null) { return; } if (!Utility.IsNullOrWhiteSpace(overrideData.Geomorph)) { if (overrideData.X == 0 && overrideData.Z == 0) { return; } GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>(overrideData.Geomorph); if ((Object)(object)loadedAsset != (Object)null) { bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - tile overriden! "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)loadedAsset).name); } Logger.Info(val2); tilePrefab = loadedAsset; } } if (overrideData.Rotation != RotateType.None) { _nextRotateType = overrideData.Rotation; } } [HarmonyPatch(typeof(LG_LevelBuilder), "PlaceRoot")] [HarmonyPostfix] [HarmonyPriority(500)] [HarmonyWrapSafe] private static void Post_PlaceRoot(LG_Tile tile, LG_Zone zone, LG_Geomorph __result) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown if (_configContext == null) { return; } if (_nextRotateType != RotateType.None) { GameObject gameObject = ((Component)__result).gameObject; LG_PlugInfo lG_PlugInfo = LG_PlugInfo.BuildPlugInfo(gameObject, gameObject.transform.rotation); Logger.Verbose($" - TRYING ROTATION! PLUG COUNT: {lG_PlugInfo.Count}", (LogLevel)8); if (lG_PlugInfo.TryGetNewRotation(zone.m_subSeed, _nextRotateType, out var rotation)) { Logger.Verbose(" - Done!", (LogLevel)16); gameObject.transform.rotation = rotation; } __result.SetPlaced(); } if (!_configContext.TryGetTileData(tile.ToNormalGrid(_configContext.GridSize), out TileOverrideData overrideData)) { return; } if (overrideData.OverrideAreaSeeds) { bool flag = default(bool); if (overrideData.AreaSeeds.Length == ((Il2CppArrayBase<LG_Area>)(object)__result.m_areas).Length) { int length = ((Il2CppArrayBase<LG_Area>)(object)__result.m_areas).Length; for (int i = 0; i < length; i++) { uint num = overrideData.AreaSeeds[i]; if (num != 0) { ((Il2CppArrayBase<LG_Area>)(object)__result.m_areas)[i].AreaSeed = num; BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - new area seed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<LG_NavInfo>(((Il2CppArrayBase<LG_Area>)(object)__result.m_areas)[i].m_navInfo); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(num); } Logger.Debug(val); } } } else { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(99, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Area count and AreaSeeds item count mismatched! (CFG: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(overrideData.AreaSeeds.Length); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" != AREA: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((Il2CppArrayBase<LG_Area>)(object)__result.m_areas).Length); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") Area seed will not be applied!"); } Logger.Error(val2); } } if (!zone.m_settings.HasCustomGeomorphPrefab) { Il2CppArrayBase<iLG_CustomGeomorphLogic> componentsInChildren = ((Component)__result).GetComponentsInChildren<iLG_CustomGeomorphLogic>(); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].SpawnedOnFloor(); LG_Factory.InjectJob((LG_FactoryJob)new LG_CustomGeomorphBuildJob(componentsInChildren[j]), (BatchName)45); LG_Factory.InjectJob((LG_FactoryJob)new LG_CustomGeomorphPostCullingJob(componentsInChildren[j]), (BatchName)64); } } } [HarmonyPatch(typeof(LG_LevelBuilder), "BuildFloor")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_BuildFloor() { BuilderInfo.OnResourceSetSelected(); } [HarmonyPatch(typeof(LG_LevelBuilder), "GetTilePosition")] [HarmonyPostfix] [HarmonyPriority(500)] [HarmonyWrapSafe] private static void Post_GetTilePosition(LG_Tile tile, LG_Floor floor, int dimensionIndex, ref Vector3 __result) { //IL_002f: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (_configContext != null && floor.TryGetDimension(dimensionIndex, out Dimension dimension)) { int gridSize = _configContext.GridSize; LG_GridPosition val = tile.ToNormalGrid(gridSize); if (_configContext.TryGetTileData(val, out TileOverrideData overrideData) && overrideData.OverrideAltitude) { Vector3 positionNormal = dimension.Grid.GetPositionNormal(val.x, val.z, gridSize); positionNormal += new Vector3(0f, (float)overrideData.Altitude * BuilderInfo.AltitudeOffset, 0f); __result = positionNormal; } } } [HarmonyPatch(typeof(LG_ZoneJob_CreateExpandFromData), "Build")] [HarmonyPrefix] [HarmonyWrapSafe] private static void Pre_ZoneJob(LG_ZoneJob_CreateExpandFromData __instance) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Builder.CurrentFloor == (Object)null || !__instance.m_zone.m_settings.HasCustomGeomorphInstance || (int)__instance.m_mainStatus != 5) { return; } TileOverrideData overrideData = null; if (BuilderInfo.TryGetConfig(__instance.m_zone, out _configContext2)) { int gridSize = _configContext2.GridSize; LG_GridPosition normalGridPosition = __instance.m_zone.m_settings.CustomGeomorphInstance.GetComponent<LG_Geomorph>().m_tile.ToNormalGrid(gridSize); _configContext2.TryGetTileData(normalGridPosition, out overrideData); } if (overrideData == null || !overrideData.TryForceCustomGeoAreaAssignment) { return; } bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - addcustomgeomorphareas for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__instance.m_zone.NavInfo).ToString()); } Logger.Info(val); Dictionary<LG_Area, float> dictionary = new Dictionary<LG_Area, float>(); Enumerator<LG_Area> enumerator = __instance.m_zone.m_areas.GetEnumerator(); while (enumerator.MoveNext()) { LG_Area current = enumerator.Current; float num = 1000f; if (current.m_zone.ID == 0 && ((Object)current).GetInstanceID() == ((Object)current.m_zone.m_areas[0]).GetInstanceID()) { num = 2000f; } if (((Object)current).GetInstanceID() == ((Object)current.m_zone.m_sourceExpander.m_linksTo).GetInstanceID()) { num = 1500f; } dictionary.Add(current, num - Vector3.Distance(current.Position, __instance.m_zone.m_sourceExpander.m_linksFrom.Position)); } IOrderedEnumerable<KeyValuePair<LG_Area, float>> orderedEnumerable = dictionary.OrderByDescending((KeyValuePair<LG_Area, float> scoredAreas) => scoredAreas.Value); __instance.m_zone.m_areas.Clear(); foreach (KeyValuePair<LG_Area, float> item in orderedEnumerable) { Logger.Verbose($" - addcustomgeomorphareas scoredict {((Object)item.Key).name} {item.Value}", (LogLevel)32); if (!__instance.m_zone.m_areas.Contains(item.Key)) { __instance.m_zone.m_areas.Add(item.Key); } foreach (LG_InternalGate componentsInChild in ((Component)item.Key).gameObject.GetComponentsInChildren<LG_InternalGate>(true)) { if ((Object)(object)((LG_ZoneExpander)componentsInChild).m_linksFrom != (Object)null && !__instance.m_zone.m_areas.Contains(((LG_ZoneExpander)componentsInChild).m_linksFrom)) { Logger.Verbose(" - addcustomgeomorphareas adding m_linksFrom " + ((Object)((LG_ZoneExpander)componentsInChild).m_linksFrom).name, (LogLevel)32); __instance.m_zone.m_areas.Add(((LG_ZoneExpander)componentsInChild).m_linksFrom); } if ((Object)(object)((LG_ZoneExpander)componentsInChild).m_linksTo != (Object)null && !__instance.m_zone.m_areas.Contains(((LG_ZoneExpander)componentsInChild).m_linksTo)) { Logger.Verbose(" - addcustomgeomorphareas adding m_linksTo " + ((Object)((LG_ZoneExpander)componentsInChild).m_linksTo).name, (LogLevel)32); __instance.m_zone.m_areas.Add(((LG_ZoneExpander)componentsInChild).m_linksTo); } } } } } [HarmonyPatch] internal static class Inject_BuildPlug { [HarmonyPatch(typeof(LG_BuildPlugBaseJob), "SpawnPlug")] [HarmonyPrefix] [HarmonyWrapSafe] private static void Pre_SpawnPlug(LG_Plug plug, ref GameObject prefab) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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) //IL_017c: Expected I4, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Expected O, but got Unknown Logger.Verbose($"found plug for zone: {((LG_ZoneExpander)plug).m_linksFrom.m_zone.LocalIndex}{((Object)((LG_ZoneExpander)plug).m_linksFrom).name}->{((LG_ZoneExpander)plug).m_linksTo.m_zone.LocalIndex}{((Object)((LG_ZoneExpander)plug).m_linksTo).name}", (LogLevel)32); if (!BuilderInfo.TryGetConfig(((LG_ZoneExpander)plug).m_linksFrom.m_zone, out LayoutConfig config)) { return; } LG_GridPosition normal = ((LG_ZoneExpander)plug).m_linksFrom.m_geomorph.m_tile.m_shape.m_gridPosition.GetNormal(config.GridSize); if (!config.TryGetTileData(normal, out TileOverrideData overrideData)) { return; } ZoneOverrideData zoneData = overrideData.ZoneData; bool flag = default(bool); if (zoneData != null && zoneData.OverridePlugs && TryGetPlugPrefab(overrideData.ZoneData.GetNextPlug(), out GameObject prefab2)) { BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(48, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - Prefab replaced by ZoneData.OverridePlugs! '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)prefab2).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Info(val); prefab = prefab2; } LG_PlugDir dir = plug.m_dir; if (TryGetPlugPrefab((dir - 2) switch { 0 => overrideData.BackwardPlug, 2 => overrideData.ForwardPlug, 3 => overrideData.LeftPlug, 1 => overrideData.RightPlug, _ => string.Empty, }, out prefab2)) { BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - Prefab replaced by "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<LG_PlugDir>(plug.m_dir); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" plug setting! '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)prefab2).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Info(val); prefab = prefab2; } else { if (!overrideData.OverridePlugWithNoGateChance) { return; } Random random = new Random(((LG_ZoneExpander)plug).m_linksFrom.AreaSeed.ToSeed()); bool withGate = ((LG_ZoneExpander)plug).m_isZoneSource || (!(overrideData.PlugWithNoGateChance >= 1f) && (overrideData.PlugWithNoGateChance <= 0f || random.NextFloat01() >= overrideData.PlugWithNoGateChance)); int dropHeight = GetDropHeight(plug); GameObject randomPlug = BuilderInfo.GetRandomPlug(random.NextUInt(), dropHeight, GetSubComplexOfPlug(plug), withGate); if ((Object)(object)randomPlug == (Object)null) { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Plug was null! - Height: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(dropHeight); } Logger.Error(val2); } else { prefab = randomPlug; } } } [HarmonyPatch(typeof(LG_BuildPlugJob), "Build")] [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_BuildPlug(LG_BuildPlugJob __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected I4, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) LG_Plug plug = __instance.m_plug; Logger.Verbose($"buildplugjob plug in complex {((LG_ZoneExpander)plug).m_subComplex} plug status {((LG_ZoneExpander)plug).ExpanderStatus} plug direction {plug.m_dir} ..", (LogLevel)32); if ((int)((LG_ZoneExpander)plug).ExpanderStatus == 1 || ((LG_ZoneExpander)plug).m_isZoneSource || !BuilderInfo.TryGetConfig(((LG_ZoneExpander)plug).m_linksFrom.m_zone, out LayoutConfig config)) { return true; } LG_GridPosition normal = ((LG_ZoneExpander)plug).m_linksFrom.m_geomorph.m_tile.m_shape.m_gridPosition.GetNormal(config.GridSize); if (!config.TryGetTileData(normal, out TileOverrideData overrideData)) { return true; } LG_PlugDir dir = plug.m_dir; if (TryGetPlugPrefab((dir - 2) switch { 0 => overrideData.BackwardPlug, 2 => overrideData.ForwardPlug, 3 => overrideData.LeftPlug, 1 => overrideData.RightPlug, _ => string.Empty, }, out GameObject prefab)) { bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - Prefab replaced by "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<LG_PlugDir>(plug.m_dir); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" plug setting! '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)prefab).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Info(val); GameObject val2 = Object.Instantiate<GameObject>(prefab, ((Component)plug).transform.position, ((Component)plug).transform.rotation); val2.transform.SetParent(((Component)plug).transform, true); LG_Factory.FindAndBuildSelectorsAndSpawners(val2, RandomExtensions.NextSubSeed(__instance.m_rnd.Random), false); __instance.ProcessDivider(plug, val2, false, RandomExtensions.NextSubSeed(__instance.m_rnd.Random)); ((LG_ZoneExpander)plug).m_wasProcessed = true; } return true; } private static bool TryGetPlugPrefab(string prefabPath, [MaybeNullWhen(false)] out GameObject prefab) { if (Utility.IsNullOrWhiteSpace(prefabPath)) { prefab = null; return false; } prefab = AssetAPI.GetLoadedAsset<GameObject>(prefabPath); return (Object)(object)prefab != (Object)null; } private static int GetDropHeight(LG_Plug plug) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(((Component)plug).transform.position.y - ((Component)plug.m_pariedWith).transform.position.y); return Mathf.RoundToInt(num / BuilderInfo.AltitudeOffset); } private static SubComplex GetSubComplexOfPlug(LG_Plug plug) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) SubComplex result = ((LG_ZoneExpander)plug).m_subComplex; if (((LG_ZoneExpander)plug).m_subComplex != ((LG_ZoneExpander)plug.m_pariedWith).m_subComplex) { result = (SubComplex)8; } return result; } } [HarmonyPatch] internal static class Inject_CreateDimension { [HarmonyPatch(typeof(LG_Floor), "CreateAllDimensions")] [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_CreateAllDim250(LG_Floor __instance, uint seed, bool skipMainDimension = true) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Invalid comparison between Unknown and I4 //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Invalid comparison between Unknown and I4 //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: 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_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Expected O, but got Unknown //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) int num = 40; if (Builder.LevelGenExpedition.DimensionDatas == null || Builder.LevelGenExpedition.DimensionDatas.Count <= 0) { Dimension.CalculateAllDimensionBounds(); return false; } XXHashSequence val = default(XXHashSequence); ((XXHashSequence)(ref val))..ctor(seed, true); int num2 = 0; float num3 = 150f; DimensionDataBlock val3 = default(DimensionDataBlock); bool flag = default(bool); for (int i = 0; i < Builder.LevelGenExpedition.DimensionDatas.Count; i++) { DimensionInExpeditionData val2 = Builder.LevelGenExpedition.DimensionDatas[i]; if ((int)val2.DimensionIndex == 22 || !val2.TryGetDimensionData(ref val3)) { continue; } DimensionData dimensionData = val3.DimensionData; if (val2.Enabled && (!skipMainDimension || (int)val2.DimensionIndex != 0) && !__instance.m_createdDimensionSet.Contains(val2.DimensionIndex)) { num3 += dimensionData.VerticalExtentsDown; Vector3 val4 = Vector3.up * num3; __instance.CreateDimension(((XXHashSequence)(ref val)).NextSubSeed(), val2.DimensionIndex, false, dimensionData, val4, num, 64f); __instance.m_createdDimensionSet.Add(val2.DimensionIndex); BepInExDebugLogInterpolatedStringHandler val5 = new BepInExDebugLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("created dim "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<eDimensionIndex>(val2.DimensionIndex); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" pos "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector3>(val4); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" .."); } Logger.Debug(val5); num3 += dimensionData.VerticalExtentsUp; num2++; } } float num4 = 0f; float num5 = 0f; DimensionDataBlock val7 = default(DimensionDataBlock); for (int j = 0; j < Builder.LevelGenExpedition.DimensionDatas.Count; j++) { DimensionInExpeditionData val6 = Builder.LevelGenExpedition.DimensionDatas[j]; if ((int)val6.DimensionIndex == 22 && val6.TryGetDimensionData(ref val7)) { if (val7.DimensionData.VerticalExtentsDown > num4) { num4 = val7.DimensionData.VerticalExtentsDown; } if (val7.DimensionData.VerticalExtentsUp > num4) { num5 = num4; } } } int num6 = 0; DimensionDataBlock val9 = default(DimensionDataBlock); Bounds val11 = default(Bounds); for (int k = 0; k < ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Length; k++) { num3 += num4; float num7 = 0f; for (int l = 0; l < Builder.LevelGenExpedition.DimensionDatas.Count; l++) { DimensionInExpeditionData val8 = Builder.LevelGenExpedition.DimensionDatas[l]; if ((int)val8.DimensionIndex != 22) { continue; } if (!val8.TryGetDimensionData(ref val9)) { Debug.LogError(Object.op_Implicit("Could not find datablock for arena: datablockID: " + val8.DimensionData)); continue; } eDimensionIndex val10 = (eDimensionIndex)(21 - (num6 + 1)); if (__instance.m_createdDimensionSet.Contains(val10)) { DebugLog.LogPrefixError((Object)(object)__instance, $"Enemy dimension ({val10}) had already been created! If there are dimension enemies in the level, dimensionIndex {17}-{20} needs to be free (one for each player slot)."); continue; } DimensionData dimensionData2 = val9.DimensionData; if (val8.Enabled) { GameObject customGeomorph = GameDataBlockBase<ComplexResourceSetDataBlock>.GetBlock(dimensionData2.DimensionResourceSetID).GetCustomGeomorph(dimensionData2.DimensionGeomorph); if ((Object)(object)customGeomorph == (Object)null) { DebugLog.LogPrefixError((Object)(object)__instance, $"The dimension geomorph for ({((GameDataBlockBase<DimensionDataBlock>)(object)val9).persistentID}) {((GameDataBlockBase<DimensionDataBlock>)(object)val9).name} could not be found!"); continue; } float num8 = 32f; LG_Dimension component = customGeomorph.GetComponent<LG_Dimension>(); if ((Object)(object)component != (Object)null && component.TryGetDimensionBounds(ref val11)) { num8 += ((Bounds)(ref val11)).extents.x; } num7 += num8; Vector3 val12 = Vector3.up * num3 + Vector3.right * num7; __instance.CreateDimension(((XXHashSequence)(ref val)).NextSubSeed(), val10, true, dimensionData2, val12, 10, 64f); __instance.m_createdDimensionSet.Add(val10); DimensionSlotIndex val13 = new DimensionSlotIndex { DimensionDataBlockID = 14u, PlayerSlotIndex = (uint)k }; Dictionary<DimensionSlotIndex, Dimension> dimensionArenaMap = __instance.m_dimensionArenaMap; List<Dimension> dimensions = __instance.m_dimensions; dimensionArenaMap.Add(val13, dimensions[dimensions.Count - 1]); BepInExDebugLogInterpolatedStringHandler val5 = new BepInExDebugLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("created dim "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<eDimensionIndex>(val10); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" pos "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector3>(val12); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" .."); } Logger.Debug(val5); num2++; num7 += num8; } num6++; } num3 += num5; } Dimension.CalculateAllDimensionBounds(); BepInExInfoLogInterpolatedStringHandler val14 = new BepInExInfoLogInterpolatedStringHandler(101, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val14).AppendLiteral("Found ("); ((BepInExLogInterpolatedStringHandler)val14).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val14).AppendLiteral(") unique dimension references in GameData for this expedition and created ("); ((BepInExLogInterpolatedStringHandler)val14).AppendFormatted<int>(num6); ((BepInExLogInterpolatedStringHandler)val14).AppendLiteral(") enemy dimensions."); } Logger.Info(val14); return false; } [HarmonyPatch(typeof(LG_Floor), "CreateDimension")] [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_CreateDimension(LG_Floor __instance, uint seed, eDimensionIndex dimensionIndex, bool arenaDimension, ref DimensionData dimensionData, Vector3 position, ref int __result, int gridSize, float cellSize = 64f) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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_035e: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) if (arenaDimension) { return true; } gridSize = 40; if (dimensionData.IsStaticDimension) { return true; } LevelLayoutDataBlock val = default(LevelLayoutDataBlock); if (!DataBlockUtil.TryGetBlock<LevelLayoutDataBlock>(dimensionData.LevelLayoutData, ref val) || !ConfigManager.TryGetConfig(((GameDataBlockBase<LevelLayoutDataBlock>)(object)val).persistentID, out LayoutConfig config) || config.TileOverrides.Length == 0) { return true; } bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("in createdim prefix gridsize "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(gridSize); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" .."); } Logger.Debug(val2); cellSize = 64f; XXHashSequence val3 = default(XXHashSequence); ((XXHashSequence)(ref val3))..ctor(seed, true); Vector3 val4 = position - new Vector3(cellSize, 0f, cellSize) * (float)gridSize * 0.5f; LG_TileShape val5 = __instance.CreateTileShape((LG_TileShapeType)1, cellSize, ref val4); LG_Grid val6 = CellGridBase<LG_Grid, LG_Tile, LG_Cell>.Create(cellSize, val4); ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)val6).SetupCells(gridSize, gridSize); ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)val6).InititalizeCells(); int count = __instance.m_dimensions.Count; Dimension val7 = new Dimension(val6, dimensionIndex, count, dimensionData, position, arenaDimension); DebugLog.LogPrefix((Object)(object)__instance, $"Created Dimension (Index: {dimensionIndex}, gridSize: {gridSize}, cellSize: {cellSize})."); GameObject val8 = val7.ResourceData.GetCustomGeomorph(dimensionData.DimensionGeomorph); TileOverrideData tileOverrideData = config.TileOverrides.FirstOrDefault((TileOverrideData t) => t.X == 0 && t.Z == 0); if (tileOverrideData != null && !Utility.IsNullOrWhiteSpace(tileOverrideData.Geomorph)) { val8 = AssetAPI.GetLoadedAsset<GameObject>(tileOverrideData.Geomorph); BepInExInfoLogInterpolatedStringHandler val9 = new BepInExInfoLogInterpolatedStringHandler(28, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral(" - dim "); ((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<eDimensionIndex>(dimensionIndex); ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral(" elevator overriden! "); ((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<string>(((Object)val8).name); } Logger.Info(val9); } if ((Object)(object)val8 == (Object)null) { DebugLog.LogPrefixError((Object)(object)__instance, $"<b><color=red>NULL ERROR</color></b> Could not get the Dimension Geomorph prefab for dimension {dimensionIndex}, are you using a resource set in the DimensionDataBlock that contains the Dimension Geomorph prefab under the \"Custom Geomorphs_Objective_1x1\" header?"); __result = count; return false; } LG_FloorTransition val10 = __instance.CreateFloorTransition(((XXHashSequence)(ref val3)).NextSubSeed(), val7, position, Quaternion.identity, val8, val7.DimensionData.IsStaticDimension); if ((Object)(object)val10 == (Object)null) { DebugLog.LogPrefixError((Object)(object)__instance, $"<b><color=red>NULL ERROR</color></b> The LG_FloorTransition of dimension {dimensionIndex} was null! Does the dimension prefab have a LG_FloorTransition component on its root?"); __result = count; return false; } LG_Dimension val11 = ((Component)val10).GetComponent<LG_Dimension>(); if ((Object)(object)val11 == (Object)null) { val11 = ((Component)val10).gameObject.AddComponent<LG_Dimension>(); DebugLog.LogPrefixError((Object)(object)__instance, $"<b><color=red>NULL ERROR</color></b> The dimension {dimensionIndex} had no {typeof(LG_Dimension).Name} component, so added one automatically!"); } val7.DimensionLevel = val11; if (val10.m_spawnPoints != null && ((Il2CppArrayBase<Transform>)(object)val10.m_spawnPoints).Length != 0) { val11.AddSpawnPoints(val10.m_spawnPoints); } val5.m_gridPosition = new LG_GridPosition(gridSize / 2, gridSize / 2); val5.m_type = val10.m_shapeType; AIG_GeomorphNodeVolume component = ((Component)val10).GetComponent<AIG_GeomorphNodeVolume>(); if ((Object)(object)component == (Object)null) { DebugLog.LogPrefixError((Object)(object)__instance, $"<b><color=red>NULL ERROR</color></b> The Dimension Geomorph for {dimensionIndex} did not have a {typeof(AIG_GeomorphNodeVolume).Name} component on it!"); __result = count; return false; } ((LG_Geomorph)val10).m_nodeVolume = (AIG_NodeVolume)(object)component; ((AIG_NodeVolume)component).ConstructVoxelNodeVolume(); ((LG_Geomorph)val10).ScanChildrenAreas(); val7.m_startTile = LG_Tile.Create(val6, val5); val7.m_startTile.m_geoRoot = (LG_Geomorph)(object)val10; val7.m_startTile.m_geoRoot.m_tile = val7.m_startTile; ((Component)val10).transform.SetParent(((Component)val7.DimensionRootTemp).transform); ((LG_Geomorph)val10).m_tile = val7.m_startTile; val7.m_startTransition = val10; val7.Tiles.Add(val7.m_startTile); __instance.m_dimensions.Add(val7); __instance.m_indexToDimensionMap[dimensionIndex] = val7; __result = count; return false; } } [HarmonyPatch(typeof(LG_LoadComplexDataSetResourcesJob), "Build")] internal static class Inject_LoadComplexShard { private static int _waitingShared; private static void Loaded() { _waitingShared--; } [HarmonyPrefix] [HarmonyPriority(500)] [HarmonyWrapSafe] private static void Pre_LoadComplexShard_Build(LG_LoadComplexDataSetResourcesJob __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected I4, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0053: Invalid comparison between Unknown and I4 //IL_004a: 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) if (__instance.m_loadingStarted) { return; } foreach (Complex item in BuilderInfo.ExtraComplexResourceToLoad) { AssetBundleName val = (AssetBundleName)((int)item switch { 0 => 2, 1 => 4, 2 => 3, _ => 0, }); if ((int)val > 0) { AssetShardManager.LoadAllShardsForBundleAsync(val, Action.op_Implicit((Action)Loaded), 1, (LoadSceneMode)1); _waitingShared++; } } } [HarmonyPostfix] [HarmonyPriority(500)] [HarmonyWrapSafe] private static void Post_LoadComplexShard_Build(ref bool __result) { if (_waitingShared >= 1) { __result = false; } } } [HarmonyPatch(typeof(LG_SetupFloor), "Build")] internal static class Inject_SetupFloor { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_SetupFloor_Build(LG_SetupFloor __instance, ref bool __result) { //IL_0076: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown Debug.Log(Object.op_Implicit(Deb.LG("LG_SetupFloor.Build", 0f))); uint num = 0u; if (Builder.LayerBuildDatas[0].m_zoneBuildDatas != null && Builder.LayerBuildDatas[0].m_zoneBuildDatas.Count > 0) { num = (uint)Builder.LayerBuildDatas[0].m_zoneBuildDatas[0].SubSeed; } XXHashSeed seed = __instance.m_rnd.Seed; XXHashSequence val = default(XXHashSequence); ((XXHashSequence)(ref val))..ctor(((XXHashSeed)(ref seed)).SubSeed(num), true); if (!ConfigManager.TryGetConfig(RundownManager.ActiveExpedition.LevelLayoutData, out LayoutConfig config) || config.TileOverrides.Length == 0) { return true; } TileOverrideData tileOverrideData = config.TileOverrides.FirstOrDefault((TileOverrideData t) => t.X == 0 && t.Z == 0); if (tileOverrideData == null || Utility.IsNullOrWhiteSpace(tileOverrideData.Geomorph)) { return true; } GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>(tileOverrideData.Geomorph); if ((Object)(object)loadedAsset == (Object)null) { Logger.Error("LGTuner failed to override elevator!"); return true; } bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - elevator overriden! "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)loadedAsset).name); } Logger.Info(val2); LG_FloorTransition val3 = GOUtil.SpawnChildAndGetComp<LG_FloorTransition>(loadedAsset, __instance.m_position, __instance.m_rotation); ((LG_Geomorph)val3).m_geoPrefab = loadedAsset; ((LG_Geomorph)val3).SetupAreas(((XXHashSequence)(ref val)).NextSubSeed()); ((LG_Geomorph)val3).SetPlaced(); __instance.m_floor.Setup(((XXHashSequence)(ref val)).NextSubSeed(), (LG_FloorType)0, Builder.ComplexResourceSetBlock.LevelGenConfig.TransitionDirection, val3); for (int num2 = 0; num2 < __instance.m_floor.m_dimensions.Count; num2++) { __instance.m_floor.InjectJobs(__instance.m_floor.m_dimensions[num2].DimensionIndex); } LG_Factory.InjectJob((LG_FactoryJob)new LG_BuildFloorJob(__instance.m_floor), (BatchName)7); __result = true; return false; } } [HarmonyPatch(typeof(LG_SetupFloor), "Build")] internal static class Inject_SetupFloor_Late { private static bool _geoFixesApplied; static Inject_SetupFloor_Late() { _geoFixesApplied = false; LevelAPI.OnLevelCleanup += delegate { _geoFixesApplied = false; }; } [HarmonyPrepare] private static bool Prepare() { return !ConfigManager.BCGF_IsLoaded; } [HarmonyPrefix] [HarmonyPriority(300)] [HarmonyWrapSafe] private static void Pre_SetupFloor_Build() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: 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_0313: 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_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055e: 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_05b5: Unknown result type (might be due to invalid IL or missing references) if (!ConfigManager.General.LegacyGeoFixesEnabled.Value || _geoFixesApplied) { return; } GameObject val = default(GameObject); if (AssetAPI.TryGetLoadedAsset<GameObject>("Assets/AssetPrefabs/Complex/Service/Geomorphs/Maintenance/geo_64x64_service_floodways_hub_SF_01_R8D1.prefab", ref val)) { foreach (Transform componentsInChild in val.GetComponentsInChildren<Transform>()) { if (((Object)componentsInChild).name.Equals("AIGraphSource", StringComparison.OrdinalIgnoreCase)) { componentsInChild.position = new Vector3(5f, 2f, -16f); } } Logger.Debug("navmesh fix on 'geo_64x64_service_floodways_hub_SF_01_R8D1' done"); } GameObject val2 = default(GameObject); if (AssetAPI.TryGetLoadedAsset<GameObject>("Assets/AssetPrefabs/Complex/Service/Geomorphs/Maintenance/geo_64x64_service_floodways_hub_SF_01.prefab", ref val2)) { foreach (Transform componentsInChild2 in val2.GetComponentsInChildren<Transform>()) { if (((Object)componentsInChild2).name.Equals("AIGraphSource", StringComparison.OrdinalIgnoreCase)) { componentsInChild2.position = new Vector3(5f, 2f, -16f); } } Logger.Debug("navmesh fix on 'geo_64x64_service_floodways_hub_SF_01' done"); } GameObject val3 = default(GameObject); if (AssetAPI.TryGetLoadedAsset<GameObject>("Assets/AssetPrefabs/Complex/Tech/Geomorphs/geo_64x64_tech_lab_HA_05.prefab", ref val3)) { foreach (LG_PrefabSpawner componentsInChild3 in val3.GetComponentsInChildren<LG_PrefabSpawner>()) { if (!((Object)((Component)componentsInChild3).transform).name.Contains("prop_generic_duct_d_2m_tile_001")) { continue; } foreach (Transform componentsInChild4 in componentsInChild3.m_prefab.GetComponentsInChildren<Transform>()) { if (((Object)componentsInChild4).name.Equals("Capsulecollider", StringComparison.OrdinalIgnoreCase)) { ((Component)componentsInChild4).transform.localScale = new Vector3(0.5f, 1f, 0.5f); } } } Logger.Debug("collider fix on 'geo_64x64_tech_lab_HA_05' done"); } GameObject val4 = default(GameObject); if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("StairsFix") && AssetAPI.TryGetLoadedAsset<GameObject>("Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_Mining_Shaft.prefab", ref val4)) { Il2CppArrayBase<LG_Ladder> componentsInChildren = val4.GetComponentsInChildren<LG_Ladder>(); if (componentsInChildren.Count >= 2) { Transform transform = ((Component)componentsInChildren[2]).transform; transform.position += new Vector3(0f, 0f, -1.5f); Logger.Debug("navmesh fix on 'Dimension_Desert_Mining_Shaft' done"); } } AssetReference val5 = default(AssetReference); if (AssetAPI.AllCustomAssets.TryGet("Assets/Custom Geo's/Mining exit/Mining_exit_V1.prefab", ref val5) && val5.IsLoaded) { Vector3[] array = (Vector3[])(object)new Vector3[24] { new Vector3(-3.5f, -4.119f, -21.95f), new Vector3(-3.5f, -4.119f, -17.05f), new Vector3(3.46f, -4.119f, -21.95f), new Vector3(3.46f, -4.119f, -17f), new Vector3(3.5f, -4.119f, -21.95f), new Vector3(0.20444f, -4.119f, -23.95f), new Vector3(-3.5f, -4.119f, -11.1f), new Vector3(3.46f, -4.119f, -11.07f), new Vector3(-3.5f, -4.119f, -5.21f), new Vector3(3.46f, -4.119f, -5.16f), new Vector3(-8.443f, -4.119f, -27.37f), new Vector3(8.45f, -4.119f, -27.265f), new Vector3(-3.5f, -4.119f, -21.95f), new Vector3(-3.5f, -4.119f, -17.05f), new Vector3(3.46f, -4.119f, -21.95f), new Vector3(3.46f, -4.119f, -17f), new Vector3(3.5f, -4.119f, -21.95f), new Vector3(0.20444f, -4.119f, -23.95f), new Vector3(-3.5f, -4.205f, -13.11f), new Vector3(3.46f, -4.119f, -11.07f), new Vector3(-8.443f, -4.119f, -27.37f), new Vector3(8.45f, -4.119f, -27.265f), new Vector3(-3.5f, -4.119f, -28.07f), new Vector3(3.46f, -4.119f, -28f) }; int num = 0; foreach (LG_PrefabSpawner componentsInChild5 in val5.AssetAs<GameObject>().GetComponentsInChildren<LG_PrefabSpawner>()) { if (((Object)((Component)componentsInChild5).transform).name.Contains("BuildingPart_StorageDivider_Conc_4x4x1_a", StringComparison.OrdinalIgnoreCase)) { ((Component)componentsInChild5).transform.localPosition = array[num++]; } } Logger.Debug("navmesh fix on samdb_v1 'Mining_exit_V1' done"); } _geoFixesApplied = true; } } } namespace LGTuner.Extensions { public static class RandomExtensions { public static uint NextUInt(this Random random) { uint num = (uint)random.Next(1073741824); uint num2 = (uint)random.Next(4); return (num << 2) | num2; } public static float NextFloat01(this Random random) { return Mathf.Clamp01(random.NextSingle()); } public static int ToSeed(this uint seed) { return (int)seed; } } } namespace LGTuner.Configs { public sealed class LayoutConfig { private TileOverrideData[,] _builtTileOverrides = new TileOverrideData[0, 0]; public uint LevelLayoutID { get; set; } public Complex[] ExtraComplexResourceToLoad { get; set; } = Array.Empty<Complex>(); public ZoneOverrideData[] ZoneOverrides { get; set; } = Array.Empty<ZoneOverrideData>(); public TileOverrideData[] TileOverrides { get; set; } = Array.Empty<TileOverrideData>(); [JsonIgnore] public int GridSize { get; private set; } [JsonIgnore] public int GridSizeHalf { get; private set; } public void Reset(int gridSize) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown Array.ForEach(ZoneOverrides, delegate(ZoneOverrideData item) { item.Clear(); }); Array.Clear(_builtTileOverrides, 0, _builtTileOverrides.Length); GridSize = gridSize; GridSizeHalf = gridSize / 2; _builtTileOverrides = new TileOverrideData[GridSize, GridSize]; TileOverrideData[] tileOverrides = TileOverrides; bool flag = default(bool); foreach (TileOverrideData tileOverrideData in tileOverrides) { if (_builtTileOverrides[tileOverrideData.X + GridSizeHalf, tileOverrideData.Z + GridSizeHalf] == null) { PutOverrideData(tileOverrideData); continue; } BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Duplicate tile data in layout: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(LevelLayoutID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(tileOverrideData.X); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(tileOverrideData.Z); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")!"); } Logger.Error(val); } } public bool TryGetTileData(LG_GridPosition normalGridPosition, out TileOverrideData overrideData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown int num = normalGridPosition.x + GridSizeHalf; bool flag = default(bool); if (num >= GridSize) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(41, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("TryGetTileData grid x was out of range! "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(":"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(GridSize); } Logger.Error(val); overrideData = null; return false; } int num2 = normalGridPosition.z + GridSizeHalf; if (num2 >= GridSize) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(41, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("TryGetTileData grid Z was out of range! "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(":"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(GridSize); } Logger.Error(val); overrideData = null; return false; } overrideData = _builtTileOverrides[num, num2]; return overrideData != null; } public void PutOverrideData(TileOverrideData data) { _builtTileOverrides[data.X + GridSizeHalf, data.Z + GridSizeHalf] = data; } public TileOverrideData PopulateTileOverrideForZone(LG_Zone zone, LG_GridPosition normalGridPosition) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!TryGetZoneOverride(zone.LocalIndex, out ZoneOverrideData data)) { return null; } if (TryGetTileData(normalGridPosition, out TileOverrideData overrideData)) { overrideData.ZoneData = data; TryApplyOverrides(data, overrideData); return overrideData; } TileOverrideData tileOverrideData = new TileOverrideData { ZoneData = data, X = normalGridPosition.x, Z = normalGridPosition.z, OverridePlugWithNoGateChance = data.OverridePlugWithNoGateChance, PlugWithNoGateChance = data.PlugWithNoGateChance }; TryApplyOverrides(data, tileOverrideData); PutOverrideData(tileOverrideData); return tileOverrideData; } private static void TryApplyOverrides(ZoneOverrideData zoneOverrideData, TileOverrideData tileOverrideData) { if (zoneOverrideData.OverrideGeomorphs && string.IsNullOrEmpty(tileOverrideData.Geomorph)) { ZoneOverrideData.GeomorphData? nextGeo = zoneOverrideData.GetNextGeo(); if (nextGeo.HasValue) { tileOverrideData.Geomorph = nextGeo.Value.Geomorph; if (tileOverrideData.Rotation == RotateType.None) { tileOverrideData.Rotation = ZoneOverrideData.DirectionToRotate(nextGeo.Value.Direction); } } } if (zoneOverrideData.OverrideAltitudes && !tileOverrideData.OverrideAltitude) { int? nextAltitude = zoneOverrideData.GetNextAltitude(); if (nextAltitude.HasValue) { tileOverrideData.OverrideAltitude = true; tileOverrideData.Altitude = nextAltitude.Value; } } } public bool TryGetZoneOverride(eLocalZoneIndex localIndex, out ZoneOverrideData data) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing referen