Decompiled source of Architect v3.15.6

Architect/Architect.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Architect.Api;
using Architect.Behaviour.Abilities;
using Architect.Behaviour.Custom;
using Architect.Behaviour.Fixers;
using Architect.Behaviour.Utility;
using Architect.Config;
using Architect.Config.Types;
using Architect.Content;
using Architect.Content.Custom;
using Architect.Content.Preloads;
using Architect.Editor;
using Architect.Events;
using Architect.Events.Blocks;
using Architect.Events.Blocks.Config;
using Architect.Events.Blocks.Config.Types;
using Architect.Events.Blocks.Events;
using Architect.Events.Blocks.Objects;
using Architect.Events.Blocks.Operators;
using Architect.Events.Blocks.Outputs;
using Architect.Events.Vars;
using Architect.Multiplayer;
using Architect.Multiplayer.Ssmp;
using Architect.Multiplayer.Ssmp.Data;
using Architect.Objects;
using Architect.Objects.Categories;
using Architect.Objects.Groups;
using Architect.Objects.Placeable;
using Architect.Objects.Tools;
using Architect.Placements;
using Architect.Prefabs;
using Architect.Sharer;
using Architect.Sharer.Info;
using Architect.Sharer.States;
using Architect.Storage;
using Architect.Utils;
using Architect.Workshop;
using Architect.Workshop.Config;
using Architect.Workshop.Items;
using Architect.Workshop.Types;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GlobalEnums;
using GlobalSettings;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using InControl;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using Newtonsoft.Json;
using Patchwork.Handlers;
using PrepatcherPlugin;
using QuickWarp;
using SSMP.Api.Client;
using SSMP.Api.Client.Networking;
using SSMP.Api.Server;
using SSMP.Api.Server.Networking;
using SSMP.Math;
using SSMP.Networking.Packet;
using Silksong.AssetHelper.ManagedAssets;
using Silksong.AssetHelper.Plugin;
using TMProOld;
using TeamCherry.Localization;
using TeamCherry.SharedUtils;
using TeamCherry.Splines;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;
using UnityStandardAssets.ImageEffects;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Architect")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("3.15.6.0")]
[assembly: AssemblyInformationalVersion("3.15.6+4f9ceec47022e9d0c283b0c3bb10aaec249ccc15")]
[assembly: AssemblyProduct("Architect")]
[assembly: AssemblyTitle("Architect")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.15.6.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Architect
{
	[BepInPlugin("com.cometcake575.architect", "Architect", "3.15.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ArchitectPlugin : BaseUnityPlugin
	{
		internal static ArchitectPlugin Instance;

		internal static ManualLogSource Logger;

		public static readonly Sprite BlankSprite = ResourceUtils.LoadSpriteResource("blank", (FilterMode)1, default(Vector4), 300f);

		private void Awake()
		{
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Architect has loaded!");
			SceneUtils.Init();
			PrefabManager.Init();
			HookUtils.Init();
			TitleUtils.Init();
			StorageManager.Init();
			Settings.Init(((BaseUnityPlugin)this).Config);
			MiscFixers.Init();
			EnemyFixers.Init();
			HazardFixers.Init();
			InteractableFixers.Init();
			Categories.Init();
			ActionManager.Init();
			CoopManager.Init();
			EditManager.Init();
			CursorManager.Init();
			EditorUI.Init();
			VanillaObjects.Init();
			SplineObjects.Init();
			LegacyObjects.Init();
			UtilityObjects.Init();
			AbilityObjects.Init();
			MiscObjects.Init();
			RespawnMarkerManager.Init();
			PlacementManager.Init();
			BroadcasterHooks.Init();
			SharerManager.Init();
			PreloadManager.Init();
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)HeroController.instance))
			{
				EditManager.Update();
				HazardFixers.UpdateLanterns();
			}
			CursorManager.Update();
			SharerManager.Update();
			AbilityObjects.Update();
		}
	}
}
namespace Architect.Workshop
{
	public static class ConfigurationManager
	{
		public static readonly Dictionary<string, Architect.Workshop.Types.ConfigType> ConfigTypes = new Dictionary<string, Architect.Workshop.Types.ConfigType>();

		public static Architect.Workshop.Types.ConfigType RegisterConfigType(Architect.Workshop.Types.ConfigType type)
		{
			ConfigTypes[type.Id] = type;
			return type;
		}

		public static Architect.Workshop.Types.ConfigValue DeserializeConfigValue(string configType, string serializedValue)
		{
			return ConfigTypes[configType].Deserialize(serializedValue);
		}
	}
	[JsonConverter(typeof(WorkshopDataConverter))]
	public class WorkshopData
	{
		public class WorkshopDataConverter : JsonConverter<WorkshopData>
		{
			public override void WriteJson(JsonWriter writer, WorkshopData value, JsonSerializer serializer)
			{
				writer.WriteStartObject();
				writer.WritePropertyName("items");
				writer.WriteStartArray();
				foreach (WorkshopItem item in value.Items)
				{
					writer.WriteStartObject();
					writer.WritePropertyName("type");
					writer.WriteValue(item.Type);
					writer.WritePropertyName("name");
					writer.WriteValue(item.Id);
					writer.WritePropertyName("config");
					serializer.Serialize(writer, (object)item.CurrentConfig.Values.ToDictionary((Architect.Workshop.Types.ConfigValue c) => c.GetTypeId(), (Architect.Workshop.Types.ConfigValue c) => c.SerializeValue()));
					writer.WriteEndObject();
				}
				writer.WriteEndArray();
				writer.WriteEndObject();
			}

			public override WorkshopData ReadJson(JsonReader reader, Type objectType, WorkshopData existingValue, bool hasExistingValue, JsonSerializer serializer)
			{
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Invalid comparison between Unknown and I4
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Invalid comparison between Unknown and I4
				WorkshopData workshopData = new WorkshopData();
				reader.Read();
				reader.Read();
				reader.Read();
				while ((int)reader.TokenType == 1)
				{
					string key = "";
					string arg = "";
					Dictionary<string, Architect.Workshop.Types.ConfigValue> currentConfig = new Dictionary<string, Architect.Workshop.Types.ConfigValue>();
					reader.Read();
					while ((int)reader.TokenType == 4)
					{
						switch (reader.Value as string)
						{
						case "type":
							key = reader.ReadAsString();
							break;
						case "name":
							arg = reader.ReadAsString();
							break;
						case "config":
							reader.Read();
							currentConfig = DeserializeConfig(serializer.Deserialize<Dictionary<string, string>>(reader));
							break;
						}
						reader.Read();
					}
					WorkshopItem workshopItem = WorkshopManager.WorkshopItems[key].Item2(arg);
					workshopItem.CurrentConfig = currentConfig;
					workshopData.Items.Add(workshopItem);
					reader.Read();
				}
				reader.Read();
				return workshopData;
			}

			private static Dictionary<string, Architect.Workshop.Types.ConfigValue> DeserializeConfig(Dictionary<string, string> data)
			{
				Dictionary<string, Architect.Workshop.Types.ConfigValue> dictionary = new Dictionary<string, Architect.Workshop.Types.ConfigValue>();
				foreach (KeyValuePair<string, string> datum in data)
				{
					dictionary[datum.Key] = ConfigurationManager.DeserializeConfigValue(datum.Key, datum.Value);
				}
				return dictionary;
			}
		}

		public readonly List<WorkshopItem> Items = new List<WorkshopItem>();
	}
	public static class WorkshopManager
	{
		public static WorkshopData WorkshopData;

		public static readonly List<WorkshopItem> CustomItems = new List<WorkshopItem>();

		public static readonly Dictionary<string, (Vector2, Func<string, WorkshopItem>)> WorkshopItems = new Dictionary<string, (Vector2, Func<string, WorkshopItem>)>();

		public static void Init()
		{
			//IL_0010: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			Register<CustomItem>("Item", new Vector2(-300f, -150f), new List<Architect.Workshop.Types.ConfigType>[3]
			{
				Architect.Workshop.Config.ConfigGroup.CustomItem,
				Architect.Workshop.Config.ConfigGroup.SpriteItem,
				Architect.Workshop.Config.ConfigGroup.UsableItem
			});
			Register<CustomTool>("Tool", new Vector2(-300f, -225f), new List<Architect.Workshop.Types.ConfigType>[4]
			{
				Architect.Workshop.Config.ConfigGroup.CustomTool,
				Architect.Workshop.Config.ConfigGroup.SpriteItem,
				Architect.Workshop.Config.ConfigGroup.UseToolSprites,
				Architect.Workshop.Config.ConfigGroup.RedTools
			});
			Register<CustomJournalEntry>("Journal Entry", new Vector2(-100f, -225f), new List<Architect.Workshop.Types.ConfigType>[3]
			{
				Architect.Workshop.Config.ConfigGroup.JournalEntry,
				Architect.Workshop.Config.ConfigGroup.SpriteItem,
				Architect.Workshop.Config.ConfigGroup.JournalEntrySprites
			});
			Register<CustomQuest>("Quest", new Vector2(-100f, -150f), new List<Architect.Workshop.Types.ConfigType>[2]
			{
				Architect.Workshop.Config.ConfigGroup.Quest,
				Architect.Workshop.Config.ConfigGroup.QuestSprites
			});
			Register<SceneGroup>("Scene Group", new Vector2(-300f, -300f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.SceneGroup });
			Register<CustomScene>("Scene", new Vector2(-100f, -300f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Scene });
			Register<CustomMateriumEntry>("Material", new Vector2(-300f, -375f), new List<Architect.Workshop.Types.ConfigType>[2]
			{
				Architect.Workshop.Config.ConfigGroup.MateriumEntry,
				Architect.Workshop.Config.ConfigGroup.SpriteItem
			});
			typeof(CollectableItemManager).Hook("InternalGetCollectedItems", (Func<Func<CollectableItemManager, Func<CollectableItem, bool>, List<CollectableItem>>, CollectableItemManager, Func<CollectableItem, bool>, List<CollectableItem>>)delegate(Func<CollectableItemManager, Func<CollectableItem, bool>, List<CollectableItem>> orig, CollectableItemManager self, Func<CollectableItem, bool> predicate)
			{
				if (Application.isPlaying)
				{
					WorkshopItem[] array = CustomItems.ToArray();
					foreach (WorkshopItem workshopItem in array)
					{
						workshopItem.Unregister();
						workshopItem.Register();
					}
					CollectableItemsData collectables = PlayerData.instance.Collectables;
					foreach (string item in from item in ((SerializableNamedList<Data, NamedData>)(object)collectables).GetValidNames((Func<Data, bool>)null)
						where !self.IsItemInMasterList(item)
						select item)
					{
						((SerializableNamedList<Data, NamedData>)(object)collectables).RuntimeData.Remove(item);
						CollectableItemManager.IncrementVersion();
					}
				}
				return orig(self, predicate);
			});
			typeof(HeroController).Hook("ThrowTool", (Action<Action<HeroController, bool>, HeroController, bool>)delegate(Action<HeroController, bool> orig, HeroController self, bool isAutoThrow)
			{
				//IL_0037: 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)
				//IL_003d: 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_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected I4, but got Unknown
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)self.willThrowTool) && CustomTool.List.Contains(self.willThrowTool.name))
				{
					ToolItemType type = self.willThrowTool.type;
					ToolItemType val = type;
					switch ((int)val)
					{
					case 3:
						HeroController.instance.TakeSilk(PlayerData.instance.SilkSkillCost);
						break;
					case 0:
					{
						Data savedData = self.willThrowTool.SavedData;
						savedData.AmountLeft--;
						self.willThrowTool.SavedData = savedData;
						ToolItemManager.ReportAllBoundAttackToolsUpdated();
						break;
					}
					}
					ToolBlock.DoBroadcast(self.willThrowTool.name);
				}
				orig(self, isAutoThrow);
			});
		}

		public static void Setup()
		{
			SceneUtils.InitQWHook();
			StorageManager.LoadWorkshopData();
		}

		public static void LoadWorkshop(WorkshopData data)
		{
			if (data == null)
			{
				data = new WorkshopData();
			}
			if (WorkshopData != null)
			{
				foreach (WorkshopItem item in WorkshopData.Items)
				{
					item.Unregister();
				}
			}
			WorkshopData = data;
			foreach (WorkshopItem item2 in WorkshopData.Items)
			{
				foreach (Architect.Workshop.Types.ConfigValue value in item2.CurrentConfig.Values)
				{
					value.Setup(item2);
				}
				item2.Register();
			}
			WorkshopUI.Refresh();
		}

		private static void Register<T>(string type, Vector2 pos, params List<Architect.Workshop.Types.ConfigType>[] config) where T : WorkshopItem, new()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			WorkshopItems[type] = (pos, (string s) => new T
			{
				Id = s,
				Type = type,
				Config = config,
				CurrentConfig = new Dictionary<string, Architect.Workshop.Types.ConfigValue>()
			});
		}
	}
}
namespace Architect.Workshop.Types
{
	public class BoolConfigType<T> : ConfigType<T, BoolConfigValue<T>> where T : WorkshopItem
	{
		private bool? _defaultValue;

		public BoolConfigType(string name, string id, Action<T, BoolConfigValue<T>> action)
			: base(name, id, action)
		{
		}

		public BoolConfigType<T> WithDefaultValue(bool value)
		{
			_defaultValue = value;
			return this;
		}

		public override ConfigValue GetDefaultValue()
		{
			return _defaultValue.HasValue ? new BoolConfigValue<T>(this, _defaultValue.Value) : null;
		}

		public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return new BoolConfigElement(parent, apply, pos, currentVal);
		}

		public override ConfigValue Deserialize(string data)
		{
			return new BoolConfigValue<T>(this, Convert.ToBoolean(data, CultureInfo.InvariantCulture));
		}
	}
	public class BoolConfigValue<T> : ConfigValue<BoolConfigType<T>> where T : WorkshopItem
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private bool <value>P;

		public BoolConfigValue(BoolConfigType<T> type, bool value)
		{
			<value>P = value;
			base..ctor(type);
		}

		public bool GetValue()
		{
			return <value>P;
		}

		public override string SerializeValue()
		{
			return <value>P.ToString(CultureInfo.InvariantCulture);
		}
	}
	public class BoolConfigElement : ConfigElement
	{
		private readonly Button _input;

		private bool _active = true;

		public BoolConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal)
		{
			//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)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_00d9: Expected O, but got Unknown
			BoolConfigElement boolConfigElement = this;
			UIUtils.Label txt;
			(_input, txt) = UIUtils.MakeTextButton("Config Input", "Default", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), hasOutline: true, new Vector2(120f, 25f));
			if (currentVal != null)
			{
				((Text)txt.textComponent).text = currentVal;
				_active = Convert.ToBoolean(currentVal, CultureInfo.InvariantCulture);
			}
			((UnityEvent)_input.onClick).AddListener((UnityAction)delegate
			{
				boolConfigElement._active = !boolConfigElement._active;
				((Text)txt.textComponent).text = boolConfigElement._active.ToString(CultureInfo.InvariantCulture);
				((Selectable)apply).interactable = true;
			});
		}

		public override RectTransform GetElement()
		{
			Transform transform = ((Component)_input).transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public override string GetValue()
		{
			return _active.ToString(CultureInfo.InvariantCulture);
		}
	}
	public class ChoiceConfigType<T> : ConfigType<T, ChoiceConfigValue<T>> where T : WorkshopItem
	{
		private int? _defaultValue;

		private string[] _options = Array.Empty<string>();

		public ChoiceConfigType(string name, string id, Action<T, ChoiceConfigValue<T>> action)
			: base(name, id, action)
		{
		}

		public ChoiceConfigType<T> WithOptions(params string[] options)
		{
			_options = options;
			return this;
		}

		public ChoiceConfigType<T> WithDefaultValue(int value)
		{
			_defaultValue = value;
			return this;
		}

		public override ConfigValue GetDefaultValue()
		{
			return _defaultValue.HasValue ? new ChoiceConfigValue<T>(this, _defaultValue.Value) : null;
		}

		public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return new ChoiceConfigElement(parent, apply, pos, currentVal, _options);
		}

		public override ConfigValue Deserialize(string data)
		{
			if (1 == 0)
			{
			}
			int num = ((!(data == "False")) ? ((data == "True") ? 1 : Convert.ToInt32(data, CultureInfo.InvariantCulture)) : 0);
			if (1 == 0)
			{
			}
			int value = num;
			return new ChoiceConfigValue<T>(this, value);
		}

		public string GetOption(int index)
		{
			return _options[(index < _options.Length) ? index : 0];
		}
	}
	public class ChoiceConfigValue<T> : ConfigValue<ChoiceConfigType<T>> where T : WorkshopItem
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private int <value>P;

		private readonly ChoiceConfigType<T> _type;

		public ChoiceConfigValue(ChoiceConfigType<T> type, int value)
		{
			<value>P = value;
			_type = type;
			base..ctor(type);
		}

		public int GetValue()
		{
			return <value>P;
		}

		public string GetStringValue()
		{
			return _type.GetOption(<value>P);
		}

		public override string SerializeValue()
		{
			return <value>P.ToString(CultureInfo.InvariantCulture);
		}
	}
	public class ChoiceConfigElement : ConfigElement
	{
		public class ChoiceButton : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
		{
			public ChoiceConfigElement Cce;

			public void OnPointerClick(PointerEventData eventData)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_001c: Expected I4, but got Unknown
				InputButton button = eventData.button;
				InputButton val = button;
				switch ((int)val)
				{
				default:
					return;
				case 0:
					Cce._active++;
					break;
				case 1:
					if (Cce._active != -1)
					{
						Cce._active--;
					}
					break;
				case 2:
					return;
				}
				if (Cce._active < 0)
				{
					Cce._active += Cce._options.Length;
				}
				Cce._active %= Cce._options.Length;
				((Text)Cce._txt.textComponent).text = Cce._options[Cce._active];
				((Selectable)Cce._apply).interactable = true;
			}
		}

		private readonly Button _input;

		private readonly string[] _options;

		private readonly Button _apply;

		private readonly UIUtils.Label _txt;

		private int _active = -1;

		public ChoiceConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal, string[] options)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			(Button, UIUtils.Label) tuple = UIUtils.MakeTextButton("Config Input", "Default", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), hasOutline: true, new Vector2(120f, 25f));
			_input = tuple.Item1;
			_txt = tuple.Item2;
			_options = options;
			_apply = apply;
			ChoiceButton choiceButton = ((Component)_input).gameObject.AddComponent<ChoiceButton>();
			choiceButton.Cce = this;
			if (currentVal != null)
			{
				_active = Convert.ToInt32(currentVal, CultureInfo.InvariantCulture);
				((Text)_txt.textComponent).text = options[_active];
			}
		}

		public override RectTransform GetElement()
		{
			Transform transform = ((Component)_input).transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public override string GetValue()
		{
			return _active.ToString(CultureInfo.InvariantCulture);
		}
	}
	public abstract class ConfigType
	{
		public readonly string Name;

		public readonly string Id;

		public int Priority;

		protected ConfigType(string name, string id)
		{
			Name = name;
			Id = id;
			base..ctor();
		}

		public abstract ConfigValue Deserialize(string data);

		[CanBeNull]
		public abstract ConfigValue GetDefaultValue();

		public abstract ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal);

		internal abstract void RunAction(WorkshopItem item, ConfigValue value);
	}
	public abstract class ConfigType<TType, TValue> : ConfigType where TType : WorkshopItem where TValue : ConfigValue
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private Action<TType, TValue> <action>P;

		protected ConfigType(string name, string id, Action<TType, TValue> action)
		{
			<action>P = action;
			base..ctor(name, id);
		}

		public ConfigType<TType, TValue> WithPriority(int priority)
		{
			Priority = priority;
			return this;
		}

		internal override void RunAction(WorkshopItem item, ConfigValue value)
		{
			<action>P(item as TType, value as TValue);
		}
	}
	public abstract class ConfigValue
	{
		public abstract string SerializeValue();

		public abstract string GetTypeId();

		public abstract string GetName();

		public abstract int GetPriority();

		public abstract void Setup(WorkshopItem item);
	}
	public abstract class ConfigValue<TType> : ConfigValue where TType : ConfigType
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private TType <type>P;

		protected ConfigValue(TType type)
		{
			<type>P = type;
			base..ctor();
		}

		public override string GetTypeId()
		{
			return <type>P.Id;
		}

		public override string GetName()
		{
			return <type>P.Name;
		}

		public override void Setup(WorkshopItem item)
		{
			<type>P.RunAction(item, this);
		}

		public override int GetPriority()
		{
			return <type>P.Priority;
		}
	}
	public abstract class ConfigElement
	{
		public abstract RectTransform GetElement();

		public abstract string GetValue();
	}
	public class FloatConfigType<T> : ConfigType<T, FloatConfigValue<T>> where T : WorkshopItem
	{
		private float? _defaultValue;

		public FloatConfigType(string name, string id, Action<T, FloatConfigValue<T>> action)
			: base(name, id, action)
		{
		}

		public FloatConfigType<T> WithDefaultValue(float value)
		{
			_defaultValue = value;
			return this;
		}

		public override ConfigValue GetDefaultValue()
		{
			return _defaultValue.HasValue ? new FloatConfigValue<T>(this, _defaultValue.Value) : null;
		}

		public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return new FloatConfigElement(parent, apply, pos, currentVal);
		}

		public override ConfigValue Deserialize(string data)
		{
			float value;
			try
			{
				value = Convert.ToSingle(data, CultureInfo.InvariantCulture);
			}
			catch (FormatException)
			{
				value = 9999999f;
			}
			return new FloatConfigValue<T>(this, value);
		}
	}
	public class FloatConfigValue<T> : ConfigValue<FloatConfigType<T>> where T : WorkshopItem
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private float <value>P;

		public FloatConfigValue(FloatConfigType<T> type, float value)
		{
			<value>P = value;
			base..ctor(type);
		}

		public float GetValue()
		{
			return <value>P;
		}

		public override string SerializeValue()
		{
			return <value>P.ToString(CultureInfo.InvariantCulture);
		}
	}
	public class FloatConfigElement : ConfigElement
	{
		private readonly InputField _input;

		public FloatConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			(_input, _) = UIUtils.MakeTextbox("Config Input", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 120f, 25f);
			if (currentVal != null)
			{
				_input.text = currentVal;
			}
			string last = _input.text;
			_input.characterValidation = (CharacterValidation)2;
			((UnityEvent<string>)(object)_input.onValueChanged).AddListener((UnityAction<string>)delegate(string s)
			{
				if (!(last == s))
				{
					last = s;
					((Selectable)apply).interactable = true;
				}
			});
		}

		public override RectTransform GetElement()
		{
			Transform transform = ((Component)_input).transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public override string GetValue()
		{
			return _input.text;
		}
	}
	public class IntConfigType<T> : ConfigType<T, IntConfigValue<T>> where T : WorkshopItem
	{
		private int? _defaultValue;

		public IntConfigType(string name, string id, Action<T, IntConfigValue<T>> action)
			: base(name, id, action)
		{
		}

		public IntConfigType<T> WithDefaultValue(int value)
		{
			_defaultValue = value;
			return this;
		}

		public override ConfigValue GetDefaultValue()
		{
			return _defaultValue.HasValue ? new IntConfigValue<T>(this, _defaultValue.Value) : null;
		}

		public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return new IntConfigElement(parent, apply, pos, currentVal);
		}

		public override ConfigValue Deserialize(string data)
		{
			return new IntConfigValue<T>(this, Convert.ToInt32(data, CultureInfo.InvariantCulture));
		}
	}
	public class IntConfigValue<T> : ConfigValue<IntConfigType<T>> where T : WorkshopItem
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private int <value>P;

		public IntConfigValue(IntConfigType<T> type, int value)
		{
			<value>P = value;
			base..ctor(type);
		}

		public int GetValue()
		{
			return <value>P;
		}

		public override string SerializeValue()
		{
			return <value>P.ToString(CultureInfo.InvariantCulture);
		}
	}
	public class IntConfigElement : ConfigElement
	{
		private readonly InputField _input;

		public IntConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			(_input, _) = UIUtils.MakeTextbox("Config Input", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 120f, 25f);
			if (currentVal != null)
			{
				_input.text = currentVal;
			}
			string last = _input.text;
			_input.characterValidation = (CharacterValidation)1;
			((UnityEvent<string>)(object)_input.onValueChanged).AddListener((UnityAction<string>)delegate(string s)
			{
				if (!(last == s))
				{
					last = s;
					((Selectable)apply).interactable = true;
				}
			});
		}

		public override RectTransform GetElement()
		{
			Transform transform = ((Component)_input).transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public override string GetValue()
		{
			return _input.text;
		}
	}
	public class NoteConfigType<T> : ConfigType<T, NoteConfigValue<T>> where T : WorkshopItem
	{
		public NoteConfigType(string name, string id)
			: base(name, id, (Action<T, NoteConfigValue<T>>)delegate
			{
			})
		{
		}

		public override ConfigValue GetDefaultValue()
		{
			return null;
		}

		public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal)
		{
			return new NoteConfigElement(apply);
		}

		public override ConfigValue Deserialize(string data)
		{
			return new NoteConfigValue<T>(this, data);
		}
	}
	public class NoteConfigValue<T> : ConfigValue<NoteConfigType<T>> where T : WorkshopItem
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private string <value>P;

		public NoteConfigValue(NoteConfigType<T> type, string value)
		{
			<value>P = value;
			base..ctor(type);
		}

		public override string SerializeValue()
		{
			return <value>P;
		}
	}
	public class NoteConfigElement : ConfigElement
	{
		private readonly Button _input;

		public NoteConfigElement(Button apply)
		{
			_input = apply;
			((Component)apply).gameObject.SetActive(false);
			((Component)((Component)apply).GetComponent<UIUtils.LabelledButton>().label).gameObject.SetActive(false);
		}

		public override RectTransform GetElement()
		{
			Transform transform = ((Component)_input).transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public override string GetValue()
		{
			return "";
		}
	}
	public class StringConfigType<T> : ConfigType<T, StringConfigValue<T>> where T : WorkshopItem
	{
		[CanBeNull]
		private string _defaultValue;

		public StringConfigType(string name, string id, Action<T, StringConfigValue<T>> action)
			: base(name, id, action)
		{
		}

		public StringConfigType<T> WithDefaultValue(string value)
		{
			_defaultValue = value;
			return this;
		}

		public override ConfigValue GetDefaultValue()
		{
			return (_defaultValue == null) ? null : new StringConfigValue<T>(this, _defaultValue);
		}

		public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return new StringConfigElement(parent, apply, pos, currentVal);
		}

		public override ConfigValue Deserialize(string data)
		{
			return new StringConfigValue<T>(this, data);
		}
	}
	public class StringConfigValue<T> : ConfigValue<StringConfigType<T>> where T : WorkshopItem
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private string <value>P;

		public StringConfigValue(StringConfigType<T> type, string value)
		{
			<value>P = value;
			base..ctor(type);
		}

		public string GetValue()
		{
			return <value>P;
		}

		public override string SerializeValue()
		{
			return <value>P;
		}
	}
	public class StringConfigElement : ConfigElement
	{
		private readonly InputField _input;

		public StringConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			(_input, _) = UIUtils.MakeTextbox("Config Input", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 220f, 25f);
			if (currentVal != null)
			{
				_input.text = currentVal;
			}
			string last = _input.text;
			((UnityEvent<string>)(object)_input.onValueChanged).AddListener((UnityAction<string>)delegate(string s)
			{
				if (!(last == s))
				{
					last = s;
					((Selectable)apply).interactable = true;
				}
			});
		}

		public override RectTransform GetElement()
		{
			Transform transform = ((Component)_input).transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public override string GetValue()
		{
			return _input.text;
		}
	}
}
namespace Architect.Workshop.Items
{
	public class CustomItem : SpriteItem
	{
		public interface ICustomItem
		{
			void Register(CustomItem item);

			void Unregister();

			void SetSprite(Sprite sprite)
			{
			}

			void SetAudio1(AudioClip clip)
			{
			}

			void SetAudio2(AudioClip clip)
			{
			}
		}

		public enum CustomItemType
		{
			Normal,
			Usable,
			Memento
		}

		public class CustomCollectable : CollectableItemMemento, ICustomItem
		{
			public string consumeEvent;

			public bool consume;

			private CustomItem _item;

			public override bool TakeItemOnConsume => consume;

			public override void ConsumeItemResponse()
			{
				if (!Utility.IsNullOrWhiteSpace(consumeEvent))
				{
					BroadcastBlock.DoBroadcast(consumeEvent);
				}
			}

			public void Register(CustomItem item)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: 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_0080: Unknown result type (might be due to invalid IL or missing references)
				_item = item;
				((Object)this).name = item.Id;
				((CollectableItemBasic)this).displayName = item.ItemName;
				((CollectableItemBasic)this).description = item.ItemDesc;
				((CollectableItem)this).useResponseTextOverride = item.UseType;
				((CollectableItem)this).useResponses = (UseResponse[])(object)new UseResponse[1]
				{
					new UseResponse
					{
						UseType = (UseTypes)(item.ItemType == CustomItemType.Usable),
						Description = item.UseDesc
					}
				};
				((CollectableItem)this).customMaxAmount = item.MaxAmount;
				((CollectableItemBasic)this).setExtraPlayerDataBools = Array.Empty<PlayerDataBoolOperation>();
				((CollectableItemBasic)this).setExtraPlayerDataInts = Array.Empty<PlayerDataIntOperation>();
				consumeEvent = item.UseEvent;
				consume = item.Consume;
				((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).Add((CollectableItem)(object)this);
				if (Object.op_Implicit((Object)(object)MementoList) && _item.ItemType == CustomItemType.Memento)
				{
					((NamedScriptableObjectList<CollectableItemMemento>)(object)MementoList).Add((CollectableItemMemento)(object)this);
				}
			}

			public void SetSprite(Sprite sprite)
			{
				((CollectableItemBasic)this).icon = sprite;
			}

			public void SetAudio1(AudioClip clip)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				((CollectableItem)this).useSounds = new AudioEventRandom
				{
					Volume = _item.Volume1,
					PitchMax = _item.MaxPitch1,
					PitchMin = _item.MinPitch1,
					Clips = (AudioClip[])(object)new AudioClip[1] { clip }
				};
			}

			public void SetAudio2(AudioClip clip)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				((CollectableItem)this).instantUseSounds = new AudioEventRandom
				{
					Volume = _item.Volume2,
					PitchMax = _item.MaxPitch2,
					PitchMin = _item.MinPitch2,
					Clips = (AudioClip[])(object)new AudioClip[1] { clip }
				};
			}

			public override bool IsVisibleInCollection()
			{
				if (_item.ItemType == CustomItemType.Memento)
				{
					return ((CollectableItemMemento)this).IsVisibleInCollection();
				}
				return ((CollectableItem)this).CollectedAmount > 0;
			}

			public override string GetDescription(ReadSource readSource)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				return LocalisedString.op_Implicit(((CollectableItemBasic)this).description);
			}

			public void Unregister()
			{
				((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).Remove((CollectableItem)(object)this);
				if (Object.op_Implicit((Object)(object)MementoList))
				{
					((NamedScriptableObjectList<CollectableItemMemento>)(object)MementoList).Remove((CollectableItemMemento)(object)this);
				}
				Object.Destroy((Object)(object)this);
			}
		}

		private ICustomItem _item;

		public CustomItemType ItemType;

		public LocalStr ItemName = string.Empty;

		public LocalStr ItemDesc = string.Empty;

		public LocalStr UseDesc = string.Empty;

		public int MaxAmount = int.MaxValue;

		public LocalStr UseType = "Break";

		public bool Consume;

		public string UseEvent;

		public string WavURL1;

		public float Volume1 = 1f;

		public float MaxPitch1 = 1.2f;

		public float MinPitch1 = 0.8f;

		public string WavURL2;

		public float Volume2 = 1f;

		public float MaxPitch2 = 1.2f;

		public float MinPitch2 = 0.8f;

		private static CollectableItemMementoList _mementoList;

		public override (string, string)[] FilesToDownload => new(string, string)[3]
		{
			(IconUrl, "png"),
			(WavURL1, "wav"),
			(WavURL2, "wav")
		};

		public static CollectableItemMementoList MementoList
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_mementoList))
				{
					_mementoList = Resources.FindObjectsOfTypeAll<CollectableItemMementoList>().FirstOrDefault();
				}
				return _mementoList;
			}
		}

		public override void Register()
		{
			_item = ScriptableObject.CreateInstance<CustomCollectable>();
			_item.Register(this);
			WorkshopManager.CustomItems.Add(this);
			base.Register();
			RefreshAudio1();
			RefreshAudio2();
			CollectableItemManager.IncrementVersion();
		}

		public override void Unregister()
		{
			WorkshopManager.CustomItems.Remove(this);
			_item.Unregister();
			CollectableItemManager.IncrementVersion();
		}

		protected override void OnReadySprite()
		{
			_item.SetSprite(Sprite);
		}

		public void RefreshAudio1()
		{
			if (!Utility.IsNullOrWhiteSpace(WavURL1))
			{
				CustomAssetManager.DoLoadSound(WavURL1, delegate(AudioClip clip)
				{
					_item.SetAudio1(clip);
				});
			}
		}

		public void RefreshAudio2()
		{
			if (!Utility.IsNullOrWhiteSpace(WavURL2))
			{
				CustomAssetManager.DoLoadSound(WavURL2, delegate(AudioClip clip)
				{
					_item.SetAudio2(clip);
				});
			}
		}
	}
	public class CustomJournalEntry : SpriteItem
	{
		private EnemyJournalRecord _record;

		public string LIconUrl = string.Empty;

		public bool LPoint;

		public float LPpu = 100f;

		public LocalStr ItemName = string.Empty;

		public LocalStr ItemDesc = string.Empty;

		public LocalStr ItemHDesc = string.Empty;

		public string InsertBefore = string.Empty;

		public int KillsRequired = 1;

		public override void Register()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			_record = ScriptableObject.CreateInstance<EnemyJournalRecord>();
			((Object)_record).name = Id;
			_record.altNotesTest = new PlayerDataTest();
			_record.completeOthers = Array.Empty<EnemyJournalRecord>();
			_record.recordType = (RecordTypes)0;
			_record.killsRequired = KillsRequired;
			_record.displayName = ItemName;
			_record.description = ItemDesc;
			_record.notes = ItemHDesc;
			List<EnemyJournalRecord> list = ((NamedScriptableObjectList<EnemyJournalRecord>)(object)EnemyJournalManager.Instance.recordList).List;
			int num = list.FindIndex((EnemyJournalRecord o) => ((Object)o).name == InsertBefore);
			if (num != -1)
			{
				list.Insert(num, _record);
			}
			else
			{
				list.Add(_record);
			}
			base.Register();
			RefreshLSprite();
		}

		public void RefreshLSprite()
		{
			if (Utility.IsNullOrWhiteSpace(LIconUrl))
			{
				return;
			}
			CustomAssetManager.DoLoadSprite(LIconUrl, LPoint, LPpu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					_record.enemySprite = sprites[0];
				}
			});
		}

		protected override void OnReadySprite()
		{
			_record.iconSprite = Sprite;
		}

		public override void Unregister()
		{
			((NamedScriptableObjectList<EnemyJournalRecord>)(object)EnemyJournalManager.Instance.recordList).Remove(_record);
		}
	}
	public class CustomMateriumEntry : SpriteItem
	{
		private MateriumItem _item;

		public LocalStr ItemName = string.Empty;

		public LocalStr Desc = string.Empty;

		public string InsertBefore = string.Empty;

		public override void Register()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			_item = ScriptableObject.CreateInstance<MateriumItem>();
			((Object)_item).name = Id;
			_item.itemQuests = new List<Quest>();
			_item.playerDataCondition = new PlayerDataTest();
			_item.displayName = ItemName;
			_item.description = Desc;
			List<MateriumItem> list = ((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).List;
			int num = list.FindIndex((MateriumItem o) => ((Object)o).name == InsertBefore);
			if (num != -1)
			{
				list.Insert(num, _item);
			}
			else
			{
				list.Add(_item);
			}
			((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).UpdateDictionary();
			base.Register();
		}

		public override void Unregister()
		{
			((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).Remove(_item);
			((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).UpdateDictionary();
		}

		protected override void OnReadySprite()
		{
			_item.icon = Sprite;
		}
	}
	public class CustomQuest : SpriteItem
	{
		public bool MainQuest;

		public LocalStr ItemName = string.Empty;

		public LocalStr ItemDesc = string.Empty;

		public LocalStr TypeName = string.Empty;

		public Color Color = Color.white;

		private MainQuest _mq;

		private FullQuestBase _quest;

		private QuestType _type;

		public string LIconUrl = string.Empty;

		public bool LPoint;

		public float LPpu = 100f;

		public string GIconUrl = string.Empty;

		public bool GPoint;

		public float GPpu = 100f;

		public override (string, string)[] FilesToDownload => new(string, string)[3]
		{
			(IconUrl, "png"),
			(LIconUrl, "png"),
			(GIconUrl, "png")
		};

		public override void Register()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			_type = QuestType.Create((LocalisedString)TypeName, (Sprite)null, Color, (Sprite)null, (Sprite)null, (Sprite)null);
			if (MainQuest)
			{
				_mq = ScriptableObject.CreateInstance<MainQuest>();
				_mq.questType = _type;
				_mq.subQuests = Array.Empty<SubQuest>();
				_mq.altTargets = Array.Empty<AltQuestTarget>();
				_quest = (FullQuestBase)(object)_mq;
			}
			else
			{
				Quest val = ScriptableObject.CreateInstance<Quest>();
				val.questType = _type;
				_quest = (FullQuestBase)(object)val;
			}
			((Object)_quest).name = Id;
			_quest.hideDescCounterForLangs = Array.Empty<LanguageCode>();
			_quest.persistentBoolTests = Array.Empty<PersistentBoolTest>();
			_quest.requiredCompleteQuests = Array.Empty<FullQuestBase>();
			_quest.requiredUnlockedTools = Array.Empty<ToolItem>();
			_quest.requiredCompleteTotalGroups = Array.Empty<QuestCompleteTotalGroup>();
			_quest.markCompleted = Array.Empty<FullQuestBase>();
			_quest.cancelIfIncomplete = Array.Empty<FullQuestBase>();
			_quest.hideIfComplete = Array.Empty<FullQuestBase>();
			_quest.playerDataTest = new PlayerDataTest();
			_quest.targets = Array.Empty<QuestTarget>();
			_quest.overrideFontSize = new OverrideFloat();
			_quest.overrideParagraphSpacing = new OverrideFloat();
			_quest.overrideParagraphSpacingShort = new OverrideFloat();
			((BasicQuestBase)_quest).displayName = ItemName;
			_quest.inventoryDescription = ItemDesc;
			((NamedScriptableObjectList<BasicQuestBase>)(object)QuestManager.Instance.masterList).Add((BasicQuestBase)(object)_quest);
			base.Register();
			RefreshLSprite();
			RefreshGSprite();
			QuestManager.IncrementVersion();
		}

		public override void Unregister()
		{
			((NamedScriptableObjectList<BasicQuestBase>)(object)QuestManager.Instance.masterList).Remove((BasicQuestBase)(object)_quest);
			QuestManager.IncrementVersion();
		}

		protected override void OnReadySprite()
		{
			_type.icon = Sprite;
			if (Object.op_Implicit((Object)(object)_mq))
			{
				_mq.typeIcon = Sprite;
			}
		}

		public void RefreshLSprite()
		{
			if (Utility.IsNullOrWhiteSpace(LIconUrl))
			{
				return;
			}
			CustomAssetManager.DoLoadSprite(LIconUrl, LPoint, LPpu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					_type.largeIcon = sprites[0];
					if (Object.op_Implicit((Object)(object)_mq))
					{
						_mq.typeLargeIcon = sprites[0];
					}
				}
			});
		}

		public void RefreshGSprite()
		{
			if (Utility.IsNullOrWhiteSpace(GIconUrl))
			{
				return;
			}
			CustomAssetManager.DoLoadSprite(GIconUrl, GPoint, GPpu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					_type.largeIconGlow = sprites[0];
					if (Object.op_Implicit((Object)(object)_mq))
					{
						_mq.typeLargeIconGlow = sprites[0];
					}
				}
			});
		}
	}
	public class CustomScene : WorkshopItem
	{
		private static readonly Sprite Icon = ResourceUtils.LoadSpriteResource("door", (FilterMode)1);

		public string Group = "None";

		public int TilemapWidth = 500;

		public int TilemapHeight = 500;

		public override void Register()
		{
			SceneUtils.CustomScenes.Add(Id, this);
			if (SceneUtils.QWHookEnabled)
			{
				QuickWarpHookLoader.RegisterScene(Group, Id);
			}
		}

		public override void Unregister()
		{
			SceneUtils.CustomScenes.Remove(Id);
			if (SceneUtils.QWHookEnabled)
			{
				QuickWarpHookLoader.UnregisterScene(Group, Id);
			}
		}

		public override Sprite GetIcon()
		{
			return Icon;
		}
	}
	public class CustomTool : SpriteItem
	{
		public class CustomToolItem : ToolItemBasic
		{
			public Sprite fullSprite;

			public int cost = 5;

			public override Sprite GetHudSprite(IconVariants iconVariant)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				Sprite hudSprite = ((ToolItemBasic)this).GetHudSprite(iconVariant);
				if (!((ToolItem)this).IsEmpty)
				{
					return fullSprite ?? hudSprite;
				}
				return hudSprite;
			}

			public override bool TryReplenishSingle(bool doReplenish, float inCost, out float outCost, out int reserveCost)
			{
				((ToolItem)this).TryReplenishSingle(doReplenish, inCost, ref outCost, ref reserveCost);
				outCost = cost;
				return true;
			}
		}

		private ToolItemBasic _tool;

		public static readonly List<string> List = new List<string>();

		public LocalStr ItemName = string.Empty;

		public LocalStr ItemDesc = string.Empty;

		public ToolItemType ItemType = (ToolItemType)0;

		public string HIconUrl = string.Empty;

		public bool HPoint;

		public float HPpu = 100f;

		public string GIconUrl = string.Empty;

		public bool GPoint;

		public float GPpu = 100f;

		public int RepairCost = 5;

		public bool PreventIncrease;

		public int MaxAmount = 10;

		public override (string, string)[] FilesToDownload => new(string, string)[3]
		{
			(IconUrl, "png"),
			(HIconUrl, "png"),
			(GIconUrl, "png")
		};

		public override void Register()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Invalid comparison between Unknown and I4
			List.Add(Id);
			_tool = (ToolItemBasic)(object)(((int)ItemType == 3) ? ((CustomToolItem)(object)ScriptableObject.CreateInstance<ToolItemSkill>()) : ScriptableObject.CreateInstance<CustomToolItem>());
			_tool.usageOptions.FsmEventName = "";
			((ToolItem)_tool).name = Id;
			((ToolItem)_tool).type = ItemType;
			_tool.displayName = ItemName;
			_tool.description = ItemDesc;
			((ToolItem)_tool).alternateUnlockedTest = new PlayerDataTest();
			((ToolItem)_tool).preventStorageIncrease = PreventIncrease;
			if ((int)ItemType == 0)
			{
				((ToolItem)_tool).baseStorageAmount = MaxAmount;
			}
			if (_tool is CustomToolItem customToolItem)
			{
				customToolItem.cost = RepairCost;
			}
			((NamedScriptableObjectList<ToolItem>)(object)ManagerSingleton<ToolItemManager>.Instance.toolItems).Add((ToolItem)(object)_tool);
			WorkshopManager.CustomItems.Add(this);
			ToolItemManager.IncrementVersion();
			base.Register();
			RefreshHSprite();
			RefreshGSprite();
		}

		protected override void OnReadySprite()
		{
			_tool.inventorySprite = Sprite;
		}

		public override void Unregister()
		{
			List.Remove(Id);
			((NamedScriptableObjectList<ToolItem>)(object)ManagerSingleton<ToolItemManager>.Instance.toolItems).Remove((ToolItem)(object)_tool);
			WorkshopManager.CustomItems.Remove(this);
			ToolItemManager.IncrementVersion();
		}

		public void RefreshHSprite()
		{
			if (Utility.IsNullOrWhiteSpace(HIconUrl))
			{
				return;
			}
			CustomAssetManager.DoLoadSprite(HIconUrl, HPoint, HPpu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					_tool.hudSprite = sprites[0];
				}
			});
		}

		public void RefreshGSprite()
		{
			if (Utility.IsNullOrWhiteSpace(GIconUrl))
			{
				return;
			}
			CustomAssetManager.DoLoadSprite(GIconUrl, GPoint, GPpu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					ToolItemBasic tool = _tool;
					ToolItemBasic val = tool;
					ToolItemSkill val2 = (ToolItemSkill)(object)((val is ToolItemSkill) ? val : null);
					if (val2 == null)
					{
						if (val is CustomToolItem customToolItem)
						{
							customToolItem.fullSprite = sprites[0];
						}
					}
					else
					{
						val2.hudGlowSprite = sprites[0];
					}
				}
			});
		}
	}
	public class SceneGroup : SpriteItem
	{
		public string GroupName = string.Empty;

		public AreaBackground Background;

		public override void Register()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			Background = new AreaBackground
			{
				BackgroundImage = ArchitectPlugin.BlankSprite,
				NameOverride = (LocalStr)GroupName
			};
			SceneUtils.SceneGroups.Add(Id, this);
			base.Register();
		}

		protected override void OnReadySprite()
		{
			Background.BackgroundImage = Sprite;
		}

		public override void Unregister()
		{
			SceneUtils.SceneGroups.Remove(Id);
		}
	}
	public abstract class SpriteItem : WorkshopItem
	{
		public string IconUrl = string.Empty;

		public bool Point;

		public float Ppu = 100f;

		protected Sprite Sprite;

		public override (string, string)[] FilesToDownload => new(string, string)[1] { (IconUrl, "png") };

		public override void Register()
		{
			RefreshSprite();
		}

		public void RefreshSprite()
		{
			if (Utility.IsNullOrWhiteSpace(IconUrl))
			{
				return;
			}
			CustomAssetManager.DoLoadSprite(IconUrl, Point, Ppu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					Sprite = sprites[0];
					OnReadySprite();
					WorkshopUI.RefreshIcon(this);
				}
			});
		}

		public override Sprite GetIcon()
		{
			return Sprite;
		}

		protected virtual void OnReadySprite()
		{
		}
	}
	public abstract class WorkshopItem
	{
		public string Id;

		public string Type;

		public List<Architect.Workshop.Types.ConfigType>[] Config;

		public Dictionary<string, Architect.Workshop.Types.ConfigValue> CurrentConfig;

		public virtual (string, string)[] FilesToDownload => null;

		public abstract void Register();

		public abstract void Unregister();

		public abstract Sprite GetIcon();
	}
}
namespace Architect.Workshop.Config
{
	public static class ConfigGroup
	{
		public static readonly List<Architect.Workshop.Types.ConfigType> SpriteItem = new List<Architect.Workshop.Types.ConfigType>(3)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<SpriteItem>("Icon URL", "png_url", delegate(SpriteItem item, Architect.Workshop.Types.StringConfigValue<SpriteItem> value)
			{
				item.IconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<SpriteItem>("Anti Aliasing", "png_antialias", delegate(SpriteItem item, Architect.Workshop.Types.BoolConfigValue<SpriteItem> value)
			{
				item.Point = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<SpriteItem>("Pixels Per Unit", "png_ppu", delegate(SpriteItem item, Architect.Workshop.Types.FloatConfigValue<SpriteItem> value)
			{
				item.Ppu = value.GetValue();
			}).WithDefaultValue(100f))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> JournalEntry = new List<Architect.Workshop.Types.ConfigType>(6)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomJournalEntry>("Enemy Name", "journal_display_name", delegate(CustomJournalEntry item, Architect.Workshop.Types.StringConfigValue<CustomJournalEntry> value)
			{
				item.ItemName = value.GetValue();
			}).WithDefaultValue("Sample Name")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomJournalEntry>("Description", "journal_desc", delegate(CustomJournalEntry item, Architect.Workshop.Types.StringConfigValue<CustomJournalEntry> value)
			{
				item.ItemDesc = value.GetValue();
			}).WithDefaultValue("Sample Description")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomJournalEntry>("Hunter's Notes", "journal_hdesc", delegate(CustomJournalEntry item, Architect.Workshop.Types.StringConfigValue<CustomJournalEntry> value)
			{
				item.ItemHDesc = value.GetValue();
			}).WithDefaultValue("Sample Hunter's Notes")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.IntConfigType<CustomJournalEntry>("Required Kills", "journal_kills", delegate(CustomJournalEntry item, Architect.Workshop.Types.IntConfigValue<CustomJournalEntry> value)
			{
				item.KillsRequired = value.GetValue();
			}).WithDefaultValue(1)),
			ConfigurationManager.RegisterConfigType(new NoteConfigType<CustomJournalEntry>("A vanilla entry (list can be found in the guide)", "journal_before_note")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomJournalEntry>("Add Before", "journal_before", delegate(CustomJournalEntry item, Architect.Workshop.Types.StringConfigValue<CustomJournalEntry> value)
			{
				item.InsertBefore = value.GetValue();
			}))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> MateriumEntry = new List<Architect.Workshop.Types.ConfigType>(4)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomMateriumEntry>("Item Name", "materium_display_name", delegate(CustomMateriumEntry item, Architect.Workshop.Types.StringConfigValue<CustomMateriumEntry> value)
			{
				item.ItemName = value.GetValue();
			}).WithDefaultValue("Sample Name")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomMateriumEntry>("Description", "materium_desc", delegate(CustomMateriumEntry item, Architect.Workshop.Types.StringConfigValue<CustomMateriumEntry> value)
			{
				item.Desc = value.GetValue();
			}).WithDefaultValue("Sample Description")),
			ConfigurationManager.RegisterConfigType(new NoteConfigType<CustomMateriumEntry>("A vanilla entry (list can be found in the guide)", "materium_before_note")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomMateriumEntry>("Add Before", "materium_before", delegate(CustomMateriumEntry item, Architect.Workshop.Types.StringConfigValue<CustomMateriumEntry> value)
			{
				item.InsertBefore = value.GetValue();
			}))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> JournalEntrySprites = new List<Architect.Workshop.Types.ConfigType>(3)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomJournalEntry>("Enemy Image URL", "png_journal_url", delegate(CustomJournalEntry item, Architect.Workshop.Types.StringConfigValue<CustomJournalEntry> value)
			{
				item.LIconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomJournalEntry>("Anti Aliasing", "png_journal_antialias", delegate(CustomJournalEntry item, Architect.Workshop.Types.BoolConfigValue<CustomJournalEntry> value)
			{
				item.LPoint = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomJournalEntry>("Pixels Per Unit", "png_journal_ppu", delegate(CustomJournalEntry item, Architect.Workshop.Types.FloatConfigValue<CustomJournalEntry> value)
			{
				item.LPpu = value.GetValue();
			}).WithDefaultValue(100f))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> UsableItem = new List<Architect.Workshop.Types.ConfigType>(12)
		{
			ConfigurationManager.RegisterConfigType(new NoteConfigType<CustomItem>("Only apply to Usable items", "usable_item_node")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomItem>("Use Action", "item_consume_desc", delegate(CustomItem item, Architect.Workshop.Types.StringConfigValue<CustomItem> value)
			{
				item.UseType = value.GetValue();
			}).WithDefaultValue("Break")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomItem>("Consume on Use", "item_consume_use", delegate(CustomItem item, Architect.Workshop.Types.BoolConfigValue<CustomItem> value)
			{
				item.Consume = value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomItem>("Use Event", "item_onconsume", delegate(CustomItem item, Architect.Workshop.Types.StringConfigValue<CustomItem> value)
			{
				item.UseEvent = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomItem>("Using Audio URL", "wav_url1", delegate(CustomItem item, Architect.Workshop.Types.StringConfigValue<CustomItem> value)
			{
				item.WavURL1 = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomItem>("Volume", "wav_volume1", delegate(CustomItem item, Architect.Workshop.Types.FloatConfigValue<CustomItem> value)
			{
				item.Volume1 = value.GetValue();
			}).WithDefaultValue(1f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomItem>("Min Pitch", "wav_min_pitch1", delegate(CustomItem item, Architect.Workshop.Types.FloatConfigValue<CustomItem> value)
			{
				item.MinPitch1 = value.GetValue();
			}).WithDefaultValue(0.8f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomItem>("Max Pitch", "wav_max_pitch1", delegate(CustomItem item, Architect.Workshop.Types.FloatConfigValue<CustomItem> value)
			{
				item.MaxPitch1 = value.GetValue();
			}).WithDefaultValue(1.2f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomItem>("Used Audio URL", "wav_url2", delegate(CustomItem item, Architect.Workshop.Types.StringConfigValue<CustomItem> value)
			{
				item.WavURL2 = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomItem>("Volume", "wav_volume2", delegate(CustomItem item, Architect.Workshop.Types.FloatConfigValue<CustomItem> value)
			{
				item.Volume2 = value.GetValue();
			}).WithDefaultValue(1f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomItem>("Min Pitch", "wav_min_pitch2", delegate(CustomItem item, Architect.Workshop.Types.FloatConfigValue<CustomItem> value)
			{
				item.MinPitch2 = value.GetValue();
			}).WithDefaultValue(0.8f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomItem>("Max Pitch", "wav_max_pitch2", delegate(CustomItem item, Architect.Workshop.Types.FloatConfigValue<CustomItem> value)
			{
				item.MaxPitch2 = value.GetValue();
			}).WithDefaultValue(1.2f))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> CustomItem = new List<Architect.Workshop.Types.ConfigType>(5)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomItem>("Item Name", "item_display_name", delegate(CustomItem item, Architect.Workshop.Types.StringConfigValue<CustomItem> value)
			{
				item.ItemName = value.GetValue();
			}).WithDefaultValue("Sample Name")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomItem>("Description", "item_desc", delegate(CustomItem item, Architect.Workshop.Types.StringConfigValue<CustomItem> value)
			{
				item.ItemDesc = value.GetValue().Replace("<br>", "\n");
			}).WithDefaultValue("Sample Description")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomItem>("Use Description", "item_udesc", delegate(CustomItem item, Architect.Workshop.Types.StringConfigValue<CustomItem> value)
			{
				item.UseDesc = value.GetValue().Replace("<br>", "\n");
			}).WithDefaultValue("Sample Use Description")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.ChoiceConfigType<CustomItem>("Item Type", "item_consume", delegate(CustomItem item, Architect.Workshop.Types.ChoiceConfigValue<CustomItem> value)
			{
				item.ItemType = Enum.Parse<CustomItem.CustomItemType>(value.GetStringValue());
			}).WithOptions("Normal", "Usable", "Memento").WithDefaultValue(0)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.IntConfigType<CustomItem>("Max Amount", "item_max", delegate(CustomItem item, Architect.Workshop.Types.IntConfigValue<CustomItem> value)
			{
				item.MaxAmount = value.GetValue();
			}))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> CustomTool = new List<Architect.Workshop.Types.ConfigType>(3)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomTool>("Tool Name", "tool_name", delegate(CustomTool item, Architect.Workshop.Types.StringConfigValue<CustomTool> value)
			{
				item.ItemName = value.GetValue();
			}).WithDefaultValue("Sample Name")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomTool>("Description", "tool_desc", delegate(CustomTool item, Architect.Workshop.Types.StringConfigValue<CustomTool> value)
			{
				item.ItemDesc = value.GetValue().Replace("<br>", "\n");
			}).WithDefaultValue("Sample Description")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.ChoiceConfigType<CustomTool>("Type", "tool_type", delegate(CustomTool item, Architect.Workshop.Types.ChoiceConfigValue<CustomTool> value)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				item.ItemType = (ToolItemType)value.GetValue();
			}).WithDefaultValue(0).WithOptions("Red", "Blue", "Yellow", "Skill"))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> Scene = new List<Architect.Workshop.Types.ConfigType>(3)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomScene>("Group ID", "scene_group", delegate(CustomScene item, Architect.Workshop.Types.StringConfigValue<CustomScene> value)
			{
				item.Group = value.GetValue();
			}).WithDefaultValue("None")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.IntConfigType<CustomScene>("Tilemap Width", "scene_tilemap_width", delegate(CustomScene item, Architect.Workshop.Types.IntConfigValue<CustomScene> value)
			{
				item.TilemapWidth = value.GetValue();
			}).WithDefaultValue(500)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.IntConfigType<CustomScene>("Tilemap Height", "scene_tilemap_height", delegate(CustomScene item, Architect.Workshop.Types.IntConfigValue<CustomScene> value)
			{
				item.TilemapHeight = value.GetValue();
			}).WithDefaultValue(500))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> SceneGroup = new List<Architect.Workshop.Types.ConfigType>(3)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<SceneGroup>("Area Name", "scene_group_name", delegate(SceneGroup item, Architect.Workshop.Types.StringConfigValue<SceneGroup> value)
			{
				item.GroupName = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<SpriteItem>("Save Icon URL", "scene_group_url", delegate(SpriteItem item, Architect.Workshop.Types.StringConfigValue<SpriteItem> value)
			{
				item.IconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<SpriteItem>("Anti Aliasing", "scene_group_antialias", delegate(SpriteItem item, Architect.Workshop.Types.BoolConfigValue<SpriteItem> value)
			{
				item.Point = !value.GetValue();
			}).WithDefaultValue(value: true))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> Quest = new List<Architect.Workshop.Types.ConfigType>(7)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomQuest>("Quest Name", "quest_display_name", delegate(CustomQuest item, Architect.Workshop.Types.StringConfigValue<CustomQuest> value)
			{
				item.ItemName = value.GetValue();
			}).WithDefaultValue("Sample Name")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomQuest>("Description", "quest_desc", delegate(CustomQuest item, Architect.Workshop.Types.StringConfigValue<CustomQuest> value)
			{
				item.ItemDesc = value.GetValue();
			}).WithDefaultValue("Sample Description")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomQuest>("Quest Category", "quest_display_type", delegate(CustomQuest item, Architect.Workshop.Types.StringConfigValue<CustomQuest> value)
			{
				item.TypeName = value.GetValue();
			}).WithDefaultValue("Seek")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.ChoiceConfigType<CustomQuest>("Quest Type", "quest_type", delegate(CustomQuest item, Architect.Workshop.Types.ChoiceConfigValue<CustomQuest> value)
			{
				item.MainQuest = value.GetValue() == 1;
			}).WithDefaultValue(0).WithOptions("Regular", "Major")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomQuest>("Colour R", "quest_r", delegate(CustomQuest item, Architect.Workshop.Types.FloatConfigValue<CustomQuest> value)
			{
				item.Color.r = value.GetValue();
			}).WithDefaultValue(1f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomQuest>("Colour G", "quest_g", delegate(CustomQuest item, Architect.Workshop.Types.FloatConfigValue<CustomQuest> value)
			{
				item.Color.g = value.GetValue();
			}).WithDefaultValue(1f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomQuest>("Colour B", "quest_b", delegate(CustomQuest item, Architect.Workshop.Types.FloatConfigValue<CustomQuest> value)
			{
				item.Color.b = value.GetValue();
			}).WithDefaultValue(1f))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> UseToolSprites = new List<Architect.Workshop.Types.ConfigType>(7)
		{
			ConfigurationManager.RegisterConfigType(new NoteConfigType<CustomTool>("Only apply to Red and Skill tools", "tool_sprite_type_info")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomTool>("HUD Icon URL", "png_tool_ui_url", delegate(CustomTool item, Architect.Workshop.Types.StringConfigValue<CustomTool> value)
			{
				item.HIconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomTool>("Anti Aliasing", "png_tool_ui_antialias", delegate(CustomTool item, Architect.Workshop.Types.BoolConfigValue<CustomTool> value)
			{
				item.HPoint = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomTool>("Pixels Per Unit", "png_tool_ui_ppu", delegate(CustomTool item, Architect.Workshop.Types.FloatConfigValue<CustomTool> value)
			{
				item.HPpu = value.GetValue();
			}).WithDefaultValue(100f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomTool>("HUD Usable URL", "png_tool_glow_url", delegate(CustomTool item, Architect.Workshop.Types.StringConfigValue<CustomTool> value)
			{
				item.GIconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomTool>("Anti Aliasing", "png_tool_glow_antialias", delegate(CustomTool item, Architect.Workshop.Types.BoolConfigValue<CustomTool> value)
			{
				item.GPoint = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomTool>("Pixels Per Unit", "png_tool_glow_ppu", delegate(CustomTool item, Architect.Workshop.Types.FloatConfigValue<CustomTool> value)
			{
				item.GPpu = value.GetValue();
			}).WithDefaultValue(100f))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> RedTools = new List<Architect.Workshop.Types.ConfigType>(4)
		{
			ConfigurationManager.RegisterConfigType(new NoteConfigType<CustomTool>("Only apply to Red tools", "tool_red_info")),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.IntConfigType<CustomTool>("Max Amount", "tool_red_max", delegate(CustomTool item, Architect.Workshop.Types.IntConfigValue<CustomTool> value)
			{
				item.MaxAmount = value.GetValue();
			}).WithDefaultValue(10)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomTool>("Affected by Pouches", "tool_red_pouch", delegate(CustomTool item, Architect.Workshop.Types.BoolConfigValue<CustomTool> value)
			{
				item.PreventIncrease = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.IntConfigType<CustomTool>("Repair Cost", "tool_red_repair_cost", delegate(CustomTool item, Architect.Workshop.Types.IntConfigValue<CustomTool> value)
			{
				item.RepairCost = value.GetValue();
			}).WithDefaultValue(5))
		};

		public static readonly List<Architect.Workshop.Types.ConfigType> QuestSprites = new List<Architect.Workshop.Types.ConfigType>(9)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomQuest>("Icon URL", "png_quest_url", delegate(CustomQuest item, Architect.Workshop.Types.StringConfigValue<CustomQuest> value)
			{
				item.IconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomQuest>("Anti Aliasing", "png_quest_antialias", delegate(CustomQuest item, Architect.Workshop.Types.BoolConfigValue<CustomQuest> value)
			{
				item.Point = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomQuest>("Pixels Per Unit", "png_quest_ppu", delegate(CustomQuest item, Architect.Workshop.Types.FloatConfigValue<CustomQuest> value)
			{
				item.Ppu = value.GetValue();
			}).WithDefaultValue(100f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomQuest>("Prompt Icon URL", "png_lquest_url", delegate(CustomQuest item, Architect.Workshop.Types.StringConfigValue<CustomQuest> value)
			{
				item.LIconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomQuest>("Anti Aliasing", "png_lquest_antialias", delegate(CustomQuest item, Architect.Workshop.Types.BoolConfigValue<CustomQuest> value)
			{
				item.LPoint = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomQuest>("Pixels Per Unit", "png_lquest_ppu", delegate(CustomQuest item, Architect.Workshop.Types.FloatConfigValue<CustomQuest> value)
			{
				item.LPpu = value.GetValue();
			}).WithDefaultValue(100f)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomQuest>("Glow Icon URL", "png_gquest_url", delegate(CustomQuest item, Architect.Workshop.Types.StringConfigValue<CustomQuest> value)
			{
				item.GIconUrl = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.BoolConfigType<CustomQuest>("Anti Aliasing", "png_gquest_antialias", delegate(CustomQuest item, Architect.Workshop.Types.BoolConfigValue<CustomQuest> value)
			{
				item.GPoint = !value.GetValue();
			}).WithDefaultValue(value: true)),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.FloatConfigType<CustomQuest>("Pixels Per Unit", "png_gquest_ppu", delegate(CustomQuest item, Architect.Workshop.Types.FloatConfigValue<CustomQuest> value)
			{
				item.GPpu = value.GetValue();
			}).WithDefaultValue(100f))
		};
	}
}
namespace Architect.Utils
{
	public static class FsmUtils
	{
		public class CustomFsmAction : FsmStateAction
		{
			public bool EveryFrame;

			private Action _method;

			public CustomFsmAction(Action method)
			{
				_method = method;
				((FsmStateAction)this)..ctor();
			}

			public override void Reset()
			{
				_method = null;
				((FsmStateAction)this).Reset();
			}

			public override void OnEnter()
			{
				_method();
				if (!EveryFrame)
				{
					((FsmStateAction)this).Finish();
				}
			}

			public override void OnUpdate()
			{
				if (EveryFrame)
				{
					_method();
				}
			}
		}

		public static void AddState(this PlayMakerFSM fsm, string state)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			FsmState[] states = fsm.fsm.States;
			FsmState[] array = (FsmState[])(object)new FsmState[states.Length + 1];
			for (int i = 0; i < states.Length; i++)
			{
				array[i] = states[i];
			}
			FsmState val = new FsmState(fsm.fsm)
			{
				Name = state
			};
			array[states.Length] = val;
			fsm.fsm.States = array;
		}

		public static FsmState GetState(this PlayMakerFSM fsm, string state)
		{
			return fsm.Fsm.GetState(state);
		}

		public static void DisableAction(this FsmState state, int index)
		{
			state.Actions[index].Enabled = false;
		}

		public static void AddAction(this FsmState state, Action action, int index = -1, bool everyFrame = false)
		{
			CustomFsmAction customAction = new CustomFsmAction(action)
			{
				EveryFrame = everyFrame
			};
			state.AddAction((FsmStateAction)(object)customAction, index);
		}

		public static void AddAction(this FsmState state, FsmStateAction customAction, int index = -1)
		{
			FsmStateAction[] actions = state.Actions;
			if (index == -1)
			{
				index = actions.Length;
			}
			FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[actions.Length + 1];
			int num = 0;
			int num2 = 0;
			while (num < array.Length)
			{
				if (num == index)
				{
					array[num] = customAction;
					num++;
				}
				if (num2 < actions.Length)
				{
					array[num] = actions[num2];
				}
				num++;
				num2++;
			}
			state.Actions = array;
			customAction.Init(state);
		}
	}
	public static class HookUtils
	{
		public static Action<HeroController> OnHeroUpdate;

		public static Action<HeroController> OnHeroAwake;

		public static Action<PlayMakerFSM> OnFsmAwake;

		public static void Init()
		{
			typeof(PlayMakerFSM).Hook("Awake", (Action<Action<PlayMakerFSM>, PlayMakerFSM>)delegate(Action<PlayMakerFSM> orig, PlayMakerFSM self)
			{
				orig(self);
				OnFsmAwake?.Invoke(self);
			});
			typeof(HeroController).Hook("Update", (Action<Action<HeroController>, HeroController>)delegate(Action<HeroController> orig, HeroController self)
			{
				orig(self);
				OnHeroUpdate?.Invoke(self);
			});
			typeof(HeroController).Hook("Awake", (Action<Action<HeroController>, HeroController>)delegate(Action<HeroController> orig, HeroController self)
			{
				orig(self);
				OnHeroAwake?.Invoke(self);
			});
		}

		public static void Hook(this Type type, string name, Delegate target, params Type[] types)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (Extensions.IsNullOrEmpty<Type>((ICollection<Type>)types))
			{
				new Hook((MethodBase)type.GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), target);
			}
			else
			{
				new Hook((MethodBase)type.GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, types, null), target);
			}
		}
	}
	public static class MiscUtils
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0
		{
			public HeroController hero;

			public Predicate<HeroController> condition;

			internal bool <FreeControl>b__0()
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				return !hero.controlReqlinquished && (int)HeroController.instance.transitionState == 0 && (condition == null || condition(hero));
			}
		}

		[CompilerGenerated]
		private sealed class <FreeControl>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public HeroController hero;

			public Predicate<HeroController> condition;

			private <>c__DisplayClass0_0 <>8__1;

			private PlayMakerFSM <fsm>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FreeControl>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<fsm>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass0_0();
					<>8__1.hero = hero;
					<>8__1.condition = condition;
					<fsm>5__2 = <>8__1.hero.sprintFSM;
					if (<fsm>5__2.ActiveStateName.Contains("Sprint"))
					{
						<fsm>5__2.SendEvent("SKID END");
					}
					<>8__1.hero.umbrellaFSM.SendEvent("END");
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.hero.controlReqlinquished && (int)HeroController.instance.transitionState == 0 && (<>8__1.condition == null || <>8__1.condition(<>8__1.hero))));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<FreeControl>d__0))]
		public static IEnumerator FreeControl(this HeroController hero, Predicate<HeroController> condition = null)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FreeControl>d__0(0)
			{
				hero = hero,
				condition = condition
			};
		}

		[CanBeNull]
		public static SavedItem GetSavedItem(string name)
		{
			if (((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).dictionary.TryGetValue(name, out var value))
			{
				return (SavedItem)(object)value;
			}
			if (((NamedScriptableObjectList<CollectableRelic>)(object)ManagerSingleton<CollectableRelicManager>.Instance.masterList).dictionary.TryGetValue(name, out var value2))
			{
				return (SavedItem)(object)value2;
			}
			if (((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).dictionary.TryGetValue(name, out var value3))
			{
				return (SavedItem)(object)value3;
			}
			return (SavedItem)(object)((NamedScriptableObjectList<ToolItem>)(object)ManagerSingleton<ToolItemManager>.Instance.toolItems).dictionary.GetValueOrDefault(name);
		}
	}
	public class LocalStr
	{
		public readonly string Content;

		public LocalStr(string s)
		{
			Content = s;
			base..ctor();
		}

		public static implicit operator LocalisedString(LocalStr s)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return new LocalisedString("ArchitectMod", s.Content);
		}

		public static implicit operator string(LocalStr s)
		{
			return s.Content;
		}

		public static implicit operator LocalStr(string s)
		{
			return new LocalStr(s);
		}
	}
	public static class ObjectUtils
	{
		public static T GetOrAddComponent<T>(this GameObject obj) where T : Component
		{
			T component = obj.GetComponent<T>();
			return Object.op_Implicit((Object)(object)component) ? component : obj.AddComponent<T>();
		}

		public static void RemoveComponent<T>(this GameObject obj) where T : Component
		{
			T component = obj.GetComponent<T>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.Destroy((Object)(object)component);
			}
		}

		public static T ReplaceComponent<T>(this GameObject obj) where T : Component
		{
			obj.RemoveComponent<T>();
			return obj.AddComponent<T>();
		}

		public static void BroadcastEvent(this GameObject obj, string triggerName)
		{
			EventManager.BroadcastEvent(obj, triggerName);
		}

		public static void RemoveComponentsInChildren<T>(this GameObject obj) where T : Component
		{
			T[] componentsInChildren = obj.GetComponentsInChildren<T>(true);
			T[] array = componentsInChildren;
			foreach (T val in array)
			{
				Object.Destroy((Object)(object)val);
			}
		}

		public static string GetPath(this Transform current)
		{
			if (!Object.op_Implicit((Object)(object)current.parent))
			{
				return ((Object)current).name;
			}
			return current.parent.GetPath() + "/" + ((Object)current).name;
		}

		public static GameObject FindGameObject(string path)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < SceneManager.loadedSceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				GameObject gameObjectFromArray = GetGameObjectFromArray(((Scene)(ref sceneAt)).GetRootGameObjects(), path);
				if (Object.op_Implicit((Object)(object)gameObjectFromArray))
				{
					return gameObjectFromArray;
				}
			}
			return null;
		}

		internal static GameObject GetGameObjectFromArray(GameObject[] objects, string objName)
		{
			string text = null;
			int num = objName.IndexOf('/');
			string rootName;
			if (num == -1)
			{
				rootName = objName;
			}
			else
			{
				if (num == 0 || num == objName.Length - 1)
				{
					throw new ArgumentException("Invalid GameObject path");
				}
				rootName = objName.Substring(0, num);
				int num2 = num + 1;
				text = objName.Substring(num2, objName.Length - num2);
			}
			GameObject val = ((IEnumerable<GameObject>)objects).FirstOrDefault((Func<GameObject, bool>)((GameObject o) => ((Object)o).name == rootName));
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			if (text != null)
			{
				Transform val2 = val.transform.Find(text);
				return (!Object.op_Implicit((Object)(object)val2)) ? null : ((Component)val2).gameObject;
			}
			return val;
		}
	}
	public static class PreviewUtils
	{
		public static Vector3 FixPreview(SpriteRenderer renderer, PlaceableObject type, bool flipped, float rotation, float scale)
		{
			//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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			if (type.Tk2dRotation / 90 % 2 != 0)
			{
				renderer.flipY = flipped != type.FlipX;
				renderer.flipX = type.LossyScale.x < 0f;
			}
			else
			{
				renderer.flipX = flipped != type.FlipX;
				renderer.flipY = type.LossyScale.y < 0f;
			}
			Vector3 childOffset = type.ChildOffset;
			childOffset.x /= type.LossyScale.x;
			childOffset.y /= type.LossyScale.y;
			Vector3 val = type.Offset + childOffset;
			val.x *= type.ParentScale.x;
			val.y *= type.ParentScale.y;
			if (flipped)
			{
				val.x = 0f - val.x;
			}
			return Quaternion.Euler(0f, 0f, rotation) * (val * scale);
		}

		public static Sprite ConvertFrom2DToolkit(tk2dSpriteDefinition def, float ppu)
		{
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			Texture mainTexture = def.material.mainTexture;
			Texture2D val = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null);
			if (val == null)
			{
				return null;
			}
			float num = def.uvs[0].x;
			float num2 = def.uvs[0].y;
			float num3 = def.uvs[0].x;
			float num4 = def.uvs[0].y;
			for (int i = 1; i < def.uvs.Length; i++)
			{
				num = Mathf.Min(num, def.uvs[i].x);
				num2 = Mathf.Min(num2, def.uvs[i].y);
				num3 = Mathf.Max(num3, def.uvs[i].x);
				num4 = Mathf.Max(num4, def.uvs[i].y);
			}
			float num5 = num * (float)((Texture)val).width;
			float num6 = num2 * (float)((Texture)val).height;
			float num7 = (num3 - num) * (float)((Texture)val).width;
			float num8 = (num4 - num2) * (float)((Texture)val).height;
			return Sprite.Create(val, new Rect(num5, num6, num7, num8), new Vector2(0.5f, 0.5f), ppu);
		}
	}
	public static class QuickWarpHook
	{
		private static QuickWarpGUI _gui;

		private static FieldInfo _areaNames;

		private static FieldInfo _scenesByArea;

		private static FieldInfo _transitionsByScene;

		private static FieldInfo _respawnsByScene;

		public static void Init()
		{
			_gui = Resources.FindObjectsOfTypeAll<QuickWarpGUI>().FirstOrDefault();
			if (Object.op_Implicit((Object)(object)_gui))
			{
				_areaNames = typeof(QuickWarpGUI).GetField("_areaNames", BindingFlags.Instance | BindingFlags.NonPublic);
				_scenesByArea = typeof(Warp).GetField("_scenes_by_area", BindingFlags.Static | BindingFlags.NonPublic);
				_transitionsByScene = typeof(Warp).GetField("_transitions_by_scene", BindingFlags.Static | BindingFlags.NonPublic);
				_respawnsByScene = typeof(Warp).GetField("_respawns_by_scene", BindingFlags.Static | BindingFlags.NonPublic);
				SceneUtils.QWHookEnabled = true;
			}
		}

		private static void RegisterGroup(string groupName)
		{
			List<string> list = ((string[])_areaNames.GetValue(_gui)).ToList();
			Dictionary<string, List<string>> dictionary = (Dictionary<string, List<string>>)_scenesByArea.GetValue(null);
			dictionary[groupName] = new List<string>();
			list.Add(groupName);
			_areaNames.SetValue(_gui, list.ToArray());
		}

		private static void UnregisterGroup(string groupName)
		{
			List<string> list = ((string[])_areaNames.GetValue(_gui)).ToList();
			list.Remove(groupName);
			Dictionary<string, List<string>> dictionary = (Dictionary<string, List<string>>)_scenesByArea.GetValue(null);
			dictionary.Remove(groupName);
			_areaNames.SetValue(_gui, list.ToArray());
		}

		public static void RegisterScene(string groupName, string sceneName)
		{
			Dictionary<string, List<string>> dictionary = (Dictionary<string, List<string>>)_scenesByArea.GetValue(null);
			if (!dictionary.ContainsKey(groupName))
			{
				RegisterGroup(groupName);
			}
			dictionary[groupName].Add(sceneName);
			((Dictionary<string, List<string>>)_transitionsByScene.GetValue(null))[sceneName] = new List<string>(1) { "_SceneManager" };
			((Dictionary<string, List<string>>)_respawnsByScene.GetValue(null))[sceneName] = new List<string>();
		}

		public static void UnregisterScene(string groupName, string sceneName)
		{
			Dictionary<string, List<string>> dictionary = (Dictionary<string, List<string>>)_scenesByArea.GetValue(null);
			if (dictionary.ContainsKey(groupName))
			{
				dictionary[groupName].Remove(sceneName);
				if (Extensions.IsNullOrEmpty<string>((ICollection<string>)dictionary[groupName]))
				{
					UnregisterGroup(groupName);
				}
			}
		}
	}
	public class QuickWarpHookLoader
	{
		public static void Init()
		{
			QuickWarpHook.Init();
		}

		public static void RegisterScene(string groupName, string sceneName)
		{
			QuickWarpHook.RegisterScene(groupName, sceneName);
		}

		public static void UnregisterScene(string groupName, string sceneName)
		{
			QuickWarpHook.UnregisterScene(groupName, sceneName);
		}
	}
	public static class ResourceUtils
	{
		[CompilerGenerated]
		private sealed class <LoadClip>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string clipPath;

			public Action<AudioClip> callback;

			private UnityWebRequest <www>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadClip>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<www>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0032: 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_006e: Invalid comparison between Unknown and I4
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<www>5__1 = UnityWebRequestMultimedia.GetAudioClip(new Uri(clipPath), GetAudioType(clipPath));
					<>2__current = <www>5__1.SendWebRequest();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((int)<www>5__1.result == 1)
					{
						callback(DownloadHandlerAudioClip.GetContent(<www>5__1));
					}
					else
					{
						ArchitectPlugin.Logger.LogInfo((object)<www>5__1.error);
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static Sprite LoadSpriteResource(string spritePath, FilterMode filterMode = 1, Vector4 border = default(Vector4), float ppu = 100f)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return LoadSpriteResource(spritePath, new Vector2(0.5f, 0.5f), filterMode, border, ppu);
		}

		internal static Sprite LoadSpriteResource(string spritePath, Vector2 pivot, FilterMode filterMode = 1, Vector