Example #1
0
        public static int Get_Item_Image_Index(uint id)
        {
            try
            {
                lock (Globals.ItemImagesLock)
                {
                    if (!Globals.l2net_home.imageList_items_loaded.ContainsKey(id))
                    {
                        System.Drawing.Bitmap img;

                        if (System.IO.File.Exists(Util.GetItemImagePath(id)))
                        {
                            img = new System.Drawing.Bitmap(Util.GetItemImagePath(id));
                        }
                        else
                        {
                            img = new System.Drawing.Bitmap(32, 32);
                        }

                        Globals.l2net_home.imageList_items.Images.Add(img);
                        Globals.l2net_home.imageList_items_loaded.Add(id, Globals.l2net_home.imageList_items.Images.Count - 1);
                    }

                    return (int)Globals.l2net_home.imageList_items_loaded[id];
                }
            }
            catch
            {
                return -1;
            }
        }
Example #2
0
        public void Load_Images()
        {
            string   sk;
            ShortCut sc;

            //need to grab all the crap on this page and set the background pics
            for (int i = 0; i < Globals.Skills_PerPage; i++)
            {
                sc = ((ShortCut)Globals.gamedata.ShortCuts[i + page * Globals.Skills_PerPage]);

                try
                {
                    switch (sc.Type)
                    {
                    case ShortCut_Types.ITEM:
                        //need to go thru the inventory and find the item, then put its id or w/e
                        Set_Image(i, Util.GetItemImagePath(Util.GetInventoryItemID(sc.ID)));
                        break;

                    case ShortCut_Types.SKILL:
                        sk = sc.ID.ToString();
                        while (sk.Length < 4)
                        {
                            sk = "0" + sk;
                        }

                        Set_Image(i, Globals.PATH + "\\Icons\\skill" + sk + "_0.BMP");
                        break;

                    case ShortCut_Types.ACTION:
                        Set_Image(i, Globals.PATH + "\\Icons\\" + ((Actions)Globals.actionlist[sc.ID]).Icon + "_0.BMP");
                        break;

                    case ShortCut_Types.MACRO:
                        Set_Image(i, Util.GetItemImagePath(sc.ID));
                        break;

                    case ShortCut_Types.RECIPE:
                        Set_Image(i, Util.GetItemImagePath(sc.ID));
                        break;

                    default:
                        //lol?
                        //either no button, or something fcked up
                        Clear_Image(i);
                        break;
                    }                    //switch
                }
                catch
                {
                    //something broke... meh
                }
            }
        }