Decompiled source of WaitAnywhere v1.0.0

SODMod.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SODMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SODMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e27fa32a-6d9e-4e32-8dbd-c14138d3c479")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SODMod;

[BepInPlugin("seregado.sodmod", "SODMod", "1.0.0")]
public class Plugin : BasePlugin
{
	public const string PluginGuid = "seregado.sodmod";

	public const string PluginName = "SODMod";

	public const string PluginVersion = "1.0.0";

	internal static ManualLogSource Log;

	private Harmony _harmony;

	public override void Load()
	{
		//IL_0011: 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_0036: Expected O, but got Unknown
		Log = ((BasePlugin)this).Log;
		_harmony = new Harmony("seregado.sodmod");
		_harmony.PatchAll();
		ManualLogSource log = Log;
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SODMod");
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded!");
		}
		log.LogInfo(val);
	}
}
internal static class WaitAnywhere_HudMimic
{
	private const float ForTimeSeconds = 0.2f;

	private const string FallbackRawName = "Pass Time....";

	private static string _cachedRawName;

	internal static void ShowIfAvailable(bool available)
	{
		if (available)
		{
			ControlsDisplayController instance = ControlsDisplayController.Instance;
			if (instance != null)
			{
				instance.DisplayControlIcon((InteractionKey)2, GetRawInteractionName(), 0.2f, true);
			}
		}
	}

	private static string GetRawInteractionName()
	{
		if (_cachedRawName != null)
		{
			return _cachedRawName;
		}
		InteractionAction obj = FindPassTimeAction();
		_cachedRawName = ((obj != null) ? obj.interactionName : null) ?? "Pass Time....";
		return _cachedRawName;
	}

	private static InteractionAction FindPassTimeAction()
	{
		InteractablePreset cachedPreset = WaitAnywhere_State.CachedPreset;
		List<InteractableActionsPreset> val = ((cachedPreset != null) ? cachedPreset.actionsPreset : null);
		if (val == null)
		{
			return null;
		}
		Enumerator<InteractableActionsPreset> enumerator = val.GetEnumerator();
		while (enumerator.MoveNext())
		{
			InteractableActionsPreset current = enumerator.Current;
			if (!((SoCustomComparison)(object)current == (SoCustomComparison)null))
			{
				InteractionAction val2 = FindByActionName(current.lockedInActions1, "PassTime") ?? FindByActionName(current.lockedInActions2, "PassTime") ?? FindByActionName(current.actions, "PassTime");
				if (val2 != null)
				{
					return val2;
				}
			}
		}
		return null;
	}

	private static InteractionAction FindByActionName(List<InteractionAction> list, string actionName)
	{
		if (list == null)
		{
			return null;
		}
		Enumerator<InteractionAction> enumerator = list.GetEnumerator();
		while (enumerator.MoveNext())
		{
			InteractionAction current = enumerator.Current;
			if ((SoCustomComparison)(object)((current != null) ? current.action : null) != (SoCustomComparison)null && ((Object)current.action).name == actionName)
			{
				return current;
			}
		}
		return null;
	}
}
[HarmonyPatch(typeof(FirstPersonItemController), "SetFirstPersonItem")]
internal static class LogItemChange
{
	private static void Prefix(FirstPersonItem newItem)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Expected O, but got Unknown
		ManualLogSource log = Plugin.Log;
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(35, 2, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere: [");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now, "HH:mm:ss.fff");
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] item changed to '");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((newItem != null) ? ((Object)newItem).name : null);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
		}
		log.LogInfo(val);
		if (((newItem != null) ? newItem.actions : null) == null)
		{
			return;
		}
		Enumerator<FPSInteractionAction> enumerator = newItem.actions.GetEnumerator();
		while (enumerator.MoveNext())
		{
			FPSInteractionAction current = enumerator.Current;
			ManualLogSource log2 = Plugin.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(26, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere: [");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now, "HH:mm:ss.fff");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] action '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FPSInteractionAction>(current);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
			}
			log2.LogInfo(val);
		}
	}
}
[HarmonyPatch(typeof(ActionController), "PassTime")]
internal static class WaitAnywhere_LogPassTime
{
	private static void Prefix(Interactable what, NewNode where, Actor who)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		ManualLogSource log = Plugin.Log;
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 3, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere: PassTime called. what='");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((what != null) ? what.name : null);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' where='");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((where != null) ? where.name : null);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' who='");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((who != null) ? ((Object)who).name : null);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
		}
		log.LogInfo(val);
	}
}
[HarmonyPatch(typeof(Player), "Update")]
internal static class LogAllPlayerFields
{
	private static void Postfix(Player __instance)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		if (!Input.GetKeyDown((KeyCode)285))
		{
			return;
		}
		DumpProperties("Player.Instance", __instance, typeof(Player));
		InteractionController val = null;
		try
		{
			val = InteractionController.Instance;
		}
		catch (Exception ex)
		{
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(66, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("WaitAnywhere: не удалось получить InteractionController.Instance: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.GetType().Name);
			}
			log.LogInfo(val2);
		}
		if ((Object)(object)val != (Object)null)
		{
			DumpProperties("InteractionController.Instance", val, typeof(InteractionController));
		}
		else
		{
			Plugin.Log.LogInfo((object)"WaitAnywhere: InteractionController.Instance == null");
		}
	}

	private static void DumpProperties(string label, object instance, Type type)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Expected O, but got Unknown
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Expected O, but got Unknown
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Expected O, but got Unknown
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Expected O, but got Unknown
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Expected O, but got Unknown
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Expected O, but got Unknown
		ManualLogSource log = Plugin.Log;
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 2, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere: [");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now, "HH:mm:ss.fff");
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] === ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(label);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" dump ===");
		}
		log.LogInfo(val);
		PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
		foreach (PropertyInfo propertyInfo in properties)
		{
			if (propertyInfo.GetIndexParameters().Length != 0)
			{
				continue;
			}
			object value;
			try
			{
				value = propertyInfo.GetValue(instance);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(29, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere:   ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(propertyInfo.Name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" = <ошибка: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.GetType().Name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">");
				}
				log2.LogInfo(val);
				continue;
			}
			if (value is IEnumerable enumerable && !(value is string))
			{
				List<object> list = new List<object>();
				try
				{
					foreach (object item in enumerable)
					{
						list.Add(item);
					}
				}
				catch (Exception ex2)
				{
					ManualLogSource log3 = Plugin.Log;
					val = new BepInExInfoLogInterpolatedStringHandler(42, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere:   ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(propertyInfo.Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" = <ошибка при переборе: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex2.GetType().Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(">");
					}
					log3.LogInfo(val);
					continue;
				}
				ManualLogSource log4 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(26, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere:   ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(propertyInfo.Name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (count=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("):");
				}
				log4.LogInfo(val);
				foreach (object item2 in list)
				{
					ManualLogSource log5 = Plugin.Log;
					val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere:     - ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(item2);
					}
					log5.LogInfo(val);
				}
			}
			else
			{
				ManualLogSource log6 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(19, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere:   ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(propertyInfo.Name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" = ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(value);
				}
				log6.LogInfo(val);
			}
		}
		ManualLogSource log7 = Plugin.Log;
		val = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere: === конец дампа (");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(label);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") ===");
		}
		log7.LogInfo(val);
	}
}
internal static class WaitAnywhere_State
{
	internal static readonly Vector3 HiddenHome = new Vector3(0f, -500f, 0f);

	private const string ChairPresetName = "Chair";

	internal static InteractablePreset CachedPreset;

	internal static Interactable SpawnedProp;

	internal static bool InOurWaitSession;

	internal static void FindPreset()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		if ((SoCustomComparison)(object)CachedPreset != (SoCustomComparison)null)
		{
			return;
		}
		Toolbox instance = Toolbox.Instance;
		Dictionary<string, InteractablePreset> val = ((instance != null) ? instance.objectPresetDictionary : null);
		InteractablePreset val2 = default(InteractablePreset);
		if (val != null && val.TryGetValue("Chair", ref val2) && (SoCustomComparison)(object)val2 != (SoCustomComparison)null)
		{
			CachedPreset = val2;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(65, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("WaitAnywhere: found preset '");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("Chair");
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' via Toolbox.objectPresetDictionary.");
			}
			log.LogInfo(val3);
		}
	}

	internal static Interactable GetOrCreateProp()
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: 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_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_0047: 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_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		if (SpawnedProp != null)
		{
			return SpawnedProp;
		}
		if ((SoCustomComparison)(object)CachedPreset == (SoCustomComparison)null)
		{
			return null;
		}
		try
		{
			Interactable val = new Interactable(CachedPreset);
			val.OnCreate();
			val.name = "";
			val.save = false;
			bool flag = default(bool);
			val.SpawnObject(ref flag);
			val.SetNewPositionAndParent((Transform)null, HiddenHome, Vector3.zero, false);
			SpawnedProp = val;
			Plugin.Log.LogInfo((object)"WaitAnywhere: spawned our own hidden prop.");
			return SpawnedProp;
		}
		catch (Exception ex)
		{
			ManualLogSource log = Plugin.Log;
			bool flag2 = default(bool);
			BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(61, 1, ref flag2);
			if (flag2)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("WaitAnywhere: exception while spawning our own Interactable: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
			}
			log.LogError(val2);
			return null;
		}
	}

	internal static void ResetForNewSession()
	{
		CachedPreset = null;
		SpawnedProp = null;
		InOurWaitSession = false;
	}
}
[HarmonyPatch(typeof(SessionData), "OnSceneExit")]
internal static class WaitAnywhere_ResetOnSceneExit
{
	private static void Postfix()
	{
		WaitAnywhere_State.ResetForNewSession();
		Plugin.Log.LogInfo((object)"WaitAnywhere: session ended, reset cached prop.");
	}
}
internal static class WaitAnywhere_RotationFix
{
	internal struct Snapshot
	{
		internal Vector3 BodyEuler;

		internal Vector3 CamLocalEuler;

		internal Quaternion? CharTargetRot;

		internal Quaternion? CamTargetRot;
	}

	private static Snapshot? _pending;

	internal static Snapshot Capture(Player player)
	{
		//IL_0023: 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_004f: 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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		FirstPersonController fps = player.fps;
		MouseLook val = ((fps != null) ? fps.m_MouseLook : null);
		return new Snapshot
		{
			BodyEuler = ((Component)player).transform.eulerAngles,
			CamLocalEuler = (((Object)(object)player.cam != (Object)null) ? ((Component)player.cam).transform.localEulerAngles : Vector3.zero),
			CharTargetRot = ((val != null) ? new Quaternion?(val.m_CharacterTargetRot) : ((Quaternion?)null)),
			CamTargetRot = ((val != null) ? new Quaternion?(val.m_CameraTargetRot) : ((Quaternion?)null))
		};
	}

	internal static void Restore(Player player, Snapshot snapshot)
	{
		//IL_0007: 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_0061: 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)
		((Component)player).transform.eulerAngles = snapshot.BodyEuler;
		if ((Object)(object)player.cam != (Object)null)
		{
			((Component)player.cam).transform.localEulerAngles = snapshot.CamLocalEuler;
		}
		FirstPersonController fps = player.fps;
		MouseLook val = ((fps != null) ? fps.m_MouseLook : null);
		if (val != null)
		{
			if (snapshot.CharTargetRot.HasValue)
			{
				val.m_CharacterTargetRot = snapshot.CharTargetRot.Value;
			}
			if (snapshot.CamTargetRot.HasValue)
			{
				val.m_CameraTargetRot = snapshot.CamTargetRot.Value;
			}
		}
	}

	internal static void PrefixCapture(Interactable what)
	{
		_pending = (((Object)(object)Player.Instance != (Object)null) ? new Snapshot?(Capture(Player.Instance)) : ((Snapshot?)null));
	}

	internal static void PostfixRestore()
	{
		if (_pending.HasValue && !((Object)(object)Player.Instance == (Object)null))
		{
			Restore(Player.Instance, _pending.Value);
			_pending = null;
		}
	}
}
[HarmonyPatch(typeof(ActionController), "PassTime")]
internal static class WaitAnywhere_FixPassTimeRotation
{
	private static void Prefix(Interactable what)
	{
		WaitAnywhere_RotationFix.PrefixCapture(what);
	}

	private static void Postfix()
	{
		WaitAnywhere_RotationFix.PostfixRestore();
	}
}
[HarmonyPatch(typeof(ActionController), "ActivateTimePass")]
internal static class WaitAnywhere_FixActivateTimePassRotation
{
	private static void Prefix(Interactable what)
	{
		WaitAnywhere_RotationFix.PrefixCapture(what);
	}

	private static void Postfix()
	{
		WaitAnywhere_RotationFix.PostfixRestore();
	}
}
[HarmonyPatch(typeof(ActionController), "CancelPassTime")]
internal static class WaitAnywhere_FixCancelPassTimeRotation
{
	private static void Prefix(Interactable what)
	{
		WaitAnywhere_RotationFix.PrefixCapture(what);
	}

	private static void Postfix()
	{
		WaitAnywhere_RotationFix.PostfixRestore();
	}
}
[HarmonyPatch(typeof(Interactable), "GetName")]
internal static class WaitAnywhere_HideOwnPropName
{
	private static bool Prefix(Interactable __instance, ref string __result)
	{
		if (WaitAnywhere_State.SpawnedProp != null && __instance != null && ((Il2CppObjectBase)__instance).Pointer == ((Il2CppObjectBase)WaitAnywhere_State.SpawnedProp).Pointer)
		{
			__result = "Here";
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(Player), "Update")]
internal static class WaitAnywhere_Hotkey
{
	private static void Postfix(Player __instance)
	{
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Expected O, but got Unknown
		if (WaitAnywhere_State.InOurWaitSession)
		{
			InteractionController instance = InteractionController.Instance;
			if (((instance != null) ? instance.lockedInInteraction : null) == null && !__instance.transitionActive)
			{
				WaitAnywhere_State.InOurWaitSession = false;
			}
		}
		WaitAnywhere_State.FindPreset();
		WaitAnywhere_State.GetOrCreateProp();
		GameplayControls instance2 = GameplayControls.Instance;
		FirstPersonItem val = ((instance2 != null) ? instance2.watchItem : null);
		FirstPersonItemController instance3 = FirstPersonItemController.Instance;
		FirstPersonItem val2 = ((instance3 != null) ? instance3.currentItem : null);
		bool num = (SoCustomComparison)(object)val != (SoCustomComparison)null && (SoCustomComparison)(object)val2 != (SoCustomComparison)null && ((Object)val2).name == ((Object)val).name;
		InteractionController instance4 = InteractionController.Instance;
		bool flag = (Object)(object)instance4 != (Object)null && instance4.lockedInInteraction != null;
		bool flag2 = (Object)(object)instance4 != (Object)null && (Object)(object)instance4.currentInteractable != (Object)null;
		bool available = num && !flag && !flag2 && !__instance.transitionActive;
		if (num && (Object)(object)instance4 != (Object)null && instance4.lookingAtInteractable != flag2)
		{
			ManualLogSource log = Plugin.Log;
			bool flag3 = default(bool);
			BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(81, 2, ref flag3);
			if (flag3)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("WaitAnywhere: [avail-debug] lookingAtInteractable=");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(instance4.lookingAtInteractable);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" currentInteractable=");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>((Object)(object)instance4.currentInteractable != (Object)null);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" disagree.");
			}
			log.LogInfo(val3);
		}
		WaitAnywhere_HudMimic.ShowIfAvailable(available);
		if (Input.GetMouseButtonUp(1))
		{
			RunHotkey(__instance, available);
		}
	}

	private static void RunHotkey(Player __instance, bool available)
	{
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Expected O, but got Unknown
		//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_0034: 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_003c: 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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: 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_007a: Unknown result type (might be due to invalid IL or missing references)
		if (!available)
		{
			return;
		}
		try
		{
			Interactable orCreateProp = WaitAnywhere_State.GetOrCreateProp();
			if (orCreateProp == null)
			{
				Plugin.Log.LogWarning((object)"WaitAnywhere: no prop available yet.");
				return;
			}
			Vector3 position = ((Component)__instance).transform.position;
			Vector3 eulerAngles = ((Component)__instance).transform.eulerAngles;
			orCreateProp.SetNewPositionAndParent((Transform)null, position, eulerAngles, false);
			__instance.originalPlayerPosition = position;
			__instance.storedTransitionPosition = position;
			__instance.originalModPosition = position;
			NewNode currentNode = ((Actor)__instance).currentNode;
			WaitAnywhere_State.InOurWaitSession = true;
			ActionController.Instance.PassTime(orCreateProp, currentNode, (Actor)(object)__instance);
			orCreateProp.SetNewPositionAndParent((Transform)null, WaitAnywhere_State.HiddenHome, Vector3.zero, false);
		}
		catch (Exception ex)
		{
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(53, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WaitAnywhere: exception during direct PassTime call: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
			}
			log.LogError(val);
		}
	}
}