Decompiled source of OnePlayerHost v1.0.0

kotos-OnePlayerHost.dll

Decompiled 2 months ago
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;

[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("kotos-OnePlayerHost")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("One Player Host")]
[assembly: AssemblyTitle("kotos-OnePlayerHost")]
[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 OnePlayerHost
{
	public class LobbyPatches
	{
		[HarmonyPatch(typeof(SelectRoleUI), "StartGame")]
		[HarmonyPrefix]
		[Conditional("DEBUG")]
		public static void SelectRoleUI(SelectRoleUI __instance)
		{
			Traverse val = Traverse.Create((object)__instance);
			val.Field("allReady").SetValue((object)true);
			Plugin.Logger.LogInfo((object)"Set Select Role UI to Ready");
		}

		[HarmonyPatch(typeof(SelectRoleUI), "UpdatedFullStatus")]
		[HarmonyPrefix]
		[Conditional("DEBUG")]
		public static void UpdatedFullStatus(SelectRoleUI __instance, ref bool areAllPlayerReady)
		{
			areAllPlayerReady = true;
			Plugin.Logger.LogInfo((object)"Updated full status");
		}

		[HarmonyPatch(typeof(LobbyManager), "PlayerReady")]
		[HarmonyPostfix]
		[Conditional("DEBUG")]
		public static void PlayerReady(LobbyManager __instance, bool ready)
		{
			if (ready)
			{
				__instance.NetworkareAllPlayersReady = true;
				Plugin.Logger.LogInfo((object)"Overwrote");
			}
		}
	}
	[BepInPlugin("kotos-OnePlayerHost", "One Player Host", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private void Awake()
		{
			Harmony.CreateAndPatchAll(typeof(LobbyPatches), (string)null);
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin kotos-OnePlayerHost is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "kotos-OnePlayerHost";

		public const string PLUGIN_NAME = "One Player Host";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}