Decompiled source of EchoCurse Weather v1.0.0

EchoCurse.dll

Decompiled 5 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using WeatherRegistry;
using echo_curse.patches;
using echo_curse.weathers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("EchoCurse")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EchoCurse")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("472ad058-9d06-4e6c-a9ed-159f4f1e044b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace echo_curse
{
	public class echo_curse_helper
	{
		public static bool is_echo_curse;
	}
	[BepInPlugin("vtl0.echo_curse", "Echo Curse", "1.0.0")]
	public class mod_base : BaseUnityPlugin
	{
		private const string mod_guid = "vtl0.echo_curse";

		private const string mod_name = "Echo Curse";

		private const string mod_version = "1.0.0";

		private readonly Harmony echo_curse_mod = new Harmony("vtl0.echo_curse");

		private static mod_base instance;

		public static Weather echo_curse_weather;

		private void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c0: 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)
			//IL_00d3: Expected O, but got Unknown
			//IL_00d8: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			GameObject val = Object.Instantiate<GameObject>(new GameObject
			{
				name = "EchoCurseWeather"
			});
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<EchoCurse>();
			echo_curse_weather = new Weather("Echo Curse", new ImprovedWeatherEffect((GameObject)null, val)
			{
				SunAnimatorBool = "overcast"
			})
			{
				Color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)201, (byte)125, byte.MaxValue)),
				Config = 
				{
					ScrapAmountMultiplier = new FloatConfigHandler(1.15f, true)
				},
				Config = 
				{
					ScrapValueMultiplier = new FloatConfigHandler(1.2f, true)
				},
				Config = 
				{
					LevelWeights = new LevelWeightsConfigHandler("Assurance@150; Titan@120; Experimentation@50; March@120; Vow@50; Gratar@140; Atlantis@20; Bozoros@110; EchoReach@200", true)
				},
				Config = 
				{
					DefaultWeight = new IntegerConfigHandler(100, true)
				}
			};
			echo_curse_mod.PatchAll(typeof(echo_curse_soundpatch_roundmanager));
			echo_curse_mod.PatchAll(typeof(echo_curse_soundpatch_playercontrollerb));
			WeatherManager.RegisterWeather(echo_curse_weather);
		}
	}
}
namespace echo_curse.weathers
{
	public class EchoCurse : MonoBehaviour
	{
		private void Awake()
		{
		}

		private void OnEnable()
		{
			echo_curse_helper.is_echo_curse = true;
			RoundManager.Instance.hourTimeBetweenEnemySpawnBatches = 1;
			RoundManager instance = RoundManager.Instance;
			instance.currentMaxInsidePower *= 1.3f;
			RoundManager instance2 = RoundManager.Instance;
			instance2.currentMaxOutsidePower *= 1.3f;
		}

		private void OnDisable()
		{
			echo_curse_helper.is_echo_curse = false;
			RoundManager.Instance.hourTimeBetweenEnemySpawnBatches = 2;
			SoundManager.Instance.SetEchoFilter(false);
		}
	}
}
namespace echo_curse.patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class echo_curse_soundpatch_roundmanager
	{
		[HarmonyPatch("PlayAudibleNoise")]
		[HarmonyPrefix]
		public static void PlayAudibleNoise_pre(ref float noiseRange)
		{
			if (echo_curse_helper.is_echo_curse)
			{
				noiseRange *= 1.5f;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class echo_curse_soundpatch_playercontrollerb
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void playercontroller_update(PlayerControllerB __instance)
		{
			if (echo_curse_helper.is_echo_curse)
			{
				float num = 15f * Time.deltaTime;
				__instance.activeAudioReverbFilter = ((Component)__instance.activeAudioListener).GetComponent<AudioReverbFilter>();
				((Behaviour)__instance.activeAudioReverbFilter).enabled = true;
				if (__instance.isInHangarShipRoom)
				{
					__instance.activeAudioReverbFilter.roomLF = Mathf.Lerp(__instance.activeAudioReverbFilter.roomLF, -60f, num);
					__instance.activeAudioReverbFilter.roomHF = Mathf.Lerp(__instance.activeAudioReverbFilter.roomHF, -50f, num);
					__instance.activeAudioReverbFilter.decayTime = Mathf.Lerp(__instance.activeAudioReverbFilter.decayTime, 0.7f, num);
					__instance.activeAudioReverbFilter.decayHFRatio = Mathf.Lerp(__instance.activeAudioReverbFilter.decayHFRatio, 1.2f, num);
					__instance.activeAudioReverbFilter.room = Mathf.Lerp(__instance.activeAudioReverbFilter.room, -300f, num);
				}
				else if (!__instance.isInsideFactory)
				{
					__instance.activeAudioReverbFilter.roomLF = Mathf.Lerp(__instance.activeAudioReverbFilter.roomLF, -80f, num);
					__instance.activeAudioReverbFilter.roomHF = Mathf.Lerp(__instance.activeAudioReverbFilter.roomHF, -50f, num);
					__instance.activeAudioReverbFilter.decayTime = Mathf.Lerp(__instance.activeAudioReverbFilter.decayTime, 2f, num);
					__instance.activeAudioReverbFilter.decayHFRatio = Mathf.Lerp(__instance.activeAudioReverbFilter.decayHFRatio, 5f, num);
					__instance.activeAudioReverbFilter.room = Mathf.Lerp(__instance.activeAudioReverbFilter.room, -3600f, num);
				}
				__instance.activeAudioReverbFilter.dryLevel = Mathf.Lerp(__instance.activeAudioReverbFilter.dryLevel, -520f, num);
				SoundManager.Instance.SetEchoFilter(true);
			}
		}
	}
}