Exemple #1
0
        void LoadBP(object misplacedobj)
        {
            Invoke((Action)(() =>
            {
                metroProgressSpinner1.Size = new Size(970, 666);
            }));
            var misplaced = (bool)misplacedobj;

            ListBackpack.Clear();
            bot.GetOtherInventory(SID);
            Inventory.Item[] inventory = bot.OtherInventory.Items;
            if (inventory == null)
            {
                bot.main.Invoke((Action)(() =>
                {
                    this.Text += " - Could not retrieve backpack contents. Backpack is likely private.";
                    this.metroProgressSpinner1.Spinning = false;
                }));
                return;
            }
            foreach (Inventory.Item item in inventory)
            {
                if (item.ItemPosition != -1 && !ItemList.ContainsKey(item.ItemPosition))
                {
                    ItemList.Add(item.ItemPosition, item);
                }
                if (item.ItemPosition == -1)
                {
                    MisplacedItemList.Add(item);
                }
            }
            maxPage = (int)Math.Ceiling(((double)bot.OtherInventory.NumSlots / 64));
            UpdateBP(misplaced);
        }
Exemple #2
0
        public static void Add(string itemName, int defindex, string url, string price = null)
        {
            ListBackpack item = new ListBackpack(itemName, defindex, url, price);

            list.Add(item);
        }
Exemple #3
0
 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());
     }
 }
Exemple #4
0
 public static void Add(string itemName, int defindex, string url, string price = null)
 {
     ListBackpack item = new ListBackpack(itemName, defindex, url, price);
     list.Add(item);
 }