Decompiled source of CompanyProfitFix v0.1.0

CompanyProfitFix.dll

Decompiled 2 years ago
using System;
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 Game.Companies;
using Game.Economy;
using Game.Prefabs;
using Game.Simulation;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CompanyProfitFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: AssemblyInformationalVersion("0.1.0+4175539d64edbaf62167a6a775901068124e7ebb")]
[assembly: AssemblyProduct("CompanyProfitFix")]
[assembly: AssemblyTitle("CompanyProfitFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 CompanyProfitFix
{
	[BepInPlugin("CompanyProfitFix", "CompanyProfitFix", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			Harmony val = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "CompanyProfitFix_Cities2Harmony");
			MethodBase[] array = val.GetPatchedMethods().ToArray();
			Debug.Log((object)("Plugin CompanyProfitFix is loaded! Patched methods " + array.Length));
			MethodBase[] array2 = array;
			foreach (MethodBase methodBase in array2)
			{
				Debug.Log((object)("Patched method: " + methodBase.Module.Name + ":" + methodBase.Name));
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CompanyProfitFix";

		public const string PLUGIN_NAME = "CompanyProfitFix";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace CompanyProfitFix.Patches
{
	[HarmonyPatch(typeof(ProcessingCompanySystem), "EstimateDailyProfit")]
	public static class ProcessingCompanySystemPatches
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static bool Prefix(int production, int wages, IndustrialProcessData processData, ref EconomyParameterData economyParameters, DynamicBuffer<TradeCost> tradeCost, ResourcePrefabs resourcePrefabs, ComponentLookup<ResourceData> resourceDatas, ref int __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0016: 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_004e: 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_0077: 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_0065: 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_00aa: 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_00b5: 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_00ca: 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_00cd: 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)
			TradeCost tradeCost2 = EconomyUtils.GetTradeCost(processData.m_Output.m_Resource, tradeCost);
			float3 val = default(float3);
			val.x = 0f;
			if (float.IsNaN(tradeCost2.m_BuyCost))
			{
				val.x = tradeCost2.m_SellCost - 0f;
			}
			else if (float.IsNaN(tradeCost2.m_SellCost))
			{
				val.x = 0f - tradeCost2.m_BuyCost;
			}
			else
			{
				val.x = tradeCost2.m_SellCost - tradeCost2.m_BuyCost;
			}
			val.y = EconomyUtils.GetTradeCost(processData.m_Input1.m_Resource, tradeCost).m_BuyCost;
			val.z = EconomyUtils.GetTradeCost(processData.m_Input2.m_Resource, tradeCost).m_BuyCost;
			__result = ProcessingCompanySystem.EstimateDailyProfit(production, wages, processData, ref economyParameters, val, resourcePrefabs, resourceDatas);
			return false;
		}
	}
	[HarmonyPatch(typeof(TransportBoardingHelpers))]
	public static class TransferFixPatch
	{
	}
}