public static void Remove(string itemName, ulong itemID) { ListUserOfferings item = list.Find(x => x.itemName == itemName && x.itemID == itemID); list.Remove(item); }
private void list_userofferings_ItemActivate(object sender, EventArgs e) { ulong itemID = Convert.ToUInt64(column_uo_id.GetValue(list_userofferings.SelectedItem.RowObject)); if (itemID != 0) { try { var itemName = list_userofferings.SelectedItem.Text.Trim(); bool valid = false; string img = ""; bot.GetInventory(); foreach (var item in bot.MyInventory.Items) { if (item.Id == itemID) { valid = true; img = SteamTrade.Trade.CurrentSchema.GetItem(item.Defindex).ImageURL; } } if (valid) { try { bot.CurrentTrade.RemoveItem(itemID); itemsAdded--; if (itemsAdded < 1) { check_userready.Enabled = true; } Color prevColor = text_log.SelectionColor; text_log.AppendText("You removed: "); if (itemName.Contains("Strange")) { text_log.SelectionColor = ColorTranslator.FromHtml("#CF6A32"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Vintage")) { text_log.SelectionColor = ColorTranslator.FromHtml("#476291"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Unusual")) { text_log.SelectionColor = ColorTranslator.FromHtml("#8650AC"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Geniune")) { text_log.SelectionColor = ColorTranslator.FromHtml("#4D7455"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Haunted")) { text_log.SelectionColor = ColorTranslator.FromHtml("#38F3AB"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Community") || itemName.Contains("Self-Made")) { text_log.SelectionColor = ColorTranslator.FromHtml("#70B04A"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Valve")) { text_log.SelectionColor = ColorTranslator.FromHtml("#A50F79"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else { text_log.SelectionColor = ColorTranslator.FromHtml( SteamTrade.Trade.CurrentItemsGame.GetRarityColorFromName(itemName)); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } text_log.AppendText(" [" + DateTime.Now.ToLongTimeString() + "]\r\n"); text_log.ScrollToCaret(); ResetTradeStatus(); list_userofferings.SelectedItem.Remove(); ListInventory.Add(itemName, itemID, img); ListUserOfferings.Remove(itemName, itemID); //list_inventory.SetObjects(ListInventory.Get()); list_userofferings.SetObjects(ListUserOfferings.Get()); } catch (SteamTrade.Exceptions.TradeException ex) { bot.log.Error(ex.ToString()); } } else { bot.log.Warn("Invalid item, skipping"); } } catch (Exception ex) { bot.log.Error(ex.ToString()); } } }
public static void Add(string itemName, ulong itemID, string price = null) { ListUserOfferings item = new ListUserOfferings(itemName, itemID, price); list.Add(item); }
public static void ClearAll() { ListInventory.Clear(); ListUserOfferings.Clear(); ListOtherOfferings.Clear(); }
private void addAllItemsToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Don't click Yes unless you haven't added any items to the trade yet. Are you sure you wish to continue?", "WARNING: Experimental Feature", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { bot.GetInventory(); foreach (var item in bot.MyInventory.Items) { if (!item.IsNotTradeable) { var currentItem = SteamTrade.Trade.CurrentSchema.GetItem(item.Defindex); var itemName = GetItemName(currentItem, item); bot.log.Info("Adding " + itemName + ", " + item.Id); try { bot.CurrentTrade.AddItem(item.Id); itemsAdded++; if (itemsAdded > 0) { check_userready.Enabled = true; } Color prevColor = text_log.SelectionColor; text_log.AppendText("You added: "); if (itemName.Contains("Strange")) { text_log.SelectionColor = ColorTranslator.FromHtml("#CF6A32"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Vintage")) { text_log.SelectionColor = ColorTranslator.FromHtml("#476291"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Unusual")) { text_log.SelectionColor = ColorTranslator.FromHtml("#8650AC"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Geniune")) { text_log.SelectionColor = ColorTranslator.FromHtml("#4D7455"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Haunted")) { text_log.SelectionColor = ColorTranslator.FromHtml("#38F3AB"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Community") || itemName.Contains("Self-Made")) { text_log.SelectionColor = ColorTranslator.FromHtml("#70B04A"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Valve")) { text_log.SelectionColor = ColorTranslator.FromHtml("#A50F79"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else { text_log.SelectionColor = ColorTranslator.FromHtml( SteamTrade.Trade.CurrentItemsGame.GetRarityColorFromName(itemName)); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } text_log.AppendText(" [" + DateTime.Now.ToLongTimeString() + "]\r\n"); text_log.ScrollToCaret(); ResetTradeStatus(); ListUserOfferings.Add(itemName, item.Id, item); ListInventory.Remove(itemName, item.Id); list_userofferings.SetObjects(ListUserOfferings.Get()); list_inventory.SetObjects(ListInventory.Get()); var count = ListUserOfferings.Get().Count(x => x.Item.Defindex == item.Defindex); AppendText(string.Format("Current count of {0}: {1}", Trade.CurrentSchema.GetItem(item.Defindex).ItemName, count)); } catch (Exception ex) { bot.log.Error(ex.ToString()); } } } bot.log.Info("Done adding all items!"); } else if (dialogResult == DialogResult.No) { return; } }
private void list_userofferings_ItemActivate(object sender, EventArgs e) { ulong itemID = Convert.ToUInt64(column_uo_id.GetValue(list_userofferings.SelectedItem.RowObject)); string itemValue = column_uo_value.GetValue(list_userofferings.SelectedItem.RowObject).ToString(); double value = 0; if (itemValue.Contains("ref")) { string newValue = ReplaceLastOccurrence(itemValue, "ref", ""); value = Convert.ToDouble(newValue); } else if (itemValue.Contains("key")) { string newValue = ReplaceLastOccurrence(itemValue, "keys", ""); value = Convert.ToDouble(newValue); value = value * BackpackTF.KeyPrice; } else if (itemValue.Contains("bud")) { string newValue = ReplaceLastOccurrence(itemValue, "buds", ""); value = Convert.ToDouble(newValue); value = value * BackpackTF.BudPrice; } YourTotalValue -= value; Console.WriteLine(YourTotalValue); if (YourTotalValue >= BackpackTF.BudPrice * 1.33) { double formatPrice = YourTotalValue / BackpackTF.BudPrice; label_yourvalue.Text = "Total Value: " + formatPrice.ToString("0.00") + " buds"; } else if (YourTotalValue >= BackpackTF.KeyPrice) { double formatPrice = YourTotalValue / BackpackTF.KeyPrice; label_yourvalue.Text = "Total Value: " + formatPrice.ToString("0.00") + " keys"; } else { label_yourvalue.Text = "Total Value: " + YourTotalValue.ToString("0.00") + " ref"; } if (itemID != 0) { try { var itemName = list_userofferings.SelectedItem.Text.Trim(); bool valid = false; string img = ""; bot.GetInventory(); foreach (var item in bot.MyInventory.Items) { if (item.Id == itemID) { valid = true; img = SteamTrade.Trade.CurrentSchema.GetItem(item.Defindex).ImageURL; } } if (valid) { try { bot.CurrentTrade.RemoveItem(itemID); itemsAdded--; if (itemsAdded < 1) { check_userready.Enabled = true; } Color prevColor = text_log.SelectionColor; text_log.AppendText("You removed: "); if (itemName.Contains("Strange")) { text_log.SelectionColor = ColorTranslator.FromHtml("#CF6A32"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Vintage")) { text_log.SelectionColor = ColorTranslator.FromHtml("#476291"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Unusual")) { text_log.SelectionColor = ColorTranslator.FromHtml("#8650AC"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Geniune")) { text_log.SelectionColor = ColorTranslator.FromHtml("#4D7455"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Haunted")) { text_log.SelectionColor = ColorTranslator.FromHtml("#38F3AB"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Community") || itemName.Contains("Self-Made")) { text_log.SelectionColor = ColorTranslator.FromHtml("#70B04A"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Valve")) { text_log.SelectionColor = ColorTranslator.FromHtml("#A50F79"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else { //text_log.SelectionColor = ColorTranslator.FromHtml("#FFD700"); text_log.SelectionColor = Color.DarkGoldenrod; text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } text_log.AppendText(" [" + DateTime.Now.ToLongTimeString() + "]\r\n"); text_log.ScrollToCaret(); ResetTradeStatus(); list_userofferings.SelectedItem.Remove(); ListInventory.Add(itemName, itemID, img, itemValue); ListUserOfferings.Remove(itemName, itemID); //list_inventory.SetObjects(ListInventory.Get()); list_userofferings.SetObjects(ListUserOfferings.Get()); } catch (SteamTrade.Exceptions.TradeException ex) { bot.log.Error(ex.ToString()); } } else { bot.log.Warn("Invalid item, skipping"); } } catch (Exception ex) { bot.log.Error(ex.ToString()); } } }
private void list_inventory_ItemActivate(object sender, EventArgs e) { try { ulong itemID = Convert.ToUInt64(column_id.GetValue(list_inventory.SelectedItem.RowObject)); if (itemID != 0) { try { var itemName = list_inventory.SelectedItem.Text.Trim(); bool valid = false; Inventory.Item invItem = null; bot.GetInventory(); foreach (var item in bot.MyInventory.Items) { if (item.Id == itemID) { invItem = item; valid = true; break; } } if (valid) { try { Color prevColor = text_log.SelectionColor; bot.CurrentTrade.AddItem(itemID); itemsAdded++; if (itemsAdded > 0) { check_userready.Enabled = true; } text_log.AppendText("You added: "); if (itemName.Contains("Strange")) { text_log.SelectionColor = ColorTranslator.FromHtml("#CF6A32"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Vintage")) { text_log.SelectionColor = ColorTranslator.FromHtml("#476291"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Unusual")) { text_log.SelectionColor = ColorTranslator.FromHtml("#8650AC"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Geniune")) { text_log.SelectionColor = ColorTranslator.FromHtml("#4D7455"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Haunted")) { text_log.SelectionColor = ColorTranslator.FromHtml("#38F3AB"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Community") || itemName.Contains("Self-Made")) { text_log.SelectionColor = ColorTranslator.FromHtml("#70B04A"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Valve")) { text_log.SelectionColor = ColorTranslator.FromHtml("#A50F79"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else { text_log.SelectionColor = ColorTranslator.FromHtml( SteamTrade.Trade.CurrentItemsGame.GetRarityColorFromName(itemName)); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } text_log.AppendText(" [" + DateTime.Now.ToLongTimeString() + "]\r\n"); text_log.ScrollToCaret(); ResetTradeStatus(); list_inventory.SelectedItem.Remove(); ListUserOfferings.Add(itemName, itemID, invItem); ListInventory.Remove(itemName, itemID); list_userofferings.SetObjects(ListUserOfferings.Get()); var count = ListUserOfferings.Get().Count(x => x.Item.Defindex == invItem.Defindex); AppendText(string.Format("Current count of {0}: {1}", Trade.CurrentSchema.GetItem(invItem.Defindex).ItemName, count)); } catch (SteamTrade.Exceptions.TradeException ex) { bot.main.Invoke((Action)(() => { bot.log.Error(ex.ToString()); MessageBox.Show(ex + "\nYou can ignore this error. Just restart the trade. Sorry about that :(", "Trade Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); })); } } else { bot.log.Warn("Invalid item, skipping"); } } catch (Exception ex) { bot.log.Error(ex.ToString()); bot.main.Invoke((Action)(() => { MessageBox.Show("\nSomething weird happened. Here's the error:\n" + ex, "Trade Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); })); } } } catch (Exception ex) { bot.log.Error(ex.ToString()); } }
private void addAllItemsToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Don't click Yes unless you haven't added any items to the trade yet. Are you sure you wish to continue?", "WARNING: Experimental Feature", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { bot.GetInventory(); foreach (var item in bot.MyInventory.Items) { if (!item.IsNotTradeable) { var currentItem = SteamTrade.Trade.CurrentSchema.GetItem(item.Defindex); var itemName = GetItemName(currentItem, item); string itemValue = Util.GetPrice(item.Defindex, currentItem.ItemQuality, item); double value = 0; if (itemValue.Contains("ref")) { string newValue = ReplaceLastOccurrence(itemValue, "ref", ""); value = Convert.ToDouble(newValue); } else if (itemValue.Contains("key")) { string newValue = ReplaceLastOccurrence(itemValue, "keys", ""); Console.WriteLine("{0}, {1}", itemValue, newValue); value = Convert.ToDouble(newValue); value = value * BackpackTF.KeyPrice; } else if (itemValue.Contains("bud")) { string newValue = ReplaceLastOccurrence(itemValue, "buds", ""); value = Convert.ToDouble(newValue); value = value * BackpackTF.BudPrice; } YourTotalValue += value; if (YourTotalValue >= BackpackTF.BudPrice * 1.33) { double formatPrice = YourTotalValue / BackpackTF.BudPrice; label_yourvalue.Text = "Total Value: " + formatPrice.ToString("0.00") + " buds"; } else if (YourTotalValue >= BackpackTF.KeyPrice) { double formatPrice = YourTotalValue / BackpackTF.KeyPrice; label_yourvalue.Text = "Total Value: " + formatPrice.ToString("0.00") + " keys"; } else { label_yourvalue.Text = "Total Value: " + YourTotalValue.ToString("0.00") + " ref"; } bot.log.Info("Adding " + itemName + ", " + item.Id); try { bot.CurrentTrade.AddItem(item.Id); itemsAdded++; if (itemsAdded > 0) { check_userready.Enabled = true; } Color prevColor = text_log.SelectionColor; text_log.AppendText("You added: "); if (itemName.Contains("Strange")) { text_log.SelectionColor = ColorTranslator.FromHtml("#CF6A32"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Vintage")) { text_log.SelectionColor = ColorTranslator.FromHtml("#476291"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Unusual")) { text_log.SelectionColor = ColorTranslator.FromHtml("#8650AC"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Geniune")) { text_log.SelectionColor = ColorTranslator.FromHtml("#4D7455"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Haunted")) { text_log.SelectionColor = ColorTranslator.FromHtml("#38F3AB"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Community") || itemName.Contains("Self-Made")) { text_log.SelectionColor = ColorTranslator.FromHtml("#70B04A"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Valve")) { text_log.SelectionColor = ColorTranslator.FromHtml("#A50F79"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else { //text_log.SelectionColor = ColorTranslator.FromHtml("#FFD700"); text_log.SelectionColor = Color.DarkGoldenrod; text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } text_log.AppendText(" [" + DateTime.Now.ToLongTimeString() + "]\r\n"); text_log.ScrollToCaret(); ResetTradeStatus(); ListUserOfferings.Add(itemName, item.Id, itemValue); ListInventory.Remove(itemName, item.Id); list_userofferings.SetObjects(ListUserOfferings.Get()); list_inventory.SetObjects(ListInventory.Get()); } catch (Exception ex) { bot.log.Error(ex.ToString()); } } } bot.log.Info("Done adding all items!"); } else if (dialogResult == DialogResult.No) { return; } }
private void list_inventory_ItemActivate(object sender, EventArgs e) { try { ulong itemID = Convert.ToUInt64(column_id.GetValue(list_inventory.SelectedItem.RowObject)); string itemValue = column_value.GetValue(list_inventory.SelectedItem.RowObject).ToString(); // Check whether in ref, keys or buds first double value = 0; if (itemValue.Contains("ref")) { string newValue = ReplaceLastOccurrence(itemValue, "ref", ""); value = Convert.ToDouble(newValue); } else if (itemValue.Contains("key")) { string newValue = ReplaceLastOccurrence(itemValue, "keys", ""); Console.WriteLine("{0}, {1}", itemValue, newValue); value = Convert.ToDouble(newValue); value = value * BackpackTF.KeyPrice; } else if (itemValue.Contains("bud")) { string newValue = ReplaceLastOccurrence(itemValue, "buds", ""); value = Convert.ToDouble(newValue); value = value * BackpackTF.BudPrice; } YourTotalValue += value; if (YourTotalValue >= BackpackTF.BudPrice * 1.33) { double formatPrice = YourTotalValue / BackpackTF.BudPrice; label_yourvalue.Text = "Total Value: " + formatPrice.ToString("0.00") + " buds"; } else if (YourTotalValue >= BackpackTF.KeyPrice) { double formatPrice = YourTotalValue / BackpackTF.KeyPrice; label_yourvalue.Text = "Total Value: " + formatPrice.ToString("0.00") + " keys"; } else { label_yourvalue.Text = "Total Value: " + YourTotalValue.ToString("0.00") + " ref"; } if (itemID != 0) { try { var itemName = list_inventory.SelectedItem.Text.Trim(); bool valid = false; bot.GetInventory(); foreach (var item in bot.MyInventory.Items) { if (item.Id == itemID) { valid = true; } } if (valid) { try { Color prevColor = text_log.SelectionColor; bot.CurrentTrade.AddItem(itemID); itemsAdded++; if (itemsAdded > 0) { check_userready.Enabled = true; } text_log.AppendText("You added: "); if (itemName.Contains("Strange")) { text_log.SelectionColor = ColorTranslator.FromHtml("#CF6A32"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Vintage")) { text_log.SelectionColor = ColorTranslator.FromHtml("#476291"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Unusual")) { text_log.SelectionColor = ColorTranslator.FromHtml("#8650AC"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Geniune")) { text_log.SelectionColor = ColorTranslator.FromHtml("#4D7455"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Haunted")) { text_log.SelectionColor = ColorTranslator.FromHtml("#38F3AB"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Community") || itemName.Contains("Self-Made")) { text_log.SelectionColor = ColorTranslator.FromHtml("#70B04A"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else if (itemName.Contains("Valve")) { text_log.SelectionColor = ColorTranslator.FromHtml("#A50F79"); text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } else { //text_log.SelectionColor = ColorTranslator.FromHtml("#FFD700"); text_log.SelectionColor = Color.DarkGoldenrod; text_log.AppendText(itemName); text_log.SelectionColor = prevColor; } text_log.AppendText(" [" + DateTime.Now.ToLongTimeString() + "]\r\n"); text_log.ScrollToCaret(); ResetTradeStatus(); list_inventory.SelectedItem.Remove(); ListUserOfferings.Add(itemName, itemID, itemValue); ListInventory.Remove(itemName, itemID); list_userofferings.SetObjects(ListUserOfferings.Get()); //list_inventory.SetObjects(ListInventory.Get()); } catch (SteamTrade.Exceptions.TradeException ex) { bot.main.Invoke((Action)(() => { bot.log.Error(ex.ToString()); MessageBox.Show(ex + "\nYou can ignore this error. Just restart the trade. Sorry about that :(", "Trade Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); })); } } else { bot.log.Warn("Invalid item, skipping"); } } catch (Exception ex) { bot.log.Error(ex.ToString()); bot.main.Invoke((Action)(() => { MessageBox.Show("\nSomething weird happened. Here's the error:\n" + ex, "Trade Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); })); } } } catch (Exception ex) { bot.log.Error(ex.ToString()); } }
public static void Add(string itemName, ulong itemID) { ListUserOfferings item = new ListUserOfferings(itemName, itemID); list.Add(item); }
public static void Add(string itemName, ulong itemID, Inventory.Item item, string price = null) { ListUserOfferings ite = new ListUserOfferings(itemName, itemID, price, item); list.Add(ite); }