using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Riverboat.Players;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MixedPatch_NoTV")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MixedPatch_NoTV")]
[assembly: AssemblyTitle("MixedPatch_NoTV")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MixedPatch_NoTV;
[HarmonyPatch]
public static class NoTVPatch
{
public static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(Player), "Initialize", (Type[])null, (Type[])null);
}
public static void Postfix(Player __instance)
{
GameObject val = GameObject.Find("TV Root");
GameObject val2 = GameObject.Find("msh_env_TV_Screen");
if ((Object)(object)val2 != (Object)null)
{
val2.GetComponent<VideoAudioSync>().StopSynced();
}
else
{
Plugin.Logger.LogWarning((object)"Could not find TV audio sync object: 'msh_env_TV_Screen'");
}
if ((Object)(object)val != (Object)null)
{
val.active = false;
Plugin.Logger.LogInfo((object)"Disabled TV.");
}
else
{
Plugin.Logger.LogWarning((object)"Could not find TV object: 'TV Root'");
}
}
}
[BepInPlugin("com.mixedpatch.notv", "Voodoo No TV Restock", "1.0.0")]
public class Plugin : BasePlugin
{
internal static Plugin Instance;
public static ManualLogSource Logger { get; private set; }
public override void Load()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
Instance = this;
Logger = ((BasePlugin)this).Log;
((BasePlugin)this).Log.LogInfo((object)"Voodoo No TV loading...");
Harmony val = new Harmony("com.mixedpatch.notv");
MethodBase methodBase = NoTVPatch.TargetMethod();
Logger.LogDebug((object)((methodBase == null) ? "Player.Initialize() not found." : $"Found: {methodBase}"));
if (methodBase != null)
{
val.Patch(methodBase, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(NoTVPatch), "Postfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
((BasePlugin)this).Log.LogInfo((object)"Voodoo No TV Loaded.");
}
}