private void text_search_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { text_search.Clear(); this.list_inventory.SetObjects(ListInventory.Get()); } }
private void text_search_TextChanged(object sender, EventArgs e) { if (text_search.Text == "") { this.list_inventory.SetObjects(ListInventory.Get()); } else { this.list_inventory.SetObjects(ListInventory.Get(text_search.Text)); } }
private void text_search_Leave(object sender, EventArgs e) { if (text_search.Text == null) { this.list_inventory.SetObjects(ListInventory.Get()); text_search.ForeColor = Color.Gray; text_search.Font = new Font(text_search.Font, FontStyle.Italic); text_search.Text = "Search for an item in your inventory..."; } if (this.list_inventory.Columns == null) { this.list_inventory.SetObjects(ListInventory.Get()); } }
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 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; } }