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 SharedUpgrades v1.0.1
BepInEx\plugins\SharedUpgrades\SharedUpgrades.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SharedUpgrades")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("When any player buys an upgrade, all players in the lobby receive it.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SharedUpgrades")] [assembly: AssemblyTitle("SharedUpgrades")] [assembly: AssemblyVersion("1.0.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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; } } } namespace SharedUpgrades { [BepInPlugin("com.sharedupgrades.mod", "SharedUpgrades", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private Harmony _harmony; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("com.sharedupgrades.mod"); _harmony.PatchAll(); Logger.LogInfo((object)"SharedUpgrades loaded — all upgrades will be shared with the lobby."); } } } namespace SharedUpgrades.Patches { [HarmonyPatch] internal static class UpgradePatches { [CompilerGenerated] private sealed class <OtherPlayers>d__1 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private string exceptSteamID; public string <>3__exceptSteamID; private PlayerAvatar[] <>7__wrap1; private int <>7__wrap2; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OtherPlayers>d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0076; } <>1__state = -1; <>7__wrap1 = Object.FindObjectsOfType<PlayerAvatar>(); <>7__wrap2 = 0; goto IL_0084; IL_0076: <>7__wrap2++; goto IL_0084; IL_0084: if (<>7__wrap2 < <>7__wrap1.Length) { PlayerAvatar val = <>7__wrap1[<>7__wrap2]; if (!((Object)(object)val == (Object)null)) { string text = SemiFunc.PlayerGetSteamID(val); if (!string.IsNullOrEmpty(text) && text != exceptSteamID) { <>2__current = text; <>1__state = 1; return true; } } goto IL_0076; } <>7__wrap1 = null; 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(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { <OtherPlayers>d__1 <OtherPlayers>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <OtherPlayers>d__ = this; } else { <OtherPlayers>d__ = new <OtherPlayers>d__1(0); } <OtherPlayers>d__.exceptSteamID = <>3__exceptSteamID; return <OtherPlayers>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } private static bool _syncing; private static bool ShouldSync { get { if (!_syncing) { return PhotonNetwork.IsMasterClient; } return false; } } [IteratorStateMachine(typeof(<OtherPlayers>d__1))] private static IEnumerable<string> OtherPlayers(string exceptSteamID) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OtherPlayers>d__1(-2) { <>3__exceptSteamID = exceptSteamID }; } private static void SyncToAll(string exceptSteamID, string rpcMethodName) { PhotonView component = ((Component)PunManager.instance).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { return; } _syncing = true; foreach (string item in OtherPlayers(exceptSteamID)) { typeof(PunManager).GetMethod(rpcMethodName)?.Invoke(PunManager.instance, new object[1] { item }); component.RPC(rpcMethodName, (RpcTarget)1, new object[1] { item }); } _syncing = false; } [HarmonyPostfix] [HarmonyPatch(typeof(PunManager), "UpgradePlayerHealth")] private static void Health_Postfix(string steamID) { if (ShouldSync) { SyncToAll(steamID, "UpgradePlayerHealth"); } } [HarmonyPostfix] [HarmonyPatch(typeof(PunManager), "UpgradePlayerEnergy")] private static void Energy_Postfix(string steamID) { if (ShouldSync) { SyncToAll(steamID, "UpgradePlayerEnergy"); } } [HarmonyPostfix] [HarmonyPatch(typeof(PunManager), "UpgradePlayerSprintSpeed")] private static void SprintSpeed_Postfix(string steamID) { if (ShouldSync) { SyncToAll(steamID, "UpgradePlayerSprintSpeed"); } } [HarmonyPostfix] [HarmonyPatch(typeof(PunManager), "UpgradePlayerGrabStrength")] private static void GrabStrength_Postfix(string steamID) { if (ShouldSync) { SyncToAll(steamID, "UpgradePlayerGrabStrength"); } } [HarmonyPostfix] [HarmonyPatch(typeof(PunManager), "UpgradePlayerGrabRange")] private static void GrabRange_Postfix(string steamID) { if (ShouldSync) { SyncToAll(steamID, "UpgradePlayerGrabRange"); } } [HarmonyPostfix] [HarmonyPatch(typeof(PunManager), "UpgradePlayerExtraJump")] private static void ExtraJump_Postfix(string steamID) { if (ShouldSync) { SyncToAll(steamID, "UpgradePlayerExtraJump"); } } [HarmonyPostfix] [HarmonyPatch(typeof(PunManager), "UpgradePlayerTumbleLaunch")] private static void TumbleLaunch_Postfix(string steamID) { if (ShouldSync) { SyncToAll(steamID, "UpgradePlayerTumbleLaunch"); } } } }