Decompiled source of FindStuff v1.1.0

FindStuff/FindStuff.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Colossal.Collections;
using Colossal.Entities;
using Colossal.IO.AssetDatabase;
using Colossal.Localization;
using Colossal.Mathematics;
using Colossal.Serialization.Entities;
using FindStuff.Configuration;
using FindStuff.Helper;
using FindStuff.Indexing;
using FindStuff.Patches;
using FindStuff.Prefabs;
using FindStuff.Systems;
using FindStuff.UI;
using Game;
using Game.Buildings;
using Game.Citizens;
using Game.City;
using Game.Common;
using Game.Companies;
using Game.Economy;
using Game.Net;
using Game.Notifications;
using Game.Objects;
using Game.Prefabs;
using Game.Rendering;
using Game.SceneFlow;
using Game.Settings;
using Game.Simulation;
using Game.Tools;
using Game.UI;
using Game.UI.InGame;
using Game.UI.Localization;
using Game.UI.Widgets;
using Game.Vehicles;
using Game.Zones;
using Gooee;
using Gooee.Plugins;
using Gooee.Plugins.Attributes;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Burst;
using Unity.Burst.Intrinsics;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Scripting;
using cohtml.Net;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FindStuff")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+5a6478dd887898ac99440f492d913ffab0fc47ac")]
[assembly: AssemblyProduct("FindStuff")]
[assembly: AssemblyTitle("FindStuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Game.Buildings
{
	public class CustomZoneCheckSystem : GameSystemBase
	{
		[BurstCompile]
		private struct FindSpawnableBuildingsJob : IJobParallelForDefer
		{
			private struct Iterator : INativeQuadTreeIterator<Entity, QuadTreeBoundsXZ>, IUnsafeQuadTreeIterator<Entity, QuadTreeBoundsXZ>
			{
				public Bounds2 m_Bounds;

				public ParallelWriter<Entity> m_ResultQueue;

				public ComponentLookup<Building> m_BuildingData;

				public ComponentLookup<PrefabRef> m_PrefabRefData;

				public ComponentLookup<SpawnableBuildingData> m_PrefabSpawnableBuildingData;

				public ComponentLookup<SignatureBuildingData> m_PrefabSignatureBuildingData;

				public ComponentLookup<PloppableBuildingData> m_PloppableBuildingData;

				public bool Intersect(QuadTreeBoundsXZ bounds)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					return MathUtils.Intersect(((Bounds3)(ref bounds.m_Bounds)).xz, m_Bounds);
				}

				public void Iterate(QuadTreeBoundsXZ bounds, Entity objectEntity)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_0035: 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_004f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0050: 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_0070: Unknown result type (might be due to invalid IL or missing references)
					if (MathUtils.Intersect(((Bounds3)(ref bounds.m_Bounds)).xz, m_Bounds) && m_BuildingData.HasComponent(objectEntity))
					{
						PrefabRef val = m_PrefabRefData[objectEntity];
						if (m_PrefabSpawnableBuildingData.HasComponent(val.m_Prefab) && !m_PrefabSignatureBuildingData.HasComponent(val.m_Prefab) && !m_PloppableBuildingData.HasComponent(objectEntity))
						{
							m_ResultQueue.Enqueue(objectEntity);
						}
					}
				}
			}

			[ReadOnly]
			public NativeArray<Bounds2> m_Bounds;

			[ReadOnly]
			public NativeQuadTree<Entity, QuadTreeBoundsXZ> m_SearchTree;

			[ReadOnly]
			public ComponentLookup<Building> m_BuildingData;

			[ReadOnly]
			public ComponentLookup<PrefabRef> m_PrefabRefData;

			[ReadOnly]
			public ComponentLookup<SpawnableBuildingData> m_PrefabSpawnableBuildingData;

			[ReadOnly]
			public ComponentLookup<SignatureBuildingData> m_PrefabSignatureBuildingData;

			[ReadOnly]
			public ComponentLookup<PloppableBuildingData> m_PloppableBuildingData;

			public ParallelWriter<Entity> m_ResultQueue;

			public void Execute(int index)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: 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_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: 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)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				Iterator iterator = default(Iterator);
				iterator.m_Bounds = m_Bounds[index];
				iterator.m_ResultQueue = m_ResultQueue;
				iterator.m_BuildingData = m_BuildingData;
				iterator.m_PrefabRefData = m_PrefabRefData;
				iterator.m_PrefabSpawnableBuildingData = m_PrefabSpawnableBuildingData;
				iterator.m_PrefabSignatureBuildingData = m_PrefabSignatureBuildingData;
				iterator.m_PloppableBuildingData = m_PloppableBuildingData;
				Iterator iterator2 = iterator;
				m_SearchTree.Iterate<Iterator>(ref iterator2, 0);
			}
		}

		[BurstCompile]
		private struct CollectEntitiesJob : IJob
		{
			[StructLayout(LayoutKind.Sequential, Size = 1)]
			private struct EntityComparer : IComparer<Entity>
			{
				public int Compare(Entity x, Entity y)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return x.Index - y.Index;
				}
			}

			public NativeQueue<Entity> m_Queue;

			public NativeList<Entity> m_List;

			public void Execute()
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: 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_0093: 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)
				int count = m_Queue.Count;
				if (count == 0)
				{
					return;
				}
				m_List.ResizeUninitialized(count);
				for (int i = 0; i < count; i++)
				{
					m_List[i] = m_Queue.Dequeue();
				}
				NativeSortExtension.Sort<Entity, EntityComparer>(m_List, default(EntityComparer));
				Entity val = Entity.Null;
				int num = 0;
				int num2 = 0;
				while (num < m_List.Length)
				{
					Entity val2 = m_List[num++];
					if (val2 != val)
					{
						m_List[num2++] = val2;
						val = val2;
					}
				}
				if (num2 < m_List.Length)
				{
					m_List.RemoveRangeSwapBack(num2, m_List.Length - num2);
				}
			}
		}

		[BurstCompile]
		private struct CheckBuildingZonesJob : IJobParallelForDefer
		{
			private struct Iterator : INativeQuadTreeIterator<Entity, Bounds2>, IUnsafeQuadTreeIterator<Entity, Bounds2>
			{
				public Bounds2 m_Bounds;

				public int2 m_LotSize;

				public float2 m_StartPosition;

				public float2 m_Right;

				public float2 m_Forward;

				public ZoneType m_ZoneType;

				public CellFlags m_Directions;

				public NativeArray<bool> m_Validated;

				public ComponentLookup<Block> m_BlockData;

				public ComponentLookup<ValidArea> m_ValidAreaData;

				public BufferLookup<Cell> m_Cells;

				public bool Intersect(Bounds2 bounds)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					return MathUtils.Intersect(bounds, m_Bounds);
				}

				public void Iterate(Bounds2 bounds, Entity blockEntity)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0027: 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_0037: Unknown result type (might be due to invalid IL or missing references)
					//IL_0040: Unknown result type (might be due to invalid IL or missing references)
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0053: Unknown result type (might be due to invalid IL or missing references)
					//IL_0054: Unknown result type (might be due to invalid IL or missing references)
					//IL_0059: 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_0061: Unknown result type (might be due to invalid IL or missing references)
					//IL_0066: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_006d: Unknown result type (might be due to invalid IL or missing references)
					//IL_020a: Unknown result type (might be due to invalid IL or missing references)
					//IL_007c: Unknown result type (might be due to invalid IL or missing references)
					//IL_007e: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d8: 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_008e: 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_0097: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ef: 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_01fc: Unknown result type (might be due to invalid IL or missing references)
					//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
					//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
					//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d3: 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_00df: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
					//IL_010a: Unknown result type (might be due to invalid IL or missing references)
					//IL_011f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0132: Unknown result type (might be due to invalid IL or missing references)
					//IL_0140: Unknown result type (might be due to invalid IL or missing references)
					//IL_0142: Unknown result type (might be due to invalid IL or missing references)
					//IL_014c: Unknown result type (might be due to invalid IL or missing references)
					//IL_014f: 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_0151: Unknown result type (might be due to invalid IL or missing references)
					//IL_0153: Unknown result type (might be due to invalid IL or missing references)
					//IL_0158: Unknown result type (might be due to invalid IL or missing references)
					//IL_015d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0177: Unknown result type (might be due to invalid IL or missing references)
					//IL_017c: Unknown result type (might be due to invalid IL or missing references)
					//IL_017e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0181: Unknown result type (might be due to invalid IL or missing references)
					//IL_0186: Unknown result type (might be due to invalid IL or missing references)
					//IL_0189: Unknown result type (might be due to invalid IL or missing references)
					//IL_018f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0194: Unknown result type (might be due to invalid IL or missing references)
					//IL_0199: Unknown result type (might be due to invalid IL or missing references)
					//IL_019e: Unknown result type (might be due to invalid IL or missing references)
					//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
					//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
					if (!MathUtils.Intersect(bounds, m_Bounds))
					{
						return;
					}
					ValidArea val = m_ValidAreaData[blockEntity];
					if (val.m_Area.y <= val.m_Area.x)
					{
						return;
					}
					Block val2 = default(Block);
					val2.m_Direction = m_Forward;
					Block val3 = val2;
					Block val4 = m_BlockData[blockEntity];
					DynamicBuffer<Cell> val5 = m_Cells[blockEntity];
					float2 val6 = m_StartPosition;
					int2 val7 = default(int2);
					val7.y = 0;
					int4 val10 = default(int4);
					while (val7.y < m_LotSize.y)
					{
						float2 val8 = val6;
						val7.x = 0;
						while (val7.x < m_LotSize.x)
						{
							int2 cellIndex = ZoneUtils.GetCellIndex(val4, val8);
							if (math.all((cellIndex >= ((int4)(ref val.m_Area)).xz) & (cellIndex < ((int4)(ref val.m_Area)).yw)))
							{
								int num = cellIndex.y * val4.m_Size.x + cellIndex.x;
								Cell val9 = val5[num];
								if ((val9.m_State & 8) != 0 && ((ZoneType)(ref val9.m_Zone)).Equals(m_ZoneType))
								{
									m_Validated[val7.y * m_LotSize.x + val7.x] = true;
									if ((val9.m_State & 0xE04) != 0)
									{
										CellFlags roadDirection = ZoneUtils.GetRoadDirection(val3, val4, val9.m_State);
										((int4)(ref val10))..ctor(512, 4, 1024, 2048);
										val10 = math.select(int4.op_Implicit(0), val10, new bool4(val7 == 0, val7 == m_LotSize - 1));
										m_Directions = (CellFlags)(m_Directions | (roadDirection & (ushort)math.csum(val10)));
									}
								}
							}
							val8 -= m_Right;
							val7.x++;
						}
						val6 -= m_Forward;
						val7.y++;
					}
				}
			}

			[ReadOnly]
			public ComponentLookup<Condemned> m_CondemnedData;

			[ReadOnly]
			public ComponentLookup<Block> m_BlockData;

			[ReadOnly]
			public ComponentLookup<ValidArea> m_ValidAreaData;

			[ReadOnly]
			public ComponentLookup<Destroyed> m_DestroyedData;

			[ReadOnly]
			public ComponentLookup<Abandoned> m_AbandonedData;

			[ReadOnly]
			public ComponentLookup<Transform> m_TransformData;

			[ReadOnly]
			public ComponentLookup<Attached> m_AttachedData;

			[ReadOnly]
			public ComponentLookup<PrefabRef> m_PrefabRefData;

			[ReadOnly]
			public ComponentLookup<BuildingData> m_PrefabBuildingData;

			[ReadOnly]
			public ComponentLookup<SpawnableBuildingData> m_PrefabSpawnableBuildingData;

			[ReadOnly]
			public ComponentLookup<PlaceholderBuildingData> m_PrefabPlaceholderBuildingData;

			[ReadOnly]
			public ComponentLookup<ZoneData> m_PrefabZoneData;

			[ReadOnly]
			public BufferLookup<Cell> m_Cells;

			[ReadOnly]
			public BuildingConfigurationData m_BuildingConfigurationData;

			[ReadOnly]
			public NativeArray<Entity> m_Buildings;

			[ReadOnly]
			public NativeQuadTree<Entity, Bounds2> m_SearchTree;

			[ReadOnly]
			public bool m_EditorMode;

			public IconCommandBuffer m_IconCommandBuffer;

			public ParallelWriter m_CommandBuffer;

			public void Execute(int index)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: 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_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_002b: 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_0033: 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_003d: 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_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: 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_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: 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_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: 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_009f: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				Entity val = m_Buildings[index];
				PrefabRef val2 = m_PrefabRefData[val];
				BuildingData prefabBuildingData = m_PrefabBuildingData[val2.m_Prefab];
				SpawnableBuildingData prefabSpawnableBuildingData = m_PrefabSpawnableBuildingData[val2.m_Prefab];
				bool flag = m_EditorMode;
				if (!flag)
				{
					flag = ValidateAttachedParent(val, prefabSpawnableBuildingData);
				}
				if (!flag)
				{
					flag = ValidateZoneBlocks(val, prefabBuildingData, prefabSpawnableBuildingData);
				}
				if (flag)
				{
					if (m_CondemnedData.HasComponent(val))
					{
						((ParallelWriter)(ref m_CommandBuffer)).RemoveComponent<Condemned>(index, val);
						((IconCommandBuffer)(ref m_IconCommandBuffer)).Remove(val, m_BuildingConfigurationData.m_CondemnedNotification, default(Entity), (IconFlags)0);
					}
				}
				else if (!m_CondemnedData.HasComponent(val))
				{
					((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Condemned>(index, val, default(Condemned));
					if (!m_DestroyedData.HasComponent(val) && !m_AbandonedData.HasComponent(val))
					{
						((IconCommandBuffer)(ref m_IconCommandBuffer)).Add(val, m_BuildingConfigurationData.m_CondemnedNotification, (IconPriority)250, (IconClusterLayer)0, (IconFlags)0, default(Entity), false, false, false, 0f);
					}
				}
			}

			private bool ValidateAttachedParent(Entity building, SpawnableBuildingData prefabSpawnableBuildingData)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: 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)
				//IL_0059: 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_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				if (m_AttachedData.HasComponent(building))
				{
					Attached val = m_AttachedData[building];
					if (m_PrefabRefData.HasComponent(val.m_Parent))
					{
						PrefabRef val2 = m_PrefabRefData[val.m_Parent];
						if (m_PrefabPlaceholderBuildingData.HasComponent(val2.m_Prefab) && m_PrefabPlaceholderBuildingData[val2.m_Prefab].m_ZonePrefab == prefabSpawnableBuildingData.m_ZonePrefab)
						{
							return true;
						}
					}
				}
				return false;
			}

			private bool ValidateZoneBlocks(Entity building, BuildingData prefabBuildingData, SpawnableBuildingData prefabSpawnableBuildingData)
			{
				//IL_0006: 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_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: 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_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//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_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: 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_008d: 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)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: 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_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				//IL_015d: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: 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_0174: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: 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_0192: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Invalid comparison between Unknown and I4
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				Transform val = m_TransformData[building];
				ZoneData val2 = default(ZoneData);
				if (m_PrefabZoneData.HasComponent(prefabSpawnableBuildingData.m_ZonePrefab))
				{
					val2 = m_PrefabZoneData[prefabSpawnableBuildingData.m_ZonePrefab];
				}
				float3 val3 = math.rotate(val.m_Rotation, new float3(8f, 0f, 0f));
				float2 xz = ((float3)(ref val3)).xz;
				val3 = math.rotate(val.m_Rotation, new float3(0f, 0f, 8f));
				float2 xz2 = ((float3)(ref val3)).xz;
				float2 val4 = xz * ((float)prefabBuildingData.m_LotSize.x * 0.5f - 0.5f);
				float2 val5 = xz2 * ((float)prefabBuildingData.m_LotSize.y * 0.5f - 0.5f);
				float2 val6 = math.abs(val5) + math.abs(val4);
				NativeArray<bool> validated = default(NativeArray<bool>);
				validated..ctor(prefabBuildingData.m_LotSize.x * prefabBuildingData.m_LotSize.y, (Allocator)2, (NativeArrayOptions)1);
				Iterator iterator = default(Iterator);
				iterator.m_Bounds = new Bounds2(((float3)(ref val.m_Position)).xz - val6, ((float3)(ref val.m_Position)).xz + val6);
				iterator.m_LotSize = prefabBuildingData.m_LotSize;
				iterator.m_StartPosition = ((float3)(ref val.m_Position)).xz + val5 + val4;
				iterator.m_Right = xz;
				iterator.m_Forward = xz2;
				iterator.m_ZoneType = val2.m_ZoneType;
				iterator.m_Validated = validated;
				iterator.m_BlockData = m_BlockData;
				iterator.m_ValidAreaData = m_ValidAreaData;
				iterator.m_Cells = m_Cells;
				Iterator iterator2 = iterator;
				m_SearchTree.Iterate<Iterator>(ref iterator2, 0);
				bool flag = (iterator2.m_Directions & 4) > 0;
				for (int i = 0; i < validated.Length; i++)
				{
					flag &= validated[i];
				}
				validated.Dispose();
				return flag;
			}
		}

		private struct TypeHandle
		{
			[ReadOnly]
			public ComponentLookup<Building> __Game_Buildings_Building_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<PrefabRef> __Game_Prefabs_PrefabRef_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<SpawnableBuildingData> __Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<SignatureBuildingData> __Game_Prefabs_SignatureBuildingData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Condemned> __Game_Buildings_Condemned_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Block> __Game_Zones_Block_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<ValidArea> __Game_Zones_ValidArea_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Destroyed> __Game_Common_Destroyed_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Abandoned> __Game_Buildings_Abandoned_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Transform> __Game_Objects_Transform_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Attached> __Game_Objects_Attached_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<BuildingData> __Game_Prefabs_BuildingData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<PlaceholderBuildingData> __Game_Prefabs_PlaceholderBuildingData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<PloppableBuildingData> __Game_Prefabs_PloppableBuildingData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<ZoneData> __Game_Prefabs_ZoneData_RO_ComponentLookup;

			[ReadOnly]
			public BufferLookup<Cell> __Game_Zones_Cell_RO_BufferLookup;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: 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_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: 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_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: 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_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: 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_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				__Game_Buildings_Building_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Building>(true);
				__Game_Prefabs_PrefabRef_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<PrefabRef>(true);
				__Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<SpawnableBuildingData>(true);
				__Game_Prefabs_SignatureBuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<SignatureBuildingData>(true);
				__Game_Buildings_Condemned_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Condemned>(true);
				__Game_Zones_Block_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Block>(true);
				__Game_Zones_ValidArea_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ValidArea>(true);
				__Game_Common_Destroyed_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Destroyed>(true);
				__Game_Buildings_Abandoned_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Abandoned>(true);
				__Game_Objects_Transform_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Transform>(true);
				__Game_Objects_Attached_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Attached>(true);
				__Game_Prefabs_BuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<BuildingData>(true);
				__Game_Prefabs_PlaceholderBuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<PlaceholderBuildingData>(true);
				__Game_Prefabs_PloppableBuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<PloppableBuildingData>(true);
				__Game_Prefabs_ZoneData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ZoneData>(true);
				__Game_Zones_Cell_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<Cell>(true);
			}
		}

		private UpdateCollectSystem m_ZoneUpdateCollectSystem;

		private SearchSystem m_ZoneSearchSystem;

		private ModificationEndBarrier m_ModificationEndBarrier;

		private SearchSystem m_ObjectSearchSystem;

		private ToolSystem m_ToolSystem;

		private IconCommandSystem m_IconCommandSystem;

		private EntityQuery m_BuildingSettingsQuery;

		private TypeHandle __TypeHandle;

		[Preserve]
		protected override void OnCreate()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnCreate();
			m_ZoneUpdateCollectSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<UpdateCollectSystem>();
			m_ZoneSearchSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<SearchSystem>();
			m_ModificationEndBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ModificationEndBarrier>();
			m_ObjectSearchSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<SearchSystem>();
			m_ToolSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolSystem>();
			m_IconCommandSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<IconCommandSystem>();
			m_BuildingSettingsQuery = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<BuildingConfigurationData>() });
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			if (m_ZoneUpdateCollectSystem.isUpdated && !((EntityQuery)(ref m_BuildingSettingsQuery)).IsEmptyIgnoreFilter)
			{
				NativeQueue<Entity> queue = default(NativeQueue<Entity>);
				queue..ctor(AllocatorHandle.op_Implicit((Allocator)3));
				NativeList<Entity> val = default(NativeList<Entity>);
				val..ctor(AllocatorHandle.op_Implicit((Allocator)3));
				JobHandle val2 = default(JobHandle);
				NativeList<Bounds2> updatedBounds = m_ZoneUpdateCollectSystem.GetUpdatedBounds(true, ref val2);
				__TypeHandle.__Game_Prefabs_SignatureBuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Buildings_Building_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				FindSpawnableBuildingsJob findSpawnableBuildingsJob = default(FindSpawnableBuildingsJob);
				findSpawnableBuildingsJob.m_Bounds = updatedBounds.AsDeferredJobArray();
				JobHandle val3 = default(JobHandle);
				findSpawnableBuildingsJob.m_SearchTree = m_ObjectSearchSystem.GetStaticSearchTree(true, ref val3);
				findSpawnableBuildingsJob.m_BuildingData = __TypeHandle.__Game_Buildings_Building_RO_ComponentLookup;
				findSpawnableBuildingsJob.m_PrefabRefData = __TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentLookup;
				findSpawnableBuildingsJob.m_PrefabSpawnableBuildingData = __TypeHandle.__Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup;
				findSpawnableBuildingsJob.m_PrefabSignatureBuildingData = __TypeHandle.__Game_Prefabs_SignatureBuildingData_RO_ComponentLookup;
				findSpawnableBuildingsJob.m_PloppableBuildingData = __TypeHandle.__Game_Prefabs_PloppableBuildingData_RO_ComponentLookup;
				findSpawnableBuildingsJob.m_ResultQueue = queue.AsParallelWriter();
				FindSpawnableBuildingsJob findSpawnableBuildingsJob2 = findSpawnableBuildingsJob;
				CollectEntitiesJob collectEntitiesJob = default(CollectEntitiesJob);
				collectEntitiesJob.m_Queue = queue;
				collectEntitiesJob.m_List = val;
				CollectEntitiesJob collectEntitiesJob2 = collectEntitiesJob;
				__TypeHandle.__Game_Zones_Cell_RO_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Prefabs_ZoneData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Prefabs_PlaceholderBuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Prefabs_BuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Objects_Attached_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Objects_Transform_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Buildings_Abandoned_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Common_Destroyed_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Zones_ValidArea_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Zones_Block_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				__TypeHandle.__Game_Buildings_Condemned_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
				CheckBuildingZonesJob checkBuildingZonesJob = default(CheckBuildingZonesJob);
				checkBuildingZonesJob.m_CondemnedData = __TypeHandle.__Game_Buildings_Condemned_RO_ComponentLookup;
				checkBuildingZonesJob.m_BlockData = __TypeHandle.__Game_Zones_Block_RO_ComponentLookup;
				checkBuildingZonesJob.m_ValidAreaData = __TypeHandle.__Game_Zones_ValidArea_RO_ComponentLookup;
				checkBuildingZonesJob.m_DestroyedData = __TypeHandle.__Game_Common_Destroyed_RO_ComponentLookup;
				checkBuildingZonesJob.m_AbandonedData = __TypeHandle.__Game_Buildings_Abandoned_RO_ComponentLookup;
				checkBuildingZonesJob.m_TransformData = __TypeHandle.__Game_Objects_Transform_RO_ComponentLookup;
				checkBuildingZonesJob.m_AttachedData = __TypeHandle.__Game_Objects_Attached_RO_ComponentLookup;
				checkBuildingZonesJob.m_PrefabRefData = __TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentLookup;
				checkBuildingZonesJob.m_PrefabBuildingData = __TypeHandle.__Game_Prefabs_BuildingData_RO_ComponentLookup;
				checkBuildingZonesJob.m_PrefabSpawnableBuildingData = __TypeHandle.__Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup;
				checkBuildingZonesJob.m_PrefabPlaceholderBuildingData = __TypeHandle.__Game_Prefabs_PlaceholderBuildingData_RO_ComponentLookup;
				checkBuildingZonesJob.m_PrefabZoneData = __TypeHandle.__Game_Prefabs_ZoneData_RO_ComponentLookup;
				checkBuildingZonesJob.m_Cells = __TypeHandle.__Game_Zones_Cell_RO_BufferLookup;
				checkBuildingZonesJob.m_BuildingConfigurationData = ((EntityQuery)(ref m_BuildingSettingsQuery)).GetSingleton<BuildingConfigurationData>();
				checkBuildingZonesJob.m_Buildings = val.AsDeferredJobArray();
				JobHandle val4 = default(JobHandle);
				checkBuildingZonesJob.m_SearchTree = m_ZoneSearchSystem.GetSearchTree(true, ref val4);
				checkBuildingZonesJob.m_EditorMode = GameModeExtensions.IsEditor(m_ToolSystem.actionMode);
				checkBuildingZonesJob.m_IconCommandBuffer = m_IconCommandSystem.CreateCommandBuffer();
				EntityCommandBuffer val5 = ((SafeCommandBufferSystem)m_ModificationEndBarrier).CreateCommandBuffer();
				checkBuildingZonesJob.m_CommandBuffer = ((EntityCommandBuffer)(ref val5)).AsParallelWriter();
				CheckBuildingZonesJob checkBuildingZonesJob2 = checkBuildingZonesJob;
				JobHandle val6 = IJobParallelForDeferExtensions.Schedule<FindSpawnableBuildingsJob, Bounds2>(findSpawnableBuildingsJob2, updatedBounds, 1, JobHandle.CombineDependencies(((SystemBase)this).Dependency, val2, val3));
				JobHandle val7 = IJobExtensions.Schedule<CollectEntitiesJob>(collectEntitiesJob2, val6);
				JobHandle val8 = IJobParallelForDeferExtensions.Schedule<CheckBuildingZonesJob, Entity>(checkBuildingZonesJob2, val, 1, JobHandle.CombineDependencies(val7, val4));
				queue.Dispose(val7);
				val.Dispose(val8);
				m_ZoneUpdateCollectSystem.AddBoundsReader(val6);
				m_ObjectSearchSystem.AddStaticSearchTreeReader(val6);
				m_ZoneSearchSystem.AddSearchTreeReader(val8);
				m_IconCommandSystem.AddCommandBufferWriter(val8);
				((EntityCommandBufferSystem)m_ModificationEndBarrier).AddJobHandleForProducer(val8);
				((SystemBase)this).Dependency = val8;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
		}

		protected override void OnCreateForCompiler()
		{
			((ComponentSystemBase)this).OnCreateForCompiler();
			__AssignQueries(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__AssignHandles(ref ((SystemBase)this).CheckedStateRef);
		}

		[Preserve]
		public CustomZoneCheckSystem()
		{
		}
	}
}
namespace FindStuff
{
	[BepInPlugin("FindStuff", "FindStuff", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Type customPropertyRenterSystemType = null;

		public static Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			Harmony val = new Harmony("FindStuff_Cities2Harmony");
			if (HasLandValueOverhaul())
			{
				Debug.Log((object)"LandValueOverhaul found. Patch CustomPropertyRenterSystem instead.");
				MethodInfo? method = customPropertyRenterSystemType.GetMethod("OnCreate", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
				HarmonyMethod val2 = new HarmonyMethod(typeof(CustomPropertyRenterSystemPatch).GetMethod("Postfix"));
				val2.after = new string[1] { "LandValueOverhaul_Cities2Harmony" };
				val.Patch((MethodBase)method, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			else
			{
				Debug.Log((object)"LandValueOverhaul not found. Patch original PropertyRenterSystem.");
				val.Patch((MethodBase)typeof(PropertyRenterSystem).GetMethod("OnCreate", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy), (HarmonyMethod)null, new HarmonyMethod(typeof(PropertyRenterSystemPatch).GetMethod("Postfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			val.Patch((MethodBase)typeof(SystemOrder).GetMethod("Initialize"), (HarmonyMethod)null, new HarmonyMethod(typeof(SystemOrderPatches).GetMethod("Postfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)typeof(ZoneCheckSystem).GetMethod("OnCreate", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy), (HarmonyMethod)null, new HarmonyMethod(typeof(ZoneCheckSystem_Patches).GetMethod("Postfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			MethodBase[] array = val.GetPatchedMethods().ToArray();
			((BaseUnityPlugin)this).Logger.LogInfo((object)(Environment.NewLine + " +-+-+-+-+ +-+-+-+-+-+\r\n |F|i|n|d| |S|t|u|f|f|\r\n +-+-+-+-+ +-+-+-+-+-+"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin FindStuff is loaded! Patched methods: " + array.Length));
			MethodBase[] array2 = array;
			foreach (MethodBase methodBase in array2)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched method: " + methodBase.Module.Name + ":" + methodBase.Name));
			}
		}

		public static bool HasLandValueOverhaul()
		{
			Assembly assembly = assemblies.FirstOrDefault((Assembly a) => a.GetName().Name == "LandValueOverhaul");
			if (assembly != null)
			{
				customPropertyRenterSystemType = assembly.GetTypes().FirstOrDefault((Type a) => a.Name == "CustomPropertyRenterSystem");
				return true;
			}
			return false;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "FindStuff";

		public const string PLUGIN_NAME = "FindStuff";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace FindStuff.UI
{
	[ControllerDepends(/*Could not decode attribute arguments.*/)]
	public class FindStuffController : Controller<FindStuffViewModel>
	{
		private ToolSystem _toolSystem;

		private ToolRaycastSystem _toolRaycastSystem;

		private DefaultToolSystem _defaulToolSystem;

		private PickerToolSystem _pickerToolSystem;

		private PrefabSystem _prefabSystem;

		private ImageSystem _imageSystem;

		private ToolbarUISystem _toolbarUISystem;

		private PloppableRICOSystem _ploppableRICOSystem;

		private InputAction _enableAction;

		private TerrainSystem _terrainSystem;

		private static FieldInfo _prefabsField = typeof(PrefabSystem).GetField("m_Prefabs", BindingFlags.Instance | BindingFlags.NonPublic);

		private Dictionary<string, PrefabBase> _prefabInstances = new Dictionary<string, PrefabBase>();

		private EntityArchetype _entityArchetype;

		private EndFrameBarrier _endFrameBarrier;

		private static MethodInfo _selectAsset = typeof(ToolbarUISystem).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "SelectAsset" && m.GetParameters().Length == 1);

		public static readonly FindStuffConfig _config = ConfigBase.Load<FindStuffConfig>();

		private IBaseHelper[] _baseHelper;

		private PrefabIndexer _indexer;

		private LocalizationManager _localizationManager;

		private static HashSet<string> TypesWithNoThumbnails = new HashSet<string> { "Surface", "PropMisc", "Billboards", "Fences", "SignsAndPosters", "Accessory" };

		private static HashSet<string> ModdedComponents = new HashSet<string> { "CustomSurface", "CustomDecal", "CustomSurfaceComponent" };

		private float _lastSearchTime;

		private string _lastSearch;

		private string _lastQueryKey = "";

		private Queue<(string Key, string Json)> _queryResults = new Queue<(string, string)>();

		private FindStuffSettings _modSettings;

		private static bool created = false;

		private static PrefabBase createPrefab;

		private static readonly HashSet<string> GetEvilPrefabs = new HashSet<string> { "lane editor container", "traffic spawner", "NA_DeliveryVan01", "EU_DeliveryVan01", "MotorbikeDelivery01" };

		private bool IsPickingShortcut { get; set; }

		public bool IsPicking => base.Model.IsPicking;

		public bool EnableShortcut => base.Model.EnableShortcut;

		public bool IsHistorical => base.Model.IsHistorical;

		public override FindStuffViewModel Configure()
		{
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			_modSettings = (FindStuffSettings)(object)base.Settings;
			SetupResourceHandler();
			_toolSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolSystem>();
			_toolRaycastSystem = ((ComponentSystemBase)this).World.GetExistingSystemManaged<ToolRaycastSystem>();
			_defaulToolSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<DefaultToolSystem>();
			_prefabSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<PrefabSystem>();
			_imageSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ImageSystem>();
			_endFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>();
			_toolbarUISystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolbarUISystem>();
			_pickerToolSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<PickerToolSystem>();
			_ploppableRICOSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<PloppableRICOSystem>();
			_terrainSystem = ((ComponentSystemBase)this).World.GetExistingSystemManaged<TerrainSystem>();
			_localizationManager = GameManager.instance.localizationManager;
			EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
			_entityArchetype = ((EntityManager)(ref entityManager)).CreateArchetype((ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadWrite<Unlock>(),
				ComponentType.ReadWrite<Event>()
			});
			FindStuffViewModel obj = new FindStuffViewModel
			{
				Favourites = _config.Favourites.ToList(),
				ViewMode = _config.ViewMode,
				Filter = _config.Filter,
				SubFilter = _config.SubFilter,
				OrderByAscending = _config.OrderByAscending,
				EnableShortcut = _config.EnableShortcut,
				ExpertMode = _config.ExpertMode,
				IsHistorical = _config.IsHistorical,
				OperationMode = Enum.Parse<ViewOperationMode>(_modSettings.OperationMode)
			};
			if (_config.RecentSearches == null)
			{
				_config.RecentSearches = new Dictionary<string, ushort>();
			}
			obj.RecentSearches = (from s in _config.RecentSearches
				orderby s.Value descending
				select s.Key).ToHashSet();
			return obj;
		}

		private bool CheckForModdedComponents(Entity entity)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
			List<string> list = ((IEnumerable<ComponentType>)(object)((EntityManager)(ref entityManager)).GetComponentTypes(entity, (Allocator)2)).Select((ComponentType ct) => ((ComponentType)(ref ct)).GetManagedType().FullName).ToList();
			if (list != null && list.Count > 0)
			{
				foreach (string moddedComponent in ModdedComponents)
				{
					if (list.Count((string c) => c.ToLowerInvariant().EndsWith(moddedComponent.ToLowerInvariant())) > 0)
					{
						return true;
					}
				}
			}
			return false;
		}

		protected override void OnGameLoadingComplete(Purpose purpose, GameMode mode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, 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_0089: 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)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: 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)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnGameLoadingComplete(purpose, mode);
			if ((int)mode != 2)
			{
				return;
			}
			if ((base.Plugin as FindStuffPlugin).Settings is FindStuffSettings modSettings)
			{
				_modSettings = modSettings;
			}
			UpdateFromSettings();
			if (_enableAction != null)
			{
				_enableAction.Disable();
				_enableAction.Dispose();
			}
			_enableAction = new InputAction("FindStuff_Toggle", (InputActionType)0, (string)null, (string)null, (string)null, (string)null);
			CompositeSyntax val = InputActionSetupExtensions.AddCompositeBinding(_enableAction, "ButtonWithOneModifier", (string)null, (string)null);
			val = ((CompositeSyntax)(ref val)).With("Modifier", "<Keyboard>/CTRL", (string)null, (string)null);
			((CompositeSyntax)(ref val)).With("Button", "<Keyboard>/f", (string)null, (string)null);
			_enableAction.performed += delegate
			{
				OnToggleVisible();
			};
			_enableAction.Enable();
			_enableAction = new InputAction("FindStuff_Escape", (InputActionType)0, (string)null, (string)null, (string)null, (string)null);
			InputActionSetupExtensions.AddBinding(_enableAction, "<Keyboard>/escape", (string)null, (string)null, (string)null);
			_enableAction.performed += delegate
			{
				OnEscapePressed();
			};
			_enableAction.Enable();
			List<PrefabBase> list = (List<PrefabBase>)_prefabsField.GetValue(_prefabSystem);
			Debug.Log((object)$"Getting {list.Count} prefabs");
			List<PrefabItem> list2 = new List<PrefabItem>();
			_baseHelper = new IBaseHelper[12]
			{
				new PlantHelper(((ComponentSystemBase)this).EntityManager),
				new TreeHelper(((ComponentSystemBase)this).EntityManager),
				new SurfaceHelper(((ComponentSystemBase)this).EntityManager),
				new AreaHelper(((ComponentSystemBase)this).EntityManager),
				new CityServiceHelper(((ComponentSystemBase)this).EntityManager),
				new TransportStopHelper(((ComponentSystemBase)this).EntityManager),
				new NetworkHelper(((ComponentSystemBase)this).EntityManager),
				new SignatureBuildingHelper(((ComponentSystemBase)this).EntityManager),
				new BuildingHelper(((ComponentSystemBase)this).EntityManager),
				new VehicleHelper(((ComponentSystemBase)this).EntityManager),
				new ZoneBuildingHelper(((ComponentSystemBase)this).EntityManager, _prefabSystem),
				new PropHelper(((ComponentSystemBase)this).EntityManager)
			};
			foreach (PrefabBase item2 in list)
			{
				if (!GetEvilPrefabs.Contains(((Object)item2).name.ToLower()) && ProcessPrefab(item2, out var prefabType, out var categoryType, out var tags, out var meta, out var thumbnailOverride, out var isExpertMode))
				{
					string text = "";
					Entity entity = _prefabSystem.GetEntity(item2);
					string thumbnail = _imageSystem.GetThumbnail(entity);
					string typeIcon = GetTypeIcon(prefabType, item2, entity);
					text = ((thumbnail != null && !(thumbnail == _imageSystem.placeholderIcon)) ? thumbnail : typeIcon);
					PrefabItem item = new PrefabItem
					{
						ID = entity.Index,
						Name = ((Object)item2).name,
						IsModded = CheckForModdedComponents(entity),
						Type = prefabType,
						Category = categoryType,
						Thumbnail = ((!string.IsNullOrEmpty(thumbnailOverride)) ? thumbnailOverride : ((categoryType == "Zones") ? CheckForZoneIcon(item2, entity) : (TypesWithNoThumbnails.Contains(prefabType) ? typeIcon : text))),
						TypeIcon = typeIcon,
						Meta = meta,
						Tags = tags,
						IsExpertMode = isExpertMode
					};
					list2.Add(item);
					if (_prefabInstances.ContainsKey(((Object)item2).name))
					{
						_prefabInstances.Remove(((Object)item2).name);
					}
					_prefabInstances.Add(((Object)item2).name, item2);
				}
			}
			_indexer = PrefabIndexer._instance;
			_indexer.Build(list2);
			base.Model.Prefabs = list2;
			base.TriggerUpdate();
		}

		private string CheckForZoneIcon(PrefabBase prefabBase, Entity entity)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new ZoneBuildingHelper(((ComponentSystemBase)this).EntityManager, _prefabSystem).GetZoneTypeIcon(prefabBase, entity);
		}

		protected override void OnDestroy()
		{
			((UISystemBase)this).OnDestroy();
			InputAction enableAction = _enableAction;
			if (enableAction != null)
			{
				enableAction.Disable();
			}
			InputAction enableAction2 = _enableAction;
			if (enableAction2 != null)
			{
				enableAction2.Dispose();
			}
		}

		private bool ProcessPrefab(PrefabBase prefab, out string prefabType, out string categoryType, out List<string> tags, out Dictionary<string, object> meta, out string thumbnailOverride, out bool isExpertMode)
		{
			//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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			thumbnailOverride = null;
			tags = new List<string>();
			meta = new Dictionary<string, object>();
			Entity entity = _prefabSystem.GetEntity(prefab);
			bool result = false;
			prefabType = "Unknown";
			categoryType = "None";
			isExpertMode = false;
			IBaseHelper[] baseHelper = _baseHelper;
			foreach (IBaseHelper baseHelper2 in baseHelper)
			{
				if (baseHelper2.IsValidPrefab(prefab, entity))
				{
					result = true;
					tags = baseHelper2.CreateTags(prefab, entity);
					meta = baseHelper2.CreateMeta(prefab, entity);
					prefabType = baseHelper2.PrefabType;
					categoryType = baseHelper2.CategoryType;
					isExpertMode = baseHelper2.IsExpertMode(prefab, entity);
					break;
				}
			}
			SurfacePrefab val = (SurfacePrefab)(object)((prefab is SurfacePrefab) ? prefab : null);
			if (val != null)
			{
				EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
				if (((EntityManager)(ref entityManager)).HasComponent<RenderedAreaData>(entity))
				{
					entityManager = ((ComponentSystemBase)this).EntityManager;
					if (((EntityManager)(ref entityManager)).HasComponent<SurfaceData>(entity))
					{
						entityManager = ((ComponentSystemBase)this).EntityManager;
						if (((EntityManager)(ref entityManager)).HasComponent<PrefabData>(entity))
						{
							UIObject component = ((ComponentBase)prefab).GetComponent<UIObject>();
							if ((Object)(object)component != (Object)null)
							{
								string icon = component.m_Icon;
								if (icon != null && icon.ToLowerInvariant().Contains("customsurfaces/"))
								{
									thumbnailOverride = component.m_Icon;
									goto IL_011f;
								}
							}
							thumbnailOverride = SurfaceExporter.ExportSurface(val);
						}
					}
				}
			}
			goto IL_011f;
			IL_011f:
			return result;
		}

		private Entity CreatePrefab(Entity prefabEntity, float3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0046: 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)
			//IL_0048: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
			ObjectData componentData = ((EntityManager)(ref entityManager)).GetComponentData<ObjectData>(prefabEntity);
			entityManager = ((ComponentSystemBase)this).EntityManager;
			Entity val = ((EntityManager)(ref entityManager)).CreateEntity(componentData.m_Archetype);
			Transform transform = default(Transform);
			transform.m_Position = position;
			LevelToGround(ref transform);
			entityManager = ((ComponentSystemBase)this).EntityManager;
			((EntityManager)(ref entityManager)).SetComponentData<PrefabRef>(val, new PrefabRef(prefabEntity));
			entityManager = ((ComponentSystemBase)this).EntityManager;
			((EntityManager)(ref entityManager)).SetComponentData<Transform>(val, transform);
			return val;
		}

		private void LevelToGround(ref Transform transform)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			TerrainHeightData heightData = _terrainSystem.GetHeightData(true);
			transform.m_Position.y = TerrainUtils.SampleHeight(ref heightData, transform.m_Position);
		}

		public void SetupResourceHandler()
		{
			base.MountResources("findstuffui", ConfigBase.MOD_PATH);
		}

		public bool IsValidPrefab(PrefabBase prefabBase, Entity entity)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			IBaseHelper[] baseHelper = _baseHelper;
			for (int i = 0; i < baseHelper.Length; i++)
			{
				if (baseHelper[i].IsValidPrefab(prefabBase, entity))
				{
					return true;
				}
			}
			return false;
		}

		public bool IsValidPrefab(PrefabBase prefabBase, Entity entity, out IBaseHelper prefabHelper)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			prefabHelper = _baseHelper.FirstOrDefault();
			IBaseHelper[] baseHelper = _baseHelper;
			foreach (IBaseHelper baseHelper2 in baseHelper)
			{
				if (baseHelper2.IsValidPrefab(prefabBase, entity))
				{
					prefabHelper = baseHelper2;
					return true;
				}
			}
			return false;
		}

		private string GetTypeIcon(string type, PrefabBase prefabBase, Entity entity)
		{
			switch (type)
			{
			case "Plant":
				return "Media/Game/Icons/Forest.svg";
			case "Tree":
				return "Media/Game/Icons/Forest.svg";
			case "Network":
				return "Media/Game/Icons/Roads.svg";
			case "ServiceBuilding":
				return "Media/Game/Icons/Services.svg";
			case "SignatureBuilding":
				return "Media/Game/Icons/ZoneSignature.svg";
			case "MiscBuilding":
				return "Media/Game/Icons/BuildingLevel.svg";
			case "Zoneable":
				return "Media/Game/Icons/Zones.svg";
			case "ZoneResidential":
				return "Media/Game/Icons/ZoneResidential.svg";
			case "ZoneCommercial":
				return "Media/Game/Icons/ZoneCommercial.svg";
			case "ZoneIndustrial":
				return "Media/Game/Icons/ZoneIndustrial.svg";
			case "ZoneOffice":
				return "Media/Game/Icons/ZoneOffice.svg";
			case "Vehicle":
				return "Media/Game/Icons/Traffic.svg";
			case "Area":
			case "Surface":
				return "Media/Game/Icons/LotTool.svg";
			case "PropMisc":
				return "fa:solid-cube";
			case "SignsAndPosters":
				return "fa:solid-clipboard-user";
			case "Fences":
				return "fa:solid-xmarks-lines";
			case "Billboards":
				return "fa:solid-rectangle-ad";
			case "Pavement":
				return "Media/Game/Icons/Pathways.svg";
			case "SmallRoad":
				return "Media/Game/Icons/SmallRoad.svg";
			case "MediumRoad":
				return "Media/Game/Icons/MediumRoad.svg";
			case "LargeRoad":
				return "Media/Game/Icons/LargeRoad.svg";
			case "Highway":
				return "Media/Game/Icons/Highways.svg";
			case "RoadTool":
				return "Media/Game/Icons/RoadsServices.svg";
			case "OtherNetwork":
				return "Media/Game/Icons/Roads.svg";
			case "Park":
				return "Media/Game/Icons/ParksAndRecreation.svg";
			case "Parking":
				return "Media/Game/Icons/Parking.svg";
			case "Roundabout":
				return "Media/Game/Icons/Roundabouts.svg";
			case "Accessory":
				return "fa:solid-tree-city";
			case "TransportStop":
				return "Media/Game/Icons/Bus Stop.svg";
			default:
				return "";
			}
		}

		protected override void OnUpdate()
		{
			base.OnUpdate();
			if (!IsPickingShortcut && _toolSystem.activeTool == _defaulToolSystem && PickerShortcutTrigger() && !IsPicking)
			{
				IsPickingShortcut = true;
				UpdatePicker(isPicking: true);
			}
			else if (IsPickingShortcut && !PickerShortcutTrigger() && IsPicking)
			{
				IsPickingShortcut = false;
				_pickerToolSystem.RemoveLastHighlighted();
				UpdatePicker(isPicking: false);
			}
			if (_queryResults.Any() && _queryResults.TryDequeue(out (string, string) result))
			{
				GameManager.instance.userInterface.view.View.TriggerEvent<string, string>("findstuff.onReceiveResults", result.Item1, result.Item2);
			}
			if (!string.IsNullOrEmpty(_lastSearch) && Time.time >= _lastSearchTime + 5f)
			{
				IncrementSearchHistory();
				base.Model.RecentSearches = (from s in _config.RecentSearches
					orderby s.Value descending
					select s.Key).ToHashSet();
				base.TriggerUpdate();
				_lastSearch = null;
			}
		}

		private void IncrementSearchHistory()
		{
			if (_config.RecentSearches == null)
			{
				_config.RecentSearches = new Dictionary<string, ushort>();
			}
			if (_config.RecentSearches.Count >= 100 && DateTime.UtcNow >= _config.LastSearchHistoryPurge.AddDays(1.0))
			{
				foreach (string item in (from r in _config.RecentSearches
					orderby r.Value
					select r into s
					select s.Key).Take(50))
				{
					_config.RecentSearches.Remove(item);
				}
			}
			if (!_config.RecentSearches.ContainsKey(_lastSearch))
			{
				_config.RecentSearches.Add(_lastSearch, 1);
			}
			else
			{
				ushort num = _config.RecentSearches[_lastSearch];
				if (num < ushort.MaxValue)
				{
					_config.RecentSearches[_lastSearch] = (ushort)(num + 1);
				}
			}
			_config.Save();
		}

		[OnTrigger]
		private void OnTestClick()
		{
		}

		[OnTrigger]
		private void OnTogglePicker()
		{
			UpdatePicker(!base.Model.IsPicking);
		}

		private void OnEscapePressed()
		{
			if (base.Model.IsVisible || base.Model.IsPicking)
			{
				if (base.Model.IsPicking)
				{
					UpdatePicker(isPicking: false);
					_pickerToolSystem.RemoveLastHighlighted();
				}
				else
				{
					OnToggleVisible();
				}
			}
		}

		[OnTrigger]
		private void OnToggleVisible()
		{
			base.Model.IsVisible = !base.Model.IsVisible;
			if (base.Model.OperationMode == ViewOperationMode.MoveFindStuff && base.Model.IsVisible && !base.Model.Shifted && _toolSystem.activeTool != _defaulToolSystem)
			{
				base.Model.Shifted = true;
			}
			base.TriggerUpdate();
		}

		[OnTrigger]
		private void OnShow()
		{
			base.Model.IsVisible = true;
			base.TriggerUpdate();
		}

		[OnTrigger]
		private void OnHide()
		{
			base.Model.IsVisible = false;
			base.TriggerUpdate();
		}

		[OnTrigger]
		private void OnSelectPrefab(string name)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(name))
			{
				return;
			}
			PrefabBase val = ((List<PrefabBase>)_prefabsField.GetValue(_prefabSystem))?.FirstOrDefault((Func<PrefabBase, bool>)((PrefabBase p) => ((Object)p).name == name));
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			Entity entity = _prefabSystem.GetEntity(val);
			if (entity != Entity.Null)
			{
				_toolSystem.ActivatePrefabTool(val);
				EntityCommandBuffer commandBuffer = ((SafeCommandBufferSystem)_endFrameBarrier).CreateCommandBuffer();
				if (IsValidPrefab(val, entity, out var prefabHelper) && prefabHelper is ZoneBuildingHelper)
				{
					_ploppableRICOSystem.MakePloppable(entity, commandBuffer);
				}
				if (_modSettings.AutomaticUnlocks)
				{
					Entity val2 = ((EntityCommandBuffer)(ref commandBuffer)).CreateEntity(_entityArchetype);
					((EntityCommandBuffer)(ref commandBuffer)).SetComponent<Unlock>(val2, new Unlock(entity));
				}
				GameManager.instance.userInterface.view.View.ExecuteScript($"engine.trigger('toolbar.selectAsset',{{index: {entity.Index}, version: {entity.Version}}});");
				if (!created)
				{
					createPrefab = val;
					created = true;
				}
			}
		}

		[OnTrigger]
		private void OnToggleFavourite(string name)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(name))
			{
				return;
			}
			PrefabBase val = ((List<PrefabBase>)_prefabsField.GetValue(_prefabSystem))?.FirstOrDefault((Func<PrefabBase, bool>)((PrefabBase p) => ((Object)p).name == name));
			if ((Object)(object)val != (Object)null && _prefabSystem.GetEntity(val) != Entity.Null)
			{
				if (_config.Favourites.Contains(name))
				{
					_config.Favourites.Remove(name);
				}
				else
				{
					_config.Favourites.Add(name);
				}
				_config.Save();
				base.Model.Favourites = _config.Favourites.ToList();
				base.TriggerUpdate();
			}
		}

		protected override void OnModelUpdated()
		{
			if (_config.ViewMode != base.Model.ViewMode || _config.Filter != base.Model.Filter || _config.SubFilter != base.Model.SubFilter || _config.ExpertMode != base.Model.ExpertMode || _config.EnableShortcut != base.Model.EnableShortcut || _config.OrderByAscending != base.Model.OrderByAscending || _config.IsHistorical != base.Model.IsHistorical)
			{
				_config.ViewMode = base.Model.ViewMode;
				_config.Filter = base.Model.Filter;
				_config.SubFilter = base.Model.SubFilter;
				_config.OrderByAscending = base.Model.OrderByAscending;
				_config.ExpertMode = base.Model.ExpertMode;
				_config.EnableShortcut = base.Model.EnableShortcut;
				_config.IsHistorical = base.Model.IsHistorical;
				_config.Save();
			}
		}

		protected override void OnSettingsUpdated()
		{
			UpdateFromSettings();
		}

		private void UpdateFromSettings()
		{
			if (_modSettings != null)
			{
				bool flag = false;
				if (_modSettings.EnableShortcut != base.Model.EnableShortcut)
				{
					base.Model.EnableShortcut = _modSettings.EnableShortcut;
					flag = true;
				}
				if (_modSettings.OperationMode != base.Model.OperationMode.ToString())
				{
					base.Model.OperationMode = Enum.Parse<ViewOperationMode>(_modSettings.OperationMode);
					flag = true;
				}
				if (_modSettings.ExpertMode != base.Model.ExpertMode)
				{
					base.Model.ExpertMode = _modSettings.ExpertMode;
					flag = true;
				}
				if (flag)
				{
					base.TriggerUpdate();
				}
			}
		}

		[OnTrigger]
		private void OnUpdateQuery()
		{
			if (base.Model == null || (Object)(object)_indexer == (Object)null)
			{
				return;
			}
			string text = _indexer.GenerateKey(base.Model);
			if (text == _lastQueryKey)
			{
				return;
			}
			_indexer.Query(Enum.TryParse<SearchSpeed>(_modSettings.SearchSpeed, out var result2) ? result2 : SearchSpeed.Medium, base.Model, delegate(string key, (string Json, int Count) result)
			{
				if (string.IsNullOrEmpty(result.Json))
				{
					Debug.LogWarning((object)"Empty JSON payload for query");
				}
				else
				{
					if (!string.IsNullOrEmpty(base.Model.Search))
					{
						_lastSearch = base.Model.Search.ToLowerInvariant().Trim();
						_lastSearchTime = Time.time;
					}
					else
					{
						_lastSearch = null;
					}
					_queryResults.Enqueue((key, result.Json));
				}
			}, delegate
			{
				GameManager.instance.userInterface.view.View.TriggerEvent("findstuff.onShowLoader");
			});
			_lastQueryKey = text;
		}

		private bool PickerShortcutTrigger()
		{
			if (EnableShortcut)
			{
				return Input.GetKey((KeyCode)306);
			}
			return false;
		}

		public void UpdatePicker(bool isPicking)
		{
			base.Model.IsPicking = isPicking;
			if (base.Model.IsPicking && _toolSystem.activeTool != _pickerToolSystem)
			{
				_toolSystem.activeTool = (ToolBaseSystem)(object)_pickerToolSystem;
			}
			else if (!base.Model.IsPicking && _toolSystem.activeTool == _pickerToolSystem)
			{
				_toolSystem.activeTool = (ToolBaseSystem)(object)_defaulToolSystem;
			}
			if (!base.Model.IsPicking)
			{
				IsPickingShortcut = false;
			}
			base.TriggerUpdate();
		}

		public void UpdatePrefabFromPicker(string prefabName)
		{
			(PrefabItem, Filter, SubFilter) prefab = _indexer.GetPrefab(prefabName);
			if (prefab.Item1 != null)
			{
				base.Model.Selected = prefab.Item1;
				if (!base.Model.IsVisible && base.Model.OperationMode == ViewOperationMode.HideAssetMenu)
				{
					base.Model.Filter = prefab.Item2;
					base.Model.SubFilter = prefab.Item3;
				}
			}
		}

		[OnTrigger]
		private void OnNeedHighlightPrefab(string idString)
		{
			if (string.IsNullOrEmpty(idString) || !int.TryParse(idString, out var result))
			{
				return;
			}
			(PrefabItem, Filter, SubFilter) prefab = _indexer.GetPrefab(result);
			if (prefab.Item1 != null)
			{
				base.Model.Selected = prefab.Item1;
				if (!base.Model.IsVisible && base.Model.OperationMode == ViewOperationMode.HideAssetMenu)
				{
					base.Model.Filter = prefab.Item2;
					base.Model.SubFilter = prefab.Item3;
				}
				base.TriggerUpdate();
			}
		}
	}
	[ControllerTypes(new Type[] { typeof(FindStuffController) })]
	[GooeeSettingsMenu(typeof(FindStuffSettings))]
	public class FindStuffPlugin : IGooeePluginWithControllers, IGooeePlugin, IGooeeChangeLog, IGooeeSettings, IGooeeLanguages, IGooeeStyleSheet
	{
		public string Name => "FindStuff";

		public string Version => "1.1.0";

		public string ScriptResource => "FindStuff.Resources.ui.js";

		public string ChangeLogResource => "FindStuff.Resources.changelog.md";

		public string StyleResource => "FindStuff.Resources.ui.css";

		public IController[] Controllers { get; set; }

		public string LanguageResourceFolder => "FindStuff.Resources.lang";

		public GooeeSettings Settings { get; set; }
	}
	internal class FindStuffSettings : GooeeSettings
	{
		[SettingsUISection("Toggles")]
		public string OperationMode { get; set; }

		[SettingsUISection("Toggles")]
		public bool EnableShortcut { get; set; }

		[SettingsUISection("Toggles")]
		public bool ExpertMode { get; set; }

		[SettingsUISection("Toggles")]
		public string SearchSpeed { get; set; }

		[SettingsUISection("Toggles")]
		public bool AutomaticUnlocks { get; set; }

		[SettingsUIHidden]
		protected override string UIResource => "FindStuff.Resources.settings.xml";

		public override void SetDefaults()
		{
			OperationMode = "HideFindStuff";
			ExpertMode = false;
			EnableShortcut = false;
			SearchSpeed = "Medium";
			AutomaticUnlocks = false;
		}

		[Preserve]
		public static DropdownItem<string>[] GetOperationModes()
		{
			//IL_0039: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			LocalizationManager localizationManager = GameManager.instance.localizationManager;
			return new DropdownItem<string>[4]
			{
				new DropdownItem<string>
				{
					value = ViewOperationMode.MoveFindStuff.ToString(),
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.MoveFindStuff"))
				},
				new DropdownItem<string>
				{
					value = ViewOperationMode.HideFindStuff.ToString(),
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.HideFindStuff"))
				},
				new DropdownItem<string>
				{
					value = ViewOperationMode.HideFindStuffSideMenu.ToString(),
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.HideFindStuffSideMenu"))
				},
				new DropdownItem<string>
				{
					value = ViewOperationMode.HideAssetMenu.ToString(),
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.HideAssetMenu"))
				}
			};
		}

		[Preserve]
		public static DropdownItem<string>[] GetSearchSpeeds()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			LocalizationManager localizationManager = GameManager.instance.localizationManager;
			return new DropdownItem<string>[5]
			{
				new DropdownItem<string>
				{
					value = "VeryLow",
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.SearchSpeed.VeryLow"))
				},
				new DropdownItem<string>
				{
					value = "Low",
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.SearchSpeed.Low"))
				},
				new DropdownItem<string>
				{
					value = "Medium",
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.SearchSpeed.Medium"))
				},
				new DropdownItem<string>
				{
					value = "High",
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.SearchSpeed.High"))
				},
				new DropdownItem<string>
				{
					value = "VeryHigh",
					displayName = LocalizedString.op_Implicit(localizationManager.GetLocalizedName("FindStuff.FindStuffSettings.SearchSpeed.VeryHigh"))
				}
			};
		}
	}
	public class FindStuffViewModel : Model
	{
		public bool IsVisible { get; set; }

		public bool IsPicking { get; set; }

		public bool IsHistorical { get; set; }

		public List<Category> Categories { get; set; } = PrefabIndexer._filterMappings.Select((KeyValuePair<Filter, SubFilter[]> kvp) => new Category
		{
			Filter = kvp.Key,
			SubFilters = kvp.Value.ToList()
		}).ToList();


		public bool IsWaitingQuery { get; set; }

		[JsonIgnore]
		public List<PrefabItem> Prefabs { get; set; } = new List<PrefabItem>();


		public bool OrderByAscending { get; set; } = true;


		public ViewMode ViewMode { get; set; } = ViewMode.IconGrid;


		public string Search { get; set; }

		public Filter Filter { get; set; }

		public SubFilter SubFilter { get; set; }

		public List<string> Favourites { get; set; } = new List<string>();


		public ViewOperationMode OperationMode { get; set; }

		public bool EnableShortcut { get; set; }

		public bool ExpertMode { get; set; }

		public bool Shifted { get; set; }

		public PrefabItem Selected { get; set; }

		public bool SearchWords { get; set; }

		public bool SearchTags { get; set; }

		public HashSet<string> RecentSearches { get; set; }
	}
	public class PrefabItem
	{
		public int ID { get; set; }

		public string Name { get; set; }

		public string Category { get; set; }

		public string Type { get; set; }

		public string Description { get; set; }

		public string Thumbnail { get; set; }

		public string TypeIcon { get; set; }

		public bool IsModded { get; set; }

		public bool IsExpertMode { get; set; }

		public Dictionary<string, object> Meta { get; set; }

		public List<string> Tags { get; set; }
	}
	public class Category
	{
		public Filter