private void _setupTreeListView() { treeListView1.SmallImageList = new ImageList(); treeListView1.SmallImageList.Images.Add(Properties.Resources.changeset); treeListView1.SmallImageList.ImageSize = new Size(16, 16); treeListView1.HotItemStyle = new BrightIdeasSoftware.HotItemStyle(); treeListView1.HotItemStyle.BackColor = Color.CadetBlue; treeListView1.HotItemStyle.ForeColor = Color.Black; treeListView1.HotItemStyle.FontStyle = FontStyle.Underline; //treeListView1.HotTracking = true; treeListView1.ShowItemToolTips = true; treeListView1.CellToolTip.InitialDelay = 2000; treeListView1.CellToolTip.ReshowDelay = 4000; treeListView1.CellToolTip.IsBalloon = false; treeListView1.CellToolTip.BackColor = System.Drawing.SystemColors.Info; treeListView1.CellToolTip.BackColor = System.Drawing.SystemColors.InfoText; { treeListView1.EmptyListMsg = "No Changesets Found."; BrightIdeasSoftware.TextOverlay textOverlay = treeListView1.EmptyListMsgOverlay as BrightIdeasSoftware.TextOverlay; textOverlay.TextColor = Color.Firebrick; textOverlay.BackColor = Color.MistyRose; textOverlay.BorderColor = Color.DarkRed; textOverlay.BorderWidth = 4.0f; textOverlay.Font = new Font("Tahoma", 26); textOverlay.Rotation = -5; } BrightIdeasSoftware.TypedObjectListView <Revision> patches = new BrightIdeasSoftware.TypedObjectListView <Revision>(treeListView1); patches.GenerateAspectGetters(); treeListView1.CanExpandGetter = _canExpandGetter; treeListView1.ChildrenGetter = _childrenGetter; }
void LoadBP() { ListBackpack.Clear(); bot.GetOtherInventory(SID); Inventory.Item[] inventory = bot.OtherInventory.Items; if (inventory == null) { bot.main.Invoke((Action)(() => { list_inventory.EmptyListMsg = "Could not retrieve backpack contents. Backpack is likely private."; BrightIdeasSoftware.TextOverlay textOverlay = this.list_inventory.EmptyListMsgOverlay as BrightIdeasSoftware.TextOverlay; })); return; } bot.main.Invoke((Action)(() => { list_inventory.View = View.Tile; list_inventory.TileSize = new Size(250, 64); ListView_SetSpacing(list_inventory, 70, 10); })); foreach (Inventory.Item item in inventory) { bool isGift = false; bool isUnusual = false; var currentItem = Trade.CurrentSchema.GetItem(item.Defindex); try { for (int count = 0; count < item.Attributes.Length; count++) { if (item.Attributes[count].Defindex == 229) { Console.WriteLine("Item: " + currentItem.ItemName); Console.WriteLine(item.Attributes[count].FloatValue); Console.WriteLine(item.Attributes[count].Value); } } } catch { } string name = ""; string price = null; var type = Convert.ToInt32(item.Quality.ToString()); if (Util.QualityToName(type) != "Unique") { name += Util.QualityToName(type) + " "; } name += currentItem.ItemName; name += " (" + SteamTrade.Trade.CurrentItemsGame.GetItemRarity(item.Defindex.ToString()) + ")"; if (Util.QualityToName(type) == "Unusual") { isUnusual = true; try { for (int count = 0; count < item.Attributes.Length; count++) { if (item.Attributes[count].Defindex == 134) { name += " (Effect: " + EffectToName(item.Attributes[count].FloatValue) + ")"; price = Util.GetPrice(item.Defindex, type, item, false, (int)item.Attributes[count].FloatValue); } } } catch { } } if (currentItem.CraftMaterialType == "supply_crate") { for (int count = 0; count < item.Attributes.Length; count++) { name += " #" + (item.Attributes[count].FloatValue); } } try { int size = item.Attributes.Length; for (int count = 0; count < size; count++) { if (item.Attributes[count].Defindex == 261) { string paint = PaintToName(item.Attributes[count].FloatValue); name += " (Painted: " + paint + ")"; } if (item.Attributes[count].Defindex == 186) { isGift = true; name += " (Gifted)"; } } } catch { // Item has no attributes... or something. } if (currentItem.Name == "Wrapped Gift") { isGift = true; // Untested! try { var containedItem = Trade.CurrentSchema.GetItem(item.ContainedItem.Defindex); var containedName = GetItemName(containedItem, item.ContainedItem); price = Util.GetPrice(item.ContainedItem.Defindex, Convert.ToInt32(item.ContainedItem.Quality.ToString()), item, true); name += " (Contains: " + containedName + ")"; } catch (Exception ex) { Bot.Print(ex); // Guess this doesn't work :P. } } if (item.IsNotCraftable) { name += " (Uncraftable)"; } if (item.IsNotTradeable) { name += " (Untradeable)"; } if (!isGift && !isUnusual) { price = Util.GetPrice(currentItem.Defindex, type, item); ListBackpack.Add(name, item.Defindex, currentItem.ImageURL, price); } else { ListBackpack.Add(name, item.Defindex, currentItem.ImageURL, price); } list_inventory.SetObjects(ListBackpack.Get()); } }