using System; using System.Diagnostics; using System.IO; 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 Microsoft.CodeAnalysis; using On.RoR2; using RiskOfOptions; using RiskOfOptions.OptionConfigs; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LunarCoinsMenu")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LunarCoinsMenu")] [assembly: AssemblyTitle("LunarCoinsMenu")] [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 LunarCoinsMenu { [BepInPlugin("Bamboooz.LunarCoinsMenu", "LunarCoinsMenu", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LunarCoinsMenuPlugin : BaseUnityPlugin { public static class ModConfig { public enum UpdateMode { Disabled, Once, OnEachRun } public static ConfigEntry ShouldUpdate; public static ConfigEntry LunarCoinsAmount; public static void Init(ConfigFile config) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown ShouldUpdate = config.Bind("General", "Update mode", UpdateMode.Disabled, "Select whether the game should update your lunar coins once, or on the start of each run, or not."); LunarCoinsAmount = config.Bind("General", "Lunar Coins Amount", 0, "Set lunar coins amount."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)ShouldUpdate)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(LunarCoinsAmount, new IntSliderConfig { min = 0, max = int.MaxValue })); } } internal static ManualLogSource Log; public const string PluginGUID = "Bamboooz.LunarCoinsMenu"; public const string PluginAuthor = "Bamboooz"; public const string PluginName = "LunarCoinsMenu"; public const string PluginVersion = "1.0.0"; public void Awake() { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; try { ModSettingsManager.SetModDescription("A Risk of Rain 2 mod that allows you to set your lunar coins to a certain value once, or at the start of each run using Risk of Options."); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string path = Path.Combine(directoryName, "icon.png"); if (!File.Exists(path)) { path = Path.Combine(Path.GetDirectoryName(directoryName), "icon.png"); } if (File.Exists(path)) { Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, File.ReadAllBytes(path))) { ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } } ModConfig.Init(((BaseUnityPlugin)this).Config); Run.Start += new hook_Start(Run_Start); } catch (Exception ex) { Log.LogError((object)("Failed to initialize LunarCoinsMenu: " + ex.Message)); } } private void Run_Start(orig_Start orig, Run self) { orig.Invoke(self); if (ModConfig.ShouldUpdate.Value == ModConfig.UpdateMode.Once) { ModConfig.ShouldUpdate.Value = ModConfig.UpdateMode.Disabled; SetLunarCoins(); } if (ModConfig.ShouldUpdate.Value == ModConfig.UpdateMode.OnEachRun) { SetLunarCoins(); } } private void SetLunarCoins() { try { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null) { Log.LogWarning((object)"LocalUser is null, couldn't set coins."); return; } if (firstLocalUser.userProfile == null) { Log.LogWarning((object)"UserProfile is null, couldn't set coins."); return; } uint num = (uint)Mathf.Max(0, ModConfig.LunarCoinsAmount.Value); firstLocalUser.userProfile.coins = num; Log.LogInfo((object)$"Set Lunar Coins to {num}"); } catch (Exception arg) { Log.LogError((object)$"Error setting lunar coins: {arg}"); } } } }