Decompiled source of WeatherInjector v1.0.0

WeatherInjector.dll

Decompiled a day ago
using System;
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;
using MrovLib;
using MrovLib.Events;
using WeatherRegistry;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("WeatherInjector")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WeatherInjector")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("744944a1-3e69-4d97-a708-cdaf12151b51")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace WeatherInjector;

[BepInPlugin("ZetaArcade.WeatherInjector", "WeatherInjector", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class WeatherInjectorBase : BaseUnityPlugin
{
	private const string modGUID = "ZetaArcade.WeatherInjector";

	private const string modName = "WeatherInjector";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("ZetaArcade.WeatherInjector");

	private void Awake()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		((CustomEvent)EventManager.SetupFinished).AddListener(new Event(OnSetupFinished));
		ConfigManager.Init(((BaseUnityPlugin)this).Config);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin is loaded!");
		harmony.PatchAll(typeof(WeatherInjectorBase));
	}

	private void OnSetupFinished()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: 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_00e8: Expected O, but got Unknown
		//IL_014a: 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_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: 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_017c: Expected O, but got Unknown
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: 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_0210: Expected O, but got Unknown
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Injecting weathers!");
		int num = 0;
		LevelRarity[] value = ((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.DustInjectionLevels).Value;
		foreach (LevelRarity val in value)
		{
			RandomWeatherWithVariables val2 = new RandomWeatherWithVariables
			{
				weatherType = (LevelWeatherType)0,
				weatherVariable = ((Rarity)val).Weight,
				weatherVariable2 = ((Rarity)((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.DustInjectionLevels2).Value[num]).Weight
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Injecting DustClouds into " + (object)val));
			WeatherController.AddRandomWeather(val.Level, val2);
			num++;
		}
		num = 0;
		LevelRarity[] value2 = ((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.RainInjectionLevels).Value;
		foreach (LevelRarity val3 in value2)
		{
			RandomWeatherWithVariables val4 = new RandomWeatherWithVariables
			{
				weatherType = (LevelWeatherType)1,
				weatherVariable = ((Rarity)val3).Weight,
				weatherVariable2 = ((Rarity)((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.RainInjectionLevels2).Value[num]).Weight
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Injecting Rainy into " + (object)val3));
			WeatherController.AddRandomWeather(val3.Level, val4);
			num++;
		}
		num = 0;
		LevelRarity[] value3 = ((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.FogInjectionLevels).Value;
		foreach (LevelRarity val5 in value3)
		{
			RandomWeatherWithVariables val6 = new RandomWeatherWithVariables
			{
				weatherType = (LevelWeatherType)3,
				weatherVariable = ((Rarity)val5).Weight,
				weatherVariable2 = ((Rarity)((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.FogInjectionLevels2).Value[num]).Weight
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Injecting Foggy into " + (object)val5));
			WeatherController.AddRandomWeather(val5.Level, val6);
			num++;
		}
		num = 0;
		LevelRarity[] value4 = ((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.StormInjectionLevels).Value;
		foreach (LevelRarity val7 in value4)
		{
			RandomWeatherWithVariables val8 = new RandomWeatherWithVariables
			{
				weatherType = (LevelWeatherType)2,
				weatherVariable = ((Rarity)val7).Weight,
				weatherVariable2 = ((Rarity)((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.StormInjectionLevels2).Value[num]).Weight
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Injecting Stormy into " + (object)val7));
			WeatherController.AddRandomWeather(val7.Level, val8);
			num++;
		}
		num = 0;
		LevelRarity[] value5 = ((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.FloodInjectionLevels).Value;
		foreach (LevelRarity val9 in value5)
		{
			RandomWeatherWithVariables val10 = new RandomWeatherWithVariables
			{
				weatherType = (LevelWeatherType)4,
				weatherVariable = ((Rarity)val9).Weight,
				weatherVariable2 = ((Rarity)((ConfigHandler<LevelRarity[], string>)(object)ConfigManager.FloodInjectionLevels2).Value[num]).Weight
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Injecting Flooded into " + (object)val9));
			WeatherController.AddRandomWeather(val9.Level, val10);
			num++;
		}
	}
}
public class ConfigManager
{
	public static ConfigFile config;

	public static LevelWeightsConfigHandler RainInjectionLevels = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler DustInjectionLevels = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler StormInjectionLevels = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler FloodInjectionLevels = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler FogInjectionLevels = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler RainInjectionLevels2 = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler DustInjectionLevels2 = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler StormInjectionLevels2 = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler FloodInjectionLevels2 = new LevelWeightsConfigHandler("", true);

	public static LevelWeightsConfigHandler FogInjectionLevels2 = new LevelWeightsConfigHandler("", true);

	public static void Init(ConfigFile configFile)
	{
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Expected O, but got Unknown
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Expected O, but got Unknown
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Expected O, but got Unknown
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Expected O, but got Unknown
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Expected O, but got Unknown
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Expected O, but got Unknown
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Expected O, but got Unknown
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Expected O, but got Unknown
		config = configFile;
		((ConfigHandler<LevelRarity[], string>)(object)RainInjectionLevels).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)DustInjectionLevels).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)FogInjectionLevels).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)FloodInjectionLevels).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)StormInjectionLevels).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)RainInjectionLevels2).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)DustInjectionLevels2).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)FogInjectionLevels2).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)FloodInjectionLevels2).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)StormInjectionLevels2).ConfigFile = config;
		((ConfigHandler<LevelRarity[], string>)(object)DustInjectionLevels).SetConfigEntry("DustClouds", "Dust Clouds Levels + 1st Weather variable", new ConfigDescription("Levels to inject DustClouds weather into, in a semi-colon seperated list, with each entry being the moon name, followed by an @ and the first weather variable as an int E.g. Experimentation@0;Assurance@1;Gloom@2; If you don't know what a weather variable is, leave it as 0.", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)DustInjectionLevels2).SetConfigEntry("DustClouds", "Dust Clouds 2nd Weather Variable", new ConfigDescription("Paired with the above config, a semi-colon seperated list for the 2nd weather variable Experimentation@2;Assurance@5;Gloom@10;. Make sure it has the exact same order + count as the above moons!", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)RainInjectionLevels).SetConfigEntry("Rainy", "Rainy Levels + 1st Weather variable", new ConfigDescription("Levels to inject Rainy weather into, in a semi-colon seperated list, with each entry being the moon name, followed by an @ and the first weather variable as an int E.g. Experimentation@0;Assurance@1;Gloom@2; If you don't know what a weather variable is, leave it as 0.", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)RainInjectionLevels2).SetConfigEntry("Rainy", "Rainy 2nd Weather Variable", new ConfigDescription("Paired with the above config, a semi-colon seperated list for the 2nd weather variable Experimentation@2;Assurance@5;Gloom@10;. Make sure it has the exact same order + count as the above moons!", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)FogInjectionLevels).SetConfigEntry("Foggy", "Foggy Levels + 1st Weather variable", new ConfigDescription("Levels to inject Foggy weather into, in a semi-colon seperated list, with each entry being the moon name, followed by an @ and the first weather variable as an int E.g. Experimentation@0;Assurance@1;Gloom@2; If you don't know what a weather variable is, leave it as 0.", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)FogInjectionLevels2).SetConfigEntry("Foggy", "Foggy 2nd Weather Variable", new ConfigDescription("Paired with the above config, a semi-colon seperated list for the 2nd weather variable Experimentation@2;Assurance@5;Gloom@10;. Make sure it has the exact same order + count as the above moons!", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)FloodInjectionLevels).SetConfigEntry("Flooded", "Flooded Levels + 1st Weather variable", new ConfigDescription("Levels to inject Flooded weather into, in a semi-colon seperated list, with each entry being the moon name, followed by an @ and the first weather variable as an int E.g. Experimentation@0;Assurance@1;Gloom@2; If you don't know what a weather variable is, leave it as 0.", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)FloodInjectionLevels2).SetConfigEntry("Flooded", "Flooded 2nd Weather Variable", new ConfigDescription("Paired with the above config, a semi-colon seperated list for the 2nd weather variable Experimentation@2;Assurance@5;Gloom@10;. Make sure it has the exact same order + count as the above moons!", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)StormInjectionLevels).SetConfigEntry("Stormy", "Stormy Levels + 1st Weather variable", new ConfigDescription("Levels to inject Stormy weather into, in a semi-colon seperated list, with each entry being the moon name, followed by an @ and the first weather variable as an int E.g. Experimentation@0;Assurance@1;Gloom@2; If you don't know what a weather variable is, leave it as 0.", (AcceptableValueBase)null, Array.Empty<object>()));
		((ConfigHandler<LevelRarity[], string>)(object)StormInjectionLevels2).SetConfigEntry("Stormy", "Stormy 2nd Weather Variable", new ConfigDescription("Paired with the above config, a semi-colon seperated list for the 2nd weather variable Experimentation@2;Assurance@5;Gloom@10;. Make sure it has the exact same order + count as the above moons!", (AcceptableValueBase)null, Array.Empty<object>()));
	}
}