GetImage() public static method

public static GetImage ( string name ) : Image
name string
return Image
示例#1
0
        public static Bitmap DrawCountOnItem(Item item, int itemCount)
        {
            Bitmap image;

            if (item.stackable)
            {
                try {
                    image = new Bitmap(LootDropForm.GetStackImage(item.image, itemCount, item));
                } catch {
                    image = new Bitmap(item.image);
                }
            }
            else
            {
                image = new Bitmap(item.image);
            }

            using (Graphics gr = Graphics.FromImage(image)) {
                int numbers = (int)Math.Floor(Math.Log(itemCount, 10)) + 1;
                int xoffset = 1, logamount = itemCount;
                for (int i = 0; i < numbers; i++)
                {
                    int   imagenr     = logamount % 10;
                    Image imageNumber = StyleManager.GetImage(imagenr + ".png");
                    xoffset = xoffset + imageNumber.Width + (itemCount >= 1000 ? 0 : 1);
                    lock (imageNumber) {
                        gr.DrawImage(imageNumber, new Point(image.Width - xoffset, image.Height - imageNumber.Height - 3));
                    }
                    logamount /= 10;
                }
            }
            return(image);
        }
示例#2
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);
        }
示例#3
0
        private void languageBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (MainForm.prevent_settings_update)
            {
                return;
            }

            switch ((sender as PrettyDropDownList).SelectedIndex)
            {
            case 0:
                languageImageBox.Image = StyleManager.GetImage("flag-usa.png");
                MainForm.mainForm.ChangeLanguage("en-US");
                break;

            case 1:
                languageImageBox.Image = StyleManager.GetImage("flag-nl.png");
                MainForm.mainForm.ChangeLanguage("nl-NL");
                break;

            case 2:
                languageImageBox.Image = StyleManager.GetImage("flag-pl.png");
                MainForm.mainForm.ChangeLanguage("pl-PL");
                break;

            case 3:
                languageImageBox.Image = StyleManager.GetImage("flag-br.png");
                MainForm.mainForm.ChangeLanguage("pt-BR");
                break;

            default:
                break;
            }
        }
示例#4
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);
                    RenderItemCount(gr, item, 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);
        }
示例#5
0
        public override void LoadForm()
        {
            this.SuspendForm();
            base.NotificationInitialize();

            this.cityNameLabel.Text = city.name.ToTitle();
            mapBox             = UIManager.DrawRoute(city.location, new Coordinate(-1, -1, mapSize.Width), mapSize, mapSize, mapSize, new List <Color>(), new List <Target>());
            mapBox.Location    = new Point(5, cityNameLabel.Location.Y + cityNameLabel.Height);
            mapBox.MapUpdated += ResetTimer;
            this.Controls.Add(mapBox);

            baseHeight = this.Size.Height;
            RefreshForm();

            npcButton.Click         -= c_Click;
            utilityButton.Click     -= c_Click;
            huntButton.Click        -= c_Click;
            questButton.Click       -= c_Click;
            nextButton.Click        -= c_Click;
            previousButton.Click    -= c_Click;
            this.mapUpLevel.Image    = StyleManager.GetImage("mapup.png");
            this.mapUpLevel.Click   -= c_Click;
            this.mapDownLevel.Image  = StyleManager.GetImage("mapdown.png");
            this.mapDownLevel.Click -= c_Click;

            this.NotificationFinalize();
            this.ResumeForm();
        }
示例#6
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);
        }
示例#7
0
        public Image GetImage()
        {
            string imageName = gender == Gender.Male ? "male" : "female";

            switch (vocation)
            {
            case Vocation.Druid:
                imageName += promoted ? "elderdruid" : "druid";
                break;

            case Vocation.Sorcerer:
                imageName += promoted ? "mastersorcerer" : "sorcerer";
                break;

            case Vocation.Paladin:
                imageName += promoted ? "royalpaladin" : "paladin";
                break;

            case Vocation.Knight:
                imageName += promoted ? "eliteknight" : "knight";
                break;

            default:
                imageName += "knight";
                break;
            }
            return(StyleManager.GetImage(imageName + ".png"));
        }
示例#8
0
        private void CreateCreatureDropsBox(Creature creature, List <Tuple <Item, int> > items, string message, int x, ref int y, List <Control> controls)
        {
            Image      image = RecentDropsBox(creature, items);
            PictureBox box   = new PictureBox();

            box.Size      = image.Size;
            box.BackColor = Color.Transparent;
            box.Location  = new Point(x, y);
            box.Image     = image;
            box.Name      = "creature" + Constants.CommandSymbol + creature.title;
            box.Click    += CommandClick;
            this.Controls.Add(box);
            controls.Add(box);
            // copy button
            PictureBox copyButton = new PictureBox();

            copyButton.Size      = new Size(box.Size.Height - 4, box.Size.Height - 4);
            copyButton.BackColor = StyleManager.MainFormButtonColor;
            copyButton.Location  = new Point(box.Location.X + box.Size.Width - box.Size.Height + 2, y + 2);
            copyButton.Click    += CopyLootText;
            copyButton.Name      = message;
            copyButton.Image     = StyleManager.GetImage("copyicon.png");
            copyButton.SizeMode  = PictureBoxSizeMode.Zoom;
            this.Controls.Add(copyButton);
            controls.Add(copyButton);
            copyButton.BringToFront();

            y += box.Height;
        }
示例#9
0
        private void CreateRatioDisplay(List <string> itemList, int baseX, int baseY, EventHandler itemClick, List <Control> labelControls)
        {
            int it = 0;

            foreach (string itemName in itemList)
            {
                Item       item       = StorageManager.getItem(itemName);
                PictureBox pictureBox = new PictureBox();
                pictureBox.Image                 = item.image;
                pictureBox.Location              = new Point(baseX + it * 52, baseY);
                pictureBox.BackgroundImage       = StyleManager.GetImage("item_background.png");
                pictureBox.BackgroundImageLayout = ImageLayout.Zoom;
                pictureBox.SizeMode              = PictureBoxSizeMode.Zoom;
                pictureBox.Size   = new Size(48, 48);
                pictureBox.Name   = itemName;
                pictureBox.Click += itemClick;

                double goldRatio = item.GetMaxValue() / item.capacity;
                Label  label     = new Label();
                label.Text      = String.Format(goldRatio < 100 ? "{0:0.#}" : "{0:0.}", goldRatio);
                label.Location  = new Point(pictureBox.Location.X, pictureBox.Location.Y + pictureBox.Size.Height);
                label.Font      = new Font(FontFamily.GenericSansSerif, 10.0f, FontStyle.Bold);
                label.Size      = new Size(48, 24);
                label.ForeColor = StyleManager.MainFormButtonColor;
                label.TextAlign = ContentAlignment.MiddleCenter;
                label.Name      = itemName;
                labelControls.Add(label);

                this.Controls.Add(pictureBox);
                this.Controls.Add(label);
                it++;
            }
        }
示例#10
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            e.Graphics.DrawRectangle(new Pen(StyleManager.BorderColor, 1), new Rectangle(0, 0, this.Width - 1, this.Height - 1));
            int paddingX = Padding.Left / 2;
            int paddingY = Padding.Top / 2;

            e.Graphics.FillRectangle(new SolidBrush(BackColor), new Rectangle(paddingX, 8, 16 + paddingX, 16 + paddingX));
            if (!StyleManager.Initialized)
            {
                e.Graphics.FillRectangle(new SolidBrush(Color.Red), new Rectangle(paddingX, 8, 16 + paddingX, 16 + paddingX));
            }
            else
            {
                Image image = null;
                if (this.Checked)
                {
                    image = StyleManager.GetImage("checkbox-checked.png");
                }
                else
                {
                    image = StyleManager.GetImage("checkbox-empty.png");
                }
                lock (image) {
                    e.Graphics.DrawImage(image, new Rectangle(paddingX, 8, 16 + paddingX, 16 + paddingX));
                }
            }
        }
示例#11
0
        private PictureBox CreateCreatureDropsBox(Creature creature, List <Tuple <Item, int> > items, string message, int x, ref int y, List <Control> controls, int imageHeight, List <ItemRegion> region = null, int index = 0)
        {
            Image      image = RecentDropsBox(creature, items, imageHeight, region);
            PictureBox box   = new PictureBox();

            box.Size      = image.Size;
            box.BackColor = Color.Transparent;
            box.Location  = new Point(x, y);
            box.Image     = image;
            box.Name      = index.ToString();
            this.Controls.Add(box);
            controls.Add(box);
            // copy button
            PictureBox copyButton = new PictureBox();

            copyButton.Size      = new Size(box.Size.Height - 4, box.Size.Height - 4);
            copyButton.BackColor = StyleManager.MainFormButtonColor;
            copyButton.Location  = new Point(box.Location.X + box.Size.Width - box.Size.Height + 2, y + 2);
            copyButton.Click    += CopyLootText;
            copyButton.Name      = message;
            copyButton.Image     = StyleManager.GetImage("copyicon.png");
            copyButton.SizeMode  = PictureBoxSizeMode.Zoom;
            this.Controls.Add(copyButton);
            controls.Add(copyButton);
            copyButton.BringToFront();

            y += box.Height;
            return(box);
        }
示例#12
0
        public override List <Attribute> GetAttributes()
        {
            string expQuality  = exp_quality < 0 ? "unknown" : (exp_quality - 1).ToString();
            string lootQuality = loot_quality < 0 ? "unknown" : (loot_quality - 1).ToString();

            return(new List <Attribute> {
                new StringAttribute(name, 120), new StringAttribute(level < 0 ? "-" : level.ToString(), 50),
                new ImageAttribute(StyleManager.GetImage(String.Format("star{0}_text.png", expQuality))), new ImageAttribute(StyleManager.GetImage(String.Format("star{0}_text.png", lootQuality))),
                new StringAttribute(city, 100)
            });
        }
示例#13
0
        public SimpleTextNotification(Image image, string title, string text)
        {
            this.InitializeComponent();

            this.notificationImage.Image = image == null?StyleManager.GetImage("defaulticon.png") : image;

            this.titleLabel.Text = title;
            this.textLabel.Text  = text;

            this.InitializeSimpleNotification();
        }
示例#14
0
        public override void LoadForm()
        {
            if (mount == null)
            {
                return;
            }
            this.SuspendLayout();
            NotificationInitialize();

            this.mountTitle.Text     = mount.name;
            this.mountImageBox.Image = mount.image;
            if (mount.tibiastore)
            {
                this.tameItemImageBox.Visible      = false;
                this.tameItemLabel.Visible         = false;
                this.tameCreatureImageBox.Image    = StyleManager.GetImage("tibiastore.png");
                this.tameCreatureLabel.Text        = "Tibia Store";
                this.tameCreatureImageBox.Location = new System.Drawing.Point(this.tameCreatureImageBox.Location.X, this.tameCreatureImageBox.Location.Y - 50);
                this.tameCreatureLabel.Location    = new System.Drawing.Point(this.tameCreatureLabel.Location.X, this.tameCreatureLabel.Location.Y - 50);
            }
            else if (mount.tamecreatureid > 0 && mount.tameitemid > 0)
            {
                Creature tameCreature = StorageManager.getCreature(mount.tamecreatureid);
                Item     tameItem     = StorageManager.getItem(mount.tameitemid);

                this.tameCreatureImageBox.Image = tameCreature.image;
                this.tameCreatureLabel.Text     = tameCreature.displayname.ToTitle();
                this.tameItemImageBox.Image     = tameItem.image;
                this.tameItemLabel.Text         = tameItem.displayname.ToTitle();

                tameCreatureImageBox.Name = tameCreature.GetName();
                tameCreatureLabel.Name    = tameCreature.GetName();
                tameItemImageBox.Name     = tameItem.GetName();
                tameItemLabel.Name        = tameItem.GetName();

                this.tameCreatureLabel.Click    += TameCreatureImageBox_Click;
                this.tameCreatureImageBox.Click += TameCreatureImageBox_Click;
                this.tameItemImageBox.Click     += TameItemImageBox_Click;
                this.tameItemLabel.Click        += TameItemImageBox_Click;
            }
            else
            {
                this.tameCreatureImageBox.Visible = false;
                this.tameCreatureLabel.Visible    = false;
                this.tameItemImageBox.Visible     = false;
                this.tameItemLabel.Visible        = false;
            }


            base.NotificationFinalize();
            this.ResumeLayout(false);
        }
示例#15
0
        private void refreshCreatures()
        {
            foreach (Control c in creatureControls)
            {
                Controls.Remove(c);
                c.Dispose();
            }

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

            foreach (int creatureid in hunting_place.creatures)
            {
                Creature cr = StorageManager.getCreature(creatureid);
                creatures.Add(cr);
            }

            PageInfo pageInfo = new PageInfo(false, false);
            int      newWidth;
            int      y = baseY + UIManager.DisplayCreatureAttributeList(this.Controls, creatures, 10, baseY, out newWidth, null, creatureControls, currentPage, 10, pageInfo, null, null, sortFunction, sortedHeader, desc);

            if (pageInfo.prevPage || pageInfo.nextPage)
            {
                if (pageInfo.prevPage)
                {
                    PictureBox prevpage = new PictureBox();
                    prevpage.Location  = new Point(10, y);
                    prevpage.Size      = new Size(97, 23);
                    prevpage.Image     = StyleManager.GetImage("prevpage.png");
                    prevpage.BackColor = Color.Transparent;
                    prevpage.SizeMode  = PictureBoxSizeMode.Zoom;
                    prevpage.Click    += Prevpage_Click;
                    this.Controls.Add(prevpage);
                    creatureControls.Add(prevpage);
                }
                if (pageInfo.nextPage)
                {
                    PictureBox nextpage = new PictureBox();
                    nextpage.Location  = new Point(Math.Max(newWidth, this.Size.Width) - 108, y);
                    nextpage.Size      = new Size(98, 23);
                    nextpage.BackColor = Color.Transparent;
                    nextpage.Image     = StyleManager.GetImage("nextpage.png");
                    nextpage.SizeMode  = PictureBoxSizeMode.Zoom;
                    nextpage.Click    += Nextpage_Click;
                    this.Controls.Add(nextpage);
                    creatureControls.Add(nextpage);
                }
                y += 25;
            }
            refreshTimer();
            this.Size = new Size(Math.Max(this.Size.Width, newWidth), y + 10);
        }
示例#16
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);
        }
示例#17
0
 public override Image GetImage()
 {
     if (sqm < 20)
     {
         return(StyleManager.GetImage("smallhouse.png"));
     }
     else if (sqm < 60)
     {
         return(StyleManager.GetImage("mediumhouse.png"));
     }
     else
     {
         return(StyleManager.GetImage("bighouse.png"));
     }
 }
示例#18
0
        public SimpleTextNotification(Image image, string title, string text, double extraTime = 0, int widthOffset = 0)
        {
            this.InitializeComponent();

            this.Size = new Size(SettingsManager.getSettingInt("SimpleNotificationWidth"), this.Size.Height);

            this.notificationImage.Image = image == null?StyleManager.GetImage("defaulticon.png") : image;

            this.titleLabel.Text       = title;
            this.textLabel.Text        = text;
            this.textLabel.MaximumSize = new System.Drawing.Size(this.Size.Width - textLabel.Location.X, 0);

            this.textLabel.MaximumSize = new Size(this.textLabel.MaximumSize.Width - widthOffset, 0);

            this.InitializeSimpleNotification();
        }
示例#19
0
        public static void DrawCountOnGraphics(Graphics gr, int itemCount, int offset_x, int offset_y)
        {
            int numbers = (int)Math.Floor(Math.Log(itemCount, 10)) + 1;
            int xoffset = 1, logamount = itemCount;

            for (int i = 0; i < numbers; i++)
            {
                int   imagenr     = logamount % 10;
                Image imageNumber = StyleManager.GetImage(imagenr + ".png");
                xoffset = xoffset + imageNumber.Width + (itemCount >= 1000 ? 0 : 1);
                lock (imageNumber) {
                    gr.DrawImage(imageNumber, new Point(offset_x - xoffset, offset_y - imageNumber.Height - 3));
                }
                logamount /= 10;
            }
        }
示例#20
0
 protected void NotificationFinalize()
 {
     if (NotificationManager.HasBack())
     {
         back_button           = new PictureBox();
         back_button.Location  = new Point(5, 5);
         back_button.Image     = StyleManager.GetImage("back.png");
         back_button.Size      = new Size(63, 22);
         back_button.BackColor = Color.Transparent;
         back_button.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
         back_button.Click    += back_button_Click;
         this.Controls.Add(back_button);
         this.back_button.BringToFront();
     }
     this.ReturnFocusToTibia();
 }
示例#21
0
        public override void LoadHUD()
        {
            pictureBox           = new PictureBox();
            pictureBox.Location  = new Point(0, 0);
            pictureBox.Size      = new Size(this.Width, this.Height);
            pictureBox.BackColor = StyleManager.TransparencyKey;
            this.Controls.Add(pictureBox);

            try {
                string backgroundLocation = SettingsManager.getSettingString("PortraitBackgroundImage");
                if (backgroundLocation != null)
                {
                    backgroundImage = Image.FromFile(backgroundLocation);
                }
                else
                {
                    backgroundImage = StyleManager.GetImage("defaultportrait-blue.png").Clone() as Image;
                }
            } catch {
                backgroundImage = StyleManager.GetImage("defaultportrait-blue.png").Clone() as Image;
            }

            try {
                string centerLocation = SettingsManager.getSettingString("PortraitCenterImage");
                if (centerLocation != null)
                {
                    centerImage = Image.FromFile(centerLocation);
                }
                else
                {
                    centerImage = null;
                }
            } catch {
                centerImage = null;
            }


            backgroundOffset = new Point(SettingsManager.getSettingInt("PortraitBackgroundXOffset"), SettingsManager.getSettingInt("PortraitBackgroundYOffset"));
            centerOffset     = new Point(SettingsManager.getSettingInt("PortraitCenterXOffset"), SettingsManager.getSettingInt("PortraitCenterYOffset"));

            backgroundScale = Math.Min(100, Math.Max(0, SettingsManager.getSettingInt("PortraitBackgroundScale")));
            centerScale     = Math.Min(100, Math.Max(0, SettingsManager.getSettingInt("PortraitCenterScale")));

            RefreshHUD(1, 1);

            this.Load += Portrait_Load;
        }
示例#22
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();
        }
示例#23
0
        private void CreateRatioDisplay(List <string> itemList, int baseX, int baseY, List <Control> discardControls, List <Control> convertControls)
        {
            int it = 0;

            foreach (string itemName in itemList)
            {
                Item       item       = StorageManager.getItem(itemName);
                PictureBox pictureBox = new PictureBox();
                pictureBox.Image                 = item.image;
                pictureBox.Location              = new Point(baseX + it * 52, baseY);
                pictureBox.BackgroundImage       = StyleManager.GetImage("item_background.png");
                pictureBox.BackgroundImageLayout = ImageLayout.Zoom;
                pictureBox.SizeMode              = PictureBoxSizeMode.Zoom;
                pictureBox.Size = new Size(48, 48);
                pictureBox.Name = itemName;

                double goldRatio = item.GetMaxValue() / item.capacity;
                Label  label     = new Label();
                label.Text      = goldRatio > 1000 ? StyleManager.GoldToText(goldRatio).ToString() : String.Format(goldRatio < 100 ? "{0:0.#}" : "{0:0.}", goldRatio);
                label.Location  = new Point(pictureBox.Location.X, pictureBox.Location.Y + pictureBox.Size.Height);
                label.Font      = new Font(FontFamily.GenericSansSerif, 10.0f, FontStyle.Bold);
                label.Size      = new Size(48, 24);
                label.ForeColor = StyleManager.MainFormButtonColor;
                label.TextAlign = ContentAlignment.MiddleCenter;
                label.Name      = itemName + ":" + goldRatio.ToString(CultureInfo.InvariantCulture);
                label.Click    += SetDiscardRatio;
                discardControls.Add(label);

                Label convertLabel = new Label();
                convertLabel.Text      = StyleManager.GoldToText(item.GetMaxValue()).ToString();
                convertLabel.Location  = new Point(pictureBox.Location.X, label.Location.Y + label.Size.Height);
                convertLabel.Font      = new Font(FontFamily.GenericSansSerif, 10.0f, FontStyle.Bold);
                convertLabel.Size      = new Size(48, 24);
                convertLabel.ForeColor = StyleManager.MainFormButtonColor;
                convertLabel.TextAlign = ContentAlignment.MiddleCenter;
                convertLabel.Name      = itemName + ":" + goldRatio.ToString(CultureInfo.InvariantCulture);
                convertLabel.Click    += SetConvertValue;
                convertControls.Add(convertLabel);

                this.Controls.Add(pictureBox);
                this.Controls.Add(label);
                this.Controls.Add(convertLabel);
                it++;
            }
        }
示例#24
0
        public static Bitmap GenerateColorImage(int pressedIndex)
        {
            Bitmap bitmap = new Bitmap(OutfitColorBoxSize * OutfitColorsPerRow, OutfitColorBoxSize * 8);

            using (Graphics gr = Graphics.FromImage(bitmap)) {
                int index = 0;
                for (int i = 0; i < outfitColors.Count; i++)
                {
                    int x = OutfitColorBoxSize * (index % OutfitColorsPerRow);
                    int y = OutfitColorBoxSize * (index / OutfitColorsPerRow);
                    using (Brush brush = new SolidBrush(outfitColors[i]))
                        gr.FillRectangle(brush, new Rectangle(x, y, OutfitColorBoxSize - 1, OutfitColorBoxSize - 1));
                    gr.DrawImage(i == pressedIndex ? StyleManager.GetImage("color_bevel_pressed.png") : StyleManager.GetImage("color_bevel.png"), new Rectangle(x, y, OutfitColorBoxSize, OutfitColorBoxSize));
                    index++;
                }
            }
            return(bitmap);
        }
示例#25
0
        private void UpdateMap()
        {
            Target target = new Target();

            target.coordinate = new Coordinate(targetCoordinate);
            target.image      = StyleManager.GetImage("cross.png");
            target.size       = 12;

            if (mapBox.map != null)
            {
                mapBox.map.Dispose();
            }
            mapBox.map = StorageManager.getMap(targetCoordinate.z);
            mapBox.targets.Clear();
            mapBox.targets.Add(target);
            mapBox.mapCoordinate = new Coordinate(targetCoordinate);
            mapBox.sourceWidth   = mapBox.Width;
            mapBox.UpdateMap();
        }
示例#26
0
        public Image ItemBox(Item item, int amount = 0)
        {
            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, (amount > 1 || item.stackable) ? LootDropForm.GetStackImage(item.GetImage(), amount > 0 ? amount : 1, item) : item.GetImage(), new Rectangle(1, 1, ImageHeight - 2, ImageHeight - 2));
                RenderText(gr, item.displayname.ToTitle(), ImageHeight + 2, Color.Empty, StyleManager.NotificationTextColor);
                if (amount > 0)
                {
                    RenderText(gr, amount.ToString(), -ImageWidth, Color.FromArgb(StyleManager.MainFormButtonColor.R / 2, StyleManager.MainFormButtonColor.G / 2, StyleManager.MainFormButtonColor.B / 2), StyleManager.NotificationTextColor);
                }
            }
            return(bitmap);
        }
示例#27
0
        public override void LoadForm()
        {
            this.SuspendForm();
            NotificationInitialize();

            Coordinate coord = startCoordinate;

            if (coord == null)
            {
                try {
                    MemoryReader.UpdateBattleList();
                    coord = new Coordinate(MemoryReader.X, MemoryReader.Y, MemoryReader.Z);
                } catch {
                    coord = new Coordinate();
                }
            }
            Map m = StorageManager.getMap(coord.z);

            mapBox.map      = m;
            mapBox.mapImage = null;

            mapBox.sourceWidth     = mapBox.Width;
            mapBox.beginCoordinate = new Coordinate(coord);
            mapBox.mapCoordinate   = new Coordinate(coord);
            mapBox.zCoordinate     = coord.z;
            mapBox.MapUpdated     += MapBox_MapUpdated;
            mapBox.UpdateMap();

            coordinateBox.Text = String.Format("{0},{1},{2}", coord.x, coord.y, coord.z);

            mapBox.Click -= c_Click;

            this.mapUpLevel.Image    = StyleManager.GetImage("mapup.png");
            this.mapUpLevel.Click   -= c_Click;
            this.mapUpLevel.Click   += mapUpLevel_Click;
            this.mapDownLevel.Image  = StyleManager.GetImage("mapdown.png");
            this.mapDownLevel.Click -= c_Click;
            this.mapDownLevel.Click += mapDownLevel_Click;

            base.NotificationFinalize();
            this.ResumeForm();
        }
示例#28
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);
        }
示例#29
0
        public override Image GetImage()
        {
            TibiaObject obj = null;

            switch (imagetype)
            {
            case 1: obj = StorageManager.getOutfit(image); break;

            case 2: obj = StorageManager.getMount(image); break;

            case 3: obj = StorageManager.getQuest(image); break;

            case 4: obj = StorageManager.getHunt(image); break;

            case 5: obj = StorageManager.getCreature(image); break;

            case 6: obj = StorageManager.getNPC(image); break;

            case 7: obj = StorageManager.getItem(image); break;

            case 8: obj = StorageManager.getSpell(image); break;
            }
            if (obj != null)
            {
                Image img = obj.GetImage();
                if (img != null)
                {
                    return(img);
                }
            }
            switch (grade)
            {
            case 4: return(StyleManager.GetImage("achievementgrade4.png"));

            case 3: return(StyleManager.GetImage("achievementgrade3.png"));

            case 2: return(StyleManager.GetImage("achievementgrade2.png"));

            default: return(StyleManager.GetImage("achievementgrade1.png"));
            }
        }
示例#30
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);
        }