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 ModdingTales;
using Newtonsoft.Json;
using RadialUI;
using Unity.Mathematics;
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("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("3.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("3.0.0.0")]
namespace LordAshes;
[BepInPlugin("org.lordashes.plugins.projectile", "Projectile Plug-In", "3.0.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(BoardTool), "CallCameraClick")]
public static class PatchClick
{
public static bool Prefix(CameraClickEvent click)
{
//IL_0011: 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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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)
string[] obj = new string[7] { "User Click At ", null, null, null, null, null, null };
Vector2 position = click.position;
obj[1] = ((object)(Vector2)(ref position)).ToString();
obj[2] = " (AvoidClick=";
obj[3] = avoidClickRepeat.ToString();
obj[4] = ", activeProjectile==";
obj[5] = (activeProjectile != null).ToString();
obj[6] = ")";
LoggingPlugin.LogDebug(string.Concat(obj));
if (!avoidClickRepeat && activeProjectile != null)
{
((MonoBehaviour)self).StartCoroutine(preventClickCollection(1000f));
LoggingPlugin.LogTrace("Click While Selection Mode Active");
CreatureBoardAsset val = null;
float3 val2 = default(float3);
PixelPickingManager.TryGetPickedCreature(ref val2, ref val);
if (Input.GetMouseButtonDown(2))
{
LoggingPlugin.LogDebug("Triggering Projectile " + activeProjectile.name + " With Less Targets");
fire();
}
else if ((Object)(object)val != (Object)null)
{
string[] obj2 = new string[5] { "Selection of Creature ", val.Name, " (", null, null };
CreatureGuid creatureId = val.CreatureId;
obj2[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
obj2[4] = ")";
LoggingPlugin.LogDebug(string.Concat(obj2));
addAttackTarget(val);
}
else
{
LoggingPlugin.LogDebug("Selection of Location " + ((object)(float3)(ref val2)).ToString());
ProjectilePlugin.addAttackTarget(new Vector3(val2.x, val2.y, val2.z));
}
return false;
}
return true;
}
}
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 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);
}
}
public static class Utility
{
public static void PostOnMainPage(BaseUnityPlugin plugin)
{
string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
ModdingUtils.AddPluginToMenuList(plugin, text);
}
public static bool isBoardLoaded()
{
return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
}
public static GameObject FindInHierarchy(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: true, ref results, ref done);
return (results.Count > 0) ? results.ElementAt(0) : null;
}
public static GameObject FindInHierarchyViaPartialName(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: true, ref results, ref done, partial: true);
return (results.Count > 0) ? results.ElementAt(0) : null;
}
public static GameObject[] FindAllInHierarchy(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: false, ref results, ref done);
return results.ToArray();
}
public static GameObject[] FindAllInHierarchyViaPartialName(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: false, ref results, ref done, partial: true);
return results.ToArray();
}
public static GameObject FindWithComponentInHierarchy(GameObject start, string seekType)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, null, seekType, single: true, ref results, ref done);
return (results.Count > 0) ? results.ElementAt(0) : null;
}
public static GameObject[] FindAllWithComponentInHierarchy<T>(GameObject start, string seekType)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, null, seekType, single: false, ref results, ref done);
return results.ToArray();
}
public static void Traverse(Transform root, string seekName, string seekType, bool single, ref List<GameObject> results, ref bool done, bool partial = false)
{
try
{
LoggingPlugin.LogTrace("Found '" + ((Object)((Component)root).gameObject).name + "' While Seeking Component Type '" + Convert.ToString(seekType) + "' And Name '" + Convert.ToString(seekName) + "' With Partial " + partial);
if ((seekName == null || seekName == ((Object)((Component)root).gameObject).name || (partial && ((Object)((Component)root).gameObject).name.Contains(seekName))) && (seekType == null || (Object)(object)((Component)root).GetComponent(seekType) != (Object)null))
{
LoggingPlugin.LogTrace("Matched '" + ((Object)((Component)root).gameObject).name + "'");
results.Add(((Component)root).gameObject);
if (single)
{
done = true;
return;
}
}
foreach (Transform item in ExtensionMethods.Children(root))
{
if (!done)
{
Traverse(item, seekName, seekType, single, ref results, ref done, partial);
}
}
}
catch
{
}
}
}
private static bool avoidClickRepeat = false;
public const string Name = "Projectile Plug-In";
public const string Guid = "org.lordashes.plugins.projectile";
public const string Version = "3.0.0.0";
public const string Author = "Lord Ashes";
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 static List<Guid> runningAnimations = new List<Guid>();
private static Dictionary<CreatureGuid, bool> creaturePermissions = new Dictionary<CreatureGuid, bool>();
private static ProjectilePlugin self = null;
private static Projectile activeProjectile = null;
private static Dictionary<string, Texture2D[]> icons = new Dictionary<string, Texture2D[]>();
private IEnumerator AnimateProjectile(Guid id, Projectile projectile, AssetBundle ab, List<P3> targets, int target)
{
yield return (object)new WaitForSeconds(0.1f);
LoggingPlugin.LogDebug("Creating " + projectile.name + " Target " + target + " Using " + projectile.prefabName);
LoggingPlugin.LogTrace("AB = " + Convert.ToString(Object.op_Implicit((Object)(object)ab)));
GameObject projectileItem = null;
try
{
LoggingPlugin.LogTrace("Getting prefab");
GameObject prefab = ab.LoadAsset<GameObject>(projectile.prefabName);
LoggingPlugin.LogTrace("PF = " + Convert.ToString(Object.op_Implicit((Object)(object)prefab)));
LoggingPlugin.LogTrace("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)
{
LoggingPlugin.LogTrace("AB contains " + obj);
}
}
LoggingPlugin.LogTrace("GO = " + Convert.ToString(Object.op_Implicit((Object)(object)projectileItem)));
LoggingPlugin.LogTrace("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))
{
LoggingPlugin.LogTrace("Did not file Path Builder '" + builderName + "'. Using Path Builder '" + pathBuilders.ElementAt(0).Key + "' Instead.");
builderName = pathBuilders.ElementAt(0).Key;
}
else
{
LoggingPlugin.LogTrace("Using Path Builder " + builderName);
}
if (pathBuilders[builderName] != null)
{
LoggingPlugin.LogTrace("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();
LoggingPlugin.LogTrace("Staggering Target If Applicable");
for (int d = 0; (float)d < animationStagger.Value * (float)(target - 1) / animationSmoothness.Value; d++)
{
path.Insert(0, delayPos);
}
LoggingPlugin.LogTrace("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));
LoggingPlugin.LogTrace("Animating Projectile");
while (path.Count > 0)
{
LoggingPlugin.LogTrace("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 != "")
{
LoggingPlugin.LogInfo("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;
LoggingPlugin.LogTrace("Waiting Morph Duration (" + projectile.morphDuration + "s)");
yield return (object)new WaitForSeconds(projectile.morphDuration);
}
LoggingPlugin.LogTrace("Animation Complete. Destroying Projectile");
Object.Destroy((Object)(object)projectileItem);
}
else
{
LoggingPlugin.LogWarning("Builder Is Null");
}
runningAnimations.Remove(id);
}
private IEnumerator UnloadAssetBundle(AssetBundle ab)
{
while (runningAnimations.Count > 0)
{
yield return (object)new WaitForSeconds(1f);
}
LoggingPlugin.LogTrace("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 static IEnumerator preventClickCollection(float delay)
{
LoggingPlugin.LogTrace("Preventing click");
avoidClickRepeat = true;
yield return (object)new WaitForSeconds(delay / 1000f);
avoidClickRepeat = false;
LoggingPlugin.LogTrace("Allowing click");
}
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0533: Unknown result type (might be due to invalid IL or missing references)
//IL_0539: Expected O, but got Unknown
self = this;
LoggingPlugin.SetLogLevel(((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostic Level", (DiagnosticLevel)3, (ConfigDescription)null).Value);
string? assemblyQualifiedName = ((object)this).GetType().AssemblyQualifiedName;
DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
LoggingPlugin.LogInfo(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")");
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)
{
LoggingPlugin.LogInfo("Found " + item);
string text = File.ReadAllText(item, (CacheType)999);
LoggingPlugin.LogInfo(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)
{
string text2 = ((projectile.targets > 0) ? projectile.targets.ToString() : "Unlimited");
RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.projectile", projectile.name + " (" + text2 + " Target" + ((projectile.targets > 1) ? "s" : "") + ")", Image.LoadSprite(projectile.iconName, (CacheType)999), (Action<CreatureGuid, string, MapMenuItem>)delegate(CreatureGuid c, string n, MapMenuItem i)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
startAttackSelection(c, projectile);
}, true, (Func<bool>)null);
}
foreach (string item2 in from file in File.Catalog(true)
where file.ToUpper().Contains("_PATHBUILDER.DLL")
select file)
{
string text3 = item2.Substring(item2.LastIndexOf("(") + 1).Trim();
text3 = text3.Substring(0, text3.Length - 1);
string text4 = item2.Substring(0, item2.LastIndexOf("(")).Trim();
string text5 = text3 + text4;
Assembly assembly = Assembly.LoadFrom(text5);
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text5);
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);
}
LoggingPlugin.LogInfo("PathBuilder " + fileNameWithoutExtension.ToUpper() + " Version " + assembly.ImageRuntimeVersion + " => " + Convert.ToString(type));
}
}
}
icons.Add("D", (Texture2D[])(object)new Texture2D[10]);
icons.Add("L", (Texture2D[])(object)new Texture2D[10]);
for (int l = 0; l < 10; l++)
{
if (l == 0)
{
icons["D"][l] = Image.LoadTexture("UD.png", (CacheType)999);
icons["L"][l] = Image.LoadTexture("UD.png", (CacheType)999);
}
else
{
icons["D"][l] = Image.LoadTexture(l + "D.png", (CacheType)999);
icons["L"][l] = Image.LoadTexture(l + "L.png", (CacheType)999);
}
}
LoggingPlugin.LogDebug("Subscribing to projectile (org.lordashes.plugins.projectile) requests.");
AssetDataPlugin.Subscribe("org.lordashes.plugins.projectile", (Action<DatumChange>)handleRequest);
Harmony val = new Harmony("org.lordashes.plugins.projectile");
val.PatchAll();
Utility.PostOnMainPage((BaseUnityPlugin)(object)this);
}
private void OnGUI()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
if (activeProjectile == null)
{
return;
}
if (activeProjectile.targets <= 0)
{
GUI.DrawTexture(new Rect((float)(Screen.width - 32), 60f, 16f, 16f), (Texture)(object)icons["D"][0], (ScaleMode)2);
return;
}
for (int i = 1; i <= activeProjectile.targets; i++)
{
if (activeProjectile.sources.Count > i)
{
GUI.DrawTexture(new Rect((float)(Screen.width - 32), (float)(60 + (i - 1) * 20), 16f, 16f), (Texture)(object)icons["L"][i], (ScaleMode)2);
}
else
{
GUI.DrawTexture(new Rect((float)(Screen.width - 32), (float)(60 + (i - 1) * 20), 16f, 16f), (Texture)(object)icons["D"][i], (ScaleMode)2);
}
}
}
private static void startAttackSelection(CreatureGuid selectedCreatureId, Projectile projectile)
{
//IL_005b: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_00e7: 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_0106: Unknown result type (might be due to invalid IL or missing references)
LoggingPlugin.LogInfo("Initiated Projectile Attack " + projectile.name + " (" + projectile.targets + " Targets)");
((MonoBehaviour)self).StartCoroutine(preventClickCollection(1000f));
CreatureBoardAsset val = null;
CreaturePresenter.TryGetAsset(new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), ref val);
if ((Object)(object)val == (Object)null)
{
CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
}
if ((Object)(object)val != (Object)null)
{
string[] obj = new string[5] { "Attacking Creature Is ", val.Name, " (", null, null };
CreatureGuid creatureId = val.CreatureId;
obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
obj[4] = ")";
LoggingPlugin.LogDebug(string.Concat(obj));
Vector3 position = val.GetHook((HookTransform)1).position;
activeProjectile = projectile;
activeProjectile.sources = new List<P3>
{
new P3(val.GetHook((HookTransform)1).position)
};
}
else
{
LoggingPlugin.LogWarning("Attacking CreatureId Is Not Null");
}
}
private static void addAttackTarget(CreatureBoardAsset asset)
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: 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_013e: Unknown result type (might be due to invalid IL or missing references)
LoggingPlugin.LogDebug("Projectile Attack " + activeProjectile.name + " Target Selection (" + activeProjectile.sources.Count + " of " + activeProjectile.targets + ")");
if ((Object)(object)asset != (Object)null)
{
switch (activeProjectile.targetArea.ToUpper())
{
case "HEAD":
activeProjectile.sources.Add(new P3(asset.HookHead.position));
break;
case "CAST":
case "SPELL":
activeProjectile.sources.Add(new P3(asset.GetHook((HookTransform)1).position));
break;
case "TORCH":
activeProjectile.sources.Add(new P3(asset.GetHook((HookTransform)3).position));
break;
default:
activeProjectile.sources.Add(new P3(asset.GetHook((HookTransform)2).position));
break;
}
}
if (activeProjectile.targets > 0 && activeProjectile.sources.Count > activeProjectile.targets)
{
fire();
}
}
private static void addAttackTarget(Vector3 position)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
LoggingPlugin.LogDebug("Projectile Attack " + activeProjectile.name + " Target Selection (Location " + ((object)(Vector3)(ref position)).ToString() + ")");
activeProjectile.sources.Add(new P3(position));
if (activeProjectile.targets > 0 && activeProjectile.sources.Count > activeProjectile.targets)
{
fire();
}
}
private static void fire()
{
LoggingPlugin.LogInfo("Projectile Attack " + activeProjectile.name + " Triggered");
AssetDataPlugin.SendInfo("org.lordashes.plugins.projectile", JsonConvert.SerializeObject((object)activeProjectile));
activeProjectile = null;
}
private void handleRequest(DatumChange change)
{
try
{
Projectile projectile = JsonConvert.DeserializeObject<Projectile>(change.value.ToString());
LoggingPlugin.LogDebug("Getting Projectile Name " + projectile.name);
List<P3> sources = projectile.sources;
if (projectile.prefabName == "")
{
projectile.prefabName = projectile.assetBundleName;
}
LoggingPlugin.LogTrace("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
{
LoggingPlugin.LogWarning("Error Loading Asset Bundle " + projectile.assetBundleName);
}
}
catch (Exception ex)
{
LoggingPlugin.LogInfo("Exception Processing Projectile");
LoggingPlugin.LogWarning(ex.ToString());
}
}
}