using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.SceneManagement;
[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("PeakThingsTVFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PeakThingsTVFix")]
[assembly: AssemblyTitle("PeakThingsTVFix")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
namespace PeakThingsTVFix
{
[BepInPlugin("com.fix.peakthings.tvfix", "PeakThings TV Fix", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class TVFixPlugin : BaseUnityPlugin
{
private static bool _spawnedThisSession;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"PeakThings TV Fix loaded!");
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name == "Airport")
{
_spawnedThisSession = false;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Airport scene detected, waiting for host check...");
((MonoBehaviour)this).StartCoroutine(DelayedTVSpawn());
}
}
private IEnumerator DelayedTVSpawn()
{
yield return (object)new WaitForSeconds(3f);
if (!PhotonNetwork.IsMasterClient)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"TVFix: Not host, skipping TV spawn.");
yield break;
}
if (_spawnedThisSession)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"TVFix: TV already spawned this session, skipping.");
yield break;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"TVFix: Spawning TVSet directly via PhotonNetwork...");
Vector3 spawnPos = new Vector3(-15.29617f, 3.101736f, 106.5155f);
Quaternion spawnRot = Quaternion.Euler(0f, 0f, 0f);
try
{
GameObject tv = PhotonNetwork.Instantiate("0_Items/PeakThings_TVSet", spawnPos, spawnRot, (byte)0, (object[])null);
if ((Object)(object)tv != (Object)null)
{
_spawnedThisSession = true;
((BaseUnityPlugin)this).Logger.LogInfo((object)"TVFix: TVSet spawned successfully!");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"TVFix: Spawn returned null!");
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("TVFix: Exception during spawn: " + ex.Message));
}
}
}
}