public ListFoodController(FoodList foods) { _foodList = foods; }
public FoodList Add(FoodList foodList) { return(_foodListRepository.Add(foodList)); }
public void CheckForItems() { //Added to Make sure our list matches what we are looking for. LoadList(ItemName, _removeListPath); LoadList(BagList, _bagListPath); // NB: Since we will be modifying the Me.BagItems list indirectly through WoWclient directives, // we can't use it as our iterator--we must make a copy, instead. List <WoWItem> itemsToVisit = Me.BagItems.ToList(); foreach (WoWItem item in itemsToVisit) { if (!item.IsValid) { continue; } bool isQuestItem = IsQuestItem(item); if (BagList.Contains(item.Name)) { Slog("{0} is a bag, ignoring.", item.Name); continue; } if (OpnList.Contains(item.Name) && item.IsOpenable && MrItemRemover2Settings.Instance.EnableOpen == "True") { Slog("{0} can be opened. Opening.", item.Name); Lua.DoString("UseItemByName(\"" + item.Name + "\")"); } if (OpnList.Contains(item.Name) && item.StackCount == 1) { Slog("{0} can be opened, so we're opening it.", item.Name); Lua.DoString("UseItemByName(\"" + item.Name + "\")"); } if (Combine3List.Contains(item.Name) && item.StackCount >= 3) { uint timesToUse = (uint)(Math.Floor((double)(item.StackCount / 3))); Slog("{0} can be combined {1} times, so we're combining it.", item.Name, timesToUse); for (uint timesUsed = 0; timesUsed < timesToUse; timesUsed++) { Lua.DoString("UseItemByName(\"" + item.Name + "\")"); Thread.Sleep(SpellManager.GlobalCooldownLeft); } } if (Combine5List.Contains(item.Name) && item.StackCount >= 5) { uint timesToUse = (uint)(Math.Floor((double)(item.StackCount / 5))); Slog("{0} can be combined {1} times, so we're combining it.", item.Name, timesToUse); for (uint timesUsed = 0; timesUsed < timesToUse; timesUsed++) { Lua.DoString("UseItemByName(\"" + item.Name + "\")"); Thread.Sleep(SpellManager.GlobalCooldownLeft); } } if (Combine10List.Contains(item.Name) && item.StackCount >= 10) { uint timesToUse = (uint)(Math.Floor((double)(item.StackCount / 10))); Slog("{0} can be combined {1} times, so we're combining it.", item.Name, timesToUse); for (uint timesUsed = 0; timesUsed < timesToUse; timesUsed++) { Lua.DoString("UseItemByName(\"" + item.Name + "\")"); Thread.Sleep(SpellManager.GlobalCooldownLeft); } } if (MrItemRemover2Settings.Instance.EnableRemove == "True" && MrItemRemover2Settings.Instance.RemoveFood == "True") { if (!KeepList.Contains(item.Name) && FoodList.Contains(item.Name)) { Slog("{0} was in the Food List and We want to Remove Food. Removing.", item.Name); Lua.DoString("ClearCursor()"); item.PickUp(); Lua.DoString("DeleteCursorItem()"); } } if (MrItemRemover2Settings.Instance.EnableRemove == "True" && MrItemRemover2Settings.Instance.RemoveDrinks == "True") { if (!KeepList.Contains(item.Name) && DrinkList.Contains(item.Name)) { Slog("{0} was in the Drink List and We want to Remove Drinks. Removing.", item.Name); Lua.DoString("ClearCursor()"); item.PickUp(); Lua.DoString("DeleteCursorItem()"); } } //if item name Matches whats in the text file / the internal list (after load) if (ItemName.Contains(item.Name) && !KeepList.Contains(item.Name)) { //probally not needed, but still user could be messing with thier inventory. //Printing to the log, and Deleting the Item. Slog("{0} Found Removing Item", item.Name); item.PickUp(); Lua.DoString("DeleteCursorItem()"); //a small Sleep, might not be needed. } if (MrItemRemover2Settings.Instance.DeleteQuestItems == "True" && item.ItemInfo.BeginQuestId != 0 && !KeepList.Contains(item.Name)) { Slog("{0}'s Began a Quest. Removing", item.Name); item.PickUp(); Lua.DoString("DeleteCursorItem()"); } //Process all Gray Items if enabled. if (MrItemRemover2Settings.Instance.DeleteAllGray == "True" && item.Quality == WoWItemQuality.Poor && !BagList.Contains(item.Name)) { //Gold Format, goes in GXX SXX CXX string goldString = MrItemRemover2Settings.Instance.GoldGrays.ToString(CultureInfo.InvariantCulture); int goldValue = goldString.ToInt32() * 10000; string silverString = MrItemRemover2Settings.Instance.SilverGrays.ToString(CultureInfo.InvariantCulture); int silverValue = silverString.ToInt32() * 100; string copperString = MrItemRemover2Settings.Instance.CopperGrays.ToString(CultureInfo.InvariantCulture); int copperValue = copperString.ToInt32(); //slog("Value of input sell string - " + (goldValue + silverValue + copperValue)); if (item.BagSlot != -1 && !isQuestItem && item.ItemInfo.SellPrice <= (goldValue + silverValue + copperValue) && !KeepList.Contains(item.Name) && !BagList.Contains(item.Name)) { Slog("{0}'s Item Quality was Poor and only worth {1} copper. Removing.", item.Name, item.ItemInfo.SellPrice); Lua.DoString("ClearCursor()"); item.PickUp(); Lua.DoString("DeleteCursorItem()"); } } //Process all White Items if enabled. if (MrItemRemover2Settings.Instance.DeleteAllWhite == "True" && item.Quality == WoWItemQuality.Common && !BagList.Contains(item.Name)) { if (item.BagSlot != -1 && !isQuestItem && !KeepList.Contains(item.Name) && !BagList.Contains(item.Name) && !FoodList.Contains(item.Name) && !DrinkList.Contains(item.Name)) { Slog("{0}'s Item Quality was Common. Removing.", item.Name); Lua.DoString("ClearCursor()"); item.PickUp(); Lua.DoString("DeleteCursorItem()"); } } //Process all Green Items if enabled. if (MrItemRemover2Settings.Instance.DeleteAllGreen == "True" && item.Quality == WoWItemQuality.Uncommon && !BagList.Contains(item.Name)) { if (item.BagSlot != -1 && !isQuestItem && !KeepList.Contains(item.Name) && !BagList.Contains(item.Name)) { Slog("{0}'s Item Quality was Uncommon. Removing.", item.Name); Lua.DoString("ClearCursor()"); item.PickUp(); Lua.DoString("DeleteCursorItem()"); } } //Process all Blue Items if enabled. if (MrItemRemover2Settings.Instance.DeleteAllBlue == "True" && item.Quality == WoWItemQuality.Rare && !BagList.Contains(item.Name)) { if (item.BagSlot != -1 && !isQuestItem && !KeepList.Contains(item.Name) && !BagList.Contains(item.Name)) { Slog("{0}'s Item Quality was Rare. Removing.", item.Name); Lua.DoString("ClearCursor()"); item.PickUp(); Lua.DoString("DeleteCursorItem()"); } } } }
public static List <FoodList> OldGetFoodLists() { string html = GetHtml(URLs.FoodListsURL); var doc = new HtmlDocument(); doc.LoadHtml(html); var node = doc.DocumentNode; var mnde = node.SelectSingleNode("//center"); var tds = mnde.SelectNodes("//td").Where(x => x.Attributes["width"] != null && x.Attributes["width"].Value == "50%" && x.InnerText != "" && x.InnerText != " ").ToList(); string tempDate1 = ""; string tempDate2 = ""; var lists = new List <FoodList>(); for (int i = 0; i < tds.Count(); i++) { var nd = tds[i] as HtmlNode; if (i % 4 == 0) { tempDate1 = new string(nd.InnerText.ToCharArray().Where(c => char.IsDigit(c) || c == '.').ToArray()); } else if (i % 4 == 1) { tempDate2 = new string(nd.InnerText.ToCharArray().Where(c => char.IsDigit(c) || c == '.').ToArray()); } else { var list = new FoodList(); list.Date = Convert.ToDateTime((i % 4 == 2 ? tempDate1 : tempDate2)); list.Foods = new List <Food>(); var split = nd.InnerText.Replace("\t", "").Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); for (int j = 0; j < split.Length; j++) { string foodName = split[j].Trim(); if (!string.IsNullOrEmpty(foodName)) { if (foodName.Contains("AKŞAM")) { break; } if (foodName.Contains("ÖĞLE")) { foodName = foodName.Replace("ÖĞLE", ""); } foodName = foodName.Tidy(); if (!string.IsNullOrEmpty(foodName) && foodName != "T A T İ L" && foodName.ToUpper() != "TATİL") { list.Foods.Add(new Food() { Name = foodName }); } } } lists.Add(list); } } return(lists.OrderBy(x => x.Date).ToList()); }
public void SellVenderItems(object sender, LuaEventArgs args) { if (MerchantFrame.Instance.IsVisible && IsInitialized && MrItemRemover2Settings.Instance.EnableSell == "True") { LoadList(FoodList, _foodListPath); LoadList(DrinkList, _drinkListPath); LoadList(ItemNameSell, _sellListPath); LoadList(BagList, _bagListPath); foreach (WoWItem item in Me.BagItems) { if (MrItemRemover2Settings.Instance.SellSoulbound == "False") { if (!item.IsSoulbound && !KeepList.Contains(item.Name) && !FoodList.Contains(item.Name) && !DrinkList.Contains(item.Name)) { if (item.Quality == WoWItemQuality.Poor && MrItemRemover2Settings.Instance.SellGray == "True") { Slog("Selling Gray Item {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Common && MrItemRemover2Settings.Instance.SellWhite == "True" && !FoodList.Contains(item.Name) && !DrinkList.Contains(item.Name)) { Slog("Selling White Item {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Uncommon && MrItemRemover2Settings.Instance.SellGreen == "True") { Slog("Selling Green Item {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Rare && MrItemRemover2Settings.Instance.SellBlue == "True") { Slog("Selling Blue Item {0}", item.Name); item.UseContainerItem(); } if (ItemNameSell.Contains(item.Name)) { Slog("Item Matched List Selling {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Common && FoodList.Contains(item.Name) && MrItemRemover2Settings.Instance.SellFood == "True" && item.ItemInfo.RequiredLevel <= MrItemRemover2Settings.Instance.ReqRefLvl) { Slog("Item Matched Selling Food List {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Common && DrinkList.Contains(item.Name) && MrItemRemover2Settings.Instance.SellDrinks == "True" && item.ItemInfo.RequiredLevel <= MrItemRemover2Settings.Instance.ReqRefLvl) { Slog("Item Matched Selling Food List {0}", item.Name); item.UseContainerItem(); } } } if (MrItemRemover2Settings.Instance.SellSoulbound == "True") { if (!KeepList.Contains(item.Name) && !FoodList.Contains(item.Name) && !DrinkList.Contains(item.Name)) { if (item.Quality == WoWItemQuality.Poor && MrItemRemover2Settings.Instance.SellGray == "True") { Slog("Selling Gray Item {0}", item.Name); item.UseContainerItem(); } if ((item.Quality == WoWItemQuality.Common && MrItemRemover2Settings.Instance.SellWhite == "True" && !FoodList.Contains(item.Name) && !DrinkList.Contains(item.Name))) { Slog("Selling White Item {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Uncommon && MrItemRemover2Settings.Instance.SellGreen == "True") { Slog("Selling Green Item {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Rare && MrItemRemover2Settings.Instance.SellBlue == "True") { Slog("Selling Blue Item {0}", item.Name); item.UseContainerItem(); } if (ItemNameSell.Contains(item.Name)) { Slog("Item Matched List Selling {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Common && FoodList.Contains(item.Name) && MrItemRemover2Settings.Instance.SellFood == "True" && item.ItemInfo.RequiredLevel <= MrItemRemover2Settings.Instance.ReqRefLvl) { Slog("Item Matched Selling Food List {0}", item.Name); item.UseContainerItem(); } if (item.Quality == WoWItemQuality.Common && DrinkList.Contains(item.Name) && MrItemRemover2Settings.Instance.SellDrinks == "True" && item.ItemInfo.RequiredLevel <= MrItemRemover2Settings.Instance.ReqRefLvl) { Slog("Item Matched Selling Drink List {0}", item.Name); item.UseContainerItem(); } } } } } }