Example #1
0
        public bool Remove(int index)
        {
            if (myBuild.Count > 1 && index == 1)
            {
                return(false);
            }
            BuildElement th = myBuild.First(ele => ele.position == index);

            myBuild.Remove(th);
            th.Remove(menu);
            foreach (BuildElement el in myBuild.OrderBy(b => b.position).Where(b => b.position > index))
            {
                el.position--;


                List <LoLItem> c = new List <LoLItem>();
                BrutalItemInfo.InventorySimulator(myBuild, c, el.position - 1);
                el.cost = BrutalItemInfo.InventorySimulator(new List <BuildElement> {
                    el
                }, c);
                el.freeSlots = 7 - c.Count;
                el.updateText();
            }


            SaveBuild();
            return(true);
        }
Example #2
0
 private void LoadBuild()
 {
     if (!File.Exists(buildFile))
     {
         if (!sugBuild.Equals(string.Empty))
         {
             LoadInternalBuild();
         }
         return;
     }
     try
     {
         string s = File.ReadAllText(buildFile);
         if (s.Equals(string.Empty))
         {
             Chat.Print("Auto Buddy Plus: the build is empty.");
             LoadInternalBuild();
             return;
         }
         foreach (ItemAction ac in DeserializeBuild(s))
         {
             AddElement(BrutalItemInfo.GetItemByID(ac.item), ac.t);
         }
     }
     catch (Exception e)
     {
         Chat.Print("Auto Buddy Plus: couldn't load the build.");
         LoadInternalBuild();
         Console.WriteLine(e.Message);
     }
 }
Example #3
0
        private void Chat_OnInput(ChatInputEventArgs args)
        {
            if (args.Input.ToLower().StartsWith("/b "))
            {
                args.Process = false;
                string  itemName = args.Input.Substring(2);
                LoLItem i        = BrutalItemInfo.FindBestItem(itemName);
                Chat.Print("Buy " + i.name);

                if (myBuild.Count == 0 && !i.groups.Equals("RelicBase"))
                {
                    AddElement(BrutalItemInfo.GetItemByID(3340), ShopActionType.Buy);
                    Chat.Print("Added also warding totem.");
                }
                AddElement(i, ShopActionType.Buy);
                SaveBuild();
            }
            else if (args.Input.ToLower().StartsWith("/s "))
            {
                args.Process = false;
                string  itemName = args.Input.Substring(2);
                LoLItem i        = BrutalItemInfo.FindBestItemAll(itemName);
                Chat.Print("Sell " + i.name);

                AddElement(i, ShopActionType.Sell);
                SaveBuild();
            }
            else if (args.Input.ToLower().Equals("/buyhp"))
            {
                if (myBuild.Count == 0)
                {
                    AddElement(BrutalItemInfo.GetItemByID(3340), ShopActionType.Buy);
                    Chat.Print("Added also warding totem.");
                }
                AddElement(BrutalItemInfo.GetItemByID(2003), ShopActionType.StartHpPot);
                SaveBuild();
                args.Process = false;
            }
            else if (args.Input.ToLower().Equals("/stophp"))
            {
                if (myBuild.Count == 0)
                {
                    AddElement(BrutalItemInfo.GetItemByID(3340), ShopActionType.Buy);
                    Chat.Print("Added also warding totem.");
                }
                AddElement(BrutalItemInfo.GetItemByID(2003), ShopActionType.StopHpPot);
                SaveBuild();
                args.Process = false;
            }
        }
Example #4
0
 private void LoadInternalBuild()
 {
     try
     {
         if (sugBuild.Equals(string.Empty))
         {
             Chat.Print("Auto Buddy Plus: internal build is empty.");
             return;
         }
         foreach (ItemAction ac in DeserializeBuild(sugBuild))
         {
             AddElement(BrutalItemInfo.GetItemByID(ac.item), ac.t);
         }
     }
     catch (Exception e)
     {
         Chat.Print("Auto Buddy Plus: internal build load failed.");
         Console.WriteLine(e.Message);
     }
     Chat.Print("Auto Buddy Plus: loaded internal build(change it if you want!).");
 }
Example #5
0
 private void LoadInternalBuild()
 {
     try
     {
         if (sugBuild.Equals(string.Empty))
         {
             Chat.Print("AutoBuddy: mevcut build yok.");
             return;
         }
         foreach (var ac in DeserializeBuild(sugBuild))
         {
             AddElement(BrutalItemInfo.GetItemByID(ac.item), ac.t);
         }
     }
     catch (Exception e)
     {
         Chat.Print("AutoBuddy: mevcut build yuklemesi basarisiz.");
         Console.WriteLine(e.Message);
     }
     Chat.Print("AutoBuddy: mevcut build yuklendi.");
 }
Example #6
0
 private void LoadInternalBuild()
 {
     try
     {
         if (sugBuild.Equals(string.Empty))
         {
             Chat.Print("AutoBuddy (LegendaryBot Custom by James): internal build is empty.");
             return;
         }
         foreach (var ac in DeserializeBuild(sugBuild))
         {
             AddElement(BrutalItemInfo.GetItemByID(ac.item), ac.t);
         }
     }
     catch (Exception e)
     {
         Chat.Print("AutoBuddy (LegendaryBot Custom by James): internal build load failed.");
         Console.WriteLine(e.Message);
     }
     Chat.Print("AutoBuddy (LegendaryBot Custom by James): Internal build loaded.");
 }
Example #7
0
        private void LoadBuild()
        {
            LoadInternalBuild();
            return;

            if (!File.Exists(buildFile))

            {
                Chat.Print("Custom build doesn't exist: " + buildFile);
                if (!sugBuild.Equals(string.Empty))
                {
                    LoadInternalBuild();
                }
                return;
            }
            try
            {
                var s = File.ReadAllText(buildFile);
                if (s.Equals(string.Empty))
                {
                    Chat.Print("AutoBuddy: the build is empty.");
                    LoadInternalBuild();
                    return;
                }
                foreach (var ac in DeserializeBuild(s))
                {
                    AddElement(BrutalItemInfo.GetItemByID(ac.item), ac.t);
                    Console.Write("Custom Build Loading ");
                }
                Chat.Print("Loaded build from: " + buildFile);
            }
            catch (Exception e)
            {
                Chat.Print("AutoBuddy: couldn't load the build.");

                LoadInternalBuild();
                Console.WriteLine(e.Message);
            }
        }
Example #8
0
        public void MoveUp(int index)
        {
            if (index <= 2)
            {
                return;
            }
            BuildElement th = myBuild.First(ele => ele.position == index);
            BuildElement up = myBuild.First(ele => ele.position == index - 1);

            th.position--;
            up.position++;

            foreach (BuildElement el in myBuild.OrderBy(b => b.position))
            {
                List <LoLItem> c = new List <LoLItem>();
                BrutalItemInfo.InventorySimulator(myBuild, c, el.position - 1);
                el.cost = BrutalItemInfo.InventorySimulator(new List <BuildElement> {
                    el
                }, c);
                el.freeSlots = 7 - c.Count;
                el.updateText();
            }
            SaveBuild();
        }
Example #9
0
        private void AddElement(LoLItem it, ShopActionType ty)
        {
            if (ty != ShopActionType.Buy || ty != ShopActionType.Sell)
            {
                int hp = myBuild.Count(e => e.action == ShopActionType.StartHpPot) -
                         myBuild.Count(e => e.action == ShopActionType.StopHpPot);
                if (ty == ShopActionType.StartHpPot && hp != 0)
                {
                    return;
                }
                if (ty == ShopActionType.StopHpPot && hp == 0)
                {
                    return;
                }
            }

            BuildElement b = new BuildElement(this, menu, it, myBuild.Any() ? myBuild.Max(a => a.position) + 1 : 1, ty);

            List <LoLItem> c = new List <LoLItem>();

            BrutalItemInfo.InventorySimulator(myBuild, c);
            b.cost = BrutalItemInfo.InventorySimulator(new List <BuildElement> {
                b
            }, c);
            b.freeSlots = 7 - c.Count;
            b.updateText();
            if (b.freeSlots == -1)
            {
                Chat.Print("Couldn't add " + it + ", inventory is full.");
                b.Remove(menu);
            }
            else
            {
                myBuild.Add(b);
            }
        }
Example #10
0
        private void LoadBuild()
        {
            if (!File.Exists(buildFile))

            {
                Chat.Print("Ozel build yok: " + buildFile);
                if (!sugBuild.Equals(string.Empty))
                {
                    LoadInternalBuild();
                }
                return;
            }
            try
            {
                var s = File.ReadAllText(buildFile);
                if (s.Equals(string.Empty))
                {
                    Chat.Print("AutoBuddy: build yok.");
                    LoadInternalBuild();
                    return;
                }
                foreach (var ac in DeserializeBuild(s))
                {
                    AddElement(BrutalItemInfo.GetItemByID(ac.item), ac.t);
                    Console.Write("Ozel Build Yukleniyor ");
                }
                Chat.Print("Yuklu build: " + buildFile);
            }
            catch (Exception e)
            {
                Chat.Print("AutoBuddy: build yuklenemedi.");

                LoadInternalBuild();
                Console.WriteLine(e.Message);
            }
        }
Example #11
0
        private void AddElement(IItem it, ShopActionType ty)
        {
            if (ty != ShopActionType.Buy || ty != ShopActionType.Sell)
            {
                var hp = myBuild.Count(e => e.action == ShopActionType.StartHpPot) -
                         myBuild.Count(e => e.action == ShopActionType.StopHpPot);
                if (ty == ShopActionType.StartHpPot && hp != 0)
                {
                    return;
                }
                if (ty == ShopActionType.StopHpPot && hp == 0)
                {
                    return;
                }
            }

            var b = new BuildElement(this, menu, it, myBuild.Any() ? myBuild.Max(a => a.position) + 1 : 1, ty);

            var c = new List <IItem>();

            BrutalItemInfo.InventorySimulator(myBuild, c);
            b.cost = BrutalItemInfo.InventorySimulator(new List <BuildElement> {
                b
            }, c);
            b.freeSlots = 7 - c.Count;
            b.updateText();
            if (b.freeSlots == -1)
            {
                Chat.Print("Eklenemedi " + it + ", envanter dolu.");
                b.Remove(menu);
            }
            else
            {
                myBuild.Add(b);
            }
        }
Example #12
0
        private void Shopping()
        {
            var myit = BrutalItemInfo.MyItems();

            if (!first && (!enabled.CurrentValue || !ObjectManager.Player.IsInShopRange() || !buildElements.Any()))
            {
                first = true;
                Core.DelayAction(Shopping, 300);
                return;
            }

            ShopGlobals.GoldForNextItem = 9999999;
            var currentPos = BrutalItemInfo.GetNum(buildElements);

            if (currentPos == -1)
            {
                ShopGlobals.Next = "Stoklar uyumsuz, herhangi bir item alinmayacak";
            }
            if (currentPos == 0) // Run when currentPos is 0
            {
                if (!myit.Any()) // Run when we have no items
                {
                    if (Shop.CanShop)
                    {
                        Shop.BuyItem(buildElements.First(el => el.position == 1).item.Id);
                    }
                    Core.DelayAction(Shopping, 800);
                    return;
                }
            }
            if (currentPos + 2 > buildElements.Count) // Run when inventory is full of what needed
            {
                Core.DelayAction(Shopping, RandGen.r.Next(400, 800));
                return;
            }

            if (buildElements.First(b => b.position == currentPos + 2).action != ShopActionType.Buy) // Run when next action is not buy
            {
                foreach (
                    var buildElement in
                    buildElements.Where(b => b.position > currentPos + 1).OrderBy(b => b.position).ToList())
                {
                    if (buildElement.action == ShopActionType.Buy || buildElement.action == ShopActionType.Sell)
                    {
                        break;
                    }

                    currentPos++;
                    if (currentPos + 2 > buildElements.Count)
                    {
                        Core.DelayAction(Shopping, RandGen.r.Next(400, 800));
                        return;
                    }
                }
            }


            if (currentPos < buildElements.Count - 1) // Run if we have slots to buy
            {
                var b = buildElements.First(el => el.position == currentPos + 2);
                if (b.action == ShopActionType.Sell)
                {
                    var slot = BrutalItemInfo.GetItemSlot(buildElements.First(el => el.position == currentPos + 2).item.Id);
                    if (slot != -1)
                    {
                        if (Shop.CanShop)
                        {
                            Shop.SellItem(slot);
                        }
                    }
                    else
                    {
                        b = buildElements.First(el => el.position == currentPos + 3);
                    }
                }

                if (b.action == ShopActionType.Buy)
                {
                    ShopGlobals.Next            = b.item.Name;
                    ShopGlobals.GoldForNextItem = BrutalItemInfo.BuyItemSim(myit, b.item);
                    if (Shop.CanShop)
                    {
                        Shop.BuyItem(b.item.Id);
                    }
                }
            }


            Core.DelayAction(() =>
            {
                if (currentPos == -1)
                {
                    return;
                }
                var cur = buildElements.Where(b => b.position < currentPos + 2).ToList();

                var hp = cur.Count(e => e.action == ShopActionType.StartHpPot) -
                         cur.Count(e => e.action == ShopActionType.StopHpPot);
                if (hp > 0 && !AutoWalker.p.InventoryItems.Any(it => it.Id.IsHealthlyConsumable()))
                {
                    if (Shop.CanShop)
                    {
                        Shop.BuyItem(ItemId.Health_Potion);
                    }
                    else if (hp <= 0)
                    {
                        var slot = BrutalItemInfo.GetHealtlyConsumableSlot();
                        if (slot != -1)
                        {
                            if (Shop.CanShop)
                            {
                                Shop.SellItem(slot);
                            }
                        }
                    }
                }
            }
                             , 150);

            Core.DelayAction(Shopping, RandGen.r.Next(600, 1000));
        }
Example #13
0
        private void Shopping()
        {
            List <LoLItem> myit = BrutalItemInfo.MyItems();

            if (!first && (!enabled.CurrentValue || !ObjectManager.Player.IsInShopRange() || !buildElements.Any()))
            {
                first = true;
                Core.DelayAction(Shopping, 300);
                return;
            }

            ShopGlobals.GoldForNextItem = 9999999;
            int currentPos = BrutalItemInfo.GetNum(buildElements);

            if (currentPos == -1)
            {
                ShopGlobals.Next = "Inventories mismatch, won't buy any items";
            }
            if (currentPos == 0)
            {
                if (!myit.Any())
                {
                    Shop.BuyItem(buildElements.First(el => el.position == 1).item.id);
                    Core.DelayAction(Shopping, 800);
                    return;
                }
            }
            if (currentPos + 2 > buildElements.Count)
            {
                Core.DelayAction(Shopping, RandGen.r.Next(400, 800));
                return;
            }

            if (buildElements.First(b => b.position == currentPos + 2).action != ShopActionType.Buy)
            {
                foreach (
                    BuildElement buildElement in
                    buildElements.Where(b => b.position > currentPos + 1).OrderBy(b => b.position).ToList())
                {
                    if (buildElement.action == ShopActionType.Buy || buildElement.action == ShopActionType.Sell)
                    {
                        break;
                    }

                    currentPos++;
                    if (currentPos + 2 > buildElements.Count)
                    {
                        Core.DelayAction(Shopping, RandGen.r.Next(400, 800));
                        return;
                    }
                }
            }


            if (currentPos < buildElements.Count - 1)
            {
                BuildElement b = buildElements.First(el => el.position == currentPos + 2);
                if (b.action == ShopActionType.Sell)
                {
                    int slot = BrutalItemInfo.GetItemSlot(buildElements.First(el => el.position == currentPos + 2).item.id);
                    if (slot != -1)
                    {
                        Shop.SellItem(slot);
                    }
                    else
                    {
                        b = buildElements.First(el => el.position == currentPos + 3);
                    }
                }

                if (b.action == ShopActionType.Buy)
                {
                    ShopGlobals.Next            = b.item.name;
                    ShopGlobals.GoldForNextItem = BrutalItemInfo.BuyItemSim(myit, b.item);
                    Shop.BuyItem(b.item.id);
                }
            }


            Core.DelayAction(() =>
            {
                if (currentPos == -1)
                {
                    return;
                }
                List <BuildElement> cur = buildElements.Where(b => b.position < currentPos + 2).ToList();

                int hp = cur.Count(e => e.action == ShopActionType.StartHpPot) -
                         cur.Count(e => e.action == ShopActionType.StopHpPot);
                if (hp > 0 && !AutoWalker.p.InventoryItems.Any(it => it.Id.IsHealthlyConsumable()))
                {
                    Shop.BuyItem(ItemId.Health_Potion);
                }
                else if (hp <= 0)
                {
                    int slot = BrutalItemInfo.GetHealtlyConsumableSlot();
                    if (slot != -1)
                    {
                        Shop.SellItem(slot);
                    }
                }
            }
                             , 150);

            Core.DelayAction(Shopping, RandGen.r.Next(600, 1000));
        }