using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DisablePlatformAchievements.Properties;
using HarmonyLib;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DisablePlatformAchievements")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DisablePlatformAchievements")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1426aeea-4589-4e1c-8206-e5d350358c3a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DisablePlatformAchievements
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("bulletbot.disableplatformachievements", "DisablePlatformAchievements", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
private static class RiskOfOptions
{
public const string modGUID = "com.rune580.riskofoptions";
public static bool IsLoaded()
{
return Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
}
public static void OnAwake()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
Bitmap icon = Resources.icon;
using (MemoryStream memoryStream = new MemoryStream())
{
((Image)icon).Save((Stream)memoryStream, ImageFormat.Png);
Texture2D val = new Texture2D(((Image)icon).Width, ((Image)icon).Height, (TextureFormat)5, false, false);
ImageConversion.LoadImage(val, memoryStream.ToArray());
((Texture)val).filterMode = (FilterMode)0;
ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)));
}
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.disableSteamAchievements));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.disableEpicGamesAchievements));
}
}
private const string modGUID = "bulletbot.disableplatformachievements";
private const string modName = "DisablePlatformAchievements";
private const string modVer = "1.0.2";
public static Plugin instance;
public ManualLogSource logger;
private readonly Harmony harmony = new Harmony("bulletbot.disableplatformachievements");
public ConfigEntry<bool> disableSteamAchievements;
public ConfigEntry<bool> disableEpicGamesAchievements;
private void Awake()
{
instance = this;
logger = Logger.CreateLogSource("DisablePlatformAchievements");
disableSteamAchievements = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Steam Achievements", true, "Determines whether to disable Steam achievement unlocks.");
disableEpicGamesAchievements = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Epic Games Achievements", true, "Determines whether to disable Epic Games achievement unlocks.");
if (RiskOfOptions.IsLoaded())
{
RiskOfOptions.OnAwake();
}
harmony.PatchAll();
}
}
}
namespace DisablePlatformAchievements.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("DisablePlatformAchievements.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static Bitmap icon
{
get
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
object @object = ResourceManager.GetObject("icon", resourceCulture);
return (Bitmap)@object;
}
}
internal Resources()
{
}
}
}
namespace DisablePlatformAchievements.Patches
{
[HarmonyPatch(typeof(AchievementSystemEOS))]
internal class AchievementSystemEOSPatch
{
[HarmonyPatch("AddAchievement")]
[HarmonyPrefix]
private static bool AddAchievement()
{
return !Plugin.instance.disableEpicGamesAchievements.Value;
}
}
[HarmonyPatch(typeof(AchievementSystemSteam))]
internal class AchievementSystemSteamPatch
{
[HarmonyPatch("AddAchievement")]
[HarmonyPrefix]
private static bool AddAchievement()
{
return !Plugin.instance.disableSteamAchievements.Value;
}
}
}