description of TCPWrapper.
Ejemplo n.º 1
0
 public Stats(TCPWrapper MyTCPWrapper, Logger MyLogger, MySqlManager MyMySqlManager)
 {
     this.TheTCPWrapper = MyTCPWrapper;
     this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
     this.TheLogger = MyLogger;
     this.TheMySqlManager = MyMySqlManager;
 }
Ejemplo n.º 2
0
 public Stats(TCPWrapper MyTCPWrapper, Logger MyLogger, MySqlManager MyMySqlManager)
 {
     this.TheTCPWrapper             = MyTCPWrapper;
     this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
     this.TheLogger       = MyLogger;
     this.TheMySqlManager = MyMySqlManager;
 }
Ejemplo n.º 3
0
 public Perks(TCPWrapper MyTCPWrapper, Logger MyLogger, MySqlManager MyMySqlManager)
 {
     this.TheTCPWrapper             = MyTCPWrapper;
     this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
     this.TheLogger       = MyLogger;
     this.TheMySqlManager = MyMySqlManager;
     //TheTCPWrapper.Send(CommandCreator.SEND_PM(TradeHandler.username, "I'm too far away from storage to open it, move me closer please!"));
 }
Ejemplo n.º 4
0
 public Inventory(TCPWrapper MyTCPWrapper, Logger MyLogger, MySqlManager MyMySqlManager)
 {
     this.TheTCPWrapper = MyTCPWrapper;
     this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
     this.TheLogger = MyLogger;
     this.TheMySqlManager = MyMySqlManager;
     TheTCPWrapper.GotDisconnected += new TCPWrapper.GotDisconnectedEventHandler(GotServerDisconnected);
 }
Ejemplo n.º 5
0
 public Inventory(TCPWrapper MyTCPWrapper, Logger MyLogger, MySqlManager MyMySqlManager)
 {
     this.TheTCPWrapper             = MyTCPWrapper;
     this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
     this.TheLogger                 = MyLogger;
     this.TheMySqlManager           = MyMySqlManager;
     TheTCPWrapper.GotDisconnected += new TCPWrapper.GotDisconnectedEventHandler(GotServerDisconnected);
 }
Ejemplo n.º 6
0
        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 + "|";
        }
Ejemplo n.º 7
0
        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 + "|";
        }
Ejemplo n.º 8
0
 public MySqlManager(string SqlServer, string SqlUsername, string SqlPassword, string SqlDatabase, int SqlPort, Logger MyLogger, TCPWrapper MyTCPWrapper, errorHandler MyErrorHandler)
 {
     this.TheLogger = MyLogger;
     this.TheTCPWrapper = MyTCPWrapper;
     this.SqlServer = SqlServer;
     this.SqlUsername = SqlUsername;
     this.SqlPassword = SqlPassword;
     this.SqlDatabase = SqlDatabase;
     this.SqlPort = SqlPort;
     myErrorHandler = MyErrorHandler;
     //this.TheInventory = MyInventory;
 }
Ejemplo n.º 9
0
        private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            if (e.CommandBuffer[0] == 19)
            {
                HERE_YOUR_INVENTORY(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 20)
            {
                INVENTORY_ITEM_TEXT(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 21)
            {
                GET_NEW_INVENTORY_ITEM(e.CommandBuffer);
                return;
            }
        }
Ejemplo n.º 10
0
 private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
 {
     if (e.CommandBuffer[0] == 18)
     {
         HERE_YOUR_STATS(e.CommandBuffer);
     }
     if (e.CommandBuffer[0] == 49)
     {
         SEND_PARTIAL_STAT(e.CommandBuffer);
     }
     if (e.CommandBuffer[0] == 42)
     {
         GET_YOUR_SIGILS(e.CommandBuffer);
     }
 }
Ejemplo n.º 11
0
        //public static myCoords myCurrentCoords = new myCoords();

        //public struct myCoords
        //{
        //    public int x;
        //    public int y;
        //}
        public static void Main(string[] args)
        {
            myHome.x       = 0;
            myHome.y       = 0;
            myHome.heading = 0;
            myHome.mapName = "";
            // Create instance of the log file handler
            Logger MyLogger = new Logger();

            // Create instance of the TCP client
            TCPClient.TCPClient MyTCPClient = new TCPClient.TCPClient();

            // Initialize the TCPWrapper
            TCPWrapper MyTCPWrapper = new TCPWrapper(MyTCPClient, MyLogger);

            // set up working directory
            if (args.Length > 0)
            {
                string botName = args[0];
                launchPath  = args[1];
                SqlServer   = args[2];
                SqlPort     = Convert.ToInt16(args[3]);
                SqlUsername = args[4];
                SqlPassword = args[5];
                SqlDatabase = args[6];
                Environment.CurrentDirectory = launchPath + botName;
            }
            if (Environment.CurrentDirectory.ToLower().Contains("Live".ToLower()))
            {
                serverName = "live";
            }
            else if (Environment.CurrentDirectory.ToLower().Contains("Test".ToLower()))
            {
                serverName = "test";
            }
            else if (Environment.CurrentDirectory.ToLower().Contains("PK".ToLower()))
            {
                serverName = "pk";
            }
            else
            {
                launchedByBotManager = false;
                launchPath           = "C:\\bot\\test\\";
                Console.WriteLine("serverName not found in file path, defaulting to test");
                Console.WriteLine("path containing cs-elbot.exe should be something like c:/bot/test/botname/");
                Console.WriteLine("If you're not using bot manager, don't worry about this message");
            }

            Settings MySettings = new Settings();

            //Load Sql Configuration if not supplied in parameters
            if (SqlServer == "")
            {
                MySettings.LoadSqlSettingsFromConfigfile();
            }

            MySettings.LoadSettings();
            errorHandler MyErrorHandler = new errorHandler();

            //Setup the MySQL Database
            MySqlManager MyMySqlManager = new MySqlManager(SqlServer, SqlUsername, SqlPassword, SqlDatabase, SqlPort, MyLogger, MyTCPWrapper, MyErrorHandler);

            Settings.TradeTimeOut = MyMySqlManager.GetTimeoutInterval(Settings.botid);
            botType = MyMySqlManager.getBotType(Settings.botid);
            //Console.WriteLine("Bot type: " + botType);

            MyMySqlManager.ImStarted(Settings.botid);
            Settings.URL = MyMySqlManager.getURL() + Settings.Loginname + ".php";


            try
            {
                System.Net.IPHostEntry ServerIPHostEntry = System.Net.Dns.GetHostEntry(Settings.ServerHostname);
                MyTCPWrapper.HostIp = ServerIPHostEntry.AddressList[0];
                MyTCPWrapper.Port   = Settings.ServerPort;

                Logging.CommandLogger MyCommandDebugger = new Logging.CommandLogger(MyTCPWrapper, MyLogger);

                //BasicCommunication.HeartBeat MyHeartBeat = new BasicCommunication.HeartBeat(MyTCPWrapper, MyErrorHandler);
                BasicCommunication.HeartBeat MyHeartBeat = new BasicCommunication.HeartBeat(MyTCPWrapper);
                BasicCommunication.Ping      MyPing      = new BasicCommunication.Ping(MyTCPWrapper);
                Inventory MyInventory = new Inventory(MyTCPWrapper, MyLogger, MyMySqlManager);
                Storage   MyStorage   = new Storage(MyTCPWrapper, MyLogger, MyMySqlManager);
                BasicCommunication.new_minute MyMewMinute = new BasicCommunication.new_minute(MyTCPWrapper, MyMySqlManager, MyInventory);

                // Login here
                BasicCommunication.Login         MyLogin         = new BasicCommunication.Login(MyTCPWrapper);
                BasicCommunication.RawText       MyRawText       = new BasicCommunication.RawText(MyTCPWrapper);
                BasicCommunication.MessageParser MyMessageParser = new BasicCommunication.MessageParser(MyRawText, MyLogger, MyTCPWrapper, MyMySqlManager);
                BasicCommunication.changeMap     MyChangeMap     = new BasicCommunication.changeMap(MyTCPWrapper);

                //if this is a storage bot (not a tradebot) start a shutdown timer
                if (Settings.IsTradeBot == false && botType == 2)
                {
                    BasicCommunication.Shutdown MyShutdown = new BasicCommunication.Shutdown(MyTCPWrapper, MyMessageParser, MyMySqlManager, MyErrorHandler);
                }

                Logging.LoginLogger   MyLoginLogger   = new Logging.LoginLogger(MyLogin, MyLogger, MyTCPWrapper, MyMySqlManager);
                Logging.MessageLogger MyMessageLogger = new Logging.MessageLogger(MyMessageParser, MyLogger, MyMySqlManager);

                AdvancedCommunication.ActorHandler MyActorHandler = new AdvancedCommunication.ActorHandler(MyTCPWrapper, MyLogger, MyMySqlManager);

                AdvancedCommunication.PMHandler               MyPMHandler               = new AdvancedCommunication.PMHandler(MyTCPWrapper, MyMessageParser, MyMySqlManager);
                AdvancedCommunication.HelpCommandHandler      MyHelpCommandHandler      = new AdvancedCommunication.HelpCommandHandler(MyTCPWrapper, MyMessageParser, MyPMHandler, MyMySqlManager);
                AdvancedCommunication.AdvHelpCommandHandler   MyAdvHelpCommandHandler   = new AdvancedCommunication.AdvHelpCommandHandler(MyTCPWrapper, MyMessageParser, MyPMHandler, MyMySqlManager, MyHelpCommandHandler);
                AdvancedCommunication.AdminHelpCommandHandler MyAdminHelpCommandHandler = new AdvancedCommunication.AdminHelpCommandHandler(MyTCPWrapper, MyMessageParser, MyPMHandler, MyMySqlManager, MyAdvHelpCommandHandler);
                AdvancedCommunication.SAYCommandHandler       MySAYCommandHandler       = new AdvancedCommunication.SAYCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyPMHandler);
                AdvancedCommunication.PMCommandHandler        MyPMCommandHandler        = new AdvancedCommunication.PMCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager);

                AdvancedCommunication.BuddyHandler MyBuddyHandler = new AdvancedCommunication.BuddyHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogin);

                //get my stats
                Stats MyStats = new Stats(MyTCPWrapper, MyLogger, MyMySqlManager);


                TradeHandler MyTradeHandler = new TradeHandler(MyTCPWrapper, MyMessageParser, MyMySqlManager, MyInventory, MyActorHandler, MyLogger, MyStorage, MyErrorHandler, MyHelpCommandHandler);

                AdvancedCommunication.INVCommandHandler     MyINVCommandHandler     = new AdvancedCommunication.INVCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats);
                AdvancedCommunication.INVRCommandHandler    MyINVRCommandHandler    = new AdvancedCommunication.INVRCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats);
                AdvancedCommunication.STOCommandHandler     MySTOCommandHandler     = new AdvancedCommunication.STOCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyStorage, MyTradeHandler, MyStats);
                AdvancedCommunication.INVLISTCommandHandler MyINVLISTCommandHandler = new AdvancedCommunication.INVLISTCommandHandler(MyHelpCommandHandler, MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats);
                AdvancedCommunication.ReserveCommandHandler MyReserveCommandHandler = new AdvancedCommunication.ReserveCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats, MyStorage);

                AdvancedCommunication.GiveCommandHandler     MyGiveCommandHandler     = new AdvancedCommunication.GiveCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyPMHandler);
                AdvancedCommunication.GiveToCommandHandler   MyGiveToCommandHandler   = new AdvancedCommunication.GiveToCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyPMHandler);
                AdvancedCommunication.BUYCommandHandler      MyBUYCommandHandler      = new AdvancedCommunication.BUYCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.DESCRIBECommandHandler MyDESCRIBECommandHandler = new AdvancedCommunication.DESCRIBECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyPMHandler);

                AdvancedCommunication.DONATECommandHandler    MyDONATECommandHandler    = new AdvancedCommunication.DONATECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.PUTONSALECommandHandler MyPUTONSALECommandHandler = new AdvancedCommunication.PUTONSALECommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.WANTEDCommandHandler    MyWANTEDCommandHandler    = new AdvancedCommunication.WANTEDCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory, MyStats);
                AdvancedCommunication.LOCCommandHandler       MyLOCCommandHandler       = new AdvancedCommunication.LOCCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.BANCommandHandler       MyBANCommandHandler       = new AdvancedCommunication.BANCommandHandler(MyHelpCommandHandler, MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.DropCommandHandler      MyDropCommandHandler      = new AdvancedCommunication.DropCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.LaunchCommandHandler    MyLaunchCommandHandler    = new AdvancedCommunication.LaunchCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.QuitCommandHandler      MyQuitCommandHandler      = new AdvancedCommunication.QuitCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.WearCommandHandler      MyWearCommandHandler      = new AdvancedCommunication.WearCommandHandler(MyActorHandler, MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.UseItemCommandHandler   MyUseItemCommandHandler   = new AdvancedCommunication.UseItemCommandHandler(MyActorHandler, MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);

                AdvancedCommunication.ABOUTCommandHandler MyABOUTCommandHandler = new AdvancedCommunication.ABOUTCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.AFKCommandHandler   MyAFKCommandHandler   = new AdvancedCommunication.AFKCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.ELTCCommandHandler  MyELTCCommandHandler  = new AdvancedCommunication.ELTCCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);

                AdvancedCommunication.ACCEPTMECommandHandler MyACCEPTMECommandHandler = new AdvancedCommunication.ACCEPTMECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.KICKMECommandHandler   MyKICKMECommandHandler   = new AdvancedCommunication.KICKMECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.GTCommandHandler       MyGTCommandHandler       = new AdvancedCommunication.GTCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.GuildTextHandler       MyGuildTextHandler       = new AdvancedCommunication.GuildTextHandler(MyRawText, MyTCPWrapper, MyMessageParser, MyMySqlManager, MyLogger);

                AdvancedCommunication.GreetPlayers        MyGreetPlayers        = new AdvancedCommunication.GreetPlayers(MyTCPWrapper, MyMySqlManager, MyActorHandler);
                AdvancedCommunication.AdvertHandler       MyAdvertHandler       = new AdvancedCommunication.AdvertHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory, MyErrorHandler);
                AdvancedCommunication.HouseKeepingHandler MyHouseKeepingHandler = new AdvancedCommunication.HouseKeepingHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyErrorHandler);
                AdvancedCommunication.AltAdvertHandler    MyAltAdvertHandler    = new AdvancedCommunication.AltAdvertHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory, MyErrorHandler);
                //AdvancedCommunication.RulesHandler MyRulesHandler = new AdvancedCommunication.RulesHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.MOVECommandHandler         MyMOVECommandHandler     = new AdvancedCommunication.MOVECommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler);
                AdvancedCommunication.SitStandCommandHandler     MySitStandCommandHandler = new AdvancedCommunication.SitStandCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler);
                AdvancedCommunication.RetradeCommandHandler      MyRetradeCommandHandler  = new AdvancedCommunication.RetradeCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyActorHandler, MyTradeHandler);
                AdvancedCommunication.TextCommandsHandler        MyTextCommandsHandler    = new AdvancedCommunication.TextCommandsHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.WhoIsTradingCommandHandler MyWhoIsTradingHandler    = new cs_elbot.AdvancedCommunication.WhoIsTradingCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.CancelTradeCommandHandler  MyCancelTradeHandler     = new cs_elbot.AdvancedCommunication.CancelTradeCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);

                //goto command handler
                AdvancedCommunication.GotoCommandHandler MyGotoCommandHandler = new cs_elbot.AdvancedCommunication.GotoCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler, MyActorHandler);

                //use object command handler
                AdvancedCommunication.UseObject MyUseObjectCommandHandler = new cs_elbot.AdvancedCommunication.UseObject(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler);

                //openstorage
                AdvancedCommunication.OpenStorage MyOpenStorageCommandHandler = new cs_elbot.AdvancedCommunication.OpenStorage(MyHelpCommandHandler, MyTCPWrapper, MyMessageParser, MyMySqlManager, MyActorHandler, MyAdminHelpCommandHandler);
                //withdraw
                AdvancedCommunication.WithdrawCommandHandler MyWithdrawCommandHandler = new cs_elbot.AdvancedCommunication.WithdrawCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyStorage, MyTradeHandler, MyStats, MyInventory);
                AdvancedCommunication.DepositCommandHandler  MyDepositCommandHandler  = new cs_elbot.AdvancedCommunication.DepositCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats, MyStorage);

                //gamble
                AdvancedCommunication.GAMBLECommandHandler MyGAMBLECommandHandler = new AdvancedCommunication.GAMBLECommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.PRIZECommandHandler  MyPRIZECommandHandler  = new AdvancedCommunication.PRIZECommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats, MyLogger, MyActorHandler);

                //isonline command
                AdvancedCommunication.ISOnlineCommandHandler MyISOnlineCommandHandler = new AdvancedCommunication.ISOnlineCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);


                //Guard bot code below
                if (botType == 3)
                {
                    AdvancedCommunication.AssessThreat MyAssessThreat = new AdvancedCommunication.AssessThreat(MyTCPWrapper, MyMySqlManager, MyActorHandler);
                }

                Perks MyPerks = new Perks(MyTCPWrapper, MyLogger, MyMySqlManager);
                CLI   MyCLI   = new CLI(MyTCPWrapper, MyMessageParser);

                MyCLI.DoLoop();
            }
            catch (System.Net.Sockets.SocketException se)
            {
                Console.WriteLine("Error in main loop: " + se.Message);
                if (se.ErrorCode == 11001) // Host name not found
                {
                    Console.WriteLine("When this error occurs, check that you are connected to the internet and a firewall is not blocking this program.");
                }
            }
            catch (Exception except)
            {
                MyErrorHandler.writeErrorMessage("Exception in main loop: " + except);
            }
            finally
            {
                Console.ReadLine();
            }
        }
Ejemplo n.º 12
0
        public TradeHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, MySqlManager MyMySqlManager, Inventory MyInventory, AdvancedCommunication.ActorHandler MyActorHandler, Logger MyLogger, Storage MyStorage, errorHandler MyErrorHandler, AdvancedCommunication.HelpCommandHandler MyHelpCommandHandler)
        {
            this.TheErrorHandler = MyErrorHandler;
                    this.TheHelpCommandHandler = MyHelpCommandHandler;
            this.TheTCPWrapper = MyTCPWrapper;
            this.TheMessageParser = MyMessageParser;
            this.TheMySqlManager = MyMySqlManager;
            this.TheInventory = MyInventory;
            this.TheActorHandler = MyActorHandler;
            this.TheLogger = MyLogger;
                    this.TheStorage = MyStorage;
                    //this.TheErrorHandler = MyErrorHandler;

            TradeTimer.Stop();
            TradeTimer.Interval=1000;
            TradeTimer.Elapsed += new System.Timers.ElapsedEventHandler(TradeTimer_Tick );

            this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
            this.TheMessageParser.Got_TradeRequest += new BasicCommunication.MessageParser.Got_TradeRequest_EventHandler(OnGotTradeRequest);
            this.TheMessageParser.Got_AbortTrade += new BasicCommunication.MessageParser.Got_AbortTrade_EventHandler(OnGotAbortTrade);
            this.TheInventory.GotNewInventoryList += new Inventory.GotNewInventoryListEventHandler(OnGotNewInventoryList);
                    if (Settings.IsTradeBot == true)
                    {
                        MyHelpCommandHandler.AddCommand("#total - get a detailed total of your transaction");
                    }

                    TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
        }
Ejemplo n.º 13
0
        private void OnGotCommand(object sender, TCPWrapper.GotCommandEventArgs e)
        {
            if (Gambling || claimingPrize)
            {
                return;
            }
            if (e.CommandBuffer[0] == 35) // GET_TRADE_OBJECT
            {
                GET_TRADE_OBJECT(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 36)
            {
                GET_TRADE_ACCEPT(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 37)
            {
                GET_TRADE_REJECT(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 38)
            {
                GET_TRADE_ABORT(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 39)
            {
                REMOVE_TRADE_OBJECT(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 20)
            {
                INVENTORY_ITEM_TEXT(e.CommandBuffer);
                return;
            }
            // 40 = GET_YOUR_TRADE_OBJECTS, sent whenever a trade is initiated
            if (e.CommandBuffer[0] == 40) //GET_YOUR_TRADE_OBJECTS
            {
                GET_YOUR_TRADE_OBJECTS(e.CommandBuffer);
                return;
            }
            if (e.CommandBuffer[0] == 41) //GET_TRADE_PARTNER_name
            {
                int i,storagetrade;
                i = System.BitConverter.ToInt16(e.CommandBuffer, 1) - 2;
                storagetrade = System.BitConverter.ToInt16(e.CommandBuffer, 3);
                string name = System.Text.Encoding.ASCII.GetString(e.CommandBuffer, 4, i);
                return;
            }
            if (e.CommandBuffer[0] == 67) // STORAGE_LIST
            {
                STORAGE_LIST(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 68) // STORAGE_ITEMS (per category)
            {
                STORAGE_ITEMS(e.CommandBuffer);
                return;
            }

            if (e.CommandBuffer[0] == 69) // STORAGE_TEXT
            {
                STORAGE_TEXT(e.CommandBuffer);
                return;
            }
        }
Ejemplo n.º 14
0
        //public static myCoords myCurrentCoords = new myCoords();
        //public struct myCoords
        //{
        //    public int x;
        //    public int y;
        //}
        public static void Main(string[] args)
        {
            myHome.x = 0;
            myHome.y = 0;
            myHome.heading = 0;
            myHome.mapName = "";
            // Create instance of the log file handler
            Logger MyLogger = new Logger();

            // Create instance of the TCP client
            TCPClient.TCPClient MyTCPClient = new TCPClient.TCPClient();

            // Initialize the TCPWrapper
            TCPWrapper MyTCPWrapper = new TCPWrapper(MyTCPClient, MyLogger);

            // set up working directory
            if (args.Length > 0)
            {
                string botName = args[0];
                launchPath = args[1];
                SqlServer = args[2];
                SqlPort = Convert.ToInt16(args[3]);
                SqlUsername = args[4];
                SqlPassword = args[5];
                SqlDatabase = args[6];
                Environment.CurrentDirectory = launchPath + botName;
            }
            if (Environment.CurrentDirectory.ToLower().Contains("Live".ToLower()))
            {
                serverName = "live";
            }
            else if (Environment.CurrentDirectory.ToLower().Contains("Test".ToLower()))
            {
                serverName = "test";
            }
            else if (Environment.CurrentDirectory.ToLower().Contains("PK".ToLower()))
            {
                serverName = "pk";
            }
            else
            {
                launchedByBotManager = false;
            launchPath = "C:\\bot\\test\\";
                Console.WriteLine("serverName not found in file path, defaulting to test");
                Console.WriteLine("path containing cs-elbot.exe should be something like c:/bot/test/botname/");
                Console.WriteLine("If you're not using bot manager, don't worry about this message");
            }

            Settings MySettings = new Settings();

            //Load Sql Configuration if not supplied in parameters
            if (SqlServer == "")
            {
                MySettings.LoadSqlSettingsFromConfigfile();
            }

            MySettings.LoadSettings();
            errorHandler MyErrorHandler = new errorHandler();

            //Setup the MySQL Database
            MySqlManager MyMySqlManager = new MySqlManager(SqlServer, SqlUsername, SqlPassword, SqlDatabase, SqlPort, MyLogger, MyTCPWrapper, MyErrorHandler);
            Settings.TradeTimeOut = MyMySqlManager.GetTimeoutInterval(Settings.botid);
            botType = MyMySqlManager.getBotType(Settings.botid);
            //Console.WriteLine("Bot type: " + botType);

            MyMySqlManager.ImStarted(Settings.botid);
            Settings.URL = MyMySqlManager.getURL() + Settings.Loginname + ".php";

            try
            {
                System.Net.IPHostEntry ServerIPHostEntry = System.Net.Dns.GetHostEntry(Settings.ServerHostname);
                MyTCPWrapper.HostIp = ServerIPHostEntry.AddressList[0];
                MyTCPWrapper.Port = Settings.ServerPort;

                Logging.CommandLogger MyCommandDebugger = new Logging.CommandLogger(MyTCPWrapper, MyLogger);

                //BasicCommunication.HeartBeat MyHeartBeat = new BasicCommunication.HeartBeat(MyTCPWrapper, MyErrorHandler);
                BasicCommunication.HeartBeat MyHeartBeat = new BasicCommunication.HeartBeat(MyTCPWrapper);
                BasicCommunication.Ping MyPing = new BasicCommunication.Ping(MyTCPWrapper);
                Inventory MyInventory = new Inventory(MyTCPWrapper, MyLogger, MyMySqlManager);
                Storage MyStorage = new Storage(MyTCPWrapper, MyLogger, MyMySqlManager);
                BasicCommunication.new_minute MyMewMinute = new BasicCommunication.new_minute(MyTCPWrapper, MyMySqlManager, MyInventory);

                // Login here
                BasicCommunication.Login MyLogin = new BasicCommunication.Login(MyTCPWrapper);
                BasicCommunication.RawText MyRawText = new BasicCommunication.RawText(MyTCPWrapper);
                BasicCommunication.MessageParser MyMessageParser = new BasicCommunication.MessageParser(MyRawText, MyLogger, MyTCPWrapper, MyMySqlManager);
                BasicCommunication.changeMap MyChangeMap = new BasicCommunication.changeMap(MyTCPWrapper);

                //if this is a storage bot (not a tradebot) start a shutdown timer
                if (Settings.IsTradeBot == false && botType == 2)
                {
                    BasicCommunication.Shutdown MyShutdown = new BasicCommunication.Shutdown(MyTCPWrapper, MyMessageParser, MyMySqlManager, MyErrorHandler);
                }

                Logging.LoginLogger MyLoginLogger = new Logging.LoginLogger(MyLogin, MyLogger, MyTCPWrapper, MyMySqlManager);
                Logging.MessageLogger MyMessageLogger = new Logging.MessageLogger(MyMessageParser, MyLogger, MyMySqlManager);

                AdvancedCommunication.ActorHandler MyActorHandler = new AdvancedCommunication.ActorHandler(MyTCPWrapper, MyLogger, MyMySqlManager);

                AdvancedCommunication.PMHandler MyPMHandler = new AdvancedCommunication.PMHandler(MyTCPWrapper, MyMessageParser, MyMySqlManager);
                AdvancedCommunication.HelpCommandHandler MyHelpCommandHandler = new AdvancedCommunication.HelpCommandHandler(MyTCPWrapper, MyMessageParser, MyPMHandler, MyMySqlManager);
                AdvancedCommunication.AdvHelpCommandHandler MyAdvHelpCommandHandler = new AdvancedCommunication.AdvHelpCommandHandler(MyTCPWrapper, MyMessageParser, MyPMHandler, MyMySqlManager, MyHelpCommandHandler);
                AdvancedCommunication.AdminHelpCommandHandler MyAdminHelpCommandHandler = new AdvancedCommunication.AdminHelpCommandHandler(MyTCPWrapper, MyMessageParser, MyPMHandler, MyMySqlManager, MyAdvHelpCommandHandler);
                AdvancedCommunication.SAYCommandHandler MySAYCommandHandler = new AdvancedCommunication.SAYCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyPMHandler);
                AdvancedCommunication.PMCommandHandler MyPMCommandHandler = new AdvancedCommunication.PMCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager);

                AdvancedCommunication.BuddyHandler MyBuddyHandler = new AdvancedCommunication.BuddyHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogin);

                //get my stats
                Stats MyStats = new Stats(MyTCPWrapper, MyLogger, MyMySqlManager);

                TradeHandler MyTradeHandler = new TradeHandler(MyTCPWrapper, MyMessageParser, MyMySqlManager, MyInventory, MyActorHandler, MyLogger, MyStorage, MyErrorHandler, MyHelpCommandHandler);

                AdvancedCommunication.INVCommandHandler MyINVCommandHandler = new AdvancedCommunication.INVCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats);
                AdvancedCommunication.INVRCommandHandler MyINVRCommandHandler = new AdvancedCommunication.INVRCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats);
                AdvancedCommunication.STOCommandHandler MySTOCommandHandler = new AdvancedCommunication.STOCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyStorage, MyTradeHandler, MyStats);
                AdvancedCommunication.INVLISTCommandHandler MyINVLISTCommandHandler = new AdvancedCommunication.INVLISTCommandHandler(MyHelpCommandHandler, MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats);
                AdvancedCommunication.ReserveCommandHandler MyReserveCommandHandler = new AdvancedCommunication.ReserveCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats, MyStorage);

                AdvancedCommunication.GiveCommandHandler MyGiveCommandHandler = new AdvancedCommunication.GiveCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyPMHandler);
                AdvancedCommunication.GiveToCommandHandler MyGiveToCommandHandler = new AdvancedCommunication.GiveToCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyPMHandler);
                AdvancedCommunication.BUYCommandHandler MyBUYCommandHandler = new AdvancedCommunication.BUYCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.DESCRIBECommandHandler MyDESCRIBECommandHandler = new AdvancedCommunication.DESCRIBECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyPMHandler);

                AdvancedCommunication.DONATECommandHandler MyDONATECommandHandler = new AdvancedCommunication.DONATECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.PUTONSALECommandHandler MyPUTONSALECommandHandler = new AdvancedCommunication.PUTONSALECommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.WANTEDCommandHandler MyWANTEDCommandHandler = new AdvancedCommunication.WANTEDCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory, MyStats);
                AdvancedCommunication.LOCCommandHandler MyLOCCommandHandler = new AdvancedCommunication.LOCCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.BANCommandHandler MyBANCommandHandler = new AdvancedCommunication.BANCommandHandler(MyHelpCommandHandler, MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.DropCommandHandler MyDropCommandHandler = new AdvancedCommunication.DropCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.LaunchCommandHandler MyLaunchCommandHandler = new AdvancedCommunication.LaunchCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.QuitCommandHandler MyQuitCommandHandler = new AdvancedCommunication.QuitCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.WearCommandHandler MyWearCommandHandler = new AdvancedCommunication.WearCommandHandler(MyActorHandler, MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.UseItemCommandHandler MyUseItemCommandHandler = new AdvancedCommunication.UseItemCommandHandler(MyActorHandler, MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);

                AdvancedCommunication.ABOUTCommandHandler MyABOUTCommandHandler = new AdvancedCommunication.ABOUTCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.AFKCommandHandler MyAFKCommandHandler = new AdvancedCommunication.AFKCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.ELTCCommandHandler MyELTCCommandHandler = new AdvancedCommunication.ELTCCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);

                AdvancedCommunication.ACCEPTMECommandHandler MyACCEPTMECommandHandler = new AdvancedCommunication.ACCEPTMECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.KICKMECommandHandler MyKICKMECommandHandler = new AdvancedCommunication.KICKMECommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.GTCommandHandler MyGTCommandHandler = new AdvancedCommunication.GTCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.GuildTextHandler MyGuildTextHandler = new AdvancedCommunication.GuildTextHandler(MyRawText, MyTCPWrapper, MyMessageParser, MyMySqlManager, MyLogger);

                AdvancedCommunication.GreetPlayers MyGreetPlayers = new AdvancedCommunication.GreetPlayers(MyTCPWrapper, MyMySqlManager, MyActorHandler);
                AdvancedCommunication.AdvertHandler MyAdvertHandler = new AdvancedCommunication.AdvertHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory, MyErrorHandler);
                AdvancedCommunication.HouseKeepingHandler MyHouseKeepingHandler = new AdvancedCommunication.HouseKeepingHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyErrorHandler);
                AdvancedCommunication.AltAdvertHandler MyAltAdvertHandler = new AdvancedCommunication.AltAdvertHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory, MyErrorHandler);
                //AdvancedCommunication.RulesHandler MyRulesHandler = new AdvancedCommunication.RulesHandler(MyTCPWrapper, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.MOVECommandHandler MyMOVECommandHandler = new AdvancedCommunication.MOVECommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler);
                AdvancedCommunication.SitStandCommandHandler MySitStandCommandHandler = new AdvancedCommunication.SitStandCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler);
                AdvancedCommunication.RetradeCommandHandler MyRetradeCommandHandler = new AdvancedCommunication.RetradeCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyActorHandler, MyTradeHandler);
                AdvancedCommunication.TextCommandsHandler MyTextCommandsHandler = new AdvancedCommunication.TextCommandsHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);
                AdvancedCommunication.WhoIsTradingCommandHandler MyWhoIsTradingHandler = new cs_elbot.AdvancedCommunication.WhoIsTradingCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);
                AdvancedCommunication.CancelTradeCommandHandler MyCancelTradeHandler = new cs_elbot.AdvancedCommunication.CancelTradeCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler);

                //goto command handler
                AdvancedCommunication.GotoCommandHandler MyGotoCommandHandler = new cs_elbot.AdvancedCommunication.GotoCommandHandler(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler, MyActorHandler);

                //use object command handler
                AdvancedCommunication.UseObject MyUseObjectCommandHandler = new cs_elbot.AdvancedCommunication.UseObject(MyTCPWrapper, MyMessageParser, MyAdminHelpCommandHandler, MyMySqlManager, MyPMHandler);

                //openstorage
                AdvancedCommunication.OpenStorage MyOpenStorageCommandHandler = new cs_elbot.AdvancedCommunication.OpenStorage(MyHelpCommandHandler, MyTCPWrapper, MyMessageParser, MyMySqlManager, MyActorHandler, MyAdminHelpCommandHandler);
                //withdraw
                AdvancedCommunication.WithdrawCommandHandler MyWithdrawCommandHandler = new cs_elbot.AdvancedCommunication.WithdrawCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyStorage, MyTradeHandler, MyStats, MyInventory);
                AdvancedCommunication.DepositCommandHandler MyDepositCommandHandler = new cs_elbot.AdvancedCommunication.DepositCommandHandler(MyTCPWrapper, MyMessageParser, MyAdvHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats, MyStorage);

                //gamble
                AdvancedCommunication.GAMBLECommandHandler MyGAMBLECommandHandler = new AdvancedCommunication.GAMBLECommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger, MyTradeHandler, MyInventory);
                AdvancedCommunication.PRIZECommandHandler MyPRIZECommandHandler = new AdvancedCommunication.PRIZECommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyInventory, MyTradeHandler, MyStats, MyLogger, MyActorHandler);

                //isonline command
                AdvancedCommunication.ISOnlineCommandHandler MyISOnlineCommandHandler = new AdvancedCommunication.ISOnlineCommandHandler(MyTCPWrapper, MyMessageParser, MyHelpCommandHandler, MyMySqlManager, MyLogger);

                //Guard bot code below
                if (botType == 3)
                {
                    AdvancedCommunication.AssessThreat MyAssessThreat = new AdvancedCommunication.AssessThreat(MyTCPWrapper, MyMySqlManager, MyActorHandler);
                }

                Perks MyPerks = new Perks(MyTCPWrapper, MyLogger, MyMySqlManager);
                CLI MyCLI = new CLI(MyTCPWrapper, MyMessageParser);

                MyCLI.DoLoop();
            }
            catch (System.Net.Sockets.SocketException se)
            {
                Console.WriteLine("Error in main loop: " + se.Message);
                if (se.ErrorCode == 11001) // Host name not found
                {
                    Console.WriteLine("When this error occurs, check that you are connected to the internet and a firewall is not blocking this program.");
                }
            }
            catch (Exception except)
            {
                MyErrorHandler.writeErrorMessage("Exception in main loop: " + except);
            }
            finally
            {
                Console.ReadLine();
            }
        }