DrawCountOnItem() public static method

public static DrawCountOnItem ( Item item, int itemCount, int size = -1 ) : Bitmap
item Item
itemCount int
size int
return Bitmap
Esempio n. 1
0
        private void RefreshWaste()
        {
            foreach (Control c in wasteControls)
            {
                Controls.Remove(c);
                c.Dispose();
            }
            wasteControls.Clear();

            int  base_x = 5, x = 0;
            int  base_y = 32, y = 0;
            int  max_x        = this.Size.Width - 5;
            Size item_size    = new Size(32, 32);
            int  item_spacing = 4;

            foreach (var tpl in HuntManager.GetUsedItems(hunt))
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (x >= (max_x - item_size.Width - item_spacing))
                    {
                        x  = 0;
                        y += item_size.Height + item_spacing;
                    }
                    int mitems = 1;
                    if (item.stackable)
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;

                    PictureBox picture_box = new PictureBox();
                    picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                    picture_box.Name     = item.GetName();
                    picture_box.Size     = new System.Drawing.Size(item_size.Width, item_size.Height);
                    picture_box.TabIndex = 1;
                    picture_box.TabStop  = false;
                    picture_box.Click   += openItem_Click;
                    if (item.stackable)
                    {
                        picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                    }
                    else
                    {
                        picture_box.Image = item.GetImage();
                    }

                    picture_box.SizeMode        = PictureBoxSizeMode.StretchImage;
                    picture_box.BackgroundImage = StyleManager.GetImage("item_background.png");
                    this.Controls.Add(picture_box);
                    wasteControls.Add(picture_box);

                    x += item_size.Width + item_spacing;
                }
            }

            this.Size = new Size(this.Size.Width, base_y + y + item_size.Height + item_spacing * 2);
        }
Esempio n. 2
0
        private void DisplayItem(ItemDrop drop, int base_x, int base_y, int x, int y, Size item_size, ToolTip droprate_tooltip, int dropbar_height, string prefix = "Drop rate of ")
        {
            Item dropItem = StorageManager.getItem(drop.itemid);
            // the main picture of the item
            PictureBox picture_box = new PictureBox();

            picture_box.Location        = new System.Drawing.Point(base_x + x, base_y + y);
            picture_box.Name            = dropItem.GetName();
            picture_box.Size            = new System.Drawing.Size(item_size.Width, item_size.Height);
            picture_box.TabIndex        = 1;
            picture_box.TabStop         = false;
            picture_box.Image           = drop.max > 1 ? LootDropForm.DrawCountOnItem(dropItem, drop.max) : dropItem.GetImage();
            picture_box.SizeMode        = PictureBoxSizeMode.StretchImage;
            picture_box.BackgroundImage = StyleManager.GetImage("item_background.png");
            picture_box.Click          += openItemBox;
            droprate_tooltip.SetToolTip(picture_box, prefix + dropItem.displayname + " is " + (drop.percentage >= 0 ? Math.Round(drop.percentage, 1).ToString() + "%." : "unknown."));
            this.Controls.Add(picture_box);
            itemControls.Add(picture_box);

            // the 'dropbar' that roughly displays the droprate of the item
            PictureBox dropbar_box = new PictureBox();
            Brush      brush;

            dropbar_box.Location = new System.Drawing.Point(base_x + x, base_y + y + item_size.Height);
            dropbar_box.Name     = "dropbar_image";
            dropbar_box.Size     = new System.Drawing.Size(item_size.Width, dropbar_height);
            dropbar_box.TabIndex = 1;
            dropbar_box.TabStop  = false;
            Image    image = new Bitmap(dropbar_box.Width, dropbar_box.Height);
            Graphics gr    = Graphics.FromImage(image);

            gr.FillRectangle(Brushes.DarkGray, new Rectangle(0, 0, item_size.Width, dropbar_height)); //dropbar base bar
            if (drop.percentage < 1)
            {
                brush = Brushes.DarkRed; // <1% is red
            }
            else if (drop.percentage < 15)
            {
                brush = Brushes.Yellow; //<15% is yellow
            }
            else
            {
                brush = Brushes.ForestGreen; //everything else is green
            }
            gr.FillRectangle(brush, new Rectangle(0, 0, (int)(Math.Ceiling(item_size.Width * drop.percentage / 100) + 1), dropbar_height));
            dropbar_box.Image = image;
            this.Controls.Add(dropbar_box);
            itemControls.Add(dropbar_box);
        }
Esempio n. 3
0
 private static void RenderItemCount(Graphics gr, Tuple <Item, int> item, Rectangle region)
 {
     if (region.Width > 28)
     {
         RenderImageResized(gr, item.Item1.GetImage(), region);
         if (item.Item1.stackable || item.Item2 > 1)
         {
             LootDropForm.DrawCountOnGraphics(gr, item.Item2, region.X + region.Width - 1, region.Y + region.Height - 1);
         }
     }
     else
     {
         RenderImageResized(gr, (item.Item1.stackable || item.Item2 > 1) ? LootDropForm.DrawCountOnItem(item.Item1, item.Item2) : item.Item1.GetImage(), region);
     }
 }
Esempio n. 4
0
        public override void LoadForm()
        {
            if (quest == null)
            {
                return;
            }
            this.SuspendLayout();
            NotificationInitialize();

            wikiButton.Click -= c_Click;

            this.questTitle.Text  = quest.name;
            this.premiumBox.Image = quest.premium ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            this.cityLabel.Text   = quest.city == null ? "Unknown" : quest.city.ToTitle();
            this.levelLabel.Text  = quest.minlevel.ToString();
            this.legendLabel.Text = quest.legend;

            List <TibiaObject> rewards = new List <TibiaObject>();

            foreach (int reward in quest.rewardItems)
            {
                Item item = StorageManager.getItem(reward);
                rewards.Add(item);
            }
            rewards = rewards.OrderByDescending(o => (o as Item).GetMaxValue()).ToList <TibiaObject>();
            int x = 5;
            int y = 77;

            foreach (string missionName in quest.questInstructions.Keys)
            {
                if (quest.questInstructions[missionName].Count == 0)
                {
                    continue;
                }
                if (x + 150 >= this.Size.Width)
                {
                    x  = 5;
                    y += 25;
                }
                Label missionButton = new Label();
                missionButton.BackColor   = System.Drawing.Color.Transparent;
                missionButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                missionButton.Font        = wikiButton.Font;
                missionButton.ForeColor   = StyleManager.NotificationTextColor;
                missionButton.Location    = new System.Drawing.Point(x, y);
                missionButton.Name        = quest.questInstructions[missionName][0].specialCommand != null ? quest.questInstructions[missionName][0].specialCommand : "guide" + Constants.CommandSymbol + quest.name.ToLower() + Constants.CommandSymbol + "1" + Constants.CommandSymbol + missionName;
                missionButton.Padding     = new System.Windows.Forms.Padding(2);
                missionButton.Text        = missionName;
                missionButton.TextAlign   = System.Drawing.ContentAlignment.MiddleCenter;
                missionButton.Click      += MissionButton_Click;
                missionButton.Size        = new Size(150, 21);
                this.Controls.Add(missionButton);
                x += missionButton.Width + 5;
            }
            y += 25;
            using (Graphics gr = Graphics.FromHwnd(legendLabel.Handle)) {
                this.legendLabel.Location = new Point(legendLabel.Location.X, y);
                y += (int)gr.MeasureString(this.legendLabel.Text, this.legendLabel.Font, this.legendLabel.MaximumSize.Width).Height + 20;
            }

            if (this.quest.additionalRequirements.Count > 0 || this.quest.questRequirements.Count > 0)
            {
                Label label = new Label();
                label.Text      = "Requirements";
                label.Location  = new Point(5, y);
                label.ForeColor = StyleManager.NotificationTextColor;
                label.BackColor = Color.Transparent;
                label.Font      = questTitle.Font;
                label.Size      = new Size(this.Size.Width - 10, label.Height);
                this.Controls.Add(label);
                y += 25;

                // Item requirements
                if (this.quest.questRequirements.Count > 0)
                {
                    List <Tuple <int, Item> > requirements = new List <Tuple <int, Item> >();
                    foreach (Tuple <int, int> tpl in quest.questRequirements)
                    {
                        Item item = StorageManager.getItem(tpl.Item2);
                        requirements.Add(new Tuple <int, Item>(tpl.Item1, item));
                    }
                    requirements = requirements.OrderBy(o => o.Item1 * o.Item2.GetMaxValue()).ToList();
                    List <TibiaObject> itemList = requirements.Select(o => o.Item2).ToList <TibiaObject>();

                    List <Control> itemControls = new List <Control>();
                    y = y + UIManager.DisplayCreatureList(this.Controls, itemList, 10, y, this.Size.Width - 10, 1, null, 1, itemControls);
                    int itemnr = 0;
                    foreach (Control control in itemControls)
                    {
                        control.BackgroundImage = StyleManager.GetImage("item_background.png");
                        int  itemCount = requirements[itemnr].Item1;
                        Item item      = requirements[itemnr].Item2;

                        (control as PictureBox).Image = LootDropForm.DrawCountOnItem(item, itemCount);

                        itemnr++;
                    }
                }

                // Text requirements
                if (this.quest.additionalRequirements.Count > 0)
                {
                    List <string> requirementStrings = this.quest.additionalRequirements.ToList();
                    if (this.quest.minlevel > 0)
                    {
                        requirementStrings.Add(String.Format("You must be at least level {0}.", this.quest.minlevel));
                    }

                    y += 5;
                    Regex questRegex = new Regex("\\[([^]]+)\\]");
                    foreach (string text in requirementStrings)
                    {
                        label = new Label();
                        string txt = text;
                        Match  m   = questRegex.Match(txt);
                        label.ForeColor = StyleManager.NotificationTextColor;
                        if (m != null && m.Groups.Count > 1)
                        {
                            string requiredQuestName = m.Groups[1].Value;
                            txt             = txt.Replace(m.Groups[0].Value, requiredQuestName);
                            label.Name      = StorageManager.getQuest(requiredQuestName.ToLower()).GetCommand();
                            label.ForeColor = StyleManager.ClickableLinkColor;
                            label.Click    += MissionButton_Click;
                        }
                        label.Text      = txt == "" ? "" : "- " + txt;
                        label.Location  = new Point(5, y);
                        label.BackColor = Color.Transparent;
                        label.Font      = QuestGuideForm.requirementFont;
                        Size size;
                        using (Graphics gr = Graphics.FromHwnd(label.Handle)) {
                            size       = gr.MeasureString(label.Text, label.Font, this.Size.Width - 50).ToSize();
                            label.Size = new Size(this.Size.Width - 10, (int)(size.Height * 1.2));
                        }
                        this.Controls.Add(label);
                        y += label.Size.Height;
                    }
                }
            }

            if (rewards.Count > 0 || quest.rewardOutfits.Count > 0)
            {
                Label label = new Label();
                label.Text      = "Rewards";
                label.Location  = new Point(40, y);
                label.ForeColor = StyleManager.NotificationTextColor;
                label.BackColor = Color.Transparent;
                label.Font      = questTitle.Font;
                this.Controls.Add(label);
                y += 25;
                if (rewards.Count > 0)
                {
                    List <Control> itemControls = new List <Control>();
                    y = y + UIManager.DisplayCreatureList(this.Controls, rewards, 10, y, this.Size.Width - 10, 1, null, 1, itemControls);
                }
                if (quest.rewardOutfits.Count > 0)
                {
                    List <Control> outfitControls = new List <Control>();

                    List <TibiaObject> rewardOutfits = new List <TibiaObject>();
                    foreach (int reward in quest.rewardOutfits)
                    {
                        Outfit outfit = StorageManager.getOutfit(reward);
                        rewardOutfits.Add(outfit);
                    }

                    y = y + UIManager.DisplayCreatureList(this.Controls, rewardOutfits, 10, y, this.Size.Width - 10, 4, null, 1, outfitControls);
                }
            }
            this.Size = new Size(this.Size.Width, y + 20);

            base.NotificationFinalize();
            this.ResumeLayout(false);
        }
Esempio n. 5
0
        public SimpleLootNotification(Creature cr, List <Tuple <Item, int> > items, string message) : base()
        {
            this.InitializeComponent();
            this.creature = cr;

            this.Size = new Size(SettingsManager.getSettingInt("SimpleNotificationWidth"), this.Size.Height);
            bool showCopyButton = SettingsManager.getSettingBool("SimpleNotificationCopyButton");


            this.InitializeSimpleNotification();

            creatureBox.Click -= c_Click;

            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  max_x = this.Size.Width - creatureBox.Width - (showCopyButton ? 32 : 4);
            int  base_x = 64, base_y = 20;
            int  x            = 0;
            int  y            = 0;
            int  item_spacing = 4;
            Size item_size    = new Size(32, 32);

            List <Tuple <Item, int> > updatedItems = new List <Tuple <Item, int> >();

            foreach (Tuple <Item, int> tpl in items)
            {
                if (tpl.Item1.GetName().ToLower() == "gold coin" && tpl.Item2 > 100)
                {
                    Item platinumCoin = StorageManager.getItem("platinum coin");
                    updatedItems.Add(new Tuple <Item, int>(platinumCoin, tpl.Item2 / 100));
                    updatedItems.Add(new Tuple <Item, int>(tpl.Item1, tpl.Item2 % 100));
                }
                else
                {
                    updatedItems.Add(tpl);
                }
            }
            updatedItems = updatedItems.OrderByDescending(o => o.Item1.GetMaxValue() * o.Item2).ToList();

            x = 0;
            foreach (Tuple <Item, int> tpl in updatedItems)
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (x >= (max_x - item_size.Width - item_spacing))
                    {
                        item_size = new Size(24, 24);
                        x         = 0;
                        base_y    = 4;
                        creatureDropLabel.Visible = false;
                        break;
                    }
                    int mitems = 1;
                    if (item.stackable)
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;

                    x += item_size.Width + item_spacing;
                }
                if (x == 0)
                {
                    break;
                }
            }

            x = 0;
            foreach (Tuple <Item, int> tpl in updatedItems)
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (x >= (max_x - item_size.Width - item_spacing))
                    {
                        x = 0;
                        y = y + item_size.Height + item_spacing;
                    }
                    int mitems = 1;
                    if (item.stackable)
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;

                    PictureBox picture_box = new PictureBox();
                    picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                    picture_box.Name     = item.GetName();
                    picture_box.Size     = new System.Drawing.Size(item_size.Width, item_size.Height);
                    picture_box.TabIndex = 1;
                    picture_box.TabStop  = false;
                    picture_box.Click   += openItem_Click;
                    if (item.stackable)
                    {
                        picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                    }
                    else
                    {
                        picture_box.Image = item.GetImage();
                    }

                    picture_box.SizeMode              = PictureBoxSizeMode.Zoom;
                    picture_box.BackgroundImage       = StyleManager.GetImage("item_background.png");
                    picture_box.BackgroundImageLayout = ImageLayout.Zoom;
                    value_tooltip.SetToolTip(picture_box, item.displayname.ToTitle() + " value: " + Math.Max(item.actual_value, item.vendor_value) * mitems);
                    this.Controls.Add(picture_box);

                    x += item_size.Width + item_spacing;
                }
            }

            Image creatureImage = cr.GetImage();

            if (creatureImage.Size.Width <= creatureBox.Width && creatureImage.Size.Height <= creatureBox.Height)
            {
                creatureBox.SizeMode = PictureBoxSizeMode.CenterImage;
            }
            else
            {
                creatureBox.SizeMode = PictureBoxSizeMode.Zoom;
            }
            this.creatureBox.Image      = cr.GetImage();
            this.creatureDropLabel.Text = String.Format("Loot of {0}.", cr.displayname);

            if (showCopyButton)
            {
                PictureBox copyButton = new PictureBox();
                copyButton.Size      = new Size(32, 32);
                copyButton.BackColor = Color.Transparent;
                copyButton.Location  = new Point(this.Size.Width - copyButton.Size.Width - 4, base_y == 4 ? (this.Size.Height - copyButton.Size.Height) / 2 : base_y);
                copyButton.Click    += CopyLootText;
                copyButton.Name      = message;
                copyButton.Image     = StyleManager.GetImage("copyicon.png");
                copyButton.SizeMode  = PictureBoxSizeMode.Zoom;
                this.Controls.Add(copyButton);
            }
        }
Esempio n. 6
0
        public void RefreshLoot()
        {
            foreach (Control c in createdControls)
            {
                this.Controls.Remove(c);
                c.Dispose();
            }
            createdControls.Clear();
            if (page < 0)
            {
                page = 0;
            }

            int  base_x = 20, base_y = 30;
            int  x = 0, y = 0;
            int  item_spacing = 4;
            Size item_size    = new Size(32, 32);
            int  max_x        = SettingsManager.getSettingInt("LootFormWidth");

            if (max_x < minLootWidth)
            {
                max_x = minLootWidth;
            }
            int width_x = max_x + item_spacing * 2;

            long total_value = 0;
            int  currentPage = 0;
            bool prevPage    = page > 0;
            bool nextPage    = false;

            averageGold = GetAverageGold(creatures);

            foreach (Tuple <Item, int> tpl in items)
            {
                total_value += tpl.Item1.GetMaxValue() * tpl.Item2;
            }
            Dictionary <Item, List <PictureBox> > newItemControls = new Dictionary <Item, List <PictureBox> >();

            foreach (Tuple <Item, int> tpl in items)
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (base_x + x >= (max_x - item_size.Width - item_spacing))
                    {
                        x = 0;
                        if (y + item_size.Height + item_spacing > pageHeight)
                        {
                            currentPage++;
                            if (currentPage > page)
                            {
                                nextPage = true;
                                break;
                            }
                            else
                            {
                                y = 0;
                            }
                        }
                        else
                        {
                            y = y + item_size.Height + item_spacing;
                        }
                    }
                    int mitems = 1;
                    if (item.stackable || SettingsManager.getSettingBool("StackAllItems"))
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;
                    if (currentPage == page)
                    {
                        PictureBox picture_box;
                        if (itemControls.ContainsKey(item))
                        {
                            picture_box = itemControls[item][0];
                            itemControls[item].RemoveAt(0);
                            if (itemControls[item].Count == 0)
                            {
                                itemControls.Remove(item);
                            }
                            picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                            if (picture_box.TabIndex != mitems && (item.stackable || mitems > 1))
                            {
                                picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                            }
                            picture_box.TabIndex = mitems;
                            long individualValue = item.GetMaxValue();
                            value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + (individualValue >= 0 ? (individualValue * mitems).ToString() : "Unknown"));
                        }
                        else
                        {
                            picture_box          = new PictureBox();
                            picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                            picture_box.Name     = item.GetName();
                            picture_box.Size     = new System.Drawing.Size(item_size.Width, item_size.Height);
                            picture_box.TabIndex = mitems;
                            picture_box.TabStop  = false;
                            if (item.stackable || mitems > 1)
                            {
                                picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                            }
                            else
                            {
                                picture_box.Image = item.GetImage();
                            }

                            picture_box.SizeMode        = PictureBoxSizeMode.StretchImage;
                            picture_box.BackgroundImage = StyleManager.GetImage("item_background.png");
                            picture_box.Click          += openItemBox;
                            long individualValue = item.GetMaxValue();
                            value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + (individualValue >= 0 ? (individualValue * mitems).ToString() : "Unknown"));
                            this.Controls.Add(picture_box);
                        }
                        if (!newItemControls.ContainsKey(item))
                        {
                            newItemControls.Add(item, new List <PictureBox>());
                        }
                        newItemControls[item].Add(picture_box);
                    }

                    x += item_size.Width + item_spacing;
                }
                if (currentPage > page)
                {
                    break;
                }
            }
            if (page > currentPage)
            {
                page = currentPage;
                RefreshLoot();
                return;
            }

            foreach (KeyValuePair <Item, List <PictureBox> > kvp in itemControls)
            {
                foreach (PictureBox p in kvp.Value)
                {
                    this.Controls.Remove(p);
                    p.Dispose();
                }
            }
            itemControls = newItemControls;

            y = y + item_size.Height + item_spacing;
            if (prevPage)
            {
                PictureBox prevpage = new PictureBox();
                prevpage.Location  = new Point(10, base_y + y);
                prevpage.Size      = new Size(97, 23);
                prevpage.Image     = StyleManager.GetImage("prevpage.png");
                prevpage.BackColor = Color.Transparent;
                prevpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                prevpage.Click    += Prevpage_Click;
                this.Controls.Add(prevpage);
                createdControls.Add(prevpage);
            }
            if (nextPage)
            {
                PictureBox nextpage = new PictureBox();
                nextpage.Location  = new Point(width_x - 108, base_y + y);
                nextpage.Size      = new Size(98, 23);
                nextpage.BackColor = Color.Transparent;
                nextpage.Image     = StyleManager.GetImage("nextpage.png");
                nextpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                nextpage.Click    += Nextpage_Click;
                this.Controls.Add(nextpage);
                createdControls.Add(nextpage);
            }
            if (prevPage || nextPage)
            {
                y += 23;
            }

            x      = 0;
            base_x = 5;
            Size creature_size = new Size(1, 1);
            Size labelSize     = new Size(1, 1);

            foreach (KeyValuePair <Creature, int> tpl in creatures)
            {
                Creature creature = tpl.Key;
                creature_size.Width  = Math.Max(creature_size.Width, creature.GetImage().Width);
                creature_size.Height = Math.Max(creature_size.Height, creature.GetImage().Height);
            }
            {
                Dictionary <Creature, Tuple <PictureBox, Label> > newCreatureControls = new Dictionary <Creature, Tuple <PictureBox, Label> >();
                int i = 0;
                foreach (Creature cr in creatures.Keys.OrderByDescending(o => creatures[o] * (1 + o.experience)).ToList <Creature>())
                {
                    Creature creature  = cr;
                    int      killCount = creatures[cr];
                    if (x >= max_x - creature_size.Width - item_spacing * 2)
                    {
                        x = 0;
                        y = y + creature_size.Height + 23;
                        if (y > maxCreatureHeight)
                        {
                            break;
                        }
                    }
                    int xoffset = (creature_size.Width - creature.GetImage().Width) / 2;
                    int yoffset = (creature_size.Height - creature.GetImage().Height) / 2;

                    Label      count;
                    PictureBox picture_box;
                    if (creatureControls.ContainsKey(creature))
                    {
                        picture_box = creatureControls[creature].Item1;
                        count       = creatureControls[creature].Item2;
                        creatureControls.Remove(creature);

                        picture_box.Location = new System.Drawing.Point(base_x + x + xoffset, base_y + y + yoffset + (creature_size.Height - creature.GetImage().Height) / 2);
                        count.Location       = new Point(base_x + x + xoffset, base_y + y + creature_size.Height);
                        count.Text           = killCount.ToString() + "x";
                    }
                    else
                    {
                        count           = new Label();
                        count.Text      = killCount.ToString() + "x";
                        count.Font      = loot_font;
                        count.Size      = new Size(1, 10);
                        count.Location  = new Point(base_x + x + xoffset, base_y + y + creature_size.Height);
                        count.AutoSize  = true;
                        count.TextAlign = ContentAlignment.MiddleCenter;
                        count.ForeColor = StyleManager.NotificationTextColor;
                        count.BackColor = Color.Transparent;

                        picture_box           = new PictureBox();
                        picture_box.Location  = new System.Drawing.Point(base_x + x + xoffset, base_y + y + yoffset + (creature_size.Height - creature.GetImage().Height) / 2);
                        picture_box.Name      = creature.GetName();
                        picture_box.Size      = new System.Drawing.Size(creature.GetImage().Width, creature.GetImage().Height);
                        picture_box.TabIndex  = 1;
                        picture_box.TabStop   = false;
                        picture_box.Image     = creature.GetImage();
                        picture_box.SizeMode  = PictureBoxSizeMode.StretchImage;
                        picture_box.Click    += openCreatureDrops;
                        picture_box.BackColor = Color.Transparent;

                        this.Controls.Add(picture_box);
                        this.Controls.Add(count);
                    }
                    int measured_size = (int)count.CreateGraphics().MeasureString(count.Text, count.Font).Width;
                    int width         = Math.Max(measured_size, creature.GetImage().Width);

                    if (width > creature.GetImage().Width)
                    {
                        picture_box.Location = new Point(picture_box.Location.X + (width - creature.GetImage().Width) / 2, picture_box.Location.Y);
                    }
                    else
                    {
                        count.Location = new Point(count.Location.X + (width - measured_size) / 2, count.Location.Y);
                    }
                    newCreatureControls.Add(creature, new Tuple <PictureBox, Label>(picture_box, count));

                    labelSize = count.Size;

                    i++;
                    x += width + xoffset;
                }
                y = y + creature_size.Height + labelSize.Height * 2;
                foreach (KeyValuePair <Creature, Tuple <PictureBox, Label> > kvp in creatureControls)
                {
                    this.Controls.Remove(kvp.Value.Item1);
                    this.Controls.Remove(kvp.Value.Item2);
                    kvp.Value.Item1.Dispose();
                    kvp.Value.Item2.Dispose();
                }
                creatureControls = newCreatureControls;
            }

            long usedItemValue = 0;

            foreach (var tpl in HuntManager.GetUsedItems(hunt))
            {
                usedItemValue += tpl.Item1.GetMaxValue() * tpl.Item2;
            }

            int xPosition = width_x - totalValueValue.Size.Width - 5;

            y = base_y + y + item_spacing + 10;
            huntNameLabel.Text       = hunt.name.ToString();
            totalValueLabel.Location = new Point(5, y);
            totalValueValue.Location = new Point(xPosition, y);
            totalValueValue.Text     = total_value.ToString("N0");
            value_tooltip.SetToolTip(totalValueValue, String.Format("Average gold for these creature kills: {0} gold.", averageGold.ToString("N0")));
            totalExpLabel.Location  = new Point(5, y += 20);
            totalExpValue.Location  = new Point(xPosition, y);
            totalExpValue.Text      = hunt.totalExp.ToString("N0");
            expHourValue.Text       = ScanningManager.lastResults == null ? "-" : ScanningManager.lastResults.expPerHour.ToString("N0");
            expHourLabel.Location   = new Point(5, y += 20);
            expHourValue.Location   = new Point(xPosition, y);
            totalTimeLabel.Location = new Point(5, y += 20);
            totalTimeValue.Location = new Point(xPosition, y);
            usedItemsValue.Text     = usedItemValue.ToString("N0");
            usedItemsLabel.Location = new Point(5, y += 20);
            usedItemsValue.Location = new Point(xPosition, y);
            long profit = total_value - usedItemValue;

            value_tooltip.SetToolTip(usedItemsValue, String.Format(profit > 0 ? "Total Profit: {0} gold" : "Total Waste: {0} gold", profit.ToString("N0")));

            totalTimeValue.Text = TimeToString((long)hunt.totalTime);
            y += 20;


            int widthSize = width_x / 3 - 5;

            lootButton.Size        = new Size(widthSize, lootButton.Size.Height);
            lootButton.Location    = new Point(5, y);
            allLootButton.Size     = new Size(widthSize, lootButton.Size.Height);
            allLootButton.Location = new Point(7 + widthSize, y);
            rawLootButton.Size     = new Size(widthSize, lootButton.Size.Height);
            rawLootButton.Location = new Point(10 + 2 * widthSize, y);

            y += allLootButton.Size.Height + 2;

            huntNameLabel.Size   = new Size(width_x, huntNameLabel.Size.Height);
            this.Size            = new Size(width_x, y + 5);
            lootLarger.Location  = new Point(Size.Width - lootLarger.Size.Width - 4, 4);
            lootSmaller.Location = new Point(Size.Width - 2 * lootLarger.Size.Width - 4, 4);
        }
        public SimpleLootNotification(Creature cr, List <Tuple <Item, int> > items) : base()
        {
            this.InitializeComponent();
            this.creature = cr;

            this.InitializeSimpleNotification();

            creatureBox.Click -= c_Click;

            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  max_x = 300;
            int  base_x = 64, base_y = 20;
            int  x            = 0;
            int  y            = 0;
            int  item_spacing = 4;
            Size item_size    = new Size(32, 32);

            List <Tuple <Item, int> > updatedItems = new List <Tuple <Item, int> >();

            foreach (Tuple <Item, int> tpl in items)
            {
                if (tpl.Item1.GetName().ToLower() == "gold coin" && tpl.Item2 > 100)
                {
                    Item platinumCoin = StorageManager.getItem("platinum coin");
                    updatedItems.Add(new Tuple <Item, int>(platinumCoin, tpl.Item2 / 100));
                    updatedItems.Add(new Tuple <Item, int>(tpl.Item1, tpl.Item2 % 100));
                }
                else
                {
                    updatedItems.Add(tpl);
                }
            }
            updatedItems = updatedItems.OrderByDescending(o => o.Item1.GetMaxValue() * o.Item2).ToList();

            foreach (Tuple <Item, int> tpl in updatedItems)
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (x >= (max_x - item_size.Width - item_spacing))
                    {
                        x = 0;
                        y = y + item_size.Height + item_spacing;
                    }
                    int mitems = 1;
                    if (item.stackable)
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;

                    PictureBox picture_box = new PictureBox();
                    picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                    picture_box.Name     = item.GetName();
                    picture_box.Size     = new System.Drawing.Size(item_size.Width, item_size.Height);
                    picture_box.TabIndex = 1;
                    picture_box.TabStop  = false;
                    picture_box.Click   += openItem_Click;
                    if (item.stackable)
                    {
                        picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                    }
                    else
                    {
                        picture_box.Image = item.GetImage();
                    }

                    picture_box.SizeMode        = PictureBoxSizeMode.StretchImage;
                    picture_box.BackgroundImage = StyleManager.GetImage("item_background.png");
                    value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + Math.Max(item.actual_value, item.vendor_value) * mitems);
                    this.Controls.Add(picture_box);

                    x += item_size.Width + item_spacing;
                }
            }

            Image creatureImage = cr.GetImage();

            if (creatureImage.Size.Width <= creatureBox.Width && creatureImage.Size.Height <= creatureBox.Height)
            {
                creatureBox.SizeMode = PictureBoxSizeMode.CenterImage;
            }
            else
            {
                creatureBox.SizeMode = PictureBoxSizeMode.Zoom;
            }
            this.creatureBox.Image      = cr.GetImage();
            this.creatureDropLabel.Text = String.Format("Loot of {0}.", cr.displayname);
        }
Esempio n. 8
0
        public void RefreshLoot()
        {
            foreach (Control c in createdControls)
            {
                this.Controls.Remove(c);
                c.Dispose();
            }
            createdControls.Clear();
            if (page < 0)
            {
                page = 0;
            }

            int  base_x = 20, base_y = 30;
            int  x = 0, y = 0;
            int  item_spacing = 4;
            Size item_size    = new Size(32, 32);
            int  max_x        = MainForm.mainForm.getSettingInt("LootFormWidth");

            if (max_x < minLootWidth)
            {
                max_x = minLootWidth;
            }
            int width_x = max_x + item_spacing * 2;

            // add a tooltip that displays the actual droprate when you mouseover
            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;
            long total_value = 0;
            int  currentPage = 0;
            bool prevPage    = page > 0;
            bool nextPage    = false;

            averageGold = 0;
            foreach (KeyValuePair <Creature, int> tpl in creatures)
            {
                double average = 0;
                foreach (ItemDrop dr in tpl.Key.itemdrops)
                {
                    Item it = MainForm.getItem(dr.itemid);
                    if (!it.discard && it.GetMaxValue() > 0 && dr.percentage > 0)
                    {
                        average += ((dr.min + dr.max) / 2.0) * (dr.percentage / 100.0) * it.GetMaxValue();
                    }
                }
                Console.WriteLine(average);
                Console.WriteLine(tpl.Value);
                averageGold += (int)(average * tpl.Value);
            }

            foreach (Tuple <Item, int> tpl in items)
            {
                total_value += tpl.Item1.GetMaxValue() * tpl.Item2;
            }
            foreach (Tuple <Item, int> tpl in items)
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (base_x + x >= (max_x - item_size.Width - item_spacing))
                    {
                        x = 0;
                        if (y + item_size.Height + item_spacing > pageHeight)
                        {
                            currentPage++;
                            if (currentPage > page)
                            {
                                nextPage = true;
                                break;
                            }
                            else
                            {
                                y = 0;
                            }
                        }
                        else
                        {
                            y = y + item_size.Height + item_spacing;
                        }
                    }
                    int mitems = 1;
                    if (item.stackable || count > 100)
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;
                    if (currentPage == page)
                    {
                        PictureBox picture_box = new PictureBox();
                        picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                        picture_box.Name     = item.GetName();
                        picture_box.Size     = new System.Drawing.Size(item_size.Width, item_size.Height);
                        picture_box.TabIndex = 1;
                        picture_box.TabStop  = false;
                        if (item.stackable || mitems > 1)
                        {
                            picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                        }
                        else
                        {
                            picture_box.Image = item.GetImage();
                        }

                        picture_box.SizeMode        = PictureBoxSizeMode.StretchImage;
                        picture_box.BackgroundImage = MainForm.item_background;
                        picture_box.Click          += openItemBox;
                        long individualValue = Math.Max(item.actual_value, item.vendor_value);
                        value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + (individualValue >= 0 ? (individualValue * mitems).ToString() : "Unknown"));
                        createdControls.Add(picture_box);
                        this.Controls.Add(picture_box);
                    }

                    x += item_size.Width + item_spacing;
                }
                if (currentPage > page)
                {
                    break;
                }
            }
            if (page > currentPage)
            {
                page = currentPage;
                RefreshLoot();
                return;
            }

            y = y + item_size.Height + item_spacing;
            if (prevPage)
            {
                PictureBox prevpage = new PictureBox();
                prevpage.Location  = new Point(10, base_y + y);
                prevpage.Size      = new Size(97, 23);
                prevpage.Image     = MainForm.prevpage_image;
                prevpage.BackColor = Color.Transparent;
                prevpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                prevpage.Click    += Prevpage_Click;
                this.Controls.Add(prevpage);
                createdControls.Add(prevpage);
            }
            if (nextPage)
            {
                PictureBox nextpage = new PictureBox();
                nextpage.Location  = new Point(width_x - 108, base_y + y);
                nextpage.Size      = new Size(98, 23);
                nextpage.BackColor = Color.Transparent;
                nextpage.Image     = MainForm.nextpage_image;
                nextpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                nextpage.Click    += Nextpage_Click;
                this.Controls.Add(nextpage);
                createdControls.Add(nextpage);
            }
            if (prevPage || nextPage)
            {
                y += 23;
            }

            x      = 0;
            base_x = 5;
            Size creature_size = new Size(1, 1);
            Size labelSize     = new Size(1, 1);

            foreach (KeyValuePair <Creature, int> tpl in creatures)
            {
                Creature creature = tpl.Key;
                creature_size.Width  = Math.Max(creature_size.Width, creature.GetImage().Width);
                creature_size.Height = Math.Max(creature_size.Height, creature.GetImage().Height);
            }
            {
                int i = 0;
                foreach (Creature cr in creatures.Keys.OrderByDescending(o => creatures[o] * (1 + o.experience)).ToList <Creature>())
                {
                    Creature creature  = cr;
                    int      killCount = creatures[cr];
                    if (x >= max_x - creature_size.Width - item_spacing * 2)
                    {
                        x = 0;
                        y = y + creature_size.Height + 23;
                        if (y > maxCreatureHeight)
                        {
                            break;
                        }
                    }
                    int xoffset = (creature_size.Width - creature.GetImage().Width) / 2;
                    int yoffset = (creature_size.Height - creature.GetImage().Height) / 2;

                    Label count = new Label();
                    count.Text      = killCount.ToString() + "x";
                    count.Font      = loot_font;
                    count.Size      = new Size(1, 10);
                    count.Location  = new Point(base_x + x + xoffset, base_y + y + creature_size.Height);
                    count.AutoSize  = true;
                    count.TextAlign = ContentAlignment.MiddleCenter;
                    count.ForeColor = Color.FromArgb(191, 191, 191);
                    count.BackColor = Color.Transparent;

                    int        measured_size = (int)count.CreateGraphics().MeasureString(count.Text, count.Font).Width;
                    int        width         = Math.Max(measured_size, creature.GetImage().Width);
                    PictureBox picture_box   = new PictureBox();
                    picture_box.Location  = new System.Drawing.Point(base_x + x + xoffset, base_y + y + yoffset + (creature_size.Height - creature.GetImage().Height) / 2);
                    picture_box.Name      = creature.GetName();
                    picture_box.Size      = new System.Drawing.Size(creature.GetImage().Width, creature.GetImage().Height);
                    picture_box.TabIndex  = 1;
                    picture_box.TabStop   = false;
                    picture_box.Image     = creature.GetImage();
                    picture_box.SizeMode  = PictureBoxSizeMode.StretchImage;
                    picture_box.Click    += openCreatureDrops;
                    picture_box.BackColor = Color.Transparent;

                    if (width > creature.GetImage().Width)
                    {
                        picture_box.Location = new Point(picture_box.Location.X + (width - creature.GetImage().Width) / 2, picture_box.Location.Y);
                    }
                    else
                    {
                        count.Location = new Point(count.Location.X + (width - measured_size) / 2, count.Location.Y);
                    }

                    labelSize = count.Size;

                    i++;
                    x += width + xoffset;
                    createdControls.Add(picture_box);
                    createdControls.Add(count);
                    this.Controls.Add(picture_box);
                    this.Controls.Add(count);
                }
                y = y + creature_size.Height + labelSize.Height * 2;
            }

            int xPosition = width_x - totalValueValue.Size.Width - 5;

            y = base_y + y + item_spacing + 10;
            huntNameLabel.Text       = hunt.name.ToString();
            totalValueLabel.Location = new Point(5, y);
            totalValueValue.Location = new Point(xPosition, y);
            totalValueValue.Text     = total_value.ToString();
            value_tooltip.SetToolTip(totalValueValue, String.Format("Average gold for these creature kills: {0} gold.", averageGold));
            totalExpLabel.Location  = new Point(5, y += 20);
            totalExpValue.Location  = new Point(xPosition, y);
            totalExpValue.Text      = hunt.totalExp.ToString();
            totalTimeLabel.Location = new Point(5, y += 20);
            totalTimeValue.Location = new Point(xPosition, y);

            long   totalSeconds  = (long)hunt.totalTime;
            string displayString = "";

            if (totalSeconds >= 3600)
            {
                displayString += (totalSeconds / 3600).ToString() + "h ";
                totalSeconds   = totalSeconds % 3600;
            }
            if (totalSeconds >= 60)
            {
                displayString += (totalSeconds / 60).ToString() + "m ";
                totalSeconds   = totalSeconds % 60;
            }
            displayString += totalSeconds.ToString() + "s";

            totalTimeValue.Text = displayString;
            y += 20;


            int widthSize = width_x / 3 - 5;

            lootButton.Size        = new Size(widthSize, lootButton.Size.Height);
            lootButton.Location    = new Point(5, y);
            allLootButton.Size     = new Size(widthSize, lootButton.Size.Height);
            allLootButton.Location = new Point(7 + widthSize, y);
            rawLootButton.Size     = new Size(widthSize, lootButton.Size.Height);
            rawLootButton.Location = new Point(10 + 2 * widthSize, y);

            y += allLootButton.Size.Height + 2;

            huntNameLabel.Size   = new Size(width_x, huntNameLabel.Size.Height);
            this.Size            = new Size(width_x, y + 5);
            lootLarger.Location  = new Point(Size.Width - lootLarger.Size.Width - 4, 4);
            lootSmaller.Location = new Point(Size.Width - 2 * lootLarger.Size.Width - 4, 4);
        }
Esempio n. 9
0
        private PictureBox CreateItemList(List <Tuple <Item, int> > items, int x, ref int y, List <Control> controls, int imageHeight, List <ItemRegion> newRegions = null, int boxIndex = 0)
        {
            Image image = new Bitmap(BlockWidth, imageHeight);

            using (Graphics gr = Graphics.FromImage(image)) {
                int counter = 0;
                foreach (Tuple <Item, int> item in items)
                {
                    Rectangle region = new Rectangle(x + (counter++) * (imageHeight + 1), 0, imageHeight - 1, imageHeight - 1);
                    if (newRegions != null)
                    {
                        newRegions.Add(new ItemRegion {
                            item = item.Item1, region = region
                        });
                    }
                    RenderImageResized(gr, StyleManager.GetImage("item_background.png"), region);
                    RenderImageResized(gr, (item.Item1.stackable || item.Item2 > 1) ? LootDropForm.DrawCountOnItem(item.Item1, item.Item2) : item.Item1.GetImage(), region);
                }
            }
            PictureBox box = new PictureBox();

            box.Size      = image.Size;
            box.BackColor = Color.Transparent;
            box.Location  = new Point(x, y);
            box.Image     = image;
            box.Name      = boxIndex.ToString();
            this.Controls.Add(box);
            controls.Add(box);
            y += box.Height;
            return(box);
        }
Esempio n. 10
0
        public Image RecentDropsBox(Creature creature, List <Tuple <Item, int> > items, int imageHeight, List <ItemRegion> regions)
        {
            Bitmap bitmap = new Bitmap(BlockWidth, imageHeight);

            using (Graphics gr = Graphics.FromImage(bitmap)) {
                using (Brush brush = new SolidBrush(StyleManager.MainFormButtonColor)) {
                    gr.FillRectangle(brush, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
                }
                gr.DrawRectangle(Pens.Black, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1));
                Rectangle creatureRegion = new Rectangle(1, 1, imageHeight - 1, imageHeight - 1);
                RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, imageHeight - 2, imageHeight - 2));
                RenderImageResized(gr, creature.GetImage(), creatureRegion);
                regions.Add(new ItemRegion {
                    item = creature, region = creatureRegion
                });
                int count = 0;
                foreach (Tuple <Item, int> item in items)
                {
                    Rectangle region = new Rectangle(8 + (imageHeight - 1) * ++count, 1, imageHeight - 2, imageHeight - 2);
                    regions.Add(new ItemRegion {
                        item = item.Item1, region = region
                    });
                    RenderImageResized(gr, StyleManager.GetImage("item_background.png"), region);
                    RenderImageResized(gr, (item.Item1.stackable || item.Item2 > 1) ? LootDropForm.DrawCountOnItem(item.Item1, item.Item2) : item.Item1.GetImage(), region);
                }
            }
            return(bitmap);
        }
Esempio n. 11
0
        private void CreateItemList(List <Tuple <Item, int> > items, int x, ref int y, List <Control> controls)
        {
            Image image = new Bitmap(ImageWidth, ImageHeight);

            using (Graphics gr = Graphics.FromImage(image)) {
                int counter = 0;
                foreach (Tuple <Item, int> item in items)
                {
                    Rectangle region = new Rectangle(x + (counter++) * (ImageHeight + 1), 0, ImageHeight - 1, ImageHeight - 1);
                    RenderImageResized(gr, StyleManager.GetImage("item_background.png"), region);
                    RenderImageResized(gr, (item.Item1.stackable || item.Item2 > 1) ? LootDropForm.DrawCountOnItem(item.Item1, item.Item2) : item.Item1.GetImage(), region);
                }
            }
            PictureBox box = new PictureBox();

            box.Size      = image.Size;
            box.BackColor = Color.Transparent;
            box.Location  = new Point(x, y);
            box.Image     = image;
            this.Controls.Add(box);
            controls.Add(box);
            y += box.Height;
        }
Esempio n. 12
0
        public SimpleLootNotification(Creature cr, List <Tuple <Item, int> > items) : base()
        {
            this.InitializeComponent();
            this.creature = cr;

            this.InitializeSimpleNotification();

            creatureBox.Click -= c_Click;

            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  max_x = 300;
            int  base_x = 64, base_y = 20;
            int  x            = 0;
            int  y            = 0;
            int  item_spacing = 4;
            Size item_size    = new Size(32, 32);

            List <Tuple <Item, int> > updatedItems = new List <Tuple <Item, int> >();

            foreach (Tuple <Item, int> tpl in items)
            {
                if (tpl.Item1.GetName().ToLower() == "gold coin" && tpl.Item2 > 100)
                {
                    Item platinumCoin = MainForm.getItem("platinum coin");
                    updatedItems.Add(new Tuple <Item, int>(platinumCoin, tpl.Item2 / 100));
                    updatedItems.Add(new Tuple <Item, int>(tpl.Item1, tpl.Item2 % 100));
                }
                else
                {
                    updatedItems.Add(tpl);
                }
            }

            foreach (Tuple <Item, int> tpl in updatedItems)
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (x >= (max_x - item_size.Width - item_spacing))
                    {
                        x = 0;
                        y = y + item_size.Height + item_spacing;
                    }
                    int mitems = 1;
                    if (item.stackable)
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;

                    PictureBox picture_box = new PictureBox();
                    picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                    picture_box.Name     = item.GetName();
                    picture_box.Size     = new System.Drawing.Size(item_size.Width, item_size.Height);
                    picture_box.TabIndex = 1;
                    picture_box.TabStop  = false;
                    picture_box.Click   += openItem_Click;
                    if (item.stackable)
                    {
                        /*
                         * Bitmap image = LootDropForm.GetStackImage(item.image, mitems, item);
                         * Graphics gr = Graphics.FromImage(image);
                         * int numbers = (int)Math.Floor(Math.Log(mitems, 10)) + 1;
                         * int xoffset = 1, logamount = mitems;
                         * for (int i = 0; i < numbers; i++) {
                         *  int imagenr = logamount % 10;
                         *  xoffset = xoffset + MainForm.image_numbers[imagenr].Width + 1;
                         *  gr.DrawImage(MainForm.image_numbers[imagenr],
                         *      new Point(image.Width - xoffset, image.Height - MainForm.image_numbers[imagenr].Height - 3));
                         *  logamount /= 10;
                         * }*/
                        picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                    }
                    else
                    {
                        picture_box.Image = item.GetImage();
                    }

                    picture_box.SizeMode        = PictureBoxSizeMode.StretchImage;
                    picture_box.BackgroundImage = MainForm.item_background;
                    value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + Math.Max(item.actual_value, item.vendor_value) * mitems);
                    this.Controls.Add(picture_box);

                    x += item_size.Width + item_spacing;
                }
            }

            this.creatureBox.Image      = cr.GetImage();
            this.creatureDropLabel.Text = String.Format("Loot of {0}.", cr.displayname);
        }