Decompiled source of MysticsItems v2.1.14

MysticsItemsPlugin.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using ArchaicWisp;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterUI;
using EntityStates;
using EntityStates.Huntress.HuntressWeapon;
using EntityStates.Turret1;
using HG;
using IL.RoR2;
using ItemStats;
using ItemStats.Stat;
using ItemStats.ValueFormatters;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MysticsItems.Buffs;
using MysticsItems.CharacterMasters;
using MysticsItems.Equipment;
using MysticsItems.Items;
using MysticsItems.SoftDependencies;
using MysticsRisky2Utils;
using MysticsRisky2Utils.BaseAssetTypes;
using MysticsRisky2Utils.ContentManagement;
using MysticsRisky2Utils.MonoBehaviours;
using MysticsRisky2Utils.SoftDependencies;
using On.EntityStates;
using On.EntityStates.Huntress.HuntressWeapon;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.Items;
using On.RoR2.UI;
using ProperSave;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Achievements;
using RoR2.Artifacts;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.DirectionalSearch;
using RoR2.EntityLogic;
using RoR2.Hologram;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using TILER2;
using TMPro;
using ThreeEyedGames;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using WhatAmILookingAt;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MysticsItemsPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MysticsItemsPlugin")]
[assembly: AssemblyTitle("MysticsItemsPlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MysticsItems
{
	public static class ConfigManager
	{
		public static class General
		{
			public struct DisabledItem
			{
				public ItemTier previousTier;

				public bool wasWorldUnique;
			}

			public struct DisabledEquipment
			{
				public bool appearedInSinglePlayer;

				public bool appearedInMultiPlayer;
			}

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

				public static Action<Run, RuleBook> <>9__7_0;

				public static Predicate<EquipmentIndex> <>9__7_3;

				public static hook_OnRunStartGlobal <>9__7_1;

				public static Func<FieldInfo, ItemDef> <>9__7_4;

				public static Func<ItemDef, bool> <>9__7_5;

				public static Func<FieldInfo, EquipmentDef> <>9__7_6;

				public static Func<EquipmentDef, bool> <>9__7_7;

				public static Action <>9__7_2;

				internal void <InitItemAndEquipmentDisabling>b__7_0(Run run, RuleBook rulebook)
				{
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0023: Unknown result type (might be due to invalid IL or missing references)
					//IL_0033: Unknown result type (might be due to invalid IL or missing references)
					//IL_006a: Unknown result type (might be due to invalid IL or missing references)
					//IL_006f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_008b: Unknown result type (might be due to invalid IL or missing references)
					foreach (ItemIndex key in disabledItems.Keys)
					{
						if (run.availableItems.Contains(key))
						{
							run.availableItems.Remove(key);
						}
					}
					foreach (EquipmentIndex key2 in disabledEquipment.Keys)
					{
						if (run.availableEquipment.Contains(key2))
						{
							run.availableEquipment.Remove(key2);
						}
					}
					PickupDropTable.RegenerateAll(run);
				}

				internal void <InitItemAndEquipmentDisabling>b__7_1(orig_OnRunStartGlobal orig, Run run)
				{
					orig.Invoke(run);
					if (NetworkServer.active)
					{
						EnigmaArtifactManager.validEquipment.RemoveAll((EquipmentIndex x) => disabledEquipment.ContainsKey(x));
					}
				}

				internal bool <InitItemAndEquipmentDisabling>b__7_3(EquipmentIndex x)
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					return disabledEquipment.ContainsKey(x);
				}

				internal void <InitItemAndEquipmentDisabling>b__7_2()
				{
					List<ItemDef> list = (from x in typeof(MysticsItemsContent.Items).GetFields().Select(delegate(FieldInfo x)
						{
							object? value2 = x.GetValue(null);
							return (ItemDef)((value2 is ItemDef) ? value2 : null);
						})
						where !x.hidden && x.inDroppableTier
						select x).ToList();
					List<EquipmentDef> list2 = (from x in typeof(MysticsItemsContent.Equipment).GetFields().Select(delegate(FieldInfo x)
						{
							object? value = x.GetValue(null);
							return (EquipmentDef)((value is EquipmentDef) ? value : null);
						})
						where x.canDrop
						select x).ToList();
					<>c__DisplayClass7_0 <>c__DisplayClass7_ = default(<>c__DisplayClass7_0);
					<>c__DisplayClass7_.richTags = new List<string>
					{
						"align", "color", "alpha", "b", "i", "cspace", "font", "indent", "line-height", "line-indent",
						"link", "lowercase", "uppercase", "smallcaps", "margin", "mark", "mspace", "noparse", "nobr", "page",
						"pos", "size", "space", "sprite", "s", "u", "style", "sub", "sup", "voffset",
						"width"
					};
					using (List<ItemDef>.Enumerator enumerator = list.GetEnumerator())
					{
						while (enumerator.MoveNext())
						{
							<>c__DisplayClass7_1 CS$<>8__locals0 = new <>c__DisplayClass7_1
							{
								itemDef = enumerator.Current
							};
							ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "Enabled Items", <InitItemAndEquipmentDisabling>g__GetSanitizedStringFromToken|7_8(CS$<>8__locals0.itemDef.nameToken, ref <>c__DisplayClass7_), true, "Should this item be enabled? Changes to this value take effect only at the start of a run. Item description: " + <InitItemAndEquipmentDisabling>g__GetSanitizedStringFromToken|7_8(CS$<>8__locals0.itemDef.pickupToken, ref <>c__DisplayClass7_), (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)delegate(bool newValue)
							{
								//IL_0090: Unknown result type (might be due to invalid IL or missing references)
								//IL_0015: Unknown result type (might be due to invalid IL or missing references)
								//IL_002a: Unknown result type (might be due to invalid IL or missing references)
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								//IL_0063: Unknown result type (might be due to invalid IL or missing references)
								//IL_0075: Unknown result type (might be due to invalid IL or missing references)
								//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
								//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
								//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
								//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
								//IL_011f: Unknown result type (might be due to invalid IL or missing references)
								if (!newValue)
								{
									disabledItems.Add(CS$<>8__locals0.itemDef.itemIndex, new DisabledItem
									{
										previousTier = CS$<>8__locals0.itemDef.tier,
										wasWorldUnique = CS$<>8__locals0.itemDef.ContainsTag((ItemTag)9)
									});
									CS$<>8__locals0.itemDef.tier = (ItemTier)5;
									CS$<>8__locals0.itemDef.deprecatedTier = (ItemTier)5;
									ref ItemTag[] tags = ref CS$<>8__locals0.itemDef.tags;
									ItemTag val = (ItemTag)9;
									ArrayUtils.ArrayAppend<ItemTag>(ref tags, ref val);
								}
								else if (disabledItems.ContainsKey(CS$<>8__locals0.itemDef.itemIndex))
								{
									DisabledItem disabledItem = disabledItems[CS$<>8__locals0.itemDef.itemIndex];
									CS$<>8__locals0.itemDef.tier = disabledItem.previousTier;
									CS$<>8__locals0.itemDef.deprecatedTier = disabledItem.previousTier;
									if (!disabledItem.wasWorldUnique)
									{
										ArrayUtils.ArrayRemoveAtAndResize<ItemTag>(ref CS$<>8__locals0.itemDef.tags, Array.IndexOf(CS$<>8__locals0.itemDef.tags, (ItemTag)9), 1);
									}
									disabledItems.Remove(CS$<>8__locals0.itemDef.itemIndex);
								}
							});
						}
					}
					using List<EquipmentDef>.Enumerator enumerator2 = list2.GetEnumerator();
					while (enumerator2.MoveNext())
					{
						<>c__DisplayClass7_2 CS$<>8__locals1 = new <>c__DisplayClass7_2
						{
							equipmentDef = enumerator2.Current
						};
						ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "Enabled Equipment", <InitItemAndEquipmentDisabling>g__GetSanitizedStringFromToken|7_8(CS$<>8__locals1.equipmentDef.nameToken, ref <>c__DisplayClass7_), true, "Should this equipment be enabled? Changes to this value take effect only at the start of a run. Equipment description: " + <InitItemAndEquipmentDisabling>g__GetSanitizedStringFromToken|7_8(CS$<>8__locals1.equipmentDef.pickupToken, ref <>c__DisplayClass7_), (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)delegate(bool newValue)
						{
							//IL_0080: Unknown result type (might be due to invalid IL or missing references)
							//IL_0015: Unknown result type (might be due to invalid IL or missing references)
							//IL_009a: Unknown result type (might be due to invalid IL or missing references)
							//IL_00de: Unknown result type (might be due to invalid IL or missing references)
							if (!newValue)
							{
								General.disabledEquipment.Add(CS$<>8__locals1.equipmentDef.equipmentIndex, new DisabledEquipment
								{
									appearedInSinglePlayer = CS$<>8__locals1.equipmentDef.appearsInSinglePlayer,
									appearedInMultiPlayer = CS$<>8__locals1.equipmentDef.appearsInMultiPlayer
								});
								CS$<>8__locals1.equipmentDef.canDrop = false;
								CS$<>8__locals1.equipmentDef.appearsInMultiPlayer = false;
								CS$<>8__locals1.equipmentDef.appearsInSinglePlayer = false;
							}
							else if (General.disabledEquipment.ContainsKey(CS$<>8__locals1.equipmentDef.equipmentIndex))
							{
								DisabledEquipment disabledEquipment = General.disabledEquipment[CS$<>8__locals1.equipmentDef.equipmentIndex];
								CS$<>8__locals1.equipmentDef.canDrop = true;
								CS$<>8__locals1.equipmentDef.appearsInSinglePlayer = disabledEquipment.appearedInSinglePlayer;
								CS$<>8__locals1.equipmentDef.appearsInMultiPlayer = disabledEquipment.appearedInMultiPlayer;
								General.disabledEquipment.Remove(CS$<>8__locals1.equipmentDef.equipmentIndex);
							}
						});
					}
				}

				internal ItemDef <InitItemAndEquipmentDisabling>b__7_4(FieldInfo x)
				{
					object? value = x.GetValue(null);
					return (ItemDef)((value is ItemDef) ? value : null);
				}

				internal bool <InitItemAndEquipmentDisabling>b__7_5(ItemDef x)
				{
					return !x.hidden && x.inDroppableTier;
				}

				internal EquipmentDef <InitItemAndEquipmentDisabling>b__7_6(FieldInfo x)
				{
					object? value = x.GetValue(null);
					return (EquipmentDef)((value is EquipmentDef) ? value : null);
				}

				internal bool <InitItemAndEquipmentDisabling>b__7_7(EquipmentDef x)
				{
					return x.canDrop;
				}

				internal void <.cctor>b__12_0(bool newValue)
				{
					if (onSecretsToggled != null)
					{
						onSecretsToggled(newValue);
					}
				}
			}

			[StructLayout(LayoutKind.Auto)]
			[CompilerGenerated]
			private struct <>c__DisplayClass7_0
			{
				public List<string> richTags;
			}

			[CompilerGenerated]
			private sealed class <>c__DisplayClass7_1
			{
				public ItemDef itemDef;

				internal void <InitItemAndEquipmentDisabling>b__9(bool newValue)
				{
					//IL_0090: Unknown result type (might be due to invalid IL or missing references)
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
					//IL_011f: Unknown result type (might be due to invalid IL or missing references)
					if (!newValue)
					{
						disabledItems.Add(itemDef.itemIndex, new DisabledItem
						{
							previousTier = itemDef.tier,
							wasWorldUnique = itemDef.ContainsTag((ItemTag)9)
						});
						itemDef.tier = (ItemTier)5;
						itemDef.deprecatedTier = (ItemTier)5;
						ref ItemTag[] tags = ref itemDef.tags;
						ItemTag val = (ItemTag)9;
						ArrayUtils.ArrayAppend<ItemTag>(ref tags, ref val);
					}
					else if (disabledItems.ContainsKey(itemDef.itemIndex))
					{
						DisabledItem disabledItem = disabledItems[itemDef.itemIndex];
						itemDef.tier = disabledItem.previousTier;
						itemDef.deprecatedTier = disabledItem.previousTier;
						if (!disabledItem.wasWorldUnique)
						{
							ArrayUtils.ArrayRemoveAtAndResize<ItemTag>(ref itemDef.tags, Array.IndexOf(itemDef.tags, (ItemTag)9), 1);
						}
						disabledItems.Remove(itemDef.itemIndex);
					}
				}
			}

			[CompilerGenerated]
			private sealed class <>c__DisplayClass7_2
			{
				public EquipmentDef equipmentDef;

				internal void <InitItemAndEquipmentDisabling>b__10(bool newValue)
				{
					//IL_0080: Unknown result type (might be due to invalid IL or missing references)
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					//IL_009a: Unknown result type (might be due to invalid IL or missing references)
					//IL_00de: Unknown result type (might be due to invalid IL or missing references)
					if (!newValue)
					{
						General.disabledEquipment.Add(equipmentDef.equipmentIndex, new DisabledEquipment
						{
							appearedInSinglePlayer = equipmentDef.appearsInSinglePlayer,
							appearedInMultiPlayer = equipmentDef.appearsInMultiPlayer
						});
						equipmentDef.canDrop = false;
						equipmentDef.appearsInMultiPlayer = false;
						equipmentDef.appearsInSinglePlayer = false;
					}
					else if (General.disabledEquipment.ContainsKey(equipmentDef.equipmentIndex))
					{
						DisabledEquipment disabledEquipment = General.disabledEquipment[equipmentDef.equipmentIndex];
						equipmentDef.canDrop = true;
						equipmentDef.appearsInSinglePlayer = disabledEquipment.appearedInSinglePlayer;
						equipmentDef.appearsInMultiPlayer = disabledEquipment.appearedInMultiPlayer;
						General.disabledEquipment.Remove(equipmentDef.equipmentIndex);
					}
				}
			}

			public static ConfigFile config = new ConfigFile(Paths.ConfigPath + "\\MysticsItems_General.cfg", true);

			public static string categoryName = "Mystic's Items (General)";

			public static string categoryGUID = "com.themysticsword.mysticsitems_general";

			public static ConfigurableValue<bool> secrets = ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "Misc", "Secrets", true, "Enable secret optional content", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)delegate(bool newValue)
			{
				if (onSecretsToggled != null)
				{
					onSecretsToggled(newValue);
				}
			});

			public static Action<bool> onSecretsToggled;

			public static ConfigurableValue<bool> initialCritStacking = ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "Gameplay", "Initial Crit Stacking", false, "If enabled, items that give some crit chance on the first stack (Ceremony of Perdition, Devil's Cry, etc.) will give more crit chance on each stack", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)null);

			public static Dictionary<ItemIndex, DisabledItem> disabledItems = new Dictionary<ItemIndex, DisabledItem>();

			public static Dictionary<EquipmentIndex, DisabledEquipment> disabledEquipment = new Dictionary<EquipmentIndex, DisabledEquipment>();

			internal static void Init()
			{
				InitItemAndEquipmentDisabling();
			}

			private static void InitItemAndEquipmentDisabling()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				Run.onRunSetRuleBookGlobal += delegate(Run run, RuleBook rulebook)
				{
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0023: Unknown result type (might be due to invalid IL or missing references)
					//IL_0033: Unknown result type (might be due to invalid IL or missing references)
					//IL_006a: Unknown result type (might be due to invalid IL or missing references)
					//IL_006f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_008b: Unknown result type (might be due to invalid IL or missing references)
					foreach (ItemIndex key in disabledItems.Keys)
					{
						if (run.availableItems.Contains(key))
						{
							run.availableItems.Remove(key);
						}
					}
					foreach (EquipmentIndex key2 in disabledEquipment.Keys)
					{
						if (run.availableEquipment.Contains(key2))
						{
							run.availableEquipment.Remove(key2);
						}
					}
					PickupDropTable.RegenerateAll(run);
				};
				object obj = <>c.<>9__7_1;
				if (obj == null)
				{
					hook_OnRunStartGlobal val = delegate(orig_OnRunStartGlobal orig, Run run)
					{
						orig.Invoke(run);
						if (NetworkServer.active)
						{
							EnigmaArtifactManager.validEquipment.RemoveAll((EquipmentIndex x) => disabledEquipment.ContainsKey(x));
						}
					};
					<>c.<>9__7_1 = val;
					obj = (object)val;
				}
				EnigmaArtifactManager.OnRunStartGlobal += (hook_OnRunStartGlobal)obj;
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
				{
					List<ItemDef> list = (from x in typeof(MysticsItemsContent.Items).GetFields().Select(delegate(FieldInfo x)
						{
							object? value2 = x.GetValue(null);
							return (ItemDef)((value2 is ItemDef) ? value2 : null);
						})
						where !x.hidden && x.inDroppableTier
						select x).ToList();
					List<EquipmentDef> list2 = (from x in typeof(MysticsItemsContent.Equipment).GetFields().Select(delegate(FieldInfo x)
						{
							object? value = x.GetValue(null);
							return (EquipmentDef)((value is EquipmentDef) ? value : null);
						})
						where x.canDrop
						select x).ToList();
					List<string> richTags = new List<string>
					{
						"align", "color", "alpha", "b", "i", "cspace", "font", "indent", "line-height", "line-indent",
						"link", "lowercase", "uppercase", "smallcaps", "margin", "mark", "mspace", "noparse", "nobr", "page",
						"pos", "size", "space", "sprite", "s", "u", "style", "sub", "sup", "voffset",
						"width"
					};
					foreach (ItemDef itemDef in list)
					{
						ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "Enabled Items", GetSanitizedStringFromToken(itemDef.nameToken), true, "Should this item be enabled? Changes to this value take effect only at the start of a run. Item description: " + GetSanitizedStringFromToken(itemDef.pickupToken), (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)delegate(bool newValue)
						{
							//IL_0090: Unknown result type (might be due to invalid IL or missing references)
							//IL_0015: Unknown result type (might be due to invalid IL or missing references)
							//IL_002a: Unknown result type (might be due to invalid IL or missing references)
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							//IL_0063: Unknown result type (might be due to invalid IL or missing references)
							//IL_0075: Unknown result type (might be due to invalid IL or missing references)
							//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
							//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
							//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
							//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
							//IL_011f: Unknown result type (might be due to invalid IL or missing references)
							if (!newValue)
							{
								disabledItems.Add(itemDef.itemIndex, new DisabledItem
								{
									previousTier = itemDef.tier,
									wasWorldUnique = itemDef.ContainsTag((ItemTag)9)
								});
								itemDef.tier = (ItemTier)5;
								itemDef.deprecatedTier = (ItemTier)5;
								ref ItemTag[] tags = ref itemDef.tags;
								ItemTag val2 = (ItemTag)9;
								ArrayUtils.ArrayAppend<ItemTag>(ref tags, ref val2);
							}
							else if (disabledItems.ContainsKey(itemDef.itemIndex))
							{
								DisabledItem disabledItem = disabledItems[itemDef.itemIndex];
								itemDef.tier = disabledItem.previousTier;
								itemDef.deprecatedTier = disabledItem.previousTier;
								if (!disabledItem.wasWorldUnique)
								{
									ArrayUtils.ArrayRemoveAtAndResize<ItemTag>(ref itemDef.tags, Array.IndexOf(itemDef.tags, (ItemTag)9), 1);
								}
								disabledItems.Remove(itemDef.itemIndex);
							}
						});
					}
					foreach (EquipmentDef equipmentDef in list2)
					{
						ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "Enabled Equipment", GetSanitizedStringFromToken(equipmentDef.nameToken), true, "Should this equipment be enabled? Changes to this value take effect only at the start of a run. Equipment description: " + GetSanitizedStringFromToken(equipmentDef.pickupToken), (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)delegate(bool newValue)
						{
							//IL_0080: Unknown result type (might be due to invalid IL or missing references)
							//IL_0015: Unknown result type (might be due to invalid IL or missing references)
							//IL_009a: Unknown result type (might be due to invalid IL or missing references)
							//IL_00de: Unknown result type (might be due to invalid IL or missing references)
							if (!newValue)
							{
								General.disabledEquipment.Add(equipmentDef.equipmentIndex, new DisabledEquipment
								{
									appearedInSinglePlayer = equipmentDef.appearsInSinglePlayer,
									appearedInMultiPlayer = equipmentDef.appearsInMultiPlayer
								});
								equipmentDef.canDrop = false;
								equipmentDef.appearsInMultiPlayer = false;
								equipmentDef.appearsInSinglePlayer = false;
							}
							else if (General.disabledEquipment.ContainsKey(equipmentDef.equipmentIndex))
							{
								DisabledEquipment disabledEquipment = General.disabledEquipment[equipmentDef.equipmentIndex];
								equipmentDef.canDrop = true;
								equipmentDef.appearsInSinglePlayer = disabledEquipment.appearedInSinglePlayer;
								equipmentDef.appearsInMultiPlayer = disabledEquipment.appearedInMultiPlayer;
								General.disabledEquipment.Remove(equipmentDef.equipmentIndex);
							}
						});
					}
					string GetSanitizedStringFromToken(string token)
					{
						string text = Language.english.GetLocalizedStringByToken(token);
						string text2 = "";
						bool flag = false;
						bool flag2 = false;
						while (text.Length > 0)
						{
							char c = text[0];
							switch (c)
							{
							case '<':
								foreach (string item in richTags)
								{
									if ((text.IndexOf(item, StringComparison.InvariantCulture) == 1 || text.IndexOf("/" + item, StringComparison.InvariantCulture) == 1) && text.Contains(">"))
									{
										flag = true;
										flag2 = true;
										break;
									}
								}
								break;
							case '>':
								flag = false;
								break;
							}
							if (!flag)
							{
								if (!flag2)
								{
									switch (c)
									{
									case '\t':
									case '\n':
									case '"':
									case '\'':
									case '=':
									case '[':
									case '\\':
									case ']':
										text2 += " ";
										break;
									default:
										text2 += c;
										break;
									}
								}
								flag2 = false;
							}
							text = text.Remove(0, 1);
						}
						return text2;
					}
				});
			}

			[CompilerGenerated]
			internal static string <InitItemAndEquipmentDisabling>g__GetSanitizedStringFromToken|7_8(string token, ref <>c__DisplayClass7_0 P_1)
			{
				string text = Language.english.GetLocalizedStringByToken(token);
				string text2 = "";
				bool flag = false;
				bool flag2 = false;
				while (text.Length > 0)
				{
					char c = text[0];
					switch (c)
					{
					case '<':
						foreach (string richTag in P_1.richTags)
						{
							if ((text.IndexOf(richTag, StringComparison.InvariantCulture) == 1 || text.IndexOf("/" + richTag, StringComparison.InvariantCulture) == 1) && text.Contains(">"))
							{
								flag = true;
								flag2 = true;
								break;
							}
						}
						break;
					case '>':
						flag = false;
						break;
					}
					if (!flag)
					{
						if (!flag2)
						{
							switch (c)
							{
							case '\t':
							case '\n':
							case '"':
							case '\'':
							case '=':
							case '[':
							case '\\':
							case ']':
								text2 += " ";
								break;
							default:
								text2 += c;
								break;
							}
						}
						flag2 = false;
					}
					text = text.Remove(0, 1);
				}
				return text2;
			}
		}

		public static class Balance
		{
			public static ConfigFile config = new ConfigFile(Paths.ConfigPath + "\\MysticsItems_Balance.cfg", true);

			public static string categoryName = "Mystic's Items (Balance)";

			public static string categoryGUID = "com.themysticsword.mysticsitems_balance";

			public static ConfigurableValue<bool> ignore = ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "! Important !", "Ignore Balance Config", true, "If enabled, items from this mod will use default recommended values. Otherwise, the mod will use values of your choice.", (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)null);

			public static void CreateEquipmentCooldownOption(EquipmentDef equipmentDef, string section, float defaultValue)
			{
				ConfigurableValue<float> val = null;
				val = ConfigurableValue.CreateFloat(categoryGUID, categoryName, config, section, "Cooldown", defaultValue, 0f, 1000f, "", (List<string>)null, ignore.bepinexConfigEntry, false, (Action<float>)delegate(float newValue)
				{
					if (Object.op_Implicit((Object)(object)equipmentDef))
					{
						equipmentDef.cooldown = newValue;
					}
				});
			}

			public static void CreateEquipmentEnigmaCompatibleOption(EquipmentDef equipmentDef, string section, bool defaultValue)
			{
				ConfigurableValue.CreateBool(categoryGUID, categoryName, config, section, "Enigma Compatible", defaultValue, "Can be rolled by the Artifact of Enigma", (List<string>)null, ignore.bepinexConfigEntry, false, (Action<bool>)delegate(bool newValue)
				{
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Invalid comparison between Unknown and I4
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					//IL_0081: Unknown result type (might be due to invalid IL or missing references)
					//IL_006d: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)equipmentDef))
					{
						equipmentDef.enigmaCompatible = newValue;
						List<EquipmentIndex> enigmaEquipmentList = EquipmentCatalog.enigmaEquipmentList;
						if (enigmaEquipmentList != null && (int)equipmentDef._equipmentIndex != -1)
						{
							bool flag = enigmaEquipmentList.Contains(equipmentDef.equipmentIndex);
							if (newValue != flag)
							{
								if (flag)
								{
									enigmaEquipmentList.Remove(equipmentDef.equipmentIndex);
								}
								else
								{
									enigmaEquipmentList.Add(equipmentDef.equipmentIndex);
								}
							}
						}
					}
				});
			}

			public static void CreateEquipmentCanBeRandomlyTriggeredOption(EquipmentDef equipmentDef, string section, bool defaultValue)
			{
				ConfigurableValue.CreateBool(categoryGUID, categoryName, config, section, "Can Be Randomly Triggered", defaultValue, "Can be rolled by the Bottled Chaos item from the Survivors of the Void DLC", (List<string>)null, ignore.bepinexConfigEntry, false, (Action<bool>)delegate(bool newValue)
				{
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Invalid comparison between Unknown and I4
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					//IL_0081: Unknown result type (might be due to invalid IL or missing references)
					//IL_006d: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)equipmentDef))
					{
						equipmentDef.canBeRandomlyTriggered = newValue;
						List<EquipmentIndex> randomTriggerEquipmentList = EquipmentCatalog.randomTriggerEquipmentList;
						if (randomTriggerEquipmentList != null && (int)equipmentDef._equipmentIndex != -1)
						{
							bool flag = randomTriggerEquipmentList.Contains(equipmentDef.equipmentIndex);
							if (newValue != flag)
							{
								if (flag)
								{
									randomTriggerEquipmentList.Remove(equipmentDef.equipmentIndex);
								}
								else
								{
									randomTriggerEquipmentList.Add(equipmentDef.equipmentIndex);
								}
							}
						}
					}
				});
			}
		}

		internal static void Init()
		{
			if (RiskOfOptionsDependency.enabled)
			{
				Sprite val = Main.AssetBundle.LoadAsset<Sprite>("Assets/Misc/Textures/MysticsItemsIcon.png");
				RiskOfOptionsDependency.RegisterModInfo(General.categoryGUID, General.categoryName, "General settings of Mystic's Items, a large-scale item mod", val);
				RiskOfOptionsDependency.RegisterModInfo(Balance.categoryGUID, Balance.categoryName, "Configure the values of items and equipment from Mystic's Items", val);
			}
			General.Init();
		}
	}
	public static class CustomStats
	{
		public static readonly StatDef totalDamageBlockedWithArmor = StatDef.Register("MysticsItems_totalDamageBlockedWithArmor", (StatRecordType)0, (StatDataType)0, 0.0, (DisplayValueFormatterDelegate)null);

		internal static void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GenericGameEvents.OnTakeDamage += new DamageReportEventHandler(GenericGameEvents_OnTakeDamage);
		}

		private static void GenericGameEvents_OnTakeDamage(DamageReport damageReport)
		{
			if (damageReport.damageInfo == null || damageReport.damageInfo.rejected || (Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)damageReport.victimBody.healthComponent) && damageReport.victimBody.healthComponent.ospTimer > 0f))
			{
				return;
			}
			float num = damageReport.damageInfo.damage - damageReport.damageDealt;
			if (!(num > 0f))
			{
				return;
			}
			CharacterMaster victimMaster = damageReport.victimMaster;
			if ((Object)(object)victimMaster != (Object)null)
			{
				PlayerStatsComponent playerStatsComponent = victimMaster.playerStatsComponent;
				if ((Object)(object)playerStatsComponent != (Object)null)
				{
					playerStatsComponent.currentStats.PushStatValue(totalDamageBlockedWithArmor, (ulong)num);
				}
			}
		}
	}
	internal static class DamageNumberTint
	{
		public static Color nuclearTintColor = Color32.op_Implicit(new Color32((byte)179, (byte)239, (byte)0, byte.MaxValue));

		public static Color mysticSwordTintColor = Color32.op_Implicit(new Color32((byte)244, (byte)236, (byte)80, byte.MaxValue));

		private static DamageDealtMessage damageDealtMessage;

		internal static void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			HealthComponent.HandleDamageDealt += new Manipulator(HealthComponent_HandleDamageDealt);
			DamageNumberManager.SpawnDamageNumber += new Manipulator(DamageNumberManager_SpawnDamageNumber);
		}

		private static void HealthComponent_HandleDamageDealt(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
			}))
			{
				val.EmitDelegate<Func<DamageDealtMessage, DamageDealtMessage>>((Func<DamageDealtMessage, DamageDealtMessage>)delegate(DamageDealtMessage newDamageDealtMessage)
				{
					damageDealtMessage = newDamageDealtMessage;
					return newDamageDealtMessage;
				});
			}
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchRet(x)
			}))
			{
				val.EmitDelegate<Action>((Action)delegate
				{
					damageDealtMessage = null;
				});
			}
		}

		private static void DamageNumberManager_SpawnDamageNumber(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
			}))
			{
				return;
			}
			val.EmitDelegate<Func<Color, Color>>((Func<Color, Color>)delegate(Color particleColor)
			{
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: 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_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				if (damageDealtMessage != null && (Object)(object)damageDealtMessage.attacker != (Object)null)
				{
					CharacterBody component = damageDealtMessage.attacker.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
					{
						Inventory inventory = component.inventory;
						int itemCount = inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_SpeedGivesDamage);
						if (itemCount > 0)
						{
							particleColor = Color.Lerp(particleColor, nuclearTintColor, 0.3f);
						}
						itemCount = inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_MysticSword);
						if (itemCount > 0)
						{
							particleColor = Color.Lerp(particleColor, mysticSwordTintColor, 0.3f);
						}
					}
				}
				return particleColor;
			});
		}
	}
	internal static class FunEvents
	{
		public static class ChristmasAndNewYear
		{
			public static GameObject festiveEffectsPrefab;

			public static void Init()
			{
				SceneManager.sceneLoaded += SceneManager_sceneLoaded;
			}

			private static void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode)
			{
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				if (!(((Scene)(ref scene)).name == "bazaar"))
				{
					return;
				}
				if ((Object)(object)festiveEffectsPrefab == (Object)null)
				{
					festiveEffectsPrefab = Main.AssetBundle.LoadAsset<GameObject>("Assets/Mods/Mystic's Items/Effects/FestiveStage.prefab");
					ParticleSystem[] componentsInChildren = festiveEffectsPrefab.GetComponentsInChildren<ParticleSystem>();
					foreach (ParticleSystem val in componentsInChildren)
					{
						ShapeModule shape = val.shape;
						((ShapeModule)(ref shape)).radius = 100f;
					}
				}
				Object.Instantiate<GameObject>(festiveEffectsPrefab, Vector3.zero, Quaternion.identity);
			}
		}

		public static class AprilFools
		{
			public static void Init()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				Language.GetLocalizedStringByToken += new hook_GetLocalizedStringByToken(Language_GetLocalizedStringByToken);
			}

			private static string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token)
			{
				string text = orig.Invoke(self, token);
				if (token.Contains("MYSTICSITEMS_"))
				{
					text = "<link=\"MysticsItemsAprilFools\">" + text + "</link>";
				}
				return text;
			}
		}

		public static void Init()
		{
			ConfigurableValue<bool> val = ConfigurableValue.CreateBool(ConfigManager.General.categoryGUID, ConfigManager.General.categoryName, ConfigManager.General.config, "Misc", "Fun Events", true, "Enable fun events that happen on specific dates", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<bool>)null);
			if (ConfigurableValue<bool>.op_Implicit(val))
			{
				DateTime now = DateTime.Now;
				if (now.Month == 4 && now.Day == 1)
				{
					AprilFools.Init();
				}
				if ((now.Month == 12 && now.Day >= 25) || (now.Month == 1 && now.Day <= 5))
				{
					ChristmasAndNewYear.Init();
				}
			}
		}
	}
	public static class GenericCostTypes
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static IsAffordableDelegate <>9__0_0;

			public static PayCostDelegate <>9__0_1;

			public static Action<CostTypeIndex> <>9__0_3;

			internal bool <Init>b__0_0(CostTypeDef costTypeDef2, IsAffordableContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = ((Component)context.activator).gameObject.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Inventory inventory = component.inventory;
					if (Object.op_Implicit((Object)(object)inventory))
					{
						int num = 0;
						ItemIndex val = (ItemIndex)0;
						ItemIndex val2 = (ItemIndex)ItemCatalog.itemCount;
						while (val < val2)
						{
							int itemCount = inventory.GetItemCount(val);
							if (itemCount > 0)
							{
								ItemDef itemDef = ItemCatalog.GetItemDef(val);
								if (itemDef.canRemove)
								{
									num += inventory.GetItemCount(val);
								}
							}
							val = (ItemIndex)(val + 1);
							int num2 = Mathf.FloorToInt((float)num * Mathf.Clamp01((float)context.cost / 100f));
							if (num2 > 0)
							{
								return true;
							}
						}
					}
				}
				return false;
			}

			internal void <Init>b__0_1(CostTypeDef costTypeDef2, PayCostContext context)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: 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_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: 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_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)context.activatorBody))
				{
					return;
				}
				Inventory inventory = context.activatorBody.inventory;
				if (!Object.op_Implicit((Object)(object)inventory))
				{
					return;
				}
				List<ItemIndex> itemsToTake = CollectionPool<ItemIndex, List<ItemIndex>>.RentCollection();
				WeightedSelection<ItemIndex> val = new WeightedSelection<ItemIndex>(8);
				WeightedSelection<ItemIndex> val2 = new WeightedSelection<ItemIndex>(8);
				int num = 0;
				AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator();
				try
				{
					while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
					{
						ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
						if (current == context.avoidedItemIndex)
						{
							continue;
						}
						int itemCount = inventory.GetItemCount(current);
						if (itemCount > 0)
						{
							ItemDef itemDef = ItemCatalog.GetItemDef(current);
							if (itemDef.canRemove)
							{
								(itemDef.ContainsTag((ItemTag)10) ? val2 : val).AddChoice(current, (float)itemCount);
								num += itemCount;
							}
						}
					}
				}
				finally
				{
					((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
				}
				int num2 = Mathf.FloorToInt((float)num * Mathf.Clamp01((float)context.cost / 100f));
				TakeItemsFromWeightedSelection(val2, ref context, ref itemsToTake, num2);
				TakeItemsFromWeightedSelection(val, ref context, ref itemsToTake, num2);
				for (int i = itemsToTake.Count; i < num2; i++)
				{
					itemsToTake.Add(context.avoidedItemIndex);
				}
				for (int j = 0; j < itemsToTake.Count; j++)
				{
					ItemIndex val3 = itemsToTake[j];
					context.results.itemsTaken.Add(val3);
					inventory.RemoveItem(val3, 1);
				}
				CollectionPool<ItemIndex, List<ItemIndex>>.ReturnCollection(itemsToTake);
			}

			internal void <Init>b__0_3(CostTypeIndex costTypeIndex)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if (OnItemFractionCostTypeRegister != null)
				{
					OnItemFractionCostTypeRegister(costTypeIndex);
				}
			}
		}

		public static Action<CostTypeIndex> OnItemFractionCostTypeRegister;

		public static void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			CostTypeDef costType_ItemFraction = new CostTypeDef();
			costType_ItemFraction.costStringFormatToken = "COST_MYSTICSITEMS_PERCENTAGEITEMS_FORMAT";
			CostTypeDef obj = costType_ItemFraction;
			object obj2 = <>c.<>9__0_0;
			if (obj2 == null)
			{
				IsAffordableDelegate val = delegate(CostTypeDef costTypeDef2, IsAffordableContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					//IL_0040: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					//IL_0081: Unknown result type (might be due to invalid IL or missing references)
					//IL_0084: Unknown result type (might be due to invalid IL or missing references)
					//IL_0085: Unknown result type (might be due to invalid IL or missing references)
					//IL_008a: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = ((Component)context.activator).gameObject.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Inventory inventory2 = component.inventory;
						if (Object.op_Implicit((Object)(object)inventory2))
						{
							int num3 = 0;
							ItemIndex val7 = (ItemIndex)0;
							ItemIndex val8 = (ItemIndex)ItemCatalog.itemCount;
							while (val7 < val8)
							{
								int itemCount2 = inventory2.GetItemCount(val7);
								if (itemCount2 > 0)
								{
									ItemDef itemDef2 = ItemCatalog.GetItemDef(val7);
									if (itemDef2.canRemove)
									{
										num3 += inventory2.GetItemCount(val7);
									}
								}
								val7 = (ItemIndex)(val7 + 1);
								int num4 = Mathf.FloorToInt((float)num3 * Mathf.Clamp01((float)context.cost / 100f));
								if (num4 > 0)
								{
									return true;
								}
							}
						}
					}
					return false;
				};
				<>c.<>9__0_0 = val;
				obj2 = (object)val;
			}
			obj.isAffordable = (IsAffordableDelegate)obj2;
			CostTypeDef obj3 = costType_ItemFraction;
			object obj4 = <>c.<>9__0_1;
			if (obj4 == null)
			{
				PayCostDelegate val2 = delegate(CostTypeDef costTypeDef2, PayCostContext context)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: 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_0058: Unknown result type (might be due to invalid IL or missing references)
					//IL_005d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0060: 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_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
					//IL_008a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0127: Unknown result type (might be due to invalid IL or missing references)
					//IL_0128: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
					//IL_014f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0154: Unknown result type (might be due to invalid IL or missing references)
					//IL_0156: Unknown result type (might be due to invalid IL or missing references)
					//IL_0161: Unknown result type (might be due to invalid IL or missing references)
					//IL_016a: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)context.activatorBody))
					{
						Inventory inventory = context.activatorBody.inventory;
						if (Object.op_Implicit((Object)(object)inventory))
						{
							List<ItemIndex> itemsToTake = CollectionPool<ItemIndex, List<ItemIndex>>.RentCollection();
							WeightedSelection<ItemIndex> val4 = new WeightedSelection<ItemIndex>(8);
							WeightedSelection<ItemIndex> val5 = new WeightedSelection<ItemIndex>(8);
							int num = 0;
							AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator();
							try
							{
								while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
								{
									ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
									if (current != context.avoidedItemIndex)
									{
										int itemCount = inventory.GetItemCount(current);
										if (itemCount > 0)
										{
											ItemDef itemDef = ItemCatalog.GetItemDef(current);
											if (itemDef.canRemove)
											{
												(itemDef.ContainsTag((ItemTag)10) ? val5 : val4).AddChoice(current, (float)itemCount);
												num += itemCount;
											}
										}
									}
								}
							}
							finally
							{
								((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
							}
							int num2 = Mathf.FloorToInt((float)num * Mathf.Clamp01((float)context.cost / 100f));
							TakeItemsFromWeightedSelection(val5, ref context, ref itemsToTake, num2);
							TakeItemsFromWeightedSelection(val4, ref context, ref itemsToTake, num2);
							for (int i = itemsToTake.Count; i < num2; i++)
							{
								itemsToTake.Add(context.avoidedItemIndex);
							}
							for (int j = 0; j < itemsToTake.Count; j++)
							{
								ItemIndex val6 = itemsToTake[j];
								context.results.itemsTaken.Add(val6);
								inventory.RemoveItem(val6, 1);
							}
							CollectionPool<ItemIndex, List<ItemIndex>>.ReturnCollection(itemsToTake);
						}
					}
				};
				<>c.<>9__0_1 = val2;
				obj4 = (object)val2;
			}
			obj3.payCost = (PayCostDelegate)obj4;
			costType_ItemFraction.colorIndex = (ColorIndex)1;
			CustomCostTypeInfo val3 = default(CustomCostTypeInfo);
			val3.costTypeDef = costType_ItemFraction;
			val3.onRegister = delegate(CostTypeIndex costTypeIndex)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if (OnItemFractionCostTypeRegister != null)
				{
					OnItemFractionCostTypeRegister(costTypeIndex);
				}
			};
			CostTypeCreation.CreateCostType(val3);
			Language.GetLocalizedFormattedStringByToken += (hook_GetLocalizedFormattedStringByToken)((orig_GetLocalizedFormattedStringByToken orig, Language self, string token, object[] args) => (token == costType_ItemFraction.costStringFormatToken) ? orig.Invoke(self, "COST_ITEM_FORMAT", new object[1] { args[0].ToString() + "%" }) : orig.Invoke(self, token, args));
		}

		private static void TakeItemsFromWeightedSelection(WeightedSelection<ItemIndex> weightedSelection, ref PayCostContext context, ref List<ItemIndex> itemsToTake, int halfTotalItemCount)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			while (weightedSelection.Count > 0 && itemsToTake.Count < halfTotalItemCount)
			{
				int num = weightedSelection.EvaluateToChoiceIndex(context.rng.nextNormalizedFloat);
				ChoiceInfo<ItemIndex> choice = weightedSelection.GetChoice(num);
				ItemIndex value = choice.value;
				int num2 = (int)choice.weight;
				num2--;
				if (num2 <= 0)
				{
					weightedSelection.RemoveChoice(num);
				}
				else
				{
					weightedSelection.ModifyChoiceWeight(num, (float)num2);
				}
				itemsToTake.Add(value);
			}
		}
	}
	internal static class ImageGeneration
	{
		internal class ItemTableSection
		{
			public List<ItemDef> itemDefs = null;

			public List<EquipmentDef> equipmentDefs = null;

			public Color color = default(Color);
		}

		private class ItemTableVisualSlot
		{
			public float x;

			public float y;

			internal int row;

			public Texture2D icon;

			public string name;

			public string description;

			public Color color;
		}

		public static string path = Path.Combine(Application.persistentDataPath, "MysticsItems", "ImageGeneration");

		public static HGTextMeshProUGUI notifTitleTmp;

		public static HGTextMeshProUGUI notifDescriptionTmp;

		internal static void Init()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
			}
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/NotificationPanel2.prefab").WaitForCompletion(), "MysticsRisky2Utils_NotificationPanel", false);
			notifTitleTmp = ((Component)val.transform.Find("CanvasGroup/TextArea/Title")).GetComponent<HGTextMeshProUGUI>();
			notifDescriptionTmp = ((Component)val.transform.Find("CanvasGroup/TextArea/Description")).GetComponent<HGTextMeshProUGUI>();
		}

		public static void GenerateItemTable(float padding, float columnWidth, float rowHeight, int columns, Language language, List<ItemTableSection> sections)
		{
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Expected O, but got Unknown
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//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)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Expected O, but got Unknown
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01e6: 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_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: 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_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0545: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: 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_0562: Unknown result type (might be due to invalid IL or missing references)
			float num = columnWidth / 512f;
			float num2 = rowHeight / 107f;
			int num3 = 1;
			int num4 = 1;
			int num5 = 0;
			int num6 = 0;
			List<ItemTableVisualSlot> list = new List<ItemTableVisualSlot>();
			foreach (ItemTableSection section in sections)
			{
				int num7 = ((section.itemDefs != null) ? section.itemDefs.Count : 0) + ((section.equipmentDefs != null) ? section.equipmentDefs.Count : 0);
				int num8 = 0;
				if (section.itemDefs != null)
				{
					foreach (ItemDef itemDef in section.itemDefs)
					{
						list.Add(new ItemTableVisualSlot
						{
							x = (float)(num3 - 1) * columnWidth + padding,
							row = num4,
							icon = (Texture2D)itemDef.pickupIconTexture,
							name = language.GetLocalizedStringByToken(itemDef.nameToken),
							description = language.GetLocalizedStringByToken(itemDef.pickupToken),
							color = section.color
						});
						num4++;
						num8++;
					}
				}
				if (section.equipmentDefs != null)
				{
					foreach (EquipmentDef equipmentDef in section.equipmentDefs)
					{
						list.Add(new ItemTableVisualSlot
						{
							x = (float)(num3 - 1) * columnWidth + padding,
							row = num4,
							icon = (Texture2D)equipmentDef.pickupIconTexture,
							name = language.GetLocalizedStringByToken(equipmentDef.nameToken),
							description = language.GetLocalizedStringByToken(equipmentDef.pickupToken),
							color = section.color
						});
						num4++;
						num8++;
					}
				}
				num3++;
				num4 -= num8;
				num6 = Mathf.Max(num6, num7);
				if (num3 == columns + 1)
				{
					num3 = 1;
					num4 += num6;
					num5 += num6;
					num6 = 0;
				}
			}
			num5 += num6;
			Texture2D texture = new Texture2D((int)((float)columns * columnWidth + padding * 2f), (int)((float)num5 * rowHeight + padding * 2f), (TextureFormat)5, false);
			for (int i = 0; i < ((Texture)texture).width; i++)
			{
				for (int j = 0; j < ((Texture)texture).height; j++)
				{
					texture.SetPixel(i, j, Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)30)));
				}
			}
			for (int k = (int)padding; (float)k < (float)((Texture)texture).width - padding; k++)
			{
				for (int l = (int)padding; (float)l < (float)((Texture)texture).height - padding; l++)
				{
					texture.SetPixel(k, l, Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)80)));
				}
			}
			foreach (ItemTableVisualSlot item in list)
			{
				ItemTableVisualSlot visualSlot = item;
				visualSlot.y = (float)(-visualSlot.row) * rowHeight - padding;
				Texture2D val = new Texture2D((int)rowHeight, (int)rowHeight, (TextureFormat)5, false);
				Graphics.ConvertTexture((Texture)(object)visualSlot.icon, (Texture)(object)val);
				RenderTexture renderTexture = RenderTexture.GetTemporary(((Texture)val).width, ((Texture)val).height, 24, (RenderTextureFormat)0);
				renderTexture.Create();
				RenderTexture.active = renderTexture;
				Graphics.Blit((Texture)(object)val, renderTexture);
				val.ReadPixels(new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), 0, 0);
				val.Apply();
				RenderTexture.active = null;
				RenderTexture.ReleaseTemporary(renderTexture);
				for (int m = 0; m < ((Texture)val).width; m++)
				{
					for (int n = 0; n < ((Texture)val).height; n++)
					{
						Color pixel = texture.GetPixel(m + (int)visualSlot.x, n + (int)visualSlot.y);
						Color pixel2 = val.GetPixel(m, n);
						texture.SetPixel(m + (int)visualSlot.x, n + (int)visualSlot.y, new Color(pixel.r * (1f - pixel2.a) + pixel2.r * pixel2.a, pixel.g * (1f - pixel2.a) + pixel2.g * pixel2.a, pixel.b * (1f - pixel2.a) + pixel2.b * pixel2.a, Mathf.Clamp01(pixel.a + pixel2.a)));
					}
				}
				DrawText(visualSlot.name, visualSlot.color, (float)((Texture)val).width + 10f * num, 10f * num2, notifTitleTmp);
				DrawText(visualSlot.description, ((Graphic)notifDescriptionTmp).color, (float)((Texture)val).width + 10f * num, 42f * num2, notifDescriptionTmp);
				void DrawText(string text, Color color, float tx, float ty, HGTextMeshProUGUI notifTmp)
				{
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_0019: Expected O, but got Unknown
					//IL_001e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0024: Expected O, but got Unknown
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0073: Unknown result type (might be due to invalid IL or missing references)
					//IL_0089: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
					//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
					//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
					//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
					//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
					//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f3: 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_0209: Unknown result type (might be due to invalid IL or missing references)
					//IL_0210: Unknown result type (might be due to invalid IL or missing references)
					//IL_0218: Unknown result type (might be due to invalid IL or missing references)
					//IL_022a: Unknown result type (might be due to invalid IL or missing references)
					//IL_022f: Unknown result type (might be due to invalid IL or missing references)
					//IL_026c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0290: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
					//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
					//IL_0353: 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_035f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0364: Unknown result type (might be due to invalid IL or missing references)
					//IL_038d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0399: Unknown result type (might be due to invalid IL or missing references)
					//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
					//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
					//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
					//IL_03be: Unknown result type (might be due to invalid IL or missing references)
					//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
					//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
					//IL_03d7: 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_03ec: Unknown result type (might be due to invalid IL or missing references)
					//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
					//IL_03fc: 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_0410: Unknown result type (might be due to invalid IL or missing references)
					Texture2D val2 = new Texture2D((int)columnWidth, (int)rowHeight, (TextureFormat)5, false);
					GameObject val3 = new GameObject("TMPObject");
					TextMeshPro val4 = val3.AddComponent<TextMeshPro>();
					((TMP_Text)val4).rectTransform.pivot = new Vector2(0f, 1f);
					((TMP_Text)val4).rectTransform.SetSizeWithCurrentAnchors((Axis)0, 30f);
					((TMP_Text)val4).rectTransform.SetSizeWithCurrentAnchors((Axis)1, 30f);
					((TMP_Text)val4).text = text;
					((Graphic)val4).color = color;
					((TMP_Text)val4).font = HGTextMeshProUGUI.defaultLanguageFont;
					((TMP_Text)val4).fontStyle = ((TMP_Text)notifTmp).fontStyle;
					((TMP_Text)val4).lineSpacing = ((TMP_Text)notifTmp).lineSpacing;
					((TMP_Text)val4).characterSpacing = ((TMP_Text)notifTmp).characterSpacing;
					((TMP_Text)val4).enableKerning = ((TMP_Text)notifTmp).enableKerning;
					((TMP_Text)val4).enableWordWrapping = ((TMP_Text)notifTmp).enableWordWrapping;
					((TMP_Text)val4).overflowMode = ((TMP_Text)notifTmp).overflowMode;
					((TMP_Text)val4).alignment = (TextAlignmentOptions)257;
					((TMP_Text)val4).fontSize = ((TMP_Text)notifTmp).fontSize;
					((TMP_Text)val4).autoSizeTextContainer = ((TMP_Text)notifTmp).autoSizeTextContainer;
					((TMP_Text)val4).enableAutoSizing = ((TMP_Text)notifTmp).enableAutoSizing;
					((TMP_Text)val4).ClearMesh(false);
					((TMP_Text)val4).ForceMeshUpdate(false, false);
					Material fontMaterial = ((TMP_Text)val4).fontMaterial;
					float num9 = 18f;
					float num10 = (float)((Texture)val2).width / (float)((Texture)val2).height;
					Vector2 val5 = default(Vector2);
					((Vector2)(ref val5))..ctor(num9 * num10 * 0.5f, num9 * 0.5f);
					Vector2 val6 = default(Vector2);
					((Vector2)(ref val6))..ctor(0.5f, 0.5f);
					Vector2 val7 = default(Vector2);
					((Vector2)(ref val7))..ctor(((float)((Texture)val2).width / 2f - tx) / (float)((Texture)val2).width * num9 * num10, (0f - ((float)((Texture)val2).height / 2f - ty)) / (float)((Texture)val2).height * num9);
					val7 *= 0.5f;
					Matrix4x4 val8 = Matrix4x4.Ortho(val5.x * (val6.x - 1f) + val7.x, val5.x * val6.x + val7.x, val5.y * (val6.y - 1f) + val7.y, val5.y * val6.y + val7.y, -1f, 1f);
					renderTexture = RenderTexture.GetTemporary(((Texture)val2).width, ((Texture)val2).height, 24, (RenderTextureFormat)0);
					renderTexture.Create();
					Graphics.SetRenderTarget(renderTexture);
					GL.PushMatrix();
					GL.LoadProjectionMatrix(val8);
					GL.LoadIdentity();
					GL.Clear(false, true, new Color(0f, 0f, 0f, 0f));
					val4.renderer.material.SetPass(0);
					Graphics.DrawMeshNow(((TMP_Text)val4).mesh, Matrix4x4.identity);
					RenderTexture.active = renderTexture;
					val2.ReadPixels(new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), 0, 0, false);
					val2.Apply(false);
					GL.PopMatrix();
					RenderTexture.active = null;
					RenderTexture.ReleaseTemporary(renderTexture);
					Object.Destroy((Object)(object)val3);
					for (int num11 = 0; num11 < ((Texture)val2).width; num11++)
					{
						for (int num12 = 0; num12 < ((Texture)val2).height; num12++)
						{
							Color pixel3 = texture.GetPixel(num11 + (int)visualSlot.x, num12 + (int)visualSlot.y);
							Color pixel4 = val2.GetPixel(num11, num12);
							texture.SetPixel(num11 + (int)visualSlot.x, num12 + (int)visualSlot.y, new Color(pixel3.r * (1f - pixel4.a) + pixel4.r * pixel4.a, pixel3.g * (1f - pixel4.a) + pixel4.g * pixel4.a, pixel3.b * (1f - pixel4.a) + pixel4.b * pixel4.a, Mathf.Clamp01(pixel3.a + pixel4.a)));
						}
					}
				}
			}
			texture.Apply();
			File.WriteAllBytes(Path.Combine(path, "ItemTable.png"), ImageConversion.EncodeToPNG(texture));
		}
	}
	public static class LegacyBalanceConfigManager
	{
		public class ConfigurableValue<T> : ConfigurableValue<T>
		{
			public ConfigurableValue(string section, string key, float defaultValue, string description = "", List<string> stringsToAffect = null, Action<float> onChanged = null)
				: base(ConfigManager.Balance.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, (Action<T>)null)
			{
				ConfigurableValue.CreateFloat(ConfigManager.Balance.categoryGUID, ConfigManager.Balance.categoryName, ConfigManager.Balance.config, section, key, defaultValue, 0f, 1000000f, description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, onChanged);
			}

			public ConfigurableValue(string section, string key, int defaultValue, string description = "", List<string> stringsToAffect = null, Action<int> onChanged = null)
				: base(ConfigManager.Balance.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, (Action<T>)null)
			{
				ConfigurableValue.CreateInt(ConfigManager.Balance.categoryGUID, ConfigManager.Balance.categoryName, ConfigManager.Balance.config, section, key, defaultValue, 0, 1000000, description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, onChanged);
			}

			public ConfigurableValue(string section, string key, bool defaultValue, string description = "", List<string> stringsToAffect = null, Action<bool> onChanged = null)
				: base(ConfigManager.Balance.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, (Action<T>)null)
			{
				ConfigurableValue.CreateBool(ConfigManager.Balance.categoryGUID, ConfigManager.Balance.categoryName, ConfigManager.Balance.config, section, key, defaultValue, description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, onChanged);
			}

			public ConfigurableValue(string section, string key, string defaultValue, string description = "", List<string> stringsToAffect = null, Action<string> onChanged = null)
				: base(ConfigManager.Balance.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, (Action<T>)null)
			{
				ConfigurableValue.CreateString(ConfigManager.Balance.categoryGUID, ConfigManager.Balance.categoryName, ConfigManager.Balance.config, section, key, defaultValue, description, stringsToAffect, ConfigManager.Balance.ignore.bepinexConfigEntry, false, onChanged);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.themysticsword.mysticsitems", "MysticsItems", "2.1.14")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class MysticsItemsPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.themysticsword.mysticsitems";

		public const string PluginName = "MysticsItems";

		public const string PluginVersion = "2.1.14";

		internal static ManualLogSource logger;

		internal static PluginInfo pluginInfo;

		public void Awake()
		{
			logger = ((BaseUnityPlugin)this).Logger;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Main.Init();
		}
	}
	public static class Main
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static CollectContentPackProvidersDelegate <>9__8_0;

			internal void <Init>b__8_0(AddContentPackProviderDelegate addContentPackProvider)
			{
				addContentPackProvider.Invoke((IContentPackProvider)(object)new MysticsItemsContent());
			}
		}

		private static AssetBundle _assetBundle;

		internal const BindingFlags bindingFlagAll = (BindingFlags)(-1);

		internal static ManualLogSource logger;

		internal static bool isDedicatedServer = Application.isBatchMode;

		public static Assembly executingAssembly;

		internal static Type declaringType;

		public static AssetBundle AssetBundle
		{
			get
			{
				if ((Object)(object)_assetBundle == (Object)null)
				{
					_assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(MysticsItemsPlugin.pluginInfo.Location), "mysticsitemsunityassetbundle"));
				}
				return _assetBundle;
			}
		}

		public static void Init()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			logger = MysticsItemsPlugin.logger;
			ConfigManager.Init();
			SoundBanks.Add(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(MysticsItemsPlugin.pluginInfo.Location), "MysticsItemsWwiseSoundbank.bnk")));
			executingAssembly = Assembly.GetExecutingAssembly();
			declaringType = MethodBase.GetCurrentMethod().DeclaringType;
			CustomStats.Init();
			DamageNumberTint.Init();
			GenericCostTypes.Init();
			NetworkPickupDiscovery.Init();
			SoftDependenciesCore.Init();
			TMProEffects.Init();
			ContentLoadHelper.PluginAwakeLoad<BaseItem>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseEquipment>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseBuff>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseInteractable>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseCharacterBody>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseCharacterMaster>(executingAssembly);
			object obj = <>c.<>9__8_0;
			if (obj == null)
			{
				CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate addContentPackProvider)
				{
					addContentPackProvider.Invoke((IContentPackProvider)(object)new MysticsItemsContent());
				};
				<>c.<>9__8_0 = val;
				obj = (object)val;
			}
			ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
			UpdateFirstLaunchManager.Init();
			FunEvents.Init();
		}
	}
	public class MysticsItemsContent : IContentPackProvider
	{
		public static class Resources
		{
			public static List<GameObject> bodyPrefabs = new List<GameObject>();

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

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

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

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

			public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

			public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

			public static List<Type> entityStateTypes = new List<Type>();

			public static List<SkillDef> skillDefs = new List<SkillDef>();

			public static List<SkillFamily> skillFamilies = new List<SkillFamily>();
		}

		public static class Items
		{
			public static ItemDef MysticsItems_AllyDeathRevenge;

			public static ItemDef MysticsItems_BackArmor;

			public static ItemDef MysticsItems_Backpack;

			public static ItemDef MysticsItems_CoffeeBoostOnItemPickup;

			public static ItemDef MysticsItems_Cookie;

			public static ItemDef MysticsItems_CrystalWorld;

			public static ItemDef MysticsItems_DasherDisc;

			public static ItemDef MysticsItems_DeathCeremony;

			public static ItemDef MysticsItems_DroneWires;

			public static ItemDef MysticsItems_ElitePotion;

			public static ItemDef MysticsItems_ExplosivePickups;

			public static ItemDef MysticsItems_ExtraShrineUse;

			public static ItemDef MysticsItems_HealOrbOnBarrel;

			public static ItemDef MysticsItems_Idol;

			public static ItemDef MysticsItems_JudgementCut;

			public static ItemDef MysticsItems_KeepShopTerminalOpen;

			public static ItemDef MysticsItems_KeepShopTerminalOpenConsumed;

			public static ItemDef MysticsItems_LimitedArmor;

			public static ItemDef MysticsItems_LimitedArmorBroken;

			public static ItemDef MysticsItems_Manuscript;

			public static ItemDef MysticsItems_MarwanAsh1;

			public static ItemDef MysticsItems_MarwanAsh2;

			public static ItemDef MysticsItems_MarwanAsh3;

			public static ItemDef MysticsItems_Moonglasses;

			public static ItemDef MysticsItems_MysticSword;

			public static ItemDef MysticsItems_RegenAndDifficultySpeed;

			public static ItemDef MysticsItems_Rhythm;

			public static ItemDef MysticsItems_RiftLens;

			public static ItemDef MysticsItems_RiftLensDebuff;

			public static ItemDef MysticsItems_ScratchTicket;

			public static ItemDef MysticsItems_SpeedGivesDamage;

			public static ItemDef MysticsItems_Spotter;

			public static ItemDef MysticsItems_ThoughtProcessor;

			public static ItemDef MysticsItems_TreasureMap;

			public static ItemDef MysticsItems_Voltmeter;

			public static ItemDef MysticsItems_VyraelCommandments;

			public static ItemDef MysticsItems_GachaponToken;

			public static ItemDef MysticsItems_Nanomachines;

			public static ItemDef MysticsItems_ShieldUpgrade;

			public static ItemDef MysticsItems_BuffInTPRange;

			public static ItemDef MysticsItems_StarBook;

			public static ItemDef MysticsItems_TimePiece;

			public static ItemDef MysticsItems_Flow;

			public static ItemDef MysticsItems_GhostApple;

			public static ItemDef MysticsItems_GhostAppleWeak;

			public static ItemDef MysticsItems_SnowRing;
		}

		public static class Equipment
		{
			public static EquipmentDef MysticsItems_ArchaicMask;

			public static EquipmentDef MysticsItems_FragileMask;

			public static EquipmentDef MysticsItems_GateChalice;

			public static EquipmentDef MysticsItems_Microphone;

			public static EquipmentDef MysticsItems_MechanicalArm;

			public static EquipmentDef MysticsItems_OmarHackTool;

			public static EquipmentDef MysticsItems_PrinterHacker;

			public static EquipmentDef MysticsItems_SirenPole;

			public static EquipmentDef MysticsItems_TuningFork;

			public static EquipmentDef MysticsItems_EquipmentEater;
		}

		public static class Buffs
		{
			public static BuffDef MysticsItems_AllyDeathRevenge;

			public static BuffDef MysticsItems_CoffeeBoost;

			public static BuffDef MysticsItems_Crystallized;

			public static BuffDef MysticsItems_DasherDiscActive;

			public static BuffDef MysticsItems_DasherDiscCooldown;

			public static BuffDef MysticsItems_Deafened;

			public static BuffDef MysticsItems_MarwanAshBurn;

			public static BuffDef MysticsItems_MarwanAshBurnStrong;

			public static BuffDef MysticsItems_MechanicalArmCharge;

			public static BuffDef MysticsItems_SpotterMarked;

			public static BuffDef MysticsItems_GachaponBonus;

			public static BuffDef MysticsItems_NanomachineArmor;

			public static BuffDef MysticsItems_BuffInTPRange;

			public static BuffDef MysticsItems_StarPickup;

			public static BuffDef MysticsItems_TimePieceSlow;
		}

		private ContentPack contentPack = new ContentPack();

		public string identifier => "MysticsItems";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			ContentLoadHelper contentLoadHelper = new ContentLoadHelper();
			Action[] loadDispatchers = new Action[6]
			{
				delegate
				{
					contentLoadHelper.DispatchLoad<ItemDef>(Main.executingAssembly, typeof(BaseItem), (Action<ItemDef[]>)delegate(ItemDef[] x)
					{
						contentPack.itemDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<EquipmentDef>(Main.executingAssembly, typeof(BaseEquipment), (Action<EquipmentDef[]>)delegate(EquipmentDef[] x)
					{
						contentPack.equipmentDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<BuffDef>(Main.executingAssembly, typeof(BaseBuff), (Action<BuffDef[]>)delegate(BuffDef[] x)
					{
						contentPack.buffDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(Main.executingAssembly, typeof(BaseInteractable), (Action<GameObject[]>)null);
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(Main.executingAssembly, typeof(BaseCharacterBody), (Action<GameObject[]>)delegate(GameObject[] x)
					{
						contentPack.bodyPrefabs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(Main.executingAssembly, typeof(BaseCharacterMaster), (Action<GameObject[]>)delegate(GameObject[] x)
					{
						contentPack.masterPrefabs.Add(x);
					});
				}
			};
			int i = 0;
			while (i < loadDispatchers.Length)
			{
				loadDispatchers[i]();
				args.ReportProgress(Util.Remap((float)(i + 1), 0f, (float)loadDispatchers.Length, 0f, 0.05f));
				yield return null;
				int num = i + 1;
				i = num;
			}
			while (contentLoadHelper.coroutine.MoveNext())
			{
				args.ReportProgress(Util.Remap(contentLoadHelper.progress.value, 0f, 1f, 0.05f, 0.9f));
				yield return contentLoadHelper.coroutine.Current;
			}
			loadDispatchers = new Action[13]
			{
				delegate
				{
					ContentLoadHelper.PopulateTypeFields<ItemDef>(typeof(Items), contentPack.itemDefs, (Func<string, string>)null);
				},
				delegate
				{
					ContentLoadHelper.PopulateTypeFields<EquipmentDef>(typeof(Equipment), contentPack.equipmentDefs, (Func<string, string>)null);
				},
				delegate
				{
					ContentLoadHelper.PopulateTypeFields<BuffDef>(typeof(Buffs), contentPack.buffDefs, (Func<string, string>)null);
				},
				delegate
				{
					contentPack.bodyPrefabs.Add(Resources.bodyPrefabs.ToArray());
				},
				delegate
				{
					contentPack.masterPrefabs.Add(Resources.masterPrefabs.ToArray());
				},
				delegate
				{
					contentPack.projectilePrefabs.Add(Resources.projectilePrefabs.ToArray());
				},
				delegate
				{
					contentPack.effectDefs.Add(Resources.effectPrefabs.ConvertAll((Converter<GameObject, EffectDef>)((GameObject x) => new EffectDef(x))).ToArray());
				},
				delegate
				{
					contentPack.networkedObjectPrefabs.Add(Resources.networkedObjectPrefabs.ToArray());
				},
				delegate
				{
					contentPack.networkSoundEventDefs.Add(Resources.networkSoundEventDefs.ToArray());
				},
				delegate
				{
					contentPack.unlockableDefs.Add(Resources.unlockableDefs.ToArray());
				},
				delegate
				{
					contentPack.entityStateTypes.Add(Resources.entityStateTypes.ToArray());
				},
				delegate
				{
					contentPack.skillDefs.Add(Resources.skillDefs.ToArray());
				},
				delegate
				{
					contentPack.skillFamilies.Add(Resources.skillFamilies.ToArray());
				}
			};
			int j = 0;
			while (j < loadDispatchers.Length)
			{
				loadDispatchers[j]();
				args.ReportProgress(Util.Remap((float)(j + 1), 0f, (float)loadDispatchers.Length, 0.9f, 0.95f));
				yield return null;
				int num = j + 1;
				j = num;
			}
			loadDispatchers = new Action[6]
			{
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseItem>(Main.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseEquipment>(Main.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseBuff>(Main.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseInteractable>(Main.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseCharacterBody>(Main.executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseCharacterMaster>(Main.executingAssembly);
				}
			};
			int k = 0;
			while (k < loadDispatchers.Length)
			{
				loadDispatchers[k]();
				args.ReportProgress(Util.Remap((float)(k + 1), 0f, (float)loadDispatchers.Length, 0.95f, 0.99f));
				yield return null;
				int num = k + 1;
				k = num;
			}
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public static class NetworkPickupDiscovery
	{
		private class SyncDiscoverPickup : INetMessage, ISerializableObject
		{
			private NetworkInstanceId objID;

			private int pickupIndex;

			public SyncDiscoverPickup()
			{
			}

			public SyncDiscoverPickup(NetworkInstanceId objID, int pickupIndex)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.objID = objID;
				this.pickupIndex = pickupIndex;
			}

			public void Deserialize(NetworkReader reader)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				objID = reader.ReadNetworkId();
				pickupIndex = reader.ReadInt32();
			}

			public void OnReceived()
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Util.FindNetworkObject(objID);
				if (!Object.op_Implicit((Object)(object)val))
				{
					return;
				}
				CharacterMaster component = val.GetComponent<CharacterMaster>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				PlayerCharacterMasterController component2 = ((Component)component).GetComponent<PlayerCharacterMasterController>();
				if (!Object.op_Implicit((Object)(object)component2))
				{
					return;
				}
				NetworkUser networkUser = component2.networkUser;
				if (Object.op_Implicit((Object)(object)networkUser))
				{
					LocalUser localUser = networkUser.localUser;
					if (localUser != null)
					{
						localUser.userProfile.DiscoverPickup(new PickupIndex(pickupIndex));
					}
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(objID);
				writer.Write(pickupIndex);
			}
		}

		internal static void Init()
		{
			NetworkingAPI.RegisterMessageType<SyncDiscoverPickup>();
		}

		public static void DiscoverPickup(CharacterMaster master, PickupIndex pickupIndex)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				NetMessageExtensions.Send((INetMessage)(object)new SyncDiscoverPickup(((Component)master).GetComponent<NetworkIdentity>().netId, pickupIndex.value), (NetworkDestination)1);
			}
		}
	}
	public static class OtherModCompat
	{
		public static void ExplosivePickups_TryExplode(CharacterBody body)
		{
			ExplosivePickups.Explode(body);
		}

		public static void ElitePotion_AddSpreadEffect(BuffDef eliteBuffDef, GameObject vfx = null, BuffDef debuff = null, DotIndex dot = -1, float damage = 0f, float procCoefficient = 0f, DamageType damageType = 0u)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			ElitePotion.spreadEffectInfos.Add(new ElitePotion.SpreadEffectInfo
			{
				eliteBuffDef = eliteBuffDef,
				vfx = vfx,
				debuff = debuff,
				dot = dot,
				damage = damage,
				procCoefficient = procCoefficient,
				damageType = damageType
			});
		}

		public static void ElitePotion_AddSpreadEffect(BuffDef eliteBuffDef, GameObject vfx = null, BuffDef debuff = null, DotIndex dot = -1, float damage = 0f, float procCoefficient = 0f, ModdedDamageType moddedDamageType = -1)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			ElitePotion.spreadEffectInfos.Add(new ElitePotion.SpreadEffectInfo
			{
				eliteBuffDef = eliteBuffDef,
				vfx = vfx,
				debuff = debuff,
				dot = dot,
				damage = damage,
				procCoefficient = procCoefficient,
				moddedDamageType = moddedDamageType
			});
		}
	}
	public static class TMProEffects
	{
		public class MysticsItemsTextEffects : MonoBehaviour
		{
			public TMP_Text textComponent;

			public bool textChanged;

			public TMP_MeshInfo[] cachedMeshInfo;

			public float updateTimer = 0f;

			public float updateFrequency = 0.016f;

			public float currentTime = 0f;

			public void Awake()
			{
				textComponent = ((Component)this).GetComponent<TMP_Text>();
				textChanged = true;
			}

			public void Start()
			{
				if (Object.op_Implicit((Object)(object)textComponent) && ((Behaviour)textComponent).isActiveAndEnabled)
				{
					textComponent.ForceMeshUpdate(false, false);
				}
			}

			public void OnEnable()
			{
				TMPro_EventManager.TEXT_CHANGED_EVENT.Add((Action<Object>)ON_TEXT_CHANGED);
			}

			public void OnDisable()
			{
				TMPro_EventManager.TEXT_CHANGED_EVENT.Remove((Action<Object>)ON_TEXT_CHANGED);
			}

			public void ON_TEXT_CHANGED(Object obj)
			{
				if (obj == (Object)(object)textComponent)
				{
					textChanged = true;
				}
			}

			public void Update()
			{
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Expected O, but got Unknown
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_013f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0301: Unknown result type (might be due to invalid IL or missing references)
				//IL_0303: Unknown result type (might be due to invalid IL or missing references)
				//IL_030a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0317: Unknown result type (might be due to invalid IL or missing references)
				//IL_031e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0331: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_0190: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_021c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0221: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_022f: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0245: Unknown result type (might be due to invalid IL or missing references)
				//IL_024a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0274: Unknown result type (might be due to invalid IL or missing references)
				//IL_0281: Unknown result type (might be due to invalid IL or missing references)
				//IL_0286: Unknown result type (might be due to invalid IL or missing references)
				//IL_028b: Unknown result type (might be due to invalid IL or missing references)
				currentTime += Time.deltaTime;
				updateTimer -= Time.deltaTime;
				while (updateTimer <= 0f)
				{
					updateTimer += updateFrequency;
					if (!Object.op_Implicit((Object)(object)textComponent) || !((Behaviour)textComponent).isActiveAndEnabled)
					{
						continue;
					}
					TMP_TextInfo textInfo = textComponent.textInfo;
					if (textInfo == null || textInfo.meshInfo == null || textInfo.meshInfo.Length == 0 || textInfo.meshInfo[0].vertices == null)
					{
						break;
					}
					if (textChanged)
					{
						textChanged = false;
						cachedMeshInfo = textInfo.CopyMeshInfoVertexData();
						currentTime = 0f;
					}
					bool flag = false;
					Xoroshiro128Plus val = new Xoroshiro128Plus(4923495uL);
					float num = easeInOutBack(Mathf.Clamp01(currentTime));
					for (int i = 0; i < textInfo.linkCount; i++)
					{
						TMP_LinkInfo val2 = textInfo.linkInfo[i];
						if (!(((TMP_LinkInfo)(ref val2)).GetLinkID() == "MysticsItemsAprilFools"))
						{
							continue;
						}
						for (int j = val2.linkTextfirstCharacterIndex; j < val2.linkTextfirstCharacterIndex + val2.linkTextLength; j++)
						{
							TMP_CharacterInfo val3 = textInfo.characterInfo[j];
							if (val3.isVisible)
							{
								flag = true;
								Vector3[] vertices = cachedMeshInfo[val3.materialReferenceIndex].vertices;
								Color32[] colors = cachedMeshInfo[val3.materialReferenceIndex].colors32;
								Vector3[] vertices2 = textInfo.meshInfo[val3.materialReferenceIndex].vertices;
								Color32[] colors2 = textInfo.meshInfo[val3.materialReferenceIndex].colors32;
								Vector3 val4 = new Vector3(val.RangeFloat(-8f, 8f), val.RangeFloat(-8f, 8f), 0f) * num * val3.scale;
								for (int k = 0; k <= 3; k++)
								{
									vertices2[val3.vertexIndex + k] = vertices[val3.vertexIndex + k] + val4;
									colors2[val3.vertexIndex + k] = Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(colors[val3.vertexIndex + k]), Color.HSVToRGB((Time.time * 0.15f + 0.06f * (float)j) % 1f, 1f, 1f), 0.2f * num));
								}
							}
						}
					}
					if (flag)
					{
						for (int l = 0; l < textInfo.meshInfo.Length; l++)
						{
							TMP_MeshInfo val5 = textInfo.meshInfo[l];
							val5.mesh.vertices = val5.vertices;
							val5.mesh.colors32 = val5.colors32;
							textComponent.UpdateGeometry(val5.mesh, l);
							textComponent.UpdateVertexData((TMP_VertexDataUpdateFlags)16);
						}
					}
				}
				static float easeInOutBack(float x)
				{
					float num2 = 1.70158f;
					float num3 = num2 * 1.525f;
					return (x < 0.5f) ? (Mathf.Pow(2f * x, 2f) * ((num3 + 1f) * 2f * x - num3) / 2f) : ((Mathf.Pow(2f * x - 2f, 2f) * ((num3 + 1f) * (x * 2f - 2f) + num3) + 2f) / 2f);
				}
			}
		}

		public static void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			ChatBox.Start += new hook_Start(ChatBox_Start);
			HGTextMeshProUGUI.Awake += new hook_Awake(HGTextMeshProUGUI_Awake);
		}

		private static void ChatBox_Start(orig_Start orig, ChatBox self)
		{
			orig.Invoke(self);
			MysticsItemsTextEffects component = ((Component)self.messagesText.textComponent).GetComponent<MysticsItemsTextEffects>();
			if (!Object.op_Impli