Exemple #1
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);
            }
        }
Exemple #2
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 #3
0
        public static bool NeedRun(List <string> items)
        {
            try
            {
                if (!spell.KnownSpell)
                {
                    return(false);
                }

                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 (string i in itemsToAdd)
                {
                    if (!items.Contains(i))
                    {
                        items.Add(i);
                    }
                }
                if (string.IsNullOrEmpty(itemArray))
                {
                    Logging.Write("Milling interrupted, no items founds from the list, check that the names are correctly typed and that you have at least 5 of them.");
                    return(false);
                }
                string macro =
                    "myTable = {" + itemArray + "} " +
                    "needRun = \"false\" " +
                    "for key,value in pairs(myTable) do " +
                    "	itemsToMil = value "+
                    "	_, itemLink = GetItemInfo(itemsToMil) "+
                    "	_, _, 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 "+
                    "						needRun = \"true\""+
                    "						return "+
                    "					end "+
                    "				 end "+
                    "			 end "+
                    "		end "+
                    "	end "+
                    "end";
                Lua.LuaDoString(macro);
                return(Lua.GetLocalizedText("needRun") == "true");
            }
            catch (Exception exception)
            {
                Logging.WriteError("Milling > NeedRun(List<string> items): " + exception);
                return(false);
            }
        }