Пример #1
0
        private void item_CurrentRankChanged(object sender, EventArgs e)
        {
            TalentItem item = sender as TalentItem;

            _tree1Count = talentTree1.TotalPoints();
            _tree2Count = talentTree2.TotalPoints();
            _tree3Count = talentTree3.TotalPoints();
            if (!Character.IsLoading)
            {
                if (item != null)
                {
                    Talents.Data[item.Index] = item.CurrentRank;
                }
                UpdateSavedTalents();
                _character.OnTalentChange();
                _character.OnCalculationsInvalidated();
            }
            if (_tree1Count + _tree2Count + _tree3Count < _character.Level - 9)
            {
                comboBoxTalentSpec.BackColor = Color.FromArgb(255, 255, 128);
            }
            else if (_tree1Count + _tree2Count + _tree3Count > _character.Level - 9)
            {
                comboBoxTalentSpec.BackColor = Color.FromArgb(255, 128, 128);
            }
            else
            {
                comboBoxTalentSpec.BackColor = Color.White;
            }
        }
Пример #2
0
        private void TalentTree_MouseMove(object sender, MouseEventArgs e)
        {
            int row = ((e.Y - 8) % 65 > 48 || e.Y < 8) ? -1 : (e.Y - 8) / 65;
            int col = ((e.X - 8) % 65 > 47 || e.X < 8) ? -1 : (e.X - 8) / 65;

            if (row >= 0 && row <= 10 && col >= 0 && col <= 3)
            {
                if (row != _mouseRow || col != _mouseCol)
                {
                    TalentItem talent = _talents[row, col];
                    if (talent != null)
                    {
                        _toolTip.Show(talent.TooltipText(), this, col * 65 + 65, row * 65 + 24);
                    }
                    else
                    {
                        _toolTip.Hide(this);
                    }
                }
            }
            else
            {
                _toolTip.Hide(this);
            }
            _mouseRow = row;
            _mouseCol = col;
        }
Пример #3
0
 private void TalentTree_MouseUp(object sender, MouseEventArgs e)
 {
     if (_mouseRow >= 0 && _mouseRow <= 10 && _mouseCol >= 0 && _mouseCol <= 3)
     {
         TalentItem talent = _talents[_mouseRow, _mouseCol];
         if (talent != null)
         {
             if (e.Button == MouseButtons.Right)
             {
                 if (Control.ModifierKeys == Keys.Shift)
                 {
                     talent.CurrentRank = 0;
                 }
                 else
                 {
                     talent.CurrentRank--;
                 }
             }
             else if (e.Button == MouseButtons.Left)
             {
                 if (Control.ModifierKeys == Keys.Shift)
                 {
                     talent.CurrentRank = talent.MaxRank;
                 }
                 else
                 {
                     talent.CurrentRank++;
                 }
             }
             Redraw();
         }
     }
 }
Пример #4
0
        void item_CurrentRankChanged(object sender, EventArgs e)
        {
            TalentItem item = sender as TalentItem;

            if (_mouseRow == item.Row && _mouseCol == item.Col)
            {
                _toolTip.Show(item.TooltipText(), this, _mouseCol * 65 + 65, _mouseRow * 65 + 24);
            }
        }
Пример #5
0
        public TalentItem GetTalent(string TalentName)
        {
            TalentItem ti = null;

            foreach (string tree in _trees.Keys)
            {
                ti = _trees[tree].Find(delegate(TalentItem talent) { return(talent.Name.Replace(" ", "").ToUpper() == TalentName.Replace(" ", "").ToUpper()); });
                if (ti != null)
                {
                    return(ti);
                }
            }
            return(new TalentItem());
        }
Пример #6
0
 public TalentItem(TalentTree talentTree, string talentName, int row, int col, int index, string[] description, string icon, int currentRank, int maxRank, TalentItem prereq)
 {
     _talentTree  = talentTree;
     _talentName  = talentName;
     _row         = row;
     _col         = col;
     _index       = index;
     _description = description;
     _iconName    = icon;
     _maxRank     = maxRank;
     _currentRank = currentRank > maxRank ? maxRank : currentRank;
     Prereq       = prereq;
     UpdateIcon();
     UpdateOverlay();
 }
Пример #7
0
        private void UpdateTrees()
        {
            ClearTalentPickerItems();
            if (Talents != null)
            {
                _treeNames = new List <string>((string[])Talents.GetType().GetField("TreeNames").GetValue(Talents));
                talentTree1.CharacterClass = _character.Class;
                talentTree1.TreeName       = _treeNames[0];
                tabPageTree1.Text          = _treeNames[0];
                talentTree2.CharacterClass = _character.Class;
                talentTree2.TreeName       = _treeNames[1];
                tabPageTree2.Text          = _treeNames[1];
                talentTree3.CharacterClass = _character.Class;
                talentTree3.TreeName       = _treeNames[2];
                tabPageTree3.Text          = _treeNames[2];

                TalentTree currentTree;

                List <GlyphDataAttribute> majors   = new List <GlyphDataAttribute>();
                List <GlyphDataAttribute> minors   = new List <GlyphDataAttribute>();
                List <string>             relevant = Calculations.GetModel(Character.CurrentModel).GetRelevantGlyphs();

                foreach (PropertyInfo pi in Talents.GetType().GetProperties())
                {
                    TalentDataAttribute[] talentDatas = pi.GetCustomAttributes(typeof(TalentDataAttribute), true) as TalentDataAttribute[];
                    if (talentDatas.Length > 0)
                    {
                        TalentDataAttribute talentData = talentDatas[0];
                        switch (talentData.Tree)
                        {
                        case 0: currentTree = talentTree1; break;

                        case 1: currentTree = talentTree2; break;

                        default: currentTree = talentTree3; break;
                        }
                        TalentItem item = new TalentItem(currentTree, talentData.Name, talentData.Row - 1, talentData.Column - 1, talentData.Index, LineWrapDescription(talentData.Description), talentData.Icon,
                                                         (int)pi.GetValue(Talents, null), talentData.MaxPoints, talentData.Prerequisite >= 0 ? _talentPickerItems[talentData.Prerequisite] : null);
                        _talentPickerItems[talentData.Index] = item;
                        currentTree.AddTalent(item);

                        item.CurrentRankChanged += new EventHandler(item_CurrentRankChanged);
                    }

                    GlyphDataAttribute[] glyphDatas = pi.GetCustomAttributes(typeof(GlyphDataAttribute), true) as GlyphDataAttribute[];
                    if (glyphDatas.Length > 0)
                    {
                        GlyphDataAttribute glyphData = glyphDatas[0];
                        if (glyphData.Major)
                        {
                            majors.Add(glyphData);
                        }
                        else
                        {
                            minors.Add(glyphData);
                        }
                    }
                }

                tabPageGlyphs.SuspendLayout();

                foreach (Control c in grpMajorGlyph.Controls)
                {
                    c.Dispose();
                }
                grpMajorGlyph.Controls.Clear();

                int count = 0;
                foreach (GlyphDataAttribute glyph in majors)
                {
                    if (relevant == null || relevant.Contains(glyph.Name))
                    {
                        CheckBox cb = new CheckBox();
                        grpMajorGlyph.Controls.Add(cb);
                        cb.AutoSize = true;
                        cb.Text     = glyph.Name;
                        cb.Tag      = glyph.Index;
                        cb.Checked  = Talents.GlyphData[glyph.Index];
                        cb.UseVisualStyleBackColor = true;
                        cb.Location        = new Point(8, 17 + 21 * count);
                        cb.CheckedChanged += new EventHandler(this.glyph_ValueChanged);
                        tooltipGlyph.SetToolTip(cb, glyph.Description);
                        count++;
                    }
                }
                if (count == 0)
                {
                    grpMajorGlyph.Hide();
                }
                else
                {
                    grpMajorGlyph.Show();
                }
                count = 0;

                foreach (Control c in grpMinorGlyph.Controls)
                {
                    c.Dispose();
                }
                grpMinorGlyph.Controls.Clear();

                foreach (GlyphDataAttribute glyph in minors)
                {
                    if (relevant == null || relevant.Contains(glyph.Name))
                    {
                        CheckBox cb = new CheckBox();
                        grpMinorGlyph.Controls.Add(cb);
                        cb.AutoSize = true;
                        cb.Text     = glyph.Name;
                        cb.Tag      = glyph.Index;
                        cb.Checked  = Talents.GlyphData[glyph.Index];
                        cb.UseVisualStyleBackColor = true;
                        cb.Location        = new Point(6, 19 + 23 * count);
                        cb.CheckedChanged += new EventHandler(this.glyph_ValueChanged);
                        tooltipGlyph.SetToolTip(cb, glyph.Description);
                        count++;
                    }
                }

                if (count == 0)
                {
                    grpMinorGlyph.Hide();
                }
                else
                {
                    grpMinorGlyph.Show();
                }

                tabPageGlyphs.ResumeLayout();

                talentTree1.Redraw();
                talentTree2.Redraw();
                talentTree3.Redraw();
                item_CurrentRankChanged(null, null);
            }
        }
Пример #8
0
 public void AddTalent(TalentItem talent)
 {
     talent.CurrentRankChanged       += new EventHandler(item_CurrentRankChanged);
     _talents[talent.Row, talent.Col] = talent;
     _points[talent.Row] += talent.CurrentRank;
 }