Decompiled source of Femboy V1 v1.0.0

FemboyV1.dll

Decompiled 2 hours ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
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: AssemblyCompany("FemboyV1")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FemboyV1")]
[assembly: AssemblyTitle("FemboyV1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FemboyV1;

[BepInPlugin("com.kommeleon.femboyv1", "Femboy V1", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Mesh CustomMesh;

	public static Material CustomMaterial;

	private void Awake()
	{
		string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		string text = Path.Combine(directoryName, "femboy_v1");
		if (File.Exists(text))
		{
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val != (Object)null)
			{
				Mesh[] array = val.LoadAllAssets<Mesh>();
				if (array.Length != 0)
				{
					CustomMesh = array[0];
				}
				CustomMaterial = val.LoadAsset<Material>("Femboy V1");
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded Femboy V1 assets!");
			}
		}
		((MonoBehaviour)this).InvokeRepeating("SwapPlushies", 1f, 1f);
	}

	private void SwapPlushies()
	{
		if ((Object)(object)CustomMesh == (Object)null || (Object)(object)CustomMaterial == (Object)null)
		{
			return;
		}
		MeshFilter[] array = Object.FindObjectsOfType<MeshFilter>();
		MeshFilter[] array2 = array;
		foreach (MeshFilter val in array2)
		{
			if (!((Object)(object)val.sharedMesh != (Object)null) || !((Object)(object)val.sharedMesh != (Object)(object)CustomMesh))
			{
				continue;
			}
			string text = ((Object)((Component)val).gameObject).name.ToLower();
			string text2 = ((Object)val.sharedMesh).name.ToLower();
			if ((text.Contains("v1") && text.Contains("plush")) || (text2.Contains("v1") && text2.Contains("plush")))
			{
				val.sharedMesh = CustomMesh;
				MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).sharedMaterial = CustomMaterial;
				}
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Found a V1 Plushie in the world and swapped it!");
			}
		}
	}
}