Esempio n. 1
0
        //PropertiesQueue propRequester;

        public SimObjectsConsole(RadegastInstance instance, CogbotRadegastPlugin plugin)
        {
            this.instance = instance;
            InitializeComponent();
            Plugin     = plugin;
            addObjects = new TaskQueueHandler(plugin.TheBot, "SimObjectsConsole", TimeSpan.Zero, false);
            Disposed  += new EventHandler(frmObjects_Disposed);

            //propRequester = new PropertiesQueue(instance);
            //propRequester.OnTick += new PropertiesQueue.TickCallback(propRequester_OnTick);

            nudRadius.Value         = (decimal)searchRadius;
            nudRadius.ValueChanged += nudRadius_ValueChanged;
            nudRadius.KeyUp        += nudRadius_KeyUp;
            nudRadius.KeyDown      += nudRadius_KeyDown;

            lstPrims.ListViewItemSorter = new SimObjectSorter(client.Self);
            lstPrims.MouseUp           += lstPrims_MouseUp;

            AddObjectType(typeof(SimObjectImpl));
            AddObjectType(typeof(Primitive));
            AddObjectType(typeof(Primitive.ObjectProperties));
            // Callbacks
            client.Network.Disconnected     += Network_OnDisconnected;
            instance.Netcom.ClientConnected += Network_OnConnected;
            if (instance.Netcom.IsLoggedIn)
            {
                RegisterWorldSystemEvents();
            }
            client.Objects.KillObject += Objects_OnObjectKilled;
            //client.Objects.OnObjectProperties += new ObjectManager.ObjectPropertiesCallback(Objects_OnObjectProperties);
            client.Network.SimChanged        += Network_OnCurrentSimChanged;
            client.Avatars.UUIDNameReply     += Avatars_OnAvatarNames;
            instance.State.OnWalkStateCanged += new StateManager.WalkStateCanged(State_OnWalkStateCanged);
        }
        public Abortable GetTaskQueueHandler(string id, bool createIfMissing)
        {
            id = id.ToLower();
            IList <Abortable> BotTaskQueues = AllTaskQueues();

            lock (BotTaskQueues)
            {
                foreach (Abortable tq0 in BotTaskQueues)
                {
                    if (tq0.MatchesId(id))
                    {
                        return(tq0);
                    }
                }
                if (!createIfMissing)
                {
                    return(null);
                }
                var tq = new TaskQueueHandler(this, new NamedPrefixThing(id, GetName), TimeSpan.FromMilliseconds(1),
                                              true);
                {
                    AddTaskQueue(id, tq);
                }
                return(tq);
            }
        }
Esempio n. 3
0
        //PropertiesQueue propRequester;

        public SimObjectsConsole(RadegastInstance instance, CogbotRadegastPlugin plugin)
        {
            this.instance = instance;
            InitializeComponent();
            Plugin = plugin;
            addObjects = new TaskQueueHandler(plugin.TheBot, "SimObjectsConsole", TimeSpan.Zero, false);
            Disposed += new EventHandler(frmObjects_Disposed);

            //propRequester = new PropertiesQueue(instance);
            //propRequester.OnTick += new PropertiesQueue.TickCallback(propRequester_OnTick);

            nudRadius.Value = (decimal)searchRadius;
            nudRadius.ValueChanged += nudRadius_ValueChanged;
            nudRadius.KeyUp += nudRadius_KeyUp;
            nudRadius.KeyDown += nudRadius_KeyDown;

            lstPrims.ListViewItemSorter = new SimObjectSorter(client.Self);
            lstPrims.MouseUp += lstPrims_MouseUp;

            AddObjectType(typeof (SimObjectImpl));
            AddObjectType(typeof(Primitive));
            AddObjectType(typeof(Primitive.ObjectProperties));
            // Callbacks
            client.Network.Disconnected += Network_OnDisconnected;
            instance.Netcom.ClientConnected += Network_OnConnected;
            if (instance.Netcom.IsLoggedIn)
            {
                RegisterWorldSystemEvents();
            }
            client.Objects.KillObject +=  Objects_OnObjectKilled;
            //client.Objects.OnObjectProperties += new ObjectManager.ObjectPropertiesCallback(Objects_OnObjectProperties);
            client.Network.SimChanged +=  Network_OnCurrentSimChanged;
            client.Avatars.UUIDNameReply += Avatars_OnAvatarNames;
            instance.State.OnWalkStateCanged += new StateManager.WalkStateCanged(State_OnWalkStateCanged);
        }
Esempio n. 4
0
        public CogbotTabWindow(RadegastInstance instance, CogbotRadegastPlugin man)
        {
            InitializeComponent();
            this.instance = instance;
            Disposed     += new EventHandler(ChatConsole_Disposed);

            if (!instance.advancedDebugging)
            {
//                tbtnAnim.Visible = false;
//              tbtnTextures.Visible = false;

                ctxAnim.Visible     = false;
                ctxTextures.Visible = false;
            }

            ctxAnim.Visible     = true;
            ctxTextures.Visible = true;
            writeLock           = new TaskQueueHandler(man.TheBot, "FormWriter", TimeSpan.Zero, false);


            // Callbacks
            netcom.ClientLoginStatus += new EventHandler <LoginProgressEventArgs>(netcom_ClientLoginStatus);
            //netcom.ClientLoggedOut += new EventHandler(netcom_ClientLoggedOut);
            //  netcom.ChatReceived += new EventHandler<ChatEventArgs>(netcom_ChatReceived);
            //netcom.InstantMessageReceived += new EventHandler<InstantMessageEventArgs>(netcom_InstantMessageReceived);
            //this.instance.Config.ConfigApplied += new EventHandler<ConfigAppliedEventArgs>(Config_ConfigApplied);
            // client.Grid.OnCoarseLocationUpdate += new GridManager.CoarseLocationUpdateCallback(Grid_OnCoarseLocationUpdate);
            //client.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties);

            // movement = new SleekMovement(client);
            printer     = new RichTextBoxPrinter(rtbChat);
            chatManager = man;
            //chatManager.PrintStartupMessage();

            this.instance.MainForm.Load += new EventHandler(MainForm_Load);
            this.VisibleChanged         += Form_VisibleChanged;

            simObjectSorterClass          = new SimObjectSorterClass();
            lvwObjects.ListViewItemSorter = simObjectSorterClass;

            //Alice = new AIMLbot.Bot();
            //Alice.isAcceptingUserInput = false;

            //try {
            //    Alice.loadSettings();
            //    AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(Alice);
            //    Alice.isAcceptingUserInput = false;
            //    loader.loadAIML(Alice.PathToAIML);
            //    Alice.isAcceptingUserInput = true;
            //} catch (Exception ex) {
            //    System.Console.WriteLine("Failed loading ALICE: " + ex.Message);
            //}
            //instance.Client.Self.Movement.UseOnlyThreads.Add(Thread.CurrentThread);
            // ApplyConfig(this.instance.Config.CurrentConfig);
            //ClientManager.SingleInstance.Clients[]
            //BotClien.OnlyOneCurrentBotClient
            this.cbxInput.Enabled = true;
        }
 protected override void SaveFile(string tmpname)
 {
     if (Item == null)
     {
         Item = SimGesture.SaveGesture(this);
     }
     byte[] bs = AssetData;
     if (bs != null && bs.Length > 0)
     {
         NeedsSave = false;
         FileName  = "anim_cache/" + tmpname + ".anim";
         WriteLine("saving anim file " + FileName);
         TaskQueueHandler.WithLock(SimAssetStore.SavingFileLock, () => {
             if (Directory.Exists("anim_cache"))
             {
                 File.WriteAllBytes(FileName, AssetData);
             }
         });
     }
     //WorldObjects.Master.GetModuleName()
 }
Esempio n. 6
0
        internal void _listener_404(IHttpClientContext context, IHttpRequest request, IHttpResponse response)
        {
            HttpJob httpJob = new HttpJob(this, context, request, response);

            lock (HttpJobs)
            {
                HttpJobs.Add(httpJob);
            }
            // 5 second wait
            if (Monitor.TryEnter(HttpLock, waitForEachTime))
            {
                DoJob(httpJob);
                Monitor.Exit(HttpLock);
            }
            else
            {
                LogInfo("ERROR Waiting for prevoius request more than " +
                        TaskQueueHandler.GetTimeString(waitForEachTime));
                httpJob.OutOfLock = true;
                DoJob(httpJob);
            }
        }
Esempio n. 7
0
 public void AddTaskQueue(string id, TaskQueueHandler tq)
 {
     tq.Owner = this;
 }
Esempio n. 8
0
 public Abortable GetTaskQueueHandler(string id, bool createIfMissing)
 {
     id = id.ToLower();
     IList<Abortable> BotTaskQueues = AllTaskQueues();
     lock (BotTaskQueues)
     {
         foreach (Abortable tq0 in BotTaskQueues)
         {
             if (tq0.MatchesId(id)) return tq0;
         }
         if (!createIfMissing) return null;
         var tq = new TaskQueueHandler(this, new NamedPrefixThing(id, GetName), TimeSpan.FromMilliseconds(1),
                                       true);
         {
             AddTaskQueue(id, tq);
         }
         return tq;
     }
 }
Esempio n. 9
0
 public SimEventMulticastPipeline(object publisher)
 {
     Publisher     = publisher;
     taskQueue     = new TaskQueueHandler(publisher as ContextualSingleton, new NamedPrefixThing("SimEventMulticastPipeline ", publisher.ToString));
     EventsEnabled = true;
 }
Esempio n. 10
0
        public String taskInterpreterType = "DotLispInterpreter";// DotLispInterpreter,CycInterpreter or ABCLInterpreter

        public ClientManager()
        {
            lock (SingleInstanceLock)
            {
                if (_si != null)
                {
                    Exception e = new Exception("Only one instance of Client Manafger please!!");
                    GlobalWriteLine("" + e);
                    throw e;
                }
                SingleInstance = this;
            }
            if (!ClientManager.SingleInstance.ProcessCommandArgs())
            {
                ConsoleApp.Usage();
            }
            DLRConsole.AddOutput(new OutputDelegateWriter(VeryRealWriteLine));
            var col = DLRConsole.TransparentCallers;
            lock (col)
            {
                col.Add(typeof(BotClient));
                col.Add(typeof(ClientManager));
                col.Add(typeof(SimEventMulticastPipeline));
                col.Add(typeof(Cogbot.SimEventTextSubscriber));
                col.Add(typeof(DotLisp.CLSMember));
            }
            OneAtATimeQueue = new TaskQueueHandler(null, "ClientManager.OneAtATime", new TimeSpan(0, 0, 0, 0, 10), true, false);
            PostAutoExec = new TaskQueueHandler(null, "ClientManager.PostAutoExec", new TimeSpan(0, 0, 0, 0, 10), false,
                                                false);
            LoadConfigFile(ClientManagerConfig.arguments.GetValue("botconfig", "botconfig.xml"));
            foreach (var arg in ClientManagerConfig.arguments.ParamMap)
            {
                string value;
                if (ClientManagerConfig.arguments.TryGetValue(arg.Key, out value))
                {
                    config[arg.Key] = value;
                }
            }
            DefaultAccount.LoadFromConfig(config);
            nextTcpPort = config.GetValue("tcpPort", 5555);
            if (clientManagerHttpServer == null)
            {
                clientManagerHttpServer = MushDLR223.Utilities.HttpServerUtil.CreateHttpServer(this, config.GetValue("httpd",5580), "first_robot");
            }
            groupActions = new SortedDictionary<string, Cogbot.Actions.CommandInfo>();
            registrationTypes = new List<Type>();

            RegisterAssembly(Assembly.GetExecutingAssembly());
            RegisterAssembly(GetType().Assembly);
            RegisterAssembly(typeof(DLRConsole).Assembly);
            RegisterAssembly(typeof(PathSystem3D.Navigation.SimPathStore).Assembly);
        }
Esempio n. 11
0
        public WorldObjects(BotClient client)
            : base(client)
        {
            _defaultProvider = new DefaultWorldGroupProvider(this);
            MushDLR223.ScriptEngines.ScriptManager.AddGroupProvider(client, _defaultProvider);
            OnConnectedQueue = new TaskQueueHandler(client, new NamedPrefixThing("OnConnectedQueue", client.GetName),
                                                    TimeSpan.FromMilliseconds(20), false);
            client.AddTaskQueue("OnConnectedQueue", OnConnectedQueue);
            client.WorldSystem = this;
            RegisterAll();
            DLRConsole.TransparentCallers.Add(typeof (WorldObjects));
            if (Utils.GetRunningRuntime() == Utils.Runtime.Mono)
            {
                // client.Settings.USE_LLSD_LOGIN = true;
            } //else
            ///client.Settings.USE_LLSD_LOGIN = true;

            // TODO client.Network.PacketEvents.SkipEvent += Network_SkipEvent;

            lock (WorldObjectsMasterLock)
            {
                ScriptManager.AddTypeChanger(this.TypeChangerProc);
                RegionMasterSimulatorsCatchUps = false;
                if (GridMaster == null || true)
                {
                    GridMaster = this;
                    if (client.Network.CurrentSim != null) RegionMasterSimulatorsCatchUps = true;
                    if (RegionMasterSimulatorsCatchUps)
                    {
                        RegionMasterSimulatorsCatchUps = false;
                        CatchUpQueue.AddFirst(DoCatchup);
                    }
                    client.Settings.USE_LLSD_LOGIN = true;
                }
                else
                {
                    //only one rpc at a time  (btw broken with OpenSim.. works with Linden)
                    //client.Settings.USE_LLSD_LOGIN = true;
                }
                //new DebugAllEvents(client);

                client.Settings.ENABLE_CAPS = true;
                client.Settings.ENABLE_SIMSTATS = true;
                client.Settings.AVATAR_TRACKING = true;
                //client.Settings.THROTTLE_OUTGOING_PACKETS = true;
                client.Settings.MULTIPLE_SIMS = true;
                client.Settings.SEND_AGENT_THROTTLE = false;
                client.Settings.LOGIN_TIMEOUT = 10 * 1000;
                client.Settings.SIMULATOR_TIMEOUT = int.MaxValue;

                client.Settings.SEND_AGENT_UPDATES = true;

                client.Settings.SEND_PINGS = true;

                //client.Settings.DISABLE_AGENT_UPDATE_DUPLICATE_CHECK = true;
                //client.Self.Movement.AutoResetControls = false;
                //client.Self.Movement.UpdateInterval = 0;

                client.Network.SimConnected += Network_OnSimConnectedHook;
                client.Inventory.ScriptRunningReply += Inventory_OnScriptRunning;

                if (RegionMasterTexturePipeline == null)
                {
                    RegionMasterTexturePipeline = client.Assets;
                    //RegionMasterTexturePipeline.OnDownloadFinished += new TexturePipeline.DownloadFinishedCallback(RegionMasterTexturePipeline_OnDownloadFinished);
                    client.Settings.USE_ASSET_CACHE = true;
                }
                else
                {
                    //client.Settings.USE_TEXTURE_CACHE = false;
                }
                // must be after the pipeline is made
                _simAssetSystem = new SimAssetStore(client);
                if (GridMaster == this)
                {

                    {
                        //BotWorld = this;
                        SimTypeSystem.LoadDefaultTypes();
                    }
                    const int InterLeave = 3000;
                    if (EnsureSelectedTimer == null) EnsureSelectedTimer = new Timer(ReallyEnsureSelected_Thread, null, InterLeave / 2, InterLeave);
                    if (EnsureRequestedTimer == null) EnsureRequestedTimer = new Timer(ReallyEnsureRequested_Thread, null, InterLeave, InterLeave);
                    if (_SimPaths == null) _SimPaths = new WorldPathSystem(this);
                }
                //SetWorldMaster(false);
                //RegisterAll();
            }
        }
Esempio n. 12
0
 public SimEventMulticastPipeline(object publisher)
 {
     Publisher = publisher;
     taskQueue = new TaskQueueHandler(publisher as ContextualSingleton, new NamedPrefixThing("SimEventMulticastPipeline ", publisher.ToString));
     EventsEnabled = true;
 }
Esempio n. 13
0
        public CogbotTabWindow(RadegastInstance instance, CogbotRadegastPlugin man)
        {
            InitializeComponent();
            this.instance = instance;
            Disposed += new EventHandler(ChatConsole_Disposed);

            if (!instance.advancedDebugging)
            {
//                tbtnAnim.Visible = false;
  //              tbtnTextures.Visible = false;

                ctxAnim.Visible = false;
                ctxTextures.Visible = false;
            }

            ctxAnim.Visible = true;
            ctxTextures.Visible = true;
            writeLock = new TaskQueueHandler(man.TheBot, "FormWriter", TimeSpan.Zero, false);


            // Callbacks
            netcom.ClientLoginStatus += new EventHandler<LoginProgressEventArgs>(netcom_ClientLoginStatus);
            //netcom.ClientLoggedOut += new EventHandler(netcom_ClientLoggedOut);
            //  netcom.ChatReceived += new EventHandler<ChatEventArgs>(netcom_ChatReceived);
            //netcom.InstantMessageReceived += new EventHandler<InstantMessageEventArgs>(netcom_InstantMessageReceived);
            //this.instance.Config.ConfigApplied += new EventHandler<ConfigAppliedEventArgs>(Config_ConfigApplied);
            // client.Grid.OnCoarseLocationUpdate += new GridManager.CoarseLocationUpdateCallback(Grid_OnCoarseLocationUpdate);
            //client.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties);

            // movement = new SleekMovement(client);
            printer = new RichTextBoxPrinter(rtbChat);
            chatManager = man;
            //chatManager.PrintStartupMessage();

            this.instance.MainForm.Load += new EventHandler(MainForm_Load);
            this.VisibleChanged += Form_VisibleChanged;

            simObjectSorterClass = new SimObjectSorterClass();
            lvwObjects.ListViewItemSorter = simObjectSorterClass;

            //Alice = new AIMLbot.Bot();
            //Alice.isAcceptingUserInput = false;
            
            //try {
            //    Alice.loadSettings();
            //    AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(Alice);
            //    Alice.isAcceptingUserInput = false;
            //    loader.loadAIML(Alice.PathToAIML);
            //    Alice.isAcceptingUserInput = true;
            //} catch (Exception ex) {
            //    System.Console.WriteLine("Failed loading ALICE: " + ex.Message);
            //}
            //instance.Client.Self.Movement.UseOnlyThreads.Add(Thread.CurrentThread);
           // ApplyConfig(this.instance.Config.CurrentConfig);
            //ClientManager.SingleInstance.Clients[]
            //BotClien.OnlyOneCurrentBotClient
            this.cbxInput.Enabled = true;
        }
Esempio n. 14
0
        /// <summary>
        /// 
        /// </summary>
        public BotClient(ClientManager manager, GridClient g)
        {
            OpenMetaverse.Utils.InternStrings = true;
            LoginRetries = LoginRetriesFresh;
            ClientManager = manager;
            ClientManager.LastRefBotClient = this;
            _gridClient = g;
            manager.AddBotClient(this);
            NeedRunOnLogin = true;
            //manager.LastRefBotClient = this;

            Settings.USE_INTERPOLATION_TIMER = false;
            Settings.LOG_LEVEL = Helpers.LogLevel.None;

            //   Settings.LOG_RESENDS = false;
            //   Settings.ALWAYS_DECODE_OBJECTS = true;
            //   Settings.ALWAYS_REQUEST_OBJECTS = true;
            //   Settings.SEND_AGENT_UPDATES = true;
            ////   Settings.SYNC_PACKETCALLBACKS = true;
            //   Settings.OBJECT_TRACKING = true;
            //   //Settings.STORE_LAND_PATCHES = true;
            //   //Settings.USE_TEXTURE_CACHE = true;
            //   //Settings.PARCEL_TRACKING = true;
            //   //Settings.FETCH_MISSING_INVENTORY = true;
            //   // Optimize the throttle
            //   Throttle.Wind = 0;
            //   Throttle.Cloud = 0;
            //   Throttle.Land = 1000000;
            //   Throttle.Task = 1000000;
            ////Throttle.Total = 250000;
            // Settings.CAPS_TIMEOUT = 6 * 1000;
            Settings.RESEND_TIMEOUT = 20 * 1000;
            Settings.MAX_RESEND_COUNT = 10;
            Settings.LOGIN_TIMEOUT = 120 * 1000;
            //Settings.LOGOUT_TIMEOUT = 120 * 1000;
            //Settings.SIMULATOR_TIMEOUT = int.MaxValue;
            //Settings.SEND_PINGS = true;
            Settings.SEND_AGENT_APPEARANCE = true;
            Settings.LOG_DISKCACHE = false;
            //Settings.USE_LLSD_LOGIN = true;
            ////Settings.MULTIPLE_SIMS = false;

            VoiceManager = new VoiceManager(gridClient);
            //manager.AddBotClientToTextForm(this);

            botPipeline = new SimEventMulticastPipeline(this);
            OneAtATimeQueue = new TaskQueueHandler(this, new NamedPrefixThing("OneAtATimeQueue", GetName), new TimeSpan(0, 0, 0, 0, 10),
                                                   true, true);
            AddTaskQueue("OneAtATimeQueue", OneAtATimeQueue);

            SetSecurityLevel(OWNERLEVEL, null, BotPermissions.Owner);
            ClientManager.PostAutoExecEnqueue(OneAtATimeQueue.Start);

            botPipeline.AddSubscriber(new SimEventTextSubscriber(SimEventWriteLine, this));
            // SingleInstance = this;
            ///this = this;// new GridClient();


            Settings.ALWAYS_DECODE_OBJECTS = true;
            Settings.ALWAYS_REQUEST_OBJECTS = true;
            Settings.OBJECT_TRACKING = true;
            Settings.AVATAR_TRACKING = true;
            Settings.STORE_LAND_PATCHES = true;
            Settings.CACHE_PRIMITIVES = true;
            Settings.POOL_PARCEL_DATA = true;


            //  Manager = Inventory;
            //Inventory = Manager.Store;

            // config = new Configuration();
            // config.loadConfig();
            /// Settings.LOGIN_SERVER = config.simURL;
            // Opensim recommends 250k total

            //Settings.ENABLE_CAPS = true;
            Self.Movement.Camera.Far = 512f;
            //Settings.LOG_ALL_CAPS_ERRORS = true;
            //Settings.FETCH_MISSING_INVENTORY = true;
            //Settings.SEND_AGENT_THROTTLE = false;

            //muteList = new List<string>();

            Plugins = new Dictionary<string, Cogbot.Listener>();
            //registrationTypes["avatars"] = new Cogbot.Avatars(this);
            //registrationTypes["chat"] = new Cogbot.Chat(this);
            WorldSystem = new Cogbot.WorldObjects(this);
            //registrationTypes["teleport"] = new Cogbot.Teleport(this);
            //registrationTypes["whisper"] = new Cogbot.Whisper(this);
            //ObjectSystem = new Cogbot.Objects(this);
            //registrationTypes["bump"] = new Cogbot.Bump(this);
            //registrationTypes["sound"] = new Cogbot.Sound(this);
            //registrationTypes["sound"] = new Cogbot.Objects(this);
            var gc = gridClient;
            //_gridClient = null;
            Commands = new SortedDictionary<string, CommandInstance>();
			RegisterCommand("login", new Login(this));
			RegisterCommand("logout", new Logout(this));
			RegisterCommand("stop", new StopCommand(this));
			RegisterCommand("teleport", new Teleport(this));
			var desc = newCommandInfo(new Describe(this));
			Commands["describe"] = desc;
			Commands["look"] = desc;
            RegisterCommand("say", new Cogbot.Actions.Communication.SayCommand(this));
			RegisterCommand("help", new Cogbot.Actions.System.Help(this));
            RegisterCommand("setmaster", new Cogbot.Actions.System.SetMasterKeyCommand(this));
            RegisterCommand("setmasterkey", new Cogbot.Actions.System.SetMasterKeyCommand(this));
			RegisterCommand("sit", new Sit(this));
			RegisterCommand("stand", new StandCommand(this));
			RegisterCommand("jump", new JumpCommand(this));
			RegisterCommand("crouch", new CrouchCommand(this));
			RegisterCommand("mute", new MuteCommand(this));
			RegisterCommand("unmute", new UnmuteCommand(this));
            RegisterCommand("move", new MoveToCommand(this)); 
            RegisterCommand("forward", new MoveToCommand(this));
			RegisterCommand("use", new Use(this));
			RegisterCommand("eval", new Eval(this));
			RegisterCommand("wear", new ReplaceOutfitCommand(this));
            RegisterCommand("task", new ThreadCommand(this));
            RegisterCommand("thread", new ThreadCommand(this));
            

            Commands["locate"] = Commands["location"] = Commands["where"] = newCommandInfo(new Actions.Movement.LocationCommand(this));
            var follow = newCommandInfo(new Follow(this));
            Commands["follow"] = follow;
            //Commands["simexport"] = new Cogbot.Actions.SimExport.ExportCommand(this);
            Commands["stop following"] = follow;
            Commands["stop-following"] = follow;

            // ensure all commands are registered when this constructor completes
            foreach (Type type in GetType().Assembly.GetTypes())
            {
                RegisterType(type);
            }
            
            _gridClient = gc;

            XmlInterp = new XmlScriptInterpreter(this);
            XmlInterp.BotClient = this;
            if (false)
                ClientManager.PostAutoExecEnqueue(LoadTaskInterpreter);

            // Start the server
            lock (ClientManager.config)
            {
                int poff = ClientManager.config.GetValue("tcpPortOffset", 10);
                thisTcpPort = ClientManager.nextTcpPort;
                ClientManager.nextTcpPort += poff;
                ClientManager.PostAutoExecEnqueue(() =>
                {
                    Utilities.BotTcpServer UtilitiesTcpServer = new Utilities.BotTcpServer(thisTcpPort, this);
                    UtilitiesTcpServer.ServerPortIncr = poff;
                    UtilitiesTcpServer.startSocketListener();
                    ClientManager.nextTcpPort = UtilitiesTcpServer.ServerPort + UtilitiesTcpServer.ServerPortIncr;
                    this.OnDispose += ((SimEventSubscriber)UtilitiesTcpServer).Dispose;
                });
            }

            Network.RegisterCallback(PacketType.AgentDataUpdate, AgentDataUpdateHandler);
            Network.RegisterCallback(PacketType.AlertMessage, AlertMessageHandler);
            Network.RegisterCallback(PacketType.AvatarAppearance, AvatarAppearanceHandler);

            //Move to effects Appearance.OnAppearanceUpdated += new AppearanceManager.AppearanceUpdatedCallback(Appearance_OnAppearanceUpdated);

            Inventory.InventoryObjectOffered += Inventory_OnInventoryObjectReceived;
            Groups.GroupMembersReply += new EventHandler<GroupMembersReplyEventArgs>(GroupMembersHandler);
            Logger.OnLogMessage += new Logger.LogCallback(client_OnLogMessage);
            Network.EventQueueRunning += Network_OnEventQueueRunning;
            Network.LoginProgress += Network_OnLogin;
            Network.LoggedOut += Network_OnLogoutReply;
            Network.SimConnected += Network_OnSimConnected;
            Network.SimDisconnected += Network_OnSimDisconnected;
            //Network.OnConnected += Network_OnConnected;
            Network.Disconnected += Network_OnDisconnected;
            Self.IM += Self_OnInstantMessage;
            //Self.OnScriptDialog += new AgentManager.ScriptDialogCallback(Self_OnScriptDialog);
            //Self.OnScriptQuestion += new AgentManager.ScriptQuestionCallback(Self_OnScriptQuestion);
            Self.TeleportProgress += Self_OnTeleport;
            Self.ChatFromSimulator += Self_OnChat;
            var callback = new EventHandler<CurrentGroupsEventArgs>(Groups_OnCurrentGroups);
            Groups.CurrentGroups += callback;

            BotInventory = new BotInventoryEval(this);
            ClientManager.PostAutoExecEnqueue(() =>
            {
                if (UseLispEventProducer)
                {
                    lispEventProducer = new LispEventProducer(this, LispTaskInterperter);
                }
            });
            ClientManager.PostAutoExecEnqueue(ClientManager.EnsureREPLNotPaused);

        }
 public void AddTaskQueue(string id, TaskQueueHandler tq)
 {
     tq.Owner = this;
 }