Decompiled source of FS Audio Fix v1.0.0

FS_Audio_Fix.dll

Decompiled 5 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using EntityStates;
using EntityStates.FalseSonBoss;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using On.EntityStates.FalseSonBoss;
using RoR2;
using RoR2.ContentManagement;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FS_Audio_Fix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f39aa4ba68eeb165a0f36b99ec8127cf3a372c94")]
[assembly: AssemblyProduct("FS_Audio_Fix")]
[assembly: AssemblyTitle("FS_Audio_Fix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FS_Audio_Fix
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Onyx.FS_Audio_Fix", "FS_Audio_Fix", "1.0.0")]
	public class FS_Arena_Fix : BaseUnityPlugin
	{
		public const string PluginGUID = "Onyx.FS_Audio_Fix";

		public const string PluginAuthor = "Onyx";

		public const string PluginName = "FS_Audio_Fix";

		public const string PluginVersion = "1.0.0";

		public void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			FissureSlam.FixedUpdate += new hook_FixedUpdate(FissureSwingSync);
			SwatAwayPlayersSlam.FixedUpdate += new hook_FixedUpdate(SwatSwingSync);
			AssetReferenceT<EntityStateConfiguration> val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_FalseSonBoss.EntityStates_FalseSonBoss_FissureSlamWindup_asset);
			AsyncOperationHandle<EntityStateConfiguration> val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
			val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<string>(x.Result, "enterSFXString", "");
			};
			val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_FalseSonBoss.EntityStates_FalseSonBoss_FissureSlam_asset);
			val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
			val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<string>(x.Result, "enterSoundString", "");
			};
			val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_FalseSonBoss.FalseSonBossSwatAwayPlayersWindup_asset);
			val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
			val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<string>(x.Result, "enterSFXString", "");
			};
			val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_FalseSonBoss.FalseSonBossSwatAwayPlayersSlam_asset);
			val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
			val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<string>(x.Result, "enterSoundString", "");
			};
			if (!FalseSonBossTweaks.enabled)
			{
				val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_meridian.RoR2_MeridianEventPhase1_asset);
				val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
				val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
				{
					Extensions.TryModifyFieldValue<float>(x.Result, "endStateDelay", 4f);
				};
				val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_meridian.RoR2_MeridianEventPhase2_asset);
				val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
				val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
				{
					Extensions.TryModifyFieldValue<float>(x.Result, "endStateDelay", 2.5f);
				};
			}
		}

		private void FissureSwingSync(orig_FixedUpdate orig, FissureSlam self)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (((EntityState)self).fixedAge > 0.4f && self.fissureExplosionTimer == 0f)
			{
				self.fissureExplosionTimer = 0.1f;
				self.fissureExplosionDelay += 0.1f;
				Util.PlaySound("Play_boss_falseson_skill1_swing", ((EntityState)self).gameObject);
			}
			if (((EntityState)self).fixedAge > 0.7f && self.fissureExplosionTimer <= 0.1f)
			{
				self.fissureExplosionTimer = 0.2f;
				self.fissureExplosionDelay += 0.1f;
				EffectManager.SimpleSoundEffect(FalseSonBossGenericStateWithSwing.impactSound.index, ((EntityState)self).characterBody.footPosition, true);
			}
		}

		private void SwatSwingSync(orig_FixedUpdate orig, SwatAwayPlayersSlam self)
		{
			orig.Invoke(self);
			if (((EntityState)self).fixedAge > 0.4f && !self.detonateNextFrame)
			{
				self.detonateNextFrame = true;
				Util.PlaySound("Play_boss_falseson_skill1_swing", ((EntityState)self).gameObject);
			}
		}
	}
	public static class FalseSonBossTweaks
	{
		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("Jeffdev.FalseSonBossTweaks");
				}
				return _enabled.Value;
			}
		}
	}
}