public static void GetDesc(EliteAPI api) { uint itemID = api.Inventory.SelectedItemId; Structs.InventoryItem item = XML.GetInvItem(itemID); if (!item.success) { Chat.SendEcho(api, "Couldn't find that item!"); return; } //Get page html. string itemPage = FFXIAH.baseUrl + itemID; string html = FFXIAH.GetHTML(itemPage, 12); string itemName = item.name; string desc = Misc.RegExMatch(html, FFXIAH.RegExs.desc); Chat.SendLinkshell(api, itemName + "\n" + desc); }
public static void GetPrice(EliteAPI api, Structs.InventoryItem invItem, bool isStack = false) { string itemPage = FFXIAH.baseUrl + invItem.id; if (isStack) { itemPage += "/?stack=1"; } //Get page html. string html = FFXIAH.GetHTML(itemPage, 12); //Get itemSale string so that we have less to sift through. string itemSaleStr = Misc.RegExMatch(html, FFXIAH.RegExs.itemSale); int numSales = 0, maxSales; //Item isn't EX if (itemSaleStr != "null") { //Get number of sales and server to ensure we're parsing the correct one. int serverValue = int.Parse(Misc.RegExMatch(itemSaleStr, FFXIAH.RegExs.server)); //Verify server is correct before parsing. /*if (api.Player.ServerId != serverValue) * { * Chat.SendEcho(api, "Wrong server being parsed!"); * return; * }*/ numSales = Misc.RegExMatches(itemSaleStr, FFXIAH.RegExs.server).Count; maxSales = FFXIAH.maxSales > numSales ? numSales : FFXIAH.maxSales; //Store sales for (int i = 0; i < maxSales; i++) { var colCount = 0; FFXIAH.Sale sale = new FFXIAH.Sale(); foreach (string regExStr in FFXIAH.RegExs.list) { string matchVal = Misc.RegExMatch(itemSaleStr, regExStr, i); if (colCount == 0) { sale.date = Misc.FromUnixTime(long.Parse(matchVal)).ToShortDateString(); } else if (colCount == 1) { sale.seller = matchVal; } else if (colCount == 2) { sale.buyer = matchVal; } else if (colCount == 3) { sale.price = int.Parse(matchVal); } if (colCount == 3) { FFXIAH.sales.Add(sale); } colCount = (colCount + 1) % 4; } } } //Create an xiah item object after all info gathered. FFXIAH.Item item = new FFXIAH.Item(); //Store item info. string stockStr = Misc.RegExMatch(html, FFXIAH.RegExs.stock); item.stock = stockStr != "null" ? int.Parse(stockStr) : 0; item.isStack = isStack; //Print sales list. FFXIAH.PrintSales(api, invItem, item, numSales); //Clear sales list. FFXIAH.sales.Clear(); }