Decompiled source of ArrowShotgun v1.0.0

arrowShotgun.dll

Decompiled a month 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 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("arrowShotgun")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("arrowShotgun")]
[assembly: AssemblyTitle("arrowShotgun")]
[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 arrowShotgun
{
	[BepInPlugin("com.erwer.arrowShotgun", "arrowShotgun", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.erwer.arrowShotgun";

		public const string PLUGIN_NAME = "arrowShotgun";

		public const string PLUGIN_VERSION = "1.0.0";

		internal static ConfigFile config;

		internal static ConfigEntry<float> arrowSpread;

		internal static ConfigEntry<int> arrowCount;

		public void Awake()
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.erwer.arrowShotgun is loaded!");
			config = ((BaseUnityPlugin)this).Config;
			arrowSpread = config.Bind<float>("Settings", "Arrow Spread / Extents", 0.3f, "Minimum is 0.0 (Negitives default to 0).\n MAX : 1\n Suggested Value : 0.3f");
			if (arrowSpread.Value < 0f)
			{
				arrowSpread.Value = 0f;
			}
			if (arrowSpread.Value > 1f)
			{
				arrowSpread.Value = 1f;
			}
			arrowCount = config.Bind<int>("Settings", "Arrow Count", 6, "Minimum is 0.0 (Negitives default to 0).\n MAX : 100\n Suggested Value : 6f");
			if ((float)arrowCount.Value < 0f)
			{
				arrowCount.Value = 0;
			}
			if ((float)arrowCount.Value > 100f)
			{
				arrowCount.Value = 100;
			}
			Harmony val = new Harmony("com.erwer.arrowShotgun");
			val.PatchAll(typeof(Patches));
		}
	}
	internal class Patches
	{
		[HarmonyPatch(typeof(BowTransform), "Shoot")]
		[HarmonyPrefix]
		public static bool Shotgun(Vec2 dir, BowTransform __instance, ref Fix ___ArrowSpeed, ref PlayerBody ___body, ref BoplBody ___Arrow, ref bool ___hasFired, ref Fix ___TimeBeforeArrowsHurtOwner, ref PlayerInfo ___playerInfo, ref int ___maxNumberOfArrows)
		{
			//IL_0016: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			int value = Plugin.arrowCount.Value;
			Fix val = (Fix)Plugin.arrowSpread.Value;
			Vec2 val4 = default(Vec2);
			for (int i = 0; i < value; i++)
			{
				Vec2 position = ___body.position;
				Fix val2 = Fix.One + (___body.fixtrans.Scale - Fix.One) / (Fix)2L;
				BoplBody val3 = FixTransform.InstantiateFixed<BoplBody>(___Arrow, position, ___body.rotation);
				val3.Scale = ___body.fixtrans.Scale;
				val3.rotation = ___body.rotation;
				val3.position = position;
				((Vec2)(ref val4))..ctor(Updater.RandomFix(-val, val), Updater.RandomFix(-val, val));
				val3.StartVelocity = (dir + val4) * ((Fix)4L + Fix.One) * ___ArrowSpeed * val2 + ___body.selfImposedVelocity;
				((Renderer)((Component)val3).GetComponent<SpriteRenderer>()).material = ___playerInfo.playerMaterial;
				((Component)val3).GetComponent<IPlayerIdHolder>().SetPlayerId(___playerInfo.playerId);
				((Component)val3).GetComponent<Projectile>().DelayedEnableHurtOwner(___TimeBeforeArrowsHurtOwner * val2 / Vec2.Magnitude(val3.StartVelocity));
			}
			___hasFired = true;
			___maxNumberOfArrows = 7;
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "arrowShotgun";

		public const string PLUGIN_NAME = "arrowShotgun";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}