Exemplo n.º 1
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var mod    = trigger.Text.NextModifiers();
                var target = trigger.Args.Target;

                if (target == null)
                {
                    return;
                }

                if (mod.Length > 0 && !(mod.Length == 1 && mod.Contains("r")))
                {
                    if (mod.Contains("c"))
                    {
                        // add all class abilities
                        ClassId clss;
                        if (trigger.Text.HasNext)
                        {
                            clss = trigger.Text.NextEnum(ClassId.End);
                            if (clss == ClassId.End)
                            {
                                trigger.Reply(RealmLangKey.InvalidClass);
                                return;
                            }
                        }
                        else
                        {
                            clss = target.Class;
                        }

                        var count = 0;
                        var lines = SpellLines.GetLines(clss);
                        foreach (var line in lines)
                        {
                            if (line.HighestRank.Talent == null)
                            {
                                AddSpell(target, line.HighestRank, mod.Contains("r"));
                                count++;
                            }
                        }
                        if (count > 0)
                        {
                            trigger.Reply(RealmLangKey.CmdSpellAddResponseSpells, count);
                        }
                    }

                    if (mod.Contains("t"))
                    {
                        // add all talents
                        int count = 0;
                        var lines = SpellLines.GetLines(target.Class);
                        foreach (var line in lines)
                        {
                            if (line.HighestRank.Talent != null)
                            {
                                AddSpell(target, line.HighestRank, mod.Contains("r"));
                                count++;
                            }
                        }
                        trigger.Reply(RealmLangKey.CmdSpellAddResponseTalents, count);
                    }
                }
                else
                {
                    // add list of spells
                    var spells = SpellGetCommand.RetrieveSpells(trigger);
                    if (spells.Length == 0)
                    {
                        trigger.Reply(RealmLangKey.CmdSpellNotExists);
                    }
                    else
                    {
                        foreach (var spell in spells)
                        {
                            AddSpell(target, spell, mod.Contains("r"));
                            trigger.Reply(RealmLangKey.CmdSpellAddResponseSpell, spell);
                        }
                    }
                }
            }
Exemplo n.º 2
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                string str    = trigger.Text.NextModifiers();
                Unit   target = trigger.Args.Target;

                if (target == null)
                {
                    return;
                }
                if (str.Length > 0 && (str.Length != 1 || !str.Contains("r")))
                {
                    if (str.Contains("c"))
                    {
                        ClassId clss;
                        if (trigger.Text.HasNext)
                        {
                            clss = trigger.Text.NextEnum(ClassId.End);
                            if (clss == ClassId.End)
                            {
                                trigger.Reply(RealmLangKey.InvalidClass);
                                return;
                            }
                        }
                        else
                        {
                            clss = target.Class;
                        }

                        int num = 0;
                        foreach (SpellLine line in SpellLines.GetLines(clss))
                        {
                            if (line.HighestRank.Talent == null)
                            {
                                AddSpell(target, line.HighestRank, str.Contains("r"));
                                ++num;
                            }
                        }

                        if (num > 0)
                        {
                            trigger.Reply(RealmLangKey.CmdSpellAddResponseSpells, (object)num);
                        }
                    }

                    if (!str.Contains("t"))
                    {
                        return;
                    }
                    int num1 = 0;
                    foreach (SpellLine line in SpellLines.GetLines(target.Class))
                    {
                        if (line.HighestRank.Talent != null)
                        {
                            AddSpell(target, line.HighestRank, str.Contains("r"));
                            ++num1;
                        }
                    }

                    trigger.Reply(RealmLangKey.CmdSpellAddResponseTalents, (object)num1);
                }
                else
                {
                    Spell[] spellArray = SpellGetCommand.RetrieveSpells(trigger);
                    if (spellArray.Length == 0)
                    {
                        trigger.Reply(RealmLangKey.CmdSpellNotExists);
                    }
                    else
                    {
                        foreach (Spell spell in spellArray)
                        {
                            AddSpell(target, spell, str.Contains("r"));
                            trigger.Reply(RealmLangKey.CmdSpellAddResponseSpell, (object)spell);
                        }
                    }
                }
            }