Decompiled source of ShakePlugin v2.0.0

ShakePlugin.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using ModdingTales;
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("ShakePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShakePlugin")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("ShakePlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.shake", "Shake Plug-In", "2.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ShakePlugin : BaseUnityPlugin
{
	public const string Name = "Shake Plug-In";

	public const string Guid = "org.lordashes.plugins.shake";

	public const string Version = "2.0.0.0";

	public const string Author = "Lord Ashes";

	private static Generic _LocalClient = new Generic("LocalClient", (string[])null, (object)null);

	private static Generic _SystemMessage = new Generic("SystemMessage", (string[])null, (object)null);

	private ConfigEntry<KeyboardShortcut> triggerKey { get; set; }

	private ConfigEntry<float> shakeDuration { get; set; }

	private ConfigEntry<float> shakeMagnitude { get; set; }

	private ConfigEntry<float> shakeFrequency { get; set; }

	private void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: 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)
		LoggingPlugin.SetLogLevel(((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostic Level", (DiagnosticLevel)3, (ConfigDescription)null).Value);
		string? assemblyQualifiedName = ((object)this).GetType().AssemblyQualifiedName;
		DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
		LoggingPlugin.LogInfo(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")");
		triggerKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Shake Camera", new KeyboardShortcut((KeyCode)280, Array.Empty<KeyCode>()), (ConfigDescription)null);
		shakeDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Duration", 1f, (ConfigDescription)null);
		shakeMagnitude = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Magnitude", 1f, (ConfigDescription)null);
		shakeFrequency = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Frequency", 1f, (ConfigDescription)null);
		AssetDataPlugin.Subscribe("org.lordashes.plugins.shake", (Action<DatumChange>)delegate
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			new Generic("TS_CameraShaker", (string[])null, (object)null).Invoke("CallShakeWithNoise", new object[4]
			{
				shakeDuration.Value,
				shakeMagnitude.Value,
				((Component)Camera.current).transform.position,
				shakeFrequency.Value
			});
		});
		string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
		ModdingUtils.AddPluginToMenuList((BaseUnityPlugin)(object)this, text);
	}

	private void Update()
	{
		//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)
		KeyboardShortcut value = triggerKey.Value;
		if (((KeyboardShortcut)(ref value)).IsUp())
		{
			if (_LocalClient.Get<bool>("IsInGmMode"))
			{
				AssetDataPlugin.SendInfo("org.lordashes.plugins.shake", "Shake It Baby! (" + DateTime.UtcNow.ToString() + ")");
				return;
			}
			_SystemMessage.Invoke("DisplayInfoText", new string[1] { "String" }, new object[1] { "Players Can't Shake It Like The GM Can!" });
		}
	}
}