Decompiled source of Talking Death Heads v0.0.18

TalkinDeathHeads.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RepoModding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RepoModding")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("D8F49D33-43C7-40F7-94EE-293BEFDA9C3A")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RepoModding
{
	[BepInPlugin("com.valkyriebae.TalkingDeathHeadsMod", "Talking Death Heads", "0.0.15")]
	public class ValRepoMod : BaseUnityPlugin
	{
		public class TalkingDeathHeadsMod : MonoBehaviour, IPunObservable
		{
			private bool IsEnabled = true;

			private bool IsLobby = true;

			private PlayerAvatar _playerAvatar;

			public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
			{
				throw new NotImplementedException();
			}

			private void Awake()
			{
				_playerAvatar = ((Component)this).gameObject.GetComponent<PlayerAvatar>();
			}

			public bool GetIsEnabled()
			{
				return IsEnabled;
			}

			public void LocalSetLobbyToggle(bool SetIsLobby)
			{
				if (IsLobby != SetIsLobby)
				{
					SetLobbyToggleRPC(SetIsLobby);
					if (GameManager.Multiplayer())
					{
						PlayerAvatar.instance.photonView.RPC("SetLobbyToggleRPC", (RpcTarget)1, new object[1] { SetIsLobby });
					}
				}
			}

			[PunRPC]
			public void SetLobbyToggleRPC(bool SetIsLobby)
			{
				IsLobby = SetIsLobby;
			}

			public void LocalSetIsEnabled(bool SetIsEnabled)
			{
				if (IsEnabled != SetIsEnabled)
				{
					SetTalkingDeathHeadRPC(SetIsEnabled);
					if (GameManager.Multiplayer())
					{
						PlayerAvatar.instance.photonView.RPC("SetTalkingDeathHeadRPC", (RpcTarget)1, new object[1] { SetIsEnabled });
					}
				}
			}

			[PunRPC]
			public void SetTalkingDeathHeadRPC(bool SetIsEnabled)
			{
				IsEnabled = SetIsEnabled;
				if (_playerAvatar.GetPrivateField<bool>("isDisabled") && (SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()))
				{
					_playerAvatar.GetPrivateField<PlayerVoiceChat>("voiceChat").ToggleLobby(!IsEnabled);
				}
			}
		}

		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Talking Death Heads loaded!");
			new Harmony("com.valkyriebae.TalkingDeathHeadsMod").PatchAll();
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "Update")]
	public static class PlayerAvatar_Update_Transpiler_Patch
	{
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Callvirt && list[i].operand != null && list[i].operand.ToString().Contains("ToggleLobby"))
				{
					list[i - 1] = new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
					break;
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar))]
	public static class PlayerAvatarPatches
	{
		private static string _playerName = "Wait, who is this?";

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Start_Postfix(ref bool ___isLocal, PlayerAvatar? __instance)
		{
			if (___isLocal)
			{
				_playerName = __instance.GetPrivateField<string>("playerName");
			}
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Awake_Postfix(ref PhotonView ___photonView, PlayerAvatar __instance)
		{
			((Component)__instance).gameObject.AddComponent<ValRepoMod.TalkingDeathHeadsMod>();
		}

		[HarmonyPatch("PlayerDeathDone")]
		[HarmonyPostfix]
		public static void PlayerDeathDone_Postfix(ref bool ___isLocal, PlayerAvatar __instance)
		{
			if (__instance.GetPrivateField<bool>("isLocal"))
			{
				SemiFunc.HUDSpectateSetName(_playerName);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void Update_Postfix(ref bool ___deadSet, PlayerAvatar __instance)
		{
			if (SemiFunc.MenuLevel())
			{
				((Component)PlayerAvatar.instance).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().LocalSetIsEnabled(SetIsEnabled: true);
			}
		}

		[HarmonyPatch("ReviveRPC")]
		[HarmonyPostfix]
		public static void ReviveRPC_Postfix(PlayerAvatar __instance)
		{
			((Component)__instance).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().SetTalkingDeathHeadRPC(SetIsEnabled: true);
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	public static class RunManagerPatches
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void Start_Postfix(RunManager __instance)
		{
			if (SemiFunc.RunIsArena() && Object.op_Implicit((Object)(object)PlayerAvatar.instance))
			{
				((Component)PlayerAvatar.instance).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().LocalSetIsEnabled(SetIsEnabled: false);
			}
		}
	}
	[HarmonyPatch(typeof(MenuSpectateList))]
	public static class MenuSpectateListPatches
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void MenuSpectateList_Update_Postfix(MenuSpectateList __instance)
		{
			if (Object.op_Implicit((Object)(object)PlayerAvatar.instance) && ((Component)PlayerAvatar.instance).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().GetIsEnabled())
			{
				((SemiUI)__instance).Hide();
			}
		}
	}
	[HarmonyPatch(typeof(PlayerVoiceChat))]
	public static class PlayerVoiceChatPatches
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void Update_Postfix(ref bool ___isTalking, PlayerVoiceChat __instance)
		{
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyPostfix]
		public static void LateUpdate_Postfix(ref PlayerAvatar ___playerAvatar, ref PlayerVoiceChat __instance)
		{
			//IL_0050: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)___playerAvatar) && ___playerAvatar.GetPrivateField<bool>("isDisabled") && ((Component)___playerAvatar).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().GetIsEnabled() && Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead) && (SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()))
			{
				((Component)__instance).transform.position = Vector3.Lerp(((Component)__instance).transform.position, ((Component)___playerAvatar.playerDeathHead).transform.position, 30f * Time.deltaTime);
			}
		}

		[HarmonyPatch("ToggleLobby")]
		[HarmonyPrefix]
		public static bool ToggleLobby_Prefix(bool _toggle, ref PlayerAvatar ___playerAvatar, PlayerVoiceChat __instance)
		{
			if (!SemiFunc.RunIsArena() || !___playerAvatar.GetPrivateField<bool>("deadSet"))
			{
				return true;
			}
			if (_toggle)
			{
				return true;
			}
			__instance.ToggleLobby(true);
			return false;
		}
	}
	[HarmonyPatch(typeof(SpectateCamera))]
	public static class SpectateCameraPatches
	{
		[HarmonyPatch("SetDeath")]
		[HarmonyPostfix]
		public static void SetDeath_Postfix(ref Transform ___deathPlayerSpectatePoint, ref PlayerAvatar ___player, ref SpectateCamera __instance)
		{
			if (Object.op_Implicit((Object)(object)___player) && ((Component)___player).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().GetIsEnabled() && Object.op_Implicit((Object)(object)___player.playerDeathHead) && ___player.GetPrivateField<bool>("isLocal"))
			{
				___deathPlayerSpectatePoint = ((Component)___player.playerDeathHead).transform;
			}
		}

		[HarmonyPatch("StateNormal")]
		[HarmonyPrefix]
		public static bool StateNormal_Prefix(ref PlayerAvatar? ___player, ref bool ___stateImpulse, ref Camera ___MainCamera, ref float ___previousFarClipPlane, ref float ___previousFieldOfView, ref Camera ___TopCamera, ref float ___normalMaxDistance, ref float ___normalMinDistance, ref float ___normalAimHorizontal, ref float ___normalAimVertical, ref Vector3 ___normalPreviousPosition, ref Transform ___normalTransformPivot, ref float ___normalDistanceTarget, SpectateCamera __instance)
		{
			//IL_00c8: 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_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: 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_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: 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_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)PlayerAvatar.instance))
			{
				return true;
			}
			if (SemiFunc.InputDown((InputKey)2))
			{
				((Component)PlayerAvatar.instance).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().LocalSetIsEnabled(SetIsEnabled: false);
				___stateImpulse = true;
				return true;
			}
			if (!((Component)PlayerAvatar.instance).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().GetIsEnabled())
			{
				return true;
			}
			___player = PlayerAvatar.instance;
			if (!Object.op_Implicit((Object)(object)___player) || !___player.GetPrivateField<bool>("isDisabled") || !((Component)___player).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().GetIsEnabled() || !Object.op_Implicit((Object)(object)___player?.playerDeathHead))
			{
				return true;
			}
			Transform transform = ((Component)___player.playerDeathHead).transform;
			if (___stateImpulse)
			{
				RenderSettings.fog = true;
				Camera val = ___MainCamera;
				val.farClipPlane = ___previousFarClipPlane;
				val.fieldOfView = ___previousFieldOfView;
				___TopCamera.fieldOfView = val.fieldOfView;
				((Component)val).transform.localPosition = Vector3.zero;
				((Component)val).transform.localRotation = Quaternion.identity;
				AudioManager.instance.AudioListener.TargetPositionTransform = ((Component)val).transform;
				___stateImpulse = false;
				SemiFunc.LightManagerSetCullTargetTransform(transform);
				CameraGlitch.Instance.PlayTiny();
				GameDirector.instance.CameraImpact.Shake(1f, 0.1f);
				AudioManager.instance.RestartAudioLoopDistances();
				___normalMaxDistance = 3f;
			}
			CameraNoise.Instance.Override(0.03f, 0.25f);
			float num = SemiFunc.InputMouseX();
			float num2 = SemiFunc.InputMouseY();
			float num3 = SemiFunc.InputScrollY();
			if (CameraAim.Instance.GetPrivateField<bool>("overrideAimStop"))
			{
				num = 0f;
				num2 = 0f;
				num3 = 0f;
			}
			___normalAimHorizontal += (float)((double)num * (double)CameraAim.Instance.AimSpeedMouse * 1.5);
			if ((double)___normalAimHorizontal > 360.0)
			{
				___normalAimHorizontal -= 360f;
			}
			if ((double)___normalAimHorizontal < -360.0)
			{
				___normalAimHorizontal += 360f;
			}
			float num4 = ___normalAimVertical;
			float num5 = (float)((0.0 - (double)num2 * (double)CameraAim.Instance.AimSpeedMouse) * 1.5);
			___normalAimVertical += num5;
			___normalAimVertical = Mathf.Clamp(___normalAimVertical, -70f, 70f);
			if ((double)num3 != 0.0)
			{
				___normalMaxDistance = Mathf.Clamp(___normalMaxDistance - num3 * 0.0025f, ___normalMinDistance + 1f, 6f);
			}
			Vector3 position = transform.position;
			position = (___normalPreviousPosition = position + Vector3.up * 0.45f);
			__instance.normalTransformPivot.position = Vector3.Lerp(___normalTransformPivot.position, position, 10f * Time.deltaTime);
			__instance.normalTransformPivot.rotation = Quaternion.Lerp(___normalTransformPivot.rotation, Quaternion.Euler(___normalAimVertical, ___normalAimHorizontal, 0f), Mathf.Lerp(50f, 6.25f, GameplayManager.instance.GetPrivateField<float>("cameraSmoothing") / 100f) * Time.deltaTime);
			Transform normalTransformPivot = __instance.normalTransformPivot;
			Quaternion localRotation = ___normalTransformPivot.localRotation;
			float x = ((Quaternion)(ref localRotation)).eulerAngles.x;
			localRotation = ___normalTransformPivot.localRotation;
			normalTransformPivot.localRotation = Quaternion.Euler(x, ((Quaternion)(ref localRotation)).eulerAngles.y, 0f);
			bool flag = false;
			float num6 = ___normalMaxDistance;
			RaycastHit[] array = Physics.SphereCastAll(___normalTransformPivot.position, 0.1f, -___normalTransformPivot.forward, ___normalMaxDistance, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()));
			if (array.Length != 0)
			{
				RaycastHit[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					RaycastHit val2 = array2[i];
					if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val2)).transform).GetComponent<PlayerHealthGrab>()) && !Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val2)).transform).GetComponent<PlayerAvatar>()) && !Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val2)).transform).GetComponent<PlayerTumble>()))
					{
						num6 = Mathf.Min(num6, ((RaycastHit)(ref val2)).distance);
						if (((Component)((RaycastHit)(ref val2)).transform).CompareTag("Wall"))
						{
							flag = true;
						}
						Bounds bounds = ((RaycastHit)(ref val2)).collider.bounds;
						Vector3 size = ((Bounds)(ref bounds)).size;
						if ((double)((Vector3)(ref size)).magnitude > 2.0)
						{
							flag = true;
						}
					}
				}
				___normalDistanceTarget = Mathf.Max(___normalMinDistance, num6);
			}
			else
			{
				___normalDistanceTarget = ___normalMaxDistance;
			}
			__instance.normalTransformDistance.localPosition = Vector3.Lerp(__instance.normalTransformDistance.localPosition, new Vector3(0f, 0f, 0f - ___normalDistanceTarget), Time.deltaTime * 5f);
			float num7 = 0f - __instance.normalTransformDistance.localPosition.z;
			Vector3 val3 = ___normalTransformPivot.position - __instance.normalTransformDistance.position;
			float num8 = ((Vector3)(ref val3)).magnitude;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.SphereCast(__instance.normalTransformDistance.position, 0.15f, val3, ref val4, ___normalMaxDistance, LayerMask.GetMask(new string[1] { "PlayerVisuals" }), (QueryTriggerInteraction)2))
			{
				num8 = ((RaycastHit)(ref val4)).distance;
			}
			float num9 = (float)((double)num7 - (double)num8 - 0.10000000149011612);
			if (flag)
			{
				float num10 = Mathf.Max(num6, num9);
				___MainCamera.nearClipPlane = Mathf.Max(num7 - num10, 0.01f);
			}
			else
			{
				___MainCamera.nearClipPlane = 0.01f;
			}
			RenderSettings.fogStartDistance = ___MainCamera.nearClipPlane;
			((Component)__instance).transform.position = __instance.normalTransformDistance.position;
			((Component)__instance).transform.rotation = __instance.normalTransformDistance.rotation;
			if ((double)((Component)__instance).transform.position.y < (double)transform.position.y + 0.25 && (double)num5 < 0.0)
			{
				___normalAimVertical = num4;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(LoadingUI))]
	public static class LoadingUIPatches
	{
		[HarmonyPatch("StartLoading")]
		[HarmonyPostfix]
		public static void StartLoading_Postfix(ref LoadingUI __instance)
		{
			if (Object.op_Implicit((Object)(object)PlayerAvatar.instance) && Object.op_Implicit((Object)(object)PlayerAvatar.instance.GetPrivateField<PlayerVoiceChat>("voiceChat")))
			{
				((Component)PlayerAvatar.instance).GetComponent<ValRepoMod.TalkingDeathHeadsMod>().LocalSetLobbyToggle(SetIsLobby: true);
			}
		}
	}
	public static class Utilities
	{
		public static void PrintFullHierarchy(GameObject go)
		{
			if (!((Object)(object)go == (Object)null))
			{
				List<GameObject> list = new List<GameObject>();
				Transform val = go.transform;
				while ((Object)(object)val != (Object)null)
				{
					list.Add(((Component)val).gameObject);
					val = val.parent;
				}
				list.Reverse();
				ValRepoMod.Log.LogInfo((object)"=== Parent Chain ===");
				for (int i = 0; i < list.Count; i++)
				{
					string text = new string(' ', i * 2);
					ValRepoMod.Log.LogInfo((object)(text + ((Object)list[i]).name + " - Components: " + GetComponentsString(list[i])));
				}
				ValRepoMod.Log.LogInfo((object)"=== Children Hierarchy ===");
				PrintChildren(go.transform, 1);
			}
		}

		private static void PrintChildren(Transform t, int depth)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			string text = new string(' ', depth * 2);
			foreach (Transform item in t)
			{
				Transform val = item;
				ValRepoMod.Log.LogInfo((object)(text + ((Object)((Component)val).gameObject).name + " - Components: " + GetComponentsString(((Component)val).gameObject)));
				PrintChildren(val, depth + 1);
			}
		}

		private static string GetComponentsString(GameObject go)
		{
			List<string> values = (from comp in go.GetComponents<Component>().OfType<Component>()
				select ((object)comp).GetType().Name).ToList();
			return string.Join(", ", values);
		}

		public static TResult InvokePrivateMethod<TClass, TResult>(TClass __instance, string methodName)
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(TClass), methodName, (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				ValRepoMod.Log.LogWarning((object)$"Method '{methodName}' not found on type '{typeof(TClass)}'.");
				return default(TResult);
			}
			TResult result = (TResult)methodInfo.Invoke(__instance, null);
			result?.ToString();
			return result;
		}

		public static void InvokeVoidPrivateMethod<TClass>(TClass __instance, string methodName, object[]? parameters = null)
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(TClass), methodName, (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				ValRepoMod.Log.LogWarning((object)$"Method '{methodName}' not found on type '{typeof(TClass)}'.");
				return;
			}
			methodInfo.Invoke(__instance, parameters);
			if (parameters != null)
			{
				string.Join(", ", parameters);
			}
		}

		public static TField GetPrivateField<TField>(this object? instance, string fieldName)
		{
			if (instance == null)
			{
				return default(TField);
			}
			FieldInfo fieldInfo = AccessTools.Field(instance.GetType(), fieldName);
			if (fieldInfo == null)
			{
				return default(TField);
			}
			return (TField)fieldInfo.GetValue(instance);
		}

		public static void SetPrivateField<TField>(this object instance, string fieldName, TField newValue)
		{
			FieldInfo fieldInfo = AccessTools.Field(instance.GetType(), fieldName);
			if (fieldInfo == null)
			{
				ValRepoMod.Log.LogWarning((object)$"Field '{fieldName}' not found on type '{instance.GetType()}'.");
			}
			else
			{
				fieldInfo.SetValue(instance, newValue);
			}
		}
	}
	[HarmonyPatch(typeof(GameDirector))]
	public static class GameDirectorPatches
	{
	}
}