Decompiled source of MultipleTools v0.0.3

MultipleTools.dll

Decompiled 9 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MultipleTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MultipleTools")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ff4e4061-daae-44bf-aa52-a71e9ff67624")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MultipleTools;

[BepInPlugin("cn.blacksnipe.dsp.MultipleTools", "MultipleTools", "0.0.3")]
public class MultipleTools : BaseUnityPlugin
{
	public class MultipleToolsPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(PowerSystem), "NewNodeComponent")]
		public static void NewNodeComponentPatchPrefix(PowerSystem __instance, ref int entityId, ref float conn, ref float cover)
		{
			short protoId = __instance.factory.entityPool[entityId].protoId;
			int powerGenId = __instance.factory.entityPool[entityId].powerGenId;
			switch (protoId)
			{
			case 2201:
				conn *= TeslaTowerConnectDistanceMultiple.Value;
				cover *= TeslaTowerCoverDistanceMultiple.Value;
				break;
			case 2202:
				conn *= WirelexxPowerTowerConnectDistanceMultiple.Value;
				cover *= WirelexxPowerTowerCoverDistanceMultiple.Value;
				break;
			case 2212:
				conn *= SatelliteSubstationConnectDistanceMultiple.Value;
				cover *= SatelliteSubstationCoverDistanceMultiple.Value;
				break;
			case 2203:
				conn *= WindTurbineConnectDistanceMultiple.Value;
				cover *= WindTurbineCoverDistanceMultiple.Value;
				__instance.genPool[powerGenId].genEnergyPerTick *= WindTurbineGenerateMultiple.Value;
				break;
			case 2204:
				conn *= ThermalPowerPlantConnectDistanceMultiple.Value;
				cover *= ThermalPowerPlantCoverDistanceMultiple.Value;
				__instance.genPool[powerGenId].genEnergyPerTick *= ThermalPowerPlantGenerateMultiple.Value;
				__instance.genPool[powerGenId].useFuelPerTick *= ThermalPowerPlantGenerateMultiple.Value;
				break;
			case 2205:
				__instance.genPool[powerGenId].genEnergyPerTick *= SolarPanelGenerateMultiple.Value;
				break;
			case 2210:
				conn *= ArtificialstarsConnectDistanceMultiple.Value;
				cover *= ArtificialstarsCoverDistanceMultiple.Value;
				__instance.genPool[powerGenId].genEnergyPerTick *= ArtificialstarsGenerateMultiple.Value;
				__instance.genPool[powerGenId].useFuelPerTick *= ArtificialstarsGenerateMultiple.Value;
				break;
			case 2211:
				conn *= MiniFusionPowerPlantConnectDistanceMultiple.Value;
				cover *= MiniFusionPowerPlantCoverDistanceMultiple.Value;
				__instance.genPool[powerGenId].genEnergyPerTick *= MiniFusionPowerPlantGenerateMultiple.Value;
				__instance.genPool[powerGenId].useFuelPerTick *= MiniFusionPowerPlantGenerateMultiple.Value;
				break;
			case 2213:
				conn *= GeothermalPowerStationConnectDistanceMultiple.Value;
				cover *= GeothermalPowerStationCoverDistanceMultiple.Value;
				__instance.genPool[powerGenId].genEnergyPerTick *= GeothermalPowerStationGenerateMultiple.Value;
				break;
			case 2206:
			case 2207:
			case 2208:
			case 2209:
				break;
			}
		}
	}

	public const string GUID = "cn.blacksnipe.dsp.MultipleTools";

	public const string NAME = "MultipleTools";

	public const string VERSION = "0.0.3";

	public static ConfigEntry<int> TeslaTowerConnectDistanceMultiple;

	public static ConfigEntry<int> TeslaTowerCoverDistanceMultiple;

	public static ConfigEntry<int> WirelexxPowerTowerConnectDistanceMultiple;

	public static ConfigEntry<int> WirelexxPowerTowerCoverDistanceMultiple;

	public static ConfigEntry<int> SatelliteSubstationConnectDistanceMultiple;

	public static ConfigEntry<int> SatelliteSubstationCoverDistanceMultiple;

	public static ConfigEntry<int> WindTurbineConnectDistanceMultiple;

	public static ConfigEntry<int> WindTurbineCoverDistanceMultiple;

	public static ConfigEntry<int> WindTurbineGenerateMultiple;

	public static ConfigEntry<int> ThermalPowerPlantConnectDistanceMultiple;

	public static ConfigEntry<int> ThermalPowerPlantCoverDistanceMultiple;

	public static ConfigEntry<int> ThermalPowerPlantGenerateMultiple;

	public static ConfigEntry<int> SolarPanelGenerateMultiple;

	public static ConfigEntry<int> GeothermalPowerStationConnectDistanceMultiple;

	public static ConfigEntry<int> GeothermalPowerStationCoverDistanceMultiple;

	public static ConfigEntry<int> GeothermalPowerStationGenerateMultiple;

	public static ConfigEntry<int> MiniFusionPowerPlantConnectDistanceMultiple;

	public static ConfigEntry<int> MiniFusionPowerPlantCoverDistanceMultiple;

	public static ConfigEntry<int> MiniFusionPowerPlantGenerateMultiple;

	public static ConfigEntry<int> ArtificialstarsGenerateMultiple;

	public static ConfigEntry<int> ArtificialstarsCoverDistanceMultiple;

	public static ConfigEntry<int> ArtificialstarsConnectDistanceMultiple;

	private void Start()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("cn.blacksnipe.dsp.MultipleTools");
		val.PatchAll(typeof(MultipleToolsPatch));
		TeslaTowerConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("电力感应塔连接距离倍率", "TeslaTowerConnectDistanceMultiple", 1, (ConfigDescription)null);
		TeslaTowerCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("电力感应塔覆盖距离倍率", "TeslaTowerCoverDistanceMultiple", 1, (ConfigDescription)null);
		WirelexxPowerTowerConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("无线输电塔连接距离倍率", "WirelexxPowerTowerConnectDistanceMultiple", 1, (ConfigDescription)null);
		WirelexxPowerTowerCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("无线输电塔覆盖距离倍率", "WirelexxPowerTowerCoverDistanceMultiple", 1, (ConfigDescription)null);
		SatelliteSubstationConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("卫星配电站连接距离倍率", "SatelliteSubstationConnectDistanceMultiple", 1, (ConfigDescription)null);
		SatelliteSubstationCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("卫星配电站覆盖距离倍率", "SatelliteSubstationCoverDistanceMultiple", 1, (ConfigDescription)null);
		WindTurbineConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("风力涡轮机连接距离倍率", "WindTurbineConnectDistanceMultiple", 1, (ConfigDescription)null);
		WindTurbineCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("风力涡轮机覆盖距离倍率", "WindTurbineCoverDistanceMultiple", 1, (ConfigDescription)null);
		WindTurbineGenerateMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("风力涡轮机发电倍率", "WindTurbineGenerateMultiple", 1, (ConfigDescription)null);
		ThermalPowerPlantConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("火力发电厂连接距离倍率", "ThermalPowerPlantConnectDistanceMultiple", 1, (ConfigDescription)null);
		ThermalPowerPlantCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("火力发电厂覆盖距离倍率", "ThermalPowerPlantCoverDistanceMultiple", 1, (ConfigDescription)null);
		ThermalPowerPlantGenerateMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("火力发电厂发电倍率", "ThermalPowerPlantGenerateMultiple", 1, (ConfigDescription)null);
		GeothermalPowerStationConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("地热发电站连接距离倍率", "GeothermalPowerStationConnectDistanceMultiple", 1, (ConfigDescription)null);
		GeothermalPowerStationCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("地热发电站覆盖距离倍率", "GeothermalPowerStationCoverDistanceMultiple", 1, (ConfigDescription)null);
		GeothermalPowerStationGenerateMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("地热发电站发电倍率", "GeothermalPowerStationGenerateMultiple", 1, (ConfigDescription)null);
		MiniFusionPowerPlantConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("微型聚变发电站连接距离倍率", "MiniFusionPowerPlantConnectDistanceMultiple", 1, (ConfigDescription)null);
		MiniFusionPowerPlantCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("微型聚变发电站覆盖距离倍率", "MiniFusionPowerPlantCoverDistanceMultiple", 1, (ConfigDescription)null);
		MiniFusionPowerPlantGenerateMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("微型聚变发电站发电倍率", "MiniFusionPowerPlantGenerateMultiple", 1, (ConfigDescription)null);
		SolarPanelGenerateMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("太阳能板发电倍率", "SolarPanelGenerateMultiple", 1, (ConfigDescription)null);
		ArtificialstarsGenerateMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("人造恒星发电倍率", "ArtificialstarsGenerateMultiple", 1, (ConfigDescription)null);
		ArtificialstarsCoverDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("人造恒星覆盖距离倍率", "ArtificialstarsCoverDistanceMultiple", 1, (ConfigDescription)null);
		ArtificialstarsConnectDistanceMultiple = ((BaseUnityPlugin)this).Config.Bind<int>("人造恒星连接距离倍率", "ArtificialstarsConnectDistanceMultiple", 1, (ConfigDescription)null);
	}
}