using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[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.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RollBoost")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds Roll speed boosting and configs")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RollBoost")]
[assembly: AssemblyTitle("RollBoost")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace RollBoost
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "RollBoost";
public const string PLUGIN_NAME = "RollBoost";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace NewPlugin
{
[BepInPlugin("com.Starbox614.RollBoost", "RollBoost", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(Roll), "OldUpdate")]
private class RollOldUpdatePatch
{
private static bool Prefix(ref Roll __instance, ref Fix simDeltaTime, ref PlayerPhysics ___playerPhysics, ref bool ___isCharging, ref Fix ___secondsCharged, ref PlayerInfo ___playerInfo, ref bool ___jumpButtonHasBeenUp, ref Player ___player, ref Fix ___timeSinceRelease, ref Fix ___groundedSpeed, ref PlayerBody ___body, ref Fix ___chargeTime, ref bool ___waitingToRelease, ref Fix ___dashTime, ref bool ___hasCharged, ref bool ___isShortJumping, ref SpriteAnimator ___rollAnimator, ref AnimationData ___animData, ref SpriteAnimator ___animator, ref GameObject ___rollWave, ref Ability ___ability, ref Fix ___topSpeed, ref Fix ___MaxSpeed)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Invalid comparison between Unknown and I4
//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
if (___playerPhysics.IsGrounded() && ((Object)(object)___playerPhysics.getAttachedGround() == (Object)null || !___playerPhysics.getAttachedGround().ThisGameObject().activeInHierarchy))
{
___playerPhysics.UnGround(true, true);
__instance.ExitAbility(default(AbilityExitInfo));
return false;
}
if (___isCharging)
{
___secondsCharged += GameTime.FixedDeltaTime(___playerInfo.playerId, simDeltaTime);
if (___jumpButtonHasBeenUp && ___player.JumpButton_isDown())
{
___playerPhysics.Jump();
AudioManager.Get().Play("slimeJump" + ___player.Id);
__instance.ExitAbility(default(AbilityExitInfo));
return false;
}
}
else
{
___timeSinceRelease += GameTime.FixedDeltaTime(___playerInfo.playerId, simDeltaTime);
if (___jumpButtonHasBeenUp && ___player.JumpButton_isDown())
{
___topSpeed += (Fix)configSpeedIncrease.Value;
if (___topSpeed > (Fix)configMaxSpeed.Value)
{
Vec2 val = ___groundedSpeed * ___body.right;
___playerPhysics.UnGround(true, true);
___body.selfImposedVelocity = val * (Fix)configReleaseKeepRatio.Value;
__instance.ExitAbility(default(AbilityExitInfo));
return false;
}
}
else
{
Log.LogInfo((object)((object)(Fix)(ref ___topSpeed)).ToString());
if (___topSpeed > ___MaxSpeed)
{
___topSpeed -= (Fix)configSpeedDecrease.Value;
if (___topSpeed < ___MaxSpeed)
{
___topSpeed = ___MaxSpeed;
}
}
}
}
if (___isCharging && !___player.AbilityButtonIsDown(___playerInfo.AbilityButtonUsedIndex012))
{
if (___secondsCharged >= ___chargeTime)
{
___waitingToRelease = true;
___body.AttachRope((RopeBody)null, ___body.topAttachment);
}
else
{
if (___playerPhysics.IsGrounded())
{
__instance.ExitAbility(new AbilityExitInfo
{
justlanded = true
});
return false;
}
RollShortJump(__instance);
}
}
if (___timeSinceRelease > ___dashTime)
{
__instance.ExitAbility(default(AbilityExitInfo));
return false;
}
if (!___hasCharged && ___secondsCharged >= ___chargeTime && !___isShortJumping)
{
___hasCharged = true;
if ((int)___player.RumbleState == 3)
{
___player.Rumble((Rumble)0);
}
___rollAnimator.beginAnimation(___animData.GetAnimation("bigWave"));
___animator.beginAnimation(___animData.GetAnimation("rollFast"));
AudioManager.Get().Play("rollReady");
}
if (___waitingToRelease && ___playerPhysics.IsGrounded())
{
RollReleaseDash(__instance);
}
if (___playerPhysics.IsGrounded())
{
RollMove(__instance, ___groundedSpeed, simDeltaTime);
}
___rollWave.SetActive(___playerPhysics.IsGrounded() && !___ability.KillPlayersOnContact);
return false;
}
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(Roll), "ReleaseDash")]
public static void RollReleaseDash(object instance)
{
throw new NotImplementedException("It's a stub");
}
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(Roll), "Move")]
public static void RollMove(object instance, Fix speed, Fix simDeltaTime)
{
throw new NotImplementedException("It's a stub");
}
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(Roll), "ShortJump")]
public static void RollShortJump(object instance)
{
throw new NotImplementedException("It's a stub");
}
}
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(Roll), "Awake")]
private class RollAwakePatch
{
private static void Postfix(ref Fix ___MaxSpeed)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
___MaxSpeed = (Fix)configDefaultSpeed.Value;
}
}
internal static ManualLogSource Log;
public Harmony harmony = new Harmony("com.Starbox614.RollBoost");
private static ConfigEntry<float> configDefaultSpeed;
private static ConfigEntry<float> configSpeedIncrease;
private static ConfigEntry<float> configSpeedDecrease;
private static ConfigEntry<float> configMaxSpeed;
private static ConfigEntry<float> configReleaseKeepRatio;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.Starbox614.RollBoost is loaded!");
Log = ((BaseUnityPlugin)this).Logger;
configDefaultSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("main", "Default speed", 500f, "default rolling speed");
configMaxSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("main", "Max speed", 1500f, "max rolling speed before you fly out of the roll");
configSpeedIncrease = ((BaseUnityPlugin)this).Config.Bind<float>("main", "Speed boost", 50f, "amount boosting increases speed per frame");
configSpeedDecrease = ((BaseUnityPlugin)this).Config.Bind<float>("main", "Speed loss", 25f, "amount speed decreases when not boosting, per frame");
configReleaseKeepRatio = ((BaseUnityPlugin)this).Config.Bind<float>("main", "Release kept speed multiplier", 0.25f, "multiplier for the amount of speed kept when exceeding max speed and exiting the roll");
harmony.PatchAll();
}
}
}