using System; using System.Collections.Generic; 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.Json; using System.Text.Json.Serialization; using AIGraph; using ARA.LevelLayout; using ARA.LevelLayout.DefinitionData; using AmorLib.Dependencies; using AmorLib.Utils; using AmorLib.Utils.Extensions; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Hook; using FluffyUnderware.DevTools.Extensions; using GTFO.API; using GTFO.API.Extensions; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppInterop.Runtime.Runtime.VersionSpecific.MethodInfo; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using LevelGeneration; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using UnityEngine; 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("AdditionalRundownAdvancements")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c77f019af73049b789fb072cdf2b4feb81133656")] [assembly: AssemblyProduct("AdditionalRundownAdvancements")] [assembly: AssemblyTitle("AdditionalRundownAdvancements")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 ARA { internal static class ARAJson { private static readonly JsonSerializerOptions _setting = JsonSerializerUtil.CreateDefaultSettings(true, PData_Wrapper.IsLoaded, InjectLib_Wrapper.IsLoaded); public static T Deserialize(string json) { return JsonSerializer.Deserialize(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); } } internal static class ARALogger { internal static readonly ManualLogSource MLS; static ARALogger() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown MLS = new ManualLogSource("ARA"); Logger.Sources.Add((ILogSource)(object)MLS); } public static void Info(BepInExInfoLogInterpolatedStringHandler handler) { MLS.LogInfo(handler); } public static void Info(string str) { MLS.LogMessage((object)str); } public static void Debug(BepInExDebugLogInterpolatedStringHandler handler) { MLS.LogDebug(handler); } public static void Debug(string str) { MLS.LogDebug((object)str); } 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 abstract class CustomConfigBase { public static readonly string Module = Path.Combine(MTFOPathAPI.CustomPath, "AdditionalRundownAdvancements"); public abstract string ModulePath { get; } public abstract void Setup(); public virtual void OnBuildStart() { } public virtual void OnBeforeBatchBuild(BatchName batch) { } public virtual void OnBuildDone() { } public virtual void OnEnterLevel() { } public virtual void OnLevelCleanup() { } } public static class CustomConfigManager { public static readonly List CustomConfigs = new List(); public static void Setup(IEnumerable configs) { foreach (CustomConfigBase config in configs) { CustomConfigs.Add(config); config.Setup(); LevelAPI.OnBuildStart += config.OnBuildStart; LevelAPI.OnBeforeBuildBatch += config.OnBeforeBatchBuild; LevelAPI.OnBuildDone += config.OnBuildDone; LevelAPI.OnEnterLevel += config.OnEnterLevel; LevelAPI.OnLevelCleanup += config.OnLevelCleanup; } } } [BepInPlugin("Amor.ARA", "AdditionalRundownAdvancements", "0.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [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 = "AdditionalRundownAdvancements"; public override void Load() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("Amor.ARA").PatchAll(); AssetAPI.OnStartupAssetsLoaded += OnStartupAssetsLoaded; ARALogger.Info("ARA is done loading!"); } private void OnStartupAssetsLoaded() { IEnumerable configs = from t in AccessTools.GetTypesFromAssembly(((object)this).GetType().Assembly) where typeof(CustomConfigBase).IsAssignableFrom(t) && !t.IsAbstract select (CustomConfigBase)Activator.CreateInstance(t); CustomConfigManager.Setup(configs); } } } namespace ARA.Patches { [HarmonyPatch(typeof(ElevatorCargoCage), "SpawnObjectiveItemsInLandingArea")] internal static class ElevatorCargoPatches { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_SpawnItems(out ElevatorCargoCustomData? __state) { if (LayoutConfigManager.Current == LayoutConfigDefinition.Empty) { __state = null; return true; } __state = LayoutConfigManager.Current.Elevator; if (__state.DisableElevatorCargo) { ElevatorRide.Current.m_cargoCageInUse = false; return false; } return !__state.OverrideCargoItems; } [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_SpawnItems(ElevatorCargoCage __instance, ElevatorCargoCustomData? __state) { //IL_00d8: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected I4, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) if (__state == null || __state.CargoItems.Length == 0) { return; } if (__instance.m_itemsToMoveToCargo == null) { List val2 = (__instance.m_itemsToMoveToCargo = new List()); } uint[] cargoItems = __state.CargoItems; bool flag = default(bool); foreach (uint num in cargoItems) { ItemDataBlock block = GameDataBlockBase.GetBlock(num); if (block == null || !((GameDataBlockBase)(object)block).internalEnabled) { BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to find enabled ItemDataBlock "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("!"); } ARALogger.Error(val3); continue; } LG_PickupItem val4 = LG_PickupItem.SpawnGenericPickupItem(ElevatorShaftLanding.CargoAlign); val4.SpawnNode = Builder.GetElevatorArea().m_courseNode; int num2 = Random.Range(0, int.MaxValue); InventorySlot inventorySlot = block.inventorySlot; InventorySlot val5 = inventorySlot; switch (val5 - 5) { case 0: val4.SetupAsConsumable(num2, num); break; case 1: case 3: val4.SetupAsBigPickupItem(num2, num, false, 0); break; case 2: case 4: val4.SetupAsSmallGenericPickup(num2, num, false); break; default: { BepInExWarningLogInterpolatedStringHandler val6 = new BepInExWarningLogInterpolatedStringHandler(61, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("Unknown item type "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(block.inventorySlot); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" for "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(((GameDataBlockBase)(object)block).name); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("), attempting spawning as big pickup"); } ARALogger.Warn(val6); val4.SetupAsBigPickupItem(num2, num, false, 0); break; } } __instance.m_itemsToMoveToCargo.Add(((Component)val4).transform); } ElevatorRide.Current.m_cargoCageInUse = true; } } [HarmonyPatch(typeof(LG_DistributionJobUtils), "GetRandomNodeFromZoneForFunction")] internal static class GeneratorClusterPatch { [HarmonyPrefix] [HarmonyWrapSafe] public static bool ForceGeneratorClusterSpawn(ref AIG_CourseNode __result, LG_Zone zone, ExpeditionFunction func, float randomValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown if ((int)func != 19) { return true; } if (!LayoutConfigManager.TryGetCurrentZoneData(zone, out ZoneCustomData zoneData) || !zoneData.ForceGeneratorClusterMarkers) { return true; } List list = new List(); Enumerator enumerator = zone.m_areas.GetEnumerator(); while (enumerator.MoveNext()) { LG_Area current = enumerator.Current; if (current.GetMarkerSpawnerCount((ExpeditionFunction)19) > 0) { list.Add(current); } } if (list.Count == 0) { return true; } int index = Math.Clamp((int)(randomValue * (float)list.Count), 0, list.Count - 1); bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(44, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Selected area for forced generator cluster: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(list[index].m_navInfo.m_suffix); } ARALogger.Debug(val); __result = list[index].m_courseNode; return false; } } [HarmonyPatch] internal static class WorldEventUtilsPatches { private unsafe delegate bool d_ForceSpawnMarker(IntPtr position, IntPtr rotation, IntPtr parent, uint markerBlockID, int index, ExpeditionFunction wantedFunc, out IntPtr spawnedObject, Il2CppMethodInfo* methodInfo); private static INativeDetour? ForceSpawnMarkerDetour; private static d_ForceSpawnMarker? orig_ForceSpawnMarker; [HarmonyPrepare] private unsafe static void ApplyNativePatch() { if (ForceSpawnMarkerDetour == null) { ForceSpawnMarkerDetour = CreateGenericStaticDetour(typeof(WorldEventUtils), "TryForceSpawnMarkerResult", typeof(bool).FullName, new string[7] { typeof(Vector3).FullName, typeof(Quaternion).FullName, typeof(Transform).FullName, typeof(uint).FullName, typeof(int).FullName, typeof(ExpeditionFunction).FullName, typeof(GameObject).MakeByRefType().FullName }, new Type[1] { typeof(MiningMarkerDataBlock) }, ForceSpawnMarkerPatch, out orig_ForceSpawnMarker); } } [HarmonyPatch(typeof(WorldEventUtils), "TrySpawnItemOnAlign")] [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_TryForceSpawnItem(Transform itemAlign, out SpecificDataContainer? __state) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return !LayoutConfigManager.TryGetSpecificDataContainer(itemAlign.position, out __state); } [HarmonyPatch(typeof(WorldEventUtils), "TrySpawnItemOnAlign")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_TryForceSpawnItem(ref bool __result, bool __runOriginal, uint itemID, Transform itemAlign, uint seed, ref ItemInLevel spawnedItem, SpecificDataContainer? __state) { //IL_00aa: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected I4, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) SpecificDataContainer __state2 = __state; if (__runOriginal || __state2 == null) { return; } ItemDataBlock block = GameDataBlockBase.GetBlock(itemID); bool flag = default(bool); if (block == null || !((GameDataBlockBase)(object)block).internalEnabled) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to find enabled ItemDataBlock "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(itemID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!"); } ARALogger.Error(val); return; } LG_PickupItem val2 = LG_PickupItem.SpawnGenericPickupItem(itemAlign); val2.SpawnNode = __state2.SpawnNode; int num = (int)XXHash.Hash(seed, 0u, false); InventorySlot inventorySlot = block.inventorySlot; InventorySlot val3 = inventorySlot; switch (val3 - 5) { case 0: val2.SetupAsConsumable(num, itemID); break; case 1: case 3: val2.SetupAsBigPickupItem(num, itemID, false, 0); break; case 2: case 4: val2.SetupAsSmallGenericPickup(num, itemID, false); break; default: { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unknown item type "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(block.inventorySlot); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" for ItemDataBlock "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(itemID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!"); } ARALogger.Error(val); return; } } spawnedItem = ((Component)val2).GetComponentInChildren(); Queue eData = new Queue(__state2.EventsOnPickup); ItemInLevel obj = spawnedItem; if (obj != null) { obj.GetSyncComponent().OnSyncStateChange += Action.op_Implicit((Action)delegate(ePickupItemStatus status, pPickupPlacement placement, PlayerAgent _, bool isRecall) { //IL_0001: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if ((!placement.hasBeenPickedUp || !placement.linkedToMachine) && isRecall) { bool flag2 = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(59, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("isRecall for SpecificDataContainer "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(__state2.WorldEventObjectFilter); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("; restore EventsOnPickup"); } ARALogger.Warn(val4); eData = new Queue(__state2.EventsOnPickup); } if ((int)status == 1 && !isRecall) { while (eData.Count > 0) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(eData.Dequeue(), (eWardenObjectiveEventTrigger)0, true, 0f); } } }); } __result = (Object)(object)spawnedItem != (Object)null; } private unsafe static INativeDetour CreateGenericStaticDetour(Type classType, string methodName, string returnType, string[] paramTypes, Type[] genericArguments, TDelegate to, out TDelegate original) where TDelegate : Delegate { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown IntPtr il2CppClass = IL2CPP.GetIl2CppClass(classType.Module.Name, string.Empty, classType.Name); if (il2CppClass == IntPtr.Zero) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to get class pointer for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(methodName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("?"); } ARALogger.Error(val); original = null; return null; } IntPtr il2CppMethod = IL2CPP.GetIl2CppMethod(il2CppClass, true, methodName, returnType, paramTypes); MethodInfo val2 = new MethodInfo(IL2CPP.il2cpp_method_get_object(il2CppMethod, il2CppClass)); MethodInfo val3 = val2.MakeGenericMethod(((IEnumerable)genericArguments).Select((Func)Il2CppType.From).ToArray()); INativeMethodInfoStruct val4 = UnityVersionHandler.Wrap((Il2CppMethodInfo*)(void*)IL2CPP.il2cpp_method_get_from_reflection(((Il2CppObjectBase)val3).Pointer)); return INativeDetour.CreateAndApply(val4.MethodPointer, to, ref original); } private unsafe static bool ForceSpawnMarkerPatch(IntPtr position, IntPtr rotation, IntPtr parent, uint markerBlockID, int index, ExpeditionFunction wantedFunc, out IntPtr spawnedObject, Il2CppMethodInfo* methodInfo) { //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_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_0021: 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_0163: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0102: 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) spawnedObject = IntPtr.Zero; Vector3 val = (Vector3)(*(void*)position); Quaternion val2 = (Quaternion)(*(void*)rotation); if (!LayoutConfigManager.TryGetSpecificDataContainer(val, out SpecificDataContainer container)) { orig_ForceSpawnMarker(position, rotation, parent, markerBlockID, index, wantedFunc, out spawnedObject, methodInfo); return spawnedObject != IntPtr.Zero; } GameObject val3 = new GameObject(); Transform val4 = new Transform(parent); try { string extraPrefab; string customPrefabs = container.GetCustomPrefabs(out extraPrefab); GameObject loadedAsset = AssetAPI.GetLoadedAsset(customPrefabs); val3 = GameObjectPlusExtensions.ClonePrefabSpawners(loadedAsset, val, val2, val4); if ((Object)(object)val3.GetComponentInChildren() == (Object)null && !Utility.IsNullOrWhiteSpace(extraPrefab)) { bool flag = false; foreach (LG_MarkerProducer componentsInChild in val3.GetComponentsInChildren(false)) { if (!flag && HasTerminalMarker(componentsInChild.MarkerDataBlockType, componentsInChild.MarkerDataBlockID)) { GameObject loadedAsset2 = AssetAPI.GetLoadedAsset(extraPrefab); val3 = GameObjectPlusExtensions.ClonePrefabSpawners(loadedAsset2, ((Component)componentsInChild).transform.position, ((Component)componentsInChild).transform.rotation, ((Component)componentsInChild).transform.parent); flag = true; } ((Component)componentsInChild).gameObject.SetActive(false); } } } catch (Exception ex) { bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(73, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Unable to load custom terminal prefab(s), is the correct complex loaded?\n"); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(ex); } ARALogger.Error(val5); orig_ForceSpawnMarker(position, rotation, parent, markerBlockID, index, wantedFunc, out spawnedObject, methodInfo); return spawnedObject != IntPtr.Zero; } ((Object)val3).name = container.WorldEventObjectFilter; iLG_SpawnedInNodeHandler componentInChildren = val3.GetComponentInChildren(); if (componentInChildren == null) { return false; } componentInChildren.SpawnNode = container.SpawnNode; spawnedObject = ((Il2CppObjectBase)val3).Pointer; return spawnedObject != IntPtr.Zero; } private static bool HasTerminalMarker(LG_MarkerDataBlockType type, uint id) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0019: Expected I4, but got Unknown switch ((int)type) { case 0: { MiningMarkerDataBlock block3 = GameDataBlockBase.GetBlock(id); return block3 != null && ((GameDataBlockBase)(object)block3).internalEnabled && ListExtensions.ToManaged(block3.GetCompositions()).Any((MarkerComposition comp) => (int)comp.function == 7); } case 1: { ServiceMarkerDataBlock block2 = GameDataBlockBase.GetBlock(id); return block2 != null && ((GameDataBlockBase)(object)block2).internalEnabled && ListExtensions.ToManaged(block2.GetCompositions()).Any((MarkerComposition comp) => (int)comp.function == 7); } case 2: { TechMarkerDataBlock block = GameDataBlockBase.GetBlock(id); return block != null && ((GameDataBlockBase)(object)block).internalEnabled && ListExtensions.ToManaged(block.GetCompositions()).Any((MarkerComposition comp) => (int)comp.function == 7); } default: return false; } } } } namespace ARA.LevelLayout { public sealed class LayoutConfigDefinition { [JsonIgnore] public static readonly LayoutConfigDefinition Empty = new LayoutConfigDefinition(); public uint MainLevelLayout { get; set; } = 0u; public ElevatorCargoCustomData Elevator { get; set; } = new ElevatorCargoCustomData(); [JsonPropertyName("SetupWorldEventObjectOnAllTerminals")] public bool AllWorldEventTerminals { get; set; } = false; public ZoneCustomData[] Zones { get; set; } = Array.Empty(); } public sealed class LayoutConfigManager : CustomConfigBase { private static readonly Dictionary> _filepathLayoutMap = new Dictionary>(); private static readonly Dictionary _customLayoutData = new Dictionary(); private static readonly Dictionary _positionToContainerMap = new Dictionary(); private static readonly Dictionary _currentARAFilters = new Dictionary(); public static LayoutConfigDefinition Current { get; private set; } = LayoutConfigDefinition.Empty; public override string ModulePath => CustomConfigBase.Module + "/LevelLayout"; public static bool TryGetCurrentZoneData(LG_Zone zone, [MaybeNullWhen(false)] out ZoneCustomData zoneData) { LG_Zone zone2 = zone; List list = Current.Zones.Where(delegate(ZoneCustomData zData) { int result; if (zData != null) { (int, int, int) intTuple = ((GlobalBase)zData).IntTuple; (int, int, int) tuple = GlobalIndexUtil.ToIntTuple(zone2); result = ((intTuple.Item1 == tuple.Item1 && intTuple.Item2 == tuple.Item2 && intTuple.Item3 == tuple.Item3) ? 1 : 0); } else { result = 0; } return (byte)result != 0; }).ToList(); zoneData = list.Count switch { 0 => null, 1 => list[0], _ => new ZoneCustomData { HibernateSpawnAligns = list.SelectMany((ZoneCustomData zData) => zData.HibernateSpawnAligns).ToArray(), EnemySpawnPoints = list.SelectMany((ZoneCustomData zData) => zData.EnemySpawnPoints).ToArray(), BioscanSpawnPoints = list.SelectMany((ZoneCustomData zData) => zData.BioscanSpawnPoints).ToArray(), ForceGeneratorClusterMarkers = list.Any((ZoneCustomData zData) => zData.ForceGeneratorClusterMarkers), WorldEventObjects = list.SelectMany((ZoneCustomData zData) => zData.WorldEventObjects).ToArray() }, }; return zoneData != null; } public static bool TryGetSpecificDataContainer(Vector3 position, [MaybeNullWhen(false)] out SpecificDataContainer container) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair item in _positionToContainerMap) { if (Vector3Ext.Approximately(item.Key, position)) { container = item.Value; return true; } } container = null; return false; } public override void Setup() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown Directory.CreateDirectory(ModulePath); string path = Path.Combine(ModulePath, "Template.json"); LayoutConfigDefinition layoutConfigDefinition = new LayoutConfigDefinition(); layoutConfigDefinition.Zones = new ZoneCustomData[1] { new ZoneCustomData() }; LayoutConfigDefinition value = layoutConfigDefinition; File.WriteAllText(path, ARAJson.Serialize(value, typeof(LayoutConfigDefinition))); foreach (string item in Directory.EnumerateFiles(ModulePath, "*.json", SearchOption.AllDirectories)) { string content = File.ReadAllText(item); ReadFileContent(item, content); } LiveEditListener val = LiveEdit.CreateListener(ModulePath, "*.json", true); val.FileCreated += new LiveEditEventHandler(FileCreated); val.FileChanged += new LiveEditEventHandler(FileChanged); val.FileDeleted += new LiveEditEventHandler(FileDeleted); } private static uint ReadFileContent(string file, string content) { HashSet orAddNew = CollectionExtensions.GetOrAddNew>((IDictionary>)_filepathLayoutMap, file); foreach (uint item in orAddNew) { _customLayoutData.Remove(item); } orAddNew.Clear(); LayoutConfigDefinition layoutConfigDefinition = ARAJson.Deserialize(content); if (layoutConfigDefinition != null && layoutConfigDefinition.MainLevelLayout != 0) { orAddNew.Add(layoutConfigDefinition.MainLevelLayout); _customLayoutData[layoutConfigDefinition.MainLevelLayout] = layoutConfigDefinition; } return layoutConfigDefinition?.MainLevelLayout ?? 0; } private void FileCreated(LiveEditEventArgs e) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown LiveEditEventArgs e2 = e; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LiveEdit file created: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e2.FullPath); } ARALogger.Warn(val); LiveEdit.TryReadFileContent(e2.FullPath, (Action)delegate(string content) { ReadFileContent(e2.FullPath, content); }); } private void FileChanged(LiveEditEventArgs e) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown LiveEditEventArgs e2 = e; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LiveEdit file changed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e2.FullPath); } ARALogger.Warn(val); LiveEdit.TryReadFileContent(e2.FullPath, (Action)delegate(string content) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) uint num = ReadFileContent(e2.FullPath, content); if (Current == LayoutConfigDefinition.Empty || Current.MainLevelLayout != num || (int)GameStateManager.CurrentStateName != 10) { return; } Collider val3 = default(Collider); foreach (WE_ObjectCustomData item in _customLayoutData[num].Zones.SelectMany((ZoneCustomData zData) => zData.WorldEventObjects)) { if (_currentARAFilters.TryGetValue(item.WorldEventObjectFilter, out var value) && !item.UseExistingFilterInArea && !item.UseRandomPosition) { LG_WorldEventObject val2 = new LG_WorldEventObject(value); ((Component)val2).transform.position = item.Position; ((Component)val2).transform.rotation = Quaternion.Euler(item.Rotation); ((Component)val2).transform.localScale = item.Scale; if (GameObjectPlusExtensions.TryAndGetComponent(((Component)val2).gameObject, ref val3)) { foreach (WE_ComponentCustomData value2 in item.Components.Values) { switch (value2.ColliderType) { case ColliderType.Box: { BoxCollider val6 = ((Il2CppObjectBase)val3).Cast(); val6.center = value2.Center; val6.size = value2.Size; break; } case ColliderType.Sphere: { SphereCollider val5 = ((Il2CppObjectBase)val3).Cast(); val5.center = value2.Center; val5.radius = value2.Radius; break; } case ColliderType.Capsule: { CapsuleCollider val4 = ((Il2CppObjectBase)val3).Cast(); val4.center = value2.Center; val4.radius = value2.Radius; val4.height = value2.Height; break; } } } } } } }); } private void FileDeleted(LiveEditEventArgs e) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown LiveEditEventArgs e2 = e; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LiveEdit file deleted: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e2.FullPath); } ARALogger.Warn(val); LiveEdit.TryReadFileContent(e2.FullPath, (Action)delegate { foreach (uint item in _filepathLayoutMap[e2.FullPath]) { _customLayoutData.Remove(item); } _filepathLayoutMap.Remove(e2.FullPath); }); } public override void OnBuildStart() { uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData; Current = (_customLayoutData.TryGetValue(levelLayoutData, out LayoutConfigDefinition value) ? value : LayoutConfigDefinition.Empty); _positionToContainerMap.Clear(); _currentARAFilters.Clear(); } public override void OnBeforeBatchBuild(BatchName batch) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((int)batch != 46) { return; } Dictionary> dictionary = new Dictionary>(); foreach (LG_WorldEventObject item in Object.FindObjectsOfType()) { object obj = item.ParentArea; if (obj == null) { AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(((Component)item).transform.position); obj = ((courseNode != null) ? courseNode.m_area : null); } LG_Area val = (LG_Area)obj; if (!((Object)(object)val == (Object)null)) { CollectionExtensions.GetOrAddNew>((IDictionary>)dictionary, ((Object)val).GetInstanceID()).Add(item); } } ARALogger.Debug("Applying layout data"); Enumerator enumerator2 = Builder.CurrentFloor.allZones.GetEnumerator(); while (enumerator2.MoveNext()) { LG_Zone current2 = enumerator2.Current; ApplyLayoutData(current2, dictionary); } } public override void OnEnterLevel() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) foreach (ElevatorCargoCage item in Object.FindObjectsOfType()) { if ((Object)(object)item == (Object)null) { break; } foreach (ItemCuller componentsInChild in ((Component)item).GetComponentsInChildren()) { componentsInChild.MoveToNode(Builder.GetElevatorArea().m_courseNode.m_cullNode, ((Component)item).transform.position); } } } private static void ApplyLayoutData(LG_Zone zone, Dictionary> preAllocWE) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_0265: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Expected O, but got Unknown //IL_04c2: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) if (Current.AllWorldEventTerminals) { AddWorldEventObjectToTerminals(zone); } if (!TryGetCurrentZoneData(zone, out ZoneCustomData zoneData) || (Object)(object)((GlobalBase)(zoneData?)).Zone == (Object)null) { return; } zoneData.AddSpawnPoints(); WE_ObjectCustomData[] worldEventObjects = zoneData.WorldEventObjects; bool flag = default(bool); foreach (WE_ObjectCustomData wE_ObjectCustomData in worldEventObjects) { if (!wE_ObjectCustomData.IsAreaIndexValid(zone, out LG_Area area)) { continue; } if (!wE_ObjectCustomData.UseExistingFilterInArea || !wE_ObjectCustomData.TryGetExistingFilterInArea(preAllocWE, area, out LG_WorldEventObject weObj)) { weObj = ComponentExt.AddChildGameObject((Component)(object)area, wE_ObjectCustomData.WorldEventObjectFilter); if (wE_ObjectCustomData.UseRandomPosition) { wE_ObjectCustomData.Position = area.m_courseNode.GetRandomPositionInside(); } ((Component)weObj).transform.SetPositionAndRotation(wE_ObjectCustomData.Position, Quaternion.Euler(wE_ObjectCustomData.Rotation)); ((Component)weObj).transform.localScale = wE_ObjectCustomData.Scale; weObj.WorldEventComponents = Il2CppReferenceArray.op_Implicit(Array.Empty()); if (!_currentARAFilters.TryAdd(wE_ObjectCustomData.WorldEventObjectFilter, ((Il2CppObjectBase)weObj).Pointer)) { BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(80, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Duplicates of WorldEventObjectFilter \""); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(wE_ObjectCustomData.WorldEventObjectFilter); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\" will be illegible for LiveEdit mid-level"); } ARALogger.Debug(val); } } foreach (var (worldEventComponent2, wE_ComponentCustomData2) in wE_ObjectCustomData.Components) { if (worldEventComponent2 >= WorldEventComponent.WE_CollisionTrigger && worldEventComponent2 <= WorldEventComponent.WE_InteractTrigger) { if (wE_ComponentCustomData2.ColliderType == ColliderType.Box) { BoxCollider val2 = ((Component)weObj).gameObject.AddComponent(); ((Component)val2).gameObject.layer = 14; ((Collider)val2).isTrigger = wE_ComponentCustomData2.IsTrigger; val2.center = wE_ComponentCustomData2.Center; val2.size = wE_ComponentCustomData2.Size; } else if (wE_ComponentCustomData2.ColliderType == ColliderType.Sphere) { SphereCollider val3 = ((Component)weObj).gameObject.AddComponent(); ((Component)val3).gameObject.layer = 14; ((Collider)val3).isTrigger = wE_ComponentCustomData2.IsTrigger; val3.center = wE_ComponentCustomData2.Center; val3.radius = wE_ComponentCustomData2.Radius; } else if (wE_ComponentCustomData2.ColliderType == ColliderType.Capsule) { CapsuleCollider val4 = ((Component)weObj).gameObject.AddComponent(); ((Component)val4).gameObject.layer = 14; ((Collider)val4).isTrigger = wE_ComponentCustomData2.IsTrigger; val4.center = wE_ComponentCustomData2.Center; val4.radius = wE_ComponentCustomData2.Radius; val4.height = wE_ComponentCustomData2.Height; } } switch (worldEventComponent2) { case WorldEventComponent.WE_SpecificTerminal: if (wE_ComponentCustomData2.PrefabOverride == TerminalPrefab.None) { break; } goto case WorldEventComponent.WE_SpecificPickup; case WorldEventComponent.WE_SpecificPickup: _positionToContainerMap[wE_ObjectCustomData.Position] = new SpecificDataContainer(wE_ObjectCustomData.WorldEventObjectFilter, area.m_courseNode, wE_ComponentCustomData2.PrefabOverride, wE_ComponentCustomData2.EventsOnPickup); break; case WorldEventComponent.WE_ChainedPuzzle: GameObjectPlusExtensions.AddOrGetComponent(((Component)weObj).gameObject); break; case WorldEventComponent.WE_NavMarker: { PlaceNavMarkerOnGO val10 = GameObjectPlusExtensions.AddOrGetComponent(((Component)weObj).gameObject); val10.type = wE_ComponentCustomData2.NavMarkerType; val10.m_placeOnStart = wE_ComponentCustomData2.PlaceOnStart; GameObjectPlusExtensions.AddOrGetComponent(((Component)weObj).gameObject); break; } case WorldEventComponent.WE_CollisionTrigger: { LG_CollisionWorldEventTrigger val12 = GameObjectPlusExtensions.AddOrGetComponent(((Component)weObj).gameObject); val12.m_isToggle = wE_ComponentCustomData2.IsToggle; break; } case WorldEventComponent.WE_LookatTrigger: { LG_LookatWorldEventTrigger val11 = GameObjectPlusExtensions.AddOrGetComponent(((Component)weObj).gameObject); val11.m_lookatMaxDistance = wE_ComponentCustomData2.LookatMaxDistance; val11.m_isToggle = wE_ComponentCustomData2.IsToggle; break; } case WorldEventComponent.WE_InteractTrigger: { LG_InteractWorldEventTrigger val5 = GameObjectPlusExtensions.AddOrGetComponent(((Component)weObj).gameObject); LG_InteractWorldEventTrigger val6 = val5; if (((Interact_Base)val6).m_colliderToOwn == null) { Collider val7 = (((Interact_Base)val6).m_colliderToOwn = ((Component)weObj).gameObject.GetComponent()); } val5.m_interactionText = wE_ComponentCustomData2.InteractionText; val5.m_isToggle = wE_ComponentCustomData2.IsToggle; val5.m_insertType = wE_ComponentCustomData2.CarryItemInsertType; val6 = val5; if (val6.m_carryAlign == null) { LG_InteractWorldEventTrigger obj = val6; Transform val8 = new Transform { position = wE_ComponentCustomData2.CarryItemTransform.Position, rotation = Quaternion.Euler(wE_ComponentCustomData2.CarryItemTransform.Rotation), localScale = wE_ComponentCustomData2.CarryItemTransform.Scale }; Transform val9 = val8; obj.m_carryAlign = val8; } val5.m_removeItemOnInsert = wE_ComponentCustomData2.RemoveItemOnInsert; val5.m_itemStateAfterInsert = wE_ComponentCustomData2.ItemStateAfterInsert; break; } } } } } private static void AddWorldEventObjectToTerminals(LG_Zone zone) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected I4, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected I4, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected I4, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected I4, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected I4, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected I4, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < zone.TerminalsSpawnedInZone.Count; i++) { LG_ComputerTerminal val = zone.TerminalsSpawnedInZone[i]; LG_MarkerProducer componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { string text = $"WE_ARA_Term_{(int)zone.DimensionIndex}_{(int)zone.Layer.m_type}_{(int)zone.LocalIndex}_{i}"; LG_WorldEventObject val2 = ComponentExt.AddChildGameObject((Component)(object)componentInParent, text); ((Component)val2).transform.localPosition = Vector3.zero; val2.WorldEventComponents = Il2CppReferenceArray.op_Implicit(Array.Empty()); } } LG_WardenObjective_Reactor val3 = default(LG_WardenObjective_Reactor); if (GameObjectPlusExtensions.TryAndGetComponent(((Component)zone).gameObject, ref val3)) { string text2 = $"WE_ARA_Term_{(int)zone.DimensionIndex}_{(int)zone.Layer.m_type}_{(int)zone.LocalIndex}_Reactor"; Transform terminalAlign = val3.m_terminalAlign; LG_WorldEventObject val4 = ((terminalAlign != null) ? ComponentExt.AddChildGameObject((Component)(object)terminalAlign, text2) : null); if (!((Object)(object)val4 == (Object)null)) { ((Component)val4).transform.localPosition = Vector3.zero; val4.WorldEventComponents = Il2CppReferenceArray.op_Implicit(Array.Empty()); } } } } } namespace ARA.LevelLayout.DefinitionData { public sealed class ElevatorCargoCustomData { [JsonPropertyName("ForceDisableElevatorCargo")] public bool DisableElevatorCargo { get; set; } = false; [JsonPropertyName("OverrideDefaultElevatorCargoItems")] public bool OverrideCargoItems { get; set; } = false; [JsonPropertyName("CustomElevatorCargoItems")] public uint[] CargoItems { get; set; } = Array.Empty(); } public enum TerminalPrefab { None, Default, MiningCover, MiniTerminal, DataCenterCube, ServiceCover, CyberDeck, GardensCover, GardensShelf } public sealed class SpecificDataContainer { private const string DefaultPrefab = "Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Floor.prefab"; private static readonly Dictionary _prefabMap = new Dictionary { [TerminalPrefab.Default] = ("Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Floor.prefab", null), [TerminalPrefab.MiningCover] = ("Assets/AssetPrefabs/Complex/Mining/SubMarkers/Props/submarker_mining_cover_120x120x240/submarker_mining_cover_120x120x240_Terminal_t.prefab", null), [TerminalPrefab.MiniTerminal] = ("Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Mini.prefab", null), [TerminalPrefab.ServiceCover] = ("Assets/AssetPrefabs/Complex/Service/MarkerCompositions/Floodways_terminal_wall_120x120x240/Floodways_terminal_wall_120x120x240_01.prefab", null), [TerminalPrefab.CyberDeck] = ("Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_CyberDeck.prefab", null), [TerminalPrefab.DataCenterCube] = ("Assets/AssetPrefabs/Complex/Tech/Markers/MarkerCompositions/DataCenter_submarker_240x240x400/DataCenter_submarker_240x240x400_V01_terminal.prefab", "Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Mini.prefab"), [TerminalPrefab.GardensCover] = ("Assets/AssetPrefabs/Complex/Service/MarkerCompositions/Gardens_Concrete_Submarker_Station_180x180x240/Gardens_Concrete_Submarker_Station_180x180x240_V02.prefab", "Assets/AssetPrefabs/Complex/Service/MarkerCompositions/Gardens_concrete_terminal_locker_200x300x50/Gardens_concrete_terminal_locker_200x300x50.prefab"), [TerminalPrefab.GardensShelf] = ("Assets/AssetPrefabs/Complex/Service/MarkerCompositions/Gardens_Concrete_Submarker_Station_180x180x240/Gardens_Concrete_Submarker_Station_180x180x240_V03.prefab", "Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Mini.prefab") }; public string WorldEventObjectFilter; public AIG_CourseNode SpawnNode; public TerminalPrefab TerminalPrefabOverride; public List EventsOnPickup; public SpecificDataContainer(string filter, AIG_CourseNode node, TerminalPrefab prefabType, List events) { WorldEventObjectFilter = filter; SpawnNode = node; TerminalPrefabOverride = prefabType; EventsOnPickup = events; } public string GetCustomPrefabs(out string? extraPrefab) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (_prefabMap.TryGetValue(TerminalPrefabOverride, out (string, string) value)) { extraPrefab = value.Item2; return value.Item1; } bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(59, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Invalid PrefabOverride \""); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(TerminalPrefabOverride); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\" for filter "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(WorldEventObjectFilter); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", using default prefab"); } ARALogger.Warn(val); extraPrefab = null; return "Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Floor.prefab"; } } public enum WorldEventComponent { None, WE_ChainedPuzzle, WE_NavMarker, WE_CollisionTrigger, WE_LookatTrigger, WE_InteractTrigger, WE_SpecificTerminal, WE_SpecificPickup } public enum ColliderType { None, Box, Sphere, Capsule } public struct CarryItemTransform { public Vector3 Position; public Vector3 Rotation; public Vector3 Scale; } public sealed class WE_ComponentCustomData { public TerminalPrefab PrefabOverride { get; set; } = TerminalPrefab.None; public List EventsOnPickup { get; set; } = new List(); public eMarkerType NavMarkerType { get; set; } = (eMarkerType)1; public bool PlaceOnStart { get; set; } = true; public ColliderType ColliderType { get; set; } = ColliderType.None; public bool IsTrigger { get; set; } = false; public Vector3 Center { get; set; } = Vector3.zero; public Vector3 Size { get; set; } = Vector3.one; public float Radius { get; set; } = 0f; public float Height { get; set; } = 0f; public bool IsToggle { get; set; } = false; public float LookatMaxDistance { get; set; } = 0f; public uint InteractionText { get; set; } = 0u; public eCarryItemInsertTargetType CarryItemInsertType { get; set; } = (eCarryItemInsertTargetType)0; public CarryItemTransform CarryItemTransform { get; set; } = default(CarryItemTransform); public bool RemoveItemOnInsert { get; set; } = false; public eCarryItemCustomState ItemStateAfterInsert { get; set; } = (eCarryItemCustomState)0; } public sealed class WE_ObjectCustomData { public string WorldEventObjectFilter { get; set; } = string.Empty; public int AreaIndex { get; set; } = 0; public bool UseExistingFilterInArea { get; set; } = false; public bool UseRandomPosition { get; set; } = false; public Vector3 Position { get; set; } = Vector3.zero; public Vector3 Rotation { get; set; } = Vector3.zero; public Vector3 Scale { get; set; } = Vector3.one; public Dictionary Components { get; set; } = new Dictionary(); public bool IsAreaIndexValid(LG_Zone zone, [MaybeNullWhen(false)] out LG_Area area) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (AreaIndex >= 0 && AreaIndex < zone.m_areas.Count) { area = zone.m_areas[AreaIndex]; return true; } if (AreaIndex == -1) { AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(Position, zone.DimensionIndex); area = ((courseNode != null) ? courseNode.m_area : null); return (Object)(object)area != (Object)null; } bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Invalid AreaIndex "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(AreaIndex); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" for filter "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(WorldEventObjectFilter); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!"); } ARALogger.Error(val); area = null; return false; } public bool TryGetExistingFilterInArea(Dictionary> preAllocWE, LG_Area area, [MaybeNullWhen(false)] out LG_WorldEventObject weObj) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) weObj = ((IEnumerable)CollectionExtensions.GetOrAddNew>((IDictionary>)preAllocWE, ((Object)area).GetInstanceID())).FirstOrDefault((Func)((LG_WorldEventObject we) => we.WorldEventObjectKey == WorldEventObjectFilter)); if ((Object)(object)weObj == (Object)null) { return false; } Position = ((Component)weObj).transform.position; if (Rotation != Vector3.zero) { ((Component)weObj).transform.rotation = Quaternion.Euler(Rotation); } if (Scale != Vector3.one) { ((Component)weObj).transform.localScale = Scale; } return true; } } public sealed class ZoneCustomData : GlobalBase { public Vector3[] HibernateSpawnAligns { get; set; } = Array.Empty(); public Vector3[] EnemySpawnPoints { get; set; } = Array.Empty(); public Vector3[] BioscanSpawnPoints { get; set; } = Array.Empty(); public bool ForceGeneratorClusterMarkers { get; set; } = false; public WE_ObjectCustomData[] WorldEventObjects { get; set; } = Array.Empty(); public void AddSpawnPoints() { AddSpawnPoints("HSA", HibernateSpawnAligns, (LG_Area area) => area.m_spawnAligns); AddSpawnPoints("ESP", EnemySpawnPoints, (LG_Area area) => area.m_enemySpawnPoints); AddSpawnPoints("SBP", BioscanSpawnPoints, (LG_Area area) => area.m_bioscanSpawnPoints); } private void AddSpawnPoints(string source, Vector3[] positions, Func> targetList) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0099: Expected O, but got Unknown //IL_00a0: 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) for (int i = 0; i < positions.Length; i++) { Vector3 val = positions[i]; AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(val, ((GlobalBase)this).DimensionIndex); LG_Area val2 = ((courseNode != null) ? courseNode.m_area : null); if (!((Object)(object)val2 == (Object)null)) { string text = "ARA_" + source + "_SpawnPoint"; if (i > 0) { text += $" ({i})"; } GameObject val3 = new GameObject(text); val3.transform.SetPositionAndRotation(val, Quaternion.identity); val3.transform.SetParent(((Component)val2).transform, true); targetList(val2).Add(val3.transform); } } } } }