Decompiled source of TransportPolicyAdjuster v1.2.0

TransportPolicyAdjuster.dll

Decompiled 10 months 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 Colossal.UI.Binding;
using Game;
using Game.Areas;
using Game.Buildings;
using Game.City;
using Game.Common;
using Game.PSI;
using Game.Pathfind;
using Game.Policies;
using Game.Prefabs;
using Game.Routes;
using Game.Simulation;
using Game.Tools;
using Game.Triggers;
using Game.UI.InGame;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TransportPolicyAdjuster;
using Unity.Burst;
using Unity.Burst.Intrinsics;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Scripting;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TransportPolicyAdjuster")]
[assembly: AssemblyConfiguration("Steam")]
[assembly: AssemblyDescription("TransportPolicyAdjuster")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+73671e12ca181bf2d6b1a9c68762955a8acbc3d5")]
[assembly: AssemblyProduct("TransportPolicyAdjuster")]
[assembly: AssemblyTitle("TransportPolicyAdjuster")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TransportPolicyAdjuster
{
	public class ModifiedSystem : GameSystemBase
	{
		[BurstCompile]
		private struct ModifyPolicyJob : IJobChunk
		{
			[ReadOnly]
			public DistrictModifierRefreshData m_DistrictModifierRefreshData;

			[ReadOnly]
			public BuildingModifierRefreshData m_BuildingModifierRefreshData;

			[ReadOnly]
			public RouteModifierInitializeSystem.RouteModifierRefreshData m_RouteModifierRefreshData;

			[ReadOnly]
			public CityModifierRefreshData m_CityModifierRefreshData;

			[ReadOnly]
			public NativeList<ArchetypeChunk> m_EffectProviderChunks;

			[ReadOnly]
			public ComponentTypeHandle<Modify> m_ModifyType;

			public ComponentLookup<District> m_DistrictData;

			public ComponentLookup<Building> m_BuildingData;

			public ComponentLookup<Route> m_RouteData;

			public ComponentLookup<City> m_CityData;

			public BufferLookup<DistrictModifier> m_DistrictModifiers;

			public BufferLookup<BuildingModifier> m_BuildingModifiers;

			public BufferLookup<RouteModifier> m_RouteModifiers;

			public BufferLookup<CityModifier> m_CityModifiers;

			public BufferLookup<Policy> m_Policies;

			public EntityCommandBuffer m_CommandBuffer;

			public ParallelWriter<TriggerAction> m_TriggerBuffer;

			public ParallelWriter<PolicyEventInfo> m_PolicyEventInfos;

			public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: 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_0045: 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_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0224: Unknown result type (might be due to invalid IL or missing references)
				//IL_022a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: Invalid comparison between Unknown and I4
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_023a: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0240: Unknown result type (might be due to invalid IL or missing references)
				//IL_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_0246: Unknown result type (might be due to invalid IL or missing references)
				//IL_024c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0258: Unknown result type (might be due to invalid IL or missing references)
				//IL_0259: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0264: Unknown result type (might be due to invalid IL or missing references)
				//IL_0273: 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_0279: Unknown result type (might be due to invalid IL or missing references)
				//IL_027e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: 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_00b1: Invalid comparison between Unknown and I4
				//IL_01db: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dc: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_0207: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: 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_011a: 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_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: 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_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c6: 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)
				NativeArray<Modify> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Modify>(ref m_ModifyType);
				for (int i = 0; i < nativeArray.Length; i++)
				{
					Modify val = nativeArray[i];
					if (!m_Policies.HasBuffer(val.m_Entity))
					{
						continue;
					}
					((EntityCommandBuffer)(ref m_CommandBuffer)).AddComponent<Updated>(val.m_Entity);
					DynamicBuffer<Policy> policies = m_Policies[val.m_Entity];
					int num = 0;
					while (true)
					{
						if (num < policies.Length)
						{
							Policy val2 = policies[num];
							if (val2.m_Policy == val.m_Policy)
							{
								if ((val.m_Flags & 1) == 0)
								{
									if (!m_DistrictModifierRefreshData.m_PolicySliderData.HasComponent(val2.m_Policy))
									{
										policies.RemoveAt(num);
										RefreshEffects(val.m_Entity, val.m_Policy, policies);
										m_PolicyEventInfos.Enqueue(new PolicyEventInfo
										{
											m_Activated = false,
											m_Entity = val.m_Policy,
											m_PolicyRange = GetPolicyRange(val.m_Entity, val.m_Policy)
										});
										break;
									}
									if (m_DistrictModifierRefreshData.m_PolicySliderData[val2.m_Policy].m_Default == val2.m_Adjustment)
									{
										policies.RemoveAt(num);
										RefreshEffects(val.m_Entity, val.m_Policy, policies);
										m_PolicyEventInfos.Enqueue(new PolicyEventInfo
										{
											m_Activated = false,
											m_Entity = val.m_Policy,
											m_PolicyRange = GetPolicyRange(val.m_Entity, val.m_Policy)
										});
										break;
									}
								}
								val2.m_Flags = val.m_Flags;
								val2.m_Adjustment = val.m_Adjustment;
								policies[num] = val2;
								RefreshEffects(val.m_Entity, val.m_Policy, policies);
								break;
							}
							num++;
							continue;
						}
						if ((val.m_Flags & 1) > 0)
						{
							policies.Add(new Policy(val.m_Policy, val.m_Flags, val.m_Adjustment));
							RefreshEffects(val.m_Entity, val.m_Policy, policies);
							m_TriggerBuffer.Enqueue(new TriggerAction((TriggerType)30, val.m_Policy, Entity.Null, Entity.Null, 0f));
							m_PolicyEventInfos.Enqueue(new PolicyEventInfo
							{
								m_Activated = true,
								m_Entity = val.m_Policy,
								m_PolicyRange = GetPolicyRange(val.m_Entity, val.m_Policy)
							});
						}
						break;
					}
				}
			}

			private PolicyRange GetPolicyRange(Entity entity, Entity policy)
			{
				//IL_000c: 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_003a: 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_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: 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_0057: 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_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				if (m_DistrictModifierRefreshData.m_DistrictOptionData.HasComponent(policy) && m_DistrictData.HasComponent(entity))
				{
					return (PolicyRange)2;
				}
				if (m_DistrictModifierRefreshData.m_DistrictModifierData.HasBuffer(policy) && m_DistrictModifiers.HasBuffer(entity))
				{
					return (PolicyRange)2;
				}
				if (m_BuildingModifierRefreshData.m_BuildingOptionData.HasComponent(policy) && m_BuildingData.HasComponent(entity))
				{
					return (PolicyRange)1;
				}
				if (m_BuildingModifierRefreshData.m_BuildingModifierData.HasBuffer(policy) && m_BuildingModifiers.HasBuffer(entity))
				{
					return (PolicyRange)1;
				}
				if (m_RouteModifierRefreshData.m_RouteOptionData.HasComponent(policy) && m_RouteData.HasComponent(entity))
				{
					return (PolicyRange)4;
				}
				if (m_RouteModifierRefreshData.m_RouteModifierData.HasBuffer(policy) && m_RouteModifiers.HasBuffer(entity))
				{
					return (PolicyRange)4;
				}
				if (m_CityModifierRefreshData.m_CityOptionData.HasComponent(policy) && m_CityData.HasComponent(entity))
				{
					return (PolicyRange)3;
				}
				if (m_CityModifierRefreshData.m_CityModifierData.HasBuffer(policy) && m_CityModifiers.HasBuffer(entity))
				{
					return (PolicyRange)3;
				}
				return (PolicyRange)0;
			}

			private void RefreshEffects(Entity entity, Entity policy, DynamicBuffer<Policy> policies)
			{
				//IL_000c: 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_005e: 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_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: 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_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: 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_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: 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_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_0162: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01db: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b8: 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_01be: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_021c: Unknown result type (might be due to invalid IL or missing references)
				//IL_021d: Unknown result type (might be due to invalid IL or missing references)
				//IL_023f: 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_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_0264: Unknown result type (might be due to invalid IL or missing references)
				//IL_0265: Unknown result type (might be due to invalid IL or missing references)
				//IL_026a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0272: 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_0276: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				if (m_DistrictModifierRefreshData.m_DistrictOptionData.HasComponent(policy) && m_DistrictData.HasComponent(entity))
				{
					District val = m_DistrictData[entity];
					((DistrictModifierRefreshData)(ref m_DistrictModifierRefreshData)).RefreshDistrictOptions(ref val, policies);
					m_DistrictData[entity] = val;
				}
				if (m_DistrictModifierRefreshData.m_DistrictModifierData.HasBuffer(policy) && m_DistrictModifiers.HasBuffer(entity))
				{
					DynamicBuffer<DistrictModifier> val2 = m_DistrictModifiers[entity];
					((DistrictModifierRefreshData)(ref m_DistrictModifierRefreshData)).RefreshDistrictModifiers(val2, policies);
				}
				if (m_BuildingModifierRefreshData.m_BuildingOptionData.HasComponent(policy) && m_BuildingData.HasComponent(entity))
				{
					Building val3 = m_BuildingData[entity];
					((BuildingModifierRefreshData)(ref m_BuildingModifierRefreshData)).RefreshBuildingOptions(ref val3, policies);
					m_BuildingData[entity] = val3;
				}
				if (m_BuildingModifierRefreshData.m_BuildingModifierData.HasBuffer(policy) && m_BuildingModifiers.HasBuffer(entity))
				{
					DynamicBuffer<BuildingModifier> val4 = m_BuildingModifiers[entity];
					((BuildingModifierRefreshData)(ref m_BuildingModifierRefreshData)).RefreshBuildingModifiers(val4, policies);
				}
				if (m_RouteModifierRefreshData.m_RouteOptionData.HasComponent(policy) && m_RouteData.HasComponent(entity))
				{
					Route route = m_RouteData[entity];
					m_RouteModifierRefreshData.RefreshRouteOptions(ref route, policies);
					m_RouteData[entity] = route;
				}
				if (m_RouteModifierRefreshData.m_RouteModifierData.HasBuffer(policy) && m_RouteModifiers.HasBuffer(entity))
				{
					DynamicBuffer<RouteModifier> modifiers = m_RouteModifiers[entity];
					m_RouteModifierRefreshData.RefreshRouteModifiers(modifiers, policies);
				}
				if (m_CityModifierRefreshData.m_CityOptionData.HasComponent(policy) && m_CityData.HasComponent(entity))
				{
					City val5 = m_CityData[entity];
					((CityModifierRefreshData)(ref m_CityModifierRefreshData)).RefreshCityOptions(ref val5, policies);
					m_CityData[entity] = val5;
				}
				if (m_CityModifierRefreshData.m_CityModifierData.HasBuffer(policy) && m_CityModifiers.HasBuffer(entity))
				{
					NativeList<CityModifierData> val6 = default(NativeList<CityModifierData>);
					val6..ctor(10, AllocatorHandle.op_Implicit((Allocator)2));
					DynamicBuffer<CityModifier> val7 = m_CityModifiers[entity];
					((CityModifierRefreshData)(ref m_CityModifierRefreshData)).RefreshCityModifiers(val7, policies, m_EffectProviderChunks, val6);
					val6.Dispose();
				}
				((EntityCommandBuffer)(ref m_CommandBuffer)).AddComponent<Updated>(entity);
			}

			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 ComponentTypeHandle<Modify> __Game_Policies_Modify_RO_ComponentTypeHandle;

			public ComponentLookup<District> __Game_Areas_District_RW_ComponentLookup;

			public ComponentLookup<Building> __Game_Buildings_Building_RW_ComponentLookup;

			public ComponentLookup<Route> __Game_Routes_Route_RW_ComponentLookup;

			public ComponentLookup<City> __Game_City_City_RW_ComponentLookup;

			public BufferLookup<DistrictModifier> __Game_Areas_DistrictModifier_RW_BufferLookup;

			public BufferLookup<BuildingModifier> __Game_Buildings_BuildingModifier_RW_BufferLookup;

			public BufferLookup<RouteModifier> __Game_Routes_RouteModifier_RW_BufferLookup;

			public BufferLookup<CityModifier> __Game_City_CityModifier_RW_BufferLookup;

			public BufferLookup<Policy> __Game_Policies_Policy_RW_BufferLookup;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				__Game_Policies_Modify_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Modify>(true);
				__Game_Areas_District_RW_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<District>(false);
				__Game_Buildings_Building_RW_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Building>(false);
				__Game_Routes_Route_RW_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Route>(false);
				__Game_City_City_RW_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<City>(false);
				__Game_Areas_DistrictModifier_RW_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<DistrictModifier>(false);
				__Game_Buildings_BuildingModifier_RW_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<BuildingModifier>(false);
				__Game_Routes_RouteModifier_RW_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<RouteModifier>(false);
				__Game_City_CityModifier_RW_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<CityModifier>(false);
				__Game_Policies_Policy_RW_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<Policy>(false);
			}
		}

		private EntityQuery m_EventQuery;

		private EntityQuery m_EffectProviderQuery;

		private ModificationBarrier4 m_ModificationBarrier;

		private TriggerSystem m_TriggerSystem;

		private NativeQueue<PolicyEventInfo> m_PolicyEventInfos;

		private DistrictModifierRefreshData m_DistrictModifierRefreshData;

		private BuildingModifierRefreshData m_BuildingModifierRefreshData;

		private RouteModifierInitializeSystem.RouteModifierRefreshData m_RouteModifierRefreshData;

		private CityModifierRefreshData m_CityModifierRefreshData;

		private TypeHandle __TypeHandle;

		[Preserve]
		[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_0014: 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_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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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)
			((GameSystemBase)this).OnCreate();
			m_PolicyEventInfos = new NativeQueue<PolicyEventInfo>(AllocatorHandle.op_Implicit((Allocator)4));
			m_DistrictModifierRefreshData = new DistrictModifierRefreshData((SystemBase)(object)this);
			m_BuildingModifierRefreshData = new BuildingModifierRefreshData((SystemBase)(object)this);
			m_RouteModifierRefreshData = new RouteModifierInitializeSystem.RouteModifierRefreshData((SystemBase)(object)this);
			m_CityModifierRefreshData = new CityModifierRefreshData((SystemBase)(object)this);
			m_EventQuery = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<Event>(),
				ComponentType.ReadOnly<Modify>()
			});
			m_EffectProviderQuery = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[4]
			{
				ComponentType.ReadOnly<CityEffectProvider>(),
				ComponentType.Exclude<Deleted>(),
				ComponentType.Exclude<Destroyed>(),
				ComponentType.Exclude<Temp>()
			});
			m_ModificationBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ModificationBarrier4>();
			m_TriggerSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<TriggerSystem>();
			((ComponentSystemBase)this).RequireForUpdate(m_EventQuery);
		}

		[Preserve]
		[Preserve]
		protected override void OnUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: 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_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			JobHandle val = default(JobHandle);
			NativeList<ArchetypeChunk> effectProviderChunks = ((EntityQuery)(ref m_EffectProviderQuery)).ToArchetypeChunkListAsync(AllocatorHandle.op_Implicit((Allocator)3), ref val);
			((DistrictModifierRefreshData)(ref m_DistrictModifierRefreshData)).Update((SystemBase)(object)this);
			((BuildingModifierRefreshData)(ref m_BuildingModifierRefreshData)).Update((SystemBase)(object)this);
			m_RouteModifierRefreshData.Update((SystemBase)(object)this);
			((CityModifierRefreshData)(ref m_CityModifierRefreshData)).Update((SystemBase)(object)this);
			NativeQueue<TriggerAction> val2 = (((ComponentSystemBase)m_TriggerSystem).Enabled ? m_TriggerSystem.CreateActionBuffer() : new NativeQueue<TriggerAction>(AllocatorHandle.op_Implicit((Allocator)3)));
			__TypeHandle.__Game_Policies_Policy_RW_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_City_CityModifier_RW_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Routes_RouteModifier_RW_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Buildings_BuildingModifier_RW_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Areas_DistrictModifier_RW_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_City_City_RW_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Routes_Route_RW_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Buildings_Building_RW_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Areas_District_RW_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Policies_Modify_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			ModifyPolicyJob modifyPolicyJob = default(ModifyPolicyJob);
			modifyPolicyJob.m_DistrictModifierRefreshData = m_DistrictModifierRefreshData;
			modifyPolicyJob.m_BuildingModifierRefreshData = m_BuildingModifierRefreshData;
			modifyPolicyJob.m_RouteModifierRefreshData = m_RouteModifierRefreshData;
			modifyPolicyJob.m_CityModifierRefreshData = m_CityModifierRefreshData;
			modifyPolicyJob.m_EffectProviderChunks = effectProviderChunks;
			modifyPolicyJob.m_ModifyType = __TypeHandle.__Game_Policies_Modify_RO_ComponentTypeHandle;
			modifyPolicyJob.m_TriggerBuffer = val2.AsParallelWriter();
			modifyPolicyJob.m_DistrictData = __TypeHandle.__Game_Areas_District_RW_ComponentLookup;
			modifyPolicyJob.m_BuildingData = __TypeHandle.__Game_Buildings_Building_RW_ComponentLookup;
			modifyPolicyJob.m_RouteData = __TypeHandle.__Game_Routes_Route_RW_ComponentLookup;
			modifyPolicyJob.m_CityData = __TypeHandle.__Game_City_City_RW_ComponentLookup;
			modifyPolicyJob.m_DistrictModifiers = __TypeHandle.__Game_Areas_DistrictModifier_RW_BufferLookup;
			modifyPolicyJob.m_BuildingModifiers = __TypeHandle.__Game_Buildings_BuildingModifier_RW_BufferLookup;
			modifyPolicyJob.m_RouteModifiers = __TypeHandle.__Game_Routes_RouteModifier_RW_BufferLookup;
			modifyPolicyJob.m_CityModifiers = __TypeHandle.__Game_City_CityModifier_RW_BufferLookup;
			modifyPolicyJob.m_Policies = __TypeHandle.__Game_Policies_Policy_RW_BufferLookup;
			modifyPolicyJob.m_PolicyEventInfos = m_PolicyEventInfos.AsParallelWriter();
			modifyPolicyJob.m_CommandBuffer = ((SafeCommandBufferSystem)m_ModificationBarrier).CreateCommandBuffer();
			ModifyPolicyJob modifyPolicyJob2 = modifyPolicyJob;
			JobHandle val3 = JobChunkExtensions.Schedule<ModifyPolicyJob>(modifyPolicyJob2, m_EventQuery, JobHandle.CombineDependencies(((SystemBase)this).Dependency, val));
			effectProviderChunks.Dispose(val3);
			((EntityCommandBufferSystem)m_ModificationBarrier).AddJobHandleForProducer(val3);
			if (((ComponentSystemBase)m_TriggerSystem).Enabled)
			{
				m_TriggerSystem.AddActionBufferWriter(val3);
			}
			else
			{
				val2.Dispose(val3);
			}
			((SystemBase)this).Dependency = val3;
			((JobHandle)(ref val3)).Complete();
			while (m_PolicyEventInfos.Count > 0)
			{
				Telemetry.Policy(m_PolicyEventInfos.Dequeue());
			}
		}

		[Preserve]
		[Preserve]
		protected override void OnDestroy()
		{
			m_PolicyEventInfos.Dispose();
		}

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

		[Preserve]
		[Preserve]
		public ModifiedSystem()
		{
		}
	}
	[BepInPlugin("TransportPolicyAdjuster", "TransportPolicyAdjuster", "1.2.0")]
	[HarmonyPatch]
	public class PublicTransportSettingsPlugin : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected I4, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TransportPolicyAdjuster is loaded!");
			OperatingSystemFamily operatingSystemFamily = SystemInfo.operatingSystemFamily;
			if (1 == 0)
			{
			}
			string text = (operatingSystemFamily - 1) switch
			{
				0 => "TransportPolicyAdjuster_mac_x86_64.bundle", 
				1 => "TransportPolicyAdjuster_win_x86_64.dll", 
				2 => "TransportPolicyAdjuster_linux_x86_64.so", 
				_ => throw new NotImplementedException(), 
			};
			if (1 == 0)
			{
			}
			string text2 = text;
			BurstRuntime.LoadAdditionalLibrary(text2);
			Harmony.CreateAndPatchAll(typeof(PublicTransportSettingsPlugin).Assembly, "TransportPolicyAdjuster");
		}

		[HarmonyPatch(typeof(SystemOrder), "Initialize", new Type[] { typeof(UpdateSystem) })]
		[HarmonyPostfix]
		private static void InjectSystems(UpdateSystem updateSystem)
		{
			updateSystem.UpdateAt<ModifiedSystem>((SystemUpdatePhase)6);
		}

		[HarmonyPatch(typeof(ModifiedSystem), "OnUpdate")]
		[HarmonyPrefix]
		private static bool OnUpdate(ref ModifiedSystem __instance)
		{
			((ComponentSystemBase)__instance).Enabled = false;
			return false;
		}
	}
	public static class ReflectionExtensions
	{
		public static T GetMemberValue<T>(this object obj, string memberName)
		{
			MemberInfo memberInfo = GetMemberInfo(obj, memberName);
			object obj2 = null;
			try
			{
				if (memberInfo is PropertyInfo)
				{
					obj2 = memberInfo.As<PropertyInfo>().GetValue(obj, null);
					return (T)obj2;
				}
				if (memberInfo is FieldInfo)
				{
					obj2 = memberInfo.As<FieldInfo>().GetValue(obj);
					return (T)obj2;
				}
				throw new Exception("ReflectionExtensions: Couldn't find member name: " + memberName + "!");
			}
			catch (InvalidCastException)
			{
				throw new Exception("Cannot cast " + obj2.GetType().FullName + " to " + typeof(T).GetType().FullName);
			}
		}

		public static T SetMemberValue<T>(this object obj, string memberName, T newValue)
		{
			MemberInfo memberInfo = GetMemberInfo(obj, memberName);
			T memberValue = obj.GetMemberValue<T>(memberName);
			if (memberInfo is PropertyInfo)
			{
				memberInfo.As<PropertyInfo>().SetValue(obj, newValue, null);
			}
			else if (memberInfo is FieldInfo)
			{
				memberInfo.As<FieldInfo>().SetValue(obj, newValue);
			}
			return memberValue;
		}

		private static MemberInfo GetMemberInfo(object obj, string memberName)
		{
			List<PropertyInfo> source = new List<PropertyInfo> { obj.GetType().GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy) };
			source = source.Where((PropertyInfo i) => (object)i != null).ToList();
			if (source.Count != 0)
			{
				return source[0];
			}
			List<FieldInfo> source2 = new List<FieldInfo> { obj.GetType().GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy) };
			source2 = source2.Where((FieldInfo i) => (object)i != null).ToList();
			if (source2.Count != 0)
			{
				return source2[0];
			}
			return null;
		}

		[DebuggerHidden]
		private static T As<T>(this object obj)
		{
			return (T)obj;
		}
	}
	[HarmonyPatch]
	public class RouteModifierInitializeSystem
	{
		[BurstCompile]
		public struct InitializeRouteModifiersJob : IJobChunk
		{
			[ReadOnly]
			public RouteModifierRefreshData m_RouteModifierRefreshData;

			[ReadOnly]
			public BufferTypeHandle<Policy> m_PolicyType;

			public ComponentTypeHandle<Route> m_RouteType;

			public BufferTypeHandle<RouteModifier> m_RouteModifierType;

			public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				NativeArray<Route> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Route>(ref m_RouteType);
				BufferAccessor<RouteModifier> bufferAccessor = ((ArchetypeChunk)(ref chunk)).GetBufferAccessor<RouteModifier>(ref m_RouteModifierType);
				BufferAccessor<Policy> bufferAccessor2 = ((ArchetypeChunk)(ref chunk)).GetBufferAccessor<Policy>(ref m_PolicyType);
				for (int i = 0; i < nativeArray.Length; i++)
				{
					DynamicBuffer<Policy> policies = bufferAccessor2[i];
					if (policies.Length != 0)
					{
						Route route = nativeArray[i];
						m_RouteModifierRefreshData.RefreshRouteOptions(ref route, policies);
						nativeArray[i] = route;
						if (bufferAccessor.Length != 0)
						{
							DynamicBuffer<RouteModifier> modifiers = bufferAccessor[i];
							m_RouteModifierRefreshData.RefreshRouteModifiers(modifiers, policies);
						}
					}
				}
			}

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

		public struct RouteModifierRefreshData
		{
			public ComponentLookup<PolicySliderData> m_PolicySliderData;

			public ComponentLookup<RouteOptionData> m_RouteOptionData;

			public BufferLookup<RouteModifierData> m_RouteModifierData;

			public RouteModifierRefreshData(SystemBase system)
			{
				//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_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				m_PolicySliderData = system.GetComponentLookup<PolicySliderData>(true);
				m_RouteOptionData = system.GetComponentLookup<RouteOptionData>(true);
				m_RouteModifierData = system.GetBufferLookup<RouteModifierData>(true);
			}

			public RouteModifierRefreshData(RouteModifierRefreshData data)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: 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_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_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_0020: Unknown result type (might be due to invalid IL or missing references)
				m_PolicySliderData = data.m_PolicySliderData;
				m_RouteOptionData = data.m_RouteOptionData;
				m_RouteModifierData = data.m_RouteModifierData;
			}

			public void Update(SystemBase system)
			{
				m_PolicySliderData.Update(system);
				m_RouteOptionData.Update(system);
				m_RouteModifierData.Update(system);
			}

			public void RefreshRouteOptions(ref Route route, DynamicBuffer<Policy> policies)
			{
				//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_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_001d: 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_0027: 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_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				route.m_OptionMask = 0u;
				for (int i = 0; i < policies.Length; i++)
				{
					Policy val = policies[i];
					if ((val.m_Flags & 1) != 0 && m_RouteOptionData.HasComponent(val.m_Policy))
					{
						RouteOptionData val2 = m_RouteOptionData[val.m_Policy];
						route.m_OptionMask |= val2.m_OptionMask;
					}
				}
			}

			public void RefreshRouteModifiers(DynamicBuffer<RouteModifier> modifiers, DynamicBuffer<Policy> policies)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0021: 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_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				modifiers.Clear();
				for (int i = 0; i < policies.Length; i++)
				{
					Policy val = policies[i];
					if ((val.m_Flags & 1) == 0 || !m_RouteModifierData.HasBuffer(val.m_Policy))
					{
						continue;
					}
					DynamicBuffer<RouteModifierData> val2 = m_RouteModifierData[val.m_Policy];
					for (int j = 0; j < val2.Length; j++)
					{
						RouteModifierData val3 = val2[j];
						float delta;
						if (m_PolicySliderData.HasComponent(val.m_Policy))
						{
							PolicySliderData val4 = m_PolicySliderData[val.m_Policy];
							float num = (val.m_Adjustment - val4.m_Range.min) / (val4.m_Range.max - val4.m_Range.min);
							num = math.select(num, 0f, val4.m_Range.min == val4.m_Range.max);
							delta = math.lerp(val3.m_Range.min, val3.m_Range.max, num);
						}
						else
						{
							delta = val3.m_Range.min;
						}
						AddModifier(modifiers, val3, delta);
					}
				}
			}

			public static void AddModifier(DynamicBuffer<RouteModifier> modifiers, RouteModifierData modifierData, float delta)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Invalid comparison between I4 and Unknown
				//IL_0008: 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_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected I4, but got Unknown
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0057: Expected I4, but got Unknown
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Expected I4, but got Unknown
				while (modifiers.Length <= (int)modifierData.m_Type)
				{
					modifiers.Add(default(RouteModifier));
				}
				RouteModifier val = modifiers[(int)modifierData.m_Type];
				ModifierValueMode mode = modifierData.m_Mode;
				ModifierValueMode val2 = mode;
				switch ((int)val2)
				{
				case 0:
					val.m_Delta.y = val.m_Delta.y * (1f + delta) + delta;
					break;
				case 1:
					val.m_Delta.x += delta;
					break;
				case 2:
					delta = 1f / math.max(0.001f, 1f + delta) - 1f;
					val.m_Delta.y = val.m_Delta.y * (1f + delta) + delta;
					break;
				}
				modifiers[(int)modifierData.m_Type] = val;
			}
		}

		[HarmonyPatch(typeof(RouteModifierInitializeSystem), "OnUpdate")]
		[HarmonyPrefix]
		public static bool OnUpdate(ref RouteModifierInitializeSystem __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			RouteModifierRefreshData memberValue = __instance.GetMemberValue<RouteModifierRefreshData>("m_RouteModifierRefreshData");
			((RouteModifierRefreshData)(ref memberValue)).Update((SystemBase)(object)__instance);
			object memberValue2 = __instance.GetMemberValue<object>("__TypeHandle");
			BufferTypeHandle<RouteModifier> memberValue3 = memberValue2.GetMemberValue<BufferTypeHandle<RouteModifier>>("__Game_Routes_RouteModifier_RW_BufferTypeHandle");
			memberValue3.Update(ref ((SystemBase)__instance).CheckedStateRef);
			ComponentTypeHandle<Route> memberValue4 = memberValue2.GetMemberValue<ComponentTypeHandle<Route>>("__Game_Routes_Route_RW_ComponentTypeHandle");
			memberValue4.Update(ref ((SystemBase)__instance).CheckedStateRef);
			BufferTypeHandle<Policy> memberValue5 = memberValue2.GetMemberValue<BufferTypeHandle<Policy>>("__Game_Policies_Policy_RO_BufferTypeHandle");
			memberValue5.Update(ref ((SystemBase)__instance).CheckedStateRef);
			InitializeRouteModifiersJob initializeRouteModifiersJob = default(InitializeRouteModifiersJob);
			initializeRouteModifiersJob.m_RouteModifierRefreshData = new RouteModifierRefreshData(memberValue);
			initializeRouteModifiersJob.m_PolicyType = memberValue5;
			initializeRouteModifiersJob.m_RouteType = memberValue4;
			initializeRouteModifiersJob.m_RouteModifierType = memberValue3;
			InitializeRouteModifiersJob initializeRouteModifiersJob2 = initializeRouteModifiersJob;
			InitializeRouteModifiersJob initializeRouteModifiersJob3 = initializeRouteModifiersJob2;
			JobHandle memberValue6 = __instance.GetMemberValue<JobHandle>("Dependency");
			__instance.SetMemberValue<JobHandle>("Dependency", JobChunkExtensions.ScheduleParallel<InitializeRouteModifiersJob>(initializeRouteModifiersJob3, __instance.GetMemberValue<EntityQuery>("m_CreatedQuery"), memberValue6));
			return false;
		}
	}
	[HarmonyPatch]
	public class VehicleCountSection
	{
		[BurstCompile]
		public struct CalculateVehicleCountJob : IJob
		{
			[ReadOnly]
			public Entity m_SelectedEntity;

			[ReadOnly]
			public Entity m_SelectedPrefab;

			[ReadOnly]
			public Entity m_VehicleCountPolicy;

			[ReadOnly]
			public ComponentLookup<VehicleTiming> m_VehicleTimings;

			[ReadOnly]
			public ComponentLookup<PathInformation> m_PathInformations;

			[ReadOnly]
			public ComponentLookup<TransportLineData> m_TransportLineDatas;

			[ReadOnly]
			public ComponentLookup<PolicySliderData> m_PolicySliderDatas;

			[ReadOnly]
			public BufferLookup<RouteVehicle> m_RouteVehicles;

			[ReadOnly]
			public BufferLookup<RouteWaypoint> m_RouteWaypoints;

			[ReadOnly]
			public BufferLookup<RouteSegment> m_RouteSegments;

			[ReadOnly]
			public BufferLookup<RouteModifier> m_RouteModifiers;

			[ReadOnly]
			public BufferLookup<RouteModifierData> m_RouteModifierDatas;

			public NativeArray<int> m_IntResults;

			public NativeList<float2> m_CountResults;

			public void Execute()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_005a: 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_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Invalid comparison between Unknown and I4
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				TransportLineData val = m_TransportLineDatas[m_SelectedPrefab];
				DynamicBuffer<RouteVehicle> val2 = m_RouteVehicles[m_SelectedEntity];
				DynamicBuffer<RouteModifier> val3 = m_RouteModifiers[m_SelectedEntity];
				DynamicBuffer<RouteModifierData> val4 = m_RouteModifierDatas[m_VehicleCountPolicy];
				PolicySliderData val5 = m_PolicySliderDatas[m_VehicleCountPolicy];
				float defaultVehicleInterval = val.m_DefaultVehicleInterval;
				float vehicleInterval = defaultVehicleInterval;
				RouteUtils.ApplyModifier(ref vehicleInterval, val3, (RouteModifierType)1);
				float num = CalculateStableDuration(val);
				float2 val7 = default(float2);
				for (int i = 0; i < val4.Length; i++)
				{
					RouteModifierData val6 = val4[i];
					if ((int)val6.m_Type == 1)
					{
						ref NativeList<float2> countResults = ref m_CountResults;
						for (int j = 1; j <= 50; j++)
						{
							float num2 = 100f / (num / (defaultVehicleInterval * (float)j));
							((float2)(ref val7))..ctor((float)j * val5.m_Step, num2);
							countResults.Add(ref val7);
						}
					}
				}
				m_IntResults[0] = CalculateVehicleCount(vehicleInterval, num);
				m_IntResults[1] = val2.Length;
			}

			private int CalculateVehicleCount(float vehicleInterval, float lineDuration)
			{
				return math.max(1, (int)math.round(lineDuration / math.max(1f, vehicleInterval)));
			}

			private float CalculateStableDuration(TransportLineData transportLineData)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: 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_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00b3: 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_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: 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)
				DynamicBuffer<RouteWaypoint> val = m_RouteWaypoints[m_SelectedEntity];
				DynamicBuffer<RouteSegment> val2 = m_RouteSegments[m_SelectedEntity];
				int num = 0;
				for (int i = 0; i < val.Length; i++)
				{
					if (m_VehicleTimings.HasComponent(val[i].m_Waypoint))
					{
						num = i;
						break;
					}
				}
				float num2 = 0f;
				PathInformation val4 = default(PathInformation);
				for (int j = 0; j < val.Length; j++)
				{
					int2 val3 = int2.op_Implicit(num + j);
					val3.y++;
					val3 = math.select(val3, val3 - val.Length, val3 >= val.Length);
					Entity waypoint = val[val3.y].m_Waypoint;
					Entity segment = val2[val3.x].m_Segment;
					if (m_PathInformations.TryGetComponent(segment, ref val4))
					{
						num2 += val4.m_Duration;
					}
					if (m_VehicleTimings.HasComponent(waypoint))
					{
						num2 += transportLineData.m_StopDuration;
					}
				}
				return num2;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(VehicleCountSection), "Visible")]
		public static bool Visible(VehicleCountSection instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(VehicleCountSection), "OnSetVehicleCount")]
		[HarmonyPrefix]
		public static bool OnSetVehicleCount(float newVehicleCount, ref VehicleCountSection __instance)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			PoliciesUISystem memberValue = __instance.GetMemberValue<PoliciesUISystem>("m_PoliciesUISystem");
			Entity memberValue2 = __instance.GetMemberValue<Entity>("selectedEntity");
			Entity memberValue3 = __instance.GetMemberValue<Entity>("m_VehicleCountPolicy");
			NativeList<float2> memberValue4 = __instance.GetMemberValue<NativeList<float2>>("m_CountResult");
			float2? val = null;
			for (int i = 0; i < memberValue4.Length; i++)
			{
				if (memberValue4[i].x == newVehicleCount)
				{
					val = memberValue4[i];
					break;
				}
			}
			if (!val.HasValue)
			{
				throw new Exception($"TransportPolicyAdjuster: m_CountResult does not contain index {newVehicleCount}");
			}
			memberValue.SetPolicy(memberValue2, memberValue3, true, val.Value.y);
			return false;
		}

		[HarmonyPatch(typeof(VehicleCountSection), "OnWriteProperties")]
		[HarmonyPrefix]
		public static bool OnWriteProperties(ref IJsonWriter writer, ref VehicleCountSection __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			writer.PropertyName("vehicleCount");
			writer.Write(__instance.GetMemberValue<int>("vehicleCount"));
			writer.PropertyName("activeVehicles");
			writer.Write(__instance.GetMemberValue<int>("activeVehicles"));
			writer.PropertyName("vehicleCounts");
			int num = 50;
			JsonWriterExtensions.ArrayBegin(writer, num);
			for (int i = 1; i <= num; i++)
			{
				MathematicsWriters.Write(writer, new float2((float)(i * 10), (float)i));
			}
			writer.ArrayEnd();
			return false;
		}

		[HarmonyPatch(typeof(VehicleCountSection), "OnUpdate")]
		[HarmonyPrefix]
		public static bool OnUpdate(ref VehicleCountSection __instance)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: 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_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			__instance.SetMemberValue("visible", Visible(__instance));
			object memberValue = __instance.GetMemberValue<object>("__TypeHandle");
			if (((InfoSectionBase)__instance).visible)
			{
				BufferLookup<RouteModifierData> memberValue2 = memberValue.GetMemberValue<BufferLookup<RouteModifierData>>("__Game_Prefabs_RouteModifierData_RO_BufferLookup");
				memberValue2.Update(ref ((SystemBase)__instance).CheckedStateRef);
				BufferLookup<RouteModifier> memberValue3 = memberValue.GetMemberValue<BufferLookup<RouteModifier>>("__Game_Routes_RouteModifier_RO_BufferLookup");
				memberValue3.Update(ref ((SystemBase)__instance).CheckedStateRef);
				BufferLookup<RouteSegment> memberValue4 = memberValue.GetMemberValue<BufferLookup<RouteSegment>>("__Game_Routes_RouteSegment_RO_BufferLookup");
				memberValue4.Update(ref ((SystemBase)__instance).CheckedStateRef);
				BufferLookup<RouteWaypoint> memberValue5 = memberValue.GetMemberValue<BufferLookup<RouteWaypoint>>("__Game_Routes_RouteWaypoint_RO_BufferLookup");
				memberValue5.Update(ref ((SystemBase)__instance).CheckedStateRef);
				BufferLookup<RouteVehicle> memberValue6 = memberValue.GetMemberValue<BufferLookup<RouteVehicle>>("__Game_Routes_RouteVehicle_RO_BufferLookup");
				memberValue6.Update(ref ((SystemBase)__instance).CheckedStateRef);
				ComponentLookup<PathInformation> memberValue7 = memberValue.GetMemberValue<ComponentLookup<PathInformation>>("__Game_Pathfind_PathInformation_RO_ComponentLookup");
				memberValue7.Update(ref ((SystemBase)__instance).CheckedStateRef);
				ComponentLookup<VehicleTiming> memberValue8 = memberValue.GetMemberValue<ComponentLookup<VehicleTiming>>("__Game_Routes_VehicleTiming_RO_ComponentLookup");
				memberValue8.Update(ref ((SystemBase)__instance).CheckedStateRef);
				ComponentLookup<PolicySliderData> memberValue9 = memberValue.GetMemberValue<ComponentLookup<PolicySliderData>>("__Game_Prefabs_PolicySliderData_RO_ComponentLookup");
				memberValue9.Update(ref ((SystemBase)__instance).CheckedStateRef);
				ComponentLookup<TransportLineData> memberValue10 = memberValue.GetMemberValue<ComponentLookup<TransportLineData>>("__Game_Prefabs_TransportLineData_RO_ComponentLookup");
				memberValue10.Update(ref ((SystemBase)__instance).CheckedStateRef);
				CalculateVehicleCountJob calculateVehicleCountJob = default(CalculateVehicleCountJob);
				calculateVehicleCountJob.m_SelectedEntity = __instance.GetMemberValue<Entity>("selectedEntity");
				calculateVehicleCountJob.m_SelectedPrefab = __instance.GetMemberValue<Entity>("selectedPrefab");
				calculateVehicleCountJob.m_VehicleCountPolicy = __instance.GetMemberValue<Entity>("m_VehicleCountPolicy");
				calculateVehicleCountJob.m_TransportLineDatas = memberValue10;
				calculateVehicleCountJob.m_PolicySliderDatas = memberValue9;
				calculateVehicleCountJob.m_VehicleTimings = memberValue8;
				calculateVehicleCountJob.m_PathInformations = memberValue7;
				calculateVehicleCountJob.m_RouteVehicles = memberValue6;
				calculateVehicleCountJob.m_RouteWaypoints = memberValue5;
				calculateVehicleCountJob.m_RouteSegments = memberValue4;
				calculateVehicleCountJob.m_RouteModifiers = memberValue3;
				calculateVehicleCountJob.m_RouteModifierDatas = memberValue2;
				calculateVehicleCountJob.m_IntResults = __instance.GetMemberValue<NativeArray<int>>("m_IntResults");
				calculateVehicleCountJob.m_CountResults = __instance.GetMemberValue<NativeList<float2>>("m_CountResult");
				CalculateVehicleCountJob calculateVehicleCountJob2 = calculateVehicleCountJob;
				JobHandle val = IJobExtensions.Schedule<CalculateVehicleCountJob>(calculateVehicleCountJob2, __instance.GetMemberValue<JobHandle>("Dependency"));
				((JobHandle)(ref val)).Complete();
			}
			return false;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TransportPolicyAdjuster";

		public const string PLUGIN_NAME = "TransportPolicyAdjuster";

		public const string PLUGIN_VERSION = "1.2.0";
	}
}
[BurstCompile]
internal class __UnmanagedPostProcessorOutput__374239394
{
}
[DOTSCompilerGenerated]
internal class __JobReflectionRegistrationOutput__374239394
{
	public static void CreateJobReflectionData()
	{
		try
		{
			JobChunkExtensions.EarlyJobInit<ModifiedSystem.ModifyPolicyJob>();
			JobChunkExtensions.EarlyJobInit<RouteModifierInitializeSystem.InitializeRouteModifiersJob>();
			IJobExtensions.EarlyJobInit<VehicleCountSection.CalculateVehicleCountJob>();
		}
		catch (Exception ex)
		{
			EarlyInitHelpers.JobReflectionDataCreationFailed(ex);
		}
	}

	[RuntimeInitializeOnLoadMethod(/*Could not decode attribute arguments.*/)]
	public static void EarlyInit()
	{
		CreateJobReflectionData();
	}
}