Decompiled source of SmoldersLostSeer v1.0.0

SmoldersFoundSeer/SmoldersFoundSeer.dll

Decompiled 14 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API.Utils;
using RoR2;
using UnityEngine;

[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("SmoldersFoundSeer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SmoldersFoundSeer")]
[assembly: AssemblyTitle("SmoldersFoundSeer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 SmoldersFoundSeer
{
	[BepInPlugin("ToastyBaguette.SmoldersFoundSeer", "SmoldersFoundSeer", "1.0.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class SmoldersFoundSeer : BaseUnityPlugin
	{
		public const string PluginGUID = "ToastyBaguette.SmoldersFoundSeer";

		public const string PluginName = "SmoldersFoundSeer";

		public const string PluginVersion = "1.0.0";

		private const string SmolderEvent = "Play_SmolderExecute";

		private const string SmolderVolumeRTPC = "SmolderVolume";

		private ConfigEntry<float> smolderVolume;

		private void Awake()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SmoldersFoundSeer loaded!");
			smolderVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "Volume", 0.15f, new ConfigDescription("Volume of the Smolder execute sound. 0 = muted, 1 = full volume.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			EffectManager.SpawnEffect_EffectIndex_EffectData_bool += new hook_SpawnEffect_EffectIndex_EffectData_bool(EffectManager_SpawnEffect);
		}

		private void EffectManager_SpawnEffect(orig_SpawnEffect_EffectIndex_EffectData_bool orig, EffectIndex effectIndex, EffectData effectData, bool transmit)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			EffectDef effectDef = EffectCatalog.GetEffectDef(effectIndex);
			if (effectDef != null && (Object)(object)effectDef.prefab != (Object)null && ((Object)effectDef.prefab).name == "CritGlassesVoidExecuteEffect")
			{
				float num = smolderVolume.Value * 100f;
				AkSoundEngine.SetRTPCValue("SmolderVolume", num);
				Util.PlaySound("Play_SmolderExecute", ((Component)this).gameObject);
				string spawnSoundEventName = effectDef.spawnSoundEventName;
				effectDef.spawnSoundEventName = string.Empty;
				try
				{
					orig.Invoke(effectIndex, effectData, transmit);
					return;
				}
				finally
				{
					effectDef.spawnSoundEventName = spawnSoundEventName;
				}
			}
			orig.Invoke(effectIndex, effectData, transmit);
		}
	}
}
namespace ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static string Format(object data, string file, int line)
		{
			string fileName = Path.GetFileName(file);
			return $"[{fileName}:{line}] {data}";
		}

		internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogDebug((object)Format(data, file, line));
		}

		internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogError((object)Format(data, file, line));
		}

		internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogFatal((object)Format(data, file, line));
		}

		internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogInfo((object)Format(data, file, line));
		}

		internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogMessage((object)Format(data, file, line));
		}

		internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogWarning((object)Format(data, file, line));
		}
	}
}