Exemple #1
0
 public static string FishingPolesName()
 {
     try
     {
         foreach (int i in ListFishingPoles)
         {
             if (ItemsManager.GetItemCount(i) > 0)
             {
                 return(ItemsManager.GetItemNameById(i));
             }
         }
     }
     catch (Exception e)
     {
         Logging.WriteError("Fishing > FishingPolesName(): " + e);
     }
     return("");
 }
Exemple #2
0
 public static void EquipFishingPoles(string fishingPoleName = "")
 {
     try
     {
         if (!ReCheckFishingPoleTimer.IsReady || IsEquipedFishingPoles())
         {
             return;
         }
         Logging.WriteDebug("Parsing inventory to find a Fishing Pole to equip.");
         if (fishingPoleName != string.Empty)
         {
             ItemsManager.EquipItemByName(fishingPoleName);
             Thread.Sleep(500);
             Thread.Sleep(Usefuls.Latency);
             while (ObjectManager.ObjectManager.Me.IsCast)
             {
                 Thread.Sleep(200);
             }
         }
         else
         {
             foreach (int i in ListFishingPoles)
             {
                 if (ItemsManager.GetItemCount(i) > 0)
                 {
                     ItemsManager.EquipItemByName(ItemsManager.GetItemNameById(i));
                     Thread.Sleep(500);
                     Thread.Sleep(Usefuls.Latency);
                     while (ObjectManager.ObjectManager.Me.IsCast)
                     {
                         Thread.Sleep(200);
                     }
                     break;
                 }
             }
         }
         ReCheckFishingPoleTimer = new Timer(1000 * 60 * 5);
         Logging.WriteDebug("Inventory parsed, prevent this function from being parsed for the next five minutes.");
     }
     catch (Exception e)
     {
         Logging.WriteError("Fishing > EquipFishingPoles(string fishingPoleName = \"\"): " + e);
     }
 }
Exemple #3
0
        public static void Pulse(List <string> items)
        {
            try
            {
                Spell spell = new Spell("Prospecting");
                if (!spell.KnownSpell)
                {
                    return;
                }

                string itemArray  = "";
                var    itemsToAdd = new List <string>();
                foreach (string i in items)
                {
                    if (!string.IsNullOrWhiteSpace(i) && i.Contains("'"))
                    {
                        itemsToAdd.Add(i.Replace("'", "’"));
                    }
                    if (ItemsManager.GetItemCount(i) >= 5)
                    {
                        if (!string.IsNullOrEmpty(itemArray))
                        {
                            itemArray = itemArray + ", ";
                        }
                        itemArray = itemArray + "\"" + i + "\"";
                    }
                }
                foreach (var i in itemsToAdd)
                {
                    if (!items.Contains(i))
                    {
                        items.Add(i);
                    }
                }
                if (string.IsNullOrEmpty(itemArray))
                {
                    Logging.Write("Prospecting interrupted, no items founds from the list, check that the names are correctly typed and that you have at least 5 of them.");
                    return;
                }
                string macro =
                    "myTable = {" + itemArray + "} " +
                    "for key,value in pairs(myTable) do " +
                    "	itemsToProspect = value "+
                    "	_, itemLink = GetItemInfo(itemsToProspect) "+
                    "	_, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(itemLink, \"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?\") "+
                    "	fisrtI = -1 "+
                    "	fisrtJ = -1 "+
                    "	if tonumber(Id) > 0 then "+
                    "		for i=0,4 do "+
                    "			 for j=1,GetContainerNumSlots(i)do "+
                    "				idT = GetContainerItemID(i,j) "+
                    "				 if tonumber(Id) == idT then "+
                    "					_, itemCount, _, _, _ = GetContainerItemInfo(i,j); "+
                    "					if tonumber(itemCount) >=5 then "+
                    "						CastSpellByName(\""+ spell.NameInGame + "\"); " +
                    "						UseContainerItem(i,j) "+
                    "					end "+
                    "				 end "+
                    "			 end "+
                    "		end "+
                    "	end "+
                    "end";

                Lua.LuaDoString(macro);
            }
            catch (Exception exception)
            {
                Logging.WriteError("Prospecting > Pulse(List<string> items): " + exception);
            }
        }
Exemple #4
0
        public static int GetSkillBonus(SkillLine skill)
        {
            int bonus = 0;

            // Guide if we want to complete: http://www.elsanglin.com/equipment.html

            // Racials bonuses
            switch (ObjectManager.ObjectManager.Me.WowRace)
            {
            case WoWRace.Gnome:
                if (skill == SkillLine.Engineering)
                {
                    bonus += 15;
                }
                break;

            case WoWRace.Tauren:
                if (skill == SkillLine.Herbalism)
                {
                    bonus += 15;
                }
                break;

            case WoWRace.Draenei:
                if (skill == SkillLine.Jewelcrafting)
                {
                    bonus += 5;
                }
                break;

            case WoWRace.BloodElf:
                if (skill == SkillLine.Enchanting)
                {
                    bonus += 10;
                }
                break;

            case WoWRace.Worgen:
                if (skill == SkillLine.Skinning)
                {
                    bonus += 15;
                }
                break;

            case WoWRace.Goblin:
                if (skill == SkillLine.Alchemy)
                {
                    bonus += 15;
                }
                break;
            }

            // Buffs bonuses
            if (skill == SkillLine.Fishing && ObjectManager.ObjectManager.Me.HaveBuff(45694))
            {
                bonus += 10;
            }

            // Enchantments bonuses, seems they wont stack with the basic tools

            // Items bonuses
            switch (skill)
            {
            case SkillLine.Mining:
                if (ItemsManager.GetItemCount(40772) > 0 || ItemsManager.GetItemCount(2901) > 0)
                {
                    bonus += 10;
                }
                break;

            case SkillLine.Herbalism:
                if (ItemsManager.GetItemCount(40772) > 0 || ItemsManager.GetItemCount(85663) > 0)
                {
                    bonus += 10;
                }
                break;

            case SkillLine.Skinning:
                if (ItemsManager.GetItemCount(40772) > 0 || ItemsManager.GetItemCount(7005) > 0)
                {
                    bonus += 10;
                }
                break;

            case SkillLine.Fishing:
                // There is just too much things in Fishing to take in count, and it's not "that" useful for a bot...
                // But I will need to add them later to display the skill increases correctly. See guide above.
                break;
            }

            return(bonus);
        }
Exemple #5
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);
            }
        }
Exemple #6
0
 public static void UseLure(string lureName = "", bool automaticallyUseDraenorBait = false)
 {
     try
     {
         if (automaticallyUseDraenorBait)
         {
             UseDraenicBait();
         }
         if (!IsEquipedFishingPoles())
         {
             return;
         }
         if (ObjectManager.ObjectManager.Me.IsMainHandTemporaryEnchanted)
         {
             return; // Already lured up.
         }
         if (lureName != string.Empty)
         {
             if (ItemsManager.GetItemCount(ItemsManager.GetItemIdByName(lureName)) > 0)
             {
                 ItemsManager.UseItem(lureName);
                 Thread.Sleep(1000);
                 Thread.Sleep(Usefuls.Latency);
                 while (ObjectManager.ObjectManager.Me.IsCast)
                 {
                     Thread.Sleep(200);
                 }
                 return;
             }
             else
             {
                 Spell lureSpell = new Spell(lureName);
                 if (lureSpell.KnownSpell && lureSpell.IsSpellUsable)
                 {
                     lureSpell.Launch();
                     return;
                 }
                 if (!lureSpell.KnownSpell)
                 {
                     if (FirstLureCheck)
                     {
                         Logging.Write("Lure from Product Settings is missing, try to use a lure from the list built-in TheNoobBot.");
                         FirstLureCheck = false;
                     }
                 }
             }
         }
         foreach (int i in listLure)
         {
             if (ItemsManager.GetItemCount(i) > 0)
             {
                 ItemsManager.UseItem(ItemsManager.GetItemNameById(i));
                 Thread.Sleep(1000);
                 while (ObjectManager.ObjectManager.Me.IsCast)
                 {
                     Thread.Sleep(200);
                 }
                 break;
             }
         }
     }
     catch (Exception e)
     {
         Logging.WriteError("Fishing > UseLure(string lureName = \"\"): " + e);
     }
 }
Exemple #7
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);
            }
        }