Decompiled source of MauriceLegger v3.0.0

bitmotte.MauriceLegger.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MauriceBridge;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("bitmotte.MauriceLegger")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0+834fae4728f04e5349e422a3fbe1d63b40c55437")]
[assembly: AssemblyProduct("MauriceLegger")]
[assembly: AssemblyTitle("bitmotte.MauriceLegger")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MauriceLegger
{
	public static class GlobalConfig
	{
		public static bool bestiaryIconAlreadyEdited = false;

		public static bool disableSpiderLegs = true;

		public static bool becomeRagdollOnLanding = true;

		public static bool footsteps = true;

		public static float timeBetweenSteps = 0.9f;

		public static float footLerpSpeed = 0.1f;

		public static bool footstepsSound = true;

		public static bool footstepsParticle = true;

		public static bool damagedVisual = true;

		public static bool enragedVisual = true;

		public static bool variantJingle = true;

		public static float variantChance = 1f;

		public static Dictionary<string, float> individualVariantChances = new Dictionary<string, float>();

		public static float totalVariantChances;

		public static void InitGlobalConfig()
		{
			InitIndividualVariantChances();
		}

		private static void InitIndividualVariantChances()
		{
			individualVariantChances.Add("plushie", 1f);
			individualVariantChances.Add("tutu", 1f);
			individualVariantChances.Add("stilts", 1f);
			individualVariantChances.Add("holding_arms", 1f);
			individualVariantChances.Add("holding_legs", 1f);
			individualVariantChances.Add("2d", 1f);
			individualVariantChances.Add("mettaton", 1f);
			individualVariantChances.Add("sentry", 1f);
			individualVariantChances.Add("swordsmachine", 1f);
			individualVariantChances.Add("v2", 1f);
			individualVariantChances.Add("gross", 1f);
			individualVariantChances.Add("mini_maurice", 1f);
			individualVariantChances.Add("thigh_highs", 1f);
			individualVariantChances.Add("hand_legs", 1f);
			totalVariantChances = 14f;
		}
	}
	public static class LegConfigurator
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static PostConfigChangeEvent <0>__UpdateGlobalConfig;

			public static OnClick <1>__OpenDiscord;

			public static OnClick <2>__EnableAllVariants;

			public static OnClick <3>__DisableAllVariants;

			public static OnClick <4>__ResetAllVariants;
		}

		public static BoolField disableSpiderLegs;

		public static BoolField footsteps;

		public static FloatSliderField timeBetweenSteps;

		public static FloatSliderField footLerpSpeed;

		public static BoolField footstepsSound;

		public static BoolField footstepsParticle;

		public static BoolField damagedVisual;

		public static BoolField enragedVisual;

		public static BoolField variantJingle;

		public static FloatSliderField variantChance;

		public static ButtonField resetVariants;

		public static ButtonField maxOutAllVariants;

		public static ButtonField disableAllVariants;

		public static FloatSliderField plushieChance;

		public static FloatSliderField tutuChance;

		public static FloatSliderField stiltsChance;

		public static FloatSliderField holdingArmsChance;

		public static FloatSliderField holdingLegsChance;

		public static FloatSliderField twoDChance;

		public static FloatSliderField mettatonChance;

		public static FloatSliderField sentryChance;

		public static FloatSliderField swordsmachineChance;

		public static FloatSliderField vTwoChance;

		public static FloatSliderField grossChance;

		public static FloatSliderField miniMauriceChance;

		public static FloatSliderField thighHighsChance;

		public static FloatSliderField handLegsChance;

		public static ButtonField joinDC;

		public static PluginConfigurator CreateConfigurator()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Expected O, but got Unknown
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Expected O, but got Unknown
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Expected O, but got Unknown
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Expected O, but got Unknown
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Expected O, but got Unknown
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Expected O, but got Unknown
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Expected O, but got Unknown
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Expected O, but got Unknown
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Expected O, but got Unknown
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Expected O, but got Unknown
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Expected O, but got Unknown
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Expected O, but got Unknown
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Expected O, but got Unknown
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Expected O, but got Unknown
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Expected O, but got Unknown
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Expected O, but got Unknown
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Expected O, but got Unknown
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Expected O, but got Unknown
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Expected O, but got Unknown
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Expected O, but got Unknown
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Expected O, but got Unknown
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Expected O, but got Unknown
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Expected O, but got Unknown
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Expected O, but got Unknown
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Expected O, but got Unknown
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Expected O, but got Unknown
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Expected O, but got Unknown
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Expected O, but got Unknown
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e6: Expected O, but got Unknown
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Expected O, but got Unknown
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0625: Expected O, but got Unknown
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Expected O, but got Unknown
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Expected O, but got Unknown
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Expected O, but got Unknown
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Expected O, but got Unknown
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Expected O, but got Unknown
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06be: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Expected O, but got Unknown
			//IL_06df: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ea: Expected O, but got Unknown
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_070a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Expected O, but got Unknown
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Expected O, but got Unknown
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_0787: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_0736: Expected O, but got Unknown
			PluginConfigurator val = PluginConfigurator.Create("Maurice Legger", "bitmotte.MauriceLegger");
			ConfigSpace val2 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val3 = new ConfigHeader(val.rootPanel, "Legs", 24, (TextAlignmentOptions)513);
			ConfigHeader val4 = new ConfigHeader(val.rootPanel, "Notice : Some configs update live", 14, (TextAlignmentOptions)513);
			disableSpiderLegs = new BoolField(val.rootPanel, "Disable Spider Legs", "disable_spider_legs", true);
			ConfigSpace val5 = new ConfigSpace(val.rootPanel, 7f);
			footsteps = new BoolField(val.rootPanel, "Footsteps", "footsteps", true);
			ConfigSpace val6 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val7 = new ConfigHeader(val.rootPanel, "Tweaks", 24, (TextAlignmentOptions)513);
			timeBetweenSteps = new FloatSliderField(val.rootPanel, "Time Between Steps (s)", "time_between_steps", new Tuple<float, float>(0.01f, 2f), 0.9f);
			footLerpSpeed = new FloatSliderField(val.rootPanel, "Foot Interpolation Speed", "foot_lerp_speed", new Tuple<float, float>(0.01f, 1f), 0.1f);
			ConfigSpace val8 = new ConfigSpace(val.rootPanel, 7f);
			footstepsSound = new BoolField(val.rootPanel, "Footstep Sound", "footstep_sound", true);
			footstepsParticle = new BoolField(val.rootPanel, "Footstep Particle", "footstep_particle", true);
			ConfigSpace val9 = new ConfigSpace(val.rootPanel, 7f);
			damagedVisual = new BoolField(val.rootPanel, "Damaged Visual", "damaged_visual", true);
			enragedVisual = new BoolField(val.rootPanel, "Enraged Visual", "enraged_visual", true);
			ConfigSpace val10 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val11 = new ConfigHeader(val.rootPanel, "Secret Variations", 24, (TextAlignmentOptions)513);
			ConfigHeader val12 = new ConfigHeader(val.rootPanel, "Notice : There are 14 variations .", 14, (TextAlignmentOptions)513);
			variantJingle = new BoolField(val.rootPanel, "Jingle", "variant_jingle", true);
			variantChance = new FloatSliderField(val.rootPanel, "Chance ( % )", "variant_chance", new Tuple<float, float>(0f, 100f), 1f);
			ConfigPanel val13 = new ConfigPanel(val.rootPanel, "Individual Likelihood", "variant_likelihood");
			ConfigSpace val14 = new ConfigSpace(val13, 15f);
			resetVariants = new ButtonField(val13, "Reset", "reset_variants");
			maxOutAllVariants = new ButtonField(val13, "Max Out All", "max_out_all_variants");
			disableAllVariants = new ButtonField(val13, "Disable All", "disable_all_variants");
			ConfigSpace val15 = new ConfigSpace(val13, 15f);
			plushieChance = new FloatSliderField(val13, "Plushie", "plushie", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val16 = new ConfigHeader(val13, "Credit to Bitmotte ( mod developer ) for the idea", 14, (TextAlignmentOptions)513);
			tutuChance = new FloatSliderField(val13, "Tutu", "tutu", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val17 = new ConfigHeader(val13, "Credit to u/WingDairu on Reddit for the idea", 14, (TextAlignmentOptions)513);
			stiltsChance = new FloatSliderField(val13, "Stilts", "stilts", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val18 = new ConfigHeader(val13, "Credit to u/aqswdefrgthyjukilopm on Reddit for the idea", 14, (TextAlignmentOptions)513);
			holdingArmsChance = new FloatSliderField(val13, "Holding Arms", "holding_arms", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val19 = new ConfigHeader(val13, "Credit to u/Valkreaper on Reddit for the idea", 14, (TextAlignmentOptions)513);
			holdingLegsChance = new FloatSliderField(val13, "Holding Legs", "holding_legs", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val20 = new ConfigHeader(val13, "Credit to u/ObeyTime on Reddit for the idea", 14, (TextAlignmentOptions)513);
			twoDChance = new FloatSliderField(val13, "2D", "2d", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val21 = new ConfigHeader(val13, "Credit to u/ThatIdiotlol on Reddit for the idea", 14, (TextAlignmentOptions)513);
			mettatonChance = new FloatSliderField(val13, "Mettaton", "mettaton", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val22 = new ConfigHeader(val13, "Credit to u/Inkashes24 on Reddit for the idea", 14, (TextAlignmentOptions)513);
			sentryChance = new FloatSliderField(val13, "Sentry", "sentry", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val23 = new ConfigHeader(val13, "Credit to u/ZeroZombie12 on Reddit for the idea", 14, (TextAlignmentOptions)513);
			swordsmachineChance = new FloatSliderField(val13, "Swordsmachine", "swordsmachine", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val24 = new ConfigHeader(val13, "Credit to u/ZeroZombie12 on Reddit for the idea", 14, (TextAlignmentOptions)513);
			vTwoChance = new FloatSliderField(val13, "V2", "v2", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val25 = new ConfigHeader(val13, "Credit to u/Naorazy_Vavilon on Reddit for the idea", 14, (TextAlignmentOptions)513);
			grossChance = new FloatSliderField(val13, "Gross Maurice", "gross", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val26 = new ConfigHeader(val13, "Credit to u/Minimum-Wrangler-878 on Reddit for the idea", 14, (TextAlignmentOptions)513);
			miniMauriceChance = new FloatSliderField(val13, "Mini Maurice", "mini_maurice", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val27 = new ConfigHeader(val13, "Credit to [ deleted,sorry ! ] on Reddit for the idea", 14, (TextAlignmentOptions)513);
			thighHighsChance = new FloatSliderField(val13, "Thigh Highs", "thigh_highs", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val28 = new ConfigHeader(val13, "Credit to u/Notamoogle1 on Reddit for the idea", 14, (TextAlignmentOptions)513);
			handLegsChance = new FloatSliderField(val13, "Hand Legs", "hand_legs", new Tuple<float, float>(0f, 5f), 1f);
			ConfigHeader val29 = new ConfigHeader(val13, "Credit to u/Anonymouse276207 on Reddit for the idea", 14, (TextAlignmentOptions)513);
			ConfigSpace val30 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val31 = new ConfigHeader(val.rootPanel, "Join my discord for sneak peeks,devlogs,and the possibility to test my mods early ! !", 20, (TextAlignmentOptions)513);
			joinDC = new ButtonField(val.rootPanel, "Join my Discord", "joinDC");
			ConfigSpace val32 = new ConfigSpace(val.rootPanel, 15f);
			object obj = <>O.<0>__UpdateGlobalConfig;
			if (obj == null)
			{
				PostConfigChangeEvent val33 = UpdateGlobalConfig;
				<>O.<0>__UpdateGlobalConfig = val33;
				obj = (object)val33;
			}
			val.postConfigChange += (PostConfigChangeEvent)obj;
			UpdateGlobalConfig();
			ButtonField obj2 = joinDC;
			object obj3 = <>O.<1>__OpenDiscord;
			if (obj3 == null)
			{
				OnClick val34 = OpenDiscord;
				<>O.<1>__OpenDiscord = val34;
				obj3 = (object)val34;
			}
			obj2.onClick += (OnClick)obj3;
			ButtonField obj4 = maxOutAllVariants;
			object obj5 = <>O.<2>__EnableAllVariants;
			if (obj5 == null)
			{
				OnClick val35 = EnableAllVariants;
				<>O.<2>__EnableAllVariants = val35;
				obj5 = (object)val35;
			}
			obj4.onClick += (OnClick)obj5;
			ButtonField obj6 = disableAllVariants;
			object obj7 = <>O.<3>__DisableAllVariants;
			if (obj7 == null)
			{
				OnClick val36 = DisableAllVariants;
				<>O.<3>__DisableAllVariants = val36;
				obj7 = (object)val36;
			}
			obj6.onClick += (OnClick)obj7;
			ButtonField obj8 = resetVariants;
			object obj9 = <>O.<4>__ResetAllVariants;
			if (obj9 == null)
			{
				OnClick val37 = ResetAllVariants;
				<>O.<4>__ResetAllVariants = val37;
				obj9 = (object)val37;
			}
			obj8.onClick += (OnClick)obj9;
			AssetBundle val38 = BundleTool.Load("legs.bundle");
			Texture2D val39 = (Texture2D)val38.LoadAsset("Assets/legger.png");
			val.icon = Sprite.Create(val39, new Rect(0f, 0f, (float)((Texture)val39).width, (float)((Texture)val39).height), new Vector2(0.5f, 0.5f), 100f);
			val38.Unload(false);
			return val;
		}

		private static void UpdateGlobalConfig()
		{
			GlobalConfig.disableSpiderLegs = disableSpiderLegs.value;
			Store.leggerSpiderLegsAreDisabled = disableSpiderLegs.value;
			GlobalConfig.footsteps = footsteps.value;
			GlobalConfig.timeBetweenSteps = timeBetweenSteps.value;
			GlobalConfig.footLerpSpeed = footLerpSpeed.value;
			GlobalConfig.footstepsSound = footstepsSound.value;
			GlobalConfig.footstepsParticle = footstepsParticle.value;
			GlobalConfig.damagedVisual = damagedVisual.value;
			GlobalConfig.enragedVisual = enragedVisual.value;
			GlobalConfig.variantJingle = variantJingle.value;
			GlobalConfig.variantChance = variantChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)plushieChance).guid] = plushieChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)tutuChance).guid] = tutuChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)stiltsChance).guid] = stiltsChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)holdingArmsChance).guid] = holdingArmsChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)holdingLegsChance).guid] = holdingLegsChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)twoDChance).guid] = twoDChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)mettatonChance).guid] = mettatonChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)sentryChance).guid] = sentryChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)swordsmachineChance).guid] = swordsmachineChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)vTwoChance).guid] = vTwoChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)grossChance).guid] = grossChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)miniMauriceChance).guid] = miniMauriceChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)thighHighsChance).guid] = thighHighsChance.value;
			GlobalConfig.individualVariantChances[((ConfigField)handLegsChance).guid] = handLegsChance.value;
			GlobalConfig.totalVariantChances = 0f;
			GlobalConfig.totalVariantChances += plushieChance.value;
			GlobalConfig.totalVariantChances += tutuChance.value;
			GlobalConfig.totalVariantChances += stiltsChance.value;
			GlobalConfig.totalVariantChances += holdingArmsChance.value;
			GlobalConfig.totalVariantChances += holdingLegsChance.value;
			GlobalConfig.totalVariantChances += twoDChance.value;
			GlobalConfig.totalVariantChances += mettatonChance.value;
			GlobalConfig.totalVariantChances += sentryChance.value;
			GlobalConfig.totalVariantChances += swordsmachineChance.value;
			GlobalConfig.totalVariantChances += vTwoChance.value;
			GlobalConfig.totalVariantChances += grossChance.value;
			GlobalConfig.totalVariantChances += miniMauriceChance.value;
			GlobalConfig.totalVariantChances += thighHighsChance.value;
			GlobalConfig.totalVariantChances += handLegsChance.value;
		}

		private static void EnableAllVariants()
		{
			plushieChance.value = 5f;
			plushieChance.TriggerValueChangeEvent();
			tutuChance.value = 5f;
			tutuChance.TriggerValueChangeEvent();
			stiltsChance.value = 5f;
			stiltsChance.TriggerValueChangeEvent();
			holdingArmsChance.value = 5f;
			holdingArmsChance.TriggerValueChangeEvent();
			holdingLegsChance.value = 5f;
			holdingLegsChance.TriggerValueChangeEvent();
			twoDChance.value = 5f;
			twoDChance.TriggerValueChangeEvent();
			mettatonChance.value = 5f;
			mettatonChance.TriggerValueChangeEvent();
			sentryChance.value = 5f;
			sentryChance.TriggerValueChangeEvent();
			swordsmachineChance.value = 5f;
			swordsmachineChance.TriggerValueChangeEvent();
			vTwoChance.value = 5f;
			vTwoChance.TriggerValueChangeEvent();
			grossChance.value = 5f;
			grossChance.TriggerValueChangeEvent();
			miniMauriceChance.value = 5f;
			miniMauriceChance.TriggerValueChangeEvent();
			thighHighsChance.value = 5f;
			thighHighsChance.TriggerValueChangeEvent();
			handLegsChance.value = 5f;
			handLegsChance.TriggerValueChangeEvent();
		}

		private static void DisableAllVariants()
		{
			plushieChance.value = 0f;
			plushieChance.TriggerValueChangeEvent();
			tutuChance.value = 0f;
			tutuChance.TriggerValueChangeEvent();
			stiltsChance.value = 0f;
			stiltsChance.TriggerValueChangeEvent();
			holdingArmsChance.value = 0f;
			holdingArmsChance.TriggerValueChangeEvent();
			holdingLegsChance.value = 0f;
			holdingLegsChance.TriggerValueChangeEvent();
			twoDChance.value = 0f;
			twoDChance.TriggerValueChangeEvent();
			mettatonChance.value = 0f;
			mettatonChance.TriggerValueChangeEvent();
			sentryChance.value = 0f;
			sentryChance.TriggerValueChangeEvent();
			swordsmachineChance.value = 0f;
			swordsmachineChance.TriggerValueChangeEvent();
			vTwoChance.value = 0f;
			vTwoChance.TriggerValueChangeEvent();
			grossChance.value = 0f;
			grossChance.TriggerValueChangeEvent();
			miniMauriceChance.value = 0f;
			miniMauriceChance.TriggerValueChangeEvent();
			thighHighsChance.value = 0f;
			thighHighsChance.TriggerValueChangeEvent();
			handLegsChance.value = 0f;
			handLegsChance.TriggerValueChangeEvent();
		}

		private static void ResetAllVariants()
		{
			plushieChance.value = plushieChance.defaultValue;
			plushieChance.TriggerValueChangeEvent();
			tutuChance.value = tutuChance.defaultValue;
			tutuChance.TriggerValueChangeEvent();
			stiltsChance.value = stiltsChance.defaultValue;
			stiltsChance.TriggerValueChangeEvent();
			holdingArmsChance.value = holdingArmsChance.defaultValue;
			holdingArmsChance.TriggerValueChangeEvent();
			holdingLegsChance.value = holdingLegsChance.defaultValue;
			holdingLegsChance.TriggerValueChangeEvent();
			twoDChance.value = twoDChance.defaultValue;
			twoDChance.TriggerValueChangeEvent();
			mettatonChance.value = mettatonChance.defaultValue;
			mettatonChance.TriggerValueChangeEvent();
			sentryChance.value = sentryChance.defaultValue;
			sentryChance.TriggerValueChangeEvent();
			swordsmachineChance.value = swordsmachineChance.defaultValue;
			swordsmachineChance.TriggerValueChangeEvent();
			vTwoChance.value = vTwoChance.defaultValue;
			vTwoChance.TriggerValueChangeEvent();
			grossChance.value = grossChance.defaultValue;
			grossChance.TriggerValueChangeEvent();
			miniMauriceChance.value = miniMauriceChance.defaultValue;
			miniMauriceChance.TriggerValueChangeEvent();
			thighHighsChance.value = thighHighsChance.defaultValue;
			thighHighsChance.TriggerValueChangeEvent();
			handLegsChance.value = handLegsChance.defaultValue;
			handLegsChance.TriggerValueChangeEvent();
		}

		private static void OpenDiscord()
		{
			Process.Start("http://discord.gg/pVdr9e6hZ8");
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "Start")]
	public class LegPatch : MonoBehaviour
	{
		private static void Postfix(MaliciousFace __instance)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (GlobalConfig.disableSpiderLegs)
			{
				LineRenderer[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<LineRenderer>();
				foreach (LineRenderer val in componentsInChildren)
				{
					val.startColor = new Color(0f, 0f, 0f, 0f);
					val.endColor = new Color(0f, 0f, 0f, 0f);
				}
			}
			SecretVariations.MakeLegsWithSecretPossibility(((Component)__instance).gameObject);
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "HandleSpiderDamage")]
	public class WoundPatch : MonoBehaviour
	{
		private static void Postfix(MaliciousFace __instance, ref DamageData data)
		{
			if (GlobalConfig.damagedVisual && !__instance.eid.dead && __instance.spider.health >= __instance.maxHealth / 2f && __instance.spider.health - data.damage < __instance.maxHealth / 2f)
			{
				LegsController[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<LegsController>();
				LegsController[] array = componentsInChildren;
				foreach (LegsController legsController in array)
				{
					legsController.SwitchToDamagedVisuals();
				}
			}
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "ProcessDeath")]
	public class DeathPatch : MonoBehaviour
	{
		private static void Postfix(MaliciousFace __instance)
		{
			LegsController[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<LegsController>();
			LegsController[] array = componentsInChildren;
			foreach (LegsController legsController in array)
			{
				legsController.UnEnrage();
				legsController.SwitchToHealthyVisuals();
				legsController.Death();
			}
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "HandleCollision")]
	[HarmonyPriority(10)]
	public class FloorPatch : MonoBehaviour
	{
		private static void Postfix(MaliciousFace __instance, Collision other)
		{
			LegsController[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<LegsController>();
			if (other.gameObject.CompareTag("Floor"))
			{
				LegsController[] array = componentsInChildren;
				foreach (LegsController legsController in array)
				{
					legsController.SwitchToPhysical();
				}
			}
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "Enrage")]
	public class EnragePatch : MonoBehaviour
	{
		private static void Postfix(MaliciousFace __instance)
		{
			if (GlobalConfig.enragedVisual)
			{
				LegsController[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<LegsController>();
				LegsController[] array = componentsInChildren;
				foreach (LegsController legsController in array)
				{
					legsController.Enrage();
				}
			}
		}
	}
	[HarmonyPatch(typeof(MaliciousFace), "UnEnrage")]
	public class UnEnragePatch : MonoBehaviour
	{
		private static void Postfix(MaliciousFace __instance)
		{
			LegsController[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<LegsController>();
			LegsController[] array = componentsInChildren;
			foreach (LegsController legsController in array)
			{
				legsController.UnEnrage();
			}
		}
	}
	public class FootstepConfigCheck : MonoBehaviour
	{
		private Animator controller;

		private void Start()
		{
			controller = ((Component)this).GetComponent<Animator>();
			if (GlobalConfig.footstepsSound)
			{
				controller.SetBoolString("Audio", true);
			}
			if (GlobalConfig.footstepsParticle)
			{
				controller.SetBoolString("Particle", true);
			}
		}
	}
	public class LegsController : MonoBehaviour
	{
		public MaliciousFace malFace;

		public Animator stateController;

		public bool variant;

		private Transform turningBody;

		public float lerpSpeed = 0.2f;

		public float stepDistance = 0.9f;

		public Transform leftRayPoint;

		public Transform rightRayPoint;

		public Transform leftIKTarget;

		public Transform rightIKTarget;

		public Transform leftIKDestination;

		public Transform rightIKDestination;

		public LayerMask mask;

		private Vector3 malFacePreviousPos;

		private Transform physicalContainer;

		private Transform physical;

		private Footsteps footstepsController;

		private EnemySimplifier[] ensims = Array.Empty<EnemySimplifier>();

		private void Awake()
		{
			ensims = ((Component)this).GetComponentsInChildren<EnemySimplifier>();
		}

		private void Start()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			EnemySimplifier[] array = ensims;
			foreach (EnemySimplifier val in array)
			{
				val.eid = malFace.eid;
				val.enemyColorType = (EnemyType)0;
			}
			stateController = ((Component)this).GetComponent<Animator>();
			turningBody = ((Component)this).transform.parent.GetChild(0);
			mask = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "Environment", "EnvironmentBaked", "OutdoorsBaked" }));
			leftRayPoint = ((Component)this).transform.GetChild(2);
			rightRayPoint = ((Component)this).transform.GetChild(3);
			Transform child = ((Component)this).transform.GetChild(1);
			leftIKTarget = child.GetChild(0);
			rightIKTarget = child.GetChild(1);
			Transform child2 = ((Component)this).transform.GetChild(0);
			leftIKDestination = child2.GetChild(0);
			rightIKDestination = child2.GetChild(1);
			physicalContainer = ((Component)this).transform.GetChild(4);
			physical = physicalContainer.GetChild(1);
			if (Store.baller)
			{
				physical = physicalContainer.GetChild(0);
			}
			((Component)physicalContainer).gameObject.SetActive(false);
			footstepsController = ((Component)((Component)this).transform).GetComponentInChildren<Footsteps>();
			footstepsController.footstep.AddComponent<FootstepConfigCheck>();
			child2.parent = ((Component)this).transform.parent.parent;
			StepLeft();
			if (variant)
			{
				stateController.SetBoolString("Variant", true);
			}
			CheckConfig();
		}

		private void FixedUpdate()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.eulerAngles = new Vector3(0f, turningBody.eulerAngles.y, 0f);
			leftIKTarget.position = Vector3.Lerp(leftIKTarget.position, leftIKDestination.position, lerpSpeed);
			rightIKTarget.position = Vector3.Lerp(rightIKTarget.position, rightIKDestination.position, lerpSpeed);
		}

		private void CheckConfig()
		{
			((MonoBehaviour)this).Invoke("CheckConfig", 1f);
			lerpSpeed = GlobalConfig.footLerpSpeed;
			stepDistance = GlobalConfig.timeBetweenSteps;
		}

		private void StepLeft()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			if (malFace.spiderFalling)
			{
				return;
			}
			((MonoBehaviour)this).Invoke("StepRight", stepDistance / 2f);
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(leftRayPoint.position + -leftRayPoint.forward, leftRayPoint.up, ref val, (float)LayerMask.op_Implicit(mask)))
			{
				leftIKDestination.position = ((RaycastHit)(ref val)).point;
				if (Vector3.Distance(((Component)malFace).transform.position, malFacePreviousPos) >= stepDistance)
				{
					((MonoBehaviour)this).Invoke("MakeFootstepLeft", 0.1f);
					leftIKDestination.position = ((RaycastHit)(ref val)).point + -leftRayPoint.forward * stepDistance;
				}
			}
			malFacePreviousPos = ((Component)malFace).transform.position;
		}

		private void StepRight()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			if (malFace.spiderFalling)
			{
				return;
			}
			((MonoBehaviour)this).Invoke("StepLeft", stepDistance / 2f);
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(rightRayPoint.position + -rightRayPoint.forward, rightRayPoint.up, ref val, (float)LayerMask.op_Implicit(mask)))
			{
				rightIKDestination.position = ((RaycastHit)(ref val)).point;
				if (Vector3.Distance(((Component)malFace).transform.position, malFacePreviousPos) >= stepDistance)
				{
					((MonoBehaviour)this).Invoke("MakeFootstepRight", 0.1f);
					rightIKDestination.position = ((RaycastHit)(ref val)).point + -rightRayPoint.forward * stepDistance;
				}
			}
			malFacePreviousPos = ((Component)malFace).transform.position;
		}

		private void MakeFootstepLeft()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (GlobalConfig.footsteps)
			{
				((Component)footstepsController).transform.position = leftIKDestination.position;
				((Component)footstepsController).transform.eulerAngles = new Vector3(0f, turningBody.eulerAngles.y, 0f);
				footstepsController.Footstep();
			}
		}

		private void MakeFootstepRight()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (GlobalConfig.footsteps)
			{
				((Component)footstepsController).transform.position = rightIKDestination.position;
				((Component)footstepsController).transform.eulerAngles = new Vector3(0f, turningBody.eulerAngles.y, 0f);
				footstepsController.Footstep();
			}
		}

		public void SwitchToDamagedVisuals()
		{
			stateController.SetBoolString("Damaged", true);
		}

		public void SwitchToHealthyVisuals()
		{
			stateController.SetBoolString("Damaged", false);
		}

		public void Enrage()
		{
			if (!malFace.eid.puppet)
			{
				((MonoBehaviour)this).Invoke("EnrageWhat", 0.01f);
			}
		}

		public void EnrageWhat()
		{
			stateController.SetBoolString("Enraged", true);
			EnemySimplifier[] array = ensims;
			foreach (EnemySimplifier val in array)
			{
				val.ChangeMaterialNew((MaterialState)2, val.enragedMaterial);
				val.enraged = true;
			}
		}

		public void UnEnrage()
		{
			if (!malFace.eid.puppet)
			{
				((MonoBehaviour)this).Invoke("UnEnrageWhat", 0.01f);
			}
		}

		public void UnEnrageWhat()
		{
			stateController.SetBoolString("Enraged", false);
			EnemySimplifier[] array = ensims;
			foreach (EnemySimplifier val in array)
			{
				val.ChangeMaterialNew((MaterialState)0, val.originalMaterial);
				val.enraged = false;
			}
		}

		public void Death()
		{
			((MonoBehaviour)this).Invoke("DeathWhat", 0.01f);
		}

		public void DeathWhat()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			EnemySimplifier[] array = ensims;
			foreach (EnemySimplifier val in array)
			{
				MaterialPropertyBlock val2 = new MaterialPropertyBlock();
				val2.SetFloat("_Outline", 0f);
				val2.SetFloat("_ForceOutline", 0f);
				val.meshrenderer.SetPropertyBlock(val2);
				val.active = false;
				Object.Destroy((Object)(object)val);
			}
			DoubleRender[] componentsInChildren = ((Component)this).GetComponentsInChildren<DoubleRender>();
			DoubleRender[] array2 = componentsInChildren;
			foreach (DoubleRender val3 in array2)
			{
				Object.Destroy((Object)(object)val3);
			}
		}

		public void SwitchToPhysical()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			((Component)physicalContainer).gameObject.SetActive(true);
			physical.parent = Store.corpse.transform;
			physical.position = Store.corpse.transform.position;
			physical.rotation = Store.corpse.transform.rotation;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public static class SecretVariations
	{
		public static void MakeLegsWithSecretPossibility(GameObject gameObject)
		{
			float num = Random.Range(0f, 100f);
			if (num <= GlobalConfig.variantChance)
			{
				float num2 = Random.Range(0f, GlobalConfig.totalVariantChances);
				float num3 = 0f;
				foreach (KeyValuePair<string, float> individualVariantChance in GlobalConfig.individualVariantChances)
				{
					num3 += individualVariantChance.Value;
					if (num3 == 0f || num3 <= num2)
					{
						continue;
					}
					switch (individualVariantChance.Key)
					{
					case "plushie":
						GenericLegs("Assets/Legger/Variations/Plush/Plush.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Plushie Variant Loaded");
						break;
					case "tutu":
						GenericLegs("Assets/Legger/Variations/Tutu/Tutu.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Tutu Variant Loaded");
						break;
					case "stilts":
						GenericLegs("Assets/Legger/Variations/Stilts/Template.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Stilts Variant Loaded");
						break;
					case "holding_arms":
						GenericLegs("Assets/Legger/Variations/HoldingArms/HoldingArms.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Holding Arms Variant Loaded");
						break;
					case "holding_legs":
						GenericLegs("Assets/Legger/Variations/HoldingLegs/HoldingLegs.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Holding Legs Variant Loaded");
						break;
					case "2d":
						GenericLegs("Assets/Legger/Variations/2D/2D.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"2D Variant Loaded");
						break;
					case "mettaton":
						GenericLegs("Assets/Legger/Variations/Mettaton/Mettaton.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Mettaton Variant Loaded");
						break;
					case "sentry":
						GenericLegs("Assets/Legger/Variations/Sentry/Sentry.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Sentry Variant Loaded");
						break;
					case "swordsmachine":
						GenericLegs("Assets/Legger/Variations/Swordsmachine/Swordsmachine.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Swordsmachine Variant Loaded");
						break;
					case "v2":
						GenericLegs("Assets/Legger/Variations/ReconstructWhat/ReconstructWhat.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Reconstruct What Variant Loaded");
						break;
					case "gross":
						GenericLegs("Assets/Legger/Variations/GrossMaurice/Gross.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Gross Maurice Variant Loaded");
						break;
					case "mini_maurice":
						GenericLegs("Assets/Legger/Variations/MiniMaurice/MiniMaurice.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Mini Maurice Variant Loaded");
						break;
					case "thigh_highs":
						GenericLegs("Assets/Legger/Variations/ThighHighs/ThighHighs.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Thigh Highs Variant Loaded");
						break;
					case "hand_legs":
						GenericLegs("Assets/Legger/Variations/HandLegs/HandLegs.prefab", gameObject);
						Plugin.Logger.LogInfo((object)"Hand Legs Variant Loaded");
						break;
					default:
						Plugin.Logger.LogInfo((object)"Failed to pick variation");
						break;
					}
					break;
				}
				if (num3 != 0f)
				{
					return;
				}
			}
			Plugin.Logger.LogInfo((object)"Loaded Generic Legs");
			GenericLegsNoJingle("Assets/Legger/Legs/Legs.prefab", gameObject);
		}

		public static void GenericLegs(string key, GameObject malFace)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			AssetBundle val = BundleTool.Load("legs.bundle");
			GameObject val2 = Object.Instantiate<GameObject>((GameObject)val.LoadAsset(key));
			SetupResource.FixShader(val2);
			val2.transform.parent = malFace.transform;
			val2.transform.position = malFace.transform.position;
			LegsController legsController = val2.AddComponent<LegsController>();
			legsController.malFace = malFace.GetComponent<MaliciousFace>();
			legsController.variant = true;
			val.Unload(false);
		}

		public static void GenericLegsNoJingle(string key, GameObject malFace)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			AssetBundle val = BundleTool.Load("legs.bundle");
			GameObject val2 = Object.Instantiate<GameObject>((GameObject)val.LoadAsset(key));
			SetupResource.FixShader(val2);
			val2.transform.parent = malFace.transform;
			val2.transform.position = malFace.transform.position;
			LegsController legsController = val2.AddComponent<LegsController>();
			legsController.malFace = malFace.GetComponent<MaliciousFace>();
			legsController.variant = false;
			val.Unload(false);
		}
	}
	[BepInPlugin("bitmotte.MauriceLegger", "MauriceLegger", "3.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static PluginConfigurator config;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin bitmotte.MauriceLegger is loaded!");
			Harmony val = new Harmony("bitmotte.MauriceLegger");
			val.PatchAll();
			config = LegConfigurator.CreateConfigurator();
			SceneManager.sceneLoaded += SceneUtility.OnSceneLoad;
			Store.legger = true;
		}
	}
	public static class BundleTool
	{
		public static AssetBundle Load(string fileName)
		{
			return AssetBundle.LoadFromMemory(EmbeddedAccess.AccessFile(fileName));
		}
	}
	public static class EmbeddedAccess
	{
		public static byte[] AccessFile(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			byte[] array;
			using (Stream stream = executingAssembly.GetManifestResourceStream("MauriceLegger.resources." + fileName))
			{
				if (stream == null)
				{
					return null;
				}
				array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
			}
			return array;
		}
	}
	public static class SceneUtility
	{
		public static string sceneName;

		public static void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			sceneName = ((Scene)(ref scene)).name;
			GameObject val = new GameObject("aaa");
			val.transform.parent = null;
			val.AddComponent<SetPhysLegs>();
		}
	}
	internal class SetPhysLegs : MonoBehaviour
	{
		private void Start()
		{
			((MonoBehaviour)this).Invoke("Wagh", 0.1f);
		}

		private void Wagh()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			AssetBundle val = BundleTool.Load("legs.bundle");
			GameObject val2 = (GameObject)val.LoadAsset("Assets/Legger/Legs/Physical/Baller.prefab");
			SetupResource.FixShader(val2);
			Store.storedPhysicalLeg = val2;
			val.Unload(false);
		}
	}
	public static class SetupResource
	{
		public static GameObject FixShader(GameObject gameObject)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			Shader shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Environment/Metal/Pattern 1/Metal Pattern 1 8.mat").WaitForCompletion().shader;
			SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				Material[] materials = ((Renderer)val).materials;
				foreach (Material val2 in materials)
				{
					if (((Object)val2.shader).name == "ULTRAKILL/Master")
					{
						val2.shader = shader;
					}
					if (((Object)val2.shader).name == "Hidden/InternalErrorShader")
					{
						val2.shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Dev/FadeToWhite.mat").WaitForCompletion().shader;
					}
				}
			}
			MeshRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val3 in componentsInChildren2)
			{
				Material[] materials2 = ((Renderer)val3).materials;
				foreach (Material val4 in materials2)
				{
					val4.shader = shader;
				}
			}
			ParticleSystem[] componentsInChildren3 = gameObject.GetComponentsInChildren<ParticleSystem>();
			foreach (ParticleSystem val5 in componentsInChildren3)
			{
				Renderer[] componentsInChildren4 = ((Component)val5).gameObject.GetComponentsInChildren<Renderer>();
				foreach (Renderer val6 in componentsInChildren4)
				{
					Material[] materials3 = val6.materials;
					foreach (Material val7 in materials3)
					{
						val7.shader = shader;
					}
				}
			}
			EnemySimplifier[] componentsInChildren5 = gameObject.GetComponentsInChildren<EnemySimplifier>();
			foreach (EnemySimplifier val8 in componentsInChildren5)
			{
				if (Object.op_Implicit((Object)(object)val8.simplifiedMaterial))
				{
					val8.simplifiedMaterial.shader = shader;
				}
				if (Object.op_Implicit((Object)(object)val8.simplifiedMaterial2))
				{
					val8.simplifiedMaterial2.shader = shader;
				}
				if (Object.op_Implicit((Object)(object)val8.enragedMaterial))
				{
					if (((Object)val8.enragedMaterial.shader).name == "ULTRAKILL/Master")
					{
						val8.enragedMaterial.shader = shader;
					}
					if (((Object)val8.enragedMaterial.shader).name == "Hidden/InternalErrorShader")
					{
						val8.enragedMaterial.shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Dev/FadeToWhite.mat").WaitForCompletion().shader;
					}
				}
				if (Object.op_Implicit((Object)(object)val8.enragedSimplifiedMaterial))
				{
					val8.enragedSimplifiedMaterial.shader = shader;
				}
			}
			Footsteps[] componentsInChildren6 = gameObject.GetComponentsInChildren<Footsteps>();
			foreach (Footsteps val9 in componentsInChildren6)
			{
				if ((Object)(object)val9.footstep == (Object)null)
				{
					continue;
				}
				MeshRenderer[] componentsInChildren7 = val9.footstep.GetComponentsInChildren<MeshRenderer>();
				foreach (MeshRenderer val10 in componentsInChildren7)
				{
					Material[] materials4 = ((Renderer)val10).materials;
					foreach (Material val11 in materials4)
					{
						val11.shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Dev/FadeToWhite.mat").WaitForCompletion().shader;
					}
				}
			}
			return gameObject;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "bitmotte.MauriceLegger";

		public const string PLUGIN_NAME = "MauriceLegger";

		public const string PLUGIN_VERSION = "3.0.0";
	}
}