Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LunarCoinsMenu v1.0.1
plugins/LunarCoinsMenu/LunarCoinsMenu.dll
Decompiled 2 months agousing 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+2e1bf0c24db5409722153794986a336fff98198c")] [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.1")] [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<UpdateMode> ShouldUpdate; public static ConfigEntry<int> 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: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_006a: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown ShouldUpdate = config.Bind<UpdateMode>("General", "Update mode", UpdateMode.Disabled, "Select whether the game should update your lunar coins once, or on the start of each run, or not at all."); LunarCoinsAmount = config.Bind<int>("General", "Lunar Coins Amount", 0, "Set lunar coins amount."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)ShouldUpdate)); ConfigEntry<int> lunarCoinsAmount = LunarCoinsAmount; IntFieldConfig val = new IntFieldConfig(); ((NumericFieldConfig<int>)val).Min = 0; ((NumericFieldConfig<int>)val).Max = int.MaxValue; ModSettingsManager.AddOption((BaseOption)new IntFieldOption(lunarCoinsAmount, val)); } } 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.1"; 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 made to modify your Lunar Coins."); 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 static 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}"); } } } }