Decompiled source of MoreTerminalCommands v1.0.8

BepInEx/plugins/MoreTerminalCommands.dll

Decompiled 10 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalAPI.LibTerminal;
using LethalAPI.LibTerminal.Attributes;
using LethalAPI.LibTerminal.Models;
using MoreTerminalCommands.Lang;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreTerminalCommands")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreTerminalCommands")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a88846a7-2518-4d0d-afb9-79b6c8bdd97c")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.2.0")]
namespace MoreTerminalCommands
{
	public class LocalizationManager
	{
		private static ResourceManager resourceManager;

		public static Dictionary<string, Type> Languages = new Dictionary<string, Type>
		{
			{
				"en_us",
				typeof(en_US)
			},
			{
				"zh_cn",
				typeof(zh_CN)
			}
		};

		public static void SetLanguage(string language)
		{
			if (Languages.ContainsKey(language))
			{
				resourceManager = new ResourceManager(Languages[language]);
			}
			else
			{
				resourceManager = new ResourceManager(typeof(en_US));
			}
		}

		public static string TryGetString(string prefix, string key)
		{
			try
			{
				string @string = resourceManager.GetString(prefix + key);
				return (@string == null) ? key : @string.TrimEnd(Array.Empty<char>());
			}
			catch (Exception)
			{
				return key;
			}
		}

		public static string GetString(string key)
		{
			try
			{
				return resourceManager.GetString(key);
			}
			catch (Exception)
			{
				return "Missing translation for key: " + key;
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("cn.chuxiaaaa.plugin.MoreTerminalCommands", "MoreTerminalCommands", "1.0.8")]
	public class MoreTerminalCommandsPlugin : BaseUnityPlugin
	{
		private TerminalModRegistry Commands;

		public static ManualLogSource ManualLog = null;

		public static Dictionary<int, int> YRots = new Dictionary<int, int>();

		private ConfigEntry<string> LangugeConfig;

		public static bool Debug { get; set; }

		public DateTime cooldown { get; set; }

		private void Awake()
		{
			try
			{
				LangugeConfig = ((BaseUnityPlugin)this).Config.Bind<string>("config", "languge", "en_US", "mod languge");
				Harmony.CreateAndPatchAll(typeof(TerminalAccessibleObjectPatch), "cn.chuxiaaaa.plugin.MoreTerminalCommands");
				Harmony.CreateAndPatchAll(typeof(PlayerControllerBPatch3), "cn.chuxiaaaa.plugin.MoreTerminalCommands");
				Harmony.CreateAndPatchAll(typeof(PlayerControllerBPatch2), "cn.chuxiaaaa.plugin.MoreTerminalCommands");
				Harmony.CreateAndPatchAll(typeof(PlayerControllerBPatch), "cn.chuxiaaaa.plugin.MoreTerminalCommands");
				LocalizationManager.SetLanguage(LangugeConfig.Value);
				Commands = TerminalRegistry.CreateTerminalRegistry();
				Commands.RegisterFrom<MoreTerminalCommandsPlugin>(this);
				ManualLog = ((BaseUnityPlugin)this).Logger;
				((BaseUnityPlugin)this).Logger.LogInfo((object)"More Terminal Commands Loaded!");
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)ex.ToString());
			}
		}

		private static float CalculateLootValue()
		{
			List<GrabbableObject> source = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>()
				where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem"
				select obj).ToList();
			return source.Sum((GrabbableObject scrap) => scrap.scrapValue);
		}

		public void CollectObjectsOfType<T>(List<T> list, Predicate<T> predicate = null) where T : MonoBehaviour
		{
			T[] array = Object.FindObjectsOfType<T>();
			foreach (T val in array)
			{
				if (predicate == null || predicate(val))
				{
					list.Add(val);
				}
			}
		}

		public static Vector3 GetVec3ByString(string p_sVec3)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (p_sVec3.Length <= 0)
			{
				return Vector3.zero;
			}
			string[] array = p_sVec3.Trim(new char[1] { ' ' }).Split(new char[1] { ',' });
			if (array != null && array.Length == 3)
			{
				float num = float.Parse(array[0]);
				float num2 = float.Parse(array[1]);
				float num3 = float.Parse(array[2]);
				return new Vector3(num, num2, num3);
			}
			return Vector3.zero;
		}

		[TerminalCommand("Debug", false)]
		[CommandInfo("Layout Debug", "")]
		public string DebugCommand()
		{
			Debug = !Debug;
			return Debug.ToString();
		}

		[TerminalCommand("Load", false)]
		[CommandInfo("Load Layout From File", "")]
		public string Load(string name)
		{
			//IL_006f: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>()
				where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem"
				select obj).ToList();
			List<string> list2 = File.ReadAllLines(name + ".txt").ToList();
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			float carryWeight = localPlayerController.carryWeight;
			Vector3 localEulerAngles = ((Component)localPlayerController).transform.localEulerAngles;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("carryWeight:" + carryWeight));
			if ((Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null)
			{
				localPlayerController.DiscardHeldObject(false, (NetworkObject)null, new Vector3(0f, 0f, 0f), true);
			}
			try
			{
				foreach (GrabbableObject grabbableObject in list)
				{
					if (grabbableObject.isHeld || grabbableObject.isPocketed)
					{
						continue;
					}
					int index = 1;
					if (!dictionary.ContainsKey(grabbableObject.itemProperties.itemName))
					{
						dictionary.Add(grabbableObject.itemProperties.itemName, 1);
					}
					index = dictionary[grabbableObject.itemProperties.itemName];
					((BaseUnityPlugin)this).Logger.LogInfo((object)("index:" + index));
					int num = list2.FindIndex((string x) => x.StartsWith($"{grabbableObject.itemProperties.itemName}{index}="));
					string[] array = null;
					if (num > -1)
					{
						array = list2[num].Split(new char[1] { '=' })[1].Split(new char[1] { '|' });
						dictionary[grabbableObject.itemProperties.itemName]++;
					}
					else
					{
						num = list2.FindIndex((string x) => x.StartsWith(grabbableObject.itemProperties.itemName + "-1="));
						if (num > -1)
						{
							array = list2[num].Split(new char[1] { '=' })[1].Split(new char[1] { '|' });
						}
						else
						{
							num = list2.FindIndex((string x) => x.StartsWith("Other="));
							if (num > -1)
							{
								array = list2[num].Split(new char[1] { '=' })[1].Split(new char[1] { '|' });
							}
						}
					}
					if (array != null && array.Length != 0)
					{
						((BaseUnityPlugin)this).Logger.LogInfo((object)("v[0]:" + array[0] + "|v[1]:" + array[1]));
						Vector3 vec3ByString = GetVec3ByString(array[0]);
						if (!(((Component)grabbableObject).gameObject.transform.position == vec3ByString))
						{
							((Component)grabbableObject).gameObject.transform.position = vec3ByString;
							int num2 = int.Parse(array[1]);
							grabbableObject.floorYRot = num2;
							grabbableObject.targetFloorPosition = GetVec3ByString(array[1]);
							int instanceID = ((Object)((Component)grabbableObject).gameObject.GetComponent<NetworkObject>()).GetInstanceID();
							((BaseUnityPlugin)this).Logger.LogInfo((object)("key:" + instanceID + "," + num2));
							YRots.Add(instanceID, num2);
							grabbableObject.playerHeldBy = localPlayerController;
							localPlayerController.currentlyHeldObjectServer = grabbableObject;
							grabbableObject.EquipItem();
							localPlayerController.DiscardHeldObject(false, (NetworkObject)null, new Vector3(0f, 0f, 0f), true);
						}
					}
				}
			}
			catch (Exception innerException)
			{
				while (innerException != null)
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)innerException.ToString());
					innerException = innerException.InnerException;
				}
			}
			((Component)localPlayerController).transform.localEulerAngles = localEulerAngles;
			localPlayerController.carryWeight = carryWeight;
			return "ok!";
		}

		[TerminalCommand("Save", false)]
		[CommandInfo("Save Layout To File", "")]
		public string Save(string name)
		{
			//IL_006d: 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)
			List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>()
				where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem"
				select obj).ToList();
			StringBuilder stringBuilder = new StringBuilder();
			foreach (GrabbableObject item in list)
			{
				stringBuilder.AppendLine($"{item.itemProperties.itemName}={PositionToString(((Component)item).transform.position)}|{((Component)item).transform.localEulerAngles.y}");
			}
			List<string> list2 = stringBuilder.ToString().Split(new char[1] { '\n' }).ToList();
			list2.Sort();
			File.WriteAllLines(name, list2.ToArray());
			return "ok!";
		}

		public static string PositionToString(Vector3 postion)
		{
			return ((object)(Vector3)(ref postion)).ToString().Replace("(", "").Replace(")", "");
		}

		[TerminalCommand("dm", false)]
		[CommandInfo("查看所有机关(机枪、地雷、机械门)代码", "")]
		public string dm()
		{
			return Code();
		}

		[TerminalCommand("Code", false)]
		[CommandInfo("List the codes of turrets, mines, and mechanical doors", "")]
		public string Code()
		{
			StringBuilder stringBuilder = new StringBuilder();
			TerminalAccessibleObject[] array = Object.FindObjectsOfType<TerminalAccessibleObject>();
			for (int i = 0; i < array.Length; i++)
			{
				stringBuilder.AppendLine(array[i].objectCode + "|" + LocalizationManager.GetString(((Object)array[i]).name));
			}
			return stringBuilder.ToString();
		}

		[TerminalCommand("Lang", false)]
		[CommandInfo("Set Plugin Languge", "")]
		public string lang(string languge)
		{
			languge = languge.ToLower();
			if (languge != "en_us" && languge != "zh_cn")
			{
				return "unknow languge:" + languge;
			}
			LangugeConfig.Value = languge;
			LocalizationManager.SetLanguage(LangugeConfig.Value);
			((BaseUnityPlugin)this).Config.Save();
			return LocalizationManager.GetString("Lang") + ":" + languge;
		}

		[TerminalCommand("dr", false)]
		[CommandInfo("探测设施内的敌人(冷却时间120秒)", "")]
		public string dr()
		{
			return Enemy();
		}

		[TerminalCommand("Enemy", false)]
		[CommandInfo("Detect enemies within the facility, with a cooldown period of 120 seconds", "")]
		public string Enemy()
		{
			if (cooldown.AddSeconds(120.0) > DateTime.Now)
			{
				return string.Format("[{0}: {1} {2}.]", LocalizationManager.GetString("Cooldown"), (cooldown.AddSeconds(120.0) - DateTime.Now).TotalSeconds, LocalizationManager.GetString("sec"));
			}
			List<EnemyAI> list = new List<EnemyAI>();
			this.CollectObjectsOfType<EnemyAI>(list, (Predicate<EnemyAI>)null);
			StringBuilder stringBuilder = new StringBuilder();
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			foreach (EnemyAI item in list)
			{
				if (!item.isOutside && !item.isEnemyDead)
				{
					if (dictionary.ContainsKey(item.enemyType.enemyName))
					{
						dictionary[item.enemyType.enemyName]++;
					}
					else
					{
						dictionary.Add(item.enemyType.enemyName, 1);
					}
				}
			}
			if (dictionary.Count > 0)
			{
				stringBuilder.AppendLine("[" + LocalizationManager.GetString("Enemies") + "]");
				foreach (KeyValuePair<string, int> item2 in dictionary)
				{
					stringBuilder.AppendLine(LocalizationManager.TryGetString("enemy_", item2.Key) + ":" + item2.Value);
				}
				stringBuilder.AppendLine();
				stringBuilder.Append(LocalizationManager.GetString("enemy_tip1") ?? "");
			}
			else
			{
				stringBuilder.Append(LocalizationManager.GetString("enemy_tip2") ?? "");
			}
			cooldown = DateTime.Now;
			return stringBuilder.ToString();
		}

		[TerminalCommand("kd", false)]
		[CommandInfo("打开飞船的灯(只能打开,因为我不想看到来自终端的灯光秀)", "")]
		public string kd()
		{
			return LightOn();
		}

		[TerminalCommand("km", false)]
		[CommandInfo("打开或关闭飞船舱门(根据当前飞船舱门的状态决定)", "")]
		public string km()
		{
			return ShipDoor();
		}

		[TerminalCommand("wk", true)]
		[CommandInfo("将监视器切换到工作中的同事(在工厂内部的同事)", "")]
		public string wk()
		{
			return Work();
		}

		[TerminalCommand("Work", true)]
		[CommandInfo("Switch the monitor to colleagues who are working(colleagues in the factory)", "")]
		public string Work()
		{
			return WorkMethod(callFromSelf: false);
		}

		private string WorkMethod(bool callFromSelf)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)StartOfRound.Instance.mapScreen.radarTargets.Count);
			if (StartOfRound.Instance.mapScreen.radarTargets.Count > 1)
			{
				bool flag = false;
				for (int i = StartOfRound.Instance.mapScreen.targetTransformIndex + 1; i < StartOfRound.Instance.mapScreen.radarTargets.Count; i++)
				{
					if (!StartOfRound.Instance.mapScreen.radarTargets[i].isNonPlayer)
					{
						PlayerControllerB component = ((Component)StartOfRound.Instance.mapScreen.radarTargets[i].transform).gameObject.GetComponent<PlayerControllerB>();
						if ((Object)(object)component != (Object)null && component.isPlayerControlled && component.isInsideFactory)
						{
							flag = true;
							StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(i);
							break;
						}
					}
				}
				if (!flag)
				{
					StartOfRound.Instance.mapScreen.targetTransformIndex = 0;
					if (!callFromSelf)
					{
						WorkMethod(callFromSelf: true);
					}
					else
					{
						StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(StartOfRound.Instance.mapScreen.targetTransformIndex);
					}
				}
			}
			else
			{
				StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(0);
			}
			return "[" + LocalizationManager.GetString("Switch") + "]";
		}

		[TerminalCommand("LightOn", false)]
		[CommandInfo("Turn On The Light", "")]
		public string LightOn()
		{
			Object.FindObjectOfType<ShipLights>().SetShipLightsServerRpc(true);
			return "[" + LocalizationManager.GetString("ShipLight") + ":" + LocalizationManager.GetString("On") + "]";
		}

		[TerminalCommand("ShipDoor", false)]
		[CommandInfo("Open or Close the Ship Door", "")]
		public string ShipDoor()
		{
			GameObject gameObject = ((Component)Object.FindObjectOfType<HangarShipDoor>()).gameObject;
			string animation = "";
			if (StartOfRound.Instance.hangarDoorsClosed)
			{
				animation = "OpenDoor";
			}
			else
			{
				animation = "CloseDoor";
			}
			AnimatedObjectTrigger obj = gameObject.GetComponentsInChildren<AnimatedObjectTrigger>().First((AnimatedObjectTrigger trigger) => trigger.animationString == animation);
			if (obj != null)
			{
				((UnityEvent<PlayerControllerB>)(object)((Component)obj).GetComponentInParent<InteractTrigger>().onInteract).Invoke(GameNetworkManager.Instance?.localPlayerController);
			}
			return "[" + LocalizationManager.GetString("ShipDoor") + ":" + ((!StartOfRound.Instance.hangarDoorsClosed) ? LocalizationManager.GetString("Close") : LocalizationManager.GetString("Open")) + "]";
		}

		private string TeleportMethod(bool Inverse)
		{
			ShipTeleporter[] source = Object.FindObjectsOfType<ShipTeleporter>();
			ShipTeleporter val = source.Where((ShipTeleporter x) => x.isInverseTeleporter == Inverse).FirstOrDefault();
			if ((Object)(object)val == (Object)null)
			{
				return "[Has 0 " + (Inverse ? LocalizationManager.GetString("Inverse") : "") + LocalizationManager.GetString("Teleporter") + "]";
			}
			float num = (float)typeof(ShipTeleporter).GetField("cooldownTime", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val);
			if (num > 0f)
			{
				return string.Format("[{0}: {1} {2}.]", LocalizationManager.GetString("Cooldown"), num, LocalizationManager.GetString("sec"));
			}
			val.PressTeleportButtonOnLocalClient();
			return "[" + LocalizationManager.GetString("Teleport") + "]";
		}

		[TerminalCommand("zj", false)]
		[CommandInfo("计算当前飞船内的物品价值", "")]
		public string zj()
		{
			return ShipLoot();
		}

		[TerminalCommand("ShipLoot", false)]
		[CommandInfo("Calculate Loot Value In Ship", "")]
		public string ShipLoot()
		{
			return string.Format("[{0}:{1}]", LocalizationManager.GetString("ShipLoot"), CalculateLootValue());
		}

		[TerminalCommand("Teleport", false)]
		[CommandInfo("Teleport the player displayed on the current monitor", "")]
		public string Teleport()
		{
			return TeleportMethod(Inverse: false);
		}

		[TerminalCommand("pl", false)]
		[CommandInfo("显示玩家列表(死亡、是否在飞船)", "")]
		public string pl()
		{
			return Player();
		}

		[TerminalCommand("Player", false)]
		[CommandInfo("Show the players info(death or inship)", "")]
		public string Player()
		{
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			this.CollectObjectsOfType<PlayerControllerB>(list, (Predicate<PlayerControllerB>)null);
			list = list.Where((PlayerControllerB x) => !x.disconnectedMidGame && !x.playerUsername.Contains("Player #")).ToList();
			int num = 0;
			int num2 = 0;
			int count = list.Count;
			foreach (PlayerControllerB item in list)
			{
				if (item.isPlayerDead)
				{
					num2++;
				}
				else if (item.isInHangarShipRoom)
				{
					num++;
				}
			}
			return string.Format("[{0}]{1}[{2}]: {3}/{4}{5}[{6}]: {7}/{8}", LocalizationManager.GetString("Players"), Environment.NewLine, LocalizationManager.GetString("inShip"), num, count, Environment.NewLine, LocalizationManager.GetString("death"), num2, count);
		}

		[TerminalCommand("tp", false)]
		[CommandInfo("teleport the player displayed on the current monitor", "")]
		public string tp()
		{
			return Teleport();
		}

		[TerminalCommand("Teleport2", false)]
		[CommandInfo("Inverse Teleporter", "")]
		public string Teleport2()
		{
			return TeleportMethod(Inverse: true);
		}

		[TerminalCommand("tp2", false)]
		[CommandInfo("Inverse Teleporter", "")]
		public string tp2()
		{
			return Teleport2();
		}
	}
	[HarmonyPatch(typeof(TerminalAccessibleObject), "CallFunctionFromTerminal")]
	public class TerminalAccessibleObjectPatch
	{
		public static bool call { get; set; }

		public static void Postfix(TerminalAccessibleObject __instance)
		{
			//IL_003a: 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)
			if (call)
			{
				return;
			}
			TerminalAccessibleObject[] array = Object.FindObjectsOfType<TerminalAccessibleObject>();
			TerminalAccessibleObject[] array2 = array;
			foreach (TerminalAccessibleObject val in array2)
			{
				if (((Object)val).name.Contains("Turret") && GetDistance(((Component)val).transform.position, ((Component)__instance).transform.position) < 10f)
				{
					call = true;
					val.CallFunctionFromTerminal();
					call = false;
				}
			}
		}

		public static float GetDistance(Vector3 pos1, Vector3 pos2)
		{
			//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)
			return (float)Math.Round(Vector3.Distance(pos1, pos2));
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
	public class PlayerControllerBPatch
	{
		public static bool Prefix(PlayerControllerB __instance, bool placeObject, NetworkObject parentObjectTo, Vector3 placePosition, bool matchRotationOfParent)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			MoreTerminalCommandsPlugin.ManualLog.LogInfo((object)$"DiscardHeldObject|placeObject:{placeObject}|parentObjectTo:{parentObjectTo}|placePosition:{placePosition}|matchRotationOfParent:{matchRotationOfParent}");
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "SetObjectAsNoLongerHeld")]
	public class PlayerControllerBPatch3
	{
		public static bool Prefix(bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, GrabbableObject dropObject, ref int floorYRot)
		{
			int instanceID = ((Object)((Component)dropObject).GetComponent<NetworkObject>()).GetInstanceID();
			MoreTerminalCommandsPlugin.ManualLog.LogInfo((object)("SetObjectAsNoLongerHeld:" + instanceID));
			if (MoreTerminalCommandsPlugin.YRots.ContainsKey(instanceID))
			{
				floorYRot = MoreTerminalCommandsPlugin.YRots[instanceID];
				MoreTerminalCommandsPlugin.ManualLog.LogInfo((object)("set floorYRot:" + floorYRot));
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "ThrowObjectServerRpc")]
	public class PlayerControllerBPatch2
	{
		public static bool Prefix(NetworkObjectReference grabbedObject, bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, ref int floorYRot)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			NetworkObject val = default(NetworkObject);
			if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null))
			{
				int instanceID = ((Object)val).GetInstanceID();
				MoreTerminalCommandsPlugin.ManualLog.LogInfo((object)("ThrowObjectServerRpc:" + instanceID));
				if (MoreTerminalCommandsPlugin.YRots.ContainsKey(instanceID))
				{
					floorYRot = MoreTerminalCommandsPlugin.YRots[instanceID];
					MoreTerminalCommandsPlugin.ManualLog.LogInfo((object)("set floorYRot:" + floorYRot));
					MoreTerminalCommandsPlugin.YRots.Remove(instanceID);
				}
			}
			MoreTerminalCommandsPlugin.ManualLog.LogInfo((object)$"ThrowObjectServerRpc|grabbedObject:{grabbedObject}|droppedInElevator:{droppedInElevator}|droppedInShipRoom:{droppedInShipRoom}|targetFloorPosition:{targetFloorPosition}|floorYRot:{floorYRot}");
			return true;
		}

		public static void Postfix(PlayerControllerB __instance, NetworkObjectReference grabbedObject, bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, int floorYRot)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			NetworkObject val = default(NetworkObject);
			if (MoreTerminalCommandsPlugin.Debug && __instance.playerClientId == StartOfRound.Instance.localPlayerController.playerClientId && ((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null))
			{
				typeof(HUDManager).GetMethod("AddChatMessage", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(HUDManager.Instance, new object[2]
				{
					MoreTerminalCommandsPlugin.PositionToString(((Component)val).transform.position) + "|" + floorYRot,
					((Object)((Component)val).gameObject).name
				});
			}
		}
	}
}
namespace MoreTerminalCommands.Lang
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class en_US
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("MoreTerminalCommands.Lang.en_US", typeof(en_US).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static string BigDoor_Clone_ => ResourceManager.GetString("BigDoor(Clone)", resourceCulture);

		internal static string Close => ResourceManager.GetString("Close", resourceCulture);

		internal static string Cooldown => ResourceManager.GetString("Cooldown", resourceCulture);

		internal static string death => ResourceManager.GetString("death", resourceCulture);

		internal static string Enemies => ResourceManager.GetString("Enemies", resourceCulture);

		internal static string enemy_tip1 => ResourceManager.GetString("enemy_tip1", resourceCulture);

		internal static string enemy_tip2 => ResourceManager.GetString("enemy_tip2", resourceCulture);

		internal static string inShip => ResourceManager.GetString("inShip", resourceCulture);

		internal static string Inverse => ResourceManager.GetString("Inverse", resourceCulture);

		internal static string Landmine => ResourceManager.GetString("Landmine", resourceCulture);

		internal static string Lang => ResourceManager.GetString("Lang", resourceCulture);

		internal static string On => ResourceManager.GetString("On", resourceCulture);

		internal static string Open => ResourceManager.GetString("Open", resourceCulture);

		internal static string Players => ResourceManager.GetString("Players", resourceCulture);

		internal static string sec => ResourceManager.GetString("sec", resourceCulture);

		internal static string ShipDoor => ResourceManager.GetString("ShipDoor", resourceCulture);

		internal static string ShipLight => ResourceManager.GetString("ShipLight", resourceCulture);

		internal static string ShipLoot => ResourceManager.GetString("ShipLoot", resourceCulture);

		internal static string Switch => ResourceManager.GetString("Switch", resourceCulture);

		internal static string Teleport => ResourceManager.GetString("Teleport", resourceCulture);

		internal static string Teleporter => ResourceManager.GetString("Teleporter", resourceCulture);

		internal static string TurretScript => ResourceManager.GetString("TurretScript", resourceCulture);

		internal en_US()
		{
		}
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class zh_CN
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("MoreTerminalCommands.Lang.zh_CN", typeof(zh_CN).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static string BigDoor_Clone_ => ResourceManager.GetString("BigDoor(Clone)", resourceCulture);

		internal static string Close => ResourceManager.GetString("Close", resourceCulture);

		internal static string Cooldown => ResourceManager.GetString("Cooldown", resourceCulture);

		internal static string death => ResourceManager.GetString("death", resourceCulture);

		internal static string Enemies => ResourceManager.GetString("Enemies", resourceCulture);

		internal static string enemy_Baboon_hawk => ResourceManager.GetString("enemy_Baboon hawk", resourceCulture);

		internal static string enemy_Blob => ResourceManager.GetString("enemy_Blob", resourceCulture);

		internal static string enemy_Bunker_Spider => ResourceManager.GetString("enemy_Bunker Spider", resourceCulture);

		internal static string enemy_Centipede => ResourceManager.GetString("enemy_Centipede", resourceCulture);

		internal static string enemy_Crawler => ResourceManager.GetString("enemy_Crawler", resourceCulture);

		internal static string enemy_Flowerman => ResourceManager.GetString("enemy_Flowerman", resourceCulture);

		internal static string enemy_ForestGiant => ResourceManager.GetString("enemy_ForestGiant", resourceCulture);

		internal static string enemy_Hoarding_bug => ResourceManager.GetString("enemy_Hoarding bug", resourceCulture);

		internal static string enemy_Jester => ResourceManager.GetString("enemy_Jester", resourceCulture);

		internal static string enemy_Manticoil => ResourceManager.GetString("enemy_Manticoil", resourceCulture);

		internal static string enemy_Masked => ResourceManager.GetString("enemy_Masked", resourceCulture);

		internal static string enemy_MouthDog => ResourceManager.GetString("enemy_MouthDog", resourceCulture);

		internal static string enemy_Nutcracker => ResourceManager.GetString("enemy_Nutcracker", resourceCulture);

		internal static string enemy_Puffer => ResourceManager.GetString("enemy_Puffer", resourceCulture);

		internal static string enemy_Red_Locust_Bees => ResourceManager.GetString("enemy_Red Locust Bees", resourceCulture);

		internal static string enemy_Spring => ResourceManager.GetString("enemy_Spring", resourceCulture);

		internal static string enemy_tip1 => ResourceManager.GetString("enemy_tip1", resourceCulture);

		internal static string enemy_tip2 => ResourceManager.GetString("enemy_tip2", resourceCulture);

		internal static string inShip => ResourceManager.GetString("inShip", resourceCulture);

		internal static string Inverse => ResourceManager.GetString("Inverse", resourceCulture);

		internal static string Landmine => ResourceManager.GetString("Landmine", resourceCulture);

		internal static string Lang => ResourceManager.GetString("Lang", resourceCulture);

		internal static string On => ResourceManager.GetString("On", resourceCulture);

		internal static string Open => ResourceManager.GetString("Open", resourceCulture);

		internal static string Players => ResourceManager.GetString("Players", resourceCulture);

		internal static string sec => ResourceManager.GetString("sec", resourceCulture);

		internal static string ShipDoor => ResourceManager.GetString("ShipDoor", resourceCulture);

		internal static string ShipLight => ResourceManager.GetString("ShipLight", resourceCulture);

		internal static string ShipLoot => ResourceManager.GetString("ShipLoot", resourceCulture);

		internal static string Switch => ResourceManager.GetString("Switch", resourceCulture);

		internal static string Teleport => ResourceManager.GetString("Teleport", resourceCulture);

		internal static string Teleporter => ResourceManager.GetString("Teleporter", resourceCulture);

		internal static string TurretScript => ResourceManager.GetString("TurretScript", resourceCulture);

		internal zh_CN()
		{
		}
	}
}