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("HSRCatLIB")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HSRCatLIB")] [assembly: AssemblyTitle("HSRCatLIB")] [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 HonkaiCatCakesLIB { [BepInPlugin("CraftyGlitches.HonkaiCatCakesLIB", "Honkai Cat Cakes LIB", "1.3.4")] public class Plugin : BaseUnityPlugin { private const string GUID = "CraftyGlitches.HonkaiCatCakesLIB"; private const string NAME = "Honkai Cat Cakes LIB"; private const string VERSION = "1.3.4"; public static Plugin Instance; public static CatCakesConfig config; public static List ItemAssets = new List { "Assets/Cat Cake/fu xuan/diviner mochi.asset", "Assets/Cat Cake/robin/charmony kitty.asset", "Assets/Cat Cake/trailblazer/trash cake.asset", "Assets/Cat Cake/ruan mei/lambdas friend.asset", "Assets/Cat Cake/qingque/lucky snack.asset", "Assets/Cat Cake/guinaifen/troublemaker cat.asset", "Assets/Cat Cake/blade/black sesame.asset", "Assets/Cat Cake/herta/wisteria cake.asset", "Assets/Cat Cake/clara/pure sugar child.asset", "Assets/Cat Cake/aventurine/honey dice.asset", "Assets/Cat Cake/jing yuan/dozing meow.asset", "Assets/Cat Cake/sparkle/flower viewing dango.asset", "Assets/Cat Cake/kafka/shader cat.asset", "Assets/Cat Cake/dan heng/rice dumpling.asset", "Assets/Cat Cake/march/ice cake.asset", "Assets/Cat Cake/akivili/akivili.asset", "Assets/Cat Cake/welt/welt.asset", "Assets/Cat Cake/hyacine/hyacine.asset", "Assets/Cat Cake/yaoguang/yaoguang.asset", "Assets/Cat Cake/himeko/himeko.asset", "Assets/Cat Cake/ratio/drratio.asset", "Assets/Cat Cake/phainon/phainon.asset", "Assets/Cat Cake/anaxa/anaxa.asset", "Assets/Cat Cake/cyrene/cyrene.asset", "Assets/Cat Cake/firefly/firefly.asset", "Assets/Cat Cake/castorice/castorice.asset", "Assets/Cat Cake/sunday/sunday.asset", "Assets/Cat Cake/silverwolf/silverwolf.asset" }; public static List ItemList; private void Awake() { Instance = this; ItemList = new List(); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "hsrcatcakelib"); AssetBundle val = AssetBundle.LoadFromFile(text); foreach (string itemAsset in ItemAssets) { Item val2 = val.LoadAsset(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 CatCakesConfig(((BaseUnityPlugin)this).Config); foreach (KeyValuePair> item in CatCakesConfig.ItemRarity) { RegisterCatCakes(item.Key, SyncedEntry.op_Implicit(item.Value)); ValidateShopItem(item.Key); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"CraftyGlitches.HonkaiCatCakesLIB is loaded ! Lets trailblaze together!"); } public static void RemovePostProcessing(GameObject spawnPrefab) { if (!((Object)(object)spawnPrefab != (Object)null)) { return; } MeshRenderer[] componentsInChildren = spawnPrefab.GetComponentsInChildren(); MeshRenderer[] array = componentsInChildren; MeshRenderer[] array2 = array; foreach (MeshRenderer val in array2) { Material[] materials = ((Renderer)val).materials; foreach (Material val2 in materials) { if (val2.renderQueue < 3000) { val2.renderQueue = 2900; } } } } private void RegisterCatCakes(Item item, int value) { GameObject spawnPrefab = item.spawnPrefab; RemovePostProcessing(spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab); Utilities.FixMixerGroups(spawnPrefab); if (item.itemName == "Destiny Mochi") { Items.RegisterScrap(item, value, (LevelTypes)12288); } else { Items.RegisterScrap(item, value, (LevelTypes)(-1)); } } private void ValidateShopItem(Item item) { List list = new List { "Black Sesame", "Honey Dice" }; if (!list.Contains(item.itemName)) { return; } TerminalNode val = ScriptableObject.CreateInstance(); val.clearPreviousText = true; string text = "These creations were made by the trailblazers with the use of the creation oven, pelase take good care of them!"; string itemName = item.itemName; string text2 = itemName; if (!(text2 == "Black Sesame")) { if (text2 == "Honey Dice") { val.displayText = text + "Lets go gambling, lets go gambling!"; } } else { val.displayText = text + "Of five cats, three must pay a price."; } Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, val, Mathf.FloorToInt((float)Random.Range(100, 150))); } } public class CatCakesConfig : SyncedConfig2 { [field: SyncedEntryField] public static Dictionary> ItemRarity { get; private set; } public CatCakesConfig(ConfigFile config) : base("CraftyGlitches.HSRCatExtraLIB") { ItemRarity = new Dictionary>(); List list = new List { "Black Sesame" }; foreach (Item item in Plugin.ItemList) { if (list.Contains(item.itemName)) { string itemName = item.itemName; string text = itemName; if (text == "Black Sesame") { ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry(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 cat cakes on my thunderstore wiki page."); } } else { ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry(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 cat cakes on my thunderstore wiki page."); } } ConfigManager.Register((SyncedConfig2)(object)this); } public static void AssetLoader(List list) { } } }