Exemple #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);
        }
Exemple #2
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);
            }
        }
Exemple #3
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);
        }
        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);
        }
Exemple #5
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);
        }
Exemple #6
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);
            }
        }