Decompiled source of LoadoutLockdown v1.0.0

LoadoutLockdown.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using HookDOTS.API;
using HookDOTS.API.Attributes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProfuselyViolentProgression.Core.Config;
using ProfuselyViolentProgression.Core.Utilities;
using ProfuselyViolentProgression.LoadoutLockdown.Config;
using ProjectM;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Shared;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Nicholas Toby")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright (c) Nicholas Toby 2025")]
[assembly: AssemblyDescription("Restrict (or unrestrict) equipping gear, both in and out of combat. Fully customizable.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6465828d60b37cc281c47f791c90eae27eaa83fe")]
[assembly: AssemblyProduct("LoadoutLockdown")]
[assembly: AssemblyTitle("LoadoutLockdown")]
[assembly: AssemblyMetadata("Reloadable", "True")]
[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 ProfuselyViolentProgression.Core.Utilities
{
	public static class DebugUtil
	{
		public static void LogComponentTypesFromQueries(ComponentSystemBase systemBase)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			LogUtil.LogInfo("========================================");
			int num = 0;
			foreach (EntityQuery item in (Il2CppArrayBase<EntityQuery>)(object)systemBase.EntityQueries)
			{
				EntityQuery current = item;
				LogUtil.LogInfo($"query#{num}--------------------------------");
				NativeArray<Entity> val = ((EntityQuery)(ref current)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				for (int i = 0; i < val.Length; i++)
				{
					LogComponentTypes(val[i]);
				}
				num++;
			}
		}

		public static void LogComponentTypes(Entity entity)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			LogUtil.LogMessage("-------------------------------------------");
			EntityManager entityManager = WorldUtil.Game.EntityManager;
			Enumerator<ComponentType> enumerator = ((EntityManager)(ref entityManager)).GetComponentTypes(entity, (Allocator)2).GetEnumerator();
			while (enumerator.MoveNext())
			{
				ComponentType current = enumerator.Current;
				LogUtil.LogMessage(((object)(ComponentType)(ref current)).ToString());
			}
			LogUtil.LogMessage("-------------------------------------------");
		}

		public static void LogPrefabGuid(Entity entity)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = WorldUtil.Game.EntityManager;
			if (((EntityManager)(ref entityManager)).HasComponent<PrefabGUID>(entity))
			{
				PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity);
				LogUtil.LogInfo("  PrefabGUID: " + LookupPrefabName(componentData));
			}
		}

		public static void LogBuffs(Entity entity)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = WorldUtil.Game.EntityManager;
			if (((EntityManager)(ref entityManager)).HasBuffer<BuffBuffer>(entity))
			{
				LogUtil.LogInfo("  buffs:");
				Enumerator<BuffBuffer> enumerator = ((EntityManager)(ref entityManager)).GetBuffer<BuffBuffer>(entity, false).GetEnumerator();
				while (enumerator.MoveNext())
				{
					BuffBuffer current = enumerator.Current;
					LogUtil.LogInfo("    " + LookupPrefabName(current.PrefabGuid));
				}
			}
		}

		public static void LogSpellModSet(Entity entity)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00d9: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = WorldUtil.Game.EntityManager;
			if (((EntityManager)(ref entityManager)).HasComponent<SpellModSetComponent>(entity))
			{
				LogUtil.LogInfo("  spell mods:");
				SpellModSetComponent componentData = ((EntityManager)(ref entityManager)).GetComponentData<SpellModSetComponent>(entity);
				SpellModSet spellMods = componentData.SpellMods;
				LogUtil.LogInfo($"    count:{spellMods.Count}");
				LogUtil.LogInfo("    0:" + LookupPrefabName(spellMods.Mod0.Id));
				LogUtil.LogInfo("    1:" + LookupPrefabName(spellMods.Mod1.Id));
				LogUtil.LogInfo("    2:" + LookupPrefabName(spellMods.Mod2.Id));
				LogUtil.LogInfo("    3:" + LookupPrefabName(spellMods.Mod3.Id));
				LogUtil.LogInfo("    4:" + LookupPrefabName(spellMods.Mod4.Id));
				LogUtil.LogInfo("    5:" + LookupPrefabName(spellMods.Mod5.Id));
				LogUtil.LogInfo("    6:" + LookupPrefabName(spellMods.Mod6.Id));
				LogUtil.LogInfo("    7:" + LookupPrefabName(spellMods.Mod7.Id));
				LogUtil.LogInfo("     ----");
			}
		}

		public static void LogApplyBuffOnGameplayEvent(Entity entity)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = WorldUtil.Game.EntityManager;
			if (((EntityManager)(ref entityManager)).HasBuffer<ApplyBuffOnGameplayEvent>(entity))
			{
				LogUtil.LogInfo("  Buffs to apply on gameplay events:");
				Enumerator<ApplyBuffOnGameplayEvent> enumerator = ((EntityManager)(ref entityManager)).GetBuffer<ApplyBuffOnGameplayEvent>(entity, false).GetEnumerator();
				while (enumerator.MoveNext())
				{
					ApplyBuffOnGameplayEvent current = enumerator.Current;
					LogUtil.LogInfo($"    stacks:{current.Stacks}");
					LogUtil.LogInfo("    0:" + LookupPrefabName(current.Buff0));
					LogUtil.LogInfo("    1:" + LookupPrefabName(current.Buff1));
					LogUtil.LogInfo("    2:" + LookupPrefabName(current.Buff2));
					LogUtil.LogInfo("    3:" + LookupPrefabName(current.Buff3));
					LogUtil.LogInfo($"    spellModSource:{current.CustomAbilitySpellModsSource}");
					LogUtil.LogInfo("     ----");
				}
			}
		}

		public static void LogHitColliderCast(Entity entity)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_009d: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = WorldUtil.Game.EntityManager;
			if (((EntityManager)(ref entityManager)).HasBuffer<HitColliderCast>(entity))
			{
				LogUtil.LogInfo("  HitColliderCast [Buffer]:");
				DynamicBuffer<HitColliderCast> buffer = ((EntityManager)(ref entityManager)).GetBuffer<HitColliderCast>(entity, false);
				for (int i = 0; i < buffer.Length; i++)
				{
					HitColliderCast val = buffer[i];
					LogUtil.LogInfo($"    HitColliderCast [{i}]");
					LogUtil.LogInfo($"      CollisionCheckType: {val.CollisionCheckType}");
					LogUtil.LogInfo($"      PrimaryFilterFlags: {val.PrimaryFilterFlags}");
					LogUtil.LogInfo($"      PrimaryTargets_Count: {val.PrimaryTargets_Count}");
					LogUtil.LogInfo($"      SecondaryTargets_Count: {val.SecondaryTargets_Count}");
					LogUtil.LogInfo($"      ContinuousCollision: {val.ContinuousCollision}");
					LogUtil.LogInfo($"      CanHitThroughBlockSpellCollision: {val.CanHitThroughBlockSpellCollision}");
					LogUtil.LogInfo($"      IgnoreImmaterial: {val.IgnoreImmaterial}");
					LogUtil.LogInfo("    ----");
				}
			}
		}

		public static string LookupPrefabName(PrefabGUID prefabGuid)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			PrefabCollectionSystem existingSystemManaged = WorldUtil.Game.GetExistingSystemManaged<PrefabCollectionSystem>();
			PrefabLookupMap prefabLookupMap = existingSystemManaged._PrefabLookupMap;
			NativeParallelHashMap<PrefabGUID, Entity> guidToEntityMap = prefabLookupMap.GuidToEntityMap;
			if (!guidToEntityMap.ContainsKey(prefabGuid))
			{
				return $"GUID Not Found {prefabGuid._Value}";
			}
			return $"{((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefabGuid)} PrefabGUID({((PrefabGUID)(ref prefabGuid)).GuidHash})";
		}
	}
	public static class LogUtil
	{
		public static ManualLogSource Logger;

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}

		public static void LogMessage(object data)
		{
			Logger.LogMessage(data);
		}

		public static void LogInfo(object data)
		{
			Logger.LogInfo(data);
		}

		public static void LogDebug(object data)
		{
			Logger.LogDebug(data);
		}

		public static void LogError(object data)
		{
			Logger.LogError(data);
		}

		public static void LogWarning(object data)
		{
			Logger.LogWarning(data);
		}
	}
	public static class WorldUtil
	{
		private static World _clientWorld;

		private static World _serverWorld;

		private static ServerBootstrapSystem _serverBootstrapSystem;

		public static World Server
		{
			get
			{
				if (_serverWorld != null && _serverWorld.IsCreated)
				{
					return _serverWorld;
				}
				_serverWorld = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");
				return _serverWorld;
			}
		}

		public static World Client
		{
			get
			{
				if (_clientWorld != null && _clientWorld.IsCreated)
				{
					return _clientWorld;
				}
				_clientWorld = GetWorld("Client_0") ?? throw new Exception("There is no Client world (yet). Did you install a client mod on the server?");
				return _clientWorld;
			}
		}

		public static World Default => World.DefaultGameObjectInjectionWorld;

		public static World Game => IsClient ? Client : Server;

		public static bool IsServer => Application.productName == "VRisingServer";

		public static bool IsClient => Application.productName == "VRising";

		public static bool IsServerInitialized
		{
			get
			{
				if (_serverBootstrapSystem == null)
				{
					World server = Server;
					_serverBootstrapSystem = ((server != null) ? server.GetExistingSystemManaged<ServerBootstrapSystem>() : null);
				}
				ServerBootstrapSystem serverBootstrapSystem = _serverBootstrapSystem;
				return serverBootstrapSystem != null && serverBootstrapSystem.ServerIsInitialized;
			}
		}

		public static bool IsGameWorldCreated()
		{
			if (_clientWorld != null)
			{
				return _clientWorld.IsCreated;
			}
			if (_serverWorld != null)
			{
				return _serverWorld.IsCreated;
			}
			if (IsClient)
			{
				return GetWorld("Client_0") != null;
			}
			if (IsServer)
			{
				return GetWorld("Server") != null;
			}
			return false;
		}

		private static World GetWorld(string name)
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current.Name == name)
				{
					_serverWorld = current;
					return current;
				}
			}
			return null;
		}
	}
}
namespace ProfuselyViolentProgression.Core.Config
{
	public class BepInExConfigReloader
	{
		private ConfigFile _config;

		private string _filename;

		private string _absoluteFilePath;

		private string _absoluteFileDir;

		private FileSystemWatcher _fileWatcher;

		public BepInExConfigReloader(ConfigFile config)
		{
			_config = config;
			_absoluteFilePath = config.ConfigFilePath;
			_absoluteFileDir = Path.GetDirectoryName(_absoluteFilePath);
			_filename = Path.GetFileName(_absoluteFilePath);
			InitFileWatcher();
		}

		private void InitFileWatcher()
		{
			_fileWatcher = new FileSystemWatcher(_absoluteFileDir);
			_fileWatcher.Filter = _filename;
			_fileWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime;
			_fileWatcher.Changed += HandleConfigFileChanged;
			_fileWatcher.EnableRaisingEvents = true;
		}

		private void HandleConfigFileChanged(object sender, FileSystemEventArgs e)
		{
			_config.Reload();
		}

		public void Dispose()
		{
			_fileWatcher.Changed -= HandleConfigFileChanged;
		}
	}
	public abstract class ConfigManagerBase<TConfig> : IConfigManager<TConfig>
	{
		private string _filename;

		private string _absoluteFilePath;

		private string _absoluteFileDir;

		private FileSystemWatcher _fileWatcher;

		public string FileName => _filename;

		public string AbsoluteFilePath => _absoluteFilePath;

		public string AbsoluteFileDir => _absoluteFileDir;

		public event Action<TConfig> ConfigUpdated;

		public ConfigManagerBase(string pluginGUID, string filename)
		{
			_filename = filename;
			_absoluteFileDir = Path.Combine(Paths.ConfigPath, pluginGUID);
			Directory.CreateDirectory(_absoluteFileDir);
			_absoluteFilePath = Path.Combine(_absoluteFileDir, filename);
			InitFileWatcher();
		}

		private void InitFileWatcher()
		{
			_fileWatcher = new FileSystemWatcher(AbsoluteFileDir);
			_fileWatcher.Filter = _filename;
			_fileWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime;
			_fileWatcher.Changed += HandleConfigFileChanged;
			_fileWatcher.EnableRaisingEvents = true;
		}

		private void HandleConfigFileChanged(object sender, FileSystemEventArgs e)
		{
			if (TryLoadConfig(out var config))
			{
				this.ConfigUpdated?.Invoke(config);
			}
		}

		public void Dispose()
		{
			_fileWatcher.Changed -= HandleConfigFileChanged;
		}

		public void CreateMainFile_FromResource(string resourceName, bool overwrite = false)
		{
			CreateExampleFile_FromResource(resourceName, _filename, overwrite);
		}

		public void CreateExampleFile_FromResource(string resourceName, string toFilename, bool overwrite = false)
		{
			string path = Path.Combine(AbsoluteFileDir, toFilename);
			if (!overwrite && File.Exists(path))
			{
				return;
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			using Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
			using FileStream destination = File.Create(path);
			stream.CopyTo(destination);
		}

		public abstract bool TryLoadConfig(out TConfig config);
	}
	public class ConfigManagerJSON<TConfig> : ConfigManagerBase<TConfig>
	{
		private ManualLogSource _log;

		private JsonSerializerOptions _jsonSerializerOptions = new JsonSerializerOptions
		{
			ReadCommentHandling = JsonCommentHandling.Skip,
			AllowTrailingCommas = true,
			Converters = { (JsonConverter)new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
		};

		public ConfigManagerJSON(string pluginGUID, string filename, ManualLogSource log)
			: base(pluginGUID, filename)
		{
			_log = log;
		}

		public override bool TryLoadConfig([NotNullWhen(true)] out TConfig config)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			try
			{
				string json = File.ReadAllText(base.AbsoluteFilePath);
				config = JsonSerializer.Deserialize<TConfig>(json, _jsonSerializerOptions);
				return true;
			}
			catch (Exception ex)
			{
				config = default(TConfig);
				ManualLogSource log = _log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(16, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error parsing ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(base.AbsoluteFilePath);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogError(val);
			}
			return false;
		}
	}
	public interface IConfigManager<TConfig>
	{
		string FileName { get; }

		string AbsoluteFilePath { get; }

		string AbsoluteFileDir { get; }

		event Action<TConfig> ConfigUpdated;

		bool TryLoadConfig(out TConfig config);

		void CreateMainFile_FromResource(string resourceName, bool overwrite = false);

		void CreateExampleFile_FromResource(string resourceName, string toFilename, bool overwrite = false);

		void Dispose();
	}
}
namespace ProfuselyViolentProgression.LoadoutLockdown
{
	[BepInPlugin("LoadoutLockdown", "LoadoutLockdown", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		private Harmony _harmony;

		private HookDOTS _hookDOTS;

		private ConfigEntry<string> RulesetFilename;

		private BepInExConfigReloader BepInExConfigReloader;

		private ConfigManagerJSON<LoadoutLockdownConfig> RulesetManager;

		private bool _initialized = false;

		private ServerGameSettingsSystem _serverGameSettingsSystem => WorldUtil.Server.GetExistingSystemManaged<ServerGameSettingsSystem>();

		public Plugin()
		{
			LogUtil.Init(((BasePlugin)this).Log);
			RulesetFilename = ((BasePlugin)this).Config.Bind<string>("General", "RulesetFilename", "MyRuleset.jsonc", "Filename of the ruleset to apply. Relative to BepInEx/config/LoadoutLockdown/");
		}

		public override void Load()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			BepInExConfigReloader = new BepInExConfigReloader(((BasePlugin)this).Config);
			_harmony = new Harmony("LoadoutLockdown");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			_hookDOTS = new HookDOTS("LoadoutLockdown", ((BasePlugin)this).Log);
			_hookDOTS.RegisterAnnotatedHooks();
			ResetRulesetManager();
			string text = "ProfuselyViolentProgression.LoadoutLockdown.resources.presets";
			RulesetManager.CreateMainFile_FromResource(text + ".Default.jsonc");
			RulesetManager.CreateExampleFile_FromResource(text + ".Default.jsonc", "Example_Default.jsonc", overwrite: true);
			RulesetManager.CreateExampleFile_FromResource(text + ".FishersFantasy.jsonc", "Example_FishersFantasy.jsonc", overwrite: true);
			RulesetManager.CreateExampleFile_FromResource(text + ".CrutchersCrucible.jsonc", "Example_CrutchersCrucible.jsonc", overwrite: true);
			RulesetManager.CreateExampleFile_FromResource(text + ".SweatlordsSwag.jsonc", "Example_SweatlordsSwag.jsonc", overwrite: true);
			Hooks.EarlyUpdateGroup_Updated += OnEarlyUpdate;
			RulesetFilename.SettingChanged += HandleRulesetFilenameChanged;
			CommandRegistry.RegisterAll();
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("LoadoutLockdown");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
		}

		public override bool Unload()
		{
			CommandRegistry.UnregisterAssembly();
			BepInExConfigReloader?.Dispose();
			Hooks.EarlyUpdateGroup_Updated -= OnEarlyUpdate;
			RulesetFilename.SettingChanged -= HandleRulesetFilenameChanged;
			_hookDOTS.Dispose();
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			if (RulesetManager != null)
			{
				RulesetManager.ConfigUpdated -= HandleRulesetChanged;
				RulesetManager.Dispose();
			}
			return true;
		}

		public void OnEarlyUpdate()
		{
			if (!_initialized && WorldUtil.IsServerInitialized)
			{
				_initialized = true;
				ReloadRuleset();
			}
		}

		public void HandleRulesetChanged(LoadoutLockdownConfig config)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			if (_initialized)
			{
				ManualLogSource log = ((BasePlugin)this).Log;
				bool flag = default(bool);
				BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(18, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Reloading ruleset ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(RulesetFilename.Value);
				}
				log.LogMessage(val);
				ResetLoadoutService(config);
			}
		}

		private void HandleRulesetFilenameChanged(object sender, EventArgs e)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Switching ruleset to ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(RulesetFilename.Value);
			}
			log.LogMessage(val);
			ResetRulesetManager();
			if (_initialized)
			{
				ReloadRuleset();
			}
		}

		public void ResetRulesetManager()
		{
			if (RulesetManager != null)
			{
				RulesetManager.ConfigUpdated -= HandleRulesetChanged;
				RulesetManager.Dispose();
			}
			RulesetManager = new ConfigManagerJSON<LoadoutLockdownConfig>("LoadoutLockdown", RulesetFilename.Value, ((BasePlugin)this).Log);
			RulesetManager.ConfigUpdated += HandleRulesetChanged;
		}

		private void ReloadRuleset()
		{
			if (!RulesetManager.TryLoadConfig(out var config))
			{
				((BasePlugin)this).Log.LogWarning((object)"Failed to load ruleset. Falling back to vanilla behaviour.");
				LoadoutLockdownService.Instance = null;
			}
			else
			{
				ResetLoadoutService(config);
			}
		}

		private void ResetLoadoutService(LoadoutLockdownConfig config)
		{
			LoadoutLockdownService.Instance = new LoadoutLockdownService(config);
			_serverGameSettingsSystem._Settings.WeaponSlots = (byte)config.WeaponSlots;
		}
	}
	[HarmonyPatch]
	public static class Hooks
	{
		public static event Action EarlyUpdateGroup_Updated;

		[EcsSystemUpdatePostfix(typeof(EarlyUpdateGroup), false)]
		public static void EarlyUpdateGroup_Postfix()
		{
			Hooks.EarlyUpdateGroup_Updated?.Invoke();
		}
	}
	internal class LoadoutLockdownService
	{
		public static LoadoutLockdownService Instance;

		private LoadoutLockdownConfig _config;

		private HashSet<PrefabGUID> _forbiddenByPrefab = new HashSet<PrefabGUID>();

		private HashSet<PrefabGUID> _notWaste = new HashSet<PrefabGUID>();

		private HashSet<PrefabGUID> _alwaysAllowSwapIntoSlot = new HashSet<PrefabGUID>();

		private Dictionary<string, PrefabGUID> _spawnablePrefabLookup;

		private static HashSet<EquipmentType> EquipmentTypesWithDesignatedSlot = new HashSet<EquipmentType>
		{
			(EquipmentType)10,
			(EquipmentType)8,
			(EquipmentType)0,
			(EquipmentType)3,
			(EquipmentType)1,
			(EquipmentType)5,
			(EquipmentType)9,
			(EquipmentType)4
		};

		public static AssetGuid SCTMessage_Nope = AssetGuid.FromString("7114de17-65b2-4e69-8723-79f8b33b2213");

		public static AssetGuid SCTMessage_Disabled = AssetGuid.FromString("3bf7e066-4e49-4ae4-b7a3-6703b7a15dc1");

		public static AssetGuid SCTMessage_CannotModifyActionBarWhilePVP = AssetGuid.FromString("1b032d4c-f114-429b-ad7c-43c2cd23262a");

		public static AssetGuid SCTMessage_NoFreeActionBarSlots = AssetGuid.FromString("8e2de316-22d6-4088-b23f-9084af440171");

		public static float3 ColorRed = new float3(255f, 0f, 0f);

		private static HashSet<EquipmentType> EquipmentTypesToUnequipIfForbidden = new HashSet<EquipmentType>
		{
			(EquipmentType)10,
			(EquipmentType)8,
			(EquipmentType)0,
			(EquipmentType)3,
			(EquipmentType)1,
			(EquipmentType)5,
			(EquipmentType)9,
			(EquipmentType)4,
			(EquipmentType)2
		};

		private EntityManager EntityManager => WorldUtil.Server.EntityManager;

		private EndSimulationEntityCommandBufferSystem EndSimulationEntityCommandBufferSystem => WorldUtil.Server.GetExistingSystemManaged<EndSimulationEntityCommandBufferSystem>();

		private static NativeParallelHashMap<PrefabGUID, ItemData> ItemHashLookupMap => WorldUtil.Server.GetExistingSystemManaged<GameDataSystem>().ItemHashLookupMap;

		private static ServerScriptMapper ServerScriptMapper => WorldUtil.Server.GetExistingSystemManaged<ServerScriptMapper>();

		private static ServerRootPrefabCollection ServerRootPrefabCollection => ((ComponentSystemBase)ServerScriptMapper).GetSingleton<ServerRootPrefabCollection>();

		private static NetworkIdLookupMap NetworkIdLookupMap => ((ComponentSystemBase)ServerScriptMapper).GetSingleton<Singleton>()._NetworkIdLookupMap;

		private int _maxWeaponSlotIndex => _config.WeaponSlots - 1;

		public int WeaponSlots => _config.WeaponSlots;

		private Dictionary<string, PrefabGUID> SpawnablePrefabLookup
		{
			get
			{
				if (_spawnablePrefabLookup == null)
				{
					PrefabCollectionSystem existingSystemManaged = WorldUtil.Server.GetExistingSystemManaged<PrefabCollectionSystem>();
					_spawnablePrefabLookup = existingSystemManaged.SpawnableNameToPrefabGuidDictionary;
				}
				return _spawnablePrefabLookup;
			}
		}

		public LoadoutLockdownService(LoadoutLockdownConfig config)
		{
			_config = config;
			InitForbiddenByPrefab();
			InitNotWaste();
			InitAlwaysAllowSwapIntoSlot();
		}

		private void InitForbiddenByPrefab()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			PrefabGUID item = default(PrefabGUID);
			foreach (string item2 in _config.ForbiddenByPrefab)
			{
				if (SpawnablePrefabLookup.TryGetValue(item2, ref item))
				{
					_forbiddenByPrefab.Add(item);
				}
				else
				{
					LogUtil.LogWarning("Unrecognized prefab in ForbiddenByPrefab: " + item2);
				}
			}
		}

		private void InitNotWaste()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			PrefabGUID item = default(PrefabGUID);
			foreach (string item2 in _config.NotWaste)
			{
				if (SpawnablePrefabLookup.TryGetValue(item2, ref item))
				{
					_notWaste.Add(item);
				}
				else
				{
					LogUtil.LogWarning("Unrecognized prefab in NotWaste: " + item2);
				}
			}
		}

		private void InitAlwaysAllowSwapIntoSlot()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			PrefabGUID item = default(PrefabGUID);
			foreach (string item2 in _config.AlwaysAllowSwapIntoSlot)
			{
				if (SpawnablePrefabLookup.TryGetValue(item2, ref item))
				{
					if (_forbiddenByPrefab.Contains(item))
					{
						LogUtil.LogWarning(item2 + " was removed from AlwaysAllowSwapIntoSlot, because it is ForbiddenByPrefab.");
					}
					else
					{
						_alwaysAllowSwapIntoSlot.Add(item);
					}
				}
				else
				{
					LogUtil.LogWarning("Unrecognized prefab in AlwaysAllowSwapIntoSlot: " + item2);
				}
			}
		}

		public bool IsEquipmentForbidden(Entity entity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<EquippableData>(entity))
			{
				return false;
			}
			entityManager = EntityManager;
			EquippableData componentData = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(entity);
			if (TryFindForbiddable(componentData, out var forbiddable) && forbiddable.Forbidden)
			{
				return true;
			}
			entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<PrefabGUID>(entity))
			{
				return false;
			}
			entityManager = EntityManager;
			PrefabGUID componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity);
			return _forbiddenByPrefab.Contains(componentData2);
		}

		public bool IsEquippableWithoutSlot(Entity entity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<EquippableData>(entity))
			{
				return false;
			}
			entityManager = EntityManager;
			EquippableData componentData = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(entity);
			if (TryFindEquippableToHotBarRules(componentData, out var rules))
			{
				return !rules.RequiresHotbarSlot;
			}
			return false;
		}

		public bool HasDesignatedSlot(Entity entity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<EquippableData>(entity))
			{
				return false;
			}
			entityManager = EntityManager;
			EquippableData componentData = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(entity);
			return EquipmentTypesWithDesignatedSlot.Contains(componentData.EquipmentType);
		}

		public bool IsDesignatedSlotWasted(Entity character, Entity equippableEntity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_009f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			if (!HasDesignatedSlot(equippableEntity))
			{
				return false;
			}
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<EquippableData>(equippableEntity))
			{
				return false;
			}
			entityManager = EntityManager;
			EquippableData componentData = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(equippableEntity);
			entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<Equipment>(character))
			{
				return false;
			}
			entityManager = EntityManager;
			Equipment componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(character);
			if (!((Equipment)(ref componentData2)).IsEquipped(componentData.EquipmentType))
			{
				return true;
			}
			Entity entity = ((Equipment)(ref componentData2)).GetEquipmentEntity(componentData.EquipmentType)._Entity;
			entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<PrefabGUID>(entity))
			{
				return false;
			}
			entityManager = EntityManager;
			PrefabGUID componentData3 = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity);
			if (_notWaste.Contains(componentData3))
			{
				return false;
			}
			return false;
		}

		public bool CanMenuSwapIntoFilledSlotDuringPVP(Entity entity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (AlwaysAllowSwapIntoSlot(entity))
			{
				return true;
			}
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<EquippableData>(entity))
			{
				return false;
			}
			entityManager = EntityManager;
			EquippableData componentData = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(entity);
			if (TryFindSwappableFromMenuDuringPVP(componentData, out var swappableRules))
			{
				return swappableRules.FromMenuDuringPVP == FromMenuDuringPVP.AllowSwapIntoFilledSlot;
			}
			return false;
		}

		public bool CanDirectlyMoveOutOfSlotDuringPVP(Entity item)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return CanMenuSwapIntoFilledSlotDuringPVP(item);
		}

		private bool TryFindForbiddable(EquippableData equippableData, out IForbiddable forbiddable)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected I4, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected I4, but got Unknown
			EquipmentType equipmentType = equippableData.EquipmentType;
			EquipmentType val = equipmentType;
			switch ((int)val)
			{
			case 10:
				forbiddable = _config.RulesByType.Bag;
				return true;
			case 8:
				forbiddable = _config.RulesByType.Cloak;
				return true;
			case 0:
				forbiddable = _config.RulesByType.Headgear;
				return true;
			case 3:
				forbiddable = _config.RulesByType.MagicSource;
				return true;
			case 1:
				forbiddable = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 5:
				forbiddable = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 9:
				forbiddable = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 4:
				forbiddable = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 2:
			{
				WeaponType weaponType = equippableData.WeaponType;
				WeaponType val2 = weaponType;
				switch (val2 - 1)
				{
				case 7:
					forbiddable = _config.RulesByType.FishingPole;
					return true;
				case 6:
					forbiddable = _config.RulesByType.WeaponTypes.Axes;
					return true;
				case 14:
					forbiddable = _config.RulesByType.WeaponTypes.Claws;
					return true;
				case 3:
					forbiddable = _config.RulesByType.WeaponTypes.Crossbow;
					return true;
				case 13:
					forbiddable = _config.RulesByType.WeaponTypes.Daggers;
					return true;
				case 10:
					forbiddable = _config.RulesByType.WeaponTypes.Greatsword;
					return true;
				case 11:
					forbiddable = _config.RulesByType.WeaponTypes.Longbow;
					return true;
				case 4:
					forbiddable = _config.RulesByType.WeaponTypes.Mace;
					return true;
				case 9:
					forbiddable = _config.RulesByType.WeaponTypes.Pistols;
					return true;
				case 2:
					forbiddable = _config.RulesByType.WeaponTypes.Reaper;
					return true;
				case 5:
					forbiddable = _config.RulesByType.WeaponTypes.Slashers;
					return true;
				case 0:
					forbiddable = _config.RulesByType.WeaponTypes.Spear;
					return true;
				case 1:
					forbiddable = _config.RulesByType.WeaponTypes.Sword;
					return true;
				case 15:
					forbiddable = _config.RulesByType.WeaponTypes.Twinblades;
					return true;
				case 12:
					forbiddable = _config.RulesByType.WeaponTypes.Whip;
					return true;
				default:
					forbiddable = null;
					return false;
				}
			}
			default:
				forbiddable = null;
				return false;
			}
		}

		private bool TryFindSwappableFromMenuDuringPVP(EquippableData equippableData, out ISwappableFromMenuDuringPVP swappableRules)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected I4, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected I4, but got Unknown
			EquipmentType equipmentType = equippableData.EquipmentType;
			EquipmentType val = equipmentType;
			switch ((int)val)
			{
			case 10:
				swappableRules = _config.RulesByType.Bag;
				return true;
			case 8:
				swappableRules = _config.RulesByType.Cloak;
				return true;
			case 0:
				swappableRules = _config.RulesByType.Headgear;
				return true;
			case 3:
				swappableRules = _config.RulesByType.MagicSource;
				return true;
			case 1:
				swappableRules = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 5:
				swappableRules = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 9:
				swappableRules = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 4:
				swappableRules = _config.RulesByType.ArmorTypes.Chest;
				return true;
			case 2:
			{
				WeaponType weaponType = equippableData.WeaponType;
				WeaponType val2 = weaponType;
				switch (val2 - 1)
				{
				case 7:
					swappableRules = _config.RulesByType.FishingPole;
					return true;
				case 6:
					swappableRules = _config.RulesByType.WeaponTypes.Axes;
					return true;
				case 14:
					swappableRules = _config.RulesByType.WeaponTypes.Claws;
					return true;
				case 3:
					swappableRules = _config.RulesByType.WeaponTypes.Crossbow;
					return true;
				case 13:
					swappableRules = _config.RulesByType.WeaponTypes.Daggers;
					return true;
				case 10:
					swappableRules = _config.RulesByType.WeaponTypes.Greatsword;
					return true;
				case 11:
					swappableRules = _config.RulesByType.WeaponTypes.Longbow;
					return true;
				case 4:
					swappableRules = _config.RulesByType.WeaponTypes.Mace;
					return true;
				case 9:
					swappableRules = _config.RulesByType.WeaponTypes.Pistols;
					return true;
				case 2:
					swappableRules = _config.RulesByType.WeaponTypes.Reaper;
					return true;
				case 5:
					swappableRules = _config.RulesByType.WeaponTypes.Slashers;
					return true;
				case 0:
					swappableRules = _config.RulesByType.WeaponTypes.Spear;
					return true;
				case 1:
					swappableRules = _config.RulesByType.WeaponTypes.Sword;
					return true;
				case 15:
					swappableRules = _config.RulesByType.WeaponTypes.Twinblades;
					return true;
				case 12:
					swappableRules = _config.RulesByType.WeaponTypes.Whip;
					return true;
				default:
					swappableRules = null;
					return false;
				}
			}
			default:
				swappableRules = null;
				return false;
			}
		}

		private bool TryFindEquippableToHotBarRules(EquippableData equippableData, out EquippableToHotbarRules rules)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected I4, but got Unknown
			if ((int)equippableData.EquipmentType != 2)
			{
				rules = null;
				return false;
			}
			WeaponType weaponType = equippableData.WeaponType;
			WeaponType val = weaponType;
			switch (val - 1)
			{
			case 7:
				rules = _config.RulesByType.FishingPole;
				return true;
			case 6:
				rules = _config.RulesByType.WeaponTypes.Axes;
				return true;
			case 14:
				rules = _config.RulesByType.WeaponTypes.Claws;
				return true;
			case 3:
				rules = _config.RulesByType.WeaponTypes.Crossbow;
				return true;
			case 13:
				rules = _config.RulesByType.WeaponTypes.Daggers;
				return true;
			case 10:
				rules = _config.RulesByType.WeaponTypes.Greatsword;
				return true;
			case 11:
				rules = _config.RulesByType.WeaponTypes.Longbow;
				return true;
			case 4:
				rules = _config.RulesByType.WeaponTypes.Mace;
				return true;
			case 9:
				rules = _config.RulesByType.WeaponTypes.Pistols;
				return true;
			case 2:
				rules = _config.RulesByType.WeaponTypes.Reaper;
				return true;
			case 5:
				rules = _config.RulesByType.WeaponTypes.Slashers;
				return true;
			case 0:
				rules = _config.RulesByType.WeaponTypes.Spear;
				return true;
			case 1:
				rules = _config.RulesByType.WeaponTypes.Sword;
				return true;
			case 15:
				rules = _config.RulesByType.WeaponTypes.Twinblades;
				return true;
			case 12:
				rules = _config.RulesByType.WeaponTypes.Whip;
				return true;
			default:
				rules = null;
				return false;
			}
		}

		public bool IsValidWeaponSlot(int slotIndex)
		{
			return slotIndex <= _maxWeaponSlotIndex;
		}

		public bool IsPlayerInventory(Entity inventoryEntity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (TryGetOwnerOfInventory(inventoryEntity, out var owner))
			{
				EntityManager entityManager = EntityManager;
				return ((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(owner);
			}
			return false;
		}

		public bool TryGetOwnerOfInventory(Entity inventoryEntity, out Entity owner)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<InventoryConnection>(inventoryEntity))
			{
				owner = default(Entity);
				return false;
			}
			entityManager = EntityManager;
			InventoryConnection componentData = ((EntityManager)(ref entityManager)).GetComponentData<InventoryConnection>(inventoryEntity);
			owner = componentData.InventoryOwner;
			return true;
		}

		public bool TryFindWastedWeaponSlot(Entity character, out int slotIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			NativeArray<InventoryBuffer> val = default(NativeArray<InventoryBuffer>);
			if (!InventoryUtilities.TryGetInventory<EntityManager>(EntityManager, character, ref val, 0))
			{
				slotIndex = 0;
				return false;
			}
			bool flag = false;
			int num = 0;
			bool flag2 = false;
			int num2 = 0;
			for (int i = 0; i <= _maxWeaponSlotIndex; i++)
			{
				if (!flag && val[i].Amount == 0)
				{
					flag = true;
					num = i;
				}
				if (!flag2 && IsWasteInWeaponSlot(val[i]))
				{
					flag2 = true;
					num2 = i;
				}
			}
			if (flag)
			{
				slotIndex = num;
				return true;
			}
			if (flag2)
			{
				slotIndex = num2;
				return true;
			}
			slotIndex = 0;
			return false;
		}

		public bool IsWasteInWeaponSlot(InventoryBuffer inventoryBufferEl)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Invalid comparison between Unknown and I4
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Invalid comparison between Unknown and I4
			PrefabGUID itemType = inventoryBufferEl.ItemType;
			if (_notWaste.Contains(itemType))
			{
				return false;
			}
			if (IsEquipmentForbidden(inventoryBufferEl.ItemEntity._Entity))
			{
				return true;
			}
			Entity entity = inventoryBufferEl.ItemEntity._Entity;
			EntityManager entityManager = EntityManager;
			if (((EntityManager)(ref entityManager)).HasComponent<EquippableData>(entity))
			{
				entityManager = EntityManager;
				EquippableData componentData = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(entity);
				return (int)componentData.EquipmentType != 2 || (int)componentData.WeaponType == 8;
			}
			return true;
		}

		public void SwapItemsInSameInventory(Entity character, int slotIndexA, int slotIndexB)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			Entity val = default(Entity);
			if (InventoryUtilities.TryGetMainInventoryEntity<EntityManager>(EntityManager, character, ref val))
			{
				EntityManager entityManager = EntityManager;
				DynamicBuffer<InventoryBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<InventoryBuffer>(val, false);
				InventoryBuffer val2 = buffer[slotIndexA];
				buffer[slotIndexA] = buffer[slotIndexB];
				buffer[slotIndexB] = val2;
			}
		}

		public bool AlwaysAllowSwapIntoSlot(Entity entity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<PrefabGUID>(entity))
			{
				return false;
			}
			entityManager = EntityManager;
			PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity);
			return _alwaysAllowSwapIntoSlot.Contains(componentData);
		}

		public void CreateSCTMessage(Entity character, AssetGuid messageGuid, float3 color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			Translation componentData = ((EntityManager)(ref entityManager)).GetComponentData<Translation>(character);
			ScrollingCombatTextMessage.Create(EntityManager, ((EntityCommandBufferSystem)EndSimulationEntityCommandBufferSystem).CreateCommandBuffer(), messageGuid, componentData.Value, color, character, 0f, default(PrefabGUID), default(Entity));
		}

		public void SendMessageEquipmentForbidden(Entity character)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			CreateSCTMessage(character, SCTMessage_Disabled, ColorRed);
		}

		public void SendMessageCannotMenuSwapDuringPVP(Entity character)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			CreateSCTMessage(character, SCTMessage_CannotModifyActionBarWhilePVP, ColorRed);
		}

		public void SendMessageNoFreeWeaponSlots(Entity character)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			CreateSCTMessage(character, SCTMessage_NoFreeActionBarSlots, ColorRed);
		}

		public bool IsValidItemEquip(Entity character, Entity fromInventory, int fromSlotIndex, bool isCosmetic)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (isCosmetic)
			{
				return true;
			}
			InventoryBuffer val = default(InventoryBuffer);
			if (!InventoryUtilities.TryGetItemAtSlot<EntityManager>(EntityManager, fromInventory, fromSlotIndex, ref val))
			{
				LogUtil.LogWarning("IsValidItemEquip could not find candidateIB");
				return false;
			}
			Entity entity = val.ItemEntity._Entity;
			if (IsEquipmentForbidden(entity))
			{
				SendMessageEquipmentForbidden(character);
				return false;
			}
			if (IsEquippableWithoutSlot(entity))
			{
				return true;
			}
			bool flag = NewWeaponEquipmentRestrictionsUtility.IsInPvPCombat(EntityManager, ServerRootPrefabCollection, character);
			if (HasDesignatedSlot(entity))
			{
				bool flag2 = !flag || CanMenuSwapIntoFilledSlotDuringPVP(entity) || IsDesignatedSlotWasted(character, entity);
				if (!flag2)
				{
					SendMessageCannotMenuSwapDuringPVP(character);
				}
				return flag2;
			}
			if (IsValidWeaponSlot(fromSlotIndex))
			{
				return true;
			}
			if (TryFindWastedWeaponSlot(character, out var slotIndex))
			{
				SwapItemsInSameInventory(character, fromSlotIndex, slotIndex);
				return true;
			}
			SendMessageNoFreeWeaponSlots(character);
			return false;
		}

		public bool IsValidItemDrop(Entity character, Entity fromInventory, int slotIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			InventoryBuffer inventoryBufferEl = default(InventoryBuffer);
			if (!InventoryUtilities.TryGetItemAtSlot<EntityManager>(EntityManager, fromInventory, slotIndex, ref inventoryBufferEl))
			{
				LogUtil.LogWarning("IsValidItemDrop could not find candidateIB");
				return false;
			}
			bool flag = NewWeaponEquipmentRestrictionsUtility.IsInPvPCombat(EntityManager, ServerRootPrefabCollection, character);
			bool flag2 = !IsValidWeaponSlot(slotIndex);
			if (!flag || flag2 || IsWasteInWeaponSlot(inventoryBufferEl))
			{
				return true;
			}
			SendMessageCannotMenuSwapDuringPVP(character);
			return false;
		}

		public bool IsValidItemDropFromDedicatedSlot(Entity character, EquipmentType equipmentType)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!NewWeaponEquipmentRestrictionsUtility.IsInPvPCombat(EntityManager, ServerRootPrefabCollection, character))
			{
				return true;
			}
			EntityManager entityManager = EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<Equipment>(character))
			{
				LogUtil.LogWarning("IsValidItemDropFromDedicatedSlot failed to find Equipment on character");
				return true;
			}
			entityManager = EntityManager;
			Equipment componentData = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(character);
			Entity entity = ((Equipment)(ref componentData)).GetEquipmentEntity(equipmentType)._Entity;
			if (CanDirectlyMoveOutOfSlotDuringPVP(entity))
			{
				return true;
			}
			SendMessageCannotMenuSwapDuringPVP(character);
			return false;
		}

		public void UnEquipForbiddenItemsFromAllPlayerCharacters()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<PlayerCharacter>(),
				ComponentType.ReadWrite<Equipment>()
			});
			val.Options = (EntityQueryOptions)2;
			array[0] = val;
			EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
			NativeArray<Entity> val3 = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			NativeArray<PlayerCharacter> val4 = ((EntityQuery)(ref val2)).ToComponentDataArray<PlayerCharacter>(AllocatorHandle.op_Implicit((Allocator)2));
			NativeArray<Equipment> val5 = ((EntityQuery)(ref val2)).ToComponentDataArray<Equipment>(AllocatorHandle.op_Implicit((Allocator)2));
			LogUtil.LogInfo("Unequipping forbidden items from all players...");
			int num = 0;
			for (int i = 0; i < val3.Length; i++)
			{
				num += UnEquipForbiddenItems(val3[i], val4[i], val5[i]);
			}
			LogUtil.LogInfo($"Unequipped {num} forbidden items.");
		}

		public int UnEquipForbiddenItems(Entity characterEntity, PlayerCharacter playerCharacter, Equipment equipment)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			bool flag = default(bool);
			PrefabGUID prefabGuid = default(PrefabGUID);
			foreach (EquipmentType item in EquipmentTypesToUnequipIfForbidden)
			{
				Entity entity = ((Equipment)(ref equipment)).GetEquipmentEntity(item)._Entity;
				if (IsEquipmentForbidden(entity))
				{
					if (InventoryUtilitiesServer.TryUnEquipAndAddItem(EntityManager, ItemHashLookupMap, characterEntity, characterEntity, 1, entity, ref flag, default(Nullable_Unboxed<EntityCommandBuffer>)))
					{
						EntityManager entityManager = EntityManager;
						((EntityManager)(ref entityManager)).TryGetComponentData<PrefabGUID>(entity, ref prefabGuid);
						LogUtil.LogInfo($"  Unequipped forbidden {item} from player {playerCharacter.Name}: {DebugUtil.LookupPrefabName(prefabGuid)}");
						num++;
					}
					else
					{
						LogUtil.LogWarning($"  Failed to unequip forbidden {item} from player {playerCharacter.Name}");
					}
				}
			}
			return num;
		}
	}
	[HarmonyPatch]
	public static class Patches
	{
		private static EntityManager EntityManager = WorldUtil.Game.EntityManager;

		private const bool SKIP_ORIGINAL_METHOD = false;

		private const bool EXECUTE_ORIGINAL_METHOD = true;

		private static LoadoutLockdownService LoadoutService => LoadoutLockdownService.Instance;

		private static NativeParallelHashMap<PrefabGUID, ItemData> ItemHashLookupMap => WorldUtil.Server.GetExistingSystemManaged<GameDataSystem>().ItemHashLookupMap;

		private static ServerScriptMapper ServerScriptMapper => WorldUtil.Server.GetExistingSystemManaged<ServerScriptMapper>();

		private static ServerRootPrefabCollection ServerRootPrefabCollection => ((ComponentSystemBase)ServerScriptMapper).GetSingleton<ServerRootPrefabCollection>();

		private static NetworkIdLookupMap NetworkIdLookupMap => ((ComponentSystemBase)ServerScriptMapper).GetSingleton<Singleton>()._NetworkIdLookupMap;

		[HarmonyPatch(typeof(InventoryUtilitiesServer), "TryAddItem", new Type[]
		{
			typeof(AddItemSettings),
			typeof(Entity),
			typeof(PrefabGUID),
			typeof(int)
		})]
		[HarmonyPrefix]
		public static void TryAddItem_Prefix(ref AddItemSettings addItemSettings, Entity target, PrefabGUID itemType, int amount)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			ItemData val = default(ItemData);
			if (ItemHashLookupMap.TryGetValue(itemType, ref val) && LoadoutService.IsEquipmentForbidden(val.Entity))
			{
				addItemSettings.EquipIfPossible = false;
			}
		}

		[HarmonyPatch(typeof(InventoryUtilitiesServer), "TryAddItem", new Type[]
		{
			typeof(AddItemSettings),
			typeof(Entity),
			typeof(InventoryBuffer)
		})]
		[HarmonyPrefix]
		public static void TryAddItem_Prefix(ref AddItemSettings addItemSettings, Entity target, InventoryBuffer inventoryItem)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			ItemData val = default(ItemData);
			if (ItemHashLookupMap.TryGetValue(inventoryItem.ItemType, ref val) && LoadoutService.IsEquipmentForbidden(val.Entity))
			{
				addItemSettings.EquipIfPossible = false;
			}
		}

		[HarmonyPatch(typeof(NewWeaponEquipmentRestrictionsUtility), "IsValidWeaponEquip")]
		[HarmonyPrefix]
		public static bool IsValidWeaponEquip_Prefix(ref bool __result, EntityManager entityManager, EquippableData equippableData, EquipItemEvent equipItem, ServerRootPrefabCollection serverRootPrefabs, Entity character, NativeParallelHashMap<PrefabGUID, ItemData> itemHashLookupMap, int weaponSlots)
		{
			if (LoadoutService == null)
			{
				return true;
			}
			__result = true;
			return false;
		}

		[HarmonyPatch(typeof(NewWeaponEquipmentRestrictionsUtility), "IsValidItemMove")]
		[HarmonyPrefix]
		public static bool IsValidItemMove_Prefix(ref bool __result, EntityManager entityManager, ServerRootPrefabCollection serverRootPrefabCollection, NativeParallelHashMap<PrefabGUID, ItemData> itemDataMap, MoveItemBetweenInventoriesEvent moveEvent, Entity toInventory, Entity fromInventory, int weaponSlots)
		{
			//IL_001d: 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)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			if (LoadoutService == null)
			{
				return true;
			}
			bool flag = LoadoutService.IsPlayerInventory(fromInventory);
			bool flag2 = LoadoutService.IsPlayerInventory(toInventory);
			Entity owner = default(Entity);
			bool flag3 = false;
			if (flag)
			{
				flag3 = LoadoutService.TryGetOwnerOfInventory(fromInventory, out owner);
			}
			else if (flag2)
			{
				flag3 = LoadoutService.TryGetOwnerOfInventory(toInventory, out owner);
			}
			if (!flag3)
			{
				__result = true;
				return false;
			}
			bool flag4 = NewWeaponEquipmentRestrictionsUtility.IsInPvPCombat(EntityManager, serverRootPrefabCollection, owner);
			bool flag5 = flag && LoadoutService.IsValidWeaponSlot(moveEvent.FromSlot);
			bool flag6 = flag2 && LoadoutService.IsValidWeaponSlot(moveEvent.ToSlot);
			bool flag7 = !flag5 && !flag6;
			bool flag8 = flag5 && flag6;
			if (!flag4 || flag7 || flag8)
			{
				__result = true;
				return false;
			}
			bool flag9;
			InventoryBuffer inventoryBufferEl = default(InventoryBuffer);
			bool flag10;
			InventoryBuffer val = default(InventoryBuffer);
			if (flag5)
			{
				flag9 = !InventoryUtilities.TryGetItemAtSlot<EntityManager>(EntityManager, fromInventory, moveEvent.FromSlot, ref inventoryBufferEl);
				flag10 = !InventoryUtilities.TryGetItemAtSlot<EntityManager>(EntityManager, toInventory, moveEvent.ToSlot, ref val);
			}
			else
			{
				flag10 = !InventoryUtilities.TryGetItemAtSlot<EntityManager>(EntityManager, fromInventory, moveEvent.FromSlot, ref val);
				flag9 = !InventoryUtilities.TryGetItemAtSlot<EntityManager>(EntityManager, toInventory, moveEvent.ToSlot, ref inventoryBufferEl);
			}
			if (flag10 && flag9)
			{
				__result = true;
				return false;
			}
			bool flag11 = !flag10 && LoadoutService.HasDesignatedSlot(val.ItemEntity._Entity);
			if (!flag10 && !flag11 && LoadoutService.AlwaysAllowSwapIntoSlot(val.ItemEntity._Entity))
			{
				__result = true;
				return false;
			}
			if (!flag10 && !flag11 && LoadoutService.CanMenuSwapIntoFilledSlotDuringPVP(val.ItemEntity._Entity))
			{
				__result = true;
				return false;
			}
			if (flag9 || LoadoutService.IsWasteInWeaponSlot(inventoryBufferEl))
			{
				__result = true;
				return false;
			}
			if (flag10 && LoadoutService.IsWasteInWeaponSlot(inventoryBufferEl))
			{
				__result = true;
				return false;
			}
			__result = false;
			return false;
		}

		[HarmonyPatch(typeof(NewWeaponEquipmentRestrictionsUtility), "IsValidItemDrop")]
		[HarmonyPrefix]
		public static bool IsValidItemDrop_Prefix(ref bool __result, EntityManager entityManager, Entity characterEntity, int slotId, ServerRootPrefabCollection serverRootPrefabs)
		{
			if (LoadoutService == null)
			{
				return true;
			}
			__result = true;
			return false;
		}

		[HarmonyPatch(typeof(InventoryUtilitiesServer), "TryUnEquipAndAddItem")]
		[HarmonyPrefix]
		public static bool TryUnEquipAndAddItem_Prefix(ref bool __result, EntityManager entityManager, NativeParallelHashMap<PrefabGUID, ItemData> itemDataMap, Entity target, Entity inventoryOwnerEntity, int toSlotIndex, Entity item, out bool addedToInventory, Nullable_Unboxed<EntityCommandBuffer> commandBuffer)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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)
			addedToInventory = false;
			if (LoadoutService == null)
			{
				return true;
			}
			if (!NewWeaponEquipmentRestrictionsUtility.IsInPvPCombat(EntityManager, ServerRootPrefabCollection, target) || LoadoutService.CanDirectlyMoveOutOfSlotDuringPVP(item))
			{
				return true;
			}
			LoadoutService.SendMessageCannotMenuSwapDuringPVP(target);
			__result = false;
			return false;
		}

		[HarmonyPatch(typeof(EquipItemFromInventorySystem), "OnUpdate")]
		[HarmonyPrefix]
		public static void EquipItemFromInventorySystem_OnUpdate_Prefix(EquipItemFromInventorySystem __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_004c: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			if (LoadoutService == null)
			{
				return;
			}
			EntityQuery query = __instance._Query;
			NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			query = __instance._Query;
			NativeArray<EquipItemFromInventoryEvent> val2 = ((EntityQuery)(ref query)).ToComponentDataArray<EquipItemFromInventoryEvent>(AllocatorHandle.op_Implicit((Allocator)2));
			query = __instance._Query;
			NativeArray<FromCharacter> val3 = ((EntityQuery)(ref query)).ToComponentDataArray<FromCharacter>(AllocatorHandle.op_Implicit((Allocator)2));
			NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = NetworkIdLookupMap._NetworkIdToEntityMap;
			Entity fromInventory2 = default(Entity);
			for (int i = 0; i < val.Length; i++)
			{
				int slotIndex = val2[i].SlotIndex;
				NetworkId fromInventory = val2[i].FromInventory;
				if (!networkIdToEntityMap.TryGetValue(fromInventory, ref fromInventory2))
				{
					LogUtil.LogWarning("EquipItemFromInventorySystem_OnUpdate_Prefix: Failed to find inventory entity from network id");
				}
				else if (!LoadoutService.IsValidItemEquip(val3[i].Character, fromInventory2, slotIndex, val2[i].IsCosmetic))
				{
					((EntityManager)(ref EntityManager)).DestroyEntity(val[i]);
				}
			}
		}

		[HarmonyPatch(typeof(EquipItemSystem), "OnUpdate")]
		[HarmonyPrefix]
		public static void EquipItemFSystem_OnUpdate_Prefix(EquipItemSystem __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (LoadoutService == null)
			{
				return;
			}
			EntityQuery _query_1850505309_ = __instance.__query_1850505309_0;
			NativeArray<Entity> val = ((EntityQuery)(ref _query_1850505309_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			NativeArray<EquipItemEvent> val2 = ((EntityQuery)(ref _query_1850505309_)).ToComponentDataArray<EquipItemEvent>(AllocatorHandle.op_Implicit((Allocator)2));
			NativeArray<FromCharacter> val3 = ((EntityQuery)(ref _query_1850505309_)).ToComponentDataArray<FromCharacter>(AllocatorHandle.op_Implicit((Allocator)2));
			for (int i = 0; i < val.Length; i++)
			{
				int slotIndex = val2[i].SlotIndex;
				if (!LoadoutService.IsValidItemEquip(val3[i].Character, val3[i].Character, slotIndex, val2[i].IsCosmetic))
				{
					((EntityManager)(ref EntityManager)).DestroyEntity(val[i]);
				}
			}
		}

		[HarmonyPatch(typeof(InventoryUtilitiesServer), "TryUnEquipItem", new Type[]
		{
			typeof(EntityManager),
			typeof(Entity),
			typeof(Entity),
			typeof(Nullable_Unboxed<EntityCommandBuffer>)
		})]
		[HarmonyPrefix]
		public static bool TryUnEquipItem_Prefix(ref bool __result, EntityManager entityManager, Entity target, Entity item, Nullable_Unboxed<EntityCommandBuffer> commandBuffer)
		{
			return true;
		}

		[HarmonyPatch(typeof(InventoryUtilitiesServer), "TryUnEquipItem", new Type[]
		{
			typeof(EntityManager),
			typeof(Entity),
			typeof(PrefabGUID),
			typeof(Nullable_Unboxed<EntityCommandBuffer>)
		})]
		[HarmonyPrefix]
		public static bool TryUnEquipItem_Prefix(ref bool __result, EntityManager entityManager, Entity target, PrefabGUID type, Nullable_Unboxed<EntityCommandBuffer> commandBuffer)
		{
			return true;
		}

		[HarmonyPatch(typeof(DropItemSystem), "OnUpdate")]
		[HarmonyPrefix]
		public static void DropItemSystem_OnUpdate_Prefix(DropItemSystem __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d