Decompiled source of Economy Rebalance v0.2.0

RealEco.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Colossal.Logging;
using Game;
using Game.Agents;
using Game.Buildings;
using Game.Citizens;
using Game.City;
using Game.Common;
using Game.Companies;
using Game.Debug;
using Game.Economy;
using Game.Prefabs;
using Game.Simulation;
using Game.Tools;
using Game.Vehicles;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Burst;
using Unity.Burst.Intrinsics;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Scripting;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RealEco
{
	[CompilerGenerated]
	public class HouseholdBehaviorSystem : GameSystemBase
	{
		private struct ProcessConsumptionJob : IJob
		{
			public NativeQueue<ResourceStack> m_Queue;

			public NativeArray<int> m_ConsumptionAccumulator;

			public NativeQueue<int> m_DebugResourceQueue;

			public NativeArray<int> m_DebugResourceCounter;

			public NativeArray<int> m_DebugResourceCounter2;

			[ReadOnly]
			public ResourcePrefabs m_ResourcePrefabs;

			[ReadOnly]
			public ComponentLookup<ResourceData> m_ResourceDatas;

			public void Execute()
			{
				//IL_0002: 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_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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_004f: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				int2 val = default(int2);
				ResourceStack val2 = default(ResourceStack);
				ref NativeArray<int> consumptionAccumulator;
				while (m_Queue.TryDequeue(ref val2))
				{
					consumptionAccumulator = ref m_ConsumptionAccumulator;
					int resourceIndex = EconomyUtils.GetResourceIndex(val2.m_Resource);
					consumptionAccumulator[resourceIndex] += val2.m_Amount;
					float price = m_ResourceDatas[((ResourcePrefabs)(ref m_ResourcePrefabs))[val2.m_Resource]].m_Price;
					val.x += Mathf.RoundToInt((float)val2.m_Amount * price);
				}
				int num = default(int);
				while (m_DebugResourceQueue.TryDequeue(ref num))
				{
					val.y += num;
				}
				consumptionAccumulator = ref m_DebugResourceCounter;
				consumptionAccumulator[0] = consumptionAccumulator[0] + val.x;
				consumptionAccumulator = ref m_DebugResourceCounter2;
				consumptionAccumulator[0] = consumptionAccumulator[0] + val.y;
			}
		}

		[BurstCompile]
		private struct HouseholdTickJob : IJobChunk
		{
			[ReadOnly]
			public EntityTypeHandle m_EntityType;

			public ComponentTypeHandle<Household> m_HouseholdType;

			public ComponentTypeHandle<HouseholdNeed> m_HouseholdNeedType;

			[ReadOnly]
			public BufferTypeHandle<HouseholdCitizen> m_HouseholdCitizenType;

			public BufferTypeHandle<Resources> m_ResourceType;

			[ReadOnly]
			public SharedComponentTypeHandle<UpdateFrame> m_UpdateFrameType;

			public ComponentTypeHandle<TouristHousehold> m_TouristHouseholdType;

			[ReadOnly]
			public ComponentTypeHandle<CommuterHousehold> m_CommuterHouseholdType;

			[ReadOnly]
			public ComponentTypeHandle<PropertyRenter> m_PropertyRenterType;

			[ReadOnly]
			public ComponentTypeHandle<LodgingSeeker> m_LodgingSeekerType;

			[ReadOnly]
			public ComponentTypeHandle<HomelessHousehold> m_HomelessHouseholdType;

			[ReadOnly]
			public BufferLookup<OwnedVehicle> m_OwnedVehicles;

			[ReadOnly]
			public ComponentLookup<PropertySeeker> m_PropertySeekers;

			[ReadOnly]
			public ComponentLookup<Worker> m_Workers;

			[ReadOnly]
			public ComponentLookup<ResourceData> m_ResourceDatas;

			[ReadOnly]
			public ComponentLookup<LodgingProvider> m_LodgingProviders;

			[ReadOnly]
			public ComponentLookup<HealthProblem> m_HealthProblems;

			[ReadOnly]
			public ComponentLookup<Population> m_Populations;

			[ReadOnly]
			public ComponentLookup<Citizen> m_CitizenDatas;

			[ReadOnly]
			public NativeArray<int> m_TaxRates;

			[ReadOnly]
			public ResourcePrefabs m_ResourcePrefabs;

			public RandomSeed m_RandomSeed;

			public EconomyParameterData m_EconomyParameters;

			public ParallelWriter<ResourceStack> m_ConsumptionQueue;

			public ParallelWriter m_CommandBuffer;

			public uint m_UpdateFrameIndex;

			public int m_BaseConsumptionSum;

			public Entity m_City;

			[NativeDisableContainerSafetyRestriction]
			public ParallelWriter<int> m_DebugWealthQueue;

			public bool m_DebugWealthQueueIsCreated;

			[NativeDisableContainerSafetyRestriction]
			public ParallelWriter<int> m_DebugResourcesQueue;

			public bool m_DebugResourcesQueueIsCreated;

			[NativeDisableContainerSafetyRestriction]
			public ParallelWriter<int> m_DebugConsumptionQueue;

			public bool m_DebugConsumptionQueueIsCreated;

			public ParallelWriter<int> m_DebugResourceQueue;

			private bool NeedsCar(Entity household, int wealth, float commute, int cars)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				if (cars > 0 || wealth < 0)
				{
					return false;
				}
				Random val = new Random((uint)(household.Index + 1));
				int num = ((Random)(ref val)).NextInt(100);
				return (float)math.min(100, wealth / 100) + 0.02f * commute > (float)num;
			}

			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_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_0026: 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_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_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_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: 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_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_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: 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_00ba: 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_00c5: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: 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_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: 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_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: 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_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_022e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0233: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0318: Unknown result type (might be due to invalid IL or missing references)
				//IL_031a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0268: Unknown result type (might be due to invalid IL or missing references)
				//IL_026a: Unknown result type (might be due to invalid IL or missing references)
				//IL_024f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0253: Unknown result type (might be due to invalid IL or missing references)
				//IL_0259: Unknown result type (might be due to invalid IL or missing references)
				//IL_032d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0278: Unknown result type (might be due to invalid IL or missing references)
				//IL_027d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0286: Unknown result type (might be due to invalid IL or missing references)
				//IL_0294: 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_029e: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_034e: Unknown result type (might be due to invalid IL or missing references)
				//IL_033c: Unknown result type (might be due to invalid IL or missing references)
				//IL_033e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0343: Unknown result type (might be due to invalid IL or missing references)
				//IL_054e: 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_0373: 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_0382: Unknown result type (might be due to invalid IL or missing references)
				//IL_0384: Unknown result type (might be due to invalid IL or missing references)
				//IL_0389: Unknown result type (might be due to invalid IL or missing references)
				//IL_059a: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_041e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0423: Unknown result type (might be due to invalid IL or missing references)
				//IL_042c: Unknown result type (might be due to invalid IL or missing references)
				//IL_042e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0434: Unknown result type (might be due to invalid IL or missing references)
				//IL_0442: Unknown result type (might be due to invalid IL or missing references)
				//IL_046b: Unknown result type (might be due to invalid IL or missing references)
				//IL_046d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0472: Unknown result type (might be due to invalid IL or missing references)
				//IL_0483: Unknown result type (might be due to invalid IL or missing references)
				//IL_0485: Unknown result type (might be due to invalid IL or missing references)
				//IL_048a: Unknown result type (might be due to invalid IL or missing references)
				//IL_048f: Unknown result type (might be due to invalid IL or missing references)
				//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04de: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
				if (((ArchetypeChunk)(ref chunk)).GetSharedComponent<UpdateFrame>(m_UpdateFrameType).m_Index != m_UpdateFrameIndex)
				{
					return;
				}
				NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(m_EntityType);
				NativeArray<Household> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Household>(ref m_HouseholdType);
				NativeArray<HouseholdNeed> nativeArray3 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<HouseholdNeed>(ref m_HouseholdNeedType);
				BufferAccessor<HouseholdCitizen> bufferAccessor = ((ArchetypeChunk)(ref chunk)).GetBufferAccessor<HouseholdCitizen>(ref m_HouseholdCitizenType);
				BufferAccessor<Resources> bufferAccessor2 = ((ArchetypeChunk)(ref chunk)).GetBufferAccessor<Resources>(ref m_ResourceType);
				NativeArray<TouristHousehold> nativeArray4 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<TouristHousehold>(ref m_TouristHouseholdType);
				NativeArray<PropertyRenter> nativeArray5 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<PropertyRenter>(ref m_PropertyRenterType);
				Random random = ((RandomSeed)(ref m_RandomSeed)).GetRandom(unfilteredChunkIndex);
				int population = m_Populations[m_City].m_Population;
				for (int i = 0; i < ((ArchetypeChunk)(ref chunk)).Count; i++)
				{
					Entity val = nativeArray[i];
					Household val2 = nativeArray2[i];
					DynamicBuffer<HouseholdCitizen> val3 = bufferAccessor[i];
					if (val3.Length == 0)
					{
						((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Deleted>(unfilteredChunkIndex, val, default(Deleted));
						continue;
					}
					DynamicBuffer<Resources> val4 = bufferAccessor2[i];
					HouseholdNeed val5 = nativeArray3[i];
					PropertyRenter val6 = (PropertyRenter)((nativeArray5.Length > 0) ? nativeArray5[i] : default(PropertyRenter));
					int householdWealth = EconomyUtils.GetHouseholdWealth(val, val2, val4, bufferAccessor[i], ref m_Workers, ref m_CitizenDatas, ref m_HealthProblems, val6, ref m_EconomyParameters, m_ResourcePrefabs, ref m_ResourceDatas, m_BaseConsumptionSum, m_TaxRates);
					if (m_DebugWealthQueueIsCreated)
					{
						m_DebugWealthQueue.Enqueue(math.clamp(householdWealth, -20000, 20000));
					}
					if (m_DebugResourcesQueueIsCreated)
					{
						m_DebugResourcesQueue.Enqueue(math.clamp(val2.m_Resources, -20000, 20000));
					}
					float num = GetConsumptionMultiplier(Mathf.RoundToInt((float)householdWealth / math.max(1f, (float)bufferAccessor[i].Length))) * m_EconomyParameters.m_ResourceConsumption * (float)val3.Length;
					if (((ArchetypeChunk)(ref chunk)).Has<TouristHousehold>(ref m_TouristHouseholdType))
					{
						num *= m_EconomyParameters.m_TouristConsumptionMultiplier;
						if (!((ArchetypeChunk)(ref chunk)).Has<LodgingSeeker>(ref m_LodgingSeekerType))
						{
							TouristHousehold val7 = nativeArray4[i];
							if (((Entity)(ref val7.m_Hotel)).Equals(Entity.Null))
							{
								((ParallelWriter)(ref m_CommandBuffer)).AddComponent<LodgingSeeker>(unfilteredChunkIndex, val, default(LodgingSeeker));
							}
							else if (!m_LodgingProviders.HasComponent(val7.m_Hotel))
							{
								val7.m_Hotel = Entity.Null;
								nativeArray4[i] = val7;
								((ParallelWriter)(ref m_CommandBuffer)).AddComponent<LodgingSeeker>(unfilteredChunkIndex, val, default(LodgingSeeker));
							}
						}
					}
					val2.m_LastConsumption = (short)Mathf.RoundToInt(256f * num);
					if (m_DebugConsumptionQueueIsCreated)
					{
						m_DebugConsumptionQueue.Enqueue(val2.m_LastConsumption / val3.Length);
					}
					int num2 = Mathf.FloorToInt(num);
					num -= (float)num2;
					m_DebugResourceQueue.Enqueue(num2);
					if (((Random)(ref random)).NextFloat() < num)
					{
						num2++;
					}
					val2.m_Resources -= num2;
					if ((int)val5.m_Resource == 0)
					{
						int carCount = 0;
						if (m_OwnedVehicles.HasBuffer(val))
						{
							carCount = m_OwnedVehicles[val].Length;
						}
						if (val2.m_Resources < 0)
						{
							float lastCommutePerCitizen = GetLastCommutePerCitizen(val3, m_Workers);
							int cars = 0;
							if (m_OwnedVehicles.HasBuffer(val))
							{
								cars = m_OwnedVehicles[val].Length;
							}
							if (NeedsCar(val, householdWealth, lastCommutePerCitizen, cars))
							{
								val5.m_Resource = (Resource)1024;
								val5.m_Amount = kCarAmount;
								nativeArray3[i] = val5;
								nativeArray2[i] = val2;
								break;
							}
							ResourceIterator iterator = ResourceIterator.GetIterator();
							int num3 = 0;
							while (((ResourceIterator)(ref iterator)).Next())
							{
								num3 += GetWeight(householdWealth, iterator.resource, m_ResourcePrefabs, ref m_ResourceDatas, carCount, leisureIncluded: false, val3, ref m_CitizenDatas);
							}
							int num4 = ((Random)(ref random)).NextInt(num3);
							iterator = ResourceIterator.GetIterator();
							while (((ResourceIterator)(ref iterator)).Next())
							{
								int weight = GetWeight(householdWealth, iterator.resource, m_ResourcePrefabs, ref m_ResourceDatas, carCount, leisureIncluded: false, val3, ref m_CitizenDatas);
								num3 -= weight;
								if (weight > 0 && num3 <= num4)
								{
									val5.m_Resource = iterator.resource;
									float price = m_ResourceDatas[((ResourcePrefabs)(ref m_ResourcePrefabs))[iterator.resource]].m_Price;
									val5.m_Amount = Mathf.CeilToInt((float)(2000 * val3.Length) / price);
									nativeArray3[i] = val5;
									nativeArray2[i] = val2;
									m_ConsumptionQueue.Enqueue(new ResourceStack
									{
										m_Resource = val5.m_Resource,
										m_Amount = val5.m_Amount
									});
									return;
								}
							}
						}
					}
					int num5 = math.clamp(Mathf.RoundToInt(0.06f * (float)population), 64, 1024);
					if (!((ArchetypeChunk)(ref chunk)).Has<TouristHousehold>(ref m_TouristHouseholdType) && !((ArchetypeChunk)(ref chunk)).Has<CommuterHousehold>(ref m_CommuterHouseholdType) && !m_PropertySeekers.HasComponent(nativeArray[i]) && (!((ArchetypeChunk)(ref chunk)).Has<PropertyRenter>(ref m_PropertyRenterType) || (((ArchetypeChunk)(ref chunk)).Has<HomelessHousehold>(ref m_HomelessHouseholdType) && ((Random)(ref random)).NextInt(128) == 0) || ((Random)(ref random)).NextInt(num5) == 0))
					{
						((ParallelWriter)(ref m_CommandBuffer)).AddComponent<PropertySeeker>(unfilteredChunkIndex, nativeArray[i], default(PropertySeeker));
					}
					nativeArray2[i] = val2;
				}
			}

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

		private struct TypeHandle
		{
			[ReadOnly]
			public EntityTypeHandle __Unity_Entities_Entity_TypeHandle;

			public ComponentTypeHandle<Household> __Game_Citizens_Household_RW_ComponentTypeHandle;

			public ComponentTypeHandle<HouseholdNeed> __Game_Citizens_HouseholdNeed_RW_ComponentTypeHandle;

			public BufferTypeHandle<Resources> __Game_Economy_Resources_RW_BufferTypeHandle;

			[ReadOnly]
			public BufferTypeHandle<HouseholdCitizen> __Game_Citizens_HouseholdCitizen_RO_BufferTypeHandle;

			public ComponentTypeHandle<TouristHousehold> __Game_Citizens_TouristHousehold_RW_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<CommuterHousehold> __Game_Citizens_CommuterHousehold_RO_ComponentTypeHandle;

			public SharedComponentTypeHandle<UpdateFrame> __Game_Simulation_UpdateFrame_SharedComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<LodgingSeeker> __Game_Citizens_LodgingSeeker_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<PropertyRenter> __Game_Buildings_PropertyRenter_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<HomelessHousehold> __Game_Citizens_HomelessHousehold_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentLookup<Worker> __Game_Citizens_Worker_RO_ComponentLookup;

			[ReadOnly]
			public BufferLookup<OwnedVehicle> __Game_Vehicles_OwnedVehicle_RO_BufferLookup;

			[ReadOnly]
			public ComponentLookup<PropertySeeker> __Game_Agents_PropertySeeker_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<ResourceData> __Game_Prefabs_ResourceData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<LodgingProvider> __Game_Companies_LodgingProvider_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Citizen> __Game_Citizens_Citizen_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<HealthProblem> __Game_Citizens_HealthProblem_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Population> __Game_City_Population_RO_ComponentLookup;

			[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_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				__Unity_Entities_Entity_TypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
				__Game_Citizens_Household_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Household>(false);
				__Game_Citizens_HouseholdNeed_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<HouseholdNeed>(false);
				__Game_Economy_Resources_RW_BufferTypeHandle = ((SystemState)(ref state)).GetBufferTypeHandle<Resources>(false);
				__Game_Citizens_HouseholdCitizen_RO_BufferTypeHandle = ((SystemState)(ref state)).GetBufferTypeHandle<HouseholdCitizen>(true);
				__Game_Citizens_TouristHousehold_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<TouristHousehold>(false);
				__Game_Citizens_CommuterHousehold_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<CommuterHousehold>(true);
				__Game_Simulation_UpdateFrame_SharedComponentTypeHandle = ((SystemState)(ref state)).GetSharedComponentTypeHandle<UpdateFrame>();
				__Game_Citizens_LodgingSeeker_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<LodgingSeeker>(true);
				__Game_Buildings_PropertyRenter_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<PropertyRenter>(true);
				__Game_Citizens_HomelessHousehold_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<HomelessHousehold>(true);
				__Game_Citizens_Worker_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Worker>(true);
				__Game_Vehicles_OwnedVehicle_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<OwnedVehicle>(true);
				__Game_Agents_PropertySeeker_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<PropertySeeker>(true);
				__Game_Prefabs_ResourceData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ResourceData>(true);
				__Game_Companies_LodgingProvider_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<LodgingProvider>(true);
				__Game_Citizens_Citizen_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Citizen>(true);
				__Game_Citizens_HealthProblem_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<HealthProblem>(true);
				__Game_City_Population_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Population>(true);
			}
		}

		public static readonly int kCarAmount = 50;

		private EntityQuery m_HouseholdGroup;

		private EntityQuery m_EconomyParameterGroup;

		private SimulationSystem m_SimulationSystem;

		private EndFrameBarrier m_EndFrameBarrier;

		private ResourceSystem m_ResourceSystem;

		private TaxSystem m_TaxSystem;

		private CountConsumptionSystem m_CountConsumptionSystem;

		private CitySystem m_CitySystem;

		private NativeQueue<ResourceStack> m_ConsumptionQueue;

		[DebugWatchDeps]
		private JobHandle m_ConsumptionQueueDeps;

		[DebugWatchValue]
		private DebugWatchDistribution m_DebugWealth;

		[DebugWatchValue]
		private DebugWatchDistribution m_DebugConsumption;

		[DebugWatchValue]
		private DebugWatchDistribution m_DebugResources;

		[DebugWatchValue]
		private NativeArray<int> m_DebugResourceCounter;

		[DebugWatchValue]
		private NativeArray<int> m_DebugResourceCounter2;

		private NativeQueue<int> m_DebugResourceQueue;

		private TypeHandle __TypeHandle;

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

		public static float GetLastCommutePerCitizen(DynamicBuffer<HouseholdCitizen> householdCitizens, ComponentLookup<Worker> workers)
		{
			//IL_0013: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			float num2 = 0f;
			for (int i = 0; i < householdCitizens.Length; i++)
			{
				Entity citizen = householdCitizens[i].m_Citizen;
				if (workers.HasComponent(citizen))
				{
					num2 += workers[citizen].m_LastCommuteTime;
				}
				num += 1f;
			}
			return num2 / num;
		}

		public static float GetConsumptionMultiplier(int wealth)
		{
			return 0.3f + 2.2f * math.smoothstep(0f, 1f, (float)(wealth + 1000) / 6000f);
		}

		public static int GetHouseholdExpectedIncome(DynamicBuffer<HouseholdCitizen> citizens, ref ComponentLookup<Student> students, ref ComponentLookup<HealthProblem> healthProblems, ref ComponentLookup<Citizen> citizenDatas, ref EconomyParameterData economyParameters, NativeArray<int> taxRates, NativeArray<int> unemployment)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_003f: Invalid comparison between Unknown and I4
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			for (int i = 0; i < citizens.Length; i++)
			{
				Entity citizen = citizens[i].m_Citizen;
				if (CitizenUtils.IsDead(citizen, ref healthProblems))
				{
					continue;
				}
				Citizen val = citizenDatas[citizen];
				CitizenAge age = ((Citizen)(ref val)).GetAge();
				if ((int)age != 0)
				{
					if ((int)age == 3)
					{
						num += (float)economyParameters.m_Pension;
						continue;
					}
					int num2 = ((Citizen)(ref val)).GetEducationLevel();
					if (students.HasComponent(citizen))
					{
						num2++;
					}
					float num3 = ((EconomyParameterData)(ref economyParameters)).GetWage(num2);
					float num4 = num3 - (float)economyParameters.m_ResidentialMinimumEarnings;
					if (num4 > 0f)
					{
						num3 -= (float)Mathf.RoundToInt(num4 * ((float)TaxSystem.GetResidentialTaxRate(num2, taxRates) / 100f));
					}
					num3 = math.lerp(num3, (float)economyParameters.m_UnemploymentBenefit, 0.01f * (float)unemployment[num2]);
					num += num3;
				}
				else
				{
					num += (float)economyParameters.m_FamilyAllowance;
				}
			}
			return Mathf.RoundToInt(num);
		}

		public static int GetHouseholdExpectedIncomeDefault(DynamicBuffer<HouseholdCitizen> citizens, ref ComponentLookup<Student> students, ref ComponentLookup<HealthProblem> healthProblems, ref ComponentLookup<Citizen> citizenDatas, ref EconomyParameterData economyParameters)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_003f: Invalid comparison between Unknown and I4
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			for (int i = 0; i < citizens.Length; i++)
			{
				Entity citizen = citizens[i].m_Citizen;
				if (CitizenUtils.IsDead(citizen, ref healthProblems))
				{
					continue;
				}
				Citizen val = citizenDatas[citizen];
				CitizenAge age = ((Citizen)(ref val)).GetAge();
				if ((int)age != 0)
				{
					if ((int)age == 3)
					{
						num += (float)economyParameters.m_Pension;
						continue;
					}
					int num2 = ((Citizen)(ref val)).GetEducationLevel();
					if (students.HasComponent(citizen))
					{
						num2++;
					}
					float num3 = ((EconomyParameterData)(ref economyParameters)).GetWage(num2);
					float num4 = num3 - (float)economyParameters.m_ResidentialMinimumEarnings;
					if (num4 > 0f)
					{
						num3 -= (float)Mathf.RoundToInt(num4 * 0.1f);
					}
					num3 = math.lerp(num3, (float)economyParameters.m_UnemploymentBenefit, 0.1f);
					num += num3;
				}
				else
				{
					num += (float)economyParameters.m_FamilyAllowance;
				}
			}
			return Mathf.RoundToInt(num);
		}

		public static int GetHouseholdIncome(DynamicBuffer<HouseholdCitizen> citizens, ref ComponentLookup<Worker> workers, ref ComponentLookup<Citizen> citizenDatas, ref ComponentLookup<HealthProblem> healthProblems, ref EconomyParameterData economyParameters, NativeArray<int> taxRates)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_002a: 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_0033: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Invalid comparison between Unknown and I4
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int i = 0; i < citizens.Length; i++)
			{
				Entity citizen = citizens[i].m_Citizen;
				if (CitizenUtils.IsDead(citizen, ref healthProblems))
				{
					continue;
				}
				Citizen val = citizenDatas[citizen];
				CitizenAge age = ((Citizen)(ref val)).GetAge();
				if (workers.HasComponent(citizen))
				{
					int level = workers[citizen].m_Level;
					int wage = ((EconomyParameterData)(ref economyParameters)).GetWage(level);
					num += wage;
					int num2 = wage - economyParameters.m_ResidentialMinimumEarnings;
					if (num2 > 0)
					{
						num -= Mathf.RoundToInt((float)num2 * ((float)TaxSystem.GetResidentialTaxRate(level, taxRates) / 100f));
					}
				}
				else
				{
					num = (((int)age <= 1) ? (num + economyParameters.m_FamilyAllowance) : (((int)age != 3) ? (num + economyParameters.m_UnemploymentBenefit) : (num + economyParameters.m_Pension)));
				}
			}
			return Mathf.RoundToInt((float)num);
		}

		public static int GetHouseholdIncomeDefaultTax(DynamicBuffer<HouseholdCitizen> citizens, ref ComponentLookup<Worker> workers, ref ComponentLookup<HealthProblem> healthProblems, ref ComponentLookup<Citizen> citizenDatas, ref EconomyParameterData economyParameters)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_002a: 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_0033: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Invalid comparison between Unknown and I4
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Invalid comparison between Unknown and I4
			int num = 0;
			for (int i = 0; i < citizens.Length; i++)
			{
				Entity citizen = citizens[i].m_Citizen;
				if (CitizenUtils.IsDead(citizen, ref healthProblems))
				{
					continue;
				}
				Citizen val = citizenDatas[citizen];
				CitizenAge age = ((Citizen)(ref val)).GetAge();
				if (workers.HasComponent(citizen))
				{
					int level = workers[citizen].m_Level;
					int wage = ((EconomyParameterData)(ref economyParameters)).GetWage(level);
					num += wage;
					int num2 = wage - economyParameters.m_ResidentialMinimumEarnings;
					if (num2 > 0)
					{
						num -= Mathf.RoundToInt((float)num2 * 0.1f);
					}
				}
				else
				{
					num = (((int)age <= 1) ? (num + economyParameters.m_FamilyAllowance) : (((int)age != 3) ? (num + economyParameters.m_UnemploymentBenefit) : (num + economyParameters.m_Pension)));
				}
			}
			return Mathf.RoundToInt((float)num);
		}

		public static int EstimateHouseholdDailyExpenses(int familySize, ref EconomyParameterData economyParameters, ResourcePrefabs resourcePrefabs, ref ComponentLookup<ResourceData> resourceDatas, float baseConsumptionSum)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			ResourceIterator iterator = ResourceIterator.GetIterator();
			while (((ResourceIterator)(ref iterator)).Next())
			{
				float num2 = (float)familySize * GetCitizenDailyConsumption(iterator.resource, ref economyParameters, resourcePrefabs, ref resourceDatas, baseConsumptionSum);
				if (num2 > 0f)
				{
					num += EconomyUtils.GetMarketPrice(iterator.resource, resourcePrefabs, ref resourceDatas) * num2;
				}
			}
			return Mathf.RoundToInt(num);
		}

		public static float GetCitizenDailyConsumption(Resource resource, ref EconomyParameterData parameters, ResourcePrefabs resourcePrefabs, ref ComponentLookup<ResourceData> resourceDatas, float baseConsumptionSum)
		{
			//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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.RoundToInt(128f * (parameters.m_ResourceConsumption / EconomyUtils.GetMarketPrice(resource, resourcePrefabs, ref resourceDatas)) * GetConsumptionMultiplier(900));
			float num2 = math.lerp((float)GetWeight(900, resource, resourcePrefabs, ref resourceDatas, 1, leisureIncluded: true), (float)GetWeight(900, resource, resourcePrefabs, ref resourceDatas, 0, leisureIncluded: true), 0.2f);
			return (float)num * num2 / baseConsumptionSum;
		}

		public static bool GetFreeCar(Entity household, BufferLookup<OwnedVehicle> ownedVehicles, ComponentLookup<PersonalCar> personalCars, ref Entity car)
		{
			//IL_0002: 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_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0046: 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)
			if (ownedVehicles.HasBuffer(household))
			{
				DynamicBuffer<OwnedVehicle> val = ownedVehicles[household];
				for (int i = 0; i < val.Length; i++)
				{
					car = val[i].m_Vehicle;
					if (personalCars.HasComponent(car))
					{
						PersonalCar val2 = personalCars[car];
						if (((Entity)(ref val2.m_Keeper)).Equals(Entity.Null))
						{
							return true;
						}
					}
				}
			}
			car = Entity.Null;
			return false;
		}

		public static int GetTouristDailyConsumption(Resource resource, ref EconomyParameterData parameters, ResourcePrefabs resourcePrefabs, ref ComponentLookup<ResourceData> resourceDatas, float baseConsumptionSum)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I8
			//IL_0017: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if ((long)resource == 2048)
			{
				return 1;
			}
			int num = Mathf.RoundToInt(1024f * parameters.m_ResourceConsumption / EconomyUtils.GetMarketPrice(resource, resourcePrefabs, ref resourceDatas) * GetConsumptionMultiplier(900));
			float num2 = math.lerp((float)GetWeight(200, resource, resourcePrefabs, ref resourceDatas, 1, leisureIncluded: true), (float)GetWeight(200, resource, resourcePrefabs, ref resourceDatas, 0, leisureIncluded: true), 0.2f);
			return Mathf.RoundToInt(parameters.m_TouristConsumptionMultiplier * (float)num * num2 / baseConsumptionSum);
		}

		public static int GetTotalDailyConsumption(Resource resource, ref EconomyParameterData parameters, int population, int averageTourists, ResourcePrefabs resourcePrefabs, ComponentLookup<ResourceData> resourceDatas, float baseConsumptionSum)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			float num = averageTourists * GetTouristDailyConsumption(resource, ref parameters, resourcePrefabs, ref resourceDatas, baseConsumptionSum);
			float num2 = (float)(1 + population) * GetCitizenDailyConsumption(resource, ref parameters, resourcePrefabs, ref resourceDatas, baseConsumptionSum);
			return Mathf.RoundToInt(num + num2);
		}

		[Preserve]
		protected override void OnCreate()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//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_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_0040: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_00ca: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_010c: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0130: 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_013c: 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_014b: 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_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnCreate();
			m_DebugResourceCounter = new NativeArray<int>(1, (Allocator)4, (NativeArrayOptions)1);
			m_DebugResourceCounter2 = new NativeArray<int>(1, (Allocator)4, (NativeArrayOptions)1);
			m_DebugResourceQueue = new NativeQueue<int>(AllocatorHandle.op_Implicit((Allocator)4));
			m_DebugWealth = new DebugWatchDistribution(true, false);
			m_DebugConsumption = new DebugWatchDistribution(true, false);
			m_DebugResources = new DebugWatchDistribution(true, false);
			m_SimulationSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<SimulationSystem>();
			m_EndFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>();
			m_ResourceSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ResourceSystem>();
			m_TaxSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<TaxSystem>();
			m_CountConsumptionSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CountConsumptionSystem>();
			m_CitySystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CitySystem>();
			m_EconomyParameterGroup = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<EconomyParameterData>() });
			m_HouseholdGroup = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[8]
			{
				ComponentType.ReadWrite<Household>(),
				ComponentType.ReadWrite<HouseholdNeed>(),
				ComponentType.ReadOnly<HouseholdCitizen>(),
				ComponentType.ReadOnly<Resources>(),
				ComponentType.ReadOnly<UpdateFrame>(),
				ComponentType.Exclude<MovingAway>(),
				ComponentType.Exclude<Deleted>(),
				ComponentType.Exclude<Temp>()
			});
			m_ConsumptionQueue = new NativeQueue<ResourceStack>(AllocatorHandle.op_Implicit((Allocator)4));
			((ComponentSystemBase)this).RequireForUpdate(m_HouseholdGroup);
			((ComponentSystemBase)this).RequireForUpdate(m_EconomyParameterGroup);
			Plugin.Log("Modded HouseholdBehaviorSystem created.");
		}

		[Preserve]
		protected override void OnDestroy()
		{
			m_DebugResourceCounter.Dispose();
			m_DebugResourceCounter2.Dispose();
			m_DebugResourceQueue.Dispose();
			m_DebugWealth.Dispose();
			m_DebugResources.Dispose();
			m_DebugConsumption.Dispose();
			m_ConsumptionQueue.Dispose();
			((GameSystemBase)this).OnDestroy();
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: 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_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: 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_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: 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_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: 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_033a: 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_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: 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_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: 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_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			uint updateFrameWithInterval = SimulationUtils.GetUpdateFrameWithInterval(m_SimulationSystem.frameIndex, (uint)((GameSystemBase)this).GetUpdateInterval((SystemUpdatePhase)12), 16);
			__TypeHandle.__Game_City_Population_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_HealthProblem_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Citizen_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Companies_LodgingProvider_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Prefabs_ResourceData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Agents_PropertySeeker_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Vehicles_OwnedVehicle_RO_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Worker_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_HomelessHousehold_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Buildings_PropertyRenter_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_LodgingSeeker_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_CommuterHousehold_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_TouristHousehold_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_HouseholdCitizen_RO_BufferTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Economy_Resources_RW_BufferTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_HouseholdNeed_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Household_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			((EntityTypeHandle)(ref __TypeHandle.__Unity_Entities_Entity_TypeHandle)).Update(ref ((SystemBase)this).CheckedStateRef);
			HouseholdTickJob householdTickJob = default(HouseholdTickJob);
			householdTickJob.m_EntityType = __TypeHandle.__Unity_Entities_Entity_TypeHandle;
			householdTickJob.m_HouseholdType = __TypeHandle.__Game_Citizens_Household_RW_ComponentTypeHandle;
			householdTickJob.m_HouseholdNeedType = __TypeHandle.__Game_Citizens_HouseholdNeed_RW_ComponentTypeHandle;
			householdTickJob.m_ResourceType = __TypeHandle.__Game_Economy_Resources_RW_BufferTypeHandle;
			householdTickJob.m_HouseholdCitizenType = __TypeHandle.__Game_Citizens_HouseholdCitizen_RO_BufferTypeHandle;
			householdTickJob.m_TouristHouseholdType = __TypeHandle.__Game_Citizens_TouristHousehold_RW_ComponentTypeHandle;
			householdTickJob.m_CommuterHouseholdType = __TypeHandle.__Game_Citizens_CommuterHousehold_RO_ComponentTypeHandle;
			householdTickJob.m_UpdateFrameType = __TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle;
			householdTickJob.m_LodgingSeekerType = __TypeHandle.__Game_Citizens_LodgingSeeker_RO_ComponentTypeHandle;
			householdTickJob.m_PropertyRenterType = __TypeHandle.__Game_Buildings_PropertyRenter_RO_ComponentTypeHandle;
			householdTickJob.m_HomelessHouseholdType = __TypeHandle.__Game_Citizens_HomelessHousehold_RO_ComponentTypeHandle;
			householdTickJob.m_Workers = __TypeHandle.__Game_Citizens_Worker_RO_ComponentLookup;
			householdTickJob.m_OwnedVehicles = __TypeHandle.__Game_Vehicles_OwnedVehicle_RO_BufferLookup;
			householdTickJob.m_EconomyParameters = ((EntityQuery)(ref m_EconomyParameterGroup)).GetSingleton<EconomyParameterData>();
			householdTickJob.m_PropertySeekers = __TypeHandle.__Game_Agents_PropertySeeker_RO_ComponentLookup;
			householdTickJob.m_ResourceDatas = __TypeHandle.__Game_Prefabs_ResourceData_RO_ComponentLookup;
			householdTickJob.m_LodgingProviders = __TypeHandle.__Game_Companies_LodgingProvider_RO_ComponentLookup;
			householdTickJob.m_CitizenDatas = __TypeHandle.__Game_Citizens_Citizen_RO_ComponentLookup;
			householdTickJob.m_HealthProblems = __TypeHandle.__Game_Citizens_HealthProblem_RO_ComponentLookup;
			householdTickJob.m_Populations = __TypeHandle.__Game_City_Population_RO_ComponentLookup;
			householdTickJob.m_TaxRates = m_TaxSystem.GetTaxRates();
			householdTickJob.m_ResourcePrefabs = m_ResourceSystem.GetPrefabs();
			householdTickJob.m_RandomSeed = RandomSeed.Next();
			householdTickJob.m_BaseConsumptionSum = m_ResourceSystem.BaseConsumptionSum;
			EntityCommandBuffer val = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer();
			householdTickJob.m_CommandBuffer = ((EntityCommandBuffer)(ref val)).AsParallelWriter();
			householdTickJob.m_UpdateFrameIndex = updateFrameWithInterval;
			householdTickJob.m_ConsumptionQueue = m_ConsumptionQueue.AsParallelWriter();
			householdTickJob.m_City = m_CitySystem.City;
			householdTickJob.m_DebugResourceQueue = m_DebugResourceQueue.AsParallelWriter();
			HouseholdTickJob householdTickJob2 = householdTickJob;
			if (m_DebugWealth.IsEnabled)
			{
				JobHandle val2 = default(JobHandle);
				householdTickJob2.m_DebugWealthQueue = m_DebugWealth.GetQueue(false, ref val2).AsParallelWriter();
				householdTickJob2.m_DebugWealthQueueIsCreated = true;
				((JobHandle)(ref val2)).Complete();
			}
			if (m_DebugConsumption.IsEnabled)
			{
				JobHandle val3 = default(JobHandle);
				householdTickJob2.m_DebugConsumptionQueue = m_DebugConsumption.GetQueue(false, ref val3).AsParallelWriter();
				householdTickJob2.m_DebugConsumptionQueueIsCreated = true;
				((JobHandle)(ref val3)).Complete();
			}
			if (m_DebugResources.IsEnabled)
			{
				JobHandle val4 = default(JobHandle);
				householdTickJob2.m_DebugResourcesQueue = m_DebugResources.GetQueue(false, ref val4).AsParallelWriter();
				householdTickJob2.m_DebugResourcesQueueIsCreated = true;
				((JobHandle)(ref val4)).Complete();
			}
			JobHandle val5 = JobChunkExtensions.ScheduleParallel<HouseholdTickJob>(householdTickJob2, m_HouseholdGroup, JobHandle.CombineDependencies(m_ConsumptionQueueDeps, ((SystemBase)this).Dependency));
			m_CountConsumptionSystem.AddConsumptionWriter(val5);
			m_EndFrameBarrier.AddJobHandleForProducer(val5);
			m_ResourceSystem.AddPrefabsReader(val5);
			m_TaxSystem.AddReader(val5);
			__TypeHandle.__Game_Prefabs_ResourceData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			ProcessConsumptionJob processConsumptionJob = default(ProcessConsumptionJob);
			processConsumptionJob.m_Queue = m_ConsumptionQueue;
			JobHandle val6 = default(JobHandle);
			processConsumptionJob.m_ConsumptionAccumulator = m_CountConsumptionSystem.GetConsumptionAccumulator(ref val6);
			processConsumptionJob.m_DebugResourceQueue = m_DebugResourceQueue;
			processConsumptionJob.m_DebugResourceCounter = m_DebugResourceCounter;
			processConsumptionJob.m_DebugResourceCounter2 = m_DebugResourceCounter2;
			processConsumptionJob.m_ResourceDatas = __TypeHandle.__Game_Prefabs_ResourceData_RO_ComponentLookup;
			processConsumptionJob.m_ResourcePrefabs = m_ResourceSystem.GetPrefabs();
			ProcessConsumptionJob processConsumptionJob2 = processConsumptionJob;
			((SystemBase)this).Dependency = IJobExtensions.Schedule<ProcessConsumptionJob>(processConsumptionJob2, JobHandle.CombineDependencies(val5, val6));
			m_ConsumptionQueueDeps = ((SystemBase)this).Dependency;
			m_CountConsumptionSystem.AddConsumptionWriter(((SystemBase)this).Dependency);
		}

		public static int GetAgeWeight(ResourceData resourceData, DynamicBuffer<HouseholdCitizen> citizens, ref ComponentLookup<Citizen> citizenDatas)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected I4, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int i = 0; i < citizens.Length; i++)
			{
				Entity citizen = citizens[i].m_Citizen;
				Citizen val = citizenDatas[citizen];
				CitizenAge age = ((Citizen)(ref val)).GetAge();
				num = (int)age switch
				{
					0 => num + resourceData.m_ChildWeight, 
					1 => num + resourceData.m_TeenWeight, 
					3 => num + resourceData.m_ElderlyWeight, 
					_ => num + resourceData.m_AdultWeight, 
				};
			}
			return num;
		}

		public static int GetWeight(int wealth, Resource resource, ResourcePrefabs resourcePrefabs, ref ComponentLookup<ResourceData> resourceDatas, int carCount, bool leisureIncluded, DynamicBuffer<HouseholdCitizen> citizens, ref ComponentLookup<Citizen> citizenDatas)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			ResourceData resourceData = resourceDatas[((ResourcePrefabs)(ref resourcePrefabs))[resource]];
			return GetWeight(wealth, resourceData, carCount, leisureIncluded, citizens, ref citizenDatas);
		}

		public static int GetWeight(int wealth, ResourceData resourceData, int carCount, bool leisureIncluded, DynamicBuffer<HouseholdCitizen> citizens, ref ComponentLookup<Citizen> citizenDatas)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			float num = ((leisureIncluded || !resourceData.m_IsLeisure) ? resourceData.m_BaseConsumption : 0f);
			num += (float)(carCount * resourceData.m_CarConsumption);
			float num2 = ((leisureIncluded || !resourceData.m_IsLeisure) ? resourceData.m_WealthModifier : 0f);
			float num3 = GetAgeWeight(resourceData, citizens, ref citizenDatas);
			return Mathf.RoundToInt(100f * num3 * num * math.smoothstep(num2, 1f, math.max(0.01f, ((float)wealth + 5000f) / 10000f)));
		}

		public static int GetWeight(int wealth, Resource resource, ResourcePrefabs resourcePrefabs, ref ComponentLookup<ResourceData> resourceDatas, int carCount, bool leisureIncluded)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			ResourceData resourceData = resourceDatas[((ResourcePrefabs)(ref resourcePrefabs))[resource]];
			return GetWeight(wealth, resourceData, carCount, leisureIncluded);
		}

		public static int GetWeight(int wealth, ResourceData resourceData, int carCount, bool leisureIncluded)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			float num = ((leisureIncluded || !resourceData.m_IsLeisure) ? resourceData.m_BaseConsumption : 0f) + (float)(carCount * resourceData.m_CarConsumption);
			float num2 = ((leisureIncluded || !resourceData.m_IsLeisure) ? resourceData.m_WealthModifier : 0f);
			return Mathf.RoundToInt(num * math.smoothstep(num2, 1f, math.clamp(((float)wealth + 5000f) / 10000f, 0.1f, 0.9f)));
		}

		public static int GetHighestEducation(DynamicBuffer<HouseholdCitizen> citizenBuffer, ref ComponentLookup<Citizen> citizens)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0031: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			int num = 0;
			for (int i = 0; i < citizenBuffer.Length; i++)
			{
				Entity citizen = citizenBuffer[i].m_Citizen;
				if (citizens.HasComponent(citizen))
				{
					Citizen val = citizens[citizen];
					CitizenAge age = ((Citizen)(ref val)).GetAge();
					if ((int)age == 1 || (int)age == 2)
					{
						num = math.max(num, ((Citizen)(ref val)).GetEducationLevel());
					}
				}
			}
			return num;
		}

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

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

		[Preserve]
		public HouseholdBehaviorSystem()
		{
		}
	}
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPatch(typeof(SystemOrder), "Initialize")]
		[HarmonyPostfix]
		public static void Initialize_Postfix(UpdateSystem updateSystem)
		{
			updateSystem.UpdateAt<HouseholdBehaviorSystem>((SystemUpdatePhase)12);
		}

		[HarmonyPatch(typeof(HouseholdBehaviorSystem), "OnUpdate")]
		[HarmonyPrefix]
		private static bool HouseholdBehaviorSystem_OnUpdate()
		{
			return false;
		}
	}
	[BepInPlugin("RealEco", "RealEco", "0.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static ILog s_Log;

		public static void Log(string text, bool bMethod = false)
		{
			if (bMethod)
			{
				text = GetCallingMethod(2) + ": " + text;
			}
			Logger.LogInfo((object)text);
			s_Log.Info((object)text);
		}

		public static void LogStack(string text)
		{
			Logger.LogInfo((object)(text + " STACKTRACE"));
			s_Log.logStackTrace = true;
			s_Log.Info((object)(text + "STACKTRACE"));
			s_Log.logStackTrace = false;
		}

		public static string GetCallingMethod(int frame)
		{
			MethodBase method = new StackTrace().GetFrame(frame).GetMethod();
			return method.DeclaringType?.ToString() + "." + method.Name;
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			s_Log = LogManager.GetLogger("RealEco", true);
			Logger.LogInfo((object)"Plugin RealEco is loaded!");
			MethodBase[] array = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "RealEco_Cities2Harmony").GetPatchedMethods().ToArray();
			Logger.LogInfo((object)("Plugin RealEco made patches! Patched methods: " + array.Length));
			MethodBase[] array2 = array;
			foreach (MethodBase methodBase in array2)
			{
				Logger.LogInfo((object)("Patched method: " + methodBase.Module.Name + ":" + methodBase.Name));
			}
		}
	}
	[HarmonyPatch(typeof(PrefabSystem), "AddPrefab")]
	public static class PrefabSystem_AddPrefab_Patches
	{
		private static readonly Dictionary<ResourceInEditor, float> ResourcePriceDict = new Dictionary<ResourceInEditor, float>
		{
			{
				(ResourceInEditor)3,
				35f
			},
			{
				(ResourceInEditor)4,
				50f
			},
			{
				(ResourceInEditor)9,
				70f
			},
			{
				(ResourceInEditor)10,
				90f
			},
			{
				(ResourceInEditor)17,
				30f
			},
			{
				(ResourceInEditor)19,
				70f
			},
			{
				(ResourceInEditor)21,
				90f
			},
			{
				(ResourceInEditor)30,
				150f
			},
			{
				(ResourceInEditor)33,
				45f
			},
			{
				(ResourceInEditor)34,
				60f
			},
			{
				(ResourceInEditor)35,
				60f
			},
			{
				(ResourceInEditor)36,
				80f
			}
		};

		private static readonly Dictionary<ResourceInEditor, float> ResourceBaseConsumptionDict = new Dictionary<ResourceInEditor, float>
		{
			{
				(ResourceInEditor)3,
				15f
			},
			{
				(ResourceInEditor)4,
				25f
			},
			{
				(ResourceInEditor)21,
				20f
			},
			{
				(ResourceInEditor)31,
				20f
			},
			{
				(ResourceInEditor)32,
				15f
			},
			{
				(ResourceInEditor)33,
				15f
			},
			{
				(ResourceInEditor)34,
				30f
			},
			{
				(ResourceInEditor)35,
				25f
			},
			{
				(ResourceInEditor)36,
				20f
			},
			{
				(ResourceInEditor)37,
				15f
			}
		};

		private static readonly Dictionary<ResourceInEditor, int> ResourceCarConsumptionDict = new Dictionary<ResourceInEditor, int>
		{
			{
				(ResourceInEditor)11,
				5
			},
			{
				(ResourceInEditor)19,
				5
			},
			{
				(ResourceInEditor)21,
				5
			},
			{
				(ResourceInEditor)31,
				10
			},
			{
				(ResourceInEditor)36,
				10
			}
		};

		private static readonly Dictionary<string, float> MaxWorkersPerCellDict = new Dictionary<string, float>
		{
			{ "Industrial_ForestryExtractor", 0.04f },
			{ "Industrial_GrainExtractor", 0.05f },
			{ "Industrial_OreExtractor", 0.08f },
			{ "Industrial_OilExtractor", 0.11f },
			{ "Industrial_CoalMine", 0.14f },
			{ "Industrial_StoneQuarry", 0.12f },
			{ "Industrial_VegetableExtractor", 0.06f },
			{ "Industrial_LivestockExtractor", 0.09f },
			{ "Industrial_CottonExtractor", 0.07f },
			{ "Industrial_ConcreteFactory", 0.4f },
			{ "Industrial_PaperMill", 0.4f },
			{ "Industrial_VehicleFactory", 0.4f },
			{ "Industrial_SawMill", 0.4f },
			{ "Industrial_BioRefinery", 0.6f },
			{ "Industrial_ElectronicsFactory", 0.6f },
			{ "Industrial_ChemicalFactory", 0.6f },
			{ "Industrial_TextileFromCottonFactory", 0.6f }
		};

		private static readonly Dictionary<string, int> OutputAmountDict = new Dictionary<string, int>
		{
			{ "Industrial_FoodFactory", 3 },
			{ "Industrial_MachineryFactory", 1 },
			{ "Industrial_VehicleFactory", 1 },
			{ "Industrial_BeverageFromGrainFactory", 2 },
			{ "Industrial_BeverageFromVegetablesFactory", 2 },
			{ "Industrial_TextileFromCottonFactory", 2 },
			{ "Industrial_TextileFromLivestockFactory", 2 },
			{ "Industrial_TextileFromPetrochemicalsFactory", 2 },
			{ "Industrial_ConvenienceFoodFromLivestockFactory", 2 },
			{ "Industrial_ConvenienceFoodFromGrainFactory", 2 },
			{ "Office_SoftwareCompany", 10 },
			{ "Office_Bank", 6 },
			{ "Office_MediaCompany", 8 },
			{ "Office_TelecomCompany", 10 }
		};

		private static readonly Dictionary<string, WorkplaceComplexity> ComplexityDict = new Dictionary<string, WorkplaceComplexity>
		{
			{
				"Industrial_GrainExtractor",
				(WorkplaceComplexity)1
			},
			{
				"Industrial_OreExtractor",
				(WorkplaceComplexity)1
			},
			{
				"Industrial_VegetableExtractor",
				(WorkplaceComplexity)1
			},
			{
				"Industrial_LivestockExtractor",
				(WorkplaceComplexity)1
			},
			{
				"Industrial_CottonExtractor",
				(WorkplaceComplexity)1
			},
			{
				"Industrial_SawMill",
				(WorkplaceComplexity)1
			},
			{
				"Commercial_FoodStore",
				(WorkplaceComplexity)0
			},
			{
				"Commercial_Restaurant",
				(WorkplaceComplexity)0
			},
			{
				"Commercial_Bar",
				(WorkplaceComplexity)0
			},
			{
				"Commercial_ConvenienceFoodStore",
				(WorkplaceComplexity)0
			},
			{
				"Commercial_FashionStore",
				(WorkplaceComplexity)0
			},
			{
				"Industrial_MetalSmelter",
				(WorkplaceComplexity)2
			},
			{
				"Industrial_MachineryFactory",
				(WorkplaceComplexity)2
			},
			{
				"Industrial_BeverageFromGrainFactory",
				(WorkplaceComplexity)2
			},
			{
				"Industrial_BeverageFromVegetablesFactory",
				(WorkplaceComplexity)2
			},
			{
				"Industrial_FurnitureFactory",
				(WorkplaceComplexity)2
			},
			{
				"Industrial_ElectronicsFactory",
				(WorkplaceComplexity)3
			},
			{
				"Industrial_PlasticsFactory",
				(WorkplaceComplexity)3
			},
			{
				"Industrial_ChemicalFactory",
				(WorkplaceComplexity)3
			},
			{
				"Office_Bank",
				(WorkplaceComplexity)3
			},
			{
				"Office_MediaCompany",
				(WorkplaceComplexity)3
			}
		};

		private static readonly Dictionary<string, float> ProfitabilityDict = new Dictionary<string, float>
		{
			{ "Commercial_FoodStore", 80f },
			{ "Commercial_BookStore", 80f },
			{ "Commercial_VehicleStore", 50f },
			{ "Commercial_Restaurant", 80f },
			{ "Commercial_ElectronicsStore", 120f },
			{ "Commercial_GasStation", 50f },
			{ "Commercial_Hotel", 100f },
			{ "Commercial_Bar", 70f },
			{ "Commercial_ChemicalStore", 70f },
			{ "Commercial_ConvenienceFoodStore", 60f },
			{ "Commercial_DrugStore", 120f },
			{ "Commercial_FashionStore", 100f },
			{ "Commercial_FurnitureStore", 60f },
			{ "Commercial_LiquorStore", 80f },
			{ "Commercial_PlasticsStore", 70f },
			{ "Commercial_RecreactionStore", 70f },
			{ "Industrial_OilExtractor", 60f },
			{ "Industrial_CoalMine", 40f },
			{ "Industrial_FoodFactory", 40f },
			{ "Industrial_PaperMill", 40f },
			{ "Industrial_BioRefinery", 65f },
			{ "Industrial_ElectronicsFactory", 45f },
			{ "Industrial_MetalSmelter", 35f },
			{ "Industrial_OilRefinery", 50f },
			{ "Industrial_PlasticsFactory", 45f },
			{ "Industrial_SteelPlant", 45f },
			{ "Industrial_MachineryFactory", 30f },
			{ "Industrial_MineralPlant", 40f },
			{ "Industrial_ConcreteFactory", 30f },
			{ "Industrial_ChemicalFactory", 60f },
			{ "Industrial_PharmaceuticalsFactory", 50f },
			{ "Industrial_VehicleFactory", 45f },
			{ "Industrial_BeverageFromGrainFactory", 35f },
			{ "Industrial_BeverageFromVegetablesFactory", 30f },
			{ "Industrial_ConvenienceFoodFromLivestockFactory", 30f },
			{ "Industrial_TextileFromCottonFactory", 35f },
			{ "Industrial_TextileFromLivestockFactory", 40f },
			{ "Industrial_TextileFromPetrochemicalsFactory", 30f },
			{ "Industrial_SawMill", 30f },
			{ "Industrial_FurnitureFactory", 60f },
			{ "Industrial_ConvenienceFoodFromGrainFactory", 25f },
			{ "Office_SoftwareCompany", 80f },
			{ "Office_Bank", 75f },
			{ "Office_MediaCompany", 80f },
			{ "Office_TelecomCompany", 75f },
			{ "Industrial_WarehouseConvenienceFood", 15f },
			{ "Industrial_WarehouseGrain", 15f },
			{ "Industrial_WarehousePaper", 15f },
			{ "Industrial_WarehouseVehicles", 15f },
			{ "Industrial_WarehouseWood", 15f },
			{ "Industrial_WarehouseElectronics", 15f },
			{ "Industrial_WarehouseMetals", 15f },
			{ "Industrial_WarehouseOil", 15f },
			{ "Industrial_WarehousePlastics", 15f },
			{ "Industrial_WarehouseOre", 15f },
			{ "Industrial_WarehousePetrochemicals", 15f },
			{ "Industrial_WarehouseStone", 15f },
			{ "Industrial_WarehouseCoal", 15f },
			{ "Industrial_WarehouseLivestock", 15f },
			{ "Industrial_WarehouseCotton", 15f },
			{ "Industrial_WarehouseSteel", 15f },
			{ "Industrial_WarehouseMinerals", 15f },
			{ "Industrial_WarehouseConcrete", 15f },
			{ "Industrial_WarehouseMachinery", 15f },
			{ "Industrial_WarehouseChemicals", 15f },
			{ "Industrial_WarehousePharmaceuticals", 15f },
			{ "Industrial_WarehouseBeverages", 15f },
			{ "Industrial_WarehouseTextiles", 15f },
			{ "Industrial_WarehouseFood", 15f },
			{ "Industrial_WarehouseVegetables", 15f },
			{ "Industrial_WarehouseTimber", 15f },
			{ "Industrial_WarehouseFurniture", 15f }
		};

		[HarmonyPrefix]
		public static bool Resources_Prefix(object __instance, PrefabBase prefab)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			if (((object)prefab).GetType().Name == "ResourcePrefab")
			{
				ResourcePrefab val = (ResourcePrefab)prefab;
				bool flag = false;
				if (ResourcePriceDict.ContainsKey(val.m_Resource))
				{
					val.m_InitialPrice = ResourcePriceDict[val.m_Resource];
					flag = true;
				}
				if (ResourceBaseConsumptionDict.ContainsKey(val.m_Resource))
				{
					val.m_BaseConsumption = ResourceBaseConsumptionDict[val.m_Resource];
					flag = true;
				}
				if (ResourceCarConsumptionDict.ContainsKey(val.m_Resource))
				{
					val.m_CarConsumption = ResourceCarConsumptionDict[val.m_Resource];
					flag = true;
				}
				if (flag)
				{
					Plugin.Log($"Modded {val.m_Resource}: weight {val.m_Weight} price {val.m_InitialPrice} base {val.m_BaseConsumption} car {val.m_CarConsumption} wealth {val.m_WealthModifier} " + $"flags {val.m_IsProduceable} {val.m_IsTradable} {val.m_IsMaterial} {val.m_IsLeisure} " + $"weights {val.m_ChildWeight} {val.m_TeenWeight} {val.m_AdultWeight} {val.m_ElderlyWeight} ");
				}
			}
			return true;
		}

		[HarmonyPrefix]
		public static bool DemandPrefab_Prefix(object __instance, PrefabBase prefab)
		{
			return true;
		}

		[HarmonyPrefix]
		public static bool EconomyPrefab_Prefix(object __instance, PrefabBase prefab)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			if (((object)prefab).GetType().Name == "EconomyPrefab")
			{
				EconomyPrefab val = (EconomyPrefab)prefab;
				val.m_ExtractorCompanyExportMultiplier = 0.75f;
				val.m_IndustrialProfitFactor = 0.0008f;
				Plugin.Log($"Modded {((Object)prefab).name}: ExtrExpMult {val.m_ExtractorCompanyExportMultiplier} IndProfFact {val.m_IndustrialProfitFactor}");
				val.m_Wage0 = 1400;
				val.m_Wage1 = 1700;
				val.m_Wage2 = 2640;
				val.m_Wage3 = 3520;
				val.m_Wage4 = 4350;
				Plugin.Log($"Modded {((Object)prefab).name}: Wages {val.m_Wage0} {val.m_Wage1} {val.m_Wage2} {val.m_Wage3} {val.m_Wage4} Pension {val.m_Pension} Unemp {val.m_UnemploymentBenefit} Family {val.m_FamilyAllowance}");
			}
			if (((object)prefab).GetType().Name == "ServiceFeeParameterPrefab")
			{
				ServiceFeeParameterPrefab val2 = (ServiceFeeParameterPrefab)prefab;
				val2.m_GarbageFee.m_Default = 0.5f;
				Plugin.Log($"Modded {((Object)prefab).name}: GarbageFeece {val2.m_GarbageFee.m_Default}");
			}
			return true;
		}

		[HarmonyPrefix]
		public static bool Companies_Prefix(PrefabBase prefab)
		{
			//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_00bf: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: 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_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			if (((object)prefab).GetType().Name == "CompanyPrefab")
			{
				if (MaxWorkersPerCellDict.ContainsKey(((Object)prefab).name) && prefab.Has<ProcessingCompany>())
				{
					ProcessingCompany component = ((ComponentBase)prefab).GetComponent<ProcessingCompany>();
					component.process.m_MaxWorkersPerCell = MaxWorkersPerCellDict[((Object)prefab).name];
					Plugin.Log($"Modded {((Object)prefab).name}: wpc {component.process.m_MaxWorkersPerCell}");
				}
				if (ComplexityDict.ContainsKey(((Object)prefab).name) && prefab.Has<Workplace>())
				{
					Workplace component2 = ((ComponentBase)prefab).GetComponent<Workplace>();
					component2.m_Complexity = ComplexityDict[((Object)prefab).name];
					Plugin.Log($"Modded {((Object)prefab).name}: comp {component2.m_Complexity}");
				}
				CompanyPrefab val = (CompanyPrefab)(object)((prefab is CompanyPrefab) ? prefab : null);
				if (ProfitabilityDict.ContainsKey(((Object)prefab).name))
				{
					val.profitability = ProfitabilityDict[((Object)prefab).name];
					Plugin.Log($"Modded {((Object)prefab).name}: prof {val.profitability}");
				}
				if (OutputAmountDict.ContainsKey(((Object)prefab).name))
				{
					ProcessingCompany component3 = ((ComponentBase)prefab).GetComponent<ProcessingCompany>();
					IndustrialProcess process = component3.process;
					process.m_Output.m_Amount = OutputAmountDict[((Object)prefab).name];
					Plugin.Log($"Modded {((Object)prefab).name}.ProcessingCompany: out {process.m_Output.m_Resource} {process.m_Output.m_Amount} in1 {process.m_Input1.m_Resource} {process.m_Input1.m_Amount} in2 {process.m_Input2.m_Resource} {process.m_Input2.m_Amount} wpc {process.m_MaxWorkersPerCell} tr {component3.transports}");
				}
				if (((Object)prefab).name == "Industrial_BioRefinery")
				{
					ProcessingCompany component4 = ((ComponentBase)prefab).GetComponent<ProcessingCompany>();
					IndustrialProcess process2 = component4.process;
					process2.m_Input1.m_Amount = 1;
					Plugin.Log($"Modded {((Object)prefab).name}.ProcessingCompany: out {process2.m_Output.m_Resource} {process2.m_Output.m_Amount} in1 {process2.m_Input1.m_Resource} {process2.m_Input1.m_Amount} in2 {process2.m_Input2.m_Resource} {process2.m_Input2.m_Amount} wpc {process2.m_MaxWorkersPerCell} tr {component4.transports}");
				}
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "RealEco";

		public const string PLUGIN_NAME = "RealEco";

		public const string PLUGIN_VERSION = "0.2.0";
	}
}