Decompiled source of MoreClothing v1.0.0

Mods/MoreClothing_IL2Cpp.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.Clothing;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.UI.Shop;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Microsoft.CodeAnalysis;
using MoreClothing;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "MoreClothing", "1.0.0", "j0ckinjz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyMetadata("NexusModID", "1062")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("MoreClothing_IL2Cpp")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreClothing_IL2Cpp")]
[assembly: AssemblyTitle("MoreClothing_IL2Cpp")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 MoreClothing
{
	public static class ClothingInjector
	{
		[CompilerGenerated]
		private sealed class <InitializeShopListings>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private ClothingShopInterface <shop>5__1;

			private List<Variants>.Enumerator <>s__2;

			private Variants <variant>5__3;

			private ShopListing <listing>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InitializeShopListings>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<shop>5__1 = null;
				<>s__2 = default(List<Variants>.Enumerator);
				<variant>5__3 = null;
				<listing>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: 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_010f: Expected O, but got Unknown
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<shop>5__1 = Object.FindObjectOfType<ClothingShopInterface>();
				if (!Object.op_Implicit((Object)(object)<shop>5__1) || ((ShopInterface)<shop>5__1).Listings == null)
				{
					Log.Warn("[MoreClothing] No valid ClothingShopInterface found.");
					return false;
				}
				<>s__2 = ClothingVariants.All.GetEnumerator();
				try
				{
					while (<>s__2.MoveNext())
					{
						<variant>5__3 = <>s__2.Current;
						if (!Object.op_Implicit((Object)(object)<variant>5__3?.Definition))
						{
							Log.Warn("[MoreClothing] Skipped " + <variant>5__3?.Name + " — no definition.");
							continue;
						}
						<listing>5__4 = new ShopListing
						{
							Item = (StorableItemDefinition)(object)<variant>5__3.Definition,
							name = <variant>5__3.Name,
							OverridePrice = true,
							OverriddenPrice = <variant>5__3.Price
						};
						((ShopInterface)<shop>5__1).Listings.Add(<listing>5__4);
						((ShopInterface)<shop>5__1).CreateListingUI(<listing>5__4);
						Log.Msg("Injected " + <variant>5__3.Name + " into clothing shop.");
						<listing>5__4 = null;
						<variant>5__3 = null;
					}
				}
				finally
				{
					((IDisposable)<>s__2).Dispose();
				}
				<>s__2 = default(List<Variants>.Enumerator);
				Log.Msg("All listings injected successfully.");
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static bool _hasInjected;

		private static bool _baseDefMissingWarned;

		private static CategoryInstance MakeCategory(EClothingSlot slot)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0023: 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_000d: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			EShopCategory val = (((int)slot == 2) ? ((EShopCategory)10) : (((int)slot == 4) ? ((EShopCategory)12) : (((int)slot != 8) ? ((EShopCategory)0) : ((EShopCategory)16))));
			if (1 == 0)
			{
			}
			EShopCategory category = val;
			return new CategoryInstance
			{
				Category = category
			};
		}

		public static void InjectAll()
		{
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			if (_hasInjected)
			{
				return;
			}
			_hasInjected = true;
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition val = null;
				Enumerator<ItemRegister> enumerator2 = Singleton<Registry>.Instance.ItemRegistry.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					ItemRegister current2 = enumerator2.Current;
					ItemDefinition val2 = ((current2 != null) ? current2.Definition : null);
					if (!Object.op_Implicit((Object)(object)val2) || !(((Object)val2).name == "TacticalVest"))
					{
						continue;
					}
					val = ((Il2CppObjectBase)val2).TryCast<ClothingDefinition>();
					break;
				}
				if (!Object.op_Implicit((Object)(object)val) && !_baseDefMissingWarned)
				{
					Log.Warn("[MoreClothing] Could not find base item 'TacticalVest' in Registry.");
					_baseDefMissingWarned = true;
				}
				ClothingDefinition val3 = ((Il2CppObjectBase)ScriptableObject.CreateInstance(Il2CppType.Of<ClothingDefinition>())).TryCast<ClothingDefinition>();
				if (!Object.op_Implicit((Object)(object)val3))
				{
					Log.Error("[MoreClothing] Failed to create ClothingDefinition for '" + item.ID + "'");
					continue;
				}
				((ItemDefinition)val3).Name = item.Name;
				((Object)val3).name = item.Name.Replace(" ", "");
				((ItemDefinition)val3).ID = item.ID;
				val3.ClothingAssetPath = item.AssetPath;
				val3.Slot = item.Slot;
				val3.ApplicationType = item.ApplicationType;
				val3.Colorable = item.Colorable;
				val3.DefaultColor = item.DefaultColor;
				((StorableItemDefinition)val3).BasePurchasePrice = item.Price;
				((ItemDefinition)val3).Category = (EItemCategory)11;
				((ItemDefinition)val3).Description = item.Description;
				((ItemDefinition)val3).StackLimit = 1;
				((StorableItemDefinition)val3).ShopCategories = new List<CategoryInstance>();
				((StorableItemDefinition)val3).ShopCategories.Add(MakeCategory(item.Slot));
				if (!string.IsNullOrEmpty(item.ID))
				{
					string resourceName = "MoreClothing.Icons." + item.ID + ".png";
					Sprite val4 = Helpers.LoadEmbeddedIcon(resourceName);
					if (Object.op_Implicit((Object)(object)val4))
					{
						((ItemDefinition)val3).Icon = val4;
					}
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					((StorableItemDefinition)val3).StoredItem = ((StorableItemDefinition)val).StoredItem;
					((ItemDefinition)val3).CustomItemUI = ((ItemDefinition)val).CustomItemUI;
					((ItemDefinition)val3).Keywords = ((ItemDefinition)val).Keywords;
				}
				item.Definition = val3;
				Log.Msg("Created ClothingDefinition: " + ((ItemDefinition)val3).Name);
			}
		}

		public static void RegisterDefinitions()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition definition = item.Definition;
				if (!Object.op_Implicit((Object)(object)definition))
				{
					Log.Warn("Missing definition for variant " + item.ID);
					continue;
				}
				Singleton<Registry>.Instance.AddToRegistry((ItemDefinition)(object)definition);
				Singleton<Registry>.Instance.AddToItemDictionary(new ItemRegister
				{
					ID = ((ItemDefinition)definition).ID,
					Definition = (ItemDefinition)(object)definition
				});
			}
		}

		[IteratorStateMachine(typeof(<InitializeShopListings>d__5))]
		public static IEnumerator InitializeShopListings()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitializeShopListings>d__5(0);
		}
	}
	[HarmonyPatch(typeof(Registry), "Awake")]
	public static class PatchRegistryAwake
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			ClothingInjector.InjectAll();
			ClothingInjector.RegisterDefinitions();
		}
	}
	public class Variants
	{
		public string Name;

		public string ID;

		public float Price;

		public string Description;

		public string AssetPath;

		public EClothingSlot Slot;

		public EClothingApplicationType ApplicationType;

		public bool Colorable;

		public EClothingColor DefaultColor;

		public ClothingDefinition Definition;
	}
	public static class ClothingVariants
	{
		public static List<Variants> All = new List<Variants>
		{
			new Variants
			{
				Name = "Police Tactical Vest",
				ID = "bulletproofvest_police",
				Description = "Very tough looking vest. It doesn't actually block bullets, though. Police issued.",
				Price = 200f,
				AssetPath = "Avatar/Accessories/Chest/BulletproofVest/BulletproofVest_Police",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Police Cap",
				ID = "policecap",
				Description = "Standard-issue police cap. Offers no protection, but a strong sense of authority.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/policecap/PoliceCap",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Respirator",
				ID = "respirator",
				Description = "Blocks out the bad stuff. Or at least makes you feel like it does.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/respirator/Respirator",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Hazmat Suit",
				ID = "hazmatsuit",
				Description = "Complete body coverage for those ‘don’t ask what I’m doing’ days.",
				Price = 200f,
				AssetPath = "Avatar/layers/top/HazmatSuit",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = true,
				DefaultColor = (EClothingColor)13
			},
			new Variants
			{
				Name = "Police Belt",
				ID = "policebelt",
				Description = "Comes with holsters and zero responsibility. For decorative law enforcement.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/waist/policebelt/PoliceBelt",
				Slot = (EClothingSlot)2,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Fast Food T-Shirt",
				ID = "fastfoodtshirt",
				Description = "Grease-stained uniform of the flavor elite. Smells like tacos, permanently.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/FastFood T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Gas Station T-Shirt",
				ID = "gasstationtshirt",
				Description = "Proudly repping petroleum. Includes complimentary sweat.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/GasStation T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Tucked T-Shirt",
				ID = "tuckedtshirt",
				Description = "For when you want to look like you care... but not that much.",
				Price = 50f,
				AssetPath = "Avatar/layers/top/Tucked T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = true,
				DefaultColor = (EClothingColor)0
			},
			new Variants
			{
				Name = "Priest Gown",
				ID = "priestgown",
				Description = "God is good. We're not.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/Waist/PriestGown/PriestGown",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			}
		};
	}
	public class Core : MelonMod
	{
		public override void OnInitializeMelon()
		{
			Harmony.CreateAndPatchAll(typeof(Core).Assembly, (string)null);
			Log.Msg("Mod Initialized. Version " + ((MelonBase)this).Info.Version);
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (sceneName == "Main")
			{
				MelonCoroutines.Start(ClothingInjector.InitializeShopListings());
			}
		}
	}
	internal static class Log
	{
		public static void Msg(string msg)
		{
			Melon<Core>.Logger.Msg(msg);
		}

		public static void Warn(string warn)
		{
			Melon<Core>.Logger.Warning(warn);
		}

		public static void Error(string error)
		{
			Melon<Core>.Logger.Error(error);
		}
	}
	internal class Helpers
	{
		public static Sprite LoadEmbeddedIcon(string resourceName)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Assembly assembly = typeof(Core).Assembly;
			using Stream stream = assembly.GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				Log.Warn("Resource not found: " + resourceName);
				return null;
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(memoryStream.ToArray()));
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

Mods/MoreClothing_Mono.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using MoreClothing;
using ScheduleOne;
using ScheduleOne.Clothing;
using ScheduleOne.DevUtilities;
using ScheduleOne.ItemFramework;
using ScheduleOne.UI.Shop;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "MoreClothing", "1.0.0", "j0ckinjz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyMetadata("NexusModID", "1062")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("MoreClothing_Mono")]
[assembly: AssemblyConfiguration("MONO")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreClothing_Mono")]
[assembly: AssemblyTitle("MoreClothing_Mono")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 MoreClothing
{
	public static class ClothingInjector
	{
		[CompilerGenerated]
		private sealed class <InitializeShopListings>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private ClothingShopInterface <shop>5__1;

			private List<Variants>.Enumerator <>s__2;

			private Variants <variant>5__3;

			private ShopListing <listing>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InitializeShopListings>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<shop>5__1 = null;
				<>s__2 = default(List<Variants>.Enumerator);
				<variant>5__3 = null;
				<listing>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Expected O, but got Unknown
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<shop>5__1 = Object.FindObjectOfType<ClothingShopInterface>();
				if (!Object.op_Implicit((Object)(object)<shop>5__1) || ((ShopInterface)<shop>5__1).Listings == null)
				{
					Log.Warn("[MoreClothing] No valid ClothingShopInterface found.");
					return false;
				}
				<>s__2 = ClothingVariants.All.GetEnumerator();
				try
				{
					while (<>s__2.MoveNext())
					{
						<variant>5__3 = <>s__2.Current;
						if (!Object.op_Implicit((Object)(object)<variant>5__3?.Definition))
						{
							Log.Warn("[MoreClothing] Skipped " + <variant>5__3?.Name + " — no definition.");
							continue;
						}
						<listing>5__4 = new ShopListing
						{
							Item = (StorableItemDefinition)(object)<variant>5__3.Definition,
							name = <variant>5__3.Name,
							OverridePrice = true,
							OverriddenPrice = <variant>5__3.Price
						};
						((ShopInterface)<shop>5__1).Listings.Add(<listing>5__4);
						((ShopInterface)<shop>5__1).CreateListingUI(<listing>5__4);
						Log.Msg("Injected " + <variant>5__3.Name + " into clothing shop.");
						<listing>5__4 = null;
						<variant>5__3 = null;
					}
				}
				finally
				{
					((IDisposable)<>s__2).Dispose();
				}
				<>s__2 = default(List<Variants>.Enumerator);
				Log.Msg("All listings injected successfully.");
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static bool _hasInjected;

		private static bool _baseDefMissingWarned;

		private static CategoryInstance MakeCategory(EClothingSlot slot)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0023: 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_000d: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: 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_003d: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			EShopCategory val = (((int)slot == 2) ? ((EShopCategory)10) : (((int)slot == 4) ? ((EShopCategory)12) : (((int)slot != 8) ? ((EShopCategory)0) : ((EShopCategory)16))));
			if (1 == 0)
			{
			}
			EShopCategory category = val;
			return new CategoryInstance
			{
				Category = category
			};
		}

		public static void InjectAll()
		{
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			if (_hasInjected)
			{
				return;
			}
			_hasInjected = true;
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition val = null;
				foreach (ItemRegister item2 in Singleton<Registry>.Instance.ItemRegistry)
				{
					ItemDefinition val2 = item2?.Definition;
					if (!Object.op_Implicit((Object)(object)val2) || !(((Object)val2).name == "TacticalVest"))
					{
						continue;
					}
					val = (ClothingDefinition)(object)((val2 is ClothingDefinition) ? val2 : null);
					break;
				}
				if (!Object.op_Implicit((Object)(object)val) && !_baseDefMissingWarned)
				{
					Log.Warn("[MoreClothing] Could not find base item 'TacticalVest' in Registry.");
					_baseDefMissingWarned = true;
				}
				ClothingDefinition val3 = ScriptableObject.CreateInstance<ClothingDefinition>();
				if (!Object.op_Implicit((Object)(object)val3))
				{
					Log.Error("[MoreClothing] Failed to create ClothingDefinition for '" + item.ID + "'");
					continue;
				}
				((ItemDefinition)val3).Name = item.Name;
				((Object)val3).name = item.Name.Replace(" ", "");
				((ItemDefinition)val3).ID = item.ID;
				val3.ClothingAssetPath = item.AssetPath;
				val3.Slot = item.Slot;
				val3.ApplicationType = item.ApplicationType;
				val3.Colorable = item.Colorable;
				val3.DefaultColor = item.DefaultColor;
				((StorableItemDefinition)val3).BasePurchasePrice = item.Price;
				((ItemDefinition)val3).Category = (EItemCategory)11;
				((ItemDefinition)val3).Description = item.Description;
				((ItemDefinition)val3).StackLimit = 1;
				((StorableItemDefinition)val3).ShopCategories = new List<CategoryInstance>();
				((StorableItemDefinition)val3).ShopCategories.Add(MakeCategory(item.Slot));
				if (!string.IsNullOrEmpty(item.ID))
				{
					string resourceName = "MoreClothing.Icons." + item.ID + ".png";
					Sprite val4 = Helpers.LoadEmbeddedIcon(resourceName);
					if (Object.op_Implicit((Object)(object)val4))
					{
						((ItemDefinition)val3).Icon = val4;
					}
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					((StorableItemDefinition)val3).StoredItem = ((StorableItemDefinition)val).StoredItem;
					((ItemDefinition)val3).CustomItemUI = ((ItemDefinition)val).CustomItemUI;
					((ItemDefinition)val3).Keywords = ((ItemDefinition)val).Keywords;
				}
				item.Definition = val3;
				Log.Msg("Created ClothingDefinition: " + ((ItemDefinition)val3).Name);
			}
		}

		public static void RegisterDefinitions()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition definition = item.Definition;
				if (!Object.op_Implicit((Object)(object)definition))
				{
					Log.Warn("Missing definition for variant " + item.ID);
					continue;
				}
				Singleton<Registry>.Instance.AddToRegistry((ItemDefinition)(object)definition);
				Singleton<Registry>.Instance.AddToItemDictionary(new ItemRegister
				{
					ID = ((ItemDefinition)definition).ID,
					Definition = (ItemDefinition)(object)definition
				});
			}
		}

		[IteratorStateMachine(typeof(<InitializeShopListings>d__5))]
		public static IEnumerator InitializeShopListings()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitializeShopListings>d__5(0);
		}
	}
	[HarmonyPatch(typeof(Registry), "Awake")]
	public static class PatchRegistryAwake
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			ClothingInjector.InjectAll();
			ClothingInjector.RegisterDefinitions();
		}
	}
	public class Variants
	{
		public string Name;

		public string ID;

		public float Price;

		public string Description;

		public string AssetPath;

		public EClothingSlot Slot;

		public EClothingApplicationType ApplicationType;

		public bool Colorable;

		public EClothingColor DefaultColor;

		public ClothingDefinition Definition;
	}
	public static class ClothingVariants
	{
		public static List<Variants> All = new List<Variants>
		{
			new Variants
			{
				Name = "Police Tactical Vest",
				ID = "bulletproofvest_police",
				Description = "Very tough looking vest. It doesn't actually block bullets, though. Police issued.",
				Price = 200f,
				AssetPath = "Avatar/Accessories/Chest/BulletproofVest/BulletproofVest_Police",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Police Cap",
				ID = "policecap",
				Description = "Standard-issue police cap. Offers no protection, but a strong sense of authority.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/policecap/PoliceCap",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Respirator",
				ID = "respirator",
				Description = "Blocks out the bad stuff. Or at least makes you feel like it does.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/respirator/Respirator",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Hazmat Suit",
				ID = "hazmatsuit",
				Description = "Complete body coverage for those ‘don’t ask what I’m doing’ days.",
				Price = 200f,
				AssetPath = "Avatar/layers/top/HazmatSuit",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = true,
				DefaultColor = (EClothingColor)13
			},
			new Variants
			{
				Name = "Police Belt",
				ID = "policebelt",
				Description = "Comes with holsters and zero responsibility. For decorative law enforcement.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/waist/policebelt/PoliceBelt",
				Slot = (EClothingSlot)2,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Fast Food T-Shirt",
				ID = "fastfoodtshirt",
				Description = "Grease-stained uniform of the flavor elite. Smells like tacos, permanently.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/FastFood T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Gas Station T-Shirt",
				ID = "gasstationtshirt",
				Description = "Proudly repping petroleum. Includes complimentary sweat.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/GasStation T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Tucked T-Shirt",
				ID = "tuckedtshirt",
				Description = "For when you want to look like you care... but not that much.",
				Price = 50f,
				AssetPath = "Avatar/layers/top/Tucked T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = true,
				DefaultColor = (EClothingColor)0
			},
			new Variants
			{
				Name = "Priest Gown",
				ID = "priestgown",
				Description = "God is good. We're not.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/Waist/PriestGown/PriestGown",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			}
		};
	}
	public class Core : MelonMod
	{
		public override void OnInitializeMelon()
		{
			Harmony.CreateAndPatchAll(typeof(Core).Assembly, (string)null);
			Log.Msg("Mod Initialized. Version " + ((MelonBase)this).Info.Version);
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (sceneName == "Main")
			{
				MelonCoroutines.Start(ClothingInjector.InitializeShopListings());
			}
		}
	}
	internal static class Log
	{
		public static void Msg(string msg)
		{
			Melon<Core>.Logger.Msg(msg);
		}

		public static void Warn(string warn)
		{
			Melon<Core>.Logger.Warning(warn);
		}

		public static void Error(string error)
		{
			Melon<Core>.Logger.Error(error);
		}
	}
	internal class Helpers
	{
		public static Sprite LoadEmbeddedIcon(string resourceName)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0076: 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)
			Assembly assembly = typeof(Core).Assembly;
			using Stream stream = assembly.GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				Log.Warn("Resource not found: " + resourceName);
				return null;
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, memoryStream.ToArray());
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}