Пример #1
0
        private Attribute SellPrice(TibiaObject obj)
        {
            int npcValue = npc.sellItems.Find(o => o.itemid == (obj as LazyTibiaObject).id).price;

            return(new StringAttribute(npcValue.ToString(), 60, npcValue >= obj.AsItem().vendor_value ? Item.GoldColor : Creature.BossColor));
        }
Пример #2
0
 private Attribute SellPrice(TibiaObject obj)
 {
     int npcValue = npc.sellItems.Find(o => o.itemid == (obj as LazyTibiaObject).id).price;
     return new StringAttribute(npcValue.ToString(), 60, npcValue >= obj.AsItem().vendor_value ? StyleManager.ItemGoldColor : StyleManager.CreatureBossColor);
 }
Пример #3
0
        public static int DisplayCreatureList(System.Windows.Forms.Control.ControlCollection controls, List <TibiaObject> l, int base_x, int base_y, int max_x, int spacing, Func <TibiaObject, string> tooltip_function = null, float magnification = 1.0f, List <Control> createdControls = null, int page = 0, int pageheight = 10000, PageInfo pageInfo = null, int currentDisplay = -1)
        {
            int x = 0, y = 0;
            int height = 0;
            // add a tooltip that displays the creature names
            ToolTip value_tooltip = new ToolTip();

            value_tooltip.AutoPopDelay = 60000;
            value_tooltip.InitialDelay = 500;
            value_tooltip.ReshowDelay  = 0;
            value_tooltip.ShowAlways   = true;
            value_tooltip.UseFading    = true;
            int currentPage = 0;

            if (pageInfo != null)
            {
                pageInfo.prevPage = page > 0;
            }
            int start = 0, end = 0;
            int pageStart = 0;

            if (currentDisplay >= 0)
            {
                page = int.MaxValue;
            }
            for (int i = 0; i < l.Count; i++)
            {
                TibiaObject cr = l[i];
                int         imageWidth;
                int         imageHeight;
                Image       image = cr.GetImage();
                string      name  = cr.GetName();

                if (cr.AsItem() != null || cr.AsSpell() != null)
                {
                    imageWidth  = 32;
                    imageHeight = 32;
                }
                else
                {
                    imageWidth  = image.Width;
                    imageHeight = image.Height;
                }

                if (currentDisplay >= 0 && i == currentDisplay)
                {
                    currentDisplay = -1;
                    i                    = pageStart;
                    start                = i;
                    page                 = currentPage;
                    pageInfo.prevPage    = page > 0;
                    pageInfo.currentPage = page;
                    x                    = 0;
                    y                    = 0;
                    continue;
                }

                if (max_x < (x + base_x + (int)(imageWidth * magnification) + spacing))
                {
                    x      = 0;
                    y      = y + spacing + height;
                    height = 0;
                    if (y > pageheight)
                    {
                        if (page > currentPage)
                        {
                            y            = 0;
                            currentPage += 1;
                            pageStart    = start;
                        }
                        else
                        {
                            if (pageInfo != null)
                            {
                                pageInfo.nextPage = true;
                            }
                            break;
                        }
                    }
                }
                if ((int)(imageHeight * magnification) > height)
                {
                    height = (int)(imageHeight * magnification);
                }
                if (currentPage == page)
                {
                    PictureBox image_box;
                    image_box           = new PictureBox();
                    image_box.Image     = image;
                    image_box.BackColor = Color.Transparent;
                    image_box.Size      = new Size((int)(imageWidth * magnification), height);
                    image_box.Location  = new Point(base_x + x, base_y + y);
                    image_box.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.Zoom;
                    image_box.Name      = cr.GetCommand();
                    image_box.Click    += executeNameCommand;
                    if (cr.AsItem() != null)
                    {
                        image_box.BackgroundImage = StyleManager.GetImage("item_background.png");
                    }
                    controls.Add(image_box);
                    if (createdControls != null)
                    {
                        createdControls.Add(image_box);
                    }
                    image_box.Image = image;
                    if (tooltip_function == null)
                    {
                        value_tooltip.SetToolTip(image_box, name.ToTitle());
                    }
                    else
                    {
                        string prefix = "";
                        if (cr.AsNPC() != null)
                        {
                            NPC npc = cr is NPC ? cr as NPC : (cr as LazyTibiaObject).getTibiaObject() as NPC;
                            prefix = name.ToTitle() + " (" + npc.city.ToTitle() + ")\n";
                        }
                        value_tooltip.SetToolTip(image_box, prefix + tooltip_function(cr));
                    }
                    end++;
                }
                else
                {
                    start++;
                }

                x = x + (int)(imageWidth * magnification) + spacing;
            }
            if (pageInfo != null)
            {
                pageInfo.startDisplay = start;
                pageInfo.endDisplay   = start + end;
            }
            x = 0;
            y = y + height;
            return(y);
        }