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("hsr scrap lib")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("hsr scrap lib")] [assembly: AssemblyTitle("hsr scrap lib")] [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 HSRScrapLIB { [BepInPlugin("CraftyGlitches.HSRScrapLIB", "HSR Scrap LIB", "1.3.4")] public class Plugin : BaseUnityPlugin { private const string GUID = "CraftyGlitches.HSRScrapLIB"; private const string NAME = "HSR Scrap LIB"; private const string VERSION = "1.3.4"; public static Plugin Instance; public static HSRScrapConfig config; public static List ItemAssets = new List { "Assets/hsritems/himeko and welt/himeko and welt.asset", "Assets/hsritems/common grey seal/common grey seal.asset", "Assets/hsritems/red hot seal/red hot seal.asset", "Assets/hsritems/rubber seal/rubber seal.asset", "Assets/hsritems/duotone seal/duotone seal.asset", "Assets/hsritems/astral crew/astral crew.asset", "Assets/hsritems/bandaged seal/bandaged seal.asset", "Assets/hsritems/herta duck/herta duck.asset", "Assets/hsritems/complainer/complainer.asset", "Assets/hsritems/spiky seal/spiky seal.asset", "Assets/hsritems/mem duck/mem duck.asset", "Assets/hsritems/tribbie doll/tribbie doll.asset", "Assets/hsritems/bubbles chimera/bubbles chimera.asset", "Assets/hsritems/droma/dromas.asset", "Assets/hsritems/dark seal/dark seal.asset", "Assets/hsritems/wubbaboo/wubbaboo.asset", "Assets/hsritems/delicious shumai/delicious shumai.asset", "Assets/hsritems/angel seal/angel seal.asset", "Assets/hsritems/ratio duck/ratio duck.asset", "Assets/hsritems/sparkle doll/sparkle doll.asset", "Assets/hsritems/jade stone/jade stone.asset", "Assets/hsritems/aventurine stone/aventurine stone.asset", "Assets/hsritems/mega seal/mega seal.asset", "Assets/hsritems/tuskipir/tuskipir.asset", "Assets/hsritems/topaz stone/topaz stone.asset", "Assets/hsritems/droma pink/dromas pink.asset", "Assets/hsritems/little ica/little ica.asset", "Assets/hsritems/droma blue/dromas blue.asset", "Assets/hsritems/droma anaxa/scholarly dromas.asset", "Assets/hsritems/droma blade cat/dromas blade cat.asset", "Assets/hsritems/droma blade/wounded dromas.asset", "Assets/hsritems/sushangbird/phoenix.asset", "Assets/hsritems/lygus head/lygushead.asset", "Assets/hsritems/pompombroom/pombroom.asset", "Assets/hsritems/bubbletea/bubble tea.asset", "Assets/hsritems/ruancake/ruancake.asset", "Assets/hsritems/pompomwatergun/pompomwater.asset", "Assets/hsritems/diting/diting.asset", "Assets/hsritems/crane/crane.asset" }; public static List ItemList; private void Awake() { Instance = this; ItemList = new List(); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "hsrscraplib"); 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 HSRScrapConfig(((BaseUnityPlugin)this).Config); foreach (KeyValuePair> item in HSRScrapConfig.ItemRarity) { RegisterHSRScrap(item.Key, SyncedEntry.op_Implicit(item.Value)); ValidateShopItem(item.Key); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"CraftyGlitches.HSRScrapLIB is loaded ! ... may this journey lead us starward."); } 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 RegisterHSRScrap(Item item, int value) { GameObject spawnPrefab = item.spawnPrefab; RemovePostProcessing(spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab); Utilities.FixMixerGroups(spawnPrefab); if (item.itemName == "testname") { Items.RegisterScrap(item, value, (LevelTypes)12288); } else { Items.RegisterScrap(item, value, (LevelTypes)(-1)); } } private void ValidateShopItem(Item item) { List list = new List { "Bandaged Seal", "Complainer", "Dromas Baby", "Pink Baby Dromas", "Blue Baby Dromas", "Scholarly Dromas", "Wounded Baby Dromas" }; if (list.Contains(item.itemName)) { TerminalNode val = ScriptableObject.CreateInstance(); val.clearPreviousText = true; string text = "These items have been provided to the company by an unknown sponsor."; switch (item.itemName) { case "Bandaged Seal": val.displayText = text + "Of five seals, three must pay the price!"; break; case "Complainer": val.displayText = text + "Really loves to complain... I mean praise you!"; break; case "Dromas Baby": val.displayText = text + "A baby dromas! They seem very hardworking... make sure to feed, wash and give them plenty of love!"; break; case "Pink Baby Dromas": val.displayText = text + "A baby dromas! They seem very hardworking... make sure to feed, wash and give them plenty of love!"; break; case "Blue Baby Dromas": val.displayText = text + "A baby dromas! They seem very hardworking... make sure to feed, wash and give them plenty of love!"; break; case "Scholarly Dromas": val.displayText = text + "I'm sure professor Anaxagoras must be very happy like this."; break; case "Wounded Baby Dromas": val.displayText = text + "Poor baby dromas, it has many wounds."; break; } Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, val, Mathf.FloorToInt((float)Random.Range(100, 150))); } } } public class HSRScrapConfig : SyncedConfig2 { [field: SyncedEntryField] public static Dictionary> ItemRarity { get; private set; } public HSRScrapConfig(ConfigFile config) : base("CraftyGlitches.HSRScrapLIB") { ItemRarity = new Dictionary>(); List list = new List { "bandaged seal", "Complainer" }; foreach (Item item in Plugin.ItemList) { if (list.Contains(item.itemName)) { string itemName = item.itemName; string text = itemName; if (!(text == "bandaged seal")) { if (text == "Complainer") { ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry(config, "HSR Scrap rarity", item.itemName ?? "", 30, "Changing rarity value for: " + item.itemName + ".\n\nEnter your desired value.\n\n"); } } else { ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry(config, "HSR Scrap rarity", item.itemName ?? "", 30, "Changing rarity value for: " + item.itemName + ".\n\nEnter your desired value.\n\n"); } } else { ItemRarity[item] = SyncedBindingExtensions.BindSyncedEntry(config, "HSR Scrap rarity", item.itemName ?? "", 20, "Changing rarity value for: " + item.itemName + ".\n\nEnter your desired value.\n\n"); } } ConfigManager.Register((SyncedConfig2)(object)this); } public static void AssetLoader(List list) { } } }