Decompiled source of ProjectilePlugin v2.5.0

plugins/CustomData/PathBuilders/Arc_PathBuilder.dll

Decompiled 2 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Arc_PathBuilder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Arc_PathBuilder")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("Arc_PathBuilder")]
[assembly: ComVisible(false)]
[assembly: Guid("ca1050aa-d392-4e1e-a9ad-d52abe2bdf39")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.3.0.0")]
namespace LordAshes;

public class Arc_PathBuilder
{
	public static List<Vector3> MakePath(Vector3 source, Vector3 destination, string parameters, int frames)
	{
		//IL_00a3: 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_00a5: 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_00b1: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: 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_00df: Unknown result type (might be due to invalid IL or missing references)
		if (frames % 2 == 1)
		{
			frames++;
		}
		float[] array = new float[frames];
		float num = 0f;
		float num2 = (((parameters == null) | (parameters == "")) ? 0.25f : float.Parse(parameters, CultureInfo.InvariantCulture));
		Debug.Log((object)("Projectile Plugin: Arc Builder: Elevation Delta " + num2 + ", Frames (Fixed) = " + frames));
		for (int i = 0; i < frames / 2; i++)
		{
			num += num2;
			num2 *= 0.9f;
			array[i] = num;
			array[frames - i - 1] = num;
		}
		List<Vector3> list = new List<Vector3>();
		Vector3 val = (destination - source) / (float)frames;
		for (int j = 0; j < frames; j++)
		{
			Vector3 val2 = source + (float)j * val;
			val2.y += array[j];
			list.Add(val2);
		}
		return list;
	}
}

plugins/CustomData/PathBuilders/Direct_PathBuilder.dll

Decompiled 2 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Direct_PathBuilder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Direct_PathBuilder")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("Direct_PathBuilder")]
[assembly: ComVisible(false)]
[assembly: Guid("ce516f4d-146c-4b91-b36a-ea5b5d78ec0a")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.3.0.0")]
namespace LordAshes;

public class Direct_PathBuilder
{
	public static List<Vector3> MakePath(Vector3 source, Vector3 destination, string parameters, int frames)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		List<Vector3> list = new List<Vector3>();
		Vector3 val = (destination - source) / (float)frames;
		for (int i = 0; i < frames; i++)
		{
			list.Add(source + (float)i * val);
		}
		return list;
	}
}

ProjectilePlugin.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Bounce.Singletons;
using HarmonyLib;
using Newtonsoft.Json;
using RadialUI;
using TMPro;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ProjectilePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProjectilePlugin")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("ProjectilePlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("2.5.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.5.0.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.projectile", "Projectile Plug-In", "2.5.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ProjectilePlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(CreatureBoardAsset), "Pickup")]
	public static class PatchPickup
	{
		public static bool Prefix()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (self.fastSelectionActive != null)
			{
				Debug.Log((object)("Projectile Plugin: Pickup Detected During Fast Selection (With " + (self.selectTarget.Count - 1) + " of " + self.fastSelectionActive.targets + " Entries)"));
				self.target(LocalClient.SelectedCreatureId, self.fastSelectionActive);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(BoardTool), "CallCameraClick")]
	public static class PatchClick
	{
		public static bool Prefix(CameraClickEvent click)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			if (self.fastSelectionActive != null && Input.GetKeyDown((KeyCode)304) && !avoidClickRepeat)
			{
				avoidClickRepeat = true;
				CreatureBoardAsset val = null;
				float3 val2 = default(float3);
				PixelPickingManager.TryGetPickedCreature(ref val2, ref val);
				Debug.Log((object)("Projectile Plugin: Click At " + Convert.ToString(val2)));
				self.target(float3.op_Implicit(val2), self.fastSelectionActive);
				((MonoBehaviour)self).StartCoroutine(ClearClick());
				return false;
			}
			return true;
		}

		private static IEnumerator ClearClick()
		{
			while (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2))
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			Debug.Log((object)"Projectile Plugin: Release");
			avoidClickRepeat = false;
		}
	}

	public class Projectile
	{
		public string name { get; set; }

		public string iconName { get; set; }

		public string assetBundleName { get; set; }

		public string prefabName { get; set; } = "";


		public string morphName { get; set; } = "";


		public float morphDuration { get; set; } = 3f;


		public int targets { get; set; }

		public string pathType { get; set; } = "Arc";


		public string pathParameterString { get; set; } = "";


		public string targetArea { get; set; } = "SPELL";


		public List<P3> sources { get; set; }
	}

	public static class Utility
	{
		public static void PostOnMainPage(MemberInfo plugin)
		{
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Expected O, but got Unknown
				try
				{
					if (((Scene)(ref scene)).name == "UI")
					{
						TextMeshProUGUI uITextByName = GetUITextByName("BETA");
						if (Object.op_Implicit((Object)(object)uITextByName))
						{
							((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods";
						}
					}
					else
					{
						TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text");
						if (Object.op_Implicit((Object)(object)uITextByName2))
						{
							BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin));
							if (((TMP_Text)uITextByName2).text.EndsWith("</size>"))
							{
								((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n";
							}
							TextMeshProUGUI val2 = uITextByName2;
							((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nLord Ashes' " + val.Name + " - " + val.Version;
						}
					}
				}
				catch (Exception ex)
				{
					Debug.Log((object)ex);
				}
			};
		}

		public static bool isBoardLoaded()
		{
			return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
		}

		public static bool StrictKeyCheck(KeyboardShortcut check)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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)
			if (!((KeyboardShortcut)(ref check)).IsUp())
			{
				return false;
			}
			KeyCode[] array = new KeyCode[6];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			KeyCode[] array2 = (KeyCode[])(object)array;
			foreach (KeyCode val in array2)
			{
				if (Input.GetKey(val) != ((KeyboardShortcut)(ref check)).Modifiers.Contains(val))
				{
					return false;
				}
			}
			return true;
		}

		private static TextMeshProUGUI GetUITextByName(string name)
		{
			TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)array[i]).name == name)
				{
					return array[i];
				}
			}
			return null;
		}
	}

	public class P3
	{
		public float x { get; set; }

		public float y { get; set; }

		public float z { get; set; }

		public P3()
		{
		}

		public P3(Vector3 source)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			x = source.x;
			y = source.y;
			z = source.z;
		}

		public Vector3 ToVector3()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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)
			return new Vector3(x, y, z);
		}
	}

	private static bool avoidClickRepeat = false;

	public const string Name = "Projectile Plug-In";

	public const string Guid = "org.lordashes.plugins.projectile";

	public const string Version = "2.5.0.0";

	private ConfigEntry<float> animationLength;

	private ConfigEntry<float> animationSmoothness;

	private ConfigEntry<float> animationStagger;

	private List<Projectile> projectiles = new List<Projectile>();

	private Dictionary<string, Type> pathBuilders = new Dictionary<string, Type>();

	private List<P3> selectTarget = new List<P3>();

	private string attackSelected = "";

	private CreatureGuid attackerCid = default(CreatureGuid);

	private Projectile fastSelectionActive = null;

	private static List<Guid> runningAnimations = new List<Guid>();

	private static Dictionary<CreatureGuid, bool> creaturePermissions = new Dictionary<CreatureGuid, bool>();

	private static ProjectilePlugin self = null;

	private IEnumerator AnimateProjectile(Guid id, Projectile projectile, AssetBundle ab, List<P3> targets, int target)
	{
		yield return (object)new WaitForSeconds(0.1f);
		Debug.Log((object)("Projectile Plugin: Creating " + projectile.name + " Target " + target + " Using " + projectile.prefabName));
		Debug.Log((object)("Projectile Plugin: AB = " + Convert.ToString(Object.op_Implicit((Object)(object)ab))));
		GameObject projectileItem = null;
		try
		{
			Debug.Log((object)"Projectile Plugin: Getting prefab");
			GameObject prefab = ab.LoadAsset<GameObject>(projectile.prefabName);
			Debug.Log((object)("Projectile Plugin: PF = " + Convert.ToString(Object.op_Implicit((Object)(object)prefab))));
			Debug.Log((object)"Projectile Plugin: Making prefab instance");
			projectileItem = Object.Instantiate<GameObject>(prefab);
			projectileItem.transform.localPosition = Vector3.zero;
			projectileItem.transform.localRotation = Quaternion.Euler(Vector3.zero);
		}
		catch
		{
			string[] allAssetNames = ab.GetAllAssetNames();
			foreach (string obj in allAssetNames)
			{
				Debug.Log((object)("Projectile Plugin: AB contains " + obj));
			}
		}
		Debug.Log((object)("Projectile Plugin: GO = " + Convert.ToString(Object.op_Implicit((Object)(object)projectileItem))));
		Debug.Log((object)("Projectile Plugin: Adding Animation From " + Convert.ToString(targets[0].ToVector3()) + " To " + Convert.ToString(targets[target].ToVector3()) + " In " + ((object)animationLength)?.ToString() + " Frames"));
		string builderName = projectile.pathType.ToUpper();
		if (!pathBuilders.ContainsKey(builderName))
		{
			Debug.Log((object)("Projectile Plugin: Did not file Path Builder '" + builderName + "'. Using Path Builder '" + pathBuilders.ElementAt(0).Key + "' Instead."));
			builderName = pathBuilders.ElementAt(0).Key;
		}
		else
		{
			Debug.Log((object)("Projectile Plugin: Using Path Builder " + builderName));
		}
		if (pathBuilders[builderName] != null)
		{
			Debug.Log((object)"Projectile Plugin: Buiding Path");
			List<Vector3> path = (List<Vector3>)pathBuilders[builderName].GetMethod("MakePath").Invoke(null, new object[4]
			{
				targets[0].ToVector3(),
				targets[target].ToVector3(),
				projectile.pathParameterString,
				(int)(animationLength.Value / animationSmoothness.Value)
			});
			Vector3 delayPos = targets[0].ToVector3();
			Debug.Log((object)"Projectile Plugin: Staggering Target If Applicable");
			for (int d = 0; (float)d < animationStagger.Value * (float)(target - 1) / animationSmoothness.Value; d++)
			{
				path.Insert(0, delayPos);
			}
			Debug.Log((object)"Projectile Plugin: Setting Initial Animation Position");
			projectileItem.transform.position = new Vector3(path.ElementAt(0).x, path.ElementAt(0).y, path.ElementAt(0).z + (float)target);
			projectileItem.transform.rotation = Quaternion.Euler(new Vector3(0f, GetAngle(path.ElementAt(path.Count - 1) - path.ElementAt(0)), 0f));
			Debug.Log((object)"Projectile Plugin: Animating Projectile");
			while (path.Count > 0)
			{
				Debug.Log((object)("Projectile Plugin: Animating To Pos " + Convert.ToString(path.ElementAt(0))));
				projectileItem.transform.position = path.ElementAt(0);
				path.RemoveAt(0);
				yield return (object)new WaitForSeconds(animationSmoothness.Value);
			}
			if (projectile.morphName != "")
			{
				Debug.Log((object)"Projectile Plugin: Applying Morph");
				Vector3 pos = projectileItem.transform.position;
				Quaternion rot = projectileItem.transform.rotation;
				Object.Destroy((Object)(object)projectileItem);
				projectileItem = Object.Instantiate<GameObject>(ab.LoadAsset<GameObject>(projectile.morphName));
				projectileItem.transform.position = pos;
				projectileItem.transform.rotation = rot;
				Debug.Log((object)("Projectile Plugin: Waiting Morph Duration (" + projectile.morphDuration + "s)"));
				yield return (object)new WaitForSeconds(projectile.morphDuration);
			}
			Debug.Log((object)"Projectile Plugin: Animation Complete. Destroying Projectile");
			Object.Destroy((Object)(object)projectileItem);
		}
		else
		{
			Debug.Log((object)"Projectile Plugin: Builder Is Null");
		}
		runningAnimations.Remove(id);
	}

	private IEnumerator UnloadAssetBundle(AssetBundle ab)
	{
		while (runningAnimations.Count > 0)
		{
			yield return (object)new WaitForSeconds(1f);
		}
		Debug.Log((object)"Projectile Plugin: Animation Complete. Unloading Asset Bundle");
		ab.Unload(true);
	}

	private float GetAngle(Vector3 delta)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: 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_0089: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: 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)
		double num = 0.0;
		switch (((delta.x >= 0f) ? "+" : "-") + ((delta.z >= 0f) ? "+" : "-"))
		{
		case "--":
			num = Math.Atan(delta.x / delta.z) * 180.0 / Math.PI;
			num += 180.0;
			break;
		case "-+":
			num = Math.Atan(delta.x / delta.z) * 180.0 / Math.PI;
			break;
		case "+-":
			num = Math.Atan(delta.x / delta.z) * 180.0 / Math.PI;
			num += 180.0;
			break;
		case "++":
			num = Math.Atan(delta.x / delta.z) * 180.0 / Math.PI;
			break;
		}
		return (float)num;
	}

	private void Awake()
	{
		//IL_054d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0553: Expected O, but got Unknown
		Debug.Log((object)("Projectile Plugin: " + ((object)this).GetType().AssemblyQualifiedName + " is Active."));
		self = this;
		animationLength = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Projectile Animation Length In Frames", 3f, (ConfigDescription)null);
		animationSmoothness = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Projectile Animation Interval Between Updates In Seconds", 0.1f, (ConfigDescription)null);
		animationStagger = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Projectile Animation Stagger For Muliple Targets In Seconds", 0.25f, (ConfigDescription)null);
		foreach (string item in from file in File.Catalog(false)
			where file.ToUpper().EndsWith(".PROJECTILE")
			select file)
		{
			Debug.Log((object)("Projectile Plugin: Found " + item));
			string text = File.ReadAllText(item, (CacheType)999);
			Debug.Log((object)("Projectile Plugin: " + text));
			projectiles.Add(JsonConvert.DeserializeObject<Projectile>(text));
		}
		RadialSubmenu.EnsureMainMenuItem("org.lordashes.plugins.projectile", (MenuType)1, "Projectiles", Image.LoadSprite("Projectile.png", (CacheType)999));
		foreach (Projectile projectile in projectiles)
		{
			for (int j = 1; j <= projectile.targets; j++)
			{
				int tgt = j;
				if (tgt == 1)
				{
					RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.projectile", projectile.name + " (Target " + tgt + " of " + projectile.targets + ")", Image.LoadSprite(projectile.iconName, (CacheType)999), (Action<CreatureGuid, string, MapMenuItem>)delegate(CreatureGuid c, string n, MapMenuItem i)
					{
						//IL_0007: Unknown result type (might be due to invalid IL or missing references)
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0017: Unknown result type (might be due to invalid IL or missing references)
						attackerCid = LocalClient.SelectedCreatureId;
						target(c, projectile);
					}, true, (Func<bool>)(() => MenuDecide(projectile, tgt)));
				}
				else
				{
					RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.projectile", projectile.name + " (Target " + tgt + " of " + projectile.targets + ")", Image.LoadSprite(projectile.iconName, (CacheType)999), (Action<CreatureGuid, string, MapMenuItem>)delegate(CreatureGuid c, string n, MapMenuItem i)
					{
						//IL_0007: Unknown result type (might be due to invalid IL or missing references)
						target(c, projectile);
					}, true, (Func<bool>)(() => MenuDecide(projectile, tgt)));
				}
			}
		}
		foreach (string item2 in from file in File.Catalog(true)
			where file.ToUpper().Contains("_PATHBUILDER.DLL")
			select file)
		{
			string text2 = item2.Substring(item2.LastIndexOf("(") + 1).Trim();
			text2 = text2.Substring(0, text2.Length - 1);
			string text3 = item2.Substring(0, item2.LastIndexOf("(")).Trim();
			string text4 = text2 + text3;
			Assembly assembly = Assembly.LoadFrom(text4);
			string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text4);
			fileNameWithoutExtension = fileNameWithoutExtension.Substring(0, fileNameWithoutExtension.LastIndexOf("_"));
			Type[] types = assembly.GetTypes();
			foreach (Type type in types)
			{
				MethodInfo[] methods = type.GetMethods();
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.Name == "MakePath")
					{
						pathBuilders.Add(fileNameWithoutExtension.ToUpper(), type);
					}
					Debug.Log((object)("Projectile Plugin: PathBuilder " + fileNameWithoutExtension.ToUpper() + " Version " + assembly.ImageRuntimeVersion + " => " + Convert.ToString(type)));
				}
			}
		}
		Debug.Log((object)"Projectile Plugin: Subscribing to projectile request.");
		AssetDataPlugin.Subscribe("org.lordashes.plugins.projectile", (Action<DatumChange>)HandleRequest);
		Harmony val = new Harmony("org.lordashes.plugins.projectile");
		val.PatchAll();
		Utility.PostOnMainPage(((object)this).GetType());
	}

	private bool MenuDecide(Projectile p, int t)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		if (selectTarget.Count == 0)
		{
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)"Projectile Plugin: Adding Attacker To Targets List");
				selectTarget.Add(new P3(val.GetHook((HookTransform)1).position));
				AllowSelection();
			}
		}
		if (attackSelected != p.name && attackSelected != "")
		{
			Debug.Log((object)("Projectile Plugin: Menu Check: " + p.name + " (" + t + ") => Rejected For Attack Name"));
			return false;
		}
		if (t != selectTarget.Count)
		{
			Debug.Log((object)("Projectile Plugin: Menu Check: " + p.name + " (" + t + ") => Rejected For Target Count"));
			return false;
		}
		Debug.Log((object)("Projectile Plugin: Menu Check: " + p.name + " (" + t + ") => OK"));
		return true;
	}

	private void target(CreatureGuid cid, Projectile p)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: 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_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		if (attackSelected == "")
		{
			Debug.Log((object)("Projectile Plugin: Projectile Attack '" + p.name + "' Selected"));
			attackSelected = p.name;
		}
		Debug.Log((object)"Projectile Plugin: Target Selected");
		if (cid == attackerCid)
		{
			Debug.Log((object)"Projectile Plugin: Fast Selection Activated");
			fastSelectionActive = p;
			Debug.Log((object)"Projectile Plugin: Triggering Click Avoidance");
			((MonoBehaviour)this).StartCoroutine(DelayClickCollection(1f));
		}
		else
		{
			Debug.Log((object)"Projectile Plugin: Adding Target");
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(cid, ref val);
			if ((Object)(object)val != (Object)null)
			{
				switch (p.targetArea.ToUpper())
				{
				case "HEAD":
					selectTarget.Add(new P3(val.HookHead.position));
					break;
				case "CAST":
				case "SPELL":
					selectTarget.Add(new P3(val.GetHook((HookTransform)1).position));
					break;
				case "TORCH":
					selectTarget.Add(new P3(val.GetHook((HookTransform)3).position));
					break;
				default:
					selectTarget.Add(new P3(val.GetHook((HookTransform)2).position));
					break;
				}
			}
		}
		if (selectTarget.Count > p.targets)
		{
			fire(p);
		}
		else if (fastSelectionActive != null)
		{
			SystemMessage.DisplayInfoText(p.name + "\r\nSelect Target " + selectTarget.Count + " of " + p.targets, 2.5f);
		}
	}

	private void target(Vector3 pos, Projectile p)
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		if (attackSelected == "")
		{
			Debug.Log((object)("Projectile Plugin: Projectile Attack '" + p.name + "' Selected"));
			attackSelected = p.name;
		}
		Debug.Log((object)"Projectile Plugin: Target Selected");
		selectTarget.Add(new P3(pos));
		if (selectTarget.Count > p.targets)
		{
			fire(p);
		}
		else if (fastSelectionActive != null)
		{
			SystemMessage.DisplayInfoText(p.name + "\r\nSelect Target " + selectTarget.Count + " of " + p.targets, 2.5f);
		}
	}

	private void fire(Projectile p)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Projectile Plugin: Targetting Complete");
		p.sources = selectTarget;
		AssetDataPlugin.SendInfo("org.lordashes.plugins.projectile", JsonConvert.SerializeObject((object)p));
		attackSelected = "";
		attackerCid = default(CreatureGuid);
		selectTarget.Clear();
		fastSelectionActive = null;
		DenySelection();
	}

	private void HandleRequest(DatumChange change)
	{
		try
		{
			Projectile projectile = JsonConvert.DeserializeObject<Projectile>(change.value.ToString());
			Debug.Log((object)("Projectile Plugin: Getting Projectile Name " + projectile.name));
			List<P3> sources = projectile.sources;
			if (projectile.prefabName == "")
			{
				projectile.prefabName = projectile.assetBundleName;
			}
			Debug.Log((object)("Projectile Plugin: Getting Projectile Asset Bundle " + projectile.assetBundleName + " Prefab " + projectile.prefabName + " Morph " + ((projectile.morphName == "") ? "None" : projectile.morphName)));
			AssetBundle val = AssetBundle.Load(projectile.assetBundleName + ".assetBundle", (CacheType)999);
			if ((Object)(object)val != (Object)null)
			{
				runningAnimations = new List<Guid>();
				for (int i = 1; i < sources.Count; i++)
				{
					runningAnimations.Add(System.Guid.NewGuid());
					((MonoBehaviour)this).StartCoroutine(AnimateProjectile(runningAnimations.ElementAt(runningAnimations.Count - 1), projectile, val, sources, i));
				}
				((MonoBehaviour)this).StartCoroutine(UnloadAssetBundle(val));
			}
			else
			{
				Debug.Log((object)("Projectile Plugin: Error Loading Asset Bundle " + projectile.assetBundleName));
			}
		}
		catch (Exception ex)
		{
			Debug.Log((object)"Projectile Plugin: Exception Processing Projectile");
			Debug.LogException(ex);
		}
	}

	private IEnumerator DelayClickCollection(float delay)
	{
		Debug.Log((object)"Projectile Plugin: Selection Mode. Avoiding Click Patch Start");
		avoidClickRepeat = true;
		yield return (object)new WaitForSeconds(delay);
		avoidClickRepeat = false;
		Debug.Log((object)"Projectile Plugin: Selection Mode. Avoiding Click Patch End");
	}

	private void AllowSelection()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		creaturePermissions.Clear();
		foreach (CreatureBoardAsset item in (IEnumerable<CreatureBoardAsset>)CreaturePresenter.GetTempReadOnlyViewOfAllCreatureAssets())
		{
			PlayerGuid[] source = null;
			CreatureManager.TryGetCreaturesOwnerIds(item.CreatureId, ref source);
			bool value = source.Contains(LocalPlayer.Id);
			creaturePermissions.Add(item.CreatureId, value);
			string[] obj = new string[5] { "Projectile Plugin: Setting Allowing Selection For ", null, null, null, null };
			CreatureGuid creatureId = item.CreatureId;
			obj[1] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj[2] = " From ";
			obj[3] = value.ToString();
			obj[4] = " To true";
			Debug.Log((object)string.Concat(obj));
			CreatureManager.GivePlayerControlOfCreature(LocalPlayer.Id, LocalPlayer.Id, item.CreatureId);
		}
	}

	private void DenySelection()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_0041: 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_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		foreach (CreatureBoardAsset item in (IEnumerable<CreatureBoardAsset>)CreaturePresenter.GetTempReadOnlyViewOfAllCreatureAssets())
		{
			if (creaturePermissions.ContainsKey(item.CreatureId))
			{
				CreatureGuid creatureId;
				if (!creaturePermissions[item.CreatureId])
				{
					string[] obj = new string[5] { "Projectile Plugin: Setting Allowing Selection For ", null, null, null, null };
					creatureId = item.CreatureId;
					obj[1] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj[2] = " From true To ";
					obj[3] = creaturePermissions[item.CreatureId].ToString();
					obj[4] = " (Revoke)";
					Debug.Log((object)string.Concat(obj));
					CreatureManager.RevokePlayerControlOfCreature(LocalPlayer.Id, LocalPlayer.Id, item.CreatureId);
				}
				else
				{
					string[] obj2 = new string[5] { "Projectile Plugin: Setting Allowing Selection For ", null, null, null, null };
					creatureId = item.CreatureId;
					obj2[1] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj2[2] = " From true To ";
					obj2[3] = creaturePermissions[item.CreatureId].ToString();
					obj2[4] = " (No Action)";
					Debug.Log((object)string.Concat(obj2));
				}
			}
			else
			{
				Debug.Log((object)"Projectile Plugin: Unknown Creature. Keeping Permissions As Is");
			}
		}
		creaturePermissions.Clear();
	}
}