Decompiled source of LRCCosmetics v1.3.0

LRCCosmetics.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LRCCosmetics.Cosmetics;
using Microsoft.CodeAnalysis;
using MoreCompany.Cosmetics;
using MoreCompany.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LRCCosmetics")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A cool collection of cosmetics")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ccf3acd7d1d43cfb4a5019d73ca7883cdebc10cc")]
[assembly: AssemblyProduct("LRCCosmetics")]
[assembly: AssemblyTitle("LRCCosmetics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 LRCCosmetics
{
	[BepInPlugin("LRCCosmetics", "LRCCosmetics", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony _harmony;

		private bool _initialized;

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

		public void Start()
		{
			if (_initialized)
			{
				_initialized = true;
				Init();
			}
		}

		public void OnDestroy()
		{
			if (!_initialized)
			{
				_initialized = true;
				Init();
			}
		}

		private void Init()
		{
			List<StreamCosmeticGeneric> cosmetics = new List<StreamCosmeticGeneric>
			{
				new BraixenHead(),
				new DittoHead(),
				new EeveeHead(),
				new FlareonHead(),
				new GardevoirHead(),
				new JolteonHead(),
				new LegoSharkHeadBlue(),
				new MeowscaradaHead(),
				new MortyHead(),
				new RickHead(),
				new VaporeonHead(),
				new ZoruaHead()
			};
			LoadAssets(cosmetics);
		}

		private void LoadAssets(IEnumerable<StreamCosmeticGeneric> cosmetics)
		{
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading assets for LRCCosmetics");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			if ((object)executingAssembly == null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to get assemlby.");
			}
			foreach (StreamCosmeticGeneric cosmetic in cosmetics)
			{
				AssetBundle val = BundleUtilities.LoadBundleFromInternalAssembly(cosmetic.StreamingPath, executingAssembly);
				GameObject val2 = AssetBundleExtension.LoadPersistentAsset<GameObject>(val, ((CosmeticGeneric)cosmetic).gameObjectPath);
				if (val2 == null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("Failed to find GameObject for cosmetic '" + ((CosmeticGeneric)cosmetic).cosmeticId + "' at path '" + ((CosmeticGeneric)cosmetic).gameObjectPath + "'"));
					continue;
				}
				Texture2D val3 = AssetBundleExtension.LoadPersistentAsset<Texture2D>(val, ((CosmeticGeneric)cosmetic).textureIconPath);
				if (val3 == null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("Failed to find icon Texture2D for cosmetic '" + ((CosmeticGeneric)cosmetic).cosmeticId + " at path '" + ((CosmeticGeneric)cosmetic).textureIconPath + "'"));
				}
				else
				{
					CosmeticInstance val4 = val2.AddComponent<CosmeticInstance>();
					val4.cosmeticId = ((CosmeticGeneric)cosmetic).cosmeticId;
					val4.icon = val3;
					val4.cosmeticType = ((CosmeticGeneric)cosmetic).cosmeticType;
					CosmeticRegistry.cosmeticInstances.Add(((CosmeticGeneric)cosmetic).cosmeticId, val4);
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Successfully loaded cosmetic: " + ((CosmeticGeneric)cosmetic).cosmeticId));
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LRCCosmetics";

		public const string PLUGIN_NAME = "LRCCosmetics";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LRCCosmetics.Cosmetics
{
	public class BraixenHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.braixenhead";

		public override string gameObjectPath => "assets/LRCCosmetics/BraixenHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/BraixenHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.braixenhead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class DittoHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.dittohead";

		public override string gameObjectPath => "assets/LRCCosmetics/DittoHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/DittoHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.dittohead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class EeveeHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.eeveehead";

		public override string gameObjectPath => "assets/LRCCosmetics/EeveeHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/EeveeHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.eeveehead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class FlareonHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.flareonhead";

		public override string gameObjectPath => "assets/LRCCosmetics/FlareonHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/FlareonHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.flareonhead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class GardevoirHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.gardevoirhead";

		public override string gameObjectPath => "assets/LRCCosmetics/GardevoirHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/GardevoirHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.gardevoirhead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class JolteonHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.jolteonhead";

		public override string gameObjectPath => "assets/LRCCosmetics/JolteonHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/JolteonHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.jolteonhead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class LegoSharkHeadBlue : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.legosharkbluehead";

		public override string gameObjectPath => "assets/LRCCosmetics/LegoSharkBlueHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/LegoSharkBlueHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.legosharkbluehead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class MeowscaradaHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.meowscaradahead";

		public override string gameObjectPath => "assets/LRCCosmetics/MeowscaradaHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/MeowscaradaHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.meowscaradahead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class MortyHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.mortyhead";

		public override string gameObjectPath => "assets/LRCCosmetics/MortyHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/MortyHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.mortyhead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class RickHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.rickhead";

		public override string gameObjectPath => "assets/LRCCosmetics/RickHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/RickHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.rickhead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public abstract class StreamCosmeticGeneric : CosmeticGeneric
	{
		public virtual string StreamingPath => string.Empty;
	}
	public class VaporeonHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.vaporeonhead";

		public override string gameObjectPath => "assets/LRCCosmetics/VaporeonHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/VaporeonHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.vaporeonhead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
	public class ZoruaHead : StreamCosmeticGeneric
	{
		public override string cosmeticId => "lrccosmetics.zoruahead";

		public override string gameObjectPath => "assets/LRCCosmetics/ZoruaHead.prefab";

		public override string textureIconPath => "assets/LRCCosmetics/Icons/ZoruaHeadIconTexture.png";

		public override string StreamingPath => "LRCCosmetics.Assets.zoruahead";

		public override CosmeticType cosmeticType => (CosmeticType)0;
	}
}