Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        public DESCRIBECommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdvHelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, PMHandler MyPMHandler)
        {
            this.TheTCPWrapper            = MyTCPWrapper;
            this.TheMessageParser         = MyMessageParser;
            this.TheAdvHelpCommandHandler = MyHelpCommandHandler;
            this.TheMySqlManager          = MyMySqlManager;
            this.TheLogger       = MyLogger;
            this.TheTradeHandler = MyTradeHandler;
            this.ThePMHandler    = MyPMHandler;

            //if (CommandIsDisabled == false)
            {
                TheAdvHelpCommandHandler.AddCommand("#describe / #d - describe an item");
                ThePMHandler.AddCommand("#d");
//                TheAdvHelpCommandHandler.AddCommand("#d - null");
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo n.º 6
0
        public GiveToCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,AdvHelpCommandHandler MyAdvHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, PMHandler MyPMHandler)
        {
            this.TheTCPWrapper = MyTCPWrapper;
            this.TheMessageParser = MyMessageParser;
            this.TheAdvHelpCommandHandler = MyAdvHelpCommandHandler;
            this.TheMySqlManager = MyMySqlManager;
            this.TheLogger = MyLogger;
            this.TheTradeHandler = MyTradeHandler;
            this.ThePMHandler = MyPMHandler;
            //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#give",Settings.botid);

            //if (CommandIsDisabled == false)
            {
                TheAdvHelpCommandHandler.AddCommand("#giveto - give item to person trading with bot");
            //                ThePMHandler.AddCommand("#g");
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo n.º 7
0
        public SAYCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, PMHandler MyPMHandler)
        {
            this.TheTCPWrapper              = MyTCPWrapper;
            this.TheMessageParser           = MyMessageParser;
            this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler;
            this.TheMySqlManager            = MyMySqlManager;
            this.TheLogger    = MyLogger;
            this.ThePMHandler = MyPMHandler;
            //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#say",Settings.botid);

            //if (CommandIsDisabled == false)
            {
                TheAdminHelpCommandHandler.AddCommand("#say / #s - say something in local channel");
                //TheAdminHelpCommandHandler.AddCommand("#s - null");
                ThePMHandler.AddCommand("#s");
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo n.º 8
0
        public DESCRIBECommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdvHelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, PMHandler MyPMHandler)
        {
            this.TheTCPWrapper = MyTCPWrapper;
            this.TheMessageParser = MyMessageParser;
            this.TheAdvHelpCommandHandler = MyHelpCommandHandler;
            this.TheMySqlManager = MyMySqlManager;
            this.TheLogger = MyLogger;
            this.TheTradeHandler = MyTradeHandler;
            this.ThePMHandler = MyPMHandler;

            //if (CommandIsDisabled == false)
            {
                TheAdvHelpCommandHandler.AddCommand("#describe / #d - describe an item");
                ThePMHandler.AddCommand("#d");
            //                TheAdvHelpCommandHandler.AddCommand("#d - null");
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo n.º 9
0
        public GiveCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdvHelpCommandHandler MyAdvHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, PMHandler MyPMHandler)
        {
            this.TheTCPWrapper            = MyTCPWrapper;
            this.TheMessageParser         = MyMessageParser;
            this.TheAdvHelpCommandHandler = MyAdvHelpCommandHandler;
            this.TheMySqlManager          = MyMySqlManager;
            this.TheLogger       = MyLogger;
            this.TheTradeHandler = MyTradeHandler;
            this.ThePMHandler    = MyPMHandler;
            //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#give",Settings.botid);

            //if (CommandIsDisabled == false)
            {
                TheAdvHelpCommandHandler.AddCommand("#give / #g - give you an item");
                ThePMHandler.AddCommand("#g");
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo n.º 10
0
        public SAYCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, Logger MyLogger, PMHandler MyPMHandler)
        {
            this.TheTCPWrapper = MyTCPWrapper;
            this.TheMessageParser = MyMessageParser;
            this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler;
            this.TheMySqlManager = MyMySqlManager;
            this.TheLogger = MyLogger;
            this.ThePMHandler = MyPMHandler;
            //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#say",Settings.botid);

            //if (CommandIsDisabled == false)
            {
                TheAdminHelpCommandHandler.AddCommand("#say / #s - say something in local channel");
                //TheAdminHelpCommandHandler.AddCommand("#s - null");
                ThePMHandler.AddCommand("#s");
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo n.º 11
0
        public GotoCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser, AdminHelpCommandHandler MyAdminHelpCommandHandler, MySqlManager MyMySqlManager, PMHandler MyPMHandler, ActorHandler MyActorHandler)
        {
            this.TheTCPWrapper = MyTCPWrapper;
            this.TheMessageParser = MyMessageParser;
            this.TheAdminHelpCommandHandler = MyAdminHelpCommandHandler;
            this.TheMySqlManager = MyMySqlManager;
            this.ThePMHandler = MyPMHandler;
            this.TheActorHandler = MyActorHandler;

            //if (CommandIsDisabled == false)
            {
                TheAdminHelpCommandHandler.AddCommand("#goto - Move the bot (long range)");

                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
                TheMessageParser.Got_LocationInfo += new BasicCommunication.MessageParser.Got_LocationInfo_EventHandler(OnGotLocationInfo);
                TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
                myThread = new Thread(new ThreadStart(makeMoves));
            }
        }
Exemplo n.º 12
0
        public MOVECommandHandler(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("#move / #m - Move the bot (very local range)");
                TheAdminHelpCommandHandler.AddCommand("#turnleft / #tl - Rotate the bot left");
                TheAdminHelpCommandHandler.AddCommand("#turnright / #tr - Rotate the bot left");
                ThePMHandler.AddCommand("#tl");
                ThePMHandler.AddCommand("#m");
                ThePMHandler.AddCommand("#tr");

                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo n.º 13
0
        public MOVECommandHandler(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("#move / #m - Move the bot (very local range)");
                TheAdminHelpCommandHandler.AddCommand("#turnleft / #tl - Rotate the bot left");
                TheAdminHelpCommandHandler.AddCommand("#turnright / #tr - Rotate the bot left");
                ThePMHandler.AddCommand("#tl");
                ThePMHandler.AddCommand("#m");
                ThePMHandler.AddCommand("#tr");

                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Exemplo 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();
            }
        }
Exemplo n.º 15
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();
            }
        }