public static void GetAllPricesByFile() { List <string> itemlist = new List <string>(); itemlist = File.ReadAllLines("ItemList.txt").ToList(); for (int i = 0; i < itemlist.Count() - 2; i += 3) { WebRetrieve.CacheItemPrice(itemlist[i], z, 1, int.Parse(itemlist[i + 1]), int.Parse(itemlist[i + 2]), omit); //also below } }
//Codes //unique : 6 //strange: 11 //genuine: 1 //unusual: 5 //haunted: 13 //collectors: 14 //vintage: 3 public static double ReturnItemPrice(string _name, int _z, int _craftable, int _quality, int _cosmetic, bool _omit) { WebRetrieve.CacheItemPrice(_name, _z, _craftable, _quality, _cosmetic, _omit); Method.cachelock.EnterReadLock(); object objcacheprice = MemoryCache.Default.Get(_name + " " + _quality.ToString() + " " + _craftable.ToString());//recall from cache Method.cachelock.ExitReadLock(); double ret = double.Parse(objcacheprice.ToString()); Console.WriteLine(_name + " : " + ret); return(ret); }
public static void GetAllPrices() //gets the prices of all items the bot is interested in { List <string> itemlist = new List <string>(); itemlist = WebRetrieve.GetItems(); //this method is described below for (int i = 0; i < itemlist.Count() - 2; i += 3) { if (itemlist[i].Contains("Non-Craftable")) { string newname = itemlist[i].Replace("(Non-Craftable)", "").Trim(); WebRetrieve.CacheItemPrice(newname, z, 0, int.Parse(itemlist[i + 1]), int.Parse(itemlist[i + 2]), omit); } else { WebRetrieve.CacheItemPrice(itemlist[i], z, 1, int.Parse(itemlist[i + 1]), int.Parse(itemlist[i + 2]), omit); //also below } } }