using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Doomby")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HostIsBoss")]
[assembly: AssemblyTitle("HostIsBoss")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HostIsBoss
{
[ContentWarningPlugin("HostIsBoss", "1.0.0", true)]
[BepInPlugin("HostIsBoss", "HostIsBoss", "1.0.0")]
internal class Plugin : BaseUnityPlugin
{
public static ManualLogSource MLogger { get; private set; }
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
MLogger = ((BaseUnityPlugin)this).Logger;
new Harmony("HostIsBoss").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HostIsBoss is loaded!");
}
}
[HarmonyPatch]
internal class Patches
{
private static bool canStartGame;
[HarmonyPrefix]
[HarmonyPatch(typeof(SurfaceNetworkHandler), "RequestStartGame")]
private static void RequestStartGame_Patch()
{
canStartGame = true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SurfaceNetworkHandler), "RPCM_StartGame")]
private static bool RPCM_StartGame_Patch()
{
return canStartGame;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SurfaceNetworkHandler), "Awake")]
private static void Awake_Patch(ref bool ___m_Started)
{
canStartGame = !PhotonNetwork.IsMasterClient | ___m_Started;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(PhotonView), "RPC", new Type[]
{
typeof(string),
typeof(RpcTarget),
typeof(object[])
})]
private static bool RPC_Patch(string methodName, RpcTarget target)
{
if (methodName == "RPCA_OpenDoor")
{
return canStartGame;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(PhotonView), "RPC", new Type[]
{
typeof(string),
typeof(Player),
typeof(object[])
})]
private static bool RPC_Patch(string methodName, Player targetPlayer)
{
if (methodName == "RPCA_OpenDoor")
{
return canStartGame;
}
return true;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "HostIsBoss";
public const string PLUGIN_NAME = "HostIsBoss";
public const string PLUGIN_VERSION = "1.0.0";
}
}