Decompiled source of RealerMysticsBadItems v1.3.0

plugins/RealerMysticsBadItems/RealerMysticsBadItems.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Scrapper;
using HG;
using HG.Reflection;
using LookingGlass.ItemStatsNameSpace;
using Microsoft.CodeAnalysis;
using MysticsRisky2Utils;
using MysticsRisky2Utils.BaseAssetTypes;
using MysticsRisky2Utils.ContentManagement;
using MysticsRisky2Utils.SoftDependencies;
using On.EntityStates.Scrapper;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RealerMysticsBadItems.Buffs;
using RealerMysticsBadItems.SoftDependencies;
using RoR2;
using RoR2.Artifacts;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RealerMysticsBadItems")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c988079955e49d627ea90ee7f89be9a0c0585f20")]
[assembly: AssemblyProduct("RealerMysticsBadItems")]
[assembly: AssemblyTitle("RealerMysticsBadItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RealerMysticsBadItems
{
	public static class ConfigManager
	{
		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 Func<Type, bool> <>9__12_2;

			public static Func<Type, string> <>9__12_0;

			public static Func<Type, bool> <>9__12_1;

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

			public static Predicate<EquipmentIndex> <>9__13_3;

			public static hook_OnRunStartGlobal <>9__13_1;

			public static Action <>9__13_2;

			internal bool <InitContentLoadFilter>b__12_2(Type x)
			{
				return !x.IsAbstract;
			}

			internal string <InitContentLoadFilter>b__12_0(Type x)
			{
				return x.Name;
			}

			internal bool <InitContentLoadFilter>b__12_1(Type type)
			{
				return !unloadedContent.Contains(type);
			}

			internal void <InitItemAndEquipmentDisabling>b__13_0(Run run, RuleBook rulebook)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: 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__13_1(orig_OnRunStartGlobal orig, Run run)
			{
				orig.Invoke(run);
				if (NetworkServer.active)
				{
					EnigmaArtifactManager.validEquipment.RemoveAll((EquipmentIndex x) => disabledEquipment.ContainsKey(x));
				}
			}

			internal bool <InitItemAndEquipmentDisabling>b__13_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__13_2()
			{
				foreach (KeyValuePair<Type, ConfigurableValue<bool>> enabledOption in enabledOptions)
				{
					ApplyEnabled(enabledOption.Key, enabledOption.Value.Value);
				}
			}
		}

		public static string categoryName = "Mystic's Bad Items";

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

		private static Dictionary<string, string[]> dependentContent = new Dictionary<string, string[]> { 
		{
			"Rhythm",
			new string[1] { "RhythmCombo" }
		} };

		public static HashSet<Type> unloadedContent = new HashSet<Type>();

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

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

		private static Dictionary<Type, ConfigurableValue<bool>> enabledOptions = new Dictionary<Type, ConfigurableValue<bool>>();

		public static ConfigFile config => ((BaseUnityPlugin)Main.Instance).Config;

		internal static void Init()
		{
			if (RiskOfOptionsDependency.enabled)
			{
				RiskOfOptionsDependency.RegisterModInfo(categoryGUID, categoryName, "Settings of Mystic's Bad Items, a collection of nigh-useless items", (Sprite)null);
			}
			InitContentLoadFilter();
			InitItemAndEquipmentDisabling();
		}

		private static void InitContentLoadFilter()
		{
			Type[] assemblyTypes = ContentLoadHelper.GetAssemblyTypes(Main.executingAssembly);
			foreach (Type item in assemblyTypes.Where((Type x) => !x.IsAbstract))
			{
				string text;
				string contentType;
				string text2;
				if (typeof(BaseItem).IsAssignableFrom(item))
				{
					text = "Enabled Items";
					text2 = "ITEM_MYSTICSBADITEMS_";
					contentType = "item";
				}
				else
				{
					if (!typeof(BaseEquipment).IsAssignableFrom(item))
					{
						continue;
					}
					text = "Enabled Equipment";
					text2 = "EQUIPMENT_MYSTICSBADITEMS_";
					contentType = "equipment";
				}
				text2 += item.Name.ToUpperInvariant();
				if (!Main.englishStrings.TryGetValue(text2 + "_NAME", out var value))
				{
					continue;
				}
				Main.englishStrings.TryGetValue(text2 + "_PICKUP", out var value2);
				Type contentTypeCopy = item;
				ConfigurableValue<bool> val = ConfigurableValue.CreateBool(categoryGUID, categoryName, config, text, SanitizeConfigString(value), true, GetEnabledOptionDescription(contentType, SanitizeConfigString(value2 ?? "")), (List<string>)null, (ConfigEntry<bool>)null, false, (Action<bool>)delegate(bool newValue)
				{
					ApplyEnabled(contentTypeCopy, newValue);
				});
				enabledOptions[item] = val;
				if (val.Value)
				{
					continue;
				}
				unloadedContent.Add(item);
				if (!dependentContent.TryGetValue(item.Name, out var dependentTypeNames))
				{
					continue;
				}
				foreach (Type item2 in assemblyTypes.Where((Type x) => dependentTypeNames.Contains(x.Name)))
				{
					unloadedContent.Add(item2);
				}
			}
			if (unloadedContent.Count > 0)
			{
				Log.Info("Not loading disabled content: " + string.Join(", ", unloadedContent.Select((Type x) => x.Name)), "D:\\Games\\LostItems\\mysticsBADitems\\sourcecodeofbaditems\\RealerMysticsBadItems\\ConfigManager.cs", "InitContentLoadFilter", 104);
				ContentLoadHelper.loadFilters.Add((Type type) => !unloadedContent.Contains(type));
			}
		}

		private static void InitItemAndEquipmentDisabling()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			Run.onRunSetRuleBookGlobal += delegate(Run run, RuleBook rulebook)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: 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__13_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__13_1 = val;
				obj = (object)val;
			}
			EnigmaArtifactManager.OnRunStartGlobal += (hook_OnRunStartGlobal)obj;
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				foreach (KeyValuePair<Type, ConfigurableValue<bool>> enabledOption in enabledOptions)
				{
					ApplyEnabled(enabledOption.Key, enabledOption.Value.Value);
				}
			});
		}

		private static ItemDef GetItemDef(Type type)
		{
			object? obj = typeof(MysticsBadItemsContent.Items).GetField("MysticsBadItems_" + type.Name)?.GetValue(null);
			return (ItemDef)((obj is ItemDef) ? obj : null);
		}

		private static EquipmentDef GetEquipmentDef(Type type)
		{
			object? obj = typeof(MysticsBadItemsContent.Equipment).GetField("MysticsBadItems_" + type.Name)?.GetValue(null);
			return (EquipmentDef)((obj is EquipmentDef) ? obj : null);
		}

		private static void ApplyEnabled(Type type, bool enabled)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Invalid comparison between Unknown and I4
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (typeof(BaseItem).IsAssignableFrom(type))
			{
				ItemDef itemDef = GetItemDef(type);
				if (!Object.op_Implicit((Object)(object)itemDef) || (int)itemDef.itemIndex == -1)
				{
					return;
				}
				DisabledItem value;
				if (!enabled)
				{
					if (!disabledItems.ContainsKey(itemDef.itemIndex))
					{
						disabledItems.Add(itemDef.itemIndex, new DisabledItem
						{
							previousTier = itemDef.tier,
							wasWorldUnique = itemDef.ContainsTag((ItemTag)9)
						});
						SetItemTier(itemDef, (ItemTier)5);
						if (!itemDef.ContainsTag((ItemTag)9))
						{
							ref ItemTag[] tags = ref itemDef.tags;
							ItemTag val = (ItemTag)9;
							ArrayUtils.ArrayAppend<ItemTag>(ref tags, ref val);
						}
					}
				}
				else if (disabledItems.TryGetValue(itemDef.itemIndex, out value))
				{
					SetItemTier(itemDef, value.previousTier);
					if (!value.wasWorldUnique)
					{
						ArrayUtils.ArrayRemoveAtAndResize<ItemTag>(ref itemDef.tags, Array.IndexOf(itemDef.tags, (ItemTag)9), 1);
					}
					disabledItems.Remove(itemDef.itemIndex);
				}
			}
			else
			{
				if (!typeof(BaseEquipment).IsAssignableFrom(type))
				{
					return;
				}
				EquipmentDef equipmentDef = GetEquipmentDef(type);
				if (!Object.op_Implicit((Object)(object)equipmentDef) || (int)equipmentDef.equipmentIndex == -1)
				{
					return;
				}
				DisabledEquipment value2;
				if (!enabled)
				{
					if (!disabledEquipment.ContainsKey(equipmentDef.equipmentIndex))
					{
						disabledEquipment.Add(equipmentDef.equipmentIndex, new DisabledEquipment
						{
							appearedInSinglePlayer = equipmentDef.appearsInSinglePlayer,
							appearedInMultiPlayer = equipmentDef.appearsInMultiPlayer
						});
						equipmentDef.canDrop = false;
						equipmentDef.appearsInSinglePlayer = false;
						equipmentDef.appearsInMultiPlayer = false;
					}
				}
				else if (disabledEquipment.TryGetValue(equipmentDef.equipmentIndex, out value2))
				{
					equipmentDef.canDrop = true;
					equipmentDef.appearsInSinglePlayer = value2.appearedInSinglePlayer;
					equipmentDef.appearsInMultiPlayer = value2.appearedInMultiPlayer;
					disabledEquipment.Remove(equipmentDef.equipmentIndex);
				}
			}
		}

		private static void SetItemTier(ItemDef itemDef, ItemTier tier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			itemDef.deprecatedTier = tier;
			itemDef.tier = tier;
		}

		private static string GetEnabledOptionDescription(string contentType, string pickup)
		{
			return "Should this " + contentType + " be enabled? Disabling takes effect at the start of the next run, and after restarting the game the " + contentType + " won't be loaded at all. Enabling it again requires a restart. All players in multiplayer must use the same setting. Description: " + pickup;
		}

		private static string SanitizeConfigString(string initialString)
		{
			string text = Regex.Replace(initialString, "<[^>]*>", "");
			char[] array = new char[8] { '=', '\n', '\t', '\\', '"', '\'', '[', ']' };
			foreach (char oldChar in array)
			{
				text = text.Replace(oldChar, ' ');
			}
			return text;
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
		{
			int num = callerPath.LastIndexOf("RealerMysticsBadItems");
			if (num >= 0)
			{
				callerPath = callerPath.Substring(num + "RealerMysticsBadItems".Length + 1);
			}
			return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Error_NoCallerPrefix(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Fatal_NoCallerPrefix(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Info_NoCallerPrefix(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Message_NoCallerPrefix(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[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.mysticsbaditems", "MysticsBadItems", "1.3.0")]
	public class Main : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static CollectContentPackProvidersDelegate <>9__16_0;

			internal void <Awake>b__16_0(AddContentPackProviderDelegate addContentPackProvider)
			{
				addContentPackProvider.Invoke((IContentPackProvider)(object)new MysticsBadItemsContent());
			}
		}

		public const string PluginGUID = "com.themysticsword.mysticsbaditems";

		public const string PluginName = "MysticsBadItems";

		public const string PluginVersion = "1.3.0";

		public static Assembly executingAssembly;

		private static AssetBundle _assetBundle;

		public static readonly Dictionary<string, string> englishStrings = new Dictionary<string, string>
		{
			{ "ITEM_MYSTICSBADITEMS_RAINBOWTRAIL_NAME", "Cloud Nine" },
			{ "ITEM_MYSTICSBADITEMS_RAINBOWTRAIL_PICKUP", "Leave a <link=\"MysticsBadItemsRainbowWavy\">rainbow trail</link> behind." },
			{ "ITEM_MYSTICSBADITEMS_RAINBOWTRAIL_DESC", "Leave a <link=\"MysticsBadItemsRainbowWavy\">rainbow trail</link> behind. Lasts <style=cIsUtility>0.3s <style=cStack>(+0.3s per stack)</style></style>." },
			{ "EQUIPMENT_MYSTICSBADITEMS_DEFAULTCUBE_NAME", "Default Cube" },
			{ "EQUIPMENT_MYSTICSBADITEMS_DEFAULTCUBE_PICKUP", "Place a solid cube beneath your feet." },
			{ "EQUIPMENT_MYSTICSBADITEMS_DEFAULTCUBE_DESC", "Place a solid cube beneath your feet." },
			{ "ITEM_MYSTICSBADITEMS_CROWN_NAME", "Royal Crown" },
			{ "ITEM_MYSTICSBADITEMS_CROWN_PICKUP", "Does nothing. Turns into money when scrapped." },
			{ "ITEM_MYSTICSBADITEMS_CROWN_DESC", "Does nothing. Turns into <style=cIsUtility>98% of a large chest's worth of gold</style> when scrapped." },
			{ "ITEM_MYSTICSBADITEMS_CATEARHEADPHONES_NAME", "Kitty-Ear Headset" },
			{ "ITEM_MYSTICSBADITEMS_CATEARHEADPHONES_PICKUP", "No effect. Looks paw-some though." },
			{ "ITEM_MYSTICSBADITEMS_CATEARHEADPHONES_DESC", "No effect. Looks paw-some though." },
			{ "ITEM_MYSTICSBADITEMS_RHYTHM_NAME", "Metronome" },
			{ "ITEM_MYSTICSBADITEMS_RHYTHM_PICKUP", "Use a non-Primary skill every 30s to rack up Critical Strike chance. Missing a beat resets the bonus." },
			{ "ITEM_MYSTICSBADITEMS_RHYTHM_DESC", "A beat plays every <style=cIsUtility>30s</style>. Using a Secondary, Utility or Special skill in time with beat racks up a <style=cIsUtility>combo</style>, missing a beat <style=cIsHealth>resets the combo</style>. Critical Strike chance is increased by <style=cIsDamage>+10% <style=cStack>(+5% per stack)</style></style> multiplied by combo." }
		};

		internal static Main Instance { get; private set; }

		public static string PluginDirectory { get; private set; }

		public static AssetBundle AssetBundle
		{
			get
			{
				if ((Object)(object)_assetBundle == (Object)null)
				{
					_assetBundle = AssetBundle.LoadFromFile(Path.Combine(PluginDirectory, "mysticsbaditemsassetbundle"));
				}
				return _assetBundle;
			}
		}

		public void Awake()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			executingAssembly = Assembly.GetExecutingAssembly();
			ConfigManager.Init();
			TMProEffects.Init();
			ContentLoadHelper.PluginAwakeLoad<BaseItem>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseEquipment>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseBuff>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseInteractable>(executingAssembly);
			object obj = <>c.<>9__16_0;
			if (obj == null)
			{
				CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate addContentPackProvider)
				{
					addContentPackProvider.Invoke((IContentPackProvider)(object)new MysticsBadItemsContent());
				};
				<>c.<>9__16_0 = val;
				obj = (object)val;
			}
			ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
			foreach (KeyValuePair<string, string> englishString in englishStrings)
			{
				LanguageAPI.Add(englishString.Key, englishString.Value);
			}
			if (LookingGlassCompat.IsLookingGlassInstalled && ConfigurableValue<bool>.op_Implicit(ConfigurableValue.CreateBool(ConfigManager.categoryGUID, ConfigManager.categoryName, ConfigManager.config, "Mod Compatibility", "LookingGlass Item Stats", true, "Show this mod's item stats in LookingGlass item descriptions", (List<string>)null, (ConfigEntry<bool>)null, true, (Action<bool>)null)))
			{
				try
				{
					LookingGlassCompat.Init();
				}
				catch (Exception data)
				{
					Log.Error(data, "D:\\Games\\LostItems\\mysticsBADitems\\sourcecodeofbaditems\\RealerMysticsBadItems\\Main.cs", "Awake", 110);
				}
			}
		}
	}
	public class MysticsBadItemsContent : 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<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 MysticsBadItems_RainbowTrail;

			public static ItemDef MysticsBadItems_Crown;

			public static ItemDef MysticsBadItems_CatEarHeadphones;

			public static ItemDef MysticsBadItems_Rhythm;
		}

		public static class Equipment
		{
			public static EquipmentDef MysticsBadItems_DefaultCube;
		}

		public static class Buffs
		{
			public static BuffDef MysticsBadItems_RhythmCombo;
		}

		private ContentPack contentPack = new ContentPack();

		public string identifier => "MysticsBadItems";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			ContentLoadHelper contentLoadHelper = new ContentLoadHelper();
			Assembly executingAssembly = Main.executingAssembly;
			Action[] loadDispatchers = new Action[4]
			{
				delegate
				{
					contentLoadHelper.DispatchLoad<ItemDef>(executingAssembly, typeof(BaseItem), (Action<ItemDef[]>)delegate(ItemDef[] x)
					{
						contentPack.itemDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<EquipmentDef>(executingAssembly, typeof(BaseEquipment), (Action<EquipmentDef[]>)delegate(EquipmentDef[] x)
					{
						contentPack.equipmentDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<BuffDef>(executingAssembly, typeof(BaseBuff), (Action<BuffDef[]>)delegate(BuffDef[] x)
					{
						contentPack.buffDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(executingAssembly, typeof(BaseInteractable), (Action<GameObject[]>)null);
				}
			};
			for (int i = 0; i < loadDispatchers.Length; i++)
			{
				loadDispatchers[i]();
				args.ReportProgress(Util.Remap((float)(i + 1), 0f, (float)loadDispatchers.Length, 0f, 0.05f));
				yield return null;
			}
			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[12]
			{
				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.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());
				}
			};
			for (int i = 0; i < loadDispatchers.Length; i++)
			{
				loadDispatchers[i]();
				args.ReportProgress(Util.Remap((float)(i + 1), 0f, (float)loadDispatchers.Length, 0.9f, 0.95f));
				yield return null;
			}
			loadDispatchers = new Action[4]
			{
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseItem>(executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseEquipment>(executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseBuff>(executingAssembly);
				},
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseInteractable>(executingAssembly);
				}
			};
			for (int i = 0; i < loadDispatchers.Length; i++)
			{
				loadDispatchers[i]();
				args.ReportProgress(Util.Remap((float)(i + 1), 0f, (float)loadDispatchers.Length, 0.95f, 0.99f));
				yield return null;
			}
		}

		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 TMProEffects
	{
		public class MysticsBadItemsTextEffects : MonoBehaviour
		{
			public TMP_Text textComponent;

			public bool textChanged;

			public TMP_MeshInfo[] cachedMeshInfo;

			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_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0211: Unknown result type (might be due to invalid IL or missing references)
				//IL_0213: Unknown result type (might be due to invalid IL or missing references)
				//IL_021a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0226: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_023f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0174: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0182: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_01bb: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)textComponent) || !((Behaviour)textComponent).isActiveAndEnabled)
				{
					return;
				}
				TMP_TextInfo textInfo = textComponent.textInfo;
				if (textInfo == null || textInfo.meshInfo == null || textInfo.meshInfo.Length == 0 || textInfo.meshInfo[0].vertices == null)
				{
					return;
				}
				if (textChanged)
				{
					textChanged = false;
					cachedMeshInfo = textInfo.CopyMeshInfoVertexData();
				}
				bool flag = false;
				Vector3 val2 = default(Vector3);
				foreach (TMP_LinkInfo item in textInfo.linkInfo.Where((TMP_LinkInfo x) => ((TMP_LinkInfo)(ref x)).GetLinkID() == "MysticsBadItemsRainbowWavy"))
				{
					for (int num = item.linkTextfirstCharacterIndex; num < item.linkTextfirstCharacterIndex + item.linkTextLength; num++)
					{
						TMP_CharacterInfo val = textInfo.characterInfo[num];
						if (val.isVisible)
						{
							flag = true;
							float num2 = 2f;
							Vector3[] vertices = cachedMeshInfo[val.materialReferenceIndex].vertices;
							Vector3[] vertices2 = textInfo.meshInfo[val.materialReferenceIndex].vertices;
							Color32[] colors = textInfo.meshInfo[val.materialReferenceIndex].colors32;
							((Vector3)(ref val2))..ctor(0f, Mathf.Sin(Time.time * 8f + 0.22f * (float)num) * num2, 0f);
							for (int num3 = 0; num3 <= 3; num3++)
							{
								vertices2[val.vertexIndex + num3] = vertices[val.vertexIndex + num3] + val2;
								colors[val.vertexIndex + num3] = Color32.op_Implicit(Color.HSVToRGB((Time.time * 0.15f + 0.06f * (float)num) % 1f, 0.85f, 1f));
							}
						}
					}
				}
				if (flag)
				{
					for (int num4 = 0; num4 < textInfo.meshInfo.Length; num4++)
					{
						TMP_MeshInfo val3 = textInfo.meshInfo[num4];
						val3.mesh.vertices = val3.vertices;
						val3.mesh.colors32 = val3.colors32;
						textComponent.UpdateGeometry(val3.mesh, num4);
						textComponent.UpdateVertexData((TMP_VertexDataUpdateFlags)16);
					}
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__ChatBox_Start;

			public static hook_Awake <1>__HGTextMeshProUGUI_Awake;
		}

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			object obj = <>O.<0>__ChatBox_Start;
			if (obj == null)
			{
				hook_Start val = ChatBox_Start;
				<>O.<0>__ChatBox_Start = val;
				obj = (object)val;
			}
			ChatBox.Start += (hook_Start)obj;
			object obj2 = <>O.<1>__HGTextMeshProUGUI_Awake;
			if (obj2 == null)
			{
				hook_Awake val2 = HGTextMeshProUGUI_Awake;
				<>O.<1>__HGTextMeshProUGUI_Awake = val2;
				obj2 = (object)val2;
			}
			HGTextMeshProUGUI.Awake += (hook_Awake)obj2;
		}

		private static void ChatBox_Start(orig_Start orig, ChatBox self)
		{
			orig.Invoke(self);
			TMP_Text val = (Object.op_Implicit((Object)(object)self.messagesText) ? self.messagesText.textComponent : null);
			if (Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)((Component)val).GetComponent<MysticsBadItemsTextEffects>()))
			{
				((Component)val).gameObject.AddComponent<MysticsBadItemsTextEffects>();
			}
		}

		private static void HGTextMeshProUGUI_Awake(orig_Awake orig, HGTextMeshProUGUI self)
		{
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<MysticsBadItemsTextEffects>()))
			{
				((Component)self).gameObject.AddComponent<MysticsBadItemsTextEffects>().textComponent = (TMP_Text)(object)self;
			}
		}
	}
}
namespace RealerMysticsBadItems.SoftDependencies
{
	internal static class LookingGlassCompat
	{
		private struct Line
		{
			public string description;

			public ValueType valueType;

			public MeasurementUnits units;

			public Line(string description, ValueType valueType, MeasurementUnits units)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				this.description = description;
				this.valueType = valueType;
				this.units = units;
			}
		}

		public const string GUID = "droppod.lookingglass";

		public static bool IsLookingGlassInstalled => Chainloader.PluginInfos.ContainsKey("droppod.lookingglass");

		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void Init()
		{
			((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)RegisterItemStats);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static ItemStatsDef Create(Line[] lines)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ItemStatsDef val = new ItemStatsDef();
			for (int i = 0; i < lines.Length; i++)
			{
				Line line = lines[i];
				val.descriptions.Add(line.description);
				val.valueTypes.Add(line.valueType);
				val.measurementUnits.Add(line.units);
			}
			return val;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static void AddItem(ItemDef item, Func<int, List<float>> values, params Line[] lines)
		{
			ItemStatsDef val = Create(lines);
			val.calculateValuesFlat = values;
			Register(item, val);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static void AddMasterItem(ItemDef item, Func<CharacterMaster, int, List<float>> values, params Line[] lines)
		{
			ItemStatsDef val = Create(lines);
			val.calculateValues = values;
			Register(item, val);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static void Register(ItemDef item, ItemStatsDef def)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected I4, but got Unknown
			if (Object.op_Implicit((Object)(object)item) && (int)item.itemIndex != -1)
			{
				ItemDefinitions.allItemDefinitions[(int)item.itemIndex] = def;
			}
		}

		private static float Stack(float initial, float additional, int count)
		{
			return initial + additional * (float)(count - 1);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static void RegisterItemStats()
		{
			try
			{
				AddItem(MysticsBadItemsContent.Items.MysticsBadItems_RainbowTrail, (int count) => new List<float> { 0.3f * (float)count }, new Line("Trail Duration: ", (ValueType)2, (MeasurementUnits)6));
				AddItem(MysticsBadItemsContent.Items.MysticsBadItems_Crown, delegate(int count)
				{
					float crownGoldPerPlayer = GetCrownGoldPerPlayer();
					return new List<float>
					{
						crownGoldPerPlayer,
						crownGoldPerPlayer * (float)count
					};
				}, new Line("Gold Per Crown Scrapped: ", (ValueType)16, (MeasurementUnits)5), new Line("Gold For Whole Stack: ", (ValueType)16, (MeasurementUnits)5));
				AddMasterItem(MysticsBadItemsContent.Items.MysticsBadItems_Rhythm, delegate(CharacterMaster master, int count)
				{
					float num = Stack(RhythmCombo.comboCrit, RhythmCombo.comboCritPerStack, count) * 0.01f;
					int rhythmCombo = GetRhythmCombo(master);
					return new List<float>
					{
						num,
						rhythmCombo,
						num * (float)rhythmCombo
					};
				}, new Line("Crit Chance Per Combo: ", (ValueType)1, (MeasurementUnits)1), new Line("Current Combo: ", (ValueType)2, (MeasurementUnits)4), new Line("Current Crit Chance Bonus: ", (ValueType)1, (MeasurementUnits)1));
			}
			catch (Exception ex)
			{
				Log.Error("Failed to register LookingGlass item stats: " + ex, "D:\\Games\\LostItems\\mysticsBADitems\\sourcecodeofbaditems\\RealerMysticsBadItems\\SoftDependencies\\LookingGlassCompat.cs", "RegisterItemStats", 115);
			}
		}

		private static float GetCrownGoldPerPlayer()
		{
			float num = (Object.op_Implicit((Object)(object)Stage.instance) ? Stage.instance.entryDifficultyCoefficient : 1f);
			float num2 = (int)(49f * num);
			int num3 = (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.livingPlayerCount : 0);
			if (num3 > 0)
			{
				num2 = Mathf.CeilToInt(num2 / (float)num3);
			}
			return num2;
		}

		private static int GetRhythmCombo(CharacterMaster master)
		{
			CharacterBody val = (Object.op_Implicit((Object)(object)master) ? master.GetBody() : null);
			BuffDef mysticsBadItems_RhythmCombo = MysticsBadItemsContent.Buffs.MysticsBadItems_RhythmCombo;
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)mysticsBadItems_RhythmCombo))
			{
				return 0;
			}
			return val.GetBuffCount(mysticsBadItems_RhythmCombo);
		}
	}
}
namespace RealerMysticsBadItems.Items
{
	public class CatEarHeadphones : BaseItem
	{
		public override void OnLoad()
		{
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			((BaseLoadableAsset)this).OnLoad();
			((Object)base.itemDef).name = "MysticsBadItems_CatEarHeadphones";
			((BaseItem)this).SetItemTierWhenAvailable((ItemTier)1);
			base.itemDef.tags = (ItemTag[])(object)new ItemTag[0];
			base.itemDef.pickupModelPrefab = ((BaseItemLike)this).PrepareModel(Main.AssetBundle.LoadAsset<GameObject>("Assets/Mods/Mystic's Bad Items/Items/Cat Ear Headphones/Model.prefab"));
			base.itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset<Sprite>("Assets/Mods/Mystic's Bad Items/Items/Cat Ear Headphones/Icon.png");
			((BaseItemLike)this).itemDisplayPrefab = ((BaseItemLike)this).PrepareItemDisplayModel(((BaseItemLike)this).PrepareModel(Main.AssetBundle.LoadAsset<GameObject>("Assets/Mods/Mystic's Bad Items/Items/Cat Ear Headphones/DisplayModel.prefab")));
			BaseItemLike.onSetupIDRS += delegate
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: 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_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: 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_01be: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_027a: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_0312: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Unknown result type (might be due to invalid IL or missing references)
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				//IL_035e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0372: Unknown result type (might be due to invalid IL or missing references)
				//IL_0386: Unknown result type (might be due to invalid IL or missing references)
				//IL_03aa: 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_03d2: Unknown result type (might be due to invalid IL or missing references)
				((BaseItemLike)this).AddDisplayRule("CommandoBody", "Head", new Vector3(-0.00816f, 0.38568f, 0.02439f), new Vector3(5.07642f, 0f, 0f), new Vector3(0.85862f, 0.85862f, 0.85862f));
				((BaseItemLike)this).AddDisplayRule("HuntressBody", "Head", new Vector3(-0.00692f, 0.31612f, -0.05489f), new Vector3(354.6689f, 0f, 0f), new Vector3(0.57462f, 0.62854f, 0.57462f));
				((BaseItemLike)this).AddDisplayRule("Bandit2Body", "Head", new Vector3(-4E-05f, 0.18077f, 0.01298f), new Vector3(349.5076f, 0f, 0f), new Vector3(0.47957f, 0.50716f, 0.50716f));
				((BaseItemLike)this).AddDisplayRule("ToolbotBody", "Head", new Vector3(0.01339f, 2.69805f, 1.9022f), new Vector3(277.9093f, 191.0181f, 350.0386f), new Vector3(8.8842f, 8.8842f, 8.8842f));
				((BaseItemLike)this).AddDisplayRule("EngiBody", "HeadCenter", new Vector3(-0.00639f, 0.17129f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0.82636f, 0.76351f, 0.74883f));
				((BaseItemLike)this).AddDisplayRule("EngiTurretBody", "Head", new Vector3(0f, 0.8902f, -8E-05f), new Vector3(0f, 0f, 355f), new Vector3(4.30519f, 4.30519f, 4.30519f));
				((BaseItemLike)this).AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.0006f, 1.56941f, -0.42273f), new Vector3(353.0465f, 0f, 0f), new Vector3(4.41544f, 4.41544f, 4.41544f));
				((BaseItemLike)this).AddDisplayRule("MageBody", "Head", new Vector3(-0.00408f, 0.17284f, 0.00895f), new Vector3(6.1674f, 0f, 0f), new Vector3(0.49742f, 0.49742f, 0.49742f));
				((BaseItemLike)this).AddDisplayRule("MercBody", "Head", new Vector3(-0.00848f, 0.26603f, 0.05728f), new Vector3(11.59233f, 0f, 0f), new Vector3(0.57628f, 0.57628f, 0.57628f));
				((BaseItemLike)this).AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(0.00214f, 0.60333f, 0.03576f), new Vector3(0.26144f, 355f, 1.60241f), new Vector3(4.66764f, 5.04098f, 4.66179f));
				((BaseItemLike)this).AddDisplayRule("LoaderBody", "Head", new Vector3(-0.00419f, 0.24669f, 0.01637f), new Vector3(0f, 0f, 0f), new Vector3(0.66542f, 0.66542f, 0.66542f));
				((BaseItemLike)this).AddDisplayRule("CrocoBody", "Head", new Vector3(0.00031f, 0.36012f, 1.58152f), new Vector3(272.6808f, 36.07847f, 143.5646f), new Vector3(8.19354f, 8.19354f, 8.19354f));
				((BaseItemLike)this).AddDisplayRule("CaptainBody", "Head", new Vector3(-0.0079f, 0.25295f, 0.0517f), new Vector3(0f, 0f, 0f), new Vector3(0.59827f, 0.59827f, 0.59827f));
			};
			SkinnedMeshRenderer componentInChildren = base.itemDef.pickupModelPrefab.GetComponentInChildren<SkinnedMeshRenderer>();
			Material obj = ((Renderer)componentInChildren).sharedMaterials[0];
			Standard.Apply(obj, (Properties)null);
			Standard.Gloss(obj, 0.6f, 5f, (Color?)null);
			Material obj2 = ((Renderer)componentInChildren).sharedMaterials[1];
			Standard.Apply(obj2, (Properties)null);
			Standard.Gloss(obj2, 1f, 14f, (Color?)null);
			Material obj3 = ((Renderer)componentInChildren).sharedMaterials[2];
			Standard.Apply(obj3, (Properties)null);
			Standard.Emission(obj3, 1f, (Color?)Color32.op_Implicit(new Color32((byte)136, (byte)175, (byte)232, byte.MaxValue)));
		}
	}
	public class Crown : BaseItem
	{
		private PickupIndex crownPickupIndex => PickupCatalog.FindPickupIndex(base.itemDef.itemIndex);

		public override void OnLoad()
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			((BaseLoadableAsset)this).OnLoad();
			((Object)base.itemDef).name = "MysticsBadItems_Crown";
			((BaseItem)this).SetItemTierWhenAvailable((ItemTier)1);
			base.itemDef.tags = (ItemTag[])(object)new ItemTag[2]
			{
				(ItemTag)3,
				(ItemTag)18
			};
			base.itemDef.pickupModelPrefab = ((BaseItemLike)this).PrepareModel(Main.AssetBundle.LoadAsset<GameObject>("Assets/Mods/Mystic's Bad Items/Items/Crown/Model.prefab"));
			base.itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset<Sprite>("Assets/Mods/Mystic's Bad Items/Items/Crown/Icon.png");
			((BaseItemLike)this).itemDisplayPrefab = ((BaseItemLike)this).PrepareItemDisplayModel(PrefabAPI.InstantiateClone(base.itemDef.pickupModelPrefab, ((Object)base.itemDef.pickupModelPrefab).name + "_Display"));
			BaseItemLike.onSetupIDRS += delegate
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: 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_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: 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_01be: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_027a: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_0312: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Unknown result type (might be due to invalid IL or missing references)
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				//IL_035e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0372: Unknown result type (might be due to invalid IL or missing references)
				//IL_0386: Unknown result type (might be due to invalid IL or missing references)
				//IL_03aa: 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_03d2: Unknown result type (might be due to invalid IL or missing references)
				((BaseItemLike)this).AddDisplayRule("CommandoBody", "Head", new Vector3(0f, 0.37741f, 0.02367f), new Vector3(5.07642f, 0f, 0f), new Vector3(0.14939f, 0.14939f, 0.14939f));
				((BaseItemLike)this).AddDisplayRule("HuntressBody", "Head", new Vector3(0f, 0.32502f, -0.05572f), new Vector3(354.6689f, 0f, 0f), new Vector3(0.09658f, 0.09658f, 0.09658f));
				((BaseItemLike)this).AddDisplayRule("Bandit2Body", "Head", new Vector3(-3E-05f, 0.17107f, -0.00583f), new Vector3(349.5076f, 0f, 0f), new Vector3(0.11757f, 0.11757f, 0.11757f));
				((BaseItemLike)this).AddDisplayRule("ToolbotBody", "Head", new Vector3(0f, 2.44052f, 1.34699f), new Vector3(58.1895f, 291.422f, 294.7821f), new Vector3(1.20554f, 1.20554f, 1.20554f));
				((BaseItemLike)this).AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0f, 0.17322f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0.13141f, 0.13141f, 0.13141f));
				((BaseItemLike)this).AddDisplayRule("EngiTurretBody", "Head", new Vector3(0f, 0.8902f, -8E-05f), new Vector3(0f, 270f, 355.8558f), new Vector3(0.48895f, 0.48998f, 0.48998f));
				((BaseItemLike)this).AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.0006f, 1.56272f, -1.1861f), new Vector3(353.0465f, 0f, 0f), new Vector3(0.43814f, 0.43906f, 0.43906f));
				((BaseItemLike)this).AddDisplayRule("MageBody", "Head", new Vector3(-0.00408f, 0.19861f, -0.11468f), new Vector3(344.8334f, 0f, 0f), new Vector3(0.08068f, 0.08068f, 0.08068f));
				((BaseItemLike)this).AddDisplayRule("MercBody", "Head", new Vector3(0f, 0.26353f, 0.05679f), new Vector3(11.59233f, 0f, 0f), new Vector3(0.10902f, 0.10902f, 0.10902f));
				((BaseItemLike)this).AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(0.07958f, 1.06987f, -0.03811f), new Vector3(7.85321f, 355.2752f, 1.61757f), new Vector3(0.87261f, 0.87261f, 0.87261f));
				((BaseItemLike)this).AddDisplayRule("LoaderBody", "Head", new Vector3(0f, 0.26025f, 0.01637f), new Vector3(2.0328f, 0f, 0f), new Vector3(0.10256f, 0.10256f, 0.10256f));
				((BaseItemLike)this).AddDisplayRule("CrocoBody", "Head", new Vector3(0f, 0.62007f, 1.718f), new Vector3(79.09709f, 180f, 180f), new Vector3(1.48292f, 1.48292f, 1.48292f));
				((BaseItemLike)this).AddDisplayRule("CaptainBody", "Head", new Vector3(1E-05f, 0.24555f, -0.02541f), new Vector3(329.5633f, 0f, 0f), new Vector3(0.12897f, 0.12897f, 0.12897f));
			};
			ScrapperController.BeginScrapping_UniquePickup += new hook_BeginScrapping_UniquePickup(ScrapperController_BeginScrapping_UniquePickup);
			ScrappingToIdle.OnEnter += new hook_OnEnter(ScrappingToIdle_OnEnter);
		}

		private void ScrapperController_BeginScrapping_UniquePickup(orig_BeginScrapping_UniquePickup orig, ScrapperController self, UniquePickup pickupToTake)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			bool num = PickupCatalog.GetPickupDef(pickupToTake.pickupIndex)?.itemIndex == (ItemIndex?)base.itemDef.itemIndex;
			int count = self.pickupPrintQueue.Count;
			orig.Invoke(self, pickupToTake);
			if (num)
			{
				for (int i = count; i < self.pickupPrintQueue.Count; i++)
				{
					List<UniquePickup> pickupPrintQueue = self.pickupPrintQueue;
					int index = i;
					UniquePickup val = self.pickupPrintQueue[i];
					pickupPrintQueue[index] = ((UniquePickup)(ref val)).WithPickupIndex(crownPickupIndex);
				}
			}
		}

		private void ScrappingToIdle_OnEnter(orig_OnEnter orig, ScrappingToIdle self)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			ScrapperController component = ((EntityState)self).GetComponent<ScrapperController>();
			bool flag = NetworkServer.active && Object.op_Implicit((Object)(object)component) && component.pickupPrintQueue.Count > 0 && component.pickupPrintQueue[0].pickupIndex == crownPickupIndex;
			List<UniquePickup> list = null;
			if (flag)
			{
				component.pickupPrintQueue.RemoveAt(0);
				list = new List<UniquePickup>(component.pickupPrintQueue);
				component.pickupPrintQueue.Clear();
			}
			try
			{
				orig.Invoke(self);
			}
			finally
			{
				if (list != null)
				{
					component.pickupPrintQueue.AddRange(list);
				}
			}
			if (flag)
			{
				TeamIndex val = (TeamIndex)1;
				int num = (int)(49f * Stage.instance.entryDifficultyCoefficient);
				Interactor interactor = component.interactor;
				if (Object.op_Implicit((Object)(object)interactor))
				{
					val = TeamComponent.GetObjectTeam(((Component)interactor).gameObject);
				}
				TeamManager.instance.GiveTeamMoney(val, (uint)num, false);
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/CoinEmitter"), new EffectData
				{
					origin = ((BaseState)self).FindModelChild(ScrappingToIdle.muzzleString).position,
					genericFloat = num
				}, true);
				self.foundValidScrap = true;
			}
		}
	}
	public class RainbowTrail : BaseItem
	{
		public class MysticsBadItemsRainbowTrail : ItemBehavior
		{
			public GameObject trailObject;

			public TrailRenderer trailRenderer;

			public void Start()
			{
				trailObject = Object.Instantiate<GameObject>(Main.AssetBundle.LoadAsset<GameObject>("Assets/Mods/Mystic's Bad Items/Items/Rainbow Trail/Trail.prefab"), base.body.transform);
				trailRenderer = trailObject.GetComponent<TrailRenderer>();
				UpdateStacks();
			}

			public void UpdateStacks()
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)trailRenderer))
				{
					trailRenderer.time = 0.3f * (float)base.stack;
					trailObject.transform.parent = null;
					trailObject.transform.localScale = Vector3.one * base.body.bestFitRadius;
					trailObject.transform.SetParent(base.body.transform, true);
				}
			}

			public void OnDestroy()
			{
				Object.Destroy((Object)(object)trailObject);
			}
		}

		public override void OnLoad()
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			((BaseLoadableAsset)this).OnLoad();
			((Object)base.itemDef).name = "MysticsBadItems_RainbowTrail";
			((BaseItem)this).SetItemTierWhenAvailable((ItemTier)0);
			base.itemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 };
			base.itemDef.pickupModelPrefab = ((BaseItemLike)this).PrepareModel(Main.AssetBundle.LoadAsset<GameObject>("Assets/Mods/Mystic's Bad Items/Items/Rainbow Trail/Model.prefab"));
			base.itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset<Sprite>("Assets/Mods/Mystic's Bad Items/Items/Rainbow Trail/Icon.png");
			Standard.Emission(base.itemDef.pickupModelPrefab.GetComponentInChildren<Renderer>().sharedMaterial, 0f, (Color?)null);
			((BaseItemLike)this).itemDisplayPrefab = ((BaseItemLike)this).PrepareItemDisplayModel(PrefabAPI.InstantiateClone(base.itemDef.pickupModelPrefab, ((Object)base.itemDef.pickupModelPrefab).name + "_Display"));
			BaseItemLike.onSetupIDRS += delegate
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: 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_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: 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_01be: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_027a: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_0312: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Unknown result type (might be due to invalid IL or missing references)
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				//IL_035e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0372: Unknown result type (might be due to invalid IL or missing references)
				//IL_0386: Unknown result type (might be due to invalid IL or missing references)
				//IL_03aa: 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_03d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_040f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0423: Unknown result type (might be due to invalid IL or missing references)
				//IL_0447: Unknown result type (might be due to invalid IL or missing references)
				//IL_045b: Unknown result type (might be due to invalid IL or missing references)
				//IL_046f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0493: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_04bb: 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_04f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0507: Unknown result type (might be due to invalid IL or missing references)
				((BaseItemLike)this).AddDisplayRule("CommandoBody", "Head", new Vector3(0f, 0.16388f, 0.18652f), new Vector3(0f, 0f, 0f), new Vector3(0.102f, 0.102f, 0.102f));
				((BaseItemLike)this).AddDisplayRule("HuntressBody", "Head", new Vector3(0f, 0.0967f, 0.11243f), new Vector3(43.64907f, 0f, 0f), new Vector3(0.084f, 0.09993f, 0.084f));
				((BaseItemLike)this).AddDisplayRule("Bandit2Body", "Head", new Vector3(-1E-05f, -0.01385f, 0.12776f), new Vector3(0f, 0f, 0f), new Vector3(0.06952f, 0.06952f, 0.06952f));
				((BaseItemLike)this).AddDisplayRule("ToolbotBody", "Chest", new Vector3(-1E-05f, 1.12616f, 3.23301f), new Vector3(0f, 0f, 0f), new Vector3(1.043f, 1.043f, 1.043f));
				((BaseItemLike)this).AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0f, -0.09658f, 0.15593f), new Vector3(28.31221f, 0f, 0f), new Vector3(0.11432f, 0.11432f, 0.11432f));
				((BaseItemLike)this).AddDisplayRule("EngiTurretBody", "Head", new Vector3(0f, 0.51898f, 1.40674f), new Vector3(6.00462f, 0f, 0f), new Vector3(0.24555f, 0.24555f, 0.24555f));
				((BaseItemLike)this).AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.03191f, 0.67419f, -1.02958f), new Vector3(347.364f, 0f, 0f), new Vector3(0.58633f, 0.58633f, 0.5732f));
				((BaseItemLike)this).AddDisplayRule("MageBody", "Head", new Vector3(0f, -0.01334f, 0.13699f), new Vector3(20.87633f, 0f, 0f), new Vector3(0.07433f, 0.07433f, 0.07433f));
				((BaseItemLike)this).AddDisplayRule("MercBody", "Head", new Vector3(0f, 0.00938f, 0.16908f), new Vector3(23.24298f, 0f, 0f), new Vector3(0.093f, 0.093f, 0.093f));
				((BaseItemLike)this).AddDisplayRule("TreebotBody", "PlatformBase", new Vector3(-0.5384f, -0.33493f, 0f), new Vector3(0f, 0f, 37.80375f), new Vector3(0.26476f, 0.26476f, 0.26476f));
				((BaseItemLike)this).AddDisplayRule("LoaderBody", "Head", new Vector3(0f, 0.0199f, 0.16741f), new Vector3(13f, 0f, 0f), new Vector3(0.10986f, 0.10986f, 0.10986f));
				((BaseItemLike)this).AddDisplayRule("CrocoBody", "Head", new Vector3(0f, 3.92894f, -0.2927f), new Vector3(80.82946f, 180f, 180f), new Vector3(2.0196f, 2.0196f, 2.0196f));
				((BaseItemLike)this).AddDisplayRule("CaptainBody", "Head", new Vector3(0f, -0.0366f, 0.16365f), new Vector3(25.47889f, 0f, 0f), new Vector3(0.086f, 0.086f, 0.086f));
				((BaseItemLike)this).AddDisplayRule("BrotherBody", "Head", BrotherInfection.white, new Vector3(-0.00094f, -0.05567f, 0.03761f), new Vector3(0f, 88.56445f, 15.20469f), new Vector3(0.09773f, 0.063f, 0.063f));
				((BaseItemLike)this).AddDisplayRule("ScavBody", "Head", new Vector3(0f, 4.3108f, 0.00021f), new Vector3(270.1856f, 0f, 0f), new Vector3(2.62999f, 2.70243f, 2.62999f));
				((BaseItemLike)this).AddDisplayRule("RailgunnerBody", "Head", new Vector3(0f, 0.00334f, 0.11246f), new Vector3(8.36512f, 0f, 0f), new Vector3(0.05939f, 0.05939f, 0.05939f));
				((BaseItemLike)this).AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(-0.18866f, 0.08599f, -0.19452f), new Vector3(3.08621f, 41.85941f, 273.6595f), new Vector3(0.09512f, 0.09512f, 0.09512f));
			};
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged);
		}

		private void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			MysticsBadItemsRainbowTrail mysticsBadItemsRainbowTrail = self.AddItemBehavior<MysticsBadItemsRainbowTrail>(self.inventory.GetItemCount(base.itemDef));
			if (Object.op_Implicit((Object)(object)mysticsBadItemsRainbowTrail))
			{
				mysticsBadItemsRainbowTrail.UpdateStacks();
			}
		}
	}
	public class Rhythm : BaseItem
	{
		public static class MusicBPMHelper
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static hook_UpdateState <0>__MusicController_UpdateState;
			}

			public static MusicTrackDef oldMusicTrackDef;

			public static float currentBPM = 60f;

			public static Dictionary<string, float> songBPM = new Dictionary<string, float>
			{
				{ "muEscape", 100f },
				{ "muFULLSong02", 100f },
				{ "muFULLSong06", 60f },
				{ "muFULLSong07", 60f },
				{ "muFULLSong18", 130f },
				{ "muFULLSong19", 60f },
				{ "muGameplayBase_09", 100f },
				{ "muIntroCutscene", 120f },
				{ "muLogbook", 60f },
				{ "muMainEndingFull", 50f },
				{ "muMainEndingOutroA", 50f },
				{ "muMainEndingOutroB", 50f },
				{ "muMenu", 60f },
				{ "muNone", 120f },
				{ "muSong04", 60f },
				{ "muSong05", 107f },
				{ "muSong08", 76f },
				{ "muSong13", 110f },
				{ "muSong14", 130f },
				{ "muSong16", 150f },
				{ "muSong21", 30f },
				{ "muSong22", 120f },
				{ "muSong23", 160f },
				{ "muSong24", 50f },
				{ "muSong25", 160f },
				{ "muBossfightDLC1_10", 162f },
				{ "muBossfightDLC1_12", 134f },
				{ "muGameplayDLC1_01", 60f },
				{ "muGameplayDLC1_03", 96f },
				{ "muGameplayDLC1_06", 48f },
				{ "muGameplayDLC1_08", 76f },
				{ "muMenuDLC1", 48f },
				{ "muRaidfightDLC1_07", 114f }
			};

			public static void Init()
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected O, but got Unknown
				object obj = <>O.<0>__MusicController_UpdateState;
				if (obj == null)
				{
					hook_UpdateState val = MusicController_UpdateState;
					<>O.<0>__MusicController_UpdateState = val;
					obj = (object)val;
				}
				MusicController.UpdateState += (hook_UpdateState)obj;
			}

			private static void MusicController_UpdateState(orig_UpdateState orig, MusicController self)
			{
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self.currentTrack) && (Object)(object)self.currentTrack != (Object)(object)oldMusicTrackDef)
				{
					oldMusicTrackDef = self.currentTrack;
					if (!songBPM.TryGetValue(self.currentTrack.cachedName, out currentBPM))
					{
						currentBPM = 60f;
					}
				}
			}
		}

		public class MysticsItemsRhythmHUD : MonoBehaviour
		{
			public static List<MysticsItemsRhythmHUD> instancesList = new List<MysticsItemsRhythmHUD>();

			public HUD hud;

			public MysticsItemsRhythmBehaviour rhythmBehaviour;

			public static void OnComboForInstance(MysticsItemsRhythmBehaviour rhythmBehaviour)
			{
				foreach (MysticsItemsRhythmHUD item in instancesList.Where((MysticsItemsRhythmHUD x) => (Object)(object)x.rhythmBehaviour == (Object)(object)rhythmBehaviour).ToList())
				{
					item.OnCombo();
				}
			}

			public virtual void OnCombo()
			{
			}

			public static void OnComboBreakForInstance(MysticsItemsRhythmBehaviour rhythmBehaviour)
			{
				foreach (MysticsItemsRhythmHUD item in instancesList.Where((MysticsItemsRhythmHUD x) => (Object)(object)x.rhythmBehaviour == (Object)(object)rhythmBehaviour).ToList())
				{
					item.OnComboBreak();
				}
			}

			public virtual void OnComboBreak()
			{
			}

			public static void OnBeginReadForInstance(MysticsItemsRhythmBehaviour rhythmBehaviour)
			{
				foreach (MysticsItemsRhythmHUD item in instancesList.Where((MysticsItemsRhythmHUD x) => (Object)(object)x.rhythmBehaviour == (Object)(object)rhythmBehaviour).ToList())
				{
					item.OnBeginRead();
				}
			}

			public virtual void OnBeginRead()
			{
			}

			public static void OnTickForInstance(MysticsItemsRhythmBehaviour rhythmBehaviour)
			{
				foreach (MysticsItemsRhythmHUD item in instancesList.Where((MysticsItemsRhythmHUD x) => (Object)(object)x.rhythmBehaviour == (Object)(object)rhythmBehaviour).ToList())
				{
					item.OnTick();
				}
			}

			public virtual void OnTick()
			{
			}

			public static void RefreshAll()
			{
				foreach (HUD readOnlyInstance in HUD.readOnlyInstanceList)
				{
					RefreshForHUDInstance(readOnlyInstance);
				}
			}

			public static void RefreshForHUDInstance(HUD hudInstance)
			{
				MysticsItemsRhythmHUDUnderCrosshair.RefreshForHUDInstance(hudInstance);
				MysticsItemsRhythmHUDOverSkills.RefreshForHUDInstance(hudInstance);
			}

			public void OnEnable()
			{
				instancesList.Add(this);
			}

			public void OnDisable()
			{
				instancesList.Remove(this);
			}

			public float CalculateFadeAlpha()
			{
				if (!Object.op_Implicit((Object)(object)rhythmBehaviour))
				{
					return 0f;
				}
				if (rhythmBehaviour.currentTime >= rhythmBehaviour.interval - rhythmBehaviour.timePerMeasure * 1.4f)
				{
					return Mathf.Clamp01(1f - (rhythmBehaviour.interval - rhythmBehaviour.timePerMeasure * 1.4f + hudFadeInTime - rhythmBehaviour.currentTime) / hudFadeInTime);
				}
				if (rhythmBehaviour.currentTime >= rhythmBehaviour.beatWindowLate)
				{
					return Mathf.Clamp01(1f - (rhythmBehaviour.currentTime - rhythmBehaviour.beatWindowLate) / hudFadeOutTime);
				}
				return 1f;
			}
		}

		public enum ComboAnimationType
		{
			None,
			Tick,
			Hit,
			Break
		}

		public class MysticsItemsRhythmHUDUnderCrosshair : MysticsItemsRhythmHUD
		{
			public class MysticsItemsRhythmHUDUnderCrosshairNote : MonoBehaviour
			{
				public float maxTime;

				public float remainingTime;

				public float xOffset = 60f;

				public bool right;

				public RectTransform rectTransform;

				public AnimationCurve noteFadeInAnimation;

				public Material materialInstance;

				public bool destroyMaterialInstanceOnDestroy = true;

				public void Awake()
				{
					ref RectTransform reference = ref rectTransform;
					Transform transform = ((Component)this).transform;
					reference = (RectTransform)(object)((transform is RectTransform) ? transform : null);
					UpdateAlpha();
				}

				public void Update()
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
					//IL_0103: Unknown result type (might be due to invalid IL or missing references)
					//IL_0108: Unknown result type (might be due to invalid IL or missing references)
					//IL_0074: Unknown result type (might be due to invalid IL or missing references)
					//IL_0080: Unknown result type (might be due to invalid IL or missing references)
					//IL_0085: Unknown result type (might be due to invalid IL or missing references)
					//IL_009a: Unknown result type (might be due to invalid IL or missing references)
					//IL_009f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0150: Unknown result type (might be due to invalid IL or missing references)
					Vector3 localPosition = ((Component)this).transform.localPosition;
					localPosition.x = remainingTime / maxTime * xOffset * (float)(right ? 1 : (-1));
					((Component)this).transform.localPosition = localPosition;
					remainingTime -= Time.deltaTime;
					if (!Object.op_Implicit((Object)(object)materialInstance))
					{
						return;
					}
					UpdateAlpha();
					Rect rect;
					Vector4 val = default(Vector4);
					if (right)
					{
						float x = localPosition.x;
						rect = rectTransform.rect;
						float num = x + ((Rect)(ref rect)).width * 0.5f;
						rect = rectTransform.rect;
						float num2 = Mathf.Clamp01(1f - num / ((Rect)(ref rect)).width);
						if (num2 >= 1f)
						{
							Object.Destroy((Object)(object)((Component)this).gameObject);
							return;
						}
						((Vector4)(ref val))..ctor(num2, 1f, 0f, 1f);
					}
					else
					{
						float x2 = localPosition.x;
						rect = rectTransform.rect;
						float num3 = 0f - (x2 - ((Rect)(ref rect)).width * 0.5f);
						rect = rectTransform.rect;
						float num4 = Mathf.Clamp01(num3 / ((Rect)(ref rect)).width);
						if (num4 <= 0f)
						{
							Object.Destroy((Object)(object)((Component)this).gameObject);
							return;
						}
						((Vector4)(ref val))..ctor(0f, num4, 0f, 1f);
					}
					materialInstance.SetVector("_RenderPortion", val);
				}

				public void UpdateAlpha()
				{
					//IL_0019: 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_004f: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)materialInstance))
					{
						Color color = materialInstance.GetColor("_Color");
						color.a = noteFadeInAnimation.Evaluate(1f - remainingTime / maxTime);
						materialInstance.SetColor("_Color", color);
					}
				}

				public void OnDestroy()
				{
					if (destroyMaterialInstanceOnDestroy)
					{
						Object.Destroy((Object)(object)materialInstance);
					}
				}
			}

			public CanvasGroup canvasGroup;

			public TextMeshProUGUI comboText;

			public Transform barTransform;

			public float comboAnimationTime;

			public float comboAnimationDuration;

			public AnimationCurve comboTickAnimation;

			public float comboTickAnimationMultiplier = 1f;

			public AnimationCurve comboHitAnimation;

			public float comboHitAnimationMultiplier = 1f;

			public AnimationCurve comboBreakAnimation;

			public float comboBreakAnimationMultiplier = 1f;

			public ComboAnimationType currentComboAnimationType;

			public GameObject noteTemplate;

			public List<MysticsItemsRhythmHUDUnderCrosshairNote> notes = new List<MysticsItemsRhythmHUDUnderCrosshairNote>();

			public AnimationCurve noteFadeInAnimation;

			public float selfDestructTimer = 10f;

			public new static void RefreshForHUDInstance(HUD hudInstance)
			{
				CharacterMaster targetMaster = hudInstance.targetMaster;
				CharacterBody val = (Object.op_Implicit((Object)(object)targetMaster) ? targetMaster.GetBody() : null);
				MysticsItemsRhythmBehaviour mysticsItemsRhythmBehaviour = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<MysticsItemsRhythmBehaviour>() : null);
				bool flag = rhythmUIUnderCrosshair && Object.op_Implicit((Object)(object)mysticsItemsRhythmBehaviour);
				MysticsItemsRhythmHUDUnderCrosshair mysticsItemsRhythmHUDUnderCrosshair = MysticsItemsRhythmHUD.instancesList.OfType<MysticsItemsRhythmHUDUnderCrosshair>().FirstOrDefault((MysticsItemsRhythmHUDUnderCrosshair x) => (Object)(object)x.hud == (Object)(object)hudInstance);
				if (Object.op_Implicit((Object)(object)mysticsItemsRhythmHUDUnderCrosshair) != flag)
				{
					if (!Object.op_Implicit((Object)(object)mysticsItemsRhythmHUDUnderCrosshair))
					{
						if (Object.op_Implicit((Object)(object)hudInstance.mainUIPanel))
						{
							Transform val2 = hudInstance.mainUIPanel.transform.Find("SpringCanvas");
							if (Object.op_Implicit((Object)(object)val2))
							{
								mysticsItemsRhythmHUDUnderCrosshair = Object.Instantiate<GameObject>(rhythmHUDUnderCrosshair, val2).GetComponent<MysticsItemsRhythmHUDUnderCrosshair>();
								mysticsItemsRhythmHUDUnderCrosshair.hud = hudInstance;
							}
						}
					}
					else
					{
						Object.Destroy((Object)(object)((Component)mysticsItemsRhythmHUDUnderCrosshair).gameObject);
					}
				}
				if (flag && Object.op_Implicit((Object)(object)mysticsItemsRhythmHUDUnderCrosshair))
				{
					mysticsItemsRhythmHUDUnderCrosshair.rhythmBehaviour = mysticsItemsRhythmBehaviour;
					mysticsItemsRhythmHUDUnderCrosshair.UpdateText();
				}
			}

			public void Update()
			{
				//IL_0089: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)canvasGroup))
				{
					canvasGroup.alpha = CalculateFadeAlpha();
				}
				if (Object.op_Implicit((Object)(object)comboText) && currentComboAnimationType != ComboAnimationType.None)
				{
					float num = Mathf.Clamp01(comboAnimationTime / comboAnimationDuration);
					comboAnimationTime += Time.deltaTime;
					switch (currentComboAnimationType)
					{
					case ComboAnimationType.Tick:
						((TMP_Text)comboText).transform.localScale = Vector3.one * comboTickAnimation.Evaluate(num) * comboTickAnimationMultiplier;
						break;
					case ComboAnimationType.Hit:
						((TMP_Text)comboText).transform.localScale = Vector3.one * comboHitAnimation.Evaluate(num) * comboHitAnimationMultiplier;
						break;
					case ComboAnimationType.Break:
					{
						Vector3 localPosition = ((TMP_Text)comboText).transform.localPosition;
						localPosition.x = comboBreakAnimation.Evaluate(num) * comboBreakAnimationMultiplier;
						((TMP_Text)comboText).transform.localPosition = localPosition;
						break;
					}
					}
					if (num >= 1f)
					{
						currentComboAnimationType = ComboAnimationType.None;
					}
				}
				if (!Object.op_Implicit((Object)(object)rhythmBehaviour))
				{
					selfDestructTimer -= Time.deltaTime;
				}
				if (selfDestructTimer <= 0f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}

			public override void OnBeginRead()
			{
				base.OnBeginRead();
				SpawnNote(right: false);
				SpawnNote(right: true);
			}

			private void SpawnNote(bool right)
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				GameObject obj = Object.Instantiate<GameObject>(noteTemplate, barTransform);
				obj.SetActive(true);
				MysticsItemsRhythmHUDUnderCrosshairNote mysticsItemsRhythmHUDUnderCrosshairNote = obj.AddComponent<MysticsItemsRhythmHUDUnderCrosshairNote>();
				mysticsItemsRhythmHUDUnderCrosshairNote.maxTime = (mysticsItemsRhythmHUDUnderCrosshairNote.remainingTime = rhythmBehaviour.readTime);
				mysticsItemsRhythmHUDUnderCrosshairNote.right = right;
				obj.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
				mysticsItemsRhythmHUDUnderCrosshairNote.xOffset = 60f;
				mysticsItemsRhythmHUDUnderCrosshairNote.noteFadeInAnimation = noteFadeInAnimation;
				Image component = obj.GetComponent<Image>();
				mysticsItemsRhythmHUDUnderCrosshairNote.materialInstance = Object.Instantiate<Material>(((Graphic)component).material);
				((Graphic)component).material = mysticsItemsRhythmHUDUnderCrosshairNote.materialInstance;
				mysticsItemsRhythmHUDUnderCrosshairNote.UpdateAlpha();
				notes.Add(mysticsItemsRhythmHUDUnderCrosshairNote);
			}

			public override void OnTick()
			{
				base.OnTick();
				currentComboAnimationType = ComboAnimationType.Tick;
				comboAnimationTime = 0f;
				comboAnimationDuration = 0.1f;
			}

			public override void OnCombo()
			{
				base.OnCombo();
				UpdateText();
				currentComboAnimationType = ComboAnimationType.Hit;
				comboAnimationTime = 0f;
				comboAnimationDuration = 0.1f;
				notes.RemoveAll((MysticsItemsRhythmHUDUnderCrosshairNote x) => !Object.op_Implicit((Object)(object)x));
				foreach (MysticsItemsRhythmHUDUnderCrosshairNote item in notes.Where((MysticsItemsRhythmHUDUnderCrosshairNote x) => x.remainingTime <= rhythmBehaviour.beatWindowEarly))
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}

			public override void OnComboBreak()
			{
				base.OnComboBreak();
				UpdateText();
				currentComboAnimationType = ComboAnimationType.Break;
				comboAnimationTime = 0f;
				comboAnimationDuration = 0.2f;
			}

			public void UpdateText()
			{
				if (Object.op_Implicit((Object)(object)comboText))
				{
					((Behaviour)comboText).enabled = rhythmUIComboText;
					if (((Behaviour)comboText).enabled && Object.op_Implicit((Object)(object)rhythmBehaviour))
					{
						((TMP_Text)comboText).text = "x" + rhythmBehaviour.combo;
					}
				}
			}
		}

		public class MysticsItemsRhythmHUDOverSkills : MysticsItemsRhythmHUD
		{
			public class MysticsItemsRhythmHUDOverSkillsNote : MonoBehaviour
			{
				public float maxTime;

				public float remainingTime;

				public float yOffset = 60f;

				public RectTransform rectTransform;

				public AnimationCurve noteFadeInAnimation;

				public Material materialInstance;

				public bool destroyMaterialInstanceOnDestroy = true;

				public void Awake()
				{
					ref RectTransform reference = ref rectTransform;
					Transform transform = ((Component)this).transform;
					reference = (RectTransform)(object)((transform is RectTransform) ? transform : null);
					UpdateAlpha();
				}

				public void Update()
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_007e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0083: Unknown result type (might be due to invalid IL or missing references)
					//IL_0098: Unknown result type (might be due to invalid IL or missing references)
					//IL_009d: Unknown result type (might be due to invalid IL or missing references)
					//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
					Vector3 localPosition = ((Component)this).transform.localPosition;
					float num = remainingTime / maxTime * yOffset;
					Rect rect = rectTransform.rect;
					localPosition.y = num + ((Rect)(ref rect)).height;
					((Component)this).transform.localPosition = localPosition;
					remainingTime -= Time.deltaTime;
					if (Object.op_Implicit((Object)(object)materialInstance))
					{
						UpdateAlpha();
						float y = localPosition.y;
						rect = rectTransform.rect;
						float num2 = y + ((Rect)(ref rect)).height * 0.5f;
						rect = rectTransform.rect;
						float num3 = Mathf.Clamp01(1f - num2 / ((Rect)(ref rect)).height);
						if (num3 >= 1f)
						{
							Object.Destroy((Object)(object)((Component)this).gameObject);
						}
						else
						{
							materialInstance.SetVector("_RenderPortion", new Vector4(0f, 1f, num3, 1f));
						}
					}
				}

				public void UpdateAlpha()
				{
					//IL_0019: 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_004f: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)materialInstance))
					{
						Color color = materialInstance.GetColor("_Color");
						color.a = noteFadeInAnimation.Evaluate(1f - remainingTime / maxTime);
						materialInstance.SetColor("_Color", color);
					}
				}

				public void OnDestroy()
				{
					if (destroyMaterialInstanceOnDestroy)
					{
						Object.Destroy((Object)(object)materialInstance);
					}
				}
			}

			public CanvasGroup canvasGroup;

			public TextMeshProUGUI comboText;

			public GameObject overSkillSingleTemplate;

			public Transform[] overSkillSingleTransforms = (Transform[])(object)new Transform[0];

			public CanvasGroup[] disconnectedCanvasGroups = (CanvasGroup[])(object)new CanvasGroup[0];

			public float comboAnimationTime;

			public float comboAnimationDuration;

			public AnimationCurve comboTickAnimation;

			public float comboTickAnimationMultiplier = 1f;

			public AnimationCurve comboHitAnimation;

			public float comboHitAnimationMultiplier = 1f;

			public AnimationCurve comboBreakAnimation;

			public float comboBreakAnimationMultiplier = 1f;

			public ComboAnimationType currentComboAnimationType;

			public GameObject noteTemplate;

			public List<MysticsItemsRhythmHUDOverSkillsNote> notes = new List<MysticsItemsRhythmHUDOverSkillsNote>();

			public AnimationCurve noteFadeInAnimation;

			public float selfDestructTimer = 10f;

			public new static void RefreshForHUDInstance(HUD hudInstance)
			{
				//IL_00dd: 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)
				CharacterMaster targetMaster = hudInstance.targetMaster;
				CharacterBody val = (Object.op_Implicit((Object)(object)targetMaster) ? targetMaster.GetBody() : null);
				MysticsItemsRhythmBehaviour mysticsItemsRhythmBehaviour = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<MysticsItemsRhythmBehaviour>() : null);
				bool flag = rhythmUIOverSkills && Object.op_Implicit((Object)(object)mysticsItemsRhythmBehaviour);
				MysticsItemsRhythmHUDOverSkills mysticsItemsRhythmHUDOverSkills = MysticsItemsRhythmHUD.instancesList.OfType<MysticsItemsRhythmHUDOverSkills>().FirstOrDefault((MysticsItemsRhythmHUDOverSkills x) => (Object)(object)x.hud == (Object)(object)hudInstance);
				if (Object.op_Implicit((Object)(object)mysticsItemsRhythmHUDOverSkills) != flag)
				{
					if (!Object.op_Implicit((Object)(object)mysticsItemsRhythmHUDOverSkills))
					{
						Transform val2 = (Object.op_Implicit((Object)(object)hudInstance.mainUIPanel) ? hudInstance.mainUIPanel.transform.Find("SpringCanvas/BottomRightCluster/Scaler") : null);
						if (Object.op_Implicit((Object)(object)val2))
						{
							mysticsItemsRhythmHUDOverSkills = Object.Instantiate<GameObject>(rhythmHUDOverSkills, val2).GetComponent<MysticsItemsRhythmHUDOverSkills>();
							((Component)mysticsItemsRhythmHUDOverSkills).transform.localScale = Vector3.one;
							mysticsItemsRhythmHUDOverSkills.hud = hudInstance;
							mysticsItemsRhythmHUDOverSkills.overSkillSingleTransforms = (Transform[])(object)new Transform[0];
							Transform val3 = val2.Find("Skill1Root");
							if (Object.op_Implicit((Object)(object)val3))
							{
								CanvasGroup component = ((Component)mysticsItemsRhythmHUDOverSkills.comboText).GetComponent<CanvasGroup>();
								ArrayUtils.ArrayAppend<CanvasGroup>(ref mysticsItemsRhythmHUDOverSkills.disconnectedCanvasGroups, ref component);
								((TMP_Text)mysticsItemsRhythmHUDOverSkills.comboText).transform.SetParent(val3, false);
							}
							Transform[] array = (Transform[])(object)new Transform[3]
							{
								val2.Find("Skill2Root"),
								val2.Find("Skill3Root"),
								val2.Find("Skill4Root")
							};
							foreach (Transform val4 in array)
							{
								if (Object.op_Implicit((Object)(object)val4))
								{
									GameObject val5 = Object.Instantiate<GameObject>(mysticsItemsRhythmHUDOverSkills.overSkillSingleTemplate, val4);
									val5.transform.localScale = Vector3.one;
									val5.SetActive(true);
									ref Transform[] reference = ref mysticsItemsRhythmHUDOverSkills.overSkillSingleTransforms;
									Transform val6 = val5.transform.Find("Offset");
									ArrayUtils.ArrayAppend<Transform>(ref reference, ref val6);
									ref CanvasGroup[] reference2 = ref mysticsItemsRhythmHUDOverSkills.disconnectedCanvasGroups;
									CanvasGroup component2 = val5.GetComponent<CanvasGroup>();
									ArrayUtils.ArrayAppend<CanvasGroup>(ref reference2, ref component2);
								}
							}
						}
					}
					else
					{
						Object.Destroy((Object)(object)((Component)mysticsItemsRhythmHUDOverSkills).gameObject);
					}
				}
				if (flag && Object.op_Implicit((Object)(object)mysticsItemsRhythmHUDOverSkills))
				{
					mysticsItemsRhythmHUDOverSkills.rhythmBehaviour = mysticsItemsRhythmBehaviour;
					mysticsItemsRhythmHUDOverSkills.UpdateText();
				}
			}

			public void Update()
			{
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)canvasGroup))
				{
					float alpha = CalculateFadeAlpha();
					canvasGroup.alpha = alpha;
					CanvasGroup[] array = disconnectedCanvasGroups;
					foreach (CanvasGroup val in array)
					{
						if (Object.op_Implicit((Object)(object)val))
						{
							val.alpha = alpha;
						}
					}
				}
				if (Object.op_Implicit((Object)(object)comboText) && currentComboAnimationType != ComboAnimationType.None)
				{
					float num = Mathf.Clamp01(comboAnimationTime / comboAnimationDuration);
					comboAnimationTime += Time.deltaTime;
					switch (currentComboAnimationType)
					{
					case ComboAnimationType.Tick:
						((TMP_Text)comboText).transform.localScale = Vector3.one * comboTickAnimation.Evaluate(num) * comboTickAnimationMultiplier;
						break;
					case ComboAnimationType.Hit:
						((TMP_Text)comboText).transform.localScale = Vector3.one * comboHitAnimation.Evaluate(num) * comboHitAnimationMultiplier;
						break;
					case ComboAnimationType.Break:
					{
						Vector3 localPosition = ((TMP_Text)comboText).transform.localPosition;
						localPosition.x = comboBreakAnimation.Evaluate(num) * comboBreakAnimationMultiplier;
						((TMP_Text)comboText).transform.localPosition = localPosition;
						break;
					}
					}
					if (num >= 1f)
					{
						currentComboAnimationType = ComboAnimationType.None;
					}
				}
				if (!Object.op_Implicit((Object)(object)rhythmBehaviour))
				{
					selfDestructTimer -= Time.deltaTime;
				}
				if (selfDestructTimer <= 0f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}

			public void OnDestroy()
			{
				if (Object.op_Implicit((Object)(object)comboText))
				{
					Object.Destroy((Object)(object)((Component)comboText).gameObject);
				}
				Transform[] array = overSkillSingleTransforms;
				foreach (Transform val in array)
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						Object.Destroy((Object)(object)((Component)val.parent).gameObject);
					}
				}
			}

			public override void OnBeginRead()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				base.OnBeginRead();
				Transform[] array = overSkillSingleTransforms;
				foreach (Transform val in array)
				{
					GameObject obj = Object.Instantiate<GameObject>(noteTemplate, val);
					obj.SetActive(true);
					MysticsItemsRhythmHUDOverSkillsNote mysticsItemsRhythmHUDOverSkillsNote = obj.AddComponent<MysticsItemsRhythmHUDOverSkillsNote>();
					mysticsItemsRhythmHUDOverSkillsNote.maxTime = (mysticsItemsRhythmHUDOverSkillsNote.remainingTime = rhythmBehaviour.readTime);
					Transform obj2 = val.Find("Bar");
					Rect rect = ((RectTransform)((obj2 is RectTransform) ? obj2 : null)).rect;
					mysticsItemsRhythmHUDOverSkillsNote.yOffset = ((Rect)(ref rect)).height;
					mysticsItemsRhythmHUDOverSkillsNote.noteFadeInAnimation = noteFadeInAnimation;
					Image component = obj.GetComponent<Image>();
					mysticsItemsRhythmHUDOverSkillsNote.materialInstance = Object.Instantiate<Material>(((Graphic)component).material);
					((Graphic)component).material = mysticsItemsRhythmHUDOverSkillsNote.materialInstance;
					mysticsItemsRhythmHUDOverSkillsNote.UpdateAlpha();
					notes.Add(mysticsItemsRhythmHUDOverSkillsNote);
				}
			}

			public override void OnTick()
			{
				base.OnTick();
				currentComboAnimationType = ComboAnimationType.Tick;
				comboAnimationTime = 0f;
				comboAnimationDuration = 0.1f;
			}

			public override void OnCombo()
			{
				base.OnCombo();
				UpdateText();
				currentComboAnimationType = ComboAnimationType.Hit;
				comboAnimationTime = 0f;
				comboAnimationDuration = 0.1f;
				notes.RemoveAll((MysticsItemsRhythmHUDOverSkillsNote x) => !Object.op_Implicit((Object)(object)x));
				foreach (MysticsItemsRhythmHUDOverSkillsNote item in notes.Where((MysticsItemsRhythmHUDOverSkillsNote x) => x.remainingTime <= rhythmBehaviour.beatWindowEarly))
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}

			public override void OnComboBreak()
			{
				base.OnComboBreak();
				UpdateText();
				currentComboAnimationType = ComboAnimationType.Break;
				comboAnimationTime = 0f;
				comboAnimationDuration = 0.2f;
			}

			public void UpdateText()
			{
				if (Object.op_Implicit((Object)(object)comboText))
				{
					((Behaviour)comboText).enabled = rhythmUIComboText;
					if (((Behaviour)comboText).enabled && Object.op_Implicit((Object)(object)rhythmBehaviour))
					{
						((TMP_Text)comboText).text = "x" + rhythmBehaviour.combo;
					}
				}
			}
		}

		public class MysticsItemsRhythmBehaviour : ItemBehavior
		{
			public class SyncCombo : INetMessage, ISerializableObject
			{
				private NetworkInstanceId objID;

				private int combo;

				public SyncCombo()
				{
				}

				public SyncCombo(NetworkInstanceId objID, int combo)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					this.objID = objID;
					this.combo = combo;
				}

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

				public void OnReceived()
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					GameObject val = Util.FindNetworkObject(objID);
					if (Object.op_Implicit((Object)(object)val))
					{
						MysticsItemsRhythmBehaviour component = val.GetComponent<MysticsItemsRhythmBehaviour>();
						if (Object.op_Implicit((Object)(object)component))
						{
							component.combo = combo;
						}
					}
				}

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

			public static string beatSoundString = "MysticsItems_Play_item_proc_rhythm_beat";

			public static string hitSoundString = "MysticsItems_Play_item_proc_rhythm_hit";

			public static string prepareSoundStr