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 MarkForScrap v1.1.3
MarkForScrap.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.IO; 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 MarkForScrap.Resources; using MarkForScrap.Utils; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Networking; using UnityEngine.UI; [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MarkForScrap")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyProduct("MarkForScrap")] [assembly: AssemblyTitle("MarkForScrap")] [assembly: AssemblyInformationalVersion("1.0.0+7756039469b9c91d3cd87d56fa276d2d48acd40b")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] [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 MarkForScrap { [DisallowMultipleComponent] [RequireComponent(typeof(NetworkUser))] public class InventoryScrapCounter : NetworkBehaviour { private NetworkUser networkUser; private Inventory inventory; private readonly SyncListBool markedForScrap = new SyncListBool(); private static int kListmarkedForScrap; private static int kCmdCmdSetItemMark; public void Awake() { networkUser = ((Component)this).GetComponent<NetworkUser>(); CharacterMaster.onStartGlobal += OnCharacterMasterStart; ((SyncList<bool>)(object)markedForScrap).InitializeBehaviour((NetworkBehaviour)(object)this, kListmarkedForScrap); } public void OnDestroy() { CharacterMaster.onStartGlobal -= OnCharacterMasterStart; } [ServerCallback] public void Start() { if (!NetworkServer.active) { return; } if (((NetworkBehaviour)this).isServer) { ((SyncList<bool>)(object)markedForScrap).Clear(); for (int i = 0; i < ItemCatalog.itemCount; i++) { ((SyncList<bool>)(object)markedForScrap).Add(false); } } if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)$"Found {ItemCatalog.itemCount} total items"); } } public void OnCharacterMasterStart(CharacterMaster master) { PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController; if (!Object.op_Implicit((Object)(object)playerCharacterMasterController) || !((Object)(object)playerCharacterMasterController.networkUser == (Object)(object)networkUser)) { return; } inventory = playerCharacterMasterController.master.inventory; if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)"Found player inventory"); } if (((NetworkBehaviour)this).isServer) { inventory.onInventoryChanged += SyncScrapCountWithInventory; if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)"Added SyncScrapCountWithInventory hook to player inventory"); } } } public void MarkItem(ItemIndex idx) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)$"Marking ItemIndex {idx} for scrap"); } CallCmdSetItemMark(idx, marked: true); } public void UnmarkItem(ItemIndex idx) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)$"Unmarking ItemIndex {idx} for scrap"); } CallCmdSetItemMark(idx, marked: false); } public void FlipMark(ItemIndex idx) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (IsMarked(idx)) { UnmarkItem(idx); } else { MarkItem(idx); } } public bool IsMarked(ItemIndex idx) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown if ((int)idx >= ((SyncList<bool>)(object)markedForScrap).Count) { return false; } return ((SyncList<bool>)(object)markedForScrap)[(int)idx]; } public bool HasItemsToScrap() { for (int i = 0; i < ((SyncList<bool>)(object)markedForScrap).Count; i++) { if (((SyncList<bool>)(object)markedForScrap)[i]) { if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)"We have marked items to scrap"); } return true; } } if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)"There are no marked items to scrap"); } return false; } [Command] private void CmdSetItemMark(ItemIndex idx, bool marked) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (ItemUtils.IsScrappable(idx) && inventory.GetItemCountPermanent(idx) > 0) { int num = (int)idx; while (num >= ((SyncList<bool>)(object)markedForScrap).Count) { ((SyncList<bool>)(object)markedForScrap).Add(false); } if (((SyncList<bool>)(object)markedForScrap)[num] != marked) { ((SyncList<bool>)(object)markedForScrap)[num] = marked; } if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)$"ItemIndex {idx} has been set to marked={marked}"); } } } [Server] private void SyncScrapCountWithInventory() { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void MarkForScrap.InventoryScrapCounter::SyncScrapCountWithInventory()' called on client"); return; } for (int i = 0; i < ((SyncList<bool>)(object)markedForScrap).Count; i++) { if (((SyncList<bool>)(object)markedForScrap)[i] && inventory.GetItemCountPermanent((ItemIndex)i) <= 0) { ((SyncList<bool>)(object)markedForScrap)[i] = false; } } } [Server] public ItemIndex Take() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'RoR2.ItemIndex MarkForScrap.InventoryScrapCounter::Take()' called on client"); return default(ItemIndex); } if (!HasItemsToScrap()) { throw new Exception("No items marked for scrap"); } int i; for (i = 0; i < ((SyncList<bool>)(object)markedForScrap).Count && !((SyncList<bool>)(object)markedForScrap)[i]; i++) { } UnmarkItem((ItemIndex)i); return (ItemIndex)i; } private void UNetVersion() { } protected static void InvokeSyncListmarkedForScrap(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"SyncList markedForScrap called on server."); } else { ((SyncList<bool>)(object)((InventoryScrapCounter)(object)obj).markedForScrap).HandleMsg(reader); } } protected static void InvokeCmdCmdSetItemMark(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkServer.active) { Debug.LogError((object)"Command CmdSetItemMark called on client."); } else { ((InventoryScrapCounter)(object)obj).CmdSetItemMark((ItemIndex)reader.ReadInt32(), reader.ReadBoolean()); } } public void CallCmdSetItemMark(ItemIndex idx, bool marked) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected I4, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"Command function CmdSetItemMark called on server."); return; } if (((NetworkBehaviour)this).isServer) { CmdSetItemMark(idx, marked); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)5); val.WritePackedUInt32((uint)kCmdCmdSetItemMark); val.Write(((Component)this).GetComponent<NetworkIdentity>().netId); val.Write((int)idx); val.Write(marked); ((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdSetItemMark"); } static InventoryScrapCounter() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown kCmdCmdSetItemMark = -1563546117; NetworkBehaviour.RegisterCommandDelegate(typeof(InventoryScrapCounter), kCmdCmdSetItemMark, new CmdDelegate(InvokeCmdCmdSetItemMark)); kListmarkedForScrap = -291689635; NetworkBehaviour.RegisterSyncListDelegate(typeof(InventoryScrapCounter), kListmarkedForScrap, new CmdDelegate(InvokeSyncListmarkedForScrap)); NetworkCRC.RegisterBehaviour("InventoryScrapCounter", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { SyncListBool.WriteInstance(writer, markedForScrap); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } SyncListBool.WriteInstance(writer, markedForScrap); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { SyncListBool.ReadReference(reader, markedForScrap); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { SyncListBool.ReadReference(reader, markedForScrap); } } } [RequireComponent(typeof(ItemIcon))] [DisallowMultipleComponent] public class ItemIconScrapSelector : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { private ItemIcon icon; private static Sprite markSprite; private Image image; private Image imageShadow; private bool isHover; public ItemIndex idx => icon.itemIndex; public void Awake() { icon = ((Component)this).GetComponent<ItemIcon>(); InitUI(); } public void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!isHover || !PatchedKeyboardShortcut.IsDown(PluginConfig.ToggleScrapKey.Value)) { return; } if (!ItemUtils.IsScrappable(idx)) { if (PluginConfig.DebugLogs.Value) { MarkForScrapPlugin.Log.LogDebug((object)$"ItemIndex {idx} isn't scrappable"); } return; } InventoryScrapCounter scrapCounter = LocalUser.scrapCounter; if (Object.op_Implicit((Object)(object)scrapCounter)) { scrapCounter.FlipMark(idx); } } public void LateUpdate() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) InventoryScrapCounter scrapCounter = LocalUser.scrapCounter; bool enabled = Object.op_Implicit((Object)(object)scrapCounter) && scrapCounter.IsMarked(idx); ((Behaviour)image).enabled = enabled; ((Behaviour)imageShadow).enabled = enabled; } public void OnPointerEnter(PointerEventData eventData) { isHover = true; } public void OnPointerExit(PointerEventData eventData) { isHover = false; } public void EnsureSprite() { if (!Object.op_Implicit((Object)(object)markSprite)) { markSprite = Assets.Load<Sprite>("Assets/icon-scrapper.png"); } } public void InitUI() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0073: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0134: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) EnsureSprite(); GameObject val = new GameObject("ScrapOverlay"); val.transform.SetParent(((Component)this).transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0.05f, 0.05f); obj.anchorMax = new Vector2(0.95f, 0.95f); obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; GameObject val2 = new GameObject("imageShadowOverlay"); val2.transform.SetParent(val.transform, false); RectTransform obj2 = val2.AddComponent<RectTransform>(); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; ((Transform)obj2).localPosition = new Vector3(2f, -9f, 0f); imageShadow = val2.AddComponent<Image>(); imageShadow.sprite = markSprite; ((Graphic)imageShadow).color = new Color(0f, 0f, 0f, 1f); GameObject val3 = new GameObject("imageOverlay"); val3.transform.SetParent(val.transform, false); RectTransform obj3 = val3.AddComponent<RectTransform>(); obj3.anchorMin = Vector2.zero; obj3.anchorMax = Vector2.one; obj3.offsetMin = Vector2.zero; obj3.offsetMax = Vector2.zero; ((Transform)obj3).localPosition = new Vector3(0f, -8f, 0.1f); image = val3.AddComponent<Image>(); image.sprite = markSprite; ((Behaviour)imageShadow).enabled = false; ((Behaviour)image).enabled = false; } } [BepInPlugin("com.eviegc.MarkForScrap", "MarkForScrap", "1.1.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MarkForScrapPlugin : BaseUnityPlugin { private sealed class MainInventoryMarker : MonoBehaviour { } internal static ManualLogSource Log; public void Awake() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Assets.LoadAssets(); InitConfig(); HUD.Awake += new hook_Awake(HUD_Awake); ItemIcon.Awake += new hook_Awake(ItemIcon_Awake); NetworkUser.OnEnable += new hook_OnEnable(NetworkUser_OnEnable); Interactor.PerformInteraction += new hook_PerformInteraction(Interactor_PerformInteraction); } public void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown HUD.Awake -= new hook_Awake(HUD_Awake); ItemIcon.Awake -= new hook_Awake(ItemIcon_Awake); NetworkUser.OnEnable -= new hook_OnEnable(NetworkUser_OnEnable); Interactor.PerformInteraction -= new hook_PerformInteraction(Interactor_PerformInteraction); } private void Interactor_PerformInteraction(orig_PerformInteraction orig, Interactor activator, GameObject interactableObject) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { orig.Invoke(activator, interactableObject); return; } ScrapperController componentInParent = interactableObject.GetComponentInParent<ScrapperController>(); if (!Object.op_Implicit((Object)(object)componentInParent)) { orig.Invoke(activator, interactableObject); return; } CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); NetworkUser obj = (Object.op_Implicit((Object)(object)component) ? Util.LookUpBodyNetworkUser(component) : null); InventoryScrapCounter inventoryScrapCounter = ((obj != null) ? ((Component)obj).GetComponent<InventoryScrapCounter>() : null); if (!Object.op_Implicit((Object)(object)inventoryScrapCounter) || !inventoryScrapCounter.HasItemsToScrap()) { orig.Invoke(activator, interactableObject); return; } ItemIndex val = inventoryScrapCounter.Take(); if (PluginConfig.DebugLogs.Value) { ((BaseUnityPlugin)this).Logger.LogDebug((object)$"Taking ItemIndex {val} for scrap"); } if (component.inventory.GetItemCountPermanent(val) <= 0) { if (PluginConfig.DebugLogs.Value) { ((BaseUnityPlugin)this).Logger.LogDebug((object)$"Tried to take ItemIndex {val} for scrap, but we dont have it anymore. Spooky!"); } orig.Invoke(activator, interactableObject); } else { PickupIndex val2 = PickupCatalog.FindPickupIndex(val); componentInParent.AssignPotentialInteractor(activator); componentInParent.BeginScrapping(val2.value); } } private void NetworkUser_OnEnable(orig_OnEnable orig, NetworkUser self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<InventoryScrapCounter>())) { if (PluginConfig.DebugLogs.Value) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Adding InventoryScrapCounter component to NetworkUser"); } ((Component)self).gameObject.AddComponent<InventoryScrapCounter>(); } } private void HUD_Awake(orig_Awake orig, HUD self) { orig.Invoke(self); if (NetworkClient.active) { ItemInventoryDisplay itemInventoryDisplay = self.itemInventoryDisplay; if (!Object.op_Implicit((Object)(object)((Component)itemInventoryDisplay).gameObject.GetComponent<MainInventoryMarker>())) { ((Component)itemInventoryDisplay).gameObject.AddComponent<MainInventoryMarker>(); } } } private void ItemIcon_Awake(orig_Awake orig, ItemIcon self) { orig.Invoke(self); if (!NetworkClient.active || !Object.op_Implicit((Object)(object)((Component)self).GetComponentInParent<MainInventoryMarker>())) { return; } if (PluginConfig.DebugLogs.Value) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"An ItemIcon in the main inventory just woke up"); } if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<ItemIconScrapSelector>())) { ((Component)self).gameObject.AddComponent<ItemIconScrapSelector>(); if (PluginConfig.DebugLogs.Value) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Added ItemIconScrapSelector component an ItemIcon"); } } } private void InitConfig() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown ModSettingsManager.SetModDescription("Allows you to pre-select items from your inventory you want to automatically scrap the next time you use a scrapper."); ModSettingsManager.SetModIcon(Assets.Load<Sprite>("Assets/icon.png")); PluginConfig.ToggleScrapKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Input", "Toggle item for scrap", new KeyboardShortcut((KeyCode)116, Array.Empty<KeyCode>()), "When mouse hovering over an item in the top bar, pressing this key will (un)mark it for scrapping."); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(PluginConfig.ToggleScrapKey)); PluginConfig.DebugLogs = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Print debug logs to console", false, "When true, logs will be printed to the console"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(PluginConfig.DebugLogs)); } } public class PluginConfig { public static ConfigEntry<KeyboardShortcut> ToggleScrapKey; public static ConfigEntry<bool> DebugLogs; } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.eviegc.MarkForScrap"; public const string PLUGIN_NAME = "MarkForScrap"; public const string PLUGIN_VERSION = "1.1.3"; } } namespace MarkForScrap.Utils { public static class ItemUtils { public static bool IsScrappable(ItemIndex idx) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(idx); ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier); if (!itemDef.canRemove || !itemTierDef.canScrap || itemDef.ContainsTag((ItemTag)10) || itemDef.ContainsTag((ItemTag)33)) { return false; } return true; } } public static class PatchedKeyboardShortcut { public static bool IsDown(KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) KeyCode mainKey = ((KeyboardShortcut)(ref shortcut)).MainKey; if ((int)mainKey == 0) { return false; } if (UnityInput.Current.GetKeyDown(mainKey)) { foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if ((int)modifier != 0 && !UnityInput.Current.GetKey(modifier)) { return false; } } return true; } return false; } } public static class LocalUser { public static NetworkUser networkUser { get { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null) { return null; } return firstLocalUser.currentNetworkUser; } } public static CharacterMaster master { get { NetworkUser obj = networkUser; if (obj == null) { return null; } return obj.master; } } public static InventoryScrapCounter scrapCounter { get { NetworkUser obj = networkUser; if (obj == null) { return null; } return ((Component)obj).GetComponent<InventoryScrapCounter>(); } } } } namespace MarkForScrap.Resources { internal static class Assets { private static AssetBundle _mainAssetBundle; internal static T Load<T>(string asset) where T : Object { return _mainAssetBundle.LoadAsset<T>(asset); } internal static void LoadAssets() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MarkForScrap.Resources.AssetBundles.markforscrap"); _mainAssetBundle = AssetBundle.LoadFromStream(stream); } } }