Beispiel #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;
                    }
                }
            }
        }
Beispiel #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;
                    }
                }
            }
        }