Decompiled source of Woodz Grind Tweaks v1.0.0

TriGrindr.dll

Decompiled 2 days ago
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 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.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("TriGrindr")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Woodz Grind Tweaks")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TriGrindr")]
[assembly: AssemblyTitle("TriGrindr")]
[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 trigrindr
{
	[BepInPlugin("WoodzGrindTweaks", "Woodz Grind Tweaks", "1.0.0")]
	[BepInProcess("Bomb Rush Cyberfunk.exe")]
	public class GriTAPatchTG
	{
		[HarmonyPatch(typeof(GrindAbility), "SetToLine")]
		[HarmonyPrefix]
		private static bool GriTAPatchPreFix(GrindAbility __instance, GrindLine setGrindLine)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: 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_0066: Invalid comparison between Unknown and I4
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Invalid comparison between Unknown and I4
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Invalid comparison between Unknown and I4
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Invalid comparison between Unknown and I4
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Invalid comparison between Unknown and I4
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Invalid comparison between Unknown and I4
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Invalid comparison between Unknown and I4
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Invalid comparison between Unknown and I4
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_062f: Invalid comparison between Unknown and I4
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Invalid comparison between Unknown and I4
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_066e: Invalid comparison between Unknown and I4
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Invalid comparison between Unknown and I4
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: 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_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Invalid comparison between Unknown and I4
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_0714: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0740: Unknown result type (might be due to invalid IL or missing references)
			//IL_0745: Unknown result type (might be due to invalid IL or missing references)
			//IL_0752: 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_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_0783: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: 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)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_080d: Unknown result type (might be due to invalid IL or missing references)
			//IL_084d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0852: Unknown result type (might be due to invalid IL or missing references)
			//IL_0853: Unknown result type (might be due to invalid IL or missing references)
			//IL_0855: Unknown result type (might be due to invalid IL or missing references)
			//IL_085a: Unknown result type (might be due to invalid IL or missing references)
			//IL_085c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0887: Unknown result type (might be due to invalid IL or missing references)
			//IL_0889: Unknown result type (might be due to invalid IL or missing references)
			//IL_088e: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			flag = ((((Ability)__instance).p.trick2ButtonNew || ((Ability)__instance).p.trick2ButtonHeld) ? true : false);
			Vector3 val2;
			if (flag)
			{
				if (((int)((Ability)__instance).p.moveStyle == 0 && SquirtAbilityPatches.triangleGrind.Value && SquirtAbilityPatches.nopeShoes.Value) || ((int)((Ability)__instance).p.moveStyle == 3 && SquirtAbilityPatches.triangleGrindINLINE.Value && SquirtAbilityPatches.nopeINLINE.Value) || ((int)((Ability)__instance).p.moveStyle == 2 && SquirtAbilityPatches.triangleGrindINLINE.Value && SquirtAbilityPatches.nopeINLINE.Value) || ((int)((Ability)__instance).p.moveStyle == 1 && SquirtAbilityPatches.triangleGrindINLINE.Value && SquirtAbilityPatches.nopeINLINE.Value))
				{
					__instance.timeSinceLastNode = 0f;
					__instance.speedTarget = ((Ability)__instance).p.stats.grindSpeed;
					bool flag2 = false;
					if (!SquirtAbilityPatches.soapShoes.Value && !((Ability)__instance).p.usingEquippedMovestyle)
					{
						flag2 = true;
						((Ability)__instance).p.SwitchToEquippedMovestyle(true, false, true, true);
					}
					__instance.speed = Mathf.Max(((Ability)__instance).p.boosting ? ((Ability)__instance).p.boostSpeed : ((Ability)__instance).p.stats.grindSpeed, ((Ability)__instance).p.GetForwardSpeed());
					__instance.startTrickNames = __instance.trickingStartTrickNames;
					__instance.trickNames = __instance.trickingTrickNames;
					__instance.trickStandardDuration = __instance.trickingTrickDuration;
					if ((int)((Ability)__instance).p.moveStyle == 2 || (int)((Ability)__instance).p.moveStyle == 4)
					{
						__instance.startTrickNames = __instance.skateboardStartTrickNames;
						__instance.trickNames = __instance.skateboardTrickNames;
						__instance.trickStandardDuration = __instance.skateboardTrickDuration;
					}
					else if ((int)((Ability)__instance).p.moveStyle == 3)
					{
						__instance.startTrickNames = __instance.inlineStartTrickNames;
						__instance.trickNames = __instance.inlineTrickNames;
						__instance.trickStandardDuration = __instance.trickingTrickDuration;
					}
					else if ((int)((Ability)__instance).p.moveStyle == 1)
					{
						__instance.startTrickNames = __instance.bmxStartTrickNames;
						__instance.trickNames = __instance.bmxTrickNames;
						__instance.trickStandardDuration = __instance.bmxTrickDuration;
					}
					Vector3 position = ((Ability)__instance).p.tf.position;
					((Ability)__instance).p.motor.HaveCollision(false);
					((Ability)__instance).p.ForceUnground(true);
					Vector3 playerDirForLine = __instance.GetPlayerDirForLine(setGrindLine);
					__instance.nextNode = setGrindLine.GetNextNode(playerDirForLine);
					((Ability)__instance).p.SetVelocity(Vector3.zero);
					((Ability)__instance).p.ResetVisualRot();
					Vector3 val = setGrindLine.SnapPosToLine(position);
					((Ability)__instance).p.motor.SetPositionTeleport(val);
					__instance.grindLine = setGrindLine;
					__instance.lastPath = __instance.grindLine.Path;
					__instance.posOnLine = (__instance.justFollowNodes ? __instance.grindLine.GetRelativePosOnLine(val, __instance.nextNode) : __instance.grindLine.GetRelativePosOnLine(val, playerDirForLine));
					if (Object.op_Implicit((Object)(object)__instance.grindLine.attachedToEnemyGrindLine))
					{
						__instance.grindingOnEnemy = __instance.grindLine.attachedToEnemyGrindLine;
						__instance.grindingOnEnemy.BeingGrindedByPlayer = true;
					}
					AudioManager audioManager = ((Ability)__instance).p.AudioManager;
					audioManager.PlaySfxGameplay(setGrindLine.sfxCollection, (AudioClipID)327, ((Ability)__instance).p.playerOneShotAudioSource, 0f);
					audioManager.PlaySfxGameplayLooping(setGrindLine.sfxCollection, (AudioClipID)11, ((Ability)__instance).p.playerGrindLoopAudioSource, 0f, 0f);
					((Ability)__instance).p.anim.SetFloat(__instance.grindBoostHash, 0f);
					__instance.grindTilt = (__instance.grindTiltBuffer = Vector2.zero);
					__instance.grindTiltBufferTimer = 0f;
					__instance.softCornerBoost = false;
					((Ability)__instance).p.ActivateAbility((Ability)(object)__instance);
					__instance.normal = __instance.grindLine.GetNormalAtPos(val);
					if (__instance.grindLine.isPole)
					{
						val2 = Vector3.ProjectOnPlane(((Ability)__instance).p.dir * -1f, Vector3.up);
						__instance.normal = ((Vector3)(ref val2)).normalized;
					}
					Vector3 val3 = (__instance.preGrindDir = setGrindLine.GetLineDir(playerDirForLine));
					((Ability)__instance).p.SetRotHard(Quaternion.LookRotation(val3, __instance.normal));
					__instance.StartGrindTrick(true, flag2);
				}
			}
			else if (!flag && (((int)((Ability)__instance).p.moveStyle == 0 && !SquirtAbilityPatches.triangleGrind.Value && !SquirtAbilityPatches.nopeShoes.Value) || ((int)((Ability)__instance).p.moveStyle == 3 && !SquirtAbilityPatches.triangleGrindINLINE.Value && !SquirtAbilityPatches.nopeINLINE.Value) || ((int)((Ability)__instance).p.moveStyle == 2 && !SquirtAbilityPatches.triangleGrindINLINE.Value && !SquirtAbilityPatches.nopeINLINE.Value) || ((int)((Ability)__instance).p.moveStyle == 1 && !SquirtAbilityPatches.triangleGrindINLINE.Value && !SquirtAbilityPatches.nopeINLINE.Value)))
			{
				__instance.timeSinceLastNode = 0f;
				__instance.speedTarget = ((Ability)__instance).p.stats.grindSpeed;
				bool flag3 = false;
				if (!SquirtAbilityPatches.soapShoes.Value && !((Ability)__instance).p.usingEquippedMovestyle)
				{
					flag3 = true;
					((Ability)__instance).p.SwitchToEquippedMovestyle(true, false, true, true);
				}
				__instance.speed = Mathf.Max(((Ability)__instance).p.boosting ? ((Ability)__instance).p.boostSpeed : ((Ability)__instance).p.stats.grindSpeed, ((Ability)__instance).p.GetForwardSpeed());
				__instance.startTrickNames = __instance.trickingStartTrickNames;
				__instance.trickNames = __instance.trickingTrickNames;
				__instance.trickStandardDuration = __instance.trickingTrickDuration;
				if ((int)((Ability)__instance).p.moveStyle == 2 || (int)((Ability)__instance).p.moveStyle == 4)
				{
					__instance.startTrickNames = __instance.skateboardStartTrickNames;
					__instance.trickNames = __instance.skateboardTrickNames;
					__instance.trickStandardDuration = __instance.skateboardTrickDuration;
				}
				else if ((int)((Ability)__instance).p.moveStyle == 3)
				{
					__instance.startTrickNames = __instance.inlineStartTrickNames;
					__instance.trickNames = __instance.inlineTrickNames;
					__instance.trickStandardDuration = __instance.trickingTrickDuration;
				}
				else if ((int)((Ability)__instance).p.moveStyle == 1)
				{
					__instance.startTrickNames = __instance.bmxStartTrickNames;
					__instance.trickNames = __instance.bmxTrickNames;
					__instance.trickStandardDuration = __instance.bmxTrickDuration;
				}
				Vector3 position2 = ((Ability)__instance).p.tf.position;
				((Ability)__instance).p.motor.HaveCollision(false);
				((Ability)__instance).p.ForceUnground(true);
				Vector3 playerDirForLine2 = __instance.GetPlayerDirForLine(setGrindLine);
				__instance.nextNode = setGrindLine.GetNextNode(playerDirForLine2);
				((Ability)__instance).p.SetVelocity(Vector3.zero);
				((Ability)__instance).p.ResetVisualRot();
				Vector3 val4 = setGrindLine.SnapPosToLine(position2);
				((Ability)__instance).p.motor.SetPositionTeleport(val4);
				__instance.grindLine = setGrindLine;
				__instance.lastPath = __instance.grindLine.Path;
				__instance.posOnLine = (__instance.justFollowNodes ? __instance.grindLine.GetRelativePosOnLine(val4, __instance.nextNode) : __instance.grindLine.GetRelativePosOnLine(val4, playerDirForLine2));
				if (Object.op_Implicit((Object)(object)__instance.grindLine.attachedToEnemyGrindLine))
				{
					__instance.grindingOnEnemy = __instance.grindLine.attachedToEnemyGrindLine;
					__instance.grindingOnEnemy.BeingGrindedByPlayer = true;
				}
				AudioManager audioManager2 = ((Ability)__instance).p.AudioManager;
				audioManager2.PlaySfxGameplay(setGrindLine.sfxCollection, (AudioClipID)327, ((Ability)__instance).p.playerOneShotAudioSource, 0f);
				audioManager2.PlaySfxGameplayLooping(setGrindLine.sfxCollection, (AudioClipID)11, ((Ability)__instance).p.playerGrindLoopAudioSource, 0f, 0f);
				((Ability)__instance).p.anim.SetFloat(__instance.grindBoostHash, 0f);
				__instance.grindTilt = (__instance.grindTiltBuffer = Vector2.zero);
				__instance.grindTiltBufferTimer = 0f;
				__instance.softCornerBoost = false;
				((Ability)__instance).p.ActivateAbility((Ability)(object)__instance);
				__instance.normal = __instance.grindLine.GetNormalAtPos(val4);
				if (__instance.grindLine.isPole)
				{
					val2 = Vector3.ProjectOnPlane(((Ability)__instance).p.dir * -1f, Vector3.up);
					__instance.normal = ((Vector3)(ref val2)).normalized;
				}
				Vector3 val5 = (__instance.preGrindDir = setGrindLine.GetLineDir(playerDirForLine2));
				((Ability)__instance).p.SetRotHard(Quaternion.LookRotation(val5, __instance.normal));
				__instance.StartGrindTrick(true, flag3);
			}
			return false;
		}
	}
	[BepInPlugin("info.mariobluegloves.trigrindr", "Woodz Grind Tweaks", "1.0.0")]
	[BepInProcess("Bomb Rush Cyberfunk.exe")]
	public class SquirtAbilityPatches : BaseUnityPlugin
	{
		public static ConfigEntry<bool> soapShoes;

		public static ConfigEntry<bool> nopeShoes;

		public static ConfigEntry<bool> nopeINLINE;

		public static ConfigEntry<bool> nopeSKATEBOARD;

		public static ConfigEntry<bool> nopeBMX;

		public static ConfigEntry<bool> triangleGrind;

		public static ConfigEntry<bool> triangleGrindINLINE;

		public static ConfigEntry<bool> triangleGrindSKATEBOARD;

		public static ConfigEntry<bool> triangleGrindBMX;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("WoodzGrindTweaks");
			val.PatchAll(typeof(GriTAPatchTG));
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"why im sufing rail?");
		}

		private void Update()
		{
			soapShoes = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Soapshoes", true, "Enable soap shoes");
			nopeShoes = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Nopeshoes", true, "Disable starting a grind when on-foot (allows surfing, standing on, or phasing through rails depending on the collision of the rail)");
			nopeINLINE = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NopeInline", false, "Disable starting a grind when on inlines (allows surfing, standing on, or phasing through rails depending on the collision of the rail)");
			nopeSKATEBOARD = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NopeSkateboard", false, "Disable starting a grind when on a skateboard (allows surfing, standing on, or phasing through rails depending on the collision of the rail)");
			nopeBMX = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NopeBMX", false, "Disable starting a grind when on a BMX (allows surfing, standing on, or phasing through rails depending on the collision of the rail)");
			triangleGrind = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriangleGrindShoes", true, "Require a Button 2/Y/Triangle input to start a grind on-foot. The Nopeshoes config setting must be on to take effect.");
			triangleGrindINLINE = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriangleGrindInline", false, "Require a Button 2/Y/Triangle input to start a grind on a skateboard. NopeInline must be on to take effect.");
			triangleGrindSKATEBOARD = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriangleGrindSkateboard", false, "Require a Button 2/Y/Triangle input to start a grind on inlines. NopeSkateboard must be on to take effect.");
			triangleGrindBMX = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriangleGrindBMX", false, "Require a Button 2/Y/Triangle input to start a grind on a BMX. NopeBMX must be on to take effect.");
		}
	}
}