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;
using System.Text.Json;
using System.Text.Json.Serialization;
using AIGraph;
using ARA.LevelLayout;
using ARA.LevelLayout.DefinitionData;
using ARA.Utils;
using AmorLib.Dependencies;
using AmorLib.Utils;
using AmorLib.Utils.Extensions;
using AmorLib.Utils.JsonElementConverters;
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 Localization;
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+c1f6925369d88936f1a06f8ba12b3ec5a2c2cad5")]
[assembly: AssemblyProduct("AdditionalRundownAdvancements")]
[assembly: AssemblyTitle("AdditionalRundownAdvancements")]
[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 ARA
{
internal static class ARAJson
{
private static readonly JsonSerializerOptions _setting = JsonSerializerUtil.CreateDefaultSettings(true, PartialData_Wrapper.IsLoaded, InjectLib_Wrapper.IsLoaded);
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);
}
}
internal static class ARALogger
{
internal static readonly ManualLogSource MLS = Logger.CreateLogSource("ARA");
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 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<CustomConfigBase> CustomConfigs = new List<CustomConfigBase>();
public static void Setup(IEnumerable<CustomConfigBase> 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.6.2")]
[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.Message("ARA is done loading!");
}
private void OnStartupAssetsLoaded()
{
IEnumerable<CustomConfigBase> 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.Utils
{
public static class Il2CppListExtension
{
public static List<TResult> ToIl2Cpp<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
{
List<TResult> val = new List<TResult>();
foreach (TSource item in source)
{
val.Add(selector(item));
}
return val;
}
}
public static class TSL_Wrapper
{
public static LocalizedText ParseToLocalizedText(this LocaleText text)
{
//IL_0001: 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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
return new LocalizedText
{
UntranslatedText = text.ParseTextFragments(),
Id = 0u
};
}
public unsafe static string ParseTextFragments(this LocaleText input)
{
return ((object)(*(LocaleText*)(&input))/*cast due to .constrained prefix*/).ToString().ParseTextFragments();
}
public static string ParseTextFragments(this string input)
{
return (InteropAPI.Call("TSL.ParseTextFragments", new object[1] { input }) as string) ?? input;
}
}
}
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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected I4, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Expected O, but got Unknown
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
if (__state == null || __state.CargoItems.Length == 0)
{
return;
}
bool flag = default(bool);
if (__state.DisableElevatorCargo)
{
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(91, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("CustomElevatorCargoItems has ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(__state.CargoItems.Length);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" items, but DisableElevatorCargo is true. Is this intentional?");
}
ARALogger.Warn(val);
}
if (__instance.m_itemsToMoveToCargo == null)
{
List<Transform> val2 = (__instance.m_itemsToMoveToCargo = new List<Transform>());
}
uint[] cargoItems = __state.CargoItems;
foreach (uint num in cargoItems)
{
ItemDataBlock block = GameDataBlockBase<ItemDataBlock>.GetBlock(num);
if (block == null || !((GameDataBlockBase<ItemDataBlock>)(object)block).internalEnabled)
{
BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Failed to find enabled ItemDataBlock ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<uint>(num);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("!");
}
ARALogger.Error(val4);
continue;
}
LG_PickupItem val5 = LG_PickupItem.SpawnGenericPickupItem(ElevatorShaftLanding.CargoAlign);
val5.SpawnNode = Builder.GetElevatorArea().m_courseNode;
int num2 = Random.Range(0, int.MaxValue);
InventorySlot inventorySlot = block.inventorySlot;
InventorySlot val6 = inventorySlot;
switch (val6 - 5)
{
case 0:
val5.SetupAsConsumable(num2, num);
break;
case 1:
case 3:
val5.SetupAsBigPickupItem(num2, num, false, 0);
break;
case 2:
case 4:
val5.SetupAsSmallGenericPickup(num2, num, false);
break;
default:
{
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(61, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unknown item type ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<InventorySlot>(block.inventorySlot);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" for ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((GameDataBlockBase<ItemDataBlock>)(object)block).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(num);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), attempting spawning as big pickup");
}
ARALogger.Warn(val);
val5.SetupAsBigPickupItem(num2, num, false, 0);
break;
}
}
__instance.m_itemsToMoveToCargo.Add(((Component)val5).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<LG_Area> list = new List<LG_Area>();
Enumerator<LG_Area> 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<string>(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<d_ForceSpawnMarker>(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)
if (__runOriginal || __state == null)
{
return;
}
ItemDataBlock block = GameDataBlockBase<ItemDataBlock>.GetBlock(itemID);
bool flag = default(bool);
if (block == null || !((GameDataBlockBase<ItemDataBlock>)(object)block).internalEnabled)
{
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to find enabled ItemDataBlock ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(itemID);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!");
}
ARALogger.Error(val);
return;
}
LG_PickupItem val2 = LG_PickupItem.SpawnGenericPickupItem(itemAlign);
val2.SpawnNode = __state.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<InventorySlot>(block.inventorySlot);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" for ItemDataBlock ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(itemID);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!");
}
ARALogger.Error(val);
return;
}
}
spawnedItem = ((Component)val2).GetComponentInChildren<ItemInLevel>();
Queue<WardenObjectiveEventData> eData = new Queue<WardenObjectiveEventData>(__state.EventsOnPickup);
ItemInLevel obj = spawnedItem;
if (obj != null)
{
obj.GetSyncComponent().OnSyncStateChange += Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>.op_Implicit((Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>)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<string>(__state.WorldEventObjectFilter);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("; restore EventsOnPickup");
}
ARALogger.Warn(val4);
eData = new Queue<WardenObjectiveEventData>(__state.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<TDelegate>(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<string>(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<Type>)genericArguments).Select((Func<Type, Type>)Il2CppType.From).ToArray());
INativeMethodInfoStruct val4 = UnityVersionHandler.Wrap((Il2CppMethodInfo*)(void*)IL2CPP.il2cpp_method_get_from_reflection(((Il2CppObjectBase)val3).Pointer));
return INativeDetour.CreateAndApply<TDelegate>(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<GameObject>(customPrefabs);
val3 = GameObjectPlusExtensions.ClonePrefabSpawners(loadedAsset, val, val2, val4);
if ((Object)(object)val3.GetComponentInChildren<LG_ComputerTerminal>() == (Object)null && !Utility.IsNullOrWhiteSpace(extraPrefab))
{
bool flag = false;
foreach (LG_MarkerProducer componentsInChild in val3.GetComponentsInChildren<LG_MarkerProducer>(false))
{
if (!flag && HasTerminalMarker(componentsInChild.MarkerDataBlockType, componentsInChild.MarkerDataBlockID))
{
GameObject loadedAsset2 = AssetAPI.GetLoadedAsset<GameObject>(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<Exception>(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<iLG_SpawnedInNodeHandler>();
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<MiningMarkerDataBlock>.GetBlock(id);
return block3 != null && ((GameDataBlockBase<MiningMarkerDataBlock>)(object)block3).internalEnabled && ListExtensions.ToManaged<MarkerComposition>(block3.GetCompositions()).Any((MarkerComposition comp) => (int)comp.function == 7);
}
case 1:
{
ServiceMarkerDataBlock block2 = GameDataBlockBase<ServiceMarkerDataBlock>.GetBlock(id);
return block2 != null && ((GameDataBlockBase<ServiceMarkerDataBlock>)(object)block2).internalEnabled && ListExtensions.ToManaged<MarkerComposition>(block2.GetCompositions()).Any((MarkerComposition comp) => (int)comp.function == 7);
}
case 2:
{
TechMarkerDataBlock block = GameDataBlockBase<TechMarkerDataBlock>.GetBlock(id);
return block != null && ((GameDataBlockBase<TechMarkerDataBlock>)(object)block).internalEnabled && ListExtensions.ToManaged<MarkerComposition>(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();
public string AutoWorldEventObjectPrefix { get; set; } = "WE_ARA_{0}_";
[JsonPropertyName("SetupWorldEventObjectOnAllTerminals")]
public bool AllWorldEventTerminals { get; set; } = false;
public ZoneCustomData[] Zones { get; set; } = Array.Empty<ZoneCustomData>();
}
public sealed class LayoutConfigManager : CustomConfigBase
{
private static readonly Dictionary<string, HashSet<uint>> _filepathLayoutMap = new Dictionary<string, HashSet<uint>>();
private static readonly Dictionary<uint, LayoutConfigDefinition> _customLayoutData = new Dictionary<uint, LayoutConfigDefinition>();
private static readonly Dictionary<Vector3, SpecificDataContainer> _positionToContainerMap = new Dictionary<Vector3, SpecificDataContainer>();
private static readonly Dictionary<string, List<GameObject>> _currentARAFilters = new Dictionary<string, List<GameObject>>();
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)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
List<ZoneCustomData> 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(zone);
result = ((intTuple.Item1 == tuple.Item1 && intTuple.Item2 == tuple.Item2 && intTuple.Item3 == tuple.Item3) ? 1 : 0);
}
else
{
result = 0;
}
return (byte)result != 0;
}).ToList();
ZoneCustomData zoneCustomData;
switch (list.Count)
{
case 0:
zoneCustomData = null;
break;
case 1:
zoneCustomData = list[0];
break;
default:
{
ZoneCustomData obj = new ZoneCustomData
{
Dimension = zone.Dimension,
Zone = zone
};
((GlobalBase)obj).DimensionIndex = zone.DimensionIndex;
((GlobalBase)obj).Layer = zone.Layer.m_type;
((GlobalBase)obj).LocalIndex = zone.LocalIndex;
obj.HibernateSpawnAligns = list.SelectMany((ZoneCustomData zData) => zData.HibernateSpawnAligns).ToArray();
obj.EnemySpawnPoints = list.SelectMany((ZoneCustomData zData) => zData.EnemySpawnPoints).ToArray();
obj.BioscanSpawnPoints = list.SelectMany((ZoneCustomData zData) => zData.BioscanSpawnPoints).ToArray();
obj.InvisibleWalls = list.SelectMany((ZoneCustomData zData) => zData.InvisibleWalls).ToArray();
obj.ForceGeneratorClusterMarkers = list.Any((ZoneCustomData zData) => zData.ForceGeneratorClusterMarkers);
obj.AllWorldEventLights = list.Any((ZoneCustomData zData) => zData.AllWorldEventLights);
obj.WorldEventObjects = list.SelectMany((ZoneCustomData zData) => zData.WorldEventObjects).ToArray();
obj.StaticEventsOnTrigger = list.SelectMany((ZoneCustomData zData) => zData.StaticEventsOnTrigger).ToList();
obj.StaticWorldEventChainedPuzzleDatas = list.SelectMany((ZoneCustomData zData) => zData.StaticWorldEventChainedPuzzleDatas).ToList();
obj.StaticSpecificPickupSpawnDatas = list.SelectMany((ZoneCustomData zData) => zData.StaticSpecificPickupSpawnDatas).ToList();
obj.StaticSpecificTerminalSpawnDatas = list.SelectMany((ZoneCustomData zData) => zData.StaticSpecificTerminalSpawnDatas).ToList();
zoneCustomData = obj;
break;
}
}
zoneData = zoneCustomData;
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<Vector3, SpecificDataContainer> item in _positionToContainerMap)
{
if (Vector3Ext.Approximately(item.Key, position))
{
container = item.Value;
return true;
}
}
container = null;
return false;
}
internal static void AddARAFilter(string filter, GameObject go)
{
CollectionExtensions.GetOrAddNew<string, List<GameObject>>((IDictionary<string, List<GameObject>>)_currentARAFilters, filter).Add(go);
}
public override void Setup()
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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)));
bool flag = default(bool);
foreach (string item in Directory.EnumerateFiles(ModulePath, "*.json", SearchOption.AllDirectories))
{
try
{
string content = File.ReadAllText(item);
ReadFileContent(item, content);
}
catch (Exception ex)
{
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(21, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error reading file ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(":\n");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
ARALogger.Error(val);
}
}
SafeFileSystemWatcher val2 = SafeFileSystemWatcher.Create(ModulePath, new string[1] { "*.json" }, true);
val2.OnCreated += FileCreated;
val2.OnChanged += FileChanged;
val2.OnDeleted += FileDeleted;
val2.OnRenamed += FileRenamed;
}
private static uint ReadFileContent(string file, string content)
{
HashSet<uint> orAddNew = CollectionExtensions.GetOrAddNew<string, HashSet<uint>>((IDictionary<string, HashSet<uint>>)_filepathLayoutMap, file);
foreach (uint item in orAddNew)
{
_customLayoutData.Remove(item);
}
orAddNew.Clear();
LayoutConfigDefinition layoutConfigDefinition = ARAJson.Deserialize<LayoutConfigDefinition>(content);
if (layoutConfigDefinition != null && layoutConfigDefinition.MainLevelLayout != 0)
{
orAddNew.Add(layoutConfigDefinition.MainLevelLayout);
_customLayoutData[layoutConfigDefinition.MainLevelLayout] = layoutConfigDefinition;
}
return layoutConfigDefinition?.MainLevelLayout ?? 0;
}
private void FileCreated(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 created: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.FullPath);
}
ARALogger.Warn(val);
ReadFileContent(e.FullPath, e.ReadContent((Encoding)null));
}
private void FileChanged(FileEventArgs e)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Invalid comparison between Unknown and I4
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LiveEdit file changed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.FullPath);
}
ARALogger.Warn(val);
uint num = ReadFileContent(e.FullPath, e.ReadContent((Encoding)null));
if (Current == LayoutConfigDefinition.Empty || Current.MainLevelLayout != num || (int)GameStateManager.CurrentStateName != 10)
{
return;
}
BoxCollider val3 = default(BoxCollider);
SphereCollider val4 = default(SphereCollider);
CapsuleCollider val2 = default(CapsuleCollider);
foreach (WE_ObjectCustomData item in _customLayoutData[num].Zones.SelectMany((ZoneCustomData zData) => zData.WorldEventObjects))
{
if (!TryGetAndRepositionObject(item.WorldEventObjectFilter, item.Transform, out GameObject go, item.InstanceIndex, !item.UseExistingFilterInArea && !item.UseRandomPosition, (GameObject val5) => GameObjectPlusExtensions.HasComponent<LG_WorldEventObject>(val5)))
{
continue;
}
foreach (WE_ComponentCustomData value in item.Components.Values)
{
switch (value.ColliderType)
{
case ColliderType.Box:
if (GameObjectPlusExtensions.TryAndGetComponent<BoxCollider>(go, ref val3))
{
val3.center = value.Center;
val3.size = value.Size;
}
break;
case ColliderType.Sphere:
if (GameObjectPlusExtensions.TryAndGetComponent<SphereCollider>(go, ref val4))
{
val4.center = value.Center;
val4.radius = value.Radius;
}
break;
case ColliderType.Capsule:
if (GameObjectPlusExtensions.TryAndGetComponent<CapsuleCollider>(go, ref val2))
{
val2.center = value.Center;
val2.radius = value.Radius;
val2.height = value.Height;
}
break;
}
}
}
Enumerator<LG_Zone> enumerator3 = Builder.CurrentFloor.allZones.GetEnumerator();
while (enumerator3.MoveNext())
{
LG_Zone current3 = enumerator3.Current;
if (!TryGetCurrentZoneData(current3, out ZoneCustomData zoneData))
{
continue;
}
for (int num2 = 0; num2 < zoneData.InvisibleWalls.Length; num2++)
{
CustomTransform customTransform = zoneData.InvisibleWalls[num2];
if (customTransform != null)
{
TryGetAndRepositionObject(zoneData.GetSourceFilter("InvisWall", num2), customTransform, out GameObject _);
}
}
}
}
private static bool TryGetAndRepositionObject(string filter, CustomTransform transform, [MaybeNullWhen(false)] out GameObject go, int instanceIndex = 0, bool preCondition = true, Func<GameObject, bool>? postConditon = null)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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)
go = null;
if (!preCondition || !_currentARAFilters.TryGetValue(filter, out List<GameObject> value) || value.Count == 0)
{
return false;
}
int index = ((instanceIndex >= 0 && instanceIndex < value.Count) ? instanceIndex : 0);
GameObject val = value[index];
if ((Object)(object)val == (Object)null || (postConditon != null && !postConditon(val)))
{
return false;
}
GameObjectPlusExtensions.SetPositionRotationScale(val.transform, transform.Position, transform.Rotation, transform.Scale);
go = val;
return true;
}
private 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);
}
ARALogger.Warn(val);
foreach (uint item in _filepathLayoutMap[e.FullPath])
{
_customLayoutData.Remove(item);
}
_filepathLayoutMap.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);
}
ARALogger.Warn(val);
if (_filepathLayoutMap.ContainsKey(key))
{
_filepathLayoutMap[fullPath] = _filepathLayoutMap[key];
_filepathLayoutMap.Remove(key);
}
}
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_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
if ((int)batch != 40)
{
if ((int)batch == 46)
{
ARALogger.Debug("Adding world event objects");
WE_ObjectCustomData.AllocatePreexistingWorldEventObjects();
Enumerator<LG_Zone> enumerator = Builder.CurrentFloor.allZones.GetEnumerator();
while (enumerator.MoveNext())
{
LG_Zone current = enumerator.Current;
AddWorldEventObjectsToTerminals(current);
ApplyLayoutZoneData(current);
}
SetupAnimationTriggers();
}
return;
}
ARALogger.Debug("Adding spawnpoints and invisible walls");
Enumerator<LG_Zone> enumerator2 = Builder.CurrentFloor.allZones.GetEnumerator();
while (enumerator2.MoveNext())
{
LG_Zone current2 = enumerator2.Current;
if (TryGetCurrentZoneData(current2, out ZoneCustomData zoneData))
{
zoneData.AddSpawnPointsAndInvisibleWalls();
}
}
}
public override void OnEnterLevel()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
LG_Area elevatorArea = Builder.GetElevatorArea();
foreach (ElevatorCargoCage item in Object.FindObjectsOfType<ElevatorCargoCage>())
{
if ((Object)(object)item == (Object)null)
{
break;
}
foreach (ItemCuller componentsInChild in ((Component)item).GetComponentsInChildren<ItemCuller>())
{
componentsInChild.MoveToNode(elevatorArea.m_courseNode.m_cullNode, ((Component)item).transform.position);
}
}
}
private static void ApplyLayoutZoneData(LG_Zone zone)
{
//IL_007b: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: 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)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: 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_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: 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_03bc: Expected O, but got Unknown
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
if (!TryGetCurrentZoneData(zone, out ZoneCustomData zoneData) || (Object)(object)((GlobalBase)(zoneData?)).Zone == (Object)null)
{
return;
}
AddWorldEventObjectsToLights(zoneData);
zoneData.InjectStaticDimensionWorldEventData();
WE_ObjectCustomData[] worldEventObjects = zoneData.WorldEventObjects;
foreach (WE_ObjectCustomData wE_ObjectCustomData in worldEventObjects)
{
if (wE_ObjectCustomData.ShouldCreateNewWorldEventObject(zone, out LG_WorldEventObject weObj))
{
weObj = ComponentExt.AddChildGameObject<LG_WorldEventObject>((Component)(object)wE_ObjectCustomData.Area, wE_ObjectCustomData.WorldEventObjectFilter);
GameObjectPlusExtensions.SetPositionRotationScale(((Component)weObj).transform, wE_ObjectCustomData.Position, wE_ObjectCustomData.Rotation, wE_ObjectCustomData.Scale);
weObj.WorldEventComponents = Il2CppReferenceArray<IWorldEventComponent>.op_Implicit(Array.Empty<IWorldEventComponent>());
AddARAFilter(wE_ObjectCustomData.WorldEventObjectFilter, ((Component)weObj).gameObject);
}
if ((Object)(object)weObj == (Object)null)
{
continue;
}
foreach (var (worldEventComponent2, wE_ComponentCustomData2) in wE_ObjectCustomData.Components)
{
if (worldEventComponent2 >= WorldEventComponent.WE_CollisionTrigger && worldEventComponent2 <= WorldEventComponent.WE_InteractTrigger)
{
switch (wE_ComponentCustomData2.ColliderType)
{
case ColliderType.Box:
{
BoxCollider val3 = ((Component)weObj).gameObject.AddComponent<BoxCollider>();
((Component)val3).gameObject.layer = 14;
val3.center = wE_ComponentCustomData2.Center;
val3.size = wE_ComponentCustomData2.Size;
break;
}
case ColliderType.Sphere:
{
SphereCollider val2 = ((Component)weObj).gameObject.AddComponent<SphereCollider>();
((Component)val2).gameObject.layer = 14;
val2.center = wE_ComponentCustomData2.Center;
val2.radius = wE_ComponentCustomData2.Radius;
break;
}
case ColliderType.Capsule:
{
CapsuleCollider val = ((Component)weObj).gameObject.AddComponent<CapsuleCollider>();
((Component)val).gameObject.layer = 14;
val.center = wE_ComponentCustomData2.Center;
val.radius = wE_ComponentCustomData2.Radius;
val.height = wE_ComponentCustomData2.Height;
break;
}
}
}
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, wE_ObjectCustomData.Area.m_courseNode, wE_ComponentCustomData2.PrefabOverride, wE_ComponentCustomData2.EventsOnPickup);
break;
case WorldEventComponent.WE_ChainedPuzzle:
GameObjectPlusExtensions.AddOrGetComponent<LG_WorldEventChainPuzzle>(((Component)weObj).gameObject);
break;
case WorldEventComponent.WE_NavMarker:
{
PlaceNavMarkerOnGO val10 = GameObjectPlusExtensions.AddOrGetComponent<PlaceNavMarkerOnGO>(((Component)weObj).gameObject);
val10.type = wE_ComponentCustomData2.NavMarkerType;
val10.m_placeOnStart = wE_ComponentCustomData2.PlaceOnStart;
GameObjectPlusExtensions.AddOrGetComponent<LG_WorldEventNavMarker>(((Component)weObj).gameObject);
break;
}
case WorldEventComponent.WE_CollisionTrigger:
{
LG_CollisionWorldEventTrigger val8 = GameObjectPlusExtensions.AddOrGetComponent<LG_CollisionWorldEventTrigger>(((Component)weObj).gameObject);
val8.m_isToggle = wE_ComponentCustomData2.IsToggle;
break;
}
case WorldEventComponent.WE_LookatTrigger:
{
LG_LookatWorldEventTrigger val9 = GameObjectPlusExtensions.AddOrGetComponent<LG_LookatWorldEventTrigger>(((Component)weObj).gameObject);
val9.m_lookatMaxDistance = wE_ComponentCustomData2.LookatMaxDistance;
val9.m_isToggle = wE_ComponentCustomData2.IsToggle;
break;
}
case WorldEventComponent.WE_InteractTrigger:
{
LG_InteractWorldEventTrigger val4 = GameObjectPlusExtensions.AddOrGetComponent<LG_InteractWorldEventTrigger>(((Component)weObj).gameObject);
LG_InteractWorldEventTrigger val5 = val4;
if (((Interact_Base)val5).m_colliderToOwn == null)
{
Collider val6 = (((Interact_Base)val5).m_colliderToOwn = ((Component)weObj).gameObject.GetComponent<Collider>());
}
val4.m_interactionText = wE_ComponentCustomData2.InteractionText;
val4.m_isToggle = wE_ComponentCustomData2.IsToggle;
val4.m_insertType = wE_ComponentCustomData2.CarryItemInsertType;
if ((Object)(object)val4.m_carryAlign == (Object)null)
{
CustomTransform customTransform = wE_ComponentCustomData2.CarryItemTransform ?? new CustomTransform();
GameObject val7 = new GameObject("CarryAlign");
GameObjectPlusExtensions.SetPositionRotationScale(val7.transform, customTransform.Position, customTransform.Rotation, customTransform.Scale);
val7.transform.SetParent(((Component)weObj).transform, true);
val4.m_carryAlign = val7.transform;
}
val4.m_removeItemOnInsert = wE_ComponentCustomData2.RemoveItemOnInsert;
val4.m_itemStateAfterInsert = wE_ComponentCustomData2.ItemStateAfterInsert;
break;
}
}
}
}
}
private static void AddWorldEventObjectsToTerminals(LG_Zone zone)
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected I4, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected I4, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected I4, but got Unknown
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Expected I4, but got Unknown
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Expected I4, but got Unknown
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Expected I4, but got Unknown
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
if (!Current.AllWorldEventTerminals)
{
return;
}
string value = string.Format(Current.AutoWorldEventObjectPrefix, "Term");
for (int i = 0; i < zone.TerminalsSpawnedInZone.Count; i++)
{
LG_ComputerTerminal val = zone.TerminalsSpawnedInZone[i];
LG_MarkerProducer componentInParent = ((Component)val).GetComponentInParent<LG_MarkerProducer>();
if (!((Object)(object)componentInParent == (Object)null))
{
string text = $"{value}{(int)zone.DimensionIndex}_{(int)zone.Layer.m_type}_{(int)zone.LocalIndex}_{i}";
LG_WorldEventObject val2 = ComponentExt.AddChildGameObject<LG_WorldEventObject>((Component)(object)componentInParent, text);
((Component)val2).transform.localPosition = Vector3.zero;
val2.WorldEventComponents = Il2CppReferenceArray<IWorldEventComponent>.op_Implicit(Array.Empty<IWorldEventComponent>());
}
}
Enumerator<LG_Area> enumerator = zone.m_areas.GetEnumerator();
LG_WardenObjective_Reactor val3 = default(LG_WardenObjective_Reactor);
while (enumerator.MoveNext())
{
LG_Area current = enumerator.Current;
if (GameObjectPlusExtensions.TryAndGetComponent<LG_WardenObjective_Reactor>(((Component)current.m_geomorph).gameObject, ref val3))
{
string text2 = $"{value}{(int)zone.DimensionIndex}_{(int)zone.Layer.m_type}_{(int)zone.LocalIndex}_Reactor";
Transform terminalAlign = val3.m_terminalAlign;
LG_WorldEventObject val4 = ((terminalAlign != null) ? ComponentExt.AddChildGameObject<LG_WorldEventObject>((Component)(object)terminalAlign, text2) : null);
if (!((Object)(object)val4 == (Object)null))
{
((Component)val4).transform.localPosition = Vector3.zero;
val4.WorldEventComponents = Il2CppReferenceArray<IWorldEventComponent>.op_Implicit(Array.Empty<IWorldEventComponent>());
break;
}
}
}
}
private static void AddWorldEventObjectsToLights(ZoneCustomData zoneData)
{
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected I4, but got Unknown
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected I4, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected I4, but got Unknown
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
LG_Zone zone = ((GlobalBase)zoneData).Zone;
if ((Object)(object)zone == (Object)null || !zoneData.AllWorldEventLights)
{
return;
}
string value = string.Format(Current.AutoWorldEventObjectPrefix, "Light");
int num = 0;
for (int i = 0; i < zone.m_areas.Count; i++)
{
foreach (LG_Light componentsInChild in ((Component)zone.m_areas[i]).GetComponentsInChildren<LG_Light>(false))
{
string text = $"{value}{(int)zone.DimensionIndex}_{(int)zone.Layer.m_type}_{(int)zone.LocalIndex}_{num++}";
LG_WorldEventObject val = ComponentExt.AddChildGameObject<LG_WorldEventObject>((Component)(object)componentsInChild, text);
((Component)val).transform.localPosition = Vector3.zero;
val.WorldEventComponents = Il2CppReferenceArray<IWorldEventComponent>.op_Implicit(Array.Empty<IWorldEventComponent>());
}
}
}
private static void SetupAnimationTriggers()
{
//IL_00cd: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
foreach (WE_ObjectCustomData item in Current.Zones.SelectMany((ZoneCustomData zData) => zData.WorldEventObjects))
{
if (!_currentARAFilters.TryGetValue(item.WorldEventObjectFilter, out List<GameObject> value) || !item.Components.TryGetValue(WorldEventComponent.WE_AnimationTrigger, out WE_ComponentCustomData weComp))
{
continue;
}
List<GameObject> list = new List<GameObject>();
GameObject val = value.First();
GameObject val2 = val;
if (!Utility.IsNullOrWhiteSpace(weComp.WorldEventAnimationFilter))
{
LG_WorldEventObject val3 = ComponentExt.AddChildGameObject<LG_WorldEventObject>((Component)(object)item.Area, weComp.WorldEventAnimationFilter);
((Component)val3).transform.position = new Vector3(item.Position.x, item.Position.y + 1f, item.Position.z);
val3.WorldEventComponents = Il2CppReferenceArray<IWorldEventComponent>.op_Implicit(Array.Empty<IWorldEventComponent>());
val2 = ((Component)val3).gameObject;
list.Add(val);
}
foreach (string item2 in weComp.ARAObjectsToActivate)
{
if (_currentARAFilters.TryGetValue(item2, out List<GameObject> value2))
{
list.AddRange(value2);
}
}
if (list.Count != 0)
{
LG_WorldEventAnimationTrigger val4 = GameObjectPlusExtensions.AddOrGetComponent<LG_WorldEventAnimationTrigger>(val2);
val4.m_playResetOnSetup = weComp.PlayResetOnStartup;
val4.m_gameObjectsToActivateOnTrigger = Il2CppReferenceArray<GameObjectActivationPair>.op_Implicit(((IEnumerable<GameObject>)list).Select((Func<GameObject, GameObjectActivationPair>)((GameObject go) => new GameObjectActivationPair
{
GameObjectToSet = go,
ActivationMode = weComp.ActivationMode
})).ToArray());
val4.m_gameObjectsToActivateOnReset = Il2CppReferenceArray<GameObjectActivationPair>.op_Implicit(((IEnumerable<GameObject>)list).Select((Func<GameObject, GameObjectActivationPair>)((GameObject go) => new GameObjectActivationPair
{
GameObjectToSet = go,
ActivationMode = !weComp.ActivationMode
})).ToArray());
}
}
}
}
}
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<uint>();
}
public enum TerminalPrefab
{
None,
Default,
MiningCover,
MiniTerminal,
DataCenterCube,
ServiceCover,
CyberDeck,
GardensCover,
GardensShelf
}
public sealed class SpecificDataContainer
{
private readonly record struct PrefabSet(string Prefab, string? Extra = null);
private const string DefaultPrefab = "Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Floor.prefab";
private const string MiniPrefab = "Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Mini.prefab";
private static readonly Dictionary<TerminalPrefab, PrefabSet> _prefabMap = new Dictionary<TerminalPrefab, PrefabSet>
{
[TerminalPrefab.Default] = new PrefabSet("Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Floor.prefab"),
[TerminalPrefab.MiningCover] = new PrefabSet("Assets/AssetPrefabs/Complex/Mining/SubMarkers/Props/submarker_mining_cover_120x120x240/submarker_mining_cover_120x120x240_Terminal_t.prefab"),
[TerminalPrefab.MiniTerminal] = new PrefabSet("Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Mini.prefab"),
[TerminalPrefab.ServiceCover] = new PrefabSet("Assets/AssetPrefabs/Complex/Service/MarkerCompositions/Floodways_terminal_wall_120x120x240/Floodways_terminal_wall_120x120x240_01.prefab"),
[TerminalPrefab.CyberDeck] = new PrefabSet("Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_CyberDeck.prefab"),
[TerminalPrefab.DataCenterCube] = new PrefabSet("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] = new PrefabSet("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] = new PrefabSet("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<WardenObjectiveEventData> EventsOnPickup;
public SpecificDataContainer(string filter, AIG_CourseNode node, TerminalPrefab prefabType, List<WardenObjectiveEventData> events)
{
WorldEventObjectFilter = filter;
SpawnNode = node;
TerminalPrefabOverride = prefabType;
EventsOnPickup = events;
}
public string GetCustomPrefabs(out string? extraPrefab)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
if (_prefabMap.TryGetValue(TerminalPrefabOverride, out var value))
{
extraPrefab = value.Extra;
return value.Prefab;
}
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(59, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Invalid PrefabOverride \"");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<TerminalPrefab>(TerminalPrefabOverride);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\" for filter ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(WorldEventObjectFilter);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", using default prefab");
}
ARALogger.Warn(val);
extraPrefab = null;
return "Assets/AssetPrefabs/Complex/Generic/FunctionMarkers/Terminal_Floor.prefab";
}
}
public sealed class StaticDimensionWECPData
{
public uint ChainedPuzzle { get; set; } = 0u;
public string WorldEventObjectFilter { get; set; } = string.Empty;
public List<WardenObjectiveEventData> EventsOnScanDone { get; set; } = new List<WardenObjectiveEventData>();
public SpecificChainPuzzleSpawnData ToWECP()
{
//IL_0001: 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_0013: 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_0033: Expected O, but got Unknown
return new SpecificChainPuzzleSpawnData
{
ChainedPuzzle = ChainedPuzzle,
WorldEventObjectFilter = WorldEventObjectFilter,
EventsOnScanDone = ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(EventsOnScanDone)
};
}
}
public sealed class StaticDimensionWESTData
{
public string WorldEventObjectFilter { get; set; } = string.Empty;
public bool IsWardenObjective { get; set; } = false;
public int WardenObjectiveChainIndex { get; set; } = -1;
public List<TerminalLogFileData> LocalLogFiles { get; set; } = new List<TerminalLogFileData>();
public List<LocaleCommandData> UniqueCommands { get; set; } = new List<LocaleCommandData>();
public LocaleStartingStateData StartingStateData { get; set; } = new LocaleStartingStateData();
public SpecificTerminalSpawnData ToWEST()
{
//IL_0001: 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_0013: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_0083: Expected O, but got Unknown
return new SpecificTerminalSpawnData
{
WorldEventObjectFilter = WorldEventObjectFilter,
IsWardenObjective = IsWardenObjective,
WardenObjectiveChainIndex = WardenObjectiveChainIndex,
LocalLogFiles = ListExtensions.ToIl2Cpp<TerminalLogFileData>(LocalLogFiles),
UniqueCommands = UniqueCommands.ToIl2Cpp((LocaleCommandData s) => s.ToTerminalCommand()),
StartingStateData = StartingStateData.ToStartingState()
};
}
}
public sealed class LocaleCommandData
{
public string Command { get; set; } = string.Empty;
public LocaleText CommandDesc { get; set; } = default(LocaleText);
public List<LocaleTerminalOutput> PostCommandOutputs { get; set; } = new List<LocaleTerminalOutput>();
public List<WardenObjectiveEventData> CommandEvents { get; set; } = new List<WardenObjectiveEventData>();
public TERM_CommandRule SpecialCommandRule { get; set; } = (TERM_CommandRule)0;
public CustomTerminalCommand ToTerminalCommand()
{
//IL_0001: 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_0013: 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)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
return new CustomTerminalCommand
{
Command = Command,
CommandDesc = CommandDesc.ParseToLocalizedText(),
PostCommandOutputs = PostCommandOutputs.ToIl2Cpp((LocaleTerminalOutput x) => x.ToTerminalOutput()),
CommandEvents = ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(CommandEvents),
SpecialCommandRule = SpecialCommandRule
};
}
}
public sealed class LocaleTerminalOutput
{
public TerminalLineType LineType { get; set; }
public LocaleText Output { get; set; }
public float Time { get; set; }
public TerminalOutput ToTerminalOutput()
{
//IL_0001: 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_0008: 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_0015: 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_0033: Expected O, but got Unknown
return new TerminalOutput
{
LineType = LineType,
Output = Output.ParseToLocalizedText(),
Time = Time
};
}
}
public sealed class LocaleStartingStateData
{
public TERM_State StartingState { get; set; } = (TERM_State)0;
public bool UseCustomInfoText { get; set; } = false;
public LocaleText CustomInfoText { get; set; } = default(LocaleText);
public bool KeepShowingLocalLogCount { get; set; } = false;
public uint AudioEventEnter { get; set; } = 0u;
public uint AudioEventExit { get; set; } = 0u;
public bool PasswordProtected { get; set; } = false;
public string Password { get; set; } = string.Empty;
public string PasswordHintText { get; set; } = string.Empty;
public bool GeneratePassword { get; set; } = false;
public int PasswordPartCount { get; set; } = 0;
public bool ShowPasswordLength { get; set; } = false;
public bool ShowPasswordPartPositions { get; set; } = false;
public List<List<PasswordSelectionData>> TerminalZoneSelectionDatas { get; set; } = new List<List<PasswordSelectionData>>();
public TerminalStartStateData ToStartingState()
{
//IL_0001: 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_0008: 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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_0080: 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_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
return new TerminalStartStateData
{
StartingState = StartingState,
UseCustomInfoText = UseCustomInfoText,
CustomInfoText = LocaleText.op_Implicit(CustomInfoText),
KeepShowingLocalLogCount = KeepShowingLocalLogCount,
AudioEventEnter = AudioEventEnter,
AudioEventExit = AudioEventExit,
PasswordProtected = PasswordProtected,
Password = Password,
PasswordHintText = PasswordHintText,
GeneratePassword = GeneratePassword,
PasswordPartCount = PasswordPartCount,
ShowPasswordLength = ShowPasswordLength,
ShowPasswordPartPositions = ShowPasswordPartPositions,
TerminalZoneSelectionDatas = TerminalZoneSelectionDatas.ToIl2Cpp((List<PasswordSelectionData> inner) => inner.ToIl2Cpp((PasswordSelectionData x) => x.ToPasswordSelection()))
};
}
}
public sealed class PasswordSelectionData : GlobalBase
{
public eSeedType SeedType { get; set; } = (eSeedType)1;
public int TerminalIndex { get; set; } = 0;
public int StaticSeed { get; set; } = 0;
public PasswordSelectionData()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
TerminalIndex = Math.Max(0, TerminalIndex);
}
public TerminalZoneSelectionData ToPasswordSelection()
{
//IL_0001: 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_0008: 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_0015: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
return new TerminalZoneSelectionData
{
LocalIndex = ((GlobalBase)this).LocalIndex,
SeedType = SeedType,
TerminalIndex = TerminalIndex,
StaticSeed = StaticSeed
};
}
}
public enum WorldEventComponent
{
None,
WE_ChainedPuzzle,
WE_NavMarker,
WE_CollisionTrigger,
WE_LookatTrigger,
WE_InteractTrigger,
WE_SpecificTerminal,
WE_SpecificPickup,
WE_AnimationTrigger
}
public enum ColliderType
{
None,
Box,
Sphere,
Capsule
}
public class CustomTransform
{
public Vector3 Position { get; set; } = Vector3.zero;
public Vector3 Rotation { get; set; } = Vector3.zero;
public Vector3 Scale { get; set; } = Vector3.one;
}
public sealed class WE_ComponentCustomData
{
public TerminalPrefab PrefabOverride { get; set; } = TerminalPrefab.None;
public List<WardenObjectiveEventData> EventsOnPickup { get; set; } = new List<WardenObjectiveEventData>();
public eMarkerType NavMarkerType { get; set; } = (eMarkerType)1;
public bool PlaceOnStart { get; set; } = true;
public ColliderType ColliderType { get; set; } = ColliderType.None;
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 CustomTransform CarryItemTransform { get; set; } = new CustomTransform();
public bool RemoveItemOnInsert { get; set; } = false;
public eCarryItemCustomState ItemStateAfterInsert { get; set; } = (eCarryItemCustomState)0;
public string WorldEventAnimationFilter { get; set; } = string.Empty;
public bool PlayResetOnStartup { get; set; } = false;
public bool ActivationMode { get; set; } = true;
public HashSet<string> ARAObjectsToActivate { get; set; } = new HashSet<string>();
}
public sealed class WE_ObjectCustomData
{
private static ILookup<int, LG_WorldEventObject> _preAllocWE;
private static Random _weRand;
public string WorldEventObjectFilter { get; set; } = string.Empty;
public int InstanceIndex { get; set; } = 0;
public int AreaIndex { get; set; } = 0;
public bool UseExistingFilterInArea { get; set; } = false;
public bool UseRandomPosition { get; set; } = false;
public CustomTransform[] RandomPositions { get; set; } = Array.Empty<CustomTransform>();
public Vector3 Position { get; set; } = Vector3.zero;
public Vector3 Rotation { get; set; } = Vector3.zero;
public Vector3 Scale { get; set; } = Vector3.one;
public Dictionary<WorldEventComponent, WE_ComponentCustomData> Components { get; set; } = new Dictionary<WorldEventComponent, WE_ComponentCustomData>();
internal LG_Area Area { get; private set; } = null;
internal CustomTransform Transform => new CustomTransform
{
Position = Position,
Rotation = Rotation,
Scale = Scale
};
internal static void AllocatePreexistingWorldEventObjects()
{
_preAllocWE = (from <>h__TransparentIdentifier0 in ((IEnumerable<LG_WorldEventObject>)Object.FindObjectsOfType<LG_WorldEventObject>()).Select(delegate(LG_WorldEventObject weObj)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
object obj = weObj.ParentArea;
if (obj == null)
{
AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(((Component)weObj).transform.position);
obj = ((courseNode != null) ? courseNode.m_area : null);
}
return new
{
weObj = weObj,
area = (LG_Area)obj
};
})
where (Object)(object)<>h__TransparentIdentifier0.area != (Object)null
select (key: ((Object)<>h__TransparentIdentifier0.area).GetInstanceID(), weObj: <>h__TransparentIdentifier0.weObj)).ToLookup(((int key, LG_WorldEventObject weObj) x) => x.key, ((int key, LG_WorldEventObject weObj) y) => y.weObj);
_weRand = RandomUtil.CreateSessionRandom("WE_ObjectCustomData");
}
internal bool ShouldCreateNewWorldEventObject(LG_Zone zone, [MaybeNull] out LG_WorldEventObject weObj)
{
//IL_004b: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Expected O, but got Unknown
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
if (UseRandomPosition)
{
if (RandomPositions.Length != 0)
{
CustomTransform customTransform = RandomPositions[_weRand.Next(RandomPositions.Length)] ?? new CustomTransform();
AreaIndex = -1;
Position = customTransform.Position;
Rotation = customTransform.Rotation;
Scale = customTransform.Scale;
}
else if (AreaIndex == -1)
{
AreaIndex = _weRand.Next(zone.m_areas.Count);
}
}
if (!IsAreaIndexValid(zone))
{
weObj = null;
return false;
}
if (UseRandomPosition && RandomPositions.Length == 0 && AreaIndex != -1)
{
Position = Area.m_courseNode.GetRandomPositionInside();
Rotation = new Vector3(0f, (float)_weRand.Next(360), 0f);
}
if (UseExistingFilterInArea)
{
weObj = _preAllocWE[((Object)Area).GetInstanceID()].FirstOrDefault((Func<LG_WorldEventObject, bool>)((LG_WorldEventObject w) => w.WorldEventObjectKey == WorldEventObjectFilter));
if ((Object)(object)weObj != (Object)null)
{
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;
}
}
else
{
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(69, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unable to find preexisting world event object with filter \"");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(WorldEventObjectFilter);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\" in area!");
}
ARALogger.Error(val);
}
return false;
}
weObj = null;
return true;
}
private bool IsAreaIndexValid(LG_Zone zone)
{
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00c6: 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;
}
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2;
if (AreaIndex == -1)
{
try
{
Area = CourseNodeUtil.GetCourseNode(Position, zone.DimensionIndex).m_area;
if (!zone.m_areas.Contains(Area))
{
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(38, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\"");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(WorldEventObjectFilter);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\": Area inferred from ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector3>(Position);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" may not be in ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<(int, int, int)>(GlobalIndexUtil.ToIntTuple(zone));
}
ARALogger.Warn(val);
}
return true;
}
catch
{
val2 = new BepInExErrorLogInterpolatedStringHandler(33, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\"");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(WorldEventObjectFilter);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\": Failed to infer AreaIndex at ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Vector3>(Position);
}
ARALogger.Error(val2);
}
}
val2 = new BepInExErrorLogInterpolatedStringHandler(31, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Invalid AreaIndex ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(AreaIndex);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" for filter ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(WorldEventObjectFilter);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("!");
}
ARALogger.Error(val2);
Area = null;
return false;
}
}
public sealed class ZoneCustomData : GlobalBase
{
public Vector3[] HibernateSpawnAligns { get; set; } = Array.Empty<Vector3>();
public Vector3[] EnemySpawnPoints { get; set; } = Array.Empty<Vector3>();
public Vector3[] BioscanSpawnPoints { get; set; } = Array.Empty<Vector3>();
public CustomTransform[] InvisibleWalls { get; set; } = Array.Empty<CustomTransform>();
public bool ForceGeneratorClusterMarkers { get; set; } = false;
[JsonPropertyName("SetupWorldEventObjectOnLightsInZone")]
public bool AllWorldEventLights { get; set; } = false;
public WE_ObjectCustomData[] WorldEventObjects { get; set; } = Array.Empty<WE_ObjectCustomData>();
public List<WorldEventFromSourceData> StaticEventsOnTrigger { get; set; } = new List<WorldEventFromSourceData>();
public List<StaticDimensionWECPData> StaticWorldEventChainedPuzzleDatas { get; set; } = new List<StaticDimensionWECPData>();
public List<SpecificPickupSpawnData> StaticSpecificPickupSpawnDatas { get; set; } = new List<SpecificPickupSpawnData>();
public List<StaticDimensionWESTData> StaticSpecificTerminalSpawnDatas { get; set; } = new List<StaticDimensionWESTData>();
public void AddSpawnPointsAndInvisibleWalls()
{
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);
AddInvisibleWalls();
}
public string GetSourceFilter(string source, int index)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected I4, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected I4, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected I4, but got Unknown
return $"ARA_{source}_{(int)((GlobalBase)this).DimensionIndex}_{(int)((GlobalBase)this).Layer}_{(int)((GlobalBase)this).LocalIndex}_{index}";
}
private void AddSpawnPoints(string source, Vector3[] positions, Func<LG_Area, List<Transform>> 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);
}
}
}
private void AddInvisibleWalls()
{
//IL_0022: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < InvisibleWalls.Length; i++)
{
CustomTransform customTransform = InvisibleWalls[i];
if (customTransform != null)
{
AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(customTransform.Position, ((GlobalBase)this).DimensionIndex);
LG_Area val = ((courseNode != null) ? courseNode.m_area : null);
if (!((Object)(object)val == (Object)null))
{
string sourceFilter = GetSourceFilter("InvisWall", i);
GameObject val2 = new GameObject(sourceFilter)
{
layer = 13
};
GameObjectPlusExtensions.SetPositionRotationScale(val2.transform, customTransform.Position, customTransform.Rotation, customTransform.Scale);
val2.transform.SetParent(((Component)val).transform, true);
BoxCollider val3 = val2.AddComponent<BoxCollider>();
val3.center = Vector3.zero;
val3.size = Vector3.one;
LayoutConfigManager.AddARAFilter(sourceFilter, val2);
}
}
}
}
public void InjectStaticDimensionWorldEventData()
{
Dimension dimension = base.Dimension;
if (dimension != null)
{
DimensionData dimensionData = dimension.DimensionData;
if (((dimensionData != null) ? new bool?(dimensionData.IsStaticDimension) : ((bool?)null)) == false)
{
return;
}
}
LG_Zone zone = base.Zone;
object obj;
if (zone == null)
{
obj = null;
}
else
{
LG_ZoneSettings settings = zone.m_settings;
obj = ((settings != null) ? settings.m_zoneData : null);
}
if (obj != null)
{
ExpeditionZoneData zoneData = base.Zone.m_settings.m_zoneData;
zoneData.EventsOnTrigger = ListExtensions.ToIl2Cpp<WorldEventFromSourceData>(StaticEventsOnTrigger);
zoneData.WorldEventChainedPuzzleDatas = StaticWorldEventChainedPuzzleDatas.ToIl2Cpp((StaticDimensionWECPData s) => s.ToWECP());
zoneData.SpecificPickupSpawningDatas = ListExtensions.ToIl2Cpp<SpecificPickupSpawnData>(StaticSpecificPickupSpawnDatas);
zoneData.SpecificTerminalSpawnDatas = StaticSpecificTerminalSpawnDatas.ToIl2Cpp((StaticDimensionWESTData s) => s.ToWEST());
}
}
}
}