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); }
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(); }
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 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); } }
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); } }
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)); }
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); }