• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Wowunit list not returning vendors

    Discussion in 'Archives' started by BPAlpha, Dec 10, 2011.

    1. BPAlpha

      BPAlpha New Member

      Joined:
      Jan 15, 2010
      Messages:
      594
      Likes Received:
      41
      Trophy Points:
      0
      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 :p
       

      Attached Files:

    2. ZenLulz

      ZenLulz Community Developer

      Joined:
      Aug 17, 2011
      Messages:
      583
      Likes Received:
      98
      Trophy Points:
      28
      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.
       
    3. BPAlpha

      BPAlpha New Member

      Joined:
      Jan 15, 2010
      Messages:
      594
      Likes Received:
      41
      Trophy Points:
      0
      must be something to do with the bot as now my bags are returning false content.
       
    4. exemplar

      exemplar New Member

      Joined:
      Mar 16, 2010
      Messages:
      167
      Likes Received:
      32
      Trophy Points:
      0
      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.
       
    5. BPAlpha

      BPAlpha New Member

      Joined:
      Jan 15, 2010
      Messages:
      594
      Likes Received:
      41
      Trophy Points:
      0
      still doesnt return vendor names or ids..</wowunit></wowunit></wowunit></wowunit>
       
    6. ZenLulz

      ZenLulz Community Developer

      Joined:
      Aug 17, 2011
      Messages:
      583
      Likes Received:
      98
      Trophy Points:
      28
      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 ;)
       

    Share This Page