Decompiled source of CodeRebirthLib v0.6.0
BepInEx/plugins/CodeRebirthLib/com.github.xuuxiaolan.coderebirthlib.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; 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.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CodeRebirthLib.AssetManagement; using CodeRebirthLib.ConfigManagement; using CodeRebirthLib.ConfigManagement.Converters; using CodeRebirthLib.ContentManagement; using CodeRebirthLib.ContentManagement.Enemies; using CodeRebirthLib.ContentManagement.Items; using CodeRebirthLib.ContentManagement.MapObjects; using CodeRebirthLib.ContentManagement.Unlockables; using CodeRebirthLib.ContentManagement.Unlockables.Progressive; using CodeRebirthLib.ContentManagement.Weathers; using CodeRebirthLib.Data; using CodeRebirthLib.Exceptions; using CodeRebirthLib.Extensions; using CodeRebirthLib.ModCompats; using CodeRebirthLib.Patches; using CodeRebirthLib.Util; using CodeRebirthLib.Util.Attributes; using CodeRebirthLib.Util.Pathfinding; using GameNetcodeStuff; using LethalConfig.ConfigItems; using LethalLevelLoader; using LethalLib.Extras; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MrovLib.Events; using On; using On.LethalConfig.AutoConfig; using PathfindingLib.Jobs; using PathfindingLib.Utilities; using Unity.Jobs; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Experimental.AI; using UnityEngine.SceneManagement; using UnityEngine.Serialization; using UnityEngine.Video; using WeatherRegistry; using WeatherRegistry.Modules; using com.github.xuuxiaolan.coderebirthlib.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("com.github.xuuxiaolan.coderebirthlib.editor")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("LethalConfig")] [assembly: IgnoresAccessChecksTo("LethalLib")] [assembly: IgnoresAccessChecksTo("MrovLib")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("WeatherRegistry")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("XuXiaolan,loaforc")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A library to simplify making large LethalCompany mods.")] [assembly: AssemblyFileVersion("0.6.0.0")] [assembly: AssemblyInformationalVersion("0.6.0+a237cd4d3020dc5ee0bf4bf290e2215a945a358d")] [assembly: AssemblyProduct("CodeRebirthLib")] [assembly: AssemblyTitle("com.github.xuuxiaolan.coderebirthlib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.6.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CodeRebirthLib { internal static class CodeRebirthLibConfig { public static CompatibilityBool LethalConfigCompatibility; public static bool ExtendedLogging; internal static void Bind(ConfigManager manager) { using (ConfigContext configContext = manager.CreateConfigSection("Compatibility")) { LethalConfigCompatibility = configContext.Bind("Extend LethalConfig Support", "Patches LethalConfig to enable raw editing of strings for unknown types.\nCurrent Targeted Version: 1.4.6", CompatibilityBool.IfVersionMatches).Value; } using ConfigContext configContext2 = manager.CreateConfigSection("Debugging"); ExtendedLogging = configContext2.Bind("Extended Logging", "Enable debug logs", defaultValue: false).Value; } } [BepInPlugin("com.github.xuuxiaolan.coderebirthlib", "CodeRebirthLib", "0.6.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.*/)] internal class CodeRebirthLibPlugin : BaseUnityPlugin { internal class MainAssets : AssetBundleLoader<MainAssets> { [LoadFromBundle("CodeRebirthLibNetworker.prefab")] public GameObject NetworkerPrefab { get; private set; } public MainAssets(AssetBundle bundle) : base(bundle) { } } internal static ManualLogSource Logger { get; private set; } internal static ConfigManager ConfigManager { get; private set; } internal static MainAssets Main { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; ConfigManager = new ConfigManager(((BaseUnityPlugin)this).Config); CodeRebirthLibConfig.Bind(ConfigManager); NetcodePatcher(); RoundManagerPatch.Patch(); GameNetworkManagerPatch.Init(); EnemyAIPatch.Init(); StartOfRoundPatch.Init(); TerminalPatch.Init(); DeleteFileButtonPatch.Init(); if (LethalConfigCompatibility.Enabled) { LethalConfigCompatibility.Init(); } if (WeatherRegistryCompatibility.Enabled) { WeatherRegistryCompatibility.Init(); } ExtendedTOML.Init(); Main = new MainAssets(CRLib.LoadBundle(Assembly.GetExecutingAssembly(), "coderebirthlibmain")); string[] files = Directory.GetFiles(Paths.PluginPath, "*.crmod", SearchOption.AllDirectories); foreach (string text in files) { AssetBundle val = AssetBundle.LoadFromFile(text); CRModVersion cRModVersion = val.LoadAsset<CRModVersion>("Mod Information.asset"); if ((Object)(object)cRModVersion == (Object)null) { Logger.LogError((object)(".crmod bundle: '" + Path.GetFileName(text) + "' does not have a 'Mod Information' file. Make sure you include one with that specific name!")); } else { CRLib.RegisterNoCodeMod(cRModVersion.CreatePluginMetadata(), val, Path.GetDirectoryName(text)); } } Logger.LogInfo((object)"com.github.xuuxiaolan.coderebirthlib v0.6.0 has loaded!"); } private void NetcodePatcher() { Type[] array = new Type[3] { typeof(UnlockShipUnlockable), typeof(SmartAgentNavigator), typeof(CodeRebirthLibNetworker) }; Type[] array2 = array; foreach (Type type in array2) { try { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array3 = methods; foreach (MethodInfo methodInfo in array3) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } catch (Exception arg) { Logger.LogWarning((object)$"supressed an error from netcode patcher, probably fine but should still log that something happened: {arg}."); } } } internal static void ExtendedLogging(object text) { if (CodeRebirthLibConfig.ExtendedLogging) { Logger.LogInfo(text); } } } public static class CRLib { public static AssetBundle LoadBundle(Assembly assembly, string filePath) { return AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(assembly.Location), "Assets", filePath)); } public static CRMod RegisterMod(BaseUnityPlugin plugin, AssetBundle mainBundle) { ConfigManager configManager = new ConfigManager(plugin.Config); return new CRMod(((object)plugin).GetType().Assembly, plugin, mainBundle, Path.GetDirectoryName(((object)plugin).GetType().Assembly.Location), configManager); } public static void BroadcastTip(HUDDisplayTip displayTip) { NetworkSingleton<CodeRebirthLibNetworker>.Instance?.BroadcastDisplayTipServerRPC(displayTip); } internal static CRMod RegisterNoCodeMod(BepInPlugin plugin, AssetBundle mainBundle, string basePath) { ConfigManager configManager = new ConfigManager(GenerateConfigFile(plugin)); return new CRMod(plugin, mainBundle, basePath, configManager); } internal static ConfigFile GenerateConfigFile(BepInPlugin plugin) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown return new ConfigFile(Utility.CombinePaths(new string[2] { Paths.ConfigPath, plugin.GUID + ".cfg" }), false, plugin); } } public class CRMod { private static readonly List<CRMod> _allMods = new List<CRMod>(); private readonly string _basePath; private readonly Dictionary<string, CRRegistry> _registries = new Dictionary<string, CRRegistry>(); public static IReadOnlyList<CRMod> AllMods => _allMods.AsReadOnly(); public ConfigManager ConfigManager { get; } public ContentContainer Content { get; } public Assembly? Assembly { get; } public ManualLogSource? Logger { get; set; } public BepInPlugin Plugin { get; } internal CRMod(Assembly assembly, BaseUnityPlugin plugin, AssetBundle mainBundle, string basePath, ConfigManager configManager) : this(MetadataHelper.GetMetadata(((object)plugin).GetType()), mainBundle, basePath, configManager) { Assembly = assembly; } internal CRMod(BepInPlugin plugin, AssetBundle mainBundle, string basePath, ConfigManager configManager) { ConfigManager = configManager; _basePath = basePath; Plugin = plugin; ContentContainer[] array = mainBundle.LoadAllAssets<ContentContainer>(); if (array.Length == 0) { throw new NoContentDefinitionInBundle(mainBundle); } if (array.Length >= 2) { throw new MultipleContentDefinitionsInBundle(mainBundle); } Content = array[0]; AddDefaultRegistries(); if (WeatherRegistryCompatibility.Enabled) { AddWeatherRegistry(); } _allMods.Add(this); } public string GetRelativePath(params string[] path) { return Path.Combine(_basePath, Path.Combine(path)); } public void CreateRegistry<T>(string name, CRRegistry<T> registry) where T : CRContentDefinition { _registries[name] = registry; CodeRebirthLibPlugin.ExtendedLogging("Created Registry: " + name); } public CRRegistry<T> GetRegistryByName<T>(string name) where T : CRContentDefinition { return (CRRegistry<T>)_registries[name]; } public CRRegistry<CREnemyDefinition> EnemyRegistry() { return GetRegistryByName<CREnemyDefinition>("enemies"); } public static IEnumerable<CREnemyDefinition> AllEnemies() { return AllMods.SelectMany((CRMod mod) => mod.EnemyRegistry()); } public CRRegistry<CRItemDefinition> ItemRegistry() { return GetRegistryByName<CRItemDefinition>("items"); } public static IEnumerable<CRItemDefinition> AllItems() { return AllMods.SelectMany((CRMod mod) => mod.ItemRegistry()); } public CRRegistry<CRMapObjectDefinition> MapObjectRegistry() { return GetRegistryByName<CRMapObjectDefinition>("map_objects"); } public static IEnumerable<CRMapObjectDefinition> AllMapObjects() { return AllMods.SelectMany((CRMod mod) => mod.MapObjectRegistry()); } public CRRegistry<CRUnlockableDefinition> UnlockableRegistry() { return GetRegistryByName<CRUnlockableDefinition>("unlockables"); } public static IEnumerable<CRUnlockableDefinition> AllUnlockables() { return AllMods.SelectMany((CRMod mod) => mod.UnlockableRegistry()); } public bool TryGetBundleDataFromName(string bundleName, [NotNullWhen(true)] out AssetBundleData? data) { string bundleName2 = bundleName; data = Content.assetBundles.FirstOrDefault((AssetBundleData it) => it.assetBundleName == bundleName2); return data != null; } private void AddDefaultRegistries() { CREnemyDefinition.RegisterTo(this); CRMapObjectDefinition.RegisterTo(this); CRItemDefinition.RegisterTo(this); CRUnlockableDefinition.RegisterTo(this); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void AddWeatherRegistry() { CRWeatherDefinition.RegisterTo(this); } public void RegisterContentHandlers() { if (Assembly == null) { CodeRebirthLibPlugin.Logger.LogWarning((object)("Tried to Register Content Handlers for " + Plugin.Name + " but it is a no-code CRMod!")); return; } IEnumerable<Type> enumerable = from x in Assembly.GetLoadableTypes() where !x.IsNested && x.BaseType != null && x.BaseType.IsGenericType && x.BaseType.GetGenericTypeDefinition() == typeof(ContentHandler<>) select x; foreach (Type item in enumerable) { item.GetConstructor(new Type[1] { typeof(CRMod) }).Invoke(new object[1] { this }); } } } [CreateAssetMenu(fileName = "Mod Information", menuName = "CodeRebirthLib/Mod Information", order = -11)] public class CRModVersion : ScriptableObject { [field: SerializeField] public string Name { get; private set; } [field: SerializeField] public string Version { get; private set; } public BepInPlugin CreatePluginMetadata() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return new BepInPlugin(Name, Name, Version); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.xuuxiaolan.coderebirthlib"; public const string PLUGIN_NAME = "CodeRebirthLib"; public const string PLUGIN_VERSION = "0.6.0"; } } namespace CodeRebirthLib.Util { public class CodeRebirthLibNetworker : NetworkSingleton<CodeRebirthLibNetworker> { internal static EntranceTeleport[] _entrancePoints = Array.Empty<EntranceTeleport>(); internal Random CRLibRandom = new Random(); internal ES3Settings SaveSettings; public static IReadOnlyList<EntranceTeleport> EntrancePoints => _entrancePoints; private void Awake() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if (!((Object)(object)StartOfRound.Instance == (Object)null)) { CRLibRandom = new Random(StartOfRound.Instance.randomMapSeed + 6969); ((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(OnNewRoundStart)); SaveSettings = new ES3Settings("CRLib" + GameNetworkManager.Instance.currentSaveFileName, new Enum[1] { (Enum)(object)(EncryptionType)0 }); } } public IEnumerator Start() { yield return (object)new WaitUntil((Func<bool>)(() => ((NetworkBehaviour)this).NetworkObject.IsSpawned)); yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)); if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { ProgressiveUnlockableHandler.LoadAll(SaveSettings); yield break; } RequestProgressiveUnlockableStatesServerRpc(GameNetworkManager.Instance.localPlayerController, (from it in CRMod.AllUnlockables() where it.ProgressiveData != null select it.ProgressiveData.NetworkID).ToArray()); } [ServerRpc(RequireOwnership = false)] private void RequestProgressiveUnlockableStatesServerRpc(PlayerControllerReference requester, uint[] expectedOrder) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2345743489u, val, (RpcDelivery)0); bool flag = requester != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<PlayerControllerReference>(ref requester, default(ForNetworkSerializable)); } bool flag2 = expectedOrder != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<uint>(expectedOrder, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2345743489u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } PlayerControllerB val3 = requester; CodeRebirthLibPlugin.Logger.LogDebug((object)("Sending states of progressive unlockables for player: '" + val3.playerUsername + "'")); bool[] array = new bool[expectedOrder.Length]; for (int i = 0; i < expectedOrder.Length; i++) { uint unlockableNetworkId = expectedOrder[i]; CRUnlockableDefinition cRUnlockableDefinition = CRMod.AllUnlockables().FirstOrDefault((CRUnlockableDefinition it) => it.ProgressiveData != null && it.ProgressiveData.NetworkID == unlockableNetworkId); if (Object.op_Implicit((Object)(object)cRUnlockableDefinition)) { array[i] = cRUnlockableDefinition.ProgressiveData.IsUnlocked; CodeRebirthLibPlugin.ExtendedLogging($"set values[{i}] = {array[i]}"); } else { CodeRebirthLibPlugin.Logger.LogError((object)$"client requested progressive data status of a non-existing unlockable!!! (index: {i}, networkID: {unlockableNetworkId})"); array[i] = false; } } ProgressiveUnlockableStateResponseClientRpc(array, new ClientRpcParams { Send = { TargetClientIds = new <>z__ReadOnlyArray<ulong>(new ulong[1] { ((NetworkBehaviour)val3).OwnerClientId }) } }); } [ClientRpc] private void ProgressiveUnlockableStateResponseClientRpc(bool[] states, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1599363290u, rpcParams, (RpcDelivery)0); bool flag = states != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(states, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1599363290u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { CRUnlockableDefinition[] array = (from it in CRMod.AllUnlockables() where it.ProgressiveData != null select it).ToArray(); for (int i = 0; i < array.Length; i++) { CRUnlockableDefinition cRUnlockableDefinition = array[i]; CodeRebirthLibPlugin.ExtendedLogging($"setting state of {cRUnlockableDefinition.UnlockableItemDef.unlockable.unlockableName} to {states[i]}. (index: {i}, networkID: {cRUnlockableDefinition.ProgressiveData.NetworkID})"); cRUnlockableDefinition.ProgressiveData.SetFromServer(states[i]); } } } internal void SaveCodeRebirthLibData() { if (NetworkManager.Singleton.IsHost) { CodeRebirthLibPlugin.ExtendedLogging("Running SaveAll"); ProgressiveUnlockableHandler.SaveAll(SaveSettings); } } internal static void ResetCodeRebirthLibData(ES3Settings saveSettings) { ES3.DeleteFile(saveSettings); } private void OnNewRoundStart() { _entrancePoints = Object.FindObjectsByType<EntranceTeleport>((FindObjectsSortMode)1); EntranceTeleport[] entrancePoints = _entrancePoints; foreach (EntranceTeleport val in entrancePoints) { if (!val.FindExitPoint()) { CodeRebirthLibPlugin.Logger.LogError((object)"Something went wrong in the generation of the fire exits! (ignorable if EntranceTeleportOptimisation is installed)"); } } } [ServerRpc(RequireOwnership = false)] internal void BroadcastDisplayTipServerRPC(HUDDisplayTip displayTip) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(664095315u, val, (RpcDelivery)0); bool flag = displayTip != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<HUDDisplayTip>(ref displayTip, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 664095315u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { BroadcastDisplayTipClientRPC(displayTip); } } [ClientRpc] private void BroadcastDisplayTipClientRPC(HUDDisplayTip displayTip) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1202165993u, val, (RpcDelivery)0); bool flag = displayTip != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<HUDDisplayTip>(ref displayTip, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1202165993u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HUDManager.Instance.DisplayTip(displayTip); } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CodeRebirthLibNetworker() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2345743489u, new RpcReceiveHandler(__rpc_handler_2345743489)); NetworkManager.__rpc_func_table.Add(1599363290u, new RpcReceiveHandler(__rpc_handler_1599363290)); NetworkManager.__rpc_func_table.Add(664095315u, new RpcReceiveHandler(__rpc_handler_664095315)); NetworkManager.__rpc_func_table.Add(1202165993u, new RpcReceiveHandler(__rpc_handler_1202165993)); } private static void __rpc_handler_2345743489(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //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_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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); PlayerControllerReference requester = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<PlayerControllerReference>(ref requester, default(ForNetworkSerializable)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); uint[] expectedOrder = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<uint>(ref expectedOrder, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthLibNetworker)(object)target).RequestProgressiveUnlockableStatesServerRpc(requester, expectedOrder); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1599363290(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); bool[] states = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref states, default(ForPrimitives)); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((CodeRebirthLibNetworker)(object)target).ProgressiveUnlockableStateResponseClientRpc(states, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_664095315(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); HUDDisplayTip displayTip = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<HUDDisplayTip>(ref displayTip, default(ForNetworkSerializable)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthLibNetworker)(object)target).BroadcastDisplayTipServerRPC(displayTip); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1202165993(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); HUDDisplayTip displayTip = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<HUDDisplayTip>(ref displayTip, default(ForNetworkSerializable)); } target.__rpc_exec_stage = (__RpcExecStage)2; ((CodeRebirthLibNetworker)(object)target).BroadcastDisplayTipClientRPC(displayTip); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "CodeRebirthLibNetworker"; } } public class HUDDisplayTip : INetworkSerializable { public enum AlertType { Hint, Warning } private AlertType _alertType; private string _header; private string _body; public string Header => _header; public string Body => _body; public AlertType Type => _alertType; public HUDDisplayTip(string header, string body, AlertType type = AlertType.Hint) { _header = header; _body = body; _alertType = type; } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) serializer.SerializeValue(ref _header, false); serializer.SerializeValue(ref _body, false); ((BufferSerializer<AlertType>*)(&serializer))->SerializeValue<AlertType>(ref _alertType, default(ForEnums)); } } public static class MoreLayerMasks { public static int CollidersAndRoomAndDefaultAndInteractableAndRailingAndEnemiesAndTerrainAndHazardAndVehicleMask { get; private set; } public static int CollidersAndRoomAndInteractableAndRailingAndEnemiesAndTerrainAndHazardAndVehicleMask { get; private set; } public static int CollidersAndRoomAndInteractableAndRailingAndTerrainAndHazardAndVehicleMask { get; private set; } public static int CollidersAndRoomAndPlayersAndEnemiesAndTerrainAndVehicleAndDefaultMask { get; private set; } public static int CollidersAndRoomAndRailingAndTerrainAndHazardAndVehicleAndDefaultMask { get; private set; } public static int CollidersAndRoomAndPlayersAndEnemiesAndTerrainAndVehicleMask { get; private set; } public static int CollidersAndRoomAndRailingAndInteractableMask { get; private set; } public static int CollidersAndRoomAndPlayersAndInteractableMask { get; private set; } public static int PlayersAndInteractableAndEnemiesAndPropsHazardMask { get; private set; } public static int CollidersAndRoomMaskAndDefaultAndEnemies { get; private set; } public static int PlayersAndEnemiesAndHazardMask { get; private set; } public static int PlayersAndRagdollMask { get; private set; } public static int PropsAndHazardMask { get; private set; } public static int TerrainAndFoliageMask { get; private set; } public static int PlayersAndEnemiesMask { get; private set; } public static int DefaultMask { get; private set; } public static int PropsMask { get; private set; } public static int HazardMask { get; private set; } public static int EnemiesMask { get; private set; } public static int InteractableMask { get; private set; } public static int RailingMask { get; private set; } public static int TerrainMask { get; private set; } public static int VehicleMask { get; private set; } public static void Init() { DefaultMask = LayerMask.GetMask(new string[1] { "Default" }); PropsMask = LayerMask.GetMask(new string[1] { "Props" }); HazardMask = LayerMask.GetMask(new string[1] { "MapHazards" }); EnemiesMask = LayerMask.GetMask(new string[1] { "Enemies" }); InteractableMask = LayerMask.GetMask(new string[1] { "InteractableObject" }); RailingMask = LayerMask.GetMask(new string[1] { "Railing" }); TerrainMask = LayerMask.GetMask(new string[1] { "Terrain" }); VehicleMask = LayerMask.GetMask(new string[1] { "Vehicle" }); PlayersAndRagdollMask = StartOfRound.Instance.playersMask | LayerMask.GetMask(new string[1] { "PlayerRagdoll" }); PropsAndHazardMask = PropsMask | HazardMask; TerrainAndFoliageMask = TerrainMask | LayerMask.GetMask(new string[1] { "Foliage" }); PlayersAndEnemiesMask = StartOfRound.Instance.playersMask | EnemiesMask; PlayersAndEnemiesAndHazardMask = PlayersAndEnemiesMask | HazardMask; CollidersAndRoomMaskAndDefaultAndEnemies = StartOfRound.Instance.collidersAndRoomMaskAndDefault | EnemiesMask; CollidersAndRoomAndRailingAndInteractableMask = StartOfRound.Instance.collidersAndRoomMask | InteractableMask | RailingMask; CollidersAndRoomAndPlayersAndInteractableMask = StartOfRound.Instance.collidersAndRoomMaskAndPlayers | InteractableMask; PlayersAndInteractableAndEnemiesAndPropsHazardMask = PlayersAndEnemiesAndHazardMask | InteractableMask | PropsMask; CollidersAndRoomAndRailingAndTerrainAndHazardAndVehicleAndDefaultMask = StartOfRound.Instance.collidersAndRoomMask | HazardMask | RailingMask | TerrainMask | VehicleMask | DefaultMask; CollidersAndRoomAndPlayersAndEnemiesAndTerrainAndVehicleMask = StartOfRound.Instance.collidersAndRoomMaskAndPlayers | EnemiesMask | TerrainMask | VehicleMask; CollidersAndRoomAndPlayersAndEnemiesAndTerrainAndVehicleAndDefaultMask = CollidersAndRoomAndPlayersAndEnemiesAndTerrainAndVehicleMask | DefaultMask; CollidersAndRoomAndInteractableAndRailingAndTerrainAndHazardAndVehicleMask = CollidersAndRoomAndRailingAndInteractableMask | HazardMask | TerrainMask | VehicleMask; CollidersAndRoomAndInteractableAndRailingAndEnemiesAndTerrainAndHazardAndVehicleMask = CollidersAndRoomAndInteractableAndRailingAndTerrainAndHazardAndVehicleMask | EnemiesMask; CollidersAndRoomAndDefaultAndInteractableAndRailingAndEnemiesAndTerrainAndHazardAndVehicleMask = CollidersAndRoomAndInteractableAndRailingAndEnemiesAndTerrainAndHazardAndVehicleMask | DefaultMask; } } public abstract class NetworkSingleton<T> : NetworkBehaviour where T : NetworkSingleton<T> { public static T? Instance { get; private set; } protected void OnDisable() { if ((Object)(object)Instance == (Object)(object)(T)this) { Instance = null; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instance = (T)this; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "NetworkSingleton`1"; } } public class PlayerControllerReference : INetworkSerializable { private int _playerID; public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_000a: 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) ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref _playerID, default(ForPrimitives)); } public static implicit operator PlayerControllerB(PlayerControllerReference reference) { return StartOfRound.Instance.allPlayerScripts[reference._playerID]; } public static implicit operator PlayerControllerReference(PlayerControllerB player) { return new PlayerControllerReference { _playerID = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player) }; } public override bool Equals(object? obj) { if (obj is PlayerControllerReference playerControllerReference) { return playerControllerReference._playerID == _playerID; } PlayerControllerB val = (PlayerControllerB)((obj is PlayerControllerB) ? obj : null); if (val != null) { return Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val) == _playerID; } return false; } public override int GetHashCode() { return _playerID; } } } namespace CodeRebirthLib.Util.Pathfinding { public class FindPathThroughTeleportsOperation : PathfindingOperation { private EntranceTeleport[] entranceTeleports; private PooledFindPathJob[] FindDestinationJobs; private PooledFindPathJob? FindDirectPathToDestinationJob; private PooledFindPathJob[] FindEntrancePointJobs; public FindPathThroughTeleportsOperation(IEnumerable<EntranceTeleport> entrancePoints, Vector3 startPos, Vector3 endPos, NavMeshAgent agent) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_00c8: 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_00e6: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) FindDirectPathToDestinationJob = JobPools.GetFindPathJob(); ((FindPathJob)(ref FindDirectPathToDestinationJob.Job)).Initialize(startPos, endPos, agent); JobHandle val = IJobExtensions.ScheduleByRef<FindPathJob>(ref FindDirectPathToDestinationJob.Job, default(JobHandle)); entranceTeleports = entrancePoints.ToArray(); FindEntrancePointJobs = (PooledFindPathJob[])(object)new PooledFindPathJob[entranceTeleports.Length]; FindDestinationJobs = (PooledFindPathJob[])(object)new PooledFindPathJob[entranceTeleports.Length]; for (int i = 0; i < entranceTeleports.Length; i++) { EntranceTeleport val2 = entranceTeleports[i]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.exitPoint == (Object)null) && !((Object)(object)val2.entrancePoint == (Object)null)) { PooledFindPathJob findPathJob = JobPools.GetFindPathJob(); PooledFindPathJob findPathJob2 = JobPools.GetFindPathJob(); ((FindPathJob)(ref findPathJob.Job)).Initialize(startPos, val2.entrancePoint.position, agent); ((FindPathJob)(ref findPathJob2.Job)).Initialize(val2.exitPoint.position, endPos, agent); val = IJobExtensions.ScheduleByRef<FindPathJob>(ref findPathJob.Job, val); val = IJobExtensions.ScheduleByRef<FindPathJob>(ref findPathJob2.Job, val); FindEntrancePointJobs[i] = findPathJob; FindDestinationJobs[i] = findPathJob2; } } } public override void Dispose() { if (FindDirectPathToDestinationJob != null) { JobPools.ReleaseFindPathJob(FindDirectPathToDestinationJob); FindDirectPathToDestinationJob = null; } PooledFindPathJob[] findEntrancePointJobs = FindEntrancePointJobs; foreach (PooledFindPathJob val in findEntrancePointJobs) { if (val != null) { JobPools.ReleaseFindPathJob(val); } } PooledFindPathJob[] findDestinationJobs = FindDestinationJobs; foreach (PooledFindPathJob val2 in findDestinationJobs) { if (val2 != null) { JobPools.ReleaseFindPathJob(val2); } } entranceTeleports = Array.Empty<EntranceTeleport>(); FindEntrancePointJobs = Array.Empty<PooledFindPathJob>(); FindDestinationJobs = Array.Empty<PooledFindPathJob>(); } public bool TryGetShortestPath(out bool foundPath, out float totalDistance, out EntranceTeleport? entranceTeleport) { //IL_0028: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Invalid comparison between Unknown and I4 //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 totalDistance = -1f; float num = float.MaxValue; foundPath = false; entranceTeleport = null; if (FindDirectPathToDestinationJob == null) { return false; } PathQueryStatus result = PathQueryStatusExtensions.GetResult(((FindPathJob)(ref FindDirectPathToDestinationJob.Job)).GetStatus()); if ((int)result == 536870912) { return false; } if ((int)result == 1073741824) { num = ((FindPathJob)(ref FindDirectPathToDestinationJob.Job)).GetPathLength(); foundPath = true; } for (int i = 0; i < FindEntrancePointJobs.Length; i++) { if ((Object)(object)entranceTeleports[i] == (Object)null || FindEntrancePointJobs[i] == null || FindDestinationJobs[i] == null) { continue; } PathQueryStatus result2 = PathQueryStatusExtensions.GetResult(((FindPathJob)(ref FindEntrancePointJobs[i].Job)).GetStatus()); PathQueryStatus result3 = PathQueryStatusExtensions.GetResult(((FindPathJob)(ref FindDestinationJobs[i].Job)).GetStatus()); if ((int)result2 == 536870912) { return false; } if ((int)result3 == 536870912) { return false; } if ((int)result2 != int.MinValue && (int)result3 != int.MinValue) { float pathLength = ((FindPathJob)(ref FindEntrancePointJobs[i].Job)).GetPathLength(); float pathLength2 = ((FindPathJob)(ref FindDestinationJobs[i].Job)).GetPathLength(); float num2 = pathLength2 + pathLength; if (num2 < num) { entranceTeleport = entranceTeleports[i]; num = num2; foundPath = true; } } } Dispose(); totalDistance = num; return true; } public override bool HasDisposed() { return FindDirectPathToDestinationJob == null; } } public abstract class PathfindingOperation : IDisposable { public abstract void Dispose(); public abstract bool HasDisposed(); ~PathfindingOperation() { Dispose(); } } [RequireComponent(typeof(NavMeshAgent))] public class SmartAgentNavigator : NetworkBehaviour { [HideInInspector] public bool cantMove; [HideInInspector] public EntranceTeleport lastUsedEntranceTeleport; [HideInInspector] public NavMeshAgent agent; [HideInInspector] public bool isOutside = true; [HideInInspector] public List<EntranceTeleport> exitPoints = new List<EntranceTeleport>(); [HideInInspector] public EntranceTeleport? mainEntrance; private readonly float nonAgentMovementSpeed = 10f; private Coroutine? checkPathsRoutine; private MineshaftElevatorController? elevatorScript; private bool inElevator; [HideInInspector] public UnityEvent<bool> OnEnableOrDisableAgent = new UnityEvent<bool>(); [HideInInspector] public UnityEvent<bool> OnEnterOrExitElevator = new UnityEvent<bool>(); [HideInInspector] public UnityEvent<bool> OnUseEntranceTeleport = new UnityEvent<bool>(); [HideInInspector] public PathfindingOperation? pathfindingOperation; private Vector3 pointToGo = Vector3.zero; private bool usingElevator; [SerializeField] private float _nodeRemovalPrecision = 5f; private Coroutine? _searchRoutine; private float _searchRadius = 50f; private readonly List<Vector3> _positionsToSearch = new List<Vector3>(); private readonly List<(Vector3 nodePosition, Vector3 position)> _roamingPointsVectorList = new List<(Vector3, Vector3)>(); public void Awake() { agent = ((Component)this).gameObject.GetComponent<NavMeshAgent>(); } public void SetAllValues(bool isOutside) { this.isOutside = isOutside; exitPoints.Clear(); foreach (EntranceTeleport entrancePoint in CodeRebirthLibNetworker.EntrancePoints) { exitPoints.Add(entrancePoint); if (entrancePoint.entranceId == 0 && entrancePoint.isEntranceToBuilding) { mainEntrance = entrancePoint; } } elevatorScript = RoundManager.Instance.currentMineshaftElevator; } public void ResetAllValues() { exitPoints.Clear(); elevatorScript = null; mainEntrance = null; } public void StopAgent() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)agent).enabled && agent.isOnNavMesh) { agent.ResetPath(); } agent.velocity = Vector3.zero; } public bool DoPathingToDestination(Vector3 destination) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (_searchRoutine != null) { StopSearchRoutine(); } if (cantMove) { return false; } if (!((Behaviour)agent).enabled) { HandleDisabledAgentPathing(); return false; } return GoToDestination(destination); } public bool CheckPathsOngoing() { return checkPathsRoutine != null; } public void CheckPaths<T>(IEnumerable<(T, Vector3)> points, Action<List<(T, float)>> action) { if (CheckPathsOngoing()) { ((MonoBehaviour)this).StopCoroutine(checkPathsRoutine); checkPathsRoutine = null; ClearPathfindingOperation(); } checkPathsRoutine = ((MonoBehaviour)this).StartCoroutine(CheckPathsCoroutine(points, action)); } private IEnumerator CheckPathsCoroutine<T>(IEnumerable<(T, Vector3)> points, Action<List<(T, float)>> action) { CodeRebirthLibPlugin.ExtendedLogging($"Checking paths for {points.Count()} objects"); List<(T, float)> TList = new List<(T, float)>(); ClearPathfindingOperation(); (T, Vector3)[] array = points.ToArray(); for (int i = 0; i < array.Length; i++) { (T, Vector3) tuple = array[i]; T obj = tuple.Item1; Vector3 point = tuple.Item2; bool foundPath = false; float bestDistance = float.MaxValue; EntranceTeleport entranceTeleport; while (!TryFindViablePath(point, out foundPath, out bestDistance, out entranceTeleport)) { yield return null; } if (foundPath) { TList.Add((obj, bestDistance)); } } ClearPathfindingOperation(); action(TList); checkPathsRoutine = null; } private void HandleDisabledAgentPathing() { //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_0018: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Vector3 val = pointToGo; float num = 10f; float num2 = Vector3.Distance(((Component)this).transform.position, val); if (Vector3.Distance(((Component)this).transform.position, val) <= 1f) { OnEnableOrDisableAgent.Invoke(true); ((Behaviour)agent).enabled = true; agent.Warp(val); } else { float num3 = Mathf.Clamp01(Vector3.Distance(((Component)this).transform.position, val) / num2); Vector3 val2 = Vector3.MoveTowards(((Component)this).transform.position, val, Time.deltaTime * nonAgentMovementSpeed); val2.y += Mathf.Sin(num3 * MathF.PI) * num; ((Component)this).transform.SetPositionAndRotation(val2, Quaternion.LookRotation(val - ((Component)this).transform.position)); } } private bool DetermineIfNeedToDisableAgent(Vector3 destination) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_007e: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)this).transform.position, destination); if (num <= agent.stoppingDistance + 5f) { return false; } NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(destination, ref val, 3f, agent.areaMask)) { return false; } Vector3 val2 = FindClosestValidPoint(); agent.SetDestination(val2); if (Vector3.Distance(((Component)agent).transform.position, val2) <= agent.stoppingDistance) { pointToGo = ((NavMeshHit)(ref val)).position; OnEnableOrDisableAgent.Invoke(false); ((Behaviour)agent).enabled = false; CodeRebirthLibPlugin.ExtendedLogging($"Pathing to initial destination {destination} failed, going to fallback position {((NavMeshHit)(ref val)).position} instead."); return true; } return false; } public float CanPathToPoint(Vector3 startPos, Vector3 endPos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) NavMeshPath val = new NavMeshPath(); if (!NavMesh.CalculatePath(startPos, endPos, -1, val) || (int)val.status != 0) { return -1f; } float num = 0f; if (val.corners.Length > 1) { for (int i = 1; i < val.corners.Length; i++) { num += Vector3.Distance(val.corners[i - 1], val.corners[i]); } } return num; } public void ClearPathfindingOperation() { pathfindingOperation?.Dispose(); pathfindingOperation = null; } internal T ChangePathfindingOperation<T>(Func<T> provider) where T : PathfindingOperation { PathfindingOperation? obj = pathfindingOperation; if (obj != null && obj.HasDisposed()) { pathfindingOperation = null; } T val = pathfindingOperation as T; if (val == null) { val = provider(); pathfindingOperation?.Dispose(); pathfindingOperation = val; } return val; } public bool TryFindViablePath(Vector3 endPosition, out bool foundPath, out float bestDistance, out EntranceTeleport? entranceTeleport) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) FindPathThroughTeleportsOperation findPathThroughTeleportsOperation = ChangePathfindingOperation(() => new FindPathThroughTeleportsOperation(exitPoints, AgentExtensions.GetPathOrigin(agent), endPosition, agent)); return findPathThroughTeleportsOperation.TryGetShortestPath(out foundPath, out bestDistance, out entranceTeleport); } public bool GoToDestination(Vector3 actualEndPosition) { //IL_0001: 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_0033: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (TryFindViablePath(actualEndPosition, out bool foundPath, out float _, out EntranceTeleport entranceTeleport)) { if ((Object)(object)entranceTeleport == (Object)null && !foundPath) { if ((Object)(object)elevatorScript != (Object)null) { if (NeedsElevator(actualEndPosition, elevatorScript, out var goingUp)) { usingElevator = true; HandleElevatorActions(elevatorScript, goingUp); return false; } if (!elevatorScript.elevatorFinishedMoving && Vector3.Distance(actualEndPosition, elevatorScript.elevatorInsidePoint.position) < 7f) { return false; } } if ((isOutside && actualEndPosition.y > -50f) || (!isOutside && actualEndPosition.y < -50f)) { DetermineIfNeedToDisableAgent(actualEndPosition); return false; } if ((Object)(object)mainEntrance == (Object)null) { return false; } DoPathingThroughEntrance(mainEntrance); return false; } if ((Object)(object)entranceTeleport == (Object)null) { agent.SetDestination(actualEndPosition); return true; } DoPathingThroughEntrance(entranceTeleport); return false; } return false; } private void HandleElevatorActions(MineshaftElevatorController elevatorScript, bool goingUp) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (inElevator) { agent.Warp(elevatorScript.elevatorInsidePoint.position); } else { UseTheElevator(elevatorScript, goingUp); } } private void DoPathingThroughEntrance(EntranceTeleport viableEntrance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) Vector3 position = viableEntrance.entrancePoint.position; Vector3 position2 = viableEntrance.exitPoint.position; float num = Vector3.Distance(((Component)this).transform.position, position); if (num <= agent.stoppingDistance + 1f) { agent.Warp(position2); SetThingOutsideServerRpc(!isOutside, new NetworkBehaviourReference((NetworkBehaviour)(object)viableEntrance)); } else { agent.SetDestination(position); } } private bool NeedsElevator(Vector3 destination, MineshaftElevatorController elevatorScript, out bool goingUp) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) goingUp = false; if (isOutside && destination.y > -50f) { usingElevator = false; return false; } if (usingElevator) { return true; } bool flag = Vector3.Distance(destination, RoundManager.FindMainEntrancePosition(true, false)) < Vector3.Distance(destination, elevatorScript.elevatorBottomPoint.position); bool flag2 = Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position) > 15f; goingUp = flag; if (!(flag && flag2)) { if (!flag2) { return !flag; } return false; } return true; } private void UseTheElevator(MineshaftElevatorController elevatorScript, bool goingUp) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) MoveToWaitingPoint(elevatorScript, goingUp); if (elevatorScript.elevatorFinishedMoving && elevatorScript.elevatorDoorOpen) { if (NeedToCallElevator(elevatorScript, goingUp)) { elevatorScript.CallElevatorOnServer(goingUp); } else if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) > 1f) { agent.SetDestination(elevatorScript.elevatorInsidePoint.position); } else if (!inElevator) { elevatorScript.PressElevatorButtonOnServer(true); ((MonoBehaviour)this).StartCoroutine(StopUsingElevator(elevatorScript)); } } } private IEnumerator StopUsingElevator(MineshaftElevatorController elevatorScript) { MineshaftElevatorController elevatorScript2 = elevatorScript; inElevator = true; OnEnterOrExitElevator.Invoke(true); yield return (object)new WaitForSeconds(2f); yield return (object)new WaitUntil((Func<bool>)(() => elevatorScript2.elevatorDoorOpen && elevatorScript2.elevatorFinishedMoving)); CodeRebirthLibPlugin.ExtendedLogging("Stopped using elevator"); usingElevator = false; OnEnterOrExitElevator.Invoke(false); inElevator = false; } private bool NeedToCallElevator(MineshaftElevatorController elevatorScript, bool needToGoUp) { if (!elevatorScript.elevatorCalled) { if (!(!elevatorScript.elevatorIsAtBottom && needToGoUp)) { if (elevatorScript.elevatorIsAtBottom) { return !needToGoUp; } return false; } return true; } return false; } private void MoveToWaitingPoint(MineshaftElevatorController elevatorScript, bool needToGoUp) { //IL_0006: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) > 1f) { agent.SetDestination(needToGoUp ? elevatorScript.elevatorBottomPoint.position : elevatorScript.elevatorTopPoint.position); } else { agent.SetDestination(elevatorScript.elevatorInsidePoint.position); } } [ServerRpc(RequireOwnership = false)] public void SetThingOutsideServerRpc(bool setOutside, NetworkBehaviourReference entranceTeleportReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3922785661u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref entranceTeleportReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3922785661u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetThingOutsideClientRpc(setOutside, entranceTeleportReference); } } } [ClientRpc] public void SetThingOutsideClientRpc(bool setOutside, NetworkBehaviourReference entranceTeleportReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3927833998u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref entranceTeleportReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3927833998u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { isOutside = setOutside; lastUsedEntranceTeleport = (EntranceTeleport)NetworkBehaviourReference.op_Implicit(entranceTeleportReference); OnUseEntranceTeleport.Invoke(setOutside); } } } private Vector3 FindClosestValidPoint() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return agent.pathEndPosition; } private Vector3 WarpForwardUntilOnNavMesh(Vector3 originalDestination) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)agent).transform.forward; float num = 0.2f; float num2 = 50f; float num3 = 1f; NavMeshHit val2 = default(NavMeshHit); for (int i = 0; (float)i < num2; i++) { Vector3 val = originalDestination + forward * num * (float)(i + 1); if (NavMesh.SamplePosition(val, ref val2, num3, -1)) { return ((NavMeshHit)(ref val2)).position; } } CodeRebirthLibPlugin.Logger.LogWarning((object)"Unable to find valid point on NavMesh by warping forward."); return Vector3.zero; } public void AdjustSpeedBasedOnDistance(float multiplierBoost) { float num = 0f; float num2 = 40f; float num3 = 0f; float num4 = 10f; float num5 = Mathf.Clamp(agent.remainingDistance, num, num2); float num6 = (num5 - num) / (num2 - num); agent.speed = Mathf.Lerp(num3, num4, num6) * multiplierBoost; } public void StopNavigation() { if ((Object)(object)agent != (Object)null) { agent.isStopped = true; agent.ResetPath(); } } public void WarpToLocation(Vector3 location) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) agent.Warp(location); } public bool CurrentPathIsValid() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 if ((int)agent.path.status == 1 || (int)agent.path.status == 2) { return false; } return true; } public void StartSearchRoutine(float radius) { if (((Behaviour)agent).enabled) { _searchRadius = radius; StopSearchRoutine(); _searchRoutine = ((MonoBehaviour)this).StartCoroutine(SearchAlgorithm(radius)); } } public void StopSearchRoutine() { if (_searchRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_searchRoutine); } StopAgent(); _searchRoutine = null; } private IEnumerator SearchAlgorithm(float radius) { yield return (object)new WaitForSeconds(Random.Range(0f, 3f)); _positionsToSearch.Clear(); yield return ((MonoBehaviour)this).StartCoroutine(GetSetOfAcceptableNodesForRoaming(radius)); while (true) { Vector3 positionToTravel = _positionsToSearch.FirstOrDefault(); if (_positionsToSearch.Count == 0 || positionToTravel == Vector3.zero) { break; } _positionsToSearch.RemoveAt(0); yield return ((MonoBehaviour)this).StartCoroutine(ClearProximityNodes(_positionsToSearch, positionToTravel, _nodeRemovalPrecision)); bool reachedDestination = false; while (!reachedDestination) { GoToDestination(positionToTravel); yield return (object)new WaitForSeconds(0.5f); if (!((Behaviour)agent).enabled || Vector3.Distance(((Component)this).transform.position, positionToTravel) <= 3f + agent.stoppingDistance) { reachedDestination = true; } } } StartSearchRoutine(radius); } private IEnumerator GetSetOfAcceptableNodesForRoaming(float radius) { _roamingPointsVectorList.Clear(); if (isOutside) { _roamingPointsVectorList.AddRange(RoundManager.Instance.outsideAINodes.Select((GameObject x) => (x.transform.position, x.transform.position))); } else { _roamingPointsVectorList.AddRange(RoundManager.Instance.insideAINodes.Select((GameObject x) => (x.transform.position, x.transform.position))); } if (_roamingPointsVectorList.Count == 0) { for (int i = 0; i < 20; i++) { Vector3 randomNavMeshPositionInRadius = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, radius, default(NavMeshHit)); _roamingPointsVectorList.Add((randomNavMeshPositionInRadius, randomNavMeshPositionInRadius)); } } CheckPaths(_roamingPointsVectorList, CullRoamingNodes); yield return (object)new WaitUntil((Func<bool>)(() => _positionsToSearch.Count > 0)); } private void CullRoamingNodes(List<(Vector3 nodePosition, float distanceToNode)> NodeDistanceTuple) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < NodeDistanceTuple.Count; i++) { if (!(NodeDistanceTuple[i].distanceToNode < 0f) && !(NodeDistanceTuple[i].distanceToNode > _searchRadius)) { _positionsToSearch.Add(NodeDistanceTuple[i].nodePosition); } } _positionsToSearch.Shuffle(); } private IEnumerator ClearProximityNodes(List<Vector3> positionsToSearch, Vector3 positionToTravel, float radius) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) int count = positionsToSearch.Count; if (count == 0) { yield break; } for (int i = count - 1; i >= 0; i--) { if (Vector3.Distance(positionsToSearch[i], positionToTravel) <= radius) { positionsToSearch.RemoveAt(i); } yield return null; } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SmartAgentNavigator() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3922785661u, new RpcReceiveHandler(__rpc_handler_3922785661)); NetworkManager.__rpc_func_table.Add(3927833998u, new RpcReceiveHandler(__rpc_handler_3927833998)); } private static void __rpc_handler_3922785661(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool setOutside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setOutside, default(ForPrimitives)); NetworkBehaviourReference entranceTeleportReference = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref entranceTeleportReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartAgentNavigator)(object)target).SetThingOutsideServerRpc(setOutside, entranceTeleportReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3927833998(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool setOutside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setOutside, default(ForPrimitives)); NetworkBehaviourReference entranceTeleportReference = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref entranceTeleportReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SmartAgentNavigator)(object)target).SetThingOutsideClientRpc(setOutside, entranceTeleportReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SmartAgentNavigator"; } } } namespace CodeRebirthLib.Util.Attributes { [Serializable] public class AttributeStack<T> { [SerializeField] private T _baseValue; private bool _isDirty = true; private T _lastCalculated; private List<Func<T, T>> _stack = new List<Func<T, T>>(); public T BaseValue => _baseValue; public AttributeStack() { } public AttributeStack(T baseValue) { _baseValue = baseValue; } public Func<T, T> Add(Func<T, T> transformer) { _stack.Add(transformer); _isDirty = true; return transformer; } public void Remove(Func<T, T> transformer) { _stack.Remove(transformer); } public void MarkDirty() { _isDirty = true; } public T Calculate(bool forceRecalculate = false) { if (!_isDirty && !forceRecalculate) { return _lastCalculated; } T val = _baseValue; foreach (Func<T, T> item in _stack) { val = item(val); } _lastCalculated = val; _isDirty = false; return val; } } } namespace CodeRebirthLib.Patches { public static class DeleteFileButtonPatch { [CompilerGenerated] private static class <>O { public static hook_DeleteFile <0>__DeleteFileButton_DeleteFile; } public static void Init() { //IL_0010: 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_001b: Expected O, but got Unknown object obj = <>O.<0>__DeleteFileButton_DeleteFile; if (obj == null) { hook_DeleteFile val = DeleteFileButton_DeleteFile; <>O.<0>__DeleteFileButton_DeleteFile = val; obj = (object)val; } DeleteFileButton.DeleteFile += (hook_DeleteFile)obj; } private static void DeleteFileButton_DeleteFile(orig_DeleteFile orig, DeleteFileButton self) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown orig.Invoke(self); ES3Settings saveSettings = (ES3Settings)((!((Object)(object)NetworkSingleton<CodeRebirthLibNetworker>.Instance != (Object)null)) ? ((object)new ES3Settings($"CRLibLCSaveFile{self.fileToDelete + 1}", new Enum[1] { (Enum)(object)(EncryptionType)0 })) : ((object)NetworkSingleton<CodeRebirthLibNetworker>.Instance.SaveSettings)); CodeRebirthLibNetworker.ResetCodeRebirthLibData(saveSettings); } } internal static class EnemyAIPatch { [CompilerGenerated] private static class <>O { public static hook_Start <0>__EnemyAI_Start; public static hook_HitEnemy <1>__EnemyAI_HitEnemy; } public static void Init() { //IL_0010: 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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__EnemyAI_Start; if (obj == null) { hook_Start val = EnemyAI_Start; <>O.<0>__EnemyAI_Start = val; obj = (object)val; } EnemyAI.Start += (hook_Start)obj; object obj2 = <>O.<1>__EnemyAI_HitEnemy; if (obj2 == null) { hook_HitEnemy val2 = EnemyAI_HitEnemy; <>O.<1>__EnemyAI_HitEnemy = val2; obj2 = (object)val2; } EnemyAI.HitEnemy += (hook_HitEnemy)obj2; } private static void EnemyAI_Start(orig_Start orig, EnemyAI self) { orig.Invoke(self); CREnemyAdditionalData.CreateOrGet(self); } private static void EnemyAI_HitEnemy(orig_HitEnemy orig, EnemyAI self, int force, PlayerControllerB? playerWhoHit, bool playHitSFX, int hitID) { CREnemyAdditionalData cREnemyAdditionalData = CREnemyAdditionalData.CreateOrGet(self); if (Object.op_Implicit((Object)(object)playerWhoHit)) { cREnemyAdditionalData.PlayerThatLastHit = playerWhoHit; } if (!self.isEnemyDead && self.enemyHP - force <= 0 && (Object)(object)playerWhoHit != (Object)null) { cREnemyAdditionalData.KilledByPlayer = true; } orig.Invoke(self, force, playerWhoHit, playHitSFX, hitID); } } internal static class GameNetworkManagerPatch { [CompilerGenerated] private static class <>O { public static hook_Start <0>__GameNetworkManagerOnStart; public static hook_SaveItemsInShip <1>__GameNetworkManager_SaveItemsInShip; public static hook_ResetSavedGameValues <2>__GameNetworkManager_ResetSavedGameValues; } internal static void Init() { //IL_0010: 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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: 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) //IL_005b: Expected O, but got Unknown object obj = <>O.<0>__GameNetworkManagerOnStart; if (obj == null) { hook_Start val = GameNetworkManagerOnStart; <>O.<0>__GameNetworkManagerOnStart = val; obj = (object)val; } GameNetworkManager.Start += (hook_Start)obj; object obj2 = <>O.<1>__GameNetworkManager_SaveItemsInShip; if (obj2 == null) { hook_SaveItemsInShip val2 = GameNetworkManager_SaveItemsInShip; <>O.<1>__GameNetworkManager_SaveItemsInShip = val2; obj2 = (object)val2; } GameNetworkManager.SaveItemsInShip += (hook_SaveItemsInShip)obj2; object obj3 = <>O.<2>__GameNetworkManager_ResetSavedGameValues; if (obj3 == null) { hook_ResetSavedGameValues val3 = GameNetworkManager_ResetSavedGameValues; <>O.<2>__GameNetworkManager_ResetSavedGameValues = val3; obj3 = (object)val3; } GameNetworkManager.ResetSavedGameValues += (hook_ResetSavedGameValues)obj3; } private static void GameNetworkManagerOnStart(orig_Start orig, GameNetworkManager self) { orig.Invoke(self); VanillaEnemies.Init(); } private static void GameNetworkManager_SaveItemsInShip(orig_SaveItemsInShip orig, GameNetworkManager self) { orig.Invoke(self); CodeRebirthLibPlugin.ExtendedLogging("Saving CodeRebirthLibData"); NetworkSingleton<CodeRebirthLibNetworker>.Instance?.SaveCodeRebirthLibData(); } private static void GameNetworkManager_ResetSavedGameValues(orig_ResetSavedGameValues orig, GameNetworkManager self) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown orig.Invoke(self); ES3Settings saveSettings = (ES3Settings)((!((Object)(object)NetworkSingleton<CodeRebirthLibNetworker>.Instance != (Object)null)) ? ((object)new ES3Settings("CRLib" + GameNetworkManager.Instance.currentSaveFileName, new Enum[1] { (Enum)(object)(EncryptionType)0 })) : ((object)NetworkSingleton<CodeRebirthLibNetworker>.Instance.SaveSettings)); CodeRebirthLibNetworker.ResetCodeRebirthLibData(saveSettings); } } internal static class RoundManagerPatch { [CompilerGenerated] private static class <>O { public static hook_SpawnOutsideHazards <0>__SpawnOutsideMapObjects; } internal static List<RegisteredCRMapObject> registeredMapObjects = new List<RegisteredCRMapObject>(); internal static void Patch() { //IL_0010: 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_001b: Expected O, but got Unknown object obj = <>O.<0>__SpawnOutsideMapObjects; if (obj == null) { hook_SpawnOutsideHazards val = SpawnOutsideMapObjects; <>O.<0>__SpawnOutsideMapObjects = val; obj = (object)val; } RoundManager.SpawnOutsideHazards += (hook_SpawnOutsideHazards)obj; } private static void SpawnOutsideMapObjects(orig_SpawnOutsideHazards orig, RoundManager self) { orig.Invoke(self); Random random = new Random(StartOfRound.Instance.randomMapSeed + 69); foreach (RegisteredCRMapObject registeredMapObject in registeredMapObjects) { HandleSpawningOutsideMapObjects(registeredMapObject, random); } } private static void HandleSpawningOutsideMapObjects(RegisteredCRMapObject mapObjDef, Random random) { //IL_001d: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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_017f: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) SelectableLevel currentLevel = RoundManager.Instance.currentLevel; AnimationCurve val = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0f), new Keyframe(1f, 0f) }); GameObject prefabToSpawn = ((RegisteredMapObject)mapObjDef).outsideObject.spawnableObject.prefabToSpawn; val = ((RegisteredMapObject)mapObjDef).spawnRateFunction(currentLevel); int num2; if (mapObjDef.hasNetworkObject) { if (!NetworkManager.Singleton.IsServer) { return; } float num = val.Evaluate(Random.Range(0f, 1f)) + 0.5f; CodeRebirthLibPlugin.ExtendedLogging($"number generated for host only: {num}"); num2 = Mathf.FloorToInt(num); } else { float num3 = val.Evaluate(random.NextFloat(0f, 1f)) + 0.5f; CodeRebirthLibPlugin.ExtendedLogging("number generated for everyone: " + num3); num2 = Mathf.FloorToInt(num3); } CodeRebirthLibPlugin.ExtendedLogging($"Spawning {num2} of {((Object)prefabToSpawn).name} for level {currentLevel}"); RaycastHit val2 = default(RaycastHit); for (int i = 0; i < num2; i++) { Vector3 position; if (mapObjDef.hasNetworkObject) { position = RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length)].transform.position; position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), new Random(Random.Range(0, 10000)), -1, 1f) + Vector3.up * 2f; } else { position = RoundManager.Instance.outsideAINodes[random.Next(RoundManager.Instance.outsideAINodes.Length)].transform.position; position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random, -1, 1f) + Vector3.up * 2f; } if (Physics.Raycast(position, Vector3.down, ref val2, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider)) { GameObject val3 = Object.Instantiate<GameObject>(prefabToSpawn, ((RaycastHit)(ref val2)).point, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); CodeRebirthLibPlugin.ExtendedLogging($"Spawning {((Object)val3).name} at {((RaycastHit)(ref val2)).point}"); if (mapObjDef.alignWithTerrain) { val3.transform.up = ((RaycastHit)(ref val2)).normal; } if (mapObjDef.hasNetworkObject) { val3.GetComponent<NetworkObject>().Spawn(true); } } } } } internal static class StartOfRoundPatch { [CompilerGenerated] private static class <>O { public static hook_Start <0>__StartOfRoundOnStart; public static hook_SetPlanetsWeather <1>__RefreshEnemyWeights; public static hook_AutoSaveShipData <2>__StartOfRound_AutoSaveShipData; } internal static void Init() { //IL_0010: 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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: 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) //IL_005b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRoundOnStart; if (obj == null) { hook_Start val = StartOfRoundOnStart; <>O.<0>__StartOfRoundOnStart = val; obj = (object)val; } StartOfRound.Start += (hook_Start)obj; object obj2 = <>O.<1>__RefreshEnemyWeights; if (obj2 == null) { hook_SetPlanetsWeather