using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AIGraph; using Agents; using CullingSystem; using GameData; using Hikaria.Core; using Hikaria.DropItem.Handlers; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Localization; using Player; using SNetwork; using TheArchive.Core; using TheArchive.Core.Attributes; using TheArchive.Core.Attributes.Feature; using TheArchive.Core.Attributes.Feature.Patches; using TheArchive.Core.FeaturesAPI; using TheArchive.Core.FeaturesAPI.Settings; using TheArchive.Core.Localization; using TheArchive.Interfaces; using TheArchive.Loader; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Hikaria.DropItem { [ArchiveDependency(/*Could not decode attribute arguments.*/)] [ArchiveModule("Hikaria.DropItem", "DropItem", "1.0.1")] public class EntryPoint : IArchiveModule { public ILocalizationService LocalizationService { get; set; } public IArchiveLogger Logger { get; set; } public void Init() { Logs.Setup(Logger); } } internal static class Logs { private static IArchiveLogger _logger; public static void Setup(IArchiveLogger logger) { _logger = logger; } public static void LogDebug(object data) { _logger.Debug(data.ToString()); } public static void LogError(object data) { _logger.Error(data.ToString()); } public static void LogInfo(object data) { _logger.Info(data.ToString()); } public static void LogMessage(object data) { _logger.Msg(ConsoleColor.White, data.ToString()); } public static void LogWarning(object data) { _logger.Warning(data.ToString()); } public static void LogNotice(object data) { _logger.Notice(data.ToString()); } public static void LogSuccess(object data) { _logger.Success(data.ToString()); } public static void LogException(Exception ex) { _logger.Exception(ex); } } public static class PluginInfo { public const string GUID = "Hikaria.DropItem"; public const string NAME = "DropItem"; public const string VERSION = "1.0.1"; } } namespace Hikaria.DropItem.Handlers { public static class DropItemManager { private static GameObject s_itemGhost; public static bool IsInteractDropItem { get; private set; } public static LG_WeakResourceContainer_Slot CurrentSelectedSlot { get; private set; } public static void OnSelectedChange(LG_WeakResourceContainer_Slot slot, PlayerAgent agent, bool selected) { if (selected) { CurrentSelectedSlot = slot; IsInteractDropItem = true; SpawnItemGhost(slot, agent); InteractionGuiLayer interactionLayer = GuiManager.InteractionLayer; string format = Text.Get(864u); ItemEquippable wieldedItem = agent.Inventory.WieldedItem; interactionLayer.SetInteractPrompt(string.Format(format, (wieldedItem != null) ? ((Item)wieldedItem).PublicName : null), string.Format(Text.Get(827u), InputMapper.GetBindingName((InputAction)6)), (ePUIMessageStyle)0); if (agent != null && ((Agent)agent).IsLocallyOwned) { agent.Sync.SendGenericInteract((TypeEnum)5, false); } } else { CurrentSelectedSlot = null; IsInteractDropItem = false; DespawnItemGhost(); } } public static void TriggerInteractionAction(LG_WeakResourceContainer_Slot slot, PlayerAgent source) { //IL_0030: 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_005b: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) PlayerBackpack val = default(PlayerBackpack); if ((Object)(object)source == (Object)null || !PlayerBackpackManager.TryGetBackpack(source.Owner, ref val)) { return; } ItemEquippable wieldedItem = source.Inventory.WieldedItem; Item val2 = default(Item); if ((Object)(object)wieldedItem == (Object)null || !PlayerBackpackManager.TryGetItemInLevelFromItemData(((Item)wieldedItem).Get_pItemData(), ref val2)) { return; } ItemInLevel val3 = ((Il2CppObjectBase)val2).TryCast(); if ((Object)(object)val3 == (Object)null) { return; } InventorySlot wieldedSlot = source.Inventory.WieldedSlot; if (slot.TryGetTransform(wieldedSlot, out var transform)) { iPickupItemSync syncComponent = val3.GetSyncComponent(); if (syncComponent != null) { pItemData_Custom customData = syncComponent.GetCustomData(); customData.ammo = val.AmmoStorage.GetInventorySlotAmmo(wieldedSlot).AmmoInPack; syncComponent.AttemptPickupInteraction((ePickupItemInteractionType)1, source.Owner, customData, transform.position, transform.rotation, slot.SpawnNode, false, false); } } } public static bool PlayerCanInteract(LG_WeakResourceContainer_Slot slot, PlayerAgent source) { if (!slot.IsContainerOpen || slot.IsSlotInUse) { return false; } return slot.IsValidItemForDrop(source.Inventory.WieldedItem); } public static void SpawnItemGhost(LG_WeakResourceContainer_Slot slot, PlayerAgent agent) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) DespawnItemGhost(); object obj; if (agent == null) { obj = null; } else { PlayerInventoryBase inventory = agent.Inventory; obj = ((inventory != null) ? inventory.WieldedItem : null); } ItemEquippable val = (ItemEquippable)obj; if ((Object)(object)val == (Object)null) { return; } Dictionary> val2 = ((Il2CppArrayBase>>)(object)ItemSpawnManager.m_loadedPrefabsPerItemMode)[2]; uint itemID_gearCRC = ((Item)val).Get_pItemData().itemID_gearCRC; if (!val2.ContainsKey(itemID_gearCRC)) { return; } List val3 = val2[itemID_gearCRC]; if (val3 == null || val3.Count < 1) { return; } GameObject val4 = val3[0]; if ((Object)(object)val4 == (Object)null || !slot.TryGetTransform(agent.Inventory.WieldedSlot, out var transform)) { return; } s_itemGhost = Object.Instantiate(val4, transform.position, transform.rotation); foreach (Renderer componentsInChild in s_itemGhost.GetComponentsInChildren()) { foreach (Material item in (Il2CppArrayBase)(object)componentsInChild.materials) { item.shader = Shader.Find("Transparent/Diffuse"); Color black = Color.black; item.color = ((Color)(ref black)).AlphaMultiplied(0.25f); } } } public static void DespawnItemGhost() { if ((Object)(object)s_itemGhost != (Object)null) { Object.Destroy((Object)(object)s_itemGhost); s_itemGhost = null; } } } public sealed class LG_WeakResourceContainer_Slot : MonoBehaviour { internal class SlotInfo { public static readonly SlotInfo[] LockerSlotInfo = new SlotInfo[6] { new SlotInfo(new Vector3(-0.724f, -0.252f, 1.754f), new Vector3(0.42f, 0.433f, 0.3f)), new SlotInfo(new Vector3(-0.672f, -0.252f, 1.454f), new Vector3(0.5f, 0.433f, 0.25f)), new SlotInfo(new Vector3(-0.672f, -0.252f, 1.154f), new Vector3(0.5f, 0.433f, 0.25f)), new SlotInfo(new Vector3(-0.672f, -0.252f, 0.854f), new Vector3(0.5f, 0.433f, 0.25f)), new SlotInfo(new Vector3(-0.672f, -0.252f, 0.354f), new Vector3(0.5f, 0.433f, 0.67f)), new SlotInfo(new Vector3(-0.276f, -0.252f, 1.754f), new Vector3(0.42f, 0.433f, 0.3f)) }; public static readonly SlotInfo[] BoxSlotInfo = new SlotInfo[3] { new SlotInfo(new Vector3(0.009f, 0f, 0.163f), new Vector3(0.33f, 0.54f, 0.323f)), new SlotInfo(new Vector3(-0.343f, 0f, 0.163f), new Vector3(0.34f, 0.54f, 0.323f)), new SlotInfo(new Vector3(0.358f, 0f, 0.163f), new Vector3(0.33f, 0.54f, 0.323f)) }; public readonly Vector3 LocalPosition; public readonly Vector3 LocalScale; public SlotInfo(Vector3 position, Vector3 scale) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) LocalPosition = position; LocalScale = scale; } } private static readonly Dictionary s_SlotItemLookup = new Dictionary(); private static readonly Dictionary> s_ContainerSlotsLookup = new Dictionary>(); private static readonly Dictionary s_ItemSlotLookup = new Dictionary(); private readonly HashSet m_allowedSlots = new HashSet(); private LG_WeakResourceContainer m_container; private LG_ResourceContainer_Storage m_containerStorage; private LG_WeakResourceContainer_Graphics m_containerGraphics; private StorageSlot m_slot; private int m_slotIndex; private bool m_hasItemInSlot; private int m_itemInSlot; private Interact_Timed m_interactionDropItem; public bool IsContainerOpen { get { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!m_container.ISOpen) { return (int)m_containerGraphics.m_status == 3; } return true; } } public bool IsSlotInUse { get { if (m_hasItemInSlot) { return m_itemInSlot != 0; } return false; } } public AIG_CourseNode SpawnNode => m_container.SpawnNode; public LG_WeakResourceContainer Container => m_container; public LG_ResourceContainer_Storage Storage => m_containerStorage; public float InteractDuration { get { return m_interactionDropItem.InteractDuration; } set { m_interactionDropItem.InteractDuration = value; } } public void Setup(LG_WeakResourceContainer container, LG_ResourceContainer_Sync sync, StorageSlot slot, int slotIndex) { //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) m_container = container; if (!Object.op_Implicit((Object)(object)m_container)) { Object.Destroy((Object)(object)this); return; } iResourceContainerGraphics graphics = container.m_graphics; m_containerGraphics = ((graphics != null) ? ((Il2CppObjectBase)graphics).TryCast() : null); if (!Object.op_Implicit((Object)(object)m_containerGraphics)) { Object.Destroy((Object)(object)this); return; } iResourceContainerStorage storage = container.m_storage; m_containerStorage = ((storage != null) ? ((Il2CppObjectBase)storage).TryCast() : null); if (!s_ContainerSlotsLookup.TryGetValue(m_container, out var value)) { value = new Dictionary(); s_ContainerSlotsLookup[container] = value; } value[slotIndex] = this; m_slot = slot; m_slotIndex = slotIndex; if ((Object)(object)slot.ResourcePack != (Object)null) { m_allowedSlots.Add((InventorySlot)4); } if ((Object)(object)slot.Consumable != (Object)null) { m_allowedSlots.Add((InventorySlot)5); } if ((Object)(object)slot.Keycard != (Object)null) { m_allowedSlots.Add((InventorySlot)7); } if (m_container.m_isLocker) { SlotInfo slotInfo = SlotInfo.LockerSlotInfo[slotIndex]; ((Component)this).gameObject.transform.localRotation = Quaternion.identity; ((Component)this).gameObject.transform.localPosition = slotInfo.LocalPosition; ((Component)this).gameObject.transform.localScale = slotInfo.LocalScale; ((Component)this).gameObject.AddComponent().m_pingTargetStyle = (eNavMarkerStyle)10; } else { SlotInfo slotInfo2 = SlotInfo.BoxSlotInfo[slotIndex]; ((Component)this).gameObject.transform.localRotation = Quaternion.identity; ((Component)this).gameObject.transform.localPosition = slotInfo2.LocalPosition; ((Component)this).gameObject.transform.localScale = slotInfo2.LocalScale; ((Component)this).gameObject.AddComponent().m_pingTargetStyle = (eNavMarkerStyle)11; } m_interactionDropItem = ((Component)this).GetComponent() ?? ((Component)this).gameObject.AddComponent(); m_interactionDropItem.InteractDuration = 0.4f; m_interactionDropItem.InteractionMessage = string.Empty; ((Interact_Base)m_interactionDropItem).m_colliderToOwn = (Collider)(object)(((Component)this).GetComponent() ?? ((Component)this).gameObject.AddComponent()); m_interactionDropItem.ExternalPlayerCanInteract = Func.op_Implicit((Func)((PlayerAgent player) => DropItemManager.PlayerCanInteract(this, player))); m_interactionDropItem.OnInteractionSelected = Action.op_Implicit((Action)delegate(PlayerAgent player, bool state) { DropItemManager.OnSelectedChange(this, player, state); }); m_interactionDropItem.OnInteractionTriggered = Action.op_Implicit((Action)delegate(PlayerAgent player) { DropItemManager.TriggerInteractionAction(this, player); }); ((Interact_Base)m_interactionDropItem).OnlyActiveWhenLookingStraightAt = true; ((Interact_Base)m_interactionDropItem).SetActive(true); sync.OnSyncStateChange += Action.op_Implicit((Action)delegate(eResourceContainerStatus status, bool isRecall) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if ((int)status == 3) { ((Interact_Base)m_interactionDropItem).SetActive(!IsSlotInUse); } else if ((int)status == 2) { ((Interact_Base)m_interactionDropItem).SetActive(false); } }); } private void OnDestroy() { RemoveItem(isDestroy: true); DropItemManager.DespawnItemGhost(); if (s_ContainerSlotsLookup.TryGetValue(m_container, out var value)) { value.Remove(m_slotIndex); if (value.Count < 1) { s_ContainerSlotsLookup.Remove(m_container); } } } public void OnPrepareForRecall() { ((Interact_Base)m_interactionDropItem).SetActive(true); } public void UpdateInteractionActive() { ((Interact_Base)m_interactionDropItem).SetActive(IsContainerOpen && !IsSlotInUse); } public void AddItem(LG_PickupItem_Sync item, bool isSetup = false) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) AddItem(((Object)((Component)item).gameObject).GetInstanceID()); Item item2 = item.item; ItemInLevel val = ((item2 != null) ? ((Il2CppObjectBase)item2).TryCast() : null); if (Object.op_Implicit((Object)(object)val)) { iResourceContainerStorage storage = m_container.m_storage; LG_ResourceContainer_Storage val2 = ((storage != null) ? ((Il2CppObjectBase)storage).Cast() : null); if (Object.op_Implicit((Object)(object)val2)) { val.container = val2; } } if (!isSetup) { InventorySlot slot = (InventorySlot)(((Object)(object)((Il2CppObjectBase)item.item).TryCast() != (Object)null) ? 7 : ((int)item.item.Get_pItemData().slot)); if (TryGetTransform(slot, out var transform)) { ((Component)item).transform.SetParent(transform); } } } private void AddItem(int instanceID) { if (!IsSlotInUse) { m_hasItemInSlot = true; m_itemInSlot = instanceID; s_SlotItemLookup[this] = m_itemInSlot; s_ItemSlotLookup[m_itemInSlot] = this; ((Interact_Base)m_interactionDropItem).SetActive(false); } } public void RemoveItem(bool isDestroy = false) { if (IsSlotInUse) { m_hasItemInSlot = false; s_SlotItemLookup.Remove(this); s_ItemSlotLookup.Remove(m_itemInSlot); m_itemInSlot = 0; } if (!isDestroy) { ((Interact_Base)m_interactionDropItem).SetActive(IsContainerOpen && !IsSlotInUse); } } public static void RemoveAllItems() { foreach (LG_WeakResourceContainer_Slot key in s_SlotItemLookup.Keys) { key.RemoveItem(); } } public bool TryGetTransform(InventorySlot slot, out Transform transform) { //IL_0001: 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_0010: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 if (!IsValidInventorySlot(slot)) { transform = null; return false; } if ((int)slot != 4) { if ((int)slot == 5) { transform = m_slot.Consumable; return true; } transform = null; return false; } transform = m_slot.ResourcePack; return true; } public static bool TryFindSlot(Vector3 pos, out LG_WeakResourceContainer_Slot slot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) foreach (Collider item in (Il2CppArrayBase)(object)Physics.OverlapSphere(pos, 0.01f, LayerManager.MASK_PLAYER_INTERACT_SPHERE)) { slot = ((Component)item).gameObject.GetComponent(); if ((Object)(object)slot != (Object)null && !slot.IsSlotInUse) { return true; } } slot = null; return false; } public static bool TryFindSlot(LG_PickupItem_Sync itemSync, out LG_WeakResourceContainer_Slot slot) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!s_ItemSlotLookup.TryGetValue(((Object)((Component)itemSync).gameObject).GetInstanceID(), out slot) && !TryFindSlot(((Component)itemSync).transform.position, out slot)) { return false; } return true; } public bool IsValidItemForDrop(ItemEquippable item) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) InventorySlot? obj; if (item == null) { obj = null; } else { ItemDataBlock itemDataBlock = ((Item)item).ItemDataBlock; obj = ((itemDataBlock != null) ? new InventorySlot?(itemDataBlock.inventorySlot) : null); } InventorySlot? val = obj; return IsValidInventorySlot(val.GetValueOrDefault()); } public bool IsValidInventorySlot(InventorySlot slot) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return m_allowedSlots.Contains(slot); } } } namespace Hikaria.DropItem.Features { [EnableFeatureByDefault] [DisallowInGameToggle] [HideInModSettings] public class DropItem : Feature { [ArchivePatch(/*Could not decode attribute arguments.*/)] private class PlayerInventoryLocal__DoWieldItem__Patch { private static void Postfix(PlayerInventoryLocal __instance) { if (((PlayerInventoryBase)__instance).AllowedToWieldItem && DropItemManager.IsInteractDropItem && DropItemManager.CurrentSelectedSlot.IsValidItemForDrop(((PlayerInventoryBase)__instance).WieldedItem)) { DropItemManager.SpawnItemGhost(DropItemManager.CurrentSelectedSlot, ((PlayerInventoryBase)__instance).Owner); InteractionGuiLayer interactionLayer = GuiManager.InteractionLayer; string format = Text.Get(864u); ItemEquippable wieldedItem = ((PlayerInventoryBase)__instance).WieldedItem; interactionLayer.SetInteractPrompt(string.Format(format, (wieldedItem != null) ? ((Item)wieldedItem).PublicName : null), string.Format(Text.Get(827u), InputMapper.GetBindingName((InputAction)6)), (ePUIMessageStyle)0); } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class LG_WeakResourceContainer__Setup__Patch { private static void Postfix(LG_WeakResourceContainer __instance) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) iResourceContainerStorage storage = __instance.m_storage; LG_ResourceContainer_Storage val = ((storage != null) ? ((Il2CppObjectBase)storage).TryCast() : null); if ((Object)(object)val == (Object)null) { return; } iResourceContainerSync sync = __instance.m_sync; LG_ResourceContainer_Sync val2 = ((sync != null) ? ((Il2CppObjectBase)sync).TryCast() : null); if ((Object)(object)val2 == (Object)null) { return; } int num = 0; foreach (StorageSlot item in (Il2CppArrayBase)(object)val.m_storageSlots) { GameObject val3 = new GameObject($"ResourceContainerSlot_{num}") { layer = LayerManager.LAYER_INTERACTION }; val3.transform.SetParent(((Component)__instance).transform); val3.AddComponent().Setup(__instance, val2, item, num); num++; } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class LG_PickupItem_Sync__Setup__Patch { private static void Postfix(LG_PickupItem_Sync __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((int)__instance.GetCurrentState().status == 0 && LG_WeakResourceContainer_Slot.TryFindSlot(((Component)__instance).transform.position, out var slot)) { slot.AddItem(__instance, isSetup: true); } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class LG_PickupItem_Sync__SetStateFromFactory__Patch { private static void Postfix(LG_PickupItem_Sync __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((int)__instance.GetCurrentState().status == 0 && LG_WeakResourceContainer_Slot.TryFindSlot(((Component)__instance).transform.position, out var slot)) { slot.AddItem(__instance, isSetup: true); } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class LG_PickupItem_Sync__OnStateChange__Patch { private static void Prefix(LG_PickupItem_Sync __instance, pPickupItemState newState, bool isRecall) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0053: 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_005a: Invalid comparison between Unknown and I4 //IL_0015: 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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (newState.updateCustomDataOnly || isRecall) { return; } LG_WeakResourceContainer_Slot slot2; if ((int)newState.status == 0) { if (LG_WeakResourceContainer_Slot.TryFindSlot(newState.placement.position, out var slot)) { slot.AddItem(__instance); ItemInLevel val = ((Il2CppObjectBase)__instance.item).TryCast(); if ((Object)(object)val != (Object)null) { val.container = slot.Storage; } } } else if ((int)newState.status == 1 && LG_WeakResourceContainer_Slot.TryFindSlot(__instance, out slot2)) { slot2.RemoveItem(); ItemInLevel val2 = ((Il2CppObjectBase)__instance.item).TryCast(); if ((Object)(object)val2 != (Object)null) { val2.container = null; } } } private static void Postfix(LG_PickupItem_Sync __instance, pPickupItemState newState) { //IL_002c: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 ItemCuller component = ((Component)__instance).GetComponent(); if (((component != null) ? ((C_SpecialRenderableObject)component).CullBucket : null) != null) { ((C_Cullable)((C_SpecialRenderableObject)component).CullBucket).NeedsShadowRefresh = true; ((C_SpecialRenderableObject)component).CullBucket.SetDirtyCMDBuffer(); } if ((int)newState.status == 0) { iTerminalItem componentInChildren = ((Component)__instance.item).GetComponentInChildren(); AIG_CourseNode spawnNode = default(AIG_CourseNode); if (componentInChildren != null && ((pCourseNode)(ref newState.placement.node)).TryGet(ref spawnNode)) { componentInChildren.SpawnNode = spawnNode; } } else if ((int)newState.status == 1 && (Object)(object)((Component)__instance).transform.parent == (Object)null) { ((Component)__instance).transform.SetParent(((Component)Builder.CurrentFloor).transform, false); } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class ItemSpawnManager__SpawnItem__Patch { private static void Postfix(Item __result) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) ItemInLevel val = ((__result != null) ? ((Il2CppObjectBase)__result).TryCast() : null); if ((Object)(object)val == (Object)null || (int)val.internalSync.GetCurrentState().status != 0) { return; } pItemData pItemData = ((Item)val).Get_pItemData(); AIG_CourseNode courseNode = default(AIG_CourseNode); if (((pCourseNode)(ref pItemData.originCourseNode)).TryGet(ref courseNode)) { val.CourseNode = courseNode; return; } iTerminalItem component = ((Component)val).GetComponent(); if (component != null) { val.CourseNode = component.SpawnNode; return; } Transform parent = ((Component)val).transform.parent; object obj; if (parent == null) { obj = null; } else { Transform parent2 = parent.parent; obj = ((parent2 != null) ? ((Component)parent2).GetComponentInChildren() : null); } LG_PickupItem val2 = (LG_PickupItem)obj; if ((Object)(object)val2 != (Object)null) { val.CourseNode = val2.SpawnNode; } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class LG_ResourceContainer_Storage__SetSpawnNode__Patch { private static void Postfix(LG_ResourceContainer_Storage __instance, GameObject obj, AIG_CourseNode spawnNode) { //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) foreach (ItemInLevel componentsInChild in obj.GetComponentsInChildren()) { if (componentsInChild.CourseNode == null && (int)componentsInChild.internalSync.GetCurrentState().status == 0) { componentsInChild.CourseNode = spawnNode; } } } } public override string Name => "放置物品"; public override void Init() { ClassInjector.RegisterTypeInIl2Cpp(false); } public override void OnEnable() { SNetEventAPI.OnRecallComplete += OnRecallComplete; } public override void OnDisable() { SNetEventAPI.OnRecallComplete -= OnRecallComplete; } public override void OnFeatureSettingChanged(FeatureSetting setting) { _ = Feature.CurrentGameState; _ = 10; } public override void OnGameStateChanged(int state) { if (state != 10) { return; } foreach (LG_WeakResourceContainer_Slot item in Object.FindObjectsOfType()) { item.UpdateInteractionActive(); } } public void OnRecallComplete(eBufferType bufferType) { //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_0072: Unknown result type (might be due to invalid IL or missing references) if (Feature.CurrentGameState < 10) { return; } LG_WeakResourceContainer_Slot.RemoveAllItems(); Il2CppArrayBase val = Object.FindObjectsOfType(); foreach (LG_WeakResourceContainer_Slot item in val) { item.OnPrepareForRecall(); } foreach (LG_PickupItem_Sync item2 in Object.FindObjectsOfType()) { if (!((Object)(object)item2.item == (Object)null) && (int)item2.GetCurrentState().status == 0 && LG_WeakResourceContainer_Slot.TryFindSlot(((Component)item2).transform.position, out var slot)) { slot.AddItem(item2); } } foreach (LG_WeakResourceContainer_Slot item3 in val) { item3.UpdateInteractionActive(); } } } }