Decompiled source of AbilityCreator v1.0.4

AbilityCreator.dll

Decompiled 2 days 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 System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using DM;
using IDK;
using Landfall.TABS;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using Sirenix.Utilities;
using TFBGames;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ability Creator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Yipe")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266b11")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class NodeSceneMovement : MonoBehaviour, IDragHandler, IEventSystemHandler
{
	public RectTransform dragRectTransform;

	public NodeManager nodeman;

	private void Awake()
	{
		nodeman = Object.FindObjectOfType<NodeManager>();
	}

	public void OnDrag(PointerEventData eventData)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Invalid comparison between Unknown and I4
		//IL_0038: 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_0048: 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)
		if (nodeman.CanMove && (int)eventData.button == 2)
		{
			Node[] array = Object.FindObjectsOfType<Node>();
			for (int i = 0; i < array.Length; i++)
			{
				RectTransform component = ((Component)array[i]).GetComponent<RectTransform>();
				component.anchoredPosition += eventData.delta / 2f;
			}
		}
	}
}
public class NodeWindow : MonoBehaviour, IDragHandler, IEventSystemHandler
{
	public RectTransform dragRectTransform;

	public NodeManager nodeman;

	private void Awake()
	{
		nodeman = Object.FindObjectOfType<NodeManager>();
	}

	public void OnDrag(PointerEventData eventData)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Invalid comparison between Unknown and I4
		//IL_002b: 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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		if (nodeman.CanMove && (int)eventData.button == 0)
		{
			RectTransform obj = dragRectTransform;
			obj.anchoredPosition += eventData.delta / 2f;
		}
	}
}
[Serializable]
public class InnerListWrapper<T> : IEquatable<InnerListWrapper<T>>
{
	public List<T> innerList = new List<T>();

	public InnerListWrapper(List<T> list)
	{
		innerList = list;
	}

	public bool Equals(InnerListWrapper<T> obj)
	{
		return base.Equals(obj);
	}

	public override int GetHashCode()
	{
		return base.GetHashCode();
	}

	public override string ToString()
	{
		return base.ToString();
	}
}
[Serializable]
public class ListOfListsWrapper<T> : IEquatable<ListOfListsWrapper<T>>
{
	public List<InnerListWrapper<T>> listOfLists = new List<InnerListWrapper<T>>();

	public bool Equals(ListOfListsWrapper<T> obj)
	{
		return base.Equals(obj);
	}

	public override int GetHashCode()
	{
		return base.GetHashCode();
	}

	public override string ToString()
	{
		return base.ToString();
	}
}
namespace IDK;

public static class Bundle_Manager
{
	public static GameObject Node;

	public static GameObject Empty;

	public static AssetBundle scenes;

	public static AssetBundle AbilityPrefabs;

	public static void Setup()
	{
		scenes = LoadBundle("IDK.scenes");
		AbilityPrefabs = LoadBundle("IDK.ability");
		Node = AbilityPrefabs.LoadAsset<GameObject>("Node");
		Empty = AbilityPrefabs.LoadAsset<GameObject>("Empty");
	}

	public static AssetBundle LoadBundle(string assetBundleName)
	{
		string[] manifestResourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
		foreach (string text in manifestResourceNames)
		{
		}
		using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assetBundleName);
		return AssetBundle.LoadFromStream(stream);
	}
}
public class Code : GameStateListener
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Func<bool> <>9__3_0;

		public static UnityAction <>9__3_1;

		internal bool <SpawnButton_Internal>b__3_0()
		{
			return Object.op_Implicit((Object)(object)GameObject.Find("Quit"));
		}

		internal void <SpawnButton_Internal>b__3_1()
		{
			Main.sceneManager.EnterNodeChanger();
		}
	}

	public static GameObject button;

	public static string commnet;

	public void Begin()
	{
		SceneManager.activeSceneChanged += SpawnButtonFIXXXX;
	}

	public void SpawnButtonFIXXXX(Scene s, Scene s2)
	{
		if (((Scene)(ref s2)).name == "MainMenu")
		{
			((MonoBehaviour)this).StartCoroutine(SpawnButton_Internal());
		}
	}

	public IEnumerator SpawnButton_Internal()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)GameObject.Find("Quit"))));
		button = Object.Instantiate<GameObject>(GameObject.Find("Quit"), GameObject.Find("Quit").transform.parent);
		((Object)button).name = "Ability Creator";
		((UnityEventBase)button.GetComponent<Button>().onClick).RemoveAllListeners();
		Object.Destroy((Object)(object)button.GetComponentInChildren<LocalizeText>());
		((TMP_Text)((Component)button.transform.Find("Text")).GetComponent<TextMeshProUGUI>()).text = "Ability Creator";
		button.transform.SetSiblingIndex(4);
		ButtonClickedEvent onClick = button.GetComponent<Button>().onClick;
		object obj = <>c.<>9__3_1;
		if (obj == null)
		{
			UnityAction val = delegate
			{
				Main.sceneManager.EnterNodeChanger();
			};
			<>c.<>9__3_1 = val;
			obj = (object)val;
		}
		((UnityEvent)onClick).AddListener((UnityAction)obj);
	}

	public override void OnEnterBattleState()
	{
	}

	public override void OnEnterPlacementState()
	{
	}
}
public class DontDestroyOnLoad
{
	public Object gameObject;

	public DontDestroyOnLoad(Object target)
	{
		Object.DontDestroyOnLoad(target);
		gameObject = target;
	}
}
public static class ExampleManager
{
	public static void Setup()
	{
		File.Create(Main.abilitespath + "/Example Jump Dodge.nodescene").Close();
		string @string = Encoding.UTF8.GetString(Convert.FromBase64String("ewogICAgImNvbm50ZWN0aW9ucyI6IFsKICAgICAgICA0LAogICAgICAgIDMsCiAgICAgICAgMiwKICAgICAgICAxCiAgICBdLAogICAgImNvbm50ZWN0aW9uczIiOiBbCiAgICAgICAgIjMvMS8iLAogICAgICAgICIyLzQvIiwKICAgICAgICAiMy8iLAogICAgICAgICI0LyIKICAgIF0sCiAgICAiUG9zaXRpb25zIjogWwogICAgICAgIDQsCiAgICAgICAgMywKICAgICAgICAyLAogICAgICAgIDEKICAgIF0sCiAgICAiUG9zaXRpb25zMiI6IFsKICAgICAgICB7CiAgICAgICAgICAgICJ4IjogNTI0LjAsCiAgICAgICAgICAgICJ5IjogMjU3LjUsCiAgICAgICAgICAgICJ6IjogMC4wCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJ4IjogNzI0LjUsCiAgICAgICAgICAgICJ5IjogODkuMCwKICAgICAgICAgICAgInoiOiAwLjAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgIngiOiAzMDYuMCwKICAgICAgICAgICAgInkiOiAxMzAuMCwKICAgICAgICAgICAgInoiOiAwLjAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgIngiOiA1ODcuNSwKICAgICAgICAgICAgInkiOiAzOTQuMCwKICAgICAgICAgICAgInoiOiAwLjAKICAgICAgICB9CiAgICBdLAogICAgImZpZWxkcyI6IFsKICAgICAgICA0LAogICAgICAgIDMsCiAgICAgICAgMiwKICAgICAgICAxCiAgICBdLAogICAgImZpZWxkczIiOiBbCiAgICAgICAgIjAvMC8wLyIsCiAgICAgICAgIkhlYWQvIiwKICAgICAgICAiLyIsCiAgICAgICAgIi8iCiAgICBdLAogICAgImJsdWVwcmludHMiOiBbCiAgICAgICAgNCwKICAgICAgICAzLAogICAgICAgIDIsCiAgICAgICAgMQogICAgXSwKICAgICJibHVlcHJpbnRzMiI6IFsKICAgICAgICAiVFJBTlNGT1JNU0NBTEUiLAogICAgICAgICJHQU1FT0JKIiwKICAgICAgICAiU0VMRiIsCiAgICAgICAgIlVOSVRTUEFXTiIKICAgIF0sCiAgICAic2NlbmVOYW1lIjogIkV4YW1wbGUgSnVtcCBEb2RnZSIsCiAgICAic2NlbmVEZXNjcmlwdGlvbiI6ICJEb2RnZXMgYXR0YWNrcyBieSBKdW1waW5nIiwKICAgICJzY2VuZUltYWdlIjogIkRvZGdlX1Nob2d1bjEiLAogICAgIkRPTlRDSEFOR0UiOiAtMjAyMzY3ODA2MAp9"));
		File.WriteAllText(Main.abilitespath + "/Example Jump Dodge.nodescene", @string);
		File.Create(Main.abilitespath + "/Example Head Cutter.nodescene").Close();
		string string2 = Encoding.UTF8.GetString(Convert.FromBase64String("ewogICAgImNvbm50ZWN0aW9ucyI6IFsKICAgICAgICA2LAogICAgICAgIDUsCiAgICAgICAgNCwKICAgICAgICAzLAogICAgICAgIDIsCiAgICAgICAgMQogICAgXSwKICAgICJjb25udGVjdGlvbnMyIjogWwogICAgICAgICI1LzIvIiwKICAgICAgICAiNC82LyIsCiAgICAgICAgIjMvNS8xLyIsCiAgICAgICAgIjQvMi8iLAogICAgICAgICIzLzYvMS8iLAogICAgICAgICI0LyIKICAgIF0sCiAgICAiUG9zaXRpb25zIjogWwogICAgICAgIDYsCiAgICAgICAgNSwKICAgICAgICA0LAogICAgICAgIDMsCiAgICAgICAgMiwKICAgICAgICAxCiAgICBdLAogICAgIlBvc2l0aW9uczIiOiBbCiAgICAgICAgewogICAgICAgICAgICAieCI6IDIwMS4yMjE5MjM4MjgxMjUsCiAgICAgICAgICAgICJ5IjogMzUxLjc2NTAxNDY0ODQzNzUsCiAgICAgICAgICAgICJ6IjogMC4wCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJ4IjogNjk4LjU2MTk1MDY4MzU5MzgsCiAgICAgICAgICAgICJ5IjogNDkuODA3MTI4OTA2MjUsCiAgICAgICAgICAgICJ6IjogMC4wCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJ4IjogNjkyLjI4NDM2Mjc5Mjk2ODgsCiAgICAgICAgICAgICJ5IjogMjE5LjU2MjAxMTcxODc1LAogICAgICAgICAgICAieiI6IDAuMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAieCI6IDEwNTYuMDQzNDU3MDMxMjUsCiAgICAgICAgICAgICJ5IjogMzY1LjE1MTg1NTQ2ODc1LAogICAgICAgICAgICAieiI6IDAuMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAieCI6IDY5NS4wMjkwNTI3MzQzNzUsCiAgICAgICAgICAgICJ5IjogMzU2LjI3NTE0NjQ4NDM3NSwKICAgICAgICAgICAgInoiOiAwLjAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgIngiOiAyMTkuNTY2Mjg0MTc5Njg3NSwKICAgICAgICAgICAgInkiOiAxNzkuODg1MDcwODAwNzgxMjYsCiAgICAgICAgICAgICJ6IjogMC4wCiAgICAgICAgfQogICAgXSwKICAgICJmaWVsZHMiOiBbCiAgICAgICAgNiwKICAgICAgICA1LAogICAgICAgIDQsCiAgICAgICAgMywKICAgICAgICAyLAogICAgICAgIDEKICAgIF0sCiAgICAiZmllbGRzMiI6IFsKICAgICAgICAiLyIsCiAgICAgICAgIi8iLAogICAgICAgICJIZWFkLyIsCiAgICAgICAgIjAvMC8wLyIsCiAgICAgICAgIjIvMTUvIiwKICAgICAgICAiRWZmZWN0cyZTbGljZS8xLjUvMS4zLyIKICAgIF0sCiAgICAiYmx1ZXByaW50cyI6IFsKICAgICAgICA2LAogICAgICAgIDUsCiAgICAgICAgNCwKICAgICAgICAzLAogICAgICAgIDIsCiAgICAgICAgMQogICAgXSwKICAgICJibHVlcHJpbnRzMiI6IFsKICAgICAgICAiRElFIiwKICAgICAgICAiRU5FTVkiLAogICAgICAgICJHQU1FT0JKIiwKICAgICAgICAiVFJBTlNGT1JNU0NBTEUiLAogICAgICAgICJBQklMSVRZQUNUVklBVEUiLAogICAgICAgICJQTEFZU09VTkQiCiAgICBdLAogICAgInNjZW5lTmFtZSI6ICJFeGFtcGxlIEhlYWQgQ3V0dGVyIiwKICAgICJzY2VuZURlc2NyaXB0aW9uIjogIkN1dHMgSGVhZCBvZiBFbmVtaWVzIiwKICAgICJzY2VuZUltYWdlIjogIkljb25zXzEyOHgxMjhfQXNzYXNpbiIsCiAgICAiRE9OVENIQU5HRSI6IDEyNzkwMTgzNQp9"));
		File.WriteAllText(Main.abilitespath + "/Example Head Cutter.nodescene", string2);
	}
}
public class NodeRunner : MonoBehaviour
{
	public NodeScene nodeScene;

	public int nodeSceneindex;

	private Dictionary<string, float> Variables = new Dictionary<string, float>();

	public void begin()
	{
		nodeScene = Main.nodeScenes[nodeSceneindex].CreateCopy();
		Variables = new Dictionary<string, float>();
		SavedNode[] array = nodeScene.Positions.Keys.ToArray();
		for (int i = 0; i < array.Length; i++)
		{
			array[i].MainRigs = (Rigidbody[])(object)new Rigidbody[0];
			array[i].Others = new object[0];
			array[i].Units = (Unit[])(object)new Unit[0];
		}
		if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>()))
		{
			((MonoBehaviour)this).StartCoroutine(beginInternal());
		}
	}

	private IEnumerator beginInternal()
	{
		SavedNode[] nodes = nodeScene.Positions.Keys.ToArray();
		foreach (SavedNode currentnode in nodes)
		{
			if (currentnode.blueprint.key == "UNITSPAWN")
			{
				((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(currentnode, includeInputs: true, 0f, waitForEnemy: false));
			}
			if (currentnode.blueprint.key == "SELF")
			{
				currentnode.MainRigs = (Rigidbody[])(object)new Rigidbody[1] { ((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig };
				currentnode.Units = (Unit[])(object)new Unit[1] { ((Component)((Component)this).transform.root).GetComponent<Unit>() };
				currentnode.Others = new object[1] { ((Component)((Component)this).transform.root).gameObject };
			}
			if (currentnode.blueprint.key == "NEWOBJ")
			{
				currentnode.GetValueAtRuntime = true;
			}
			if (currentnode.blueprint.key == "VARCREATE")
			{
				currentnode.GetValueAtRuntime = true;
			}
			if (currentnode.blueprint.key == "ADDCOMP")
			{
				currentnode.GetValueAtRuntime = true;
			}
			if (currentnode.blueprint.key == "GETCOMP")
			{
				currentnode.GetValueAtRuntime = true;
			}
		}
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetData != (Object)null));
		foreach (SavedNode currentnode2 in nodes)
		{
			if (currentnode2.blueprint.type != 0 && !(currentnode2.blueprint.key != "PAUSE"))
			{
				continue;
			}
			if (currentnode2.blueprint.key == "INTERVAL")
			{
				((MonoBehaviour)this).StartCoroutine(IntervalLoop(length: float.Parse(((List<string>)nodeScene.fields[currentnode2])[0]), node: currentnode2));
			}
			if (currentnode2.blueprint.key == "WHENUNITDIE")
			{
				((Component)((Component)this).transform.root).GetComponent<Unit>().data.healthHandler.deathEvent.AddListener((UnityAction)delegate
				{
					((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(currentnode2));
				});
			}
			if (currentnode2.blueprint.key == "UNITWASATTACKED")
			{
				List<SavedNode> connections2 = nodeScene.conntections[currentnode2];
				UnityAction val = default(UnityAction);
				for (int f = 0; f < connections2.Count; f++)
				{
					List<string> currfield2 = (List<string>)nodeScene.fields[currentnode2];
					_ = currfield2[0];
					ConditionalEvent eventc2 = ((Component)this).gameObject.GetComponent<ConditionalEvent>();
					ConditionalEventInstance condetionalevent2 = eventc2.events[0];
					List<EventCondition> ls2 = new List<EventCondition>
					{
						new EventCondition
						{
							alwaysResetCounter = true,
							conditionType = (ConditionType)0,
							onlyCountWhenUnitInRange = false,
							startOnCD = true,
							value = float.Parse(currfield2[0]),
							valueType = (ValueType)1
						}
					}.ToArray().ToList();
					if (currfield2[1] != "" && currfield2[1] != "0")
					{
						ls2.Add(new EventCondition
						{
							alwaysResetCounter = true,
							conditionType = (ConditionType)1,
							onlyCountWhenUnitInRange = false,
							startOnCD = true,
							value = float.Parse(currfield2[1]),
							valueType = (ValueType)1
						});
						ls2 = ls2.ToArray().ToList();
					}
					else
					{
						ls2.Add(new EventCondition
						{
							alwaysResetCounter = true,
							conditionType = (ConditionType)1,
							onlyCountWhenUnitInRange = false,
							startOnCD = true,
							value = 1E+17f,
							valueType = (ValueType)1
						});
						ls2 = ls2.ToArray().ToList();
					}
					ls2.Add(new EventCondition
					{
						alwaysResetCounter = true,
						conditionType = (ConditionType)3,
						onlyCountWhenUnitInRange = false,
						startOnCD = true,
						value = 0f,
						valueType = (ValueType)0,
						counter = 3.402823E+38f,
						rangeType = (RangeType)0,
						whichRange = (WhichRange)0
					});
					ls2.ToArray().ToList();
					condetionalevent2.conditions = (EventCondition[])(object)new EventCondition[3]
					{
						new EventCondition
						{
							alwaysResetCounter = true,
							conditionType = (ConditionType)3,
							onlyCountWhenUnitInRange = false,
							startOnCD = true,
							value = 0f,
							valueType = (ValueType)0,
							counter = 3.402823E+38f,
							rangeType = (RangeType)0,
							whichRange = (WhichRange)0
						},
						new EventCondition
						{
							alwaysResetCounter = true,
							conditionType = (ConditionType)1,
							onlyCountWhenUnitInRange = false,
							startOnCD = true,
							value = float.Parse(currfield2[1]),
							valueType = (ValueType)1
						},
						new EventCondition
						{
							alwaysResetCounter = true,
							conditionType = (ConditionType)0,
							onlyCountWhenUnitInRange = false,
							startOnCD = true,
							value = float.Parse(currfield2[0]),
							valueType = (ValueType)1
						}
					};
					UnityEvent continuousEvent = condetionalevent2.continuousEvent;
					UnityAction obj = val;
					if (obj == null)
					{
						UnityAction val2 = delegate
						{
							((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(currentnode2));
						};
						UnityAction val3 = val2;
						val = val2;
						obj = val3;
					}
					continuousEvent.AddListener(obj);
				}
			}
			if (currentnode2.blueprint.key == "ABILITYACTVIATE")
			{
				List<string> currfield = (List<string>)nodeScene.fields[currentnode2];
				_ = currfield[0];
				List<EventCondition> ls = new List<EventCondition>
				{
					new EventCondition
					{
						alwaysResetCounter = true,
						conditionType = (ConditionType)0,
						onlyCountWhenUnitInRange = false,
						startOnCD = true,
						value = float.Parse(currfield[0]),
						valueType = (ValueType)1
					}
				};
				if (currfield[1] != "" && currfield[1] != "0")
				{
					ls.Add(new EventCondition
					{
						alwaysResetCounter = true,
						conditionType = (ConditionType)1,
						onlyCountWhenUnitInRange = false,
						startOnCD = true,
						value = float.Parse(currfield[1]),
						valueType = (ValueType)1
					});
				}
				else
				{
					ls.Add(new EventCondition
					{
						alwaysResetCounter = true,
						conditionType = (ConditionType)1,
						onlyCountWhenUnitInRange = false,
						startOnCD = true,
						value = 1E+17f,
						valueType = (ValueType)1
					});
				}
				ConditionalEvent eventc = ((Component)this).gameObject.GetComponent<ConditionalEvent>();
				ConditionalEventInstance condetionalevent = eventc.events[0];
				condetionalevent.conditions = ls.ToArray();
				condetionalevent.continuousEvent.AddListener((UnityAction)delegate
				{
					((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(currentnode2));
				});
			}
		}
	}

	private IEnumerator IntervalLoop(SavedNode node, float length)
	{
		yield return (object)new WaitForSeconds(length);
		((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(node));
		((MonoBehaviour)this).StartCoroutine(IntervalLoop(node, length));
	}

	private IEnumerator UpdateEnemy()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetData != (Object)null));
		SavedNode[] nodes = nodeScene.Positions.Keys.ToArray();
		foreach (SavedNode currentnode in nodes)
		{
			if (currentnode.blueprint.key == "ENEMY")
			{
				currentnode.MainRigs = (Rigidbody[])(object)new Rigidbody[1] { ((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetMainRig };
				currentnode.Units = (Unit[])(object)new Unit[1] { ((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetData.unit };
				currentnode.Others = new object[1] { ((Component)((Component)((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetData).transform.root).gameObject };
			}
			if (!(currentnode.blueprint.key == "GAMEOBJ"))
			{
				continue;
			}
			List<SavedNode> connections = nodeScene.conntections[currentnode];
			List<string> currfield = (List<string>)nodeScene.fields[currentnode];
			for (int o = 0; o < connections.Count; o++)
			{
				if (connections[o].GetValueAtRuntime && connections[o].Others != null && connections[o].Others.Length == 0)
				{
					GetMyValue(connections[o]);
				}
				if (connections[o].Others == null)
				{
					break;
				}
				for (int p = 0; p < connections[o].Others.Length; p++)
				{
					if (!(connections[o].Others[p] is GameObject))
					{
						continue;
					}
					object obj = connections[o].Others[p];
					GameObject y = (GameObject)((obj is GameObject) ? obj : null);
					Transform[] componentsInChildren = y.GetComponentsInChildren<Transform>();
					foreach (Transform item in componentsInChildren)
					{
						if (((Object)item).name == currfield[0])
						{
							if (Object.op_Implicit((Object)(object)((Component)item).gameObject.GetComponent<Rigidbody>()))
							{
								currentnode.MainRigs = (Rigidbody[])(object)new Rigidbody[1] { ((Component)item).gameObject.GetComponent<Rigidbody>() };
							}
							else
							{
								currentnode.MainRigs = (Rigidbody[])(object)new Rigidbody[0];
							}
							currentnode.Units = (Unit[])(object)new Unit[0];
							currentnode.Others = new object[1] { ((Component)item).gameObject };
							currentnode.UseMainRigRot = true;
						}
					}
				}
			}
		}
	}

	private IEnumerator RunNodesOfNode(SavedNode node, bool includeInputs = true, float pause = 0f, bool waitForEnemy = true)
	{
		if (pause != 0f)
		{
			yield return (object)new WaitForSeconds(pause);
		}
		List<SavedNode> connections = nodeScene.conntections[node];
		((MonoBehaviour)this).StartCoroutine(UpdateEnemy());
		if (waitForEnemy)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetData)));
		}
		if (!((Component)((Component)this).transform.root).GetComponent<Unit>().data.Dead)
		{
			for (int i = 0; i < connections.Count; i++)
			{
				if ((Object)(object)connections[i] == (Object)(object)node || (!includeInputs && connections[i].blueprint.type == NodeBlueprint.Type.Input))
				{
					continue;
				}
				if (connections[i].blueprint.key == "DEAL_DAMAGE")
				{
					List<string> currfield8 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections14 = nodeScene.conntections[connections[i]];
					for (int f16 = 0; f16 < connections14.Count; f16++)
					{
						for (int o22 = 0; o22 < connections14[f16].Units.Length; o22++)
						{
							((Damagable)connections14[f16].Units[o22].data.healthHandler).TakeDamage(float.Parse(currfield8[0]), Vector3.zero, connections14[f16].Units[o22], (DamageType)0);
						}
					}
				}
				if (connections[i].blueprint.key == "DESTROY")
				{
					_ = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections24 = nodeScene.conntections[connections[i]];
					for (int f20 = 0; f20 < connections24.Count; f20++)
					{
						if (connections24[f20].GetValueAtRuntime && connections24[f20].Others != null && connections24[f20].Others.Length == 0)
						{
							GetMyValue(connections24[f20]);
						}
						if (connections24[f20].Others == null)
						{
							continue;
						}
						for (int o25 = 0; o25 < connections24[f20].Others.Length; o25++)
						{
							if (connections24[f20].Others[o25] is Object)
							{
								object obj7 = connections24[f20].Others[o25];
								Object.Destroy((Object)((obj7 is Object) ? obj7 : null));
							}
						}
					}
				}
				if (connections[i].blueprint.key == "TRANSFORMPOS")
				{
					List<string> currfield20 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections25 = nodeScene.conntections[connections[i]];
					for (int f19 = 0; f19 < connections25.Count; f19++)
					{
						if (connections25[f19].GetValueAtRuntime && connections25[f19].Others != null && connections25[f19].Others.Length == 0)
						{
							GetMyValue(connections25[f19]);
						}
						if (connections25[f19].Others == null)
						{
							continue;
						}
						for (int o24 = 0; o24 < connections25[f19].Others.Length; o24++)
						{
							if (connections25[f19].Others[o24] is GameObject)
							{
								object obj8 = connections25[f19].Others[o24];
								GameObject g3 = (GameObject)((obj8 is GameObject) ? obj8 : null);
								Transform transform = g3.transform;
								transform.position += new Vector3
								{
									x = float.Parse(currfield20[0]),
									y = float.Parse(currfield20[1]),
									z = float.Parse(currfield20[2])
								};
							}
						}
					}
				}
				if (connections[i].blueprint.key == "TRANSFORMSCALE")
				{
					List<string> currfield19 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections23 = nodeScene.conntections[connections[i]];
					for (int f18 = 0; f18 < connections23.Count; f18++)
					{
						if (connections23[f18].GetValueAtRuntime && connections23[f18].GetValueAtRuntime && connections23[f18].Others != null && connections23[f18].Others.Length == 0)
						{
							GetMyValue(connections23[f18]);
						}
						if (connections23[f18].Others == null)
						{
							continue;
						}
						for (int o23 = 0; o23 < connections23[f18].Others.Length; o23++)
						{
							if (connections23[f18].Others[o23] is GameObject)
							{
								object obj9 = connections23[f18].Others[o23];
								GameObject g2 = (GameObject)((obj9 is GameObject) ? obj9 : null);
								g2.transform.localScale = new Vector3
								{
									x = g2.transform.localScale.x * float.Parse(currfield19[0]),
									y = g2.transform.localScale.y * float.Parse(currfield19[1]),
									z = g2.transform.localScale.z * float.Parse(currfield19[2])
								};
							}
						}
					}
				}
				if (connections[i].blueprint.key == "TRANSFORMROT")
				{
					List<string> currfield18 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections22 = nodeScene.conntections[connections[i]];
					for (int f17 = 0; f17 < connections22.Count; f17++)
					{
						if (connections22[f17].GetValueAtRuntime && connections22[f17].GetValueAtRuntime && connections22[f17].Others != null && connections22[f17].Others.Length == 0)
						{
							GetMyValue(connections22[f17]);
						}
						if (connections22[f17].Others == null)
						{
							continue;
						}
						for (int o21 = 0; o21 < connections22[f17].Others.Length; o21++)
						{
							if (connections22[f17].Others[o21] is GameObject)
							{
								object obj10 = connections22[f17].Others[o21];
								GameObject g = (GameObject)((obj10 is GameObject) ? obj10 : null);
								g.transform.Rotate(new Vector3
								{
									x = g.transform.localScale.x * float.Parse(currfield18[0]),
									y = g.transform.localScale.y * float.Parse(currfield18[1]),
									z = g.transform.localScale.z * float.Parse(currfield18[2])
								});
							}
						}
					}
				}
				if (connections[i].blueprint.key == "DIE")
				{
					List<SavedNode> connections21 = nodeScene.conntections[connections[i]];
					for (int f15 = 0; f15 < connections21.Count; f15++)
					{
						for (int o20 = 0; o20 < connections21[f15].Units.Length; o20++)
						{
							connections21[f15].Units[o20].data.healthHandler.Die((Unit)null);
						}
					}
				}
				if (connections[i].blueprint.key == "PLAYSOUND")
				{
					List<string> currfield17 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections20 = nodeScene.conntections[connections[i]];
					for (int f14 = 0; f14 < connections20.Count; f14++)
					{
						for (int o19 = 0; o19 < connections20[f14].MainRigs.Length; o19++)
						{
							ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect(currfield17[0].Replace("&", "/"), float.Parse(currfield17[1]), connections20[f14].MainRigs[o19].position, (MaterialType)0, (Transform)null, float.Parse(currfield17[2]));
						}
					}
				}
				if (connections[i].blueprint.key == "ADDEFFECT")
				{
					List<string> currfield16 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections19 = nodeScene.conntections[connections[i]];
					for (int f13 = 0; f13 < connections19.Count; f13++)
					{
						for (int o18 = 0; o18 < connections19[f13].Units.Length; o18++)
						{
							GameObject effectt = Object.Instantiate<GameObject>(Main.Effects[currfield16[0]], ((Component)connections19[f13].Units[o18]).transform);
							effectt.transform.position = ((Component)connections19[f13].Units[o18]).transform.position;
							if (Object.op_Implicit((Object)(object)effectt.GetComponent<UnitEffectBase>()))
							{
								effectt.GetComponent<UnitEffectBase>().DoEffect();
							}
						}
					}
				}
				if (connections[i].blueprint.key == "FREAZE")
				{
					List<string> currfield15 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections18 = nodeScene.conntections[connections[i]];
					for (int f12 = 0; f12 < connections18.Count; f12++)
					{
						for (int o17 = 0; o17 < connections18[f12].Units.Length; o17++)
						{
							((MonoBehaviour)this).StartCoroutine(FreazeThenUnfreaze(connections18[f12].Units[o17], float.Parse(currfield15[0])));
						}
					}
				}
				if (connections[i].blueprint.key == "ALLABS")
				{
					List<SavedNode> connections17 = nodeScene.conntections[connections[i]];
					for (int f11 = 0; f11 < connections17.Count; f11++)
					{
						for (int o16 = 0; o16 < connections17[f11].MainRigs.Length; o16++)
						{
							ConditionalEvent[] Condentials = ((Component)((Component)connections17[f11].MainRigs[o16]).transform.root).GetComponentsInChildren<ConditionalEvent>();
							for (int s3 = 0; s3 < Condentials.Length; s3++)
							{
								for (int k = 0; k < Condentials[s3].events.Length; k++)
								{
									Condentials[s3].events[k].continuousEvent.Invoke();
								}
							}
						}
					}
				}
				if (connections[i].blueprint.key == "IMMUNE")
				{
					List<string> currfield14 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections16 = nodeScene.conntections[connections[i]];
					for (int f10 = 0; f10 < connections16.Count; f10++)
					{
						for (int o15 = 0; o15 < connections16[f10].Units.Length; o15++)
						{
							DataHandler data = connections16[f10].Units[o15].data;
							data.immunityForSeconds += float.Parse(currfield14[0]);
						}
					}
				}
				if (connections[i].blueprint.key == "EXPLOSION")
				{
					List<string> currfield13 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections15 = nodeScene.conntections[connections[i]];
					for (int f9 = 0; f9 < connections15.Count; f9++)
					{
						if (!LinqExtensions.IsNullOrEmpty<Unit>((IList<Unit>)connections15[f9].Units))
						{
							for (int o14 = 0; o14 < connections15[f9].Units.Length; o14++)
							{
								GameObject explosion2 = Object.Instantiate<GameObject>(Main.explosions[currfield13[0]]);
								explosion2.transform.position = connections15[f9].Units[o14].data.mainRig.position;
								explosion2.transform.forward = ((Component)connections15[f9].Units[o14].data.mainRig).transform.forward;
								if (Object.op_Implicit((Object)(object)explosion2.GetComponentInChildren<TeamHolder>()))
								{
									explosion2.GetComponentInChildren<TeamHolder>().team = connections15[f9].Units[o14].Team;
								}
								explosion2.SetActive(true);
								if (Object.op_Implicit((Object)(object)explosion2.GetComponentInChildren<TeamHolder>()))
								{
									explosion2.GetComponentInChildren<TeamHolder>().team = connections15[f9].Units[o14].Team;
								}
								for (int j = 0; j < explosion2.GetComponentsInChildren<Explosion>().Length; j++)
								{
									explosion2.GetComponentsInChildren<Explosion>()[j].damage = float.Parse(currfield13[1]);
									if (int.Parse(currfield13[2]) == 0)
									{
										typeof(Explosion).GetField("team", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(explosion2.GetComponentsInChildren<Explosion>()[j], connections15[f9].Units[o14].Team);
										typeof(Explosion).GetField("ownUnit", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(explosion2.GetComponentsInChildren<Explosion>()[j], connections15[f9].Units[o14]);
									}
									else
									{
										typeof(Explosion).GetField("team", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(explosion2.GetComponentsInChildren<Explosion>()[j], connections15[f9].Units[o14].Team.reverse());
										typeof(Explosion).GetField("ownUnit", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(explosion2.GetComponentsInChildren<Explosion>()[j], connections15[f9].Units[o14]);
									}
								}
								explosion2.transform.parent = ((Component)connections15[f9].Units[0]).transform;
							}
						}
						else
						{
							for (int o13 = 0; o13 < connections15[f9].Others.Length; o13++)
							{
								object obj11 = connections15[f9].Others[o13];
								GameObject gameobj = (GameObject)((obj11 is GameObject) ? obj11 : null);
								GameObject explosion = Object.Instantiate<GameObject>(Main.explosions[currfield13[0]]);
								explosion.transform.position = gameobj.transform.position;
								explosion.transform.forward = gameobj.transform.forward;
								explosion.SetActive(true);
								explosion.transform.parent = gameobj.transform;
							}
						}
					}
				}
				if (connections[i].blueprint.key == "PAUSE")
				{
					((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(pause: float.Parse(((List<string>)nodeScene.fields[connections[i]])[0]), node: connections[i], includeInputs: false));
				}
				if (connections[i].blueprint.key == "REAPET")
				{
					int last = 0;
					List<string> currfield12 = (List<string>)nodeScene.fields[connections[i]];
					for (int d = 0; d < int.Parse(currfield12[0]); d++)
					{
						if (last == d)
						{
							d++;
						}
						((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(connections[i], includeInputs: false));
						yield return (object)new WaitForSeconds(0.05f);
						last = d;
					}
				}
				if (connections[i].blueprint.key == "ADDFORCE")
				{
					((MonoBehaviour)this).StartCoroutine(UpdateEnemy());
					List<string> currfield11 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections13 = nodeScene.conntections[connections[i]];
					for (int f8 = 0; f8 < connections13.Count; f8++)
					{
						for (int o12 = 0; o12 < connections13[f8].MainRigs.Length; o12++)
						{
							Rigidbody[] componentsInChildren = ((Component)((Component)connections13[f8].MainRigs[o12]).transform.root).GetComponentsInChildren<Rigidbody>();
							foreach (Rigidbody item4 in componentsInChildren)
							{
								if (!connections13[f8].UseMainRigRot)
								{
									item4.AddForce(((Component)connections13[f8].MainRigs[o12]).transform.forward * float.Parse(currfield11[0]) * 10f);
									item4.AddForce(((Component)connections13[f8].MainRigs[o12]).transform.up * float.Parse(currfield11[1]) * 10f);
									item4.AddForce(((Component)connections13[f8].MainRigs[o12]).transform.right * float.Parse(currfield11[2]) * 10f);
								}
								else
								{
									item4.AddForce(((Component)((Component)((Component)connections13[f8].MainRigs[o12]).transform.root).GetComponent<Unit>().data.mainRig).transform.forward * float.Parse(currfield11[0]) * 10f);
									item4.AddForce(((Component)((Component)((Component)connections13[f8].MainRigs[o12]).transform.root).GetComponent<Unit>().data.mainRig).transform.up * float.Parse(currfield11[1]) * 10f);
									item4.AddForce(((Component)((Component)((Component)connections13[f8].MainRigs[o12]).transform.root).GetComponent<Unit>().data.mainRig).transform.right * float.Parse(currfield11[2]) * 10f);
								}
							}
						}
					}
				}
				if (connections[i].blueprint.key == "TOGGLEPROPS")
				{
					List<string> currfield10 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections12 = nodeScene.conntections[connections[i]];
					for (int f7 = 0; f7 < connections12.Count; f7++)
					{
						for (int o11 = 0; o11 < connections12[f7].MainRigs.Length; o11++)
						{
							for (int p5 = int.Parse(currfield10[0]); p5 < int.Parse(currfield10[1]); p5++)
							{
								try
								{
									if (Object.op_Implicit((Object)(object)((Component)((Component)((Component)connections12[f7].MainRigs[o11]).transform.root).GetComponentsInChildren<PropItem>(true)[p5]).GetComponent<Weapon>()))
									{
										continue;
									}
									if (((Component)((Component)((Component)connections12[f7].MainRigs[o11]).transform.root).GetComponentsInChildren<PropItem>(true)[p5]).GetComponentInChildren<Renderer>().enabled)
									{
										GameObject[] gameobjs2 = (GameObject[])typeof(CharacterItem).GetField("m_gameObjects", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(((Component)((Component)connections12[f7].MainRigs[o11]).transform.root).GetComponentsInChildren<PropItem>(true)[p5]);
										for (int q2 = 0; q2 < gameobjs2.Length; q2++)
										{
											for (int s2 = 0; s2 < gameobjs2[q2].GetComponentsInChildren<Renderer>(true).Length; s2++)
											{
												gameobjs2[q2].GetComponentsInChildren<Renderer>(true)[s2].enabled = false;
											}
										}
									}
									else
									{
										if (((Component)((Component)((Component)connections12[f7].MainRigs[o11]).transform.root).GetComponentsInChildren<PropItem>(true)[p5]).GetComponentInChildren<Renderer>().enabled)
										{
											continue;
										}
										GameObject[] gameobjs = (GameObject[])typeof(CharacterItem).GetField("m_gameObjects", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(((Component)((Component)connections12[f7].MainRigs[o11]).transform.root).GetComponentsInChildren<PropItem>(true)[p5]);
										for (int q = 0; q < gameobjs.Length; q++)
										{
											for (int s = 0; s < gameobjs[q].GetComponentsInChildren<Renderer>(true).Length; s++)
											{
												gameobjs[q].GetComponentsInChildren<Renderer>(true)[s].enabled = true;
											}
										}
										continue;
									}
								}
								catch (IndexOutOfRangeException)
								{
									break;
								}
							}
						}
					}
				}
				if (connections[i].blueprint.key == "ADDFORCEGLOBAL")
				{
					List<string> currfield9 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections11 = nodeScene.conntections[connections[i]];
					for (int f6 = 0; f6 < connections11.Count; f6++)
					{
						for (int o10 = 0; o10 < connections11[f6].MainRigs.Length; o10++)
						{
							Rigidbody[] componentsInChildren2 = ((Component)((Component)connections11[f6].MainRigs[o10]).transform.root).GetComponentsInChildren<Rigidbody>();
							foreach (Rigidbody item3 in componentsInChildren2)
							{
								item3.AddForce(float.Parse(currfield9[0]) * 10f, 0f, 0f);
								item3.AddForce(0f, float.Parse(currfield9[1]) * 10f, 0f);
								item3.AddForce(0f, 0f, float.Parse(currfield9[2]) * 10f);
							}
						}
					}
				}
				if (connections[i].blueprint.key == "SPAWNPROJ")
				{
					List<string> currfield7 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections10 = nodeScene.conntections[connections[i]];
					for (int f5 = 0; f5 < connections10.Count; f5++)
					{
						if (connections10[f5].GetValueAtRuntime && connections10[f5].Others != null && connections10[f5].Others.Length == 0)
						{
							GetMyValue(connections10[f5]);
						}
						for (int o9 = 0; o9 < connections10[f5].Others.Length; o9++)
						{
							if (connections10[f5].Others[o9] is GameObject)
							{
								object obj12 = connections10[f5].Others[o9];
								GameObject obj6 = (GameObject)((obj12 is GameObject) ? obj12 : null);
								spawnProj(Main.Projectiles[currfield7[0]], obj6.transform.position, ((Component)((Component)this).transform.root).GetComponent<Unit>(), obj6.transform, obj6.transform, float.Parse(currfield7[1]));
							}
						}
					}
				}
				if (connections[i].blueprint.key == "GOTOSELF")
				{
					_ = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections9 = nodeScene.conntections[connections[i]];
					for (int f4 = 0; f4 < connections9.Count; f4++)
					{
						if (connections9[f4].GetValueAtRuntime && connections9[f4].Others != null && connections9[f4].Others.Length == 0)
						{
							GetMyValue(connections9[f4]);
						}
						for (int o8 = 0; o8 < connections9[f4].Others.Length; o8++)
						{
							if (connections9[f4].Others[o8] is GameObject)
							{
								object obj13 = connections9[f4].Others[o8];
								GameObject obj5 = (GameObject)((obj13 is GameObject) ? obj13 : null);
								obj5.transform.position = ((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig.position;
							}
						}
					}
				}
				if (connections[i].blueprint.key == "GOTOENEMY")
				{
					_ = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections8 = nodeScene.conntections[connections[i]];
					for (int f3 = 0; f3 < connections8.Count; f3++)
					{
						if (connections8[f3].GetValueAtRuntime && connections8[f3].Others != null && connections8[f3].Others.Length == 0)
						{
							GetMyValue(connections8[f3]);
						}
						for (int o7 = 0; o7 < connections8[f3].Others.Length; o7++)
						{
							if (connections8[f3].Others[o7] is GameObject)
							{
								object obj14 = connections8[f3].Others[o7];
								GameObject obj4 = (GameObject)((obj14 is GameObject) ? obj14 : null);
								obj4.transform.position = ((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetMainRig.position;
							}
						}
					}
				}
				if (connections[i].blueprint.key == "STUNWEAPONS")
				{
					List<string> currfield6 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections7 = nodeScene.conntections[connections[i]];
					for (int f2 = 0; f2 < connections7.Count; f2++)
					{
						for (int o6 = 0; o6 < connections7[f2].Units.Length; o6++)
						{
							Weapon leftWeapon = connections7[f2].Units[o6].data.weaponHandler.leftWeapon;
							leftWeapon.internalCounter += float.Parse(currfield6[0]);
							Weapon rightWeapon = connections7[f2].Units[o6].data.weaponHandler.rightWeapon;
							rightWeapon.internalCounter += float.Parse(currfield6[1]);
							ConditionalEvent[] componentsInChildren3 = ((Component)connections7[f2].Units[o6]).GetComponentsInChildren<ConditionalEvent>();
							foreach (ConditionalEvent con in componentsInChildren3)
							{
								con.StunAllOfMyMovesFor(float.Parse(currfield6[2]));
							}
						}
					}
				}
				if (connections[i].blueprint.key == "VARADD")
				{
					List<string> currfield5 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections6 = nodeScene.conntections[connections[i]];
					for (int o5 = 0; o5 < connections6.Count; o5++)
					{
						if (connections6[o5].GetValueAtRuntime && connections6[o5].Others != null && connections6[o5].Others.Length == 0)
						{
							GetMyValue(connections6[o5]);
						}
						if (connections6[o5].Others == null)
						{
							break;
						}
						for (int p4 = 0; p4 < connections6[o5].Others.Length; p4++)
						{
							if (connections6[o5].Others[p4] is string)
							{
								string obj3 = connections6[o5].Others[p4] as string;
								Variables[obj3] += float.Parse(currfield5[0]);
							}
						}
					}
				}
				if (connections[i].blueprint.key == "VARSET")
				{
					List<string> currfield4 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections5 = nodeScene.conntections[connections[i]];
					for (int o4 = 0; o4 < connections5.Count; o4++)
					{
						if (connections5[o4].GetValueAtRuntime && connections5[o4].Others != null && connections5[o4].Others.Length == 0)
						{
							GetMyValue(connections5[o4]);
						}
						if (connections5[o4].Others == null)
						{
							break;
						}
						for (int p3 = 0; p3 < connections5[o4].Others.Length; p3++)
						{
							if (connections5[o4].Others[p3] is string)
							{
								string obj2 = connections5[o4].Others[p3] as string;
								Variables[obj2] = float.Parse(currfield4[0]);
							}
						}
					}
				}
				if (connections[i].blueprint.key == "SPAWNUNIT")
				{
					List<string> currfield3 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections4 = nodeScene.conntections[connections[i]];
					for (int f = 0; f < connections4.Count; f++)
					{
						if (connections4[f].GetValueAtRuntime && connections4[f].Others != null && connections4[f].Others.Length == 0)
						{
							GetMyValue(connections4[f]);
						}
						for (int o3 = 0; o3 < connections4[f].Others.Length; o3++)
						{
							if (!(connections4[f].Others[o3] is GameObject))
							{
								continue;
							}
							object obj15 = connections4[f].Others[o3];
							GameObject a2 = (GameObject)((obj15 is GameObject) ? obj15 : null);
							if (currfield3[1] == "1")
							{
								GameObject[] b2 = Main.units[int.Parse(currfield3[0])].Spawn(a2.transform.position, Quaternion.identity, ((Component)((Component)this).transform.root).GetComponent<Unit>().Team.reverse(), 1f, (UnitPoolInfo?)null);
								GameObject[] objectsToSpawnAsChildren = Main.units[int.Parse(currfield3[0])].objectsToSpawnAsChildren;
								foreach (GameObject item2 in objectsToSpawnAsChildren)
								{
									Object.Instantiate<GameObject>(item2, b2[0].transform.root, true);
								}
								b2[0].transform.root.position = a2.transform.position;
							}
							if (int.Parse(currfield3[1]) == 0)
							{
								GameObject[] b = Main.units[int.Parse(currfield3[0])].Spawn(a2.transform.position, Quaternion.identity, ((Component)((Component)this).transform.root).GetComponent<Unit>().Team, 1f, (UnitPoolInfo?)null);
								GameObject[] objectsToSpawnAsChildren2 = Main.units[int.Parse(currfield3[0])].objectsToSpawnAsChildren;
								foreach (GameObject item in objectsToSpawnAsChildren2)
								{
									Object.Instantiate<GameObject>(item, b[0].transform.root);
								}
								b[0].transform.root.position = a2.transform.position;
							}
						}
					}
				}
				if (connections[i].blueprint.key == "VARIF")
				{
					List<string> currfield2 = (List<string>)nodeScene.fields[connections[i]];
					List<SavedNode> connections3 = nodeScene.conntections[connections[i]];
					for (int o2 = 0; o2 < connections3.Count; o2++)
					{
						if (connections3[o2].GetValueAtRuntime && connections3[o2].Others != null && connections3[o2].Others.Length == 0)
						{
							GetMyValue(connections3[o2]);
						}
						if (connections3[o2].Others == null)
						{
							break;
						}
						for (int p2 = 0; p2 < connections3[o2].Others.Length; p2++)
						{
							if (connections3[o2].Others[p2] is string)
							{
								string obj = connections3[o2].Others[p2] as string;
								if (currfield2[1] == ">" && Variables[obj] > float.Parse(currfield2[0]))
								{
									((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(connections[i], includeInputs: false));
								}
								if (currfield2[1] == ">=" && Variables[obj] >= float.Parse(currfield2[0]))
								{
									((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(connections[i], includeInputs: false));
								}
								if (currfield2[1] == "<" && Variables[obj] < float.Parse(currfield2[0]))
								{
									((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(connections[i], includeInputs: false));
								}
								if (currfield2[1] == "<=" && Variables[obj] <= float.Parse(currfield2[0]))
								{
									((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(connections[i], includeInputs: false));
								}
								if (((currfield2[1] == "=") | (currfield2[1] == "==")) && Variables[obj] == float.Parse(currfield2[0]))
								{
									((MonoBehaviour)this).StartCoroutine(RunNodesOfNode(connections[i], includeInputs: false));
								}
							}
						}
					}
				}
				if (!(connections[i].blueprint.key == "SetField"))
				{
					continue;
				}
				List<string> currfield = (List<string>)nodeScene.fields[connections[i]];
				List<SavedNode> connections2 = nodeScene.conntections[connections[i]];
				for (int o = 0; o < connections2.Count; o++)
				{
					if (connections2[o].GetValueAtRuntime && connections2[o].Others != null && connections2[o].Others.Length == 0)
					{
						GetMyValue(connections2[o]);
					}
					if ((Object)(object)connections2[o].comp == (Object)null)
					{
						break;
					}
					for (int p = 0; p < ((object)connections2[o].comp).GetType().GetRuntimeFields().ToArray()
						.Length; p++)
					{
						FieldInfo a = ((object)connections2[o].comp).GetType().GetRuntimeFields().ToArray()[p];
						if (!(a.Name == currfield[0]))
						{
							continue;
						}
						if (a.FieldType == typeof(string))
						{
							a.SetValue(connections2[o].comp, currfield[1]);
						}
						else if (a.FieldType == typeof(int))
						{
							a.SetValue(connections2[o].comp, int.Parse(currfield[1]));
						}
						else if (a.FieldType == typeof(float))
						{
							a.SetValue(connections2[o].comp, float.Parse(currfield[1]));
						}
						else if (a.FieldType == typeof(float))
						{
							a.SetValue(connections2[o].comp, float.Parse(currfield[1]));
						}
						else if (a.FieldType == typeof(bool))
						{
							if (currfield[1] == bool.TrueString)
							{
								a.SetValue(connections2[o].comp, true);
							}
							else
							{
								a.SetValue(connections2[o].comp, false);
							}
						}
						else
						{
							try
							{
								a.SetValue(connections2[o].comp, SmartCast(a.FieldType, currfield[1]));
							}
							catch (Exception)
							{
							}
						}
					}
				}
			}
		}
		yield return null;
	}

	private IEnumerator FreazeThenUnfreaze(Unit unit, float Length)
	{
		((Component)unit).gameObject.AddComponent<FreezeBody>().Freeze();
		((Component)unit).gameObject.AddComponent<UnitDontWalkFor>().time = Length;
		((Component)unit).gameObject.GetComponent<UnitDontWalkFor>().Go();
		((Component)unit).gameObject.AddComponent<StopAttacks>().StopAttacksFor(Length);
		yield return (object)new WaitForSeconds(Length);
		unit.UnfreezeBody();
		((Component)unit).gameObject.AddComponent<FreezeBody>().UnFreeze();
	}

	private void spawnProj(GameObject proj, Vector3 pos, Unit u, Transform spawn, Transform mainrig, float spread)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: 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_001e: 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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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_0041: 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)
		Vector3 spawnDirection = GetSpawnDirection(spawn.forward, spawn.forward, mainrig);
		Projectile val = default(Projectile);
		ServiceLocator.GetService<ProjectilesSpawnManager>().SpawnProjectile(proj, pos, Quaternion.LookRotation(spawnDirection + 0.01f * spread * Random.insideUnitSphere), u, (byte)0, spawnDirection, spawn.forward, (Rigidbody)null, spawn.forward, ref val, false, (byte?)null);
	}

	private Vector3 GetSpawnDirection(Vector3 directionToTarget, Vector3 forcedDirection, Transform mainrig)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: 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_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: 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)
		//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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Vector3.Lerp(directionToTarget, mainrig.forward, new AnimationCurve().Evaluate(Vector3.Angle(directionToTarget, mainrig.forward)));
		return ((Vector3)(ref val)).normalized;
	}

	private void GetMyValue(SavedNode savedNode)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		List<string> list = (List<string>)nodeScene.fields[savedNode];
		if (savedNode.blueprint.key == "NEWOBJ")
		{
			savedNode.Others = new object[1] { (object)new GameObject(list[0]) };
		}
		if (savedNode.blueprint.key == "VARCREATE")
		{
			Variables.Add(list[0], 0f);
			savedNode.Others = new object[1] { list[0] };
		}
		if (savedNode.blueprint.key == "GETCOMP")
		{
			List<object> list2 = new List<object>();
			for (int i = 0; i < nodeScene.conntections[savedNode].Count; i++)
			{
				SavedNode savedNode2 = nodeScene.conntections[savedNode][i];
				if (savedNode2.GetValueAtRuntime && savedNode2.Others != null && savedNode2.Others.Length == 0)
				{
					GetMyValue(savedNode2);
				}
				for (int j = 0; j < savedNode2.Others.Length; j++)
				{
					if (savedNode2.Others[j] is GameObject)
					{
						object obj = savedNode2.Others[j];
						GameObject val = (GameObject)((obj is GameObject) ? obj : null);
						if (Object.op_Implicit((Object)(object)val.GetComponent(Main.components[list[0]])))
						{
							list2.Add(val.GetComponent(Main.components[list[0]]));
							savedNode.comp = val.GetComponent(Main.components[list[0]]);
						}
					}
				}
			}
			savedNode.Others = list2.ToArray();
		}
		if (!(savedNode.blueprint.key == "ADDCOMP"))
		{
			return;
		}
		for (int k = 0; k < nodeScene.conntections[savedNode].Count; k++)
		{
			SavedNode savedNode3 = nodeScene.conntections[savedNode][k];
			if (savedNode3.GetValueAtRuntime && savedNode3.Others != null && savedNode3.Others.Length == 0)
			{
				GetMyValue(savedNode3);
			}
			for (int l = 0; l < savedNode3.Others.Length; l++)
			{
				if (savedNode3.Others[l] is GameObject)
				{
					object obj2 = savedNode3.Others[l];
					GameObject val2 = (GameObject)((obj2 is GameObject) ? obj2 : null);
					savedNode.comp = val2.AddComponent(Main.components[list[0]]);
				}
			}
		}
	}

	public static object SmartCast(Type mytype, object other)
	{
		if (TypeExtensions.IsCastableTo(other.GetType(), mytype, false))
		{
			return TypeExtensions.GetCastMethod(other.GetType(), mytype, false).Invoke(other, new object[0]);
		}
		if (other is string)
		{
			return searchy(mytype, other as string);
		}
		return null;
	}

	public static object searchy(Type mytype, string search)
	{
		if (mytype.GetMethod("Find", BindingFlags.Static) != null)
		{
			return mytype.GetMethod("Find", BindingFlags.Static).Invoke(null, new object[1] { search });
		}
		return null;
	}
}
public class NodeRunnerFixer : MonoBehaviour
{
	private void Awake()
	{
		((MonoBehaviour)this).StartCoroutine(AwakeInternal());
	}

	private IEnumerator AwakeInternal()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)((Component)this).GetComponent<NodeRunner>())));
		((Component)this).GetComponent<NodeRunner>().begin();
	}
}
public class NodeScene
{
	public Dictionary<SavedNode, List<SavedNode>> conntections = new Dictionary<SavedNode, List<SavedNode>>();

	public Dictionary<SavedNode, Vector3> Positions = new Dictionary<SavedNode, Vector3>();

	public Dictionary<SavedNode, object> fields = new Dictionary<SavedNode, object>();

	public Dictionary<string, object> VariableValues = new Dictionary<string, object>();

	public Dictionary<string, int> VariableTypes = new Dictionary<string, int>();

	public string sceneName = "";

	public string sceneDescription = "";

	public string sceneImage = "";

	public int id = 0;

	public NodeScene CreateCopy()
	{
		NodeScene nodeScene = new NodeScene();
		nodeScene.conntections = conntections;
		nodeScene.Positions = Positions;
		nodeScene.fields = fields;
		nodeScene.sceneName = sceneName;
		nodeScene.sceneDescription = sceneDescription;
		nodeScene.sceneImage = sceneImage;
		nodeScene.VariableTypes = VariableTypes;
		nodeScene.VariableValues = VariableValues;
		return nodeScene;
	}
}
[BepInPlugin("AAC", "Alter Ability Creator", "1.0.1")]
public class Main : BaseUnityPlugin
{
	public static Dictionary<string, GameObject> explosions = new Dictionary<string, GameObject>();

	public static Dictionary<string, GameObject> Effects = new Dictionary<string, GameObject>();

	public static Dictionary<string, GameObject> Projectiles = new Dictionary<string, GameObject>();

	public static Dictionary<string, Type> components = new Dictionary<string, Type>();

	public static Dictionary<int, UnitBlueprint> units = new Dictionary<int, UnitBlueprint>();

	public static Dictionary<string, Sprite> pepsis = new Dictionary<string, Sprite>();

	public static List<DatabaseID> Nodeids = new List<DatabaseID>();

	public static string path = GamePaths.DataPath + "/Abilty Creator";

	public static string Guide = "";

	public static StreamedSceneManager sceneManager;

	public static Dictionary<string, NodeBlueprint> NodeDatabase = new Dictionary<string, NodeBlueprint>();

	public static List<NodeScene> nodeScenes = new List<NodeScene>();

	public static string abilitespath = path + "/Abilites";

	private void Awake()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		if ((int)Application.platform == 1)
		{
			path = GamePaths.PersistentDataPath + "/Abilty Creator";
			abilitespath = path + "/Abilites";
		}
		Code.commnet = "Dear Code Viewer, prepare your self for the most unoptomized, evil, racist code you will ever see";
		((MonoBehaviour)this).StartCoroutine(call());
	}

	private IEnumerator call()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null));
		yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameObject.Find("Quit") != (Object)null));
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameObject.Find("Quit").GetComponentInChildren<LocalizeText>() != (Object)null));
		yield return (object)new WaitUntil((Func<bool>)(() => GameObject.Find("Quit").GetComponentInChildren<LocalizeText>().LocaleID == "BUTTON_QUIT"));
		Bundle_Manager.Setup();
		sceneManager = new GameObject("Scene Manager").AddComponent<StreamedSceneManager>();
		Object.DontDestroyOnLoad((Object)(object)sceneManager);
		Code code = new GameObject("Code").AddComponent<Code>();
		Object.DontDestroyOnLoad((Object)(object)((Component)code).gameObject);
		code.Begin();
		((MonoBehaviour)this).StartCoroutine(code.SpawnButton_Internal());
		Code.commnet = "------------------File stuff------------------------";
		Explosion[] allexplo = Resources.FindObjectsOfTypeAll<Explosion>();
		string Filetext = "";
		string Filetext2 = "";
		string Filetext3 = "";
		string Filetext4 = "";
		string Filetext5 = "";
		string Filetext6 = "";
		string Filetext7 = "";
		string Filetext8 = "";
		int index = 0;
		for (int i = 0; i < allexplo.Length; i++)
		{
			if (!explosions.ContainsValue(((Component)((Component)allexplo[i]).gameObject.transform.root).gameObject))
			{
				index++;
				string name10 = ((Object)((Component)((Component)allexplo[i]).gameObject.transform.root).gameObject).name;
				name10 = (name10.Contains("_1 Prefabs_VB") ? name10.Replace("_1 Prefabs_VB", "") : (name10.Contains("_1 Weapons_VB") ? name10.Replace("_1 Weapons_VB", "") : name10));
				name10 = (name10.Contains("_4 Moves_VB") ? name10.Replace("_4 Moves_VB", "") : (name10.Contains("_2 Projectiles_VB") ? name10.Replace("_2 Projectiles_VB", "") : name10));
				name10 = (name10.Contains("_3 Effects_VB") ? name10.Replace("_3 Effects_VB", "") : (name10.Contains("_0 UnitBases_VB") ? name10.Replace("_0 UnitBases_VB", "") : name10));
				while (Filetext.Contains(name10))
				{
					name10 += "+";
				}
				explosions.Add(name10, ((Component)((Component)allexplo[i]).gameObject.transform.root).gameObject);
				Filetext += $"\n {index} > {name10}";
			}
		}
		if (!Directory.Exists(path))
		{
			Directory.CreateDirectory(path);
		}
		if (!Directory.Exists(abilitespath))
		{
			Directory.CreateDirectory(abilitespath);
			ExampleManager.Setup();
		}
		if (!File.Exists(path + "/Explosions.txt"))
		{
			File.Create(path + "/Explosions.txt").Close();
			File.WriteAllText(path + "/Explosions.txt", Filetext);
		}
		List<Type> allTypes = new List<Type>();
		Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
		foreach (Assembly assembly in assemblies)
		{
			try
			{
				allTypes.AddRange(assembly.GetTypes());
			}
			catch (ReflectionTypeLoadException ex)
			{
				allTypes.AddRange(ex.Types);
			}
		}
		for (int j = 0; j < allTypes.Count; j++)
		{
			if (typeof(Component).IsAssignableFrom(allTypes[j]))
			{
				Filetext6 = Filetext6 + j + ">" + TypeExtensions.GetCompilableNiceFullName(allTypes[j]) + "\n";
				try
				{
					components.Add(TypeExtensions.GetCompilableNiceFullName(allTypes[j]), allTypes[j]);
				}
				catch (Exception)
				{
				}
			}
		}
		if (!File.Exists(path + "/Components.txt"))
		{
			File.Create(path + "/Components.txt").Close();
			File.WriteAllText(path + "/Components.txt", Filetext6);
		}
		SoundBankCategory[] catagories = ServiceLocator.GetService<SoundPlayer>().soundBank.Categories;
		for (int k = 0; k < ServiceLocator.GetService<SoundPlayer>().soundBank.Categories.Length; k++)
		{
			for (int o = 0; o < catagories[k].soundEffects.Length; o++)
			{
				Filetext2 = Filetext2 + ">" + catagories[k].categoryName + "&" + catagories[k].soundEffects[o].soundRef + "\n";
				if (ServiceLocator.GetService<SoundPlayer>().soundBank.GetSoundEffect(catagories[k].categoryName + "/" + catagories[k].soundEffects[o].soundRef) != null)
				{
					Filetext5 = Filetext5 + ">" + catagories[k].categoryName + "&" + catagories[k].soundEffects[o].soundRef + "\n";
				}
			}
		}
		if (!File.Exists(path + "/Sounds.txt"))
		{
			File.Create(path + "/Sounds.txt").Close();
			File.WriteAllText(path + "/Sounds.txt", Filetext5);
		}
		UnitEffectBase[] effectBases = Resources.FindObjectsOfTypeAll<UnitEffectBase>();
		index = 0;
		for (int l = 0; l < effectBases.Length; l++)
		{
			if (!Effects.ContainsValue(((Component)((Component)effectBases[l]).gameObject.transform.root).gameObject))
			{
				index++;
				string name6 = ((Object)((Component)((Component)effectBases[l]).gameObject.transform.root).gameObject).name;
				name6 = (name6.Contains("_1 Prefabs_VB") ? name6.Replace("_1 Prefabs_VB", "") : (name6.Contains("_1 Weapons_VB") ? name6.Replace("_1 Weapons_VB", "") : name6));
				name6 = (name6.Contains("_4 Moves_VB") ? name6.Replace("_4 Moves_VB", "") : (name6.Contains("_2 Projectiles_VB") ? name6.Replace("_2 Projectiles_VB", "") : name6));
				name6 = (name6.Contains("_3 Effects_VB") ? name6.Replace("_3 Effects_VB", "") : (name6.Contains("_0 UnitBases_VB") ? name6.Replace("_0 UnitBases_VB", "") : name6));
				while (Filetext3.Contains(name6))
				{
					name6 += "+";
				}
				Effects.Add(name6, ((Component)((Component)effectBases[l]).gameObject.transform.root).gameObject);
				Filetext3 += $"\n {index} > {name6}";
			}
		}
		if (!File.Exists(path + "/Effects.txt"))
		{
			File.Create(path + "/Effects.txt").Close();
			File.WriteAllText(path + "/Effects.txt", Filetext3);
		}
		UnitBlueprint[] allunits = ContentDatabase.Instance().GetAllUnitBlueprints().ToArray();
		Dictionary<string, string> langauge = Localizer.GetLanguage((Language)0);
		for (int m = 0; m < allunits.Length; m++)
		{
			Filetext7 = ((!langauge.ContainsKey(allunits[m].Entity.Name)) ? (Filetext7 + ">" + allunits[m].Entity.GUID.m_ID + ":" + allunits[m].Entity.Name + "\n") : (Filetext7 + ">" + allunits[m].Entity.GUID.m_ID + ":" + langauge[allunits[m].Entity.Name] + "\n"));
			units.Add(allunits[m].Entity.GUID.m_ID, allunits[m]);
		}
		if (!File.Exists(path + "/Units.txt"))
		{
			File.Create(path + "/Units.txt").Close();
			File.WriteAllText(path + "/Units.txt", Filetext7);
		}
		List<Sprite> allsprites = new List<Sprite>();
		List<Sprite> allsprites2 = new List<Sprite>();
		allsprites.AddRange(from n in ContentDatabase.Instance().GetFactionIcons()
			select n.Entity.LargeSpriteIcon);
		allsprites2.AddRange(from n in ContentDatabase.Instance().GetAllCombatMoves()
			select n.GetComponent<CharacterItem>().Entity.LargeSpriteIcon);
		int index4 = 0;
		for (int i2 = 0; i2 < allsprites.Count; i2++)
		{
			try
			{
				pepsis.Add(((Object)allsprites[i2]).name, allsprites[i2]);
				Filetext8 = Filetext8 + index4 + ">" + ((Object)allsprites[i2]).name + "\n";
				index4++;
			}
			catch (Exception)
			{
			}
		}
		for (int i3 = 0; i3 < allsprites2.Count; i3++)
		{
			try
			{
				pepsis.Add(((Object)allsprites2[i3]).name, allsprites2[i3]);
				Filetext8 = Filetext8 + index4 + ">" + ((Object)allsprites2[i3]).name + "\n";
				index4++;
			}
			catch (Exception)
			{
			}
		}
		if (!File.Exists(path + "/Sprites.txt"))
		{
			File.Create(path + "/Sprites.txt").Close();
			File.WriteAllText(path + "/Sprites.txt", Filetext8);
		}
		index = 0;
		Projectile[] projectiles = Resources.FindObjectsOfTypeAll<Projectile>();
		for (int i4 = 0; i4 < projectiles.Length; i4++)
		{
			if (!Projectiles.ContainsValue(((Component)((Component)projectiles[i4]).gameObject.transform.root).gameObject))
			{
				index++;
				string name2 = ((Object)((Component)((Component)projectiles[i4]).gameObject.transform.root).gameObject).name;
				name2 = (name2.Contains("_1 Prefabs_VB") ? name2.Replace("_1 Prefabs_VB", "") : (name2.Contains("_1 Weapons_VB") ? name2.Replace("_1 Weapons_VB", "") : name2));
				name2 = (name2.Contains("_4 Moves_VB") ? name2.Replace("_4 Moves_VB", "") : (name2.Contains("_2 Projectiles_VB") ? name2.Replace("_2 Projectiles_VB", "") : name2));
				name2 = (name2.Contains("_3 Effects_VB") ? name2.Replace("_3 Effects_VB", "") : (name2.Contains("_0 UnitBases_VB") ? name2.Replace("_0 UnitBases_VB", "") : name2));
				while (Filetext4.Contains(name2))
				{
					name2 += "+";
				}
				Projectiles.Add(name2, ((Component)((Component)projectiles[i4]).gameObject.transform.root).gameObject);
				Filetext4 += $"\n {index} > {name2}";
			}
		}
		if (!File.Exists(path + "/Projectiles.txt"))
		{
			File.Create(path + "/Projectiles.txt").Close();
			File.WriteAllText(path + "/Projectiles.txt", Filetext4);
		}
		Code.commnet = "------------------INIT------------------------";
		CreateNodeBlueprint("INTERVAL", new Dictionary<string, ContentType> { 
		{
			"Interval",
			(ContentType)3
		} }, NodeBlueprint.Type.Input, Color.grey, "Do Every...");
		CreateNodeBlueprint("WHENUNITDIE", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Input, Color.grey, "When Unit Dies...");
		CreateNodeBlueprint("ABILITYACTVIATE", new Dictionary<string, ContentType>
		{
			{
				"Delay",
				(ContentType)3
			},
			{
				"Range",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Input, Color.grey, "When ability triggered...");
		CreateNodeBlueprint("UNITWASATTACKED", new Dictionary<string, ContentType>
		{
			{
				"Delay",
				(ContentType)3
			},
			{
				"Range",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Input, Color.grey, "When unit gets attacked...");
		CreateNodeBlueprint("UNITSPAWN", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Input, Color.grey, "When Unit Spawns");
		CreateNodeBlueprint("PAUSE", new Dictionary<string, ContentType> { 
		{
			"Seconds",
			(ContentType)3
		} }, NodeBlueprint.Type.Function, Color.grey, "Do after pause");
		CreateNodeBlueprint("REAPET", new Dictionary<string, ContentType> { 
		{
			"Times",
			(ContentType)2
		} }, NodeBlueprint.Type.Input, Color.grey, "Repeat");
		CreateNodeBlueprint("NEWOBJ", new Dictionary<string, ContentType> { 
		{
			"Object name",
			(ContentType)0
		} }, NodeBlueprint.Type.Function, Color.green, "Create gameObject");
		CreateNodeBlueprint("ENEMY", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "Enemy unit");
		CreateNodeBlueprint("SELF", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "Self unit");
		CreateNodeBlueprint("FREAZE", new Dictionary<string, ContentType> { 
		{
			"Length",
			(ContentType)3
		} }, NodeBlueprint.Type.Function, Color.magenta, "freeze unit for");
		CreateNodeBlueprint("GAMEOBJ", new Dictionary<string, ContentType> { 
		{
			"Gameobj name",
			(ContentType)0
		} }, NodeBlueprint.Type.Function, Color.green, "Get gameobject from unit");
		CreateNodeBlueprint("DEAL_DAMAGE", new Dictionary<string, ContentType> { 
		{
			"Damage",
			(ContentType)3
		} }, NodeBlueprint.Type.Function, Color.red, "Deal Damage");
		CreateNodeBlueprint("DIE", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.red, "Kill");
		CreateNodeBlueprint("SPAWNPROJ", new Dictionary<string, ContentType>
		{
			{
				"ProjName",
				(ContentType)0
			},
			{
				"Spread",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.red, "Spawn projectile");
		CreateNodeBlueprint("EXPLOSION", new Dictionary<string, ContentType>
		{
			{
				"Explosion name",
				(ContentType)0
			},
			{
				"Damage",
				(ContentType)3
			},
			{
				"Team",
				(ContentType)2
			}
		}, NodeBlueprint.Type.Function, Color.red, "Summon Explosion at unit");
		CreateNodeBlueprint("ADDEFFECT", new Dictionary<string, ContentType> { 
		{
			"Effect",
			(ContentType)0
		} }, NodeBlueprint.Type.Function, Color.red, "Add Effect to unit");
		CreateNodeBlueprint("STUNWEAPONS", new Dictionary<string, ContentType>
		{
			{
				"Right",
				(ContentType)3
			},
			{
				"Left",
				(ContentType)3
			},
			{
				"Abilites",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.red, "Stun weapons for unit");
		CreateNodeBlueprint("SPAWNUNIT", new Dictionary<string, ContentType>
		{
			{
				"unit id",
				(ContentType)2
			},
			{
				"team",
				(ContentType)2
			}
		}, NodeBlueprint.Type.Function, Color.red, "Spawn unit at gameObj");
		CreateNodeBlueprint("ALLABS", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.magenta, "Play all abilites");
		CreateNodeBlueprint("IMMUNE", new Dictionary<string, ContentType> { 
		{
			"Length",
			(ContentType)3
		} }, NodeBlueprint.Type.Function, Color.magenta, "Make Immune for");
		CreateNodeBlueprint("TOGGLEPROPS", new Dictionary<string, ContentType>
		{
			{
				"From",
				(ContentType)2
			},
			{
				"To",
				(ContentType)2
			}
		}, NodeBlueprint.Type.Function, Color.magenta, "Toggle Props at indexs");
		CreateNodeBlueprint("ADDFORCE", new Dictionary<string, ContentType>
		{
			{
				"Forward",
				(ContentType)3
			},
			{
				"Upwareds",
				(ContentType)3
			},
			{
				"Sideway",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.magenta, "Add force to unit");
		CreateNodeBlueprint("ADDFORCEGLOBAL", new Dictionary<string, ContentType>
		{
			{
				"X",
				(ContentType)3
			},
			{
				"Y",
				(ContentType)3
			},
			{
				"Z",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.magenta, "Add global force to unit");
		CreateNodeBlueprint("PLAYSOUND", new Dictionary<string, ContentType>
		{
			{
				"SoundRef",
				(ContentType)0
			},
			{
				"Volume",
				(ContentType)3
			},
			{
				"Pitch",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.magenta, "Play sound at unit position");
		CreateNodeBlueprint("GOTOSELF", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.magenta, "Teleport to self unit");
		CreateNodeBlueprint("GOTOENEMY", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.magenta, "Teleport to enemy unit");
		CreateNodeBlueprint("TRANSFORMPOS", new Dictionary<string, ContentType>
		{
			{
				"x",
				(ContentType)3
			},
			{
				"y",
				(ContentType)3
			},
			{
				"z",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.yellow, "Change position of gameobj");
		CreateNodeBlueprint("TRANSFORMSCALE", new Dictionary<string, ContentType>
		{
			{
				"x",
				(ContentType)3
			},
			{
				"y",
				(ContentType)3
			},
			{
				"z",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.yellow, "Change scale of gameobj");
		CreateNodeBlueprint("TRANSFORMROT", new Dictionary<string, ContentType>
		{
			{
				"x",
				(ContentType)3
			},
			{
				"y",
				(ContentType)3
			},
			{
				"z",
				(ContentType)3
			}
		}, NodeBlueprint.Type.Function, Color.yellow, "Change rotation of gameobj");
		CreateNodeBlueprint("DESTROY", new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.yellow, "Destroy");
		CreateNodeBlueprint("ADDCOMP", new Dictionary<string, ContentType> { 
		{
			"Component name",
			(ContentType)0
		} }, NodeBlueprint.Type.Function, Color.yellow, "Add Component to gameObj");
		CreateNodeBlueprint("GETCOMP", new Dictionary<string, ContentType> { 
		{
			"Component name",
			(ContentType)0
		} }, NodeBlueprint.Type.Function, Color.yellow, "Get Component form gameObj");
		CreateNodeBlueprint("SetField", new Dictionary<string, ContentType>
		{
			{
				"Field name",
				(ContentType)0
			},
			{
				"Value",
				(ContentType)0
			}
		}, NodeBlueprint.Type.Function, Color.yellow, "Set Field for gameObj");
		CreateNodeBlueprint("VARCREATE", new Dictionary<string, ContentType> { 
		{
			"variable name",
			(ContentType)0
		} }, NodeBlueprint.Type.Function, Color.white, "Create variable");
		CreateNodeBlueprint("VARADD", new Dictionary<string, ContentType> { 
		{
			"value",
			(ContentType)3
		} }, NodeBlueprint.Type.Function, Color.white, "Change variable by");
		CreateNodeBlueprint("VARSET", new Dictionary<string, ContentType> { 
		{
			"value",
			(ContentType)3
		} }, NodeBlueprint.Type.Function, Color.white, "Set variable to");
		CreateNodeBlueprint("VARIF", new Dictionary<string, ContentType>
		{
			{
				"value",
				(ContentType)3
			},
			{
				"opperator",
				(ContentType)0
			}
		}, NodeBlueprint.Type.Function, Color.white, "If variable");
		for (int i5 = 0; i5 < Directory.GetFiles(abilitespath).Length; i5++)
		{
			if (!(Path.GetExtension(Directory.GetFiles(abilitespath)[i5]) != ".nodescene"))
			{
				SavedNodeScene n2 = JsonUtility.FromJson<SavedNodeScene>(File.ReadAllText(Directory.GetFiles(abilitespath)[i5]));
				SavedNodeSceneStorer.savedNodeScenes.Add(n2);
				AddAbility(n2.SavedNodeSceneToNodeScene());
			}
		}
		Code.commnet = "------------------Ability------------------------";
	}

	private static void AddAbility(NodeScene item)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Expected O, but got Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Expected O, but got Unknown
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Expected O, but got Unknown
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		nodeScenes.Add(item);
		GameObject val = new GameObject();
		((Object)val).hideFlags = (HideFlags)61;
		((Object)val).name = item.sceneName;
		SpecialAbility val2 = val.AddComponent<SpecialAbility>();
		((CharacterItem)(object)val2).SetField<CharacterItem>("m_entity", (object)new DatabaseEntity((WorkshopContentType)5)
		{
			GUID = new DatabaseID
			{
				m_ID = item.id,
				m_modID = -2
			},
			Name = item.sceneName
		});
		LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
		AssetLoader assetLoader = ContentDatabase.Instance().AssetLoader;
		Dictionary<DatabaseID, GameObject> dictionary = (Dictionary<DatabaseID, GameObject>)landfallContentDatabase.GetField<LandfallContentDatabase>("m_combatMoves");
		Dictionary<DatabaseID, Object> dictionary2 = (Dictionary<DatabaseID, Object>)assetLoader.GetField<AssetLoader>("m_nonStreamableAssets");
		val.AddComponent<NodeRunner>().nodeSceneindex = nodeScenes.FindIndex((NodeScene n) => n == item);
		val.AddComponent<NodeRunnerFixer>();
		val.AddComponent<DodgeMove>();
		ConditionalEvent val3 = val.AddComponent<ConditionalEvent>();
		val3.controllableByPlayer = true;
		ConditionalEventInstance val4 = new ConditionalEventInstance();
		val4.continuousEvent = new UnityEvent();
		val3.events = (ConditionalEventInstance[])(object)new ConditionalEventInstance[1] { val4 };
		val.AddComponent<GoToBodyPart>().playOnStart = true;
		val.GetComponent<GoToBodyPart>().targetPart = (TargetPart)1;
		val.AddComponent<DodgeMove>();
		val.AddComponent<OnlyRunWhenAddedToUnit>();
		SavedNodeSceneStorer.gameobjs.Add(val);
		Nodeids.Add(((CharacterItem)val2).Entity.GUID);
		dictionary2.Add(((CharacterItem)val2).Entity.GUID, (Object)(object)val2);
		dictionary.Add(((CharacterItem)val2).Entity.GUID, val);
		landfallContentDatabase.SetField<LandfallContentDatabase>("m_combatMoves", dictionary);
		assetLoader.SetField<AssetLoader>("m_nonStreamableAssets", dictionary2);
		((CharacterItem)val2).tags.Add(new Tag((TagType)0, "Custom Abilites"));
		if (pepsis.ContainsKey(item.sceneImage))
		{
			((CharacterItem)val2).Entity.SetSpriteIcon(pepsis[item.sceneImage]);
		}
	}

	private void CreateNodeBlueprint(string key, Dictionary<string, ContentType> fields, NodeBlueprint.Type type, Color color, string name, bool longfield = false)
	{
		//IL_0007: 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)
		NodeBlueprint obj = new NodeBlueprint
		{
			color = color,
			key = key,
			Name = name,
			type = type,
			fields = fields,
			LongField = longfield
		};
		((Object)obj).name = name;
		NodeBlueprint value = obj;
		NodeDatabase.Add(key, value);
		Object.DontDestroyOnLoad((Object)(object)NodeDatabase[key]);
	}

	public static void Reload()
	{
		//IL_0045: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		nodeScenes = new List<NodeScene>();
		Dictionary<DatabaseID, GameObject> dictionary = (Dictionary<DatabaseID, GameObject>)ContentDatabase.Instance().LandfallContentDatabase.GetField<LandfallContentDatabase>("m_combatMoves");
		Dictionary<DatabaseID, GameObject> dictionary2 = new Dictionary<DatabaseID, GameObject>();
		for (int i = 0; i < dictionary.Count; i++)
		{
			if (!Nodeids.Contains(dictionary.Keys.ToArray()[i]))
			{
				dictionary2.Add(dictionary.Keys.ToArray()[i], dictionary.Values.ToArray()[i]);
			}
		}
		Dictionary<DatabaseID, Object> dictionary3 = (Dictionary<DatabaseID, Object>)ContentDatabase.Instance().AssetLoader.GetField<AssetLoader>("m_nonStreamableAssets");
		Dictionary<DatabaseID, Object> dictionary4 = new Dictionary<DatabaseID, Object>();
		for (int j = 0; j < dictionary3.Count; j++)
		{
			if (!Nodeids.Contains(dictionary3.Keys.ToArray()[j]))
			{
				dictionary4.Add(dictionary3.Keys.ToArray()[j], dictionary3.Values.ToArray()[j]);
			}
		}
		ContentDatabase.Instance().AssetLoader.SetField<AssetLoader>("m_nonStreamableAssets", dictionary4);
		ContentDatabase.Instance().LandfallContentDatabase.SetField<LandfallContentDatabase>("m_combatMoves", dictionary2);
		for (int k = 0; k < Directory.GetFiles(abilitespath).Length; k++)
		{
			if (!(Path.GetExtension(Directory.GetFiles(abilitespath)[k]) != ".nodescene"))
			{
				SavedNodeScene savedNodeScene = JsonUtility.FromJson<SavedNodeScene>(File.ReadAllText(Directory.GetFiles(abilitespath)[k]));
				SavedNodeSceneStorer.savedNodeScenes.Add(savedNodeScene);
				AddAbility(savedNodeScene.SavedNodeSceneToNodeScene());
			}
		}
	}
}
public class Node : MonoBehaviour
{
	public LineRenderer line;

	public GameObject background;

	public bool GetValueAtRuntime;

	public NodeBlueprint blueprint;

	public Button button;

	public List<Node> connections = new List<Node>();

	public SavedNode CorispondingNode;

	public Dictionary<Node, BoxCollider2D> colliders = new Dictionary<Node, BoxCollider2D>();

	private void Awake()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Expected O, but got Unknown
		button = ((Component)this).GetComponentInChildren<Button>();
		((UnityEvent)button.onClick).AddListener((UnityAction)delegate
		{
			OnPointerClick();
		});
		background = ((Component)((Component)this).transform.Find("Background")).gameObject;
		if ((Object)(object)line == (Object)null)
		{
			line = ((Component)this).gameObject.AddComponent<LineRenderer>();
			((Renderer)line).material = new Material(Shader.Find("Sprites/Default"));
			LineRenderer obj = line;
			obj.widthMultiplier *= 3f;
			line.positionCount = 2;
		}
	}

	private void Update()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_0084: 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_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_0104: 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)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: 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_013e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)line == (Object)null)
		{
			line = ((Component)this).gameObject.AddComponent<LineRenderer>();
			((Renderer)line).material = new Material(Shader.Find("Sprites/Default"));
			LineRenderer obj = line;
			obj.widthMultiplier *= 3f;
		}
		line.positionCount = connections.Count * 2;
		int num = 0;
		for (int i = 0; i < connections.Count; i++)
		{
			line.SetPosition(num, ((Component)this).transform.position);
			line.SetPosition(num + 1, ((Component)connections[i]).transform.position);
			num += 2;
		}
		if (!Input.GetKey((KeyCode)306))
		{
			return;
		}
		float widthMultiplier = line.widthMultiplier;
		Vector2 point = Vector2.op_Implicit(Camera.current.ScreenToWorldPoint(Input.mousePosition));
		for (int j = 0; j < line.positionCount - 1; j++)
		{
			Vector2 a = Vector2.op_Implicit(line.GetPosition(j));
			Vector2 b = Vector2.op_Implicit(line.GetPosition(j + 1));
			float num2 = DistanceFromPointToLineSegment(point, a, b);
			if (num2 < widthMultiplier && Input.GetMouseButton(1))
			{
				connections.Remove(connections[(int)Math.Round((double)(j / 2) - 0.1)]);
			}
		}
	}

	private float DistanceFromPointToLineSegment(Vector2 point, Vector2 a, Vector2 b)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: 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_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: 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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = point - a;
		Vector2 val2 = b - a;
		float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude;
		float num = Vector2.Dot(val, val2);
		float num2 = Mathf.Clamp01(num / sqrMagnitude);
		Vector2 val3 = a + val2 * num2;
		return Vector2.Distance(point, val3);
	}

	public void OnPointerClick()
	{
		//IL_00a7: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)Object.FindObjectOfType<NodeManager>() != (Object)null))
		{
			return;
		}
		NodeManager nodeManager = Object.FindObjectOfType<NodeManager>();
		if (!((Object)(object)nodeManager.SelectedNode == (Object)(object)this) && !((Object)(object)nodeManager.LastSelectedNode == (Object)(object)this) && (!((Object)(object)nodeManager.SelectedNode == (Object)(object)nodeManager.LastSelectedNode) || !((Object)(object)nodeManager.SelectedNode != (Object)null) || !((Object)(object)nodeManager.LastSelectedNode != (Object)null)))
		{
			if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponentInChildren<Outline>()))
			{
				((Shadow)background.AddComponent<Outline>()).effectColor = Color.white;
				((Shadow)background.GetComponent<Outline>()).effectDistance = Vector2.one * 1.5f;
			}
			if ((Object)(object)nodeManager.SelectedNode != (Object)null && Object.op_Implicit((Object)(object)nodeManager.SelectedNode.background.GetComponent<Outline>()))
			{
				((Shadow)nodeManager.SelectedNode.background.GetComponent<Outline>()).effectColor = Color.gray;
			}
			if ((Object)(object)nodeManager.LastSelectedNode != (Object)null && Object.op_Implicit((Object)(object)nodeManager.LastSelectedNode.background.GetComponent<Outline>()))
			{
				Object.Destroy((Object)(object)nodeManager.LastSelectedNode.background.GetComponent<Outline>());
			}
			nodeManager.LastSelectedNode = nodeManager.SelectedNode;
			nodeManager.SelectedNode = this;
			((Component)this).transform.SetAsLastSibling();
			((Component)this).transform.SetSiblingIndex(((Component)this).transform.GetSiblingIndex() - 1);
		}
	}

	private void OnDestroy()
	{
		Object.Destroy((Object)(object)line);
	}
}
public class NodeBlueprint : ScriptableObject
{
	public enum Type
	{
		Input,
		SoftInput,
		Function
	}

	public string Name;

	public bool LongField = false;

	public string key;

	public Color color;

	public Dictionary<string, ContentType> fields = new Dictionary<string, ContentType>();

	public Type type;

	public Node Spawn()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Invalid comparison between Unknown and I4
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Invalid comparison between Unknown and I4
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Bundle_Manager.Node);
		val.AddComponent<NodeWindow>().dragRectTransform = val.GetComponent<RectTransform>();
		val.transform.parent = ((Component)GameObject.Find("Drawing Board").transform.Find("nodesScaler")).transform;
		val.transform.localPosition = Vector3.zero;
		((TMP_Text)val.GetComponentInChildren<TextMeshProUGUI>()).text = Name;
		((Graphic)((Component)val.transform.Find("Top")).GetComponent<Image>()).color = color;
		for (int i = 0; i < fields.Count; i++)
		{
			GameObject val2 = Object.Instantiate<GameObject>(((Component)val.transform.Find("Field")).gameObject);
			((Object)val2.transform).name = fields.Keys.ToArray()[i];
			val2.transform.position = ((Component)val.transform.Find("Field")).transform.position;
			Transform transform = val2.transform;
			transform.position += new Vector3((float)(i * -50), 0f, 0f);
			val2.GetComponentInChildren<TMP_InputField>().contentType = fields.Values.ToArray()[i];
			val2.transform.parent = val.transform;
			((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = fields.Keys.ToArray()[i];
			val2.SetActive(true);
			if (LongField)
			{
				val2.transform.localScale = new Vector3
				{
					x = val2.transform.localScale.x * 3f,
					y = val2.transform.localScale.y,
					z = val2.transform.localScale.z
				};
				Transform transform2 = val2.transform;
				transform2.position += new Vector3((float)(i * -100), 0f, 0f);
			}
			if ((((int)val2.GetComponentInChildren<TMP_InputField>().contentType == 2) | ((int)val2.GetComponentInChildren<TMP_InputField>().contentType == 3)) && ((((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text == "") | (((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text == null)))
			{
				((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = "0";
			}
		}
		if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<NodeManager>()) && Object.op_Implicit((Object)(object)Object.FindObjectOfType<Node>()))
		{
			val.transform.localScale = ((Component)Object.FindObjectOfType<Node>()).transform.localScale;
		}
		val.AddComponent<Node>().blueprint = this;
		val.transform.position = new Vector3(500f, 195f, 0f);
		Object.Destroy((Object)(object)((Component)val.transform.Find("Field")).gameObject);
		return val.GetComponent<Node>();
	}
}
public class NodeManager : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Func<bool> <>9__12_0;

		public static Func<bool> <>9__12_1;

		public static UnityAction <>9__12_3;

		public static UnityAction <>9__12_11;

		internal bool <awakeinternal>b__12_0()
		{
			return (Object)(object)GameObject.Find("Drawing Board") != (Object)null;
		}

		internal bool <awakeinternal>b__12_1()
		{
			return (Object)(object)GameObject.Find("Hitbox Movement") != (Object)null;
		}

		internal void <awakeinternal>b__12_3()
		{
			Main.sceneManager.EnterNodeChanger();
		}

		internal void <awakeinternal>b__12_11()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("UI/Click", 0.9f, ((Component)Camera.current).transform.position, (MaterialType)0, (Transform)null, 1f);
		}
	}

	public Node SelectedNode;

	public bool CanMove = true;

	public int NodesceneIndex = 0;

	public int nodeid = 0;

	public Node LastSelectedNode;

	private GameObject RightClickMenu;

	private GameObject SaveMenu;

	private GameObject QuitMenu;

	private GameObject nodescaler;

	public Vector3 scale = Vector3.one;

	private void Awake()
	{
		((MonoBehaviour)this).StartCoroutine(awakeinternal());
	}

	private void Update()
	{
		//IL_0164: 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)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Expected O, but got Unknown
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: 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_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0313: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown((KeyCode)9))
		{
			if (!RightClickMenu.activeSelf)
			{
				RightClickMenu.SetActive(true);
			}
			else
			{
				RightClickMenu.SetActive(false);
			}
		}
		if (Input.GetKeyDown((KeyCode)127) && (Object)(object)SelectedNode != (Object)null)
		{
			Node[] array = Object.FindObjectsOfType<Node>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].connections.Contains(SelectedNode))
				{
					array[i].connections.Remove(SelectedNode);
				}
			}
			Object.Destroy((Object)(object)((Component)SelectedNode).gameObject);
		}
		if (Input.GetKeyDown((KeyCode)13) && (Object)(object)SelectedNode != (Object)null && (Object)(object)LastSelectedNode != (Object)null && (Object)(object)SelectedNode != (Object)(object)LastSelectedNode && !SelectedNode.connections.Contains(LastSelectedNode))
		{
			SelectedNode.connections.Add(LastSelectedNode);
			LastSelectedNode.connections.Add(SelectedNode);
		}
		Vector2 mouseScrollDelta = Input.mouseScrollDelta;
		if (((Vector2)(ref mouseScrollDelta))[1] == 0f)
		{
			return;
		}
		if ((Object)(object)nodescaler == (Object)null)
		{
			if ((Object)(object)GameObject.Find("nodesScaler") == (Object)null)
			{
				return;
			}
			nodescaler = GameObject.Find("nodesScaler");
		}
		GameObject val = new GameObject("hehe");
		val.transform.SetParent(nodescaler.transform);
		val.transform.localScale = Vector3.one;
		Transform transform = ((Component)Object.FindObjectOfType<Canvas>()).transform;
		Vector2 val2 = default(Vector2);
		RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)(object)((transform is RectTransform) ? transform : null), Vector2.op_Implicit(Input.mousePosition), Camera.current, ref val2);
		val.transform.position = Vector2.op_Implicit(val2);
		Node[] array2 = Object.FindObjectsOfType<Node>();
		foreach (Node node in array2)
		{
			((Component)node).transform.SetParent(val.transform);
		}
		Transform transform2 = val.transform;
		Vector3 localScale = transform2.localScale;
		mouseScrollDelta = Input.mouseScrollDelta;
		float num = ((Vector2)(ref mouseScrollDelta))[1] / 15f;
		mouseScrollDelta = Input.mouseScrollDelta;
		float num2 = ((Vector2)(ref mouseScrollDelta))[1] / 15f;
		mouseScrollDelta = Input.mouseScrollDelta;
		transform2.localScale = localScale + new Vector3(num, num2, ((Vector2)(ref mouseScrollDelta))[1] / 15f);
		Vector3 val3 = scale;
		mouseScrollDelta = Input.mouseScrollDelta;
		float num3 = ((Vector2)(ref mouseScrollDelta))[1] / 15f;
		mouseScrollDelta = Input.mouseScrollDelta;
		float num4 = ((Vector2)(ref mouseScrollDelta))[1] / 15f;
		mouseScrollDelta = Input.mouseScrollDelta;
		scale = val3 + new Vector3(num3, num4, ((Vector2)(ref mouseScrollDelta))[1] / 15f);
		LineRenderer[] array3 = Object.FindObjectsOfType<LineRenderer>();
		foreach (LineRenderer val4 in array3)
		{
			float widthMultiplier = val4.widthMultiplier;
			mouseScrollDelta = Input.mouseScrollDelta;
			val4.widthMultiplier = widthMultiplier + ((Vector2)(ref mouseScrollDelta))[1] / 15f;
		}
		Node[] array4 = Object.FindObjectsOfType<Node>();
		foreach (Node node2 in array4)
		{
			((Component)node2).transform.SetParent(nodescaler.transform);
		}
		Object.Destroy((Object)(object)val);
	}

	private IEnumerator awakeinternal()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameObject.Find("Drawing Board") != (Object)null));
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameObject.Find("Hitbox Movement") != (Object)null));
		GameObject.Find("Hitbox Movement").AddComponent<NodeSceneMovement>().dragRectTransform = GameObject.Find("Hitbox Movement").GetComponent<RectTransform>();
		RightClickMenu = GameObject.Find("RightClickMenu");
		RightClickMenu.AddComponent<SetSiblingIndex>().Ind = 98;
		SaveMenu = GameObject.Find("FuckingSaveButton");
		((UnityEvent)SaveMenu.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
		{
			SaveNodeScene();
		});
		QuitMenu = GameObject.Find("FuckingQuitButton");
		ButtonClickedEvent onClick = QuitMenu.GetComponent<Button>().onClick;
		object obj = <>c.<>9__12_3;
		if (obj == null)
		{
			UnityAction val = delegate
			{
				Main.sceneManager.EnterNodeChanger();
			};
			<>c.<>9__12_3 = val;
			obj = (object)val;
		}
		((UnityEvent)onClick).AddListener((UnityAction)obj);
		RightClickMenu = GameObject.Find("RightClickMenu");
		GameObject Nodes = ((Component)new GameObject("nodesScaler").AddComponent<RectTransform>()).gameObject;
		if (StreamedSceneManager.currentscene != null)
		{
			nodeid = StreamedSceneManager.currentscene.id;
		}
		Nodes.transform.parent = GameObject.Find("Drawing Board").transform;
		for (int i = 0; i < 39; i++)
		{
			int f = int.Parse(i.ToString());
			if (f <= Main.NodeDatabase.Keys.ToArray().Length -