Decompiled source of ToggleEverythingForBepInEx v1.0.1

ToggleEverything.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Assets.Scripts.Saves___Serialization.Progression.Achievements;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ToggleEverything")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ae4eb2bca00af8a1c4407a3dade780d904d89265")]
[assembly: AssemblyProduct("ToggleEverything")]
[assembly: AssemblyTitle("ToggleEverything")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 ToggleEverything
{
	[BepInPlugin("com.Intacote.ToggleEverythingForBepInEx", "ToggleEverythingForBepInEx", "1.0.0")]
	public class Core : BasePlugin
	{
		public const string PluginGuid = "com.Intacote.ToggleEverythingForBepInEx";

		public const string PluginName = "ToggleEverythingForBepInEx";

		public const string PluginVersion = "1.0.0";

		private const string _mainMenuSceneName = "MainMenu";

		private bool _isInitialized = false;

		public override void Load()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.Intacote.ToggleEverythingForBepInEx");
			val.PatchAll();
			SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)OnSceneLoaded);
			((BasePlugin)this).Log.LogInfo((object)"ToggleEverythingForBepInEx initialized!");
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (!_isInitialized && ((Scene)(ref scene)).name == "MainMenu")
			{
				_isInitialized = true;
				Enumerator<WeaponData> enumerator = DataManager.Instance.unsortedWeapons.GetEnumerator();
				while (enumerator.MoveNext())
				{
					WeaponData current = enumerator.Current;
					((UnlockableBase)current).canAlwaysToggle = true;
				}
				Enumerator<TomeData> enumerator2 = DataManager.Instance.unsortedTomes.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					TomeData current2 = enumerator2.Current;
					((UnlockableBase)current2).canAlwaysToggle = true;
				}
				Enumerator<ItemData> enumerator3 = DataManager.Instance.unsortedItems.GetEnumerator();
				while (enumerator3.MoveNext())
				{
					ItemData current3 = enumerator3.Current;
					((UnlockableBase)current3).canAlwaysToggle = true;
				}
				((BasePlugin)this).Log.LogInfo((object)"All weapons, tomes, and items can now be toggled at any time.");
			}
		}
	}
}