Decompiled source of TwoHandedCompany v1.0.0

TwoHandedCompany.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using TwoHandedCompany.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TwoHandedCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TwoHandedCompany")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7edae068-cc07-4549-9b0b-1663b855743d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TwoHandedCompany
{
	public class PLUGIN_INFO
	{
		public const string modGUID = "Ken.TwoHandedCompany";

		public const string modName = "Two Handed Company";

		public const string modVersion = "1.0.0";
	}
	[BepInPlugin("Ken.TwoHandedCompany", "Two Handed Company", "1.0.0")]
	public class TwoHandedBase : BaseUnityPlugin
	{
		private Harmony harmony = new Harmony("Ken.TwoHandedCompany");

		private ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("Ken.TwoHandedCompany");
			mls.LogInfo((object)"Two Handed Company loaded");
			harmony.PatchAll(typeof(TwoHandedBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace TwoHandedCompany.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("BeginGrabObject")]
		[HarmonyPostfix]
		private static void UpdateBeginGrabObject(ref bool ___twoHanded)
		{
			StartOfRound instance = StartOfRound.Instance;
			___twoHanded = (instance == null || instance.currentLevel.levelID != 3 || StartOfRound.Instance.inShipPhase) & ___twoHanded;
		}

		[HarmonyPatch("GrabObjectClientRpc")]
		[HarmonyPostfix]
		private static void UpdateGrabObjectClientRpc(ref bool ___twoHanded)
		{
			StartOfRound instance = StartOfRound.Instance;
			___twoHanded = (instance == null || instance.currentLevel.levelID != 3 || StartOfRound.Instance.inShipPhase) & ___twoHanded;
		}

		[HarmonyPatch("SwitchToItemSlot")]
		[HarmonyPostfix]
		private static void UpdateSwitchToItemSlot(ref bool ___twoHanded)
		{
			StartOfRound instance = StartOfRound.Instance;
			___twoHanded = (instance == null || instance.currentLevel.levelID != 3 || StartOfRound.Instance.inShipPhase) & ___twoHanded;
		}
	}
}