Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void MoveDown(int index)
        {
            if (index == _myBuild.Count || index == 2)
            {
                return;
            }
            BuildElement th = _myBuild.First(ele => ele.Position == index);
            BuildElement dn = _myBuild.First(ele => ele.Position == index + 1);

            th.Position++;
            dn.Position--;

            SaveBuild();
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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();
        }
        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));
        }