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 Mohr Credits v1.0.3
MohrCredits.dll
Decompiled 3 months agousing System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using MiscFixes.Modules; using RoR2; using UnityEngine; using UnityEngine.Networking; [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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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; } } } [BepInPlugin("MohrCredits", "MohrCredits", "1.0.2")] public class CreditModifier : BaseUnityPlugin { public const string identifier = "MohrCredits"; public const string version = "1.0.2"; private static Harmony instance = null; private static double scalar = 1.0; private static double flat = 0.0; private static bool scaleVault = false; public void Awake() { Load(((BaseUnityPlugin)this).Config); Harmony.CreateAndPatchAll(typeof(CreditModifier), (string)null); Run.onRunStartGlobal += Begin; Run.onRunDestroyGlobal += End; } public static void Load(ConfigFile cfg) { try { cfg.Reload(); } catch (FileNotFoundException) { cfg.Clear(); } string text = "Credit Modifier Controls"; flat = Extensions.BindOptionSlider<float>(cfg, text, "Flat", "Flat credit boost", 0.5f, (ConfigFlags)0).Value; scalar = Extensions.BindOptionSlider<float>(cfg, text, "Scalar", "Per-player credit scalar", 0.5f, (ConfigFlags)0).Value; scaleVault = Extensions.BindOption<bool>(cfg, text, "ScaleVault", "Whether the \"vault\" credits should be scaled", false, (ConfigFlags)0).Value; } public static void Begin(Run thisRun) { if (instance == null && NetworkServer.active) { instance = Harmony.CreateAndPatchAll(typeof(CreditModifier), (string)null); SceneDirector.onPrePopulateSceneServer += AdjustInteractableCredits; } } public static void End(object _) { SceneDirector.onPrePopulateSceneServer -= AdjustInteractableCredits; Harmony obj = instance; if (obj != null) { obj.UnpatchSelf(); } instance = null; } private static void AdjustInteractableCredits(SceneDirector __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 SceneInfo obj2 = SceneInfo.instance; SceneDef val = ((obj2 != null) ? obj2.sceneDef : null); string text = ((val != null) ? val.baseSceneName : null); if (text == "arena" || text == "voidstage" || (val != null && (int)val.sceneType == 2)) { Console.WriteLine("Prevent extra items in hidden realm \"" + text + "\"."); return; } double num = Run.instance.participatingPlayerCount; double num2 = ((!scaleVault) ? (ClassicStageInfo.instance?.bonusInteractibleCreditObjects?.Where(delegate(BonusInteractibleCreditObject obj) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) GameObject objectThatGrantsPointsIfEnabled = obj.objectThatGrantsPointsIfEnabled; return ((objectThatGrantsPointsIfEnabled != null) ? new bool?(objectThatGrantsPointsIfEnabled.activeSelf) : null) ?? false; }).Sum((BonusInteractibleCreditObject obj) => obj.points)).GetValueOrDefault() : 0); if (num2 != 0.0) { Console.WriteLine($"{num2} vault credits found"); } double num3 = __instance.interactableCredit; double num4 = num3 - num2; double num5 = num4 / (0.5 * num + 0.5); double value = num5 * (scalar * num + flat) - num4; value = Math.Round(value, MidpointRounding.AwayFromZero); __instance.interactableCredit += (int)value; Console.WriteLine($"adjusted initial {num4} credits by {value} to {__instance.interactableCredit}."); Run.instance.RecalculateDifficultyCoefficent(); } } namespace MohrCredits.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("MohrCredits.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal Resources() { } } }