Decompiled source of TeaisntsSillySuits v1.0.0

TeaisntsSillySuits.dll

Decompiled a month ago
using System;
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 Microsoft.CodeAnalysis;
using UnityEngine;

[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("TeaisntsSillySuits")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TeaisntsSillySuits")]
[assembly: AssemblyTitle("TeaisntsSillySuits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ModelReplacement
{
	public class BEATRIXLEBEAU : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "BeatrixLeBeau";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class YOTSUBAKOIWAI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Yotsuba";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MAX : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Max";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class SAM : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Sam";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MANNYCALAVERA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "MannyCalavera";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class SAKURAKINOMOTO : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "SakuraKinomoto";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class LAINIWAKURA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "LainIwakura";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class KAGEMORIMICHIRU : BodyReplacementBase
	{
		private Animator tailAnimator;

		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "KagemoriMichiru";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void OnDeath()
		{
			((BodyReplacementBase)this).OnDeath();
			Animator val = default(Animator);
			if (((Component)base.replacementDeadBody.transform.Find("Michiru/Michiru_arm/全ての親/センター/グルーブ/下半身")).gameObject.TryGetComponent<Animator>(ref val))
			{
				tailAnimator = val;
			}
			else
			{
				Plugin.Logger.LogError((object)"Tail animator not found! Please report this and provide the log, thank you! <3");
			}
			tailAnimator.SetTrigger("OnDeath");
		}
	}
	public class TODDTHETURNIP : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "ToddTheTurnip";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class ROSALINA : BodyReplacementBase
	{
		private bool isLeft = false;

		private Animator lumaAnimator;

		private float timeSinceSpun = 0f;

		private bool isBored = false;

		private float waitToBeBoredTime = 0f;

		private float boredThresholdMin = 5f;

		private float boredThresholdMax = 10f;

		private float currBoredThreshold = 5f;

		[SerializeField]
		private Vector3 frequency = new Vector3(0f, 1f, 0f);

		[SerializeField]
		private Vector3 magnitude = new Vector3(0f, 0.5f, 0f);

		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Rosalina";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void OnDeath()
		{
			((BodyReplacementBase)this).OnDeath();
			Animator val = default(Animator);
			if (((Component)base.replacementDeadBody.transform.Find("Armature.001/skl_root/Tico_model")).gameObject.TryGetComponent<Animator>(ref val))
			{
				lumaAnimator = val;
			}
			else
			{
				Plugin.Logger.LogError((object)"Luma animator not found! Please report this and provide the log, thank you! <3");
			}
			lumaAnimator.SetTrigger("Disappear");
		}

		private void Update()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)lumaAnimator == (Object)null)
			{
				Animator val = default(Animator);
				if (((Component)base.replacementModel.transform.Find("Armature.001/skl_root/Luma")).gameObject.TryGetComponent<Animator>(ref val))
				{
					lumaAnimator = val;
				}
				return;
			}
			((Component)lumaAnimator).transform.position = ((BodyReplacementBase)this).controller.turnCompass.position;
			waitToBeBoredTime += Time.deltaTime;
			timeSinceSpun += Time.deltaTime;
			if (waitToBeBoredTime > currBoredThreshold && timeSinceSpun > 2.5f)
			{
				timeSinceSpun = 0f;
				waitToBeBoredTime = 0f;
				isBored = true;
				lumaAnimator.SetBool("isBored", true);
				isLeft = !isLeft;
				if (!isLeft)
				{
					lumaAnimator.SetTrigger("spinLeft");
				}
				else
				{
					lumaAnimator.SetTrigger("spinRight");
				}
				if (((BodyReplacementBase)this).controller.movementSpeed != 0f)
				{
					currBoredThreshold = Random.Range(boredThresholdMin, boredThresholdMax);
				}
				else
				{
					currBoredThreshold = Random.Range(boredThresholdMin / 2f, boredThresholdMax / 2f);
				}
			}
			else if (isBored && waitToBeBoredTime > 0.5f && ((BodyReplacementBase)this).controller.movementSpeed != 0f)
			{
				isBored = false;
				lumaAnimator.SetBool("isBored", false);
			}
		}
	}
	public class SHANA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Shana";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class KANBARUSURUGA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "KanbaruSuruga";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MOSTIMA : BodyReplacementBase
	{
		private Animator tailAnimator;

		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Mostima";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void OnDeath()
		{
			((BodyReplacementBase)this).OnDeath();
			Animator val = default(Animator);
			if (((Component)base.replacementDeadBody.transform.Find("survivor_biker_ARM/ValveBiped.Bip01_Pelvis")).gameObject.TryGetComponent<Animator>(ref val))
			{
				tailAnimator = val;
			}
			else
			{
				Plugin.Logger.LogError((object)"Tail animator not found! Please report this and provide the log, thank you! <3");
			}
			tailAnimator.SetTrigger("OnDeath");
		}
	}
	public class WATTSON : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Wattson";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class SHIZUOHEIWAJIMA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "ShizuoHeiwajima";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MAYOIHACHIKUJI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "MayoiHachikuji";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class DIANA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Diana";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class YOTSUGIONONOKI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "YotsugiOnonoki";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	[BepInPlugin("com.teaisnt.teaisntssillysuits", "TeaisntsSillySuits", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "TeaisntsSillySuits";

		internal static readonly Harmony Harmony = new Harmony("TeaisntsSillySuits");

		internal static ManualLogSource Logger { get; private set; } = null;


		private void Awake()
		{
			Assets.PopulateAssets();
			Logger = ((BaseUnityPlugin)this).Logger;
			ModelReplacementAPI.RegisterSuitModelReplacement("Beatrix LeBeau", typeof(BEATRIXLEBEAU));
			ModelReplacementAPI.RegisterSuitModelReplacement("Yotsuba Koiwai", typeof(YOTSUBAKOIWAI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Manny Calavera", typeof(MANNYCALAVERA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Max", typeof(MAX));
			ModelReplacementAPI.RegisterSuitModelReplacement("Sam", typeof(SAM));
			ModelReplacementAPI.RegisterSuitModelReplacement("Sakura Kinomoto", typeof(SAKURAKINOMOTO));
			ModelReplacementAPI.RegisterSuitModelReplacement("Lain Iwakura", typeof(LAINIWAKURA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Kagemori Michiru", typeof(KAGEMORIMICHIRU));
			ModelReplacementAPI.RegisterSuitModelReplacement("Todd the Turnip", typeof(TODDTHETURNIP));
			ModelReplacementAPI.RegisterSuitModelReplacement("Rosalina", typeof(ROSALINA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Shana", typeof(SHANA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Kanbaru Suruga", typeof(KANBARUSURUGA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Mostima", typeof(MOSTIMA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Wattson", typeof(WATTSON));
			ModelReplacementAPI.RegisterSuitModelReplacement("Shizuo Heiwajima", typeof(SHIZUOHEIWAJIMA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Mayoi Hachikuji", typeof(MAYOIHACHIKUJI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Diana", typeof(DIANA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Yotsugi Ononoki", typeof(YOTSUGIONONOKI));
			Harmony.PatchAll();
			Logger.LogDebug((object)"Thank you for trying out Teaisnts Silly Suits! I sincerely hope you enjoy the mod :) -Teaisnt");
		}
	}
	public static class Assets
	{
		public static string mainAssetBundleName = "teaisntssillysuitsassetbundle";

		public static AssetBundle MainAssetBundle = null;

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().GetName().Name.Replace(" ", "_");
		}

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName);
				using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName);
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}