using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Utils; using HarmonyLib; using InjectionLibrary.Attributes; using ItemRarities.Injections; using ItemRarities.Patches; using Microsoft.CodeAnalysis; using Unity.Collections; 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: RequiresInjections] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FortnitificationScanner")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.2.0")] [assembly: AssemblyInformationalVersion("0.0.2")] [assembly: AssemblyProduct("FortnitificationScanner")] [assembly: AssemblyTitle("FortnitificationScanner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 ItemRarities { internal static class ConfigManager { internal static ConfigEntry DebugLogsEnabled { get; private set; } internal static ConfigEntry CommonItems { get; private set; } internal static ConfigEntry UncommonItems { get; private set; } internal static ConfigEntry RareItems { get; private set; } internal static ConfigEntry ExceptionalItems { get; private set; } internal static ConfigEntry LegendaryItems { get; private set; } internal static ConfigEntry CommonPercentage { get; private set; } internal static ConfigEntry UncommonPercentage { get; private set; } internal static ConfigEntry RarePercentage { get; private set; } internal static ConfigEntry ExceptionalPercentage { get; private set; } internal static ConfigEntry LegendaryPercentage { get; private set; } internal static ConfigEntry CommonName { get; private set; } internal static ConfigEntry UncommonName { get; private set; } internal static ConfigEntry RareName { get; private set; } internal static ConfigEntry ExceptionalName { get; private set; } internal static ConfigEntry LegendaryName { get; private set; } internal static ConfigEntry OverrideExistingScanColours { get; private set; } internal static string[] ItemOverrides => new string[5] { CommonItems.Value, UncommonItems.Value, RareItems.Value, ExceptionalItems.Value, LegendaryItems.Value }; internal static float[] RarityPercentages => new float[5] { CommonPercentage.Value, UncommonPercentage.Value, RarePercentage.Value, ExceptionalPercentage.Value, LegendaryPercentage.Value }; internal static void Bind(ConfigFile config) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown DebugLogsEnabled = config.Bind("Internal", "Enable Debug Logging", false, "If true, enables debug logging"); CommonItems = config.Bind("Item overrides", "Common items", string.Empty, "Namespaced keys for the Common rarity, e.g. 'lethal_company:big_bolt,lethal_company:apparatus'"); UncommonItems = config.Bind("Item overrides", "Uncommon items", string.Empty, "Namespaced keys for the Uncommon rarity, e.g. 'lethal_company:big_bolt,lethal_company:apparatus'"); RareItems = config.Bind("Item overrides", "Rare items", string.Empty, "Namespaced keys for the Rare rarity, e.g. 'lethal_company:big_bolt,lethal_company:apparatus'"); ExceptionalItems = config.Bind("Item overrides", "Exceptional items", "lethal_company:apparatus", "Namespaced keys for the Exceptional rarity, e.g. 'lethal_company:big_bolt,lethal_company:apparatus'"); LegendaryItems = config.Bind("Item overrides", "Legendary items", string.Empty, "Namespaced keys for the Legendary rarity, e.g. 'lethal_company:big_bolt,lethal_company:apparatus'"); CommonPercentage = config.Bind("Rarity groups", "Common percentage", 39f, new ConfigDescription("Percentage of scrap to be Common. If all rarity percentages do not total 100, they will scale automatically", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); UncommonPercentage = config.Bind("Rarity groups", "Uncommon percentage", 28f, new ConfigDescription("Percentage of scrap to be Uncommon. If all rarity percentages do not total 100, they will scale automatically", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); RarePercentage = config.Bind("Rarity groups", "Rare percentage", 16f, new ConfigDescription("Percentage of scrap to be Rare. If all rarity percentages do not total 100, they will scale automatically", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); ExceptionalPercentage = config.Bind("Rarity groups", "Exceptional percentage", 11f, new ConfigDescription("Percentage of scrap to be Exceptional. If all rarity percentages do not total 100, they will scale automatically", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); LegendaryPercentage = config.Bind("Rarity groups", "Legendary percentage", 6f, new ConfigDescription("Percentage of scrap to be Legendary. If all rarity percentages do not total 100, they will scale automatically", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); CommonName = config.Bind("Rarity groups", "Common name", "Common", "Rarity name shown on the scanner for Common scrap"); UncommonName = config.Bind("Rarity groups", "Uncommon name", "Uncommon", "Rarity name shown on the scanner for Uncommon scrap"); RareName = config.Bind("Rarity groups", "Rare name", "Rare", "Rarity name shown on the scanner for Rare scrap"); ExceptionalName = config.Bind("Rarity groups", "Exceptional name", "Exceptional", "Rarity name shown on the scanner for Exceptional scrap"); LegendaryName = config.Bind("Rarity groups", "Legendary name", "Legendary", "Rarity name shown on the scanner for Legendary scrap"); OverrideExistingScanColours = config.Bind("General", "Override existing scan colours", false, "If there are already items with scan node colours set by DawnLib, should they be overriden?"); } } internal static class Log { internal static void Debug(string message) { if (ConfigManager.DebugLogsEnabled.Value) { Write((LogLevel)32, message); } } internal static void Info(string message) { Write((LogLevel)16, message); } internal static void Warn(string message) { Write((LogLevel)4, message); } internal static void Error(string message) { Write((LogLevel)2, message); } internal static void Fatal(string message) { Write((LogLevel)1, message); } private static void Write(LogLevel logLevel, string message) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Plugin.mls.Log(logLevel, (object)message); } } [BepInPlugin("MrHat.FortnitificationScanner", "FortnitificationScanner", "0.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "MrHat.FortnitificationScanner"; public const string modName = "FortnitificationScanner"; public const string modVersion = "0.0.2"; private readonly Harmony _harmony = new Harmony("MrHat.FortnitificationScanner"); internal static ManualLogSource mls; private void Awake() { mls = ((BaseUnityPlugin)this).Logger; ConfigManager.Bind(((BaseUnityPlugin)this).Config); RarityGroups.Enable(); _harmony.PatchAll(typeof(StartOfRoundPatches)); _harmony.PatchAll(typeof(ScanNodePropertiesPatches)); Log.Info("FortnitificationScanner loaded"); } } internal static class RarityGroups { private static readonly Dictionary AssignedItems = new Dictionary(); private static readonly List Groups = new List(); internal static void Enable() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) Groups.AddRange(new <>z__ReadOnlyArray(new RarityGroup[5] { new RarityGroup(ConfigManager.CommonName.Value, Color32.op_Implicit(new Color32((byte)74, (byte)74, (byte)74, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)226, (byte)226, (byte)226, byte.MaxValue))), new RarityGroup(ConfigManager.UncommonName.Value, Color32.op_Implicit(new Color32((byte)28, (byte)90, (byte)49, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)118, (byte)242, (byte)154, byte.MaxValue))), new RarityGroup(ConfigManager.RareName.Value, Color32.op_Implicit(new Color32((byte)36, (byte)74, (byte)122, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)127, (byte)199, byte.MaxValue, byte.MaxValue))), new RarityGroup(ConfigManager.ExceptionalName.Value, Color32.op_Implicit(new Color32((byte)85, (byte)48, (byte)112, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)215, (byte)156, byte.MaxValue, byte.MaxValue))), new RarityGroup(ConfigManager.LegendaryName.Value, Color32.op_Implicit(new Color32((byte)111, (byte)91, (byte)16, byte.MaxValue)), Color32.op_Implicit(new Color32(byte.MaxValue, (byte)230, (byte)109, byte.MaxValue))) })); if (((Registry)(object)LethalContent.Items).IsFrozen) { SortItems(); } else { ((Registry)(object)LethalContent.Items).OnFreeze += SortItems; } } internal static bool Find(Item item, out RarityGroup rarity) { return AssignedItems.TryGetValue(item, out rarity); } private static void SortItems() { List source = ((Registry)(object)LethalContent.Items).Values.Where((DawnItemInfo itemInfo) => itemInfo.Item.isScrap).ToList(); Dictionary overriddenItems = new Dictionary(); List[] array = new List[5] { new List(), new List(), new List(), new List(), new List() }; string[] itemOverrides = ConfigManager.ItemOverrides; NamespacedKey val = default(NamespacedKey); DawnItemInfo val3 = default(DawnItemInfo); for (int num = 0; num < Groups.Count; num++) { string[] array2 = itemOverrides[num].Split(new char[4] { ',', ';', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); string[] array3 = array2; foreach (string text in array3) { string text2 = text.Trim(); if (!NamespacedKey.TryParse(text2, ref val)) { Log.Error("Item override key is invalid: " + text2); continue; } NamespacedKey val2 = NamespacedKey.From(val.Namespace, val.Key); if (!((Registry)(object)LethalContent.Items).TryGetValue(val2, ref val3)) { Log.Error("Item override was not loaded: " + text2); } else if (!val3.Item.isScrap) { Log.Warn("Item override is not scrap: " + text2); } else if (!overriddenItems.TryAdd(val3.Item, Groups[num])) { Log.Error("Item override appears in more than one rarity: " + text2); } else { array[num].Add(text2); } } } List list = (from itemInfo in source where !overriddenItems.ContainsKey(itemInfo.Item) orderby MeanValue(itemInfo.Item) select itemInfo).ToList(); float[] rarityPercentages = ConfigManager.RarityPercentages; float num3 = rarityPercentages.Sum(); AssignedItems.Clear(); if (list.Count > 0 && num3 <= 0f) { Log.Error("Rarity percentages must total more than zero"); return; } if (list.Count > 0) { int num4 = 0; float num5 = rarityPercentages[0] / num3; for (int num6 = 0; num6 < list.Count; num6++) { float num7 = ((float)num6 + 0.5f) / (float)list.Count; while (num4 < Groups.Count - 1 && num7 >= num5) { num4++; num5 += rarityPercentages[num4] / num3; } AssignedItems[list[num6].Item] = Groups[num4]; } } foreach (KeyValuePair item in overriddenItems) { AssignedItems[item.Key] = item.Value; } Log.Info($"{Groups[0].Name} scrap amount: {AssignedItems.Count>((KeyValuePair item) => item.Value == Groups[0])}"); Log.Info($"{Groups[1].Name} scrap amount: {AssignedItems.Count>((KeyValuePair item) => item.Value == Groups[1])}"); Log.Info($"{Groups[2].Name} scrap amount: {AssignedItems.Count>((KeyValuePair item) => item.Value == Groups[2])}"); Log.Info($"{Groups[3].Name} scrap amount: {AssignedItems.Count>((KeyValuePair item) => item.Value == Groups[3])}"); Log.Info($"{Groups[4].Name} scrap amount: {AssignedItems.Count>((KeyValuePair item) => item.Value == Groups[4])}"); for (int num8 = 0; num8 < Groups.Count; num8++) { if (array[num8].Count > 0) { Log.Info(Groups[num8].Name + " item overrides: " + string.Join(", ", array[num8])); } } Log.Info($"{list.Count} scrap items sorted by value rank with {overriddenItems.Count} overrides"); } private static float MeanValue(Item item) { return (float)(item.minValue + item.maxValue) / 2f; } } internal class RarityGroup(string name, Color scanColor, Color textColor) { internal string Name { get; } = name; internal Color ScanColor { get; } = scanColor; internal Color TextColor { get; } = textColor; } public static class MyPluginInfo { public const string PLUGIN_GUID = "FortnitificationScanner"; public const string PLUGIN_NAME = "FortnitificationScanner"; public const string PLUGIN_VERSION = "0.0.2"; } } namespace ItemRarities.Patches { [HarmonyPatch(typeof(ScanNodeProperties))] internal static class ScanNodePropertiesPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPostfix(ScanNodeProperties __instance) { GrabbableObject componentInParent = ((Component)__instance).GetComponentInParent(); if (componentInParent != null && componentInParent.itemProperties?.isScrap == true && !((Object)(object)((Component)componentInParent).GetComponentInChildren(true) != (Object)(object)__instance)) { IScanNodeProperties scanNodeProperties = (IScanNodeProperties)__instance; scanNodeProperties.ItemRaritiesSet = true; scanNodeProperties.ItemRaritiesItem = componentInParent; Log.Debug(componentInParent.itemProperties.itemName + " scan node found"); scanNodeProperties.ItemRaritiesCoroutine = ((MonoBehaviour)__instance).StartCoroutine(RarityScanLoop(__instance, scanNodeProperties)); } } [HarmonyPatch("OnDestroy")] [HarmonyPostfix] private static void OnDestroyPostfix(ScanNodeProperties __instance) { IScanNodeProperties scanNodeProperties = (IScanNodeProperties)__instance; if (scanNodeProperties.ItemRaritiesCoroutine != null) { ((MonoBehaviour)__instance).StopCoroutine(scanNodeProperties.ItemRaritiesCoroutine); scanNodeProperties.ItemRaritiesCoroutine = null; } } private static IEnumerator RarityScanLoop(ScanNodeProperties scanNode, IScanNodeProperties scanNodeData) { WaitForSeconds updateDelay = new WaitForSeconds(0.1f); while (true) { GrabbableObject rarityItem = scanNodeData.ItemRaritiesItem; if ((Object)(object)rarityItem == (Object)null) { break; } string rarityText = scanNodeData.ItemRaritiesText; if (rarityText == null || scanNodeData.ItemRaritiesScrapValue != rarityItem.scrapValue) { if (!RarityGroups.Find(rarityItem.itemProperties, out RarityGroup rarity)) { yield return updateDelay; continue; } scanNodeData.ItemRaritiesScrapValue = rarityItem.scrapValue; Log.Debug($"{rarityItem.itemProperties.itemName} rarity scan value set to {rarityItem.scrapValue}"); rarityText = (scanNodeData.ItemRaritiesText = $"{rarity.Name} - ${rarityItem.scrapValue}"); Log.Debug(rarityItem.itemProperties.itemName + " rarity scan text set to " + rarityText); if (!scanNodeData.ItemRaritiesColoursSet) { ForceScanColorOnItem scanColour = ((Component)rarityItem).GetComponent(); if ((Object)(object)scanColour == (Object)null || ConfigManager.OverrideExistingScanColours.Value) { if (scanColour == null) { scanColour = ((Component)rarityItem).gameObject.AddComponent(); } scanColour.grabbableObject = rarityItem; scanColour.borderColor = rarity.ScanColor; scanColour.textColor = rarity.TextColor; scanColour.FindGrabbableObjectsScanObject(); } scanNodeData.ItemRaritiesColoursSet = true; Log.Debug(rarityItem.itemProperties.itemName + " rarity scan colours done"); } rarity = null; } if (scanNode.subText != rarityText) { scanNode.subText = rarityText; } yield return updateDelay; } } } internal static class StartOfRoundPatches { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__ReadScrapValues; } private const string ScrapValueMessage = "MrHat.FortnitificationScanner.ScrapValues"; [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void RegisterScrapValueMessage() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null); if (val != null) { val.UnregisterNamedMessageHandler("MrHat.FortnitificationScanner.ScrapValues"); object obj = <>O.<0>__ReadScrapValues; if (obj == null) { HandleNamedMessageDelegate val2 = ReadScrapValues; <>O.<0>__ReadScrapValues = val2; obj = (object)val2; } val.RegisterNamedMessageHandler("MrHat.FortnitificationScanner.ScrapValues", (HandleNamedMessageDelegate)obj); Log.Debug("Scrap value message registered"); } } [HarmonyPatch(typeof(GameNetworkManager), "SetInstanceValuesBackToDefault")] [HarmonyPostfix] private static void UnregisterScrapValueMessage() { NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null); if (val != null) { val.UnregisterNamedMessageHandler("MrHat.FortnitificationScanner.ScrapValues"); Log.Debug("Scrap value message unregistered"); } } [HarmonyPatch(typeof(StartOfRound), "SyncAlreadyHeldObjectsServerRpc")] [HarmonyPostfix] private unsafe static void SendScrapValues(StartOfRound __instance, int joiningClientId) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsServer) { return; } NetworkManager singleton = NetworkManager.Singleton; CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null); ulong num = (ulong)joiningClientId; if (singleton == null || !singleton.IsListening || val == null || !singleton.ConnectedClients.ContainsKey(num)) { return; } GrabbableObject[] array = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)0); List list = new List(); GrabbableObject[] array2 = array; foreach (GrabbableObject val2 in array2) { Item itemProperties = val2.itemProperties; if (itemProperties != null && itemProperties.isScrap) { NetworkObject networkObject = ((NetworkBehaviour)val2).NetworkObject; if (networkObject != null && networkObject.IsSpawned) { list.Add(val2); } } } int num2 = 4 + list.Count * 12; FastBufferWriter val3 = default(FastBufferWriter); ((FastBufferWriter)(ref val3))..ctor(num2, (Allocator)2, -1); try { int count = list.Count; ((FastBufferWriter)(ref val3)).WriteValueSafe(ref count, default(ForPrimitives)); foreach (GrabbableObject item in list) { ulong networkObjectId = ((NetworkBehaviour)item).NetworkObject.NetworkObjectId; ((FastBufferWriter)(ref val3)).WriteValueSafe(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref item.scrapValue, default(ForPrimitives)); } val.SendNamedMessage("MrHat.FortnitificationScanner.ScrapValues", num, val3, (NetworkDelivery)4); Log.Debug($"{list.Count} scrap values sent to client {num}"); } finally { ((IDisposable)(*(FastBufferWriter*)(&val3))/*cast due to .constrained prefix*/).Dispose(); } } private static void ReadScrapValues(ulong senderClientId, FastBufferReader reader) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || senderClientId != 0) { return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); int num2 = 0; ulong key = default(ulong); int scrapValue = default(int); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, default(ForPrimitives)); ((FastBufferReader)(ref reader)).ReadValueSafe(ref scrapValue, default(ForPrimitives)); if (!singleton.SpawnManager.SpawnedObjects.TryGetValue(key, out var value)) { continue; } GrabbableObject component = ((Component)value).GetComponent(); if ((Object)(object)component != (Object)null) { Item itemProperties = component.itemProperties; if (itemProperties != null && itemProperties.isScrap) { component.SetScrapValue(scrapValue); num2++; } } } Log.Debug($"{num2} of {num} scrap values synced"); } } } namespace ItemRarities.Injections { [InjectInterface(typeof(ScanNodeProperties))] public interface IScanNodeProperties { bool ItemRaritiesSet { get; set; } GrabbableObject? ItemRaritiesItem { get; set; } int ItemRaritiesScrapValue { get; set; } string? ItemRaritiesText { get; set; } bool ItemRaritiesColoursSet { get; set; } Coroutine? ItemRaritiesCoroutine { get; set; } void Start(); void OnDestroy(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } }