Decompiled source of Architect v3.19.0

Architect/Architect.dll

Decompiled 18 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 Silksong.DataManager;
using Silksong.ModMenu;
using Silksong.ModMenu.Elements;
using Silksong.ModMenu.Models;
using Silksong.ModMenu.Screens;
using TMProOld;
using TeamCherry.Localization;
using TeamCherry.SharedUtils;
using TeamCherry.Splines;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Bindings;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;
using UnityStandardAssets.ImageEffects;
using tk2dRuntime.TileMap;

[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.19.0.0")]
[assembly: AssemblyInformationalVersion("3.19.0+fb593c3bfc42008782ec87aaedb5054d226ae06e")]
[assembly: AssemblyProduct("Architect")]
[assembly: AssemblyTitle("Architect")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.19.0.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 MonoDetour.HookGen
{
	internal static class DefaultMonoDetourManager
	{
		internal static MonoDetourManager Instance { get; } = New();


		internal static MonoDetourManager New()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
	internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets
	{
		public Type? TargetType { get; }

		public bool IncludeNestedTypes { get; set; }

		public bool DistinguishOverloadsByName { get; set; }

		public string[]? Members { get; set; }

		public string[]? MemberNamePrefixes { get; set; }

		public string[]? MemberNameSuffixes { get; set; }

		public bool GenerateControlFlowVariants { get; set; }

		public MonoDetourTargetsAttribute(Type? targetType = null)
		{
			TargetType = targetType;
			IncludeNestedTypes = true;
			base..ctor();
		}
	}
}
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
{
	public class ArchitectData
	{
		public Dictionary<string, string> StringVariables = new Dictionary<string, string>();

		public Dictionary<string, float> FloatVariables = new Dictionary<string, float>();

		public Dictionary<string, bool> BoolVariables = new Dictionary<string, bool>();

		public static ArchitectData Instance => ArchitectPlugin.Instance.SaveData ?? (ArchitectPlugin.Instance.SaveData = new ArchitectData());
	}
	public class GlobalArchitectData
	{
		public Dictionary<string, KeyCode> Keybinds = new Dictionary<string, KeyCode>();

		public string CurrentMap = "";

		public static GlobalArchitectData Instance => ArchitectPlugin.Instance.GlobalData ?? (ArchitectPlugin.Instance.GlobalData = new GlobalArchitectData());

		public string MapLabel => Utility.IsNullOrWhiteSpace(CurrentMap) ? "Map Keybinds" : CurrentMap;
	}
	[BepInPlugin("com.cometcake575.architect", "Architect", "3.19.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[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, ISaveDataMod<ArchitectData>, IRawSaveDataMod, IGlobalDataMod<GlobalArchitectData>, IRawGlobalDataMod
	{
		internal static ArchitectPlugin Instance;

		internal static ManualLogSource Logger;

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

		public ArchitectData SaveData { get; set; }

		public GlobalArchitectData GlobalData { get; set; }

		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();
			StorageManager.MakeBackup();
			typeof(GameManager).Hook("ResetSemiPersistentItems", (Action<Action<GameManager>, GameManager>)delegate(Action<GameManager> orig, GameManager self)
			{
				BoolVarBlock.SemiVars.Clear();
				NumVarBlock.SemiVars.Clear();
				StringVarBlock.SemiVars.Clear();
				orig(self);
			});
		}

		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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: 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, -187.5f), 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, -187.5f), 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, -225f), new List<Architect.Workshop.Types.ConfigType>[6]
			{
				Architect.Workshop.Config.ConfigGroup.SceneGroup,
				Architect.Workshop.Config.ConfigGroup.SceneGroupIcon,
				Architect.Workshop.Config.ConfigGroup.SceneGroupMap,
				Architect.Workshop.Config.ConfigGroup.SceneGroupMapPos,
				Architect.Workshop.Config.ConfigGroup.SceneGroupMapDirIn,
				Architect.Workshop.Config.ConfigGroup.SceneGroupMapDirOut
			});
			Register<CustomScene>("Scene", new Vector2(-100f, -225f), new List<Architect.Workshop.Types.ConfigType>[3]
			{
				Architect.Workshop.Config.ConfigGroup.Scene,
				Architect.Workshop.Config.ConfigGroup.SceneMap,
				Architect.Workshop.Config.ConfigGroup.SceneMapColour
			});
			Register<CustomMateriumEntry>("Material", new Vector2(-300f, -262.5f), new List<Architect.Workshop.Types.ConfigType>[2]
			{
				Architect.Workshop.Config.ConfigGroup.MateriumEntry,
				Architect.Workshop.Config.ConfigGroup.SpriteItem
			});
			Register<CustomMapIcon>("Map Icon", new Vector2(-100f, -262.5f), new List<Architect.Workshop.Types.ConfigType>[3]
			{
				Architect.Workshop.Config.ConfigGroup.MapIcon,
				Architect.Workshop.Config.ConfigGroup.SpriteItem,
				Architect.Workshop.Config.ConfigGroup.MapIconLabel
			});
			CustomKeybind.Init();
			Register<CustomKeybind>("Keybind", new Vector2(-300f, -300f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Keybind });
			SceneGroup.Init();
			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 : ConfigType<WorkshopItem, NoteConfigValue>
	{
		public NoteConfigType(string name)
			: base(name, string.Empty, (Action<WorkshopItem, NoteConfigValue>)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(this, data);
		}

		public static implicit operator NoteConfigType(string s)
		{
			return new NoteConfigType(s);
		}
	}
	public class NoteConfigValue : ConfigValue<NoteConfigType>
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private string <value>P;

		public NoteConfigValue(NoteConfigType 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();
			WorkshopManager.CustomItems.Add(this);
		}

		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);
			WorkshopManager.CustomItems.Remove(this);
		}
	}
	public class CustomKeybind : WorkshopItem
	{
		public class CustomKeyBindElement : KeyBindElement
		{
			public CustomKeybind Keybind;

			public CustomKeyBindElement(string label, [NotNull] IValueModel<KeyCode> model)
				: base(LocalizedText.op_Implicit(label), model)
			{
				((SelectableValueElement<KeyCode>)this).OnValueChanged += DoChange;
				((MenuDisposable)this).OnDispose += DoDispose;
			}

			public void DoChange(KeyCode code)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				GlobalArchitectData.Instance.Keybinds[Keybind.Id] = code;
			}

			public void DoDispose()
			{
				((SelectableValueElement<KeyCode>)this).OnValueChanged -= DoChange;
				((MenuDisposable)this).OnDispose -= DoDispose;
			}
		}

		private static readonly Sprite Icon = ResourceUtils.LoadSpriteResource("key_listener", (FilterMode)0);

		public static readonly Dictionary<string, CustomKeybind> Keybinds = new Dictionary<string, CustomKeybind>();

		public string Name = string.Empty;

		public KeyCode Default = (KeyCode)0;

		public override void Register()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (!GlobalArchitectData.Instance.Keybinds.ContainsKey(Id) || Settings.TestMode.Value)
			{
				GlobalArchitectData.Instance.Keybinds[Id] = Default;
			}
			Keybinds.Add(Id, this);
		}

		public override void Unregister()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			Keybinds.Remove(Id);
			if (GlobalArchitectData.Instance.Keybinds.TryGetValue(Id, out var value) && (int)value == 0)
			{
				GlobalArchitectData.Instance.Keybinds.Remove(Id);
			}
		}

		public override Sprite GetIcon()
		{
			return Icon;
		}

		public static void Init()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			SimpleMenuScreen mapKeybinds = null;
			List<CustomKeyBindElement> keyButtons = new List<CustomKeyBindElement>();
			Registry.AddModMenu("Architect Binds", (MenuElementGenerator)delegate
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected O, but got Unknown
				TextButton val = new TextButton(LocalizedText.Key(new LocalisedString("ArchitectMap", "ArchitectMap")));
				val.OnSubmit = (Action)Delegate.Combine(val.OnSubmit, (Action)delegate
				{
					//IL_0062: Unknown result type (might be due to invalid IL or missing references)
					//IL_006c: Expected O, but got Unknown
					//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
					SimpleMenuScreen obj = mapKeybinds;
					if (obj != null)
					{
						((MenuDisposable)obj).Dispose();
					}
					foreach (CustomKeyBindElement item in keyButtons)
					{
						((MenuDisposable)item).Dispose();
					}
					keyButtons.Clear();
					mapKeybinds = new SimpleMenuScreen(GlobalArchitectData.Instance.MapLabel);
					MenuScreenNavigation.Show((AbstractMenuScreen)(object)mapKeybinds, (HistoryMode)0);
					foreach (KeyValuePair<string, CustomKeybind> keybind in Keybinds)
					{
						keybind.Deconstruct(out var key, out var value);
						string key2 = key;
						CustomKeybind customKeybind = value;
						CustomKeyBindElement customKeyBindElement = new CustomKeyBindElement(customKeybind.Name, (IValueModel<KeyCode>)(object)new ValueModel<KeyCode>(GlobalArchitectData.Instance.Keybinds[key2]))
						{
							Keybind = customKeybind
						};
						keyButtons.Add(customKeyBindElement);
						mapKeybinds.Add((MenuElement)(object)customKeyBindElement);
					}
				});
				return (SelectableElement)(object)val;
			});
		}
	}
	public class CustomMapIcon : SpriteItem
	{
		public class MapDisplayHandler : MonoBehaviour
		{
			public int mode;

			public string reqVar;

			private GameMap _gameMap;

			private Renderer _renderer;

			private void Reset()
			{
				_gameMap = ((Component)this).GetComponentInParent<GameMap>(true);
			}

			private void Awake()
			{
				_gameMap = ((Component)this).GetComponentInParent<GameMap>();
				_gameMap.UpdateQuickMapDisplay += Refresh;
				_renderer = ((Component)this).GetComponent<Renderer>();
			}

			private void Start()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Invalid comparison between Unknown and I4
				if ((int)DisplayOnWorldMapOnly.updateState != 0)
				{
					Refresh((int)DisplayOnWorldMapOnly.updateState == 2, (MapZone)0);
				}
			}

			private void OnDestroy()
			{
				_gameMap.UpdateQuickMapDisplay -= Refresh;
			}

			private void Refresh(bool isQuickMap, MapZone _)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				DisplayOnWorldMapOnly.updateState = (UpdateState)((!isQuickMap) ? 1 : 2);
				if (Object.op_Implicit((Object)(object)_renderer))
				{
					_renderer.enabled = (mode == 0 || mode == 1 == isQuickMap) && ShouldBeVisible();
				}
			}

			private bool ShouldBeVisible()
			{
				if (Utility.IsNullOrWhiteSpace(reqVar))
				{
					return true;
				}
				bool value;
				return ArchitectData.Instance.BoolVariables.TryGetValue(reqVar, out value) && value;
			}
		}

		public static readonly List<CustomMapIcon> Icons = new List<CustomMapIcon>();

		public string Scene = string.Empty;

		public Vector2 Pos = Vector2.zero;

		public int Mode;

		public string Text = string.Empty;

		public float FontSize = 6.2f;

		public Vector2 Offset = Vector2.zero;

		public Color Colour = Color.white;

		public string ReqVar;

		private GameObject _iconObj;

		private SpriteRenderer _renderer;

		public override void Register()
		{
			Icons.Add(this);
			Setup();
			base.Register();
		}

		public override void Unregister()
		{
			Icons.Remove(this);
			if (Object.op_Implicit((Object)(object)_iconObj))
			{
				Object.Destroy((Object)(object)_iconObj);
			}
		}

		public void Setup()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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)
			if (SceneUtils.CustomScenes.TryGetValue(Scene, out var value) && Object.op_Implicit((Object)(object)value.Map))
			{
				_iconObj = Object.Instantiate<GameObject>(SceneGroup.MapIconPrefab, value.Map.transform);
				_iconObj.transform.localPosition = Vector2.op_Implicit(Pos);
				Extensions.SetLocalPositionZ(_iconObj.transform, -2.4911f);
				_iconObj.transform.GetChild(0).localPosition = Vector2.op_Implicit(Offset);
				((Renderer)_iconObj.GetComponentInChildren<MeshRenderer>()).sortingOrder = 11;
				_renderer = _iconObj.GetComponentInChildren<SpriteRenderer>();
				((Renderer)_renderer).sortingOrder = 11;
				_iconObj.GetComponentInChildren<SetTextMeshProGameText>().text = (LocalStr)Text;
				TextMeshPro componentInChildren = _iconObj.GetComponentInChildren<TextMeshPro>();
				((TMP_Text)componentInChildren).fontSize = FontSize;
				((Graphic)componentInChildren).color = Colour;
				MapDisplayHandler mapDisplayHandler = ((Component)_iconObj.transform.GetChild(0)).gameObject.AddComponent<MapDisplayHandler>();
				MapDisplayHandler mapDisplayHandler2 = ((Component)_iconObj.transform.GetChild(1)).gameObject.AddComponent<MapDisplayHandler>();
				mapDisplayHandler.mode = Mode;
				mapDisplayHandler.reqVar = (mapDisplayHandler2.reqVar = ReqVar);
				_renderer.sprite = Sprite;
				_iconObj.SetActive(true);
			}
		}

		protected override void OnReadySprite()
		{
			if (Object.op_Implicit((Object)(object)_renderer))
			{
				_renderer.sprite = Sprite;
			}
		}
	}
	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 WallDesc = 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)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			_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;
			_quest.wallDescription = WallDesc;
			((NamedScriptableObjectList<BasicQuestBase>)(object)QuestManager.Instance.masterList).Add((BasicQuestBase)(object)_quest);
			base.Register();
			RefreshLSprite();
			RefreshGSprite();
			QuestManager.IncrementVersion();
			WorkshopManager.CustomItems.Add(this);
		}

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

		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 : SpriteItem
	{
		public string Group = "None";

		public int TilemapWidth = 500;

		public int TilemapHeight = 500;

		public Vector2 MapPos;

		public string EIconUrl = string.Empty;

		public bool EPoint;

		public float EPpu = 100f;

		public bool OverrideColour;

		public Color MapColour = Color.white;

		public GameObject Map;

		public GameMapScene Gms;

		private Sprite _is;

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

		public override void Register()
		{
			SceneUtils.CustomScenes.Add(Id, this);
			if (Object.op_Implicit((Object)(object)Map))
			{
				Object.Destroy((Object)(object)Map);
			}
			TrySetupMap();
			if (SceneUtils.QWHookEnabled)
			{
				QuickWarpHookLoader.RegisterScene(Group, Id);
			}
		}

		public void TrySetupMap()
		{
			//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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			if (!SceneUtils.SceneGroups.TryGetValue(Group, out var value) || !Object.op_Implicit((Object)(object)value.FocusMapObject))
			{
				return;
			}
			Map = Object.Instantiate<GameObject>(SceneGroup.MapSegmentPrefab, value.FocusMapObject.transform);
			((Object)Map).name = Id;
			Map.SetActive(true);
			Map.transform.localPosition = Vector2.op_Implicit(MapPos);
			Gms = Map.GetComponent<GameMapScene>();
			Gms.initialColor = value.MapColour;
			Gms.fullSprite = null;
			Gms.initialSprite = null;
			Gms.initialState = (States)1;
			Gms.spriteRenderer = ((Component)Gms).GetComponent<SpriteRenderer>();
			Gms.hasSpriteRenderer = true;
			Gms.spriteRenderer.color = (OverrideColour ? MapColour : value.MapColour);
			Gms.spriteRenderer.sprite = null;
			RefreshSprite();
			RefreshESprite();
			foreach (CustomMapIcon item in CustomMapIcon.Icons.Where((CustomMapIcon i) => i.Scene == Id))
			{
				item.Setup();
			}
			RefreshMap();
		}

		private void RefreshMap()
		{
			if (Object.op_Implicit((Object)(object)Gms))
			{
				PlayerData instance = PlayerData.instance;
				Gms.initialSprite = _is;
				Gms.fullSprite = Sprite;
				Gms.hasBeenSet = false;
				if ((Gms.isMapped || instance.scenesVisited.Contains(Id)) && SceneUtils.SceneGroups.TryGetValue(Group, out var value) && value.HasMapZone && !CollectableItemManager.IsInHiddenMode() && instance.hasQuill)
				{
					Gms.SetMapped();
				}
				else
				{
					Gms.SetNotMapped();
				}
				if (Object.op_Implicit((Object)(object)GameManager.instance.gameMap))
				{
					GameManager.instance.gameMap.CalculateMapScrollBounds();
				}
			}
		}

		public void RefreshESprite()
		{
			if (!Object.op_Implicit((Object)(object)Gms))
			{
				return;
			}
			if (Utility.IsNullOrWhiteSpace(EIconUrl))
			{
				RefreshMap();
				return;
			}
			CustomAssetManager.DoLoadSprite(EIconUrl, EPoint, EPpu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					_is = sprites[0];
					RefreshMap();
				}
			});
		}

		protected override void OnReadySprite()
		{
			RefreshMap();
		}

		public override void Unregister()
		{
			SceneUtils.CustomScenes.Remove(Id);
			if (Object.op_Implicit((Object)(object)Map))
			{
				Object.Destroy((Object)(object)Map);
			}
			if (SceneUtils.QWHookEnabled)
			{
				QuickWarpHookLoader.UnregisterScene(Group, Id);
			}
			if (Object.op_Implicit((Object)(object)GameManager.instance.gameMap))
			{
				GameManager.instance.gameMap.CalculateMapScrollBounds();
			}
		}
	}
	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 delegate bool HasMapForScene(GameMap self, string sceneName, out bool hasSceneSprite);

		public class CustomMapZone : MonoBehaviour
		{
			public SceneGroup SceneGroup;

			public void OnEnable()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				if (SceneGroup != null)
				{
					SceneGroup.MapZone.initialColor = SceneGroup.MapColour;
					SceneGroup.MapZone.initialLabelColor = Color.white;
				}
			}
		}

		public string GroupName = string.Empty;

		public bool DisableAct3Bg;

		public Vector2 MapPos;

		public Vector2 LabelPos;

		public Vector2 ZoomPos;

		public Vector2 AreaNamePos;

		public string Variable = string.Empty;

		public float Radius = 0.2f;

		public bool HasMapZone;

		public Color MapColour = Color.white;

		public string MapUrl = string.Empty;

		public bool MPoint;

		public float MPpu = 100f;

		public readonly string[] OverwriteEnter = new string[4] { "", "", "", "" };

		public readonly string[] OverwriteExit = new string[4] { "", "", "", "" };

		public Sprite MapSprite;

		public AreaBackground Background;

		private static InventoryWideMap _wideMap;

		public static GameObject MapSegmentPrefab;

		public static GameObject MapIconPrefab;

		private static GameObject _areaTextPrefab;

		public InventoryItemWideMapZone MapZone;

		private GameObject _mapObject;

		public GameObject FocusMapObject;

		private static readonly int UILayer = LayerMask.NameToLayer("UI");

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

		public static void Init()
		{
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			PreloadManager.RegisterPreload(new BasicPreload("maps_assets_all", "Assets/Prefabs/UI/Map/Game_Map_Hornet.prefab", delegate(GameObject o)
			{
				GameObject gameObject = ((Component)o.transform.Find("Tut").Find("Tut_02")).gameObject;
				gameObject.SetActive(false);
				MapSegmentPrefab = Object.Instantiate<GameObject>(gameObject);
				gameObject.SetActive(true);
				Object.DontDestroyOnLoad((Object)(object)MapSegmentPrefab);
				GameObject gameObject2 = ((Component)o.transform.Find("Tut").Find("Area Name (2)")).gameObject;
				gameObject2.SetActive(false);
				_areaTextPrefab = Object.Instantiate<GameObject>(gameObject2);
				gameObject2.SetActive(true);
				Object.DontDestroyOnLoad((Object)(object)_areaTextPrefab);
				GameObject gameObject3 = ((Component)o.transform.Find("Tut").Find("Tut_01").Find("Next Area Up (2)")).gameObject;
				gameObject3.SetActive(false);
				MapIconPrefab = Object.Instantiate<GameObject>(gameObject3);
				gameObject3.SetActive(true);
				Object.DontDestroyOnLoad((Object)(object)MapIconPrefab);
			}, notSceneBundle: true));
			typeof(GameMap).Hook("SetupMap", (Action<Action<GameMap, bool>, GameMap, bool>)delegate(Action<GameMap, bool> orig, GameMap self, bool pinsOnly)
			{
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				orig(self, pinsOnly);
				PlayerData instance = PlayerData.instance;
				foreach (var (item, customScene2) in SceneUtils.CustomScenes)
				{
					if (Object.op_Implicit((Object)(object)customScene2.Gms))
					{
						if ((customScene2.Gms.isMapped || instance.scenesVisited.Contains(item)) && SceneUtils.SceneGroups.TryGetValue(customScene2.Group, out var value7) && value7.HasMapZone && !CollectableItemManager.IsInHiddenMode())
						{
							customScene2.Gms.spriteRenderer.color = value7.MapColour;
							if (instance.hasQuill && !pinsOnly)
							{
								customScene2.Gms.initialColor = value7.MapColour;
								customScene2.Gms.hasBeenSet = false;
								customScene2.Gms.SetMapped();
							}
						}
						else
						{
							customScene2.Gms.SetNotMapped();
						}
					}
				}
			});
			typeof(GameMap).Hook("HasMapForScene", (<>F{00000400}<HasMapForScene, GameMap, string, bool, bool>)delegate(HasMapForScene orig, GameMap self, string sceneName, out bool hasSceneSprite)
			{
				if (SceneUtils.CustomScenes.TryGetValue(sceneName, out var value5) && SceneUtils.SceneGroups.TryGetValue(value5.Group, out var value6))
				{
					hasSceneSprite = value6.HasMapZone && Object.op_Implicit((Object)(object)value5.Gms) && Object.op_Implicit((Object)(object)value5.Gms.BoundsSprite);
					return value6.HasMapZone;
				}
				return orig(self, sceneName, out hasSceneSprite);
			});
			typeof(InventoryItemWideMapZone).Hook("GetNextSelectable", (Func<Func<InventoryItemWideMapZone, SelectionDirection, InventoryItemSelectable>, InventoryItemWideMapZone, SelectionDirection, InventoryItemSelectable>)delegate(Func<InventoryItemWideMapZone, SelectionDirection, InventoryItemSelectable> orig, InventoryItemWideMapZone self, SelectionDirection dir)
			{
				//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_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Expected O, but got Unknown
				//IL_011f: 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_014d: Unknown result type (might be due to invalid IL or missing references)
				string[] splitName = ((Object)self).name.Split("_");
				int num4 = splitName.Length;
				int num5 = num4;
				if (num5 <= 4)
				{
					if (num5 > 2)
					{
						SceneGroup sceneGroup = SceneUtils.SceneGroups.Values.FirstOrDefault((SceneGroup cm) => cm.OverwriteEnter[dir].Contains(splitName[2]));
						if (sceneGroup != null)
						{
							return (InventoryItemSelectable)(object)sceneGroup.MapZone;
						}
					}
				}
				else
				{
					SceneGroup sceneGroup2 = SceneUtils.SceneGroups.Values.FirstOrDefault((SceneGroup cm) => cm.OverwriteEnter[dir].Contains(splitName[4]));
					if (sceneGroup2 != null)
					{
						return (InventoryItemSelectable)(object)sceneGroup2.MapZone;
					}
				}
				CustomMapZone component3 = ((Component)self).GetComponent<CustomMapZone>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					foreach (Transform item2 in ((Component)_wideMap).transform)
					{
						Transform val5 = item2;
						string[] array = ((Object)val5).name.Split("_");
						int num6 = array.Length;
						int num7 = num6;
						if (num7 <= 4)
						{
							if (num7 > 2 && component3.SceneGroup.OverwriteExit[dir].Contains(array[2]))
							{
								return (InventoryItemSelectable)(object)((Component)val5).GetComponent<InventoryItemWideMapZone>();
							}
						}
						else if (component3.SceneGroup.OverwriteExit[dir].Contains(array[4]))
						{
							return (InventoryItemSelectable)(object)((Component)val5).GetComponent<InventoryItemWideMapZone>();
						}
					}
					InventoryItemSelectable selectableFromAutoNavGroup = ((InventoryItemSelectableDirectional)self).GetSelectableFromAutoNavGroup<InventoryItemSelectable>(dir, (Func<InventoryItemSelectable, bool>)null);
					return (selectableFromAutoNavGroup is InventoryItemWideMapZone) ? selectableFromAutoNavGroup : null;
				}
				return orig(self, dir);
			}, typeof(SelectionDirection));
			typeof(InventoryWideMap).Hook("UpdatePositions", (Action<Action<InventoryWideMap>, InventoryWideMap>)delegate(Action<InventoryWideMap> orig, InventoryWideMap self)
			{
				if ((Object)(object)self != (Object)(object)_wideMap)
				{
					ArchitectPlugin.Logger.LogInfo((object)"Setting up WideMap");
					_wideMap = self;
					foreach (SceneGroup value8 in SceneUtils.SceneGroups.Values)
					{
						value8.RegisterMap();
					}
					SceneUtils.AdjustMapScale(_wideMap);
				}
				orig(self);
			});
			Vector2 zoomPos = default(Vector2);
			bool customZoom = false;
			typeof(InventoryItemWideMapZone).Hook("Submit", (Func<Func<InventoryItemWideMapZone, bool>, InventoryItemWideMapZone, bool>)delegate(Func<InventoryItemWideMapZone, bool> orig, InventoryItemWideMapZone self)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				CustomMapZone component2 = ((Component)self).GetComponent<CustomMapZone>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					zoomPos = component2.SceneGroup.ZoomPos;
					customZoom = true;
				}
				else
				{
					customZoom = false;
				}
				return orig(self);
			});
			typeof(InventoryMapManager).Hook("ZoomIn", (Action<Action<InventoryMapManager, MapZone, bool>, InventoryMapManager, MapZone, bool>)delegate(Action<InventoryMapManager, MapZone, bool> orig, InventoryMapManager self, MapZone zone, bool animate)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				if ((int)zone == 0 && zoomPos == default(Vector2) && SceneUtils.CustomScenes.TryGetValue(GameManager.instance.sceneName, out var value3) && SceneUtils.SceneGroups.TryGetValue(value3.Group, out var value4))
				{
					zoomPos = value4.ZoomPos;
					customZoom = true;
				}
				orig(self, zone, animate);
			});
			typeof(GameMap).Hook("GetZoomPosition", (Func<Func<GameMap, MapZone, Vector2>, GameMap, MapZone, Vector2>)((Func<GameMap, MapZone, Vector2> orig, GameMap self, MapZone zone) => customZoom ? (zoomPos * -1.15f) : orig(self, zone)));
			typeof(GameMap).Hook("GetClosestWideMapZone", (Func<Func<GameMap, IEnumerable<InventoryItemWideMapZone>, InventoryItemWideMapZone>, GameMap, IEnumerable<InventoryItemWideMapZone>, InventoryItemWideMapZone>)delegate(Func<GameMap, IEnumerable<InventoryItemWideMapZone>, InventoryItemWideMapZone> orig, GameMap self, IEnumerable<InventoryItemWideMapZone> wideMapPieces)
			{
				//IL_0016: 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_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				InventoryItemWideMapZone val = orig(self, wideMapPieces);
				float num = float.MaxValue;
				Vector3 val2 = -((Component)self).transform.localPosition;
				if (Object.op_Implicit((Object)(object)val))
				{
					ZoneInfo val3 = self.mapZoneInfo[val.zoomToZone];
					ParentInfo[] parents = val3.Parents;
					foreach (ParentInfo val4 in parents)
					{
						if (Object.op_Implicit((Object)(object)val4.Parent))
						{
							for (int j = 0; j < val4.Parent.transform.childCount; j++)
							{
								Transform child = val4.Parent.transform.GetChild(j);
								Vector2 localScenePos = GameMap.GetLocalScenePos(child);
								float num2 = Vector2.Distance(Vector2.op_Implicit(val2), localScenePos);
								if (num2 <= num)
								{
									num = num2;
								}
							}
						}
					}
				}
				foreach (SceneGroup value9 in SceneUtils.SceneGroups.Values)
				{
					if (value9.HasMap())
					{
						float num3 = Vector2.Distance(Vector2.op_Implicit(val2), value9.ZoomPos) - value9.Radius;
						if (num3 < num)
						{
							num = num3;
							val = value9.MapZone;
						}
					}
				}
				return val;
			});
			typeof(GameMap).Hook("EnableUnlockedAreas", (Action<Action<GameMap, MapZone?>, GameMap, MapZone?>)delegate(Action<GameMap, MapZone?> orig, GameMap self, MapZone? setCurrent)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Invalid comparison between Unknown and I4
				if (setCurrent.HasValue)
				{
					if ((int)setCurrent.Value == 0 && SceneUtils.CustomScenes.TryGetValue(GameManager.instance.sceneName, out var value) && SceneUtils.SceneGroups.TryGetValue(value.Group, out var value2) && value2.HasMap())
					{
						value2.FocusMapObject.SetActive(true);
					}
				}
				else
				{
					foreach (SceneGroup item3 in SceneUtils.SceneGroups.Values.Where((SceneGroup group) => group.HasMap()))
					{
						item3.FocusMapObject.SetActive(true);
					}
				}
				orig(self, setCurrent);
			});
			new Hook((MethodBase)typeof(InventoryItemWideMapZone).GetProperty("IsUnlocked").GetGetMethod(), (Delegate)(Func<Func<InventoryItemWideMapZone, bool>, InventoryItemWideMapZone, bool>)delegate(Func<InventoryItemWideMapZone, bool> orig, InventoryItemWideMapZone self)
			{
				CustomMapZone component = ((Component)self).GetComponent<CustomMapZone>();
				return Object.op_Implicit((Object)(object)component) ? component.SceneGroup.HasMap() : orig(self);
			});
		}

		public bool HasMap()
		{
			if (!HasMapZone)
			{
				return false;
			}
			return Utility.IsNullOrWhiteSpace(Variable) || ArchitectData.Instance.BoolVariables.GetValueOrDefault(Variable, defaultValue: false);
		}

		public void RegisterMap()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected O, but got Unknown
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			if (!HasMapZone)
			{
				return;
			}
			_mapObject = Object.Instantiate<GameObject>(((Component)((Component)_wideMap).transform.Find("Wide_map__0007_Bonetown")).gameObject, ((Component)_wideMap).transform, true);
			((Object)_mapObject).name = "Wide_map_" + Id;
			MapZone = _mapObject.GetComponent<InventoryItemWideMapZone>();
			((InventoryItemSelectableDirectional)MapZone).Selectables = (InventoryItemSelectable[])(object)new InventoryItemSelectable[4];
			MapZone.zoomToZone = (MapZone)0;
			CustomMapZone customMapZone = _mapObject.AddComponent<CustomMapZone>();
			customMapZone.SceneGroup = this;
			customMapZone.OnEnable();
			Transform val = _mapObject.transform.Find("Area Name");
			((Component)val).GetComponent<SetTextMeshProGameText>().text = (LocalStr)GroupName;
			Extensions.SetPositionX(val, Extensions.GetPositionX(val) + LabelPos.x);
			Extensions.SetPositionY(val, Extensions.GetPositionY(val) + LabelPos.y);
			_mapObject.transform.localPosition = Vector2.op_Implicit(MapPos);
			_mapObject.GetComponent<SpriteRenderer>().sprite = MapSprite;
			GameMap gameMap = GameManager.instance.gameMap;
			GameObject val2 = new GameObject(Id)
			{
				layer = UILayer
			};
			val2.transform.parent = ((Component)gameMap).transform;
			val2.transform.localPosition = Vector2.op_Implicit(ZoomPos);
			val2.transform.localScale = Vector3.one;
			FocusMapObject = val2;
			GameObject val3 = Object.Instantiate<GameObject>(_areaTextPrefab, FocusMapObject.transform);
			val3.SetActive(true);
			((Object)val3).name = "Area Name";
			val3.transform.localPosition = Vector2.op_Implicit(AreaNamePos);
			val3.GetComponent<SetTextMeshProGameText>().text = (LocalStr)GroupName;
			((Graphic)val3.GetComponent<TextMeshPro>()).color = MapColour;
			foreach (CustomScene item in SceneUtils.CustomScenes.Values.Where((CustomScene s) => s.Group == Id))
			{
				item.TrySetupMap();
			}
			FocusMapObject.SetActive(false);
			_mapObject.SetActive(true);
			GameManager.instance.gameMap.CalculateMapScrollBounds();
			SceneUtils.AdjustMapScale(_wideMap);
		}

		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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			Background = new AreaBackground
			{
				BackgroundImage = ArchitectPlugin.BlankSprite,
				NameOverride = (LocalStr)GroupName,
				Act3OverlayOptOut = DisableAct3Bg
			};
			SceneUtils.SceneGroups.Add(Id, this);
			base.Register();
			RefreshMapSprite();
			if (Object.op_Implicit((Object)(object)_wideMap))
			{
				RegisterMap();
			}
		}

		public void RefreshMapSprite()
		{
			if (Utility.IsNullOrWhiteSpace(MapUrl))
			{
				return;
			}
			CustomAssetManager.DoLoadSprite(MapUrl, MPoint, MPpu, 1, 1, delegate(Sprite[] sprites)
			{
				if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites))
				{
					MapSprite = sprites[0];
					SceneUtils.AdjustMapScale(_wideMap);
					if (Object.op_Implicit((Object)(object)_mapObject))
					{
						_mapObject.GetComponent<SpriteRenderer>().sprite = MapSprite;
					}
				}
			});
		}

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

		public override void Unregister()
		{
			SceneUtils.SceneGroups.Remove(Id);
			if (Object.op_Implicit((Object)(object)_mapObject))
			{
				if (((MonoBehaviour)MapZone).didAwake)
				{
					((InventoryPaneBase)MapZone.pane).OnPaneStart -= MapZone.EvaluateUnlocked;
				}
				_wideMap.selectables = null;
				Object.Destroy((Object)(object)_mapObject);
			}
			if (Object.op_Implicit((Object)(object)FocusMapObject))
			{
				Object.Destroy((Object)(object)FocusMapObject);
			}
			SceneUtils.AdjustMapScale(_wideMap);
		}
	}
	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)),
			(NoteConfigType)"A vanilla entry (list can be found in the guide)",
			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")),
			(NoteConfigType)"A vanilla entry (list can be found in the guide)",
			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> MapIcon = new List<Architect.Workshop.Types.ConfigType>(6)
		{
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomMapIcon>("Custom Scene ID", "map_icon_scene", delegate(CustomMapIcon item, Architect.Workshop.Types.StringConfigValue<CustomMapIcon> value)
			{
				item.Scene = value.GetValue();
			})),
			(NoteConfigType)"The icon is unlocked when this global variable is true (if set)",
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.StringConfigType<CustomMapIcon>("Required Variable", "map_icon_reqvar", delegate(CustomMapIcon item, Architect.Workshop.Types.StringConfigValue<CustomMapIcon> value)
			{
				item.ReqVar = value.GetValue();
			})),
			ConfigurationManager.RegisterConfigType(new Architect.Workshop.Types.C