using System;
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 AG.StayonStyle.Patches;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;
using trickyclown;
[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("AG.StayonStyle")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My 4ourth plugin")]
[assembly: AssemblyTitle("AG.StayonStyle")]
[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 AG.StayonStyle
{
[BepInPlugin("AG.StayonStyle", "AG.StayonStyle", "1.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AGSOS_Plugin : BaseUnityPlugin
{
public static ManualLogSource Logger;
public static string Grind_Style_Switch_Key = "1A. Keep Style After Grind";
public static ConfigEntry<bool> Grind_Style_Switch;
public static string Trick_G_Leniency_Key = "1B. Trick Pre-Grind Leniency";
public static ConfigEntry<bool> Trick_G_Leniency;
public static string Boost_G_Leniency_Key = "1C. Boost Pre-Grind Leniency";
public static ConfigEntry<bool> Boost_G_Leniency;
public static string airDash_G_Leniency_Key = "1D. Air-Dash Pre-Grind Leniency";
public static ConfigEntry<bool> airDash_G_Leniency;
public static string No_I_Take_That_Back_G_Key = "1E. NO!!! I take that back!";
public static ConfigEntry<bool> No_I_Take_That_Back_G;
public static string Vert_Style_Switch_Key = "1A. Keep Style After Vert";
public static ConfigEntry<bool> Vert_Style_Switch;
public static string Vert_Stay_On_Foot_Key = "1B. Keep Style On Vert";
public static ConfigEntry<bool> Vert_Stay_On_Foot;
public static string Apply_to_Wallrun_Key = "1A. Apply to Wallrun";
public static ConfigEntry<bool> Apply_to_Wallrun;
public static string Trick_WR_Leniency_Key = "1B. Trick Pre-Wallrun Leniency";
public static ConfigEntry<bool> Trick_WR_Leniency;
public static string Boost_WR_Leniency_Key = "1C. Boost Pre-Wallrun Leniency";
public static ConfigEntry<bool> Boost_WR_Leniency;
public static string airDash_WR_Leniency_Key = "1D. Air-Dash Pre-Wallrun Leniency";
public static ConfigEntry<bool> airDash_WR_Leniency;
internal static Harmony Harmony = new Harmony("AG.StayonStyle");
public static Player player
{
get
{
WorldHandler instance = WorldHandler.instance;
return (instance != null) ? instance.GetCurrentPlayer() : null;
}
}
private void Awake()
{
Harmony.PatchAll();
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"I guess you wanna keep your style after grinding huh?");
Grind_Style_Switch = ((BaseUnityPlugin)this).Config.Bind<bool>("Grinding", Grind_Style_Switch_Key, true, "Keep style after getting out of grind");
Trick_G_Leniency = ((BaseUnityPlugin)this).Config.Bind<bool>("Grinding", Trick_G_Leniency_Key, true, "Pressing the Style Button while tricking before a Grind influences the exit");
Boost_G_Leniency = ((BaseUnityPlugin)this).Config.Bind<bool>("Grinding", Boost_G_Leniency_Key, true, "Pressing the Style Button while boosting before a Grind influences the exit");
airDash_G_Leniency = ((BaseUnityPlugin)this).Config.Bind<bool>("Grinding", airDash_G_Leniency_Key, true, "Pressing the Style Button while Air-Dashing before a Grind influences the exit");
Vert_Style_Switch = ((BaseUnityPlugin)this).Config.Bind<bool>("Vert", Vert_Style_Switch_Key, true, "Keep Style after getting out of Vert");
Vert_Stay_On_Foot = ((BaseUnityPlugin)this).Config.Bind<bool>("Vert", Vert_Stay_On_Foot_Key, false, "Keep Style On Vert (Only works on base-game maps)");
Apply_to_Wallrun = ((BaseUnityPlugin)this).Config.Bind<bool>("Wallrun", Apply_to_Wallrun_Key, true, "Can auto switch Styles when exiting Wallrun");
Trick_WR_Leniency = ((BaseUnityPlugin)this).Config.Bind<bool>("Wallrun", Trick_WR_Leniency_Key, true, "Pressing the Style Button while tricking before a Wallrun influences the exit");
Boost_WR_Leniency = ((BaseUnityPlugin)this).Config.Bind<bool>("Wallrun", Boost_WR_Leniency_Key, true, "Pressing the Style Button while boosting before a Wallrun influences the exit");
airDash_WR_Leniency = ((BaseUnityPlugin)this).Config.Bind<bool>("Wallrun", airDash_WR_Leniency_Key, true, "Pressing the Style Button while Air-Dashing before a Wallrun influences the exit");
}
private void FixedUpdate()
{
bool flag = Object.op_Implicit((Object)(object)Mapcontroller.Instance);
}
public static bool InGame()
{
return (Object)(object)player != (Object)null && !player.isDisabled && !Core.Instance.BaseModule.IsInGamePaused;
}
public static void New_Trix_Fix(Player p, AirTrickAbility i)
{
string configValueAir = ATAPatchTC.Instance.GetConfigValueAir("footAirBoostTrick0cfg");
string configValueAir2 = ATAPatchTC.Instance.GetConfigValueAir("footAirBoostTrick1cfg");
string configValueAir3 = ATAPatchTC.Instance.GetConfigValueAir("footAirBoostTrick2cfg");
if (PlayerPatch.back_to_normal_after_grind == 1)
{
p.anim.runtimeAnimatorController = p.animatorController;
if (i.curTrick == 0)
{
p.PlayAnim(AnimationUtility.GetAnimationByName(configValueAir), true, false, 0f);
}
if (i.curTrick == 1)
{
p.PlayAnim(AnimationUtility.GetAnimationByName(configValueAir2), true, false, 0f);
}
if (i.curTrick == 2)
{
p.PlayAnim(AnimationUtility.GetAnimationByName(configValueAir3), true, false, 0f);
}
}
}
private void ConfigSettingChanged(object sender, EventArgs e)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
if (val != null)
{
}
}
internal static bool IsCrewBoomInstalled()
{
return Chainloader.PluginInfos.Keys.Any((string x) => x == "CrewBoom");
}
internal static bool IsMovementPlusInstalled()
{
return Chainloader.PluginInfos.Keys.Any((string x) => x == "com.yuril.MovementPlus");
}
internal static bool IsNewTrixInstalled()
{
return Chainloader.PluginInfos.Keys.Any((string x) => x == "info.mariobluegloves.trickyclown");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "AG.StayonStyle";
public const string PLUGIN_NAME = "My 4ourth plugin";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace AG.StayonStyle.Patches
{
[HarmonyPatch(typeof(Player))]
internal class PlayerPatch
{
public static int back_to_normal_after_grind = 0;
public static bool soap_shoes = false;
public static int set_while_trick = 0;
public static bool set_while_trick_null = true;
public static int Frameboost_bugfix = 0;
public static int Frameboost_bugfix2 = 0;
public static int set_while_boost_G = 0;
public static int set_while_airDash_G = 0;
public static int back_to_normal_after_vert = 0;
public static int Vert_bugfix = 0;
public static bool Vert_bugfix2 = true;
public static int swap_during_wallrun = 0;
public static int set_while_boost_WR = 0;
public static bool Swap_Air_Trick = false;
public static bool On_MP_Vert = false;
[HarmonyPatch("FixedUpdatePlayer")]
[HarmonyPostfix]
public static void FixedUpdatePlayer_Postfix(Player __instance)
{
if (!((Object)(object)__instance == (Object)(object)AGSOS_Plugin.player))
{
return;
}
bool flag = __instance.boostAbility.equippedMovestyleWasUsed && (__instance.boosting || __instance.ability == __instance.boostAbility);
bool flag2 = !__instance.boostAbility.equippedMovestyleWasUsed && (__instance.boosting || __instance.ability == __instance.boostAbility);
if (__instance.IsGrinding() && !__instance.usingEquippedMovestyle && !soap_shoes)
{
soap_shoes = true;
}
else if (soap_shoes)
{
soap_shoes = false;
}
if (AGSOS_Plugin.Grind_Style_Switch.Value)
{
if (back_to_normal_after_grind != 1)
{
if (!__instance.usingEquippedMovestyle && !flag)
{
if (!__instance.IsGrinding() && back_to_normal_after_grind != 3)
{
back_to_normal_after_grind = 0;
}
}
else if (!__instance.IsGrinding())
{
back_to_normal_after_grind = 2;
}
}
if (!__instance.IsGrinding())
{
if (__instance.currentTrickName == "Frameboost")
{
if (__instance.switchStyleButtonNew && !__instance.switchToEquippedMovestyleLocked)
{
if (Frameboost_bugfix == 2)
{
Frameboost_bugfix = 1;
}
else
{
Frameboost_bugfix = 2;
}
}
}
else if (!__instance.usingEquippedMovestyle)
{
Frameboost_bugfix = 1;
}
else
{
Frameboost_bugfix = 2;
}
}
if (__instance.currentTrickName == "Frameboost" && !__instance.IsGrinding() && __instance.usingEquippedMovestyle && Frameboost_bugfix == 1 && __instance.ability == null && Frameboost_bugfix2 != 1 && !__instance.IsGrounded())
{
__instance.SwitchToEquippedMovestyle(false, false, true, true);
}
if (((__instance.usingEquippedMovestyle && __instance.ability != null) || __instance.boosting) && !__instance.IsGrounded() && Frameboost_bugfix2 != 1)
{
Frameboost_bugfix2 = 1;
}
if ((__instance.IsGrinding() || __instance.IsGrounded()) && Frameboost_bugfix2 != 0)
{
Frameboost_bugfix2 = 0;
}
if (__instance.IsGrinding() && back_to_normal_after_grind == 0)
{
back_to_normal_after_grind = 1;
}
if (back_to_normal_after_grind == 1 && !__instance.IsGrinding())
{
__instance.SwitchToEquippedMovestyle(false, false, true, true);
__instance.boostAbility.equippedMovestyleWasUsed = false;
back_to_normal_after_grind = 0;
}
if (back_to_normal_after_grind == 3 && !__instance.IsGrinding())
{
__instance.SwitchToEquippedMovestyle(true, false, true, true);
__instance.boostAbility.equippedMovestyleWasUsed = true;
back_to_normal_after_grind = 2;
}
if (__instance.IsGrinding())
{
if (__instance.switchStyleButtonNew)
{
if (back_to_normal_after_grind == 1 || back_to_normal_after_grind == 0)
{
back_to_normal_after_grind = 2;
}
else
{
back_to_normal_after_grind = 1;
}
}
if (soap_shoes && back_to_normal_after_grind == 2)
{
back_to_normal_after_grind = 3;
}
}
if (AGSOS_Plugin.Trick_G_Leniency.Value && __instance.ability != __instance.airTrickAbility)
{
set_while_trick_null = true;
}
if (__instance.ability == __instance.airTrickAbility)
{
if (AGSOS_Plugin.Trick_G_Leniency.Value)
{
if (__instance.switchStyleButtonNew)
{
if (set_while_trick == 1 || set_while_trick == 0)
{
set_while_trick = 2;
}
else
{
set_while_trick = 1;
}
}
if (set_while_trick_null)
{
if (__instance.usingEquippedMovestyle)
{
set_while_trick = 2;
}
else
{
set_while_trick = 1;
}
set_while_trick_null = false;
}
}
}
else if (__instance.IsGrinding())
{
if (set_while_trick == 1)
{
back_to_normal_after_grind = 1;
}
else if (set_while_trick == 2)
{
back_to_normal_after_grind = 2;
}
set_while_trick = 0;
}
else
{
set_while_trick = 0;
}
if (AGSOS_Plugin.Boost_G_Leniency.Value)
{
if ((__instance.boosting || __instance.ability == __instance.boostAbility) && !__instance.IsGrinding())
{
if (set_while_boost_G == 0)
{
if (flag2)
{
set_while_boost_G = 1;
}
else if (flag)
{
set_while_boost_G = 2;
}
}
else if (__instance.switchStyleButtonNew)
{
if (set_while_boost_G == 1)
{
set_while_boost_G = 2;
}
else
{
set_while_boost_G = 1;
}
}
}
else if (__instance.IsGrinding())
{
if (set_while_boost_G == 1)
{
back_to_normal_after_grind = 1;
}
else if (set_while_boost_G == 2)
{
back_to_normal_after_grind = 2;
}
if (set_while_boost_G != 0)
{
set_while_boost_G = 0;
}
}
else if (set_while_boost_G != 0)
{
set_while_boost_G = 0;
}
}
if (AGSOS_Plugin.airDash_G_Leniency.Value)
{
if (__instance.ability == __instance.airDashAbility && !__instance.IsGrinding())
{
if (set_while_airDash_G == 0)
{
if (!__instance.usingEquippedMovestyle)
{
set_while_airDash_G = 1;
}
else if (__instance.usingEquippedMovestyle)
{
set_while_airDash_G = 2;
}
}
else if (__instance.switchStyleButtonNew)
{
if (set_while_airDash_G == 1)
{
set_while_airDash_G = 2;
}
else
{
set_while_airDash_G = 1;
}
}
}
else if (__instance.IsGrinding())
{
if (set_while_airDash_G == 1)
{
back_to_normal_after_grind = 1;
}
else if (set_while_airDash_G == 2)
{
back_to_normal_after_grind = 2;
}
if (set_while_airDash_G != 0)
{
set_while_airDash_G = 0;
}
}
else if (set_while_airDash_G != 0)
{
set_while_airDash_G = 0;
}
}
}
if (AGSOS_Plugin.Vert_Style_Switch.Value)
{
if (__instance.ability == __instance.vertAbility)
{
Vert_bugfix2 = true;
}
if (__instance.CheckVert() && !Vert_bugfix2)
{
Vert_bugfix = 2;
}
else if (Vert_bugfix > 0)
{
Vert_bugfix--;
}
if (__instance.ability == __instance.vertAbility || __instance.CheckVert())
{
if (back_to_normal_after_vert == 0)
{
back_to_normal_after_vert = 1;
}
if (__instance.switchStyleButtonNew)
{
if (back_to_normal_after_vert == 1 || back_to_normal_after_vert == 0)
{
back_to_normal_after_vert = 2;
}
else
{
back_to_normal_after_vert = 1;
}
}
if (!__instance.usingEquippedMovestyle && back_to_normal_after_vert == 2)
{
back_to_normal_after_vert = 3;
}
}
else if (Vert_bugfix == 0)
{
if (Vert_bugfix2)
{
Vert_bugfix2 = false;
}
if (__instance.usingEquippedMovestyle || flag)
{
if (back_to_normal_after_vert == 1)
{
__instance.SwitchToEquippedMovestyle(false, false, true, true);
back_to_normal_after_vert = 0;
}
else if (back_to_normal_after_vert != 2)
{
back_to_normal_after_vert = 2;
}
}
else if (back_to_normal_after_vert == 3)
{
__instance.SwitchToEquippedMovestyle(true, false, true, true);
back_to_normal_after_vert = 2;
}
else if (back_to_normal_after_vert != 0)
{
back_to_normal_after_vert = 0;
}
}
}
if (!AGSOS_Plugin.Apply_to_Wallrun.Value)
{
return;
}
if (__instance.ability == __instance.wallrunAbility || (__instance.ability == __instance.airTrickAbility && !Swap_Air_Trick && AGSOS_Plugin.Trick_WR_Leniency.Value) || ((__instance.boosting || __instance.ability == __instance.boostAbility) && AGSOS_Plugin.Boost_WR_Leniency.Value) || ((__instance.boosting || __instance.ability == __instance.airDashAbility) && AGSOS_Plugin.airDash_WR_Leniency.Value))
{
if (__instance.switchStyleButtonNew)
{
if (swap_during_wallrun == 0)
{
swap_during_wallrun = 1;
}
else
{
swap_during_wallrun = 0;
}
}
}
else if (swap_during_wallrun != 0)
{
swap_during_wallrun = 0;
}
}
[HarmonyPatch("SwitchToEquippedMovestyle")]
[HarmonyPostfix]
public static void SwitchToEquippedMovestyle(Player __instance, ref bool set, ref bool doAirTrick)
{
if ((Object)(object)__instance == (Object)(object)AGSOS_Plugin.player && doAirTrick)
{
Swap_Air_Trick = true;
}
}
[HarmonyPatch("CheckVert")]
[HarmonyPrefix]
public static bool CheckVert(Player __instance, ref bool __result)
{
if ((Object)(object)__instance == (Object)(object)AGSOS_Plugin.player && AGSOS_Plugin.Vert_Stay_On_Foot.Value)
{
bool flag = __instance.OnAnyGround();
bool flag2 = flag && ((Component)__instance.motor.groundCollider).gameObject.layer == 23;
if (!flag && (Object)(object)__instance.vertShape != (Object)null && __instance.vertPos.x > 0f && __instance.vertPos.x < __instance.vertShape.size.x && __instance.vertPos.y > 0f && __instance.vertPos.y < __instance.vertShape.size.y)
{
flag2 = true;
}
if (flag2)
{
if (flag)
{
VertShape component = ((Component)__instance.motor.groundCollider).gameObject.GetComponent<VertShape>();
_ = (Object)(object)component == (Object)null;
if ((Object)(object)__instance.vertShape != (Object)(object)component)
{
__instance.VertEnter(component, __instance.vertShape);
}
}
__instance.VertMove();
__result = true;
return false;
}
if ((Object)(object)__instance.vertShape != (Object)null)
{
__instance.VertExit();
}
__result = false;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(AirTrickAbility))]
internal class AirTrickPatch
{
[HarmonyPatch("SetupBoostTrick")]
[HarmonyPostfix]
public static void SetupBoostTrick_Postfix(AirTrickAbility __instance)
{
if (AGSOS_Plugin.IsNewTrixInstalled() && (Object)(object)((Ability)__instance).p == (Object)(object)AGSOS_Plugin.player && PlayerPatch.back_to_normal_after_grind == 1)
{
AGSOS_Plugin.New_Trix_Fix(((Ability)__instance).p, __instance);
}
}
[HarmonyPatch("OnStopAbility")]
[HarmonyPostfix]
public static void OnStopAbility_Postfix(AirTrickAbility __instance)
{
if ((Object)(object)((Ability)__instance).p == (Object)(object)AGSOS_Plugin.player && PlayerPatch.Swap_Air_Trick)
{
PlayerPatch.Swap_Air_Trick = false;
}
}
}
[HarmonyPatch(typeof(WallrunLineAbility))]
internal class WallrunPatch
{
[HarmonyPatch("Jump")]
[HarmonyPrefix]
public static void Jump(WallrunLineAbility __instance)
{
if ((Object)(object)((Ability)__instance).p == (Object)(object)AGSOS_Plugin.player && PlayerPatch.swap_during_wallrun == 1)
{
if (((Ability)__instance).p.usingEquippedMovestyle)
{
((Ability)__instance).p.SwitchToEquippedMovestyle(false, false, true, true);
}
else
{
((Ability)__instance).p.SwitchToEquippedMovestyle(true, false, true, true);
}
PlayerPatch.swap_during_wallrun = 0;
}
}
[HarmonyPatch("RunOff")]
[HarmonyPrefix]
public static void RunOff(WallrunLineAbility __instance)
{
if ((Object)(object)((Ability)__instance).p == (Object)(object)AGSOS_Plugin.player && PlayerPatch.swap_during_wallrun == 1)
{
if (((Ability)__instance).p.usingEquippedMovestyle)
{
((Ability)__instance).p.SwitchToEquippedMovestyle(false, false, true, true);
}
else
{
((Ability)__instance).p.SwitchToEquippedMovestyle(true, false, true, true);
}
PlayerPatch.swap_during_wallrun = 0;
}
}
}
}