Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of Baldibility v0.0.2
Baldibility.dll
Decompiled 19 hours agousing System; using System.Collections; 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 Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Baldibility")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Baldi attack")] [assembly: AssemblyTitle("Baldibility")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 Baldibility { [BepInPlugin("com.PJGamer.baldibility", "baldi ability", "0.0.1")] public class main : BaseUnityPlugin { public static main Instance; public AudioSource audioSource; public AudioClip attacking; public AudioClip fail; public static string attackIconPath; public static string failIconPath; private void Awake() { Instance = this; audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); LoadAudioFiles(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"welcome to bopl's basics in education and fighting!"); } private void LoadAudioFiles() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); attackIconPath = Path.Combine(directoryName, "attack_icon.png"); failIconPath = Path.Combine(directoryName, "fail_icon.png"); string path = Path.Combine(directoryName, "attack.wav"); string path2 = Path.Combine(directoryName, "fail.wav"); if (File.Exists(path)) { ((MonoBehaviour)this).StartCoroutine(LoadAudioWeb(path, "attack")); } if (File.Exists(path2)) { ((MonoBehaviour)this).StartCoroutine(LoadAudioWeb(path2, "fail")); } } private IEnumerator LoadAudioWeb(string path, string clipType) { string url = "file://" + path; UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)20); try { yield return www.SendWebRequest(); if ((int)www.result == 1) { AudioClip clip = DownloadHandlerAudioClip.GetContent(www); if (clipType == "attack") { attacking = clip; } if (clipType == "fail") { fail = clip; } } else { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load audio " + clipType + ": " + www.error)); } } finally { ((IDisposable)www)?.Dispose(); } } } public class BaldibilityAction : Ability { private LineRenderer warningLine; private bool isCanceled = false; private float chargeTime = 2f; private string activePath = main.attackIconPath; public string Name => "Baldi's Basics"; public string Description => "Warns with a red line canceled by explosions"; public string IconPath => activePath; public void OnActivate() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) isCanceled = false; activePath = main.attackIconPath; GameObject val = new GameObject("BaldiWarningLine"); warningLine = val.AddComponent<LineRenderer>(); warningLine.startWidth = 0.2f; warningLine.endWidth = 0.2f; ((Renderer)warningLine).material = new Material(Shader.Find("Sprites/Default")); warningLine.startColor = Color.red; warningLine.endColor = Color.red; ((MonoBehaviour)this).StartCoroutine(baldibilitySequence()); } private IEnumerator baldibilitySequence() { float elapsed = 0f; Vector3 startpos = ((Component)this).transform.position; Vector3 targetDirection = ((Component)this).transform.right; Camera mainCam = Camera.main; float maxAllowedDistnce = 50f; if ((Object)(object)mainCam != (Object)null) { float targetViewportX = ((targetDirection.x > 0f) ? 1.1f : (-0.1f)); Vector3 viewportEdgeWorld = mainCam.ViewportToWorldPoint(new Vector3(targetViewportX, 0.5f, mainCam.nearClipPlane)); viewportEdgeWorld.z = startpos.z; maxAllowedDistnce = Mathf.Abs(viewportEdgeWorld.x - startpos.x); } RaycastHit2D wallHit = Physics2D.Raycast(Vector2.op_Implicit(startpos), Vector2.op_Implicit(targetDirection), maxAllowedDistnce); Vector3 endPos = ((!((Object)(object)((RaycastHit2D)(ref wallHit)).collider != (Object)null)) ? (startpos + targetDirection * maxAllowedDistnce) : Vector2.op_Implicit(((RaycastHit2D)(ref wallHit)).point)); warningLine.SetPosition(0, startpos); warningLine.SetPosition(1, endPos); float calculatedDistance = Vector3.Distance(startpos, endPos); while (elapsed < chargeTime) { elapsed += Time.deltaTime; ((Renderer)warningLine).enabled = Mathf.FloorToInt(elapsed * 10f) % 2 == 0; Collider2D[] hitObjects = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), 2.5f); Collider2D[] array = hitObjects; foreach (Collider2D obj in array) { if (((Object)((Component)obj).gameObject).name.Contains("Explosion") || ((Component)obj).gameObject.CompareTag("Explosion")) { isCanceled = true; break; } } if (isCanceled) { break; } yield return null; } Object.Destroy((Object)(object)((Component)warningLine).gameObject); if (isCanceled) { activePath = main.failIconPath; if ((Object)(object)main.Instance.fail != (Object)null) { main.Instance.audioSource.PlayOneShot(main.Instance.fail); } yield break; } activePath = main.attackIconPath; if (Object.op_Implicit((Object)(object)main.Instance.attacking)) { main.Instance.audioSource.PlayOneShot(main.Instance.attacking); } RaycastHit2D[] victims = Physics2D.RaycastAll(Vector2.op_Implicit(startpos), Vector2.op_Implicit(targetDirection), calculatedDistance); RaycastHit2D[] array2 = victims; for (int j = 0; j < array2.Length; j++) { RaycastHit2D victim = array2[j]; if (!((Object)(object)((Component)((RaycastHit2D)(ref victim)).collider).gameObject == (Object)(object)((Component)this).gameObject)) { Player playerScript = ((Component)((RaycastHit2D)(ref victim)).collider).GetComponent<Player>(); if (playerScript != null) { int myKillerId = ((Ability)this).GetPlayerId(); long currentTimestamp = DateTime.UtcNow.Ticks; CauseOfDeath reason = (CauseOfDeath)4; playerScript.Kill(myKillerId, currentTimestamp, reason); } } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Baldibility"; public const string PLUGIN_NAME = "Baldi attack"; public const string PLUGIN_VERSION = "1.0.0"; } }