public WANTEDCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, Inventory MyInventory, Stats MyStats) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheHelpCommandHandler = MyHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheLogger = MyLogger; this.TheTradeHandler = MyTradeHandler; this.TheInventory = MyInventory; this.TheStats = MyStats; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#wanted",Settings.botid); //if (CommandIsDisabled == false) { if (Settings.IsTradeBot == true) { TheHelpCommandHandler.AddCommand("#wanted / #w - see what I am buying"); TheHelpCommandHandler.AddCommand("#w - null"); TheHelpCommandHandler.AddCommand("#want - null"); TheHelpCommandHandler.AddCommand("#buying - null"); } TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); } }
public PRIZECommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Inventory MyInventory, TradeHandler MyTradeHandler, Stats MyStats, Logger MyLogger, ActorHandler MyActorHandler) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheHelpCommandHandler = MyHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheInventory = MyInventory; this.TheTradeHandler = MyTradeHandler; this.TheStats = MyStats; this.TheActorHandler = MyActorHandler; this.TheLogger = MyLogger; this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand); //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#inv",Settings.botid); //if (CommandIsDisabled == false) { if (Settings.IsTradeBot == true && TheMySqlManager.IGamble()) { TheHelpCommandHandler.AddCommand("#prize - show my prize list"); TheHelpCommandHandler.AddCommand("#prizes - null"); } TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); this.TheInventory.GotNewInventoryList += new Inventory.GotNewInventoryListEventHandler(OnGotNewInventoryList); this.TheMessageParser.Got_AbortTrade += new BasicCommunication.MessageParser.Got_AbortTrade_EventHandler(OnGotAbortTrade); } }
private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e) { string Message = e.Message.ToLower().Replace("\'", "\\\'").Replace("\"", "\\\""); if (Message[0] != '#') { Message = "#" + Message; } string[] CommandArray = Message.Split(' '); if (CommandArray[0] == "#canceltrade") { bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#canceltrade", Settings.botid); if (disabled == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); return; } if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("canceltrade", Settings.botid)) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!")); return; } TheTCPWrapper.Send(CommandCreator.EXIT_TRADE()); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "The trade was cancelled!")); return; } }
public INVCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Inventory MyInventory, TradeHandler MyTradeHandler, Stats MyStats) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheHelpCommandHandler = MyHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheInventory = MyInventory; this.TheTradeHandler = MyTradeHandler; this.TheStats = MyStats; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#inv",Settings.botid); //if (CommandIsDisabled == false) { if (Settings.IsTradeBot == true) { TheHelpCommandHandler.AddCommand("#inventory / #inv / #i - show what I am selling"); TheHelpCommandHandler.AddCommand("#invmembers / #im - member rates"); TheHelpCommandHandler.AddCommand("#inv - null"); TheHelpCommandHandler.AddCommand("#i - null"); TheHelpCommandHandler.AddCommand("#inb - null"); TheHelpCommandHandler.AddCommand("#sell - null"); TheHelpCommandHandler.AddCommand("#selling - null"); TheHelpCommandHandler.AddCommand("#im - null"); TheHelpCommandHandler.AddCommand("#invmember - null"); TheHelpCommandHandler.AddCommand("#invmemver - null"); TheHelpCommandHandler.AddCommand("#invmemvers - null"); } TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); } }
public TextCommandsHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheHelpCommandHandler = MyHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheLogger = MyLogger; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#donate",Settings.botid); string commands = TheMySqlManager.TextCommandlist(Settings.botid); if (commands.Length == 0) { return; } string[] commandsarray = commands.Split(' '); foreach (string command in commandsarray) { string paddedcommand = ""; if (command[0] != '#') paddedcommand = "#"; paddedcommand = paddedcommand + command; if (TheMySqlManager.CheckIfTextCommandIsDisabled(paddedcommand, Settings.botid) == false) { string text = TheMySqlManager.TextCommandHelpText(paddedcommand, Settings.botid); TheHelpCommandHandler.AddCommand(paddedcommand + text); } } TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
private void OnGlobalMessage(object sender, BasicCommunication.MessageParser.Get_GlobalMessageEventArgs e) { if (LogGlobalMessage==true) { TheLogger.ChatLog(e.Message); } }
public MessageParser(BasicCommunication.RawText MyRawText, Logger MyLogger, TCPWrapper MyTCPWrapper, MySqlManager MyMySqlManager) { this.TheLogger = MyLogger; this.TheTCPWrapper = MyTCPWrapper; this.TheMySqlManager = MyMySqlManager; TheRawText = MyRawText; TheRawText.Got_RAW_TEXT += new BasicCommunication.RawText.Got_RAW_TEXT_EventHandler(OnGot_RAW_TEXT); }
public PMHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, MySqlManager MyMySqlManager) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheMySqlManager = MyMySqlManager; CommandArrayList.Clear(); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e) { string Message = e.Message; if (Message[0]!='#') { Message = "#" + Message; } string[] CommandArray = Message.Split(' '); if (CommandArray[0].ToLower() == "#isonline") { bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#isonline", Settings.botid); if (disabled == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); return; } if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#isonline", Settings.botid)) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username,"You are not authorized to use this command!")); return; } if (CommandArray.Length < 2) { goto WrongArguments; } string playerName = CommandArray[1]; bool playerIsOnline = false; string serverName = "live"; if (CommandArray.Length == 3) { serverName = CommandArray[2]; } if ((playerIsOnline = TheMySqlManager.isPlayerOnline(e.username, playerName, serverName))) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, playerName + " is online on the " + serverName + " server.")); } else { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, playerName + " is not online on the " + serverName + " server.")); } return; WrongArguments: TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[-------------------------------------------")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Here is the usage of the #isonline command:")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[#isonline <playername> <server> ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[-------------------------------------------")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #isonline DogBreath test ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[-------------------------------------------")); return; } }
public LoginLogger(BasicCommunication.Login MyLogin, Logger MyLogger, TCPWrapper MyTCPWrapper, MySqlManager MyMySqlManager) { TheLogger = MyLogger; TheLogin = MyLogin; TheTCPWrapper = MyTCPWrapper; TheMySqlManager = MyMySqlManager; this.TheLogin.Got_LOG_IN_OK += new BasicCommunication.Login.Got_LOG_IN_OK_EventHandler(LOG_IN_OK); this.TheLogin.Got_LOG_IN_NOT_OK += new BasicCommunication.Login.Got_LOG_IN_NOT_OK_EventHandler(LOG_IN_NOT_OK); }
public GuildTextHandler(BasicCommunication.RawText MyRawText, TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, MySqlManager MyMySqlManager, Logger MyLogger) { this.TheLogger = MyLogger; this.TheMessageParser = MyMessageParser; this.TheRawText = MyRawText; this.TheMySqlManager = MyMySqlManager; this.TheTCPWrapper = MyTCPWrapper; TheMessageParser.Get_GlobalMessage += new BasicCommunication.MessageParser.Get_GlobalMessageEventHandler(Got_GlobalMessage); }
private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e) { string Message = e.Message.ToLower(); if (Message[0] != '#') { Message = "#" + Message; } string[] CommandArray = Message.Split(' '); if (CommandArray[0] == "#sit") { // if (CommandArray.Length < 3) // goto WrongArguments; // bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#sit", Settings.botid); if (disabled == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); return; } if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#move", Settings.botid)) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!")); return; } TheTCPWrapper.Send(CommandCreator.SIT_DOWN(true)); } if (CommandArray[0] == "#stand") { bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#stand", Settings.botid); if (disabled == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); return; } if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#tl", Settings.botid)) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!")); return; } TheTCPWrapper.Send(CommandCreator.SIT_DOWN(false)); } return; //WrongArguments: // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Here is the usage of the #move command: ")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[#move x y ")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[------------------------------------------")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #move 192 168 ")); // return; }
public MessageLogger(BasicCommunication.MessageParser MyMessageParser, Logger MyLogger, MySqlManager MyMySqlManager) { TheLogger = MyLogger; TheMessageParser = MyMessageParser; TheMySqlManager = MyMySqlManager; this.TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); this.TheMessageParser.Send_PM += new BasicCommunication.MessageParser.Send_PM_EventHandler(OnSendPM); this.TheMessageParser.Get_GlobalMessage += new BasicCommunication.MessageParser.Get_GlobalMessageEventHandler(OnGlobalMessage); }
public CLI(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; string VersionLine = "| Version: "; VersionLine = VersionLine.Insert(VersionLine.Length,Settings.Version); VersionLine = VersionLine.PadRight(49); VersionLine = VersionLine + "|"; }
private void OnSendPM(object sender, BasicCommunication.MessageParser.Send_PM_EventArgs e) { if (TheMySqlManager.logsendpms(Settings.botid) == true) { if (e.username.ToLower() == "gossip" && LogGossipFeed==false) { return; } TheLogger.PMLog("Send PM to "+ e.username + ": " + e.Message); } }
public CancelTradeCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheMySqlManager = MyMySqlManager; this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler; this.TheLogger = MyLogger; this.TheTradeHandler = MyTradeHandler; TheAdminHelpCommandHandler.AddCommand("#canceltrade - cancels trade and resets trade indicator"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
public WhoIsTradingCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheMySqlManager = MyMySqlManager; this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler; this.TheLogger = MyLogger; this.TheTradeHandler = MyTradeHandler; TheAdminHelpCommandHandler.AddCommand("#whoistrading - tells you who's trading with me"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e) { string Message = e.Message; if (Message[0]!='#') { Message = "#" + Message; } string[] CommandArray = Message.Split(' '); if (CommandArray[0] == "#pm") { bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#pm", Settings.botid); if (disabled == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); return; } if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#pm", Settings.botid)) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username,"You are not authorized to use this command!")); return; } int i; Message=""; if (CommandArray.Length<3) goto WrongArguments; for (i=2;i<CommandArray.Length;i++) { Message += CommandArray[i] + " "; } Message = Message.Trim(); TheTCPWrapper.Send(CommandCreator.SEND_PM(CommandArray[1],Message)); } return; WrongArguments: TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "-------------------------------------")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Here is the usage of the #pm command:")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "#pm <username> <message> ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "-------------------------------------")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Example: #pm artem Hi, how are You? ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "-------------------------------------")); return; }
public OpenStorage(HelpCommandHandler MyHelpCommandHandler, TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, MySqlManager MyMySqlManager, ActorHandler MyActorHandler,AdminHelpCommandHandler MyAdminHelpCommandHandler) { this.TheTCPWrapper = MyTCPWrapper; this.TheMySqlManager = MyMySqlManager; this.TheActorHandler = MyActorHandler; this.TheMessageParser = MyMessageParser; this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler; this.TheHelpCommandHandler = MyHelpCommandHandler; TheAdminHelpCommandHandler.AddCommand("#openstorage / #os - Open storage"); TheHelpCommandHandler.AddCommand("#os - null"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
public AFKCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheHelpCommandHandler = MyHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheLogger = MyLogger; TheHelpCommandHandler.AddCommand("#automessage: - null"); TheHelpCommandHandler.AddCommand("#automessage - null"); TheHelpCommandHandler.AddCommand("#afk - null"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
public QuitCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, Inventory MyInventory) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheMySqlManager = MyMySqlManager; this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler; this.TheLogger = MyLogger; this.TheTradeHandler = MyTradeHandler; this.TheInventory = MyInventory; TheAdminHelpCommandHandler.AddCommand("#quit / #exit / #shutdown - make me shut down"); TheAdminHelpCommandHandler.AddCommand("#exit - null"); TheAdminHelpCommandHandler.AddCommand("#shutdown - null"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e) { string Message = e.Message; if (Message[0] != '#') { Message = "#" + Message; } string[] CommandArray = Message.Split(' '); if (CommandArray[0] == "#retrade" || CommandArray[0] == "#r") { /* bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#pm", Settings.botid); if (disabled == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); return; } */ if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#inv", Settings.botid)) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!")); return; } //TheMessageParser.FakeMessage(e.username + " her in order to accept the trade."); if (!TheTradeHandler.AmITrading()) { TheMessageParser.FakeTrade(e.username); //TheTCPWrapper.Send(CommandCreator.TRADE_WITH(TheActorHandler.GetUserIDFromname(e.username))); } else if (TradeHandler.username == e.username && TheTradeHandler.AmITrading()) { TheTCPWrapper.Send(CommandCreator.EXIT_TRADE()); TheMessageParser.FakeTrade(e.username); //TheTCPWrapper.Send(CommandCreator.TRADE_WITH(TheActorHandler.GetUserIDFromname(e.username))); } else { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "#Retrade will only work when I am not trading with someone else.")); //TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "#Retrade will only work when I am trading with you.")); return; } } return; }
public ISOnlineCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheHelpCommandHandler = MyHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheLogger = MyLogger; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#loc",Settings.botid); //if (CommandIsDisabled == false) { TheHelpCommandHandler.AddCommand("#isonline - tells you the online status of a player"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); } }
public ACCEPTMECommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdvHelpCommandHandler MyAdvHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheAdvHelpCommandHandler = MyAdvHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheLogger = MyLogger; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#acceptme", Settings.botid); //if (this.CommandIsDisabled == false) { this.TheAdvHelpCommandHandler.AddCommand("#acceptme - accept me into the guild"); this.TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); } }
public HelpCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,PMHandler MyPMHandler, MySqlManager MyMySqlManager) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.ThePMHandler = MyPMHandler; this.TheMySqlManager = MyMySqlManager; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#help",Settings.botid); //if (CommandIsDisabled == false) { ThePMHandler.AddCommand("#help"); ThePMHandler.AddCommand("#h"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); } }
public GTCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheLogger = MyLogger; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#gt", Settings.botid); //if (this.CommandIsDisabled == false) { this.TheAdminHelpCommandHandler.AddCommand("#gt - Provide guild feed to the bot"); this.TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); } }
//private bool CommandIsDisabled; public PMCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; TheAdminHelpCommandHandler.AddCommand("#pm - send a pm to somebody"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#pm",Settings.botid); //if (CommandIsDisabled == false) //{ // TheAdminHelpCommandHandler.AddCommand("#pm - send a pm to somebody"); // TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); //} }
public UseObject(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, PMHandler MyPMHandler) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.ThePMHandler = MyPMHandler; //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#help",Settings.botid); //if (CommandIsDisabled == false) { TheAdminHelpCommandHandler.AddCommand("#useobject - Use a map object(like a banner)"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); } }
public DepositCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdvHelpCommandHandler MyAdvHelpCommandHandler, MySqlManager MyMySqlManager, Inventory MyInventory, TradeHandler MyTradeHandler, Stats MyStats, Storage MyStorage) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheAdvHelpCommandHandler = MyAdvHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheInventory = MyInventory; this.TheTradeHandler = MyTradeHandler; this.TheStats = MyStats; this.TheStorage = MyStorage; { TheAdvHelpCommandHandler.AddCommand("#deposit - deposit something(s) into my storage"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand); } }
public ELTCCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger) { this.TheTCPWrapper = MyTCPWrapper; this.TheMessageParser = MyMessageParser; this.TheHelpCommandHandler = MyHelpCommandHandler; this.TheMySqlManager = MyMySqlManager; this.TheLogger = MyLogger; TheHelpCommandHandler.AddCommand("#thx - null"); TheHelpCommandHandler.AddCommand("#thy - null"); TheHelpCommandHandler.AddCommand("#thank - null"); TheHelpCommandHandler.AddCommand("#thanks - null"); TheHelpCommandHandler.AddCommand("#ty - null"); TheHelpCommandHandler.AddCommand("#tyvm - null"); TheHelpCommandHandler.AddCommand("#thanx - null"); TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM); }
static void Main(string[] args) { string option = string.Empty; while (!option.Equals("0")) { Console.Clear(); Console.WriteLine("RABBIT MQ"); Console.WriteLine("\n"); Console.WriteLine("Menú Principal"); Console.WriteLine(); Console.WriteLine("1. Envío básico."); Console.WriteLine("2. Recepción básica."); Console.WriteLine("----------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("3. Envío de mensajes a dos o más colas."); Console.WriteLine("4. Recepción de mensajes desde dos o más colas de trabajo."); Console.WriteLine("----------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("5. Envío de un mensaje a un intercambiador y no directamente a una cola (Transmite mensajes a todos los consumidores)."); Console.WriteLine("6. Recepción de mensajes desde una o cualquier cola enlazada con el intercambiador especificado."); Console.WriteLine("----------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("7. Envío de un mensaje con clave de enrutamiento. (Filtrar mensajes de acuerdo a su gravedad)."); Console.WriteLine("8. Recepción de mensajes desde una cola enlazada con la clave de enrutamiento."); Console.WriteLine("----------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("9. Envío de un mensaje con clave de enrutamiento. (Filtrar mensajes de acuerdo a su gravedad)."); Console.WriteLine("101 - 102 - 103 - 104. Recepción de mensajes desde una colas enlazada con la clave de enrutamiento."); Console.WriteLine("----------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("11. Enviando solicitud y esperar como respuesta la serie de fibonacci del número 30."); Console.WriteLine("12. Servidor esperando solicitudes para responder la serie de fibonacci solicitada."); Console.WriteLine("----------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("0. Salir del Programa."); option = Console.ReadLine(); switch (option) { case "1": BasicCommunication.Send(); break; case "2": BasicCommunication.Receive(); break; case "3": NewTask.Send(new string[] { "Primer mensaje que emula procesar durante 1 segundo." }); NewTask.Send(new string[] { "Segundo mensaje que emula procesar durante 2 segundos.." }); NewTask.Send(new string[] { "Tercer mensaje que emula procesar durante 1 segundo." }); break; case "4": Worker.Receive(); break; case "5": EmitLogFanout.Send(new string[] { "Enviando un mensaje al intercambiador, ahora no se envía directamente a la cola. " }); break; case "6": ReceiveLogsFanout.Receive(); break; case "7": EmitLogDirect.Send(new string[] { "info", "Mensaje de información." }); EmitLogDirect.Send(new string[] { "warning", "Mensaje de advertencia." }); EmitLogDirect.Send(new string[] { "error", "Mensaje de error." }); EmitLogDirect.Send(new string[] { "personalizado", "Mensaje de clasificación personalizado." }); break; case "8": ReceiveLogsDirect.Receive(new string[] { "warning", "error", "personalizado" }); break; case "9": EmitLogTopic.Send(new string[] { "kern.critical", "un mensaje error crítico del kernel." }); EmitLogTopic.Send(new string[] { "kern.*", "Mensaje general del kernel." }); EmitLogTopic.Send(new string[] { "*.critital", "Mensaje crítico sin importar de quien sea." }); break; case "101": ReceiveLogsTopic.Receive(new string[] { "#" }); break; case "102": ReceiveLogsTopic.Receive(new string[] { "kern.*" }); break; case "103": ReceiveLogsTopic.Receive(new string[] { "*.critical" }); break; case "104": ReceiveLogsTopic.Receive(new string[] { "kern.*", "*.critical" }); break; case "11": RPCClient rpcClient = new RPCClient(); Console.WriteLine(" [x] Solicitando fib(30)..."); var response = rpcClient.Call("30"); Console.WriteLine(" [.] Recibido {0}", response); Console.ReadLine(); rpcClient.Close(); break; case "12": RPCServer rpcServer = new RPCServer(); rpcServer.Server(); break; default: break; } } }