예제 #1
0
        public static bool GetRequiresContext(this BaseCommand <RealmServerCmdArgs> cmd)
        {
            RealmServerCommand rootCmd = cmd.RootCmd as RealmServerCommand;

            if (rootCmd != null)
            {
                return(rootCmd.RequiresContext);
            }
            return(false);
        }
예제 #2
0
        /// <summary>
        /// Whether this the supplied arguments match the specified target criteria.
        /// </summary>
        public bool CheckArgs(Command <RealmServerCmdArgs> cmd)
        {
            if (!(cmd is RealmServerCommand))
            {
                return(true);
            }
            RealmServerCommand realmServerCommand = (RealmServerCommand)cmd;
            Unit             target      = this.Target;
            ObjectTypeCustom targetTypes = realmServerCommand.TargetTypes;

            if (realmServerCommand.RequiresCharacter && this.m_chr == null)
            {
                return(false);
            }
            if (targetTypes == ObjectTypeCustom.None)
            {
                return(true);
            }
            if (target != null)
            {
                return(targetTypes.HasAnyFlag(target.CustomType));
            }
            return(false);
        }
예제 #3
0
 private static void OnInvalidArguments(CmdTrigger <RealmServerCmdArgs> trigger, RealmServerCommand cmd)
 {
     trigger.Reply("Invalid command arguments - " +
                   "Required target-type: " + cmd.TargetTypes +
                   " - Context required: " + cmd.GetRequiresContext());
 }