Decompiled source of HSRCatPairings v1.0.1

hsrcatpairings.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using CSync.Extensions;
using CSync.Lib;
using LethalLib.Modules;
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: AssemblyCompany("hsrcatpairings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("hsrcatpairings")]
[assembly: AssemblyTitle("hsrcatpairings")]
[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 HSRCatPairings
{
	[BepInPlugin("CraftyGlitches.HSRCatPairings", "HSR Cat Cake Pairings", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "CraftyGlitches.HSRCatPairings";

		private const string NAME = "HSR Cat Cake Pairings";

		private const string VERSION = "1.0.1";

		public static Plugin Instance;

		public static CatPairConfig config;

		public static List<string> ItemAssets = new List<string>
		{
			"Assets/cat cakes/yingxingfeng/azure sesame.asset", "Assets/cat cakes/bladeheng/rice sesame.asset", "Assets/cat cakes/high cloud quintet/high cloud meowtet.asset", "Assets/cat cakes/phainon and cyrene/love and moonstone.asset", "Assets/cat cakes/march and evernight/dark n ice cake.asset", "Assets/cat cakes/boothill and dan heng/mechanical dumpling.asset", "Assets/cat cakes/aglaea and anaxa/scholarly marigold.asset", "Assets/cat cakes/astral family cake/astral family cake.asset", "Assets/cat cakes/serval gepard and lynx/the landau family.asset", "Assets/cat cakes/moze feixiao and jiaoqiu/yaoqing club.asset",
			"Assets/cat cakes/stellaron hunters/stellarmeow hunters.asset", "Assets/cat cakes/jade aventurine and topaz/the ipc family.asset", "Assets/cat cakes/kafka and trailblazer/shaders n trash.asset", "Assets/cat cakes/mydei argenti/pomegranate and roses.asset", "Assets/cat cakes/seele and phainon/doodoo divas.asset", "Assets/cat cakes/jingliu and baiheng/dearly beloved.asset", "Assets/cat cakes/argenti and boothill/guns n roses.asset", "Assets/cat cakes/robin and sunday/halovian siblings.asset", "Assets/cat cakes/mydei and phainon/deliverer and pomegranates.asset", "Assets/cat cakes/anaxa and dan heng/scholars and dromas.asset",
			"Assets/cat cakes/phainons and phainons/eternal cycles.asset"
		};

		public static List<Item> ItemList;

		private void Awake()
		{
			Instance = this;
			ItemList = new List<Item>();
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "hsrcatpairings");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			foreach (string itemAsset in ItemAssets)
			{
				Item val2 = val.LoadAsset<Item>(itemAsset);
				if ((Object)(object)val2 == (Object)null)
				{
					Debug.LogError((object)(itemAsset + " is not accessible, please check your asset path again"));
				}
				else
				{
					ItemList.Add(val2);
				}
			}
			config = new CatPairConfig(((BaseUnityPlugin)this).Config);
			foreach (KeyValuePair<Item, SyncedEntry<int>> item in CatPairConfig.ItemRarity)
			{
				RegisterCatCakes(item.Key, SyncedEntry<int>.op_Implicit(item.Value));
				ValidateShopItem(item.Key);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"CraftyGlitches.HSRCatPairings is loaded ! ... Meow! Feed us all!");
		}

		private void RegisterCatCakes(Item item, int value)
		{
			GameObject spawnPrefab = item.spawnPrefab;
			NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab);
			Utilities.FixMixerGroups(spawnPrefab);
			Items.RegisterScrap(item, value, (LevelTypes)(-1));
		}

		private void ValidateShopItem(Item item)
		{
			List<string> list = new List<string> { "Rice Sesame", "Azure Sesame" };
			if (!list.Contains(item.itemName))
			{
				return;
			}
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.clearPreviousText = true;
			string text = "With the collaboration of Hertas Space Station, the trailblazer can happily provide this cute gelatinous creature as a companion for your lonely adventure.";
			string itemName = item.itemName;
			string text2 = itemName;
			if (!(text2 == "Rice Sesame"))
			{
				if (text2 == "Azure Sesame")
				{
					val.displayText = text + "The two cats are sharing a drink together under the moonlight, you almost feel like you should give them some privacy.";
				}
			}
			else
			{
				val.displayText = text + "One would think Black Sesame and Rice Dumpling are stuck together with glue but its actually just Black Sesames claws refusing to let go of Rice Dumplings shell.";
			}
			Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, val, Mathf.FloorToInt((float)Random.Range(80, 150)));
		}
	}
	public class CatPairConfig : SyncedConfig2<CatPairConfig>
	{
		[field: SyncedEntryField]
		public static Dictionary<Item, SyncedEntry<int>> ItemRarity { get; private set; }

		public CatPairConfig(ConfigFile config)
			: base("CraftyGlitches.HSRCatPairings")
		{
			ItemRarity = new Dictionary<Item, SyncedEntry<int>>();
			List<string> list = new List<string> { "Rice Sesame", "Azure Sesame", "Stellarmeow Hunters" };
			foreach (Item item in Plugin.ItemList)
			{
				if (list.Contains(item.itemName))
				{
					switch (item.itemName)
					{
					case "Rice Sesame":
						ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Cat cake rarity", item.itemName ?? "", 30, "Changing rarity value for: " + item.itemName + ".\n\nEnter your desired value.\n\nYou can check the names of the cats on my thunderstore wiki page.");
						break;
					case "Azure Sesame":
						ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Cat cake rarity", item.itemName ?? "", 30, "Changing rarity value for: " + item.itemName + ".\n\nEnter your desired value.\n\nYou can check the names of the cats on my thunderstore wiki page.");
						break;
					case "Stellarmeow Hunters":
						ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Cat cake rarity", item.itemName ?? "", 30, "Changing rarity value for: " + item.itemName + ".\n\nEnter your desired value.\n\nYou can check the names of the cats on my thunderstore wiki page.");
						break;
					}
				}
				else
				{
					ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Cat cake rarity", item.itemName ?? "", 20, "Changing rarity value for: " + item.itemName + ".\n\nEnter your desired value.\n\nYou can check the names of the cats on my thunderstore wiki page.");
				}
			}
			ConfigManager.Register<CatPairConfig>((SyncedConfig2<CatPairConfig>)(object)this);
		}
	}
}