Decompiled source of ReservedWeaponSlotKR v1.0.0

ReservedWeaponSlotKR.dll

Decompiled 9 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using ReservedItemSlotCore;
using ReservedItemSlotCore.Config;
using ReservedItemSlotCore.Data;
using ReservedWeaponSlot.Config;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ReservedWeaponSlot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReservedWeaponSlot")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5b723481-f5bd-43e5-9f47-26325095eea7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ReservedWeaponSlot
{
	[BepInPlugin("FlipMods.ReservedWeaponSlot", "ReservedWeaponSlot", "1.1.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private static ManualLogSource logger;

		private Harmony _harmony;

		public static ReservedItemSlotData weaponSlotData;

		public static ReservedItemSlotData rangedWeaponSlotData;

		public static ReservedItemSlotData ammoSlotData;

		public static ReservedItemData shotgunData;

		public static ReservedItemData zapGunData;

		public static ReservedItemData shovelData;

		public static ReservedItemData stopSignData;

		public static ReservedItemData yieldSignData;

		public static ReservedItemData rocketLauncherData;

		public static ReservedItemData flareGunData;

		public static ReservedItemData toyGunData;

		public static ReservedItemData toyHammerData;

		public static ReservedItemData goldenShovelData;

		public static ReservedItemData ammoData;

		public static ReservedItemData shotgunAmmoData;

		public static ReservedItemData flareGunAmmoData;

		public static List<ReservedItemData> additionalItemData = new List<ReservedItemData>();

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			instance = this;
			CreateCustomLogger();
			ConfigSettings.BindConfigSettings();
			CreateReservedItemSlots();
			CreateAdditionalReservedItemSlots();
			_harmony = new Harmony("ReservedWeaponSlot");
			PatchAll();
			Log("ReservedWeaponSlot loaded");
		}

		private void CreateReservedItemSlots()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Expected O, but got Unknown
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Expected O, but got Unknown
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Expected O, but got Unknown
			weaponSlotData = ReservedItemSlotData.CreateReservedItemSlotData("weapons", ConfigSettings.overrideMeleeSlotPriority.Value, ConfigSettings.overrideMeleeSlotPrice.Value);
			if (ConfigSettings.combineMeleeAndRangedWeaponSlots.Value)
			{
				rangedWeaponSlotData = weaponSlotData;
				weaponSlotData.purchasePrice = ConfigSettings.overrideCombinedWeaponSlotPrice.Value;
			}
			else
			{
				weaponSlotData.slotName = "melee_weapons";
				rangedWeaponSlotData = ReservedItemSlotData.CreateReservedItemSlotData("ranged_weapons", ConfigSettings.overrideRangedSlotPriority.Value, ConfigSettings.overrideRangedSlotPrice.Value);
			}
			shovelData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("철제 삽", (PlayerBone)0, default(Vector3), default(Vector3)));
			stopSignData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("정지 표지판", (PlayerBone)0, default(Vector3), default(Vector3)));
			yieldSignData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("양보 표지판", (PlayerBone)0, default(Vector3), default(Vector3)));
			toyGunData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Toy Hammer", (PlayerBone)0, default(Vector3), default(Vector3)));
			goldenShovelData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Australium Shovel", (PlayerBone)0, default(Vector3), default(Vector3)));
			shotgunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("산탄총", (PlayerBone)0, default(Vector3), default(Vector3)));
			zapGunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("잽건", (PlayerBone)0, default(Vector3), default(Vector3)));
			rocketLauncherData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Rocket Launcher", (PlayerBone)0, default(Vector3), default(Vector3)));
			flareGunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Flaregun", (PlayerBone)0, default(Vector3), default(Vector3)));
			toyGunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Revolver", (PlayerBone)0, default(Vector3), default(Vector3)));
			ammoSlotData = null;
			if (!ConfigSettings.disableReservedAmmoSlot.Value)
			{
				ammoSlotData = ReservedItemSlotData.CreateReservedItemSlotData("ammo", ConfigSettings.overrideAmmoSlotPriority.Value, ConfigSettings.overrideAmmoSlotPrice.Value);
				ammoData = ammoSlotData.AddItemToReservedItemSlot(new ReservedItemData("탄약", (PlayerBone)0, default(Vector3), default(Vector3)));
				shotgunAmmoData = ammoSlotData.AddItemToReservedItemSlot(new ReservedItemData("탄약", (PlayerBone)0, default(Vector3), default(Vector3)));
				flareGunAmmoData = ammoSlotData.AddItemToReservedItemSlot(new ReservedItemData("Emergency Flare (ammo)", (PlayerBone)0, default(Vector3), default(Vector3)));
			}
		}

		private void CreateAdditionalReservedItemSlots()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			string[] array = ConfigSettings.ParseAdditionalMeleeWeaponItems();
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (!weaponSlotData.ContainsItem(text))
				{
					LogWarning("Adding additional item to reserved (melee weapons) item slot. Item: " + text);
					ReservedItemData val = new ReservedItemData(text, (PlayerBone)0, default(Vector3), default(Vector3));
					additionalItemData.Add(val);
					weaponSlotData.AddItemToReservedItemSlot(val);
				}
			}
			array = ConfigSettings.ParseAdditionalRangedWeaponItems();
			string[] array3 = array;
			foreach (string text2 in array3)
			{
				if (!rangedWeaponSlotData.ContainsItem(text2))
				{
					LogWarning("Adding additional item to reserved (ranged weapons) item slot. Item: " + text2);
					ReservedItemData val2 = new ReservedItemData(text2, (PlayerBone)0, default(Vector3), default(Vector3));
					additionalItemData.Add(val2);
					rangedWeaponSlotData.AddItemToReservedItemSlot(val2);
				}
			}
			if (!ConfigSettings.disableReservedAmmoSlot.Value)
			{
				array = ConfigSettings.ParseAdditionalAmmoItems();
				string[] array4 = array;
				foreach (string text3 in array4)
				{
					if (!ammoSlotData.ContainsItem(text3))
					{
						LogWarning("Adding additional item to reserved (ammo) item slot. Item: " + text3);
						ReservedItemData val3 = new ReservedItemData(text3, (PlayerBone)0, default(Vector3), default(Vector3));
						additionalItemData.Add(val3);
						ammoSlotData.AddItemToReservedItemSlot(val3);
					}
				}
			}
			string[] array5 = ConfigSettings.ParseRemoveMeleeWeaponItems();
			string[] array6 = array5;
			foreach (string text4 in array6)
			{
				if (!weaponSlotData.ContainsItem(text4))
				{
					LogWarning("Removing item from reserved (melee weapons) item slot. Item: " + text4);
					weaponSlotData.RemoveItemFromReservedItemSlot(text4);
				}
			}
			array5 = ConfigSettings.ParseRemoveRangedWeaponItems();
			string[] array7 = array5;
			foreach (string text5 in array7)
			{
				if (!rangedWeaponSlotData.ContainsItem(text5))
				{
					LogWarning("Removing item from reserved (ranged weapons) item slot. Item: " + text5);
					rangedWeaponSlotData.RemoveItemFromReservedItemSlot(text5);
				}
			}
			if (ammoData == null)
			{
				return;
			}
			array5 = ConfigSettings.ParseRemoveAmmoItems();
			string[] array8 = array5;
			foreach (string text6 in array8)
			{
				if (!ammoSlotData.ContainsItem(text6))
				{
					LogWarning("Removing item from reserved (ammo) item slot. Item: " + text6);
					ammoSlotData.RemoveItemFromReservedItemSlot(text6);
				}
			}
		}

		private void PatchAll()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				_harmony.PatchAll(item);
			}
		}

		private void CreateCustomLogger()
		{
			try
			{
				logger = Logger.CreateLogSource($"{((BaseUnityPlugin)this).Info.Metadata.Name}-{((BaseUnityPlugin)this).Info.Metadata.Version}");
			}
			catch
			{
				logger = ((BaseUnityPlugin)this).Logger;
			}
		}

		public static void Log(string message)
		{
			logger.LogInfo((object)message);
		}

		public static void LogError(string message)
		{
			logger.LogError((object)message);
		}

		public static void LogWarning(string message)
		{
			logger.LogWarning((object)message);
		}

		public static bool IsModLoaded(string guid)
		{
			return Chainloader.PluginInfos.ContainsKey(guid);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.ReservedWeaponSlot";

		public const string PLUGIN_NAME = "ReservedWeaponSlot";

		public const string PLUGIN_VERSION = "1.1.2";
	}
}
namespace ReservedWeaponSlot.Input
{
	internal class IngameKeybinds : LcInputActions
	{
		internal static IngameKeybinds Instance = new IngameKeybinds();

		[InputAction("<Keyboard>/t", Name = "[ReservedItemSlots]\nToggle Weapon Slot")]
		public InputAction ToggleWeaponSlotHotkey { get; set; }

		internal static InputActionAsset GetAsset()
		{
			return ((LcInputActions)Instance).Asset;
		}
	}
	internal class InputUtilsCompat
	{
		internal static InputActionAsset Asset => IngameKeybinds.GetAsset();

		internal static bool Enabled => Plugin.IsModLoaded("com.rune580.LethalCompanyInputUtils");

		public static InputAction ToggleWeaponHotkey => IngameKeybinds.Instance.ToggleWeaponSlotHotkey;
	}
	[HarmonyPatch]
	internal static class Keybinds
	{
		public static InputActionAsset Asset;

		public static InputActionMap ActionMap;

		private static InputAction ToggleWeaponSlotAction;

		public static bool holdingWeaponModifier;

		public static bool toggledWeaponSlot;

		public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController;

		public static ReservedPlayerData localPlayerData => ReservedPlayerData.localPlayerData;

		[HarmonyPatch(typeof(PreInitSceneScript), "Awake")]
		[HarmonyPrefix]
		public static void AddToKeybindMenu()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log("Initializing hotkeys.");
			if (InputUtilsCompat.Enabled)
			{
				Asset = InputUtilsCompat.Asset;
				ActionMap = Asset.actionMaps[0];
				ToggleWeaponSlotAction = InputUtilsCompat.ToggleWeaponHotkey;
			}
			else
			{
				Asset = ScriptableObject.CreateInstance<InputActionAsset>();
				ActionMap = new InputActionMap("ReservedItemSlots");
				InputActionSetupExtensions.AddActionMap(Asset, ActionMap);
				ToggleWeaponSlotAction = InputActionSetupExtensions.AddAction(ActionMap, "ReservedItemSlots.ToggleWeaponSlot", (InputActionType)0, "", (string)null, (string)null, (string)null, (string)null);
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnEnable")]
		[HarmonyPostfix]
		public static void OnEnable()
		{
			Asset.Enable();
			ToggleWeaponSlotAction.performed += OnSwapToWeaponSlot;
			ToggleWeaponSlotAction.canceled += OnSwapToWeaponSlot;
		}

		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			Asset.Disable();
			ToggleWeaponSlotAction.performed -= OnSwapToWeaponSlot;
			ToggleWeaponSlotAction.canceled -= OnSwapToWeaponSlot;
		}

		private static void OnSwapToWeaponSlot(CallbackContext context)
		{
			if (!((Object)(object)localPlayerController == (Object)null) && localPlayerData != null && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && SessionManager.unlockedReservedItemSlotsDict.TryGetValue(Plugin.weaponSlotData.slotName, out var value))
			{
				List<ReservedItemSlotData> list = new List<ReservedItemSlotData> { value };
				if (SessionManager.unlockedReservedItemSlotsDict.TryGetValue(Plugin.rangedWeaponSlotData.slotName, out var value2) && !list.Contains(value2))
				{
					list.Add(value2);
				}
				ReservedHotbarManager.ForceToggleReservedHotbar(list.ToArray());
			}
		}
	}
}
namespace ReservedWeaponSlot.Config
{
	public static class ConfigSettings
	{
		public static ConfigEntry<int> overrideMeleeSlotPriority;

		public static ConfigEntry<int> overrideMeleeSlotPrice;

		public static ConfigEntry<int> overrideRangedSlotPriority;

		public static ConfigEntry<int> overrideRangedSlotPrice;

		public static ConfigEntry<bool> combineMeleeAndRangedWeaponSlots;

		public static ConfigEntry<int> overrideCombinedWeaponSlotPrice;

		public static ConfigEntry<bool> disableReservedAmmoSlot;

		public static ConfigEntry<int> overrideAmmoSlotPriority;

		public static ConfigEntry<int> overrideAmmoSlotPrice;

		public static ConfigEntry<string> additionalMeleeWeaponsInSlot;

		public static ConfigEntry<string> additionalRangedWeaponsInSlot;

		public static ConfigEntry<string> additionalAmmoInSlot;

		public static ConfigEntry<string> removeItemsFromMeleeWeaponsSlot;

		public static ConfigEntry<string> removeItemsFromRangedWeaponsSlot;

		public static ConfigEntry<string> removeItemsFromAmmoSlot;

		public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>();

		public static void BindConfigSettings()
		{
			Plugin.Log("BindingConfigs");
			overrideMeleeSlotPriority = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "MeleeWeaponSlotPriorityOverride", 100, "[Host only] Manually set the priority for this item slot. Higher priority slots will come first in the reserved item slots, which will appear below the other slots. Negative priority items will appear on the left side of the screen, this is disabled in the core mod's config."));
			overrideMeleeSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "MeleeWeaponSlotPriceOverride", 150, "[Host only] Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts."));
			overrideRangedSlotPriority = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "RangedWeaponSlotPriorityOverride", 99, "[Host only] Manually set the priority for this item slot. Higher priority slots will come first in the reserved item slots, which will appear below the other slots. Negative priority items will appear on the left side of the screen, this is disabled in the core mod's config."));
			overrideRangedSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "RangedWeaponSlotPriceOverride", 250, "[Host only] Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts."));
			combineMeleeAndRangedWeaponSlots = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Server-side", "CombineMeleeAndRangedWeaponSlots", true, "[Host only] If set to false, melee and ranged weapons will be added to two different reserved item slots. If purchasing item slots is enabled, each slots will need to be purchased separately. (prices for each will be reduced)"));
			overrideCombinedWeaponSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "CombinedWeaponSlotPriceOverride", 400, "[Host only] Only applies if CombineMeleeAndRangedWeaponSlots is true. Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts."));
			disableReservedAmmoSlot = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Server-side", "DisableReservedAmmoSlot", false, "[Host only] Disables the reserved ammo slot. Will sync with clients."));
			overrideAmmoSlotPriority = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "AmmoSlotPriorityOverride", -10, "[Host only] Manually set the priority for this item slot. Higher priority slots will come first in the reserved item slots, which will appear below the other slots. Negative priority items will appear on the left side of the screen, this is disabled in the core mod's config."));
			overrideAmmoSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "AmmoSlotPriceOverride", 150, "[Host only] Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts."));
			additionalMeleeWeaponsInSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "AdditionalMeleeWeaponsInSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). When adding items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nNOTE: IF YOU ARE USING A TRANSLATION MOD, YOU MAY NEED TO ADD THE TRANSLATED NAME OF ANY ITEM YOU WANT IN THIS SLOT."));
			additionalRangedWeaponsInSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "AdditionalRangedWeaponsInSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). When adding items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nNOTE: IF YOU ARE USING A TRANSLATION MOD, YOU MAY NEED TO ADD THE TRANSLATED NAME OF ANY ITEM YOU WANT IN THIS SLOT."));
			additionalAmmoInSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "AdditionalAmmoInSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). When adding items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nNOTE: IF YOU ARE USING A TRANSLATION MOD, YOU MAY NEED TO ADD THE TRANSLATED NAME OF ANY ITEM YOU WANT IN THIS SLOT."));
			removeItemsFromMeleeWeaponsSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "RemoveMeleeWeaponsFromSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). Removes the specified items from this reserved item slot. When removing items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nCURRENT MELEE WEAPONS IN SLOT: \"Shovel\", \"Stop sign\", \"Yield sign\", \"Toy Hammer\", \"Australium Shovel\""));
			removeItemsFromRangedWeaponsSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "RemoveRangedWeaponsFromSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). Removes the specified items from this reserved item slot. When removing items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nCURRENT RANGED WEAPONS IN SLOT: \"Shotgun\", \"Zap gun\", \"Rocket Launcher\", \"Flaregun\", \"Revolver\""));
			removeItemsFromAmmoSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "RemoveAmmoItemsFromSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). Removes the specified items from this reserved item slot.When removing items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nCURRENT AMMO ITEMS IN SLOT: \"Ammo\", \"Shells\", \"Emergency Flare (ammo)\""));
			additionalMeleeWeaponsInSlot.Value = additionalMeleeWeaponsInSlot.Value.Replace(", ", ",");
			additionalRangedWeaponsInSlot.Value = additionalRangedWeaponsInSlot.Value.Replace(", ", ",");
			additionalAmmoInSlot.Value = additionalAmmoInSlot.Value.Replace(", ", ",");
			removeItemsFromMeleeWeaponsSlot.Value = removeItemsFromMeleeWeaponsSlot.Value.Replace(", ", ",");
			removeItemsFromRangedWeaponsSlot.Value = removeItemsFromRangedWeaponsSlot.Value.Replace(", ", ",");
			removeItemsFromAmmoSlot.Value = removeItemsFromAmmoSlot.Value.Replace(", ", ",");
			TryRemoveOldConfigSettings();
		}

		public static ConfigEntry<T> AddConfigEntry<T>(ConfigEntry<T> configEntry)
		{
			currentConfigEntries.Add(((ConfigEntryBase)configEntry).Definition.Key, (ConfigEntryBase)(object)configEntry);
			return configEntry;
		}

		public static string[] ParseAdditionalMeleeWeaponItems()
		{
			return ConfigSettings.ParseItemNames(additionalMeleeWeaponsInSlot.Value);
		}

		public static string[] ParseAdditionalRangedWeaponItems()
		{
			return ConfigSettings.ParseItemNames(additionalRangedWeaponsInSlot.Value);
		}

		public static string[] ParseAdditionalAmmoItems()
		{
			return ConfigSettings.ParseItemNames(additionalAmmoInSlot.Value);
		}

		public static string[] ParseRemoveMeleeWeaponItems()
		{
			return ConfigSettings.ParseItemNames(removeItemsFromMeleeWeaponsSlot.Value);
		}

		public static string[] ParseRemoveRangedWeaponItems()
		{
			return ConfigSettings.ParseItemNames(removeItemsFromRangedWeaponsSlot.Value);
		}

		public static string[] ParseRemoveAmmoItems()
		{
			return ConfigSettings.ParseItemNames(removeItemsFromAmmoSlot.Value);
		}

		public static void TryRemoveOldConfigSettings()
		{
			HashSet<string> hashSet = new HashSet<string>();
			HashSet<string> hashSet2 = new HashSet<string>();
			foreach (ConfigEntryBase value in currentConfigEntries.Values)
			{
				hashSet.Add(value.Definition.Section);
				hashSet2.Add(value.Definition.Key);
			}
			try
			{
				ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config;
				string configFilePath = config.ConfigFilePath;
				if (!File.Exists(configFilePath))
				{
					return;
				}
				string text = File.ReadAllText(configFilePath);
				string[] array = File.ReadAllLines(configFilePath);
				string text2 = "";
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = array[i].Replace("\n", "");
					if (array[i].Length <= 0)
					{
						continue;
					}
					if (array[i].StartsWith("["))
					{
						if (text2 != "" && !hashSet.Contains(text2))
						{
							text2 = "[" + text2 + "]";
							int num = text.IndexOf(text2);
							int num2 = text.IndexOf(array[i]);
							text = text.Remove(num, num2 - num);
						}
						text2 = array[i].Replace("[", "").Replace("]", "").Trim();
					}
					else
					{
						if (!(text2 != ""))
						{
							continue;
						}
						if (i <= array.Length - 4 && array[i].StartsWith("##"))
						{
							int j;
							for (j = 1; i + j < array.Length && array[i + j].Length > 3; j++)
							{
							}
							if (hashSet.Contains(text2))
							{
								int num3 = array[i + j - 1].IndexOf("=");
								string item = array[i + j - 1].Substring(0, num3 - 1);
								if (!hashSet2.Contains(item))
								{
									int num4 = text.IndexOf(array[i]);
									int num5 = text.IndexOf(array[i + j - 1]) + array[i + j - 1].Length;
									text = text.Remove(num4, num5 - num4);
								}
							}
							i += j - 1;
						}
						else if (array[i].Length > 3)
						{
							text = text.Replace(array[i], "");
						}
					}
				}
				if (!hashSet.Contains(text2))
				{
					text2 = "[" + text2 + "]";
					int num6 = text.IndexOf(text2);
					text = text.Remove(num6, text.Length - num6);
				}
				while (text.Contains("\n\n\n"))
				{
					text = text.Replace("\n\n\n", "\n\n");
				}
				File.WriteAllText(configFilePath, text);
				config.Reload();
			}
			catch
			{
			}
		}
	}
}