I'm currently trying to make a mod that requires the part of the inventory responsible for selecting/equipping an item. Specifically, the part of the code where it determines what icon on the side of the inventory to light up when you click on an item. The reason I need this is because I currently have a system that adds items to containers "unstacked", so that instead of showing up as iron sword (5) you just have 5 separate entries for iron swords. However, when I do this, the menu behaves erratically and won't actually select the exact item you click on. It will instead select a seemingly random item with the same type. In my 5 swords example, it would select 1 of the five swords, but not the one I was clicking on. This leads me to believe that the code for that starts at the currently selected entry, and runs a loop until it finds the item with the selected type. In this case it goes from an iron sword to an iron sword, causing it behave strangely.
So my question is: does anyone know where the code that implements the selection is? I looked in inventorylists, container, itemcard, and various others but I can't pinpoint it.
I'm using mardoxx's decompiled sources at https://github.com/Mardoxx/skyrimui