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 BingtiiOverBingbong v0.1.1
plugins/com.github.elyobsbrain.BingtiiOverBingbong.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PEAKLib.Core; using PEAKLib.Items; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [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.elyobsbrain.BingtiiOverBingbong")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1")] [assembly: AssemblyProduct("com.github.elyobsbrain.BingtiiOverBingbong")] [assembly: AssemblyTitle("BingtiiOverBingbong")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.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 BingtiiOverBingbong { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.elyobsbrain.BingtiiOverBingbong", "BingtiiOverBingbong", "0.1.1")] public class Plugin : BaseUnityPlugin { internal class LocalizedTextPatches { [HarmonyPatch(typeof(LocalizedText), "GetText", new Type[] { typeof(string), typeof(bool) })] [HarmonyPrefix] private static bool GetText_Prefix(string id, ref string __result) { string text = id.ToUpperInvariant(); if (text == "NAME_BINGTII") { __result = "BINGTII"; return false; } if (LocalizedText.mainTable.ContainsKey(text)) { return true; } __result = text; return false; } } [CompilerGenerated] private sealed class <>c__DisplayClass35_0 { public GameObject spawner; internal bool <ReplaceSpawner>b__0(GameObject obj) { if (((Object)obj).name.Contains("BingBong")) { return (Object)(object)obj != (Object)(object)spawner; } return false; } } [CompilerGenerated] private sealed class <ReplaceSpawner>d__35 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private <>c__DisplayClass35_0 <>8__1; private Component[] <components>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ReplaceSpawner>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <components>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass35_0(); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: { <>1__state = -1; <>8__1.spawner = GameObject.Find("BingBong_Spawner"); if ((Object)(object)<>8__1.spawner == (Object)null) { Log.LogError((object)"BingBong_Spawner not found!"); return false; } Log.LogWarning((object)"Found BingBong_Spawner, checking components..."); GameObject[] array3 = (from obj in Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0) where ((Object)obj).name.Contains("BingBong") && (Object)(object)obj != (Object)(object)<>8__1.spawner select obj).ToArray(); GameObject[] array4 = array3; foreach (GameObject val2 in array4) { Log.LogWarning((object)("Destroying existing BingBong: " + ((Object)val2).name)); Object.Destroy((Object)(object)val2); } <components>5__2 = <>8__1.spawner.GetComponents<Component>(); bool flag = false; Component[] array5 = <components>5__2; foreach (Component val3 in array5) { if ((Object)(object)val3 == (Object)null) { continue; } string name2 = ((object)val3).GetType().Name; Log.LogWarning((object)("Found component: " + name2)); if (!name2.Contains("Spawner") && !name2.Contains("Item")) { continue; } Log.LogWarning((object)("Checking spawner component: " + name2)); FieldInfo[] fields = ((object)val3).GetType().GetFields(); FieldInfo[] array6 = fields; foreach (FieldInfo fieldInfo in array6) { Log.LogWarning((object)("Field: " + fieldInfo.Name + " (Type: " + fieldInfo.FieldType.Name + ")")); if (fieldInfo.FieldType == typeof(GameObject) && fieldInfo.Name.ToLower().Contains("prefab")) { object value = fieldInfo.GetValue(val3); Log.LogWarning((object)$"Found prefab field '{fieldInfo.Name}': {value}"); fieldInfo.SetValue(val3, BingtiiPrefab); Log.LogWarning((object)"Successfully replaced BingBong with Bingtii!"); flag = true; break; } } if (flag) { break; } } if (flag) { <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } Log.LogError((object)"Could not find any prefab field in spawner components!"); break; } case 2: { <>1__state = -1; Component[] array = <components>5__2; foreach (Component val in array) { if ((Object)(object)val == (Object)null) { continue; } string name = ((object)val).GetType().Name; if (!name.Contains("Spawner")) { continue; } MethodInfo[] methods = ((object)val).GetType().GetMethods(); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { if (!methodInfo.Name.Contains("Spawn") && !methodInfo.Name.Contains("Trigger") && !methodInfo.Name.Contains("Start") && !methodInfo.Name.Contains("Initialize")) { continue; } try { Log.LogWarning((object)("Trying to call method: " + methodInfo.Name)); if (methodInfo.GetParameters().Length == 0) { methodInfo.Invoke(val, null); Log.LogWarning((object)("Successfully called " + methodInfo.Name)); } } catch (Exception ex) { Log.LogWarning((object)("Could not call " + methodInfo.Name + ": " + ex.Message)); } } } break; } } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string Id = "com.github.elyobsbrain.BingtiiOverBingbong"; public static Plugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static Harmony? Harmony { get; set; } internal static AssetBundle Bundle { get; set; } internal static ModDefinition Definition { get; set; } internal static GameObject BingtiiPrefab { get; set; } internal static Texture2D BadgeTexture { get; set; } public static string Name => "BingtiiOverBingbong"; public static string Version => "0.1.1"; private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; Definition = ModDefinition.GetOrCreate(((BaseUnityPlugin)this).Info.Metadata); Log.LogWarning((object)("Plugin " + Name + " is loaded!")); Harmony = Harmony.CreateAndPatchAll(typeof(LocalizedTextPatches), (string)null); LoadAssets(); RegisterItem(); SceneManager.activeSceneChanged += OnActiveSceneChanged; } private void LoadAssets() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bingtii"); Bundle = AssetBundle.LoadFromFile(text); BingtiiPrefab = Bundle.LoadAsset<GameObject>("Bingtii.prefab"); BadgeTexture = Bundle.LoadAsset<Texture2D>("Badge_bingtii.png"); Log.LogInfo((object)"Bingtii prefab loaded successfully"); } private void RegisterItem() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) Item component = BingtiiPrefab.GetComponent<Item>(); if ((Object)(object)component == (Object)null) { Log.LogError((object)"Item component missing on Bingtii.prefab!"); return; } new ItemContent(component).Register(Definition); Log.LogInfo((object)"Bingtii item registered successfully"); } private void OnActiveSceneChanged(Scene oldScene, Scene newScene) { Log.LogWarning((object)("Scene changed from " + ((Scene)(ref oldScene)).name + " to " + ((Scene)(ref newScene)).name)); if (!string.IsNullOrEmpty(((Scene)(ref newScene)).name) && ((Scene)(ref newScene)).name != "Pretitle" && ((Scene)(ref newScene)).name != "Title" && ((Scene)(ref newScene)).name != "Airport") { Log.LogWarning((object)"You have arrived at the island!"); ((MonoBehaviour)this).StartCoroutine(ReplaceSpawner()); } if (!string.IsNullOrEmpty(((Scene)(ref newScene)).name) && ((Scene)(ref newScene)).name != "Pretitle") { _ = ((Scene)(ref newScene)).name != "Title"; } } private void OnDestroy() { SceneManager.activeSceneChanged -= OnActiveSceneChanged; } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!string.IsNullOrEmpty(name) && name != "Title" && name != "Pretitle") { ReplaceBadgeImage(); } } private void ReplaceBadgeImage() { GameObject val = GameObject.Find("GUIManager/PauseCanvases/Canvas_Badges/BadgeSash/Badges/UI_Badge (17)"); if (!((Object)(object)val != (Object)null)) { return; } Transform val2 = val.transform.Find("Image"); if ((Object)(object)val2 != (Object)null) { RawImage component = ((Component)val2).GetComponent<RawImage>(); if ((Object)(object)component != (Object)null && (Object)(object)component.texture != (Object)null && ((Object)component.texture).name.Contains("Badge")) { component.texture = (Texture)(object)BadgeTexture; ((Behaviour)component).enabled = false; ((Behaviour)component).enabled = true; ((Graphic)component).SetVerticesDirty(); ((Graphic)component).SetMaterialDirty(); } } } [IteratorStateMachine(typeof(<ReplaceSpawner>d__35))] private IEnumerator ReplaceSpawner() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ReplaceSpawner>d__35(0); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }