Example #1
0
        public static int SolveAllArtifact(bool useKeystone)
        {
            try
            {
                int nbSolved = 0;
                if (archaeologySpell == null)
                {
                    archaeologySpell = new Spell("Archaeology");
                }

                Lua.RunMacroText("/cast " + archaeologySpell.NameInGame);
                int j = 1;
                while (j <= 18)
                {
                    Lua.RunMacroText("/click ArchaeologyFrameSummaryButton");
                    if (j == 13)
                    {
                        Lua.RunMacroText("/click ArchaeologyFrameSummarytButton");
                        Lua.RunMacroText("/click ArchaeologyFrameSummaryPageNextPageButton");
                    }
                    string buttonName;
                    if (j > 12)
                    {
                        buttonName = "ArchaeologyFrameSummaryPageRace" + (j - 12);
                    }
                    else
                    {
                        buttonName = "ArchaeologyFrameSummaryPageRace" + j;
                    }

                    if (IsButtonActive(buttonName))
                    {
                        Lua.RunMacroText("/click " + buttonName);
                    }
                    else
                    {
                        j++;
                        continue;
                    }
                    Thread.Sleep(200 + Usefuls.Latency);
                    if (useKeystone)
                    {
                        bool moreToSocket;
                        do
                        {
                            moreToSocket = false;
                            string randomString1 = Others.GetRandomString(Others.Random(4, 10));
                            string randomString2 = Others.GetRandomString(Others.Random(4, 10));
                            Lua.LuaDoString(randomString1 + " = SocketItemToArtifact(); if " + randomString1 + " then " + randomString2 + "=\"1\" else " + randomString2 + "=\"0\" end");
                            if (Lua.GetLocalizedText(randomString2) == "1")
                            {
                                moreToSocket = true;
                                Thread.Sleep(250 + Usefuls.Latency);
                            }
                        } while (moreToSocket);
                    }
                    string randomString3 = Others.GetRandomString(Others.Random(4, 10));
                    string randomString4 = Others.GetRandomString(Others.Random(4, 10));
                    Lua.LuaDoString(randomString3 + " = CanSolveArtifact(); if " + randomString3 + " then " + randomString4 + "=\"1\" else " + randomString4 + "=\"0\" end");
                    bool canSolve = Lua.GetLocalizedText(randomString4) == "1";
                    if (canSolve)
                    {
                        nbSolved++;
                        Lua.RunMacroText("/click ArchaeologyFrameArtifactPageSolveFrameSolveButton");
                        if (Usefuls.GetContainerNumFreeSlots >= 1)
                        {
                            j--;
                        }
                        Thread.Sleep(2050 + Usefuls.Latency); // Spell cast time is 2.0secs
                    }
                    j++;
                    Thread.Sleep(200 + Usefuls.Latency);
                }
                Lua.RunMacroText("/click ArchaeologyFrameCloseButton");
                if (ObjectManager.ObjectManager.Me.Level < 90 || Usefuls.GetContainerNumFreeSlots <= 0)
                {
                    return(nbSolved);
                }
                for (int i = 79896; i <= 79917; i++)
                {
                    if (i == 79906 || i == 79907)
                    {
                        continue;
                    }
                    WoWItem item = ObjectManager.ObjectManager.GetWoWItemById(i);
                    if (item == null || !item.IsValid || ItemsManager.IsItemOnCooldown(i) ||
                        !ItemsManager.IsItemUsable(i))
                    {
                        continue;
                    }
                    while (ItemsManager.GetItemCount(i) > 0)
                    {
                        MountTask.DismountMount();
                        ItemsManager.UseItem(i);
                        Thread.Sleep(1550 + Usefuls.Latency); // Spell cast time is 1.5secs
                    }
                }
                for (int i = 95375; i <= 95382; i++)
                {
                    WoWItem item = ObjectManager.ObjectManager.GetWoWItemById(i);
                    if (item == null || !item.IsValid || ItemsManager.IsItemOnCooldown(i) ||
                        !ItemsManager.IsItemUsable(i))
                    {
                        continue;
                    }
                    while (ItemsManager.GetItemCount(i) > 0)
                    {
                        MountTask.DismountMount();
                        ItemsManager.UseItem(i);
                        Thread.Sleep(1550 + Usefuls.Latency); // Spell cast time is 1.5secs
                    }
                }
                return(nbSolved);
            }
            catch (Exception e)
            {
                Logging.WriteError("Archaeology >  solveAllArtifact(): " + e);
                return(0);
            }
        }
Example #2
0
        public static void UseDraenicBait()
        {
            if (Usefuls.ContinentId != 1116 && Usefuls.ContinentId != 1464 || HaveDraenicBaitBuff())
            {
                return;
            }
            int baitToUse = 0;

            if (Usefuls.AreaId == 7004 || Usefuls.AreaId == 7078)
            {
                // Frostwall Horde garrison or Lunarfall Alliance garrison
                baitToUse = GetRandomDraenicBait();
            }
            else if (DraenorSeasList.Contains(Usefuls.SubAreaId))
            {
                baitToUse = DraenicBaitList[6];
            }
            else if (Usefuls.AreaId == 6719)
            {
                // Shadowmoon Valley
                baitToUse = DraenicBaitList[0];
            }
            else if (Usefuls.AreaId == 6720)
            {
                // Frostfire Ridge
                baitToUse = DraenicBaitList[1];
            }
            else if (Usefuls.AreaId == 6721)
            {
                // Gorgrond
                baitToUse = DraenicBaitList[2];
            }
            else if (Usefuls.AreaId == 6722)
            {
                // Spires of Arak
                baitToUse = DraenicBaitList[3];
            }
            else if (Usefuls.AreaId == 6662)
            {
                // Talador
                baitToUse = DraenicBaitList[4];
            }
            else if (Usefuls.AreaId == 6755)
            {
                // Nagrand
                baitToUse = DraenicBaitList[5];
            }
            else if (Usefuls.ContinentId == 1464)
            {
                baitToUse = 128229; // Felmouth Frenzy Bait can't be used in Garrison.
            }

            if (baitToUse == 0 || ItemsManager.GetItemCount(baitToUse) <= 0)
            {
                return;
            }
            string baitToUseName = ItemsManager.GetItemNameById(baitToUse);

            if (ItemsManager.IsItemUsable(baitToUseName))
            {
                ItemsManager.UseItem(baitToUseName);
            }
        }