using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
using Microsoft.CodeAnalysis;
using NineSolsAPI;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CelesteSols")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Example Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8f85a121d6989b3994eeae289781b554e74006bd")]
[assembly: AssemblyProduct("CelesteSols")]
[assembly: AssemblyTitle("CelesteSols")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 CelesteSols
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("CelesteSols", "CelesteSols", "1.0.0")]
public class CelesteSols : BaseUnityPlugin
{
private ConfigEntry<bool> unlimitedDashEnabled;
private ConfigEntry<KeyboardShortcut> somethingKeyboardShortcut;
private ConfigEntry<KeyCode> dashKey;
public static bool isFallEnable = true;
private Harmony harmony;
private float dashSpeed = 360f;
private float dashDuration = 0.15f;
private float dashTimeElapsed;
private bool isDashing;
private Vector2 dashVelocity;
private int maxDashes = 1;
private int currentDashes = 1;
private float lastDashEndTime = -999f;
private Vector2 lastDashDirection = Vector2.zero;
private Vector2 lastDashVelocity = Vector2.zero;
private float dashBoostMemoryDuration = 0.2f;
private float boostStrengthMultiplier = 2.1f;
private float boostVerticalMinimum = 300f;
private void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
harmony = Harmony.CreateAndPatchAll(typeof(CelesteSols).Assembly, (string)null);
unlimitedDashEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Dash", "UnlimitedDash", false, "Allow unlimited dash without needing to touch ground");
dashKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Dash", "DashKey", (KeyCode)120, "");
KeybindManager.Add((MonoBehaviour)(object)this, (Action)TestMethod, (Func<KeyboardShortcut>)(() => new KeyboardShortcut((KeyCode)104, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 })));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CelesteSols is loaded!");
}
private void FixedUpdate()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
if (((Actor)Player.i).onGround || unlimitedDashEnabled.Value)
{
currentDashes = maxDashes;
}
if (!isDashing && currentDashes > 0 && (Input.GetKey(dashKey.Value) || ((OneAxisInputControl)InputManager.ActiveDevice.LeftStickButton).IsPressed))
{
Vector2 dashDirection = GetDashDirection();
StartDash(GetFixedDashVector(dashDirection));
}
if (isDashing)
{
dashTimeElapsed += Time.deltaTime;
((PhysicsMover)Player.i).Velocity = dashVelocity;
if (dashTimeElapsed >= dashDuration)
{
EndDash();
}
}
if (((OneAxisInputControl)Player.i.playerInput.gameplayActions.Jump).IsPressed && !Player.i.CanJump && ((Actor)Player.i).onGround)
{
if (isDashing)
{
EndDash();
}
JumpWithBoost();
}
}
private void StartDash(Vector2 dir)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
isDashing = true;
dashTimeElapsed = 0f;
Vector2 val = dir * dashSpeed;
Vector2 zero = Vector2.zero;
if (!((Actor)Player.i).onGround)
{
Vector2 velocity = ((PhysicsMover)Player.i).Velocity;
float num = velocity.x * 0.8f;
float num2 = velocity.y * 1.2f;
((Vector2)(ref zero))..ctor(num, num2);
}
dashVelocity = val + zero;
currentDashes--;
lastDashDirection = dir;
lastDashVelocity = dashVelocity;
lastDashEndTime = -999f;
isFallEnable = false;
}
private void EndDash()
{
isDashing = false;
isFallEnable = true;
lastDashEndTime = Time.time;
}
private void JumpWithBoost()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
bool num = Time.time - lastDashEndTime <= dashBoostMemoryDuration;
bool flag = lastDashDirection.y < -0.1f && Mathf.Abs(lastDashDirection.x) > 0.1f;
if (num && flag)
{
Vector2 val = ((Vector2)(ref lastDashDirection)).normalized * ((Vector2)(ref lastDashVelocity)).magnitude * boostStrengthMultiplier;
val.y = Math.Abs(val.y) / 2f;
((PhysicsMover)Player.i).Velocity = val;
}
}
private Vector2 GetFixedDashVector(Vector2 dir)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
if (dir == Vector2.zero)
{
return Vector2.zero;
}
if (dir == Vector2.up)
{
return new Vector2(0f, 1f);
}
if (dir == Vector2.down)
{
return new Vector2(0f, -1f);
}
if (dir == Vector2.left)
{
return new Vector2(-1f, 0f);
}
if (dir == Vector2.right)
{
return new Vector2(1f, 0f);
}
float num = 0.8f;
return new Vector2(Mathf.Sign(dir.x) * num, Mathf.Sign(dir.y) * num);
}
private Vector2 GetDashDirection()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
bool isPressed = ((OneAxisInputControl)((PlayerBaseActionSet)Player.i.playerInput.gameplayActions).MoveUp).IsPressed;
bool isPressed2 = ((OneAxisInputControl)((PlayerBaseActionSet)Player.i.playerInput.gameplayActions).MoveDown).IsPressed;
bool isPressed3 = ((OneAxisInputControl)((PlayerBaseActionSet)Player.i.playerInput.gameplayActions).MoveLeft).IsPressed;
bool isPressed4 = ((OneAxisInputControl)((PlayerBaseActionSet)Player.i.playerInput.gameplayActions).MoveRight).IsPressed;
if (isPressed && isPressed3)
{
return new Vector2(-1f, 1f);
}
if (isPressed && isPressed4)
{
return new Vector2(1f, 1f);
}
if (isPressed)
{
return new Vector2(0f, 1f);
}
if (isPressed2 && isPressed3)
{
return new Vector2(-1f, -1f);
}
if (isPressed2 && isPressed4)
{
return new Vector2(1f, -1f);
}
if (isPressed2)
{
return new Vector2(0f, -1f);
}
if (isPressed3)
{
return new Vector2(-1f, 0f);
}
if (isPressed4)
{
return new Vector2(1f, 0f);
}
return Vector2.zero;
}
private void TestMethod()
{
ToastManager.Toast((object)"Shortcut activated");
Log.Info("Log messages will only show up in the logging console and LogOutput.txt");
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
}
internal static class Log
{
private static ManualLogSource? logSource;
internal static void Init(ManualLogSource logSource)
{
Log.logSource = logSource;
}
internal static void Debug(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogDebug(data);
}
}
internal static void Error(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogError(data);
}
}
internal static void Fatal(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogFatal(data);
}
}
internal static void Info(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogInfo(data);
}
}
internal static void Message(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogMessage(data);
}
}
internal static void Warning(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogWarning(data);
}
}
}
[HarmonyPatch]
public class Patches
{
[HarmonyPatch(typeof(Player), "Fall")]
[HarmonyPrefix]
private static bool HookFall(Player __instance)
{
if (CelesteSols.isFallEnable)
{
return true;
}
return false;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "CelesteSols";
public const string PLUGIN_NAME = "CelesteSols";
public const string PLUGIN_VERSION = "1.0.0";
}
}