예제 #1
0
        public override bool Do()
        {
            Functions.Interact(unit);
            Thread.Sleep(2000);

            if (GossipFrame.IsVisible())
            {
                if (!GossipFrame.ClickOptionText("training"))
                {
                    return(false);
                }
                Thread.Sleep(2000);
            }
            if (TrainerFrame.IsVisible())
            {
                TrainerFrame.LearnAllSkills();
                PPather.WriteLine("Train: Learned new skills");
                GContext.Main.SendKey("Common.Escape");                 // Clear up
                // Stop it from trying to execute again on the same level
                PPather.ToonData.Set("TrainLevel" + trainType,
                                     GPlayerSelf.Me.Level.ToString());
            }
            else
            {
                GContext.Main.SendKey("Common.Escape");
                return(false);
            }             // ? Try again?
            return(true);
        }
예제 #2
0
        public override bool Do()
        {
            int option   = 0;
            int maxtries = 3;

            // ToDo: Have this use GossipFrame.ClickOptionText().

            while (maxtries > 0)
            {
                Functions.Interact(npc);
                Thread.Sleep(5000);

                if (GossipFrame.IsVisible())
                {
                    //PPather.WriteLine(this.name + ": attempt to skip gossip");

                    GInterfaceObject[] options = GossipFrame.VisibleOptions();
                    if (option >= options.Length)
                    {
                        PPather.WriteLine("Queue: no battleground option in gossip frame");
                        return(true);
                    }
                    GossipFrame.ClickOption(options[option]);
                    option++;
                    Thread.Sleep(1000);
                }

                if (BattlefieldFrame.IsVisible())
                {
                    PPather.WriteLine("Queue: got battlefield frame");

                    if (BattlefieldFrame.IsJoin())
                    {
                        BattlefieldFrame.Join();
                        BGQueueTaskManager.SetQueueState(battlefield, MiniMapBattlefieldFrameState.Queue);
                        Thread.Sleep(3000);
                    }
                    else
                    {
                        PPather.WriteLine("Queue: can't join, no button?");
                    }

                    BattlefieldFrame.Close();
                    Thread.Sleep(1000);

                    return(true);
                }
                else
                {
                    GContext.Main.SendKey("Common.Escape");                     // Close whatever frame popped up
                }
                maxtries--;
            }

            return(true);
        }
예제 #3
0
        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");
            }
        }
예제 #4
0
        public override bool Do()
        {
            Helpers.Mount.Dismount();

            while (true)
            {
                Functions.Interact(npc);
                Thread.Sleep(2000);

                if (GossipFrame.IsVisible())
                {
                    PPather.WriteLine("Vendor: Got a gossip frame");
                    if (!GossipFrame.ClickOptionText("browse your"))
                    {
                        return(false);
                    }
                    Thread.Sleep(2000);
                }

                if (MerchantFrame.IsVisible())
                {
                    GMerchant Merchant = new GMerchant();

                    BagManager bm = new BagManager();

                    GItem[] items = bm.GetAllItems();
                    foreach (GItem item in items)
                    {
                        if (ShouldSell(item))
                        {
                            bm.ClickItem(item, true);
                            Thread.Sleep(500);                             // extra delay
                        }
                    }

                    if (Merchant.IsRepairEnabled)                       // Might as well fix it up while we're here.
                    {
                        PPather.WriteLine("Vendor: Repairing");
                        Functions.ClickRepairButton(Merchant);
                    }

                    Functions.Closeit(Merchant);
                }
                else
                {
                    GContext.Main.SendKey("Common.Escape");                     // Close whatever frame popped up
                }
                return(true);
            }
        }
예제 #5
0
        private void GOSSIP_SHOW()
        {
            if (GossipFrame.IsOpen)
            {
                GossipFrame.Destroy();
            }
            GossipFrame.Create();

            //Console.WriteLine("##################");
            //Console.WriteLine("Gossip Text:");
            //Console.WriteLine($"{GossipFrame.Instance.Text}\n\nOptions:");
            //foreach (var x in GossipFrame.Instance.Options)
            //    Console.WriteLine($"{x.Type}: {x.Text}");

            //foreach (var x in GossipFrame.Instance.Quests)
            //    Console.WriteLine($"Quest Id {x.Id}: {x.Text}\tState: {x.State}");
            //Console.WriteLine("##################");

            OnGossipShow?.Invoke(this, new EventArgs());
        }
예제 #6
0
        public override bool Do()
        {
            Functions.Interact(npc);
            Thread.Sleep(1000);

            if (GossipFrame.IsVisible())
            {
                if (!GossipFrame.ClickOptionText("inn your home"))
                {
                    return(false);
                }
                Thread.Sleep(2000);                 // Lag.
                // When I tested it the popup was StaticPopup1. No idea if this changes...
                if (GContext.Main.Interface.GetByName("StaticPopup1").IsVisible)
                {
                    Functions.Click(GContext.Main.Interface.GetByName("StaticPopup1Button1"), false);
                }
                // Should now have hearth set.
            }
            return(true);
        }
예제 #7
0
        public override bool Do()
        {
            Helpers.Mount.Dismount();

            if (!ppather.IsQuestGoalDone(QuestID))
            {
                return(true);                // Quest isn't ready to handin
            }
            Functions.Interact(pathObject);

            while (GPlayerSelf.Me.IsCasting)
            {
                Thread.Sleep(100);
            }

            Thread.Sleep(1000);

            if (GossipFrame.IsVisible())
            {
                if (!GossipFrame.ClickOptionText(QuestName))
                {
                    return(false);
                }
                Thread.Sleep(2000);                 // Lag
            }
            if (QuestFrame.IsVisible() && QuestFrame.IsSelect())
            {
                if (!QuestFrame.ClickOptionText(QuestName))
                {
                    return(false);
                }
                Thread.Sleep(2000);                 // Lag
            }
            if (QuestFrame.IsVisible() && QuestFrame.IsContinue())
            {
                QuestFrame.Continue();
                Thread.Sleep(2000);
            }

            if (QuestFrame.IsVisible() && QuestFrame.IsComplete())
            {
                PPather.WriteLine("HandinQuest: Great! A quest complete frame");
                string quest = QuestFrame.GetCompleteTitle();
                if (quest.ToLower().Contains(QuestName.ToLower()))
                {
                    PPather.WriteLine("HandinQuest: Complete quest name match for " + quest);
                    QuestFrame.SelectReward(Reward);
                    Thread.Sleep(300);
                    QuestFrame.Complete();
                    ppather.QuestCompleted(QuestID, Repeatable);
                    Thread.Sleep(3000);
                    return(true);
                }
                else
                {
                    PPather.WriteLine("HandinQuest: Not the right quest");
                    GContext.Main.SendKey("Common.Escape");
                    Thread.Sleep(1000);
                    ppather.QuestFailed(QuestID);
                    return(true);                    // cry
                }
            }

            // If we're here...that means we failed to pick up the quest.
            // Maybe we could try a different angle if it's not an item

            if (!pathObject.isItem())
            {
                Location newLoc = new Location((pathObject.getLocation().X + (GContext.Main.Me.Location.X - pathObject.getLocation().X) * 2), pathObject.getLocation().Y + ((GContext.Main.Me.Location.Y - pathObject.getLocation().Y) * 2), pathObject.getLocation().Z + ((GContext.Main.Me.Location.Z - pathObject.getLocation().Z) * 2));
                em = new EasyMover(ppather, newLoc, false, true);
                em.move(2.5f);
                return(false);                // Does this loop through again?
            }
            return(true);
        }
예제 #8
0
        public override bool Do()
        {
            Helpers.Mount.Dismount();

            if (ppather.IsQuestAccepted(QuestID))
            {
                return(true);
            }

            if (pathObject != null)
            {
                Functions.Interact(pathObject);
            }

            // For quest pickup on some items
            while (GPlayerSelf.Me.IsCasting)
            {
                Thread.Sleep(250);
            }
            Thread.Sleep(1000);             // In case of lag

            if (GossipFrame.IsVisible())
            {
                if (!GossipFrame.ClickOptionText(QuestName))
                {
                    return(false);
                }
                Thread.Sleep(2000);                 // Lag
            }
            if (QuestFrame.IsVisible() && QuestFrame.IsSelect())
            {
                if (!QuestFrame.ClickOptionText(QuestName))
                {
                    return(false);
                }
                Thread.Sleep(2000);                 // Lag
            }
            if (QuestFrame.IsVisible() && QuestFrame.IsAccept())
            {
                string quest = QuestFrame.GetAcceptTitle();
                if (quest.Contains(QuestName))
                {
                    PPather.WriteLine("PickupQuest: Woot! We have the right quest. Picking up.");
                    ppather.QuestAccepted(QuestID);
                    QuestFrame.Accept();
                    Thread.Sleep(1000);
                    return(true);
                }
                else
                {
                    // Got the wrong quest somehow
                    GContext.Main.SendKey("Common.Escape");
                    ppather.QuestFailed(QuestID);
                    return(true);
                }
            }

            /*
             * Try Continue button if it didn't have the Accept button.
             * This is the case with many repeatable quests.
             */
            if (QuestFrame.IsVisible() && QuestFrame.IsContinue())
            {
                PPather.WriteLine("Yiha! Continuing with quest...");
                ppather.QuestAccepted(QuestID);
                QuestFrame.Continue();
                Thread.Sleep(1000);
                return(true);
            }

            // If we're here...that means we failed to pick up the quest.
            // Maybe we could try a different angle if it's not an item

            if (!pathObject.isItem())
            {
                Location newLoc = new Location((pathObject.getLocation().X + (GContext.Main.Me.Location.X - pathObject.getLocation().X) * 2), pathObject.getLocation().Y + ((GContext.Main.Me.Location.Y - pathObject.getLocation().Y) * 2), pathObject.getLocation().Z + ((GContext.Main.Me.Location.Z - pathObject.getLocation().Z) * 2));
                em = new EasyMover(ppather, newLoc, false, true);
                em.move(2.5f);
                return(false);                // Does this loop through again?
            }
            return(true);
        }
예제 #9
0
        public override bool Do()
        {
            Helpers.Mount.Dismount();

            while (true)
            {
                Functions.Interact(npc);
                Thread.Sleep(1000);

                if (GossipFrame.IsVisible())
                {
                    //PPather.WriteLine("Buy: Got a gossip frame");
                    if (GossipFrame.ClickOptionText("browse your") ||
                        GossipFrame.ClickOptionText("Sid") ||
                        GossipFrame.ClickOptionText("What do you have"))
                    {
                        Thread.Sleep(2000);                         // Lag
                    }
                }

                if (MerchantFrame.IsVisible())
                {
                    GMerchant Merchant = new GMerchant();

                    string[] toBuy;
                    int[]    toBuyQuantities;
                    GetShoppingList(out toBuy, out toBuyQuantities);

                    GSpellTimer sanity = new GSpellTimer(5000);

                    for (int i = 0; i < toBuy.Length; i++)
                    {
                        sanity.Reset();

                        int lastCount = Inventory.GetItemCount(toBuy[i], false);
                        int curCount  = lastCount;

                        do
                        {
                            GContext.Main.EnableCursorHook();
                            if (!Merchant.BuyOnAnyPage(toBuy[i]))
                            {
                                PPather.WriteLine("!Info:Buy: Unable to buy [" + toBuy[i] + "], skipping");
                                break;
                            }
                            Thread.Sleep(2000);

                            curCount = Inventory.GetItemCount(toBuy[i], false);

                            // inventory went up so reset the timer
                            if (curCount > lastCount)
                            {
                                sanity.Reset();
                            }

                            // PPather.WriteLine(string.Format("  {0} -> {1} of {2}", lastCount, curCount, toBuyQuantities[i]));
                            lastCount = curCount;

                            if (sanity.IsReady)
                            {
                                PPather.WriteLine("!Info:Buy: Waiting too long buying [" + toBuy[i] + "], skipping");
                                break;
                            }
                        } while (curCount < toBuyQuantities[i]);
                        GContext.Main.DisableCursorHook();
                    }

                    if (Merchant.IsRepairEnabled)                       // Might as well fix it up while we're here.
                    {
                        PPather.WriteLine("Buy: Repairing");
                        Functions.ClickRepairButton(Merchant);
                    }

                    Functions.Closeit(Merchant);
                }
                else
                {
                    PPather.WriteLine("!Info: Never got merchant frame");
                    GContext.Main.SendKey("Common.Escape");                     // Close whatever frame popped up
                }
                return(true);
            }
        }
예제 #10
0
 private void GOSSIP_CLOSED()
 {
     GossipFrame.Destroy();
     OnGossipClosed?.Invoke(this, new EventArgs());
 }
예제 #11
0
        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;
            })
                                                       )
                                                   )
                                     )
                                 ));
        }