public void ChangeBook()
 {
     MasteryTextBox.Text = SelectedBook.Name;
     foreach (TalentEntry talent in SelectedBook.TalentEntries)
     {
         TalentEntry talent1 = talent;
         foreach (masteries mastery in Client.Masteries.Where(mastery => mastery.id == talent1.TalentId))
         {
             mastery.selectedRank = talent.Rank;
         }
     }
 }
Exemple #2
0
        private List <TalentEntry> GetCurrentTalentEntries()
        {
            List <TalentEntry> talentEntries = new List <TalentEntry>();

            foreach (masteries mastery in Client.Masteries)
            {
                if (mastery.selectedRank > 0)
                {
                    TalentEntry talentEntry = new TalentEntry();
                    talentEntry.Rank     = mastery.selectedRank;
                    talentEntry.TalentId = mastery.id;
                    talentEntries.Add(talentEntry);
                }
            }
            return(talentEntries);
        }
        private void RevertButton_Click(object sender, RoutedEventArgs e)
        {
            foreach (masteries mastery in Client.Masteries)
            {
                mastery.selectedRank = 0;
            }

            foreach (TalentEntry savedMastery in SelectedBook.TalentEntries)
            {
                TalentEntry mastery1 = savedMastery;
                foreach (masteries mastery in Client.Masteries.Where(mastery => mastery.id == mastery1.TalentId))
                {
                    mastery.selectedRank = savedMastery.Rank;
                }
            }
        }
        public static Spell[] RetrieveSpells(CmdTrigger <RealmServerCmdArgs> trigger)
        {
            string[] strArray = trigger.Text.Remainder.Split(new string[1]
            {
                ","
            }, StringSplitOptions.RemoveEmptyEntries);
            List <Spell> spellList = new List <Spell>(strArray.Length);

            foreach (string input in strArray)
            {
                Spell   spell = null;
                SpellId result1;
                if (EnumUtil.TryParse(input, out result1))
                {
                    spell = SpellHandler.Get(result1);
                }
                if (spell == null)
                {
                    SpellLineId result2;
                    if (EnumUtil.TryParse(input, out result2))
                    {
                        SpellLine line = result2.GetLine();
                        if (line != null)
                        {
                            spell = line.HighestRank;
                        }
                    }

                    if (spell == null)
                    {
                        TalentEntry entry = TalentMgr.GetEntry(trigger.Text.NextEnum(TalentId.None));
                        if (entry != null && entry.Spells != null && entry.Spells.Length > 0)
                        {
                            spell = entry.Spells[entry.Spells.Length - 1];
                        }
                        if (spell == null)
                        {
                            continue;
                        }
                    }
                }

                spellList.Add(spell);
            }

            return(spellList.ToArray());
        }
Exemple #5
0
        public static void WriteSpellId()
        {
            var noSpell = new Spell();

            noSpell.Name    = "None";
            noSpell.Effects = new SpellEffect[0];

            SpellHandler.ById[(int)0] = noSpell;
            WriteEnum("SpellId", "Spells", SpellHandler.ById, false,
                      (spell) => {
                return(true);
            },
                      (spell) => {
                return(spell.FullName);
            },
                      (spell) => {
                TalentEntry talent = spell.Talent;

                List <string> descs = new List <string>();

                if (spell.IsPassive)
                {
                    descs.Add("Passive");
                }

                if (talent != null)
                {
                    descs.Add("Talent");
                }
                else if (spell.Ability != null &&
                         spell.Ability.Skill != null && spell.Ability.Skill.Category != SkillCategory.Invalid)
                {
                    descs.Add(spell.Ability.Skill.Category.ToString());
                }

                if (spell.IsLearnSpell)
                {
                    descs.Add("Teaches: " + spell.Effects[0].TriggerSpell);
                }
                else if (spell.Level > 0)
                {
                    descs.Add("Level: " + spell.Level);
                }

                string desc = string.Join(", ", descs.ToArray());

                if (!string.IsNullOrEmpty(spell.BookDescription))
                {
                    if (desc.Length > 0)
                    {
                        desc += "\n";
                    }
                    desc += spell.BookDescription;
                }

                return(desc);
            },
                      (spell, name) => {
                return(null);
            },
                      (spell) => {
                return(spell.Id.ToString());
            });
        }
        public static void WriteSpellId()
        {
            RealmDBMgr.Initialize();
            ContentMgr.Initialize();
            World.InitializeWorld();
            SpellHandler.LoadSpells();
            FactionMgr.Initialize();
            SpellHandler.Initialize2();

            var noSpell = new Spell {
                Name = "None", Effects = new SpellEffect[0]
            };

            SpellHandler.ById[0] = noSpell;
            WriteEnum("SpellId", " : uint", "Spells", SpellHandler.ById, false,
                      (spell) => { return(true); },
                      (spell) => { return(spell.FullName + spell.RankDesc); },
                      (spell) =>
            {
                TalentEntry talent = spell.Talent;

                var descs = new List <string>();

                if (spell.IsPassive)
                {
                    descs.Add("Passive");
                }

                if (talent != null)
                {
                    descs.Add("Talent");
                }
                else if (spell.Ability != null &&
                         spell.Ability.Skill != null && spell.Ability.Skill.Category != SkillCategory.Invalid)
                {
                    descs.Add(spell.Ability.Skill.Category.ToString());
                }

                if (spell.IsTeachSpell)
                {
                    descs.Add("Teachspell");
                }
                if (spell.Level > 0)
                {
                    descs.Add("Level: " + spell.Level);
                }

                string desc = string.Join(", ", descs.ToArray());

                if (!string.IsNullOrEmpty(spell.Description))
                {
                    if (desc.Length > 0)
                    {
                        desc += "\n";
                    }
                    desc += spell.Description;
                }

                return(desc);
            },
                      (spell, name) => { return(null); },
                      (spell) => { return(spell.Id.ToString()); });
        }