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 Upgrade Divider v1.0.3
UpgradeDivider.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UpgradeDivider")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UpgradeDivider")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4070c5a9-55a0-46cb-9986-7282c066cefc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.yourname.shopdiscount", "Shop Discount Mod", "1.0.0")] public class ShopDiscountMod : BaseUnityPlugin { [CompilerGenerated] private sealed class <WaitAndApplyDiscount>d__1 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ShopDiscountMod <>4__this; private int <playerCount>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitAndApplyDiscount>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) Scene activeScene; switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0046; case 1: <>1__state = -1; goto IL_0046; case 2: { <>1__state = -1; break; } IL_0046: activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "Level - Shop") { <>2__current = null; <>1__state = 1; return true; } ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"In Shop Scene... waiting for StatsManager"); break; } if ((Object)(object)StatsManager.instance == (Object)null) { <>2__current = null; <>1__state = 2; return true; } ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"StatsManager is ready. Applying discount."); <playerCount>5__1 = <>4__this.GetPlayerCount(); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Detected player count: {<playerCount>5__1}"); <>4__this.ApplyDiscountToAllUpgrades(<playerCount>5__1); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private void Start() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Shop Discount Mod started."); ((MonoBehaviour)this).StartCoroutine(WaitAndApplyDiscount()); } [IteratorStateMachine(typeof(<WaitAndApplyDiscount>d__1))] private IEnumerator WaitAndApplyDiscount() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitAndApplyDiscount>d__1(0) { <>4__this = this }; } private int GetPlayerCount() { return 2; } private void ApplyDiscountToAllUpgrades(int playerCount) { StatsManager instance = StatsManager.instance; ModifyUpgradePrice(instance.playerUpgradeStrength, playerCount); ModifyUpgradePrice(instance.playerUpgradeStamina, playerCount); ModifyUpgradePrice(instance.playerUpgradeHealth, playerCount); ModifyUpgradePrice(instance.playerUpgradeSpeed, playerCount); ModifyUpgradePrice(instance.playerUpgradeExtraJump, playerCount); ModifyUpgradePrice(instance.playerUpgradeLaunch, playerCount); ModifyUpgradePrice(instance.playerUpgradeMapPlayerCount, playerCount); ModifyUpgradePrice(instance.playerUpgradeRange, playerCount); } private void ModifyUpgradePrice(Dictionary<string, int> upgradeDictionary, int playerCount) { foreach (KeyValuePair<string, int> item in new Dictionary<string, int>(upgradeDictionary)) { int value = item.Value; int num = Mathf.Max(1, value / playerCount); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Discounted {item.Key}: {value} → {num}"); upgradeDictionary[item.Key] = num; } } }