Decompiled source of AbilityCreator v2.0.0

AbilityCreator.dll

Decompiled a week 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 HarmonyLib;
using IDK;
using IDK.Help_Componets;
using IDK.NodeScripts;
using IDK.Node_Related_Scripts;
using IDK.Node_Related_Scripts.connection_stuff;
using Landfall.TABS;
using Landfall.TABS.AI;
using Landfall.TABS.AI.Components;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.GameMode;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using Newtonsoft.Json;
using ProGrids;
using Sirenix.Utilities;
using TFBGames;
using TMPro;
using Unity.Entities;
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_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Invalid comparison between Unknown and I4
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: 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_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		if (!nodeman.CanMove || (int)eventData.button != 0)
		{
			return;
		}
		if (nodeman.SelectedNodes.Contains(((Component)this).GetComponent<Node>()))
		{
			for (int i = 0; i < nodeman.SelectedNodes.Length; i++)
			{
				try
				{
					RectTransform obj = ((Component)nodeman.SelectedNodes[i]).GetComponent<NodeWindow>().dragRectTransform;
					obj.anchoredPosition += eventData.delta / 2f;
				}
				catch (Exception)
				{
				}
			}
		}
		else
		{
			RectTransform obj2 = dragRectTransform;
			obj2.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 EMPTY
{
	public class ExtraSerializedUnit : SerializedUnitBlueprint
	{
		public List<string> extraFieldNames;

		public List<string> extraFieldValues;
	}
	public static class Helper
	{
		public static ExtraSerializedUnit TurnExtra(this SerializedUnitBlueprint serializedUnitBlueprint)
		{
			//IL_002c: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_0128: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			return new ExtraSerializedUnit
			{
				attackSpeedMultiplier = serializedUnitBlueprint.attackSpeedMultiplier,
				customCost = serializedUnitBlueprint.customCost,
				damageMultiplier = serializedUnitBlueprint.damageMultiplier,
				leftProjectile = serializedUnitBlueprint.leftProjectile,
				m_animationMultiplier = serializedUnitBlueprint.m_animationMultiplier,
				m_armLimitMultiplier = serializedUnitBlueprint.m_armLimitMultiplier,
				m_attackDistanceCurve = serializedUnitBlueprint.m_attackDistanceCurve,
				m_combatMoves = serializedUnitBlueprint.m_combatMoves,
				m_faction = serializedUnitBlueprint.m_faction,
				m_fistRef = serializedUnitBlueprint.m_fistRef,
				m_hasRider = serializedUnitBlueprint.m_hasRider,
				m_health = serializedUnitBlueprint.m_health,
				m_holdingWithTwoHands = serializedUnitBlueprint.m_holdingWithTwoHands,
				m_icon = serializedUnitBlueprint.m_icon,
				m_id = serializedUnitBlueprint.m_id,
				m_leftWeapon = serializedUnitBlueprint.m_leftWeapon,
				m_leftWeaponData = serializedUnitBlueprint.m_leftWeaponData,
				m_massMultiplier = serializedUnitBlueprint.m_massMultiplier,
				m_movementSpeedMuiltiplier = serializedUnitBlueprint.m_movementSpeedMuiltiplier,
				m_movementTypes = serializedUnitBlueprint.m_movementTypes,
				m_name = serializedUnitBlueprint.m_name,
				m_propData = serializedUnitBlueprint.m_propData,
				m_props = serializedUnitBlueprint.m_props,
				m_rider = serializedUnitBlueprint.m_rider,
				m_rightWeapon = serializedUnitBlueprint.m_rightWeapon,
				m_rightWeaponData = serializedUnitBlueprint.m_rightWeaponData,
				m_sizeMultiplier = serializedUnitBlueprint.m_sizeMultiplier,
				m_stepMultiplier = serializedUnitBlueprint.m_stepMultiplier,
				m_targetingPriorityMultiplier = serializedUnitBlueprint.m_targetingPriorityMultiplier,
				m_targetingType = serializedUnitBlueprint.m_targetingType,
				m_turningData = serializedUnitBlueprint.m_turningData,
				m_turnSpeed = serializedUnitBlueprint.m_turnSpeed,
				m_turnSpeedCurve = serializedUnitBlueprint.m_turnSpeedCurve,
				m_unitBase = serializedUnitBlueprint.m_unitBase,
				m_weaponSeparation = serializedUnitBlueprint.m_weaponSeparation,
				rightProjectile = serializedUnitBlueprint.rightProjectile,
				unitDescription = serializedUnitBlueprint.unitDescription,
				useCustomCost = serializedUnitBlueprint.useCustomCost,
				voiceBundle = serializedUnitBlueprint.voiceBundle,
				voicePitch = serializedUnitBlueprint.voicePitch,
				voiceVolume = serializedUnitBlueprint.voiceVolume,
				extraFieldNames = new List<string>(),
				extraFieldValues = new List<string>()
			};
		}
	}
	[HarmonyPatch(typeof(CustomUnitHandler))]
	[HarmonyPatch("SaveUnit")]
	public class UnitEditorHarmonyPatch
	{
		private static bool Prefix(UnitBlueprint unitBlueprint, DatabaseID id = default(DatabaseID), Action refreshDoneCallback = null)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"LETS GO THE METHOD HAS BEEN PATCHEDDDDDD");
			try
			{
				DatabaseID val = default(DatabaseID);
				if (id == val)
				{
					unitBlueprint.Entity.GenerateNewID();
				}
				else
				{
					unitBlueprint.Entity.GUID = id;
				}
				MethodInfo method = typeof(CustomUnitHandler).GetMethod("SaveIcon", (BindingFlags)(-1));
				Action<Exception> action = delegate
				{
					ServiceLocator.GetService<CustomContentLoaderModIO>().QuickRefresh((WorkshopContentType)0, refreshDoneCallback);
				};
				ContentDatabase.Instance().AddUserUnitBlueprint(unitBlueprint);
				val = unitBlueprint.Entity.GUID;
				string text = ((object)(DatabaseID)(ref val)).ToString();
				string customUnitPath = UnitBlueprint.GetCustomUnitPath(text);
				string iconPath = CustomContentFilePaths.UnitDirectoryPath + "/" + text + "/icon.png";
				UnitBlueprint obj = unitBlueprint;
				val = default(DatabaseID);
				ExtraSerializedUnit extraSerializedUnit = AddAbilites(obj.SerializedUnit(val), unitBlueprint);
				string text2 = JsonUtility.ToJson((object)extraSerializedUnit, true);
				ServiceLocator.GetService<FileIOWrapper>().WriteAllText(customUnitPath, text2, (FileHandlingFileType)2, (Action<Exception>)delegate
				{
					method.Invoke(null, new object[3]
					{
						unitBlueprint.Entity.SpriteIcon.texture,
						iconPath,
						action
					});
				});
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Failed to Save Unit with exception " + ex));
				return true;
			}
			return false;
		}

		public static ExtraSerializedUnit AddAbilites(SerializedUnitBlueprint serializedUnitBlueprint, UnitBlueprint unitBlueprint)
		{
			ExtraSerializedUnit extraSerializedUnit = serializedUnitBlueprint.TurnExtra();
			Debug.Log((object)("Turned Extra! " + (object)extraSerializedUnit));
			for (int i = 0; i < unitBlueprint.objectsToSpawnAsChildren.Length; i++)
			{
				Debug.Log((object)("Checking if abiltiy is custom :" + (object)unitBlueprint.objectsToSpawnAsChildren[i]));
				if (Object.op_Implicit((Object)(object)unitBlueprint.objectsToSpawnAsChildren[i].GetComponent<NodeRunner>()))
				{
					Debug.Log((object)"It is custom!");
					NodeRunner component = unitBlueprint.objectsToSpawnAsChildren[i].GetComponent<NodeRunner>();
					extraSerializedUnit.extraFieldNames.Add(component.nodeScene.sceneName);
					Debug.Log((object)("Added field name:" + component.nodeScene.sceneName));
					string s = component.nodeScene.Jsonify((Formatting)1);
					byte[] bytes = Encoding.UTF8.GetBytes(s);
					string item = Convert.ToBase64String(bytes);
					extraSerializedUnit.extraFieldValues.Add(item);
					Debug.Log((object)"Added Json!");
				}
			}
			return extraSerializedUnit;
		}
	}
	[HarmonyPatch(typeof(CustomContentLoaderModIO))]
	[HarmonyPatch("ReadUnit")]
	public class LoadSerializedUnitPatch
	{
		public static bool Prefix(FileInfo file, int modID, Action<LoadedCustomUnitWrapper> doneCallback)
		{
			FileIOWrapper service = ServiceLocator.GetService<FileIOWrapper>();
			ContentDatabase contentDatabase = ContentDatabase.Instance();
			string path = file.FullName;
			service.ReadAllText(path, (FileHandlingFileType)2, (Action<string, Exception>)delegate(string json, Exception readException)
			{
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Expected O, but got Unknown
				if (string.IsNullOrEmpty(json))
				{
					Debug.LogFormat("Failed to load: {0}", new object[1] { path });
					doneCallback?.Invoke(null);
				}
				else
				{
					UnitBlueprint val;
					try
					{
						val = UnitBlueprint.DeserializedUnit((SerializedUnitBlueprint)(object)JsonUtility.FromJson<ExtraSerializedUnit>(json), contentDatabase.AssetLoader, contentDatabase.LandfallContentDatabase);
					}
					catch
					{
						val = UnitBlueprint.DeserializedUnit(JsonUtility.FromJson<SerializedUnitBlueprint>(json), contentDatabase.AssetLoader, contentDatabase.LandfallContentDatabase);
					}
					val.SetCustomUnit(modID, path);
					string iconPath = Path.Combine(file.Directory.FullName, "icon.png");
					val.SetIconPath(iconPath);
					doneCallback?.Invoke(new LoadedCustomUnitWrapper(val, Path.GetDirectoryName(path), path, 0L));
				}
			});
			return false;
		}
	}
	[HarmonyPatch(typeof(UnitBlueprint))]
	[HarmonyPatch("DeserializedUnit")]
	public class UnitLoaderHarmonyPatch
	{
		private static bool Prefix(SerializedUnitBlueprint data, AssetLoader assetLoader, LandfallContentDatabase landfallContentDatabase)
		{
			//IL_0072: 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_0081: Expected O, but got Unknown
			ExtraSerializedUnit serializedUnit = data as ExtraSerializedUnit;
			if (serializedUnit != null)
			{
				List<NodeScene> nodeScenes = Main.nodeScenes;
				Debug.Log((object)"Extra serialized unit detected!");
				int i;
				for (i = 0; i < serializedUnit.extraFieldNames.Count; i++)
				{
					try
					{
						if ((Object)(object)nodeScenes.Find((NodeScene n) => ((Object)n).name == serializedUnit.extraFieldNames[i]) == (Object)null)
						{
							JsonSerializerSettings val = new JsonSerializerSettings
							{
								ReferenceLoopHandling = (ReferenceLoopHandling)1
							};
							string s = serializedUnit.extraFieldValues[i];
							byte[] bytes = Convert.FromBase64String(s);
							string @string = Encoding.UTF8.GetString(bytes);
							SavedNodeScene savedNodeScene = JsonConvert.DeserializeObject<SavedNodeScene>(@string, val);
							if (!File.Exists(Main.abilitespath + "/" + savedNodeScene.sceneName + ".newnodescene"))
							{
								File.WriteAllText(Main.abilitespath + "/" + savedNodeScene.sceneName + ".newnodescene", @string);
							}
							SavedNodeSceneStorer.savedNodeScenes.Add(savedNodeScene);
							Main.Reload();
						}
					}
					catch (Exception ex)
					{
						Debug.Log((object)("Something went wrong while loading abilites, error:" + ex));
					}
				}
			}
			return true;
		}

		private static void Postfix(SerializedUnitBlueprint data, AssetLoader assetLoader, LandfallContentDatabase landfallContentDatabase, UnitBlueprint __result)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < data.m_combatMoves.Length; i++)
			{
				try
				{
					GameObject combatMove = landfallContentDatabase.GetCombatMove(data.m_combatMoves[i]);
					if (Object.op_Implicit((Object)(object)combatMove.GetComponent<NodeRunner>()) && !__result.objectsToSpawnAsChildren.Contains(combatMove))
					{
						__result.objectsToSpawnAsChildren = CollectionExtensions.AddItem<GameObject>((IEnumerable<GameObject>)__result.objectsToSpawnAsChildren, combatMove).ToArray();
					}
				}
				catch
				{
				}
			}
		}
	}
}
namespace IDK
{
	public static class Bundle_Manager
	{
		public static GameObject Node;

		public static GameObject Empty;

		public static GameObject ConnecterTrig;

		public static GameObject ConnecterUnit;

		public static GameObject ConnecterGameObject;

		public static GameObject ConnectorComponent;

		public static GameObject ConnecterVar;

		public static AssetBundle scenes;

		public static AssetBundle AbilityPrefabs;

		public static void Setup()
		{
			scenes = LoadBundle("IDK.Bundle__butt__Stuff.scenes");
			AbilityPrefabs = LoadBundle("IDK.Bundle__butt__Stuff.ability");
			Node = AbilityPrefabs.LoadAsset<GameObject>("Node");
			Empty = AbilityPrefabs.LoadAsset<GameObject>("Empty");
			ConnecterTrig = AbilityPrefabs.LoadAsset<GameObject>("Assets/Connecter_Trig.prefab");
			ConnecterUnit = AbilityPrefabs.LoadAsset<GameObject>("Assets/Connector_Unit.prefab");
			ConnecterGameObject = AbilityPrefabs.LoadAsset<GameObject>("Assets/Connector_GameObject.prefab");
			ConnecterVar = AbilityPrefabs.LoadAsset<GameObject>("Assets/Connector_Variable.prefab");
			ConnectorComponent = AbilityPrefabs.LoadAsset<GameObject>("Assets/Connector_Component.prefab");
			ConnecterTrig.AddComponent<NodeConnector>();
			ConnecterUnit.AddComponent<NodeConnector>();
			ConnecterGameObject.AddComponent<NodeConnector>();
			ConnecterVar.AddComponent<NodeConnector>();
			ConnectorComponent.AddComponent<NodeConnector>();
		}

		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 DestroySelfWhenObjectDestroyed : MonoBehaviour
	{
		public GameObject obj;

		private void Update()
		{
			if ((Object)(object)obj == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	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 static void TurnIntoExample(string json, string name)
		{
			byte[] bytes = Encoding.UTF8.GetBytes(json);
			string contents = Convert.ToBase64String(bytes);
			File.WriteAllText(Main.abilitespath + "/" + name + ".newnodescene", contents);
		}
	}
	public class RemoveAfterSecondsObject : MonoBehaviour
	{
		public Object other;

		public float time;

		private IEnumerator Start()
		{
			yield return (object)new WaitForSeconds(time);
			Object.Destroy(other);
		}
	}
	public class KillYourself : MonoBehaviour
	{
		public GameObject other;

		private void Update()
		{
			if ((Object)(object)other == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class AbilityCreator
	{
		public static void Log(object log)
		{
			Console.WriteLine("Abiltiy Creator:" + log);
		}
	}
	public class NodeRunner : MonoBehaviour
	{
		public NodeScene nodeScene;

		public List<ITriggerNode> triggerNodes = new List<ITriggerNode>();

		public void Begin()
		{
			nodeScene = nodeScene.CreateCopy();
			for (int i = 0; i < nodeScene.everyNode.Length; i++)
			{
				nodeScene.everyNode[i].valuePools = new Dictionary<Unit, ValuePool>();
			}
			if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>()))
			{
				((MonoBehaviour)this).StartCoroutine(BeginInternal());
			}
		}

		public IEnumerator BeginInternal()
		{
			yield return null;
			yield return null;
			SavedNode[] savedNodes = nodeScene.everyNode;
			Unit unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			SavedNode[] array = savedNodes;
			foreach (SavedNode savedNode in array)
			{
				if (savedNode.blueprint.nodeFunction != null && savedNode.blueprint.nodeFunction.BaseType == typeof(ITriggerNode))
				{
					ITriggerNode triggerNode = (ITriggerNode)Activator.CreateInstance(savedNode.blueprint.nodeFunction);
					triggerNode.StartFrame(savedNode, unit, savedNode.connections, savedNode.fields.ToArray(), this);
					triggerNodes.Add(triggerNode);
				}
			}
		}

		public IEnumerator TriggerConnection(SavedNode savedNode)
		{
			try
			{
				SavedNode node = savedNode.connections.GetNode(NodeBlueprint.ConnectionType.Trigger);
				((MonoBehaviour)this).StartCoroutine(RunNode(node));
			}
			catch (Exception ex)
			{
				Debug.Log((object)("(NodeRunner TriggerConnection) Something went wrong! exception:" + ex));
			}
			yield return null;
		}

		public IEnumerator RunNode(SavedNode node)
		{
			yield return null;
			Debug.Log((object)("Running node " + node?.blueprint?.Name + "..."));
			if ((Object)(object)node == (Object)null)
			{
				Debug.Log((object)"nvm this node is null \ud83d\ude23");
				yield break;
			}
			try
			{
				GetValueOfConnections(node);
				IBehaviorNode behaviorNode = (IBehaviorNode)Activator.CreateInstance(node.blueprint.nodeFunction);
				((MonoBehaviour)this).StartCoroutine(behaviorNode.RunNode(node, ((Component)((Component)this).transform.root).GetComponent<Unit>(), node.connections, node.fields.ToArray(), this));
			}
			catch (Exception ex)
			{
				Debug.Log((object)("(NodeRunner RunNode) Something went wrong! exception:" + ex));
			}
		}

		public void GetValueOfConnections(SavedNode savedNode)
		{
			List<Node.Connection> connections = savedNode.connections;
			foreach (Node.Connection item in connections)
			{
				try
				{
					if (!(item?.savedNode?.blueprint?.nodeFunction == null) && !(item.savedNode.blueprint.nodeFunction.BaseType != typeof(IValueNode)))
					{
						IValueNode valueNode = (IValueNode)Activator.CreateInstance(item.savedNode.blueprint.nodeFunction);
						valueNode.GetValuePool(item.savedNode, ((Component)((Component)this).transform.root).GetComponent<Unit>(), item.savedNode.connections, item.savedNode.fields.ToArray());
					}
				}
				catch (Exception ex)
				{
					Debug.Log((object)("(GetValueOfConnections) Something went wrong! exception:" + ex));
				}
			}
		}

		public IEnumerator Die()
		{
			yield return null;
			yield return null;
			yield return null;
			yield return null;
			yield return null;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void Update()
		{
			if (((Component)((Component)this).transform.root).GetComponent<Unit>().dead)
			{
				((MonoBehaviour)this).StartCoroutine(Die());
			}
		}
	}
	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();
		}
	}
	[Serializable]
	public class NodeScene : MonoBehaviour
	{
		public SavedNode[] everyNode;

		public string sceneName = "";

		public string sceneDescription = "";

		public string sceneImage = "";

		public int id;

		public int nodeSceneIndex
		{
			get
			{
				try
				{
					if (Main.nodeScenes.FindIndex((NodeScene n) => (Object)(object)n == (Object)(object)this) != -1)
					{
						return Main.nodeScenes.FindIndex((NodeScene n) => (Object)(object)n == (Object)(object)this);
					}
					throw new Exception();
				}
				catch (Exception)
				{
					return Main.nodeScenes.Count;
				}
			}
		}

		public string Jsonify(Formatting formatting = 1)
		{
			//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_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			SavedNodeScene savedNodeScene = SavedNodeScene.Instance(this);
			JsonSerializerSettings val = new JsonSerializerSettings
			{
				ReferenceLoopHandling = (ReferenceLoopHandling)1
			};
			return JsonConvert.SerializeObject((object)savedNodeScene, formatting, val);
		}

		public NodeScene CreateCopy()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			GameObject val = new GameObject("Node Scene (" + sceneName + ")");
			NodeScene nodeScene = val.AddComponent<NodeScene>();
			nodeScene.everyNode = everyNode;
			nodeScene.id = id;
			nodeScene.sceneDescription = sceneDescription;
			nodeScene.sceneImage = sceneImage;
			nodeScene.sceneName = sceneName;
			return nodeScene;
		}

		public void Awake()
		{
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}
	}
	[BepInPlugin("AAC", "Alter Ability Creator", "2.0.0")]
	public class Main : BaseUnityPlugin
	{
		public static GameObject sliceEffect;

		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<string, UnitBlueprint> units = new Dictionary<string, UnitBlueprint>();

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

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

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

		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
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			if ((int)Application.platform == 1)
			{
				path = GamePaths.PersistentDataPath + "/Abilty Creator";
				abilitespath = path + "/Abilites";
			}
			Harmony val = new Harmony("Alter.AbilityCreator");
			val.PatchAll();
			Code.commnet = "Dear Code Viewer, prepare your self for the most unoptomized, evil, racist code you will ever see";
			((MonoBehaviour)this).StartCoroutine(Call());
			string[] commandLineArgs = Environment.GetCommandLineArgs();
			string[] array = commandLineArgs;
			foreach (string text in array)
			{
				if (text.EndsWith(".newnodescene"))
				{
					File.Copy(text, abilitespath + "/" + Path.GetFileName(text));
					Debug.Log((object)("Added da ability : " + Path.GetFileNameWithoutExtension(text)));
				}
			}
		}

		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"));
			GameObject sliceObj = ContentDatabase.Instance().LandfallContentDatabase.GetCombatMove(new DatabaseID(-1, 1998224969));
			sliceEffect = sliceObj.GetComponent<BlockMove>().sliceEffect;
			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 = "";
			string Filetext9 = "";
			int index = 0;
			for (int i = 0; i < allexplo.Length; i++)
			{
				if (!explosions.ContainsValue(((Component)((Component)allexplo[i]).gameObject.transform.root).gameObject))
				{
					index++;
					string name4 = ((Object)((Component)((Component)allexplo[i]).gameObject.transform.root).gameObject).name;
					name4 = (name4.Contains("_1 Prefabs_VB") ? name4.Replace("_1 Prefabs_VB", "") : (name4.Contains("_1 Weapons_VB") ? name4.Replace("_1 Weapons_VB", "") : name4));
					name4 = (name4.Contains("_4 Moves_VB") ? name4.Replace("_4 Moves_VB", "") : (name4.Contains("_2 Projectiles_VB") ? name4.Replace("_2 Projectiles_VB", "") : name4));
					name4 = (name4.Contains("_3 Effects_VB") ? name4.Replace("_3 Effects_VB", "") : (name4.Contains("_0 UnitBases_VB") ? name4.Replace("_0 UnitBases_VB", "") : name4));
					while (Filetext.Contains(name4))
					{
						name4 += "+";
					}
					explosions.Add(name4, ((Component)((Component)allexplo[i]).gameObject.transform.root).gameObject);
					Filetext += $"\n {index} > {name4}";
				}
			}
			if (!Directory.Exists(Main.path))
			{
				Directory.CreateDirectory(Main.path);
			}
			if (!Directory.Exists(abilitespath))
			{
				Directory.CreateDirectory(abilitespath);
				ExampleManager.Setup();
			}
			File.WriteAllText(Main.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]))
				{
					string name13 = TypeExtensions.GetCompilableNiceFullName(allTypes[j]);
					while (Filetext6.Contains(name13))
					{
						name13 += "+";
					}
					Filetext6 = Filetext6 + ">" + name13 + "\n";
					try
					{
						components.Add(name13, allTypes[j]);
					}
					catch (Exception)
					{
					}
				}
			}
			File.WriteAllText(Main.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";
					}
				}
			}
			File.WriteAllText(Main.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 name8 = ((Object)((Component)((Component)effectBases[l]).gameObject.transform.root).gameObject).name;
					name8 = (name8.Contains("_1 Prefabs_VB") ? name8.Replace("_1 Prefabs_VB", "") : (name8.Contains("_1 Weapons_VB") ? name8.Replace("_1 Weapons_VB", "") : name8));
					name8 = (name8.Contains("_4 Moves_VB") ? name8.Replace("_4 Moves_VB", "") : (name8.Contains("_2 Projectiles_VB") ? name8.Replace("_2 Projectiles_VB", "") : name8));
					name8 = (name8.Contains("_3 Effects_VB") ? name8.Replace("_3 Effects_VB", "") : (name8.Contains("_0 UnitBases_VB") ? name8.Replace("_0 UnitBases_VB", "") : name8));
					while (Filetext3.Contains(name8))
					{
						name8 += "+";
					}
					Effects.Add(name8, ((Component)((Component)effectBases[l]).gameObject.transform.root).gameObject);
					Filetext3 = Filetext3 + "\n > " + name8;
				}
			}
			File.WriteAllText(Main.path + "/Effects.txt", Filetext3);
			ParticleSystem[] allParticles = Resources.FindObjectsOfTypeAll<ParticleSystem>();
			for (int m = 0; m < allParticles.Length; m++)
			{
				string text = ((Object)((Component)allParticles[m]).transform.root).name + "+" + ((Object)allParticles[m]).name;
				while (particles.ContainsKey(text))
				{
					text += "+";
				}
				particles.Add(text, ((Component)allParticles[m]).gameObject);
				Filetext9 = Filetext9 + "> " + text + "\n";
			}
			File.WriteAllText(Main.path + "/Particles.txt", Filetext9);
			UnitBlueprint[] allunits = ContentDatabase.Instance().GetAllUnitBlueprints().ToArray();
			Dictionary<string, string> langauge = Localizer.GetLanguage((Language)0);
			for (int i2 = 0; i2 < allunits.Length; i2++)
			{
				try
				{
					if (langauge.ContainsKey(allunits[i2].Entity.Name))
					{
						Filetext7 = Filetext7 + i2 + ">" + langauge[allunits[i2].Entity.Name] + "\n";
						units.Add(langauge[allunits[i2].Entity.Name], allunits[i2]);
					}
					else
					{
						Filetext7 = Filetext7 + i2 + ">" + allunits[i2].Entity.Name + "\n";
						units.Add(allunits[i2].Entity.Name, allunits[i2]);
					}
				}
				catch
				{
				}
			}
			File.WriteAllText(Main.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 i3 = 0; i3 < allsprites.Count; i3++)
			{
				try
				{
					pepsis.Add(((Object)allsprites[i3]).name, allsprites[i3]);
					Filetext8 = Filetext8 + index4 + ">" + ((Object)allsprites[i3]).name + "\n";
					index4++;
				}
				catch (Exception)
				{
				}
			}
			for (int i4 = 0; i4 < allsprites2.Count; i4++)
			{
				try
				{
					pepsis.Add(((Object)allsprites2[i4]).name, allsprites2[i4]);
					Filetext8 = Filetext8 + index4 + ">" + ((Object)allsprites2[i4]).name + "\n";
					index4++;
				}
				catch (Exception)
				{
				}
			}
			File.WriteAllText(Main.path + "/Sprites.txt", Filetext8);
			index = 0;
			Projectile[] projectiles = Resources.FindObjectsOfTypeAll<Projectile>();
			for (int i5 = 0; i5 < projectiles.Length; i5++)
			{
				if (!Projectiles.ContainsValue(((Component)((Component)projectiles[i5]).gameObject.transform.root).gameObject))
				{
					index++;
					string name9 = ((Object)((Component)((Component)projectiles[i5]).gameObject.transform.root).gameObject).name;
					name9 = (name9.Contains("_1 Prefabs_VB") ? name9.Replace("_1 Prefabs_VB", "") : (name9.Contains("_1 Weapons_VB") ? name9.Replace("_1 Weapons_VB", "") : name9));
					name9 = (name9.Contains("_4 Moves_VB") ? name9.Replace("_4 Moves_VB", "") : (name9.Contains("_2 Projectiles_VB") ? name9.Replace("_2 Projectiles_VB", "") : name9));
					name9 = (name9.Contains("_3 Effects_VB") ? name9.Replace("_3 Effects_VB", "") : (name9.Contains("_0 UnitBases_VB") ? name9.Replace("_0 UnitBases_VB", "") : name9));
					while (Filetext4.Contains(name9))
					{
						name9 += "+";
					}
					Projectiles.Add(name9, ((Component)((Component)projectiles[i5]).gameObject.transform.root).gameObject);
					Filetext4 += $"\n {index} > {name9}";
				}
			}
			File.WriteAllText(Main.path + "/Projectiles.txt", Filetext4);
			Code.commnet = "------------------INIT------------------------";
			CreateNodeBlueprint("BATTLE_BEGIN", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.Trigger }, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.grey, "When Battle Begins", "Triggers", longfield: false, typeof(WhenBattleBegins));
			CreateNodeBlueprint("UNIT_SPAWN", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.Trigger }, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.grey, "When unit spawns", "Triggers", longfield: false, typeof(WhenUnitSpawned));
			CreateNewNodeBlueprint("ENDBATTLE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field
				{
					name = "stupidDumbassNode",
					isDropdown = true,
					dropDowns = new string[2] { "Win", "Lose" }
				}
			}, typeof(EndBattle), NodeBlueprint.Type.Function, Color.white, "End battle", "Misc");
			CreateNewNodeBlueprint("GETMAXUNITHEALTH", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.GiveVariable
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field
				{
					name = "valueType",
					isDropdown = true,
					dropDowns = new string[2] { "Normal", "Precentage" }
				}
			}, typeof(GetMaxUnitHealth), NodeBlueprint.Type.Function, Color.white, "Get max unit health", "Data");
			CreateNewNodeBlueprint("GETUNITHEALTH", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.GiveVariable
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field
				{
					name = "valueType",
					isDropdown = true,
					dropDowns = new string[2] { "Normal", "Precentage" }
				}
			}, typeof(GetUnitHealth), NodeBlueprint.Type.Function, Color.white, "Get unit health", "Data");
			CreateNewNodeBlueprint("SETUNITHEALTH", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.Trigger
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("value", (ContentType)3),
				new NodeBlueprint.Field
				{
					name = "valueType",
					isDropdown = true,
					dropDowns = new string[5] { "Set", "Add", "Set (%)", "Add (%)", "Multiply" }
				}
			}, typeof(SetUnitHealth), NodeBlueprint.Type.Function, Color.white, "Set unit health", "Data");
			CreateNewNodeBlueprint("SETUNITDAMAGE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.Trigger
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("value", (ContentType)3),
				new NodeBlueprint.Field
				{
					name = "valueType",
					isDropdown = true,
					dropDowns = new string[5] { "Set", "Add", "Set (%)", "Add (%)", "Multiply" }
				}
			}, typeof(SetUnitDamage), NodeBlueprint.Type.Function, Color.white, "Set unit damage", "Data");
			CreateNewNodeBlueprint("SETUNITCOOLDOWN", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.Trigger
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("value", (ContentType)3),
				new NodeBlueprint.Field
				{
					name = "valueType",
					isDropdown = true,
					dropDowns = new string[5] { "Set", "Add", "Set (%)", "Add (%)", "Multiply" }
				}
			}, typeof(SetUnitDamage), NodeBlueprint.Type.Function, Color.white, "Set unit cooldown", "Data");
			CreateNewNodeBlueprint("QUICKBUFF", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.Trigger
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("length", (ContentType)3),
				new NodeBlueprint.Field("amount", (ContentType)3),
				new NodeBlueprint.Field
				{
					name = "mode",
					isDropdown = true,
					dropDowns = new string[5] { "All", "Heal only", "Increase damage", "Speed up", "Speed up attacks" }
				}
			}, typeof(QuickBuff), NodeBlueprint.Type.Function, Color.white, "Quick buff", "Data");
			CreateNodeBlueprint("LOG", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveVariable
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.white, "Log variable", "Variables", longfield: false, typeof(LogVariable));
			CreateNewNodeBlueprint("ABILITYACTVIATE", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.Trigger }, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("Delay", (ContentType)3),
				new NodeBlueprint.Field("Range", (ContentType)3)
			}, typeof(WhenAbilityTriggered), NodeBlueprint.Type.Input, Color.grey, "When ability triggered...", "Triggers");
			CreateNewNodeBlueprint("UNITWASATTACKED", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.Trigger }, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("Delay", (ContentType)3),
				new NodeBlueprint.Field("Range", (ContentType)3)
			}, typeof(UnitWasAttacked), NodeBlueprint.Type.Input, Color.grey, "When unit gets attacked...", "Triggers");
			CreateNodeBlueprint("INTERVAL", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.Trigger }, new Dictionary<string, ContentType> { 
			{
				"Interval",
				(ContentType)3
			} }, NodeBlueprint.Type.Input, Color.grey, "Do Every...", "Triggers", longfield: false, typeof(DoEveryNode));
			CreateNodeBlueprint("WHENUNITDIE", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.Trigger }, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Input, Color.grey, "When Unit Dies...", "Triggers", longfield: false, typeof(WhenUnitDies));
			CreateNodeBlueprint("WHENUNITDAMAGED", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.GiveUnit
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Input, Color.grey, "When unit damaged...", "Triggers", longfield: false, typeof(WhenUnitDamaged));
			CreateNodeBlueprint("WHENUNITATTACKS", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.GiveUnit
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Input, Color.grey, "When unit attacks...", "Triggers", longfield: false, typeof(WhenUnitAttacks));
			CreateNewNodeBlueprint("PROJECTILERANGE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.GiveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("Range", (ContentType)3),
				new NodeBlueprint.Field("Block Power", (ContentType)3)
			}, typeof(WhenProjectileEntersRange), NodeBlueprint.Type.Input, Color.grey, "When projectile in range...", "Triggers");
			CreateNodeBlueprint("IS_BATTLE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.grey, "Run if in battle state", "Control", longfield: false, typeof(IsBattleState));
			CreateNodeBlueprint("PAUSE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered
			}, new Dictionary<string, ContentType> { 
			{
				"Seconds",
				(ContentType)3
			} }, NodeBlueprint.Type.Function, Color.grey, "Do after pause", "Control", longfield: false, typeof(PauseNode));
			CreateNodeBlueprint("REAPET", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered
			}, new Dictionary<string, ContentType>
			{
				{
					"Times",
					(ContentType)2
				},
				{
					"Delay",
					(ContentType)3
				}
			}, NodeBlueprint.Type.Input, Color.grey, "Repeat", "Control", longfield: false, typeof(ReapetNode));
			CreateNodeBlueprint("NEWOBJ", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.GiveGameObject }, new Dictionary<string, ContentType> { 
			{
				"Object name",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.green, "Create gameObject", "Gameobjects", longfield: false, typeof(CreateGameobject));
			CreateNodeBlueprint("ENEMY", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.GiveUnit }, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "Enemy unit", "Units", longfield: false, typeof(EnemyNode));
			CreateNodeBlueprint("SELF", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.GiveUnit }, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "Self unit", "Units", longfield: false, typeof(SelfNode));
			CreateNodeBlueprint("EXPSENSIVETEAMMATE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.GiveUnit
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "Most expensive teammate of unit", "Units", longfield: false, typeof(MostExspensiveTeamMateUnit));
			CreateNodeBlueprint("EXPSENSIVEENEMY", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.GiveUnit
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "Most expensive enemy of unit", "Units", longfield: false, typeof(MostExspensiveEnemy));
			CreateNodeBlueprint("ALLTEAM", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.GiveUnit }, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "All units of same team", "Units", longfield: false, typeof(AllTeam));
			CreateNodeBlueprint("ALLOTHERTEAM", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.GiveUnit }, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "All units of other team", "Units", longfield: false, typeof(AllOtherTeam));
			CreateNodeBlueprint("TEAMMATE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.GiveUnit,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.green, "Closest team mate of unit", "Unit Tools", longfield: false, typeof(ClosestTeamMateUnit));
			CreateNodeBlueprint("FREAZE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType> { 
			{
				"Length",
				(ContentType)3
			} }, NodeBlueprint.Type.Function, Color.magenta, "freeze unit for", "Unit Tools", longfield: false, typeof(FreezeNode));
			CreateNewNodeBlueprint("GAMEOBJ", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.GiveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field
				{
					name = "BodyPart",
					isDropdown = true,
					dropDowns = new string[12]
					{
						"Root", "Head", "Torso", "Right Arm", "Left Arm", "Right Hand", "Left Hand", "Right Knee", "Left Knee", "Right Foot",
						"Left Foot", "All"
					}
				}
			}, typeof(GetGameobject), NodeBlueprint.Type.Function, Color.green, "Get body part of unit", "Unit Tools");
			CreateNodeBlueprint("DEAL_DAMAGE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType> { 
			{
				"Damage",
				(ContentType)3
			} }, NodeBlueprint.Type.Function, Color.red, "Deal Damage", "Unit Tools", longfield: false, typeof(Deal_Damage));
			CreateNodeBlueprint("DIE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.red, "Kill", "Unit Tools", longfield: false, typeof(DieNode));
			CreateNodeBlueprint("SPAWNPROJ", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.GiveGameObject
			}, new Dictionary<string, ContentType>
			{
				{
					"ProjName",
					(ContentType)0
				},
				{
					"Spread",
					(ContentType)3
				}
			}, NodeBlueprint.Type.Function, Color.red, "Spawn projectile", "Projectiles", longfield: false, typeof(SpawnProjectileNode));
			CreateNewNodeBlueprint("PARRYPROJECTILE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field
				{
					name = "PlaySliceEffect",
					isDropdown = true,
					dropDowns = new string[2] { "Play Slice", "Don't" }
				},
				new NodeBlueprint.Field
				{
					name = "Reflect",
					isDropdown = true,
					dropDowns = new string[2] { "Reflect", "Don't" }
				}
			}, typeof(ParryProjectile), NodeBlueprint.Type.Function, Color.red, "Parry projectile", "Projectiles");
			CreateNewNodeBlueprint("PLAYSLICE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.GiveGameObject
			}, new List<NodeBlueprint.Field>(), typeof(PlaySlice), NodeBlueprint.Type.Function, Color.red, "Play slice effect", "Projectiles");
			CreateNewNodeBlueprint("EXPLOSION", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.GiveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("Explosion name", (ContentType)0),
				new NodeBlueprint.Field("Damage", (ContentType)3),
				new NodeBlueprint.Field
				{
					isDropdown = true,
					dropDowns = new string[2] { "My team", "Other team" },
					name = "Team"
				}
			}, typeof(SpawnExplosionNode), NodeBlueprint.Type.Function, Color.red, "Summon Explosion", "Misc");
			CreateNewNodeBlueprint("PARTICLE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.GiveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("Projectile name", (ContentType)0),
				new NodeBlueprint.Field("Size", (ContentType)3),
				new NodeBlueprint.Field("Loop", (ContentType)0)
				{
					isDropdown = true,
					dropDowns = new string[2] { "Loop", "Don't" }
				},
				new NodeBlueprint.Field("Speed", (ContentType)3),
				new NodeBlueprint.Field("Length", (ContentType)3),
				new NodeBlueprint.Field("Follow", (ContentType)3)
				{
					isDropdown = true,
					dropDowns = new string[2] { "Follow", "Don't" }
				}
			}, typeof(SpawnParticleNode), NodeBlueprint.Type.Function, Color.red, "Spawn particle", "Misc");
			CreateNodeBlueprint("ADDEFFECT", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType> { 
			{
				"Effect",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.red, "Add Effect to unit", "Unit Tools", longfield: false, typeof(AddEffectNode));
			CreateNodeBlueprint("STUNWEAPONS", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType> { 
			{
				"Time",
				(ContentType)3
			} }, NodeBlueprint.Type.Function, Color.red, "Stun weapons for unit", "Unit Tools", longfield: false, typeof(StunWeaponsNode));
			CreateNewNodeBlueprint("SPAWNUNIT", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.GiveUnit
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("unit id", (ContentType)0),
				new NodeBlueprint.Field
				{
					name = "Team",
					isDropdown = true,
					dropDowns = new string[2] { "My Team", "Other Team" }
				}
			}, typeof(SpawnUnitNode), NodeBlueprint.Type.Function, Color.red, "Spawn unit at gameobject", "Units");
			CreateNodeBlueprint("ALLABS", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.magenta, "Play all abilites", "Unit Tools", longfield: false, typeof(PlayAllAbilites));
			CreateNodeBlueprint("IMMUNE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType> { 
			{
				"Length",
				(ContentType)3
			} }, NodeBlueprint.Type.Function, Color.magenta, "Make Immune for", "Unit Tools", longfield: false, typeof(MakeUnitImmune));
			CreateNodeBlueprint("TOGGLEPROPS", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new Dictionary<string, ContentType>
			{
				{
					"From",
					(ContentType)2
				},
				{
					"To",
					(ContentType)2
				}
			}, NodeBlueprint.Type.Function, Color.magenta, "Toggle Props at indexs", "Unit Tools", longfield: false, typeof(ToggleProps));
			CreateNodeBlueprint("ADDFORCE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new Dictionary<string, ContentType>
			{
				{
					"Forward",
					(ContentType)3
				},
				{
					"Upwareds",
					(ContentType)3
				},
				{
					"Sideway",
					(ContentType)3
				}
			}, NodeBlueprint.Type.Function, Color.magenta, "Add force to gameobject", "Gameobjects", longfield: false, typeof(AddForceNode));
			CreateNodeBlueprint("ADDFORCEGLOBAL", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new Dictionary<string, ContentType>
			{
				{
					"X",
					(ContentType)3
				},
				{
					"Y",
					(ContentType)3
				},
				{
					"Z",
					(ContentType)3
				}
			}, NodeBlueprint.Type.Function, Color.magenta, "Add global force to gameobject", "Gameobjects", longfield: false, typeof(AddGlobalForceNode));
			CreateNodeBlueprint("PLAYSOUND", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new Dictionary<string, ContentType>
			{
				{
					"SoundRef",
					(ContentType)0
				},
				{
					"Volume",
					(ContentType)3
				},
				{
					"Pitch",
					(ContentType)3
				}
			}, NodeBlueprint.Type.Function, Color.magenta, "Play sound at gameobject position", "Gameobjects", longfield: false, typeof(PlaySoundNode));
			CreateNewNodeBlueprint("GOTOUNIT", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.ReciveUnit
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field
				{
					name = "IDKME",
					isDropdown = true,
					dropDowns = new string[3] { "Both", "Position only", "Rotation only" }
				},
				new NodeBlueprint.Field
				{
					name = "BodyPart",
					isDropdown = true,
					dropDowns = new string[10] { "Head", "Torso", "Right Arm", "Left Arm", "Right Hand", "Left Hand", "Right Knee", "Left Knee", "Right Foot", "Left Foot" }
				}
			}, typeof(GoToUnitNode), NodeBlueprint.Type.Function, Color.magenta, "Teleport gameobject to unit", "Gameobjects");
			CreateNewNodeBlueprint("GETDISTANCE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.ReciveUnit,
				NodeBlueprint.ConnectionType.GiveVariable
			}, new List<NodeBlueprint.Field>(), typeof(GetDistanceFrom), NodeBlueprint.Type.Function, Color.magenta, "Get distance from unit to gameobject", "Gameobjects");
			CreateNewNodeBlueprint("TRANSFORMPOS", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("x", (ContentType)3),
				new NodeBlueprint.Field("y", (ContentType)3),
				new NodeBlueprint.Field("z", (ContentType)3),
				new NodeBlueprint.Field
				{
					name = "TransformType",
					isDropdown = true,
					dropDowns = new string[2] { "Global", "Local" }
				},
				new NodeBlueprint.Field
				{
					name = "TransformTypeOther",
					isDropdown = true,
					dropDowns = new string[2] { "Add", "Set" }
				}
			}, typeof(TransformPositionNode), NodeBlueprint.Type.Function, Color.yellow, "Modify position of gameobj", "Gameobjects");
			CreateNodeBlueprint("TRANSFORMSCALE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new Dictionary<string, ContentType>
			{
				{
					"x",
					(ContentType)3
				},
				{
					"y",
					(ContentType)3
				},
				{
					"z",
					(ContentType)3
				}
			}, NodeBlueprint.Type.Function, Color.yellow, "Change scale of gameobj", "Gameobjects", longfield: false, typeof(TransformScaleNode));
			CreateNewNodeBlueprint("TRANSFORMROT", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("x", (ContentType)3),
				new NodeBlueprint.Field("y", (ContentType)3),
				new NodeBlueprint.Field("z", (ContentType)3),
				new NodeBlueprint.Field
				{
					name = "TransformType",
					isDropdown = true,
					dropDowns = new string[2] { "Global", "Local" }
				},
				new NodeBlueprint.Field
				{
					name = "TransformTypeOther",
					isDropdown = true,
					dropDowns = new string[2] { "Add", "Set" }
				}
			}, typeof(TransformRotationNode), NodeBlueprint.Type.Function, Color.yellow, "Modify rotation of gameobj", "Gameobjects");
			CreateNewNodeBlueprint("COLOR", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("red", (ContentType)3),
				new NodeBlueprint.Field("green", (ContentType)3),
				new NodeBlueprint.Field("blue", (ContentType)3),
				new NodeBlueprint.Field("alpha", (ContentType)3),
				new NodeBlueprint.Field("index", (ContentType)2),
				new NodeBlueprint.Field
				{
					name = "Color children",
					isDropdown = true,
					dropDowns = new string[2] { "Color children", "Don't" }
				}
			}, typeof(ColorObjectNode), NodeBlueprint.Type.Function, Color.yellow, "Color object", "Gameobjects");
			CreateNodeBlueprint("DESTROY", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.yellow, "Destroy", "Gameobjects", longfield: false, typeof(DestroyNode));
			CreateNodeBlueprint("CREATEFUNC", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.Trigger }, new Dictionary<string, ContentType> { 
			{
				"Function name",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.yellow, "Create function", "Functions", longfield: false, typeof(CreateFunctionNode));
			CreateNodeBlueprint("RUNFUNC", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.Trigger
			}, new Dictionary<string, ContentType> { 
			{
				"Function name",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.yellow, "Run function", "Functions", longfield: false, typeof(RunFunctionNode));
			CreateNodeBlueprint("ADDONHITACTION", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.ReciveGameObject
			}, new Dictionary<string, ContentType>(), NodeBlueprint.Type.Function, Color.yellow, "Add projectile hit action ", "Projectiles", longfield: false, typeof(AddProjectileOnHitAction));
			CreateNodeBlueprint("ADDCOMP", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.GiveComponent
			}, new Dictionary<string, ContentType> { 
			{
				"Component name",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.yellow, "Add Component to gameObj", "Gameobjects", longfield: false, typeof(AddComponentNode));
			CreateNodeBlueprint("GETCOMP", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.ReciveGameObject,
				NodeBlueprint.ConnectionType.GiveComponent
			}, new Dictionary<string, ContentType> { 
			{
				"Component name",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.yellow, "Get Component form gameObj", "Gameobjects", longfield: false, typeof(GetComponentNode));
			CreateNodeBlueprint("SetField", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveComponent
			}, new Dictionary<string, ContentType>
			{
				{
					"Field name",
					(ContentType)0
				},
				{
					"Value",
					(ContentType)0
				}
			}, NodeBlueprint.Type.Function, Color.yellow, "Set Field for gameObj", "Gameobjects", longfield: false, typeof(SetFieldNode));
			CreateNodeBlueprint("INVOKE", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveComponent
			}, new Dictionary<string, ContentType> { 
			{
				"Method name",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.yellow, "Invoke Method From Component", "Gameobjects", longfield: false, typeof(InvokeMethodNode));
			CreateNodeBlueprint("VARCREATE", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.GiveVariable }, new Dictionary<string, ContentType> { 
			{
				"variable name",
				(ContentType)0
			} }, NodeBlueprint.Type.Function, Color.white, "Get variable", "Variables", longfield: false, typeof(CreateVariableNode));
			CreateNodeBlueprint("VARADD", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveVariable
			}, new Dictionary<string, ContentType> { 
			{
				"value",
				(ContentType)3
			} }, NodeBlueprint.Type.Function, Color.white, "Change variable by", "Variables", longfield: false, typeof(ChangeVariableBy));
			CreateNodeBlueprint("VARSET", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Trigger,
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveVariable
			}, new Dictionary<string, ContentType> { 
			{
				"value",
				(ContentType)3
			} }, NodeBlueprint.Type.Function, Color.white, "Set variable to", "Variables", longfield: false, typeof(SetVariableTo));
			CreateNewNodeBlueprint("VARIF", new List<NodeBlueprint.ConnectionType>
			{
				NodeBlueprint.ConnectionType.Triggered,
				NodeBlueprint.ConnectionType.ReciveVariable,
				NodeBlueprint.ConnectionType.Trigger
			}, new List<NodeBlueprint.Field>
			{
				new NodeBlueprint.Field("value", (ContentType)3),
				new NodeBlueprint.Field
				{
					name = "Operator",
					isDropdown = true,
					dropDowns = new string[5] { "=", ">", "<", "<=", ">=" }
				}
			}, typeof(IfVariableNode), NodeBlueprint.Type.Function, Color.white, "If variable", "Variables");
			CreateNodeBlueprint("RANDOM", new List<NodeBlueprint.ConnectionType> { NodeBlueprint.ConnectionType.GiveVariable }, new Dictionary<string, ContentType>
			{
				{
					"Min Value",
					(ContentType)2
				},
				{
					"Max Value",
					(ContentType)2
				}
			}, NodeBlueprint.Type.Function, Color.white, "Choose Random", "Variables", longfield: false, typeof(RandomNode));
			for (int i6 = 0; i6 < Directory.GetFiles(abilitespath).Length; i6++)
			{
				string path = Directory.GetFiles(abilitespath)[i6];
				if (!(Path.GetExtension(path) != ".newnodescene"))
				{
					SavedNodeScene n2 = LoadAbility(File.ReadAllText(path));
					AddAbility(n2.SavedNodeSceneToNodeScene());
				}
			}
			Code.commnet = "------------------Ability------------------------";
			yield return (object)new WaitForSecondsRealtime(5f);
			Reload();
		}

		public static GameObject CreateAbility(NodeScene nodeScene)
		{
			//IL_0027: 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_0036: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (!nodeScenes.Contains(nodeScene))
			{
				nodeScenes.Add(nodeScene);
			}
			GameObject val = new GameObject(nodeScene.sceneName)
			{
				hideFlags = (HideFlags)61
			};
			SpecialAbility val2 = val.AddComponent<SpecialAbility>();
			val2.SetField("m_entity", (object)new DatabaseEntity((WorkshopContentType)5)
			{
				GUID = new DatabaseID
				{
					m_ID = nodeScene.id,
					m_modID = -2
				},
				Name = nodeScene.sceneName
			});
			NodeRunner nodeRunner = val.AddComponent<NodeRunner>();
			nodeRunner.nodeScene = nodeScene;
			val.AddComponent<NodeRunnerFixer>();
			val.AddComponent<DodgeMove>();
			val.AddComponent<ConditionalEvent>();
			GoToBodyPart val3 = val.AddComponent<GoToBodyPart>();
			val3.targetPart = (TargetPart)1;
			val.AddComponent<OnlyRunWhenAddedToUnit>();
			if (pepsis.ContainsKey(nodeScene.sceneImage))
			{
				((CharacterItem)val2).Entity.SetSpriteIcon(pepsis[nodeScene.sceneImage]);
			}
			return val;
		}

		public static void AddAbility(NodeScene nodeScene)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateAbility(nodeScene);
			SpecialAbility component = val.GetComponent<SpecialAbility>();
			SavedNodeSceneStorer.gameobjs.Add(val);
			nodeIDS.Add(((CharacterItem)component).Entity.GUID);
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			AssetLoader assetLoader = ContentDatabase.Instance().AssetLoader;
			Dictionary<DatabaseID, Object> field = assetLoader.GetField<Dictionary<DatabaseID, Object>>("m_nonStreamableAssets");
			Dictionary<DatabaseID, GameObject> field2 = landfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_combatMoves");
			field.Add(((CharacterItem)component).Entity.GUID, (Object)(object)val);
			field2.Add(((CharacterItem)component).Entity.GUID, val);
			landfallContentDatabase.SetField("m_combatMoves", field2);
			assetLoader.SetField("m_nonStreamableAssets", field);
			((CharacterItem)component).tags.Add(new Tag((TagType)0, "Custom Abilites"));
			if (abilites.ContainsKey(val.GetComponent<NodeRunner>().nodeScene.sceneName))
			{
				abilites.Remove(val.GetComponent<NodeRunner>().nodeScene.sceneName);
			}
			abilites.Add(val.GetComponent<NodeRunner>().nodeScene.sceneName, val);
		}

		private void CreateNodeBlueprint(string key, List<NodeBlueprint.ConnectionType> connectionsTypes, Dictionary<string, ContentType> fields, NodeBlueprint.Type type, Color color, string name, string Tab, bool longfield = false, Type node = null)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			List<NodeBlueprint.Field> list = new List<NodeBlueprint.Field>();
			KeyValuePair<string, ContentType>[] array = fields.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				list.Add(new NodeBlueprint.Field
				{
					contentType = array[i].Value,
					name = array[i].Key
				});
			}
			if (node != null)
			{
				NodeBlueprint obj = new NodeBlueprint
				{
					color = color,
					key = key,
					Name = name,
					type = type,
					fields = list,
					LongField = longfield
				};
				((Object)obj).name = name;
				obj.connections = connectionsTypes;
				obj.nodeFunction = node;
				obj.tab = Tab;
				NodeBlueprint value = obj;
				NodeDatabase.Add(key, value);
				Object.DontDestroyOnLoad((Object)(object)NodeDatabase[key]);
			}
			else
			{
				NodeBlueprint obj2 = new NodeBlueprint
				{
					color = color,
					key = key,
					Name = name,
					type = type,
					fields = list,
					LongField = longfield
				};
				((Object)obj2).name = name;
				obj2.connections = connectionsTypes;
				obj2.tab = Tab;
				NodeBlueprint value2 = obj2;
				NodeDatabase.Add(key, value2);
			}
		}

		private void CreateNewNodeBlueprint(string key, List<NodeBlueprint.ConnectionType> connectionsTypes, List<NodeBlueprint.Field> fields, Type node, NodeBlueprint.Type type, Color color, string name, string Tab, 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;
			obj.connections = connectionsTypes;
			obj.nodeFunction = node;
			obj.tab = Tab;
			NodeBlueprint value = obj;
			NodeDatabase.Add(key, value);
			Object.DontDestroyOnLoad((Object)(object)NodeDatabase[key]);
		}

		public static void Reload()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			abilites = new Dictionary<string, GameObject>();
			nodeScenes = new List<NodeScene>();
			ContentDatabase val = ContentDatabase.Instance();
			LandfallContentDatabase landfallContentDatabase = val.LandfallContentDatabase;
			Dictionary<DatabaseID, GameObject> field = landfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_combatMoves");
			KeyValuePair<DatabaseID, GameObject>[] array = field.Where((KeyValuePair<DatabaseID, GameObject> n) => !nodeIDS.Contains(n.Key)).ToArray();
			Dictionary<DatabaseID, GameObject> dictionary = new Dictionary<DatabaseID, GameObject>();
			for (int i = 0; i < array.Length; i++)
			{
				dictionary.Add(array[i].Key, array[i].Value);
			}
			landfallContentDatabase.SetField("m_combatMoves", dictionary);
			AssetLoader assetLoader = val.AssetLoader;
			Dictionary<DatabaseID, Object> field2 = assetLoader.GetField<Dictionary<DatabaseID, Object>>("m_nonStreamableAssets");
			KeyValuePair<DatabaseID, Object>[] array2 = field2.Where((KeyValuePair<DatabaseID, Object> n) => !nodeIDS.Contains(n.Key)).ToArray();
			Dictionary<DatabaseID, Object> dictionary2 = new Dictionary<DatabaseID, Object>();
			for (int j = 0; j < array2.Length; j++)
			{
				dictionary2.Add(array2[j].Key, array2[j].Value);
			}
			assetLoader.SetField("m_nonStreamableAssets", dictionary2);
			string[] files = Directory.GetFiles(abilitespath);
			for (int k = 0; k < files.Length; k++)
			{
				string json = File.ReadAllText(files[k]);
				SavedNodeScene savedNodeScene = LoadAbility(json);
				AddAbility(savedNodeScene.SavedNodeSceneToNodeScene());
			}
			UnitBlueprint[] array3 = val.UserContentDatabase.GetUnitBlueprints().ToArray();
			for (int l = 0; l < array3.Length; l++)
			{
				CleanUnitblueprint(array3[l]);
			}
		}

		private static void CleanUnitblueprint(UnitBlueprint unitBlueprint)
		{
			for (int i = 0; i < unitBlueprint.objectsToSpawnAsChildren.Length; i++)
			{
				GameObject val = unitBlueprint.objectsToSpawnAsChildren[i];
				if (Object.op_Implicit((Object)(object)val.GetComponent<NodeRunner>()))
				{
					List<GameObject> list = unitBlueprint.objectsToSpawnAsChildren.ToList();
					list.Remove(val);
					list.Add(abilites[val.GetComponent<NodeRunner>().nodeScene.sceneName]);
					unitBlueprint.objectsToSpawnAsChildren = list.ToArray();
				}
			}
		}

		public static SavedNodeScene LoadAbility(string json)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			JsonSerializerSettings val = new JsonSerializerSettings
			{
				ReferenceLoopHandling = (ReferenceLoopHandling)1
			};
			SavedNodeScene savedNodeScene = JsonConvert.DeserializeObject<SavedNodeScene>(json, val);
			SavedNodeSceneStorer.savedNodeScenes.Add(savedNodeScene);
			return savedNodeScene;
		}
	}
	public class Node : MonoBehaviour
	{
		public class Connection
		{
			public NodeBlueprint.ConnectionType connectionsType;

			public SavedNode savedNode;
		}

		public LineRenderer line;

		public GameObject background;

		public bool GetValueAtRuntime;

		public NodeBlueprint blueprint;

		public Button button;

		public SavedNode corispondingNode;

		public Dictionary<NodeBlueprint.ConnectionType, NodeConnector> Connections => ((Component)this).GetComponentsInChildren<NodeConnector>().ToDictionary((NodeConnector n) => n.connectionsType);

		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
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			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;
			}
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<NodeManager>()))
			{
				Node[] array = (from n in Object.FindObjectsOfType<Node>()
					where (Object)(object)n != (Object)(object)this
					select n).ToArray();
				if (array.Length != 0)
				{
					((Component)this).transform.localScale = ((Component)array[0]).transform.localScale;
				}
				else
				{
					((Component)this).transform.localScale = Vector3.one;
				}
			}
		}

		private void Update()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			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;
			}
		}

		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 int GetNodeInstanceID()
		{
			Node[] array = Object.FindObjectsOfType<Node>();
			for (int i = 0; i < array.Length; i++)
			{
				if ((Object)(object)array[i] == (Object)(object)this)
				{
					return i + 1;
				}
			}
			return 0;
		}

		public void OnPointerClick()
		{
			if (!((Object)(object)Object.FindObjectOfType<NodeManager>() != (Object)null))
			{
				return;
			}
			NodeManager nodeManager = Object.FindObjectOfType<NodeManager>();
			if (!Input.GetKey((KeyCode)304))
			{
				if (!nodeManager.SelectedNodes.Contains(this))
				{
					if (nodeManager.SelectedNodes != null && nodeManager.SelectedNodes.Length != 0)
					{
						for (int i = 0; i < nodeManager.SelectedNodes.Length; i++)
						{
							nodeManager.SelectedNodes[i].RemoveOutline();
						}
					}
					AddOutline();
				}
				else
				{
					RemoveOutline();
				}
				((Component)this).transform.SetAsLastSibling();
				((Component)this).transform.SetSiblingIndex(((Component)this).transform.GetSiblingIndex() - 1);
			}
			else if (nodeManager.SelectedNodes.Contains(this))
			{
				RemoveOutline();
			}
			else
			{
				AddOutline();
			}
		}

		public void AddOutline()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)background.GetComponent<Outline>()))
			{
				((Shadow)background.AddComponent<Outline>()).effectColor = Color.white;
				((Shadow)background.GetComponent<Outline>()).effectDistance = Vector2.one * 2.5f;
			}
		}

		public void RemoveOutline()
		{
			if (Object.op_Implicit((Object)(object)background.GetComponent<Outline>()))
			{
				Object.Destroy((Object)(object)background.GetComponent<Outline>());
			}
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)line);
		}
	}
	public class NodeBlueprint : ScriptableObject
	{
		public enum ConnectionType
		{
			Triggered,
			Trigger,
			ReciveUnit,
			GiveUnit,
			ReciveGameObject,
			GiveGameObject,
			ReciveVariable,
			GiveVariable,
			ReciveComponent,
			GiveComponent
		}

		public enum Type
		{
			Input,
			Function,
			SoftInput
		}

		public struct Field
		{
			public string name;

			public ContentType contentType;

			public bool isDropdown;

			public string[] dropDowns;

			public Field(string name, ContentType contentType)
			{
				//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)
				this.name = name;
				this.contentType = contentType;
				isDropdown = false;
				dropDowns = new string[0];
			}
		}

		public System.Type nodeFunction;

		public string tab;

		public string Name;

		public bool LongField = false;

		public string key;

		public Color color;

		public List<Field> fields = new List<Field>();

		public List<ConnectionType> connections;

		public Type type;

		public Node Spawn()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Invalid comparison between Unknown and I4
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Invalid comparison between Unknown and I4
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: 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)((Component)GameObject.Find("AbilitySaveButton").transform.parent).transform.Find("nodesScaler")).transform;
			val.transform.localPosition = Vector3.zero;
			if (color == Color.white)
			{
				((Graphic)val.GetComponentInChildren<TextMeshProUGUI>()).color = Color.black;
			}
			((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("Fields").Find("Field")).gameObject);
				((Object)val2.transform).name = fields[i].name;
				val2.GetComponentInChildren<TMP_InputField>().contentType = fields[i].contentType;
				val2.transform.parent = val.transform.Find("Fields");
				((TMP_Text)((Component)val2.transform.Find("Field")).GetComponentInChildren<TextMeshProUGUI>()).text = fields[i].name;
				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 transform = val2.transform;
					transform.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)((Component)val2.transform.Find("Field")).GetComponentInChildren<TextMeshProUGUI>()).text == "") | (((TMP_Text)((Component)val2.transform.Find("Field")).GetComponentInChildren<TextMeshProUGUI>()).text == null)))
				{
					((TMP_Text)((Component)val2.transform.Find("Field")).GetComponentInChildren<TextMeshProUGUI>()).text = "0";
				}
				if (fields[i].isDropdown)
				{
					((Component)val2.GetComponentInChildren<TMP_InputField>()).gameObject.SetActive(false);
					val2.GetComponentInChildren<TMP_Dropdown>().options = ((IEnumerable<string>)fields[i].dropDowns).Select((Func<string, OptionData>)((string n) => new OptionData(n))).ToList();
				}
				else
				{
					((Component)val2.GetComponentInChildren<TMP_Dropdown>()).gameObject.SetActive(false);
				}
				val2.AddComponent<NodeField>();
			}
			Node node = val.AddComponent<Node>();
			node.blueprint = this;
			val.transform.position = new Vector3(500f, 195f, 0f);
			Object.Destroy((Object)(object)((Component)val.transform.Find("Fields").Find("Field")).gameObject);
			Transform val3 = val.transform.Find("Recives");
			Transform val4 = val.transform.Find("Out");
			foreach (ConnectionType connection in connections)
			{
				if (connection == ConnectionType.Triggered)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterTrig, val3).GetComponent<NodeConnector>().connectionsType = ConnectionType.Triggered;
				}
				if (connection == ConnectionType.ReciveUnit)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterUnit, val3).GetComponent<NodeConnector>().connectionsType = ConnectionType.ReciveUnit;
				}
				if (connection == ConnectionType.ReciveGameObject)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterGameObject, val3).GetComponent<NodeConnector>().connectionsType = ConnectionType.ReciveGameObject;
				}
				if (connection == ConnectionType.ReciveVariable)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterVar, val3).GetComponent<NodeConnector>().connectionsType = ConnectionType.ReciveVariable;
				}
				if (connection == ConnectionType.ReciveComponent)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnectorComponent, val3).GetComponent<NodeConnector>().connectionsType = ConnectionType.ReciveComponent;
				}
				if (connection == ConnectionType.Trigger)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterTrig, val4).GetComponent<NodeConnector>().connectionsType = ConnectionType.Trigger;
				}
				if (connection == ConnectionType.GiveGameObject)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterGameObject, val4).GetComponent<NodeConnector>().connectionsType = ConnectionType.GiveGameObject;
				}
				if (connection == ConnectionType.GiveUnit)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterUnit, val4).GetComponent<NodeConnector>().connectionsType = ConnectionType.GiveUnit;
				}
				if (connection == ConnectionType.GiveVariable)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnecterVar, val4).GetComponent<NodeConnector>().connectionsType = ConnectionType.GiveVariable;
				}
				if (connection == ConnectionType.GiveComponent)
				{
					Object.Instantiate<GameObject>(Bundle_Manager.ConnectorComponent, val4).GetComponent<NodeConnector>().connectionsType = ConnectionType.GiveComponent;
				}
			}
			int num = val3.childCount;
			if (fields.Count > num)
			{
				num = fields.Count;
			}
			if (val4.childCount > num)
			{
				num = val4.childCount;
			}
			for (int j = 0; j < num; j++)
			{
				if (j != 0)
				{
					Vector3 localScale = ((Component)val.transform.Find("Background")).transform.localScale;
					localScale.y += 0.2f;
					((Component)val.transform.Find("Background")).transform.localScale = localScale;
				}
			}
			return node;
		}
	}
	public class NodeManager : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Outline, bool> <>9__1_0;

			public static Func<Outline, Node> <>9__1_1;

			public static Func<bool> <>9__18_0;

			public static Func<bool> <>9__18_1;

			public static UnityAction <>9__18_3;

			internal bool <get_SelectedNodes>b__1_0(Outline n)
			{
				return Object.op_Implicit((Object)(object)((Component)((Component)n).transform.parent).GetComponent<Node>());
			}

			internal Node <get_SelectedNodes>b__1_1(Outline n)
			{
				return ((Component)((Component)n).transform.parent).GetComponent<Node>();
			}

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

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

			internal void <Awakeinternal>b__18_3()
			{
				Main.sceneManager.EnterNodeChanger();
			}
		}

		public bool CanMove = true;

		public int NodesceneIndex = 0;

		public int nodeid = 0;

		private GameObject RightClickMenu;

		private GameObject SaveMenu;

		private GameObject QuitMenu;

		private GameObject nodescaler;

		public UnitBlueprint unitBlueprint1;

		public UnitBlueprint unitBlueprint2;

		public Vector3 scale = Vector3.one;

		private bool buttonState;

		public Node[] SelectedNodes => (from n in Object.FindObjectsOfType<Outline>()
			where Object.op_Implicit((Object)(object)((Component)((Component)n).transform.parent).GetComponent<Node>())
			select ((Component)((Component)n).transform.parent).GetComponent<Node>()).ToArray();

		private void Awake()
		{
			if ((from n in Object.FindObjectsOfType<NodeManager>()
				where (Object)(object)n != (Object)(object)this
				select n).Count() != 0)
			{
				Object.Destroy((Object)(object)this);
			}
			((MonoBehaviour)this).StartCoroutine(Awakeinternal());
		}

		private void Update()
		{
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: 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)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unkn