ElementExists() public static method

public static ElementExists ( string element ) : bool
element string
return bool
Beispiel #1
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);
        }
Beispiel #2
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);
        }