Decompiled source of ServersideQoL v2.0.14

patchers/ServersideQoL.Patchers.dll

Decompiled 8 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;

[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: AssemblyFileVersion("2.0.14.0")]
[assembly: AssemblyInformationalVersion("2.0.14+62f64f08270f57d15cc5ce6dd882c86ea0c0ad0f")]
[assembly: AssemblyProduct("ServersideQoL.Patchers")]
[assembly: AssemblyTitle("ServersideQoL.Patchers")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")]
[assembly: AssemblyVersion("2.0.14.0")]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

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

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

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

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	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 new Enumerator(_item);
	}

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

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

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

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

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

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	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.Patchers
{
	internal static class Patcher
	{
		private const string AssemblyName = "assembly_valheim.dll";

		public static IEnumerable<string> TargetDLLs => new <>z__ReadOnlySingleElementList<string>("assembly_valheim.dll");

		public static void Patch(AssemblyDefinition assembly)
		{
			AddProperty(assembly, "ZDO", "ServersideQoL", "ServersideQoLZDO", "ServersideQoLZDO");
			AddProperty(assembly, "ZNetPeer", "ServersideQoL", "Peer", "ServersideQoLPeer");
			static void AddProperty(AssemblyDefinition val, string typeToExtendName, string propertyTypeNamespace, string propertyTypeName, string propertyName)
			{
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Expected O, but got Unknown
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Expected O, but got Unknown
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Expected O, but got Unknown
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: 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_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Expected O, but got Unknown
				//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c0: Expected O, but got Unknown
				//IL_01c5: Expected O, but got Unknown
				//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				ModuleDefinition mainModule = val.MainModule;
				TypeDefinition val2 = mainModule.GetType(typeToExtendName) ?? throw new Exception("Type " + typeToExtendName + " not found");
				AssemblyNameReference val3 = new AssemblyNameReference("ServersideQoL.Patchers".Replace(".Patchers", ""), new Version("2.0.14"));
				mainModule.AssemblyReferences.Add(val3);
				TypeReference val4 = mainModule.ImportReference(new TypeReference(propertyTypeNamespace, propertyTypeName, mainModule, (IMetadataScope)(object)val3));
				TypeReference val5 = mainModule.ImportReference(new TypeReference("System.Runtime.CompilerServices", "NullableAttribute", mainModule, mainModule.TypeSystem.CoreLibrary));
				FieldDefinition val6 = new FieldDefinition("<" + propertyName + ">k__BackingField", (FieldAttributes)33, val4);
				val2.Fields.Add(val6);
				MethodDefinition val7 = new MethodDefinition("get_" + propertyName, (MethodAttributes)2182, val4);
				ILProcessor iLProcessor = val7.Body.GetILProcessor();
				iLProcessor.Append(iLProcessor.Create(OpCodes.Ldarg_0));
				iLProcessor.Append(iLProcessor.Create(OpCodes.Ldfld, (FieldReference)(object)val6));
				iLProcessor.Append(iLProcessor.Create(OpCodes.Ret));
				val2.Methods.Add(val7);
				PropertyDefinition val8 = new PropertyDefinition(propertyName, (PropertyAttributes)0, val4)
				{
					GetMethod = val7
				};
				val2.Properties.Add(val8);
				MethodDefinition val9 = ((IEnumerable<MethodDefinition>)val2.Methods).Single((MethodDefinition m) => m.IsConstructor && !m.IsStatic);
				iLProcessor = val9.Body.GetILProcessor();
				Instruction val10 = val9.Body.Instructions[0];
				MethodReference val11 = new MethodReference(".ctor", mainModule.TypeSystem.Void, val4)
				{
					HasThis = true
				};
				val11.Parameters.Add(new ParameterDefinition((TypeReference)(object)val2));
				MethodReference val12 = mainModule.ImportReference(val11);
				iLProcessor.InsertBefore(val10, iLProcessor.Create(OpCodes.Ldarg_0));
				iLProcessor.InsertBefore(val10, iLProcessor.Create(OpCodes.Ldarg_0));
				iLProcessor.InsertBefore(val10, iLProcessor.Create(OpCodes.Newobj, val12));
				iLProcessor.InsertBefore(val10, iLProcessor.Create(OpCodes.Stfld, (FieldReference)(object)val6));
			}
		}
	}
	public sealed class PatchersPlugin
	{
		public const string Author = "ArgusMagnus";

		public const string PluginName = "ServersideQoL.Patchers";

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

		public const string PluginVersion = "2.0.14";

		public const string PluginInformationalVersion = "2.0.14";

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

plugins/ServersideQoL.dll

Decompiled 8 hours ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using MonoMod.Cil;
using MonoMod.Utils;
using ServersideQoL.CodeAnalysis;
using ServersideQoL.Processors;
using ServersideQoL.Utilities;
using SoftReferenceableAssets;
using UnityEngine;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.TypeInspectors;

[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("Serverside-only QoL mod, compatible with vanilla/console (e.g. XBox, PS, Switch) clients. Stack player inventories into chests, generated portal hub, auto-sort chests, refuel smelters from containers, infinite building/farming stamina and much more")]
[assembly: AssemblyFileVersion("2.0.14.0")]
[assembly: AssemblyInformationalVersion("2.0.14+62f64f08270f57d15cc5ce6dd882c86ea0c0ad0f")]
[assembly: AssemblyProduct("ServersideQoL")]
[assembly: AssemblyTitle("ServersideQoL")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.14.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	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.Length;

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

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

	bool ICollection<T>.IsReadOnly => true;

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

	public <>z__ReadOnlyArray(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 ((ICollection<T>)_items).Contains(item);
	}

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

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

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

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

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
[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();
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

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

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

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

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	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 new Enumerator(_item);
	}

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

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

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

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

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

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	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]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[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;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class ExtensionMarkerAttribute : Attribute
	{
		private readonly string <Name>k__BackingField;

		public string Name => <Name>k__BackingField;

		public ExtensionMarkerAttribute(string name)
		{
			<Name>k__BackingField = name;
		}
	}
}
namespace ServersideQoL
{
	public sealed class Config : ConfigBase<Config>
	{
		public sealed class AdvancedConfig
		{
			public sealed class ProcessingDelaysConfig
			{
				public float WhenNoNearbyPlayers { get; init; } = 2f;

				public float AfterContainerOwnershipRequest { get; init; } = 0.1f;
			}

			public sealed class ContainersConfig
			{
				public float MinOwnershipRequestInterval { get; init; } = 1f;
			}

			public sealed class PlayersConfig
			{
				public float UpdateStaminaInterval { get; init; } = 0.2f;
			}

			public ProcessingDelaysConfig ProcessingDelays { get; init; } = new ProcessingDelaysConfig();

			public ContainersConfig Containers { get; init; } = new ContainersConfig();

			public PlayersConfig Players { get; init; } = new PlayersConfig();
		}

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

		public ConfigEntry<bool> DiagnosticLogs { get; } = ConfigBase<Config>.BindEx(cfg, defaultValue: false, "Enables/disables diagnostic logs", null, null, "DiagnosticLogs");

		public ConfigEntry<bool> AutoReload { get; } = ConfigBase<Config>.BindEx(cfg, defaultValue: true, "True to automatically reload config files when they are changed.\r\nThis value is only respected during initial startup and changing it later while the server is running has no effect.", null, null, "AutoReload");

		public ConfigEntry<float> AutoReloadPollingIntervalSeconds { get; } = ConfigBase<Config>.BindEx(cfg, 0f, "If > 0, config files will be polled every x seconds in addition to listening for file system events.\r\nThis should help on file systems for which file system events don't work reliably (e.g. NFS).", null, null, "AutoReloadPollingIntervalSeconds");

		public ConfigEntry<bool> UnifiedConfig { get; } = ConfigBase<Config>.BindEx(cfg, defaultValue: false, "True to use a single config file for all SQoL mods.\r\nDO NOT turn this on unless you've updated all SQoL mods to v2.0.11 minimum.", null, null, "UnifiedConfig");

		public ConfigEntry<bool> ConfigPerWorld { get; } = ConfigBase<Config>.BindEx(cfg, defaultValue: false, "True to save the config files for each world separately in the world save directory", null, null, "ConfigPerWorld");

		public ConfigEntry<float> FarMessageRange { get; } = ConfigBase<Config>.BindEx(cfg, 64f, $"Max distance a player can have to a modified object to receive messages of type {MessageTypes.TopLeftFar} or {MessageTypes.CenterFar}", null, null, "FarMessageRange");

		public YamlConfigEntry<AdvancedConfig> Advanced { get; } = ConfigBase<Config>.BindYaml<AdvancedConfig>(cfg, "Advanced");

		public Config(ConfigFile cfg, Logger logger)
			: base(cfg, logger)
		{
		}
	}
	internal interface IConfig
	{
		IServersideQoLPlugin Plugin { get; }

		ConfigEntry<bool> Enabled { get; }

		ConfigFile ConfigFile { get; }

		event EventHandler<SettingChangedEventArgs>? ConfigChanged;

		void RaiseInitialized(IServersideQoLPlugin plugin);
	}
	public abstract class ConfigBase
	{
		protected static class Shared
		{
			[CompilerGenerated]
			private static ConfigEntry<bool>? <AutoPickup>k__BackingField;

			[CompilerGenerated]
			private static ConfigEntry<int>? <AutoPickupMaxRange>k__BackingField;

			[CompilerGenerated]
			private static ConfigEntry<bool>? <FeedFromContainers>k__BackingField;

			[CompilerGenerated]
			private static ConfigEntry<int>? <FeedFromContainersMaxRange>k__BackingField;

			public static ConfigEntry<bool>? AutoPickup
			{
				[CompilerGenerated]
				get
				{
					return <AutoPickup>k__BackingField;
				}
				set
				{
					Set(ref <AutoPickup>k__BackingField, value, "AutoPickup");
				}
			}

			public static ConfigEntry<int>? AutoPickupMaxRange
			{
				[CompilerGenerated]
				get
				{
					return <AutoPickupMaxRange>k__BackingField;
				}
				set
				{
					Set(ref <AutoPickupMaxRange>k__BackingField, value, "AutoPickupMaxRange");
				}
			}

			public static ConfigEntry<bool>? FeedFromContainers
			{
				[CompilerGenerated]
				get
				{
					return <FeedFromContainers>k__BackingField;
				}
				set
				{
					Set(ref <FeedFromContainers>k__BackingField, value, "FeedFromContainers");
				}
			}

			public static ConfigEntry<int>? FeedFromContainersMaxRange
			{
				[CompilerGenerated]
				get
				{
					return <FeedFromContainersMaxRange>k__BackingField;
				}
				set
				{
					Set(ref <FeedFromContainersMaxRange>k__BackingField, value, "FeedFromContainersMaxRange");
				}
			}

			private static void Set<T>(ref T? field, T? value, [CallerMemberName] string configName = null) where T : class
			{
				if (field != null)
				{
					throw new Exception("Shared config " + configName + " already set");
				}
				field = value;
			}
		}

		private protected interface IYamlConfigEntry
		{
			string FilePath { get; }

			object Value { get; }

			void Deserialize();
		}

		public sealed class YamlConfigEntry<T>(string filePath, T value) : IYamlConfigEntry where T : notnull
		{
			private readonly string _filePath = filePath;

			private readonly DebouncedFileWatcher _fileWatcher = new DebouncedFileWatcher(filePath);

			public T Value
			{
				[CompilerGenerated]
				get
				{
					return <Value>k__BackingField;
				}
				private set
				{
					IsDefault = value.Equals(<Value>k__BackingField);
					<Value>k__BackingField = value;
				}
			}

			public bool IsDefault { get; private set; } = true;

			string IYamlConfigEntry.FilePath => _filePath;

			object IYamlConfigEntry.Value => Value;

			public event Action<YamlConfigEntry<T>>? ValueChanged;

			private void Deserialize()
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				if (!File.Exists(_filePath))
				{
					return;
				}
				_fileWatcher.Enabled = false;
				try
				{
					IDeserializer val = ((BuilderSkeleton<DeserializerBuilder>)(object)((BuilderSkeleton<DeserializerBuilder>)(object)((BuilderSkeleton<DeserializerBuilder>)new DeserializerBuilder()).IncludeNonPublicProperties()).EnablePrivateConstructors()).WithTypeInspector<MyTypeInspector>((Func<ITypeInspector, MyTypeInspector>)((ITypeInspector x) => new MyTypeInspector(x))).Build();
					using (StreamReader streamReader = new StreamReader(_filePath))
					{
						T val2 = (T)val.Deserialize((TextReader)streamReader, typeof(T));
						Value = ((val2 != null) ? val2 : Value);
					}
					ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Logger.LogInfo("Advanced config loaded from " + Path.GetFileName(_filePath));
					this.ValueChanged?.Invoke(this);
				}
				catch (Exception arg)
				{
					ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Logger.LogWarning($"{Path.GetFileName(_filePath)}: {arg}");
				}
				_fileWatcher.Enabled = true;
			}

			void IYamlConfigEntry.Deserialize()
			{
				Deserialize();
				_fileWatcher.FileCreatedOrChanged += OnFileCreatedOrChanged;
				_fileWatcher.Enabled = true;
			}

			private async void OnFileCreatedOrChanged(object sender, FileSystemEventArgs e)
			{
				Deserialize();
			}
		}

		private protected sealed class MyTypeInspector(ITypeInspector inner) : TypeInspectorSkeleton()
		{
			private readonly ITypeInspector _inner = inner;

			public override string GetEnumName(Type enumType, string name)
			{
				return inner.GetEnumName(enumType, name);
			}

			public override string GetEnumValue(object enumValue)
			{
				return inner.GetEnumValue(enumValue);
			}

			public override IEnumerable<IPropertyDescriptor> GetProperties(Type type, object? container)
			{
				foreach (IPropertyDescriptor property in inner.GetProperties(type, container))
				{
					if (!(property.Type == typeof(Type)) || !(property.Name == "EqualityContract"))
					{
						yield return property;
					}
				}
			}
		}

		public sealed class AcceptableEnum<T> : AcceptableValueBase where T : unmanaged, Enum
		{
			private readonly T _default;

			public static AcceptableEnum<T> Default { get; } = new AcceptableEnum<T>(GetDefaultValues());

			public IReadOnlyList<T> AcceptableValues { get; }

			private static IEnumerable<T> GetDefaultValues()
			{
				HashSet<T> added = new HashSet<T>();
				T[] array = (T[])Enum.GetValues(typeof(T));
				foreach (T val in array)
				{
					if (added.Add(val))
					{
						yield return val;
					}
				}
			}

			public AcceptableEnum(IEnumerable<T> values)
				: base(typeof(T))
			{
				if (SQoLEnumUtils.IsBitSet<T>())
				{
					List<T> list = new List<T>();
					list.AddRange(values.Where((T x) => x.ExactlyOneBitSet()));
					AcceptableValues = new <>z__ReadOnlyList<T>(list);
					_default = default(T);
					return;
				}
				object obj = values as IReadOnlyList<T>;
				if (obj == null)
				{
					List<T> list2 = new List<T>();
					list2.AddRange(values);
					obj = new <>z__ReadOnlyList<T>(list2);
				}
				AcceptableValues = (IReadOnlyList<T>)obj;
				_default = AcceptableValues.FirstOrDefault();
			}

			private T ClampCore(object value)
			{
				if (value is T)
				{
					T e = (T)value;
					if (SQoLEnumUtils.IsBitSet<T>())
					{
						ulong val = e.ToUInt64();
						ulong num = 0uL;
						foreach (ulong item in from x in AcceptableValues
							select x.ToUInt64() into x
							where (val & x) == x
							select x)
						{
							num |= item;
						}
						return SQoLEnumUtils.ToEnum<T>(num);
					}
					if (!AcceptableValues.Any((T x) => x.Equals(e)))
					{
						return _default;
					}
					return e;
				}
				return _default;
			}

			public override object Clamp(object value)
			{
				return ClampCore(value);
			}

			public override bool IsValid(object value)
			{
				return object.Equals(value, ((AcceptableValueBase)this).Clamp(value));
			}

			public override string ToDescriptionString()
			{
				if (!SQoLEnumUtils.IsBitSet<T>())
				{
					return "# Acceptable values: " + string.Join(", ", AcceptableValues);
				}
				return FormattableString.Invariant(FormattableStringFactory.Create("# Acceptable values: {0}\r\n# Multiple values can be set at the same time by separating them with , (e.g. Debug, Warning)", string.Join(", ", AcceptableValues)));
			}
		}

		protected sealed class AcceptableFormatString(object[] testArgs) : AcceptableValueBase(typeof(string))
		{
			public override bool IsValid(object value)
			{
				if (!(value is string format))
				{
					return false;
				}
				try
				{
					string.Format(format, testArgs);
				}
				catch (FormatException)
				{
					return false;
				}
				return true;
			}

			public override object Clamp(object value)
			{
				return value;
			}

			public override string ToDescriptionString()
			{
				return FormattableString.Invariant(FormattableStringFactory.Create("# Acceptable value formats: .NET Format strings for {0} arguments ({1}): https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-string-format#get-started-with-the-stringformat-method", testArgs.Length, string.Join(", ", testArgs.Select((object x) => x.GetType().Name))));
			}
		}

		private protected interface ICustomConfigType
		{
			void EnsureConverterAdded();
		}

		public sealed class ConfigArray<T>(IReadOnlyList<T> value) : ICustomConfigType
		{
			public static ConfigArray<T> Empty => <Empty>k__BackingField ?? (<Empty>k__BackingField = new ConfigArray<T>(Array.Empty<T>()));

			public IReadOnlyList<T> Items { get; } = value;

			public override bool Equals(object obj)
			{
				if (this != obj)
				{
					if (obj is ConfigArray<T> configArray)
					{
						return Items.SequenceEqual(configArray.Items);
					}
					return false;
				}
				return true;
			}

			public override int GetHashCode()
			{
				return Items.GetHashCode();
			}

			void ICustomConfigType.EnsureConverterAdded()
			{
				//IL_0033: 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_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Expected O, but got Unknown
				if (TomlTypeConverter.CanConvert(typeof(ConfigArray<T>)))
				{
					return;
				}
				if (!TomlTypeConverter.CanConvert(typeof(T)))
				{
					throw new NotSupportedException();
				}
				TomlTypeConverter.AddConverter(typeof(ConfigArray<T>), new TypeConverter
				{
					ConvertToObject = delegate(string str, Type type)
					{
						if (!string.IsNullOrWhiteSpace(str))
						{
							List<T> list = new List<T>();
							list.AddRange(from x in str.Split(',', StringSplitOptions.RemoveEmptyEntries)
								select TomlTypeConverter.ConvertToValue<T>(x));
							return new ConfigArray<T>(new <>z__ReadOnlyList<T>(list));
						}
						return Empty;
					},
					ConvertToString = (object obj, Type type) => string.Join(", ", ((ConfigArray<T>)obj).Items.Select((T x) => TomlTypeConverter.ConvertToString((object)x, typeof(T))))
				});
			}
		}

		protected sealed class AcceptableArrayValues<T> : AcceptableValueBase
		{
			private readonly ConfigArray<T> _values = new ConfigArray<T>(values);

			private readonly HashSet<T> _allowedValues;

			public AcceptableArrayValues(IReadOnlyList<T> values)
			{
				HashSet<T> hashSet = new HashSet<T>();
				foreach (T value in values)
				{
					hashSet.Add(value);
				}
				_allowedValues = hashSet;
				((AcceptableValueBase)this)..ctor(typeof(ConfigArray<T>));
			}

			private ConfigArray<T> ClampCore(object value)
			{
				if (!(value is ConfigArray<T> configArray))
				{
					return ConfigArray<T>.Empty;
				}
				foreach (T item in configArray.Items)
				{
					if (!_allowedValues.Contains(item))
					{
						List<T> list = new List<T>();
						list.AddRange(configArray.Items.Where(_allowedValues.Contains));
						return new ConfigArray<T>(new <>z__ReadOnlyList<T>(list));
					}
				}
				return configArray;
			}

			public override object Clamp(object value)
			{
				return ClampCore(value);
			}

			public override bool IsValid(object value)
			{
				return object.Equals(value, ((AcceptableValueBase)this).Clamp(value));
			}

			public override string ToDescriptionString()
			{
				return FormattableString.Invariant($"# Acceptable values: {TomlTypeConverter.ConvertToString((object)_values, _values.GetType())}\r\n# Multiple values can be set at the same time by separating them with , (e.g. Debug, Warning)");
			}
		}

		protected static class AcceptableArrayValues
		{
			public static AcceptableArrayValues<T> Get<T>(IReadOnlyList<T> values)
			{
				return new AcceptableArrayValues<T>(values);
			}
		}

		public const Emotes DisabledEmote = (Emotes)(-1);

		public const Emotes AnyEmote = (Emotes)(-2);

		private static readonly bool __configWatcherInstalled = AppDomain.CurrentDomain.GetAssemblies().Any((Assembly x) => !x.IsDynamic && Path.GetFileName(x.Location) == "ConfigWatcher.dll");

		private static readonly Dictionary<ConfigFile, DebouncedFileWatcher> __fileWatcher = new Dictionary<ConfigFile, DebouncedFileWatcher>();

		protected static IReadOnlyDictionary<string, PieceTable> PieceTablesByPieceName => ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.PieceTablesByPieceName;

		protected static IReadOnlyDictionary<Biome, Character> BossesByBiome => Processor.BossesByBiome;

		public ConfigFile ConfigFile { get; }

		protected Logger Logger { get; }

		public abstract ConfigEntry<bool> Enabled { get; }

		private protected ConfigBase(ConfigFile configFile, Logger logger)
		{
			ConfigFile = configFile;
			Logger = logger;
		}

		private protected void InitializeFileWatcher()
		{
			if (!__configWatcherInstalled && ConfigBase<Config>.Instance.AutoReload.Value && !__fileWatcher.ContainsKey(ConfigFile))
			{
				DebouncedFileWatcher debouncedFileWatcher = new DebouncedFileWatcher(ConfigFile.ConfigFilePath);
				debouncedFileWatcher.FileCreatedOrChanged += delegate
				{
					ConfigFile configFile = ConfigFile;
					bool saveOnConfigSet = ConfigFile.SaveOnConfigSet;
					configFile.SaveOnConfigSet = false;
					ConfigFile.Reload();
					ConfigFile.SaveOnConfigSet = saveOnConfigSet;
				};
				debouncedFileWatcher.Enabled = true;
				__fileWatcher.Add(ConfigFile, debouncedFileWatcher);
			}
		}
	}
	public abstract class ConfigBase<TSelf> : ConfigBase, IConfig where TSelf : ConfigBase<TSelf>
	{
		public sealed record Deprecated(string Reason, Action<TSelf> AdjustConfig);

		private static readonly HashSet<ConfigEntryBase> __deprecatedEntries = new HashSet<ConfigEntryBase>();

		private static Dictionary<string, IYamlConfigEntry>? __yaml = new Dictionary<string, IYamlConfigEntry>();

		private IServersideQoLPlugin _plugin;

		private static readonly string __section;

		private EventHandler<SettingChangedEventArgs>? _configChanged;

		IServersideQoLPlugin IConfig.Plugin => _plugin;

		internal static bool IsInitialized { get; private set; }

		public static TSelf Instance
		{
			get
			{
				return <Instance>k__BackingField ?? throw new InvalidOperationException("Config has not been initialized yet");
			}
			[CompilerGenerated]
			private set
			{
				<Instance>k__BackingField = value;
			}
		}

		protected static string Section => <Section>k__BackingField ?? (<Section>k__BackingField = ((typeof(TSelf) == typeof(Config) || !ConfigBase<Config>.Instance.UnifiedConfig.Value) ? __section : ("M." + __section)));

		private static event Action<ConfigFile, TSelf>? Initialized;

		public event EventHandler<SettingChangedEventArgs>? ConfigChanged
		{
			add
			{
				if (_configChanged == null && value != null)
				{
					base.ConfigFile.SettingChanged -= OnSettingsChanged;
					base.ConfigFile.SettingChanged += OnSettingsChanged;
				}
				_configChanged = (EventHandler<SettingChangedEventArgs>)Delegate.Combine(_configChanged, value);
			}
			remove
			{
				_configChanged = (EventHandler<SettingChangedEventArgs>)Delegate.Remove(_configChanged, value);
				if (_configChanged == null)
				{
					base.ConfigFile.SettingChanged -= OnSettingsChanged;
				}
			}
		}

		protected ConfigBase(ConfigFile configFile, Logger logger)
			: base(configFile, logger)
		{
		}

		private void OnSettingsChanged(object? sender, SettingChangedEventArgs args)
		{
			if (_configChanged == null)
			{
				return;
			}
			if (ConfigBase<Config>.Instance.UnifiedConfig.Value)
			{
				string section = Section;
				string section2 = args.ChangedSetting.Definition.Section;
				if (section2 != section && !section2.StartsWith(section + "."))
				{
					return;
				}
			}
			_configChanged(this, args);
		}

		[MemberNotNull("_plugin")]
		void IConfig.RaiseInitialized(IServersideQoLPlugin plugin)
		{
			_plugin = plugin;
			Instance = (TSelf)this;
			foreach (IYamlConfigEntry value in __yaml.Values)
			{
				BindYaml(value);
			}
			__yaml = null;
			IsInitialized = true;
			ConfigBase<TSelf>.Initialized?.Invoke(base.ConfigFile, (TSelf)this);
			InitializeFileWatcher();
		}

		public static bool IsDeprecated(ConfigEntryBase entry)
		{
			return __deprecatedEntries.Contains(entry);
		}

		protected static ConfigEntry<T> BindEx<T>(ConfigFile config, T defaultValue, string description, AcceptableValueBase? acceptableValues = null, Deprecated? deprecated = null, [CallerMemberName] string key = null)
		{
			return BindExCore(config, Section, defaultValue, description, acceptableValues, deprecated, key);
		}

		protected static ConfigEntry<T> BindEx<T>(ConfigFile config, string subSection, T defaultValue, string description, AcceptableValueBase? acceptableValues = null, Deprecated? deprecated = null, [CallerMemberName] string key = null)
		{
			string section = (ConfigBase<Config>.Instance.UnifiedConfig.Value ? (Section + "." + subSection) : subSection);
			return BindExCore(config, section, defaultValue, description, acceptableValues, deprecated, key);
		}

		private static ConfigEntry<T> BindExCore<T>(ConfigFile config, string section, T defaultValue, string description, AcceptableValueBase? acceptableValues, Deprecated? deprecated, string key)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			(defaultValue as ICustomConfigType)?.EnsureConverterAdded();
			if ((object)deprecated != null)
			{
				description = string.Join(Environment.NewLine, "DEPRECATED: " + deprecated.Reason, description);
			}
			ConfigEntry<T> cfg = config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>()));
			if ((object)deprecated != null)
			{
				__deprecatedEntries.Add((ConfigEntryBase)(object)cfg);
				Initialized += OnInitialized;
			}
			return cfg;
			void OnInitialized(ConfigFile cfgFile, TSelf modConfig)
			{
				if (cfgFile == ((ConfigEntryBase)cfg).ConfigFile)
				{
					Initialized -= OnInitialized;
					cfg.SettingChanged += delegate
					{
						OnSettingChanged(deprecated, cfg, modConfig);
					};
					OnSettingChanged(deprecated, cfg, modConfig);
				}
			}
			static void OnSettingChanged(Deprecated deprecated2, ConfigEntry<T> val, TSelf modCfg)
			{
				if (!EqualityComparer<T>.Default.Equals(val.Value, (T)((ConfigEntryBase)val).DefaultValue))
				{
					deprecated2.AdjustConfig(modCfg);
					modCfg.Logger.LogWarning("[" + ((ConfigEntryBase)val).Definition.Section + "].[" + ((ConfigEntryBase)val).Definition.Key + "] is deprecated: " + deprecated2.Reason);
				}
			}
		}

		protected static YamlConfigEntry<T> BindYaml<T>(ConfigFile cfg, [CallerMemberName] string fileName = null) where T : notnull, new()
		{
			return BindYaml<T>(cfg, null, fileName);
		}

		protected static YamlConfigEntry<T> BindYaml<T>(ConfigFile cfg, Action<T> onChanged, [CallerMemberName] string fileName = null) where T : notnull, new()
		{
			if (__yaml == null)
			{
				throw new InvalidOperationException("Config alredy initialized");
			}
			if (typeof(TSelf) != typeof(Config) && ConfigBase<Config>.Instance.UnifiedConfig.Value)
			{
				fileName = __section + "." + fileName;
			}
			string path = Path.Combine(Path.GetDirectoryName(cfg.ConfigFilePath), "ArgusMagnus.ServersideQoL");
			string text = Path.Combine(path, Path.GetFileNameWithoutExtension(cfg.ConfigFilePath) + "." + fileName + ".yml");
			YamlConfigEntry<T> yamlConfigEntry = new YamlConfigEntry<T>(text, new T());
			if (onChanged != null)
			{
				yamlConfigEntry.ValueChanged += delegate(YamlConfigEntry<T> x)
				{
					onChanged(x.Value);
				};
			}
			__yaml.Add(text, yamlConfigEntry);
			return yamlConfigEntry;
		}

		private static void BindYaml(IYamlConfigEntry entry)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(entry.FilePath);
			ISerializer val = ((BuilderSkeleton<SerializerBuilder>)(object)((BuilderSkeleton<SerializerBuilder>)new SerializerBuilder()).IncludeNonPublicProperties()).WithTypeInspector<MyTypeInspector>((Func<ITypeInspector, MyTypeInspector>)((ITypeInspector x) => new MyTypeInspector(x))).DisableAliases().Build();
			Directory.CreateDirectory(directoryName);
			string path = Path.ChangeExtension(entry.FilePath, "default.yml");
			using (StreamWriter streamWriter = new StreamWriter(path, append: false))
			{
				streamWriter.WriteLine("# " + Path.GetFileName(path) + " contains the default values and is overwritten regularly.\r\n# Rename it to " + Path.GetFileName(entry.FilePath) + " if you want to change values.");
				streamWriter.WriteLine();
				WriteYamlHeader(streamWriter);
				val.Serialize((TextWriter)streamWriter, entry.Value);
			}
			entry.Deserialize();
		}

		private static void WriteYamlHeader(StreamWriter writer)
		{
			writer.WriteLine("# IMPORTANT:\r\n#   This file is for advanced tweaks.\r\n#   You are expected to be familiar with YAML and its pitfalls if you decide to edit it.\r\n#   Check the log for warnings related to this file.\r\n");
		}

		static ConfigBase()
		{
			string[] array = typeof(TSelf).Namespace.Split('.');
			__section = ((array != null && array.Length > 1) ? array[^1] : "General");
		}
	}
	public static class Extensions
	{
		[SpecialName]
		public sealed class <G>$6A1219195D713CAD396B57F11B80B7C7
		{
			[SpecialName]
			public static class <M>$5F195870FB4F4F735FF539448C719B34
			{
			}

			[ExtensionMarker("<M>$5F195870FB4F4F735FF539448C719B34")]
			public IEnumerable<ZNetView> ZNetViews
			{
				[ExtensionMarker("<M>$5F195870FB4F4F735FF539448C719B34")]
				get
				{
					throw new NotSupportedException();
				}
			}
		}

		public static float GetHeight(this Heightmap hmap, Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			int num = default(int);
			int num2 = default(int);
			hmap.WorldToVertex(pos, ref num, ref num2);
			return hmap.GetHeight(num, num2);
		}

		public static IEnumerable<ZNetView> get_ZNetViews(ZNetScene instance)
		{
			return from x in ((IEnumerable<GameObject>)instance.m_prefabs).Select((Func<GameObject, ZNetView>)delegate(GameObject x)
				{
					ZNetView component = x.GetComponent<ZNetView>();
					if (component == null)
					{
						ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Logger.LogWarning("GameObject '" + ((Object)x).name + "' was added to ZNetScene.instance.m_prefabs by another mod but is missing the ZNetView component");
						return (ZNetView)null;
					}
					return component;
				})
				where x != null
				select x;
		}
	}
	public static class ListExtensions
	{
		public readonly struct ListEnumerable<T>
		{
			public struct Enumerator : IEnumerator<T>, IEnumerator, IDisposable
			{
				private readonly IReadOnlyList<T> _list;

				private readonly int _count;

				private int _index;

				public T Current { get; private set; }

				readonly object? IEnumerator.Current => Current;

				public Enumerator(IReadOnlyList<T> list)
				{
					_list = list;
					_count = list.Count;
					_index = -1;
					Current = default(T);
				}

				public void Dispose()
				{
					Current = default(T);
				}

				public bool MoveNext()
				{
					if (++_index < _count)
					{
						Current = _list[_index];
						return true;
					}
					Current = default(T);
					return false;
				}

				public void Reset()
				{
					_index = -1;
				}
			}

			private readonly IReadOnlyList<T> _list;

			public ListEnumerable(IReadOnlyList<T> list)
			{
				_list = list;
			}

			public Enumerator GetEnumerator()
			{
				return new Enumerator(_list);
			}
		}

		public static ListEnumerable<T> Enumerate<T>(this IReadOnlyList<T> list)
		{
			return new ListEnumerable<T>(list);
		}

		public static void InsertSorted<T>(this List<T> list, T item) where T : IComparable<T>
		{
			int num = list.BinarySearch(item);
			if (num < 0)
			{
				num = ~num;
			}
			list.Insert(num, item);
		}
	}
	public sealed class Logger : ILogSource, IDisposable
	{
		private readonly ManualLogSource _logger = Logger.CreateLogSource(sourceName);

		public string SourceName => _logger.SourceName;

		public event EventHandler<LogEventArgs> LogEvent
		{
			add
			{
				_logger.LogEvent += value;
			}
			remove
			{
				_logger.LogEvent -= value;
			}
		}

		public Logger(string sourceName)
		{
		}

		public void Dispose()
		{
			_logger.Dispose();
		}

		public void Log(LogLevel level, object data)
		{
			//IL_003d: 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)
			double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
			TimeSpan timeSpan = TimeSpan.FromSeconds(realtimeSinceStartupAsDouble);
			if (realtimeSinceStartupAsDouble < 86400.0)
			{
				_logger.Log(level, (object)$"[{timeSpan:hh\\:mm\\:ss\\.fff}] {data}");
			}
			else
			{
				_logger.Log(level, (object)$"[{timeSpan:d\\.hh\\:mm\\:ss\\.fff}] {data}");
			}
		}

		public void LogFatal(object data)
		{
			Log((LogLevel)1, data);
		}

		public void LogError(object data)
		{
			Log((LogLevel)2, data);
		}

		public void LogWarning(object data)
		{
			Log((LogLevel)4, data);
		}

		public void LogMessage(object data)
		{
			Log((LogLevel)8, data);
		}

		public void LogInfo(object data)
		{
			Log((LogLevel)16, data);
		}

		public void LogDebug(object data)
		{
			Log((LogLevel)32, data);
		}

		[Conditional("DEBUG")]
		public void DevLog(string text, LogLevel logLevel = (LogLevel)4)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Log(logLevel, text);
		}

		[Conditional("DEBUG")]
		public void DevLogIf(bool condition, string text, LogLevel logLevel = (LogLevel)4)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			if (condition)
			{
				Log(logLevel, text);
			}
		}
	}
	public enum MessageTypes
	{
		None,
		TopLeftNear,
		TopLeftFar,
		CenterNear,
		CenterFar,
		InWorld
	}
	public sealed class Peer(ZNetPeer peer)
	{
		[CompilerGenerated]
		private PlayerState? <PlayerState>k__BackingField;

		public ZNetPeer ZNetPeer { get; } = peer;

		public Vector3 RefPos
		{
			get
			{
				//IL_0020: 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)
				PlayerState? playerState = PlayerState;
				if (playerState == null)
				{
					return ZNetPeer.m_refPos;
				}
				return playerState.ZDO.ZDO.GetPosition();
			}
		}

		public IReadOnlyDictionary<string, string> ServerSyncedPlayerData
		{
			get
			{
				ZNetPeer zNetPeer = ZNetPeer;
				if (zNetPeer == null || zNetPeer.m_server)
				{
					return ZNet.instance.m_serverSyncedPlayerData;
				}
				return ZNetPeer.m_serverSyncedPlayerData;
			}
		}

		public PlayerState? PlayerState
		{
			get
			{
				if (<PlayerState>k__BackingField == null)
				{
					<PlayerState>k__BackingField = Processor.Instance<PlayerRegistryProcessor>().GetStateForPeerID(ZNetPeer.m_uid);
					PlayerState? playerState = <PlayerState>k__BackingField;
					if (playerState != null)
					{
						playerState.ZDO.Destroyed += delegate
						{
							<PlayerState>k__BackingField = null;
						};
					}
				}
				return <PlayerState>k__BackingField;
			}
		}

		public Vector2s GetSector()
		{
			//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)
			return ZoneSystem.GetZone(RefPos);
		}

		public string GetHostName()
		{
			return ZNetPeer.m_socket.GetHostName() ?? "";
		}

		public override bool Equals(object obj)
		{
			return object.Equals(ZNetPeer, obj);
		}

		public override int GetHashCode()
		{
			return ((object)ZNetPeer).GetHashCode();
		}
	}
	public sealed class PeersEnumerable(ZNetPeer? localPeer) : IEnumerable<Peer>, IEnumerable
	{
		public struct Enumerator : IEnumerator<Peer>, IEnumerator, IDisposable
		{
			private readonly PeersEnumerable _enumerable;

			private int _index;

			public Peer Current { get; private set; }

			readonly object IEnumerator.Current => Current;

			public Enumerator(PeersEnumerable enumerable)
			{
				_enumerable = enumerable;
				_index = -2;
				Current = null;
			}

			public void Dispose()
			{
				Current = null;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public bool MoveNext()
			{
				if (++_index < 0)
				{
					if (_enumerable.localPeer != null)
					{
						Current = _enumerable.localPeer.ServersideQoLPeer;
						return true;
					}
					_index++;
				}
				if (_index < _enumerable._peers.Count)
				{
					Current = _enumerable._peers[_index].ServersideQoLPeer;
					return true;
				}
				Current = null;
				return false;
			}

			public void Reset()
			{
				_index = -2;
			}
		}

		private readonly ZNetPeer? _localPeer = localPeer;

		private List<ZNetPeer> _peers = new List<ZNetPeer>();

		public int Count => _peers.Count + ((localPeer != null) ? 1 : 0);

		internal void Update()
		{
			//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)
			if (localPeer != null)
			{
				localPeer.m_refPos = ZNet.instance.GetReferencePosition();
			}
			_peers = ZNet.instance.GetPeers();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Enumerator GetEnumerator()
		{
			return new Enumerator(this);
		}

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

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public interface IPrefabInfo
	{
		int PrefabHash { get; }

		string PrefabName { get; }

		IReadOnlyDictionary<Type, IReadOnlyList<MonoBehaviour>> Components { get; }
	}
	[DebuggerDisplay("{PrefabName}: Processors: {EnabledProcessors.Count}")]
	public abstract class PrefabInfo : IPrefabInfo
	{
		public GameObject? Prefab { get; private set; }

		public int PrefabHash { get; private set; }

		public string PrefabName { get; private set; }

		public IReadOnlyDictionary<Type, IReadOnlyList<MonoBehaviour>> Components { get; private set; }

		public bool ReleaseOwnershipOnRecreate { get; private set; }

		internal List<Processor> AvailableProcessors { get; } = new List<Processor>();

		internal List<Processor> EnabledProcessors { get; } = new List<Processor>();

		internal void Init(GameObject prefab, int prefabHash, string prefabName, IReadOnlyDictionary<Type, IReadOnlyList<MonoBehaviour>>? components)
		{
			Prefab = prefab;
			PrefabHash = prefabHash;
			PrefabName = prefabName;
			Components = (IReadOnlyDictionary<Type, IReadOnlyList<MonoBehaviour>>)((components != null && components.Count > 0) ? ((IEnumerable)components) : ((IEnumerable)EmptyReadOnlyCollections<Type, IReadOnlyList<MonoBehaviour>>.Dictionary));
			ReleaseOwnershipOnRecreate = Components.TryGetValue(typeof(ZSyncTransform), out IReadOnlyList<MonoBehaviour> value) && value.Cast<ZSyncTransform>().Any((ZSyncTransform x) => x.m_syncPosition || x.m_syncRotation || x.m_syncBodyVelocity);
		}

		public bool HasComponent<T>() where T : MonoBehaviour
		{
			return Components.ContainsKey(typeof(T));
		}

		public T? GetComponent<T>() where T : MonoBehaviour
		{
			if (!Components.TryGetValue(typeof(T), out IReadOnlyList<MonoBehaviour> value))
			{
				return default(T);
			}
			return (T)(object)value[0];
		}

		public T GetRequiredComponent<T>() where T : MonoBehaviour
		{
			return GetComponent<T>() ?? throw new InvalidOperationException("Prefab " + PrefabName + " does not have required component " + typeof(T).Name);
		}
	}
	public abstract record ProcessorPrefabInfo
	{
		public virtual bool IsValid => true;

		public PrefabInfo PrefabInfo { get; internal set; }
	}
	public sealed record ProcessorPrefabInfo<T>(T Component) : ProcessorPrefabInfo();
	internal interface IProcessorPrefabInfo<TPrefabInfo> : IPrefabInfo where TPrefabInfo : ProcessorPrefabInfo
	{
		TPrefabInfo? PrefabInfo { get; set; }
	}
	internal static class PrefabInfoExtensions
	{
		public static T GetExtension<T>(this IPrefabInfo prefabInfo) where T : class, IPrefabInfo
		{
			return (T)prefabInfo;
		}
	}
	public static class PrivateAccessor
	{
		private const BindingFlags AccessFlags = BindingFlags.Public | BindingFlags.NonPublic;

		[CompilerGenerated]
		private static Func<ConsoleCommand, ConsoleEvent?> <GetCommandAction>k__BackingField;

		[CompilerGenerated]
		private static Func<ConsoleCommand, ConsoleEventFailable?> <GetCommandActionFailable>k__BackingField;

		[CompilerGenerated]
		private static Func<IReadOnlyList<KeyButton>> <GetServerOptionsGUIPresets>k__BackingField;

		[CompilerGenerated]
		private static Func<IReadOnlyList<KeyUI>> <GetServerOptionsGUIModifiers>k__BackingField;

		[CompilerGenerated]
		private static Func<ZDOMan, Dictionary<ZDOID, ZDO>> <GetZDOManObjectsByID>k__BackingField;

		[CompilerGenerated]
		private static Func<Localization, IReadOnlyDictionary<string, string>> <GetLocalizationStrings>k__BackingField;

		[CompilerGenerated]
		private static Func<RandEventSystem, RandomEvent?> <GetCurrentEventFunc>k__BackingField;

		[CompilerGenerated]
		private static Func<ZoneSystem, IReadOnlyDictionary<int, ZoneLocation>> <GetLocationsByHashFunc>k__BackingField;

		[CompilerGenerated]
		private static Func<ZoneSystem, ZoneLocation, int, Vector3, Quaternion, SpawnMode, List<GameObject>, bool, GameObject> <SpawnLocationFunc>k__BackingField;

		[CompilerGenerated]
		private static Action<ZoneSystem, long> <SendGlobalKeysAction>k__BackingField;

		[CompilerGenerated]
		private static Action<Container> <CheckForChangesAction>k__BackingField;

		private static Func<ConsoleCommand, ConsoleEvent?> GetCommandAction
		{
			get
			{
				Func<ConsoleCommand, ConsoleEvent?> func = <GetCommandAction>k__BackingField;
				if (func == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(ConsoleCommand));
					func = (<GetCommandAction>k__BackingField = Expression.Lambda<Func<ConsoleCommand, ConsoleEvent>>(Expression.Field(parameterExpression, typeof(ConsoleCommand).GetField("action", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), new ParameterExpression[1] { parameterExpression }).Compile());
				}
				return func;
			}
		}

		private static Func<ConsoleCommand, ConsoleEventFailable?> GetCommandActionFailable
		{
			get
			{
				Func<ConsoleCommand, ConsoleEventFailable?> func = <GetCommandActionFailable>k__BackingField;
				if (func == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(ConsoleCommand));
					func = (<GetCommandActionFailable>k__BackingField = Expression.Lambda<Func<ConsoleCommand, ConsoleEventFailable>>(Expression.Field(parameterExpression, typeof(ConsoleCommand).GetField("actionFailable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), new ParameterExpression[1] { parameterExpression }).Compile());
				}
				return func;
			}
		}

		public static Func<IReadOnlyList<KeyButton>> GetServerOptionsGUIPresets => <GetServerOptionsGUIPresets>k__BackingField ?? (<GetServerOptionsGUIPresets>k__BackingField = Expression.Lambda<Func<IReadOnlyList<KeyButton>>>(Expression.Field(null, typeof(ServerOptionsGUI).GetField("m_presets", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)), Array.Empty<ParameterExpression>()).Compile());

		public static Func<IReadOnlyList<KeyUI>> GetServerOptionsGUIModifiers => <GetServerOptionsGUIModifiers>k__BackingField ?? (<GetServerOptionsGUIModifiers>k__BackingField = Expression.Lambda<Func<IReadOnlyList<KeyUI>>>(Expression.Field(null, typeof(ServerOptionsGUI).GetField("m_modifiers", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)), Array.Empty<ParameterExpression>()).Compile());

		private static Func<ZDOMan, Dictionary<ZDOID, ZDO>> GetZDOManObjectsByID
		{
			get
			{
				Func<ZDOMan, Dictionary<ZDOID, ZDO>> func = <GetZDOManObjectsByID>k__BackingField;
				if (func == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(ZDOMan));
					func = (<GetZDOManObjectsByID>k__BackingField = Expression.Lambda<Func<ZDOMan, Dictionary<ZDOID, ZDO>>>(Expression.Field(parameterExpression, typeof(ZDOMan).GetField("m_objectsByID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), new ParameterExpression[1] { parameterExpression }).Compile());
				}
				return func;
			}
		}

		private static Func<Localization, IReadOnlyDictionary<string, string>> GetLocalizationStrings
		{
			get
			{
				Func<Localization, IReadOnlyDictionary<string, string>> func = <GetLocalizationStrings>k__BackingField;
				if (func == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(Localization));
					func = (<GetLocalizationStrings>k__BackingField = Expression.Lambda<Func<Localization, IReadOnlyDictionary<string, string>>>(Expression.Field(parameterExpression, typeof(Localization).GetField("m_translations", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), new ParameterExpression[1] { parameterExpression }).Compile());
				}
				return func;
			}
		}

		private static Func<RandEventSystem, RandomEvent?> GetCurrentEventFunc
		{
			get
			{
				Func<RandEventSystem, RandomEvent?> func = <GetCurrentEventFunc>k__BackingField;
				if (func == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(RandEventSystem));
					func = (<GetCurrentEventFunc>k__BackingField = Expression.Lambda<Func<RandEventSystem, RandomEvent>>(Expression.Field(parameterExpression, typeof(RandEventSystem).GetField("m_randomEvent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), new ParameterExpression[1] { parameterExpression }).Compile());
				}
				return func;
			}
		}

		private static Func<ZoneSystem, IReadOnlyDictionary<int, ZoneLocation>> GetLocationsByHashFunc
		{
			get
			{
				Func<ZoneSystem, IReadOnlyDictionary<int, ZoneLocation>> func = <GetLocationsByHashFunc>k__BackingField;
				if (func == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(ZoneSystem));
					func = (<GetLocationsByHashFunc>k__BackingField = Expression.Lambda<Func<ZoneSystem, IReadOnlyDictionary<int, ZoneLocation>>>(Expression.Field(parameterExpression, typeof(ZoneSystem).GetField("m_locationsByHash", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), new ParameterExpression[1] { parameterExpression }).Compile());
				}
				return func;
			}
		}

		private static Func<ZoneSystem, ZoneLocation, int, Vector3, Quaternion, SpawnMode, List<GameObject>, bool, GameObject> SpawnLocationFunc
		{
			get
			{
				Func<ZoneSystem, ZoneLocation, int, Vector3, Quaternion, SpawnMode, List<GameObject>, bool, GameObject> func = <SpawnLocationFunc>k__BackingField;
				if (func == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(ZoneSystem));
					MethodInfo? method = typeof(ZoneSystem).GetMethod("SpawnLocation", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					Expression[] array = new Expression[7];
					ParameterExpression parameterExpression2 = (ParameterExpression)(array[0] = Expression.Parameter(typeof(ZoneLocation)));
					ParameterExpression parameterExpression3 = (ParameterExpression)(array[1] = Expression.Parameter(typeof(int)));
					ParameterExpression parameterExpression4 = (ParameterExpression)(array[2] = Expression.Parameter(typeof(Vector3)));
					ParameterExpression parameterExpression5 = (ParameterExpression)(array[3] = Expression.Parameter(typeof(Quaternion)));
					ParameterExpression parameterExpression6 = (ParameterExpression)(array[4] = Expression.Parameter(typeof(SpawnMode)));
					ParameterExpression parameterExpression7 = (ParameterExpression)(array[5] = Expression.Parameter(typeof(List<GameObject>)));
					ParameterExpression parameterExpression8 = (ParameterExpression)(array[6] = Expression.Parameter(typeof(bool)));
					func = (<SpawnLocationFunc>k__BackingField = Expression.Lambda<Func<ZoneSystem, ZoneLocation, int, Vector3, Quaternion, SpawnMode, List<GameObject>, bool, GameObject>>(Expression.Call(parameterExpression, method, array), new ParameterExpression[8] { parameterExpression, parameterExpression2, parameterExpression3, parameterExpression4, parameterExpression5, parameterExpression6, parameterExpression7, parameterExpression8 }).Compile());
				}
				return func;
			}
		}

		private static Action<ZoneSystem, long> SendGlobalKeysAction
		{
			get
			{
				Action<ZoneSystem, long> action = <SendGlobalKeysAction>k__BackingField;
				if (action == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(ZoneSystem));
					MethodInfo? method = typeof(ZoneSystem).GetMethod("SendGlobalKeys", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					Expression[] array = new Expression[1];
					ParameterExpression parameterExpression2 = (ParameterExpression)(array[0] = Expression.Parameter(typeof(long)));
					action = (<SendGlobalKeysAction>k__BackingField = Expression.Lambda<Action<ZoneSystem, long>>(Expression.Call(parameterExpression, method, array), new ParameterExpression[2] { parameterExpression, parameterExpression2 }).Compile());
				}
				return action;
			}
		}

		private static Action<Container> CheckForChangesAction
		{
			get
			{
				Action<Container> action = <CheckForChangesAction>k__BackingField;
				if (action == null)
				{
					ParameterExpression parameterExpression = Expression.Parameter(typeof(Container));
					action = (<CheckForChangesAction>k__BackingField = Expression.Lambda<Action<Container>>(Expression.Call(parameterExpression, typeof(Container).GetMethod("CheckForChanges", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), new ParameterExpression[1] { parameterExpression }).Compile());
				}
				return action;
			}
		}

		public static int ZSyncAnimationZDOSalt { get; } = (int)typeof(ZSyncAnimation).GetField("c_ZDOSalt", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetRawConstantValue();

		public static int CharacterAnimationHashEncumbered { get; } = (int)typeof(Character).GetField("s_encumbered", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null);

		public static int CharacterAnimationHashInWater { get; } = (int)typeof(Character).GetField("s_inWater", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null);

		public static int PlayerAnimationHashCrouching { get; } = (int)typeof(Player).GetField("s_crouching", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null);

		public static ConsoleEvent? GetAction(this ConsoleCommand command)
		{
			return GetCommandAction(command);
		}

		public static ConsoleEventFailable? GetActionFailable(this ConsoleCommand command)
		{
			return GetCommandActionFailable(command);
		}

		private static Dictionary<ZDOID, ZDO> GetObjectsByIDCore(this ZDOMan instance)
		{
			return GetZDOManObjectsByID(instance);
		}

		public static Dictionary<ZDOID, ZDO>.ValueCollection GetObjects(this ZDOMan instance)
		{
			return instance.GetObjectsByIDCore().Values;
		}

		public static IReadOnlyDictionary<string, string> GetStrings(this Localization instance)
		{
			return GetLocalizationStrings(instance);
		}

		public static RandomEvent? GetCurrentEvent(this RandEventSystem instance)
		{
			return GetCurrentEventFunc(instance);
		}

		public static IReadOnlyDictionary<int, ZoneLocation> GetLocationsByHash(this ZoneSystem instance)
		{
			return GetLocationsByHashFunc(instance);
		}

		public static Location GetAndLoadLocationByHash(this ZoneSystem instance, int hash)
		{
			if (!instance.GetLocationsByHash().TryGetValue(hash, out ZoneLocation value))
			{
				return default(Location);
			}
			return new Location(value);
		}

		public static GameObject SpawnLocation(this ZoneSystem instance, ZoneLocation location, int seed, Vector3 pos, Quaternion rot, SpawnMode mode, List<GameObject>? spawnedGhostObjects = null, bool cheated = false)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			return SpawnLocationFunc(instance, location, seed, pos, rot, mode, spawnedGhostObjects ?? new List<GameObject>(), cheated);
		}

		public static void SendGlobalKeys(this ZoneSystem instance, long peerID)
		{
			SendGlobalKeysAction(instance, peerID);
		}

		public static void CheckForChanges(this Container container)
		{
			CheckForChangesAction(container);
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public sealed class ProcessorAttribute : Attribute
	{
		public Guid Id { get; } = new Guid(id);

		public bool OnlyWhenDependedOn { get; init; }

		public int Priority { get; init; }

		public ProcessorAttribute(string id)
		{
		}
	}
	public abstract class ProcessorDependencyAttribute : Attribute
	{
		public Guid ProcessorId { get; }

		public bool Required { get; init; }

		public bool? RunBefore { get; }

		private ProcessorDependencyAttribute(Guid processorId, bool required, bool? runBefore)
		{
			ProcessorId = processorId;
			Required = required;
			RunBefore = runBefore;
		}

		private protected ProcessorDependencyAttribute(string processorId, bool? runBefore)
			: this(new Guid(processorId), required: false, runBefore)
		{
		}

		private protected ProcessorDependencyAttribute(Type processorType, bool? runBefore)
			: this(processorType.GetCustomAttribute<ProcessorAttribute>()?.Id ?? default(Guid), required: true, runBefore)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
	public sealed class DependsOnAttribute : ProcessorDependencyAttribute
	{
		public DependsOnAttribute(string processorId)
			: base(processorId, null)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
	public sealed class DependsOnAttribute<T> : ProcessorDependencyAttribute where T : Processor, new()
	{
		public DependsOnAttribute()
			: base(typeof(T), null)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
	public sealed class RunBeforeAttribute : ProcessorDependencyAttribute
	{
		public RunBeforeAttribute(string processorId)
			: base(processorId, true)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
	public sealed class RunBeforeAttribute<T> : ProcessorDependencyAttribute where T : Processor, new()
	{
		public RunBeforeAttribute()
			: base(typeof(T), true)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
	public sealed class RunAfterAttribute : ProcessorDependencyAttribute
	{
		public RunAfterAttribute(string processorId)
			: base(processorId, false)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
	public sealed class RunAfterAttribute<T> : ProcessorDependencyAttribute where T : Processor, new()
	{
		public RunAfterAttribute()
			: base(typeof(T), false)
		{
		}
	}
	public abstract class Processor
	{
		private static class InstanceCache<T> where T : Processor, new()
		{
			public static readonly T Instance = new T();
		}

		[Flags]
		protected internal enum ProcessResult
		{
			Default = 0,
			UnregisterProcessor = 2,
			DestroyZDO = 4,
			RecreateZDO = 8,
			SkipOtherProcessors = 0x10,
			[Obsolete("Use ScheduleReprocessing() instead")]
			ScheduleReprocessing = 0x20,
			ReregisterOnRecreated = 0x40
		}

		[Flags]
		public enum CreatorMarkers : uint
		{
			None = 0u,
			DataZDO = 1u,
			ProcessorOwned = 2u
		}

		[Obsolete("For internal use only", false)]
		public abstract class ServerVarCore<T> : ServerVar<T>
		{
			private static readonly int __serverVarHash = StringExtensionMethods.GetStableHashCode("ArgusMagnus.ServersideQoL.ServerVars" + typeof(T).Name);

			private static HashSet<int>? __serverVars;

			protected readonly int _hash;

			private bool _usageSaved;

			private protected ServerVarCore(string name)
			{
				_hash = StringExtensionMethods.GetStableHashCode(name);
			}

			protected abstract void SetCore(ServersideQoLZDO zdo, T value);

			public sealed override void Set(ServersideQoLZDO zdo, T value)
			{
				if (!_usageSaved)
				{
					_usageSaved = true;
					if (__serverVars == null)
					{
						__serverVars = new HashSet<int>();
						ServersideQoLZDO? _dataZDO = __dataZDO;
						byte[] array = ((_dataZDO != null) ? _dataZDO.ZDO.GetByteArray(__serverVarHash, (byte[])null) : null);
						if (array != null && array.Length > 0)
						{
							Span<int> span = MemoryMarshal.Cast<byte, int>(array.AsSpan());
							for (int i = 0; i < span.Length; i++)
							{
								int item = span[i];
								__serverVars.Add(item);
							}
						}
					}
					if (__serverVars.Add(_hash))
					{
						byte[] array2 = new byte[__serverVars.Count * 4];
						Span<int> span2 = MemoryMarshal.Cast<byte, int>(array2.AsSpan());
						foreach (int _serverVar in __serverVars)
						{
							span2[0] = _serverVar;
							span2 = span2.Slice(1);
						}
						DataZDO.ZDO.Set(__serverVarHash, array2);
					}
				}
				SetCore(zdo, value);
			}

			internal static HashSet<int>? GetVars()
			{
				if (__serverVars == null)
				{
					ServersideQoLZDO? _dataZDO = __dataZDO;
					byte[] array = ((_dataZDO != null) ? _dataZDO.ZDO.GetByteArray(__serverVarHash, (byte[])null) : null);
					if (array != null && array.Length > 0)
					{
						__serverVars = new HashSet<int>();
						Span<int> span = MemoryMarshal.Cast<byte, int>(array.AsSpan());
						for (int i = 0; i < span.Length; i++)
						{
							int item = span[i];
							__serverVars.Add(item);
						}
					}
				}
				return __serverVars;
			}
		}

		private static class HeightmapUtils
		{
			private static readonly List<(Vector2s ZoneId, GameObject Root)> _zoneRoots = new List<(Vector2s, GameObject)>();

			private static DateTimeOffset __nextCleanup;

			public static Heightmap CreateHeightmap(Vector2s zoneId)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//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_0011: 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_0022: Unknown result type (might be due to invalid IL or missing references)
				Vector3 zonePos = ZoneSystem.GetZonePos(zoneId);
				GameObject val = Object.Instantiate<GameObject>(ZoneSystem.instance.m_zonePrefab, zonePos, Quaternion.identity);
				_zoneRoots.Add((zoneId, val));
				return val.GetComponentInChildren<Heightmap>();
			}

			public static Heightmap CreateHeightmap(Vector3 refPos)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return CreateHeightmap(ZoneSystem.GetZone(refPos));
			}

			public static void CleanUp(PeersEnumerable peers)
			{
				//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)
				if (__nextCleanup > DateTimeOffset.UtcNow)
				{
					return;
				}
				for (int num = _zoneRoots.Count - 1; num >= 0; num--)
				{
					var (zone, val) = _zoneRoots[num];
					if (!peers.Any((Peer x) => ZNetScene.InActiveArea(x.RefPos, zone)))
					{
						_zoneRoots.RemoveAt(num);
						Object.Destroy((Object)(object)val);
					}
				}
				__nextCleanup = DateTimeOffset.UtcNow.AddSeconds(2.0);
			}
		}

		private static ServersideQoLZDO? __dataZDO;

		private static bool __enableProcessingTimeMonitoring;

		private static readonly int __oldPluginGuidHash = StringExtensionMethods.GetStableHashCode("argusmagnus.ServersideQoL");

		private static readonly ServerVar<Guid> __processorIdVar = ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.RegisterServerVar<Guid>("ProcessorId");

		[CompilerGenerated]
		private static IReadOnlyDictionary<Biome, Character> <BossesByBiome>k__BackingField;

		private static List<Predicate<ItemData>>? __isItemTeleportableEvaluationRequest;

		internal const ProcessResult ScheduleReprocessingConst = ProcessResult.ScheduleReprocessing;

		internal ProcessorAttribute Attribute { get; }

		internal IServersideQoLPlugin Plugin { get; private set; }

		protected Logger Logger { get; private set; }

		protected HashSet<ServersideQoLZDO> PlacedObjects { get; } = new HashSet<ServersideQoLZDO>();

		public double ProcessingTimeSeconds { get; private set; }

		public double TotalProcessingTimeSeconds { get; private set; }

		internal float ScheduleReprocessingDelay { get; private set; }

		internal bool HasPreProcessor { get; private set; } = true;

		protected static IReadOnlyDictionary<string, PieceTable> PieceTablesByPieceName => ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.PieceTablesByPieceName;

		protected internal static IReadOnlyDictionary<Biome, Character> BossesByBiome => <BossesByBiome>k__BackingField ?? (<BossesByBiome>k__BackingField = ((Func<IReadOnlyDictionary<Biome, Character>>)delegate
		{
			//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_009a: 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_0079: Invalid comparison between Unknown and I4
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Invalid comparison between Unknown and I4
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<Biome, Character> dictionary = new Dictionary<Biome, Character>();
			foreach (bool item in (IEnumerable<bool>)new <>z__ReadOnlyArray<bool>(new bool[2] { false, true }))
			{
				foreach (ZoneLocation location in ZoneSystem.instance.m_locations)
				{
					bool flag = !location.m_enable || !location.m_prioritized;
					bool flag2 = flag;
					if (!flag2)
					{
						Biome biome = location.m_biome;
						bool flag3 = (((int)biome == 0 || (int)biome == 256 || (int)biome == 895) ? true : false);
						flag2 = flag3;
					}
					if (!flag2 && !dictionary.ContainsKey(location.m_biome))
					{
						try
						{
							location.m_prefab.Load();
						}
						catch (Exception arg)
						{
							ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Logger.LogWarning($"Loading location asset {location.m_prefabName} failed: {arg}");
							continue;
						}
						GameObject asset = location.m_prefab.Asset;
						if (asset == null)
						{
							ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Logger.LogWarning("Loading location asset " + location.m_prefabName + " failed");
						}
						else
						{
							OfferingBowl componentInChildren = asset.GetComponentInChildren<OfferingBowl>();
							if (item && componentInChildren == null)
							{
								DungeonGenerator componentInChildren2 = asset.GetComponentInChildren<DungeonGenerator>();
								if (componentInChildren2 != null)
								{
									SoftReference<GameObject>[] availableRoomPrefabs = componentInChildren2.GetAvailableRoomPrefabs();
									for (int i = 0; i < availableRoomPrefabs.Length; i++)
									{
										SoftReference<GameObject> val = availableRoomPrefabs[i];
										val.Load();
										Room component = val.Asset.GetComponent<Room>();
										componentInChildren = ((Component)component).GetComponentInChildren<OfferingBowl>();
										if (componentInChildren != null)
										{
											break;
										}
									}
								}
							}
							if (componentInChildren != null)
							{
								dictionary.Add(location.m_biome, componentInChildren.m_bossPrefab.GetComponent<Character>());
							}
						}
					}
				}
			}
			return dictionary;
		})());

		protected static ServersideQoLZDO DataZDO
		{
			get
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				if (__dataZDO == null)
				{
					int sconce = Prefabs.Sconce;
					__dataZDO = ZDOMan.instance.CreateNewZDO(new Vector3(105000f, -1000f, 105000f), sconce).ServersideQoLZDO;
					__dataZDO.ZDO.SetPrefab(sconce);
					__dataZDO.ZDO.Persistent = true;
					__dataZDO.ZDO.Distant = false;
					__dataZDO.ZDO.Type = (ObjectType)0;
					__dataZDO.SetModAsCreator(CreatorMarkers.DataZDO);
					__dataZDO.Vars.SetHealth(-1f, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 239);
					__dataZDO.PrefabInfo = ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.GetPrefabInfo(sconce);
					__dataZDO.Fields<Piece>().Set(() => (Piece x) => x.m_canBeRemoved, value: false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 241);
					__dataZDO.Fields<WearNTear>().Set(() => (WearNTear x) => x.m_noRoofWear, value: false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 243).Set(() => (WearNTear x) => x.m_noSupportWear, value: false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 244)
						.Set(() => (WearNTear x) => x.m_health, -1f, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 245);
					__dataZDO.UnregisterAll();
				}
				return __dataZDO;
			}
		}

		protected static event Predicate<ItemData>? IsItemTeleportableEvaluationRequest
		{
			add
			{
				if (value != null)
				{
					(__isItemTeleportableEvaluationRequest ?? (__isItemTeleportableEvaluationRequest = new List<Predicate<ItemData>>())).Add(value);
				}
			}
			remove
			{
				if (value != null)
				{
					List<Predicate<ItemData>> _isItemTeleportableEvaluationRequest = __isItemTeleportableEvaluationRequest;
					if (_isItemTeleportableEvaluationRequest != null && _isItemTeleportableEvaluationRequest.Count > 0)
					{
						__isItemTeleportableEvaluationRequest.Remove(value);
					}
				}
			}
		}

		private protected Processor()
		{
			Attribute = GetType().GetCustomAttribute<ProcessorAttribute>() ?? throw new Exception("Required ProcessorAttribute missing on type " + GetType().FullName);
		}

		internal void Init(IServersideQoLPlugin plugin, Logger logger)
		{
			Plugin = plugin;
			Logger = logger;
			ValidateProcessor();
		}

		private protected abstract void ValidateProcessor();

		private protected abstract bool InitializePrefabInfo(PrefabInfo prefabInfo);

		internal bool InitializePrefabInfoInternal(PrefabInfo prefabInfo)
		{
			return InitializePrefabInfo(prefabInfo);
		}

		private protected abstract void AddPrefabInfoInterface(TypeExtensionBuilder<IPrefabInfo, PrefabInfo> prefabInfoBuilder);

		internal void AddPrefabInfoInterfaceInternal(TypeExtensionBuilder<IPrefabInfo, PrefabInfo> prefabInfoBuilder)
		{
			AddPrefabInfoInterface(prefabInfoBuilder);
		}

		public static T Instance<T>() where T : Processor, new()
		{
			return InstanceCache<T>.Instance;
		}

		internal static void StaticInitialize()
		{
			__enableProcessingTimeMonitoring = ConfigBase<Config>.Instance.DiagnosticLogs.Value;
			__dataZDO = null;
			foreach (ServersideQoLZDO item in from x in ZDOMan.instance.GetObjects()
				select x.ServersideQoLZDO)
			{
				if (!item.IsModCreator(out var marker))
				{
					if ((int)item.Vars.GetCreator().Value == __oldPluginGuidHash)
					{
						item.Destroy();
					}
					continue;
				}
				if (marker == CreatorMarkers.None)
				{
					item.Destroy();
					continue;
				}
				if ((marker & CreatorMarkers.DataZDO) != CreatorMarkers.None)
				{
					if (__dataZDO == null)
					{
						__dataZDO = item;
					}
					else
					{
						ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Logger.LogError("More then one DataZDO found, destroying the second one");
						item.Destroy();
					}
				}
				if ((marker & CreatorMarkers.ProcessorOwned) != CreatorMarkers.None && ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.Processors.TryGetValue(__processorIdVar.Get(item), out Processor value))
				{
					value.PlacedObjects.Add(item);
					item.Destroyed += value.OnPlacedObjectDestroyed;
					if (value.ClaimExclusive(item) && !item.Processors.Contains(value))
					{
						item.UnregisterAll();
					}
				}
			}
		}

		internal static void StaticPreProcess(PeersEnumerable peers)
		{
			HeightmapUtils.CleanUp(peers);
		}

		protected internal virtual void Initialize()
		{
		}

		protected void ScheduleReprocessing(ServersideQoLZDO zdo, float delayInSeconds = 0f)
		{
			ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.ScheduleReprocessing(zdo, delayInSeconds);
		}

		protected ProcessResult ScheduleReprocessing(float delayInSeconds = 0f)
		{
			ScheduleReprocessingDelay = delayInSeconds;
			return ProcessResult.ScheduleReprocessing;
		}

		private protected abstract ProcessResult Process(IReadOnlyList<Peer> peers, ServersideQoLZDO zdo);

		protected virtual void PreProcess(PeersEnumerable peers)
		{
			HasPreProcessor = false;
		}

		internal ProcessResult ProcessInternal(IReadOnlyList<Peer> peers, ServersideQoLZDO zdo)
		{
			if (!__enableProcessingTimeMonitoring)
			{
				return Process(peers, zdo);
			}
			double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
			ProcessResult result = Process(peers, zdo);
			ProcessingTimeSeconds += Time.realtimeSinceStartupAsDouble - realtimeSinceStartupAsDouble;
			return result;
		}

		internal void PreProcessInternal(PeersEnumerable peers)
		{
			if (!__enableProcessingTimeMonitoring)
			{
				PreProcess(peers);
				return;
			}
			TotalProcessingTimeSeconds += ProcessingTimeSeconds;
			double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
			PreProcess(peers);
			ProcessingTimeSeconds = Time.realtimeSinceStartupAsDouble - realtimeSinceStartupAsDouble;
		}

		protected internal virtual bool ClaimExclusive(ServersideQoLZDO zdo)
		{
			return PlacedObjects.Contains(zdo);
		}

		protected static bool CheckMinDistance(IReadOnlyList<Peer> peers, ServersideQoLZDO zdo, float minDistance)
		{
			//IL_001f: 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)
			minDistance *= minDistance;
			foreach (Peer item in peers.Enumerate())
			{
				if (Utils.DistanceSqr(item.RefPos, zdo.ZDO.GetPosition()) < minDistance)
				{
					return false;
				}
			}
			return true;
		}

		protected static PrefabInfo GetPrefabInfo(int prefab)
		{
			return ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.GetPrefabInfo(prefab);
		}

		protected static PrefabInfo GetPrefabInfo(ServersideQoLZDO zdo)
		{
			return zdo.PrefabInfo ?? (zdo.PrefabInfo = ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.GetPrefabInfo(zdo.ZDO.GetPrefab()));
		}

		protected static ServersideQoLZDO Spawn(int prefab, Vector3 pos, Quaternion rot, long owner = 0L)
		{
			//IL_0005: 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)
			ZDO val = ZDOMan.instance.CreateNewZDO(pos, prefab);
			val.SetPrefab(prefab);
			val.Persistent = true;
			val.Distant = false;
			val.Type = (ObjectType)0;
			val.SetRotation(rot);
			val.SetOwnerInternal(owner);
			val.ServersideQoLZDO.PrefabInfo = ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.GetPrefabInfo(prefab);
			return val.ServersideQoLZDO;
		}

		private void OnPlacedObjectDestroyed(ServersideQoLZDO zdo)
		{
			PlacedObjects.Remove(zdo);
		}

		protected ServersideQoLZDO PlaceObject(Vector3 pos, int prefab, float rot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return PlaceObject(pos, prefab, rot, CreatorMarkers.None);
		}

		protected ServersideQoLZDO PlaceObject(Vector3 pos, int prefab, float rot, CreatorMarkers marker)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return PlaceObject(pos, prefab, rot, marker, 0L);
		}

		protected ServersideQoLZDO PlaceObject(Vector3 pos, int prefab, float rot, CreatorMarkers marker, long owner)
		{
			//IL_0001: 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)
			return PlaceObject(pos, prefab, Quaternion.Euler(0f, rot, 0f), marker, owner);
		}

		protected ServersideQoLZDO PlaceObject(Vector3 pos, int prefab, Quaternion rot)
		{
			//IL_0001: 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)
			return PlaceObject(pos, prefab, rot, CreatorMarkers.None);
		}

		protected ServersideQoLZDO PlaceObject(Vector3 pos, int prefab, Quaternion rot, CreatorMarkers marker)
		{
			//IL_0001: 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)
			return PlaceObject(pos, prefab, rot, marker, 0L);
		}

		protected ServersideQoLZDO PlaceObject(Vector3 pos, int prefab, Quaternion rot, CreatorMarkers marker, long owner)
		{
			//IL_0005: 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)
			ServersideQoLZDO serversideQoLZDO = ZDOMan.instance.CreateNewZDO(pos, prefab).ServersideQoLZDO;
			serversideQoLZDO.ZDO.SetPrefab(prefab);
			serversideQoLZDO.ZDO.Persistent = true;
			serversideQoLZDO.ZDO.Distant = false;
			serversideQoLZDO.ZDO.Type = (ObjectType)0;
			serversideQoLZDO.ZDO.SetRotation(rot);
			serversideQoLZDO.SetModAsCreator(marker);
			serversideQoLZDO.Vars.SetHealth(-1f, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 345);
			if (marker.HasFlag(CreatorMarkers.ProcessorOwned))
			{
				__processorIdVar.Set(serversideQoLZDO, Attribute.Id);
			}
			serversideQoLZDO.ZDO.SetOwnerInternal(owner);
			serversideQoLZDO.PrefabInfo = ServersideQoLPluginBaseCore<ServersideQoLPlugin, Config>.Instance.GetPrefabInfo(prefab);
			PlacedObjects.Add(serversideQoLZDO);
			serversideQoLZDO.Destroyed += OnPlacedObjectDestroyed;
			if (ClaimExclusive(serversideQoLZDO) && !serversideQoLZDO.Processors.Contains(this))
			{
				serversideQoLZDO.UnregisterAll();
			}
			return serversideQoLZDO;
		}

		protected ServersideQoLZDO PlacePiece(Vector3 pos, int prefab, float rot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return PlacePiece(pos, prefab, rot, CreatorMarkers.None);
		}

		protected ServersideQoLZDO PlacePiece(Vector3 pos, int prefab, float rot, CreatorMarkers marker)
		{
			//IL_0001: 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)
			return PlacePiece(pos, prefab, Quaternion.Euler(0f, rot, 0f), marker);
		}

		protected ServersideQoLZDO PlacePiece(Vector3 pos, int prefab, Quaternion rot)
		{
			//IL_0001: 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)
			return PlacePiece(pos, prefab, rot, CreatorMarkers.None);
		}

		protected ServersideQoLZDO PlacePiece(Vector3 pos, int prefab, Quaternion rot, CreatorMarkers marker)
		{
			//IL_0001: 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)
			ServersideQoLZDO serversideQoLZDO = PlaceObject(pos, prefab, rot, marker, 0L);
			serversideQoLZDO.Fields<Piece>().Set(() => (Piece x) => x.m_canBeRemoved, value: false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 371);
			serversideQoLZDO.Fields<WearNTear>().Set(() => (WearNTear x) => x.m_noRoofWear, value: false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 373).Set(() => (WearNTear x) => x.m_noSupportWear, value: false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 374)
				.Set(() => (WearNTear x) => x.m_health, -1f, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL\\Processor.cs", 375);
			return serversideQoLZDO;
		}

		protected ServersideQoLZDO RecreatePiece(ServersideQoLZDO zdo)
		{
			if (!PlacedObjects.Remove(zdo))
			{
				throw new ArgumentException();
			}
			zdo.Destroyed -= OnPlacedObjectDestroyed;
			PlacedObjects.Add(zdo = zdo.Recreate());
			zdo.Destroyed += OnPlacedObjectDestroyed;
			return zdo;
		}

		protected void DestroyObject(ServersideQoLZDO zdo)
		{
			if (!PlacedObjects.Remove(zdo))
			{
				throw new ArgumentException();
			}
			zdo.Destroy();
		}

		protected static Heightmap GetHeightmap(Vector3 pos)
		{
			//IL_0000: 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)
			return Heightmap.FindHeightmap(pos) ?? HeightmapUtils.CreateHeightmap(pos);
		}

		protected static Biome GetBiome(Vector3 pos)
		{
			//IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			return GetHeightmap(pos).GetBiome(pos, 0.02f, false);
		}

		protected static float GetHeight(Vector3 pos)
		{
			//IL_0000: 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)
			return GetHeightmap(pos).GetHeight(pos);
		}

		protected static string ConvertToRegexPattern(string searchPattern)
		{
			searchPattern = Regex.Escape(searchPattern);
			searchPattern = searchPattern.Replace("\\*", ".*").Replace("\\?", ".?");
			return "(?i)^" + searchPattern + "$";
		}

		protected static bool IsItemTeleportable(ItemData item)
		{
			if (item.m_shared.m_teleportable || ZoneSystem.instance.GetGlobalKey((GlobalKeys)35))
			{
				return true;
			}
			List<Predicate<ItemData>> _isItemTeleportableEvaluationRequest = __isItemTeleportableEvaluationRequest;
			if (_isItemTeleportableEvaluationRequest != null && _isItemTeleportableEvaluationRequest.Count > 0)
			{
				foreach (Predicate<ItemData> item2 in __isItemTeleportableEvaluationRequest)
				{
					if (item2(item))
					{
						return true;
					}
				}
			}
			return false;
		}

		protected static bool HasNonTeleportableItem(IEnumerable<ItemData> items)
		{
			foreach (ItemData item in items)
			{
				if (!IsItemTeleportable(item))
				{
					return true;
				}
			}
			return false;
		}

		protected static void ShowMessage(IEnumerable<Peer> peers, Vector3 pos, string message, MessageTypes type, TextType inWorldTextType = (TextType)0)
		{
			//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_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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			switch (type)
			{
			default:
				return;
			case MessageTypes.TopLeftNear:
			case MessageTypes.CenterNear:
			case MessageTypes.InWorld:
				peers = peers.Where((Peer x) => Vector3.Distance(x.RefPos, pos) <= DamageText.instance.m_maxTextDistance);
				break;
			case MessageTypes.TopLeftFar:
			case MessageTypes.CenterFar:
				peers = peers.Where((Peer x) => Vector3.Distance(x.RefPos, pos) <= ConfigBase<Config>.Instance.FarMessageRange.Value);
				break;
			}
			bool flag;
			switch (type)
			{
			case MessageTypes.InWorld:
				RPC.ShowInWorldText(peers.Select((Peer x) => x.ZNetPeer.m_uid), inWorldTextType, pos, StringExtensionMethods.RemoveRichTextTags(message));
				return;
			case MessageTypes.TopLeftNear:
			case MessageTypes.TopLeftFar:
				flag = true;
				break;
			default:
				flag = false;
				break;
			}
			MessageType type2 = (MessageType)(flag ? 1 : 2);
			foreach (Peer peer in peers)
			{
				RPC.ShowMessage(peer.ZNetPeer.m_uid, type2, message);
			}
		}

		protected static void ShowMessage(IEnumerable<Peer> peers, ServersideQoLZDO zdo, string message, MessageTypes type, TextType inWorldTextType = (TextType)0)
		{
			//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)
			ShowMessage(peers, zdo.ZDO.GetPosition(), message, type, inWorldTextType);
		}

		[Conditional("DEBUG")]
		protected static void DevShowMessage(ServersideQoLZDO zdo, string message, TextType type = (TextType)0, [CallerFilePath] string callerFile = null, [CallerLineNumber] int callerLineNo = 0)
		{
			//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)
			RPC.ShowInWorldText(new <>z__ReadOnlySingleElementList<long>(0L), type, zdo.ZDO.GetPosition(), $"{Path.GetFileNameWithoutExtension(callerFile)} L{callerLineNo}: {message}");
		}

		protected internal static (int Width, int Height) GetInventorySize(int slots, bool exact)
		{
			int num;
			int num3;
			if (exact)
			{
				num = 1;
				for (int num2 = Math.Min(8, slots); num2 > 1; num2--)
				{
					if (slots % num2 == 0)
					{
						num = num2;
						break;
					}
				}
				num3 = slots / num;
			}
			else
			{
				int num4 = ((slots < 16) ? ((slots < 4) ? 1 : ((slots >= 9) ? 3 : 2)) : ((slots <= 32) ? 4 : 0));
				num3 = num4;
				if (num3 > 0)
				{
					num = (slots + num3 - 1) / num3;
				}
				else
				{
					num = 8;
					num3 = (slots + num - 1) / num;
				}
			}
			return (Width: num, Height: num3);
		}
	}
	public abstract class Processor<TPrefabInfo> : Processor where TPrefabInfo : notnull, ProcessorPrefabInfo
	{
		private readonly ConstructorInfo? _prefabInfoCtor;

		private readonly ParameterInfo[]? _prefabInfoCtorParameters;

		private readonly bool?[]? _prefabInfoCtorParametersNullable;

		protected Processor()
		{
			ConstructorInfo[] constructors = typeof(TPrefabInfo).GetConstructors();
			if (constructors != null && constructors.Length == 1)
			{
				_prefabInfoCtor = constructors[0];
				_prefabInfoCtorParameters = _prefabInfoCtor.GetParameters();
				_prefabInfoCtorParametersNullable = new bool?[_prefabInfoCtorParameters.Length];
			}
		}

		private protected override void AddPrefabInfoInterface(TypeExtensionBuilder<IPrefabInfo, PrefabInfo> prefabInfoBuilder)
		{
			prefabInfoBuilder.AddInterface<IProcessorPrefabInfo<TPrefabInfo>>();
		}

		private protected override bool InitializePrefabInfo(PrefabInfo prefabInfo)
		{
			IProcessorPrefabInfo<TPrefabInfo> extension = prefabInfo.GetExtension<IProcessorPrefabInfo<TPrefabInfo>>();
			if ((object)extension.PrefabInfo == null)
			{
				extension.PrefabInfo = CreateProcessorPrefabInfo(prefabInfo);
				TPrefabInfo? prefabInfo2 = extension.PrefabInfo;
				if ((object)prefabInfo2 != null)
				{
					prefabInfo2.PrefabInfo = prefabInfo;
				}
			}
			return extension.PrefabInfo?.IsValid ?? false;
		}

		protected static TPrefabInfo? GetProcessorPrefabInfo(ServersideQoLZDO zdo)
		{
			return zdo.GetProcessorPrefabInfo<TPrefabInfo>();
		}

		[Conditional("DEBUG")]
		public static void AssertHasProcessorPrefabInfo(ServersideQoLZDO zdo)
		{
		}

		private TPrefabInfo? CreateProcessorPrefabInfo(PrefabInfo prefabInfo)
		{
			if ((object)_prefabInfoCtor == null || _prefabInfoCtorParameters == null || _prefabInfoCtorParametersNullable == null)
			{
				throw new InvalidOperationException();
			}
			if (_prefabInfoCtorParameters.Length == 0)
			{
				return (TPrefabInfo)_prefabInfoCtor.Invoke(Array.Empty<object>());
			}
			GameObject prefab = prefabInfo.Prefab;
			IReadOnlyDictionary<Type, IReadOnlyList<MonoBehaviour>> components = prefabInfo.Components;
			object[] array = new object[_prefabInfoCtorParameters.Length];
			bool flag = false;
			MethodInfo methodInfo = null;
			List<Type> list = null;
			bool? defaultNullable = null;
			for (int i = 0; i < _prefabInfoCtorParameters.Length; i++)
			{
				ParameterInfo parameterInfo = _prefabInfoCtorParameters[i];
				Type type = parameterInfo.ParameterType;
				bool flag2 = false;
				if (type.IsGenericType)
				{
					Type[] genericArguments = type.GetGenericArguments();
					if (genericArguments != null && genericArguments.Length == 1 && type.IsAssignableFrom(typeof(IReadOnlyList<>).MakeGenericType(genericArguments)))
					{
						type = genericArguments[0];
						flag2 = true;
					}
				}
				if (!components.TryGetValue(type, out var value))
				{
					bool? flag3 = _prefabInfoCtorParametersNullable[i];
					bool flag4;
					if (flag3.HasValue)
					{
						flag4 = flag3 == true;
					}
					else
					{
						_prefabInfoCtorParametersNullable[i] = (flag4 = IsNullable(parameterInfo, ref defaultNullable));
					}
					if (!flag4)
					{
						return null;
					}
					continue;
				}
				if (flag2)
				{
					array[i] = (methodInfo ?? (methodInfo = new Func<IReadOnlyList<MonoBehaviour>, IReadOnlyList<MonoBehaviour>>(CreateList<MonoBehaviour>).Method.GetGenericMethodDefinition())).MakeGenericMethod(type).Invoke(null, new object[1] { value });
				}
				else
				{
					array[i] = value[0];
					if (value.Count != 1)
					{
						(list ?? (list = new List<Type>())).Add(type);
					}
				}
				flag = true;
			}
			if (!flag)
			{
				return null;
			}
			if (list != null)
			{
				base.Logger.LogWarning(typeof(TPrefabInfo).FullName + " has the following property types which are not lists but have multiple components in the prefab: " + string.Join(", ", list.Select((Type x) => x.FullName)) + ". Only the first component will be used.");
			}
			return (TPrefabInfo)_prefabInfoCtor.Invoke(array);
			static IReadOnlyList<T> CreateList<T>(IReadOnlyList<MonoBehaviour> source) where T : notnull, MonoBehaviour
			{
				List<T> list2 = new List<T>();
				list2.AddRange(source.Cast<T>());
				return new <>z__ReadOnlyList<T>(list2);
			}
		}

		private bool IsNullable(ParameterInfo par, ref bool? defaultNullable)
		{
			CustomAttributeData customAttributeData = par.CustomAttributes.FirstOrDefault((CustomAttributeData x) => x.AttributeType.FullName == "System.Runtime.CompilerServices.NullableAttribute");
			if (customAttributeData != null)
			{
				return (byte)customAttributeData.ConstructorArguments[0].Value == 2;
			}
			bool? flag = defaultNullable;
			if (!flag.HasValue)
			{
				CustomAttributeData customAttributeData2 = _prefabInfoCtor.CustomAttributes.FirstOrDefault((CustomAttributeData x) => x.AttributeType.FullName == "System.Runtime.CompilerServices.NullableContextAttribute") ?? _prefabInfoCtor.DeclaringType.CustomAttributes.FirstOrDefault((CustomAttributeData x) => x.AttributeType.FullName == "System.Runtime.CompilerServices.NullableContextAttribute") ?? _prefabInfoCtor.DeclaringType.Assembly.CustomAttributes.FirstOrDefault((CustomAttributeData x) => x.AttributeType.FullName == "System.Runtime.CompilerServices.NullableContextAttribute");
				if (customAttributeData2 == null)
				{
					defaultNullable = false;
				}
				else
				{
					defaultNullable = (byte)customAttributeData2.ConstructorArguments[0].Value == 2;
				}
			}
			return defaultNullable.Value;
		}

		private protected override void ValidateProcessor()
		{
			if ((object)_prefabInfoCtor == null)
			{
				throw new ArgumentException("Cannot use " + GetType().FullName + " with " + typeof(TPrefabInfo).FullName + ": type must have exactly one constructor.");
			}
			ParameterInfo[] prefabInfoCtorParameters = _prefabInfoCtorParameters;
			foreach (ParameterInfo parameterInfo in prefabInfoCtorParameters)
			{
				if (!parameterInfo.ParameterType.IsSubclassOf(typeof(MonoBehaviour)))
				{
					throw new ArgumentException("Cannot use " + GetType().FullName + " with " + typeof(TPrefabInfo).FullName + ": constructor parameter '" + parameterInfo.Name + "' is not a MonoBehaviour.");
				}
			}
		}

		private protected sealed override ProcessResult Process(IReadOnlyList<Peer> peers, ServersideQoLZDO zdo)
		{
			ProcessResult processResult = ProcessResult.Default;
			PrefabInfo? prefabInfo = zdo.PrefabInfo;
			TPrefabInfo val = ((prefabInfo != null) ? prefabInfo.GetExtension<IProcessorPrefabInfo<TPrefabInfo>>().PrefabInfo : null);
			if ((object)val == null)
			{
				return processResult | ProcessResult.UnregisterProcessor;
			}
			return processResult | Process(zdo, peers, val);
		}

		protected abstract ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, TPrefabInfo prefabInfo);
	}
	public static class RPC
	{
		public readonly struct RpcName
		{
			public static class MessageHud
			{
				public static RpcName ShowMessage { get; } = new RpcName("ShowMessage");
			}

			public static class Player
			{
				public static RpcName UseStamina { get; } = new RpcName("UseStamina");

				public static RpcName TeleportTo { get; } = new RpcName("RPC_TeleportTo");

				public static RpcName OnDeath { get; } = new RpcName("OnDeath");
			}

			public static class ZoneSystem
			{
				public static RpcName GlobalKeys { get; } = new RpcName("GlobalKeys");
			}

			public static class Game
			{
				public static RpcName DiscoverLocationResponse { get; } = new RpcName("RPC_DiscoverLocationResponse");
			}

			public static class DamageText
			{
				public static RpcName RPC_DamageText { get; } = new RpcName("RPC_DamageText");
			}

			public static class Chat
			{
				public static RpcName TeleportPlayer { get; } = new RpcName("RPC_TeleportPlayer");
			}

			public static class Piece
			{
				public static RpcName Remove { get; } = new RpcName("RPC_Remove");
			}

			public static class Character
			{
				public static RpcName AddStatusEffect { get; } = new RpcName("RPC_AddStatusEffect");

				public static RpcName SetTamed { get; } = new RpcName("RPC_SetTamed");

				public static RpcName Damage { get; } = new RpcName("RPC_Damage");
			}

			public static class Container
			{
				public static RpcName RequestStack { get; } = new RpcName("RPC_RequestStack");

				public static RpcName StackResponse { get; } = new RpcName("RPC_StackResponse");

				public static RpcName TakeAllResponse { get; } = new RpcName("RPC_TakeAllResponse");

				public static RpcName RequestOpen { get; } = new RpcName("RPC_RequestOpen");

				public static RpcName OpenResponse { get; } = new RpcName("RPC_OpenResponse");
			}

			public static class Trap
			{
				public static RpcName RequestStateChange { get; } = new RpcName("RPC_RequestStateChange");

				public static RpcName OnStateChanged { get; } = new RpcName("RPC_OnStateChanged");
			}

			public static class ItemDrop
			{
				public static RpcName RequestOwn { get; } = new RpcName("RPC_RequestOwn");
			}

			public static class MineRock5
			{
				public static RpcName Damage { get; } = new RpcName("RPC_Damage");
			}

			public static class ZSyncAnimation
			{
				public static RpcName SetTrigger { get; } = new RpcName("SetTrigger");
			}

			public static class Incinerator
			{
				public static RpcName AnimateLever { get; } = new RpcName("RPC_AnimateLever");
			}

			public static class TeleportWorld
			{
				public static RpcName SetTag { get; } = new RpcName("RPC_SetTag");
			}

			public static class ZNetScene
			{
				public static RpcName SpawnObject { get; } = new RpcName("RPC_SpawnObject");
			}

			private readonly string _name;

			private RpcName(string name)
			{
				_name = name;
			}

			public override string ToString()
			{
				return _name;
			}
		}

		public static class Intercept
		{
			private sealed class RpcDelegate
			{
				public Delegate Delegate { get; }

				public ParameterInfo[] Parameters { get; }

				public int DataParameterIndex { get; }

				public int ZdoParameterIndex { get; }

				public RpcDelegate(Delegate del)
				{
					Delegate = del;
					Parameters = del.Method.GetParameters();
					List<Type> list = Parameters.Select((ParameterInfo x) => x.ParameterType).ToList();
					DataParameterIndex = list.IndexOf(typeof(RoutedRPCData));
					ZdoParameterIndex = list.IndexOf(typeof(ServersideQoLZDO));
				}
			}

			private sealed record RpcMethod(string Name, List<RpcDelegate> Delegates);

			private static List<object?> __args = new List<object>();

			private static readonly Dictionary<int, object?[]> __argArrays = new Dictionary<int, object[]>();

			private static int __loopCounter;

			private static readonly Dictionary<int, RpcMethod> __methods = new Dictionary<int, RpcMethod>();

			private static readonly MethodInfo __handleRoutedRPCMethod = typeof(ZRoutedRpc).GetMethod("HandleRoutedRPC", BindingFlags.Instance | BindingFlags.NonPublic);

			private static readonly MethodInfo __handleRoutedRPCPrefix = new Func<RoutedRPCData, bool>(HandleRoutedRPCPrefix).Method;

			private static bool HandleRoutedRPCPrefix(RoutedRPCData data)
			{
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				if (__methods.TryGetValue(data.m_methodHash, out RpcMethod value))
				{
					ServersideQoLZDO serversideQoLZDO = null;
					for (int i = 0; i < value.Delegates.Count; i++)
					{
						RpcDelegate rpcDelegate = value.Delegates[i];
						try
						{
							__args.Clear();
							ZRpc.Deserialize(rpcDelegate.Parameters, data.m_parameters, ref __args);
							data.m_parameters.SetPos(0);
							if (rpcDelegate.DataParameterIndex < rpcDelegate.ZdoParameterIndex)
							{
								if (rpcDelegate.DataParameterIndex > -1)
								{
									__args.Insert(rpcDelegate.DataParameterIndex, data);
								}
								if (rpcDelegate.ZdoParameterIndex > -1)
								{
									__args.Insert(rpcDelegate.ZdoParameterIndex, serversideQoLZDO ?? (serversideQoLZDO = ZDOMan.instance.GetZDO(data.m_targetZDO).ServersideQoLZDO));
								}
							}
							else
							{
								if (rpcDelegate.ZdoParameterIndex > -1)
								{
									__args.Insert(rpcDelegate.ZdoParameterIndex, serversideQoLZD