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()); } } }
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()); } } }