Hi!
I could not find an easy way to find out the position (if any) for the vendor sell button option, so I thought Id just share how I solved it in case it could benefit anyone.
My solution might be a very bad way to solve it, in that case I would love to hear how it should be done.
The sell button (when visible on the screen) is located deep within the IngameUIElements children. I therefore added the following lines to the IngameUIElements file.
Of course you can just implement the logic in your own plugin instead as well.
Code:
public Element VendorPanel => GetChildAtIndex(21);
public Element VendorPanelOptions => VendorPanel?.GetChildAtIndex(6)?.GetChildAtIndex(0)?.GetChildAtIndex(2);
public Element VendorPanelSellOption
{
get
{
if (VendorPanelOptions?.Children != null)
{
foreach (var optionElement in VendorPanelOptions.Children)
{
if (optionElement.Children != null)
{
foreach (var innerOptionElement in optionElement.Children)
{
if (innerOptionElement.Text?.ToLower().Contains("sell item") == true)
{
return innerOptionElement;
}
}
}
}
}
return null;
}
}