Decompiled source of ArtifactOfDoom v2.0.6

ArtifactOfDoom.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text;
using ArtifactOfDoom;
using ArtifactOfDoomTinyJson;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Stats;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: AssemblyTitle("ArtifactOfDoom")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("ArtifactOfDoom")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyProduct("ArtifactOfDoom")]
[assembly: AssemblyVersion("1.0.0.0")]
public class NetworkClass
{
	internal static GameObject CentralNetworkObject;

	internal static GameObject _centralNetworkObjectSpawned;

	public NetworkClass()
	{
		SetupConfig();
	}

	public void SetupConfig()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		GameObject val = new GameObject("ArtifactOfDoomNetworkingPrefab");
		val.AddComponent<NetworkIdentity>();
		CentralNetworkObject = PrefabAPI.InstantiateClone(val, "ArtifactOfDoomNetworking", true);
		CentralNetworkObject.AddComponent<Networking>();
	}

	internal static void EnsureNetworking()
	{
		if (!Object.op_Implicit((Object)(object)_centralNetworkObjectSpawned))
		{
			_centralNetworkObjectSpawned = Object.Instantiate<GameObject>(CentralNetworkObject);
			NetworkServer.Spawn(_centralNetworkObjectSpawned);
		}
	}
}
public class Networking : NetworkBehaviour
{
	public static Networking _instance;

	[SyncVar]
	public bool IsArtifactEnabled = false;

	[SyncVar]
	public bool IsCalculationSacrifice = false;

	internal static readonly List<NetworkConnection> checkedConnections;

	private static int kTargetRpcTargetUpdateProgressBar;

	private static int kTargetRpcTargetAddGainedItemsToPlayers;

	private static int kTargetRpcTargetAddLostItemsOfPlayers;

	public bool NetworkIsArtifactEnabled
	{
		get
		{
			return IsArtifactEnabled;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<bool>(value, ref IsArtifactEnabled, 1u);
		}
	}

	public bool NetworkIsCalculationSacrifice
	{
		get
		{
			return IsCalculationSacrifice;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<bool>(value, ref IsCalculationSacrifice, 2u);
		}
	}

	private void Awake()
	{
		_instance = this;
	}

	public static void ServerEnsureNetworking()
	{
		NetworkClass.EnsureNetworking();
	}

	[TargetRpc]
	public void TargetUpdateProgressBar(NetworkConnection target, string killedNeededEnemies)
	{
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		NetworkClass.EnsureNetworking();
		if (killedNeededEnemies == null)
		{
			Debug.LogError((object)"killedNeededEnemies == null");
		}
		if (ArtifactOfDoomConfig.disableItemProgressBar.Value || _instance.IsCalculationSacrifice)
		{
			return;
		}
		string[] array = killedNeededEnemies.Split(new char[1] { ',' });
		if (array == null)
		{
			Debug.LogError((object)"stringkilledneededEnemies=null");
		}
		int num = Convert.ToInt32(array[0]);
		int num2 = Convert.ToInt32(array[1]) + 2;
		double num3 = (double)num / (double)num2;
		if (0.35f + (float)(num3 * 0.3) > 0.65f)
		{
			_ = ArtifactOfDoomUI.itemGainBar.GetComponent<RectTransform>().anchorMax;
			if (false)
			{
				Debug.LogError((object)"itemGainBar.GetComponent<RectTransform>().anchorMax==null");
			}
			ArtifactOfDoomUI.itemGainBar.GetComponent<RectTransform>().anchorMax = new Vector2(0.65f, 0.06f);
		}
		else
		{
			ArtifactOfDoomUI.itemGainBar.GetComponent<RectTransform>().anchorMin = new Vector2(0.35f, 0.05f);
			ArtifactOfDoomUI.itemGainBar.GetComponent<RectTransform>().anchorMax = new Vector2(0.35f + (float)(num3 * 0.3), 0.06f);
		}
	}

	[TargetRpc]
	public void TargetAddGainedItemsToPlayers(NetworkConnection target, string QueueGainedItemSpriteToString)
	{
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		NetworkClass.EnsureNetworking();
		if (ArtifactOfDoomConfig.disableSideBars.Value)
		{
			return;
		}
		string[] array = QueueGainedItemSpriteToString.Split(new char[1] { ' ' });
		int num = 0;
		string[] array2 = array;
		foreach (string text in array2)
		{
			if (text != "")
			{
				if (ArtifactOfDoomUI.listGainedImages.Count <= num)
				{
					break;
				}
				if ((Object)(object)ArtifactOfDoomUI.listGainedImages[num].GetComponent<Image>() == (Object)null)
				{
					ArtifactOfDoomUI.listGainedImages[num].AddComponent<Image>();
				}
				ArtifactOfDoomUI.listGainedImages[num].GetComponent<Image>().sprite = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(text)).pickupIconSprite;
				num++;
			}
		}
	}

	[TargetRpc]
	public void TargetAddLostItemsOfPlayers(NetworkConnection target, string QueueLostItemSpriteToString)
	{
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		if (ArtifactOfDoomConfig.disableSideBars.Value)
		{
			return;
		}
		string[] array = QueueLostItemSpriteToString.Split(new char[1] { ' ' });
		int num = 0;
		string[] array2 = array;
		foreach (string text in array2)
		{
			if (text != "")
			{
				if ((Object)(object)ArtifactOfDoomUI.listLostImages[num].GetComponent<Image>() == (Object)null)
				{
					ArtifactOfDoomUI.listLostImages[num].AddComponent<Image>();
				}
				ArtifactOfDoomUI.listLostImages[num].GetComponent<Image>().sprite = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(text)).pickupIconSprite;
				num++;
			}
		}
	}

	static Networking()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		checkedConnections = new List<NetworkConnection>();
		kTargetRpcTargetUpdateProgressBar = 1238139520;
		NetworkBehaviour.RegisterRpcDelegate(typeof(Networking), kTargetRpcTargetUpdateProgressBar, new CmdDelegate(InvokeRpcTargetUpdateProgressBar));
		kTargetRpcTargetAddGainedItemsToPlayers = 691277625;
		NetworkBehaviour.RegisterRpcDelegate(typeof(Networking), kTargetRpcTargetAddGainedItemsToPlayers, new CmdDelegate(InvokeRpcTargetAddGainedItemsToPlayers));
		kTargetRpcTargetAddLostItemsOfPlayers = -678159965;
		NetworkBehaviour.RegisterRpcDelegate(typeof(Networking), kTargetRpcTargetAddLostItemsOfPlayers, new CmdDelegate(InvokeRpcTargetAddLostItemsOfPlayers));
		NetworkCRC.RegisterBehaviour("Networking", 0);
	}

	private void UNetVersion()
	{
	}

	protected static void InvokeRpcTargetUpdateProgressBar(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"TargetRPC TargetUpdateProgressBar called on server.");
		}
		else
		{
			((Networking)(object)obj).TargetUpdateProgressBar(ClientScene.readyConnection, reader.ReadString());
		}
	}

	protected static void InvokeRpcTargetAddGainedItemsToPlayers(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"TargetRPC TargetAddGainedItemsToPlayers called on server.");
		}
		else
		{
			((Networking)(object)obj).TargetAddGainedItemsToPlayers(ClientScene.readyConnection, reader.ReadString());
		}
	}

	protected static void InvokeRpcTargetAddLostItemsOfPlayers(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"TargetRPC TargetAddLostItemsOfPlayers called on server.");
		}
		else
		{
			((Networking)(object)obj).TargetAddLostItemsOfPlayers(ClientScene.readyConnection, reader.ReadString());
		}
	}

	public void CallTargetUpdateProgressBar(NetworkConnection target, string killedNeededEnemies)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"TargetRPC Function TargetUpdateProgressBar called on client.");
			return;
		}
		if (target is ULocalConnectionToServer)
		{
			Debug.LogError((object)"TargetRPC Function TargetUpdateProgressBar called on connection to server");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kTargetRpcTargetUpdateProgressBar);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(killedNeededEnemies);
		((NetworkBehaviour)this).SendTargetRPCInternal(target, val, 0, "TargetUpdateProgressBar");
	}

	public void CallTargetAddGainedItemsToPlayers(NetworkConnection target, string QueueGainedItemSpriteToString)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"TargetRPC Function TargetAddGainedItemsToPlayers called on client.");
			return;
		}
		if (target is ULocalConnectionToServer)
		{
			Debug.LogError((object)"TargetRPC Function TargetAddGainedItemsToPlayers called on connection to server");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kTargetRpcTargetAddGainedItemsToPlayers);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(QueueGainedItemSpriteToString);
		((NetworkBehaviour)this).SendTargetRPCInternal(target, val, 0, "TargetAddGainedItemsToPlayers");
	}

	public void CallTargetAddLostItemsOfPlayers(NetworkConnection target, string QueueLostItemSpriteToString)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"TargetRPC Function TargetAddLostItemsOfPlayers called on client.");
			return;
		}
		if (target is ULocalConnectionToServer)
		{
			Debug.LogError((object)"TargetRPC Function TargetAddLostItemsOfPlayers called on connection to server");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kTargetRpcTargetAddLostItemsOfPlayers);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(QueueLostItemSpriteToString);
		((NetworkBehaviour)this).SendTargetRPCInternal(target, val, 0, "TargetAddLostItemsOfPlayers");
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		if (forceAll)
		{
			writer.Write(IsArtifactEnabled);
			writer.Write(IsCalculationSacrifice);
			return true;
		}
		bool flag = false;
		if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(IsArtifactEnabled);
		}
		if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(IsCalculationSacrifice);
		}
		if (!flag)
		{
			writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
		}
		return flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		if (initialState)
		{
			IsArtifactEnabled = reader.ReadBoolean();
			IsCalculationSacrifice = reader.ReadBoolean();
			return;
		}
		int num = (int)reader.ReadPackedUInt32();
		if (((uint)num & (true ? 1u : 0u)) != 0)
		{
			IsArtifactEnabled = reader.ReadBoolean();
		}
		if (((uint)num & 2u) != 0)
		{
			IsCalculationSacrifice = reader.ReadBoolean();
		}
	}
}
namespace ArtifactOfDoomTinyJson
{
	public static class JSONParser
	{
		[ThreadStatic]
		private static Stack<List<string>> splitArrayPool;

		[ThreadStatic]
		private static StringBuilder stringBuilder;

		[ThreadStatic]
		private static Dictionary<Type, Dictionary<string, FieldInfo>> fieldInfoCache;

		[ThreadStatic]
		private static Dictionary<Type, Dictionary<string, PropertyInfo>> propertyInfoCache;

		public static T FromJson<T>(this string json)
		{
			if (propertyInfoCache == null)
			{
				propertyInfoCache = new Dictionary<Type, Dictionary<string, PropertyInfo>>();
			}
			if (fieldInfoCache == null)
			{
				fieldInfoCache = new Dictionary<Type, Dictionary<string, FieldInfo>>();
			}
			if (stringBuilder == null)
			{
				stringBuilder = new StringBuilder();
			}
			if (splitArrayPool == null)
			{
				splitArrayPool = new Stack<List<string>>();
			}
			stringBuilder.Length = 0;
			for (int i = 0; i < json.Length; i++)
			{
				char c = json[i];
				if (c == '"')
				{
					i = AppendUntilStringEnd(appendEscapeCharacter: true, i, json);
				}
				else if (!char.IsWhiteSpace(c))
				{
					stringBuilder.Append(c);
				}
			}
			return (T)ParseValue(typeof(T), stringBuilder.ToString());
		}

		private static int AppendUntilStringEnd(bool appendEscapeCharacter, int startIdx, string json)
		{
			stringBuilder.Append(json[startIdx]);
			for (int i = startIdx + 1; i < json.Length; i++)
			{
				if (json[i] == '\\')
				{
					if (appendEscapeCharacter)
					{
						stringBuilder.Append(json[i]);
					}
					stringBuilder.Append(json[i + 1]);
					i++;
				}
				else
				{
					if (json[i] == '"')
					{
						stringBuilder.Append(json[i]);
						return i;
					}
					stringBuilder.Append(json[i]);
				}
			}
			return json.Length - 1;
		}

		private static List<string> Split(string json)
		{
			List<string> list = ((splitArrayPool.Count > 0) ? splitArrayPool.Pop() : new List<string>());
			list.Clear();
			if (json.Length == 2)
			{
				return list;
			}
			int num = 0;
			stringBuilder.Length = 0;
			for (int i = 1; i < json.Length - 1; i++)
			{
				switch (json[i])
				{
				case '[':
				case '{':
					num++;
					break;
				case ']':
				case '}':
					num--;
					break;
				case '"':
					i = AppendUntilStringEnd(appendEscapeCharacter: true, i, json);
					continue;
				case ',':
				case ':':
					if (num == 0)
					{
						list.Add(stringBuilder.ToString());
						stringBuilder.Length = 0;
						continue;
					}
					break;
				}
				stringBuilder.Append(json[i]);
			}
			list.Add(stringBuilder.ToString());
			return list;
		}

		internal static object ParseValue(Type type, string json)
		{
			if (type == typeof(string))
			{
				if (json.Length <= 2)
				{
					return string.Empty;
				}
				StringBuilder stringBuilder = new StringBuilder(json.Length);
				for (int i = 1; i < json.Length - 1; i++)
				{
					if (json[i] == '\\' && i + 1 < json.Length - 1)
					{
						int num = "\"\\nrtbf/".IndexOf(json[i + 1]);
						if (num >= 0)
						{
							stringBuilder.Append("\"\\\n\r\t\b\f/"[num]);
							i++;
							continue;
						}
						if (json[i + 1] == 'u' && i + 5 < json.Length - 1)
						{
							uint result = 0u;
							if (uint.TryParse(json.Substring(i + 2, 4), NumberStyles.AllowHexSpecifier, null, out result))
							{
								stringBuilder.Append((char)result);
								i += 5;
								continue;
							}
						}
					}
					stringBuilder.Append(json[i]);
				}
				return stringBuilder.ToString();
			}
			if (type.IsPrimitive)
			{
				return Convert.ChangeType(json, type, CultureInfo.InvariantCulture);
			}
			if (type == typeof(decimal))
			{
				decimal.TryParse(json, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2);
				return result2;
			}
			if (json == "null")
			{
				return null;
			}
			if (type.IsEnum)
			{
				if (json[0] == '"')
				{
					json = json.Substring(1, json.Length - 2);
				}
				try
				{
					return Enum.Parse(type, json, ignoreCase: false);
				}
				catch
				{
					return 0;
				}
			}
			if (type.IsArray)
			{
				Type elementType = type.GetElementType();
				if (json[0] != '[' || json[json.Length - 1] != ']')
				{
					return null;
				}
				List<string> list = Split(json);
				Array array = Array.CreateInstance(elementType, list.Count);
				for (int j = 0; j < list.Count; j++)
				{
					array.SetValue(ParseValue(elementType, list[j]), j);
				}
				splitArrayPool.Push(list);
				return array;
			}
			if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>))
			{
				Type type2 = type.GetGenericArguments()[0];
				if (json[0] != '[' || json[json.Length - 1] != ']')
				{
					return null;
				}
				List<string> list2 = Split(json);
				IList list3 = (IList)type.GetConstructor(new Type[1] { typeof(int) }).Invoke(new object[1] { list2.Count });
				for (int k = 0; k < list2.Count; k++)
				{
					list3.Add(ParseValue(type2, list2[k]));
				}
				splitArrayPool.Push(list2);
				return list3;
			}
			if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<, >))
			{
				Type[] genericArguments = type.GetGenericArguments();
				Type type3 = genericArguments[0];
				Type type4 = genericArguments[1];
				if (type3 != typeof(string))
				{
					return null;
				}
				if (json[0] != '{' || json[json.Length - 1] != '}')
				{
					return null;
				}
				List<string> list4 = Split(json);
				if (list4.Count % 2 != 0)
				{
					return null;
				}
				IDictionary dictionary = (IDictionary)type.GetConstructor(new Type[1] { typeof(int) }).Invoke(new object[1] { list4.Count / 2 });
				for (int l = 0; l < list4.Count; l += 2)
				{
					if (list4[l].Length > 2)
					{
						string key = list4[l].Substring(1, list4[l].Length - 2);
						object value = ParseValue(type4, list4[l + 1]);
						dictionary.Add(key, value);
					}
				}
				return dictionary;
			}
			if (type == typeof(object))
			{
				return ParseAnonymousValue(json);
			}
			if (json[0] == '{' && json[json.Length - 1] == '}')
			{
				return ParseObject(type, json);
			}
			return null;
		}

		private static object ParseAnonymousValue(string json)
		{
			if (json.Length == 0)
			{
				return null;
			}
			if (json[0] == '{' && json[json.Length - 1] == '}')
			{
				List<string> list = Split(json);
				if (list.Count % 2 != 0)
				{
					return null;
				}
				Dictionary<string, object> dictionary = new Dictionary<string, object>(list.Count / 2);
				for (int i = 0; i < list.Count; i += 2)
				{
					dictionary.Add(list[i].Substring(1, list[i].Length - 2), ParseAnonymousValue(list[i + 1]));
				}
				return dictionary;
			}
			if (json[0] == '[' && json[json.Length - 1] == ']')
			{
				List<string> list2 = Split(json);
				List<object> list3 = new List<object>(list2.Count);
				for (int j = 0; j < list2.Count; j++)
				{
					list3.Add(ParseAnonymousValue(list2[j]));
				}
				return list3;
			}
			if (json[0] == '"' && json[json.Length - 1] == '"')
			{
				string text = json.Substring(1, json.Length - 2);
				return text.Replace("\\", string.Empty);
			}
			if (char.IsDigit(json[0]) || json[0] == '-')
			{
				if (json.Contains("."))
				{
					double.TryParse(json, NumberStyles.Float, CultureInfo.InvariantCulture, out var result);
					return result;
				}
				int.TryParse(json, out var result2);
				return result2;
			}
			if (json == "true")
			{
				return true;
			}
			if (json == "false")
			{
				return false;
			}
			return null;
		}

		private static Dictionary<string, T> CreateMemberNameDictionary<T>(T[] members) where T : MemberInfo
		{
			Dictionary<string, T> dictionary = new Dictionary<string, T>(StringComparer.OrdinalIgnoreCase);
			foreach (T val in members)
			{
				if (val.IsDefined(typeof(IgnoreDataMemberAttribute), inherit: true))
				{
					continue;
				}
				string name = val.Name;
				if (val.IsDefined(typeof(DataMemberAttribute), inherit: true))
				{
					DataMemberAttribute dataMemberAttribute = (DataMemberAttribute)Attribute.GetCustomAttribute(val, typeof(DataMemberAttribute), inherit: true);
					if (!string.IsNullOrEmpty(dataMemberAttribute.Name))
					{
						name = dataMemberAttribute.Name;
					}
				}
				dictionary.Add(name, val);
			}
			return dictionary;
		}

		private static object ParseObject(Type type, string json)
		{
			object uninitializedObject = FormatterServices.GetUninitializedObject(type);
			List<string> list = Split(json);
			if (list.Count % 2 != 0)
			{
				return uninitializedObject;
			}
			if (!fieldInfoCache.TryGetValue(type, out var value))
			{
				value = CreateMemberNameDictionary(type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy));
				fieldInfoCache.Add(type, value);
			}
			if (!propertyInfoCache.TryGetValue(type, out var value2))
			{
				value2 = CreateMemberNameDictionary(type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy));
				propertyInfoCache.Add(type, value2);
			}
			for (int i = 0; i < list.Count; i += 2)
			{
				if (list[i].Length > 2)
				{
					string key = list[i].Substring(1, list[i].Length - 2);
					string json2 = list[i + 1];
					PropertyInfo value4;
					if (value.TryGetValue(key, out var value3))
					{
						value3.SetValue(uninitializedObject, ParseValue(value3.FieldType, json2));
					}
					else if (value2.TryGetValue(key, out value4))
					{
						value4.SetValue(uninitializedObject, ParseValue(value4.PropertyType, json2), null);
					}
				}
			}
			return uninitializedObject;
		}
	}
}
namespace ArtifactOfDoom
{
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "ArtifactCodeAPI" })]
	[BepInPlugin("com.SirHamburger.ArtifactOfDoom", "ArtifactOfDoom", "2.0.6")]
	public class ArtifactOfDoomConfig : BaseUnityPlugin
	{
		public const string ModVer = "2.0.6";

		public const string ModName = "ArtifactOfDoom";

		public const string ModGuid = "com.SirHamburger.ArtifactOfDoom";

		public static BuffDef ArtifactOfDoomBuff = ScriptableObject.CreateInstance<BuffDef>();

		public static GameObject GameObjectReference;

		private static ConfigFile cfgFile;

		internal static ManualLogSource _logger;

		public static ConfigEntry<int> averageItemsPerStage;

		public static ConfigEntry<int> minItemsPerStage;

		public static ConfigEntry<int> maxItemsPerStage;

		public static ConfigEntry<double> exponentailFactorIfYouAreUnderAverageItemsPerStage;

		public static ConfigEntry<double> exponentailFactorToCalculateSumOfLostItems;

		public static ConfigEntry<bool> artifactOfSwarmNerf;

		public static ConfigEntry<string> CustomChars;

		public static ConfigEntry<bool> useArtifactOfSacrificeCalculation;

		public static ConfigEntry<double> multiplayerForArtifactOfSacrificeDropRate;

		public static ConfigEntry<bool> disableItemProgressBar;

		public static ConfigEntry<double> timeAfterHitToNotLoseItemMonsoon;

		public static ConfigEntry<double> timeAfterHitToNotLoseItemDrizzly;

		public static ConfigEntry<double> timeAfterHitToNotLoseItemRainstorm;

		public static ConfigEntry<string> timeAfterHitToNotLoseItemOtherDifficulty;

		public static ConfigEntry<double> CommandoBonusItems;

		public static ConfigEntry<double> CommandoMultiplierForTimedBuff;

		public static ConfigEntry<double> HuntressBonusItems;

		public static ConfigEntry<double> HuntressMultiplierForTimedBuff;

		public static ConfigEntry<double> MULTBonusItems;

		public static ConfigEntry<double> MULTMultiplierForTimedBuff;

		public static ConfigEntry<double> EngineerBonusItems;

		public static ConfigEntry<double> EngineerMultiplierForTimedBuff;

		public static ConfigEntry<double> ArtificerBonusItems;

		public static ConfigEntry<double> ArtificerMultiplierForTimedBuff;

		public static ConfigEntry<double> MercenaryBonusItems;

		public static ConfigEntry<double> MercenaryMultiplierForTimedBuff;

		public static ConfigEntry<double> RexBonusItems;

		public static ConfigEntry<double> RexMultiplierForTimedBuff;

		public static ConfigEntry<double> LoaderBonusItems;

		public static ConfigEntry<double> LoaderMultiplierForTimedBuff;

		public static ConfigEntry<double> AcridBonusItems;

		public static ConfigEntry<double> AcridMultiplierForTimedBuff;

		public static ConfigEntry<double> CaptainBonusItems;

		public static ConfigEntry<double> CaptainMultiplierForTimedBuff;

		public static ConfigEntry<double> BanditBonusItems;

		public static ConfigEntry<double> BanditMultiplierForTimedBuff;

		public static ConfigEntry<double> RailgunnerBonusItems;

		public static ConfigEntry<double> RailgunnerMultiplierForTimedBuff;

		public static ConfigEntry<double> VoidSurvivorBonusItems;

		public static ConfigEntry<double> VoidSurvivorMultiplierForTimedBuff;

		public static ConfigEntry<double> CustomSurvivorBonusItems;

		public static ConfigEntry<double> CustomSurvivorMultiplierForTimedBuff;

		public static ConfigEntry<double> sizeOfSideBars;

		public static ConfigEntry<bool> disableSideBars;

		public static ConfigEntry<bool> enableChatItemOutput;

		public static List<ArtifactDef> artifactDefs = new List<ArtifactDef>();

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0062: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_0091: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c0: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_00f7: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_012e: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_015d: Expected O, but got Unknown
			//IL_0171: 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_018c: Expected O, but got Unknown
			//IL_018c: Expected O, but got Unknown
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01c3: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Expected O, but got Unknown
			//IL_01f2: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Expected O, but got Unknown
			//IL_0221: Expected O, but got Unknown
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Expected O, but got Unknown
			//IL_0250: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Expected O, but got Unknown
			//IL_0287: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02be: Expected O, but got Unknown
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Expected O, but got Unknown
			//IL_02f5: Expected O, but got Unknown
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Expected O, but got Unknown
			//IL_032c: Expected O, but got Unknown
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Expected O, but got Unknown
			//IL_035f: Expected O, but got Unknown
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Expected O, but got Unknown
			//IL_0396: Expected O, but got Unknown
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Expected O, but got Unknown
			//IL_03cd: Expected O, but got Unknown
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Expected O, but got Unknown
			//IL_0404: Expected O, but got Unknown
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Expected O, but got Unknown
			//IL_043b: Expected O, but got Unknown
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Expected O, but got Unknown
			//IL_0472: Expected O, but got Unknown
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Expected O, but got Unknown
			//IL_04a9: Expected O, but got Unknown
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Expected O, but got Unknown
			//IL_04e0: Expected O, but got Unknown
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Expected O, but got Unknown
			//IL_0517: Expected O, but got Unknown
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Expected O, but got Unknown
			//IL_054e: Expected O, but got Unknown
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Expected O, but got Unknown
			//IL_0585: Expected O, but got Unknown
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Expected O, but got Unknown
			//IL_05bc: Expected O, but got Unknown
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Expected O, but got Unknown
			//IL_05f3: Expected O, but got Unknown
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Expected O, but got Unknown
			//IL_062a: Expected O, but got Unknown
			//IL_063e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Expected O, but got Unknown
			//IL_0661: Expected O, but got Unknown
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Expected O, but got Unknown
			//IL_0698: Expected O, but got Unknown
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cf: Expected O, but got Unknown
			//IL_06cf: Expected O, but got Unknown
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0706: Expected O, but got Unknown
			//IL_0706: Expected O, but got Unknown
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_073d: Expected O, but got Unknown
			//IL_073d: Expected O, but got Unknown
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0774: Expected O, but got Unknown
			//IL_0774: Expected O, but got Unknown
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Expected O, but got Unknown
			//IL_07ab: Expected O, but got Unknown
			//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e2: Expected O, but got Unknown
			//IL_07e2: Expected O, but got Unknown
			//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_080f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Expected O, but got Unknown
			//IL_0819: Expected O, but got Unknown
			//IL_082d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0846: Unknown result type (might be due to invalid IL or missing references)
			//IL_0850: Expected O, but got Unknown
			//IL_0850: Expected O, but got Unknown
			//IL_0864: Unknown result type (might be due to invalid IL or missing references)
			//IL_087d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0887: Expected O, but got Unknown
			//IL_0887: Expected O, but got Unknown
			//IL_089b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08be: Expected O, but got Unknown
			//IL_08be: Expected O, but got Unknown
			//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Expected O, but got Unknown
			//IL_08f5: Expected O, but got Unknown
			//IL_0909: Unknown result type (might be due to invalid IL or missing references)
			//IL_0922: Unknown result type (might be due to invalid IL or missing references)
			//IL_092c: Expected O, but got Unknown
			//IL_092c: Expected O, but got Unknown
			//IL_0940: Unknown result type (might be due to invalid IL or missing references)
			//IL_0959: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Expected O, but got Unknown
			//IL_0963: Expected O, but got Unknown
			//IL_0977: Unknown result type (might be due to invalid IL or missing references)
			//IL_098c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0996: Expected O, but got Unknown
			//IL_0996: Expected O, but got Unknown
			//IL_09b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
			_logger = ((BaseUnityPlugin)this).Logger;
			cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "com.SirHamburger.ArtifactOfDoom.cfg"), true);
			ArtifactOfDoomUI artifactOfDoomUI = new ArtifactOfDoomUI();
			ArtifactOfDoom artifactOfDoom = new ArtifactOfDoom();
			NetworkClass networkClass = new NetworkClass();
			averageItemsPerStage = cfgFile.Bind<int>(new ConfigDefinition("Gameplay Settings", "averageItemsPerStage"), 5, new ConfigDescription("Excpected items per stage. If below you may get more items if aboth you'll need more kills to get an item", (AcceptableValueBase)null, Array.Empty<object>()));
			minItemsPerStage = cfgFile.Bind<int>(new ConfigDefinition("Gameplay Settings", "minItemsPerStage"), 2, new ConfigDescription("The expected minimum item count per stage. If you have less Items than that you'll have a decreased chance that you lose items", (AcceptableValueBase)null, Array.Empty<object>()));
			maxItemsPerStage = cfgFile.Bind<int>(new ConfigDefinition("Gameplay Settings", "maxItemsPerStage"), 7, new ConfigDescription("The expected maximum item count per stage. If you have more Items than that you'll have a chance to lose more than one item per hit", (AcceptableValueBase)null, Array.Empty<object>()));
			exponentailFactorToCalculateSumOfLostItems = cfgFile.Bind<double>(new ConfigDefinition("Gameplay Settings", "exponentailFactorToCalculateSumOfLostItems"), 1.5, new ConfigDescription("The exponent to Calculate how many items you'll lose if you're over maxItemsPerStage", (AcceptableValueBase)null, Array.Empty<object>()));
			exponentailFactorIfYouAreUnderAverageItemsPerStage = cfgFile.Bind<double>(new ConfigDefinition("Gameplay Settings", "exponentailFactorIfYouAreUnderAverageItemsPerStage"), 0.0, new ConfigDescription("The exponent to Calculate how many kills you'll need if you're under averageItemsPerStage. The formula is totalitems^exponentailFactorIfYouAreUnderAverageItemsPerStage. Default is 0 so you'll need always two kills.", (AcceptableValueBase)null, Array.Empty<object>()));
			artifactOfSwarmNerf = cfgFile.Bind<bool>(new ConfigDefinition("Gameplay Settings", "artifactOfSwarmNerf"), false, new ConfigDescription("Enable the nerf for Artifact of Swarm where you've to kill double as many enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			useArtifactOfSacrificeCalculation = cfgFile.Bind<bool>(new ConfigDefinition("Gameplay Settings", "useArtifactOfSacreficeCalculation"), false, new ConfigDescription("Chance the item gain to a specific drop rate of enemys", (AcceptableValueBase)null, Array.Empty<object>()));
			multiplayerForArtifactOfSacrificeDropRate = cfgFile.Bind<double>(new ConfigDefinition("Gameplay Settings", "multiplayerForArtifactOfSacrificeDropRate"), 2.0, new ConfigDescription("Multiplier for the drop rate (base Chance is 5)", (AcceptableValueBase)null, Array.Empty<object>()));
			disableItemProgressBar = cfgFile.Bind<bool>(new ConfigDefinition("UI Settings", "disableItemProgressBar"), false, new ConfigDescription("If true it disables the Progress bar in the bottom of the UI", (AcceptableValueBase)null, Array.Empty<object>()));
			disableSideBars = cfgFile.Bind<bool>(new ConfigDefinition("UI Settings", "disableSideBars"), false, new ConfigDescription("Disables the item Sidebars", (AcceptableValueBase)null, Array.Empty<object>()));
			enableChatItemOutput = cfgFile.Bind<bool>(new ConfigDefinition("UI Settings", "enableChatItemOutput"), false, new ConfigDescription("Enables the chat output for gained/lost Items. This setting is not synced.", (AcceptableValueBase)null, Array.Empty<object>()));
			sizeOfSideBars = cfgFile.Bind<double>(new ConfigDefinition("UI Settings", "sizeOfSideBars"), 0.02, new ConfigDescription("Spezifies the size of the sidebars. 1 is whole window 0 is invisible (but for that plase use the disable setting).", (AcceptableValueBase)null, Array.Empty<object>()));
			timeAfterHitToNotLoseItemDrizzly = cfgFile.Bind<double>(new ConfigDefinition("Gameplay Settings", "timeAfterHitToNotLooseItemDrizzly"), 0.8, new ConfigDescription("The time in seconds where you will not lose items after you lost one on drizzly", (AcceptableValueBase)null, Array.Empty<object>()));
			timeAfterHitToNotLoseItemRainstorm = cfgFile.Bind<double>(new ConfigDefinition("Gameplay Settings", "timeAfterHitToNotLooseItemRainstorm"), 0.2, new ConfigDescription("The time in seconds where you will not lose items after you lost one on rainstorm", (AcceptableValueBase)null, Array.Empty<object>()));
			timeAfterHitToNotLoseItemMonsoon = cfgFile.Bind<double>(new ConfigDefinition("Gameplay Settings", "timeAfterHitToNotLooseItemMonsoon"), 0.05, new ConfigDescription("The time in seconds where you will not lose items after you lost one on monsoon", (AcceptableValueBase)null, Array.Empty<object>()));
			timeAfterHitToNotLoseItemOtherDifficulty = cfgFile.Bind<string>(new ConfigDefinition("Gameplay Settings", "timeAfterHitToNotLooseOtherDifficulty"), "[{\"DifficultyIndex\": \"DIFFICULTYINDEX\", \"time\": 1.0}]", new ConfigDescription("The time in seconds where you will not lose items after you lost one on monsoon", (AcceptableValueBase)null, Array.Empty<object>()));
			CommandoBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "CommandoBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			CommandoMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "commandoMultiplyerForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			HuntressBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "HuntressBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			HuntressMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "HuntressMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			MULTBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "MULTBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			MULTMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "MULTMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			EngineerBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "EngineerBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			EngineerMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "EngineerMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			ArtificerBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "ArtificerBonusItems"), 2.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			ArtificerMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "ArtificerMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			MercenaryBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "MercenaryBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			MercenaryMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "MercenaryMultiplierForTimedBuff"), 4.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			RexBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "RexBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			RexMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "RexMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			LoaderBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "LoaderBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			LoaderMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "LoaderMultiplierForTimedBuff"), 4.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			AcridBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "AcridBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			AcridMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "AcridMultiplierForTimedBuff"), 4.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			CaptainBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "CaptainBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			CaptainMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "BanditMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			BanditBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "BanditBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			BanditMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "BanditMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			RailgunnerBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "RailgunnerBonusItems"), 2.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			RailgunnerMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "RailgunnerMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			VoidSurvivorBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "VoidSurvivorBonusItems"), 2.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			VoidSurvivorMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "VoidSurvivorMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLooseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomSurvivorBonusItems = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "CustomSurvivorBonusItems"), 1.0, new ConfigDescription("The count of items which you get if you kill enough enemies", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomSurvivorMultiplierForTimedBuff = cfgFile.Bind<double>(new ConfigDefinition("Character specific settings", "CustomSurvivorMultiplierForTimedBuff"), 1.0, new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLoseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomChars = cfgFile.Bind<string>(new ConfigDefinition("Character specific settings", "CustomCharacters"), "[{\"Name\": \"CUSTOM_CHAR_BODY_NAME1\", \"MultiplierForTimedBuff\": 1.0, \"BonusItems\": 1.0},{\"Name\": \"CUSTOM_CHAR_BODY_NAME2\", \"MultiplierForTimedBuff\": 2.0, \"BonusItems\": 2.0}]", new ConfigDescription("The Multiplier for that specific character for the length of timeAfterHitToNotLoseItems", (AcceptableValueBase)null, Array.Empty<object>()));
			((Object)ArtifactOfDoomBuff).name = "ArtifactOfDoomDidLoseItem";
			ArtifactOfDoomBuff.buffColor = Color.black;
			ArtifactOfDoomBuff.canStack = false;
			ArtifactOfDoomBuff.isDebuff = false;
			ContentAddition.AddBuffDef(ArtifactOfDoomBuff);
		}
	}
	public class ArtifactOfDoom
	{
		public class Character
		{
			public string Name { get; set; }

			public float MultiplierForTimedBuff { get; set; }

			public float BonusItems { get; set; }
		}

		public class Difficulty
		{
			public int DifficultyIndex { get; set; }

			public float time { get; set; }
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Awake <>9__15_0;

			public static hook_StartRun <>9__15_1;

			public static hook_Awake <>9__15_3;

			public static hook_Start <>9__15_4;

			internal void <LoadBehavior>b__15_0(orig_Awake orig, GameEndReportPanelController self)
			{
				orig.Invoke(self);
				if (Networking._instance.IsArtifactEnabled)
				{
					string[] array = new string[self.statsToDisplay.Length + 2];
					self.statsToDisplay.CopyTo(array, 0);
					array[^2] = "Lostitems";
					array[^1] = "Gainitems";
					self.statsToDisplay = array;
				}
			}

			internal void <LoadBehavior>b__15_1(orig_StartRun orig, PreGameController self)
			{
				orig.Invoke(self);
			}

			internal void <LoadBehavior>b__15_3(orig_Awake orig, Run self)
			{
				orig.Invoke(self);
			}

			internal void <LoadBehavior>b__15_4(orig_Start orig, Run self)
			{
				orig.Invoke(self);
			}
		}

		public static ArtifactDef Transmutation = ScriptableObject.CreateInstance<ArtifactDef>();

		private const string GrayColor = "7e91af";

		private const string ErrorColor = "ff0000";

		public static bool debug = false;

		private static List<CharacterBody> Playername = new List<CharacterBody>();

		private static List<int> counter = new List<int>();

		private int currentStage = 0;

		private Dictionary<NetworkUser, bool> LockNetworkUser = new Dictionary<NetworkUser, bool>();

		private Dictionary<NetworkUser, bool> LockItemGainNetworkUser = new Dictionary<NetworkUser, bool>();

		private static StatDef statsLostItems;

		private static StatDef statsGainItems;

		public static Dictionary<uint, Queue<ItemDef>> QueueLostItemSprite = new Dictionary<uint, Queue<ItemDef>>();

		public static Dictionary<uint, Queue<ItemDef>> QueueGainedItemSprite = new Dictionary<uint, Queue<ItemDef>>();

		private static double timeForBuff = -1.0;

		public ArtifactOfDoom()
		{
			Transmutation.nameToken = "Artifact of Doom";
			Transmutation.descriptionToken = "You get items on enemy kills but lose items every time you take damage.";
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArtifactOfDoom.artifactofdoom"))
			{
				AssetBundle val = AssetBundle.LoadFromStream(stream);
				Transmutation.smallIconSelectedSprite = val.LoadAsset<Sprite>("Assets/Import/artifactofdoom_icon/ArtifactDoomEnabled.png");
				Transmutation.smallIconDeselectedSprite = val.LoadAsset<Sprite>("Assets/Import/artifactofdoom_icon/ArtifactDoomDisabled.png");
				ContentAddition.AddArtifactDef(Transmutation);
			}
			LoadBehavior();
		}

		protected void LoadBehavior()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			Playername = new List<CharacterBody>();
			counter = new List<int>();
			currentStage = 0;
			statsLostItems = null;
			statsGainItems = null;
			statsLostItems = StatDef.Register("Lostitems", (StatRecordType)0, (StatDataType)0, 0.0, (DisplayValueFormatterDelegate)null);
			statsGainItems = StatDef.Register("Gainitems", (StatRecordType)0, (StatDataType)0, 0.0, (DisplayValueFormatterDelegate)null);
			object obj = <>c.<>9__15_0;
			if (obj == null)
			{
				hook_Awake val = delegate(orig_Awake orig, GameEndReportPanelController self)
				{
					orig.Invoke(self);
					if (Networking._instance.IsArtifactEnabled)
					{
						string[] array = new string[self.statsToDisplay.Length + 2];
						self.statsToDisplay.CopyTo(array, 0);
						array[^2] = "Lostitems";
						array[^1] = "Gainitems";
						self.statsToDisplay = array;
					}
				};
				<>c.<>9__15_0 = val;
				obj = (object)val;
			}
			GameEndReportPanelController.Awake += (hook_Awake)obj;
			object obj2 = <>c.<>9__15_1;
			if (obj2 == null)
			{
				hook_StartRun val2 = delegate(orig_StartRun orig, PreGameController self)
				{
					orig.Invoke(self);
				};
				<>c.<>9__15_1 = val2;
				obj2 = (object)val2;
			}
			PreGameController.StartRun += (hook_StartRun)obj2;
			SceneDirector.PopulateScene += (hook_PopulateScene)delegate(orig_PopulateScene orig, SceneDirector self)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Invalid comparison between Unknown and I4
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Invalid comparison between Unknown and I4
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Invalid comparison between Unknown and I4
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Invalid comparison between Unknown and I4
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				currentStage = Run.instance.stageClearCount + 1;
				if ((int)Run.instance.selectedDifficulty == 0)
				{
					timeForBuff = ArtifactOfDoomConfig.timeAfterHitToNotLoseItemDrizzly.Value;
				}
				if ((int)Run.instance.selectedDifficulty == 1)
				{
					timeForBuff = ArtifactOfDoomConfig.timeAfterHitToNotLoseItemRainstorm.Value;
				}
				if ((int)Run.instance.selectedDifficulty == 2)
				{
					timeForBuff = ArtifactOfDoomConfig.timeAfterHitToNotLoseItemMonsoon.Value;
				}
				if (timeForBuff == -1.0)
				{
					List<Difficulty> list2 = ArtifactOfDoomConfig.timeAfterHitToNotLoseItemOtherDifficulty.Value.FromJson<List<Difficulty>>();
					foreach (Difficulty item in list2)
					{
						if ((int)Run.instance.selectedDifficulty == item.DifficultyIndex)
						{
							timeForBuff = item.time;
						}
					}
					if (timeForBuff == -1.0)
					{
						DifficultyIndex selectedDifficulty = Run.instance.selectedDifficulty;
						Debug.LogWarning((object)("Didn't find valid Configuration for Selected Difficulty. Falling back to 0.1 seconds for Buff. If you want a own definition fill out timeAfterHitToNotLoseItemOtherDifficulty in the Config. DifficultyIndex=" + ((object)(DifficultyIndex)(ref selectedDifficulty)).ToString()));
						timeForBuff = 0.1;
					}
				}
				QueueLostItemSprite = new Dictionary<uint, Queue<ItemDef>>();
				QueueGainedItemSprite = new Dictionary<uint, Queue<ItemDef>>();
				Playername = new List<CharacterBody>();
				counter = new List<int>();
				LockNetworkUser.Clear();
			};
			object obj3 = <>c.<>9__15_3;
			if (obj3 == null)
			{
				hook_Awake val3 = delegate(orig_Awake orig, Run self)
				{
					orig.Invoke(self);
				};
				<>c.<>9__15_3 = val3;
				obj3 = (object)val3;
			}
			Run.Awake += (hook_Awake)obj3;
			object obj4 = <>c.<>9__15_4;
			if (obj4 == null)
			{
				hook_Start val4 = delegate(orig_Start orig, Run self)
				{
					orig.Invoke(self);
				};
				<>c.<>9__15_4 = val4;
				obj4 = (object)val4;
			}
			Run.Start += (hook_Start)obj4;
			CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)delegate(orig_OnInventoryChanged orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (!((Object)(object)Networking._instance == (Object)null) && Networking._instance.IsArtifactEnabled && self.isPlayerControlled)
				{
					NetworkUser networkUserOfCharacterBody2 = getNetworkUserOfCharacterBody(self);
					int num6 = calculateEnemyCountToTrigger(self.inventory);
					if (!Playername.Contains(self))
					{
						Playername.Add(self);
						counter.Add(0);
					}
					if ((Object)(object)networkUserOfCharacterBody2 != (Object)null)
					{
						string killedNeededEnemies4 = counter[Playername.IndexOf(self)] + "," + num6;
						if (NetworkServer.active)
						{
							Networking.ServerEnsureNetworking();
							Networking._instance.CallTargetUpdateProgressBar(((NetworkBehaviour)networkUserOfCharacterBody2).connectionToClient, killedNeededEnemies4);
						}
					}
				}
			};
			GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_048e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0493: Unknown result type (might be due to invalid IL or missing references)
				//IL_053a: Unknown result type (might be due to invalid IL or missing references)
				//IL_053f: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_04db: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0555: Unknown result type (might be due to invalid IL or missing references)
				//IL_055a: Unknown result type (might be due to invalid IL or missing references)
				//IL_051d: Expected O, but got Unknown
				//IL_056f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0574: Unknown result type (might be due to invalid IL or missing references)
				//IL_058a: Unknown result type (might be due to invalid IL or missing references)
				//IL_058f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_03af: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0300: Unknown result type (might be due to invalid IL or missing references)
				//IL_033b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0347: Unknown result type (might be due to invalid IL or missing references)
				//IL_034c: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0403: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0392: Expected O, but got Unknown
				//IL_0419: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, damageReport);
				Networking._instance.NetworkIsArtifactEnabled = RunArtifactManager.instance.IsArtifactEnabled(Transmutation.artifactIndex);
				Networking._instance.NetworkIsCalculationSacrifice = ArtifactOfDoomConfig.useArtifactOfSacrificeCalculation.Value;
				if (Networking._instance.IsArtifactEnabled && !Run.instance.isGameOverServer && !damageReport.victimBody.isPlayerControlled && !((Object)(object)damageReport.attackerBody == (Object)null) && !((Object)(object)damageReport.attackerBody.inventory == (Object)null) && !((Object)(object)damageReport.victimBody.inventory == (Object)null))
				{
					if ((Object)(object)damageReport.attackerOwnerMaster != (Object)null && !Playername.Contains(damageReport.attackerBody))
					{
						Playername.Add(damageReport.attackerOwnerMaster.GetBody());
						counter.Add(0);
					}
					if (!Playername.Contains(damageReport.attackerBody))
					{
						Playername.Add(damageReport.attackerBody);
						counter.Add(0);
					}
					CharacterBody val6 = ((!((Object)(object)damageReport.attackerOwnerMaster != (Object)null)) ? damageReport.attackerBody : damageReport.attackerOwnerMaster.GetBody());
					if (val6.isPlayerControlled)
					{
						uint key2 = 0u;
						int num5 = calculateEnemyCountToTrigger(val6.inventory);
						bool enemyDropRate = getEnemyDropRate(damageReport);
						if (counter[Playername.IndexOf(val6)] <= num5 && !ArtifactOfDoomConfig.useArtifactOfSacrificeCalculation.Value)
						{
							counter[Playername.IndexOf(val6)]++;
							NetworkUser networkUserOfDamageReport = getNetworkUserOfDamageReport(damageReport, withMaster: true);
							string killedNeededEnemies2 = counter[Playername.IndexOf(val6)] + "," + num5;
							if (NetworkServer.active)
							{
								Networking.ServerEnsureNetworking();
								Networking._instance.CallTargetUpdateProgressBar(((NetworkBehaviour)networkUserOfDamageReport).connectionToClient, killedNeededEnemies2);
							}
						}
						else if (!ArtifactOfDoomConfig.useArtifactOfSacrificeCalculation.Value || enemyDropRate)
						{
							NetworkInstanceId netId2;
							if ((Object)(object)damageReport.attackerOwnerMaster != (Object)null)
							{
								CharacterBody body = damageReport.attackerOwnerMaster.GetBody();
								double characterSpezificBuffLengthMultiplier2 = getCharacterSpezificBuffLengthMultiplier(body.baseNameToken);
								characterSpezificBuffLengthMultiplier2 *= 100.0;
								Random random2 = new Random();
								while (characterSpezificBuffLengthMultiplier2 > (double)random2.Next(0, 99))
								{
									ItemIndex val7 = GiveAndReturnRandomItem(body.inventory);
									if (ArtifactOfDoomConfig.enableChatItemOutput.Value)
									{
										ItemDef itemDef2 = ItemCatalog.GetItemDef(val7);
										string string2 = Language.GetString(itemDef2.nameToken);
										string coloredUserName2 = damageReport.attackerOwnerMaster.GetBody().GetColoredUserName();
										int itemCount2 = damageReport.attackerOwnerMaster.GetBody().inventory.GetItemCount(itemDef2.itemIndex);
										Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
										{
											baseToken = damageReport.attackerOwnerMaster.GetBody().GetColoredUserName() + "<color=#7e91af> gained</color> " + string.Format("{0} ({1})</color> <color=#{2}></color>", string2 ?? "???", itemCount2, "7e91af")
										});
									}
									PlayerStatsComponent.FindBodyStatSheet(body).PushStatValue(statsGainItems, 1uL);
									Dictionary<uint, Queue<ItemDef>> queueGainedItemSprite = QueueGainedItemSprite;
									netId2 = ((NetworkBehaviour)body).netId;
									if (queueGainedItemSprite.ContainsKey(((NetworkInstanceId)(ref netId2)).Value))
									{
										netId2 = ((NetworkBehaviour)body).netId;
										key2 = ((NetworkInstanceId)(ref netId2)).Value;
									}
									else
									{
										Dictionary<uint, Queue<ItemDef>> queueGainedItemSprite2 = QueueGainedItemSprite;
										netId2 = ((NetworkBehaviour)body).netId;
										queueGainedItemSprite2.Add(((NetworkInstanceId)(ref netId2)).Value, new Queue<ItemDef>());
										netId2 = ((NetworkBehaviour)body).netId;
										key2 = ((NetworkInstanceId)(ref netId2)).Value;
									}
									QueueGainedItemSprite[key2].Enqueue(ItemCatalog.GetItemDef(val7));
									characterSpezificBuffLengthMultiplier2 -= 100.0;
								}
							}
							else
							{
								CharacterBody body = damageReport.attackerBody;
								double characterSpezificItemCount = getCharacterSpezificItemCount(body.baseNameToken);
								characterSpezificItemCount *= 100.0;
								Random random3 = new Random();
								while (characterSpezificItemCount > (double)random3.Next(0, 99))
								{
									ItemIndex val8 = GiveAndReturnRandomItem(body.inventory);
									if (ArtifactOfDoomConfig.enableChatItemOutput.Value)
									{
										ItemDef itemDef3 = ItemCatalog.GetItemDef(val8);
										string string3 = Language.GetString(itemDef3.nameToken);
										string coloredUserName3 = body.GetColoredUserName();
										int itemCount3 = body.inventory.GetItemCount(itemDef3.itemIndex);
										Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
										{
											baseToken = body.GetColoredUserName() + "<color=#7e91af> gained</color> " + string.Format("{0} ({1})</color> <color=#{2}></color>", string3 ?? "???", itemCount3, "7e91af")
										});
									}
									PlayerStatsComponent.FindBodyStatSheet(body).PushStatValue(statsGainItems, 1uL);
									Dictionary<uint, Queue<ItemDef>> queueGainedItemSprite3 = QueueGainedItemSprite;
									netId2 = ((NetworkBehaviour)body).netId;
									if (queueGainedItemSprite3.ContainsKey(((NetworkInstanceId)(ref netId2)).Value))
									{
										netId2 = ((NetworkBehaviour)body).netId;
										key2 = ((NetworkInstanceId)(ref netId2)).Value;
									}
									else
									{
										try
										{
											Dictionary<uint, Queue<ItemDef>> queueGainedItemSprite4 = QueueGainedItemSprite;
											netId2 = ((NetworkBehaviour)body).netId;
											queueGainedItemSprite4.Add(((NetworkInstanceId)(ref netId2)).Value, new Queue<ItemDef>());
											netId2 = ((NetworkBehaviour)body).netId;
											key2 = ((NetworkInstanceId)(ref netId2)).Value;
										}
										catch (Exception)
										{
											Debug.LogError((object)"[SirHamburger ArtifactOfDoom] Error while excecuting : QueueGainedItemSprite.Add(body.netId.Value, new Queue<Sprite>()); (line 203)");
										}
									}
									QueueGainedItemSprite[key2].Enqueue(ItemCatalog.GetItemDef(val8));
									characterSpezificItemCount -= 100.0;
								}
							}
							if (QueueGainedItemSprite[key2].Count > 10)
							{
								QueueGainedItemSprite[key2].Dequeue();
							}
							string text2 = "";
							foreach (ItemDef item2 in QueueGainedItemSprite[key2])
							{
								text2 = text2 + ((Object)item2).name + " ";
							}
							NetworkUser networkUserOfDamageReport2 = getNetworkUserOfDamageReport(damageReport, withMaster: true);
							if (!LockItemGainNetworkUser.ContainsKey(networkUserOfDamageReport2))
							{
								LockItemGainNetworkUser.Add(networkUserOfDamageReport2, value: false);
							}
							counter[Playername.IndexOf(val6)]++;
							if (!LockItemGainNetworkUser[networkUserOfDamageReport2])
							{
								LockItemGainNetworkUser[networkUserOfDamageReport2] = false;
								LockItemGainNetworkUser[networkUserOfDamageReport2] = false;
								string killedNeededEnemies3 = counter[Playername.IndexOf(val6)] + "," + num5;
								if (NetworkServer.active)
								{
									Networking._instance.CallTargetAddGainedItemsToPlayers(((NetworkBehaviour)networkUserOfDamageReport2).connectionToClient, text2);
									Networking.ServerEnsureNetworking();
									Networking._instance.CallTargetUpdateProgressBar(((NetworkBehaviour)networkUserOfDamageReport2).connectionToClient, killedNeededEnemies3);
								}
							}
							counter[Playername.IndexOf(val6)] = 0;
						}
					}
				}
			};
			HealthComponent.TakeDamage += (hook_TakeDamage)delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageinfo)
			{
				//IL_0401: Unknown result type (might be due to invalid IL or missing references)
				//IL_0406: Unknown result type (might be due to invalid IL or missing references)
				//IL_042c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0422: Unknown result type (might be due to invalid IL or missing references)
				//IL_0427: Unknown result type (might be due to invalid IL or missing references)
				//IL_043e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0440: Unknown result type (might be due to invalid IL or missing references)
				//IL_0443: Unknown result type (might be due to invalid IL or missing references)
				//IL_044c: Unknown result type (might be due to invalid IL or missing references)
				//IL_045d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0466: Unknown result type (might be due to invalid IL or missing references)
				//IL_046d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0473: Invalid comparison between Unknown and I4
				//IL_0475: Unknown result type (might be due to invalid IL or missing references)
				//IL_047c: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0567: Unknown result type (might be due to invalid IL or missing references)
				//IL_04be: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0500: Unknown result type (might be due to invalid IL or missing references)
				//IL_0348: Unknown result type (might be due to invalid IL or missing references)
				//IL_034d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0541: Expected O, but got Unknown
				//IL_0367: Unknown result type (might be due to invalid IL or missing references)
				//IL_036c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b2: 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_01bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0386: Unknown result type (might be due to invalid IL or missing references)
				//IL_038b: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, damageinfo);
				if (Networking._instance.IsArtifactEnabled && !damageinfo.rejected)
				{
					if (debug)
					{
						Debug.LogWarning((object)"Line 336");
					}
					if ((Object)(object)self.body == (Object)null)
					{
						if (debug)
						{
							Debug.LogWarning((object)"self.body == null)");
						}
					}
					else if ((Object)(object)self.body.inventory == (Object)null)
					{
						if (debug)
						{
							Debug.LogWarning((object)"self.body.inventory == null)");
						}
					}
					else if (Run.instance.isGameOverServer)
					{
						if (debug)
						{
							Debug.LogWarning((object)"RoR2.Run.instance.isGameOverServer)");
						}
					}
					else if (damageinfo == null)
					{
						if (debug)
						{
							Debug.LogWarning((object)"damageinfo == null)");
						}
					}
					else if ((Object)(object)damageinfo.attacker == (Object)null)
					{
						if (debug)
						{
							Debug.LogWarning((object)"damageinfo.attacker.name==null)");
						}
					}
					else if (self.body.HasBuff(ArtifactOfDoomConfig.ArtifactOfDoomBuff))
					{
						if (debug)
						{
							Debug.LogWarning((object)"you did lose an item not long ago so you don't lose one now");
						}
					}
					else
					{
						int totalItemCountOfPlayer = getTotalItemCountOfPlayer(self.body.inventory);
						if (self.body.isPlayerControlled && totalItemCountOfPlayer > 0 && ((Object)self).name != ((Object)damageinfo.attacker).name)
						{
							Dictionary<ItemIndex, int> dictionary = new Dictionary<ItemIndex, int>();
							List<ItemIndex> list = new List<ItemIndex>();
							GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
							AllItemsEnumerator enumerator = allItems.GetEnumerator();
							try
							{
								while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
								{
									ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
									if (self.body.inventory.GetItemCount(current) > 0)
									{
										dictionary.Add(current, self.body.inventory.GetItemCount(current));
										list.Add(current);
									}
								}
							}
							finally
							{
								((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
							}
							double num = 100.0;
							if (totalItemCountOfPlayer <= ArtifactOfDoomConfig.minItemsPerStage.Value * currentStage)
							{
								num = Math.Sqrt((double)totalItemCountOfPlayer / ((double)currentStage * (double)ArtifactOfDoomConfig.minItemsPerStage.Value));
								num *= 100.0;
							}
							Random random = new Random();
							for (int i = 0; i < self.body.inventory.GetItemCount(Items.Clover) + 1; i++)
							{
								int num2 = random.Next(1, 100);
								if (num < (double)num2)
								{
									return;
								}
							}
							num = 100.0;
							if (totalItemCountOfPlayer > ArtifactOfDoomConfig.maxItemsPerStage.Value * currentStage)
							{
								num = Math.Pow((double)totalItemCountOfPlayer / ((double)ArtifactOfDoomConfig.maxItemsPerStage.Value * (double)currentStage), ArtifactOfDoomConfig.exponentailFactorToCalculateSumOfLostItems.Value);
								num *= 100.0;
							}
							int num3 = 0;
							uint key = 50000u;
							while (num > 0.0)
							{
								Dictionary<uint, Queue<ItemDef>> queueLostItemSprite = QueueLostItemSprite;
								NetworkInstanceId netId = ((NetworkBehaviour)self.body).netId;
								if (queueLostItemSprite.ContainsKey(((NetworkInstanceId)(ref netId)).Value))
								{
									netId = ((NetworkBehaviour)self.body).netId;
									key = ((NetworkInstanceId)(ref netId)).Value;
								}
								else
								{
									try
									{
										Dictionary<uint, Queue<ItemDef>> queueLostItemSprite2 = QueueLostItemSprite;
										netId = ((NetworkBehaviour)self.body).netId;
										queueLostItemSprite2.Add(((NetworkInstanceId)(ref netId)).Value, new Queue<ItemDef>());
										netId = ((NetworkBehaviour)self.body).netId;
										key = ((NetworkInstanceId)(ref netId)).Value;
									}
									catch (Exception)
									{
										Debug.Log((object)"[SirHamburger ArtifactOfDoom] Error in Line 311");
									}
								}
								if (num < (double)random.Next(0, 99))
								{
									break;
								}
								num3++;
								int index = random.Next(0, dictionary.Count - 1);
								ItemIndex val5 = list[index];
								while (dictionary[val5] == 0)
								{
									index = random.Next(0, dictionary.Count - 1);
									val5 = list[index];
								}
								dictionary[val5]--;
								if (!ItemCatalog.lunarItemList.Contains(val5) && (int)ItemCatalog.GetItemDef(val5).tier != 5 && val5 != Items.CaptainDefenseMatrix.itemIndex)
								{
									self.body.inventory.RemoveItem(val5, 1);
									if (ArtifactOfDoomConfig.enableChatItemOutput.Value)
									{
										ItemDef itemDef = ItemCatalog.GetItemDef(val5);
										string @string = Language.GetString(itemDef.nameToken);
										string coloredUserName = self.body.GetColoredUserName();
										int itemCount = self.body.inventory.GetItemCount(itemDef.itemIndex);
										Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
										{
											baseToken = self.body.GetColoredUserName() + "<color=#7e91af> lost</color> " + string.Format("{0} ({1})</color> <color=#{2}></color>", @string ?? "???", itemCount, "7e91af")
										});
									}
									PlayerStatsComponent.FindBodyStatSheet(self.body).PushStatValue(statsLostItems, 1uL);
									QueueLostItemSprite[key].Enqueue(ItemCatalog.GetItemDef(val5));
									if (QueueLostItemSprite[key].Count > 10)
									{
										QueueLostItemSprite[key].Dequeue();
									}
									double characterSpezificBuffLengthMultiplier = getCharacterSpezificBuffLengthMultiplier(self.body.baseNameToken);
									self.body.AddTimedBuff(ArtifactOfDoomConfig.ArtifactOfDoomBuff, (float)(timeForBuff * (double)(float)characterSpezificBuffLengthMultiplier));
								}
								num -= 100.0;
							}
							string text = "";
							foreach (ItemDef item3 in QueueLostItemSprite[key])
							{
								text = text + ((Object)item3).name + " ";
							}
							NetworkUser networkUserOfCharacterBody = getNetworkUserOfCharacterBody(self.body);
							if ((Object)(object)networkUserOfCharacterBody == (Object)null)
							{
								Debug.LogError((object)"--------------------------------tempNetworkUser(lostitems)==null---------------------------");
							}
							if (!LockNetworkUser.ContainsKey(networkUserOfCharacterBody))
							{
								LockNetworkUser.Add(networkUserOfCharacterBody, value: false);
							}
							if (!LockNetworkUser[networkUserOfCharacterBody])
							{
								LockNetworkUser[networkUserOfCharacterBody] = false;
								int num4 = calculateEnemyCountToTrigger(self.body.inventory);
								string killedNeededEnemies = counter[Playername.IndexOf(self.body)] + "," + num4;
								if (NetworkServer.active)
								{
									Networking._instance.CallTargetAddLostItemsOfPlayers(((NetworkBehaviour)networkUserOfCharacterBody).connectionToClient, text);
									Networking.ServerEnsureNetworking();
									Networking._instance.CallTargetUpdateProgressBar(((NetworkBehaviour)networkUserOfCharacterBody).connectionToClient, killedNeededEnemies);
								}
							}
						}
					}
				}
			};
		}

		private NetworkUser getNetworkUserOfDamageReport(DamageReport report, bool withMaster)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			NetworkUser result = null;
			foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
			{
				if ((Object)(object)report.attackerOwnerMaster != (Object)null && withMaster)
				{
					if ((Object)(object)readOnlyInstances.GetCurrentBody() != (Object)null && ((NetworkBehaviour)readOnlyInstances.GetCurrentBody()).netId == ((NetworkBehaviour)report.attackerOwnerMaster.GetBody()).netId)
					{
						result = readOnlyInstances;
					}
				}
				else if ((Object)(object)readOnlyInstances.GetCurrentBody() != (Object)null && ((NetworkBehaviour)readOnlyInstances.GetCurrentBody()).netId == ((NetworkBehaviour)report.attackerBody).netId)
				{
					result = readOnlyInstances;
				}
			}
			return result;
		}

		private NetworkUser getNetworkUserOfCharacterBody(CharacterBody body)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			NetworkUser result = null;
			foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
			{
				if ((Object)(object)readOnlyInstances.GetCurrentBody() != (Object)null && ((NetworkBehaviour)readOnlyInstances.GetCurrentBody()).netId == ((NetworkBehaviour)body).netId)
				{
					result = readOnlyInstances;
				}
			}
			return result;
		}

		private int getTotalItemCountOfPlayer(Inventory inventory)
		{
			return inventory.GetTotalItemCountOfTier((ItemTier)0) + inventory.GetTotalItemCountOfTier((ItemTier)1) + inventory.GetTotalItemCountOfTier((ItemTier)2);
		}

		private int calculateEnemyCountToTrigger(Inventory inventory)
		{
			int totalItemCountOfPlayer = getTotalItemCountOfPlayer(inventory);
			int num = 0;
			num = (int)((0.5 + 0.5 * (double)Mathf.Atan(0.4f * (float)totalItemCountOfPlayer - (float)(ArtifactOfDoomConfig.averageItemsPerStage.Value * (1 + currentStage) / 2)) / 2.0) * 40.0 - 3.0);
			if (num < 1)
			{
				num = 1;
			}
			if (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.swarmsArtifactDef) && ArtifactOfDoomConfig.artifactOfSwarmNerf.Value)
			{
				num *= 2;
			}
			return num;
		}

		private double getCharacterSpezificItemCount(string baseNameToken)
		{
			switch (baseNameToken)
			{
			case "COMMANDO_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Commando"));
				}
				return ArtifactOfDoomConfig.CommandoBonusItems.Value;
			case "HUNTRESS_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Huntress"));
				}
				return ArtifactOfDoomConfig.HuntressBonusItems.Value;
			case "ENGI_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Engineer"));
				}
				return ArtifactOfDoomConfig.EngineerBonusItems.Value;
			case "TOOLBOT_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: MULT"));
				}
				return ArtifactOfDoomConfig.MULTBonusItems.Value;
			case "MAGE_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Artificer"));
				}
				return ArtifactOfDoomConfig.ArtificerBonusItems.Value;
			case "MERC_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Mercenary"));
				}
				return ArtifactOfDoomConfig.MercenaryBonusItems.Value;
			case "TREEBOT_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Rex"));
				}
				return ArtifactOfDoomConfig.RexBonusItems.Value;
			case "LOADER_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Loader"));
				}
				return ArtifactOfDoomConfig.LoaderBonusItems.Value;
			case "CROCO_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Acrid"));
				}
				return ArtifactOfDoomConfig.AcridBonusItems.Value;
			case "CAPTAIN_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Captain"));
				}
				return ArtifactOfDoomConfig.CaptainBonusItems.Value;
			case "BANDIT2_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Bandit"));
				}
				return ArtifactOfDoomConfig.BanditBonusItems.Value;
			case "RAILGUNNER_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Railgunner"));
				}
				return ArtifactOfDoomConfig.RailgunnerBonusItems.Value;
			case "VOIDSURVIVOR_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: VoidSurvivor"));
				}
				return ArtifactOfDoomConfig.VoidSurvivorBonusItems.Value;
			default:
			{
				string value = ArtifactOfDoomConfig.CustomChars.Value;
				List<Character> list = value.FromJson<List<Character>>();
				foreach (Character item in list)
				{
					if (baseNameToken == item.Name)
					{
						return item.BonusItems;
					}
				}
				Debug.LogWarning((object)("did not find a valid configuation setting for Character " + baseNameToken + " you can add one in the settings"));
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Acrid"));
				}
				return ArtifactOfDoomConfig.CustomSurvivorBonusItems.Value;
			}
			}
		}

		private double getCharacterSpezificBuffLengthMultiplier(string baseNameToken)
		{
			switch (baseNameToken)
			{
			case "COMMANDO_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Commando"));
				}
				return ArtifactOfDoomConfig.CommandoMultiplierForTimedBuff.Value;
			case "HUNTRESS_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Huntress"));
				}
				return ArtifactOfDoomConfig.HuntressMultiplierForTimedBuff.Value;
			case "ENGI_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Engineer"));
				}
				return ArtifactOfDoomConfig.EngineerMultiplierForTimedBuff.Value;
			case "TOOLBOT_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: MULT"));
				}
				return ArtifactOfDoomConfig.MULTMultiplierForTimedBuff.Value;
			case "MAGE_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Artificer"));
				}
				return ArtifactOfDoomConfig.ArtificerMultiplierForTimedBuff.Value;
			case "MERC_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Mercenary"));
				}
				return ArtifactOfDoomConfig.MercenaryMultiplierForTimedBuff.Value;
			case "TREEBOT_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Rex"));
				}
				return ArtifactOfDoomConfig.RexMultiplierForTimedBuff.Value;
			case "LOADER_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Loader"));
				}
				return ArtifactOfDoomConfig.LoaderMultiplierForTimedBuff.Value;
			case "CROCO_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Acrid"));
				}
				return ArtifactOfDoomConfig.AcridMultiplierForTimedBuff.Value;
			case "CAPTAIN_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Captain"));
				}
				return ArtifactOfDoomConfig.CaptainMultiplierForTimedBuff.Value;
			case "BANDIT2_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Bandit"));
				}
				return ArtifactOfDoomConfig.BanditMultiplierForTimedBuff.Value;
			case "RAILGUNNER_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Railgunner"));
				}
				return ArtifactOfDoomConfig.RailgunnerMultiplierForTimedBuff.Value;
			case "VOIDSURVIVOR_BODY_NAME":
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: VoidSurvivor"));
				}
				return ArtifactOfDoomConfig.VoidSurvivorMultiplierForTimedBuff.Value;
			default:
			{
				string value = ArtifactOfDoomConfig.CustomChars.Value;
				List<Character> list = value.FromJson<List<Character>>();
				foreach (Character item in list)
				{
					if (baseNameToken == item.Name)
					{
						return item.MultiplierForTimedBuff;
					}
				}
				Debug.LogWarning((object)("did not find a valid configuation setting for Character " + baseNameToken + " you can add one in the settings"));
				if (debug)
				{
					Debug.LogWarning((object)("Character baseNameToken = " + baseNameToken + " returning: Acrid"));
				}
				return ArtifactOfDoomConfig.CustomSurvivorMultiplierForTimedBuff.Value;
			}
			}
		}

		public ItemIndex GiveAndReturnRandomItem(Inventory inventory)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			List<ItemIndex> tier1ItemList = ItemCatalog.tier1ItemList;
			List<ItemIndex> tier2ItemList = ItemCatalog.tier2ItemList;
			List<ItemIndex> tier3ItemList = ItemCatalog.tier3ItemList;
			WeightedSelection<List<ItemIndex>> val = new WeightedSelection<List<ItemIndex>>(8);
			val.AddChoice(tier1ItemList, 80f);
			val.AddChoice(tier2ItemList, 19f);
			val.AddChoice(tier3ItemList, 1f);
			List<ItemIndex> list = val.Evaluate(Random.value);
			ItemIndex val2 = list[Random.Range(0, list.Count)];
			inventory.GiveItem(val2, 1);
			return val2;
		}

		protected void OnDestroy()
		{
			QueueLostItemSprite = new Dictionary<uint, Queue<ItemDef>>();
			QueueGainedItemSprite = new Dictionary<uint, Queue<ItemDef>>();
			statsLostItems = null;
			statsGainItems = null;
			Playername = new List<CharacterBody>();
			counter = new List<int>();
		}

		private bool getEnemyDropRate(DamageReport damageReport)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!ArtifactOfDoomConfig.useArtifactOfSacrificeCalculation.Value)
			{
				return false;
			}
			if (!Object.op_Implicit((Object)(object)damageReport.victimMaster))
			{
				return false;
			}
			if (damageReport.attackerTeamIndex == damageReport.victimTeamIndex && Object.op_Implicit((Object)(object)damageReport.victimMaster.minionOwnership.ownerMaster))
			{
				return false;
			}
			float expAdjustedDropChancePercent = Util.GetExpAdjustedDropChancePercent(5f * (float)ArtifactOfDoomConfig.multiplayerForArtifactOfSacrificeDropRate.Value, ((Component)damageReport.victim).gameObject);
			if (Util.CheckRoll(expAdjustedDropChancePercent, 0f, (CharacterMaster)null))
			{
				return true;
			}
			return false;
		}
	}
	public class ArtifactOfDoomUI
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_RemoveItem_ItemIndex_int <>9__1_0;

			internal void <.ctor>b__1_0(orig_RemoveItem_ItemIndex_int orig, Inventory self, ItemIndex itemindex1, int ItemIndex2)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, itemindex1, ItemIndex2);
			}
		}

		public GameObject ModCanvas = null;

		public Transform HUDRoot = null;

		public GameObject ModExpBarGroup = null;

		public static List<GameObject> listGainedImages = new List<GameObject>();

		public static List<GameObject> listLostImages = new List<GameObject>();

		public static GameObject itemGainBar;

		public static GameObject itemGainFrame;

		public ArtifactOfDoomUI()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			HUD.Awake += new hook_Awake(HUDAwake);
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				hook_RemoveItem_ItemIndex_int val = delegate(orig_RemoveItem_ItemIndex_int orig, Inventory self, ItemIndex itemindex1, int ItemIndex2)
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, itemindex1, ItemIndex2);
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			Inventory.RemoveItem_ItemIndex_int += (hook_RemoveItem_ItemIndex_int)obj;
		}

		private void SetUpModCanvas()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ModCanvas == (Object)null)
			{
				ModCanvas = new GameObject("UIModifierCanvas");
				ModCanvas.AddComponent<Canvas>();
				ModCanvas.GetComponent<Canvas>().renderMode = (RenderMode)1;
				if ((Object)(object)HUDRoot != (Object)null)
				{
					ModCanvas.GetComponent<Canvas>().worldCamera = ((Component)((Component)HUDRoot).transform.root).gameObject.GetComponent<Canvas>().worldCamera;
				}
				ModCanvas.AddComponent<CanvasScaler>();
				ModCanvas.GetComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1;
				ModCanvas.GetComponent<CanvasScaler>().referenceResolution = new Vector2(1920f, 1080f);
				ModCanvas.GetComponent<CanvasScaler>().screenMatchMode = (ScreenMatchMode)1;
			}
		}

		public void HUDAwake(orig_Awake orig, HUD self)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			NetworkClass.EnsureNetworking();
			Networking._instance.NetworkIsArtifactEnabled = RunArtifactManager.instance.IsArtifactEnabled(ArtifactOfDoom.Transmutation.artifactIndex);
			Networking._instance.NetworkIsCalculationSacrifice = ArtifactOfDoomConfig.useArtifactOfSacrificeCalculation.Value;
			if (Networking._instance.IsArtifactEnabled)
			{
				HUDRoot = ((Component)self).transform.root;
				MainExpBarStart();
			}
		}

		private void MainExpBarStart()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Expected O, but got Unknown
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)HUDRoot != (Object)null)
			{
				try
				{
					SetUpModCanvas();
					listGainedImages.Clear();
					listLostImages.Clear();
					float num = Convert.ToSingle(ArtifactOfDoomConfig.sizeOfSideBars.Value);
					Resolution currentResolution = Screen.currentResolution;
					float num2 = ((Resolution)(ref currentResolution)).width;
					currentResolution = Screen.currentResolution;
					float num3 = num2 / (float)((Resolution)(ref currentResolution)).height;
					float num4 = num * num3;
					float num5 = num4 + 0.01f;
					for (int i = 0; i < 10; i++)
					{
						ModExpBarGroup = new GameObject("GainedItems" + i);
						ModExpBarGroup.transform.SetParent(ModCanvas.transform);
						ModExpBarGroup.AddComponent<RectTransform>();
						ModExpBarGroup.GetComponent<RectTransform>().anchorMin = new Vector2(0f, (float)(0.2 + (double)((float)i * num5)));
						ModExpBarGroup.GetComponent<RectTransform>().anchorMax = new Vector2(num, (float)(0.2 + (double)num4 + (double)((float)i * num5)));
						ModExpBarGroup.GetComponent<RectTransform>().sizeDelta = Vector2.zero;
						ModExpBarGroup.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
						listGainedImages.Add(ModExpBarGroup);
						ModExpBarGroup = new GameObject("LostItems" + i);
						ModExpBarGroup.transform.SetParent(ModCanvas.transform);
						ModExpBarGroup.AddComponent<RectTransform>();
						ModExpBarGroup.GetComponent<RectTransform>().anchorMin = new Vector2(1f - num, (float)(0.2 + (double)((float)i * num5)));
						ModExpBarGroup.GetComponent<RectTransform>().anchorMax = new Vector2(1f, (float)(0.2