Decompiled source of RealisticDensity v0.14.1

RealisticDensity.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using BepInEx;
using Colossal.Logging;
using Colossal.Serialization.Entities;
using FindStuff.Configuration;
using Game;
using Game.Common;
using Game.Companies;
using Game.Economy;
using Game.Modding;
using Game.Prefabs;
using Game.SceneFlow;
using Game.Simulation;
using Game.Tools;
using Game.UI;
using Gooee.Plugins;
using Gooee.Plugins.Attributes;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using RealisticDensity.Common;
using RealisticDensity.Configuration;
using RealisticDensity.Helper;
using RealisticDensity.Jobs;
using RealisticDensity.Prefabs;
using RealisticDensity.Settings;
using RealisticDensity.Systems;
using RealisticDensity.UI;
using Unity.Burst.Intrinsics;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Scripting;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RealisticDensity")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.14.1")]
[assembly: AssemblyInformationalVersion("0.14.1+fb16a9cfe69817cc465ffb53f7e1cedf05138dde")]
[assembly: AssemblyProduct("RealisticDensity")]
[assembly: AssemblyTitle("RealisticDensity")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.14.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FindStuff.UI
{
	[ControllerTypes(new Type[] { typeof(RealisticDensityController) })]
	public class RealisticDensityPlugin : IGooeePluginWithControllers, IGooeePlugin
	{
		public string Name => "RealisticDensity";

		public string Version => "0.14.1";

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

		public IController[] Controllers { get; set; }
	}
}
namespace FindStuff.Configuration
{
	public class RealisticDensityConfig : ConfigBase
	{
		protected override string ConfigFileName => "config.json";

		public bool IsEnabled { get; set; }
	}
}
namespace RealisticDensity
{
	public class Mod : IMod
	{
		public const string Name = "RealisticDensity";

		public const string Version = "0.14.1";

		public static Mod Instance { get; set; }

		internal ILog Log { get; private set; }

		public void OnLoad()
		{
			Instance = this;
			Log = LogManager.GetLogger("RealisticDensity");
			Log.Info((object)"Loading.");
		}

		public void OnDispose()
		{
			Log.Info((object)"Mod disposed.");
			Instance = null;
		}

		public static void DebugLog(string message)
		{
			Debug.Log((object)("[RealisticDensity | v0.14.1] " + message));
		}

		public void OnCreateWorld(UpdateSystem updateSystem)
		{
		}

		public void OnLoad(UpdateSystem updateSystem)
		{
			throw new NotImplementedException();
		}
	}
	[BepInPlugin("RealisticDensity", "RealisticDensity", "0.14.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Mod Mod;

		private void Awake()
		{
			Mod = new Mod();
			Mod.OnLoad();
			Mod.Log.Info((object)"Loading Harmony patches.");
			MethodBase[] array = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "RealisticDensity_Cities2Harmony").GetPatchedMethods().ToArray();
			Mod.Log.Info((object)("Plugin RealisticDensity is loaded! Patched methods " + array.Length));
			MethodBase[] array2 = array;
			foreach (MethodBase methodBase in array2)
			{
				Mod.Log.Info((object)("Patched method: " + methodBase.Module.Name + ":" + methodBase.Name));
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "RealisticDensity";

		public const string PLUGIN_NAME = "RealisticDensity";

		public const string PLUGIN_VERSION = "0.14.1";
	}
}
namespace RealisticDensity.UI
{
	public class RealisticDensityController : Controller<RealisticDensityViewModel>
	{
		public static readonly RealisticDensityConfig _config = ConfigBase.Load<RealisticDensityConfig>();

		public override RealisticDensityViewModel Configure()
		{
			return new RealisticDensityViewModel
			{
				IsVisible = false,
				IsEnabled = false
			};
		}

		protected override void OnDestroy()
		{
			((UISystemBase)this).OnDestroy();
		}

		protected override void OnModelUpdated()
		{
		}

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

		[OnTrigger]
		private void OpenURL(string url)
		{
			if (string.IsNullOrEmpty(url))
			{
				return;
			}
			try
			{
				Process.Start(url);
			}
			catch (Exception ex)
			{
				Console.WriteLine("An error occurred: " + ex.Message);
			}
		}
	}
	public class RealisticDensityViewModel : Model
	{
		public bool IsVisible { get; set; }

		public bool IsEnabled { get; set; }

		public float CommercialFactor { get; set; } = WorkforceFactors.Commercial.Medium;

	}
}
namespace RealisticDensity.Systems
{
	public class RealisticDensitySystem : GameSystemBase
	{
		public static readonly int kComponentVersion = 1;

		public static readonly int kProductionFactor = 3;

		private ModificationEndBarrier Barrier;

		public LocalSettings m_LocalSettings;

		public static RealisticDensitySettings Settings;

		public bool m_LocalSettingsLoaded;

		private UpdateCommercialBuildingsTypeHandle m_UpdateCommercialBuildingsTypeHandle;

		private EntityQuery m_UpdateCommercialBuildingsQuery;

		private UpdateIndustryBuildingsTypeHandle m_UpdateIndustryBuildingsTypeHandle;

		private EntityQuery m_UpdateIndustryBuildingsQuery;

		private UpdateCityServicesTypeHandle m_UpdateCityServicesJobTypeHandle;

		private EntityQuery m_UpdateCityServicesJobQuery;

		private UpdateHighOfficesTypeHandle m_UpdateHighOfficesJobTypeHandle;

		private EntityQuery m_UpdateHighOfficesJobQuery;

		private EntityQuery m_EconomyParameterQuery;

		private ResourcePrefabs m_ResourcePrefabs;

		[Preserve]
		protected override void OnCreate()
		{
			//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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnCreate();
			LoadSettings();
			Settings = m_LocalSettings.Settings;
			Barrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ModificationEndBarrier>();
			m_ResourcePrefabs = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ResourceSystem>().GetPrefabs();
			m_UpdateCityServicesJobQuery = ((ComponentSystemBase)this).GetEntityQuery(new UpdateCityServicesQuery().Query);
			m_UpdateCommercialBuildingsQuery = ((ComponentSystemBase)this).GetEntityQuery(new UpdateCommercialBuildingsQuery().Query);
			m_UpdateIndustryBuildingsQuery = ((ComponentSystemBase)this).GetEntityQuery(new UpdateIndustryBuildingsQuery().Query);
			m_UpdateHighOfficesJobQuery = ((ComponentSystemBase)this).GetEntityQuery(new UpdateHighOfficesQuery().Query);
			m_EconomyParameterQuery = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<EconomyParameterData>() });
			((ComponentSystemBase)this).RequireAnyForUpdate((EntityQuery[])(object)new EntityQuery[5] { m_UpdateCommercialBuildingsQuery, m_UpdateIndustryBuildingsQuery, m_UpdateCityServicesJobQuery, m_UpdateHighOfficesJobQuery, m_EconomyParameterQuery });
			Mod.DebugLog("System created.");
		}

		protected override void OnGameLoadingComplete(Purpose purpose, GameMode mode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			((GameSystemBase)this).OnGameLoadingComplete(purpose, mode);
			((ComponentSystemBase)this).Enabled = false;
			if ((int)mode == 2)
			{
				((ComponentSystemBase)this).Enabled = true;
			}
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (!Settings.DisableMod && !((Object)(object)GameManager.instance == (Object)null) && GameModeExtensions.IsGameOrEditor(GameManager.instance.gameMode))
			{
				if (m_LocalSettings.Settings.CityServicesEnabled && !((EntityQuery)(ref m_UpdateCityServicesJobQuery)).IsEmptyIgnoreFilter)
				{
					UpdateCityBuildings();
				}
				if (m_LocalSettings.Settings.SpawnablesEnabled && m_LocalSettings.Settings.CommercialsEnabled && !((EntityQuery)(ref m_UpdateCommercialBuildingsQuery)).IsEmptyIgnoreFilter)
				{
					UpdateCommercialBuildings();
				}
				if (m_LocalSettings.Settings.SpawnablesEnabled && m_LocalSettings.Settings.IndustriesEnabled && !((EntityQuery)(ref m_UpdateIndustryBuildingsQuery)).IsEmptyIgnoreFilter)
				{
					UpdateIndustryBuildings();
				}
				if (m_LocalSettings.Settings.OfficesEnabled && !((EntityQuery)(ref m_UpdateHighOfficesJobQuery)).IsEmptyIgnoreFilter)
				{
					UpdateHighOffices();
				}
			}
		}

		protected override void OnDestroy()
		{
			((GameSystemBase)this).OnDestroy();
			Debug.Log((object)"[RealisticDensity] System destroyed.");
		}

		private void UpdateCityBuildings()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0069: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: 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_01d8: Unknown result type (might be due to invalid IL or missing references)
			Mod.DebugLog("Run UpdateCityServicesJob");
			m_UpdateCityServicesJobTypeHandle.AssignHandles(ref ((SystemBase)this).CheckedStateRef);
			UpdateCityServicesJob updateCityServicesJob = default(UpdateCityServicesJob);
			EntityCommandBuffer val = ((SafeCommandBufferSystem)Barrier).CreateCommandBuffer();
			updateCityServicesJob.Ecb = ((EntityCommandBuffer)(ref val)).AsParallelWriter();
			updateCityServicesJob.EntityTypeHandle = m_UpdateCityServicesJobTypeHandle.EntityTypeHandle;
			updateCityServicesJob.BuildingDataLookup = m_UpdateCityServicesJobTypeHandle.BuildingDataLookup;
			updateCityServicesJob.WorkplaceDataLookup = m_UpdateCityServicesJobTypeHandle.WorkplaceDataLookup;
			updateCityServicesJob.PowerPlantDataLookup = m_UpdateCityServicesJobTypeHandle.PowerPlantDataLookup;
			updateCityServicesJob.SchoolDataLookup = m_UpdateCityServicesJobTypeHandle.SchoolDataLookup;
			updateCityServicesJob.HospitalDataLookup = m_UpdateCityServicesJobTypeHandle.HospitalDataLookup;
			updateCityServicesJob.PoliceStationDataLookup = m_UpdateCityServicesJobTypeHandle.PoliceStationDataLookup;
			updateCityServicesJob.PrisonDataLookup = m_UpdateCityServicesJobTypeHandle.PrisonDataLookup;
			updateCityServicesJob.FireStationDataLookup = m_UpdateCityServicesJobTypeHandle.FireStationDataLookup;
			updateCityServicesJob.CargoTransportStationDataLookup = m_UpdateCityServicesJobTypeHandle.CargoTransportStationDataLookup;
			updateCityServicesJob.TransportDepotDataLookup = m_UpdateCityServicesJobTypeHandle.TransportDepotDataLookup;
			updateCityServicesJob.GarbageFacilityDataLookup = m_UpdateCityServicesJobTypeHandle.GarbageFacilityDataLookup;
			updateCityServicesJob.DeathcareFacilityDataLookup = m_UpdateCityServicesJobTypeHandle.DeathcareFacilityDataLookup;
			updateCityServicesJob.PublicTransportStationDataLookup = m_UpdateCityServicesJobTypeHandle.PublicTransportStationDataLookup;
			updateCityServicesJob.MaintenanceDepotDataLookup = m_UpdateCityServicesJobTypeHandle.MaintenanceDepotDataLookup;
			updateCityServicesJob.PostFacilityDataLookup = m_UpdateCityServicesJobTypeHandle.PostFacilityDataLookup;
			updateCityServicesJob.AdminBuildingDataLookup = m_UpdateCityServicesJobTypeHandle.AdminBuildingDataLookup;
			updateCityServicesJob.WelfareOfficeDataLookup = m_UpdateCityServicesJobTypeHandle.WelfareOfficeDataLookup;
			updateCityServicesJob.ResearchFacilityDataLookup = m_UpdateCityServicesJobTypeHandle.ResearchFacilityDataLookup;
			updateCityServicesJob.TelecomFacilityDataLookup = m_UpdateCityServicesJobTypeHandle.TelecomFacilityDataLookup;
			updateCityServicesJob.ParkDataLookup = m_UpdateCityServicesJobTypeHandle.ParkDataLookup;
			UpdateCityServicesJob updateCityServicesJob2 = updateCityServicesJob;
			((SystemBase)this).Dependency = JobChunkExtensions.Schedule<UpdateCityServicesJob>(updateCityServicesJob2, m_UpdateCityServicesJobQuery, ((SystemBase)this).Dependency);
			((EntityCommandBufferSystem)Barrier).AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		private void UpdateCommercialBuildings()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0023: 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_0034: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00cd: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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)
			Mod.DebugLog("Run UpdateCommercialBuildingsJob");
			BuildingData val = default(BuildingData);
			val.m_LotSize = new int2(100, 10);
			BuildingData buildingData = val;
			SpawnableBuildingData val2 = default(SpawnableBuildingData);
			val2.m_Level = 1;
			SpawnableBuildingData spawnableBuildingData = val2;
			m_UpdateCommercialBuildingsTypeHandle.AssignHandles(ref ((SystemBase)this).CheckedStateRef);
			UpdateCommercialBuildingsJob updateCommercialBuildingsJob = default(UpdateCommercialBuildingsJob);
			EntityCommandBuffer val3 = ((SafeCommandBufferSystem)Barrier).CreateCommandBuffer();
			updateCommercialBuildingsJob.Ecb = ((EntityCommandBuffer)(ref val3)).AsParallelWriter();
			updateCommercialBuildingsJob.EntityHandle = m_UpdateCommercialBuildingsTypeHandle.EntityTypeHandle;
			updateCommercialBuildingsJob.WorkplaceDataLookup = m_UpdateCommercialBuildingsTypeHandle.WorkplaceDataLookup;
			updateCommercialBuildingsJob.ServiceCompanyDataLookup = m_UpdateCommercialBuildingsTypeHandle.ServiceCompanyDataLookup;
			updateCommercialBuildingsJob.IndustrialProcessDataLookup = m_UpdateCommercialBuildingsTypeHandle.IndustrialProcessDataLookup;
			updateCommercialBuildingsJob.ResourceDataLookup = m_UpdateCommercialBuildingsTypeHandle.ResourceDataLookup;
			updateCommercialBuildingsJob.EconomyParameterData = ((EntityQuery)(ref m_EconomyParameterQuery)).GetSingleton<EconomyParameterData>();
			updateCommercialBuildingsJob.ResourcePrefabs = m_ResourcePrefabs;
			updateCommercialBuildingsJob.BuildingData = buildingData;
			updateCommercialBuildingsJob.SpawnableBuildingData = spawnableBuildingData;
			UpdateCommercialBuildingsJob updateCommercialBuildingsJob2 = updateCommercialBuildingsJob;
			((SystemBase)this).Dependency = JobChunkExtensions.Schedule<UpdateCommercialBuildingsJob>(updateCommercialBuildingsJob2, m_UpdateCommercialBuildingsQuery, ((SystemBase)this).Dependency);
			((EntityCommandBufferSystem)Barrier).AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		private void UpdateIndustryBuildings()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0023: 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_0034: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00cd: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			Mod.DebugLog("Run UpdateIndustryBuildingsJob");
			BuildingData val = default(BuildingData);
			val.m_LotSize = new int2(100, 10);
			BuildingData buildingData = val;
			SpawnableBuildingData val2 = default(SpawnableBuildingData);
			val2.m_Level = 1;
			SpawnableBuildingData spawnableBuildingData = val2;
			m_UpdateIndustryBuildingsTypeHandle.AssignHandles(ref ((SystemBase)this).CheckedStateRef);
			UpdateIndustryBuildingsJob updateIndustryBuildingsJob = default(UpdateIndustryBuildingsJob);
			EntityCommandBuffer val3 = ((SafeCommandBufferSystem)Barrier).CreateCommandBuffer();
			updateIndustryBuildingsJob.Ecb = ((EntityCommandBuffer)(ref val3)).AsParallelWriter();
			updateIndustryBuildingsJob.EntityHandle = m_UpdateIndustryBuildingsTypeHandle.EntityTypeHandle;
			updateIndustryBuildingsJob.WorkplaceDataLookup = m_UpdateIndustryBuildingsTypeHandle.WorkplaceDataLookup;
			updateIndustryBuildingsJob.IndustrialProcessDataLookup = m_UpdateIndustryBuildingsTypeHandle.IndustrialProcessDataLookup;
			updateIndustryBuildingsJob.ExtractorCompanyDataLookup = m_UpdateIndustryBuildingsTypeHandle.ExtractorCompanyDataLookup;
			updateIndustryBuildingsJob.StorageLimitDataLookup = m_UpdateIndustryBuildingsTypeHandle.StorageLimitDataLookup;
			updateIndustryBuildingsJob.TransportCompanyDataLookup = m_UpdateIndustryBuildingsTypeHandle.TransportCompanyDataLookup;
			updateIndustryBuildingsJob.ResourceDataLookup = m_UpdateIndustryBuildingsTypeHandle.ResourceDataLookup;
			updateIndustryBuildingsJob.EconomyParameterData = ((EntityQuery)(ref m_EconomyParameterQuery)).GetSingleton<EconomyParameterData>();
			updateIndustryBuildingsJob.ResourcePrefabs = m_ResourcePrefabs;
			updateIndustryBuildingsJob.BuildingData = buildingData;
			updateIndustryBuildingsJob.SpawnableBuildingData = spawnableBuildingData;
			UpdateIndustryBuildingsJob updateIndustryBuildingsJob2 = updateIndustryBuildingsJob;
			((SystemBase)this).Dependency = JobChunkExtensions.Schedule<UpdateIndustryBuildingsJob>(updateIndustryBuildingsJob2, m_UpdateIndustryBuildingsQuery, ((SystemBase)this).Dependency);
			((EntityCommandBufferSystem)Barrier).AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		private void UpdateHighOffices()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_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_0071: 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)
			Mod.DebugLog("Run UpdateHighOfficesJob");
			m_UpdateHighOfficesJobTypeHandle.AssignHandles(ref ((SystemBase)this).CheckedStateRef);
			UpdateHighOfficesJob updateHighOfficesJob = default(UpdateHighOfficesJob);
			EntityCommandBuffer val = ((SafeCommandBufferSystem)Barrier).CreateCommandBuffer();
			updateHighOfficesJob.Ecb = ((EntityCommandBuffer)(ref val)).AsParallelWriter();
			updateHighOfficesJob.EntityHandle = m_UpdateHighOfficesJobTypeHandle.EntityTypeHandle;
			updateHighOfficesJob.BuildingPropertyDataLookup = m_UpdateHighOfficesJobTypeHandle.BuildingPropertyDataLookup;
			UpdateHighOfficesJob updateHighOfficesJob2 = updateHighOfficesJob;
			((SystemBase)this).Dependency = JobChunkExtensions.Schedule<UpdateHighOfficesJob>(updateHighOfficesJob2, m_UpdateHighOfficesJobQuery, ((SystemBase)this).Dependency);
			((EntityCommandBufferSystem)Barrier).AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		private void LoadSettings()
		{
			try
			{
				m_LocalSettings = new LocalSettings();
				m_LocalSettings.Init();
				m_LocalSettingsLoaded = true;
			}
			catch (Exception ex)
			{
				Debug.Log((object)("[RealisticDensity] Error loading settings: " + ex.Message));
			}
		}
	}
	public static class WorkforceFactors
	{
		public static Factor4 Commercial = new Factor4(1f, 1.5f, 2f, 3f);

		public static Factor4 Office = new Factor4(1f, 1.7f, 2.2f, 3f);

		public static Factor4 IndustryExtractor = new Factor4(1f, 1.5f, 2f, 3f);

		public static Factor4 IndustrySelling = new Factor4(1f, 1.4f, 2f, 3f);

		public static Factor4 IndustryProcessing = new Factor4(1f, 1.5f, 2f, 3f);

		public static Factor4 PowerPlant = new Factor4(1f, 4f, 8f, 10f);

		public static Factor4 School = new Factor4(1f, 3f, 5f, 7f);

		public static Factor4 Hospital = new Factor4(1f, 2f, 4f, 6f);

		public static Factor4 PoliceStation = new Factor4(1f, 1.5f, 2f, 4f);

		public static Factor4 Prison = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 FireStation = new Factor4(1f, 1.5f, 2f, 4f);

		public static Factor4 CargoTransportStation = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 TransportDepot = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 MaintenanceDepot = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 GarbageFacility = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 DeathcareFacility = new Factor4(1f, 1.5f, 2f, 3f);

		public static Factor4 PublicTransportStation = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 PostFacility = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 AdminBuilding = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 WelfareOffice = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 ResearchFacility = new Factor4(1f, 2f, 3f, 4f);

		public static Factor4 TelecomFacility = new Factor4(1f, 1.5f, 2f, 3f);

		public static Factor4 ParkData = new Factor4(1f, 1.5f, 2f, 3f);
	}
}
namespace RealisticDensity.Settings
{
	public class LocalSettings
	{
		private RealisticDensitySettings m_Settings;

		public RealisticDensitySettings Settings => m_Settings;

		public void Init()
		{
			Load();
		}

		public void Reload()
		{
			Load();
		}

		public async Task Save()
		{
			string? directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string path = "UserSettings.json";
			string path2 = Path.Combine(directoryName, path);
			try
			{
				string value = JsonConvert.SerializeObject((object)m_Settings);
				using StreamWriter writer = new StreamWriter(path2, append: false, Encoding.UTF8);
				await writer.WriteAsync(value);
			}
			catch (Exception ex)
			{
				Debug.Log((object)("Error saving settings: " + ex.Message));
			}
		}

		private void Load()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string path = "UserSettings.json";
			string text = Path.Combine(directoryName, path);
			if (!File.Exists(text))
			{
				Debug.Log((object)"No user settings found. Use default settings.");
				text = Path.Combine(directoryName, "DefaultSettings.json");
				if (!File.Exists(text))
				{
					Debug.Log((object)("Error loading settings: " + text + " does not exist."));
					return;
				}
			}
			else
			{
				Debug.Log((object)"User settings successfully loaded.");
			}
			try
			{
				RealisticDensitySettings realisticDensitySettings = JsonConvert.DeserializeObject<RealisticDensitySettings>(File.ReadAllText(text));
				if (realisticDensitySettings != null)
				{
					m_Settings = realisticDensitySettings;
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)("Error loading settings: " + ex.Message));
			}
		}
	}
	public class RealisticDensitySettings
	{
		public string Version { get; } = "0.14.1";


		public bool DisableMod { get; set; }

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


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


		public float CommercialsFactor { get; set; } = WorkforceFactors.Commercial.Medium;


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


		public float OfficesFactor { get; set; } = WorkforceFactors.Office.Medium;


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


		public float IndustryExtractorFactor { get; set; } = WorkforceFactors.IndustryExtractor.Medium;


		public float IndustryProcessingFactor { get; set; } = WorkforceFactors.IndustryProcessing.Medium;


		public float IndustrySellingFactor { get; set; } = WorkforceFactors.IndustrySelling.Medium;


		public bool IndustryIncreaseStorageCapacity { get; set; }

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


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

	}
}
namespace RealisticDensity.Prefabs
{
	public struct DefaultData : IComponentData, IQueryTypeParameter, ISerializable
	{
		public int version;

		public int workplaceData_MaxWorkers;

		public float industrialProcessData_MaxWorkersPerCell;

		public int industrialProcessData_WorkPerUnit;

		public int industrialProcessData_Output_Amount;

		public float buildingPropertyData_SpaceMultiplier;

		public int storageLimitData_limit;

		public int transportCompanyData_MaxTransports;

		public float serviceCompanyData_MaxWorkersPerCell;

		public int serviceCompanyData_WorkPerUnit;

		public DefaultData()
		{
			workplaceData_MaxWorkers = 0;
			industrialProcessData_MaxWorkersPerCell = 0f;
			industrialProcessData_WorkPerUnit = 0;
			industrialProcessData_Output_Amount = 0;
			buildingPropertyData_SpaceMultiplier = 0f;
			storageLimitData_limit = 0;
			transportCompanyData_MaxTransports = 0;
			serviceCompanyData_MaxWorkersPerCell = 0f;
			serviceCompanyData_WorkPerUnit = 0;
			version = RealisticDensitySystem.kComponentVersion;
		}

		public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
		{
			((IWriter)writer).Write(version);
			((IWriter)writer).Write(workplaceData_MaxWorkers);
			((IWriter)writer).Write(industrialProcessData_MaxWorkersPerCell);
			((IWriter)writer).Write(industrialProcessData_WorkPerUnit);
			((IWriter)writer).Write(industrialProcessData_Output_Amount);
			((IWriter)writer).Write(buildingPropertyData_SpaceMultiplier);
			((IWriter)writer).Write(storageLimitData_limit);
			((IWriter)writer).Write(transportCompanyData_MaxTransports);
			((IWriter)writer).Write(serviceCompanyData_MaxWorkersPerCell);
			((IWriter)writer).Write(serviceCompanyData_WorkPerUnit);
		}

		public void Deserialize<TReader>(TReader reader) where TReader : IReader
		{
			((IReader)reader).Read(ref version);
			((IReader)reader).Read(ref workplaceData_MaxWorkers);
			((IReader)reader).Read(ref industrialProcessData_MaxWorkersPerCell);
			((IReader)reader).Read(ref industrialProcessData_WorkPerUnit);
			((IReader)reader).Read(ref industrialProcessData_Output_Amount);
			((IReader)reader).Read(ref buildingPropertyData_SpaceMultiplier);
			((IReader)reader).Read(ref storageLimitData_limit);
			((IReader)reader).Read(ref transportCompanyData_MaxTransports);
			((IReader)reader).Read(ref serviceCompanyData_MaxWorkersPerCell);
			((IReader)reader).Read(ref serviceCompanyData_WorkPerUnit);
		}
	}
}
namespace RealisticDensity.Patches
{
	[HarmonyPatch(typeof(SystemOrder))]
	internal class SystemOrderPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(SystemOrder), "Initialize")]
		public static void GetSystemOrder(UpdateSystem updateSystem)
		{
			if (updateSystem != null)
			{
				updateSystem.UpdateAt<RealisticDensitySystem>((SystemUpdatePhase)9);
			}
		}
	}
}
namespace RealisticDensity.Jobs
{
	public struct UpdateCityServicesQuery
	{
		public EntityQueryDesc[] Query;

		public UpdateCityServicesQuery()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0018: 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_0024: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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)
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.ReadOnly<WorkplaceData>(),
				ComponentType.ReadOnly<BuildingData>(),
				ComponentType.ReadOnly<ServiceObjectData>()
			};
			val.Any = (ComponentType[])(object)new ComponentType[18]
			{
				ComponentType.ReadOnly<PowerPlantData>(),
				ComponentType.ReadOnly<SchoolData>(),
				ComponentType.ReadOnly<HospitalData>(),
				ComponentType.ReadOnly<PoliceStationData>(),
				ComponentType.ReadOnly<PrisonData>(),
				ComponentType.ReadOnly<FireStationData>(),
				ComponentType.ReadOnly<CargoTransportStationData>(),
				ComponentType.ReadOnly<TransportDepotData>(),
				ComponentType.ReadOnly<GarbageFacilityData>(),
				ComponentType.ReadOnly<DeathcareFacilityData>(),
				ComponentType.ReadOnly<PublicTransportStationData>(),
				ComponentType.ReadOnly<MaintenanceDepotData>(),
				ComponentType.ReadOnly<PostFacilityData>(),
				ComponentType.ReadOnly<AdminBuildingData>(),
				ComponentType.ReadOnly<WelfareOfficeData>(),
				ComponentType.ReadOnly<ResearchFacilityData>(),
				ComponentType.ReadOnly<TelecomFacilityData>(),
				ComponentType.ReadOnly<ParkData>()
			};
			val.None = (ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.Exclude<DefaultData>(),
				ComponentType.Exclude<Deleted>(),
				ComponentType.Exclude<Temp>()
			};
			array[0] = val;
			Query = (EntityQueryDesc[])(object)array;
		}
	}
	public struct UpdateCityServicesTypeHandle
	{
		[ReadOnly]
		public EntityTypeHandle EntityTypeHandle;

		public ComponentLookup<BuildingData> BuildingDataLookup;

		public ComponentLookup<WorkplaceData> WorkplaceDataLookup;

		public ComponentLookup<PowerPlantData> PowerPlantDataLookup;

		public ComponentLookup<SchoolData> SchoolDataLookup;

		public ComponentLookup<HospitalData> HospitalDataLookup;

		public ComponentLookup<PoliceStationData> PoliceStationDataLookup;

		public ComponentLookup<PrisonData> PrisonDataLookup;

		public ComponentLookup<FireStationData> FireStationDataLookup;

		public ComponentLookup<CargoTransportStationData> CargoTransportStationDataLookup;

		public ComponentLookup<TransportDepotData> TransportDepotDataLookup;

		public ComponentLookup<GarbageFacilityData> GarbageFacilityDataLookup;

		public ComponentLookup<DeathcareFacilityData> DeathcareFacilityDataLookup;

		public ComponentLookup<PublicTransportStationData> PublicTransportStationDataLookup;

		public ComponentLookup<MaintenanceDepotData> MaintenanceDepotDataLookup;

		public ComponentLookup<PostFacilityData> PostFacilityDataLookup;

		public ComponentLookup<AdminBuildingData> AdminBuildingDataLookup;

		public ComponentLookup<WelfareOfficeData> WelfareOfficeDataLookup;

		public ComponentLookup<ResearchFacilityData> ResearchFacilityDataLookup;

		public ComponentLookup<TelecomFacilityData> TelecomFacilityDataLookup;

		public ComponentLookup<ParkData> ParkDataLookup;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void AssignHandles(ref SystemState state)
		{
			//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_000f: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//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_0050: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			EntityTypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
			BuildingDataLookup = ((SystemState)(ref state)).GetComponentLookup<BuildingData>(false);
			WorkplaceDataLookup = ((SystemState)(ref state)).GetComponentLookup<WorkplaceData>(false);
			PowerPlantDataLookup = ((SystemState)(ref state)).GetComponentLookup<PowerPlantData>(false);
			SchoolDataLookup = ((SystemState)(ref state)).GetComponentLookup<SchoolData>(false);
			HospitalDataLookup = ((SystemState)(ref state)).GetComponentLookup<HospitalData>(false);
			PoliceStationDataLookup = ((SystemState)(ref state)).GetComponentLookup<PoliceStationData>(false);
			PrisonDataLookup = ((SystemState)(ref state)).GetComponentLookup<PrisonData>(false);
			FireStationDataLookup = ((SystemState)(ref state)).GetComponentLookup<FireStationData>(false);
			CargoTransportStationDataLookup = ((SystemState)(ref state)).GetComponentLookup<CargoTransportStationData>(false);
			TransportDepotDataLookup = ((SystemState)(ref state)).GetComponentLookup<TransportDepotData>(false);
			GarbageFacilityDataLookup = ((SystemState)(ref state)).GetComponentLookup<GarbageFacilityData>(false);
			DeathcareFacilityDataLookup = ((SystemState)(ref state)).GetComponentLookup<DeathcareFacilityData>(false);
			PublicTransportStationDataLookup = ((SystemState)(ref state)).GetComponentLookup<PublicTransportStationData>(false);
			MaintenanceDepotDataLookup = ((SystemState)(ref state)).GetComponentLookup<MaintenanceDepotData>(false);
			PostFacilityDataLookup = ((SystemState)(ref state)).GetComponentLookup<PostFacilityData>(false);
			AdminBuildingDataLookup = ((SystemState)(ref state)).GetComponentLookup<AdminBuildingData>(false);
			WelfareOfficeDataLookup = ((SystemState)(ref state)).GetComponentLookup<WelfareOfficeData>(false);
			ResearchFacilityDataLookup = ((SystemState)(ref state)).GetComponentLookup<ResearchFacilityData>(false);
			TelecomFacilityDataLookup = ((SystemState)(ref state)).GetComponentLookup<TelecomFacilityData>(false);
			ParkDataLookup = ((SystemState)(ref state)).GetComponentLookup<ParkData>(false);
		}
	}
	public struct UpdateCityServicesJob : IJobChunk
	{
		public ParallelWriter Ecb;

		public EntityTypeHandle EntityTypeHandle;

		public ComponentLookup<BuildingData> BuildingDataLookup;

		public ComponentLookup<WorkplaceData> WorkplaceDataLookup;

		public ComponentLookup<PowerPlantData> PowerPlantDataLookup;

		public ComponentLookup<SchoolData> SchoolDataLookup;

		public ComponentLookup<HospitalData> HospitalDataLookup;

		public ComponentLookup<PoliceStationData> PoliceStationDataLookup;

		public ComponentLookup<PrisonData> PrisonDataLookup;

		public ComponentLookup<FireStationData> FireStationDataLookup;

		public ComponentLookup<CargoTransportStationData> CargoTransportStationDataLookup;

		public ComponentLookup<TransportDepotData> TransportDepotDataLookup;

		public ComponentLookup<GarbageFacilityData> GarbageFacilityDataLookup;

		public ComponentLookup<DeathcareFacilityData> DeathcareFacilityDataLookup;

		public ComponentLookup<PublicTransportStationData> PublicTransportStationDataLookup;

		public ComponentLookup<MaintenanceDepotData> MaintenanceDepotDataLookup;

		public ComponentLookup<PostFacilityData> PostFacilityDataLookup;

		public ComponentLookup<AdminBuildingData> AdminBuildingDataLookup;

		public ComponentLookup<WelfareOfficeData> WelfareOfficeDataLookup;

		public ComponentLookup<ResearchFacilityData> ResearchFacilityDataLookup;

		public ComponentLookup<TelecomFacilityData> TelecomFacilityDataLookup;

		public ComponentLookup<ParkData> ParkDataLookup;

		public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(EntityTypeHandle);
			ChunkEntityEnumerator val = default(ChunkEntityEnumerator);
			((ChunkEntityEnumerator)(ref val))..ctor(useEnabledMask, chunkEnabledMask, ((ArchetypeChunk)(ref chunk)).Count);
			int num = default(int);
			WorkplaceData workplaceData = default(WorkplaceData);
			while (((ChunkEntityEnumerator)(ref val)).NextEntityIndex(ref num))
			{
				Entity val2 = nativeArray[num];
				if (WorkplaceDataLookup.TryGetComponent(val2, ref workplaceData))
				{
					UpdateWorkplaceData(val2, workplaceData, num);
				}
			}
		}

		private void UpdateWorkplaceData(Entity entity, WorkplaceData workplaceData, int entityIndex)
		{
			//IL_000d: 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_001f: 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_0025: 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_002e: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00d7: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_010b: 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_00ea: 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_00f8: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_012c: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: 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_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			DefaultData defaultData = new DefaultData();
			if (PowerPlantDataLookup.HasComponent(entity))
			{
				WorkplaceData val = DensityHelper.UpdateWorkplaceData(WorkforceFactors.PowerPlant.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val);
			}
			else if (SchoolDataLookup.HasComponent(entity))
			{
				WorkplaceData val2 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.School.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val2);
			}
			else if (HospitalDataLookup.HasComponent(entity))
			{
				WorkplaceData val3 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.Hospital.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val3);
			}
			else if (PoliceStationDataLookup.HasComponent(entity))
			{
				WorkplaceData val4 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.PoliceStation.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val4);
			}
			else if (PrisonDataLookup.HasComponent(entity))
			{
				WorkplaceData val5 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.Prison.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val5);
			}
			else if (FireStationDataLookup.HasComponent(entity))
			{
				WorkplaceData val6 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.FireStation.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val6);
			}
			else if (CargoTransportStationDataLookup.HasComponent(entity))
			{
				WorkplaceData val7 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.CargoTransportStation.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val7);
			}
			else if (TransportDepotDataLookup.HasComponent(entity))
			{
				WorkplaceData val8 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.TransportDepot.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val8);
			}
			else if (GarbageFacilityDataLookup.HasComponent(entity))
			{
				WorkplaceData val9 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.GarbageFacility.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val9);
			}
			else if (DeathcareFacilityDataLookup.HasComponent(entity))
			{
				WorkplaceData val10 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.DeathcareFacility.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val10);
			}
			else if (PublicTransportStationDataLookup.HasComponent(entity))
			{
				WorkplaceData val11 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.PublicTransportStation.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val11);
			}
			else if (MaintenanceDepotDataLookup.HasComponent(entity))
			{
				WorkplaceData val12 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.MaintenanceDepot.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val12);
			}
			else if (PostFacilityDataLookup.HasComponent(entity))
			{
				WorkplaceData val13 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.PostFacility.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val13);
			}
			else if (AdminBuildingDataLookup.HasComponent(entity))
			{
				WorkplaceData val14 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.AdminBuilding.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val14);
			}
			else if (WelfareOfficeDataLookup.HasComponent(entity))
			{
				WorkplaceData val15 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.WelfareOffice.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val15);
			}
			else if (ResearchFacilityDataLookup.HasComponent(entity))
			{
				WorkplaceData val16 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.ResearchFacility.Medium, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val16);
			}
			else if (TelecomFacilityDataLookup.HasComponent(entity))
			{
				BuildingData val17 = BuildingDataLookup[entity];
				float num = math.max(1, val17.m_LotSize.y * val17.m_LotSize.x / 100);
				WorkplaceData val18 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.TelecomFacility.Medium * num, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val18);
			}
			else if (ParkDataLookup.HasComponent(entity))
			{
				BuildingData val19 = BuildingDataLookup[entity];
				float num2 = math.max(1, val19.m_LotSize.y * val19.m_LotSize.x / 100);
				WorkplaceData val20 = DensityHelper.UpdateWorkplaceData(WorkforceFactors.ParkData.Medium * num2, workplaceData);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(entityIndex, entity, val20);
			}
			defaultData.workplaceData_MaxWorkers = workplaceData.m_MaxWorkers;
			((ParallelWriter)(ref Ecb)).AddComponent<DefaultData>(entityIndex, entity, defaultData);
		}

		void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
		{
			Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
		}
	}
	internal struct UpdateCommercialBuildingsQuery
	{
		public EntityQueryDesc[] Query;

		public UpdateCommercialBuildingsQuery()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0018: 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_0024: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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)
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[4]
			{
				ComponentType.ReadOnly<PrefabData>(),
				ComponentType.ReadOnly<WorkplaceData>(),
				ComponentType.ReadOnly<ServiceCompanyData>(),
				ComponentType.ReadOnly<CommercialCompanyData>()
			};
			val.None = (ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.Exclude<DefaultData>(),
				ComponentType.Exclude<Deleted>(),
				ComponentType.Exclude<Temp>()
			};
			array[0] = val;
			Query = (EntityQueryDesc[])(object)array;
		}
	}
	public struct UpdateCommercialBuildingsTypeHandle
	{
		[ReadOnly]
		public EntityTypeHandle EntityTypeHandle;

		public ComponentLookup<WorkplaceData> WorkplaceDataLookup;

		public ComponentLookup<ServiceCompanyData> ServiceCompanyDataLookup;

		public ComponentLookup<IndustrialProcessData> IndustrialProcessDataLookup;

		public ComponentLookup<ResourceData> ResourceDataLookup;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void AssignHandles(ref SystemState state)
		{
			//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_000f: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			EntityTypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
			WorkplaceDataLookup = ((SystemState)(ref state)).GetComponentLookup<WorkplaceData>(false);
			ServiceCompanyDataLookup = ((SystemState)(ref state)).GetComponentLookup<ServiceCompanyData>(false);
			IndustrialProcessDataLookup = ((SystemState)(ref state)).GetComponentLookup<IndustrialProcessData>(false);
			ResourceDataLookup = ((SystemState)(ref state)).GetComponentLookup<ResourceData>(false);
		}
	}
	public struct UpdateCommercialBuildingsJob : IJobChunk
	{
		public ParallelWriter Ecb;

		public EntityTypeHandle EntityHandle;

		public ComponentLookup<WorkplaceData> WorkplaceDataLookup;

		public ComponentLookup<ServiceCompanyData> ServiceCompanyDataLookup;

		public ComponentLookup<IndustrialProcessData> IndustrialProcessDataLookup;

		public ComponentLookup<ResourceData> ResourceDataLookup;

		public EconomyParameterData EconomyParameterData;

		public ResourcePrefabs ResourcePrefabs;

		public BuildingData BuildingData;

		public SpawnableBuildingData SpawnableBuildingData;

		public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0089: 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_0090: 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_009b: 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_00a4: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(EntityHandle);
			ChunkEntityEnumerator val = default(ChunkEntityEnumerator);
			((ChunkEntityEnumerator)(ref val))..ctor(useEnabledMask, chunkEnabledMask, ((ArchetypeChunk)(ref chunk)).Count);
			World defaultGameObjectInjectionWorld = World.DefaultGameObjectInjectionWorld;
			PrefabSystem val2 = ((defaultGameObjectInjectionWorld != null) ? defaultGameObjectInjectionWorld.GetOrCreateSystemManaged<PrefabSystem>() : null);
			int num = default(int);
			while (((ChunkEntityEnumerator)(ref val)).NextEntityIndex(ref num))
			{
				Entity val3 = nativeArray[num];
				DefaultData defaultData = new DefaultData();
				CompanyPrefab prefab = val2.GetPrefab<CompanyPrefab>(val3);
				WorkplaceData val4 = WorkplaceDataLookup[val3];
				ServiceCompanyData val5 = ServiceCompanyDataLookup[val3];
				float medium = WorkforceFactors.Commercial.Medium;
				WorkplaceData val6 = DensityHelper.UpdateWorkplaceData(medium, val4);
				((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(num, val3, val6);
				ServiceCompanyData val7 = val5;
				defaultData.serviceCompanyData_MaxWorkersPerCell = val5.m_MaxWorkersPerCell;
				val7.m_MaxWorkersPerCell += DensityHelper.MaxWorkersPerCellIncrease(medium, val5.m_MaxWorkersPerCell);
				defaultData.serviceCompanyData_WorkPerUnit = val5.m_WorkPerUnit;
				val7.m_WorkPerUnit = DensityHelper.WorkPerUnitForCommercial(prefab, IndustrialProcessDataLookup[val3], val7, val6, ResourcePrefabs, ResourceDataLookup, EconomyParameterData, BuildingData, SpawnableBuildingData);
				((ParallelWriter)(ref Ecb)).SetComponent<ServiceCompanyData>(num, val3, val7);
				defaultData.workplaceData_MaxWorkers = val4.m_MaxWorkers;
				((ParallelWriter)(ref Ecb)).AddComponent<DefaultData>(num, val3, defaultData);
			}
		}

		void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
		{
			Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
		}
	}
	internal struct UpdateHighOfficesQuery
	{
		public EntityQueryDesc[] Query;

		public UpdateHighOfficesQuery()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0018: 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_0024: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//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_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)
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[5]
			{
				ComponentType.ReadOnly<SpawnableBuildingData>(),
				ComponentType.ReadOnly<BuildingData>(),
				ComponentType.ReadOnly<PrefabData>(),
				ComponentType.ReadOnly<BuildingPropertyData>(),
				ComponentType.ReadOnly<OfficeBuilding>()
			};
			val.None = (ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.Exclude<DefaultData>(),
				ComponentType.Exclude<Deleted>(),
				ComponentType.Exclude<Temp>()
			};
			array[0] = val;
			Query = (EntityQueryDesc[])(object)array;
		}
	}
	public struct UpdateHighOfficesTypeHandle
	{
		[ReadOnly]
		public EntityTypeHandle EntityTypeHandle;

		public ComponentLookup<BuildingPropertyData> BuildingPropertyDataLookup;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void AssignHandles(ref SystemState state)
		{
			//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_000f: 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)
			EntityTypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
			BuildingPropertyDataLookup = ((SystemState)(ref state)).GetComponentLookup<BuildingPropertyData>(false);
		}
	}
	public struct UpdateHighOfficesJob : IJobChunk
	{
		public ParallelWriter Ecb;

		public EntityTypeHandle EntityHandle;

		public ComponentLookup<BuildingPropertyData> BuildingPropertyDataLookup;

		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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//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_0051: 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)
			//IL_0061: 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_0083: 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)
			RealisticDensitySettings settings = RealisticDensitySystem.Settings;
			NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(EntityHandle);
			ChunkEntityEnumerator val = default(ChunkEntityEnumerator);
			((ChunkEntityEnumerator)(ref val))..ctor(useEnabledMask, chunkEnabledMask, ((ArchetypeChunk)(ref chunk)).Count);
			int num = default(int);
			while (((ChunkEntityEnumerator)(ref val)).NextEntityIndex(ref num))
			{
				Entity val2 = nativeArray[num];
				DefaultData defaultData = new DefaultData();
				BuildingPropertyData val3 = BuildingPropertyDataLookup[val2];
				float officesFactor = settings.OfficesFactor;
				BuildingPropertyData val4 = val3;
				defaultData.buildingPropertyData_SpaceMultiplier = val3.m_SpaceMultiplier;
				val4.m_SpaceMultiplier *= officesFactor;
				((ParallelWriter)(ref Ecb)).SetComponent<BuildingPropertyData>(num, val2, val4);
				((ParallelWriter)(ref Ecb)).AddComponent<DefaultData>(num, val2, defaultData);
			}
		}

		void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
		{
			Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
		}
	}
	internal struct UpdateIndustryBuildingsQuery
	{
		public EntityQueryDesc[] Query;

		public UpdateIndustryBuildingsQuery()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0018: 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_0024: 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_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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//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_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)
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<WorkplaceData>(),
				ComponentType.ReadOnly<PrefabData>()
			};
			val.Any = (ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<IndustrialProcessData>(),
				ComponentType.ReadOnly<IndustrialCompanyData>()
			};
			val.None = (ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.Exclude<DefaultData>(),
				ComponentType.Exclude<Deleted>(),
				ComponentType.Exclude<Temp>()
			};
			array[0] = val;
			Query = (EntityQueryDesc[])(object)array;
		}
	}
	public struct UpdateIndustryBuildingsTypeHandle
	{
		[ReadOnly]
		public EntityTypeHandle EntityTypeHandle;

		public ComponentLookup<WorkplaceData> WorkplaceDataLookup;

		public ComponentLookup<IndustrialProcessData> IndustrialProcessDataLookup;

		public ComponentLookup<ExtractorCompanyData> ExtractorCompanyDataLookup;

		public ComponentLookup<StorageLimitData> StorageLimitDataLookup;

		public ComponentLookup<TransportCompanyData> TransportCompanyDataLookup;

		public ComponentLookup<ResourceData> ResourceDataLookup;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void AssignHandles(ref SystemState state)
		{
			//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_000f: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//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_0050: 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)
			EntityTypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
			WorkplaceDataLookup = ((SystemState)(ref state)).GetComponentLookup<WorkplaceData>(false);
			IndustrialProcessDataLookup = ((SystemState)(ref state)).GetComponentLookup<IndustrialProcessData>(false);
			ExtractorCompanyDataLookup = ((SystemState)(ref state)).GetComponentLookup<ExtractorCompanyData>(false);
			StorageLimitDataLookup = ((SystemState)(ref state)).GetComponentLookup<StorageLimitData>(false);
			TransportCompanyDataLookup = ((SystemState)(ref state)).GetComponentLookup<TransportCompanyData>(false);
			ResourceDataLookup = ((SystemState)(ref state)).GetComponentLookup<ResourceData>(false);
		}
	}
	public struct UpdateIndustryBuildingsJob : IJobChunk
	{
		public ParallelWriter Ecb;

		public EntityTypeHandle EntityHandle;

		public ComponentLookup<WorkplaceData> WorkplaceDataLookup;

		public ComponentLookup<IndustrialProcessData> IndustrialProcessDataLookup;

		public ComponentLookup<ExtractorCompanyData> ExtractorCompanyDataLookup;

		public ComponentLookup<StorageLimitData> StorageLimitDataLookup;

		public ComponentLookup<TransportCompanyData> TransportCompanyDataLookup;

		public ComponentLookup<ResourceData> ResourceDataLookup;

		public EconomyParameterData EconomyParameterData;

		public ResourcePrefabs ResourcePrefabs;

		public BuildingData BuildingData;

		public SpawnableBuildingData SpawnableBuildingData;

		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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00c9: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_0100: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			RealisticDensitySettings settings = RealisticDensitySystem.Settings;
			NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(EntityHandle);
			ChunkEntityEnumerator val = default(ChunkEntityEnumerator);
			((ChunkEntityEnumerator)(ref val))..ctor(useEnabledMask, chunkEnabledMask, ((ArchetypeChunk)(ref chunk)).Count);
			World defaultGameObjectInjectionWorld = World.DefaultGameObjectInjectionWorld;
			PrefabSystem val2 = ((defaultGameObjectInjectionWorld != null) ? defaultGameObjectInjectionWorld.GetOrCreateSystemManaged<PrefabSystem>() : null);
			int num = default(int);
			StorageLimitData val8 = default(StorageLimitData);
			TransportCompanyData val10 = default(TransportCompanyData);
			while (((ChunkEntityEnumerator)(ref val)).NextEntityIndex(ref num))
			{
				Entity val3 = nativeArray[num];
				CompanyPrefab prefab = val2.GetPrefab<CompanyPrefab>(val3);
				DefaultData defaultData = new DefaultData();
				WorkplaceData val4 = WorkplaceDataLookup[val3];
				IndustrialProcessData val5 = IndustrialProcessDataLookup[val3];
				bool flag = IsOffice(val5);
				bool flag2 = ExtractorCompanyDataLookup.HasComponent(val3);
				if (!flag || settings.OfficesEnabled)
				{
					float num2 = (flag ? settings.OfficesFactor : (flag2 ? settings.IndustryExtractorFactor : settings.IndustryProcessingFactor));
					WorkplaceData val6 = DensityHelper.UpdateWorkplaceData(num2, val4);
					((ParallelWriter)(ref Ecb)).SetComponent<WorkplaceData>(num, val3, val6);
					IndustrialProcessData val7 = val5;
					defaultData.industrialProcessData_MaxWorkersPerCell = val5.m_MaxWorkersPerCell;
					val7.m_MaxWorkersPerCell += DensityHelper.MaxWorkersPerCellIncrease(num2, val5.m_MaxWorkersPerCell);
					defaultData.industrialProcessData_WorkPerUnit = val5.m_WorkPerUnit;
					if (flag2)
					{
						val7.m_WorkPerUnit = DensityHelper.WorkPerUnitForExtractorIndustry(prefab, val7, val6, ResourcePrefabs, ResourceDataLookup, EconomyParameterData, SpawnableBuildingData);
					}
					else
					{
						val7.m_WorkPerUnit = DensityHelper.WorkPerUnitForProcessingIndustry(prefab, val7, val6, ResourcePrefabs, ResourceDataLookup, EconomyParameterData, BuildingData, SpawnableBuildingData);
					}
					((ParallelWriter)(ref Ecb)).SetComponent<IndustrialProcessData>(num, val3, val7);
					if (settings.IndustryIncreaseStorageCapacity && StorageLimitDataLookup.TryGetComponent(val3, ref val8))
					{
						StorageLimitData val9 = val8;
						defaultData.storageLimitData_limit = val8.m_Limit;
						float num3 = DensityHelper.CalculateProductionFactor(num2, val8.m_Limit);
						val9.m_Limit += Mathf.CeilToInt(num3);
						((ParallelWriter)(ref Ecb)).SetComponent<StorageLimitData>(num, val3, val9);
					}
					if (settings.IndustryIncreaseMaxTransports && TransportCompanyDataLookup.TryGetComponent(val3, ref val10))
					{
						TransportCompanyData val11 = val10;
						defaultData.transportCompanyData_MaxTransports = val10.m_MaxTransports;
						float num4 = DensityHelper.CalculateProductionFactor(num2, val10.m_MaxTransports);
						val11.m_MaxTransports += Mathf.CeilToInt(num4);
						((ParallelWriter)(ref Ecb)).SetComponent<TransportCompanyData>(num, val3, val11);
					}
					defaultData.workplaceData_MaxWorkers = val4.m_MaxWorkers;
					((ParallelWriter)(ref Ecb)).AddComponent<DefaultData>(num, val3, defaultData);
				}
			}
			nativeArray.Dispose();
		}

		private readonly bool IsOffice(IndustrialProcessData industrialProcessData)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I8
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I8
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I8
			Resource resource = industrialProcessData.m_Output.m_Resource;
			if ((long)resource == 2097152 || (long)resource == 34359738368L || (long)resource == 68719476736L)
			{
				return true;
			}
			return false;
		}

		void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
		{
			Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
		}
	}
}
namespace RealisticDensity.Helper
{
	internal static class DensityHelper
	{
		public static float CalculateProductionFactor(float factor, float of)
		{
			return of * (factor - 1f) / (float)RealisticDensitySystem.kProductionFactor;
		}

		public static WorkplaceData UpdateWorkplaceData(float factor, WorkplaceData workplaceData)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or mis