Decompiled source of EclipsedOnly v1.0.0

BepInEx/plugins/Only Eclipsed.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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Only Eclipsed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Only Eclipsed")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5435013b-ec37-447d-8eb3-b883b4310826")]
[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")]
[BepInPlugin("OnlyFlooded", "Buddy.OnlyFlooded", "1.0.0")]
public class OnlyFlooded : BaseUnityPlugin
{
	public const string PLUGIN_GUID = "OnlyFlooded";

	public const string PLUGIN_NAME = "Buddy.OnlyFlooded";

	public const string PLUGIN_VERSION = "1.0.0";

	private readonly Harmony harmony = new Harmony("OnlyFlooded");

	public SelectableLevel loadedSelectableLevel;

	private List<SelectableLevel> selectableLevels = new List<SelectableLevel>();

	private List<SpawnableEnemyWithRarity> loadedEnemies = new List<SpawnableEnemyWithRarity>();

	private List<SpawnableItemWithRarity> grabbableObjects = new List<SpawnableItemWithRarity>();

	private AnimationCurve outsideEnemySpawn = new AnimationCurve();

	internal ManualLogSource mls;

	public static OnlyFlooded Instance { get; private set; }

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		if ((Object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("OnlyFlooded");
		mls.LogInfo((object)">:)");
		harmony.PatchAll(typeof(changeWeatherType));
	}
}
public class changeWeatherType
{
	[HarmonyPatch(typeof(StartOfRound), "SetPlanetsWeather")]
	[HarmonyPrefix]
	private static bool prefixweather(StartOfRound __instance)
	{
		changeWeather(__instance);
		return false;
	}

	public static void changeWeather(StartOfRound __instance)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < __instance.levels.Length; i++)
		{
			__instance.levels[i].currentWeather = (LevelWeatherType)5;
		}
		Random random = new Random(__instance.randomMapSeed + 31);
		List<SelectableLevel> list = __instance.levels.ToList();
		float num = 1f;
		int num2 = Mathf.Clamp((int)(Mathf.Clamp(__instance.planetsWeatherRandomCurve.Evaluate((float)random.NextDouble()) * num, 0f, 1f) * (float)__instance.levels.Length), 0, __instance.levels.Length);
		for (int j = 0; j < num2; j++)
		{
			SelectableLevel val = list[random.Next(0, list.Count)];
			if (val.randomWeathers != null && val.randomWeathers.Length != 0)
			{
				val.currentWeather = (LevelWeatherType)5;
			}
			list.Remove(val);
		}
	}
}