Decompiled source of FastArrow v1.0.0

FastArrow.dll

Decompiled 4 hours 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 BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("MyFirstBoplPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MyFirstBoplPlugin")]
[assembly: AssemblyTitle("MyFirstBoplPlugin")]
[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 MyFirstBoplPlugin
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MyFirstBoplPlugin";

		public const string PLUGIN_NAME = "MyFirstBoplPlugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace instantArrow
{
	public class myPatches
	{
		public static bool Shoot_bowtrans_myplug(Vec2 dir, BowTransform __instance, ref Fix ___ArrowSpeed, ref PlayerBody ___body, ref RingBuffer<BoplBody> ___Arrows, ref BoplBody ___Arrow, ref bool ___hasFired, ref Vec2 ___FirepointOffset, ref Fix ___TimeBeforeArrowsHurtOwner, ref int ___loadingFrame, ref PlayerInfo ___playerInfo, ref int ___maxNumberOfArrows)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0022: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_0118: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i <= 39; i++)
			{
				int num = 0;
				___ArrowSpeed = (Fix)100L;
				Vec2 val = ___body.position + (___FirepointOffset.x + (Fix)(long)num) * ___body.right + ___FirepointOffset.y * ___body.up;
				BoplBody val2 = FixTransform.InstantiateFixed<BoplBody>(___Arrow, val, ___body.rotation);
				val2.gravityScale = (Fix)0L;
				val2.Scale = ___body.fixtrans.Scale;
				Fix val3 = Fix.One + (___body.fixtrans.Scale - Fix.One) / (Fix)2L;
				___Arrows.Add(val2);
				((Component)val2).GetComponent<IPlayerIdHolder>().SetPlayerId(___playerInfo.playerId);
				((Renderer)((Component)val2).GetComponent<SpriteRenderer>()).material = ___playerInfo.playerMaterial;
				val2.StartVelocity = dir * ((Fix)4L + Fix.One) * ___ArrowSpeed * val3 + ___body.selfImposedVelocity;
				((Component)val2).GetComponent<Projectile>().DelayedEnableHurtOwner(___TimeBeforeArrowsHurtOwner * val3 / Vec2.Magnitude(val2.StartVelocity));
				val2.rotation = ___body.rotation;
				___hasFired = true;
			}
			return false;
		}

		public static bool Awake_bowtrans_myplug(BowTransform __instance, ref int ___maxNumberOfArrows)
		{
			___maxNumberOfArrows = 1;
			return true;
		}
	}
	[BepInPlugin("com.Soot.instantArrow", "Instant Arrow", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin instantArrow is loaded!");
			Harmony val = new Harmony("com.Soot.instantArrow");
			MethodInfo methodInfo = AccessTools.Method(typeof(BowTransform), "Shoot", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(myPatches), "Shoot_bowtrans_myplug", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			methodInfo = AccessTools.Method(typeof(BowTransform), "Awake", (Type[])null, (Type[])null);
			methodInfo2 = AccessTools.Method(typeof(myPatches), "Awake_bowtrans_myplug", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "instantArrow";

		public const string PLUGIN_NAME = "instantArrow";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}