Decompiled source of ServersideQoL Backpack v2.4.1

ServersideQoL.Backpack.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MonoMod.Utils;
using ServersideQoL.Processors;
using ServersideQoL.Utilities;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ArgusMagnus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("ArgusMagnus")]
[assembly: AssemblyDescription("Adds a backpack with progressively larger storage capacity")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyInformationalVersion("2.4.1+0f7454f795c3611da8d9e968e0cf3e4b7b95900e")]
[assembly: AssemblyProduct("ServersideQoL.Backpack")]
[assembly: AssemblyTitle("ServersideQoL.Backpack")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Count;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Count;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Count;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyList(List<T> items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return _items.Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		_items.CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return _items.IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 ServersideQoL.Backpack
{
	[BepInPlugin("ArgusMagnus.ServersideQoL.Backpack", "ServersideQoL.Backpack", "2.4.1")]
	public sealed class BackpackPlugin : ServersideQoLPluginBase<BackpackPlugin, Config>
	{
		public const string Author = "ArgusMagnus";

		public const string PluginName = "ServersideQoL.Backpack";

		public const string PluginGuid = "ArgusMagnus.ServersideQoL.Backpack";

		public const string PluginVersion = "2.4.1";

		public const string PluginInformationalVersion = "2.4.1";

		private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639282659569971122L, default(TimeSpan));

		protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger)
		{
			return new Config(configFile, logger);
		}

		protected override void RegisterProcessors(IProcessorCollection processors)
		{
			processors.Add<BackpackProcessor>();
		}

		private void Awake()
		{
		}
	}
	[Processor("fdd88a40-add7-413c-ac4b-894ac26c500d")]
	[DependsOn<PlayerRegistryProcessor>]
	[DependsOn<ContainerRegistryProcessor>]
	internal sealed class BackpackProcessor : Processor<BackpackProcessor.PrefabInfo>
	{
		public sealed record PrefabInfo(Container? Container, Player? Player) : ProcessorPrefabInfo()
		{
			[MemberNotNullWhen(true, "Container")]
			public bool IsBackpack
			{
				[MemberNotNullWhen(true, "Container")]
				get;
				[MemberNotNullWhen(true, "Container")]
				private set;
			}

			[MemberNotNullWhen(true, "Container")]
			public bool IsBackpackTombstone
			{
				[MemberNotNullWhen(true, "Container")]
				get;
				[MemberNotNullWhen(true, "Container")]
				private set;
			}

			public override bool IsValid
			{
				get
				{
					if (Player == null && !(IsBackpack = ((ProcessorPrefabInfo)this).PrefabInfo.PrefabHash == BackpackPrefabHash))
					{
						return IsBackpackTombstone = ((ProcessorPrefabInfo)this).PrefabInfo.PrefabHash == BackpackTombstonePrefab;
					}
					return true;
				}
			}

			[CompilerGenerated]
			public override string ToString()
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.Append("PrefabInfo");
				stringBuilder.Append(" { ");
				if (((ProcessorPrefabInfo)this).PrintMembers(stringBuilder))
				{
					stringBuilder.Append(' ');
				}
				stringBuilder.Append('}');
				return stringBuilder.ToString();
			}

			[CompilerGenerated]
			protected override bool PrintMembers(StringBuilder builder)
			{
				if (((ProcessorPrefabInfo)this).PrintMembers(builder))
				{
					builder.Append(", ");
				}
				builder.Append("Container = ");
				builder.Append(Container);
				builder.Append(", Player = ");
				builder.Append(Player);
				builder.Append(", IsBackpack = ");
				builder.Append(IsBackpack.ToString());
				builder.Append(", IsBackpackTombstone = ");
				builder.Append(IsBackpackTombstone.ToString());
				return true;
			}

			[CompilerGenerated]
			public override int GetHashCode()
			{
				return (((((ProcessorPrefabInfo)this).GetHashCode() * -1521134295 + EqualityComparer<Container>.Default.GetHashCode(Container)) * -1521134295 + EqualityComparer<Player>.Default.GetHashCode(Player)) * -1521134295 + EqualityComparer<bool>.Default.GetHashCode(IsBackpack)) * -1521134295 + EqualityComparer<bool>.Default.GetHashCode(IsBackpackTombstone);
			}

			[CompilerGenerated]
			public sealed override bool Equals(ProcessorPrefabInfo? other)
			{
				return ((object)this).Equals((object?)other);
			}

			[CompilerGenerated]
			public bool Equals(PrefabInfo? other)
			{
				if ((object)this != other)
				{
					if (((ProcessorPrefabInfo)this).Equals((ProcessorPrefabInfo)(object)other) && EqualityComparer<Container>.Default.Equals(Container, other.Container) && EqualityComparer<Player>.Default.Equals(Player, other.Player) && EqualityComparer<bool>.Default.Equals(IsBackpack, other.IsBackpack))
					{
						return EqualityComparer<bool>.Default.Equals(IsBackpackTombstone, other.IsBackpackTombstone);
					}
					return false;
				}
				return true;
			}

			[CompilerGenerated]
			private PrefabInfo(PrefabInfo original)
				: base((ProcessorPrefabInfo)(object)original)
			{
				Container = original.Container;
				Player = original.Player;
				IsBackpack = original.IsBackpack;
				IsBackpackTombstone = original.IsBackpackTombstone;
			}
		}

		private sealed class State(BackpackProcessor processor, PlayerState playerState)
		{
			private readonly BackpackProcessor _processor = processor;

			private ServersideQoLZDO? _backpackContainer;

			public PlayerState PlayerState { get; } = playerState;

			public Container? Container { get; private set; }

			public bool? HasMegingjordEffect { get; set; }

			public ServersideQoLZDO? BackpackContainer
			{
				get
				{
					return _backpackContainer;
				}
				set
				{
					if (_backpackContainer != null)
					{
						processor._backpacks.Remove(_backpackContainer);
					}
					_backpackContainer = value;
					if (_backpackContainer != null)
					{
						processor._backpacks.Add(_backpackContainer, this);
						_backpackContainer.Destroyed += OnBackpackDestroyed;
					}
				}
			}

			public Timestamp? OpenBackpackAfter { get; set; }

			private void OnBackpackDestroyed(ServersideQoLZDO backpack)
			{
				processor._backpacks.Remove(backpack);
				if (backpack == _backpackContainer)
				{
					_backpackContainer = null;
				}
			}

			[MemberNotNull(new string[] { "BackpackContainer", "Container" })]
			public bool EnsureBackpackExists()
			{
				//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_0052: 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_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: 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_0111: Unknown result type (might be due to invalid IL or missing references)
				int privateChest = Prefabs.PrivateChest;
				Vector3 position = PlayerState.ZDO.ZDO.GetPosition();
				position.y -= 0.6f;
				if (BackpackContainer == null)
				{
					BackpackContainer = GetExistingBackpack();
				}
				if (BackpackContainer == null)
				{
					BackpackContainer = ((Processor)processor).PlacePiece(position, privateChest, 0f, (CreatorMarkers)2);
					ZDOVars vars = BackpackContainer.Vars;
					((ZDOVars)(ref vars)).SetPlayerID(PlayerState.PlayerID, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 435);
					AdjustSizeAndName(BackpackContainer, processor._backpackSlots, processor._maxBackpackWeight);
					BackpackContainer.ZDO.SetOwnerInternal(PlayerState.Owner);
				}
				else
				{
					if (!AdjustSizeAndName(BackpackContainer, processor._backpackSlots, processor._maxBackpackWeight) && !(Vector3.Distance(PlayerState.ZDO.ZDO.GetPosition(), BackpackContainer.ZDO.GetPosition()) > InventoryGui.instance.m_autoCloseDistance))
					{
						Container = Processor.GetPrefabInfo(BackpackContainer).GetRequiredComponent<Container>();
						return true;
					}
					BackpackContainer.ZDO.SetPosition(position);
					BackpackContainer.ZDO.SetOwnerInternal(PlayerState.Owner);
					BackpackContainer = ((Processor)processor).RecreatePiece(BackpackContainer);
				}
				Container = Processor.GetPrefabInfo(BackpackContainer).GetRequiredComponent<Container>();
				return false;
				static bool AdjustSizeAndName(ServersideQoLZDO zdo, int slots, int maxWeight)
				{
					//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)
					ComponentFieldAccessor<Container> val = zdo.Fields<Container>();
					ContainerState state = Processor.Instance<ContainerRegistryProcessor>().GetState(zdo);
					IInventory inventory = state.GetInventory();
					int num = Math.Max(slots, inventory.Items.Count);
					ValueTuple<int, int> inventorySize = Processor.GetInventorySize(num, true);
					int item = inventorySize.Item1;
					int item2 = inventorySize.Item2;
					bool num2 = val.UpdateValue((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_width), item, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 396);
					bool flag = val.UpdateValue((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_height), item2, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 397);
					bool flag2 = val.UpdateValue((Func<Expression<Func<Container, string>>>)(() => (Container x) => x.m_name), ConfigBase<Config>.Instance.Localization.Value.FormatBackpackName(maxWeight), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 398);
					if (!num2 && !flag && !flag2)
					{
						return false;
					}
					using (List<ItemData>.Enumerator enumerator = inventory.Items.GetEnumerator())
					{
						int num3 = 0;
						while (true)
						{
							if (num3 >= item2)
							{
								flag2 = true;
								break;
							}
							int num4 = 0;
							while (true)
							{
								if (num4 >= item)
								{
									num3++;
									break;
								}
								if (!enumerator.MoveNext())
								{
									zdo.ClaimOwnershipInternal();
									inventory.Save();
									flag2 = true;
									goto end_IL_0150;
								}
								enumerator.Current.m_gridPos = new Vector2i(num4, num3);
								num4++;
							}
							continue;
							end_IL_0150:
							break;
						}
					}
					return flag2;
				}
			}

			private ServersideQoLZDO? GetExistingBackpack()
			{
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Invalid comparison between Unknown and I4
				//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_0062: 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_006a: 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)
				ServersideQoLZDO val = null;
				Container val2 = null;
				CreatorMarkers val3 = default(CreatorMarkers);
				foreach (ServersideQoLZDO placedObject in ((Processor)processor).PlacedObjects)
				{
					PrefabInfo processorPrefabInfo = Processor<PrefabInfo>.GetProcessorPrefabInfo(placedObject);
					if ((object)processorPrefabInfo == null)
					{
						continue;
					}
					Container container = processorPrefabInfo.Container;
					if (container == null || !placedObject.IsModCreator(ref val3) || (int)val3 != 2)
					{
						continue;
					}
					ZDOVars vars = placedObject.Vars;
					if (((ZDOVars)(ref vars)).GetPlayerID(default(PlayerID)) != PlayerState.PlayerID)
					{
						continue;
					}
					if (val == null)
					{
						val2 = container;
						val = placedObject;
						continue;
					}
					IInventory inventory = Processor.Instance<ContainerRegistryProcessor>().GetState(val, val2).GetInventory();
					if (inventory.Items.Count == 0)
					{
						val.Destroy();
						val2 = container;
						val = placedObject;
						continue;
					}
					IInventory inventory2 = Processor.Instance<ContainerRegistryProcessor>().GetState(placedObject, container).GetInventory();
					if (inventory2.Items.Count == 0)
					{
						placedObject.Destroy();
						continue;
					}
					((Processor)processor).Logger.LogWarning((object)("Additional backpack found for player " + PlayerState.PlayerName + ", dropping backpack tombstone at player location"));
					processor.CreateBackpackTombstone(PlayerState, PlayerState.Owner, inventory2);
					placedObject.Destroy();
				}
				return val;
			}
		}

		public const string Id = "fdd88a40-add7-413c-ac4b-894ac26c500d";

		private readonly Dictionary<ServersideQoLZDO, State> _backpacks = new Dictionary<ServersideQoLZDO, State>();

		private readonly Dictionary<ServersideQoLZDO, State> _backpacksByPlayer = new Dictionary<ServersideQoLZDO, State>();

		private int _backpackSlots;

		private int _maxBackpackWeight;

		private Func<PlayerID, bool>? _hasMegingjordEffect;

		private static readonly ServerVar<bool> __isBackpackTombstone = ServersideQoLPluginBaseCore<BackpackPlugin, Config>.RegisterServerVar<bool>("IsBackbackTombstone");

		private static int BackpackPrefabHash => Prefabs.PrivateChest;

		private static int BackpackTombstonePrefab => Prefabs.TombStone;

		protected override void Initialize()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Invalid comparison between Unknown and I4
			_backpacks.Clear();
			_backpacksByPlayer.Clear();
			Processor.Instance<PlayerRegistryProcessor>().EmoteDetected -= OnEmoteDetected;
			ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.GlobalKeysChanged -= UpdateBackpackSlots;
			if ((int)ConfigBase<Config>.Instance.OpenBackpackEmote.Value == -1)
			{
				_backpackSlots = 0;
			}
			else
			{
				UpdateBackpackSlots();
				if (ConfigBase<Config>.Instance.AdditionalBackpackSlotsPerDefeatedBoss.Value != 0)
				{
					ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.GlobalKeysChanged += UpdateBackpackSlots;
				}
				Processor.Instance<PlayerRegistryProcessor>().EmoteDetected += OnEmoteDetected;
				if (_hasMegingjordEffect == null)
				{
					Processor val = Processor.Instance(new Guid("7b156eea-3364-40ca-83ad-417a55fa6e4b"));
					if (val != null)
					{
						MethodInfo methodInfo = AccessTools.Method(((object)val).GetType(), "HasMegingjordEffect", new Type[1] { typeof(PlayerID) }, (Type[])null);
						_hasMegingjordEffect = (((object)methodInfo != null) ? Extensions.CreateDelegate<Func<PlayerID, bool>>((MethodBase)methodInfo, (object)val) : null);
					}
				}
			}
			RpcName onDeath = Player.OnDeath;
			Action<RoutedRPCData> action = RPC_OnDeath;
			Config instance = ConfigBase<Config>.Instance;
			int num;
			if (instance != null)
			{
				ConfigEntry<Emotes> openBackpackEmote = instance.OpenBackpackEmote;
				if (openBackpackEmote != null && (int)openBackpackEmote.Value != -1)
				{
					ConfigEntry<Config.BackPackOnDeathOptions> backpackOnDeath = instance.BackpackOnDeath;
					if (backpackOnDeath != null)
					{
						num = ((backpackOnDeath.Value != Config.BackPackOnDeathOptions.Keep) ? 1 : 0);
						goto IL_013b;
					}
				}
			}
			num = 0;
			goto IL_013b;
			IL_013b:
			Intercept.UpdateInterception(onDeath, (Delegate)action, (byte)num != 0);
		}

		protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, PrefabInfo prefabInfo)
		{
			//IL_0034: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: 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_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			State value;
			ProcessResult result;
			float num;
			Timestamp now;
			float num3;
			ZDOVars vars;
			if (prefabInfo.IsBackpack)
			{
				if (!_backpacks.TryGetValue(zdo, out value))
				{
					return (ProcessResult)((!((Processor)this).PlacedObjects.Contains(zdo)) ? 2 : 0);
				}
				result = (ProcessResult)0;
				bool flag = value.PlayerState.ZDO.ZDO.IsOwner();
				bool flag2 = false;
				bool flag3 = false;
				num = 0f;
				ContainerState state = Processor.Instance<ContainerRegistryProcessor>().GetState(zdo, prefabInfo.Container);
				IInventory inventory = state.GetInventory();
				Vector3 position = value.PlayerState.ZDO.ZDO.GetPosition();
				position.y += 2f;
				for (int num2 = inventory.Items.Count - 1; num2 >= 0; num2--)
				{
					ItemData val = inventory.Items[num2];
					bool flag4 = false;
					if (!Processor.IsItemTeleportable(val))
					{
						flag2 = true;
						if (flag)
						{
							flag4 = true;
						}
					}
					if (!flag4)
					{
						num += val.GetWeight(-1);
						if (_maxBackpackWeight > -1 && num > (float)_maxBackpackWeight)
						{
							flag3 = true;
							if (flag)
							{
								flag4 = true;
							}
						}
					}
					if (flag4)
					{
						ItemDrop.DropItem(val, 0, position, value.PlayerState.ZDO.ZDO.GetRotation());
						inventory.Items.RemoveAt(num2);
					}
				}
				if (flag)
				{
					if (flag2 || flag3)
					{
						long owner = zdo.ZDO.GetOwner();
						zdo.ClaimOwnershipInternal();
						inventory.Save();
						zdo.ZDO.SetOwnerInternal(owner);
						value.BackpackContainer = ((Processor)this).RecreatePiece(zdo);
						RPC.ShowMessage(owner, (MessageType)2, flag2 ? ConfigBase<Config>.Instance.Localization.Value.ForbiddenItems : ConfigBase<Config>.Instance.Localization.Value.FormatWeightLimitExceeded(_maxBackpackWeight));
						State state2 = value;
						now = Timestamp.Now;
						state2.OpenBackpackAfter = ((Timestamp)(ref now)).AddSeconds(ConfigBase<Config>.Instance.Advanced.Value.OpenBackpackDelay);
					}
				}
				else
				{
					if (flag2)
					{
						value.PlayerState.AddGlobalKeyModification(new GlobalKey((GlobalKeys)32), true, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs");
					}
					else
					{
						value.PlayerState.RemoveGlobalKeyModification(new GlobalKey((GlobalKeys)32), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs");
					}
					if (flag3)
					{
						num3 = 300f;
						vars = value.PlayerState.ZDO.Vars;
						if (((ZDOVars)(ref vars)).GetEquippedItemHash((EquipmemtSlots)6, 0) != Prefabs.Megingjord)
						{
							State state3 = value;
							bool? hasMegingjordEffect = state3.HasMegingjordEffect;
							bool valueOrDefault = hasMegingjordEffect == true;
							bool num4;
							if (!hasMegingjordEffect.HasValue)
							{
								valueOrDefault = _hasMegingjordEffect?.Invoke(value.PlayerState.PlayerID) ?? false;
								bool? hasMegingjordEffect2 = valueOrDefault;
								state3.HasMegingjordEffect = hasMegingjordEffect2;
								num4 = valueOrDefault;
							}
							else
							{
								num4 = valueOrDefault;
							}
							if (!num4)
							{
								goto IL_02f2;
							}
						}
						num3 += 150f;
						goto IL_02f2;
					}
					value.PlayerState.RemoveGlobalKeyModification(new GlobalKey((GlobalKeys)16), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs");
				}
				goto IL_033a;
			}
			if (prefabInfo.IsBackpackTombstone)
			{
				if (!__isBackpackTombstone.Get(zdo, false))
				{
					return (ProcessResult)2;
				}
				PlayerRegistryProcessor obj = Processor.Instance<PlayerRegistryProcessor>();
				vars = zdo.Vars;
				PlayerState stateForPlayerID = obj.GetStateForPlayerID(((ZDOVars)(ref vars)).GetCreator(default(PlayerID)));
				if (stateForPlayerID != null)
				{
					vars = stateForPlayerID.ZDO.Vars;
					if (!((ZDOVars)(ref vars)).GetIsDead(false) && Vector3.Distance(stateForPlayerID.ZDO.ZDO.GetPosition(), zdo.ZDO.GetPosition()) < ConfigBase<Config>.Instance.Advanced.Value.BackpackOnDeathDropTombStone.AutoCollectDistance && _backpacksByPlayer.TryGetValue(stateForPlayerID.ZDO, out State value2))
					{
						value2.EnsureBackpackExists();
						IInventory inventory2 = Processor.Instance<ContainerRegistryProcessor>().GetState(zdo, prefabInfo.Container).GetInventory();
						IInventory inventory3 = Processor.Instance<ContainerRegistryProcessor>().GetState(value2.BackpackContainer, value2.Container).GetInventory();
						foreach (ItemData item in inventory2.Items)
						{
							if (!inventory3.Inventory.AddItem(item))
							{
								DropBackpackItem(item, zdo, stateForPlayerID.Owner);
							}
						}
						value2.BackpackContainer.ClaimOwnershipInternal();
						inventory3.Save();
						RPC.ShowMessage(stateForPlayerID.Owner, (MessageType)2, "$piece_tombstone_recovered (" + ConfigBase<Config>.Instance.Localization.Value.FormatBackpackName(_maxBackpackWeight) + ")");
						zdo.Destroy();
					}
				}
				return ((Processor)this).ScheduleReprocessing(0.1f);
			}
			if (prefabInfo.Player != null)
			{
				if (_backpacksByPlayer.TryGetValue(zdo, out State value3) && value3.BackpackContainer != null)
				{
					Timestamp? openBackpackAfter = value3.OpenBackpackAfter;
					now = Timestamp.Now;
					if (openBackpackAfter.HasValue && openBackpackAfter.GetValueOrDefault() < now)
					{
						value3.OpenBackpackAfter = null;
						ZDORpc rPC = value3.BackpackContainer.RPC;
						ContainerRpc container = ((ZDORpc)(ref rPC)).Container;
						((ContainerRpc)(ref container)).OpenResponse(true);
					}
					else if (value3.BackpackContainer.ZDO.GetPosition().y > -1000f && Vector3.Distance(zdo.ZDO.GetPosition(), value3.BackpackContainer.ZDO.GetPosition()) > InventoryGui.instance.m_autoCloseDistance)
					{
						ZDO zDO = value3.BackpackContainer.ZDO;
						Vector3 position2 = value3.BackpackContainer.ZDO.GetPosition();
						position2.y = -1000f;
						zDO.SetPosition(position2);
						value3.BackpackContainer = ((Processor)this).RecreatePiece(value3.BackpackContainer);
					}
				}
				return ((Processor)this).ScheduleReprocessing(0.1f);
			}
			return (ProcessResult)2;
			IL_033a:
			return result;
			IL_02f2:
			float num5 = default(float);
			if (!ZoneSystem.instance.GetGlobalKey((GlobalKeys)16, ref num5))
			{
				num5 = 100f;
			}
			num5 -= (num - (float)_maxBackpackWeight) * 100f / num3;
			value.PlayerState.AddOrUpdateGlobalKeyModification(new GlobalKey((GlobalKeys)16), num5, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs");
			goto IL_033a;
		}

		private void UpdateBackpackSlots()
		{
			_backpackSlots = ConfigBase<Config>.Instance.InitialBackpackSlots.Value;
			_maxBackpackWeight = ConfigBase<Config>.Instance.MaxBackpackWeight.Value;
			if (ConfigBase<Config>.Instance.AdditionalBackpackSlotsPerDefeatedBoss.Value != 0)
			{
				int num = Processor.BossesByBiome.Values.Count((Character x) => ZoneSystem.instance.GetGlobalKey(x.m_defeatSetGlobalKey));
				_backpackSlots += num * ConfigBase<Config>.Instance.AdditionalBackpackSlotsPerDefeatedBoss.Value;
				if (_maxBackpackWeight >= 0)
				{
					_maxBackpackWeight += num * ConfigBase<Config>.Instance.AdditionalMaxBackpackWeightPerDefeatedBoss.Value;
				}
			}
		}

		private State GetState(PlayerState playerState)
		{
			if (!_backpacksByPlayer.TryGetValue(playerState.ZDO, out State value))
			{
				_backpacksByPlayer.Add(playerState.ZDO, value = new State(this, playerState));
				playerState.ZDO.Destroyed += delegate(ServersideQoLZDO zdo)
				{
					if (_backpacksByPlayer.Remove(zdo, out State value2))
					{
						value2.BackpackContainer = null;
					}
				};
			}
			return value;
		}

		private void OnEmoteDetected(PlayerState playerState, Emotes emote)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0085: 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_003c: 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)
			if ((int)ConfigBase<Config>.Instance.OpenBackpackEmote.Value == -2 || ConfigBase<Config>.Instance.OpenBackpackEmote.Value == emote)
			{
				State state = GetState(playerState);
				if (!state.EnsureBackpackExists())
				{
					Timestamp now = Timestamp.Now;
					state.OpenBackpackAfter = ((Timestamp)(ref now)).AddSeconds(ConfigBase<Config>.Instance.Advanced.Value.OpenBackpackDelay);
					return;
				}
				state.OpenBackpackAfter = null;
				ZDORpc rPC = state.BackpackContainer.RPC;
				ContainerRpc container = ((ZDORpc)(ref rPC)).Container;
				((ContainerRpc)(ref container)).OpenResponse(true);
			}
		}

		private void DestroyBackpack(long peerID)
		{
			PlayerState stateForPeerID = Processor.Instance<PlayerRegistryProcessor>().GetStateForPeerID(peerID);
			if (stateForPeerID != null)
			{
				ServersideQoLZDO backpackContainer = GetState(stateForPeerID).BackpackContainer;
				if (backpackContainer != null)
				{
					((Processor)this).DestroyObject(backpackContainer);
					((Processor)this).Logger.LogInfo((object)("Backpack of player '" + stateForPeerID.PlayerName + "' destroyed on death"));
				}
			}
		}

		private void DropBackpackItem(ItemData item, ServersideQoLZDO refPosZdo, long peerID)
		{
			//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_0021: 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_003b: 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_0067: 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)
			Config.AdvancedConfig.BackpackOnDeathDropItemsConfig backpackOnDeathDropItems = ConfigBase<Config>.Instance.Advanced.Value.BackpackOnDeathDropItems;
			Vector3 position = refPosZdo.ZDO.GetPosition();
			Vector2 val = Random.insideUnitCircle * backpackOnDeathDropItems.ScatterRadius;
			position.x += val.x;
			position.y += backpackOnDeathDropItems.VerticalOffset;
			position.z += val.y;
			ServersideQoLZDO serversideQoLZDO = ((Component)ItemDrop.DropItem(item, 0, position, refPosZdo.ZDO.GetRotation())).GetComponent<ZNetView>().GetZDO().ServersideQoLZDO;
			serversideQoLZDO.Fields<ItemDrop>().Set((Func<Expression<Func<ItemDrop, bool>>>)(() => (ItemDrop x) => x.m_autoDestroy), !backpackOnDeathDropItems.PreventAutoDestroy, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 271).Set((Func<Expression<Func<ItemDrop, bool>>>)(() => (ItemDrop x) => x.m_autoPickup), !backpackOnDeathDropItems.PreventAutoPickup, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 272);
			serversideQoLZDO.ZDO.SetOwnerInternal(peerID);
		}

		private void DropBackpackItems(long peerID)
		{
			PlayerState stateForPeerID = Processor.Instance<PlayerRegistryProcessor>().GetStateForPeerID(peerID);
			if (stateForPeerID == null)
			{
				return;
			}
			State state = GetState(stateForPeerID);
			if (state == null)
			{
				return;
			}
			ServersideQoLZDO backpackContainer = state.BackpackContainer;
			if (backpackContainer == null)
			{
				return;
			}
			Container container = state.Container;
			if (container == null)
			{
				return;
			}
			IInventory inventory = Processor.Instance<ContainerRegistryProcessor>().GetState(backpackContainer, container).GetInventory();
			foreach (ItemData item in inventory.Items)
			{
				DropBackpackItem(item, stateForPeerID.ZDO, peerID);
			}
			((Processor)this).DestroyObject(backpackContainer);
			((Processor)this).Logger.LogInfo((object)("Backpack items of player '" + stateForPeerID.PlayerName + "' dropped at death location."));
		}

		private void CreateBackpackTombstone(PlayerState playerState, long peerID, IInventory backpackInventory)
		{
			//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_003a: 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_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_007d: 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)
			Vector3 position = playerState.ZDO.ZDO.GetPosition();
			position.y += ConfigBase<Config>.Instance.Advanced.Value.BackpackOnDeathDropTombStone.VerticalOffset;
			ServersideQoLZDO val = Processor.Spawn(BackpackTombstonePrefab, position, playerState.ZDO.ZDO.GetRotation(), peerID);
			__isBackpackTombstone.Set(val, true);
			ZDOVars vars = val.Vars;
			((ZDOVars)(ref vars)).SetOwner(playerState.PlayerID, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 296);
			vars = val.Vars;
			((ZDOVars)(ref vars)).SetOwnerName(playerState.PlayerName + " - " + ConfigBase<Config>.Instance.Localization.Value.FormatBackpackName(_maxBackpackWeight), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 297);
			val.Fields<Container>().Set((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_width), backpackInventory.Inventory.GetWidth(), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 300).Set((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_height), backpackInventory.Inventory.GetHeight(), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Backpack\\BackpackProcessor.cs", 301);
			IInventory inventory = Processor.Instance<ContainerRegistryProcessor>().GetState(val).GetInventory();
			foreach (ItemData item in backpackInventory.Items)
			{
				inventory.Items.Add(item);
			}
			inventory.Save();
		}

		private void DropBackback(long peerID)
		{
			PlayerState stateForPeerID = Processor.Instance<PlayerRegistryProcessor>().GetStateForPeerID(peerID);
			if (stateForPeerID == null)
			{
				return;
			}
			State state = GetState(stateForPeerID);
			if (state == null)
			{
				return;
			}
			ServersideQoLZDO backpackContainer = state.BackpackContainer;
			if (backpackContainer == null)
			{
				return;
			}
			Container container = state.Container;
			if (container != null)
			{
				IInventory inventory = Processor.Instance<ContainerRegistryProcessor>().GetState(backpackContainer, container).GetInventory();
				if (inventory.Items.Count != 0)
				{
					CreateBackpackTombstone(stateForPeerID, peerID, inventory);
					((Processor)this).DestroyObject(backpackContainer);
					((Processor)this).Logger.LogInfo((object)("Backpack of player '" + stateForPeerID.PlayerName + "' dropped at death location."));
				}
			}
		}

		private void RPC_OnDeath(RoutedRPCData data)
		{
			switch (ConfigBase<Config>.Instance.BackpackOnDeath.Value)
			{
			case Config.BackPackOnDeathOptions.SameAsInventory:
				if (ZoneSystem.instance.GetGlobalKey((GlobalKeys)20) || ZoneSystem.instance.GetGlobalKey((GlobalKeys)21))
				{
					DestroyBackpack(data.m_senderPeerID);
				}
				else if (!ZoneSystem.instance.GetGlobalKey((GlobalKeys)23))
				{
					DropBackback(data.m_senderPeerID);
				}
				break;
			case Config.BackPackOnDeathOptions.Destroy:
				DestroyBackpack(data.m_senderPeerID);
				break;
			case Config.BackPackOnDeathOptions.DropTombStone:
				DropBackback(data.m_senderPeerID);
				break;
			case Config.BackPackOnDeathOptions.DropItems:
				DropBackpackItems(data.m_senderPeerID);
				break;
			case Config.BackPackOnDeathOptions.Keep:
				break;
			}
		}
	}
	public sealed class Config : ConfigBase<Config>
	{
		public enum BackPackOnDeathOptions
		{
			SameAsInventory,
			Keep,
			Destroy,
			DropTombStone,
			DropItems
		}

		public sealed class LocalizationConfig
		{
			private string BackpackName { get; init; } = "Backpack ({0} kg)";

			public string ForbiddenItems { get; init; } = "Backpack cannot contain non-teleportable items";

			private string WeightLimitExceeded { get; init; } = "Backpack weight limit ({0}) exceeded";

			public string FormatBackpackName(int maxWeight)
			{
				return string.Format(BackpackName, (maxWeight < 0) ? "∞" : ((object)maxWeight));
			}

			public string FormatWeightLimitExceeded(int maxWeight)
			{
				return string.Format(WeightLimitExceeded, maxWeight);
			}
		}

		public sealed class AdvancedConfig
		{
			public sealed record BackpackOnDeathDropTombStoneConfig(float VerticalOffset, float AutoCollectDistance)
			{
				private BackpackOnDeathDropTombStoneConfig()
					: this(0f, 0f)
				{
				}
			}

			public sealed record BackpackOnDeathDropItemsConfig(float ScatterRadius, float VerticalOffset, bool PreventAutoDestroy, bool PreventAutoPickup)
			{
				private BackpackOnDeathDropItemsConfig()
					: this(0f, 0f, PreventAutoDestroy: false, PreventAutoPickup: false)
				{
				}
			}

			public float OpenBackpackDelay { get; init; } = 0.2f;

			public BackpackOnDeathDropTombStoneConfig BackpackOnDeathDropTombStone { get; init; } = new BackpackOnDeathDropTombStoneConfig(2f, 2f);

			public BackpackOnDeathDropItemsConfig BackpackOnDeathDropItems { get; init; } = new BackpackOnDeathDropItemsConfig(2f, 1f, PreventAutoDestroy: true, PreventAutoPickup: false);
		}

		public override ConfigEntry<bool> Enabled { get; } = ConfigBase<Config>.BindEx<bool>(cfg, true, "Enables/disables the entire mod", (IAcceptableValueBase<bool>)null, (Deprecated<Config>)null, "Enabled");

		public ConfigEntry<Emotes> OpenBackpackEmote { get; }

		public ConfigEntry<int> InitialBackpackSlots { get; }

		public ConfigEntry<int> AdditionalBackpackSlotsPerDefeatedBoss { get; }

		public ConfigEntry<int> MaxBackpackWeight { get; }

		public ConfigEntry<int> AdditionalMaxBackpackWeightPerDefeatedBoss { get; }

		public ConfigEntry<BackPackOnDeathOptions> BackpackOnDeath { get; }

		public YamlConfigEntry<LocalizationConfig> Localization { get; }

		public YamlConfigEntry<AdvancedConfig> Advanced { get; }

		public Config(ConfigFile cfg, Logger logger)
		{
			string text = $"Emote to open the backpack.\r\nIf a player uses this emote, a virtual container acting as their backpack will open.\r\n{(object)(Emotes)(-2)} to use any emote as trigger.\r\nYou can bind emotes to buttons with chat commands.\r\nFor example, on xbox you can bind the Y-Button to the wave-emote by entering \"/bind JoystickButton3 {(object)(Emotes)0}\" in the in-game chat.\r\nIf you use emotes exclusively for this feature, it is recommended to set the value to {(object)(Emotes)(-2)} as it is more reliably detected than specific emotes, especially on bad connection/with crossplay.";
			List<Emotes> list = new List<Emotes>();
			list.Add((Emotes)(-2));
			list.AddRange(Enum.GetValues(typeof(Emotes)).Cast<Emotes>());
			OpenBackpackEmote = ConfigBase<Config>.BindEx<Emotes>(cfg, (Emotes)0, text, (IAcceptableValueBase<Emotes>)(object)new AcceptableEnum<Emotes>((IEnumerable<Emotes>)new <>z__ReadOnlyList<Emotes>(list)), (Deprecated<Config>)null, "OpenBackpackEmote");
			InitialBackpackSlots = ConfigBase<Config>.BindEx<int>(cfg, 4, "Initial available slots in the backpack", (IAcceptableValueBase<int>)null, (Deprecated<Config>)null, "InitialBackpackSlots");
			AdditionalBackpackSlotsPerDefeatedBoss = ConfigBase<Config>.BindEx<int>(cfg, 4, "Additional backpack slots per defeated boss", (IAcceptableValueBase<int>)null, (Deprecated<Config>)null, "AdditionalBackpackSlotsPerDefeatedBoss");
			MaxBackpackWeight = ConfigBase<Config>.BindEx<int>(cfg, -1, "Maximum backpack weight. -1 for no limit.", (IAcceptableValueBase<int>)null, (Deprecated<Config>)null, "MaxBackpackWeight");
			AdditionalMaxBackpackWeightPerDefeatedBoss = ConfigBase<Config>.BindEx<int>(cfg, 0, "Additional maximum backpack weight per defeated boss", (IAcceptableValueBase<int>)null, (Deprecated<Config>)null, "AdditionalMaxBackpackWeightPerDefeatedBoss");
			BackpackOnDeath = ConfigBase<Config>.BindEx<BackPackOnDeathOptions>(cfg, BackPackOnDeathOptions.SameAsInventory, "What happens to backpack contents on player death", (IAcceptableValueBase<BackPackOnDeathOptions>)null, (Deprecated<Config>)null, "BackpackOnDeath");
			Localization = ConfigBase<Config>.BindYaml<LocalizationConfig>(cfg, "Localization");
			Advanced = ConfigBase<Config>.BindYaml<AdvancedConfig>(cfg, "Advanced");
			base..ctor(cfg, logger);
		}
	}
}