Esempio 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);
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
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();
        }
Esempio n. 4
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);
            }
        }