public void wearFolder(string folderName) { // what we simply want // Client.Appearance.WearOutfit(folderName.Split('/'), false); UUID folderID = UUID.Zero; InventoryFolder rootFolder = Inventory.Store.RootFolder; //List<FolderData> folderContents; // List<ItemData> folderItems; BotInventoryEval searcher = new BotInventoryEval(this); folderID = searcher.findInFolders(rootFolder, folderName); if (folderID != UUID.Zero) { Self.Chat("Wearing folder \"" + folderName + "\"", 0, ChatType.Normal); WriteLine("Wearing folder \"" + folderName + "\""); Appearance.AddToOutfit(GetFolderItems(folderName)); /* List<InventoryBase> folderContents= Client.Inventory.FolderContents(folderID, Client.Self.AgentID, false, true, InventorySortOrder.ByDate, new TimeSpan(0, 0, 0, 0, 10000)); if (folderContents != null) { folderContents.ForEach( delegate(ItemData i) { Client.Appearance.Attach(i, AttachmentPoint.Default); Client.Self.Chat("Attaching item: " + i.Name, 0, ChatType.Normal); WriteLine("Attaching item: " + i.Name); } ); } */ } else { Self.Chat("Can't find folder \"" + folderName + "\" to wear", 0, ChatType.Normal); WriteLine("Can't find folder \"" + folderName + "\" to wear"); } }
/// <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); }