Decompiled source of Homebrewery v4.3.2

Homebrewery.dll

Decompiled 16 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CodeTalker.Networking;
using CodeTalker.Packets;
using GLTFast;
using GLTFast.Loading;
using GLTFast.Logging;
using GLTFast.Materials;
using HarmonyLib;
using Homebrewery.Code;
using Homebrewery.Code.Commands;
using Homebrewery.Code.Component;
using Homebrewery.Code.Enum;
using Homebrewery.Code.Objects;
using Homebrewery.Code.Objects.SliderLimitCFGs;
using Homebrewery.Code.Objects.Things;
using Homebrewery.Code.Shop;
using Homebrewery.Code.Struct;
using Marioalexsan.AtlyssGLTF;
using Microsoft.CodeAnalysis;
using Mirror;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Homebrewery")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("4.3.2.0")]
[assembly: AssemblyInformationalVersion("4.3.2+844740affb370ccc98cbda4951b3bdd646f198b5")]
[assembly: AssemblyProduct("Homebrewery")]
[assembly: AssemblyTitle("Homebrewery")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.3.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 Homebrewery
{
	internal static class CT
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static PacketListener <0>__P;
		}

		internal const string MOD_ID = "CodeTalker";

		private static bool? _enabled;

		internal static uint _playerIndex;

		internal static bool _ready;

		internal static Dictionary<uint, Player> _players = new Dictionary<uint, Player>();

		internal static bool _f;

		internal static bool _s;

		internal static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("CodeTalker");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		internal static void RegisterListeners()
		{
			//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_0045: 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_0050: Expected O, but got Unknown
			object obj = <>O.<0>__P;
			if (obj == null)
			{
				PacketListener val = P;
				<>O.<0>__P = val;
				obj = (object)val;
			}
			if (!CodeTalkerNetwork.RegisterListener<F>((PacketListener)obj))
			{
				HB.Log("Could not register float packet listener!", 4);
			}
			else
			{
				_f = true;
			}
			object obj2 = <>O.<0>__P;
			if (obj2 == null)
			{
				PacketListener val2 = P;
				<>O.<0>__P = val2;
				obj2 = (object)val2;
			}
			if (!CodeTalkerNetwork.RegisterListener<S>((PacketListener)obj2))
			{
				HB.Log("Could not register string packet listener!", 4);
			}
			else
			{
				_s = true;
			}
		}

		internal static void P(PacketHeader header, PacketBase packet)
		{
			if (_ready)
			{
				if (packet is F f)
				{
					FI(f);
				}
				else if (packet is S s)
				{
					SI(s);
				}
			}
		}

		internal static void FI(F f)
		{
			uint sender = (uint)f.V[1];
			float num = f.V[0];
			if (num != 0f)
			{
				if (num != 1f)
				{
					if (num == 2f)
					{
						CondEffectIn(sender, f.V[3..]);
					}
				}
				else
				{
					LimitsPacketIn(sender, f.V[2], f.V[3..]);
				}
			}
			else
			{
				HBHelloIn(sender);
			}
		}

		internal static void HBHelloIn(uint sender)
		{
			if (sender == _playerIndex)
			{
				ZPartMarkersOut();
				LimitsPacketOut();
			}
			else
			{
				ZPartMarkersOut(sender.ToString(CultureInfo.InvariantCulture));
				LimitsPacketOut(sender);
			}
		}

		internal static void LimitsPacketIn(uint sender, float recipient, float[] v)
		{
			Player value;
			CondEffectManager condEffectManager = default(CondEffectManager);
			if (sender == _playerIndex)
			{
				HB.Log("Ignored a LimitsPacket that was ours", 2);
			}
			else if (recipient != -1f && recipient != (float)_playerIndex)
			{
				HB.Log("Ignored a LimitsPacket that wasn't for us", 2);
			}
			else if (!_players.TryGetValue(sender, out value))
			{
				HB.Log($"Sender ID ({sender}) was not in Players Dictionary!", 4);
			}
			else if (((Component)value).TryGetComponent<CondEffectManager>(ref condEffectManager))
			{
				condEffectManager._boobsLimits = new MinMax(v[0], v[1]);
				condEffectManager._buttLimits = new MinMax(v[2], v[3]);
				condEffectManager._bellyLimits = new MinMax(v[4], v[5]);
				condEffectManager._armsLimits = new MinMax(v[6], v[7]);
				condEffectManager._torsoLimits = new MinMax(v[8], v[9]);
				condEffectManager._muzzleLimits = new MinMax(v[10], v[11]);
				condEffectManager._heightLimits = new MinMax(v[12], v[13]);
				condEffectManager._widthLimits = new MinMax(v[14], v[15]);
				condEffectManager._headLimits = new MinMax(v[16], v[17]);
				condEffectManager._voiceLimits = new MinMax(v[18], v[19]);
			}
		}

		internal static void LimitsPacketOut(float recipient = -1f)
		{
			CondEffectManager condEffectManager = default(CondEffectManager);
			if (((Component)Player._mainPlayer).TryGetComponent<CondEffectManager>(ref condEffectManager))
			{
				CodeTalkerNetwork.SendNetworkPacket((PacketBase)(object)new F(1f, _playerIndex, new float[20]
				{
					condEffectManager._boobsLimits._min,
					condEffectManager._boobsLimits._max,
					condEffectManager._buttLimits._min,
					condEffectManager._buttLimits._max,
					condEffectManager._bellyLimits._min,
					condEffectManager._bellyLimits._max,
					condEffectManager._armsLimits._min,
					condEffectManager._armsLimits._max,
					condEffectManager._torsoLimits._min,
					condEffectManager._torsoLimits._max,
					condEffectManager._muzzleLimits._min,
					condEffectManager._muzzleLimits._max,
					condEffectManager._heightLimits._min,
					condEffectManager._heightLimits._max,
					condEffectManager._widthLimits._min,
					condEffectManager._widthLimits._max,
					condEffectManager._headLimits._min,
					condEffectManager._headLimits._max,
					condEffectManager._voiceLimits._min,
					condEffectManager._voiceLimits._max
				}, recipient));
			}
		}

		internal static void CondEffectIn(uint sender, float[] v)
		{
			CondEffectManager condEffectManager = default(CondEffectManager);
			if (!_players.TryGetValue(sender, out Player value))
			{
				HB.Log($"Sender ID ({sender}) was not in Players Dictionary!", 4);
			}
			else if (((Component)value).TryGetComponent<CondEffectManager>(ref condEffectManager))
			{
				condEffectManager.GetEffect((CondType)v[0], v[1], v[2], v[3], v[4] != 0f);
			}
		}

		internal static void CondEffectOut(CondType cond, float duration, float power, float interval, bool delayed)
		{
			CodeTalkerNetwork.SendNetworkPacket((PacketBase)(object)new F(2f, _playerIndex, new float[5]
			{
				(float)cond,
				duration,
				power,
				interval,
				delayed ? 1 : 0
			}));
		}

		internal static void SI(S s)
		{
			if (uint.TryParse(s.V[1], out var result))
			{
				string text = s.V[0];
				if (text == "0")
				{
					ZPartMarkersIn(result, s.V[2], s.V[3..]);
				}
			}
		}

		internal static void ZPartMarkersIn(uint sender, string recipient, string[] s)
		{
			Player value;
			if (sender == _playerIndex)
			{
				HB.Log("Ignored a ZPartMarkers that was ours", 2);
			}
			else if (recipient.Length > 0 && !recipient.Equals(_playerIndex.ToString(CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase))
			{
				HB.Log("Ignored a ZPartMarkers that wasn't for us", 2);
			}
			else if (HB._players.TryGetValue(sender, out value))
			{
				HB.Log("Got a ZPartMarkers from: " + value._nickname, 2);
				if (s[0].Length > 0)
				{
					Sync.Part(value, FolderType.Skin, s[0]);
				}
				if (s[1].Length > 0)
				{
					Sync.Part(value, FolderType.Mouth, s[1]);
				}
				if (s[2].Length > 0)
				{
					Sync.Part(value, FolderType.Eyes, s[2]);
				}
				if (s[3].Length > 0)
				{
					Sync.Part(value, FolderType.Hair, s[3]);
				}
			}
		}

		internal static void ZPartMarkersOut(string recipient = "")
		{
			PlayerRaceModel playerRaceModel = Player._mainPlayer._pVisual._playerRaceModel;
			if (Lookup._raceTypes.TryGetValue(playerRaceModel._scriptablePlayerRace._raceName, out var value))
			{
				string key = playerRaceModel.SetTextureIndex.ToString(CultureInfo.InvariantCulture);
				string key2 = playerRaceModel.SetMouthIndex.ToString(CultureInfo.InvariantCulture);
				string key3 = playerRaceModel.SetEyeIndex.ToString(CultureInfo.InvariantCulture);
				string key4 = playerRaceModel._setHairIndex.ToString(CultureInfo.InvariantCulture);
				string value2;
				string text = (HB._partInd[value][FolderType.Skin].TryGetValue(key, out value2) ? value2 : string.Empty);
				string value3;
				string text2 = (HB._partInd[value][FolderType.Mouth].TryGetValue(key2, out value3) ? value3 : string.Empty);
				string value4;
				string text3 = (HB._partInd[value][FolderType.Eyes].TryGetValue(key3, out value4) ? value4 : string.Empty);
				string value5;
				string text4 = (HB._partInd[value][FolderType.Hair].TryGetValue(key4, out value5) ? value5 : string.Empty);
				if (text.Length + text2.Length + text3.Length + text4.Length != 0)
				{
					CodeTalkerNetwork.SendNetworkPacket((PacketBase)(object)new S("0", _playerIndex.ToString(CultureInfo.InvariantCulture), new string[4] { text, text2, text3, text4 }, recipient));
				}
			}
		}
	}
	internal sealed class F : PacketBase
	{
		public override string PacketSourceGUID => "Homebrewery";

		[JsonProperty]
		public float[] V { get; set; }

		public F(float type, float sender, float[] values = null, float recipient = -1f)
		{
			List<float> list = new List<float>();
			list.Add(type);
			list.Add(sender);
			list.Add(recipient);
			list.AddRange(values ?? Array.Empty<float>());
			V = list.ToArray();
			((PacketBase)this)..ctor();
		}
	}
	internal sealed class S : PacketBase
	{
		public override string PacketSourceGUID => "Homebrewery";

		[JsonProperty]
		public string[] V { get; set; }

		public S(string type, string sender, string[] values = null, string recipient = "")
		{
			List<string> list = new List<string>();
			list.Add(type);
			list.Add(sender);
			list.Add(recipient);
			list.AddRange(values ?? Array.Empty<string>());
			V = list.ToArray();
			((PacketBase)this)..ctor();
		}
	}
	[BepInPlugin("Homebrewery", "Homebrewery", "4.3.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class HB : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("Homebrewery");

		internal static InstallType _installType = InstallType.r2ModMan;

		private DirectoryInfo? _location;

		private static DirectoryInfo? _internal;

		private DirectoryInfo? _hbFiles;

		private DirectoryInfo? _contentPacks;

		internal static GameObject _homebreweryGameObject = null;

		internal static MainThreadJobber? _jobber;

		internal static Shop? _shop;

		internal static GameObject _gLTFstorage = null;

		public static readonly Dictionary<string, ScriptableArmorRender> ARend = new Dictionary<string, ScriptableArmorRender>(StringComparer.OrdinalIgnoreCase);

		public static readonly Dictionary<string, Mesh> AMesh = new Dictionary<string, Mesh>(StringComparer.OrdinalIgnoreCase);

		public static readonly Dictionary<string, ScriptableWeaponType> WeaponTypes = new Dictionary<string, ScriptableWeaponType>(StringComparer.OrdinalIgnoreCase);

		public static readonly Dictionary<string, ScriptableWeaponProjectileSet> ProjectileSets = new Dictionary<string, ScriptableWeaponProjectileSet>(StringComparer.OrdinalIgnoreCase);

		private readonly Stopwatch _modsSW = new Stopwatch();

		internal double _modsSW_ms;

		internal static readonly Dictionary<string, ModFolder> _modFolders = new Dictionary<string, ModFolder>();

		internal static readonly PieceType[] _armorRenderTypes = new PieceType[9]
		{
			PieceType.chestRenderDisplay,
			PieceType.robeSkirtRender,
			PieceType.armCuffRender,
			PieceType.helmRender,
			PieceType.legPieceRend1,
			PieceType.legPieceRend2,
			PieceType.legPieceRend3,
			PieceType.legPieceRend4,
			PieceType.hipMesh
		};

		internal static readonly PieceType[] _meshPartTypes = new PieceType[6]
		{
			PieceType.capeMesh,
			PieceType.neckCollarMesh,
			PieceType.shoulderPadMesh,
			PieceType.helmOverrideMesh,
			PieceType.shieldMesh,
			PieceType.weaponMesh
		};

		internal static readonly List<ModShop> _modShops = new List<ModShop>();

		internal static readonly Dictionary<PieceType, List<Action>> _modelPartAssignments = new Dictionary<PieceType, List<Action>>
		{
			{
				PieceType.capeMesh,
				new List<Action>()
			},
			{
				PieceType.neckCollarMesh,
				new List<Action>()
			},
			{
				PieceType.chestRenderDisplay,
				new List<Action>()
			},
			{
				PieceType.robeSkirtRender,
				new List<Action>()
			},
			{
				PieceType.armCuffRender,
				new List<Action>()
			},
			{
				PieceType.shoulderPadMesh,
				new List<Action>()
			},
			{
				PieceType.hipMesh,
				new List<Action>()
			},
			{
				PieceType.helmRender,
				new List<Action>()
			},
			{
				PieceType.helmOverrideMesh,
				new List<Action>()
			},
			{
				PieceType.legPieceRend1,
				new List<Action>()
			},
			{
				PieceType.legPieceRend2,
				new List<Action>()
			},
			{
				PieceType.legPieceRend3,
				new List<Action>()
			},
			{
				PieceType.legPieceRend4,
				new List<Action>()
			},
			{
				PieceType.shieldMesh,
				new List<Action>()
			},
			{
				PieceType.weaponMesh,
				new List<Action>()
			}
		};

		internal static readonly List<Action> _weaponActionsActions = new List<Action>();

		internal static readonly List<Action> _consumableDXActions = new List<Action>();

		internal static readonly List<Action> _addNewItems = new List<Action>();

		internal static readonly List<PNG> _pNGs = new List<PNG>();

		internal static readonly List<Task> _importArmorRenderTasks = new List<Task>();

		internal static readonly List<Action> _playerRaceAssignments = new List<Action>();

		internal static readonly List<Task> _importMeshPartTasks = new List<Task>();

		internal static readonly List<Task> _importHairTasks = new List<Task>();

		internal static readonly List<Action> _hairReplaceActions = new List<Action>();

		internal static readonly List<Task> _importAudioTasks = new List<Task>();

		internal static Dictionary<RaceType, Dictionary<FolderType, List<AnyThing>>> _addParts = new Dictionary<RaceType, Dictionary<FolderType, List<AnyThing>>>
		{
			{
				RaceType.Byrdle,
				new Dictionary<FolderType, List<AnyThing>>
				{
					{
						FolderType.Eyes,
						new List<AnyThing>()
					},
					{
						FolderType.Mouth,
						new List<AnyThing>()
					},
					{
						FolderType.Skin,
						new List<AnyThing>()
					},
					{
						FolderType.Hair,
						new List<AnyThing>()
					}
				}
			},
			{
				RaceType.Chang,
				new Dictionary<FolderType, List<AnyThing>>
				{
					{
						FolderType.Eyes,
						new List<AnyThing>()
					},
					{
						FolderType.Mouth,
						new List<AnyThing>()
					},
					{
						FolderType.Skin,
						new List<AnyThing>()
					},
					{
						FolderType.Hair,
						new List<AnyThing>()
					}
				}
			},
			{
				RaceType.Imp,
				new Dictionary<FolderType, List<AnyThing>>
				{
					{
						FolderType.Eyes,
						new List<AnyThing>()
					},
					{
						FolderType.Mouth,
						new List<AnyThing>()
					},
					{
						FolderType.Skin,
						new List<AnyThing>()
					},
					{
						FolderType.Hair,
						new List<AnyThing>()
					}
				}
			},
			{
				RaceType.Kubold,
				new Dictionary<FolderType, List<AnyThing>>
				{
					{
						FolderType.Eyes,
						new List<AnyThing>()
					},
					{
						FolderType.Mouth,
						new List<AnyThing>()
					},
					{
						FolderType.Skin,
						new List<AnyThing>()
					},
					{
						FolderType.Hair,
						new List<AnyThing>()
					}
				}
			},
			{
				RaceType.Poon,
				new Dictionary<FolderType, List<AnyThing>>
				{
					{
						FolderType.Eyes,
						new List<AnyThing>()
					},
					{
						FolderType.Mouth,
						new List<AnyThing>()
					},
					{
						FolderType.Skin,
						new List<AnyThing>()
					},
					{
						FolderType.Hair,
						new List<AnyThing>()
					}
				}
			}
		};

		internal static Dictionary<RaceType, RaceStruct> _races = new Dictionary<RaceType, RaceStruct>();

		internal static readonly ScriptablePlayerRace _playerRace_imp = Resources.Load<ScriptablePlayerRace>("_race/01_race_imp/playerrace_imp");

		internal static readonly ScriptablePlayerRace _playerRace_poon = Resources.Load<ScriptablePlayerRace>("_race/02_race_poon/playerrace_poon");

		internal static readonly ScriptablePlayerRace _playerRace_kubold = Resources.Load<ScriptablePlayerRace>("_race/03_race_kubold/playerrace_kubold");

		internal static readonly ScriptablePlayerRace _playerRace_byrdle = Resources.Load<ScriptablePlayerRace>("_race/04_race_byrdle/playerrace_byrdle");

		internal static readonly ScriptablePlayerRace _playerRace_chang = Resources.Load<ScriptablePlayerRace>("_race/05_race_chang/playerrace_chang");

		internal static Dictionary<RaceType, Dictionary<FolderType, Dictionary<string, string>>> _partInd = new Dictionary<RaceType, Dictionary<FolderType, Dictionary<string, string>>>
		{
			{
				RaceType.Byrdle,
				new Dictionary<FolderType, Dictionary<string, string>>
				{
					{
						FolderType.Eyes,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Mouth,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Skin,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Hair,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					}
				}
			},
			{
				RaceType.Chang,
				new Dictionary<FolderType, Dictionary<string, string>>
				{
					{
						FolderType.Eyes,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Mouth,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Skin,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Hair,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					}
				}
			},
			{
				RaceType.Imp,
				new Dictionary<FolderType, Dictionary<string, string>>
				{
					{
						FolderType.Eyes,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Mouth,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Skin,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Hair,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					}
				}
			},
			{
				RaceType.Kubold,
				new Dictionary<FolderType, Dictionary<string, string>>
				{
					{
						FolderType.Eyes,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Mouth,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Skin,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Hair,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					}
				}
			},
			{
				RaceType.Poon,
				new Dictionary<FolderType, Dictionary<string, string>>
				{
					{
						FolderType.Eyes,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Mouth,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Skin,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					},
					{
						FolderType.Hair,
						new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
					}
				}
			},
			{
				RaceType.HB_ALLRACES,
				new Dictionary<FolderType, Dictionary<string, string>> { 
				{
					FolderType.Dye,
					new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
				} }
			}
		};

		private static CFG? _cfg;

		internal static readonly Dictionary<RaceType, BaseLimitCFG> _limitYoursCfg = new Dictionary<RaceType, BaseLimitCFG>
		{
			{
				RaceType.Byrdle,
				new ByrdleLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Byrdle_YourLimits.cfg"), true), "your")
			},
			{
				RaceType.Chang,
				new ChangLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Chang_YourLimits.cfg"), true), "your")
			},
			{
				RaceType.Imp,
				new ImpLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Imp_YourLimits.cfg"), true), "your")
			},
			{
				RaceType.Kubold,
				new KuboldLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Kubold_YourLimits.cfg"), true), "your")
			},
			{
				RaceType.Poon,
				new PoonLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Poon_YourLimits.cfg"), true), "your")
			}
		};

		internal static readonly Dictionary<RaceType, BaseLimitCFG> _limitOthersCfg = new Dictionary<RaceType, BaseLimitCFG>
		{
			{
				RaceType.Byrdle,
				new ByrdleLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Byrdle_OthersLimits.cfg"), true), "other")
			},
			{
				RaceType.Chang,
				new ChangLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Chang_OthersLimits.cfg"), true), "other")
			},
			{
				RaceType.Imp,
				new ImpLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Imp_OthersLimits.cfg"), true), "other")
			},
			{
				RaceType.Kubold,
				new KuboldLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Kubold_OthersLimits.cfg"), true), "other")
			},
			{
				RaceType.Poon,
				new PoonLimitCFG(new ConfigFile(Path.Combine(Paths.ConfigPath, "HBLimitCFGs", "HB_Poon_OthersLimits.cfg"), true), "other")
			}
		};

		internal static TextureFormat _texFormat = (TextureFormat)5;

		private static bool _hotkeysOn = true;

		public static readonly int UpdateCount = 10;

		internal const string UPDATE_STRING = "Thank you for using Homebrewery 4.3.2!\r\n\r\n\r\n\r\n\r\n\r\nRemember: don't store custom items!\r\nClose: 'T' | Ctrl+P to open HB Phone!";

		private static bool _shownUpdateMessage;

		public static readonly Dictionary<string, AudioClip> AudioClips = new Dictionary<string, AudioClip>(StringComparer.OrdinalIgnoreCase);

		public static readonly Dictionary<string, Sprite> Sprites = new Dictionary<string, Sprite>();

		private static GameObject? _consumableObject;

		private static GameObject? _dyeObject;

		public static readonly Dictionary<string, GameObject> ConsumableObjects = new Dictionary<string, GameObject>(StringComparer.OrdinalIgnoreCase);

		internal static readonly Dictionary<string, float> _dropItemTimers = new Dictionary<string, float>(StringComparer.OrdinalIgnoreCase);

		internal static readonly Dictionary<ScriptableItem, ItemThing> _itemDeluxe = new Dictionary<ScriptableItem, ItemThing>();

		internal static float _foodLevel;

		internal static ScriptableArmorDye? _testDye;

		private static GameManager? _gm;

		internal static CharacterCreationManager? _cCM;

		internal static ManualLogSource _logger = null;

		private static readonly List<(string msg, int typ)> _errorList = new List<(string, int)>();

		internal static int _nudge;

		internal DirectoryInfo Location
		{
			get
			{
				return _location ?? throw new InvalidOperationException("Location wasn't initialised!");
			}
			set
			{
				_location = value;
			}
		}

		internal static DirectoryInfo Internal
		{
			get
			{
				return _internal ?? throw new InvalidOperationException("Internal wasn't initialised!");
			}
			set
			{
				_internal = value;
			}
		}

		internal DirectoryInfo HBFiles
		{
			get
			{
				return _hbFiles ?? throw new InvalidOperationException("HBFiles wasn't initialised!");
			}
			set
			{
				_hbFiles = value;
			}
		}

		internal DirectoryInfo ContentPacks
		{
			get
			{
				return _contentPacks ?? throw new InvalidOperationException("ContentPacks wasn't initialised!");
			}
			set
			{
				_contentPacks = value;
			}
		}

		internal static List<TexReplace> _texReplacements => TexReplacer._texReplacements;

		internal static Dictionary<uint, Player> _players => CT._players;

		internal static CFG Cfg
		{
			get
			{
				return _cfg ?? throw new InvalidOperationException("CFG wasn't initialised!");
			}
			set
			{
				_cfg = value;
			}
		}

		public static GameObject ConsumableObject
		{
			get
			{
				return _consumableObject ?? Resources.Load<GameObject>("_item/02_consumable/03_status/_consumableeffect_healthconsumable");
			}
			set
			{
				_consumableObject = value;
			}
		}

		public static GameObject DyeObject
		{
			get
			{
				return _dyeObject ?? Resources.Load<GameObject>("_item/02_consumable/01_dye/_consumableeffect_blackdye");
			}
			set
			{
				_dyeObject = value;
			}
		}

		public static GameManager GM
		{
			get
			{
				return _gm ?? throw new InvalidOperationException("Tried to use GameManager._current before it was ready!");
			}
			set
			{
				_gm = value;
			}
		}

		public static CharacterCreationManager CCM
		{
			get
			{
				return _cCM ?? throw new InvalidOperationException("Tried to read HB.ccm before it was even set!");
			}
			set
			{
				_cCM = value;
			}
		}

		internal static async Task ReloadAll(bool nocheck)
		{
			if (!nocheck)
			{
				Log("Reloading everything that's changed, hopefully!");
			}
			else
			{
				Log("Reloading everything without checking!");
			}
			foreach (ModFolder value in _modFolders.Values)
			{
				value.Reload(nocheck);
			}
			await Task.WhenAll(_importArmorRenderTasks).ConfigureAwait(continueOnCapturedContext: true);
			PieceType[] armorRenderTypes = _armorRenderTypes;
			foreach (PieceType key in armorRenderTypes)
			{
				foreach (Action item in _modelPartAssignments[key])
				{
					item();
				}
			}
			_importArmorRenderTasks.Clear();
			await Task.WhenAll(_importMeshPartTasks).ConfigureAwait(continueOnCapturedContext: true);
			PieceType[] meshPartTypes = _meshPartTypes;
			foreach (PieceType key2 in meshPartTypes)
			{
				foreach (Action item2 in _modelPartAssignments[key2])
				{
					item2();
				}
			}
			_importMeshPartTasks.Clear();
			await Task.WhenAll(_importHairTasks).ConfigureAwait(continueOnCapturedContext: true);
			if (_importHairTasks.Count > 0)
			{
				foreach (Action hairReplaceAction in _hairReplaceActions)
				{
					hairReplaceAction();
				}
			}
			_hairReplaceActions.Clear();
			_importHairTasks.Clear();
		}

		internal static bool FolderCheck(DirectoryInfo dir)
		{
			DateTime lastAccessTime = dir.LastAccessTime;
			DateTime lastWriteTime = dir.LastWriteTime;
			dir.Refresh();
			if (dir.Exists)
			{
				if (!(lastAccessTime < dir.LastAccessTime))
				{
					return lastWriteTime < dir.LastWriteTime;
				}
				return true;
			}
			return false;
		}

		internal static bool AddNewItem(ScriptableItem item, ItemThing thing)
		{
			if (GM._cachedScriptableItems.TryAdd(item._itemName, item))
			{
				if (!thing.secretitem)
				{
					thing.Mod.StoreItem(thing);
				}
				return true;
			}
			Log(((Object)item).name + " - Failed to add to cachedScriptableItems!", 4);
			return false;
		}

		internal static void AddNewItem(CapeEquip item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void AddNewItem(ChestpieceEquip item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void AddNewItem(Consumable item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void AddNewItem(DyeItem item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
			if (item.Added)
			{
				string text = GM._statLogics._armorDyes.Length.ToString(CultureInfo.InvariantCulture);
				_partInd[RaceType.HB_ALLRACES][FolderType.Dye].Add(item.Marker, text);
				_partInd[RaceType.HB_ALLRACES][FolderType.Dye].Add(text, item.Marker);
				StatLogics statLogics = GM._statLogics;
				ScriptableArmorDye[] armorDyes = GM._statLogics._armorDyes;
				int num = 0;
				ScriptableArmorDye[] array = (ScriptableArmorDye[])(object)new ScriptableArmorDye[1 + armorDyes.Length];
				ReadOnlySpan<ScriptableArmorDye> readOnlySpan = new ReadOnlySpan<ScriptableArmorDye>(armorDyes);
				readOnlySpan.CopyTo(new Span<ScriptableArmorDye>(array).Slice(num, readOnlySpan.Length));
				num += readOnlySpan.Length;
				array[num] = item._obj;
				statLogics._armorDyes = array;
			}
		}

		internal static void AddNewItem(HelmEquip item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void AddNewItem(LeggingsEquip item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void AddNewItem(ShieldEquip item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void AddNewItem(TradeItem item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void AddNewItem(WeaponEquip item)
		{
			item.Added = AddNewItem((ScriptableItem)(object)item._obj, item);
		}

		internal static void ImportArmorRender(GLB glb)
		{
			ArmorRender armorRender = (ArmorRender)glb._thingF.Thing;
			((Object)armorRender._obj).name = glb._name;
			if (armorRender._obj._raceArmorRenders == null || armorRender._obj._raceArmorRenders.Length == 0)
			{
				armorRender._obj._raceArmorRenders = (RaceArmorRender[])(object)new RaceArmorRender[5] { armorRender._byrdle, armorRender._chang, armorRender._imp, armorRender._kubold, armorRender._poon };
				RaceArmorRender[] raceArmorRenders = armorRender._obj._raceArmorRenders;
				foreach (RaceArmorRender rar in raceArmorRenders)
				{
					_playerRaceAssignments.Add(delegate
					{
						RaceArmorPlayerRace(rar);
					});
				}
			}
			_importArmorRenderTasks.Add(AtlyssGLTF.GetArmorRender(glb, armorRender));
		}

		internal static void RaceArmorPlayerRace(RaceArmorRender rar)
		{
			if (GM._cachedScriptableRaces.TryGetValue(rar._raceNameTag, out var value))
			{
				rar._scriptableRace = value;
			}
		}

		internal static void ImportMeshPart(GLB glb)
		{
			MeshPart meshPart = (MeshPart)glb._thingF.Thing;
			_importMeshPartTasks.Add(AtlyssGLTF.GetMeshPart(glb, meshPart));
		}

		internal static void ImportHair(GLB glb)
		{
			Hair hair = (Hair)glb._thingF.Thing;
			hair._name = glb._thingF._mod._name + "-Hair-" + glb._thingF._dir.Name;
			_importHairTasks.Add(AtlyssGLTF.GetHair(glb, hair));
			if (!hair.Added)
			{
				_addParts[RaceType.Byrdle][FolderType.Hair].Add(hair);
				_addParts[RaceType.Chang][FolderType.Hair].Add(hair);
				_addParts[RaceType.Imp][FolderType.Hair].Add(hair);
				_addParts[RaceType.Kubold][FolderType.Hair].Add(hair);
				_addParts[RaceType.Poon][FolderType.Hair].Add(hair);
			}
			else
			{
				_hairReplaceActions.Add(delegate
				{
					HairReplace(hair);
				});
			}
		}

		internal static void HairReplace(Hair hair)
		{
			foreach (KeyValuePair<RaceType, Mesh> item in hair._obj)
			{
				if (_partInd[item.Key][FolderType.Hair].TryGetValue(hair._name, out string value))
				{
					_races[item.Key]._race._hairStyleMeshes[int.Parse(value, CultureInfo.InvariantCulture)] = item.Value;
				}
			}
		}

		internal static void ImportAudio(MP3 mp3)
		{
			Audio audio = (Audio)mp3._thingF.Thing;
			_importAudioTasks.Add(SFX.GetAudioClip(mp3, audio));
		}

		public static void Log(object? t = null, int l = 0)
		{
			if (Cfg._logLevel.Value == -1)
			{
				return;
			}
			if (t == null)
			{
				_logger.LogMessage((object)"Logged a null, nice one.");
				return;
			}
			switch (l)
			{
			case 1:
				if (Cfg._logLevel.Value <= 1)
				{
					_logger.LogDebug(t);
				}
				break;
			case 2:
				if (Cfg._logLevel.Value <= 2)
				{
					_logger.LogMessage(t);
				}
				break;
			case 3:
				_errorList.Add((t.ToString(), 3));
				if (Cfg._logLevel.Value <= 3)
				{
					_logger.LogWarning((object)$"{t}\n");
				}
				break;
			case 4:
				_errorList.Add((t.ToString(), 4));
				_logger.LogError((object)$"{t}\n");
				break;
			default:
				_logger.LogMessage(t);
				break;
			}
		}

		public static void ErrorLister()
		{
			Log("Reprinting warnings and errors:", 2);
			foreach (var (text, num) in _errorList)
			{
				if (num == 3)
				{
					_logger.LogWarning((object)text);
				}
				else
				{
					_logger.LogError((object)text);
				}
			}
			Log("List cleared.", 2);
			_errorList.Clear();
		}

		private static void Bumpscosity()
		{
			int[] array = new int[7] { 0, 1, 12, 50, 76, 100, 1000 };
			Cfg._bumpscosity.Value = array[Random.Range(0, 6)];
			int value = Cfg._bumpscosity.Value;
			if (value < 50)
			{
				if (value > 0)
				{
					if (value < 12)
					{
						if (value == 1)
						{
							Log("Well I'm quite feeling the lack of bumpscosity in here.\nOnly a single bumpscosit. Still, it'll have to do.\n");
						}
						else
						{
							Log("Well I'm quite feeling the lack of bumpscosity in here.\nOnly a few bumpscosits. Still, it'll have to do.\n");
						}
					}
					else
					{
						Log("Just a light breeze of bumpscosity in here at the moment, not bad. I personally enjoy a bit more bumpscosity, but at this amount it's absolutely reasonable.\n");
					}
				}
				else
				{
					Log("Dear me, where did all the bumpscosity go? Quite unnerving in here with all of it gone.\n");
				}
			}
			else if (value < 100)
			{
				if (value < 76)
				{
					Log("Ahh, quite a pleasant amount of bumpscosity we've got today, wouldn't you say? Very enjoyable.\n");
				}
				else
				{
					Log("Well, the bumpscosity in here is really getting up there, isn't it?\nNo matter, the story must carry on no matter how much or how little bumpscosity there is.\n");
				}
			}
			else if (value < 1000)
			{
				Log("Who turned up the bumpscosity so high?\nI like bumpscosity as much as the next person, but a hundred is quite a lot, wouldn't you say?\n");
			}
			else
			{
				Log("My god, the bumpscosity in here is absolutely overwhelming.\nA thousand?! You people have got to be nuts!\nHow can you stand this much bumpscosity?\n");
			}
		}

		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Expected O, but got Unknown
			Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)2);
			_logger = ((BaseUnityPlugin)this).Logger;
			_homebreweryGameObject = new GameObject("Homebrewery-GameObject")
			{
				hideFlags = (HideFlags)61
			};
			_gLTFstorage = new GameObject("GLTFObject")
			{
				hideFlags = (HideFlags)61
			};
			Cfg = new CFG(((BaseUnityPlugin)this).Config);
			_hotkeysOn = Cfg._hotkeysOn.Value;
			if (Cfg._updateMessage.Value >= UpdateCount && !Cfg._alwaysShowUpdateMsg.Value)
			{
				_shownUpdateMessage = true;
			}
			if (Cfg._texCompress.Value)
			{
				_texFormat = (TextureFormat)12;
			}
			Cfg.Clamps();
			Cfg.KeyBinds();
			_homebreweryGameObject.AddComponent<Jiggler>();
			Log($"Waking up at {DateTime.UtcNow:yyyy-MM-dd h:mm:ss tt}... Game Version is: {Application.version}");
			string text = "82025.a2";
			if (!Application.version.Equals(text, StringComparison.OrdinalIgnoreCase))
			{
				Log("This version of Homebrewery was made for game version '" + text + "', so be wary of issues arising due to game changes!", 3);
			}
			Log($"AtlyssGLTF available: {AtlyssGLTF.Enabled}.");
			if (AtlyssGLTF.Enabled)
			{
				Log($"AtlyssGLTF ForceReadableMeshes is {AtlyssGLTF.GetForceReadableMeshes()}", 1);
			}
			_gLTFstorage.transform.parent = _homebreweryGameObject.transform;
			_gLTFstorage.SetActive(false);
			Bumpscosity();
			Location = new DirectoryInfo(((BaseUnityPlugin)this).Info.Location);
			Location = Location.Parent;
			if (Location.Name.Equals("plugins", StringComparison.OrdinalIgnoreCase))
			{
				Log("Homebrewery is not installed incorrectly! The DLL should not be directly in the plugins folder - Leave it inside its 'Catman232-Homebrewery' folder!", 4);
				Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)1);
				return;
			}
			string pluginshbfiles = "HomebreweryFiles";
			if (Directory.Exists(Path.Combine(Location.FullName, "plugins")))
			{
				_installType = InstallType.Manual;
				pluginshbfiles = Path.Combine("plugins", "HomebreweryFiles");
			}
			if (_installType == InstallType.r2ModMan)
			{
				Internal = new DirectoryInfo(Path.Combine(Location.FullName, "Internal"));
				HBFiles = new DirectoryInfo(Path.Combine(Location.FullName, "HomebreweryFiles"));
				TexReplacer._folder = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "TextureReplace"));
				ContentPacks = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "ContentPacks"));
			}
			else if (_installType == InstallType.Manual)
			{
				Internal = new DirectoryInfo(Path.Combine(Location.FullName, "plugins", "Internal"));
				HBFiles = new DirectoryInfo(Path.Combine(Location.FullName, "plugins", "HomebreweryFiles"));
				TexReplacer._folder = new DirectoryInfo(Path.Combine(Location.FullName, "config", "TextureReplace"));
				ContentPacks = new DirectoryInfo(Path.Combine(Location.FullName, "config", "ContentPacks"));
			}
			if (!Internal.Exists)
			{
				Log("Internal folder could not be found! Something is wrong with your mod installation!", 4);
				Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)1);
				return;
			}
			if (!HBFiles.Exists)
			{
				Log("HomebreweryFiles folder could not be found! Something is wrong with your mod installation!", 4);
				Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)1);
				return;
			}
			Log("Mod's folder is called: " + Location.Name);
			Log("HBFiles path should be: " + HBFiles.FullName);
			Log("Internal path should be: " + Internal.FullName);
			Log("Plugins path should be: " + Location.Parent.FullName + "\n");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			Log("_harmony.PatchAll done");
			TexReplacer.Go();
			Assign.NothingMesh = new Mesh();
			Log("Loading Vanilla mesh parts!", 2);
			List<Mesh> list = new List<Mesh>();
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/00_player/player_meshes/_armormeshes/_collars"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/00_player/player_meshes/_armormeshes/_shoulderpads/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/00_player/player_meshes/_armormeshes/_helms/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/00_player/player_meshes/_armormeshes/_capes/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/03_shield/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/00_axehammer/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/01_sword/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/02_dagger/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/03_scepter/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/04_magicbell/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/06_longbow/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/08_polearm/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/01_weapon/09_gun/"));
			IEnumerable<Mesh> enumerable = new <>z__ReadOnlyList<Mesh>(list);
			foreach (Mesh item in enumerable)
			{
				if (!AMesh.TryAdd(((Object)item).name, item) && !AMesh.TryAdd(((Object)item).name + "HB", item))
				{
					Log("Vanilla Mesh Name: " + ((Object)item).name + " is too frequent! Cannot add to Mesh Dictionary!", 4);
				}
			}
			Log("Making Internal Sprites!", 2);
			string[] array = new string[13]
			{
				"based", "Nokia_3310", "BrokenDye", "joker", "VanityIco", "PortalIco", "ExitIco", "ForwardIco", "BackIco", "NextIco",
				"PreviousIco", "StorageIco", "DungeonIco"
			};
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				Sprites.Add(text2, MakeSprite(Internal.FullName, text2));
			}
			Log("Setting up custom condition data!", 2);
			ConsumableObject = Resources.Load<GameObject>("_item/02_consumable/03_status/_consumableeffect_healthconsumable");
			DyeObject = Resources.Load<GameObject>("_item/02_consumable/01_dye/_consumableeffect_blackdye");
			List<GameObject> list2 = new List<GameObject>();
			list2.AddRange(Resources.LoadAll<GameObject>("_item/02_consumable/01_dye/"));
			list2.AddRange(Resources.LoadAll<GameObject>("_item/02_consumable/02_skillscroll/"));
			list2.AddRange(Resources.LoadAll<GameObject>("_item/02_consumable/03_status/"));
			list2.AddRange(from c in Resources.LoadAll<GameObject>("_skill/")
				where ((Object)c).name.StartsWith("_conditionEffect_", StringComparison.OrdinalIgnoreCase) || ((Object)c).name.StartsWith("_conditionObject_", StringComparison.OrdinalIgnoreCase)
				select c);
			IEnumerable<GameObject> enumerable2 = new <>z__ReadOnlyList<GameObject>(list2);
			foreach (GameObject item2 in enumerable2)
			{
				string text3 = ((Object)item2).name.Replace("_consumableEffect_", string.Empty, StringComparison.OrdinalIgnoreCase).Replace("_conditionEffect_", string.Empty, StringComparison.OrdinalIgnoreCase).Replace("_conditionObject_", string.Empty, StringComparison.OrdinalIgnoreCase);
				if (!ConsumableObjects.TryAdd(text3, item2) && !ConsumableObjects.TryAdd(text3 + "HB", item2))
				{
					Log("ConsumableObject Name: " + ((Object)item2).name + " is too frequent! Cannot add to ConsumableObjects Dictionary!", 4);
				}
			}
			ConsumableObjects.Remove("crya");
			Cond.IDSet();
			Log("Checking HomebreweryFiles and constructing objects!");
			_modsSW.Start();
			_modShops.Add(new ModShop("All Items"));
			_modFolders.Add("Catman-Homebrewery", new ModFolder("Catman-Homebrewery", HBFiles));
			Log("Finding other content folders and constructing objects!");
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("Paths:");
			List<DirectoryInfo> list3 = (from d in Location.Parent.EnumerateDirectories()
				where !File.Exists(Path.Combine(d.FullName, "manifest.json.old")) && Directory.Exists(Path.Combine(d.FullName, pluginshbfiles))
				select d).ToList();
			_modFolders.TryAdd(Location.Name, null);
			List<DirectoryInfo> list4 = new List<DirectoryInfo>(1) { HBFiles };
			foreach (DirectoryInfo item3 in list3)
			{
				string name = item3.Name;
				string text4 = Path.Combine(item3.FullName, pluginshbfiles, "HB_Info.json");
				if (File.Exists(text4))
				{
					HB_InfoJson hB_InfoJson = new HB_InfoJson(text4);
					if (hB_InfoJson.Name.Length != 0)
					{
						name = hB_InfoJson.Name;
					}
				}
				if (!_modFolders.ContainsKey(name))
				{
					_modFolders.Add(name, new ModFolder(name, new DirectoryInfo(Path.Combine(item3.FullName, pluginshbfiles))));
					list4.Add(new DirectoryInfo(Path.Combine(item3.FullName, pluginshbfiles)));
					stringBuilder.AppendLine(item3.FullName);
				}
			}
			List<DirectoryInfo> list5 = new List<DirectoryInfo>();
			if (_contentPacks != null)
			{
				list5.AddRange(from d in ContentPacks.EnumerateDirectories()
					where Directory.Exists(Path.Combine(d.FullName, "plugins", "HomebreweryFiles"))
					select d);
				foreach (DirectoryInfo item4 in list5)
				{
					string name2 = item4.Name;
					string text5 = Path.Combine(item4.FullName, "plugins", "HomebreweryFiles", "HB_Info.json");
					if (File.Exists(text5))
					{
						HB_InfoJson hB_InfoJson2 = new HB_InfoJson(text5);
						if (hB_InfoJson2.Name.Length != 0)
						{
							name2 = hB_InfoJson2.Name;
						}
					}
					if (!_modFolders.ContainsKey(name2))
					{
						_modFolders.Add(name2, new ModFolder(name2, new DirectoryInfo(Path.Combine(item4.FullName, "plugins", "HomebreweryFiles"))));
						list4.Add(new DirectoryInfo(Path.Combine(item4.FullName, pluginshbfiles)));
						stringBuilder.AppendLine(item4.FullName);
					}
				}
			}
			if (list4.Count + list5.Count > 0)
			{
				Log($"Mods imported: {list4.Count + list5.Count}");
			}
			else
			{
				Log("None found!\n");
			}
			Log(stringBuilder.ToString(), 1);
			_modsSW.Stop();
			_modsSW_ms = _modsSW.Elapsed.TotalMilliseconds;
			Log($"Time Taken: {_modsSW_ms}ms");
			RaceStructer();
			try
			{
				Cache_HBScriptableAssets();
			}
			catch (Exception)
			{
				throw;
			}
			if (CT.Enabled)
			{
				CT.RegisterListeners();
			}
			_jobber = _homebreweryGameObject.AddComponent<MainThreadJobber>();
			Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)1);
		}

		private static async Task Cache_HBScriptableAssets()
		{
			Log("Cache_HBScriptableAssets()", 1);
			Log("Waiting for GameManager!", 2);
			await Task.Run(async delegate
			{
				while ((Object)(object)_gm == (Object)null)
				{
					await Task.Delay(1000).ConfigureAwait(continueOnCapturedContext: true);
				}
			}).ConfigureAwait(continueOnCapturedContext: true);
			Log("Grabbing ScriptableArmorRenders!", 2);
			ScriptableArmorRender[] array = Resources.FindObjectsOfTypeAll<ScriptableArmorRender>();
			foreach (ScriptableArmorRender val in array)
			{
				ARend[((Object)val).name.Replace("00_armorRender_", string.Empty, StringComparison.OrdinalIgnoreCase).Replace("armorRender_", string.Empty, StringComparison.OrdinalIgnoreCase).Replace("helmRender_", string.Empty, StringComparison.OrdinalIgnoreCase)] = val;
			}
			Log("Grabbing ScriptableWeaponTypes!", 2);
			ScriptableWeaponType[] array2 = Resources.FindObjectsOfTypeAll<ScriptableWeaponType>();
			foreach (ScriptableWeaponType val2 in array2)
			{
				WeaponTypes[val2._weaponTypeClassTag] = val2;
			}
			WeaponTypeCombatParams val3 = WeaponTypes["Unarmed"]._weaponAnimSlots[0]._weaponTypeCombatParams[0];
			val3._allowJumpAttack = true;
			val3._timeBeforeJumpAttack = 0.08f;
			val3._JumpAttackJumpForce = 50f;
			val3._JumpAttackFowardForce = 90f;
			val3._JumpAttackJumpGravityMultiply = 50f;
			val3._jumpLandDelayTime = 0.5f;
			Log("Grabbing ScriptableWeaponProjectileSets!", 2);
			ScriptableWeaponProjectileSet[] array3 = Resources.FindObjectsOfTypeAll<ScriptableWeaponProjectileSet>();
			foreach (ScriptableWeaponProjectileSet val4 in array3)
			{
				ProjectileSets[((Object)val4).name.Replace("weaponProjectileSet_", string.Empty, StringComparison.OrdinalIgnoreCase)] = val4;
			}
			ScriptableStatModifierTable[] array4 = Resources.FindObjectsOfTypeAll<ScriptableStatModifierTable>();
			foreach (ScriptableStatModifierTable val5 in array4)
			{
				if (((Object)val5).name.Equals("statModifierTable_weapon", StringComparison.OrdinalIgnoreCase))
				{
					Assign._scriptableStatModifierTable = val5;
					break;
				}
			}
			Log("Doing RaceArmorRender race assignments!", 2);
			foreach (Action playerRaceAssignment in _playerRaceAssignments)
			{
				playerRaceAssignment();
			}
			_playerRaceAssignments.Clear();
			Log("Awaiting GLB and MP3 imports!");
			await Task.WhenAll(_importArmorRenderTasks).ConfigureAwait(continueOnCapturedContext: true);
			_importArmorRenderTasks.Clear();
			await Task.WhenAll(_importMeshPartTasks).ConfigureAwait(continueOnCapturedContext: true);
			_importMeshPartTasks.Clear();
			ModelAliases();
			await Task.WhenAll(_importHairTasks).ConfigureAwait(continueOnCapturedContext: true);
			_importHairTasks.Clear();
			await Task.WhenAll(_importAudioTasks).ConfigureAwait(continueOnCapturedContext: true);
			_importAudioTasks.Clear();
			Log("Doing model part assignments!", 2);
			foreach (List<Action> value7 in _modelPartAssignments.Values)
			{
				foreach (Action item in value7)
				{
					item();
				}
			}
			Log("Sorting out fancy consumables!", 2);
			foreach (Action consumableDXAction in _consumableDXActions)
			{
				consumableDXAction();
			}
			_consumableDXActions.Clear();
			Log("Inserting Custom items!");
			foreach (Action addNewItem in _addNewItems)
			{
				addNewItem();
			}
			_addNewItems.Clear();
			if (GM._cachedScriptableItems.TryGetValue("#HB#TEST Dye`Catman-Homebrewery-Dye-Homebrewery_Dye_Test#HB#", out var value))
			{
				_testDye = (ScriptableArmorDye)value;
			}
			Log("Sorting out weapon properties!", 2);
			foreach (Action weaponActionsAction in _weaponActionsActions)
			{
				weaponActionsAction();
			}
			_weaponActionsActions.Clear();
			if (_races.TryGetValue(RaceType.Byrdle, out var value2))
			{
				Log("Inserting Custom parts for Byrdle!");
				_addParts[RaceType.Byrdle][FolderType.Mouth] = _addParts[RaceType.Byrdle][FolderType.Mouth].OrderBy((AnyThing m) => (!m._beak) ? 1 : 0).ToList();
				PartInserter(value2);
			}
			if (_races.TryGetValue(RaceType.Chang, out var value3))
			{
				Log("Inserting Custom parts for Chang!");
				PartInserter(value3);
			}
			if (_races.TryGetValue(RaceType.Imp, out var value4))
			{
				Log("Inserting Custom parts for Imp!");
				PartInserter(value4);
			}
			if (_races.TryGetValue(RaceType.Kubold, out var value5))
			{
				Log("Inserting Custom parts for Kubold!");
				PartInserter(value5);
			}
			if (_races.TryGetValue(RaceType.Poon, out var value6))
			{
				Log("Inserting Custom parts for Poon!");
				PartInserter(value6);
			}
			if (Cfg._spreadVanillaParts.Value)
			{
				Log("Sharing Vanilla parts to Byrdle!");
				PartSpreader(value2, value3, value4, value5, value6);
				Log("Sharing Vanilla parts to Chang!");
				PartSpreader(value3, value2, value4, value5, value6);
				Log("Sharing Vanilla parts to Imp!");
				PartSpreader(value4, value2, value3, value5, value6);
				Log("Sharing Vanilla parts to Kubold!");
				PartSpreader(value5, value2, value3, value4, value6);
				Log("Sharing Vanilla parts to Poon!");
				PartSpreader(value6, value2, value3, value4, value5);
			}
			Log("Generating a shop source for some vanilla items!", 2);
			GetVanillaItems();
			Log("Organising the shop sources!", 2);
			for (int n = 1; n < _modShops.Count; n++)
			{
				_modShops[n].SortThem();
				_modShops[n].ChunkThem();
				_modShops[0]._items_Cons.AddRange(_modShops[n]._items_Cons);
				_modShops[0]._items_Gear.AddRange(_modShops[n]._items_Gear);
				_modShops[0]._items_Trad.AddRange(_modShops[n]._items_Trad);
			}
			_modShops[0].ChunkThem();
			if (Cfg._condenseSmallMods.Value > 0)
			{
				ModShop modShop = new ModShop("Small Mods");
				foreach (ModShop item2 in _modShops.ToList())
				{
					int num = item2._items_Gear.Count + item2._items_Trad.Count + item2._items_Cons.Count;
					if (num <= Cfg._condenseSmallMods.Value)
					{
						modShop._items_Gear.AddRange(item2._items_Gear);
						modShop._items_Cons.AddRange(item2._items_Cons);
						modShop._items_Trad.AddRange(item2._items_Trad);
						_modShops.Remove(item2);
					}
				}
				modShop.SortThem();
				modShop.ChunkThem();
				_modShops.Add(modShop);
			}
			_shop = _homebreweryGameObject.AddComponent<Shop>();
			_homebreweryGameObject.AddComponent<Phone>();
			Log("Everything accomplished!");
		}

		internal static void ModelAliases()
		{
			string[][] array = new string[12][]
			{
				new string[2] { "hood", "hood01" },
				new string[2] { "robeSkirt", "robeSkirt01" },
				new string[2] { "armCuffs_00", "armCuff01" },
				new string[2] { "armCuffs_01", "armCuff02" },
				new string[2] { "armCuffs_02", "armCuff03" },
				new string[2] { "chestMesh_00", "chestpiece03" },
				new string[2] { "hipMesh_00", "legPads03" },
				new string[2] { "legCuffs_00", "legCuffs03" },
				new string[2] { "legCuffs_01", "shinPads01" },
				new string[2] { "chestTabard_00", "chestTabard02" },
				new string[2] { "chestTabard_01", "chestTabard03" },
				new string[2] { "belt_00", "beltSash02" }
			};
			string[][] array2 = array;
			foreach (string[] array3 in array2)
			{
				if (ARend.TryGetValue(array3[0], out ScriptableArmorRender value))
				{
					ARend[array3[1]] = value;
				}
			}
			string[][] array4 = new string[5][]
			{
				new string[2] { "_collar_00", "vikingArmor_collar" },
				new string[2] { "Catman-Homebrewery-Mesh-warlockArmor_collar", "warlockArmor_collar" },
				new string[2] { "Catman-Homebrewery-Mesh-thiefArmor_collar", "thiefArmor_collar" },
				new string[2] { "Catman-Homebrewery-Mesh-mysticArmor_collar", "mysticArmor_collar" },
				new string[2] { "Catman-Homebrewery-Mesh-maidArmor_collar", "maidArmor_collar" }
			};
			string[][] array5 = array4;
			foreach (string[] array6 in array5)
			{
				if (AMesh.TryGetValue(array6[0], out Mesh value2))
				{
					AMesh[array6[1]] = value2;
				}
			}
		}

		private static void PartInserter(RaceStruct them)
		{
			foreach (FolderType key in _addParts[them._type].Keys)
			{
				foreach (AnyThing item in _addParts[them._type][key])
				{
					switch (key)
					{
					case FolderType.Eyes:
					{
						Eyes eyes = (Eyes)item;
						string text = them._race._eyeTextures.Length.ToString(CultureInfo.InvariantCulture);
						_partInd[them._type][FolderType.Eyes].Add(eyes._name, text);
						_partInd[them._type][FolderType.Eyes].Add(text, eyes._name);
						ScriptablePlayerRace race2 = them._race;
						EyeTextureGroup[] eyeTextures = them._race._eyeTextures;
						int num = 0;
						EyeTextureGroup[] array2 = (EyeTextureGroup[])(object)new EyeTextureGroup[1 + eyeTextures.Length];
						ReadOnlySpan<EyeTextureGroup> readOnlySpan2 = new ReadOnlySpan<EyeTextureGroup>(eyeTextures);
						readOnlySpan2.CopyTo(new Span<EyeTextureGroup>(array2).Slice(num, readOnlySpan2.Length));
						num += readOnlySpan2.Length;
						array2[num] = eyes._obj;
						race2._eyeTextures = array2;
						eyes.Added = true;
						break;
					}
					case FolderType.Hair:
					{
						Hair hair = (Hair)item;
						if (!((Object)(object)hair._obj[them._type] == (Object)null))
						{
							string text = them._race._hairStyleMeshes.Length.ToString(CultureInfo.InvariantCulture);
							_partInd[them._type][FolderType.Hair].Add(hair._name, text);
							_partInd[them._type][FolderType.Hair].Add(text, hair._name);
							ScriptablePlayerRace race4 = them._race;
							Mesh[] hairStyleMeshes = them._race._hairStyleMeshes;
							int num = 0;
							Mesh[] array4 = (Mesh[])(object)new Mesh[1 + hairStyleMeshes.Length];
							ReadOnlySpan<Mesh> readOnlySpan4 = new ReadOnlySpan<Mesh>(hairStyleMeshes);
							readOnlySpan4.CopyTo(new Span<Mesh>(array4).Slice(num, readOnlySpan4.Length));
							num += readOnlySpan4.Length;
							array4[num] = hair._obj[them._type];
							race4._hairStyleMeshes = array4;
							hair.Added = true;
						}
						break;
					}
					case FolderType.Mouth:
					{
						Mouth mouth = (Mouth)item;
						string text = them._race._mouthTextures.Length.ToString(CultureInfo.InvariantCulture);
						_partInd[them._type][FolderType.Mouth].Add(mouth._name, text);
						_partInd[them._type][FolderType.Mouth].Add(text, mouth._name);
						ScriptablePlayerRace race3 = them._race;
						MouthTextureGroup[] mouthTextures = them._race._mouthTextures;
						int num = 0;
						MouthTextureGroup[] array3 = (MouthTextureGroup[])(object)new MouthTextureGroup[1 + mouthTextures.Length];
						ReadOnlySpan<MouthTextureGroup> readOnlySpan3 = new ReadOnlySpan<MouthTextureGroup>(mouthTextures);
						readOnlySpan3.CopyTo(new Span<MouthTextureGroup>(array3).Slice(num, readOnlySpan3.Length));
						num += readOnlySpan3.Length;
						array3[num] = mouth._obj;
						race3._mouthTextures = array3;
						mouth.Added = true;
						break;
					}
					case FolderType.Skin:
					{
						Skin skin = (Skin)item;
						if (skin._obj[them._type]._textureGroupTag.Length != 0)
						{
							string text = them._race._skinTextureGroups.Length.ToString(CultureInfo.InvariantCulture);
							_partInd[them._type][FolderType.Skin].Add(skin._name, text);
							_partInd[them._type][FolderType.Skin].Add(text, skin._name);
							if ((Object)(object)skin._obj[them._type]._bodyTexture == (Object)null)
							{
								skin._obj[them._type]._bodyTexture = them._race._skinTextureGroups[2]._bodyTexture;
							}
							if ((Object)(object)skin._obj[them._type]._legTexture == (Object)null)
							{
								skin._obj[them._type]._legTexture = them._race._skinTextureGroups[2]._legTexture;
							}
							if ((Object)(object)skin._obj[them._type]._headTexture == (Object)null)
							{
								skin._obj[them._type]._headTexture = them._race._skinTextureGroups[2]._headTexture;
							}
							if ((Object)(object)skin._obj[them._type]._hairTexture == (Object)null)
							{
								skin._obj[them._type]._hairTexture = them._race._skinTextureGroups[2]._hairTexture;
							}
							if ((Object)(object)skin._obj[them._type]._earTexture == (Object)null)
							{
								skin._obj[them._type]._earTexture = them._race._skinTextureGroups[2]._earTexture;
							}
							if ((Object)(object)skin._obj[them._type]._tailTexture == (Object)null)
							{
								skin._obj[them._type]._tailTexture = them._race._skinTextureGroups[2]._tailTexture;
							}
							ScriptablePlayerRace race = them._race;
							SkinTextureGroup[] skinTextureGroups = them._race._skinTextureGroups;
							int num = 0;
							SkinTextureGroup[] array = (SkinTextureGroup[])(object)new SkinTextureGroup[1 + skinTextureGroups.Length];
							ReadOnlySpan<SkinTextureGroup> readOnlySpan = new ReadOnlySpan<SkinTextureGroup>(skinTextureGroups);
							readOnlySpan.CopyTo(new Span<SkinTextureGroup>(array).Slice(num, readOnlySpan.Length));
							num += readOnlySpan.Length;
							array[num] = skin._obj[them._type];
							race._skinTextureGroups = array;
							skin.Added = true;
						}
						break;
					}
					}
				}
				_addParts[them._type][key].Clear();
			}
		}

		private static void PartSpreader(RaceStruct them, RaceStruct a, RaceStruct b, RaceStruct c, RaceStruct d)
		{
			RaceStruct[] array = new RaceStruct[4] { a, b, c, d };
			RaceStruct[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaceStruct raceStruct = array2[i];
				int num = 0;
				EyeTextureGroup[] eyes = raceStruct._eyes;
				foreach (EyeTextureGroup val in eyes)
				{
					string text = them._race._eyeTextures.Length.ToString(CultureInfo.InvariantCulture);
					string text2 = $"Atlyss-Eyes-{raceStruct._race._raceName}{num}";
					num++;
					_partInd[them._type][FolderType.Eyes].Add(text2, text);
					_partInd[them._type][FolderType.Eyes].Add(text, text2);
					ScriptablePlayerRace race = them._race;
					EyeTextureGroup[] eyeTextures = them._race._eyeTextures;
					int num2 = 0;
					EyeTextureGroup[] array3 = (EyeTextureGroup[])(object)new EyeTextureGroup[1 + eyeTextures.Length];
					ReadOnlySpan<EyeTextureGroup> readOnlySpan = new ReadOnlySpan<EyeTextureGroup>(eyeTextures);
					readOnlySpan.CopyTo(new Span<EyeTextureGroup>(array3).Slice(num2, readOnlySpan.Length));
					num2 += readOnlySpan.Length;
					array3[num2] = val;
					race._eyeTextures = array3;
				}
				num = 0;
				if (them._type != RaceType.Byrdle)
				{
					MouthTextureGroup[] mouth = raceStruct._mouth;
					foreach (MouthTextureGroup val2 in mouth)
					{
						string text = them._race._mouthTextures.Length.ToString(CultureInfo.InvariantCulture);
						string text3 = $"Atlyss-Mouth-{raceStruct._race._raceName}{num}";
						num++;
						_partInd[them._type][FolderType.Mouth].Add(text3, text);
						_partInd[them._type][FolderType.Mouth].Add(text, text3);
						ScriptablePlayerRace race2 = them._race;
						MouthTextureGroup[] mouthTextures = them._race._mouthTextures;
						int num2 = 0;
						MouthTextureGroup[] array4 = (MouthTextureGroup[])(object)new MouthTextureGroup[1 + mouthTextures.Length];
						ReadOnlySpan<MouthTextureGroup> readOnlySpan2 = new ReadOnlySpan<MouthTextureGroup>(mouthTextures);
						readOnlySpan2.CopyTo(new Span<MouthTextureGroup>(array4).Slice(num2, readOnlySpan2.Length));
						num2 += readOnlySpan2.Length;
						array4[num2] = val2;
						race2._mouthTextures = array4;
					}
				}
				num = 0;
				SkinTextureGroup[] skins = raceStruct._skins;
				foreach (SkinTextureGroup val3 in skins)
				{
					string text = them._race._skinTextureGroups.Length.ToString(CultureInfo.InvariantCulture);
					string text4 = $"Atlyss-Skin-{raceStruct._race._raceName}{num}";
					num++;
					_partInd[them._type][FolderType.Skin].Add(text4, text);
					_partInd[them._type][FolderType.Skin].Add(text, text4);
					ScriptablePlayerRace race3 = them._race;
					SkinTextureGroup[] skinTextureGroups = them._race._skinTextureGroups;
					int num2 = 0;
					SkinTextureGroup[] array5 = (SkinTextureGroup[])(object)new SkinTextureGroup[1 + skinTextureGroups.Length];
					ReadOnlySpan<SkinTextureGroup> readOnlySpan3 = new ReadOnlySpan<SkinTextureGroup>(skinTextureGroups);
					readOnlySpan3.CopyTo(new Span<SkinTextureGroup>(array5).Slice(num2, readOnlySpan3.Length));
					num2 += readOnlySpan3.Length;
					array5[num2] = val3;
					race3._skinTextureGroups = array5;
				}
			}
		}

		private static void GetVanillaItems()
		{
			ModShop modShop = new ModShop("Vanilla Items");
			_modShops.Add(modShop);
			(string, int)[] array = new(string, int)[13]
			{
				("Red Dye", 1),
				("Orange Dye", 2),
				("Lime Dye", 3),
				("Green Dye", 4),
				("Blue Dye", 5),
				("Cyan Dye", 6),
				("Yellow Dye", 7),
				("Brown Dye", 8),
				("Pink Dye", 9),
				("Purple Dye", 10),
				("White Dye", 11),
				("Grey Dye", 12),
				("Black Dye", 13)
			};
			(string, int)[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				(string, int) tuple = array2[i];
				string item = tuple.Item1;
				int item2 = tuple.Item2;
				VanillaItem vanillaItem = new VanillaItem(null, null, FolderType.Dye, (ShopTab)1)
				{
					_itemName = item,
					Added = true,
					SortTag = (SortTag)1,
					sortindex = item2
				};
				vanillaItem.ShopItem._scriptItem = GM._cachedScriptableItems[item];
				vanillaItem.ShopItem._itemNameTag = item;
				modShop._items_Cons.Add(vanillaItem);
			}
			string[] array3 = new string[5] { "Necro Marrow", "Leather Top", "Sagecloth Top", "Aero Top", "Nutso Top" };
			string[] array4 = array3;
			foreach (string text in array4)
			{
				VanillaItem vanillaItem2 = new VanillaItem(null, null, FolderType.Chestpiece, (ShopTab)0)
				{
					_itemName = text,
					Added = true
				};
				vanillaItem2.ShopItem._scriptItem = GM._cachedScriptableItems[text];
				vanillaItem2.ShopItem._itemNameTag = text;
				modShop._items_Gear.Add(vanillaItem2);
			}
			array3 = new string[5] { "Necro Caustics", "Leather Britches", "Sagecloth Shorts", "Aero Pants", "Nutso Pants" };
			string[] array5 = array3;
			foreach (string text2 in array5)
			{
				VanillaItem vanillaItem3 = new VanillaItem(null, null, FolderType.Leggings, (ShopTab)0)
				{
					_itemName = text2,
					Added = true
				};
				vanillaItem3.ShopItem._scriptItem = GM._cachedScriptableItems[text2];
				vanillaItem3.ShopItem._itemNameTag = text2;
				modShop._items_Gear.Add(vanillaItem3);
			}
		}

		private static Sprite MakeSprite(string path, string name)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = File.ReadAllBytes(Path.Combine(path, name + ".png"));
			Texture2D val = new Texture2D(4, 4, _texFormat, false)
			{
				name = name + "_Tex",
				anisoLevel = 16,
				filterMode = (FilterMode)Cfg._filterMode.Value,
				mipMapBias = 0f
			};
			ImageConversion.LoadImage(val, array, false);
			Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			((Object)val2).name = name + "_Spr";
			return val2;
		}

		private void Update()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Invalid comparison between Unknown and I4
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Invalid comparison between Unknown and I4
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Invalid comparison between Unknown and I4
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Invalid comparison between Unknown and I4
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKey((KeyCode)308) && Input.GetKeyUp((KeyCode)120))
			{
				_hotkeysOn = !_hotkeysOn;
				Log($"Toggled hotkeysOn to {_hotkeysOn}");
			}
			if (!_hotkeysOn)
			{
				return;
			}
			bool flag = (Object)(object)Player._mainPlayer != (Object)null && (int)Player._mainPlayer._currentGameCondition == 1 && !Player._mainPlayer._inChat && !Player._mainPlayer._inUI;
			bool flag2 = (Object)(object)MainMenuManager._current != (Object)null && (int)MainMenuManager._current._mainMenuCondition == 2;
			bool flag3 = (Object)(object)MainMenuManager._current != (Object)null && (int)MainMenuManager._current._mainMenuCondition == 1 && Object.op_Implicit((Object)(object)MainMenuManager._current._characterSelectManager._setRaceModelED) && Object.op_Implicit((Object)(object)MainMenuManager._current._characterSelectManager._setRaceModelED._playerRaceModel);
			bool flag4 = (Object)(object)VanityMirrorManager._current != (Object)null && VanityMirrorManager._current._isOpen;
			bool flag5 = Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303);
			bool flag6 = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305);
			if (Input.GetKeyDown((KeyCode)114) && flag6)
			{
				if (!flag5)
				{
					ReloadAll(nocheck: false);
				}
				else
				{
					ReloadAll(nocheck: true);
				}
			}
			if (Input.GetKeyUp((KeyCode)286))
			{
				ErrorLister();
			}
			if (flag)
			{
				if (Input.GetKeyUp((KeyCode)287) && Player._mainPlayer._isHostPlayer)
				{
					if (GameWorldManager._current._dayNightCycleInterval == 0f)
					{
						if ((int)GameWorldManager._current._clockSetting == 1)
						{
							GameWorldManager._current._dayNightCycleInterval = 0f;
							GameWorldManager._current._clockSetting = (ClockSetting)0;
							GameWorldManager._current._timeDisplay = 12;
							GameWorldManager._current._worldTime = (WorldTime)1;
						}
						else
						{
							GameWorldManager._current._dayNightCycleInterval = 40f;
						}
					}
					else
					{
						GameWorldManager._current._dayNightCycleInterval = 0f;
						GameWorldManager._current._clockSetting = (ClockSetting)1;
						GameWorldManager._current._timeDisplay = 12;
						GameWorldManager._current._worldTime = (WorldTime)0;
					}
				}
				if (!_shownUpdateMessage)
				{
					_shownUpdateMessage = true;
					if (!Cfg._alwaysShowUpdateMsg.Value)
					{
						Cfg._updateMessage.Value = UpdateCount;
					}
				}
				_foodLevel -= Time.deltaTime / Cfg._foodDigestRate.Value;
				if (_foodLevel < 0f)
				{
					_foodLevel = 0f;
				}
			}
			if ((Object)(object)_testDye != (Object)null && (flag || flag2))
			{
				if (flag5)
				{
					if (Input.GetKeyDown((KeyCode)45))
					{
						ColorAdjustShader_Profile dyeParams = _testDye._dyeParams;
						dyeParams._hue += 15f;
						if (_testDye._dyeParams._hue > 360f)
						{
							_testDye._dyeParams._hue = -345f;
						}
						Log($"TEST Dye Hue is now {_testDye._dyeParams._hue}");
					}
				}
				else if (Input.GetKeyUp((KeyCode)45))
				{
					ColorAdjustShader_Profile dyeParams2 = _testDye._dyeParams;
					dyeParams2._hue += 1f;
					if (_testDye._dyeParams._hue > 360f)
					{
						_testDye._dyeParams._hue = -359f;
					}
					Log($"TEST Dye Hue is now {_testDye._dyeParams._hue}");
				}
				if (Input.GetKeyUp((KeyCode)61))
				{
					_testDye._dyeParams._saturation = (float)((double)_testDye._dyeParams._saturation + 0.1);
					if (_testDye._dyeParams._saturation > 2.05f)
					{
						_testDye._dyeParams._saturation = 0f;
					}
					Log($"TEST Dye Saturation is now {_testDye._dyeParams._saturation}");
				}
				if (Input.GetKeyUp((KeyCode)91))
				{
					_testDye._dyeParams._brightness = (float)Math.Round((float)((double)_testDye._dyeParams._brightness + 0.1), 1);
					if (_testDye._dyeParams._brightness > 1.05f)
					{
						_testDye._dyeParams._brightness = -1f;
					}
					Log($"TEST Dye Brightness is now {_testDye._dyeParams._brightness}");
				}
				if (Input.GetKeyUp((KeyCode)93))
				{
					_testDye._dyeParams._contrast = (float)((double)_testDye._dyeParams._contrast + 0.1);
					if (_testDye._dyeParams._contrast > 2.05f)
					{
						_testDye._dyeParams._contrast = 0f;
					}
					Log($"TEST Dye Contrast is now {_testDye._dyeParams._contrast}");
				}
			}
			if (!(flag2 || flag3 || flag4) || flag6)
			{
				return;
			}
			PlayerRaceModel val = null;
			if (flag4)
			{
				val = VanityMirrorManager._current._setRaceModel;
			}
			else if (flag3)
			{
				val = MainMenuManager._current._characterSelectManager._setRaceModelED._playerRaceModel;
			}
			else if (flag2 && (Object)(object)_cCM != (Object)null)
			{
				val = CCM._currentRaceModel;
			}
			if ((Object)(object)val != (Object)null)
			{
				if (Input.GetKeyUp((KeyCode)119))
				{
					val.Set_EyeCondition((EyeCondition)1, 2f);
				}
				if (Input.GetKeyUp((KeyCode)115))
				{
					val.Set_EyeCondition((EyeCondition)2, 2f);
				}
				if (Input.GetKeyUp((KeyCode)97))
				{
					val.Set_EyeCondition((EyeCondition)3, 2f);
				}
				if (Input.GetKeyUp((KeyCode)100))
				{
					val.Set_EyeCondition((EyeCondition)4, 2f);
				}
				if (Input.GetKeyUp((KeyCode)101))
				{
					val.Set_EyeCondition((EyeCondition)8, 2f);
				}
				if (Input.GetKeyUp((KeyCode)113))
				{
					val.Set_EyeCondition((EyeCondition)7, 2f);
				}
				if (Input.GetKeyUp((KeyCode)114))
				{
					val.Set_EyeCondition((EyeCondition)5, 2f);
				}
				if (Input.GetKeyUp((KeyCode)102))
				{
					val.Set_MouthCondition((MouthCondition)1, 2f);
				}
			}
		}

		internal static void DropMe(string item, int n = 1)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0067: Expected O, but got Unknown
			if (!Assign.ItemMatcher(item, out ScriptableItem firstmatch) || (Object)(object)firstmatch == (Object)null)
			{
				Log(item + " is not a real item!", 3);
				return;
			}
			GameManager._current.Client_SpawnLocalItemObject(new ItemData
			{
				_itemName = firstmatch._itemName,
				_quantity = n
			}, NetworkClient.localPlayer, ((Component)Player._mainPlayer).transform.position, 0, ((Component)Player._mainPlayer).transform, true);
		}

		public static void TellMeAbout(object it, bool showempty = true)
		{
			Log("TellMeAbout...");
			if (it == null)
			{
				Log("It's null");
				Log("...ToldYouAbout.\n");
				return;
			}
			Log("Object: " + it);
			List<FieldInfo> list = it.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).ToList();
			if (list.Count > 0)
			{
				list.Sort((FieldInfo f1, FieldInfo f2) => string.Compare(f1.Name, f2.Name, StringComparison.OrdinalIgnoreCase));
				foreach (FieldInfo item in list)
				{
					if (showempty || item.GetValue(it) != null)
					{
						Log(item.Name.Replace("k__BackingField", string.Empty, StringComparison.OrdinalIgnoreCase).Replace("<", string.Empty, StringComparison.OrdinalIgnoreCase).Replace(">", string.Empty, StringComparison.OrdinalIgnoreCase) + " " + item.GetValue(it));
					}
				}
			}
			List<PropertyInfo> list2 = it.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).ToList();
			if (list2.Count > 0)
			{
				list2.Sort((PropertyInfo p1, PropertyInfo p2) => string.Compare(p1.Name, p2.Name, StringComparison.OrdinalIgnoreCase));
				foreach (PropertyInfo item2 in list2)
				{
					if (showempty || item2.GetValue(it) != null)
					{
						Log(item2.Name.Replace("k__BackingField", string.Empty, StringComparison.OrdinalIgnoreCase).Replace("<", string.Empty, StringComparison.OrdinalIgnoreCase).Replace(">", string.Empty, StringComparison.OrdinalIgnoreCase) + " " + item2.GetValue(it));
					}
				}
			}
			Log("...ToldYouAbout.\n");
		}

		public static bool CleanItemName(string name, out string edit)
		{
			edit = string.Empty;
			if (name == null)
			{
				return false;
			}
			if (name.Contains("#HB#", StringComparison.OrdinalIgnoreCase))
			{
				string[] array = name.Split("#HB#", 3);
				if (array.Length < 3)
				{
					return false;
				}
				string text = array[1].Split('`')[0];
				edit = array[0] + text + array[2];
				return true;
			}
			return false;
		}

		internal void DumpAllScriptables()
		{
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Expected O, but got Unknown
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Expected O, but got Unknown
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Expected O, but got Unknown
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Expected O, but got Unknown
			//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d9: Expected O, but got Unknown
			//IL_0975: Unknown result type (might be due to invalid IL or missing references)
			//IL_097c: Expected O, but got Unknown
			//IL_09ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f3: Expected O, but got Unknown
			//IL_0baf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8f: Expected O, but got Unknown
			//IL_0c0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c16: Expected O, but got Unknown
			//IL_0f96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9d: Expected O, but got Unknown
			//IL_0d2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d36: Expected O, but got Unknown
			//IL_1088: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ba: Unknown result type (might be due to invalid IL or missing references)
			IEnumerable<ScriptableItem> enumerable = GameManager._current._cachedScriptableItems.Values.Where((ScriptableItem i) => !i._itemName.StartsWith("#HB#", StringComparison.OrdinalIgnoreCase));
			DirectoryInfo directoryInfo = Location.CreateSubdirectory("Scriptable");
			Dictionary<Type, DirectoryInfo> dictionary = new Dictionary<Type, DirectoryInfo>();
			dictionary.Add(typeof(ScriptableArmorDye), directoryInfo.CreateSubdirectory("ArmorDye"));
			dictionary.Add(typeof(ScriptableCape), directoryInfo.CreateSubdirectory("Cape"));
			dictionary.Add(typeof(ScriptableChestpiece), directoryInfo.CreateSubdirectory("Chestpiece"));
			dictionary.Add(typeof(ScriptableHelm), directoryInfo.CreateSubdirectory("Helm"));
			dictionary.Add(typeof(ScriptableLeggings), directoryInfo.CreateSubdirectory("Leggings"));
			dictionary.Add(typeof(ScriptableRing), directoryInfo.CreateSubdirectory("Ring"));
			dictionary.Add(typeof(ScriptableShield), directoryInfo.CreateSubdirectory("Shield"));
			dictionary.Add(typeof(ScriptableStatusConsumable), directoryInfo.CreateSubdirectory("StatusConsumable"));
			dictionary.Add(typeof(ScriptableTradeItem), directoryInfo.CreateSubdirectory("TradeItem"));
			dictionary.Add(typeof(ScriptableWeapon), directoryInfo.CreateSubdirectory("Weapon"));
			Dictionary<Type, DirectoryInfo> dictionary2 = dictionary;
			foreach (ScriptableItem item in enumerable)
			{
				try
				{
					List<string> list = new List<string>();
					Type type = ((object)item).GetType();
					if (!dictionary2.TryGetValue(type, out var value))
					{
						continue;
					}
					list.Add("- ScriptableItem -");
					list.Add("name : " + ((Object)item).name);
					list.Add("_itemName : " + item._itemName);
					list.Add("_itemDescription : " + item._itemDescription);
					list.Add($"_destroyOnDrop : {item._destroyOnDrop}");
					list.Add($"_maxStackAmount : {item._maxStackAmount}");
					list.Add($"_itemIcon : {item._itemIcon}");
					list.Add($"_itemRarity : {item._itemRarity}");
					if (type == typeof(ScriptableTradeItem))
					{
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
						continue;
					}
					if (type == typeof(ScriptableArmorDye) || type == typeof(ScriptableStatusConsumable))
					{
						ScriptableConsumable val = (ScriptableConsumable)item;
						list.Add("\n- ScriptableConsumable -");
						list.Add($"_consumableCooldown : {val._consumableCooldown}");
						list.Add($"_consumableObject : {val._consumableObject}");
						list.Add($"_useOnlyInTown : {val._useOnlyInTown}");
						list.Add($"_unperishable : {val._unperishable}");
						if (type == typeof(ScriptableStatusConsumable))
						{
							ScriptableStatusConsumable val2 = (ScriptableStatusConsumable)val;
							list.Add("\n- ScriptableStatusConsumable -");
							list.Add($"_healthApply : {val2._healthApply}");
							list.Add($"_manaApply : {val2._manaApply}");
							list.Add($"_staminaApply : {val2._staminaApply}");
							list.Add($"_expGain : {val2._expGain}");
							list.Add($"_resetSkillPoints : {val2._resetSkillPoints}");
							list.Add($"_resetAttributePoints : {val2._resetAttributePoints}");
							File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
						}
						else if (type == typeof(ScriptableArmorDye))
						{
							ScriptableArmorDye val3 = (ScriptableArmorDye)val;
							list.Add("\n- ScriptableArmorDye -");
							list.Add("_dyeParams : {");
							list.Add($"    _hue : {val3._dyeParams._hue}\r\n    _saturation : {val3._dyeParams._saturation}\r\n    _brightness : {val3._dyeParams._brightness}\r\n    _contrast : {val3._dyeParams._contrast}");
							list.Add("}");
							File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
						}
						continue;
					}
					ScriptableEquipment val4 = (ScriptableEquipment)item;
					list.Add("\n- ScriptableEquipment -");
					list.Add($"_equipmentLevel : {val4._equipmentLevel}");
					list.Add($"_classRequirement : {val4._classRequirement}");
					list.Add("_statArray : {");
					list.Add($"    _maxHealth : {val4._statArray._maxHealth}\r\n    _maxMana : {val4._statArray._maxMana}\r\n    _maxStamina : {val4._statArray._maxStamina}\r\n    _experience : {val4._statArray._experience}\r\n    _attackPower : {val4._statArray._attackPower}\r\n    _magicPower : {val4._statArray._magicPower}\r\n    _dexPower : {val4._statArray._dexPower}\r\n    _criticalRate : {val4._statArray._criticalRate}\r\n    _magicCriticalRate : {val4._statArray._magicCriticalRate}\r\n    _evasion : {val4._statArray._evasion}\r\n    _defense : {val4._statArray._defense}\r\n    _magicDefense : {val4._statArray._magicDefense}\r\n    _fireResist : {val4._statArray._fireResist}\r\n    _waterResist : {val4._statArray._waterResist}\r\n    _natureResist : {val4._statArray._natureResist}\r\n    _earthResist : {val4._statArray._earthResist}\r\n    _holyResist : {val4._statArray._holyResist}\r\n    _shadowResist : {val4._statArray._shadowResist}");
					list.Add("}");
					if (val4._statModifierCost != null)
					{
						list.Add("_statModifierCost : {");
						list.Add($"    _scriptItem : {val4._statModifierCost._scriptItem}\r\n    _scriptItemQuantity : {val4._statModifierCost._scriptItemQuantity}");
						list.Add("}");
					}
					if (!(type == typeof(ScriptableCape)) && !(type == typeof(ScriptableChestpiece)) && !(type == typeof(ScriptableHelm)) && !(type == typeof(ScriptableLeggings)) && !(type == typeof(ScriptableRing)))
					{
						goto IL_0e70;
					}
					ScriptableArmor val5 = (ScriptableArmor)val4;
					list.Add("\n- ScriptableArmor -");
					if (val5._conditionResistances == null || val5._conditionResistances.Length == 0)
					{
						list.Add("_conditionResistances : []");
					}
					else
					{
						list.Add("_conditionResistances : [");
						ConditionResistance[] conditionResistances = val5._conditionResistances;
						foreach (ConditionResistance val6 in conditionResistances)
						{
							list.Add($"    '{val6._conditionTag}' ~ {val6._resistancePercent}");
						}
						list.Add("]");
					}
					list.Add($"_canDyeArmor : {val5._canDyeArmor}");
					list.Add("_colorAdjustParams : {");
					list.Add($"    _hue : {val5._colorAdjustParams._hue}\r\n    _saturation : {val5._colorAdjustParams._saturation}\r\n    _brightness : {val5._colorAdjustParams._brightness}\r\n    _contrast : {val5._colorAdjustParams._contrast}");
					list.Add("}");
					list.Add($"_armorTexture : {val5._armorTexture}");
					if (type == typeof(ScriptableRing))
					{
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
					}
					else if (type == typeof(ScriptableCape))
					{
						ScriptableCape val7 = (ScriptableCape)val5;
						list.Add("\n- ScriptableCape -");
						list.Add($"_capeMesh : {val7._capeMesh}");
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
					}
					else if (type == typeof(ScriptableChestpiece))
					{
						ScriptableChestpiece val8 = (ScriptableChestpiece)val5;
						list.Add("\n- ScriptableChestpiece -");
						list.Add($"_lockBoobs : {val8._lockBoobs}");
						list.Add($"_disableJiggleBoobBones : {val8._disableJiggleBoobBones}");
						list.Add($"_textureArms : {val8._textureArms}");
						list.Add($"_legOverlayTexture : {val8._legOverlayTexture}");
						list.Add($"_boobOverrideTexture : {val8._boobOverrideTexture}");
						list.Add($"_neckCollarMesh : {val8._neckCollarMesh}");
						list.Add($"_neckCollarTexture : {val8._neckCollarTexture}");
						list.Add($"_chestRenderDisplay : {val8._chestRenderDisplay}");
						list.Add($"_chestRenderTexture : {val8._chestRenderTexture}");
						list.Add($"_chestRenderBoobTexture : {val8._chestRenderBoobTexture}");
						list.Add($"_robeSkirtRender : {val8._robeSkirtRender}");
						list.Add($"_robeSkirtTexture : {val8._robeSkirtTexture}");
						list.Add($"_hipMeshDisplay : {val8._hipMeshDisplay}");
						list.Add($"_hipMeshTexture : {val8._hipMeshTexture}");
						list.Add($"_armCuffRender : {val8._armCuffRender}");
						list.Add($"_shoulderpadMesh : {val8._shoulderpadMesh}");
						list.Add($"_shoulderpadTexture : {val8._shoulderpadTexture}");
						list.Add($"_shoulderPadDisplayType : {val8._shoulderPadDisplayType}");
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
					}
					else if (type == typeof(ScriptableHelm))
					{
						ScriptableHelm val9 = (ScriptableHelm)val5;
						list.Add("\n- ScriptableHelm -");
						list.Add($"_blendHelmValue : {val9._blendHelmValue}");
						list.Add($"_useHelmHairDisplay : {val9._useHelmHairDisplay}");
						list.Add($"_hideEars : {val9._hideEars}");
						list.Add($"_hideMisc : {val9._hideMisc}");
						list.Add($"_isFullHelm : {val9._isFullHelm}");
						list.Add($"_helmRender : {val9._helmRender}");
						list.Add($"_helmOverrideMesh : {val9._helmOverrideMesh}");
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
					}
					else
					{
						if (!(type == typeof(ScriptableLeggings)))
						{
							goto IL_0e70;
						}
						ScriptableLeggings val10 = (ScriptableLeggings)val5;
						list.Add("\n- ScriptableLeggings -");
						list.Add($"_textureUpperLegOnly : {val10._textureUpperLegOnly}");
						list.Add($"_textureFeet : {val10._textureFeet}");
						list.Add($"_legPieceRender_01 : {val10._legPieceRender_01}");
						list.Add($"_legPieceTexture_01 : {val10._legPieceTexture_01}");
						list.Add($"_legPieceRender_02 : {val10._legPieceRender_02}");
						list.Add($"_legPieceTexture_02 : {val10._legPieceTexture_02}");
						list.Add($"_legPieceRender_03 : {val10._legPieceRender_03}");
						list.Add($"_legPieceTexture_03 : {val10._legPieceTexture_03}");
						list.Add($"_legPieceRender_04 : {val10._legPieceRender_04}");
						list.Add($"_legPieceTexture_04 : {val10._legPieceTexture_04}");
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
					}
					goto end_IL_0171;
					IL_0e70:
					if (type == typeof(ScriptableShield))
					{
						ScriptableShield val11 = (ScriptableShield)val4;
						list.Add("\n- ScriptableShield -");
						list.Add($"_shieldMesh : {val11._shieldMesh}");
						list.Add($"_shieldTexture : {val11._shieldTexture}");
						list.Add("_textureColorAdjust : {");
						list.Add($"    _hue : {val11._textureColorAdjust._hue}\r\n    _saturation : {val11._textureColorAdjust._saturation}\r\n    _brightness : {val11._textureColorAdjust._brightness}\r\n    _contrast : {val11._textureColorAdjust._contrast}");
						list.Add("}");
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
					}
					else if (type == typeof(ScriptableWeapon))
					{
						ScriptableWeapon val12 = (ScriptableWeapon)val4;
						list.Add("\n- ScriptableWeapon -");
						list.Add("weaponType : " + val12.weaponType._weaponTypeClassTag);
						list.Add($"_weaponHoldClipIndex : {val12._weaponHoldClipIndex}");
						if (Object.op_Implicit((Object)(object)val12._combatElement))
						{
							list.Add($"_combatElement : {val12._combatElement._elementName} - ID: {val12._combatElement._elementID}");
						}
						else
						{
							list.Add("_combatElement : None");
						}
						list.Add($"_weaponProjectileSet : {val12._weaponProjectileSet}");
						list.Add($"_weaponDamage : {val12._weaponDamage}");
						list.Add($"_damageBonus : {val12._damageBonus}");
						list.Add($"_readonlyDamageRange : {val12._readonlyDamageRange}");
						if (val12._weaponConditionSlot != null && Object.op_Implicit((Object)(object)val12._weaponConditionSlot._scriptableCondition))
						{
							list.Add("_weaponConditionSlot : {");
							list.Add($"    _scriptableCondition : {val12._weaponConditionSlot._scriptableCondition._conditionName} - ID: {val12._weaponConditionSlot._scriptableCondition._ID}\r\n    _chance : {val12._weaponConditionSlot._chance}\r\n    _bonusPower : {val12._weaponConditionSlot._bonusPower}\r\n    _bonusDuration : {val12._weaponConditionSlot._bonusDuration}");
							list.Add("}");
						}
						else
						{
							list.Add("_weaponConditionSlot : None");
						}
						list.Add($"weaponTexture : {val12.weaponTexture}");
						list.Add($"weaponMesh : {val12.weaponMesh}");
						list.Add("trailColors : #" + ColorUtility.ToHtmlStringRGBA(val12.trailColors[0]) + " & #" + ColorUtility.ToHtmlStringRGBA(val12.trailColors[1]));
						list.Add("_textureColorAdjust : {");
						list.Add($"    _hue : {val12._textureColorAdjust._hue}\r\n    _saturation : {val12._textureColorAdjust._saturation}\r\n    _brightness : {val12._textureColorAdjust._brightness}\r\n    _contrast : {val12._textureColorAdjust._contrast}");
						list.Add("}");
						File.WriteAllLinesAsync(Path.Combine(value.FullName, item._itemName + ".txt"), list);
					}
					end_IL_0171:;
				}
				catch
				{
					Log("DumpAllScriptables() - Didn't manage to make a file for " + item._itemName);
					throw;
				}
			}
		}

		internal static void RaceStructer()
		{
			//IL_0063: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0089: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			_races.Add(RaceType.Imp, new RaceStruct(RaceType.Imp, _playerRace_imp));
			_races.Add(RaceType.Poon, new RaceStruct(RaceType.Poon, _playerRace_poon));
			_races.Add(RaceType.Kubold, new RaceStruct(RaceType.Kubold, _playerRace_kubold));
			_races.Add(RaceType.Chang, new RaceStruct(RaceType.Chang, _playerRace_chang));
			_playerRace_byrdle._disableMouthSelector = false;
			MouthTextureGroup val = new MouthTextureGroup
			{
				_closed = Resources.Load<Texture>("_graphic/_mesh/00_player/player_meshes/_racemesh_byrdle/byrdlebeaktex_02"),
				_open = Resources.Load<Texture>("_graphic/_mesh/00_player/player_meshes/_racemesh_byrdle/byrdlebeaktex_02")
			};
			MouthTextureGroup val2 = new MouthTextureGroup
			{
				_closed = Resources.Load<Texture>("_graphic/_mesh/00_player/player_meshes/_racemesh_byrdle/byrdlebeaktex_01"),
				_open = Resources.Load<Texture>("_graphic/_mesh/00_player/player_meshes/_racemesh_byrdle/byrdlebeaktex_01")
			};
			MouthTextureGroup val3 = new MouthTextureGroup
			{
				_closed = (Texture)(object)Texture2D.blackTexture,
				_open = (Texture)(object)Texture2D.blackTexture
			};
			_playerRace_byrdle._mouthTextures = Array.Empty<MouthTextureGroup>();
			_races.Add(RaceType.Byrdle, new RaceStruct(RaceType.Byrdle, _playerRace_byrdle));
			_playerRace_byrdle._mouthTextures = (MouthTextureGroup[])(object)new MouthTextureGroup[3] { val, val2, val3 };
			_partInd[RaceType.Byrdle][FolderType.Mouth].Add("Atlyss-Byrdle-Mouth-ByrdleBeakTex_02", "0");
			_partInd[RaceType.Byrdle][FolderType.Mouth].Add("0", "Atlyss-Byrdle-Mouth-ByrdleBeakTex_02");
			_partInd[RaceType.Byrdle][FolderType.Mouth].Add("Atlyss-Byrdle-Mouth-ByrdleBeakTex_01", "1");
			_partInd[RaceType.Byrdle][FolderType.Mouth].Add("1", "Atlyss-Byrdle-Mouth-ByrdleBeakTex_01");
			_partInd[RaceType.Byrdle][FolderType.Mouth].Add("Catman-Homebrewery-Byrdle-Mouth-hbInvisBeak", "2");
			_partInd[RaceType.Byrdle][FolderType.Mouth].Add("2", "Catman-Homebrewery-Byrdle-Mouth-hbInvisBeak");
		}

		internal static void Nudge(bool cmd = false)
		{
			//IL_0031: 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_0055: 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)
			if (!cmd)
			{
				ErrorPromptTextManager.current.Init_ErrorPrompt("HB - Nudging you out of terrain.");
			}
			((Collider)Player._mainPlayer._pMove._playerController).enabled = false;
			Player._mainPlayer._pMove.UserCode_Target_SetRotation__Quaternion(Quaternion.LookRotation(Vector3.forward));
			Transform transform = ((Component)Player._mainPlayer._pMove._player).transform;
			transform.position += Vector3.up;
			((Collider)Player._mainPlayer._pMove._playerController).enabled = true;
		}

		internal static void OffsetSliders()
		{
			if (!Object.op_Implicit((Object)(object)SettingsManager._current._cameraVertPosSlider) || !Object.op_Implicit((Object)(object)SettingsManager._current._cameraHorizPosSlider))
			{
				Log("Camera position offset sliders did not exist!", 4);
				return;
			}
			SettingsManager._current._cameraVertPosSlider.minValue = Cfg._camera_VerticalMin.Value;
			SettingsManager._current._cameraVertPosSlider.maxValue = Cfg._camera_VerticalMax.Value;
			SettingsManager._current._cameraHorizPosSlider.minValue = Cfg._camera_HorizontalLeft.Value;
			SettingsManager._current._cameraHorizPosSlider.maxValue = Cfg._camera_HorrizontalRight.Value;
		}
	}
	[HarmonyPatch(typeof(GameManager), "Cache_ScriptableAssets")]
	public static class WaitingForGameManager
	{
		[HarmonyPostfix]
		private static void Cache_ScriptableAssetsPatch()
		{
			HB.GM = GameManager._current;
		}
	}
	[HarmonyPatch(typeof(VanityMirrorManager), "Update")]
	public static class VanityMirrorManagerPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null)
			}).Advance(2).SetInstruction(new CodeInstruction(OpCodes.Ldc_I4_3, (object)null))
				.InstructionEnumeration();
		}
	}
	[HarmonyPatch(typeof(CharacterCreationManager), "Awake")]
	public static class GrabCCM
	{
		[HarmonyPrefix]
		private static void AwakePatch(CharacterCreationManager __instance)
		{
			HB.CCM = __instance;
		}
	}
	[HarmonyPatch(typeof(CharacterCreationManager), "Awake")]
	public static class LabelCCM
	{
		private static GameObject? _label;

		private static Text? _skint;

		private static Text? _eyest;

		private static Text? _moutht;

		private static Text? _hairt;

		private static Text? _dyet;

		private static Button? _skinl;

		private static Button? _skinr;

		private static Button? _eyesl;

		private static Button? _eyesr;

		private static Button? _mouthl;

		private static Button? _mouthr;

		private static Button? _hairl;

		private static Button? _hairr;

		private static Button? _dyel;

		private static Button? _dyer;

		[HarmonyPostfix]
		private static void AwakePatch()
		{
			_label = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterSlider_headWidth/_tag");
			_skint = GameObject.Find("_dolly_customizer/_customizer_color/_dolly_bodyColor/_characterButtonSelector").GetComponent<Text>();
			_skinl = GameObject.Find("_dolly_customizer/_customizer_color/_dolly_bodyColor/_characterButtonSelector/_button_leftSelect").GetComponent<Button>();
			_skinr = GameObject.Find("_dolly_customizer/_customizer_color/_dolly_bodyColor/_characterButtonSelector/_button_rightSelect").GetComponent<Button>();
			_eyest = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_eyes").GetComponent<Text>();
			_eyesl = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_eyes/_button_leftSelect").GetComponent<Button>();
			_eyesr = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_eyes/_button_rightSelect").GetComponent<Button>();
			_moutht = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_mouth").GetComponent<Text>();
			_mouthl = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_mouth/_button_leftSelect").GetComponent<Button>();
			_mouthr = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_mouth/_button_rightSelect").GetComponent<Button>();
			_hairt = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_hairStyle").GetComponent<Text>();
			_hairl = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_hairStyle/_button_leftSelect").GetComponent<Button>();
			_hairr = GameObject.Find("_dolly_customizer/_customizer_head/_dolly_headCustomizer/_characterButtons_hairStyle/_button_rightSelect").GetComponent<Button>();
			_dyet = GameObject.Find("_dolly_customizer/_customizer_trait/_dolly_traitCustomizer/_selector_gearDye").GetComponent<Text>();
			_dyel = GameObject.Find("_dolly_customizer/_customizer_trait/_dolly_traitCustomizer/_selector_gearDye/_button_leftSelect").GetComponent<Button>();
			_dyer = GameObject.Find("_dolly_customizer/_customizer_trait/_dolly_traitCustomizer/_selector_gearDye/_button_rightSelect").GetComponent<Button>();
			AddLabel(_skint, _skinl, _skinr, FolderType.Skin);
			AddLabel(_eyest, _eyesl, _eyesr, FolderType.Eyes);
			AddLabel(_moutht, _mouthl, _mouthr, FolderType.Mouth);
			AddLabel(_hairt, _hairl, _hairr, FolderType.Hair);
			AddLabel(_dyet, _dyel, _dyer, FolderType.Dye);
		}

		private static void AddLabel(Text parent, Button l, Button r, FolderType type)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_label == (Object)null)
			{
				HB.Log($"AddLabel() : '{type}' ended up null!", 4);
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(_label, ((Component)parent).transform, true);
			val.transform.localScale = Vector3.one;
			val.transform.localPosition = new Vector3(-39.5f, -15f, 0f);
			FolderType folderType = type;
			if ((folderType == FolderType.Dye || folderType == FolderType.Skin) ? true : false)
			{
				val.transform.localPosition = new Vector3(-39.5f, -7f, 0f);
			}
			Text labeltext = val.GetComponent<Text>();
			labeltext.fontSize = 12;
			labeltext.text = "X: Vanilla";
			((UnityEvent)l.onClick).AddListener((UnityAction)delegate
			{
				UpdateLabel(labeltext, type);
			});
			((UnityEvent)r.onClick).AddListener((UnityAction)delegate
			{
				UpdateLabel(labeltext, type);
			});
		}