Decompiled source of SaiCosmetics v1.1.0

SaiCosmetics.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreCompany.Cosmetics;
using MoreCompany.Utils;
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 = "")]
[assembly: AssemblyCompany("SaiCosmetics")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SaiCosmetics")]
[assembly: AssemblyTitle("SaiCosmetics")]
[assembly: AssemblyVersion("1.0.0.0")]
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 SaiCosmetics
{
	public class Dance : SaiCosmeticGeneric
	{
		public override string BundleName => "Dance";

		public override string BundlePath => "SaiCosmetics.dance";

		public override string cosmeticId => "sai.Dance";

		public CosmeticType cosType => (CosmeticType)0;
	}
	public class Doug : SaiCosmeticGeneric
	{
		public override string BundleName => "Doug";

		public override string BundlePath => "SaiCosmetics.doug";

		public override string cosmeticId => "sai.doug";

		public CosmeticType cosType => (CosmeticType)0;
	}
	public class Kid : SaiCosmeticGeneric
	{
		public override string BundleName => "kid";

		public override string BundlePath => "SaiCosmetics.kid";

		public override string cosmeticId => "sai.kid";

		public CosmeticType cosType => (CosmeticType)0;
	}
	[BepInPlugin("Sai.SaiCosmetics", "Sai's Bullshit Cosmetics", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony _harmony;

		private bool _initialized;

		private void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if (_harmony == null)
			{
				_harmony = new Harmony("Sai.SaiCosmetics");
			}
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SaiCosmetics is loaded!");
			LoadAssets();
		}

		private void LoadAssets()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading assets for SaiCosmetics");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			if (executingAssembly == null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to get assembly.");
			}
			Type[] types = executingAssembly.GetTypes();
			foreach (Type type in types)
			{
				if (!(type == null) && type.IsSubclassOf(typeof(SaiCosmeticGeneric)))
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)$"Loading cosmetic: {type}");
					SaiCosmeticGeneric streamCosmeticGeneric2 = (SaiCosmeticGeneric)Activator.CreateInstance(type);
					loadBundle(streamCosmeticGeneric2);
				}
			}
			void loadBundle(SaiCosmeticGeneric streamCosmeticGeneric)
			{
				//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)
				AssetBundle val = BundleUtilities.LoadBundleFromInternalAssembly(streamCosmeticGeneric.BundlePath, executingAssembly);
				GameObject val2 = AssetBundleExtension.LoadPersistentAsset<GameObject>(val, streamCosmeticGeneric.BundleName + ".prefab");
				if ((Object)(object)val2 == (Object)null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("Failed to find GameObject for cosmetic '" + ((CosmeticGeneric)streamCosmeticGeneric).cosmeticId + "' at path '" + ((CosmeticGeneric)streamCosmeticGeneric).gameObjectPath + "'"));
				}
				else
				{
					CosmeticInstance component = val2.GetComponent<CosmeticInstance>();
					component.cosmeticId = ((CosmeticGeneric)streamCosmeticGeneric).cosmeticId;
					component.cosmeticType = streamCosmeticGeneric.CosType;
					CosmeticRegistry.cosmeticInstances.Add(((CosmeticGeneric)streamCosmeticGeneric).cosmeticId, component);
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Successfully loaded cosmetic: " + ((CosmeticGeneric)streamCosmeticGeneric).cosmeticId));
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_ID = "SaiCosmetics";

		public const string PLUGIN_NAME = "Sai's Bullshit Cosmetics";

		public const string PLUGIN_VERSION = "1.1.0";

		public const string PLUGIN_GUID = "Sai.SaiCosmetics";
	}
	public class Rao : SaiCosmeticGeneric
	{
		public override string BundleName => "rao";

		public override string BundlePath => "SaiCosmetics.rao";

		public override string cosmeticId => "sai.rao";

		public CosmeticType cosType => (CosmeticType)0;
	}
	public class Rat : SaiCosmeticGeneric
	{
		public override string BundleName => "rat";

		public override string BundlePath => "SaiCosmetics.rat";

		public override string cosmeticId => "sai.rat";

		public CosmeticType cosType => (CosmeticType)0;
	}
	public class SaiCosmeticGeneric : CosmeticGeneric
	{
		public CosmeticType CosType;

		public virtual string BundleName { get; }

		public virtual string BundlePath { get; }
	}
	public class ShyGuy : SaiCosmeticGeneric
	{
		public override string BundleName => "ShyGuy";

		public override string BundlePath => "SaiCosmetics.shyguy";

		public override string cosmeticId => "sai.Shy";

		public CosmeticType cosType => (CosmeticType)0;
	}
}