public static bool GetRequiresContext(this BaseCommand <RealmServerCmdArgs> cmd) { RealmServerCommand rootCmd = cmd.RootCmd as RealmServerCommand; if (rootCmd != null) { return(rootCmd.RequiresContext); } return(false); }
/// <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); }
private static void OnInvalidArguments(CmdTrigger <RealmServerCmdArgs> trigger, RealmServerCommand cmd) { trigger.Reply("Invalid command arguments - " + "Required target-type: " + cmd.TargetTypes + " - Context required: " + cmd.GetRequiresContext()); }