Decompiled source of EconomyFixer v1.1.7

EconomyFixer.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Colossal;
using Colossal.Collections;
using Colossal.Entities;
using Colossal.IO.AssetDatabase;
using Colossal.Logging;
using Colossal.Serialization.Entities;
using Colossal.UI.Binding;
using EconomyFixer.Domain;
using EconomyFixer.Settings;
using EconomyFixer.Systems;
using EconomyFixer.UI;
using EconomyFixer.Utility;
using Game;
using Game.Buildings;
using Game.Citizens;
using Game.City;
using Game.Common;
using Game.Events;
using Game.Modding;
using Game.Net;
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.Tooltip;
using Game.UI.Widgets;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Burst;
using Unity.Burst.Intrinsics;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Scripting;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("EconomyFixer")]
[assembly: AssemblyConfiguration("BepInEx")]
[assembly: AssemblyFileVersion("1.1.7")]
[assembly: AssemblyInformationalVersion("1.1.7")]
[assembly: AssemblyProduct("EconomyFixer")]
[assembly: AssemblyTitle("EconomyFixer")]
[assembly: AlwaysLinkAssembly]
[assembly: AssemblyVersion("1.1.7.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace EconomyFixer
{
	public class EconomyFixerMod : IMod
	{
		private Harmony? _harmony;

		public static ILog Log { get; } = LogManager.GetLogger("EconomyFixer", false);


		public static EconomyFixerSettings? Settings { get; private set; }

		public void OnCreateWorld(UpdateSystem updateSystem)
		{
			Log.Info((object)"OnCreateWorld");
			try
			{
				updateSystem.UpdateAt<DemolitionTimerSystem>((SystemUpdatePhase)12);
				updateSystem.UpdateAt<MilestoneNoRewardSystem>((SystemUpdatePhase)12);
				updateSystem.UpdateAt<BulldozeCostSystem>((SystemUpdatePhase)17);
				updateSystem.UpdateAt<BulldozeDemolitionSystem>((SystemUpdatePhase)17);
				updateSystem.UpdateAt<CondemnedDemolitionSystem>((SystemUpdatePhase)12);
				updateSystem.UpdateAt<ExtendedCollapsedBuildingSystem>((SystemUpdatePhase)12);
				updateSystem.UpdateAt<MoneyApplySystem>((SystemUpdatePhase)12);
				updateSystem.UpdateAt<BulldozeCostTooltipSystem>((SystemUpdatePhase)23);
				updateSystem.UpdateAt<CustomBudgetUISystem>((SystemUpdatePhase)22);
			}
			catch (Exception ex)
			{
				Log.Fatal(ex);
			}
		}

		public void OnDispose()
		{
			Log.Info((object)"OnDispose");
		}

		public void OnLoad()
		{
			Log.Info((object)"OnLoad");
			Settings = new EconomyFixerSettings(this);
			((ModSetting)Settings).RegisterInOptionsUI();
			GameManager.instance.localizationManager.AddSource("en-US", (IDictionarySource)(object)new LocaleEN(Settings));
			AssetDatabase.global.LoadSettings("EconomyFixerMod", (object)Settings, (object)new EconomyFixerSettings(this)
			{
				DefaultBlock = true
			});
			AssetDatabase.global.SaveSettingsNow();
		}

		internal void RefreshSystems()
		{
			((ComponentSystemBase)World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged<MilestoneNoRewardSystem>()).Enabled = true;
		}
	}
	[BepInPlugin("EconomyFixer", "EconomyFixer", "1.1.7")]
	[HarmonyPatch]
	public class EconomyFixerPlugin : BaseUnityPlugin
	{
		internal static EconomyFixerMod _mod;

		public void Awake()
		{
			_mod = new EconomyFixerMod();
			Harmony.CreateAndPatchAll(typeof(EconomyFixerPlugin).Assembly, "EconomyFixer");
		}

		[HarmonyPatch(typeof(SystemOrder), "Initialize", new Type[] { typeof(UpdateSystem) })]
		[HarmonyPostfix]
		private static void InjectSystems(UpdateSystem updateSystem)
		{
			_mod.OnLoad();
			_mod.OnCreateWorld(updateSystem);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "EconomyFixer";

		public const string PLUGIN_NAME = "EconomyFixer";

		public const string PLUGIN_VERSION = "1.1.7";
	}
}
namespace EconomyFixer.Utility
{
	public static class DemolitionUtility
	{
		public const int DemolitionTimerValue = 8192;

		private static readonly DemolitionTimerSystem _demolitionTimerSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged<DemolitionTimerSystem>();

		public static void TriggerControlledDemolition(EntityManager entityManager, Entity entity, EntityCommandBuffer commandBuffer, Entity m_City, BulldozeCostSystem m_BulldozeCostSystem)
		{
			//IL_0003: 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_002b: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00c6: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00e5: 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_00e9: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: 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_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			int demolitionCost = m_BulldozeCostSystem.GetDemolitionCost(entity);
			if (demolitionCost != 0)
			{
				DynamicBuffer<PendingDemolitionCosts> val = default(DynamicBuffer<PendingDemolitionCosts>);
				(EntitiesExtensions.TryGetBuffer<PendingDemolitionCosts>(entityManager, m_City, false, ref val) ? val : ((EntityManager)(ref entityManager)).AddBuffer<PendingDemolitionCosts>(m_City)).Add(new PendingDemolitionCosts
				{
					m_Value = demolitionCost
				});
			}
			EconomyFixerSettings? settings = EconomyFixerMod.Settings;
			if (settings != null && !settings.BulldozeCausesDemolition)
			{
				return;
			}
			ObjectData componentData = ((EntityManager)(ref entityManager)).GetComponentData<ObjectData>(((EntityManager)(ref entityManager)).GetComponentData<PrefabRef>(entity).m_Prefab);
			Entity val2 = ((EntityManager)(ref entityManager)).CreateEntity(componentData.m_Archetype);
			EventData componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<EventData>(_demolitionTimerSystem.BuildingCollapseEntity);
			((EntityManager)(ref entityManager)).SetComponentData<PrefabRef>(val2, ((EntityManager)(ref entityManager)).GetComponentData<PrefabRef>(entity));
			((EntityManager)(ref entityManager)).SetComponentData<Transform>(val2, ((EntityManager)(ref entityManager)).GetComponentData<Transform>(entity));
			((EntityManager)(ref entityManager)).SetComponentData<Building>(val2, ((EntityManager)(ref entityManager)).GetComponentData<Building>(entity));
			((EntityManager)(ref entityManager)).SetComponentData<Color>(val2, ((EntityManager)(ref entityManager)).GetComponentData<Color>(entity));
			((EntityManager)(ref entityManager)).SetComponentData<Lot>(val2, ((EntityManager)(ref entityManager)).GetComponentData<Lot>(entity));
			((EntityManager)(ref entityManager)).RemoveComponent<PlaceableObjectData>(val2);
			((EntityManager)(ref entityManager)).AddComponentData<ControlledDemolition>(val2, default(ControlledDemolition));
			DynamicBuffer<InstalledUpgrade> val3 = default(DynamicBuffer<InstalledUpgrade>);
			if (EntitiesExtensions.TryGetBuffer<InstalledUpgrade>(entityManager, entity, true, ref val3))
			{
				for (int i = 0; i < val3.Length; i++)
				{
					((EntityManager)(ref entityManager)).AddComponentData<ControlledDemolition>(val3[i].m_Upgrade, default(ControlledDemolition));
				}
			}
			Entity val4 = ((EntityCommandBuffer)(ref commandBuffer)).CreateEntity(componentData2.m_Archetype);
			((EntityCommandBuffer)(ref commandBuffer)).SetComponent<PrefabRef>(val4, new PrefabRef(_demolitionTimerSystem.BuildingCollapseEntity));
			((EntityCommandBuffer)(ref commandBuffer)).SetBuffer<TargetElement>(val4).Add(new TargetElement(val2));
		}
	}
	internal static class EconomyUtility
	{
		public static int ConvertFromBufferedValueToMonthly(int bufferedValue)
		{
			return ConvertFromBufferedValueToTick(bufferedValue, 1);
		}

		public static int ConvertFromBufferedValueToHourly(int bufferedValue)
		{
			return ConvertFromBufferedValueToTick(bufferedValue) * 1024 / 24;
		}

		public static int ConvertFromBufferedValueToTick(int bufferedValue, int updatesPerMonth = 1024)
		{
			if (bufferedValue < 0)
			{
				return -math.min(-bufferedValue, 1000 + (-5 * bufferedValue + Mathf.RoundToInt(math.pow((float)bufferedValue / 100f, 2f))) / updatesPerMonth);
			}
			return math.min(bufferedValue, 1000 + (5 * bufferedValue + Mathf.RoundToInt(math.pow((float)bufferedValue / 100f, 2f))) / updatesPerMonth);
		}

		public static int GetExpense(ExpenseSource source, NativeArray<int> array)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return GetExpense(source, CityServiceBudgetSystem.GetExpense(source, array));
		}

		public static int GetExpense(ExpenseSource source, int value)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected I4, but got Unknown
			if (1 == 0)
			{
			}
			int num;
			switch ((int)source)
			{
			case 0:
			case 6:
			case 7:
			case 8:
				num = value * 5 / 3;
				break;
			case 1:
				num = value * 3 / 2;
				break;
			case 2:
				num = value * 3;
				break;
			case 3:
			case 4:
				num = value * 6;
				break;
			case 9:
				num = value * 7 / 5;
				break;
			default:
				num = value;
				break;
			}
			if (1 == 0)
			{
			}
			value = num;
			EconomyDifficulty? economyDifficulty = EconomyFixerMod.Settings?.EconomyDifficulty;
			if (1 == 0)
			{
			}
			float num2 = economyDifficulty switch
			{
				EconomyDifficulty.Easy => value, 
				EconomyDifficulty.Medium => (float)value * 1.15f, 
				EconomyDifficulty.Hard => (float)value * 1.3f, 
				EconomyDifficulty.GoodLuck => (float)value * 1.45f, 
				_ => value, 
			};
			if (1 == 0)
			{
			}
			return Mathf.RoundToInt(num2);
		}

		public static int GetIncome(IncomeSource source, NativeArray<int> array)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return GetIncome(source, CityServiceBudgetSystem.GetIncome(source, array));
		}

		public static int GetIncome(IncomeSource source, int value)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected I4, but got Unknown
			if (1 == 0)
			{
			}
			int num;
			switch ((int)source)
			{
			case 0:
			case 1:
			case 11:
				num = value * 7 / 10;
				break;
			case 2:
				num = value * 3 / 10;
				break;
			case 4:
				num = value * 9 / 5;
				break;
			case 7:
				num = value * 2 / 5;
				break;
			case 8:
			case 13:
				num = value * 3;
				break;
			case 12:
				num = value / 12;
				break;
			case 3:
				num = value * 8;
				break;
			case 14:
				num = value / 3;
				break;
			default:
				num = value;
				break;
			}
			if (1 == 0)
			{
			}
			value = num;
			EconomyDifficulty? economyDifficulty = EconomyFixerMod.Settings?.EconomyDifficulty;
			if (1 == 0)
			{
			}
			float num2 = economyDifficulty switch
			{
				EconomyDifficulty.Easy => (float)value / 0.95f, 
				EconomyDifficulty.Medium => (float)value / 1.1f, 
				EconomyDifficulty.Hard => (float)value / 1.25f, 
				EconomyDifficulty.GoodLuck => (float)value / 1.4f, 
				_ => value, 
			};
			if (1 == 0)
			{
			}
			return Mathf.RoundToInt(num2);
		}
	}
}
namespace EconomyFixer.UI
{
	public class CustomBudgetUISystem : UISystemBase
	{
		private PrefabSystem m_PrefabSystem;

		private CityServiceBudgetSystem m_CityServiceBudgetSystem;

		private EntityQuery m_ConfigQuery;

		private GetterValueBinding<int> m_TotalIncomeBinding;

		private GetterValueBinding<int> m_TotalExpensesBinding;

		private RawValueBinding m_IncomeItemsBinding;

		private RawValueBinding m_IncomeValuesBinding;

		private RawValueBinding m_ExpenseItemsBinding;

		private RawValueBinding m_ExpenseValuesBinding;

		[Preserve]
		protected override void OnCreate()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ba: 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_00c1: Expected O, but got Unknown
			//IL_00c6: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_00f1: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_011c: Expected O, but got Unknown
			//IL_013b: 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: Expected O, but got Unknown
			//IL_0147: Expected O, but got Unknown
			((UISystemBase)this).OnCreate();
			m_PrefabSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<PrefabSystem>();
			m_CityServiceBudgetSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CityServiceBudgetSystem>();
			m_ConfigQuery = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<UIEconomyConfigurationData>() });
			((UISystemBase)this).AddBinding((IBinding)(object)(m_TotalIncomeBinding = new GetterValueBinding<int>("budget", "totalIncome", (Func<int>)GetTotalIncome, (IWriter<int>)null, (EqualityComparer<int>)null)));
			((UISystemBase)this).AddBinding((IBinding)(object)(m_TotalExpensesBinding = new GetterValueBinding<int>("budget", "totalExpenses", (Func<int>)GetTotalExpenses, (IWriter<int>)null, (EqualityComparer<int>)null)));
			RawValueBinding val = new RawValueBinding("budget", "incomeItems", (Action<IJsonWriter>)BindIncomeItems);
			RawValueBinding val2 = val;
			m_IncomeItemsBinding = val;
			((UISystemBase)this).AddBinding((IBinding)(object)val2);
			RawValueBinding val3 = new RawValueBinding("budget", "incomeValues", (Action<IJsonWriter>)BindIncomeValues);
			val2 = val3;
			m_IncomeValuesBinding = val3;
			((UISystemBase)this).AddBinding((IBinding)(object)val2);
			RawValueBinding val4 = new RawValueBinding("budget", "expenseItems", (Action<IJsonWriter>)BindExpenseItems);
			val2 = val4;
			m_ExpenseItemsBinding = val4;
			((UISystemBase)this).AddBinding((IBinding)(object)val2);
			RawValueBinding val5 = new RawValueBinding("budget", "expenseValues", (Action<IJsonWriter>)BindExpenseValues);
			val2 = val5;
			m_ExpenseValuesBinding = val5;
			((UISystemBase)this).AddBinding((IBinding)(object)val2);
			((ComponentSystemBase)((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BudgetUISystem>()).Enabled = false;
		}

		[Preserve]
		protected override void OnUpdate()
		{
			m_TotalIncomeBinding.Update();
			m_TotalExpensesBinding.Update();
			m_IncomeValuesBinding.Update();
			m_ExpenseValuesBinding.Update();
		}

		private int GetTotalIncome()
		{
			return m_CityServiceBudgetSystem.GetTotalIncome();
		}

		private int GetTotalExpenses()
		{
			return m_CityServiceBudgetSystem.GetTotalExpenses();
		}

		private void BindIncomeItems(IJsonWriter writer)
		{
			//IL_0063: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected I4, but got Unknown
			UIEconomyConfigurationPrefab config = GetConfig();
			JsonWriterExtensions.ArrayBegin(writer, config.m_IncomeItems.Length);
			BudgetItem<IncomeSource>[] incomeItems = config.m_IncomeItems;
			BudgetItem<IncomeSource>[] array = incomeItems;
			foreach (BudgetItem<IncomeSource> val in array)
			{
				writer.TypeBegin("Game.UI.InGame.BudgetItem");
				writer.PropertyName("id");
				writer.Write(val.m_ID);
				writer.PropertyName("color");
				UnityWriters.Write(writer, val.m_Color);
				writer.PropertyName("icon");
				writer.Write(val.m_Icon);
				writer.PropertyName("sources");
				int num = val.m_Sources.Length;
				if (val.m_ID == "Exports")
				{
					num++;
				}
				JsonWriterExtensions.ArrayBegin(writer, num);
				IncomeSource[] sources = val.m_Sources;
				IncomeSource[] array2 = sources;
				foreach (IncomeSource val2 in array2)
				{
					writer.TypeBegin("Game.UI.InGame.BudgetSource");
					writer.PropertyName("id");
					writer.Write(Enum.GetName(typeof(IncomeSource), val2));
					writer.PropertyName("index");
					writer.Write((int)val2);
					writer.TypeEnd();
				}
				if (val.m_ID == "Exports")
				{
					writer.TypeBegin("Game.UI.InGame.BudgetSource");
					writer.PropertyName("id");
					writer.Write("ExportedGoods");
					writer.PropertyName("index");
					writer.Write(14);
					writer.TypeEnd();
				}
				writer.ArrayEnd();
				writer.TypeEnd();
			}
			writer.ArrayEnd();
		}

		private void BindIncomeValues(IJsonWriter writer)
		{
			//IL_0043: 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_004c: 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)
			writer.ArrayBegin(15u);
			for (int i = 0; i < 14; i++)
			{
				writer.Write(EconomyUtility.GetIncome((IncomeSource)i, m_CityServiceBudgetSystem.GetIncome((IncomeSource)i)));
			}
			Entity city = ((ComponentSystemBase)this).World.GetExistingSystemManaged<CitySystem>().City;
			int num = 0;
			DynamicBuffer<BufferedMoneyResource> val = default(DynamicBuffer<BufferedMoneyResource>);
			if (EntitiesExtensions.TryGetBuffer<BufferedMoneyResource>(((ComponentSystemBase)this).EntityManager, city, true, ref val))
			{
				for (int j = 0; j < val.Length; j++)
				{
					BufferedMoneyResource bufferedMoneyResource = val[j];
					if (bufferedMoneyResource.m_Value > 0)
					{
						num += EconomyUtility.GetIncome((IncomeSource)14, bufferedMoneyResource.m_Value);
					}
				}
			}
			writer.Write(num);
			writer.ArrayEnd();
		}

		private void BindExpenseItems(IJsonWriter writer)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected I4, but got Unknown
			UIEconomyConfigurationPrefab config = GetConfig();
			JsonWriterExtensions.ArrayBegin(writer, config.m_ExpenseItems.Length);
			BudgetItem<ExpenseSource>[] expenseItems = config.m_ExpenseItems;
			BudgetItem<ExpenseSource>[] array = expenseItems;
			foreach (BudgetItem<ExpenseSource> val in array)
			{
				writer.TypeBegin("Game.UI.InGame.BudgetItem");
				writer.PropertyName("id");
				writer.Write(val.m_ID);
				writer.PropertyName("color");
				UnityWriters.Write(writer, val.m_Color);
				writer.PropertyName("icon");
				writer.Write(val.m_Icon);
				writer.PropertyName("sources");
				int num = val.m_Sources.Length;
				string iD = val.m_ID;
				if ((iD == "Imports" || iD == "Upkeeps") ? true : false)
				{
					num++;
				}
				JsonWriterExtensions.ArrayBegin(writer, num);
				ExpenseSource[] sources = val.m_Sources;
				ExpenseSource[] array2 = sources;
				foreach (ExpenseSource val2 in array2)
				{
					writer.TypeBegin("Game.UI.InGame.BudgetSource");
					writer.PropertyName("id");
					writer.Write(Enum.GetName(typeof(ExpenseSource), val2));
					writer.PropertyName("index");
					writer.Write((int)val2);
					writer.TypeEnd();
				}
				if (val.m_ID == "Upkeeps")
				{
					writer.TypeBegin("Game.UI.InGame.BudgetSource");
					writer.PropertyName("id");
					writer.Write("BuildingDemolitions");
					writer.PropertyName("index");
					writer.Write(9);
					writer.TypeEnd();
				}
				if (val.m_ID == "Imports")
				{
					writer.TypeBegin("Game.UI.InGame.BudgetSource");
					writer.PropertyName("id");
					writer.Write("ImportedGoods");
					writer.PropertyName("index");
					writer.Write(10);
					writer.TypeEnd();
				}
				writer.ArrayEnd();
				writer.TypeEnd();
			}
			writer.ArrayEnd();
		}

		private void BindExpenseValues(IJsonWriter writer)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a7: 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)
			writer.ArrayBegin(11u);
			for (int i = 0; i < 9; i++)
			{
				writer.Write(-EconomyUtility.GetExpense((ExpenseSource)i, m_CityServiceBudgetSystem.GetExpense((ExpenseSource)i)));
			}
			Entity city = ((ComponentSystemBase)this).World.GetExistingSystemManaged<CitySystem>().City;
			int num = 0;
			DynamicBuffer<PendingDemolitionCosts> val = default(DynamicBuffer<PendingDemolitionCosts>);
			if (EntitiesExtensions.TryGetBuffer<PendingDemolitionCosts>(((ComponentSystemBase)this).EntityManager, city, true, ref val))
			{
				for (int j = 0; j < val.Length; j++)
				{
					num -= val[j].m_Value;
				}
			}
			writer.Write(num);
			int num2 = 0;
			DynamicBuffer<BufferedMoneyResource> val2 = default(DynamicBuffer<BufferedMoneyResource>);
			if (EntitiesExtensions.TryGetBuffer<BufferedMoneyResource>(((ComponentSystemBase)this).EntityManager, city, true, ref val2))
			{
				for (int k = 0; k < val2.Length; k++)
				{
					BufferedMoneyResource bufferedMoneyResource = val2[k];
					if (bufferedMoneyResource.m_Value < 0)
					{
						num2 += EconomyUtility.GetExpense((ExpenseSource)9, bufferedMoneyResource.m_Value);
					}
				}
			}
			writer.Write(num2);
			writer.ArrayEnd();
		}

		private UIEconomyConfigurationPrefab GetConfig()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return m_PrefabSystem.GetSingletonPrefab<UIEconomyConfigurationPrefab>(m_ConfigQuery);
		}

		[Preserve]
		public CustomBudgetUISystem()
		{
		}
	}
}
namespace EconomyFixer.Systems
{
	[CompilerGenerated]
	public class BulldozeCostSystem : GameSystemBase
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		private struct TypeHandle
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
			}
		}

		private const string k_BuildingCollapsePrefab = "Building Collapse";

		private CitySystem m_CitySystem;

		private ToolSystem m_ToolSystem;

		private BulldozeToolSystem m_BulldozeTool;

		private EntityQuery m_DefinitionQuery;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_882071098_0;

		public int TotalCost { get; private set; }

		[Preserve]
		protected override void OnCreate()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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)
			((GameSystemBase)this).OnCreate();
			m_CitySystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CitySystem>();
			m_ToolSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolSystem>();
			m_BulldozeTool = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BulldozeToolSystem>();
			m_DefinitionQuery = __query_882071098_0;
			((ComponentSystemBase)this).RequireForUpdate(m_DefinitionQuery);
		}

		protected override void OnGameLoadingComplete(Purpose purpose, GameMode mode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0041: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnGameLoadingComplete(purpose, mode);
			if (GameModeExtensions.IsGame(mode))
			{
				EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
				if (!((EntityManager)(ref entityManager)).HasBuffer<BufferedMoneyResource>(m_CitySystem.City))
				{
					entityManager = ((ComponentSystemBase)this).EntityManager;
					((EntityManager)(ref entityManager)).AddBuffer<BufferedMoneyResource>(m_CitySystem.City);
				}
			}
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0041: 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_0048: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			if (m_ToolSystem.activeTool != m_BulldozeTool)
			{
				return;
			}
			int num = 0;
			NativeArray<CreationDefinition> val = ((EntityQuery)(ref m_DefinitionQuery)).ToComponentDataArray<CreationDefinition>(AllocatorHandle.op_Implicit((Allocator)2));
			for (int i = 0; i < val.Length; i++)
			{
				CreationDefinition val2 = val[i];
				Entity original = val2.m_Original;
				if (((Enum)val2.m_Flags).HasFlag((Enum)(object)(CreationFlags)4))
				{
					int demolitionCost = GetDemolitionCost(original);
					num += demolitionCost;
				}
			}
			TotalCost = num;
		}

		public int GetDemolitionCost(Entity entity)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0063: 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_0071: 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_007e: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			EconomyFixerSettings? settings = EconomyFixerMod.Settings;
			if (settings != null && !settings.BulldozeCostsMoney)
			{
				return 0;
			}
			float num = math.min(2500000f, GetDemolitionCostImpl(entity));
			if (num == 0f)
			{
				return 0;
			}
			EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
			if (!((EntityManager)(ref entityManager)).HasComponent<ResidentialProperty>(entity))
			{
				entityManager = ((ComponentSystemBase)this).EntityManager;
				if (!((EntityManager)(ref entityManager)).HasComponent<CommercialProperty>(entity))
				{
					entityManager = ((ComponentSystemBase)this).EntityManager;
					if (!((EntityManager)(ref entityManager)).HasComponent<IndustrialProperty>(entity))
					{
						entityManager = ((ComponentSystemBase)this).EntityManager;
						if (!((EntityManager)(ref entityManager)).HasComponent<OfficeProperty>(entity))
						{
							num /= 2f;
						}
					}
				}
			}
			switch (EconomyFixerMod.Settings?.EconomyDifficulty)
			{
			case EconomyDifficulty.Easy:
				num /= 3f;
				break;
			case EconomyDifficulty.Medium:
				num /= 2f;
				break;
			case EconomyDifficulty.Hard:
				num /= 1.5f;
				break;
			}
			return Mathf.RoundToInt(num / 100f) * 100;
		}

		private float GetDemolitionCostImpl(Entity entity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0041: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_0058: 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_0067: 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_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_00fa: 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_0082: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: 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_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: 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_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: 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_02a9: 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_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
			Building val = default(Building);
			if (((EntityManager)(ref entityManager)).HasComponent<UnderConstruction>(entity) || !EntitiesExtensions.TryGetComponent<Building>(((ComponentSystemBase)this).EntityManager, entity, ref val))
			{
				return 0f;
			}
			float num = 0f;
			entityManager = ((ComponentSystemBase)this).EntityManager;
			if (((EntityManager)(ref entityManager)).HasComponent<Destroyed>(entity))
			{
				EntityManager entityManager2 = ((ComponentSystemBase)this).EntityManager;
				entityManager = ((ComponentSystemBase)this).EntityManager;
				ObjectGeometryData val2 = default(ObjectGeometryData);
				if (EntitiesExtensions.TryGetComponent<ObjectGeometryData>(entityManager2, ((EntityManager)(ref entityManager)).GetComponentData<PrefabRef>(entity).m_Prefab, ref val2))
				{
					return val2.m_Size.x * val2.m_Size.z * 4f;
				}
			}
			DynamicBuffer<InstalledUpgrade> val3 = default(DynamicBuffer<InstalledUpgrade>);
			if (EntitiesExtensions.TryGetBuffer<InstalledUpgrade>(((ComponentSystemBase)this).EntityManager, entity, true, ref val3))
			{
				for (int i = 0; i < val3.Length; i++)
				{
					num += GetDemolitionCostImpl(val3[i].m_Upgrade);
				}
			}
			LandValue val4 = default(LandValue);
			if (EntitiesExtensions.TryGetComponent<LandValue>(((ComponentSystemBase)this).EntityManager, val.m_RoadEdge, ref val4))
			{
				entityManager = ((ComponentSystemBase)this).EntityManager;
				DynamicBuffer<Renter> val5 = default(DynamicBuffer<Renter>);
				if (((EntityManager)(ref entityManager)).HasComponent<ResidentialProperty>(entity) && EntitiesExtensions.TryGetBuffer<Renter>(((ComponentSystemBase)this).EntityManager, entity, true, ref val5))
				{
					float num2 = 1500f;
					float num3 = 0f;
					for (int j = 0; j < val5.Length; j++)
					{
						if (val5[j].m_Renter != Entity.Null)
						{
							entityManager = ((ComponentSystemBase)this).EntityManager;
							Household componentData = ((EntityManager)(ref entityManager)).GetComponentData<Household>(val5[j].m_Renter);
							if (((Enum)componentData.m_Flags).HasFlag((Enum)(object)(HouseholdFlags)4))
							{
								entityManager = ((ComponentSystemBase)this).EntityManager;
								PropertyRenter componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<PropertyRenter>(val5[j].m_Renter);
								num2 = math.clamp((float)componentData2.m_Rent, 0f, num2);
								num3 += 1f;
							}
						}
					}
					num += num2 * num3;
				}
				num += val4.m_LandValue * (4f + (4f - math.log10(6f * val4.m_Weight)) * val4.m_Weight / 8f);
			}
			EntityManager entityManager3 = ((ComponentSystemBase)this).EntityManager;
			entityManager = ((ComponentSystemBase)this).EntityManager;
			ObjectGeometryData val6 = default(ObjectGeometryData);
			if (EntitiesExtensions.TryGetComponent<ObjectGeometryData>(entityManager3, ((EntityManager)(ref entityManager)).GetComponentData<PrefabRef>(entity).m_Prefab, ref val6))
			{
				num += val6.m_Size.x * val6.m_Size.z * 3f + val6.m_Size.x * val6.m_Size.y * val6.m_Size.z / 6f;
			}
			return num;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
			//IL_0004: 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_001e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryBuilder val = default(EntityQueryBuilder);
			((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
			EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithAll<CreationDefinition>();
			val2 = ((EntityQueryBuilder)(ref val2)).WithNone<Updated>();
			__query_882071098_0 = ((EntityQueryBuilder)(ref val2)).Build(ref state);
			((EntityQueryBuilder)(ref val)).Reset();
			((EntityQueryBuilder)(ref val)).Dispose();
		}

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

		[Preserve]
		public BulldozeCostSystem()
		{
		}
	}
	[CompilerGenerated]
	public class BulldozeCostTooltipSystem : TooltipSystemBase
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		private struct TypeHandle
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
			}
		}

		private ToolSystem m_ToolSystem;

		private BulldozeToolSystem m_BulldozeTool;

		private BulldozeCostSystem m_BulldozeCostSystem;

		private IntTooltip m_Tooltip;

		private EntityQuery m_TempQuery;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_2027941964_0;

		[Preserve]
		protected override void OnCreate()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0055: 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_0066: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0083: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			((TooltipSystemBase)this).OnCreate();
			m_ToolSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolSystem>();
			m_BulldozeTool = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BulldozeToolSystem>();
			m_BulldozeCostSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BulldozeCostSystem>();
			m_TempQuery = __query_2027941964_0;
			((ComponentSystemBase)this).RequireForUpdate(m_TempQuery);
			IntTooltip val = new IntTooltip
			{
				icon = "Media/Game/Icons/Money.svg",
				path = PathSegment.op_Implicit("bulldozeCostTool")
			};
			((NumberTooltip<int>)val).unit = "money";
			((IconTooltip)val).color = (TooltipColor)2;
			((LabelIconTooltip)val).label = LocalizedString.Id("EconomyFixer.BULLDOZECOST_LABEL");
			m_Tooltip = val;
		}

		[Preserve]
		protected override void OnUpdate()
		{
			if (m_ToolSystem.activeTool == m_BulldozeTool && m_BulldozeCostSystem.TotalCost > 0)
			{
				((NumberTooltip<int>)(object)m_Tooltip).value = m_BulldozeCostSystem.TotalCost;
				((IconTooltip)m_Tooltip).color = (TooltipColor)0;
				((TooltipSystemBase)this).AddMouseTooltip((IWidget)(object)m_Tooltip);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
			//IL_0004: 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_001e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryBuilder val = default(EntityQueryBuilder);
			((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
			EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithAll<Temp>();
			val2 = ((EntityQueryBuilder)(ref val2)).WithNone<Deleted>();
			__query_2027941964_0 = ((EntityQueryBuilder)(ref val2)).Build(ref state);
			((EntityQueryBuilder)(ref val)).Reset();
			((EntityQueryBuilder)(ref val)).Dispose();
		}

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

		[Preserve]
		public BulldozeCostTooltipSystem()
		{
		}
	}
	[CompilerGenerated]
	public class BulldozeDemolitionSystem : SystemBase
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		private struct TypeHandle
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
			}
		}

		private ToolOutputBarrier m_ToolOutputBarrier;

		private ToolSystem m_ToolSystem;

		private BulldozeToolSystem m_BulldozeTool;

		private BulldozeCostSystem m_BulldozeCostSystem;

		private EntityQuery m_DefinitionQuery;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_1008762778_0;

		[Preserve]
		protected override void OnCreate()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			((ComponentSystemBase)this).OnCreate();
			m_BulldozeCostSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BulldozeCostSystem>();
			m_ToolOutputBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolOutputBarrier>();
			m_ToolSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolSystem>();
			m_BulldozeTool = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BulldozeToolSystem>();
			m_DefinitionQuery = __query_1008762778_0;
			((ComponentSystemBase)this).RequireForUpdate(m_DefinitionQuery);
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00a2: 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)
			//IL_00ab: 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_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_00fb: 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)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c3: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			if (m_ToolSystem.activeTool != m_BulldozeTool || (int)((ToolBaseSystem)m_BulldozeTool).applyMode != 1)
			{
				return;
			}
			NativeArray<CreationDefinition> val = ((EntityQuery)(ref m_DefinitionQuery)).ToComponentDataArray<CreationDefinition>(AllocatorHandle.op_Implicit((Allocator)2));
			EntityCommandBuffer commandBuffer = ((SafeCommandBufferSystem)m_ToolOutputBarrier).CreateCommandBuffer();
			Entity city = ((ComponentSystemBase)this).World.GetExistingSystemManaged<CitySystem>().City;
			for (int i = 0; i < val.Length; i++)
			{
				CreationDefinition val2 = val[i];
				if (!((Enum)val2.m_Flags).HasFlag((Enum)(object)(CreationFlags)4) || !(val2.m_Original != Entity.Null))
				{
					continue;
				}
				EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
				if (!((EntityManager)(ref entityManager)).HasComponent<Building>(val2.m_Original))
				{
					continue;
				}
				entityManager = ((ComponentSystemBase)this).EntityManager;
				if (!((EntityManager)(ref entityManager)).HasComponent<UnderConstruction>(val2.m_Original))
				{
					entityManager = ((ComponentSystemBase)this).EntityManager;
					if (!((EntityManager)(ref entityManager)).HasComponent<Destroyed>(val2.m_Original))
					{
						Entity original = val2.m_Original;
						DemolitionUtility.TriggerControlledDemolition(((ComponentSystemBase)this).EntityManager, original, commandBuffer, city, m_BulldozeCostSystem);
						((EntityCommandBuffer)(ref commandBuffer)).AddComponent<Deleted>(original);
					}
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
			//IL_0004: 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_001e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryBuilder val = default(EntityQueryBuilder);
			((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
			EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithAll<CreationDefinition>();
			val2 = ((EntityQueryBuilder)(ref val2)).WithNone<Updated>();
			__query_1008762778_0 = ((EntityQueryBuilder)(ref val2)).Build(ref state);
			((EntityQueryBuilder)(ref val)).Reset();
			((EntityQueryBuilder)(ref val)).Dispose();
		}

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

		[Preserve]
		public BulldozeDemolitionSystem()
		{
		}
	}
	[CompilerGenerated]
	internal class CondemnedDemolitionSystem : GameSystemBase
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		private struct TypeHandle
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
			}
		}

		private BulldozeCostSystem m_BulldozeCostSystem;

		private BulldozeDemolitionSystem m_BulldozeDemolitionSystem;

		private EndFrameBarrier m_EndFrameBarrier;

		private EntityQuery m_CondemnedQuery;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_718621682_0;

		public override int GetUpdateInterval(SystemUpdatePhase phase)
		{
			return 256;
		}

		[Preserve]
		protected override void OnCreate()
		{
			//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_005b: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnCreate();
			((ComponentSystemBase)((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CondemnedBuildingSystem>()).Enabled = false;
			m_BulldozeCostSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BulldozeCostSystem>();
			m_BulldozeDemolitionSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<BulldozeDemolitionSystem>();
			m_EndFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>();
			m_CondemnedQuery = __query_718621682_0;
			((ComponentSystemBase)this).RequireForUpdate(m_CondemnedQuery);
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//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_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_001e: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_005c: 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_00ab: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			EntityCommandBuffer commandBuffer = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer();
			NativeArray<Entity> val = ((EntityQuery)(ref m_CondemnedQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			Entity city = ((ComponentSystemBase)this).World.GetExistingSystemManaged<CitySystem>().City;
			for (int i = 0; i < val.Length; i++)
			{
				Entity val2 = val[i];
				EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
				if (((EntityManager)(ref entityManager)).HasComponent<UnderConstruction>(val2))
				{
					((EntityCommandBuffer)(ref commandBuffer)).AddComponent<Deleted>(val2);
					continue;
				}
				RandomSeed val3 = RandomSeed.Next();
				Random random = ((RandomSeed)(ref val3)).GetRandom(val2.Index * 10000);
				if (((Random)(ref random)).NextInt(math.clamp(val.Length / 2, 2, 8)) == 0)
				{
					DemolitionUtility.TriggerControlledDemolition(((ComponentSystemBase)this).EntityManager, val2, commandBuffer, city, m_BulldozeCostSystem);
					((EntityCommandBuffer)(ref commandBuffer)).AddComponent<Deleted>(val2);
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
			//IL_0004: 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_001e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryBuilder val = default(EntityQueryBuilder);
			((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
			EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithAll<Condemned, Building, UpdateFrame>();
			val2 = ((EntityQueryBuilder)(ref val2)).WithNone<Destroyed, Deleted, Temp>();
			__query_718621682_0 = ((EntityQueryBuilder)(ref val2)).Build(ref state);
			((EntityQueryBuilder)(ref val)).Reset();
			((EntityQueryBuilder)(ref val)).Dispose();
		}

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

		[Preserve]
		public CondemnedDemolitionSystem()
		{
		}
	}
	[CompilerGenerated]
	internal class DemolitionTimerSystem : GameSystemBase
	{
		[BurstCompile]
		private struct DemolitionTimerTickJob : IJobChunk
		{
			internal EntityTypeHandle m_EntityTypeHandle;

			internal ComponentTypeHandle<DemolitionTimer> m_DemolitionTimerTypeHandle;

			internal ParallelWriter m_CommandBuffer;

			public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_001a: 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_0067: 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)
				NativeArray<DemolitionTimer> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray<DemolitionTimer>(ref m_DemolitionTimerTypeHandle);
				NativeArray<Entity> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray(m_EntityTypeHandle);
				for (int i = 0; i < nativeArray.Length; i++)
				{
					DemolitionTimer demolitionTimer = nativeArray[i];
					demolitionTimer.mTimer -= 512;
					nativeArray[i] = demolitionTimer;
					if (demolitionTimer.mTimer <= 0)
					{
						((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Deleted>(unfilteredChunkIndex, nativeArray2[i], default(Deleted));
					}
				}
			}

			void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
			}
		}

		private struct TypeHandle
		{
			public ComponentTypeHandle<DemolitionTimer> __EconomyFixer_Domain_DemolitionTimer_RW_ComponentTypeHandle;

			[ReadOnly]
			public EntityTypeHandle __Unity_Entities_Entity_TypeHandle;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
				//IL_0004: 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_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)
				__EconomyFixer_Domain_DemolitionTimer_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<DemolitionTimer>(false);
				__Unity_Entities_Entity_TypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
			}
		}

		public const int UPDATE_INTERVAL = 512;

		private const string k_BuildingCollapsePrefab = "Building Collapse";

		private EntityQuery m_DemolitionTimerQuery;

		private Entity m_BuildingCollapseEntity;

		private EndFrameBarrier m_EndFrameBarrier;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_666193170_0;

		private EntityQuery __query_666193170_1;

		public Entity BuildingCollapseEntity => m_BuildingCollapseEntity;

		[Preserve]
		protected override void OnCreate()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			((GameSystemBase)this).OnCreate();
			EntityQuery _query_666193170_ = __query_666193170_0;
			NativeArray<Entity> val = ((EntityQuery)(ref _query_666193170_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)3));
			PrefabSystem orCreateSystemManaged = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<PrefabSystem>();
			for (int i = 0; i < val.Length; i++)
			{
				Entity val2 = val[i];
				EventPrefab prefab = orCreateSystemManaged.GetPrefab<EventPrefab>(val2);
				if (((Object)prefab).name == "Building Collapse")
				{
					m_BuildingCollapseEntity = val2;
					break;
				}
			}
			m_EndFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>();
			m_DemolitionTimerQuery = __query_666193170_1;
			((ComponentSystemBase)this).RequireForUpdate(m_DemolitionTimerQuery);
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007e: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			DemolitionTimerTickJob demolitionTimerTickJob = default(DemolitionTimerTickJob);
			__TypeHandle.__EconomyFixer_Domain_DemolitionTimer_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			demolitionTimerTickJob.m_DemolitionTimerTypeHandle = __TypeHandle.__EconomyFixer_Domain_DemolitionTimer_RW_ComponentTypeHandle;
			((EntityTypeHandle)(ref __TypeHandle.__Unity_Entities_Entity_TypeHandle)).Update(ref ((SystemBase)this).CheckedStateRef);
			demolitionTimerTickJob.m_EntityTypeHandle = __TypeHandle.__Unity_Entities_Entity_TypeHandle;
			EntityCommandBuffer val = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer();
			demolitionTimerTickJob.m_CommandBuffer = ((EntityCommandBuffer)(ref val)).AsParallelWriter();
			((SystemBase)this).Dependency = JobChunkExtensions.ScheduleParallel<DemolitionTimerTickJob>(demolitionTimerTickJob, m_DemolitionTimerQuery, ((SystemBase)this).Dependency);
			m_EndFrameBarrier.AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		public override int GetUpdateInterval(SystemUpdatePhase phase)
		{
			return 512;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
			//IL_0004: 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_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_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_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_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)
			EntityQueryBuilder val = default(EntityQueryBuilder);
			((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
			EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithAll<EventData>();
			__query_666193170_0 = ((EntityQueryBuilder)(ref val2)).Build(ref state);
			((EntityQueryBuilder)(ref val)).Reset();
			val2 = ((EntityQueryBuilder)(ref val)).WithAll<DemolitionTimer>();
			val2 = ((EntityQueryBuilder)(ref val2)).WithNone<Deleted, Temp>();
			__query_666193170_1 = ((EntityQueryBuilder)(ref val2)).Build(ref state);
			((EntityQueryBuilder)(ref val)).Reset();
			((EntityQueryBuilder)(ref val)).Dispose();
		}

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

		[Preserve]
		public DemolitionTimerSystem()
		{
		}
	}
	[CompilerGenerated]
	public class ExtendedCollapsedBuildingSystem : GameSystemBase
	{
		[BurstCompile]
		private struct CollapsedBuildingJob : IJobChunk
		{
			[ReadOnly]
			public EntityTypeHandle m_EntityType;

			[ReadOnly]
			public ComponentTypeHandle<RescueTarget> m_RescueTargetType;

			[ReadOnly]
			public ComponentTypeHandle<ServiceUpgrade> m_ServiceUpgradeType;

			[ReadOnly]
			public ComponentTypeHandle<Owner> m_OwnerType;

			[ReadOnly]
			public ComponentTypeHandle<Extension> m_ExtensionType;

			[ReadOnly]
			public ComponentTypeHandle<Attached> m_AttachedType;

			[ReadOnly]
			public ComponentTypeHandle<PrefabRef> m_PrefabRefType;

			[ReadOnly]
			public ComponentTypeHandle<ControlledDemolition> m_ControledDemolition;

			public ComponentTypeHandle<Destroyed> m_DestroyedType;

			[ReadOnly]
			public ComponentLookup<FireRescueRequest> m_FireRescueRequestData;

			[ReadOnly]
			public ComponentLookup<ObjectGeometryData> m_PrefabObjectGeometryData;

			[ReadOnly]
			public ComponentLookup<BuildingData> m_PrefabBuildingData;

			[ReadOnly]
			public EntityArchetype m_RescueRequestArchetype;

			public ParallelWriter m_CommandBuffer;

			public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0022: 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_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: 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_0148: 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_0155: 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_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_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_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Invalid comparison between Unknown and I4
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0190: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_01de: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: 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_02e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0306: Unknown result type (might be due to invalid IL or missing references)
				//IL_030b: 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)
				//IL_0316: Unknown result type (might be due to invalid IL or missing references)
				//IL_031e: 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_0372: 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_037c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0333: Unknown result type (might be due to invalid IL or missing references)
				//IL_0335: Unknown result type (might be due to invalid IL or missing references)
				//IL_033b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0280: Unknown result type (might be due to invalid IL or missing references)
				//IL_0284: Unknown result type (might be due to invalid IL or missing references)
				//IL_028c: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_029d: Unknown result type (might be due to invalid IL or missing references)
				//IL_029f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0354: Unknown result type (might be due to invalid IL or missing references)
				//IL_0358: Unknown result type (might be due to invalid IL or missing references)
				//IL_035e: Unknown result type (might be due to invalid IL or missing references)
				NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(m_EntityType);
				NativeArray<Destroyed> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Destroyed>(ref m_DestroyedType);
				NativeArray<RescueTarget> nativeArray3 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<RescueTarget>(ref m_RescueTargetType);
				NativeArray<PrefabRef> nativeArray4 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<PrefabRef>(ref m_PrefabRefType);
				bool flag = ((ArchetypeChunk)(ref chunk)).Has<ServiceUpgrade>(ref m_ServiceUpgradeType) && !((ArchetypeChunk)(ref chunk)).Has<Owner>(ref m_OwnerType);
				bool flag2 = flag || ((ArchetypeChunk)(ref chunk)).Has<ControlledDemolition>(ref m_ControledDemolition);
				bool flag3 = ((ArchetypeChunk)(ref chunk)).Has<Attached>(ref m_AttachedType);
				bool flag4 = !flag2 && (((ArchetypeChunk)(ref chunk)).Has<ServiceUpgrade>(ref m_ServiceUpgradeType) || ((ArchetypeChunk)(ref chunk)).Has<Extension>(ref m_ExtensionType));
				if (nativeArray3.Length != 0)
				{
					for (int i = 0; i < nativeArray2.Length; i++)
					{
						Destroyed val = nativeArray2[i];
						Entity val2 = nativeArray[i];
						if (val.m_Cleared < 1f)
						{
							RescueTarget rescueTarget = nativeArray3[i];
							RequestRescueIfNeeded(unfilteredChunkIndex, val2, rescueTarget);
						}
						else
						{
							((ParallelWriter)(ref m_CommandBuffer)).RemoveComponent<RescueTarget>(unfilteredChunkIndex, val2);
						}
					}
				}
				else
				{
					BuildingData val4 = default(BuildingData);
					for (int j = 0; j < nativeArray2.Length; j++)
					{
						ref Destroyed reference = ref CollectionUtils.ElementAt<Destroyed>(nativeArray2, j);
						PrefabRef val3 = nativeArray4[j];
						bool flag5 = false;
						if (m_PrefabBuildingData.TryGetComponent(val3.m_Prefab, ref val4))
						{
							flag5 = (val4.m_Flags & 1) > 0;
						}
						if (reference.m_Cleared < 0f)
						{
							Entity val5 = nativeArray[j];
							reference.m_Cleared += 1.0666667f;
							if (reference.m_Cleared >= 0f)
							{
								reference.m_Cleared = math.select(1f, 0f, flag5);
								((ParallelWriter)(ref m_CommandBuffer)).RemoveComponent<InterpolatedTransform>(unfilteredChunkIndex, val5);
								((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Updated>(unfilteredChunkIndex, val5, default(Updated));
							}
						}
						else if (flag2 || (reference.m_Cleared < 1f && !flag4))
						{
							if (flag2)
							{
								((ParallelWriter)(ref m_CommandBuffer)).AddComponent<DemolitionTimer>(unfilteredChunkIndex, nativeArray[j], new DemolitionTimer
								{
									mTimer = 8192 + (flag ? 1 : 0)
								});
							}
							else if (flag5)
							{
								Entity val6 = nativeArray[j];
								RescueTarget val7 = default(RescueTarget);
								RequestRescueIfNeeded(unfilteredChunkIndex, val6, val7);
								((ParallelWriter)(ref m_CommandBuffer)).AddComponent<RescueTarget>(unfilteredChunkIndex, val6, val7);
							}
							else
							{
								reference.m_Cleared = 1f;
							}
						}
					}
				}
				ObjectGeometryData val10 = default(ObjectGeometryData);
				for (int k = 0; k < nativeArray2.Length; k++)
				{
					if (!(nativeArray2[k].m_Cleared >= 1f) || flag4)
					{
						continue;
					}
					Entity val8 = nativeArray[k];
					PrefabRef val9 = nativeArray4[k];
					if (m_PrefabObjectGeometryData.TryGetComponent(val9.m_Prefab, ref val10))
					{
						if ((val10.m_Flags & 2) != 0 && !flag3)
						{
							((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Deleted>(unfilteredChunkIndex, val8, default(Deleted));
						}
					}
					else
					{
						((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Deleted>(unfilteredChunkIndex, val8, default(Deleted));
					}
				}
			}

			private void RequestRescueIfNeeded(int jobIndex, Entity entity, RescueTarget rescueTarget)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: 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_002c: 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_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				if (!m_FireRescueRequestData.HasComponent(rescueTarget.m_Request))
				{
					Entity val = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(jobIndex, m_RescueRequestArchetype);
					((ParallelWriter)(ref m_CommandBuffer)).SetComponent<FireRescueRequest>(jobIndex, val, new FireRescueRequest(entity, 10f, (FireRescueRequestType)1));
					((ParallelWriter)(ref m_CommandBuffer)).SetComponent<RequestGroup>(jobIndex, val, new RequestGroup(4u));
				}
			}

			void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
			}
		}

		private struct TypeHandle
		{
			[ReadOnly]
			public EntityTypeHandle __Unity_Entities_Entity_TypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<RescueTarget> __Game_Buildings_RescueTarget_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<ServiceUpgrade> __Game_Buildings_ServiceUpgrade_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<Owner> __Game_Common_Owner_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<Extension> __Game_Buildings_Extension_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<Attached> __Game_Objects_Attached_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<PrefabRef> __Game_Prefabs_PrefabRef_RO_ComponentTypeHandle;

			public ComponentTypeHandle<Destroyed> __Game_Common_Destroyed_RW_ComponentTypeHandle;

			public ComponentTypeHandle<ControlledDemolition> __EconomyFixer_Domain_ControlledDemolition_RW_ComponentTypeHandle;

			[ReadOnly]
			public ComponentLookup<FireRescueRequest> __Game_Simulation_FireRescueRequest_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<ObjectGeometryData> __Game_Prefabs_ObjectGeometryData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<BuildingData> __Game_Prefabs_BuildingData_RO_ComponentLookup;

			[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)
				__Unity_Entities_Entity_TypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
				__Game_Buildings_RescueTarget_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<RescueTarget>(true);
				__Game_Buildings_ServiceUpgrade_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<ServiceUpgrade>(true);
				__Game_Common_Owner_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Owner>(true);
				__Game_Buildings_Extension_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Extension>(true);
				__Game_Objects_Attached_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Attached>(true);
				__Game_Prefabs_PrefabRef_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<PrefabRef>(true);
				__Game_Common_Destroyed_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Destroyed>(false);
				__EconomyFixer_Domain_ControlledDemolition_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<ControlledDemolition>(false);
				__Game_Simulation_FireRescueRequest_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<FireRescueRequest>(true);
				__Game_Prefabs_ObjectGeometryData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ObjectGeometryData>(true);
				__Game_Prefabs_BuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<BuildingData>(true);
			}
		}

		private const int UPDATE_INTERVAL = 64;

		private EndFrameBarrier m_EndFrameBarrier;

		private EntityQuery m_CollapsedQuery;

		private EntityArchetype m_RescueRequestArchetype;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_173944317_0;

		public override int GetUpdateInterval(SystemUpdatePhase phase)
		{
			return 64;
		}

		[Preserve]
		protected override void OnCreate()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnCreate();
			((ComponentSystemBase)((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CollapsedBuildingSystem>()).Enabled = false;
			m_EndFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>();
			m_CollapsedQuery = __query_173944317_0;
			((ComponentSystemBase)this).RequireForUpdate(m_CollapsedQuery);
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			CollapsedBuildingJob collapsedBuildingJob = default(CollapsedBuildingJob);
			((EntityTypeHandle)(ref __TypeHandle.__Unity_Entities_Entity_TypeHandle)).Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_EntityType = __TypeHandle.__Unity_Entities_Entity_TypeHandle;
			__TypeHandle.__Game_Buildings_RescueTarget_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_RescueTargetType = __TypeHandle.__Game_Buildings_RescueTarget_RO_ComponentTypeHandle;
			__TypeHandle.__Game_Buildings_ServiceUpgrade_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_ServiceUpgradeType = __TypeHandle.__Game_Buildings_ServiceUpgrade_RO_ComponentTypeHandle;
			__TypeHandle.__Game_Common_Owner_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_OwnerType = __TypeHandle.__Game_Common_Owner_RO_ComponentTypeHandle;
			__TypeHandle.__Game_Buildings_Extension_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_ExtensionType = __TypeHandle.__Game_Buildings_Extension_RO_ComponentTypeHandle;
			__TypeHandle.__Game_Objects_Attached_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_AttachedType = __TypeHandle.__Game_Objects_Attached_RO_ComponentTypeHandle;
			__TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_PrefabRefType = __TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentTypeHandle;
			__TypeHandle.__Game_Common_Destroyed_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_DestroyedType = __TypeHandle.__Game_Common_Destroyed_RW_ComponentTypeHandle;
			__TypeHandle.__EconomyFixer_Domain_ControlledDemolition_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_ControledDemolition = __TypeHandle.__EconomyFixer_Domain_ControlledDemolition_RW_ComponentTypeHandle;
			__TypeHandle.__Game_Simulation_FireRescueRequest_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_FireRescueRequestData = __TypeHandle.__Game_Simulation_FireRescueRequest_RO_ComponentLookup;
			__TypeHandle.__Game_Prefabs_ObjectGeometryData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_PrefabObjectGeometryData = __TypeHandle.__Game_Prefabs_ObjectGeometryData_RO_ComponentLookup;
			__TypeHandle.__Game_Prefabs_BuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			collapsedBuildingJob.m_PrefabBuildingData = __TypeHandle.__Game_Prefabs_BuildingData_RO_ComponentLookup;
			collapsedBuildingJob.m_RescueRequestArchetype = m_RescueRequestArchetype;
			EntityCommandBuffer val = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer();
			collapsedBuildingJob.m_CommandBuffer = ((EntityCommandBuffer)(ref val)).AsParallelWriter();
			((SystemBase)this).Dependency = JobChunkExtensions.ScheduleParallel<CollapsedBuildingJob>(collapsedBuildingJob, m_CollapsedQuery, ((SystemBase)this).Dependency);
			m_EndFrameBarrier.AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
			//IL_0004: 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_001e: 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_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)
			EntityQueryBuilder val = default(EntityQueryBuilder);
			((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
			EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithAll<Destroyed>();
			val2 = ((EntityQueryBuilder)(ref val2)).WithAny<Building, ServiceUpgrade, Extension>();
			val2 = ((EntityQueryBuilder)(ref val2)).WithNone<DemolitionTimer, Deleted, Temp>();
			__query_173944317_0 = ((EntityQueryBuilder)(ref val2)).Build(ref state);
			((EntityQueryBuilder)(ref val)).Reset();
			((EntityQueryBuilder)(ref val)).Dispose();
		}

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

		[Preserve]
		public ExtendedCollapsedBuildingSystem()
		{
		}
	}
	[CompilerGenerated]
	public class MilestoneNoRewardSystem : GameSystemBase
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		private struct TypeHandle
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
			}
		}

		private EntityQuery m_MilestoneGroup;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_1746502360_0;

		[Preserve]
		protected override void OnCreate()
		{
			//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)
			((GameSystemBase)this).OnCreate();
			m_MilestoneGroup = __query_1746502360_0;
		}

		[Preserve]
		protected override void OnUpdate()
		{
			ApplyMilestoneRewards();
			((ComponentSystemBase)this).Enabled = false;
		}

		protected override void OnGamePreload(Purpose purpose, GameMode mode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (((int)purpose == 2 || (int)purpose == 1) && ((Enum)mode).HasFlag((Enum)(object)(GameMode)2))
			{
				((GameSystemBase)this).OnGamePreload(purpose, mode);
			}
		}

		protected override void OnGameLoadingComplete(Purpose purpose, GameMode mode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if (((int)purpose == 2 || (int)purpose == 1) && ((Enum)mode).HasFlag((Enum)(object)(GameMode)2))
			{
				ApplyMilestoneRewards();
			}
		}

		private void ApplyMilestoneRewards()
		{
			//IL_0003: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_00a5: 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_00eb: Unknown result type (might be due to invalid IL