Please disclose if your mod was created primarily 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 ItemTrashandDuplicateKeys v2.0.0
plugins/ItemTrashKey.dll
Decompiled 2 months agousing System; 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 System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Kai")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ItemTrashKey")] [assembly: AssemblyTitle("ItemTrashKey")] [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 { [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 ItemTrashKey { [BepInPlugin("Kai.ItemTrashKey", "ItemTrashKey", "2.0")] public class ItemTrashKey : BaseUnityPlugin { internal static class ValuablePrefabCache { public static bool Initialized; public static Dictionary<string, GameObject> PrefabByNormalizedName = new Dictionary<string, GameObject>(); } internal static class ValuablePrefabRefCatalog { public static bool Initialized; public static readonly List<PrefabRef> All = new List<PrefabRef>(); public static void Build() { if (Initialized) { return; } Initialized = true; foreach (Level level in RunManager.instance.levels) { if (level?.ValuablePresets == null) { continue; } foreach (LevelValuables valuablePreset in level.ValuablePresets) { Add(valuablePreset.tiny); Add(valuablePreset.small); Add(valuablePreset.medium); Add(valuablePreset.big); Add(valuablePreset.wide); Add(valuablePreset.tall); Add(valuablePreset.veryTall); } } All.RemoveAll((PrefabRef p) => p == null || !p.IsValid()); List<PrefabRef> collection = (from p in All group p by p.PrefabName into g select g.First()).ToList(); All.Clear(); All.AddRange(collection); DebugLog($"[ValuableCatalog] Loaded {All.Count} PrefabRefs"); } private static void Add(List<PrefabRef> list) { if (list == null) { return; } foreach (PrefabRef item in list) { if (item != null && item.IsValid()) { All.Add(item); } } } } public static ConfigEntry<bool> AllowEverywhere; public static ConfigEntry<Key> TrashKey; public static ConfigEntry<Key> DuplicateKey; public static ConfigEntry<float> HoldTimeSetting; public static ConfigEntry<bool> SaveDataUpdate; public static ConfigEntry<bool> EnableDebugLog; public static ConfigEntry<bool> EnableValuableMemoryCache; private float holdTimer; private float guideSwitchTimer; private float guideSwitchInterval = 2f; private bool isGuideDisplayed = true; internal static ItemTrashKey Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; AllowEverywhere = ((BaseUnityPlugin)this).Config.Bind<bool>("TrashKey", "AllowEverywhere", false, "Museum / Manor / Arctic / Wizard でも削除/複製を許可する"); TrashKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Keys", "TrashKey", (Key)71, "キー設定: 削除用キー"); DuplicateKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Keys", "DuplicateKey", (Key)70, "キー設定: 複製用キー"); HoldTimeSetting = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HoldTime", 1f, new ConfigDescription("長押し時間: アイテムを削除または複製するために必要な長押し時間 (秒)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SaveDataUpdate = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SaveDataUpdate", true, "複製および削除時にセーブデータへ反映するかどうか"); EnableValuableMemoryCache = ((BaseUnityPlugin)this).Config.Bind<bool>("Advanced", "EnableValuableMemoryCache", false, "ValuablePresets に存在しない貴重品も複製可能にする"); EnableDebugLog = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDebugLog", false, "ログ出力を有効にするかどうか"); Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } private static bool IsLobbyOrTruck() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) try { RunManager instance = RunManager.instance; if ((Object)(object)instance?.levelCurrent != (Object)null) { string text = ((Object)instance.levelCurrent).name ?? ""; return text.Contains("Lobby") || text.Contains("Truck"); } Scene activeScene = SceneManager.GetActiveScene(); string text2 = ((Scene)(ref activeScene)).name ?? ""; return text2.Contains("Lobby") || text2.Contains("Truck"); } catch { return false; } } public static void DebugLog(string msg) { if (EnableDebugLog.Value) { Logger.LogInfo((object)msg); } } public static void BuildCacheIfEnabled() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!EnableValuableMemoryCache.Value || ValuablePrefabCache.Initialized) { return; } ValuablePrefabCache.Initialized = true; ValuableObject[] array = Resources.FindObjectsOfTypeAll<ValuableObject>(); ValuableObject[] array2 = array; foreach (ValuableObject val in array2) { if ((Object)(object)val == (Object)null) { continue; } GameObject gameObject = ((Component)val).gameObject; Scene scene = gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { string key = NormalizeNameKey(((Object)val).name); if (!ValuablePrefabCache.PrefabByNormalizedName.ContainsKey(key)) { ValuablePrefabCache.PrefabByNormalizedName[key] = gameObject; } } } DebugLog($"[ValuableCache] Cached {ValuablePrefabCache.PrefabByNormalizedName.Count} valuables"); } private void RemoveItemCompletely(ItemAttributes attrs) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } StatsManager instance = StatsManager.instance; if (!((Object)(object)instance == (Object)null)) { string text = FindDictionaryKeyFromAttributes(attrs); if (text == null) { Logger.LogError((object)"[Trash] 削除対象のキーが特定できませんでした。"); return; } instance.ItemRemove(attrs.instanceName); instance.SaveFileSave(); DebugLog("[Trash] 完全削除: " + attrs.instanceName + " / " + text); } } private static string NormalizeNameKey(string s) { if (string.IsNullOrWhiteSpace(s)) { return ""; } s = s.ToLowerInvariant(); s = s.Replace("(clone)", ""); s = Regex.Replace(s, "[\\s_\\-]+", ""); return s; } private string? FindDictionaryKeyFromAttributes(ItemAttributes attrs) { if ((Object)(object)attrs == (Object)null) { return null; } StatsManager instance = StatsManager.instance; if ((Object)(object)instance == (Object)null) { return null; } if ((Object)(object)attrs.item != (Object)null) { foreach (KeyValuePair<string, Item> item in instance.itemDictionary) { if (item.Value == attrs.item) { return item.Key; } } } string text = NormalizeNameKey(attrs.itemName); string text2 = NormalizeNameKey(((Object)attrs).name); string[] array = new string[10] { "small", "medium", "big", "large", "huge", "tiny", "xl", "xs", "wide", "tall" }; string result = null; int num = int.MinValue; foreach (string key in instance.itemDictionary.Keys) { string text3 = NormalizeNameKey(key); int num2 = 0; if (text3 == text) { num2 += 200; } if (text3 == text2) { num2 += 180; } string[] array2 = array; foreach (string value in array2) { bool flag = text.Contains(value); bool flag2 = text3.Contains(value); if (flag && flag2) { num2 += 80; } if (flag != flag2) { num2 -= 60; } } num2 -= Math.Abs(text3.Length - text.Length) * 2; if (text.Contains(text3)) { num2 += 10; } if (text3.Contains(text)) { num2 += 10; } if (num2 > num) { num = num2; result = key; } } if (num < 80) { return null; } return result; } private void SpawnItemFromAttributes(ItemAttributes sourceAttrs) { string text = FindDictionaryKeyFromAttributes(sourceAttrs); if (text == null) { Logger.LogError((object)("[Duplicate] 辞書キーが特定できませんでした: display='" + sourceAttrs.itemName + "', prefab='" + ((Object)sourceAttrs).name + "'")); } else { SpawnItemByDictionaryKey(text); } } private void SpawnItemByDictionaryKey(string dictKey) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00cb: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) StatsManager instance = StatsManager.instance; if ((Object)(object)instance == (Object)null) { Logger.LogError((object)"[Duplicate] StatsManager.instance が null です。"); return; } if (!instance.itemDictionary.TryGetValue(dictKey, out var value)) { Logger.LogError((object)("[Duplicate] itemDictionary に '" + dictKey + "' が見つかりません。")); return; } Camera main = Camera.main; object obj = ((main != null) ? ((Component)main).transform : null); if (obj == null) { PlayerController instance2 = PlayerController.instance; obj = ((instance2 != null) ? ((Component)instance2).transform : null); } Transform val = (Transform)obj; if ((Object)(object)val == (Object)null) { Logger.LogError((object)"[Duplicate] カメラまたはプレイヤーが見つかりません。"); return; } Vector3 val2 = val.position + val.forward * 3f + Vector3.up * 0.5f; Quaternion val3 = val.rotation * value.spawnRotationOffset; GameObject val4 = (SemiFunc.IsMultiplayer() ? PhotonNetwork.InstantiateRoomObject(value.prefab.ResourcePath, val2, val3, (byte)0, (object[])null) : Object.Instantiate<GameObject>(value.prefab.Prefab, val2, val3)); ItemAttributes component = val4.GetComponent<ItemAttributes>(); if ((Object)(object)component == (Object)null) { Logger.LogError((object)"[Duplicate] 生成されたアイテムに ItemAttributes がありません。"); } else if (SaveDataUpdate.Value) { instance.ItemPurchase(dictKey); int num = (((Object)(object)component.photonView != (Object)null) ? component.photonView.ViewID : (-1)); instance.ItemAdd(dictKey, component, num); instance.SaveFileSave(); DebugLog("[Duplicate] '" + dictKey + "' を複製し、インスタンス '" + component.instanceName + "' として登録&セーブしました。"); } else { DebugLog("[Duplicate] '" + dictKey + "' をスポーン(セーブ更新なし)。インスタンス名: " + component.instanceName); } } private void SpawnViaDirector(PrefabRef prefabRef) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_007c: 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) if (prefabRef == null) { return; } ValuableDirector instance = ValuableDirector.instance; if ((Object)(object)instance == (Object)null) { DebugLog("[SpawnViaDirector] ValuableDirector.instance is null"); return; } Camera main = Camera.main; object obj = ((main != null) ? ((Component)main).transform : null); if (obj == null) { PlayerController instance2 = PlayerController.instance; obj = ((instance2 != null) ? ((Component)instance2).transform : null); } Transform val = (Transform)obj; if (!((Object)(object)val == (Object)null)) { Vector3 position = val.position + val.forward * 2f; GameObject val2 = new GameObject("[ItemTrashKeyValuableVolume]"); val2.transform.position = position; val2.transform.rotation = Quaternion.identity; ValuableVolume val3 = val2.AddComponent<ValuableVolume>(); instance.Spawn(prefabRef, val3, prefabRef.ResourcePath); Object.Destroy((Object)(object)val2); DebugLog("[SpawnViaDirector] Spawned via director: " + prefabRef.PrefabName); } } private void DuplicateValuable(ValuableObject val) { PrefabRef val2 = FindValuablePrefab(val); if (val2 != null) { SpawnViaDirector(val2); } else { if (TrySpawnValuableBySpecialRoute(val)) { return; } if (!EnableValuableMemoryCache.Value) { DebugLog("[Duplicate Valuable] Skipped (memory cache disabled)\n[Duplicate Valuable] Cache miss: " + ((Object)val).name); return; } if (SemiFunc.IsMultiplayer()) { DebugLog("[Duplicate Valuable] Skipped (multiplayer mode)[Duplicate Valuable] Cache miss: " + ((Object)val).name); return; } BuildCacheIfEnabled(); string key = NormalizeNameKey(((Object)val).name); if (!ValuablePrefabCache.PrefabByNormalizedName.TryGetValue(key, out GameObject value)) { DebugLog("[Duplicate Valuable] Cache miss: " + ((Object)val).name); } else { SpawnValuableDirect(value); } } } private void SpawnValuableDirect(GameObject prefab) { //IL_0032: 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) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; object obj = ((main != null) ? ((Component)main).transform : null); if (obj == null) { PlayerController instance = PlayerController.instance; obj = ((instance != null) ? ((Component)instance).transform : null); } Transform val = (Transform)obj; if (!((Object)(object)val == (Object)null)) { Vector3 val2 = val.position + val.forward * 2f; GameObject val3 = (SemiFunc.IsMultiplayer() ? PhotonNetwork.InstantiateRoomObject(((Object)prefab).name, val2, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(prefab, val2, Quaternion.identity)); DebugLog("[Duplicate Valuable] Spawned via cache: " + ((Object)prefab).name); } } private PrefabRef? FindValuablePrefab(ValuableObject val) { ValuablePrefabRefCatalog.Build(); string text = NormalizeNameKey(((Object)val).name); PrefabRef result = null; int num = int.MinValue; foreach (PrefabRef item in ValuablePrefabRefCatalog.All) { string text2 = NormalizeNameKey(item.PrefabName); int num2 = 0; if (text2 == text) { num2 += 200; } if (text2.Contains(text) || text.Contains(text2)) { num2 += 50; } num2 -= Math.Abs(text2.Length - text.Length) * 2; if (num2 > num) { num = num2; result = item; } } if (num < 80) { return null; } return result; } private void DeleteValuable(ValuableObject val) { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Destroy(((Component)val).gameObject); } else { Object.Destroy((Object)(object)((Component)val).gameObject); } DebugLog("[Trash Valuable] " + ((Object)val).name); } private bool TrySpawnValuableBySpecialRoute(ValuableObject val) { if (TrySpawnEnemyValuableFallback(val)) { return true; } if (TrySpawnSurplusValuableFallback(val)) { return true; } return false; } private bool TrySpawnEnemyValuableFallback(ValuableObject val) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) AssetManager instance = AssetManager.instance; if ((Object)(object)instance == (Object)null) { return false; } string text = ((Object)val).name.ToLowerInvariant(); if (!text.Contains("enemy valuable")) { return false; } GameObject val2 = null; if (text.Contains("small")) { val2 = instance.enemyValuableSmall; } else if (text.Contains("medium")) { val2 = instance.enemyValuableMedium; } else if (text.Contains("big")) { val2 = instance.enemyValuableBig; } if ((Object)(object)val2 == (Object)null) { return false; } Camera main = Camera.main; object obj = ((main != null) ? ((Component)main).transform : null); if (obj == null) { PlayerController instance2 = PlayerController.instance; obj = ((instance2 != null) ? ((Component)instance2).transform : null); } Transform val3 = (Transform)obj; if ((Object)(object)val3 == (Object)null) { return false; } Vector3 val4 = val3.position + val3.forward * 2f; if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject("Valuables/" + ((Object)val2).name, val4, Quaternion.identity, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(val2, val4, Quaternion.identity); } DebugLog("[Duplicate Valuable] Spawned enemy valuable fallback: " + ((Object)val2).name); return true; } private bool TrySpawnSurplusValuableFallback(ValuableObject val) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00f2: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) AssetManager instance = AssetManager.instance; if ((Object)(object)instance == (Object)null) { return false; } string text = ((Object)val).name.ToLowerInvariant(); if (!text.Contains("surplus")) { return false; } GameObject val2 = null; if (text.Contains("small")) { val2 = instance.surplusValuableSmall; } else if (text.Contains("medium")) { val2 = instance.surplusValuableMedium; } else if (text.Contains("big")) { val2 = instance.surplusValuableBig; } if ((Object)(object)val2 == (Object)null) { return false; } Camera main = Camera.main; object obj = ((main != null) ? ((Component)main).transform : null); if (obj == null) { PlayerController instance2 = PlayerController.instance; obj = ((instance2 != null) ? ((Component)instance2).transform : null); } Transform val3 = (Transform)obj; if ((Object)(object)val3 == (Object)null) { return false; } Vector3 val4 = val3.position + val3.forward * 2f; GameObject val5 = ((!SemiFunc.IsMultiplayer()) ? Object.Instantiate<GameObject>(val2, val4, Quaternion.identity) : PhotonNetwork.InstantiateRoomObject("Valuables/" + ((Object)val2).name, val4, Quaternion.identity, (byte)0, (object[])null)); ValuableObject component = val5.GetComponent<ValuableObject>(); if ((Object)(object)component != (Object)null) { component.dollarValueOverride = (int)val.dollarValueCurrent; } DebugLog($"[Duplicate Valuable] Spawned surplus valuable fallback: {((Object)val2).name} (${val.dollarValueCurrent})"); return true; } private void Update() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (!AllowEverywhere.Value && !IsLobbyOrTruck()) { holdTimer = 0f; return; } PhysGrabObject val = PhysGrabber.instance?.grabbedPhysGrabObject; if ((Object)(object)val == (Object)null) { holdTimer = 0f; } else { if ((Object)(object)((Component)val).GetComponent<PlayerDeathHead>() != (Object)null || (Object)(object)((Component)val).GetComponent<PlayerAvatar>() != (Object)null) { return; } ItemAttributes component = ((Component)val).GetComponent<ItemAttributes>(); ValuableObject component2 = ((Component)val).GetComponent<ValuableObject>(); if ((Object)(object)component == (Object)null && (Object)(object)component2 == (Object)null) { holdTimer = 0f; return; } string text = (((Object)(object)component != (Object)null) ? component.instanceName : "(valuable)"); guideSwitchTimer += Time.deltaTime; if (guideSwitchTimer >= guideSwitchInterval) { guideSwitchTimer = 0f; isGuideDisplayed = !isGuideDisplayed; } if (holdTimer == 0f) { if (isGuideDisplayed) { ItemInfoExtraUI.instance.ItemInfoText($"[{TrashKey.Value}] HOLD TO DESTROY", Color.red); } else { ItemInfoExtraUI.instance.ItemInfoText($"[{DuplicateKey.Value}] HOLD TO DUPLICATE", Color.green); } } if (((ButtonControl)Keyboard.current[TrashKey.Value]).isPressed) { holdTimer += Time.deltaTime; ItemInfoExtraUI.instance.ItemInfoText("DESTROYING...", Color.red); if (!(holdTimer >= HoldTimeSetting.Value)) { return; } if ((Object)(object)component != (Object)null) { if (SaveDataUpdate.Value) { RemoveItemCompletely(component); } if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Destroy(((Component)val).gameObject); } else { Object.Destroy((Object)(object)((Component)val).gameObject); } } else if ((Object)(object)component2 != (Object)null) { DeleteValuable(component2); } holdTimer = 0f; } else if (((ButtonControl)Keyboard.current[DuplicateKey.Value]).isPressed) { holdTimer += Time.deltaTime; ItemInfoExtraUI.instance.ItemInfoText("DUPLICATING...", Color.green); if (holdTimer >= HoldTimeSetting.Value) { if ((Object)(object)component != (Object)null) { SpawnItemFromAttributes(component); } else if ((Object)(object)component2 != (Object)null) { DuplicateValuable(component2); } holdTimer = 0f; } } else { holdTimer = 0f; } } } } }