im not sure if im doing something wrong but i cant get HB to return vendor id's at all here is file im using but when i try return vendor names and id's i just get online players!! not vendors any help would be great guys
Just re-read you... You create two lists, one with the content of all the ObjectManager and a second with nothing. After, you parse your first List to only put the vendors in the second and log all Unit from the first List. Your vars names are confused, even for you because the content of the ObjectManager are stored in a list named Merchantlist, and you store all vendors in Unitlist.
It looks like you don't really know what you're doing, and you've copy and pasted the code from somewhere and hacked at it hoping it will work. If you're going to want the amount of items in your bag, maybe use something like this instead of lua: Code: static int NumOfItemsInBag(uint entry) { int count = 0; foreach(WoWItem item in StyxWoW.Me.BagItems.Where(i => i.Entry == entry)) { count += (int)item.StackCount; } return count; } is As for the MerchantList, that code will get every instance of a WoWUnit including players (cuz wowplayer is a derivative of wowunit). If you only want units and not derived classes (ie, players), do this: Code: List<WoWUnit> Merchantlist = ObjectManager.GetObjectsOfType<WoWUnit>(false); If you only want vendors, do this: Code: List<WoWUnit> Merchantlist = ObjectManager.GetObjectsOfType<WoWUnit>(false).Where(unit => unit.IsVendor).ToList(); And then fuck off using a second list to hold vendors. I'd also recommend not using lua to buy items, rather use something like Styx.Logic.Inventory.Frames.Merchant.MerchantFrame.BuyItem(int index, int amount) Other than that your code is pretty horrible in implementation and I wouldn't be surprised if it worked at all. It's a nice try, but I really would recommend learning a bit more about how HB works and c# in general.
The codes of Exemplar work great for what you are looking for. If you don't know the Where clause or whatever, just go on MSDN website