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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Shooterlatro.DebugTools;
using UnityEngine;
[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("LuckyShotDevMode")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4135dd1490a61fe647f2a0e54287f36471f5cf7f")]
[assembly: AssemblyProduct("LuckyShotDevMode")]
[assembly: AssemblyTitle("LuckyShotDevMode")]
[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 LuckyShotDevMode
{
[BepInPlugin("com.luckyshot.wiki.devmode", "LuckyShot DevMode (Wiki)", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("com.luckyshot.wiki.devmode").PatchAll(typeof(Plugin).Assembly);
ForceUnityDevConsoleOff();
}
private void Update()
{
ForceUnityDevConsoleOff();
}
private static void ForceUnityDevConsoleOff()
{
try
{
Type? typeFromHandle = typeof(Debug);
PropertyInfo property = typeFromHandle.GetProperty("developerConsoleEnabled", BindingFlags.Static | BindingFlags.Public);
if (property != null && property.PropertyType == typeof(bool) && (bool)property.GetValue(null))
{
property.SetValue(null, false);
}
PropertyInfo property2 = typeFromHandle.GetProperty("developerConsoleVisible", BindingFlags.Static | BindingFlags.Public);
if (property2 != null && property2.PropertyType == typeof(bool) && (bool)property2.GetValue(null))
{
property2.SetValue(null, false);
}
}
catch
{
}
}
}
[HarmonyPatch]
internal static class AchLayer1
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("SteamAchievementsManager");
if (!(type == null))
{
return AccessTools.Method(type, "UnlockAchievement", (Type[])null, (Type[])null);
}
return null;
}
private static bool Prefix()
{
return false;
}
}
[HarmonyPatch]
internal static class AchLayer2
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("Steamworks.SteamUserStats");
if (!(type == null))
{
return AccessTools.Method(type, "SetAchievement", (Type[])null, (Type[])null);
}
return null;
}
private static bool Prefix()
{
return false;
}
}
[HarmonyPatch]
internal static class AchLayer3
{
private static MethodBase TargetMethod()
{
try
{
Type type = AccessTools.TypeByName("Steamworks.SteamUserStats");
if (type == null)
{
return null;
}
MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.Name == "SetStat" && methodInfo.GetParameters().Length == 2 && methodInfo.GetParameters()[0].ParameterType == typeof(string))
{
return methodInfo;
}
}
}
catch
{
}
return null;
}
private static bool Prefix()
{
return false;
}
}
[HarmonyPatch]
internal static class AchLayer4
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("Steamworks.SteamUserStats");
if (!(type == null))
{
return AccessTools.Method(type, "StoreStats", (Type[])null, (Type[])null);
}
return null;
}
private static bool Prefix(ref bool __result)
{
__result = true;
return false;
}
}
[HarmonyPatch(typeof(DemoContentLockDebugTool), "ShouldEnableConsole")]
internal static class ShouldEnableConsolePatch
{
private static bool Prefix(ref bool __result)
{
__result = true;
return false;
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.luckyshot.wiki.devmode";
public const string PLUGIN_NAME = "LuckyShot DevMode (Wiki)";
public const string PLUGIN_VERSION = "1.0.0";
}
}