Decompiled source of Cat Cosmetics v0.1.1

CatCosmetics.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Steamworks;
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(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CatCosmetics;

[BepInPlugin("eberk30.catcosmetics", "Cat Cosmetics", "0.1.0")]
public class CatCosmeticsPlugin : BaseUnityPlugin
{
	public const string PLUGIN_GUID = "eberk30.catcosmetics";

	public const string PLUGIN_NAME = "Cat Cosmetics";

	public const string PLUGIN_VERSION = "0.1.0";

	internal static ManualLogSource Log;

	private const string GiftUsername = "catnamednorris";

	private const string GiftCosmeticName = "Fleur";

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		((MonoBehaviour)this).StartCoroutine(GiftCosmeticRoutine());
	}

	private IEnumerator GiftCosmeticRoutine()
	{
		float waited = 0f;
		while ((Object)(object)MetaManager.instance == (Object)null || MetaManager.instance.cosmeticAssets.Count == 0)
		{
			yield return null;
			waited += Time.deltaTime;
			if (waited > 30f)
			{
				Log.LogWarning((object)"[CatCosmetics] timed out waiting for MetaManager cosmetic assets to load");
				yield break;
			}
		}
		if (!SteamClient.IsValid || !string.Equals(SteamClient.Name, "catnamednorris", StringComparison.OrdinalIgnoreCase))
		{
			yield break;
		}
		CosmeticAsset target = null;
		waited = 0f;
		while ((Object)(object)target == (Object)null)
		{
			foreach (CosmeticAsset asset in MetaManager.instance.cosmeticAssets)
			{
				if ((Object)(object)asset != (Object)null && asset.assetName == "Fleur")
				{
					target = asset;
					break;
				}
			}
			if ((Object)(object)target != (Object)null)
			{
				break;
			}
			yield return null;
			waited += Time.deltaTime;
			if (waited > 30f)
			{
				Log.LogWarning((object)"[CatCosmetics] timed out waiting for cosmetic asset 'Fleur' to be registered");
				yield break;
			}
		}
		if (MetaManager.instance.CosmeticUnlock(target))
		{
			Log.LogInfo((object)("[CatCosmetics] gifted '" + target.assetName + "' to catnamednorris"));
		}
	}
}