using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("happyness.CruiserLoader")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("CruiserLoader")] [assembly: AssemblyTitle("happyness.CruiserLoader")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 CruiserLoader { [BepInPlugin("happyness.CruiserLoader", "CruiserLoader", "0.1.0")] public class CruiserLoader : BaseUnityPlugin { public static CruiserLoader Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static ConfigFile ItemZoneConfig { get; private set; } private void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; ItemZoneConfig = new ConfigFile(Paths.ConfigPath + "/CruiserLoader/Items.cfg", true); new Harmony("happyness.CruiserLoader").PatchAll(); Log.LogInfo((object)"happyness.CruiserLoader v0.1.0 loaded successfully!"); } public static void DisplayTip(string title, string msg, bool isWarning = false) { HUDManager.Instance.DisplayTip(title, msg, isWarning, false, "LC_Tip1"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "happyness.CruiserLoader"; public const string PLUGIN_NAME = "CruiserLoader"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace CruiserLoader.Patches { [HarmonyPatch(typeof(HUDManager), "AddTextToChatOnServer")] public static class CaptureCommand { private const float timeout = 2f; [HarmonyPrefix] public unsafe static bool Prefix(string chatMessage) { //IL_013f: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(chatMessage) && chatMessage.StartsWith(".cload")) { CruiserLoader.Log.LogInfo((object)"[CL] Prefix intercepted .cload"); } if (string.IsNullOrEmpty(chatMessage)) { return true; } if (!chatMessage.StartsWith(".cload")) { return true; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return false; } VehicleController val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { CruiserLoader.DisplayTip("CruiserLoader", "Buy a cruiser first!\nBAKA!"); return false; } if (!NetworkManager.Singleton.IsHost) { if (NetworkManager.Singleton.CustomMessagingManager == null) { CruiserLoader.DisplayTip("CruiserLoader", "Network issue: CustomMessagingManager unavailable"); return false; } MSGHandlers.RegisterHandlers(); MSGHandlers.pendingVerification = true; MSGHandlers.verificationReceived = false; FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(512, (Allocator)2, -1); try { ((FastBufferWriter)(ref val2)).WriteValueSafe(chatMessage, false); CruiserLoader.Log.LogInfo((object)("Sending command to host: " + chatMessage)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("CLC", 0uL, val2, (NetworkDelivery)3); VeriRunner.Instance.WaitThen(2f, delegate { if (MSGHandlers.pendingVerification && !MSGHandlers.verificationReceived) { CruiserLoader.DisplayTip("CruiserLoader", "Host does not have\nCruiser Loader installed!"); MSGHandlers.pendingVerification = false; } }); return false; } finally { ((IDisposable)(*(FastBufferWriter*)(&val2))/*cast due to .constrained prefix*/).Dispose(); } } string text = ExecuteCommand(chatMessage, localPlayerController, val); if (!string.IsNullOrEmpty(text)) { CruiserLoader.DisplayTip("CruiserLoader", text); MSGHandlers.SendMSGToClients(text); } return false; } private static string ExecuteCommand(string chatMessage, PlayerControllerB player, VehicleController cruiser) { string[] array = chatMessage.Trim().Split(' '); if (array.Length == 1) { return CruiserZoneManager.MoveItemsToCruiser(cruiser); } if (array.Length == 3) { string value = array[1].ToLower(); if (!int.TryParse(array[2], out var result) || result <= 0) { return string.Empty; } string text = null; foreach (string key in CruiserLoadPatch.ItemZoneConfig.Keys) { if (key.ToLower().Contains(value)) { text = key; break; } } if (text == null) { return string.Empty; } return CruiserZoneManager.MoveItemsToCruiser(cruiser, text, result); } if (array.Length == 4) { string value2 = array[1].ToLower(); if (!int.TryParse(array[2], out var result2) || result2 <= 0) { return string.Empty; } string text2 = array[3].ToUpper(); if (!CruiserPositions.Zones.ContainsKey(text2)) { return "Invalid zone: " + text2; } string text3 = null; foreach (string key2 in CruiserLoadPatch.ItemZoneConfig.Keys) { if (key2.ToLower().Contains(value2)) { text3 = key2; break; } } if (text3 == null) { return string.Empty; } return CruiserZoneManager.MoveItemsToCruiser(cruiser, text3, result2, text2); } return string.Empty; } } [HarmonyPatch(typeof(StartOfRound))] internal class CruiserLoadPatch { internal static Dictionary> ItemZoneConfig = new Dictionary>(); internal static Dictionary> ItemCountConfig = new Dictionary>(); [HarmonyPatch("LoadShipGrabbableItems")] [HarmonyPrefix] internal static void PatchLogic() { CruiserPositions.PositionsDictionary.Clear(); CruiserPositions.ZoneAllocated.Clear(); CruiserPositions.Zones.Clear(); CruiserPositions.CreateZones(); PopulateItemConfig(); TranslateDictionaries(); NetworkHelper(); } [HarmonyPatch("Start")] [HarmonyPrefix] internal static void Prefix() { NetworkHelper(); } internal static void NetworkHelper() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (!((Object)(object)NetworkManager.Singleton == (Object)null) && NetworkManager.Singleton.IsHost && !((Object)(object)CruiserLoaderNetworkHandler.Instance != (Object)null)) { CruiserLoader.Log.LogInfo((object)"Creating network handler on host..."); GameObject val = new GameObject("CruiserLoaderNetworkHandler"); val.AddComponent(); } } internal static void PopulateItemConfig() { List itemsList = StartOfRound.Instance.allItemsList.itemsList; Dictionary dictionary = new Dictionary { { "Radar-booster", "D2" }, { "Kitchen knife", "F2" }, { "Shovel", "A2" }, { "Shotgun", "A3" }, { "Ammo", "B3" }, { "Weed killer", "D1" }, { "Key", "E2" }, { "Extension ladder", "D3" }, { "Lockpicker", "G2" }, { "TZP-Inhalant", "F3" }, { "Boombox", "C2" } }; Dictionary dictionary2 = new Dictionary { { "Radar-booster", 1 }, { "Kitchen knife", 3 }, { "Shotgun", 2 }, { "Weed killer", 15 }, { "TZP-Inhalant", 15 } }; foreach (Item item in itemsList) { if ((!item.isScrap || item.itemName.Equals("Kitchen knife") || item.itemName.Equals("Shotgun")) && !(item.itemName == "Binoculars") && !(item.itemName == "box") && !(item.itemName == "Mapper")) { string valueOrDefault = dictionary.GetValueOrDefault(item.itemName, ""); int valueOrDefault2 = dictionary2.GetValueOrDefault(item.itemName, 5); ItemZoneConfig[item.itemName] = CruiserLoader.ItemZoneConfig.Bind("Items", item.itemName, valueOrDefault, "Set cruiser zone for " + item.itemName + ". Leave empty to not move. (e.g. A1, B2, C3)"); ItemCountConfig[item.itemName] = CruiserLoader.ItemZoneConfig.Bind("ItemCounts", item.itemName, valueOrDefault2, "How many " + item.itemName + " to move to cruiser."); } } } internal static void TranslateDictionaries() { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair> item in ItemZoneConfig) { string value = item.Value.Value; if (string.IsNullOrEmpty(value) || !CruiserPositions.Zones.ContainsKey(value)) { continue; } if (CruiserPositions.PositionsDictionary.ContainsKey(item.Key)) { Vector3 oldPosition = CruiserPositions.PositionsDictionary[item.Key]; string key = CruiserPositions.Zones.First>((KeyValuePair kv) => kv.Value == oldPosition).Key; CruiserPositions.ZoneAllocated[key] = Math.Max(0, CruiserPositions.ZoneAllocated.GetValueOrDefault(key, 0) - 1); if (CruiserPositions.ZoneAllocated[key] == 0) { CruiserPositions.ZoneAllocated.Remove(key); } CruiserPositions.PositionsDictionary.Remove(item.Key); } CruiserPositions.PositionsDictionary[item.Key] = CruiserPositions.Zones[value]; CruiserPositions.ZoneAllocated[value] = CruiserPositions.ZoneAllocated.GetValueOrDefault(value, 0) + 1; } } } internal static class CruiserZoneManager { internal static string MoveItemsToCruiser(VehicleController cruiser, string? onlyItem = null, int overrideCount = -1, string? overrideZone = null) { //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null) { return string.Empty; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return string.Empty; } bool flag = (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsHost; CruiserPositions.ResetPlacedCounts(); Dictionary dictionary = new Dictionary(); GrabbableObject[] componentsInChildren = ((Component)cruiser).GetComponentsInChildren(); GrabbableObject[] array = componentsInChildren; foreach (GrabbableObject val2 in array) { if (!val2.itemProperties.isScrap) { string itemName = val2.itemProperties.itemName; dictionary[itemName] = dictionary.GetValueOrDefault(itemName, 0) + 1; } } Dictionary dictionary2 = new Dictionary(); GrabbableObject[] array2 = Object.FindObjectsOfType(); int num = 0; GrabbableObject[] array3 = array2; foreach (GrabbableObject val3 in array3) { if ((val3.itemProperties.isScrap && !val3.itemProperties.itemName.Equals("Kitchen knife") && !val3.itemProperties.itemName.Equals("Shotgun")) || (Object)(object)((Component)val3).transform.parent == (Object)null || (((Object)((Component)val3).transform.parent).name != "HangarShip" && ((Object)((Component)val3).transform.parent).name != "StorageCloset") || val3.isHeld || val3.isPocketed) { continue; } string itemName2 = val3.itemProperties.itemName; if ((onlyItem != null && itemName2 != onlyItem) || !CruiserPositions.PositionsDictionary.TryGetValue(itemName2, out var _)) { continue; } bool flag2 = false; int num2; if (overrideCount <= 0) { num2 = ((!CruiserLoadPatch.ItemCountConfig.TryGetValue(itemName2, out ConfigEntry value2)) ? 1 : value2.Value); } else { num2 = overrideCount; flag2 = true; } int valueOrDefault = dictionary.GetValueOrDefault(itemName2, 0); int num3 = (flag2 ? num2 : (num2 - valueOrDefault)); if (num3 <= 0) { continue; } dictionary2.TryGetValue(itemName2, out var value3); if (value3 >= num3) { continue; } string zoneName = ((overrideZone == null) ? CruiserLoadPatch.ItemZoneConfig[itemName2].Value : overrideZone); Vector3 nextZonePosition = CruiserPositions.GetNextZonePosition(zoneName); ((Component)val3).transform.SetParent(((Component)cruiser).transform, true); ((Component)val3).transform.localPosition = nextZonePosition; val3.fallTime = 1f; val3.reachedFloorTarget = true; val3.hasHitGround = true; val3.targetFloorPosition = nextZonePosition; val3.startFallingPosition = nextZonePosition; NetworkObject component = ((Component)cruiser).GetComponent(); try { val.PlaceObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val3).NetworkObject), NetworkObjectReference.op_Implicit(component), nextZonePosition, false); } catch (Exception ex) { CruiserLoader.Log.LogError((object)("Error calling RPC for " + itemName2 + ": " + ex.Message)); } if (flag) { Rigidbody component2 = ((Component)val3).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.position = ((Component)cruiser).transform.TransformPoint(nextZonePosition); component2.velocity = Vector3.zero; component2.angularVelocity = Vector3.zero; } Physics.SyncTransforms(); } dictionary2[itemName2] = value3 + 1; num++; } if (onlyItem != null && dictionary2.TryGetValue(onlyItem, out var value4)) { if (overrideZone != null) { return $"Moved {value4} {onlyItem} to {overrideZone}."; } return $"Moved {value4} {onlyItem} to cruiser."; } return $"Moved {num} items to cruiser."; } } public class CruiserLoaderNetworkHandler : MonoBehaviour { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnHostCommandReceived; } private bool registered; internal static CruiserLoaderNetworkHandler? Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } private void OnEnable() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown if (registered) { return; } if ((Object)(object)NetworkManager.Singleton == (Object)null) { CruiserLoader.Log.LogInfo((object)"[CL] NetworkManager not ready."); } else if (NetworkManager.Singleton.IsHost && NetworkManager.Singleton.CustomMessagingManager != null) { CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnHostCommandReceived; if (obj == null) { HandleNamedMessageDelegate val = OnHostCommandReceived; <>O.<0>__OnHostCommandReceived = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("CLC", (HandleNamedMessageDelegate)obj); registered = true; CruiserLoader.Log.LogInfo((object)"[CL] Registered CLC handler on host."); } else { CruiserLoader.Log.LogInfo((object)"[CL] CMM unavailable or not host when enabling handler."); } } private void OnDisable() { if (registered && (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.CustomMessagingManager != null) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("CLC"); registered = false; CruiserLoader.Log.LogInfo((object)"[CL] Unregistering CLC handler."); } if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private static void OnHostCommandReceived(ulong clientId, FastBufferReader reader) { if (!NetworkManager.Singleton.IsHost) { CruiserLoader.Log.LogInfo((object)"[CL] Received CLC on non-host, ignoring."); return; } SendVerificationResponse(clientId); string text = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); CruiserLoader.Log.LogInfo((object)$"[CL] Received from client {clientId}: {text}"); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } VehicleController val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { string text2 = "Cruiser not found!\nBAKA!"; CruiserLoader.DisplayTip("Cruiser Loader", text2); SendCommandResult(clientId, text2); return; } string text3 = ExecuteCommandOnHost(text, localPlayerController, val); if (!string.IsNullOrEmpty(text3)) { CruiserLoader.DisplayTip("CruiserLoader", text3); SendCommandResult(clientId, text3); } } private unsafe static void SendVerificationResponse(ulong clientId) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if (((singleton != null) ? singleton.CustomMessagingManager : null) == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe("CLVR_OK", false); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("CLVR", clientId, val, (NetworkDelivery)3); CruiserLoader.Log.LogInfo((object)$"[CL] Verifi sent to ID: {clientId}."); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private unsafe static void SendCommandResult(ulong clientId, string result) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if (((singleton != null) ? singleton.CustomMessagingManager : null) == null || string.IsNullOrEmpty(result)) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(512, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(result, false); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("CLTR", clientId, val, (NetworkDelivery)3); CruiserLoader.Log.LogInfo((object)$"[CL] Response sent to ID: {clientId}"); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static string? ExecuteCommandOnHost(string chatMessage, PlayerControllerB player, VehicleController cruiser) { string[] array = chatMessage.Trim().Split(' '); if (array.Length == 1) { return CruiserZoneManager.MoveItemsToCruiser(cruiser); } if (array.Length == 3) { string value = array[1].ToLower(); if (!int.TryParse(array[2], out var result) || result <= 0) { return null; } string text = null; foreach (string key in CruiserLoadPatch.ItemZoneConfig.Keys) { if (key.ToLower().Contains(value)) { text = key; break; } } if (text == null) { return null; } return CruiserZoneManager.MoveItemsToCruiser(cruiser, text, result); } if (array.Length == 4) { string value2 = array[1].ToLower(); if (!int.TryParse(array[2], out var result2) || result2 <= 0) { return null; } string text2 = array[3].ToUpper(); if (!CruiserPositions.Zones.ContainsKey(text2)) { return "Invalid zone: " + text2; } string text3 = null; foreach (string key2 in CruiserLoadPatch.ItemZoneConfig.Keys) { if (key2.ToLower().Contains(value2)) { text3 = key2; break; } } if (text3 == null) { return null; } return CruiserZoneManager.MoveItemsToCruiser(cruiser, text3, result2, text2); } return null; } } internal static class CruiserPositions { internal static Dictionary Zones = new Dictionary(); internal static Dictionary PositionsDictionary = new Dictionary(); internal static Dictionary ZoneAllocated = new Dictionary(); internal static Dictionary ZonePlacedCount = new Dictionary(); private static readonly HashSet ZStackZones = new HashSet { "A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3", "E1", "E2", "E3", "F1", "F2", "F3", "G1", "G2", "G3" }; private static readonly HashSet XStackZonesPositive = new HashSet { "D1" }; private static readonly HashSet XStackZonesNegative = new HashSet { "D3" }; internal static void CreateZones() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) Zones.Clear(); Zones["A1"] = new Vector3(-1.15f, -0.4f, -2.6f); Zones["A2"] = new Vector3(-1.15f, 0.46f, -2.6f); Zones["A3"] = new Vector3(-1.15f, 1.22f, -2.6f); Zones["B1"] = new Vector3(-1.15f, -0.4f, -1.7f); Zones["B2"] = new Vector3(-1.15f, 0.46f, -1.7f); Zones["B3"] = new Vector3(-1.15f, 1.22f, -1.7f); Zones["C1"] = new Vector3(-1.15f, -0.4f, -0.8f); Zones["C2"] = new Vector3(-1.15f, 0.46f, -0.8f); Zones["C3"] = new Vector3(-1.15f, 1.22f, -0.8f); Zones["D1"] = new Vector3(-0.91f, 0f, 0.3f); Zones["D2"] = new Vector3(0f, -0.5f, -0.55f); Zones["D3"] = new Vector3(0.82f, 0f, 0.3f); Zones["E1"] = new Vector3(1.15f, -0.4f, -2.6f); Zones["E2"] = new Vector3(1.15f, 0.46f, -2.6f); Zones["E3"] = new Vector3(1.15f, 1.22f, -2.6f); Zones["F1"] = new Vector3(1.15f, -0.4f, -1.7f); Zones["F2"] = new Vector3(1.15f, 0.46f, -1.7f); Zones["F3"] = new Vector3(1.15f, 1.22f, -1.7f); Zones["G1"] = new Vector3(1.15f, -0.4f, -0.8f); Zones["G2"] = new Vector3(1.15f, 0.46f, -0.8f); Zones["G3"] = new Vector3(1.15f, 1.22f, -0.8f); } internal static Vector3 GetNextZonePosition(string zoneName) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c6: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Zones[zoneName]; int valueOrDefault = ZonePlacedCount.GetValueOrDefault(zoneName, 0); int num = valueOrDefault % 5; ZonePlacedCount[zoneName] = valueOrDefault + 1; if (ZStackZones.Contains(zoneName)) { return new Vector3(val.x, val.y, val.z + (float)num * 0.1f); } if (XStackZonesPositive.Contains(zoneName)) { return new Vector3(val.x + (float)num * 0.1f, val.y, val.z); } if (XStackZonesNegative.Contains(zoneName)) { return new Vector3(val.x - (float)num * 0.1f, val.y, val.z); } return val; } internal static void ResetPlacedCounts() { ZonePlacedCount.Clear(); } } public static class MSGHandlers { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnVerificationResponse; public static HandleNamedMessageDelegate <1>__OnMSGReceived; } public static bool pendingVerification; public static bool verificationReceived; public static bool messageHandlersOK; public unsafe static void SendMSGToClients(string result) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if (((singleton != null) ? singleton.CustomMessagingManager : null) == null || string.IsNullOrEmpty(result)) { return; } FastBufferWriter val = default(FastBufferWriter); foreach (ulong connectedClientsId in NetworkManager.Singleton.ConnectedClientsIds) { if (connectedClientsId != 0) { ((FastBufferWriter)(ref val))..ctor(512, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(result, false); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("CLTR", connectedClientsId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } } } public static void OnVerificationReceived() { verificationReceived = true; CruiserLoader.Log.LogInfo((object)"[CL] Host verification OK."); pendingVerification = false; } public static void ResetVerificationState() { pendingVerification = false; verificationReceived = false; if (messageHandlersOK) { NetworkManager singleton = NetworkManager.Singleton; if (((singleton != null) ? singleton.CustomMessagingManager : null) != null) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("CLVR"); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("CLTR"); messageHandlersOK = false; CruiserLoader.Log.LogInfo((object)"[CL] Reset things on disconnect."); } } } public static void RegisterHandlers() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0078: 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: Expected O, but got Unknown if (messageHandlersOK) { return; } NetworkManager singleton = NetworkManager.Singleton; if (((singleton != null) ? singleton.CustomMessagingManager : null) != null) { CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnVerificationResponse; if (obj == null) { HandleNamedMessageDelegate val = OnVerificationResponse; <>O.<0>__OnVerificationResponse = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("CLVR", (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnMSGReceived; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnMSGReceived; <>O.<1>__OnMSGReceived = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("CLTR", (HandleNamedMessageDelegate)obj2); messageHandlersOK = true; CruiserLoader.Log.LogInfo((object)"[CL] Verification handlers OK."); } } public static void OnMSGReceived(ulong serverId, FastBufferReader reader) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) FastBufferReader val = reader; string text = default(string); ((FastBufferReader)(ref val)).ReadValueSafe(ref text, false); if (!string.IsNullOrEmpty(text)) { CruiserLoader.DisplayTip("CruiserLoader", text); } } public static void OnVerificationResponse(ulong serverId, FastBufferReader reader) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) FastBufferReader val = reader; string text = default(string); ((FastBufferReader)(ref val)).ReadValueSafe(ref text, false); if (text == "CLVR_OK") { OnVerificationReceived(); } } } [HarmonyPatch(typeof(StartOfRound), "Start")] public static class RegisterVerificationHandlersOnStart { [HarmonyPostfix] public static void Postfix() { if (!((Object)(object)NetworkManager.Singleton == (Object)null) && !NetworkManager.Singleton.IsHost) { MSGHandlers.RegisterHandlers(); } } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] public static class ResetVerificationOnDisconnect { [HarmonyPostfix] public static void Postfix() { MSGHandlers.ResetVerificationState(); } } public class VeriRunner : MonoBehaviour { private static VeriRunner? _instance; public static VeriRunner Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("VeriRunner"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent(); } return _instance; } } public void WaitThen(float seconds, Action onTimeout) { ((MonoBehaviour)this).StartCoroutine(WaitCoroutine(seconds, onTimeout)); } private IEnumerator WaitCoroutine(float seconds, Action onTimeout) { yield return (object)new WaitForSecondsRealtime(seconds); try { onTimeout?.Invoke(); } catch (Exception ex) { Exception ex2 = ex; CruiserLoader.Log.LogError((object)("[CL] Verification runner callback error: " + ex2.Message)); } } } }