示例#1
0
        void setTalentsFromTree(SavedVariablesDictionary characterInfo)
        {
            if (!characterInfo.ContainsKey("Talents"))
            {
                return;
            }

            SavedVariablesDictionary talent_tree = characterInfo["Talents"] as SavedVariablesDictionary;

            TalentsBase Talents = Character.CurrentTalents;

            if (Talents != null)
            {
                List <string> treeNames = new List <string>((string[])Talents.GetType().GetField("TreeNames").GetValue(Talents));

                //TalentTree currentTree;
                foreach (PropertyInfo pi in Talents.GetType().GetProperties())
                {
                    TalentDataAttribute[] talentDatas = pi.GetCustomAttributes(typeof(TalentDataAttribute), true) as TalentDataAttribute[];
                    if (talentDatas.Length > 0)
                    {
                        TalentDataAttribute talentData = talentDatas[0];

                        int points = getTalentPointsFromTree(talent_tree, treeNames[talentData.Tree], talentData);
                        Character.CurrentTalents.Data[talentData.Index] = points;
                    }
                }
            }
        }
示例#2
0
        void setTalentsFromTree(SavedVariablesDictionary characterInfo)
        {
            if (!characterInfo.ContainsKey("Talents"))
            {
#if RAWR3 || RAWR4 || SILVERLIGHT
                //new ErrorWindow() { Message = "Not yet implemented." }.Show();
#else
                MessageBox.Show("Talent data was not found, and must be manually added.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
#endif
                return;
            }

            SavedVariablesDictionary talent_tree = characterInfo["Talents"] as SavedVariablesDictionary;

            TalentsBase Talents = m_character.CurrentTalents;

            if (Talents != null)
            {
                List <string> treeNames = new List <string>((string[])Talents.GetType().GetField("TreeNames").GetValue(Talents));

                //TalentTree currentTree;
                foreach (PropertyInfo pi in Talents.GetType().GetProperties())
                {
                    TalentDataAttribute[] talentDatas = pi.GetCustomAttributes(typeof(TalentDataAttribute), true) as TalentDataAttribute[];
                    if (talentDatas.Length > 0)
                    {
                        TalentDataAttribute talentData = talentDatas[0];

                        int points = getTalentPointsFromTree(talent_tree, treeNames[talentData.Tree], talentData);
                        m_character.CurrentTalents.Data[talentData.Index] = points;
                    }
                }
            }
        }
示例#3
0
        private List <TalentsBase> GetOptimizeTalentSpecs()
        {
            List <TalentsBase> talentSpecs = null;

            if (CK_Talents_Points.IsChecked.GetValueOrDefault(false) ||
                CK_Talents_Glyphs.IsChecked.GetValueOrDefault(false) ||
                CK_Talents_Specs.IsChecked.GetValueOrDefault(false))
            {
                talentSpecs = new List <TalentsBase>();
                foreach (SavedTalentSpec spec in SavedTalentSpec.SpecsFor(character.Class))
                {
                    TalentsBase talents     = spec.TalentSpec();
                    int         totalPoints = 0;
                    for (int i = 0; i < talents.Data.Length; i++)
                    {
                        totalPoints += talents.Data[i];
                    }
                    if (totalPoints == 41 /*character.Level - 9*/)//that's the old method
                    {
                        talentSpecs.Add(talents);
                    }
                }
            }
            return(talentSpecs);
        }
        public SaveTalentSpecDialog(TalentsBase spec, int tree1, int tree2, int tree3)
        {
            InitializeComponent();

#if !SILVERLIGHT
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            this.WindowState = System.Windows.WindowState.Normal;
#endif

            Talents = spec;
            Tree1 = tree1;
            Tree2 = tree2;
            Tree3 = tree3;

            SavedTalentSpecList saved = SavedTalentSpec.SpecsFor(spec.GetClass());
            if (saved.Count > 0)
            {
                UpdateCombo.ItemsSource = saved;
                UpdateCombo.SelectedIndex = 0;
            }
            else
            {
                UpdateCombo.IsEnabled = false;
            }
        }
示例#5
0
        public SaveTalentSpecDialog(TalentsBase spec, int tree1, int tree2, int tree3)
        {
            InitializeComponent();

#if !SILVERLIGHT
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            this.WindowState           = System.Windows.WindowState.Normal;
#endif

            Talents = spec;
            Tree1   = tree1;
            Tree2   = tree2;
            Tree3   = tree3;

            SavedTalentSpecList saved = SavedTalentSpec.SpecsFor(spec.GetClass());
            if (saved.Count > 0)
            {
                UpdateCombo.ItemsSource   = saved;
                UpdateCombo.SelectedIndex = 0;
            }
            else
            {
                UpdateCombo.IsEnabled = false;
            }
        }
示例#6
0
 public bool Equals(TalentsBase talents)
 {
     if (talents == null || Spec == null)
     {
         return(false);
     }
     return(talents.ToString().Equals(Spec) && Class == talents.GetClass());
 }
示例#7
0
 public SavedTalentSpec(String name, TalentsBase talentSpec, int tree1, int tree2, int tree3)
 {
     Name  = name;
     Tree1 = tree1;
     Tree2 = tree2;
     Tree3 = tree3;
     if (talentSpec != null)
     {
         Spec  = talentSpec.ToString();
         Class = talentSpec.GetClass();
     }
 }
        public SaveTalentSpecDialog(TalentsBase spec, int tree1, int tree2, int tree3)
        {
            InitializeComponent();
            Talents = spec;
            Tree1   = tree1;
            Tree2   = tree2;
            Tree3   = tree3;

            SavedTalentSpecList saved = SavedTalentSpec.SpecsFor(spec.GetClass());

            if (saved.Count > 0)
            {
                UpdateCombo.ItemsSource   = saved;
                UpdateCombo.SelectedIndex = 0;
            }
            else
            {
                UpdateCombo.IsEnabled = false;
            }
        }
示例#9
0
        private List <TalentsBase> GetOptimizeTalentSpecs()
        {
            List <TalentsBase> talentSpecs = null;

            if (checkBoxOptimizeTalents.Checked || checkBoxMutateTalents.Checked)
            {
                talentSpecs = new List <TalentsBase>();
                foreach (SavedTalentSpec spec in FormMain.Instance.TalentPicker.SpecsFor(_character.Class))
                {
                    TalentsBase talents     = spec.TalentSpec();
                    int         totalPoints = 0;
                    for (int i = 0; i < talents.Data.Length; i++)
                    {
                        totalPoints += talents.Data[i];
                    }
                    if (totalPoints == _character.Level - 9)
                    {
                        talentSpecs.Add(talents);
                    }
                }
            }
            return(talentSpecs);
        }
示例#10
0
        private List <TalentsBase> GetOptimizeTalentSpecs()
        {
            List <TalentsBase> talentSpecs = null;

            if (TalentsCheck.IsChecked.GetValueOrDefault(false) || TalentSpecsCheck.IsChecked.GetValueOrDefault(false))
            {
                talentSpecs = new List <TalentsBase>();
                foreach (SavedTalentSpec spec in SavedTalentSpec.SpecsFor(character.Class))
                {
                    TalentsBase talents     = spec.TalentSpec();
                    int         totalPoints = 0;
                    for (int i = 0; i < talents.Data.Length; i++)
                    {
                        totalPoints += talents.Data[i];
                    }
                    if (totalPoints == character.Level - 9)
                    {
                        talentSpecs.Add(talents);
                    }
                }
            }
            return(talentSpecs);
        }
示例#11
0
 void _character_ClassChanged(object sender, EventArgs e)
 {
     Talents = _character.CurrentTalents;
     UpdateSavedTalents();
 }