Example #1
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 #2
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 #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);
        }