using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
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.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("Rebound")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1+3e8a5c34222730661dc8403c1a2171ebb98d6a1b")]
[assembly: AssemblyProduct("Rebound")]
[assembly: AssemblyTitle("Rebound")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Rebound
{
internal class RBSettings
{
public static List<string> PlayerActionTypes = new List<string> { "slide", "boost", "spray", "dance", "trick1", "trick2", "trick3", "trickany", "switchstyle", "walk" };
private static ConfigEntry<float> config_reboundVelocityMultiplier;
private static ConfigEntry<float> config_maxLandingTimeToRebound;
private static ConfigEntry<float> config_minVelocityToRebound;
private static ConfigEntry<float> config_minReboundYVelocity;
private static ConfigEntry<float> config_maxReboundYVelocity;
private static ConfigEntry<float> config_launcherBonusMultiplier;
public static ConfigEntry<float> config_slopeMultiplierX;
public static ConfigEntry<float> config_slopeMultiplierY;
private static ConfigEntry<bool> config_capBasedOnHeight;
private static ConfigEntry<float> config_heightCapGenerosity;
private static ConfigEntry<bool> config_refreshCombo;
private static ConfigEntry<bool> config_tempDisableBoostAfterRebound;
private static ConfigEntry<bool> config_alwaysCalculateBasedOnHeight;
public static ConfigEntry<bool> config_slopeOnLauncher;
public static ConfigEntry<bool> config_preventComboExtend;
public static ConfigEntry<bool> config_enableTrail;
public static ConfigEntry<float> config_trailLength;
public static ConfigEntry<float> config_trailWidth;
private static ConfigEntry<string> config_cancelReboundActions;
private static ConfigEntry<string> config_doReboundActions;
public static ConfigEntry<bool> config_requireAllDRA;
public static ConfigEntry<bool> config_requireAllCRA;
public static void UpdateSettings(ConfigFile Config)
{
BindSettings(Config);
SetSettingsInPlugin();
}
public static void SetSettingsInPlugin()
{
ReboundPlugin.reboundVelocityMultiplier = config_reboundVelocityMultiplier.Value;
ReboundPlugin.maxLandingTimeToRebound = config_maxLandingTimeToRebound.Value;
ReboundPlugin.minVelocityToRebound = config_minVelocityToRebound.Value;
ReboundPlugin.minReboundYVelocity = config_minReboundYVelocity.Value;
ReboundPlugin.maxReboundYVelocity = config_maxReboundYVelocity.Value;
ReboundPlugin.launcherBonusMultiplier = config_launcherBonusMultiplier.Value;
ReboundPlugin.capBasedOnHeight = config_capBasedOnHeight.Value;
ReboundPlugin.heightCapGenerosity = config_heightCapGenerosity.Value;
ReboundPlugin.refreshCombo = config_refreshCombo.Value;
ReboundPlugin.alwaysCalculateBasedOnHeight = config_alwaysCalculateBasedOnHeight.Value;
ReboundPlugin.tempDisableBoostAfterRebound = config_tempDisableBoostAfterRebound.Value;
ReboundPlugin.cancelReboundActions = ConvertString(config_cancelReboundActions.Value, PlayerActionTypes);
ReboundPlugin.doReboundActions = ConvertString(config_doReboundActions.Value, PlayerActionTypes);
}
public static void UpdateSettingsEvent(object sender, EventArgs args)
{
SetSettingsInPlugin();
}
public static List<string> ConvertString(string _string, List<string> _list)
{
string text = _string.Replace(" ", "").ToLower();
List<string> list = text.Split(new char[1] { ',' }).ToList();
List<string> list2 = new List<string>();
foreach (string item in list)
{
string text2 = item;
if (_list.Contains(text2))
{
if (!text2.Equals("trickany"))
{
text2 = ((!text2.Equals("switchstyle")) ? (text2 + "ButtonHeld") : "switchStyleButtonHeld");
}
else
{
text2 = "trick1ButtonHeld";
list2.Add(text2);
text2 = "trick2ButtonHeld";
list2.Add(text2);
text2 = "trick3ButtonHeld";
}
list2.Add(text2);
}
}
return list2;
}
private static void BindSettings(ConfigFile Config)
{
config_reboundVelocityMultiplier = Config.Bind<float>("1. Variables", "Rebound Velocity Multiplier", 0.8f, "How much vertical speed is preserved when rebounding.");
config_maxLandingTimeToRebound = Config.Bind<float>("1. Variables", "Rebound Grace Period", 0.15f, "How much time you have after landing to do a rebound.");
config_minVelocityToRebound = Config.Bind<float>("1. Variables", "Minimum Falling Velocity to Rebound", 0f, "How fast you have to be falling to be able to do a rebound. (For reference, 8 is the player's jump height)");
config_minReboundYVelocity = Config.Bind<float>("1. Variables", "Minimum Rebound Velocity", 8f, "The minimum upward speed a rebound can send you. (For reference, 8 is the player's jump height)");
config_maxReboundYVelocity = Config.Bind<float>("1. Variables", "Maximum Rebound Velocity", 0f, "The maximum upward speed a rebound can send you. If zero or below, there's no upper limit (except the maximum fall speed). Note that reaching this limit will slow down your forward speed as well as your upward speed.");
config_launcherBonusMultiplier = Config.Bind<float>("1. Variables", "Launcher Bonus Multiplier", 0.5f, "How much extra momentum you get from rebounding off a launcher. A rebound off a launcher will never send you lower than the height a launcher sends you by default.");
config_slopeMultiplierX = Config.Bind<float>("1. Variables", "Ground Angle Multiplier on Forward Speed", 1f, "How much the angle of the ground you rebound off affects your forward speed. Speeds up on downward slopes, slows down on upward slopes. Note that you will automatically be flipped over if the slope sends you backwards.");
config_slopeMultiplierY = Config.Bind<float>("1. Variables", "Ground Angle Multiplier on Upward Speed", 1f, "How much the angle of the ground you rebound off affects your rebound height. Higher on upward slopes, lower on downward slopes. Not restricted by minimum/maximum rebound height.");
config_capBasedOnHeight = Config.Bind<bool>("2. Options", "Cap Rebound Velocity Based on Height", true, "Limit your rebound speed based on the peak of your jump, preventing you from going really high really fast by abusing Movement Plus fast falls. Shouldn't ever have an effect on vanilla gameplay, but when playing with Movement Plus, you may be sent lower than you might expect.");
config_heightCapGenerosity = Config.Bind<float>("2. Options", "Height Cap Generosity", 1.5f, "How much extra speed is added to the height-based velocity cap. Note that this is not a multiplier, but an offset added to the height cap.");
config_refreshCombo = Config.Bind<bool>("2. Options", "Refresh Combo Meter", true, "Toggle whether your combo meter is set to the value it was at before you landed before every rebound. Keeps your combo losses consistent, regardless of when within the grace period you rebounded.");
config_tempDisableBoostAfterRebound = Config.Bind<bool>("2. Options", "Temporarily Disable Boost on Rebound", true, "Toggle whether doing a rebound stops you from boosting until the trick is done. Does not affect Boosted Rebounds.");
config_alwaysCalculateBasedOnHeight = Config.Bind<bool>("2. Options", "Always Calculate Rebound Velocity Based On Height", false, "Always set the rebound velocity to the height-based velocity cap, regardless of the player's falling velocity. Note that this method tends to send you slightly higher, and also may be less accurate with mid-jump velocity changes (ex. wall plants or air boosts). However, this does prevent the fall speed limitations from capping your rebound height. Highly recommended to leave on false.");
config_slopeOnLauncher = Config.Bind<bool>("2. Options", "Apply Slope Physics When Rebounding Off Launcher", false, "If false, rebounding off a launcher will act like you have rebounded off of flat ground. If true, rebounding off a launcher will send you at an angle. Note that this can and will send you flying in directions you may not want - but it also could be used to your advantage to get insane height/speed.");
config_preventComboExtend = Config.Bind<bool>("2. Options", "Prevent Combo Extension", true, "Prevents using the Rebound grace period to artificially extend combos by detecting if an action other than a Rebound is taken during the period and cancelling the combo accordingly. If using MovementPlus, this does not apply until the combo meter runs out while on the ground.");
config_enableTrail = Config.Bind<bool>("2. Options", "Enable Rebound Trail", true, "Toggle the extended boost trail effect when Rebounding.");
config_trailLength = Config.Bind<float>("2. Options", "Trail Time", 3f, "Affects how long the Rebound trail lasts. Note that this time is adjusted depending on the height of the Rebound. The default value reflects the approximate time at the peak of a Rebound.");
config_trailWidth = Config.Bind<float>("2. Options", "Trail Width", 0.25f, "Affects how big the Rebound trail starts off as.");
config_doReboundActions = Config.Bind<string>("3. Input", "Rebound Modifier Actions", "", "A list of what additional player actions need to be pressed/held to do a rebound, separated by commas. Note that jumping is always required. Acceptable values: slide, boost, spray, dance, trick1, trick2, trick3, trickAny, switchStyle, walk");
config_requireAllDRA = Config.Bind<bool>("3. Input", "Require ALL Rebound Modifiers to Rebound", false, "If true, the player must press/hold ALL the rebound modifier actions (as well as jump) to successfully rebound. If false, the player can hold ANY of them (along with jump) to rebound.");
config_cancelReboundActions = Config.Bind<string>("3. Input", "Cancel Rebound Modifier Actions", "slide", "A list of what player actions can be pressed/held to prevent a rebound and do a regular jump instead, separated by commas. Acceptable values: slide, boost, spray, dance, trick1, trick2, trick3, trickAny, switchStyle, walk");
config_requireAllCRA = Config.Bind<bool>("3. Input", "Require ALL Cancel Rebound Modifiers to Cancel", false, "If true, the player must press/hold ALL the cancel modifier actions to cancel a rebound. If false, the player can hold ANY of them to cancel a rebound.");
config_reboundVelocityMultiplier.SettingChanged += UpdateSettingsEvent;
config_maxLandingTimeToRebound.SettingChanged += UpdateSettingsEvent;
config_minVelocityToRebound.SettingChanged += UpdateSettingsEvent;
config_minReboundYVelocity.SettingChanged += UpdateSettingsEvent;
config_maxReboundYVelocity.SettingChanged += UpdateSettingsEvent;
config_launcherBonusMultiplier.SettingChanged += UpdateSettingsEvent;
config_slopeMultiplierX.SettingChanged += UpdateSettingsEvent;
config_slopeMultiplierY.SettingChanged += UpdateSettingsEvent;
config_capBasedOnHeight.SettingChanged += UpdateSettingsEvent;
config_heightCapGenerosity.SettingChanged += UpdateSettingsEvent;
config_refreshCombo.SettingChanged += UpdateSettingsEvent;
config_tempDisableBoostAfterRebound.SettingChanged += UpdateSettingsEvent;
config_alwaysCalculateBasedOnHeight.SettingChanged += UpdateSettingsEvent;
config_slopeOnLauncher.SettingChanged += UpdateSettingsEvent;
config_cancelReboundActions.SettingChanged += UpdateSettingsEvent;
config_doReboundActions.SettingChanged += UpdateSettingsEvent;
config_requireAllDRA.SettingChanged += UpdateSettingsEvent;
config_requireAllCRA.SettingChanged += UpdateSettingsEvent;
}
}
[HarmonyPatch(typeof(AirTrickAbility))]
internal class AirTrickPatch
{
[HarmonyPrefix]
[HarmonyPatch("SetupBoostTrick")]
private static bool SetupBoostTrick_Prefix(AirTrickAbility __instance)
{
if (ReboundPlugin.rebounding && RBTrix.boostedReboundsRespectTrickButtons.Value)
{
int num = RBTrix.GetPlayerTrickNumber(ReboundPlugin.player);
if (num < 0)
{
num = 0;
}
__instance.curTrick = num;
}
ReboundPlugin.Log.LogInfo((object)__instance.curTrick);
ReboundPlugin.Log.LogInfo((object)(ReboundPlugin.rebounding.ToString() + true + RBTrix.boostedReboundsRespectTrickButtons.Value));
return true;
}
}
[HarmonyPatch(typeof(Player))]
internal class PlayerPatches
{
public static bool wasRequestingJump;
public static float wasRequestingJumpTime;
[HarmonyPrefix]
[HarmonyPatch("HandleJump")]
public static bool HandleJumpPrefix_TriggerRebound(Player __instance)
{
if ((Object)(object)__instance != (Object)(object)ReboundPlugin.player || __instance.isDisabled || __instance.isAI)
{
return true;
}
__instance.jumpedThisFrame = false;
__instance.timeSinceJumpRequested += Core.dt;
if (__instance.jumpRequested && __instance.IsGrounded() && (!__instance.jumpConsumed || __instance.ability == __instance.slideAbility || __instance.ability == __instance.boostAbility))
{
if (ReboundPlugin.PlayerAttemptingRebound())
{
ReboundPlugin.ReboundTrick();
}
else if (__instance.JumpIsAllowed())
{
if (ReboundPlugin.CanRebound())
{
ReboundPlugin.CancelRebound();
}
__instance.Jump();
ReboundPlugin.landTime = float.PositiveInfinity;
}
ReboundPlugin.distanceFallenFromPeakOfJump = 0f;
}
return false;
}
[HarmonyPrefix]
[HarmonyPatch("OnLanded")]
public static bool OnLandedPrefix_ReboundDistance(Player __instance)
{
if ((Object)(object)__instance != (Object)(object)ReboundPlugin.player || __instance.isDisabled || __instance.isAI)
{
return true;
}
ReboundPlugin.rebounding = false;
ReboundPlugin.landTime = 0f;
ReboundPlugin.distanceFallenFromPeakOfJump += __instance.reallyMovedVelocity.y;
if (__instance.comboTimeOutTimer <= 0f)
{
ReboundPlugin.CancelRebound();
}
wasRequestingJump = __instance.jumpRequested;
wasRequestingJumpTime = __instance.timeSinceJumpRequested;
return true;
}
[HarmonyPostfix]
[HarmonyPatch("OnLanded")]
public static void OnLandedPostfix_ReboundSlide(Player __instance)
{
if (!((Object)(object)__instance != (Object)(object)ReboundPlugin.player) && !__instance.isDisabled && !__instance.isAI && __instance.slideButtonHeld && !((Ability)__instance.slideAbility).locked && !__instance.jumpRequested && ((wasRequestingJump && wasRequestingJumpTime <= __instance.JumpPreGroundingGraceTime) || __instance.jumpButtonNew) && ReboundPlugin.PlayerAttemptingRebound())
{
__instance.jumpRequested = true;
__instance.timeSinceJumpRequested = wasRequestingJumpTime;
}
}
[HarmonyPrefix]
[HarmonyPatch("DoTrick")]
public static bool DoTrickPrefix_FailIfNotRebound(TrickType type, string trickName, int trickNum, Player __instance)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Invalid comparison between Unknown and I4
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Invalid comparison between Unknown and I4
if ((Object)(object)__instance != (Object)(object)ReboundPlugin.player || __instance.isDisabled || __instance.isAI)
{
return true;
}
if (ReboundPlugin.CanRebound() && !ReboundPlugin.rebounding && ReboundPlugin.landTime > Core.dt * 3f && ((int)__instance.currentTrickType != 12 || (int)type != 12))
{
ReboundPlugin.CancelRebound();
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch("LandCombo")]
public static bool LandComboPrefix_ExtendForRebound(Player __instance)
{
if ((Object)(object)__instance != (Object)(object)ReboundPlugin.player || __instance.isDisabled || __instance.isAI)
{
return true;
}
return !ReboundPlugin.CanRebound();
}
[HarmonyPrefix]
[HarmonyPatch("ActivateAbility")]
public static bool AbilityPrefix_CancelRebound(Ability a, Player __instance)
{
if ((Object)(object)__instance != (Object)(object)ReboundPlugin.player || __instance.isDisabled || __instance.isAI)
{
return true;
}
if (!ReboundPlugin.settingUpRebound)
{
ReboundPlugin.rebounding = false;
}
if ((__instance.ability == null || __instance.ability == __instance.slideAbility) && a != __instance.boostAbility && ReboundPlugin.CanRebound() && ReboundPlugin.landTime > Core.dt * 3f)
{
ReboundPlugin.CancelRebound();
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch("UpdateTrails")]
public static bool UpdateReboundTrail(Player __instance)
{
if (__instance.characterVisual.VFX.boostpackEffect.activeSelf)
{
if (!__instance.preBoostpackActive)
{
TrailRenderer boostpackTrail = __instance.boostpackTrail;
float time = (__instance.boostpackTrail.startWidth = 0f);
boostpackTrail.time = time;
}
__instance.preBoostpackActive = true;
__instance.characterVisual.VFX.boostpackTrail.SetActive(true);
__instance.boostTrailTimer += Core.dt * 1.2f;
if (__instance.boostTrailTimer > __instance.boostpackTrailDefaultTime && !ReboundPlugin.rebounding)
{
__instance.boostTrailTimer = __instance.boostpackTrailDefaultTime;
}
__instance.trailWidth += Core.dt;
if (__instance.trailWidth > __instance.boostpackTrailDefaultWidth && !ReboundPlugin.rebounding)
{
__instance.trailWidth = __instance.boostpackTrailDefaultWidth;
}
}
else
{
__instance.preBoostpackActive = false;
__instance.boostTrailTimer -= Core.dt * 6f;
if (__instance.boostTrailTimer < 0f)
{
__instance.boostTrailTimer = 0f;
__instance.characterVisual.VFX.boostpackTrail.SetActive(false);
ReboundPlugin.rebounding = false;
}
__instance.trailWidth -= Core.dt;
if (__instance.trailWidth < 0f)
{
__instance.trailWidth = 0f;
}
}
__instance.boostpackTrail.time = __instance.boostTrailTimer;
__instance.boostpackTrail.startWidth = __instance.trailWidth;
return false;
}
}
[BepInPlugin("goatgirl.Rebound", "Rebound", "2.3.0")]
[BepInProcess("Bomb Rush Cyberfunk.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ReboundPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
internal static Harmony Harmony = new Harmony("goatgirl.Rebound");
public static bool MPlusActive = false;
public static float landTime = float.PositiveInfinity;
public static Vector2 landingVelocity = new Vector2(0f, 0f);
public static float distanceFallenFromPeakOfJump = 0f;
public static float landingComboMeter = 1f;
public static float reboundVelocityMultiplier = 0.8f;
public static float launcherBonusMultiplier = 0.5f;
public static float maxLandingTimeToRebound = 0.15f;
public static float minVelocityToRebound = 0f;
public static float minReboundYVelocity = 8f;
public static float maxReboundYVelocity = 0f;
public static bool capBasedOnHeight = true;
public static float heightCapGenerosity = 1.5f;
public static bool alwaysCalculateBasedOnHeight = false;
public static bool refreshCombo = true;
public static bool tempDisableBoostAfterRebound = true;
public const float comboCost = 0.215f;
public const float boostCost = 0f;
public const bool allowBoostedRebounds = true;
public static bool canCancelCombo = true;
public static List<string> cancelReboundActions = new List<string>();
public static List<string> doReboundActions = new List<string>();
public static bool rebounding = false;
public static bool settingUpRebound = false;
public static Player player
{
get
{
WorldHandler instance = WorldHandler.instance;
return (instance != null) ? instance.GetCurrentPlayer() : null;
}
}
public static float reboundTrailTime => RBSettings.config_trailLength.Value + 0.000125f;
public static float reboundTrailWidth => RBSettings.config_trailWidth.Value + 0.000125f;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Rebound is loaded!");
foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
{
if (pluginInfo.Value.Metadata.GUID.Equals("com.yuril.MovementPlus"))
{
MPlusActive = true;
Log.LogInfo((object)"Rebound: MovementPlus found!");
}
}
RBSettings.UpdateSettings(((BaseUnityPlugin)this).Config);
}
private void FixedUpdate()
{
//IL_0059: 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)
//IL_0068: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: 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)
if (!InGame())
{
return;
}
if (landTime < maxLandingTimeToRebound)
{
landTime += Core.dt;
}
if (!player.IsGrounded())
{
landingVelocity = new Vector2(player.GetForwardSpeed(), player.GetVelocity().y);
landingComboMeter = player.comboTimeOutTimer;
if (player.GetVelocity().y < 0f)
{
distanceFallenFromPeakOfJump += Mathf.Abs(player.GetVelocity().y);
landTime = 0f;
}
else
{
distanceFallenFromPeakOfJump = 0f;
}
}
else if (player.ability == player.boostAbility && landTime >= maxLandingTimeToRebound && !MPlusActive)
{
player.LandCombo();
}
if (rebounding && player.boostTrailTimer <= 0f)
{
rebounding = false;
}
else if (rebounding && RBSettings.config_enableTrail.Value)
{
Player obj = player;
obj.boostTrailTimer += Mathf.Min(Core.dt, player.GetVelocity().y / 500f) * 6f;
Player obj2 = player;
obj2.trailWidth += Mathf.Min(Core.dt, player.GetVelocity().y / 500f);
}
}
public static bool CanRebound()
{
return landTime < maxLandingTimeToRebound && player.IsGrounded();
}
public static bool PlayerAttemptingRebound()
{
bool flag = !doReboundActions.Any() || ActionsPressed(doReboundActions, RBSettings.config_requireAllDRA.Value);
bool flag2 = cancelReboundActions.Any() && ActionsPressed(cancelReboundActions, RBSettings.config_requireAllCRA.Value);
return landingVelocity.y < 0f - minVelocityToRebound && landTime < maxLandingTimeToRebound && !flag2 && flag;
}
public static void ReboundTrick()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
bool boosting = player.boosting;
Vector3 val = Vector3.ProjectOnPlane(player.motor.groundNormalVisual, Vector3.up);
float num = Vector3.Dot(((Vector3)(ref val)).normalized, player.dir);
player.animInfosSets[player.moveStyle][Animator.StringToHash("jumpTrick1")].fadeTo[player.fallHash] = 1f;
player.animInfosSets[player.moveStyle][Animator.StringToHash("jumpTrick1")].fadeTo[Animator.StringToHash("fallIdle")] = 1f;
PrepForRebound();
if (refreshCombo)
{
player.comboTimeOutTimer = landingComboMeter;
}
rebounding = true;
settingUpRebound = true;
Vector2 val2 = landingVelocity;
val2.y = (0f - val2.y) * reboundVelocityMultiplier;
if (player.CheckBoostTrick())
{
player.DoTrick((TrickType)6, "Boosted Rebound", 0);
player.ActivateAbility((Ability)(object)player.airTrickAbility);
val2.x = Mathf.Max(val2.x, player.GetForwardSpeed());
}
else
{
if (tempDisableBoostAfterRebound)
{
player.ActivateAbility((Ability)(object)player.airTrickAbility);
AirTrickAbility airTrickAbility = player.airTrickAbility;
airTrickAbility.duration /= 3f;
}
player.DoTrick((TrickType)6, RBTrix.GetReboundTrickName(), 0);
player.PlayAnim(Animator.StringToHash(RBTrix.GetReboundAnimation()), true, true, -1f);
}
float num2 = distanceFallenFromPeakOfJump * reboundVelocityMultiplier;
float num3 = Mathf.Sqrt(2f * num2 * player.motor.gravity);
float num4 = num3 / 9f + heightCapGenerosity;
if (alwaysCalculateBasedOnHeight)
{
val2.y = num4 - heightCapGenerosity;
}
else if (capBasedOnHeight)
{
val2.y = Mathf.Min(val2.y, num4);
}
if (Object.op_Implicit((Object)(object)player.onLauncher))
{
if (!RBSettings.config_slopeOnLauncher.Value)
{
num = 0f;
}
float num5 = (((Object)((Component)player.onLauncher.parent).gameObject).name.Contains("Super") ? (player.jumpSpeedLauncher * 1.4f) : player.jumpSpeedLauncher);
val2.y = Mathf.Max(val2.y + num5 * launcherBonusMultiplier, num5);
}
val2.y = Mathf.Max(val2.y, minReboundYVelocity);
if (val2.y > maxReboundYVelocity && maxReboundYVelocity != 0f)
{
val2.x = maxReboundYVelocity * (val2.x / val2.y);
val2.y = maxReboundYVelocity;
}
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(Mathf.Sin(num) * RBSettings.config_slopeMultiplierX.Value, Mathf.Cos(num) * RBSettings.config_slopeMultiplierY.Value);
if (val3.x < 0f)
{
val3.y += 1f;
}
player.motor.SetVelocityYOneTime(val2.y * val3.y);
float num6 = val2.x + val2.y * val3.x;
player.SetForwardSpeed(num6);
if (num6 < 0f)
{
player.SetRotation(-player.dir);
}
bool flag = true;
if (player.comboTimeOutTimer - 0.215f > 1f)
{
player.ResetComboTimeOut();
}
else
{
player.DoComboTimeOut(0.215f);
player.comboTimeOutTimer = Mathf.Clamp(player.comboTimeOutTimer, 0f, 1f);
}
if (player.comboTimeOutTimer == 0f)
{
player.LandCombo();
}
if (RBSettings.config_enableTrail.Value)
{
player.boostTrailTimer = reboundTrailTime;
player.trailWidth = reboundTrailWidth;
}
rebounding = true;
settingUpRebound = false;
}
public static void PrepForRebound()
{
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
bool boosting = player.boosting;
if (!boosting)
{
player.StopCurrentAbility();
}
player.jumpedThisFrame = true;
player.isJumping = true;
player.maintainSpeedJump = true;
player.jumpConsumed = true;
player.jumpRequested = false;
player.jumpedThisFrame = true;
player.timeSinceLastJump = 0f;
player.ForceUnground(true);
player.radialHitbox.SetActive(true);
player.AudioManager.PlaySfxGameplay((SfxCollectionID)20, (AudioClipID)130, player.playerOneShotAudioSource, 0f);
player.PlayVoice((AudioClipID)489, (VoicePriority)0, true);
if (!boosting)
{
player.PlayAnim(Animator.StringToHash(RBTrix.GetReboundAnimation()), true, false, -1f);
}
else
{
player.PlayAnim(Animator.StringToHash("jump"), true, false, -1f);
}
player.DoHighJumpEffects(player.motor.groundNormalVisual * -1f);
}
public static void CancelRebound()
{
if (ComboCanBeCancelled() && RBSettings.config_preventComboExtend.Value && !rebounding)
{
landTime = maxLandingTimeToRebound + 1f;
player.LandCombo();
}
}
public static bool ComboCanBeCancelled()
{
if (!canCancelCombo)
{
return false;
}
return (!MPlusActive || player.comboTimeOutTimer <= 0f) && player.ability != player.slideAbility && !((Ability)player.slideAbility).locked && player.ability != player.ledgeClimbAbility && player.switchMoveStyleAbility != player.ability;
}
private void OnDestroy()
{
Harmony.UnpatchSelf();
}
public static bool ActionsPressed(List<string> actions, bool checkIfAllPressed)
{
if (actions == null || !actions.Any())
{
return false;
}
bool result = checkIfAllPressed;
foreach (string action in actions)
{
if (TranslateActionString(action) == !checkIfAllPressed)
{
result = !checkIfAllPressed;
}
}
return result;
}
public static bool TranslateActionString(string action)
{
return action switch
{
"jumpRequested" => player.jumpRequested,
"trick1ButtonHeld" => player.trick1ButtonHeld || player.trick1ButtonNew,
"trick2ButtonHeld" => player.trick2ButtonHeld || player.trick2ButtonNew,
"trick3ButtonHeld" => player.trick3ButtonHeld || player.trick3ButtonNew,
"slideButtonHeld" => player.slideButtonHeld || player.slideButtonNew || player.ability == player.slideAbility,
"boostButtonHeld" => player.boostButtonHeld || player.boostButtonNew,
"sprayButtonHeld" => player.sprayButtonHeld || player.sprayButtonNew,
"danceButtonHeld" => player.danceButtonHeld || player.danceButtonNew,
"switchStyleButtonHeld" => player.switchStyleButtonHeld || player.switchStyleButtonNew,
"walkButtonHeld" => player.walkButtonHeld || player.walkButtonNew,
_ => false,
};
}
public static bool InGame()
{
return (Object)(object)player != (Object)null && !player.isDisabled && !Core.Instance.BaseModule.IsInGamePaused;
}
}
[BepInPlugin("goatgirl.Rebound.NewTrix", "Rebound.NewTrix", "1.0.0")]
[BepInProcess("Bomb Rush Cyberfunk.exe")]
public class ReboundTrixPlugin : BaseUnityPlugin
{
private void Awake()
{
RBTrix.UpdateSettings(((BaseUnityPlugin)this).Config);
}
}
internal class RBTrix
{
public static ConfigEntry<bool> boostedReboundsRespectTrickButtons;
public static ConfigEntry<string> reboundTrickAnimFootDefault;
public static ConfigEntry<string> reboundTrickNameFootDefault;
public static ConfigEntry<string> reboundTrickAnimFoot0;
public static ConfigEntry<string> reboundTrickNameFoot0;
public static ConfigEntry<string> reboundTrickAnimFoot1;
public static ConfigEntry<string> reboundTrickNameFoot1;
public static ConfigEntry<string> reboundTrickAnimFoot2;
public static ConfigEntry<string> reboundTrickNameFoot2;
public static ConfigEntry<string> reboundTrickAnimBMXDefault;
public static ConfigEntry<string> reboundTrickNameBMXDefault;
public static ConfigEntry<string> reboundTrickAnimBMX0;
public static ConfigEntry<string> reboundTrickNameBMX0;
public static ConfigEntry<string> reboundTrickAnimBMX1;
public static ConfigEntry<string> reboundTrickNameBMX1;
public static ConfigEntry<string> reboundTrickAnimBMX2;
public static ConfigEntry<string> reboundTrickNameBMX2;
public static ConfigEntry<string> reboundTrickAnimInlineDefault;
public static ConfigEntry<string> reboundTrickNameInlineDefault;
public static ConfigEntry<string> reboundTrickAnimInline0;
public static ConfigEntry<string> reboundTrickNameInline0;
public static ConfigEntry<string> reboundTrickAnimInline1;
public static ConfigEntry<string> reboundTrickNameInline1;
public static ConfigEntry<string> reboundTrickAnimInline2;
public static ConfigEntry<string> reboundTrickNameInline2;
public static ConfigEntry<string> reboundTrickAnimBoardDefault;
public static ConfigEntry<string> reboundTrickNameBoardDefault;
public static ConfigEntry<string> reboundTrickAnimBoard0;
public static ConfigEntry<string> reboundTrickNameBoard0;
public static ConfigEntry<string> reboundTrickAnimBoard1;
public static ConfigEntry<string> reboundTrickNameBoard1;
public static ConfigEntry<string> reboundTrickAnimBoard2;
public static ConfigEntry<string> reboundTrickNameBoard2;
public static void UpdateSettings(ConfigFile Config)
{
BindSettings(Config);
}
private static void BindSettings(ConfigFile Config)
{
boostedReboundsRespectTrickButtons = Config.Bind<bool>("1. Options", "Multiple Tricks for Boosted Rebounds", true, "If enabled, holding a trick button while doing a Boosted Rebound will perform the boost trick associated with that button.");
reboundTrickAnimFootDefault = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick (Default)", "jumpTrick1", "Default Rebound trick, holding no trick button");
reboundTrickNameFootDefault = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick (Default) Name", "Rebound Corkscrew", "Default Rebound trick name, holding no trick button");
reboundTrickAnimFoot0 = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick 0", "jumpTrick1", "Button 1 Rebound trick");
reboundTrickNameFoot0 = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick 0 Name", "Rebound Corkscrew", "Button 1 Rebound trick name");
reboundTrickAnimFoot1 = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick 1", "jumpTrick1", "Button 2 Rebound trick");
reboundTrickNameFoot1 = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick 1 Name", "Rebound Corkscrew", "Button 2 Rebound trick name");
reboundTrickAnimFoot2 = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick 2", "jumpTrick1", "Button 3 Rebound trick");
reboundTrickNameFoot2 = Config.Bind<string>("2. On-Foot Rebound Tricks", "On-Foot Trick 2 Name", "Rebound Corkscrew", "Button 3 Rebound trick name");
reboundTrickAnimBoardDefault = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick (Default)", "jumpTrick1", "Default Rebound trick, holding no trick button");
reboundTrickNameBoardDefault = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick (Default) Name", "Rebound McTwist", "Default Rebound trick name, holding no trick button");
reboundTrickAnimBoard0 = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick 0", "jumpTrick1", "Button 1 Rebound trick");
reboundTrickNameBoard0 = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick 0 Name", "Rebound McTwist", "Button 1 Rebound trick name");
reboundTrickAnimBoard1 = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick 1", "jumpTrick1", "Button 2 Rebound trick");
reboundTrickNameBoard1 = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick 1 Name", "Rebound McTwist", "Button 2 Rebound trick name");
reboundTrickAnimBoard2 = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick 2", "jumpTrick1", "Button 3 Rebound trick");
reboundTrickNameBoard2 = Config.Bind<string>("3. Skateboard Rebound Tricks", "Skateboard Trick 2 Name", "Rebound McTwist", "Button 3 Rebound trick name");
reboundTrickAnimInlineDefault = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick (Default)", "jumpTrick1", "Default Rebound trick, holding no trick button");
reboundTrickNameInlineDefault = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick (Default) Name", "Rebound Corkscrew", "Default Rebound trick name, holding no trick button");
reboundTrickAnimInline0 = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick 0", "jumpTrick1", "Button 1 Rebound trick");
reboundTrickNameInline0 = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick 0 Name", "Rebound Corkscrew", "Button 1 Rebound trick name");
reboundTrickAnimInline1 = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick 1", "jumpTrick1", "Button 2 Rebound trick");
reboundTrickNameInline1 = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick 1 Name", "Rebound Corkscrew", "Button 2 Rebound trick name");
reboundTrickAnimInline2 = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick 2", "jumpTrick1", "Button 3 Rebound trick");
reboundTrickNameInline2 = Config.Bind<string>("4. Inline Rebound Tricks", "Inline Trick 2 Name", "Rebound Corkscrew", "Button 3 Rebound trick name");
reboundTrickAnimBMXDefault = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick (Default)", "jumpTrick1", "Default Rebound trick, holding no trick button");
reboundTrickNameBMXDefault = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick (Default) Name", "Rebound 360 Backflip", "Default Rebound trick name, holding no trick button");
reboundTrickAnimBMX0 = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick 0", "jumpTrick1", "Button 1 Rebound trick");
reboundTrickNameBMX0 = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick 0 Name", "Rebound 360 Backflip", "Button 1 Rebound trick name");
reboundTrickAnimBMX1 = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick 1", "jumpTrick1", "Button 2 Rebound trick");
reboundTrickNameBMX1 = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick 1 Name", "Rebound 360 Backflip", "Button 2 Rebound trick name");
reboundTrickAnimBMX2 = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick 2", "jumpTrick1", "Button 3 Rebound trick");
reboundTrickNameBMX2 = Config.Bind<string>("5. BMX Rebound Tricks", "BMX Trick 2 Name", "Rebound 360 Backflip", "Button 3 Rebound trick name");
}
public static string GetReboundAnimation(MoveStyle moveStyle, int trickButton = -1)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Invalid comparison between Unknown and I4
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
string text = ((trickButton == -1) ? "Default" : trickButton.ToString());
string text2 = (((int)moveStyle == 1) ? "BMX" : (((int)moveStyle == 2 || (int)moveStyle == 4) ? "Board" : (((int)moveStyle == 3) ? "Inline" : "Foot")));
try
{
string name = "reboundTrickAnim" + text2 + text;
ConfigEntry<string> val = (ConfigEntry<string>)typeof(RBTrix).GetField(name).GetValue(null);
return val.Value;
}
catch (Exception ex)
{
ReboundPlugin.Log.LogError((object)("GetReboundAnimation exception: " + ex.Message));
return "jumpTrick1";
}
}
public static string GetReboundTrickName(MoveStyle moveStyle, int trickButton = -1)
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Invalid comparison between Unknown and I4
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Invalid comparison between Unknown and I4
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Invalid comparison between Unknown and I4
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Invalid comparison between Unknown and I4
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
string text = ((trickButton == -1) ? "Default" : trickButton.ToString());
string text2 = (((int)moveStyle == 1) ? "BMX" : (((int)moveStyle == 2 || (int)moveStyle == 4) ? "Board" : (((int)moveStyle == 3) ? "Inline" : "Foot")));
try
{
string name = "reboundTrickName" + text2 + text;
ConfigEntry<string> val = (ConfigEntry<string>)typeof(RBTrix).GetField(name).GetValue(null);
return val.Value;
}
catch (Exception ex)
{
ReboundPlugin.Log.LogError((object)("GetReboundTrickName exception: " + ex.Message));
return ((int)moveStyle == 1) ? "Rebound 360 Backflip" : (((int)moveStyle == 2 || (int)moveStyle == 4) ? "Rebound McTwist" : (((int)moveStyle == 3) ? "Rebound Corkscrew" : "Rebound Corkscrew"));
}
}
public static string GetReboundAnimation()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Player player = ReboundPlugin.player;
return GetReboundAnimation(player.moveStyle, GetPlayerTrickNumber(player));
}
public static string GetReboundTrickName()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Player player = ReboundPlugin.player;
return GetReboundTrickName(player.moveStyle, GetPlayerTrickNumber(player));
}
public static int GetPlayerTrickNumber(Player p)
{
if (p.trick1ButtonNew || p.trick1ButtonHeld)
{
return 0;
}
if (p.trick2ButtonNew || p.trick2ButtonHeld)
{
return 1;
}
if (p.trick3ButtonNew || p.trick3ButtonHeld)
{
return 2;
}
return -1;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Rebound";
public const string PLUGIN_NAME = "Rebound";
public const string PLUGIN_VERSION = "2.0.1";
}
}