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 SyncMod v1.0.0
SyncMod.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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("SyncMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5e6794bc6138d616f85bd7e1063690abcf5136af")] [assembly: AssemblyProduct("SyncMod")] [assembly: AssemblyTitle("SyncMod")] [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 SyncMod { [BepInPlugin("Jo.SyncMod", "SyncMod", "1.0.0")] public class Entry : BaseUnityPlugin { private const string PluginId = "Jo.SyncMod"; private const string PluginName = "SyncMod"; private const string PluginVersion = "1.0.0"; private static readonly Harmony Harmony = new Harmony("Jo.SyncMod"); internal static ManualLogSource LogSource = null; private void Awake() { LogSource = ((BaseUnityPlugin)this).Logger; Harmony.PatchAll(); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)4; LogSource.LogInfo((object)"SyncMod v1.0.0 loaded."); } } } namespace SyncMod.Patches { [HarmonyPatch(typeof(ItemUpgrade))] public class ItemUpgradePatch { private static readonly FieldInfo field_upgradeDone = AccessTools.Field(typeof(ItemUpgrade), "upgradeDone"); private static readonly FieldInfo field_itemToggle = AccessTools.Field(typeof(ItemUpgrade), "itemToggle"); private static readonly FieldInfo field_playerTogglePhotonID = AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID"); [HarmonyPrefix] [HarmonyPatch("PlayerUpgrade")] private static void Prefix_PlayerUpgrade(ItemUpgrade __instance) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown bool flag = (bool)field_upgradeDone.GetValue(__instance); if (SemiFunc.IsNotMasterClient() || flag) { return; } Entry.LogSource.LogInfo((object)"Applying upgrades to everyone else"); ItemToggle obj = (ItemToggle)field_itemToggle.GetValue(__instance); int originalPhotonID = (int)field_playerTogglePhotonID.GetValue(obj); foreach (PlayerAvatar item in from p in SemiFunc.PlayerGetAll() where p.photonView.ViewID != originalPhotonID select p) { AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID").SetValue(obj, item.photonView.ViewID); __instance.upgradeEvent.Invoke(); } AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID").SetValue(obj, originalPhotonID); } } [HarmonyPatch(typeof(PunManager))] public class PunManagerPatch { [HarmonyPrefix] [HarmonyPatch("SyncAllDictionaries")] private static void Prefix_SyncAllDictionaries(StatsManager ___statsManager) { if (SemiFunc.IsNotMasterClient()) { return; } Entry.LogSource.LogInfo((object)"Modifying dictionaries"); foreach (KeyValuePair<string, Dictionary<string, int>> dictionaryOfDictionary in ___statsManager.dictionaryOfDictionaries) { if (!dictionaryOfDictionary.Key.StartsWith("playerUpgrade")) { continue; } Dictionary<string, int> value = dictionaryOfDictionary.Value; int value2 = value.Values.Max(); foreach (string item in value.Keys.ToList()) { value[item] = value2; } } } } }