Some people expressed interest in the parsing of the Drones window in EVE Online, so I am taking a closer look at that now.
I am tracing my train of thought here. Since I guess it will lead to some code for a parsing function, this could be of interest for developers working on parsing.
Last month @Mohano discovered a new configuration of drone entries in the drones window at Can we interact with everything we see in devtools dumps? - #6 by Mohano
This week @BrianCorner discovered a similar configuration (On Discord). His screenshot also displays a new level of nesting:
How would we choose a type to package the parsed drone entries?
Looking at the screenshot, I guess the user could interact with those entries like a tree. Those icons on the left could be interactive to toggle expanding items below.
The type for the parsed return value could reflect that tree structure.
The items that you can toggle could go into a List in representing the item at the same level as the toggle button.
But how do we map those items into a tree? Sorting them by vertical location is simple. And then?
We could take the topmost item, which has the label
Drones in Bay (5) in that example and ask that function to build the tree from that item and the whole list.
Then we could continue with the remaining items, minus the ones that were already included in the tree of one of the earlier roots.
But what would the the criterion for the items without expander button to decide if they are in the descendants?
I think they all have to be a child of the item next up with an expander button.
So the invocation for
Drones in Bay (5) would get the whole list. It scans the list. When it arrives at
Drones in Local Space (5) that item is on the same level (horizontal location). Therefore it stops scanning.
When the tree for
Drones in Bay (5) is completely built, the only other item it contains is the one below.
That means we use
Drones in Local Space (5) as the root for the next tree.
Regarding the naming of the fields, we could reuse the names from the inventory. We also have a tree structure in the inventory window.