Decompiled source of Woodz Grind Tweaks v1.1.0

TriGrindr.dll

Decompiled 2 months 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
	{
		public static void SetToLineGT(GrindAbility grindAbility, GrindLine setGrindLine)
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Invalid comparison between Unknown and I4
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Invalid comparison between Unknown and I4
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Invalid comparison between Unknown and I4
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Invalid comparison between Unknown and I4
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: 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_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: 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_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			grindAbility.timeSinceLastNode = 0f;
			grindAbility.speedTarget = ((Ability)grindAbility).p.stats.grindSpeed;
			bool flag = false;
			if (!SquirtAbilityPatches.soapShoes.Value && !((Ability)grindAbility).p.usingEquippedMovestyle)
			{
				flag = true;
				((Ability)grindAbility).p.SwitchToEquippedMovestyle(true, false, true, true);
			}
			grindAbility.speed = Mathf.Max(((Ability)grindAbility).p.boosting ? ((Ability)grindAbility).p.boostSpeed : ((Ability)grindAbility).p.stats.grindSpeed, ((Ability)grindAbility).p.GetForwardSpeed());
			grindAbility.startTrickNames = grindAbility.trickingStartTrickNames;
			grindAbility.trickNames = grindAbility.trickingTrickNames;
			grindAbility.trickStandardDuration = grindAbility.trickingTrickDuration;
			if ((int)((Ability)grindAbility).p.moveStyle == 2 || (int)((Ability)grindAbility).p.moveStyle == 4)
			{
				grindAbility.startTrickNames = grindAbility.skateboardStartTrickNames;
				grindAbility.trickNames = grindAbility.skateboardTrickNames;
				grindAbility.trickStandardDuration = grindAbility.skateboardTrickDuration;
			}
			else if ((int)((Ability)grindAbility).p.moveStyle == 3)
			{
				grindAbility.startTrickNames = grindAbility.inlineStartTrickNames;
				grindAbility.trickNames = grindAbility.inlineTrickNames;
				grindAbility.trickStandardDuration = grindAbility.trickingTrickDuration;
			}
			else if ((int)((Ability)grindAbility).p.moveStyle == 1)
			{
				grindAbility.startTrickNames = grindAbility.bmxStartTrickNames;
				grindAbility.trickNames = grindAbility.bmxTrickNames;
				grindAbility.trickStandardDuration = grindAbility.bmxTrickDuration;
			}
			Vector3 position = ((Ability)grindAbility).p.tf.position;
			((Ability)grindAbility).p.motor.HaveCollision(false);
			((Ability)grindAbility).p.ForceUnground(true);
			Vector3 playerDirForLine = grindAbility.GetPlayerDirForLine(setGrindLine);
			grindAbility.nextNode = setGrindLine.GetNextNode(playerDirForLine);
			((Ability)grindAbility).p.SetVelocity(Vector3.zero);
			((Ability)grindAbility).p.ResetVisualRot();
			Vector3 val = setGrindLine.SnapPosToLine(position);
			((Ability)grindAbility).p.motor.SetPositionTeleport(val);
			grindAbility.grindLine = setGrindLine;
			grindAbility.lastPath = grindAbility.grindLine.Path;
			grindAbility.posOnLine = (grindAbility.justFollowNodes ? grindAbility.grindLine.GetRelativePosOnLine(val, grindAbility.nextNode) : grindAbility.grindLine.GetRelativePosOnLine(val, playerDirForLine));
			if (Object.op_Implicit((Object)(object)grindAbility.grindLine.attachedToEnemyGrindLine))
			{
				grindAbility.grindingOnEnemy = grindAbility.grindLine.attachedToEnemyGrindLine;
				grindAbility.grindingOnEnemy.BeingGrindedByPlayer = true;
			}
			AudioManager audioManager = ((Ability)grindAbility).p.AudioManager;
			audioManager.PlaySfxGameplay(setGrindLine.sfxCollection, (AudioClipID)327, ((Ability)grindAbility).p.playerOneShotAudioSource, 0f);
			audioManager.PlaySfxGameplayLooping(setGrindLine.sfxCollection, (AudioClipID)11, ((Ability)grindAbility).p.playerGrindLoopAudioSource, 0f, 0f);
			((Ability)grindAbility).p.anim.SetFloat(grindAbility.grindBoostHash, 0f);
			grindAbility.grindTilt = (grindAbility.grindTiltBuffer = Vector2.zero);
			grindAbility.grindTiltBufferTimer = 0f;
			grindAbility.softCornerBoost = false;
			((Ability)grindAbility).p.ActivateAbility((Ability)(object)grindAbility);
			grindAbility.normal = grindAbility.grindLine.GetNormalAtPos(val);
			if (grindAbility.grindLine.isPole)
			{
				Vector3 val2 = Vector3.ProjectOnPlane(((Ability)grindAbility).p.dir * -1f, Vector3.up);
				grindAbility.normal = ((Vector3)(ref val2)).normalized;
			}
			Vector3 val3 = (grindAbility.preGrindDir = setGrindLine.GetLineDir(playerDirForLine));
			((Ability)grindAbility).p.SetRotHard(Quaternion.LookRotation(val3, grindAbility.normal));
			grindAbility.StartGrindTrick(true, flag);
		}

		[HarmonyPatch(typeof(GrindAbility), "SetToLine")]
		[HarmonyPrefix]
		private static bool GriTAPatchPreFix(GrindAbility __instance, GrindLine setGrindLine)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Invalid comparison between Unknown and I4
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Invalid comparison between Unknown and I4
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Invalid comparison between Unknown and I4
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Invalid comparison between Unknown and I4
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Invalid comparison between Unknown and I4
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Invalid comparison between Unknown and I4
			//IL_0168: 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_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Invalid comparison between Unknown and I4
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Invalid comparison between Unknown and I4
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Invalid comparison between Unknown and I4
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Invalid comparison between Unknown and I4
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Invalid comparison between Unknown and I4
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Invalid comparison between Unknown and I4
			bool flag = false;
			bool flag2 = false;
			flag = ((((Ability)__instance).p.trick2ButtonNew || ((Ability)__instance).p.trick2ButtonHeld) ? true : false);
			if (((int)((Ability)__instance).p.moveStyle != 0 && (int)((Ability)__instance).p.moveStyle != 3 && (int)((Ability)__instance).p.moveStyle != 2 && (int)((Ability)__instance).p.moveStyle != 1) ? true : false)
			{
				SetToLineGT(__instance, setGrindLine);
			}
			else if (!SquirtAbilityPatches.invertTriangleGrinds.Value)
			{
				if ((flag && (int)((Ability)__instance).p.moveStyle == 0 && SquirtAbilityPatches.triangleGrind.Value && SquirtAbilityPatches.nopeShoes.Value) || (flag && (int)((Ability)__instance).p.moveStyle == 3 && SquirtAbilityPatches.triangleGrindINLINE.Value && SquirtAbilityPatches.nopeINLINE.Value) || (flag && (int)((Ability)__instance).p.moveStyle == 2 && SquirtAbilityPatches.triangleGrindSKATEBOARD.Value && SquirtAbilityPatches.nopeSKATEBOARD.Value) || (flag && (int)((Ability)__instance).p.moveStyle == 1 && SquirtAbilityPatches.triangleGrindBMX.Value && SquirtAbilityPatches.nopeBMX.Value))
				{
					SetToLineGT(__instance, setGrindLine);
				}
				else 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.triangleGrindSKATEBOARD.Value && !SquirtAbilityPatches.nopeSKATEBOARD.Value) || ((int)((Ability)__instance).p.moveStyle == 1 && !SquirtAbilityPatches.triangleGrindBMX.Value && !SquirtAbilityPatches.nopeBMX.Value))
				{
					SetToLineGT(__instance, setGrindLine);
				}
			}
			else if ((flag && (int)((Ability)__instance).p.moveStyle == 0 && SquirtAbilityPatches.triangleGrind.Value && SquirtAbilityPatches.nopeShoes.Value) || (flag && (int)((Ability)__instance).p.moveStyle == 3 && SquirtAbilityPatches.triangleGrindINLINE.Value && SquirtAbilityPatches.nopeINLINE.Value) || (flag && (int)((Ability)__instance).p.moveStyle == 2 && SquirtAbilityPatches.triangleGrindSKATEBOARD.Value && SquirtAbilityPatches.nopeSKATEBOARD.Value) || (flag && (int)((Ability)__instance).p.moveStyle == 1 && SquirtAbilityPatches.triangleGrindBMX.Value && SquirtAbilityPatches.nopeBMX.Value))
			{
				SetToLineGT(__instance, setGrindLine);
			}
			else if ((!flag && (int)((Ability)__instance).p.moveStyle == 0 && !SquirtAbilityPatches.triangleGrind.Value && !SquirtAbilityPatches.nopeShoes.Value) || (!flag && (int)((Ability)__instance).p.moveStyle == 3 && !SquirtAbilityPatches.triangleGrindINLINE.Value && !SquirtAbilityPatches.nopeINLINE.Value) || (!flag && (int)((Ability)__instance).p.moveStyle == 2 && !SquirtAbilityPatches.triangleGrindSKATEBOARD.Value && !SquirtAbilityPatches.nopeSKATEBOARD.Value) || (!flag && (int)((Ability)__instance).p.moveStyle == 1 && !SquirtAbilityPatches.triangleGrindBMX.Value && !SquirtAbilityPatches.nopeBMX.Value))
			{
				SetToLineGT(__instance, setGrindLine);
			}
			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;

		public static ConfigEntry<bool> invertTriangleGrinds;

		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.");
			invertTriangleGrinds = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "InvertTriangleGrinds", false, "If this is enabled, setting triangle grind to false for a movestyle will make it so that if you're holding Button 2/Y/Triangle you will not be able to start a grind. Think of it as \"Hold Y to not grind.\"");
		}
	}
}