Decompiled source of BetterSpectator v1.1.1

BetterSpectator.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using MelonLoader.Preferences;
using ModThatIsNotMod;
using ModThatIsNotMod.BoneMenu;
using UnhollowerBaseLib;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using aaaaaaaaaaaaaaaa;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Class2), "Better Spectator", "1.1.0", "spark", null)]
[assembly: MelonGame("Stress Level Zero", "BONEWORKS")]
[assembly: AssemblyTitle("BetterSpectator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterSpectator")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d4732d09-e14e-49cf-bc74-304efc5869dc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace aaaaaaaaaaaaaaaa;

public class Class2 : MelonMod
{
	public MenuCategory bonemenupage;

	private Camera actioncamera;

	private GameObject cameraobject;

	private float setfov;

	private bool alreadyloaded;

	private bool alreadynotified;

	private bool alreadywarned;

	private MelonPreferences_Category spectatorprefs;

	private MelonPreferences_Entry<float> savedfov;

	public override void OnInitializeMelon()
	{
		spectatorprefs = MelonPreferences.CreateCategory("Better Spectator");
		savedfov = spectatorprefs.CreateEntry<float>("FOV", 90f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
	}

	public void updatevalues()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		actioncamera.fieldOfView = setfov;
		Notifications.SendNotification("Applied settings!", 2f, Color.white);
		MelonPreferences.Save();
		MelonLogger.Msg("Applied settings!");
	}

	public void hfghjgjfgfj()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: 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_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		if (!alreadyloaded)
		{
			alreadyloaded = true;
			bonemenupage = MenuManager.CreateCategory("Better Spectator", Color.yellow);
			bonemenupage.CreateFloatElement("FOV", Color.blue, savedfov.Value, (Action<float>)delegate(float fovfloat)
			{
				setfov = fovfloat;
				savedfov.Value = fovfloat;
			}, 1f, 10f, 120f, true);
			bonemenupage.CreateFunctionElement("Apply Settings", Color.green, (Action)delegate
			{
				updatevalues();
			});
		}
		Il2CppArrayBase<GameObject> val = Resources.FindObjectsOfTypeAll<GameObject>();
		foreach (GameObject item in val)
		{
			if (!((Object)item).name.Contains("Follow"))
			{
				continue;
			}
			Camera component = item.GetComponent<Camera>();
			if ((Object)(object)component != (Object)null)
			{
				PostProcessLayer component2 = item.GetComponent<PostProcessLayer>();
				PostProcessVolume component3 = item.GetComponent<PostProcessVolume>();
				if ((Object)(object)component2 != (Object)null)
				{
					((Behaviour)component2).enabled = false;
				}
				if ((Object)(object)component3 != (Object)null)
				{
					((Behaviour)component3).enabled = false;
				}
				actioncamera = component;
				cameraobject = item;
				component.fieldOfView = savedfov.Value;
				component.allowHDR = false;
				component.allowMSAA = false;
			}
		}
		if (!alreadynotified)
		{
			alreadynotified = true;
			Notifications.SendNotification("Sucessfully loaded Better Spectator!", 3f, Color.white);
			MelonLogger.Msg("Sucessfully loaded Better Spectator!");
		}
		if (!alreadywarned)
		{
			alreadywarned = true;
			if (!cameraobject.activeSelf)
			{
				Notifications.SendNotification("Action camera is turned off, camera modifications will not take affect.", 2f, Color.red);
				MelonLogger.Msg("Action camera is turned off, camera modifications will not take affect.");
			}
		}
	}

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		hfghjgjfgfj();
	}

	public override void OnApplicationStart()
	{
		MelonLogger.Msg("Mod started!");
	}
}