Decompiled source of Infinite Demand Mod v1.0.2

InfiniteDemand.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Colossal.Collections;
using Game.Simulation;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Mathematics;

[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("InfiniteDemand")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bb9d7308fd2e51929f61caad5f5a7c6177b12bd7")]
[assembly: AssemblyProduct("InfiniteDemand")]
[assembly: AssemblyTitle("InfiniteDemand")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 InfiniteDemand
{
	[HarmonyPatch(typeof(CommercialDemandSystem), "OnUpdate")]
	public class CommercialDemandSystemPatch
	{
		private static FieldRef<CommercialDemandSystem, NativeValue<int>> BuildingDemandRef = AccessTools.FieldRefAccess<CommercialDemandSystem, NativeValue<int>>("m_BuildingDemand");

		private static void Prefix(CommercialDemandSystem __instance)
		{
			BuildingDemandRef.Invoke(__instance).value = 255;
		}
	}
	[HarmonyPatch(typeof(IndustrialDemandSystem), "OnUpdate")]
	public class IndustrialDemandSystemPatch
	{
		private static FieldRef<IndustrialDemandSystem, NativeValue<int>> IndustrialBuildingDemandRef = AccessTools.FieldRefAccess<IndustrialDemandSystem, NativeValue<int>>("m_IndustrialBuildingDemand");

		private static FieldRef<IndustrialDemandSystem, NativeValue<int>> StorageBuildingDemand = AccessTools.FieldRefAccess<IndustrialDemandSystem, NativeValue<int>>("m_StorageBuildingDemand");

		private static FieldRef<IndustrialDemandSystem, NativeValue<int>> OfficeBuildingDemand = AccessTools.FieldRefAccess<IndustrialDemandSystem, NativeValue<int>>("m_OfficeBuildingDemand");

		private static void Prefix(IndustrialDemandSystem __instance)
		{
			IndustrialBuildingDemandRef.Invoke(__instance).value = 255;
			StorageBuildingDemand.Invoke(__instance).value = 255;
			OfficeBuildingDemand.Invoke(__instance).value = 255;
		}
	}
	[HarmonyPatch(typeof(ResidentialDemandSystem), "OnUpdate")]
	public class ResidentialDemandSystemPatch
	{
		private static FieldRef<ResidentialDemandSystem, NativeValue<int3>> BuildingDemandRef = AccessTools.FieldRefAccess<ResidentialDemandSystem, NativeValue<int3>>("m_BuildingDemand");

		private static FieldRef<ResidentialDemandSystem, NativeValue<int>> HouseholdDemandRef = AccessTools.FieldRefAccess<ResidentialDemandSystem, NativeValue<int>>("m_HouseholdDemand");

		private static void Prefix(ResidentialDemandSystem __instance)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			BuildingDemandRef.Invoke(__instance).value = int3.op_Implicit(255);
			HouseholdDemandRef.Invoke(__instance).value = 255;
		}
	}
	[BepInPlugin("net.johnytoxic.infinitedemand", "Infinite Demand Mod", "1.0.0")]
	public class InfiniteDemandMod : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("net.johnytoxic.infinitedemand").PatchAll();
		}
	}
}