private void LegacyChestPanel_OnItemDisplayClicked(On.LegacyChestPanel.orig_OnItemDisplayClicked orig, LegacyChestPanel self, ItemDisplay _itemDisplay) { try { //OLogger.Log("OnItemDisplayClicked"); ItemDisplay m_itemInChest = (ItemDisplay)AccessTools.Field(typeof(LegacyChestPanel), "m_itemInChest").GetValue(self); ItemContainer m_refLegacyChest = (ItemContainer)AccessTools.Field(typeof(LegacyChestPanel), "m_refLegacyChest").GetValue(self); CharacterUI m_characterUI = (CharacterUI)AccessTools.Field(typeof(LegacyChestPanel), "m_characterUI").GetValue(self); //OLogger.Log($"UQD={self.RefItem.IsStackable} {self.RefItem.MaxStackAmount}"); if (_itemDisplay == m_itemInChest) { self.TakeItemBack(); } else //if (!(_itemDisplay is ItemGroupDisplay) || ((ItemGroupDisplay)_itemDisplay).StackCount == 1) { /*if (m_refLegacyChest.ItemCount > 0) * { * self.TakeItemBack(); * }*/ /*if (_itemDisplay is ItemGroupDisplay) * { * m_itemInChest = _itemDisplay; * AccessTools.Field(typeof(LegacyChestPanel), "m_itemInChest").SetValue(self, m_itemInChest); * } * OLogger.Log($"IsGroup1={_itemDisplay is ItemGroupDisplay}"); * OLogger.Log($"IsGroup2={m_itemInChest is ItemGroupDisplay}");*/ //OLogger.Log($"TryMoveTo={_itemDisplay.RefItem.IsStackable} {_itemDisplay.RefItem.MaxStackAmount}"); _itemDisplay.TryMoveTo(m_refLegacyChest); //OLogger.Log($"UQD={m_refLegacyChest.GetContainedItems()[0].IsStackable} {m_refLegacyChest.GetContainedItems()[0].MaxStackAmount}"); /*if (m_characterUI.IsGroupViewDisplayed) * { * m_characterUI.HideGroupView(); * }*/ } /*else * { * m_characterUI.ShowGroupview((ItemGroupDisplay)_itemDisplay); * }*/ } catch (Exception ex) { OLogger.Error($"OnItemDisplayClicked={ex.Message}"); } }