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 EmbrionScrapBuffs v1.1.0
embrion buffs.dll
Decompiled 3 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Unity.Netcode; 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("embrion buffs")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("embrion buffs")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("afd4aaef-f750-4d51-80ad-3018768c93ee")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("embrion.buffs.scrap", "Embrion Scrap Buffs", "2.1.0")] public class EmbrionScrapBuffs : BaseUnityPlugin { [CompilerGenerated] private sealed class <ApplyValueBuffWhenReady>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EmbrionScrapBuffs <>4__this; private SelectableLevel <level>5__1; private string <planet>5__2; private GrabbableObject[] <>s__3; private int <>s__4; private GrabbableObject <scrap>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyValueBuffWhenReady>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <level>5__1 = null; <planet>5__2 = null; <>s__3 = null; <scrap>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)StartOfRound.Instance != (Object)null)); <>1__state = 1; return true; case 1: <>1__state = -1; if (!((NetworkBehaviour)StartOfRound.Instance).IsHost) { return false; } <>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.currentLevel != (Object)null)); <>1__state = 2; return true; case 2: <>1__state = -1; <level>5__1 = RoundManager.Instance.currentLevel; <planet>5__2 = <level>5__1.PlanetName.ToLower(); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("[EmbrionBuffs] Planet detected: " + <planet>5__2)); if (!<planet>5__2.Contains("embrion")) { return false; } <>2__current = (object)new WaitUntil((Func<bool>)(() => Object.FindObjectsOfType<GrabbableObject>().Any((GrabbableObject g) => (Object)(object)g != (Object)null && (Object)(object)g.itemProperties != (Object)null && g.itemProperties.isScrap))); <>1__state = 3; return true; case 3: <>1__state = -1; if (<>4__this.appliedValueBuff) { return false; } <>s__3 = Object.FindObjectsOfType<GrabbableObject>(); for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { <scrap>5__5 = <>s__3[<>s__4]; if ((Object)(object)<scrap>5__5 != (Object)null && (Object)(object)<scrap>5__5.itemProperties != (Object)null && <scrap>5__5.itemProperties.isScrap) { <scrap>5__5.scrapValue = Mathf.RoundToInt((float)<scrap>5__5.scrapValue * 2f); } <scrap>5__5 = null; } <>s__3 = null; <>4__this.appliedValueBuff = true; ((BaseUnityPlugin)<>4__this).Logger.LogMessage((object)"[EmbrionBuffs] EMBRION SCRAP VALUE BUFF APPLIED"); 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 const float ScrapValueMultiplier = 2f; private bool appliedValueBuff = false; private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EmbrionBuffs] Plugin loaded"); Harmony val = new Harmony("embrion.buffs.scrap"); val.PatchAll(); ((MonoBehaviour)this).StartCoroutine(ApplyValueBuffWhenReady()); } [IteratorStateMachine(typeof(<ApplyValueBuffWhenReady>d__3))] private IEnumerator ApplyValueBuffWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyValueBuffWhenReady>d__3(0) { <>4__this = this }; } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] internal class EmbrionScrapSpawnPatch { private static void Prefix(RoundManager __instance) { SelectableLevel currentLevel = __instance.currentLevel; if (!((Object)(object)currentLevel == (Object)null) && currentLevel.PlanetName.ToLower().Contains("embrion")) { currentLevel.minScrap *= 2; currentLevel.maxScrap *= 2; currentLevel.minTotalScrapValue *= 2; currentLevel.maxTotalScrapValue *= 2; Debug.Log((object)("[EmbrionBuffs] Scrap spawn doubled | " + $"Range {currentLevel.minScrap}-{currentLevel.maxScrap}, " + $"MinValue {currentLevel.minTotalScrapValue}")); } } }