Decompiled source of ReservedShotGunSlot v1.0.0

ReservedShotGunSlot.dll

Decompiled 6 months ago
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.Configuration;
using HarmonyLib;
using ReservedItemSlotCore;

[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("ReservedShotGunSlot")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ReservedShotGunSlot")]
[assembly: AssemblyTitle("ReservedShotGunSlot")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ReservedShotGunSlot;

public class HarmonyPatches
{
	private static Harmony instance;

	public const string InstanceId = "com.graze.gorillatag.reservedshotgunslot";

	public static bool IsPatched { get; private set; }

	internal static void ApplyHarmonyPatches()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		if (!IsPatched)
		{
			if (instance == null)
			{
				instance = new Harmony("com.graze.gorillatag.reservedshotgunslot");
			}
			instance.PatchAll(Assembly.GetExecutingAssembly());
			IsPatched = true;
		}
	}

	internal static void RemoveHarmonyPatches()
	{
		if (instance != null && IsPatched)
		{
			instance.UnpatchAll("com.graze.gorillatag.reservedshotgunslot");
			IsPatched = false;
		}
	}
}
[BepInDependency("org.legoandmars.gorillatag.utilla", "1.5.0")]
[BepInPlugin("com.graze.gorillatag.reservedshotgunslot", "ReservedShotGunSlot", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin instance;

	public static ReservedItemInfo ShotgunInfo = new ReservedItemInfo("ShotGun", 77, true, true, true, true);

	private Plugin()
	{
		HarmonyPatches.ApplyHarmonyPatches();
		ConfigSettings.BindConfigSettings();
	}
}
public static class ConfigSettings
{
	public static ConfigEntry<string> activateShotGunKey;

	public static ConfigEntry<bool> hideShotGunMeshShoulder;

	public static string activateShotGunDisplayName;

	public static void BindConfigSettings()
	{
		activateShotGunKey = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedItemSlotCore", "ActivateShotGunKey", "<Keyboard>/x", "This doesnt work but im afraid to take it away.");
		hideShotGunMeshShoulder = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("ReservedItemSlotCore", "HideShotGunOnShoulder", true, "This also doesnt work i dont think..");
		activateShotGunDisplayName = GetDisplayName(activateShotGunKey.Value);
	}

	public static string GetDisplayName(string key)
	{
		key = key.Replace("<Keyboard>/", "");
		key = key.Replace("<Mouse>/", "");
		string text = key;
		text = text.Replace("leftAlt", "Alt");
		text = text.Replace("rightAlt", "Alt");
		text = text.Replace("leftCtrl", "Ctrl");
		text = text.Replace("rightCtrl", "Ctrl");
		text = text.Replace("leftShift", "Shift");
		text = text.Replace("rightShift", "Shift");
		text = text.Replace("leftButton", "LMB");
		text = text.Replace("rightButton", "RMB");
		return text.Replace("middleButton", "MMB");
	}
}
internal class PluginInfo
{
	public const string GUID = "com.graze.gorillatag.reservedshotgunslot";

	public const string Name = "ReservedShotGunSlot";

	public const string Version = "1.0.0";
}