Example #1
0
        /// <summary>Check for selected Target and selected Command</summary>
        public static bool InitTrigger(this CmdTrigger <RealmServerCmdArgs> trigger)
        {
            RealmServerCmdArgs args = trigger.Args;

            if (args.Role.IsStaff)
            {
                string mod = trigger.Text.NextModifiers();
                if (mod.Length > 0)
                {
                    Character character = trigger.GetCharacter(mod);
                    if (character == null)
                    {
                        return(false);
                    }
                    args.Character = character;
                    args.Double    = false;
                }
                else if (args.Character != null && trigger.SelectedCommand == null)
                {
                    trigger.SelectedCommand = args.Character.ExtraInfo.SelectedCommand;
                }
            }

            return(true);
        }
Example #2
0
 public RealmServerCmdArgs(RealmServerCmdArgs args)
 {
     m_user       = args.m_user;
     m_chr        = args.Character;
     m_chatTarget = args.m_chatTarget;
     Role         = args.Role;
     m_dbl        = args.m_dbl;
     InitArgs();
 }
Example #3
0
        /// <summary>
        /// Sets the Character of this trigger, according to the -a or -c switch, followed by the account- or character-name
        /// </summary>
        /// <param name="mod"></param>
        /// <returns></returns>
        public static Character GetCharacter(this CmdTrigger <RealmServerCmdArgs> trigger, string mod)
        {
            RealmServerCmdArgs args      = trigger.Args;
            Character          character = null;
            RoleGroup          role      = args.Role;
            bool flag1 = mod.Contains("a");
            bool flag2 = mod.Contains("c");

            if (flag1 || flag2)
            {
                if (flag1 && flag2)
                {
                    trigger.Reply("Invalid command-switch, cannot use -a and -c switch at the same time.");
                }
                else
                {
                    if (role != null && !role.CanUseCommandsOnOthers)
                    {
                        trigger.Reply("You may not use the -c or -a command-switch!");
                    }
                    string name = trigger.Text.NextWord();
                    if (flag1)
                    {
                        RealmAccount loggedInAccount =
                            ServerApp <RealmServer> .Instance.GetLoggedInAccount(name);

                        if (loggedInAccount == null || (character = loggedInAccount.ActiveCharacter) == null)
                        {
                            trigger.Reply("Account {0} is not online.", (object)name);
                        }
                    }
                    else
                    {
                        character = World.GetCharacter(name, false);
                        if (character == null)
                        {
                            trigger.Reply("Character {0} is not online.", (object)name);
                        }
                    }

                    if (character != null)
                    {
                        if (role == null || !(character.Account.Role > role))
                        {
                            return(character);
                        }
                        if (flag1)
                        {
                            trigger.Reply("Account {0} is not online.", (object)name);
                        }
                        else if (character.Stealthed == 0)
                        {
                            trigger.Reply("Cannot use this Command on {0}.", (object)character.Name);
                        }
                        else
                        {
                            trigger.Reply("Character {0} is not online.", (object)name);
                        }
                    }
                }
            }
            else
            {
                trigger.Reply("Invalid Command-Switch: " + mod);
            }

            return(null);
        }
Example #4
0
 public RealmServerNCmdArgs(RealmServerCmdArgs args, uint n)
     : base(args)
 {
     N = n;
 }
Example #5
0
 public DefaultCmdTrigger(string text, BaseCommand <RealmServerCmdArgs> selectedCommand, RealmServerCmdArgs args)
     : base(new StringStream(text), selectedCommand, args)
 {
 }
Example #6
0
 public IngameCmdTrigger(RealmServerCmdArgs args)
     : base(args)
 {
 }
Example #7
0
 public BufferedCommandTrigger(string text, BaseCommand <RealmServerCmdArgs> selectedCommand, RealmServerCmdArgs args) : base(text, selectedCommand, args)
 {
 }