Exemplo n.º 1
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);
                    RenderItemCount(gr, item, region);
                }
            }
            return(bitmap);
        }
Exemplo n.º 2
0
        public override void LoadForm()
        {
            this.SuspendForm();
            this.NotificationInitialize();
            huntLabel.Click      -= c_Click;
            creatureLabel.Click  -= c_Click;
            bossNameLabel.Click  -= c_Click;
            bossPictureBox.Click -= c_Click;
            mapUpLevel.Click     -= c_Click;
            mapDownLevel.Click   -= c_Click;
            mapUpLevel.Image      = StyleManager.GetImage("mapup.png");
            mapDownLevel.Image    = StyleManager.GetImage("mapdown.png");
            mapBox.MapUpdated    += MapBox_MapUpdated;

            pointsLabel.Text = task.taskpoints > 0 ? task.taskpoints.ToString() : "-";
            countLabel.Text  = task.count.ToString();
            taskName.Text    = task.GetName();
            Creature boss = task.GetBoss();

            if (boss != null)
            {
                bossNameLabel.Text   = boss.GetName();
                bossPictureBox.Image = boss.GetImage();
                mapBox.targets.Add(new Target {
                    coordinate = new Coordinate(task.bossposition), image = boss.GetImage(), size = 24
                });
            }
            else
            {
                bossNameLabel.Visible  = false;
                bossPictureBox.Visible = false;
                bossInfoLabel.Visible  = false;
            }
            mapBox.mapCoordinate = new Coordinate(task.bossposition);
            mapBox.map           = StorageManager.getMap(task.bossposition.z);
            mapBox.sourceWidth   = mapBox.Width;
            mapBox.Click        -= c_Click;
            mapBox.UpdateMap();
            taskGroupLabel.Text = task.groupname;
            baseWidth           = this.Size.Width;
            baseHeight          = this.Size.Height;
            refreshAttributes();

            this.NotificationFinalize();
            this.ResumeForm();
        }
Exemplo n.º 3
0
        public Image GetDangerImage()
        {
            Creature cr = GetDangerCreature();

            if (cr != null)
            {
                return(cr.GetImage());
            }
            return(null);
        }
Exemplo n.º 4
0
        public Image CreatureBox(Creature creature, int amount = 0)
        {
            Bitmap bitmap = new Bitmap(BlockWidth, BlockHeight);

            using (Graphics gr = Graphics.FromImage(bitmap)) {
                Color backColor = StyleManager.GetElementColor(creature.GetStrength());
                using (Brush brush = new SolidBrush(backColor)) {
                    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));
                RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2));
                RenderImageResized(gr, creature.GetImage(), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2));
                RenderText(gr, creature.displayname.ToTitle(), BlockHeight + 2, Color.Empty, StyleManager.NotificationTextColor, Color.Black, BlockHeight);
                if (amount > 0)
                {
                    RenderText(gr, amount.ToString(), -BlockWidth, Color.FromArgb(backColor.R / 2, backColor.G / 2, backColor.B / 2), StyleManager.NotificationTextColor, Color.Black, BlockHeight);
                }
            }
            return(bitmap);
        }
Exemplo n.º 5
0
        public Image RecentDropsBox(Creature creature, List <Tuple <Item, int> > items)
        {
            Bitmap bitmap = new Bitmap(ImageWidth, 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));
                RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, ImageHeight - 2, ImageHeight - 2));
                RenderImageResized(gr, creature.GetImage(), new Rectangle(1, 1, ImageHeight - 1, ImageHeight - 1));
                int count = 0;
                foreach (Tuple <Item, int> item in items)
                {
                    Rectangle region = new Rectangle(8 + (ImageHeight - 1) * ++count, 1, ImageHeight - 2, ImageHeight - 2);
                    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);
        }
Exemplo n.º 6
0
        public override void LoadForm()
        {
            this.SuspendForm();
            int horizontal, left, right;

            this.statsButton.Name = creature.GetName().ToLower();
            this.huntButton.Name  = creature.GetName().ToLower();
            int health     = creature.health;
            int experience = creature.experience;
            List <Resistance> resistances = new List <Resistance>();

            resistances.Add(new Resistance("Ice", creature.res_ice));
            resistances.Add(new Resistance("Holy", creature.res_holy));
            resistances.Add(new Resistance("Death", creature.res_death));
            resistances.Add(new Resistance("Phys", creature.res_phys));
            resistances.Add(new Resistance("Earth", creature.res_earth));
            resistances.Add(new Resistance("Energy", creature.res_energy));
            resistances.Add(new Resistance("Fire", creature.res_fire));
            // load image from the creature
            this.mainImage.Image = creature.GetImage();
            // set health of creature
            this.healthLabel.Text = (health > 0 ? health.ToString() + " Health" : "Unknown");
            horizontal            = 96 - healthLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.healthLabel.Padding = new Padding(left, 2, right, 2);
            // set exp of creature
            this.expLabel.Text = (experience >= 0 ? experience.ToString() : "Unknown") + " Exp";
            horizontal         = 96 - expLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.expLabel.Padding = new Padding(left, 2, right, 2);
            // add resistances of creature in order
            AddResistances(resistances);
            // set background of actual form to transparent
            this.BackColor = MainForm.background_color;
            this.Opacity   = MainForm.opacity;
            if (MainForm.transparent)
            {
                this.TransparencyKey = MainForm.background_color;
                this.Opacity         = 1;
            }
            this.nameLabel.Text = MainForm.ToTitle(this.creature.displayname);
            Font f        = MainForm.fontList[0];
            Font prevFont = f;

            for (int i = 0; i < MainForm.fontList.Count; i++)
            {
                Font font  = MainForm.fontList[i];
                int  width = TextRenderer.MeasureText(this.nameLabel.Text, font).Width;
                if (width < this.mainImage.Size.Width)
                {
                    f = prevFont;
                }
                else
                {
                    break;
                }
                prevFont = font;
            }

            string goldstring  = "";
            double averageGold = 0;

            foreach (ItemDrop itemDrop in creature.itemdrops)
            {
                if (itemDrop.percentage > 0)
                {
                    Item item = MainForm.getItem(itemDrop.itemid);
                    averageGold += ((itemDrop.max + itemDrop.min) / 2.0) * itemDrop.percentage * item.GetMaxValue() / 100;
                }
            }
            if (averageGold < 10000)
            {
                goldstring = ((long)averageGold).ToString();
            }
            else if (averageGold < 1000000)
            {
                goldstring = ((long)averageGold / 1000).ToString() + "K";
            }
            else
            {
                goldstring = ((long)averageGold / 1000000).ToString() + "M";
            }
            this.averageGoldLabel.Text = "Average Gold: " + goldstring;

            this.maxDamageLabel.Text        = "Max Damage: " + (this.creature.maxdamage >= 0 ? this.creature.maxdamage.ToString() : "-");
            this.abilitiesLabel.Text        = RemoveTextInBrackets(this.creature.abilities.Replace(", ", "\n"));
            this.abilitiesLabel.BorderStyle = BorderStyle.FixedSingle;

            string tooltip;

            this.illusionableBox.Image = creature.illusionable ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.illusionable ? "Creature illusion works for this creature." : "Creature illusion does not work for this creature.";
            resistance_tooltip.SetToolTip(illusionableBox, tooltip);
            resistance_tooltip.SetToolTip(illusionableLabel, tooltip);
            this.summonableBox.Image = creature.summoncost > 0 ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.summoncost > 0 ? "This creature can be summoned for " + creature.summoncost + " mana." : "This creature cannot be summoned.";
            resistance_tooltip.SetToolTip(summonableBox, tooltip);
            resistance_tooltip.SetToolTip(summonableLabel, tooltip);
            this.invisibleBox.Image = !creature.senseinvis ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = !creature.senseinvis ? "This creature does not detect invisibility." : "This creature detects invisibility.";
            resistance_tooltip.SetToolTip(invisibleBox, tooltip);
            resistance_tooltip.SetToolTip(invisibleLabel, tooltip);
            this.paralysableBox.Image = creature.paralysable ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.paralysable ? "This creature can be paralysed." : "This creature cannot be paralysed.";
            resistance_tooltip.SetToolTip(paralysableBox, tooltip);
            resistance_tooltip.SetToolTip(paralysableLabel, tooltip);
            this.pushableBox.Image = creature.pushable ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.pushable ? "This creature can be pushed." : "This creature cannot be pushed.";
            resistance_tooltip.SetToolTip(pushableBox, tooltip);
            resistance_tooltip.SetToolTip(pushableLabel, tooltip);
            this.pushesBox.Image = creature.pushes ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.pushes ? "This creature pushes smaller creatures." : "This creature cannot push smaller creatures.";
            resistance_tooltip.SetToolTip(pushesBox, tooltip);
            resistance_tooltip.SetToolTip(pushesLabel, tooltip);

            this.Size           = new Size(this.Size.Width, (int)Math.Max(this.abilitiesLabel.Location.Y + this.abilitiesLabel.Size.Height + 10, this.expLabel.Location.Y + this.expLabel.Height + 10));
            this.nameLabel.Font = f;
            this.nameLabel.Left = this.mainImage.Left + (mainImage.Width - this.nameLabel.Size.Width) / 2;
            base.NotificationInitialize();

            List <Task> involvedTasks = new List <Task>();

            foreach (KeyValuePair <string, List <Task> > kvp in MainForm.taskList)
            {
                foreach (Task t in kvp.Value)
                {
                    if (t.bossid == creature.id)
                    {
                        involvedTasks.Add(t);
                    }
                    foreach (int cr in t.creatures)
                    {
                        if (cr == creature.id)
                        {
                            involvedTasks.Add(t);
                        }
                    }
                }
            }
            if (involvedTasks.Count > 0)
            {
                int baseY    = this.Size.Height;
                int newWidth = 0;
                int y        = MainForm.DisplayCreatureAttributeList(Controls, involvedTasks.ToList <TibiaObject>(), 10, baseY, out newWidth);
                this.Size = new Size(Math.Max(newWidth, Size.Width), baseY + y);
            }

            base.NotificationFinalize();
            this.ResumeForm();
        }
Exemplo n.º 7
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: " + item.GetMaxValue() * 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);
            }
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
        private int drawDirections(Coordinate begin, Coordinate end, string settings, string description, int start_x, int y, bool variableSize, int imageCount, bool noText, out int width)
        {
            int  mapSize = this.Size.Width / 2;
            Size minSize = new Size(mapSize, mapSize);

            List <Color>  additionalWalkableColors = new List <Color>();
            List <Target> targetList = new List <Target>();

            // parse settings
            if (settings != null)
            {
                string[] splits = settings.ToLower().Split('@');
                foreach (string split in splits)
                {
                    string[] setting = split.Split('=');
                    switch (setting[0])
                    {
                    case "walkablecolor":
                        string[] rgb = setting[1].Split(',');
                        additionalWalkableColors.Add(Color.FromArgb(int.Parse(rgb[0]), int.Parse(rgb[1]), int.Parse(rgb[2])));
                        break;

                    case "marking":
                        Target   target     = new Target();
                        string[] coordinate = setting[1].Split(',');
                        target.size       = 12;
                        target.image      = StyleManager.GetImage("cross.png");
                        target.coordinate = new Coordinate(int.Parse(coordinate[0]), int.Parse(coordinate[1]), int.Parse(coordinate[2]));
                        targetList.Add(target);
                        break;

                    case "markicon":
                        Image image = null;
                        switch (setting[1].ToLower())
                        {
                        case "item":
                            image = StorageManager.getItem(setting[2]).image;
                            break;

                        case "npc":
                            image = StorageManager.getNPC(setting[2]).image;
                            break;

                        case "cr":
                            image = StorageManager.getCreature(setting[2]).image;
                            break;

                        case "spell":
                            image = StorageManager.getSpell(setting[2]).image;
                            break;

                        case "object":
                            image = StorageManager.getWorldObject(setting[2]).image;
                            break;

                        default:
                            throw new Exception("Unknown image type " + setting[1] + ".");
                        }
                        targetList[targetList.Count - 1].image = image;
                        break;

                    case "marksize":
                        targetList[targetList.Count - 1].size = int.Parse(setting[1]);
                        break;
                    }
                }
            }
            if (targetList.Count == 0)
            {
                targetList = null;
            }

            MapPictureBox map = UIManager.DrawRoute(begin, end, variableSize ? new Size(0, 0) : new Size(mapSize, mapSize), minSize, new Size(mapSize, mapSize), additionalWalkableColors, targetList);

            width = map.Width + 5;
            if (!noText)
            {
                map.Location = new Point(this.Size.Width - (map.Width + 5), y);
            }
            else
            {
                map.Location = new Point(start_x, y);
            }
            map.MapUpdated += refreshTimer;
            this.Controls.Add(map);
            addedControls.Add(map);
            if (noText)
            {
                return(y + map.Height + 5);
            }
            if (description.Contains("@"))
            {
                int      x = 5;
                int      minheightoffset = 20;
                string[] questStrings    = description.Split('@');
                int      minY            = y + map.Size.Height + 10;
                foreach (string instruction in questStrings)
                {
                    if (instruction == "")
                    {
                        y += 10;
                        continue;
                    }
                    if (instruction.Contains("="))
                    {
                        string[] splits = instruction.Split('=');
                        if (splits[0].ToLower() == "cr" || splits[0].ToLower() == "npc" || splits[0].ToLower() == "item")
                        {
                            bool   blockWidth  = true;
                            string imageString = splits[1];
                            if (splits[1].Contains(';'))
                            {
                                string[] options = splits[1].Split(';');
                                imageString = options[0];
                                for (int i = 1; i < options.Length; i++)
                                {
                                    if (options[i].ToLower() == "blockheight")
                                    {
                                        blockWidth = false;
                                    }
                                }
                            }
                            string command = "";
                            Image  image   = null;
                            if (splits[0].ToLower() == "cr")
                            {
                                Creature cr = StorageManager.getCreature(imageString);
                                image   = cr.GetImage();
                                command = "creature" + Constants.CommandSymbol + cr.GetName().ToLower();
                            }
                            else if (splits[0].ToLower() == "npc")
                            {
                                NPC npc = StorageManager.getNPC(imageString);
                                image   = npc.GetImage();
                                command = "npc" + Constants.CommandSymbol + npc.GetName().ToLower();
                            }
                            else if (splits[0].ToLower() == "item")
                            {
                                Item item = StorageManager.getItem(imageString);
                                image   = item.GetImage();
                                command = "item" + Constants.CommandSymbol + item.GetName().ToLower();
                            }
                            PictureBox pictureBox = new PictureBox();
                            pictureBox.Location  = new Point(x, y);
                            pictureBox.Image     = image;
                            pictureBox.SizeMode  = PictureBoxSizeMode.Zoom;
                            pictureBox.Size      = new Size(image.Width, image.Height);
                            pictureBox.BackColor = Color.Transparent;
                            pictureBox.Name      = command;
                            pictureBox.Click    += QuestTitle_Click;
                            if (blockWidth)
                            {
                                x += pictureBox.Size.Width;
                                minheightoffset = pictureBox.Size.Height + 5;
                            }
                            else
                            {
                                y += pictureBox.Size.Height;
                            }

                            addedControls.Add(pictureBox);
                            this.Controls.Add(pictureBox);
                            continue;
                        }
                    }
                    Label label = new Label();
                    label.Location    = new Point(x, y);
                    label.ForeColor   = StyleManager.NotificationTextColor;
                    label.BackColor   = Color.Transparent;
                    label.Font        = requirementFont;
                    label.AutoSize    = true;
                    label.MaximumSize = new Size(this.Size.Width - (map.Size.Width) - x, 0);
                    string labelText = CreateLinks(label, instruction);
                    label.Text = labelText == "" ? "" : "- " + labelText;

                    int labelHeight = 0;
                    using (Graphics gr = Graphics.FromHwnd(label.Handle)) {
                        labelHeight = (int)(gr.MeasureString(label.Text, label.Font, this.Size.Width - (map.Size.Width + 10) - x, StringFormat.GenericTypographic).Height * 1.2);
                    }
                    addedControls.Add(label);
                    this.Controls.Add(label);
                    y += Math.Max(labelHeight, minheightoffset);
                    minheightoffset = 0;
                    x = 5;
                }
                if (y < minY)
                {
                    y = minY;
                }
            }
            else
            {
                Label label = new Label();
                label.Location  = new Point(5, y);
                label.ForeColor = StyleManager.NotificationTextColor;
                label.BackColor = Color.Transparent;
                label.Font      = requirementFont;
                string labelText = CreateLinks(label, description);
                label.Text = labelText == "" ? "" : "- " + labelText;
                Size size;
                using (Graphics gr = Graphics.FromHwnd(label.Handle)) {
                    size       = gr.MeasureString(label.Text, label.Font, this.Size.Width - (map.Size.Width + 10)).ToSize();
                    label.Size = new Size(this.Size.Width - (map.Size.Width + 5), Math.Max((int)(size.Height * 1.3), map.Size.Height));
                }
                addedControls.Add(label);
                this.Controls.Add(label);
                y += Math.Max(label.Size.Height, map.Size.Height) + 10;
            }
            return(y);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public override void LoadForm()
        {
            this.SuspendForm();
            int horizontal, left, right;

            this.statsButton.Name = creature.GetName().ToLower();
            this.huntButton.Name  = creature.GetName().ToLower();
            int health     = creature.health;
            int experience = creature.experience;
            List <Resistance> resistances = new List <Resistance>();

            resistances.Add(new Resistance("Ice", creature.res_ice));
            resistances.Add(new Resistance("Holy", creature.res_holy));
            resistances.Add(new Resistance("Death", creature.res_death));
            resistances.Add(new Resistance("Phys", creature.res_phys));
            resistances.Add(new Resistance("Earth", creature.res_earth));
            resistances.Add(new Resistance("Energy", creature.res_energy));
            resistances.Add(new Resistance("Fire", creature.res_fire));
            // load image from the creature
            this.mainImage.Image = creature.GetImage();
            // set health of creature
            this.healthLabel.Text = (health > 0 ? health.ToString() + " Health" : "Unknown");
            horizontal            = 96 - healthLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.healthLabel.Padding = new Padding(left, 2, right, 2);
            // set exp of creature
            this.expLabel.Text = (experience >= 0 ? experience.ToString() : "Unknown") + " Exp";
            horizontal         = 96 - expLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.expLabel.Padding = new Padding(left, 2, right, 2);
            // add resistances of creature in order
            AddResistances(resistances);
            // set background of actual form to transparent
            this.BackColor      = StyleManager.NotificationBackgroundColor;
            this.nameLabel.Text = this.creature.displayname.ToTitle();
            Font f        = StyleManager.FontList[0];
            Font prevFont = f;

            for (int i = 0; i < StyleManager.FontList.Count; i++)
            {
                Font font  = StyleManager.FontList[i];
                int  width = TextRenderer.MeasureText(this.nameLabel.Text, font).Width;
                if (width < this.mainImage.Size.Width)
                {
                    f = prevFont;
                }
                else
                {
                    break;
                }
                prevFont = font;
            }

            string goldstring  = "";
            double averageGold = 0;

            foreach (ItemDrop itemDrop in creature.itemdrops)
            {
                if (itemDrop.percentage > 0)
                {
                    Item item = StorageManager.getItem(itemDrop.itemid);
                    averageGold += ((itemDrop.max + itemDrop.min) / 2.0) * itemDrop.percentage * item.GetMaxValue() / 100;
                }
            }
            goldstring = StyleManager.GoldToText((long)averageGold);
            this.averageGoldLabel.Text = "Average Gold: " + goldstring;

            this.maxDamageLabel.Text        = "Max Damage: " + (this.creature.maxdamage >= 0 ? this.creature.maxdamage.ToString() : "-");
            this.abilitiesLabel.Text        = RemoveTextInBrackets(this.creature.abilities.Replace(", ", "\n"));
            this.abilitiesLabel.BorderStyle = BorderStyle.FixedSingle;

            // average gold of creature
            this.averageGoldCenterLabel.Text = goldstring.Replace("Average Gold:", "") + " Gold";
            horizontal = 96 - averageGoldCenterLabel.Size.Width;
            left       = horizontal / 2;
            right      = horizontal - left;
            this.averageGoldCenterLabel.Padding = new Padding(left, 2, right, 2);
            // max damage of creature
            this.maxDamageCenterLabel.Text = (this.creature.maxdamage > 0 ? this.creature.maxdamage.ToString() + " Dmg" : "Unknown");
            horizontal = 96 - maxDamageCenterLabel.Size.Width;
            left       = horizontal / 2;
            right      = horizontal - left;
            this.maxDamageCenterLabel.Padding   = new Padding(left, 2, right, 2);
            this.maxDamageCenterLabel.ForeColor = StyleManager.MainFormSmallDangerColor;

            string tooltip;

            this.illusionableBox.Image = creature.illusionable ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.illusionable ? "Creature illusion works for this creature." : "Creature illusion does not work for this creature.";
            resistance_tooltip.SetToolTip(illusionableBox, tooltip);
            resistance_tooltip.SetToolTip(illusionableLabel, tooltip);
            this.summonableBox.Image = creature.summoncost > 0 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.summoncost > 0 ? "This creature can be summoned for " + creature.summoncost + " mana." : "This creature cannot be summoned.";
            resistance_tooltip.SetToolTip(summonableBox, tooltip);
            resistance_tooltip.SetToolTip(summonableLabel, tooltip);
            this.invisibleBox.Image = !creature.senseinvis ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = !creature.senseinvis ? "This creature does not detect invisibility." : "This creature detects invisibility.";
            resistance_tooltip.SetToolTip(invisibleBox, tooltip);
            resistance_tooltip.SetToolTip(invisibleLabel, tooltip);
            this.paralysableBox.Image = creature.paralysable ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.paralysable ? "This creature can be paralysed." : "This creature cannot be paralysed.";
            resistance_tooltip.SetToolTip(paralysableBox, tooltip);
            resistance_tooltip.SetToolTip(paralysableLabel, tooltip);
            this.pushableBox.Image = creature.pushable ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.pushable ? "This creature can be pushed." : "This creature cannot be pushed.";
            resistance_tooltip.SetToolTip(pushableBox, tooltip);
            resistance_tooltip.SetToolTip(pushableLabel, tooltip);
            this.pushesBox.Image = creature.pushes ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.pushes ? "This creature pushes smaller creatures." : "This creature cannot push smaller creatures.";
            resistance_tooltip.SetToolTip(pushesBox, tooltip);
            resistance_tooltip.SetToolTip(pushesLabel, tooltip);

            this.Size           = new Size(this.Size.Width, (int)Math.Max(this.abilitiesLabel.Location.Y + this.abilitiesLabel.Size.Height + 10, this.expLabel.Location.Y + this.expLabel.Height + 10));
            this.nameLabel.Font = f;
            this.nameLabel.Left = this.mainImage.Left + (mainImage.Width - this.nameLabel.Size.Width) / 2;
            base.NotificationInitialize();
            RefreshTaskList(this.Size.Height);
            base.NotificationFinalize();
            this.RefreshForm();
            this.ResumeForm();
        }
Exemplo n.º 12
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);
             RenderItemCount(gr, item, region);
         }
     }
     return bitmap;
 }
Exemplo n.º 13
0
 public Image CreatureBox(Creature creature, int amount = 0)
 {
     Bitmap bitmap = new Bitmap(BlockWidth, BlockHeight);
     using (Graphics gr = Graphics.FromImage(bitmap)) {
         Color backColor = StyleManager.GetElementColor(creature.GetStrength());
         using (Brush brush = new SolidBrush(backColor)) {
             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));
         RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2));
         RenderImageResized(gr, creature.GetImage(), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2));
         RenderText(gr, creature.displayname.ToTitle(), BlockHeight + 2, Color.Empty, StyleManager.NotificationTextColor, Color.Black, BlockHeight);
         if (amount > 0) {
             RenderText(gr, amount.ToString(), -BlockWidth, Color.FromArgb(backColor.R / 2, backColor.G / 2, backColor.B / 2), StyleManager.NotificationTextColor, Color.Black, BlockHeight);
         }
     }
     return bitmap;
 }
Exemplo n.º 14
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 = 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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
        public override Image GetImage()
        {
            Creature cr = StorageManager.getCreature(creatures[0]);

            return(cr.GetImage());
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
0
        public override Image GetImage()
        {
            Creature cr = MainForm.getCreature(creatures[0]);

            return(cr.GetImage());
        }
Exemplo n.º 19
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 = 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);
        }
Exemplo n.º 20
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);
        }