Decompiled source of BetterTransportMode v1.0.0

BetterTransportMode.dll

Decompiled 5 hours ago
using System;
using System.Collections.Generic;
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.Logging;
using EntityStates;
using EntityStates.Toolbot;
using Microsoft.CodeAnalysis;
using On.EntityStates.Toolbot;
using RoR2;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BetterTransportMode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterTransportMode")]
[assembly: AssemblyTitle("BetterTransportMode")]
[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 ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace BetterTransportMdoe
{
	[BepInPlugin("BetterTransportMode", "BetterTransportMode", "1.0.0")]
	internal class BetterTransportMode : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ToolbotDash.FixedUpdate += new hook_FixedUpdate(ToolBotFixedUpdate);
		}

		private void ToolBotFixedUpdate(orig_FixedUpdate orig, ToolbotDash self)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Expected O, but got Unknown
			((EntityState)self).fixedAge = ((EntityState)self).fixedAge + ((EntityState)self).GetDeltaTime();
			if (((BaseCharacterMain)self).hasCharacterMotor)
			{
				float num = ((BaseCharacterMain)self).estimatedVelocity.y - ((BaseCharacterMain)self).lastYSpeed;
				if (((BaseState)self).isGrounded && !((BaseCharacterMain)self).wasGrounded && ((BaseCharacterMain)self).hasModelAnimator)
				{
					int layerIndex = ((BaseCharacterMain)self).modelAnimator.GetLayerIndex("Impact");
					if (layerIndex >= 0)
					{
						((BaseCharacterMain)self).modelAnimator.SetLayerWeight(layerIndex, Mathf.Clamp01(Mathf.Max(new float[3]
						{
							0.3f,
							num / 5f,
							((BaseCharacterMain)self).modelAnimator.GetLayerWeight(layerIndex)
						})));
						((BaseCharacterMain)self).modelAnimator.PlayInFixedTime("LightImpact", layerIndex, 0f);
					}
				}
				((BaseCharacterMain)self).wasGrounded = ((BaseState)self).isGrounded;
				((BaseCharacterMain)self).lastYSpeed = ((BaseCharacterMain)self).estimatedVelocity.y;
			}
			if (((BaseCharacterMain)self).hasRootMotionAccumulator)
			{
				Vector3 val = ((BaseCharacterMain)self).rootMotionAccumulator.ExtractRootMotion();
				if (((BaseCharacterMain)self).useRootMotion && val != Vector3.zero && ((EntityState)self).isAuthority)
				{
					if (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor))
					{
						CharacterMotor characterMotor = ((EntityState)self).characterMotor;
						characterMotor.rootMotion += val;
					}
					if (Object.op_Implicit((Object)(object)((EntityState)self).railMotor))
					{
						RailMotor railMotor = ((EntityState)self).railMotor;
						railMotor.rootMotion += val;
					}
				}
			}
			if (((EntityState)self).fixedAge >= self.duration)
			{
				((EntityState)self).outer.SetNextStateToMain();
			}
			else
			{
				if (!((EntityState)self).isAuthority)
				{
					return;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
				{
					((EntityState)self).characterBody.isSprinting = true;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.special) && ((EntityState)self).inputBank.skill4.down)
				{
					((EntityState)self).skillLocator.special.ExecuteIfReady();
				}
				self.UpdateDirection();
				if (!self.inHitPause)
				{
					if (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection))
					{
						((EntityState)self).characterDirection.moveVector = self.idealDirection;
						if (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor) && !((EntityState)self).characterMotor.disableAirControlUntilCollision)
						{
							CharacterMotor characterMotor2 = ((EntityState)self).characterMotor;
							characterMotor2.rootMotion += self.GetIdealVelocity() * ((EntityState)self).GetDeltaTime();
						}
					}
					self.attack.damage = 0f;
					List<HealthComponent> list = new List<HealthComponent>(self.attack.ignoredHealthComponentList);
					if (!self.attack.Fire(self.victimsStruck))
					{
						return;
					}
					self.attack.ResetIgnoredHealthComponents();
					for (int i = 0; i < list.Count; i++)
					{
						self.attack.ignoredHealthComponentList.Add(list[i]);
					}
					Util.PlaySound(ToolbotDash.impactSoundString, ((EntityState)self).gameObject);
					self.inHitPause = true;
					self.hitPauseTimer = ToolbotDash.hitPauseDuration;
					((BaseState)self).AddRecoil(-0.5f * ToolbotDash.recoilAmplitude, -0.5f * ToolbotDash.recoilAmplitude, -0.5f * ToolbotDash.recoilAmplitude, 0.5f * ToolbotDash.recoilAmplitude);
					((EntityState)self).PlayAnimation("Gesture, Additive", ToolbotDash.BoxModeImpactStateHash, ToolbotDash.BoxModeImpactParamHash, ToolbotDash.hitPauseDuration);
					HurtBox val2 = null;
					for (int j = 0; j < self.victimsStruck.Count; j++)
					{
						float num2 = 0f;
						HurtBox val3 = self.victimsStruck[j];
						if (!Object.op_Implicit((Object)(object)val3.healthComponent))
						{
							continue;
						}
						CharacterMotor component = ((Component)val3.healthComponent).GetComponent<CharacterMotor>();
						if (Object.op_Implicit((Object)(object)component))
						{
							num2 = component.mass;
						}
						else
						{
							Rigidbody component2 = ((Component)val3.healthComponent).GetComponent<Rigidbody>();
							if (Object.op_Implicit((Object)(object)component2))
							{
								num2 = component2.mass;
							}
						}
						if (num2 >= ToolbotDash.massThresholdForKnockback)
						{
							val2 = val3;
							break;
						}
					}
					self.attack.damage = ((BaseState)self).damageStat * (ToolbotDash.chargeDamageCoefficient * self.GetDamageBoostFromSpeed());
					if (Object.op_Implicit((Object)(object)val2))
					{
						Debug.Log((object)"Impact");
						((EntityState)self).outer.SetNextState((EntityState)new ToolbotDashImpact
						{
							victimHealthComponent = val2.healthComponent,
							idealDirection = self.idealDirection,
							damageBoostFromSpeed = self.GetDamageBoostFromSpeed(),
							isCrit = self.attack.isCrit
						});
					}
					else
					{
						Debug.Log((object)"Fire");
						self.attack.forceVector = Vector3.zero;
						self.victimsStruck.Clear();
						self.attack.Fire(self.victimsStruck);
					}
				}
				else
				{
					((EntityState)self).characterMotor.velocity = Vector3.zero;
					self.hitPauseTimer -= ((EntityState)self).GetDeltaTime();
					if (self.hitPauseTimer < 0f)
					{
						self.inHitPause = false;
					}
				}
			}
		}
	}
}