Decompiled source of SoundAPIWeatherBinding v1.0.1

BepInEx/plugins/SoundAPIWeatherBinding/SoundAPIWeatherBinding.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using WeatherRegistry;
using loaforcsSoundAPI;
using loaforcsSoundAPI.SoundPacks.Data.Conditions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SoundAPIWeatherBinding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SoundAPIWeatherBinding")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ca66baa5-bd5a-475e-9f3c-95df9bc6940e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SoundAPIWeatherBinding;

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

	private const string modName = "SoundAPIWeatherBinding";

	private const string modVersion = "1.0.0";

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

	private void Awake()
	{
		SoundAPI.RegisterAll(Assembly.GetExecutingAssembly());
		((BaseUnityPlugin)this).Logger.LogInfo((object)"SoundAPI Weather Binding is registering!");
	}
}
[SoundAPICondition("LethalCompany:weather:name", false, null)]
public class WeatherNameCondition : Condition
{
	public string Value { get; internal set; }

	public override bool Evaluate(IContext context)
	{
		if (!Object.op_Implicit((Object)(object)StartOfRound.Instance))
		{
			return false;
		}
		if (!Object.op_Implicit((Object)(object)StartOfRound.Instance.currentLevel))
		{
			return false;
		}
		string b = ((object)(LevelWeatherType)(ref StartOfRound.Instance.currentLevel.currentWeather)).ToString();
		return string.Equals(Value, b, StringComparison.InvariantCultureIgnoreCase);
	}
}
[SoundAPICondition("LethalCompany:weather:isweatherpresent", false, null)]
public class WeatherIsPresentCondition : Condition
{
	public string Value { get; internal set; }

	private static bool IsWeatherEffectPresent(string weatherName)
	{
		//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_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)
		LevelWeatherType weatherType = ((WeatherResolvable)new WeatherNameResolvable(weatherName)).WeatherType;
		for (int i = 0; i < WeatherManager.CurrentEffectTypes.Count; i++)
		{
			if (WeatherManager.CurrentEffectTypes[i] == weatherType)
			{
				return true;
			}
		}
		return false;
	}

	public override bool Evaluate(IContext context)
	{
		return IsWeatherEffectPresent(Value);
	}
}
[SoundAPICondition("LethalCompany:weather:iscombinedweather", false, null)]
public class WeatherIsCombinedCondition : Condition
{
	public string Value { get; internal set; }

	private static bool IsCombined()
	{
		if (WeatherManager.CurrentEffectTypes.Count > 1)
		{
			return true;
		}
		return false;
	}

	public override bool Evaluate(IContext context)
	{
		return IsCombined();
	}
}