The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of Jobergs Hat Emporium v4.0.0
plugins/com.github.joberggg.jobergshatemporium.dll
Decompiled a week agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.joberggg.jobergshatemporium")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0")] [assembly: AssemblyProduct("com.github.joberggg.jobergshatemporium")] [assembly: AssemblyTitle("JobergsHatEmporium")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.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.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; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace JobergsHatEmporium { [BepInPlugin("joberggg.JobergsHatEmporium", "Joberg's Hat Emporium", "4.0.0")] public class Plugin : BaseUnityPlugin { private class Patcher { private static readonly int SkinColor = Shader.PropertyToID("_SkinColor"); private static PlayerCustomizationDummy lastModifiedDummy; public static bool CreateHatOption(Customization customization, string name, Texture2D icon) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) string name2 = name; if (Array.Exists(customization.hats, (CustomizationOption hat) => ((Object)hat).name == name2)) { Debug.LogError((object)("[Joberg] Trying to add " + name2 + " a second time.")); return false; } CustomizationOption val = ScriptableObject.CreateInstance<CustomizationOption>(); val.color = Color.white; ((Object)val).name = name2; val.texture = (Texture)(object)icon; val.type = (Type)50; val.requiredAchievement = (ACHIEVEMENTTYPE)0; customization.hats = CollectionExtensions.AddToArray<CustomizationOption>(customization.hats, val); Debug.Log((object)("[Joberg] " + name2 + " added.")); return true; } [HarmonyPatch(typeof(PassportManager), "Awake")] [HarmonyPostfix] public static void PassportManagerAwakePostfix(PassportManager __instance) { Customization component = ((Component)__instance).GetComponent<Customization>(); Debug.Log((object)"[Joberg] Adding hat CustomizationOptions."); for (int i = 0; i < hats.Count; i++) { HatEntry hatEntry = hats[i]; CreateHatOption(component, hatEntry.Name, hatEntry.Icon); } Debug.Log((object)"[Joberg] Done."); } [HarmonyPatch(typeof(CharacterCustomization), "Awake")] [HarmonyPostfix] public static void CharacterCustomizationAwakePostfix(CharacterCustomization __instance) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Transform child = ((Component)__instance).transform.GetChild(0).GetChild(0).GetChild(0) .GetChild(2) .GetChild(0) .GetChild(0) .GetChild(1) .GetChild(1); Debug.Log((object)$"[Joberg] Instanciating CharacterCustomization hats as children of {__instance} / {child}."); for (int i = 0; i < hats.Count; i++) { HatEntry hat = hats[i]; GameObject val = Object.Instantiate<GameObject>(hat.Prefab, child.position, child.rotation, child); SetLayerRecursively(val.transform, ((Component)child).gameObject.layer); Renderer componentInChildren = val.GetComponentInChildren<Renderer>(); ((Component)componentInChildren).gameObject.SetActive(false); for (int j = 0; j < componentInChildren.materials.Length; j++) { componentInChildren.materials[j].shader = SetShaders(componentInChildren.materials[j].shader, hat); } Debug.Log((object)$"[Joberg] CharacterCustomization Hats[{__instance.refs.playerHats.Length}] = {hat.Name}"); __instance.refs.playerHats = CollectionExtensions.AddToArray<Renderer>(__instance.refs.playerHats, componentInChildren); __instance.refs.AllRenderers = CollectionExtensions.AddToArray<Renderer>(__instance.refs.AllRenderers, componentInChildren); } } [HarmonyPatch(typeof(PlayerCustomizationDummy), "UpdateDummy")] [HarmonyPrefix] public static void PlayerCustomizationDummyUpdateDummyPrefix(PlayerCustomizationDummy __instance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)(object)lastModifiedDummy) { return; } lastModifiedDummy = __instance; Transform child = ((Component)__instance).transform.GetChild(0).GetChild(0).GetChild(0) .GetChild(2) .GetChild(0) .GetChild(0) .GetChild(1) .GetChild(1); Debug.Log((object)$"[Joberg] Instanciating PlayerCustomizationDummy hats as children of {__instance} / {child}."); for (int i = 0; i < hats.Count; i++) { HatEntry hat = hats[i]; GameObject val = Object.Instantiate<GameObject>(hat.Prefab, child.position, child.rotation, child); SetLayerRecursively(val.transform, ((Component)child).gameObject.layer); Renderer componentInChildren = val.GetComponentInChildren<Renderer>(); ((Component)componentInChildren).gameObject.SetActive(false); for (int j = 0; j < componentInChildren.materials.Length; j++) { componentInChildren.materials[j].shader = SetShaders(componentInChildren.materials[j].shader, hat); } Debug.Log((object)$"[Joberg] PlayerCustomizationDummy Hats[{__instance.refs.playerHats.Length}] = {hat.Name}"); __instance.refs.playerHats = CollectionExtensions.AddToArray<Renderer>(__instance.refs.playerHats, componentInChildren); } } [HarmonyPatch(typeof(CharacterCustomization), "OnPlayerDataChange")] [HarmonyPostfix] public static void CharacterCustomizationOnPlayerDataChangePostFix(CharacterCustomization __instance, ref PersistentPlayerData playerData) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.refs.PlayerRenderers[0] == (Object)null) { return; } int num = playerData.customizationData.currentSkin; if (__instance.useDebugColor) { num = __instance.debugColorIndex; } Color color = Singleton<Customization>.Instance.skins[num].color; for (int i = 0; i < __instance.refs.playerHats.Length; i++) { for (int j = 0; j < __instance.refs.playerHats[i].materials.Length; j++) { __instance.refs.playerHats[i].materials[j].SetColor(SkinColor, color); } } } [HarmonyPatch(typeof(PlayerCustomizationDummy), "SetPlayerColor")] [HarmonyPostfix] public static void PlayerCustomizationDummySetPlayerColorPostFix(PlayerCustomizationDummy __instance, ref int index) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (index > Singleton<Customization>.Instance.skins.Length) { return; } Color color = Singleton<Customization>.Instance.skins[index].color; for (int i = 0; i < __instance.refs.playerHats.Length; i++) { for (int j = 0; j < __instance.refs.playerHats[i].materials.Length; j++) { __instance.refs.playerHats[i].materials[j].SetColor(SkinColor, color); } } } } public struct HatEntry { public string Name; public GameObject Prefab; public Texture2D Icon; public string ShaderName; public HatEntry(string name, GameObject prefab, Texture2D icon, string shaderName) { Name = name; Prefab = prefab; Icon = icon; ShaderName = shaderName; } } public static AssetBundle assetBundle; public static List<HatEntry> hats; public void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new Harmony("joberggg.JobergsHatEmporium").PatchAll(typeof(Patcher)); ((MonoBehaviour)this).StartCoroutine(LoadHatsFromDisk()); } private static IEnumerator LoadHatsFromDisk() { Debug.Log((object)"[Joberg] Loading hats from disk."); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "JobergsHatEmporium"); Debug.Log((object)("[Joberg] Path to AssetBundle: " + text)); AssetBundleCreateRequest createRequest = AssetBundle.LoadFromMemoryAsync(File.ReadAllBytes(text)); yield return createRequest; assetBundle = createRequest.assetBundle; Debug.Log((object)"[Joberg] AssetBundle loaded."); hats = new List<HatEntry>(); hats.Add(LoadHat("jobergcap")); hats.Add(LoadHat("juliocap")); hats.Add(LoadHat("nadine")); hats.Add(LoadHat("sunder")); hats.Add(LoadHat("ansgar")); hats.Add(LoadHat("totoro")); hats.Add(LoadHat("miku")); hats.Add(LoadHat("bignosebug")); hats.Add(LoadHat("mott")); hats.Add(LoadHat("darwin")); hats.Add(LoadHat("gumball")); hats.Add(LoadHat("ironmouse")); hats.Add(LoadHat("kris")); hats.Add(LoadHat("noelle")); hats.Add(LoadHat("ralsei")); hats.Add(LoadHat("ralseihat")); hats.Add(LoadHat("susie")); hats.Add(LoadHat("spamton")); hats.Add(LoadHat("tenna")); hats.Add(LoadHat("steaz")); hats.Add(LoadHat("moonbtch")); hats.Add(LoadHat("jorboA")); hats.Add(LoadHat("jorboB")); hats.Add(LoadHat("jorboC")); hats.Add(LoadHat("bigtopSteve")); hats.Add(LoadHat("bigtopCap")); hats.Add(LoadHat("bigtopChef")); Debug.Log((object)"[Joberg] Done!"); } private static Shader SetShaders(Shader shader, HatEntry hat) { Debug.Log((object)("[Joberg] shader name: " + ((Object)shader).name)); if (((Object)shader).name == "Universal Render Pipeline/Lit") { return Shader.Find(hat.ShaderName); } return Shader.Find(((Object)shader).name); } private static void SetLayerRecursively(Transform transform, int layer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown ((Component)transform).gameObject.layer = layer; foreach (Transform item in transform) { Transform transform2 = item; SetLayerRecursively(transform2, layer); } } private static HatEntry LoadHat(string hatName, string shaderName = "W/Character") { Debug.Log((object)("[Joberg] Loading hat '" + hatName + "'.")); GameObject val = assetBundle.LoadAsset<GameObject>("Assets/" + hatName + ".prefab"); Texture2D val2 = assetBundle.LoadAsset<Texture2D>("Assets/" + hatName + ".png"); Debug.Log((object)$"[Joberg] Loaded prefab {val} and texture {val2}"); return new HatEntry(hatName, val, val2, shaderName); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }