GetElementColor() public static method

public static GetElementColor ( string element ) : Color
element string
return Color
Ejemplo n.º 1
0
        private void AddResistances(List <Resistance> resistances)
        {
            List <Resistance> sorted_list = resistances.OrderByDescending(o => o.resistance).ToList();
            int i = 0;

            foreach (Resistance resistance in sorted_list)
            {
                resistance_tooltip.SetToolTip(resistance_controls[i], "Damage taken from " + resistance.name + ": " + resistance.resistance.ToString() + "%");

                // add a tooltip that displays the actual resistance when you mouseover
                Bitmap   bitmap = new Bitmap(19 + resistance.resistance, 19);
                Graphics gr     = Graphics.FromImage(bitmap);
                using (Brush brush = new SolidBrush(StyleManager.GetElementColor(resistance.name))) {
                    gr.FillRectangle(brush, new Rectangle(19, 0, bitmap.Width - 19, bitmap.Height));
                }
                gr.DrawRectangle(Pens.Black, new Rectangle(19, 0, bitmap.Width - 20, bitmap.Height - 1));
                Image image = StyleManager.GetElementImage(resistance.name);
                lock (image) {
                    gr.DrawImage(image, new Point(2, 2));
                }
                resistance_controls[i].Width  = bitmap.Width;
                resistance_controls[i].Height = bitmap.Height;
                resistance_controls[i].Image  = bitmap;
                i++;
            }
        }
Ejemplo n.º 2
0
 public override List <Attribute> GetAttributes()
 {
     return(new List <Attribute> {
         new StringAttribute(title, 200, boss ? StyleManager.CreatureBossColor : StyleManager.NotificationTextColor), new StringAttribute(experience > 0 ? experience.ToString() : "-", 60), new StringAttribute(health > 0 ? health.ToString() : "-", 60, StyleManager.CreatureHealthColor),
         new StringAttribute(GetWeakness(), 60, StyleManager.GetElementColor(GetWeakness()))
     });
 }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public override List <Attribute> GetConditionalAttributes()
        {
            List <Attribute> att = new List <Attribute>();
            List <Attribute> regularAttributes = GetAttributes();

            att.Add(new StringAttribute(title, 120));
            if (armor >= 0)
            {
                att.Add(new StringAttribute(armor.ToString(), 50));
            }
            if (attack >= 0)
            {
                att.Add(new StringAttribute(attack.ToString(), 60));
            }
            else if (atkmod >= 0)
            {
                att.Add(new StringAttribute("+" + atkmod, 60));
            }
            if (defense > 0)
            {
                att.Add(new StringAttribute(defensestr, 60));
            }
            if (hitmod != 0)
            {
                att.Add(new StringAttribute(hitmod > 0 ? "+" + hitmod.ToString() : hitmod.ToString(), 50));
            }
            if (level >= 0)
            {
                att.Add(new StringAttribute(level.ToString(), 50));
            }
            if (range >= 0)
            {
                att.Add(new StringAttribute(range.ToString(), 60));
            }
            //if (vocation != "") att.Add(new StringAttribute(vocation, 100));
            if (attrib != "")
            {
                att.Add(new StringAttribute(attrib, 120));
            }
            if (type != "")
            {
                att.Add(new StringAttribute(type, 70, StyleManager.ElementExists(type) ? StyleManager.GetElementColor(type) : StyleManager.NotificationTextColor));
            }
            att.Add(regularAttributes[1]);
            att.Add(regularAttributes[2]);
            return(att);
        }
Ejemplo n.º 5
0
        public override void LoadForm()
        {
            if (spell == null)
            {
                return;
            }
            this.SuspendLayout();
            NotificationInitialize();

            this.spellImageBox.Image = spell.GetImage();
            this.spellTitle.Text     = spell.name;
            this.spellWords.Text     = spell.words;
            if (StyleManager.ElementExists(spell.element))
            {
                this.spellTitle.ForeColor = StyleManager.GetElementColor(spell.element);
                this.spellWords.ForeColor = StyleManager.GetElementColor(spell.element);
            }
            this.goldLabel.Text     = spell.goldcost.ToString();
            this.manaCostLabel.Text = spell.manacost.ToString();
            this.cooldownLabel.Text = spell.cooldown.ToString() + "s";
            this.levelLabel.Text    = spell.levelrequired.ToString();
            this.premiumBox.Image   = spell.premium ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            this.promotionBox.Image = spell.promotion ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");

            if (this.spell.knight)
            {
                this.knightBox.Image = StyleManager.GetImage("knight.png");
            }
            if (this.spell.paladin)
            {
                this.paladinBox.Image = StyleManager.GetImage("paladin.png");
            }
            if (this.spell.sorcerer)
            {
                this.sorcererBox.Image = StyleManager.GetImage("sorcerer.png");
            }
            if (this.spell.druid)
            {
                this.druidBox.Image = StyleManager.GetImage("druid.png");
            }

            string[] titles = new string[] { "Knight", "Druid", "Paladin", "Sorcerer" };
            for (int i = 0; i < 4; i++)
            {
                npcList[i] = new List <TibiaObject>();
            }
            for (int i = 0; i < 4; i++)
            {
                foreach (SpellTaught teach in spell.teachNPCs)
                {
                    if (teach.GetVocation(i))
                    {
                        npcList[i].Add(new LazyTibiaObject {
                            id = teach.npcid, type = TibiaObjectType.NPC
                        });
                    }
                }
            }

            int y = this.Height - 10;

            baseY = y + 35;
            int x = 5;

            for (int i = 0; i < 4; i++)
            {
                if (npcList[i].Count > 0)
                {
                    Label label = new Label();
                    label.Text      = titles[i];
                    label.Location  = new Point(x, y);
                    label.ForeColor = StyleManager.NotificationTextColor;
                    label.BackColor = Color.Transparent;
                    label.Font      = StyleManager.TextFont;
                    label.Size      = new Size(70, 25);
                    label.TextAlign = ContentAlignment.MiddleCenter;
                    x += 70;
                    label.BorderStyle   = BorderStyle.FixedSingle;
                    label.Name          = i.ToString();
                    label.Click        += toggleVocationSpells;
                    vocationControls[i] = label;
                    this.Controls.Add(label);
                    if (currentVocation < 0 || currentVocation > 3)
                    {
                        currentVocation = i;
                    }
                }
                else
                {
                    vocationControls[i] = null;
                }
            }
            refreshVocationSpells();
            base.NotificationFinalize();
            this.ResumeLayout(false);
        }