public static void Vendors2() { List <WoWUnit> unitList = ObjectManager.GetObjectsOfType <WoWUnit>(); List <WoWUnit> merchantList = new List <WoWUnit>(); foreach (WoWUnit u in unitList) { //u.IsAmmoVendor || u.IsFoodVendor || u.IsInnkeeper || u.IsPoisonVendor || u.IsReagentVendor || u.IsRepairMerchant || if (u.IsVendor) { merchantList.Add(u); } } merchantList.Sort((p1, p2) => p1.Location.Distance(ObjectManager.Me.Location).CompareTo(p2.Location.Distance(ObjectManager.Me.Location))); if (merchantList.Count > 0) { while (!StyxWoW.Me.Combat && merchantList[0].Distance > 5) { Navigator.MoveTo(merchantList[0].Location); Thread.Sleep(100); } merchantList[0].Interact(); Thread.Sleep(2000); try { GossipFrame gFrame = GossipFrame.Instance; foreach (var option in gFrame.GossipOptionEntries) { if (option.Type == GossipEntry.GossipEntryType.Vendor) { gFrame.SelectGossipOption(option.Index); break; } } } catch { } Thread.Sleep(500); foreach (WoWItem item in ObjectManager.Me.BagItems) { if (_Vendorlist.Contains(item.Entry) && item.BagSlot != -1) { Lua.DoString(string.Format("UseContainerItem({0}, {1})", item.BagIndex + 1, item.BagSlot + 1)); Thread.Sleep(100); } } } else { Logging.Write(System.Drawing.Color.Red, "No Vendor Found in Area"); } }
Composite InternalCreateBehavior() { // // Check if the behavior is not yet complete. // return(new Decorator(TreeContext => { return !m_Complete; }, new PrioritySelector( // // While not in interact range, move to the target using the mob location. // new Decorator(TreeContext => { WoWUnit Unit = GetTargetUnit(); return (Unit != null) && !Unit.WithinInteractRange; }, // // Move to the unit. // new Action(TreeContext => { WoWUnit Unit = GetTargetUnit(); return Navigator.GetRunStatusFromMoveResult(Navigator.MoveTo(Unit.Location)); }) ), // // While the unit is not found, move to the target location specified. // new Decorator(TreeContext => { WoWUnit Unit = GetTargetUnit(); return (Unit == null); }, // // Move to the location. // new Action(TreeContext => { return Navigator.GetRunStatusFromMoveResult(Navigator.MoveTo(m_Location)); }) ), // // Check if the unit is found and within interact range. // new Decorator(TreeContext => { WoWUnit Unit = GetTargetUnit(); return (Unit != null) && Unit.WithinInteractRange; }, new PrioritySelector( // // Check that the player is not currently talking to the target. // new Decorator(TreeContext => { GossipFrame Frame = GossipFrame.Instance; return (Frame == null || !Frame.IsVisible); }, new Action(TreeContext => { WoWUnit Unit = GetTargetUnit(); Unit.Interact(); }) ), // // Select the bind hearthstone gossip option. // new Action(TreeContext => { GossipFrame Frame = GossipFrame.Instance; if (Frame != null && Frame.IsVisible) { if (Frame.GossipOptionEntries != null) { foreach (GossipEntry Entry in Frame.GossipOptionEntries) { if (Entry.Type == GossipEntry.GossipEntryType.Binder) { Frame.SelectGossipOption(Entry.Index); return RunStatus.Success; } } } } return RunStatus.Failure; }) ) ) ) )); }