public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length < 1) return ShowUsage(); int argsUsed; List<SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed); args = args.AdvanceArgs(argsUsed); AttachmentPoint attachmentPoint = AttachmentPoint.Default; if (args.Length > 0) { object obj; if (TryEnumParse(typeof (AttachmentPoint), args, 0, out argsUsed, out obj)) { attachmentPoint = (AttachmentPoint) obj; } } args = args.AdvanceArgs(argsUsed); Quaternion rotation = Quaternion.Identity; if (args.Length > 0) { Quaternion quat; if (Quaternion.TryParse(Parser.Rejoin(args, 0), out quat)) { rotation = quat; } } foreach (var found in PS) { Client.Objects.AttachObject(found.GetSimulator(), found.LocalID, attachmentPoint, rotation); AddSuccess("attaching " + found + " to " + attachmentPoint + " with rotation " + rotation); } return SuccessOrFailure(); }
public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length == 0) { WorldObjects.ResetSelectedObjects(); return(Success("ResetSelectedObjects")); } string note = ""; var autoDeselect = (args[0] == "re"); if (autoDeselect) { note += "re"; args = args.AdvanceArgs(1); } var deSelect = (args[0] == "de"); if (deSelect) { note += "de"; args = args.AdvanceArgs(1); } int used; List <SimObject> PS = WorldSystem.GetPrimitives(args, out used); if (IsEmpty(PS)) { return(Failure("Cannot find objects from " + args.str)); } List <uint> selectobjs = new List <uint>(); var fp = PS[0].RegionHandle; foreach (var P in PS) { if (fp != P.RegionHandle) { SelectObjects(deSelect, fp, selectobjs, autoDeselect); fp = P.RegionHandle; selectobjs = new List <uint>(); } selectobjs.Add(P.LocalID); uint pid = P.ParentID; if (pid != 0) { selectobjs.Add(pid); } } SelectObjects(deSelect, fp, selectobjs, autoDeselect); return(Success("objects " + note + "selected " + PS.Count)); }
public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length == 0) { WorldObjects.ResetSelectedObjects(); return Success("ResetSelectedObjects"); } string note = ""; var autoDeselect = (args[0] == "re"); if (autoDeselect) { note += "re"; args = args.AdvanceArgs(1); } var deSelect = (args[0] == "de"); if (deSelect) { note += "de"; args = args.AdvanceArgs(1); } int used; List<SimObject> PS = WorldSystem.GetPrimitives(args, out used); if (IsEmpty(PS)) return Failure("Cannot find objects from " + args.str); List<uint> selectobjs = new List<uint>(); var fp = PS[0].RegionHandle; foreach (var P in PS) { if (fp != P.RegionHandle) { SelectObjects(deSelect, fp, selectobjs, autoDeselect); fp = P.RegionHandle; selectobjs = new List<uint>(); } selectobjs.Add(P.LocalID); uint pid = P.ParentID; if (pid != 0) { selectobjs.Add(pid); } } SelectObjects(deSelect, fp, selectobjs, autoDeselect); return Success("objects " + note + "selected " + PS.Count); }
public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length < 2) return ShowUsage(); SimTypeUsage use = SimTypeSystem.FindObjectUse(args[0]); if (use == null) return Failure("Unknown use: " + args[0]); args = args.AdvanceArgs(1); int argsUsed; SimObject O = WorldSystem.GetSimObjectS(args, out argsUsed); if (O == null) return Failure("Cant find simobject " + args.str); WriteLine("Doing " + use + " for " + O); WorldSystem.TheSimAvatar.Do(use, O); return Success("Did " + use + " for " + O); }
public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length < 1) { return(ShowUsage()); } int argsUsed; List <SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed); args = args.AdvanceArgs(argsUsed); AttachmentPoint attachmentPoint = AttachmentPoint.Default; if (args.Length > 0) { object obj; if (TryEnumParse(typeof(AttachmentPoint), args, 0, out argsUsed, out obj)) { attachmentPoint = (AttachmentPoint)obj; } } args = args.AdvanceArgs(argsUsed); Quaternion rotation = Quaternion.Identity; if (args.Length > 0) { Quaternion quat; if (Quaternion.TryParse(Parser.Rejoin(args, 0), out quat)) { rotation = quat; } } foreach (var found in PS) { Client.Objects.AttachObject(found.GetSimulator(), found.LocalID, attachmentPoint, rotation); AddSuccess("attaching " + found + " to " + attachmentPoint + " with rotation " + rotation); } return(SuccessOrFailure()); }
public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length < 2) { return(ShowUsage()); } SimTypeUsage use = SimTypeSystem.FindObjectUse(args[0]); if (use == null) { return(Failure("Unknown use: " + args[0])); } args = args.AdvanceArgs(1); int argsUsed; SimObject O = WorldSystem.GetSimObjectS(args, out argsUsed); if (O == null) { return(Failure("Cant find simobject " + args.str)); } WriteLine("Doing " + use + " for " + O); WorldSystem.TheSimAvatar.Do(use, O); return(Success("Did " + use + " for " + O)); }
public CmdResult ExecuteRequestTree(CmdRequest args) { BotClient Client = TheBotClient; bool showPLVersionOfHelp = false; if (args.Length == 1) { if (args[0] == "prolog") { showPLVersionOfHelp = true; args = args.AdvanceArgs(1); } if (showPLVersionOfHelp) { foreach (var s in Client.AllCommands().Values) { WriteLine(s.ToPrologString() + "."); } return(Success("showPLVersion(done).")); } } if (args.Length > 0) { int found = 0; foreach (var s in Client.AllCommands().Values) { if (s.Matches(args[0])) { found++; WriteLine(s.Name + ": " + s.Description); } } if (found == 0) { return(Failure("Command " + args[0] + " Does not exist. \"help\" to display all available commands.")); } return(Success("found=" + found)); } StringBuilder result = new StringBuilder(); var CommandTree = new SortedDictionary <string, List <CommandInfo> >(); string cc; foreach (CommandInfo c in TheBotClient.AllCommands().Values) { if (c.Category.Equals(null)) { cc = "Unknown"; } else { cc = c.Category; } if (CommandTree.ContainsKey(cc)) { CommandTree[cc].Add(c); } else { var l = new List <CommandInfo>(); l.Add(c); CommandTree.Add(cc, l); } } foreach (var kvp in CommandTree) { result.AppendFormat(Environment.NewLine + "* {0} Related Commands:" + Environment.NewLine, kvp.Key.ToString()); int colMax = 0; for (int i = 0; i < kvp.Value.Count; i++) { if (colMax >= 120) { result.AppendLine(); colMax = 0; } result.AppendFormat(" {0,-15}", kvp.Value[i].Name); colMax += 15; } result.AppendLine(); } result.AppendLine(Environment.NewLine + "Help [command] for usage/information"); return(Success(result.ToString())); ; }
public override CmdResult ExecuteRequest(CmdRequest args) { //opensim drew this line because of clients might be hardcoded to only support 255? or was this trying to copy linden? try { //Client.Objects.OnObjectProperties += callback; int argsUsed; Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim; UUID groupID = UUID.Zero; Simulator CurrentSim = CurSim; Permissions AddPerms = new Permissions(); Permissions SubPerms = new Permissions(); bool doTaskInv = false; List<Primitive> TaskPrims = new List<Primitive>(); List<uint> localIDs = new List<uint>(); // Reset class-wide variables PermsSent = false; Objects.Clear(); PermCount = 0; bool oneAtATime = false; if (args.Length < 3) return ShowUsage(); if (!UUIDTryParse(args, 0, out groupID, out argsUsed)) return ShowUsage(); args.AdvanceArgs(argsUsed); List<SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed); if (IsEmpty(PS)) return Failure("Cannot find objects from " + args.str); PermissionWho who = 0; bool deed = false; for (int i = argsUsed; i < args.Length; i++) { bool add = true; bool setPerms = false; string arg = args[i]; int whoint = (int) who; PermissionMask Perms = PermsAdd[whoint]; if (arg.StartsWith("+")) { arg = arg.Substring(1); } else if (arg.StartsWith("-")) { arg = arg.Substring(1); add = false; Perms = PermsSub[whoint]; } switch (arg.ToLower()) { // change owner referall case "who": who = 0; break; case "o": who |= PermissionWho.Owner; break; case "g": who |= PermissionWho.Group; break; case "e": who |= PermissionWho.Everyone; break; case "n": who |= PermissionWho.NextOwner; break; case "a": who = PermissionWho.All; break; // change perms for owner case "copy": Perms |= PermissionMask.Copy; setPerms = true; break; case "mod": Perms |= PermissionMask.Modify; setPerms = true; break; case "xfer": Perms |= PermissionMask.Transfer; setPerms = true; break; case "all": Perms |= PermissionMask.All; setPerms = true; break; case "dmg": Perms |= PermissionMask.Damage; setPerms = true; break; case "move": Perms |= PermissionMask.Move; setPerms = true; break; // dont change perms at all case "noperms": skipPerms = true; break; // deed (implies will use group) case "deed": deed = true; break; // set object group case "group": i++; setGroup = true; groupID = Client.GroupName2UUID(args[i]); break; case "task": doTaskInv = true; break; case "incr": oneAtATime = true; break; default: return ShowUsage(); } if (setPerms) { skipPerms = false; if (add) { PermsAdd[whoint] = Perms; } else { PermsSub[whoint] = Perms; } } } ulong CurrentSimHandle = CurrentSim.Handle; foreach (SimObject o in PS) { if (o is SimAvatar) continue; if (o.RegionHandle != CurrentSimHandle) continue; // Find the requested prim Primitive rootPrim = o.Prim; if (rootPrim == null) continue; localIDs.Add(rootPrim.LocalID); Objects[rootPrim.ID] = rootPrim; if (doTaskInv) { TaskPrims.Add(rootPrim); } continue; ; UUID rootID = UUID.Zero; if (rootPrim == null) return Failure("Cannot find requested prim " + rootID.ToString()); else WriteLine("Found requested prim " + rootPrim.ID.ToString(), Client); if (rootPrim.ParentID != 0) { // This is not actually a root prim, find the root if (!CurrentSim.ObjectsPrimitives.TryGetValue(rootPrim.ParentID, out rootPrim)) return Failure("Cannot find root prim for requested object"); else WriteLine("Set root prim to " + rootPrim.ID.ToString(), Client); } List<Primitive> childPrims; // Find all of the child objects linked to this root childPrims = CurrentSim.ObjectsPrimitives.FindAll( delegate(Primitive prim) { return prim.ParentID == rootPrim.LocalID; }); // Build a dictionary of primitives for referencing later // Objects[rootPrim.ID] = rootPrim; for (int i = 0; i < childPrims.Count; i++) Objects[childPrims[i].ID] = childPrims[i]; // Build a list of all the localIDs to set permissions for localIDs.Add(rootPrim.LocalID); for (int i = 0; i < childPrims.Count; i++) localIDs.Add(childPrims[i].LocalID); if (doTaskInv) { TaskPrims.AddRange(childPrims); TaskPrims.Add(rootPrim); } } WriteLine("Using PermissionMask: +" + PermsAdd.ToString() + " -" + PermsSub.ToString(), Client); // Go through each of the three main permissions and enable or disable them #region Set Linkset Permissions if (oneAtATime) { List<uint> smallList = new List<uint>(); foreach (var o in Objects.Values) { if (o.OwnerID == Client.Self.AgentID) //if (o.GroupID!=groupID) { if (doTaskInv) { TaskPrims.Add(o); } smallList.Clear(); smallList.Add(o.LocalID); SetDeed(CurrentSim, smallList, groupID, deed); } } } else { if (localIDs.Count < 50) SetDeed(CurrentSim, localIDs, groupID, deed); else { List<uint> smallList = new List<uint>(); while (localIDs.Count > 0) { if (localIDs.Count < 50) { SetDeed(CurrentSim, localIDs, groupID, deed); break; } smallList.Clear(); smallList.AddRange(localIDs.GetRange(0, 50)); SetDeed(CurrentSim, smallList, groupID, deed); localIDs.RemoveRange(0, 50); } } } #endregion Set Linkset Permissions // Check each prim for task inventory and set permissions on the task inventory int taskItems = 0; if (doTaskInv) foreach (Primitive prim in TaskPrims) { if ((prim.Flags & PrimFlags.InventoryEmpty) == 0) { List<InventoryBase> items = Client.Inventory.GetTaskInventory(prim.ID, prim.LocalID, 1000*10); if (items != null) { for (int i = 0; i < items.Count; i++) { if (!(items[i] is InventoryFolder)) { InventoryItem item = (InventoryItem) items[i]; // prev and not (W or All) item.Permissions.GroupMask &= ~(PermsSub[(int) PermissionWho.Group] | PermsSub[(int) PermissionWho.All]); item.Permissions.OwnerMask &= ~(PermsSub[(int) PermissionWho.Owner] | PermsSub[(int) PermissionWho.All]); item.Permissions.NextOwnerMask &= ~(PermsSub[(int) PermissionWho.NextOwner] | PermsSub[(int) PermissionWho.All]); item.Permissions.EveryoneMask &= ~(PermsSub[(int) PermissionWho.Everyone] | PermsSub[(int) PermissionWho.All]); // prev and (W or All) item.Permissions.GroupMask |= PermsAdd[(int) PermissionWho.Group] | PermsAdd[(int) PermissionWho.All]; item.Permissions.OwnerMask |= PermsAdd[(int) PermissionWho.Owner] | PermsAdd[(int) PermissionWho.All]; item.Permissions.NextOwnerMask |= PermsAdd[(int) PermissionWho.NextOwner] | PermsAdd[(int) PermissionWho.All]; item.Permissions.EveryoneMask |= PermsAdd[(int) PermissionWho.Everyone] | PermsAdd[(int) PermissionWho.All]; Client.Inventory.UpdateTaskInventory(prim.LocalID, item); ++taskItems; } } } } } return Success("Using PermissionMask: +" + PermsAdd.ToString() + " -" + PermsSub.ToString() + " on " + Objects.Count + " objects and " + taskItems + " inventory items"); } finally { // Client.Objects.OnObjectProperties -= callback; } }
public override CmdResult ExecuteRequest(CmdRequest args) { //opensim drew this line because of clients might be hardcoded to only support 255? or was this trying to copy linden? try { //Client.Objects.OnObjectProperties += callback; int argsUsed; Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim; UUID groupID = UUID.Zero; Simulator CurrentSim = CurSim; Permissions AddPerms = new Permissions(); Permissions SubPerms = new Permissions(); bool doTaskInv = false; List <Primitive> TaskPrims = new List <Primitive>(); List <uint> localIDs = new List <uint>(); // Reset class-wide variables PermsSent = false; Objects.Clear(); PermCount = 0; bool oneAtATime = false; if (args.Length < 3) { return(ShowUsage()); } if (!UUIDTryParse(args, 0, out groupID, out argsUsed)) { return(ShowUsage()); } args.AdvanceArgs(argsUsed); List <SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed); if (IsEmpty(PS)) { return(Failure("Cannot find objects from " + args.str)); } PermissionWho who = 0; bool deed = false; for (int i = argsUsed; i < args.Length; i++) { bool add = true; bool setPerms = false; string arg = args[i]; int whoint = (int)who; PermissionMask Perms = PermsAdd[whoint]; if (arg.StartsWith("+")) { arg = arg.Substring(1); } else if (arg.StartsWith("-")) { arg = arg.Substring(1); add = false; Perms = PermsSub[whoint]; } switch (arg.ToLower()) { // change owner referall case "who": who = 0; break; case "o": who |= PermissionWho.Owner; break; case "g": who |= PermissionWho.Group; break; case "e": who |= PermissionWho.Everyone; break; case "n": who |= PermissionWho.NextOwner; break; case "a": who = PermissionWho.All; break; // change perms for owner case "copy": Perms |= PermissionMask.Copy; setPerms = true; break; case "mod": Perms |= PermissionMask.Modify; setPerms = true; break; case "xfer": Perms |= PermissionMask.Transfer; setPerms = true; break; case "all": Perms |= PermissionMask.All; setPerms = true; break; case "dmg": Perms |= PermissionMask.Damage; setPerms = true; break; case "move": Perms |= PermissionMask.Move; setPerms = true; break; // dont change perms at all case "noperms": skipPerms = true; break; // deed (implies will use group) case "deed": deed = true; break; // set object group case "group": i++; setGroup = true; groupID = Client.GroupName2UUID(args[i]); break; case "task": doTaskInv = true; break; case "incr": oneAtATime = true; break; default: return(ShowUsage()); } if (setPerms) { skipPerms = false; if (add) { PermsAdd[whoint] = Perms; } else { PermsSub[whoint] = Perms; } } } ulong CurrentSimHandle = CurrentSim.Handle; foreach (SimObject o in PS) { if (o is SimAvatar) { continue; } if (o.RegionHandle != CurrentSimHandle) { continue; } // Find the requested prim Primitive rootPrim = o.Prim; if (rootPrim == null) { continue; } localIDs.Add(rootPrim.LocalID); Objects[rootPrim.ID] = rootPrim; if (doTaskInv) { TaskPrims.Add(rootPrim); } continue; ; UUID rootID = UUID.Zero; if (rootPrim == null) { return(Failure("Cannot find requested prim " + rootID.ToString())); } else { WriteLine("Found requested prim " + rootPrim.ID.ToString(), Client); } if (rootPrim.ParentID != 0) { // This is not actually a root prim, find the root if (!CurrentSim.ObjectsPrimitives.TryGetValue(rootPrim.ParentID, out rootPrim)) { return(Failure("Cannot find root prim for requested object")); } else { WriteLine("Set root prim to " + rootPrim.ID.ToString(), Client); } } List <Primitive> childPrims; // Find all of the child objects linked to this root childPrims = CurrentSim.ObjectsPrimitives.FindAll( delegate(Primitive prim) { return(prim.ParentID == rootPrim.LocalID); }); // Build a dictionary of primitives for referencing later // Objects[rootPrim.ID] = rootPrim; for (int i = 0; i < childPrims.Count; i++) { Objects[childPrims[i].ID] = childPrims[i]; } // Build a list of all the localIDs to set permissions for localIDs.Add(rootPrim.LocalID); for (int i = 0; i < childPrims.Count; i++) { localIDs.Add(childPrims[i].LocalID); } if (doTaskInv) { TaskPrims.AddRange(childPrims); TaskPrims.Add(rootPrim); } } WriteLine("Using PermissionMask: +" + PermsAdd.ToString() + " -" + PermsSub.ToString(), Client); // Go through each of the three main permissions and enable or disable them #region Set Linkset Permissions if (oneAtATime) { List <uint> smallList = new List <uint>(); foreach (var o in Objects.Values) { if (o.OwnerID == Client.Self.AgentID) //if (o.GroupID!=groupID) { if (doTaskInv) { TaskPrims.Add(o); } smallList.Clear(); smallList.Add(o.LocalID); SetDeed(CurrentSim, smallList, groupID, deed); } } } else { if (localIDs.Count < 50) { SetDeed(CurrentSim, localIDs, groupID, deed); } else { List <uint> smallList = new List <uint>(); while (localIDs.Count > 0) { if (localIDs.Count < 50) { SetDeed(CurrentSim, localIDs, groupID, deed); break; } smallList.Clear(); smallList.AddRange(localIDs.GetRange(0, 50)); SetDeed(CurrentSim, smallList, groupID, deed); localIDs.RemoveRange(0, 50); } } } #endregion Set Linkset Permissions // Check each prim for task inventory and set permissions on the task inventory int taskItems = 0; if (doTaskInv) { foreach (Primitive prim in TaskPrims) { if ((prim.Flags & PrimFlags.InventoryEmpty) == 0) { List <InventoryBase> items = Client.Inventory.GetTaskInventory(prim.ID, prim.LocalID, 1000 * 10); if (items != null) { for (int i = 0; i < items.Count; i++) { if (!(items[i] is InventoryFolder)) { InventoryItem item = (InventoryItem)items[i]; // prev and not (W or All) item.Permissions.GroupMask &= ~(PermsSub[(int)PermissionWho.Group] | PermsSub[(int)PermissionWho.All]); item.Permissions.OwnerMask &= ~(PermsSub[(int)PermissionWho.Owner] | PermsSub[(int)PermissionWho.All]); item.Permissions.NextOwnerMask &= ~(PermsSub[(int)PermissionWho.NextOwner] | PermsSub[(int)PermissionWho.All]); item.Permissions.EveryoneMask &= ~(PermsSub[(int)PermissionWho.Everyone] | PermsSub[(int)PermissionWho.All]); // prev and (W or All) item.Permissions.GroupMask |= PermsAdd[(int)PermissionWho.Group] | PermsAdd[(int)PermissionWho.All]; item.Permissions.OwnerMask |= PermsAdd[(int)PermissionWho.Owner] | PermsAdd[(int)PermissionWho.All]; item.Permissions.NextOwnerMask |= PermsAdd[(int)PermissionWho.NextOwner] | PermsAdd[(int)PermissionWho.All]; item.Permissions.EveryoneMask |= PermsAdd[(int)PermissionWho.Everyone] | PermsAdd[(int)PermissionWho.All]; Client.Inventory.UpdateTaskInventory(prim.LocalID, item); ++taskItems; } } } } } } return (Success("Using PermissionMask: +" + PermsAdd.ToString() + " -" + PermsSub.ToString() + " on " + Objects.Count + " objects and " + taskItems + " inventory items")); } finally { // Client.Objects.OnObjectProperties -= callback; } }
public CmdResult ExecuteRequestTree(CmdRequest args) { BotClient Client = TheBotClient; bool showPLVersionOfHelp = false; if (args.Length == 1) { if (args[0] == "prolog") { showPLVersionOfHelp = true; args = args.AdvanceArgs(1); } if (showPLVersionOfHelp) { foreach (var s in Client.AllCommands().Values) { WriteLine(s.ToPrologString() + "."); } return Success("showPLVersion(done)."); } } if (args.Length > 0) { int found = 0; foreach (var s in Client.AllCommands().Values) { if (s.Matches(args[0])) { found++; WriteLine(s.Name + ": " + s.Description); } } if (found == 0) { return Failure("Command " + args[0] + " Does not exist. \"help\" to display all available commands."); } return Success("found=" + found); } StringBuilder result = new StringBuilder(); var CommandTree = new SortedDictionary<string, List<CommandInfo>>(); string cc; foreach (CommandInfo c in TheBotClient.AllCommands().Values) { if (c.Category.Equals(null)) cc = "Unknown"; else cc = c.Category; if (CommandTree.ContainsKey(cc)) CommandTree[cc].Add(c); else { var l = new List<CommandInfo>(); l.Add(c); CommandTree.Add(cc, l); } } foreach (var kvp in CommandTree) { result.AppendFormat(Environment.NewLine + "* {0} Related Commands:" + Environment.NewLine, kvp.Key.ToString()); int colMax = 0; for (int i = 0; i < kvp.Value.Count; i++) { if (colMax >= 120) { result.AppendLine(); colMax = 0; } result.AppendFormat(" {0,-15}", kvp.Value[i].Name); colMax += 15; } result.AppendLine(); } result.AppendLine(Environment.NewLine + "Help [command] for usage/information"); return Success(result.ToString()); ; }