using System;
using System.Diagnostics;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using WK_huoyan1231COMLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("WK_UnlockWithCheat")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fda8917b7b65c0fa045ffc30ed147d7d47355bb6")]
[assembly: AssemblyProduct("WK_UnlockWithCheat")]
[assembly: AssemblyTitle("WK_UnlockWithCheat")]
[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 WK_UnlockWithCheat
{
[BepInPlugin("WK_UnlockWithCheat", "WK_UnlockWithCheat", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal static bool EnableUnlockWhileCheating = true;
private ConfigEntry<bool> _allowUnlockWhileCheating;
private void Awake()
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
_allowUnlockWhileCheating = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AllowUnlockWhileCheating", true, "When true, content unlocks (achievements / progression / XP) persist even while cheat mode is active. Leaderboard uploads and Steam achievement uploads are always disabled by this mod regardless of this setting.");
EnableUnlockWhileCheating = _allowUnlockWhileCheating.Value;
LeaderboardManager.DisableForThisRun("WK_UnlockWithCheat");
AchievementManager.SetSteamAchievementsDisabled(true);
AchievementManager.DisableForThisRun("WK_UnlockWithCheat");
Logger.LogInfo((object)("Plugin WK_UnlockWithCheat v1.0.0 loaded. Leaderboard & Steam achievement uploads disabled via WK_huoyan1231COMLib. UnlockWhileCheating=" + (EnableUnlockWhileCheating ? "ON" : "OFF") + "."));
new Harmony("WK_UnlockWithCheat").PatchAll();
Logger.LogInfo((object)"Harmony patches applied.");
}
}
[HarmonyPatch(typeof(StatManager), "SaveStats")]
internal static class Patch_StatManager_SaveStats
{
private static void Prefix(out bool __state)
{
__state = false;
if (Plugin.EnableUnlockWhileCheating && CommandConsole.hasCheated)
{
__state = true;
CommandConsole.hasCheated = false;
}
}
private static void Postfix(bool __state)
{
if (__state)
{
CommandConsole.hasCheated = true;
}
}
}
[HarmonyPatch(typeof(M_Gamemode), "StartFreshGamemode")]
internal static class Patch_M_Gamemode_StartFreshGamemode
{
private static void Postfix()
{
LeaderboardManager.DisableForThisRun("WK_UnlockWithCheat");
AchievementManager.DisableForThisRun("WK_UnlockWithCheat");
}
}
[HarmonyPatch(typeof(ENV_WarpFissure), "CheckCheated")]
internal static class Patch_ENV_WarpFissure_CheckCheated
{
private static bool Prefix(ref bool __result)
{
if (!Plugin.EnableUnlockWhileCheating)
{
return true;
}
__result = false;
return false;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "WK_UnlockWithCheat";
public const string PLUGIN_NAME = "WK_UnlockWithCheat";
public const string PLUGIN_VERSION = "1.0.0";
}
}