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 HideAndSeekBingBong v0.1.1
plugins/com.quackandcheese.HideAndSeekBingBong.dll
Decompiled 2 months agousing System; 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 System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On; using PEAKLib.Core; using Photon.Pun; using UnityEngine; using UnityEngine.Networking; using Zorro.Core; using Zorro.Core.CLI; [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.quackandcheese.HideAndSeekBingBong")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1")] [assembly: AssemblyProduct("com.quackandcheese.HideAndSeekBingBong")] [assembly: AssemblyTitle("HideAndSeekBingBong")] [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 HideAndSeekBingBong { public class BingBongAlerter : MonoBehaviour { public Item item; private SFX_Instance alertSfx; private void Awake() { item = ((Component)this).GetComponent<Item>(); BingBongManager.bingBongAlerters.Add(this); alertSfx = ScriptableObject.CreateInstance<SFX_Instance>(); if ((Object)(object)Plugin.AlertSound != (Object)null) { alertSfx.clips = (AudioClip[])(object)new AudioClip[1] { Plugin.AlertSound }; } } public void Alert(float volume, float range) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) alertSfx.settings = new SFX_Settings { volume = volume, range = range }; SFX_Instance obj = alertSfx; if (obj != null) { obj.Play(((Component)this).transform.position); } } private void OnDestroy() { BingBongManager.bingBongAlerters.Remove(this); } } [ConsoleClassCustomizer("BingBong")] public class BingBongManager : MonoBehaviourPun { public static List<BingBongAlerter> bingBongAlerters = new List<BingBongAlerter>(); private float alertTimer; private float timerInterval = Plugin.AlertSoundInterval.Value; public static BingBongManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } else { Object.Destroy((Object)(object)((Component)this).gameObject); } if ((Object)(object)Plugin.AlertSound == (Object)null) { Debug.LogError((object)"Alert sound is not set. Please check the configuration."); } } private void Update() { if (PhotonNetwork.IsMasterClient) { alertTimer += Time.deltaTime; if (alertTimer >= timerInterval) { alertTimer = 0f; ((MonoBehaviourPun)this).photonView.RPC("AlertBingBongs", (RpcTarget)0, new object[2] { Plugin.AlertVolume.Value, Plugin.AudibleDistance.Value }); } } } [PunRPC] public void AlertBingBongs(float volume, float range) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 foreach (BingBongAlerter bingBongAlerter in bingBongAlerters) { if ((Object)(object)bingBongAlerter != (Object)null && ((Component)bingBongAlerter).gameObject.activeInHierarchy && (((int)bingBongAlerter.item.itemState != 1 && (int)bingBongAlerter.item.itemState != 2) || Plugin.AlertPlayCondition.Value == Plugin.PlayCondition.WhileOnGroundOrCarried)) { bingBongAlerter.Alert(volume, range); } } } [ConsoleCommand] public static void DestroyAllAndSpawn() { foreach (BingBongAlerter bingBongAlerter in bingBongAlerters) { if ((Object)(object)bingBongAlerter != (Object)null && ((Component)bingBongAlerter).gameObject.activeInHierarchy && (Object)(object)bingBongAlerter.item.holderCharacter == (Object)null) { PhotonNetwork.Destroy(((Component)bingBongAlerter).gameObject); } } foreach (Character allPlayerCharacter in PlayerHandler.GetAllPlayerCharacters()) { BingBongManager instance = Instance; if (instance != null) { ((MonoBehaviourPun)instance).photonView.RPC("DestroyHeldBingBongs", (RpcTarget)0, new object[1] { ((Component)allPlayerCharacter).GetComponent<PhotonView>() }); } } Character.localCharacter.refs.items.SpawnItemInHand("BingBong"); } [PunRPC] public void DestroyHeldBingBongs(PhotonView characterView) { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) Character component = ((Component)characterView).GetComponent<Character>(); if (component.refs.items.currentSelectedSlot.IsSome && Object.op_Implicit((Object)(object)component.data.currentItem) && component.player.GetItemSlot(component.refs.items.currentSelectedSlot.Value).GetPrefabName() == "BingBong") { Item currentItem = component.data.currentItem; component.refs.items.UnAttatchEquipedItem(); if (((MonoBehaviourPun)currentItem).photonView.IsMine || (((MonoBehaviourPun)currentItem).photonView.Controller.IsMasterClient && PhotonNetwork.IsMasterClient)) { PhotonNetwork.Destroy(((Component)currentItem).gameObject); } component.player.EmptySlot(component.refs.items.currentSelectedSlot); } for (int num = 3; num >= 0; num--) { byte b = (byte)num; ItemSlot itemSlot = component.player.GetItemSlot(b); if (!itemSlot.IsEmpty() && itemSlot.GetPrefabName() == "BingBong") { component.player.EmptySlot(Optionable<byte>.Some(b)); } } } } [BepInPlugin("com.quackandcheese.HideAndSeekBingBong", "HideAndSeekBingBong", "0.1.1")] public class Plugin : BaseUnityPlugin { public enum PlayCondition { WhileOnGround, WhileOnGroundOrCarried } internal static GameObject BingBongManagerPrefab; public static AudioClip? AlertSound; public static ConfigEntry<string> SoundFileName; public static ConfigEntry<float> AlertSoundInterval; public static ConfigEntry<float> AlertVolume; public static ConfigEntry<float> AudibleDistance; public static ConfigEntry<PlayCondition> AlertPlayCondition; internal static Dictionary<string, AudioType> audioExtensions = new Dictionary<string, AudioType> { { ".ogg", (AudioType)14 }, { ".wav", (AudioType)20 }, { ".mp3", (AudioType)13 } }; public const string Id = "com.quackandcheese.HideAndSeekBingBong"; internal static ManualLogSource Log { get; private set; } = null; internal static ModDefinition Definition { get; set; } = null; internal static AssetBundle Bundle { get; set; } = null; public static string Name => "HideAndSeekBingBong"; public static string Version => "0.1.1"; private void Awake() { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Definition = ModDefinition.GetOrCreate(((BaseUnityPlugin)this).Info.Metadata); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "hideandseekbingbong"); Bundle = AssetBundle.LoadFromFile(text); SoundFileName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SoundFileName", "bingbong.mp3", "The file name of the sound for the alert. (.ogg, .mp3, or .wav)"); AlertSoundInterval = ((BaseUnityPlugin)this).Config.Bind<float>("General", "AlertSoundInterval", 5f, "The interval in seconds between alerts."); AlertVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "AlertVolume", 1f, "The volume of the alert."); AudibleDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "AudibleDistance", 100f, "The maximum distance at which the sound is heard."); AlertPlayCondition = ((BaseUnityPlugin)this).Config.Bind<PlayCondition>("General", "PlayCondition", PlayCondition.WhileOnGround, "Determines which situations the alert is played in."); AlertSound = LoadAlertSound(); BingBongManagerPrefab = Bundle.LoadAsset<GameObject>("BingBongManager.prefab"); BingBongManagerPrefab.AddComponent<BingBongManager>(); BingBongManagerPrefab.AddComponent<PhotonView>(); NetworkPrefabManager.RegisterNetworkPrefab(Definition, BingBongManagerPrefab); NetworkConnector.Awake += new hook_Awake(NetworkConnector_Awake); NetworkConnector.OnJoinedRoom += new hook_OnJoinedRoom(NetworkConnector_OnJoinedRoom); BingBong.Start += new hook_Start(BingBong_Start); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void NetworkConnector_Awake(orig_Awake orig, NetworkConnector self) { SpawnBingBongManager(); } private void NetworkConnector_OnJoinedRoom(orig_OnJoinedRoom orig, NetworkConnector self) { orig.Invoke(self); SpawnBingBongManager(); } private void SpawnBingBongManager() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient && !((Object)(object)BingBongManager.Instance != (Object)null)) { GameObject val = PhotonNetwork.InstantiateRoomObject(((Object)BingBongManagerPrefab).name, new Vector3(0f, 0f, 0f), Quaternion.identity, (byte)0, (object[])null); } } private void BingBong_Start(orig_Start orig, BingBong self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<BingBongAlerter>(); } public AudioClip? LoadAlertSound() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sfx"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); Log.LogWarning((object)"SFX folder does not exist. Creating the folder, but no sound file will be loaded."); return null; } string[] files = Directory.GetFiles(text); string sfxFile = files[0]; string text2 = Path.Combine(text, SoundFileName.Value); if (SoundFileName.Value != "" && File.Exists(text2)) { sfxFile = text2; } if (File.Exists(sfxFile)) { LoadAudioFileAsync(sfxFile).ContinueWith(delegate(Task<AudioClip> task) { if (task.IsCompletedSuccessfully) { AlertSound = task.Result; Log.LogInfo((object)("Loaded alert sound from: " + sfxFile)); } else { Log.LogError((object)("Failed to load alert sound from: " + sfxFile + ". Error: " + task.Exception?.Message)); } }); } return null; } public static async Task<AudioClip> LoadAudioFileAsync(string fullPath) { if (!File.Exists(fullPath)) { throw new FileNotFoundException("'" + fullPath + "' not found."); } if (!audioExtensions.ContainsKey(Path.GetExtension(fullPath))) { throw new NotImplementedException("Audio file extension: '" + Path.GetExtension(fullPath) + "' is not implemented."); } UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(fullPath, audioExtensions[Path.GetExtension(fullPath)]); Awaiter val = AsyncOperationAwaitableExtensions.GetAwaiter((AsyncOperation)(object)request.SendWebRequest()); if (!((Awaiter)(ref val)).IsCompleted) { await val; Awaiter val2 = default(Awaiter); val = val2; } ((Awaiter)(ref val)).GetResult(); AudioClip content = DownloadHandlerAudioClip.GetContent(request); request.Dispose(); return content; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }