Decompiled source of UnlockAllSecrets v1.0.0

TabsUnlockAllSecrets.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Landfall.TABS.Save;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TabsUnlockAllSecrets")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TabsUnlockAllSecrets")]
[assembly: AssemblyTitle("TabsUnlockAllSecrets")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 TabsUnlockAllSecrets
{
	[BepInPlugin("rilz.tabs.unlockallsecrets", "TabsUnlockAllSecrets", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "rilz.tabs.unlockallsecrets";

		public const string PluginName = "TabsUnlockAllSecrets";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("rilz.tabs.unlockallsecrets").PatchAll(typeof(Plugin).Assembly);
			MethodInfo methodInfo = AccessTools.Method(typeof(TABSSave), "HasUnlockedSecret", (Type[])null, (Type[])null);
			Patches val = ((methodInfo == null) ? null : Harmony.GetPatchInfo((MethodBase)methodInfo));
			if (val != null && val.Postfixes.Count > 0)
			{
				Log.LogInfo((object)("Patch aplicado: " + methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " agora retorna sempre true (secretos desbloqueados, incluindo de outros mods)."));
			}
			else
			{
				Log.LogError((object)"Falha ao aplicar o patch em TABSSave.HasUnlockedSecret.");
			}
		}
	}
	[HarmonyPatch(typeof(TABSSave), "HasUnlockedSecret")]
	internal static class HasUnlockedSecretPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (!AchievementGuard.Active)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(SecretUnlock), "CheckAchievements")]
	internal static class AchievementGuard
	{
		internal static bool Active;

		private static void Prefix()
		{
			Active = true;
		}

		private static void Finalizer()
		{
			Active = false;
		}
	}
}