using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AudioImportLib;
using BoneLib;
using BoneLib.Notifications;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidDash;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "VoidDash", "1.0.0", "Cirket", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("VoidDash")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bc7b8f5a1041227687a39031341123a32e710238")]
[assembly: AssemblyProduct("VoidDash")]
[assembly: AssemblyTitle("VoidDash")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 VoidDash
{
public class Core : MelonMod
{
private readonly string chargeAudioPath = Path.Combine(MelonEnvironment.UserDataDirectory, "VoidDash/chargeAudio.wav");
private readonly string blastAudioPath = Path.Combine(MelonEnvironment.UserDataDirectory, "VoidDash/blastAudio.wav");
public float dashCharge;
public float dashStrength = 200f;
public static Rigidbody playerTorso;
public static AudioClip chargeSound;
public static AudioClip blastSound;
public static bool canUseAudioLib;
private static bool canDash;
private int Dashes;
private int maxDashes = 4;
public static AudioSource chargeAudioSource;
public static AudioSource blastAudioSource;
public override void OnInitializeMelon()
{
((MelonBase)this).LoggerInstance.Msg("Ready to VoidDash.");
if (MelonBase.FindMelon("AudioImportLib", "trev & zCubed") == null)
{
((MelonBase)this).LoggerInstance.Warning("AudioImportLib wasn't found. - from VoidDash.");
canUseAudioLib = false;
}
else
{
canUseAudioLib = true;
}
Hooking.OnLevelLoaded += LevelLoaded;
}
private void LevelLoaded(LevelInfo level)
{
chargeSound = GetAudioClipSafe(chargeAudioPath);
blastSound = GetAudioClipSafe(blastAudioPath);
}
public override void OnUpdate()
{
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player.PhysicsRig == (Object)null)
{
return;
}
playerTorso = Player.PhysicsRig.torso.rbPelvis;
OnAudioUpdate();
if (IsGrounded())
{
playerTorso.constraints = (RigidbodyConstraints)0;
dashCharge = 0f;
chargeAudioSource.Stop();
Dashes = maxDashes;
}
if (IsGrounded())
{
return;
}
if (Dashes > 0 || maxDashes <= -1)
{
if (Player.RightController._aButton)
{
dashCharge = Mathf.Clamp(dashCharge + Time.deltaTime, 0f, 1f);
}
if (Player.RightController._aButtonDown || (IsGrounded() && dashCharge > 0f))
{
playerTorso.constraints = (RigidbodyConstraints)14;
}
}
if (Player.RightController._aButtonUp)
{
playerTorso.constraints = (RigidbodyConstraints)0;
playerTorso.AddForce(((Component)Camera.main).transform.forward * (dashCharge * dashStrength * playerTorso.mass), (ForceMode)1);
dashCharge = 0f;
if (maxDashes > -1)
{
Dashes = Math.Clamp(Dashes - 1, 0, maxDashes);
}
}
canDash = dashCharge > 0f;
}
public void OnAudioUpdate()
{
if ((Object)(object)chargeAudioSource == (Object)null)
{
chargeAudioSource = ((Component)playerTorso).gameObject.AddComponent<AudioSource>();
chargeAudioSource.clip = chargeSound;
chargeAudioSource.loop = true;
}
if ((Object)(object)blastAudioSource == (Object)null)
{
blastAudioSource = ((Component)playerTorso).gameObject.AddComponent<AudioSource>();
blastAudioSource.clip = blastSound;
blastAudioSource.loop = false;
}
if (!canUseAudioLib)
{
return;
}
if (IsGrounded())
{
chargeAudioSource.Stop();
}
if (IsGrounded())
{
return;
}
if (Player.RightController._aButton && (Object)(object)chargeAudioSource != (Object)null)
{
chargeAudioSource.pitch = Mathf.Clamp(dashCharge, 0.1f, 1.25f);
}
if (Player.RightController._aButtonDown || (IsGrounded() && canDash))
{
if ((Object)(object)chargeAudioSource == (Object)null)
{
chargeAudioSource = ((Component)playerTorso).gameObject.AddComponent<AudioSource>();
chargeAudioSource.clip = chargeSound;
chargeAudioSource.loop = true;
}
chargeAudioSource.Play();
}
if (Player.RightController._aButtonUp)
{
if ((Object)(object)chargeAudioSource != (Object)null)
{
chargeAudioSource.Stop();
}
if ((Object)(object)blastAudioSource == (Object)null)
{
blastAudioSource = ((Component)playerTorso).gameObject.AddComponent<AudioSource>();
blastAudioSource.clip = blastSound;
blastAudioSource.loop = false;
}
blastAudioSource.volume = dashCharge + 0.1f;
blastAudioSource.Play();
}
}
public static bool IsGrounded()
{
return Player.PhysicsRig.feet.GetComponent<PhysGrounder>().isGrounded;
}
public static AudioClip GetAudioClipSafe(string path)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
if (canUseAudioLib)
{
return API.LoadAudioClip(path, true);
}
Notifier.Send(new Notification
{
PopupLength = 14f,
Type = (NotificationType)2,
ShowTitleOnPopup = true,
Title = NotificationText.op_Implicit("VoidDash"),
Message = NotificationText.op_Implicit("AudioImportLib is not installed! Please install it!")
});
return null;
}
}
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("VoidDash.Resources", typeof(Resources).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal Resources()
{
}
}
}