public override string Execute(string[] args, UUID fromAgentID)
        {
            if (fromAgentID.IsZero())
            {
                return("Unable to send money to console.  This command only works when IMed.");
            }

            int amount = Client.Self.Balance;

            Client.Self.GiveAvatarMoney(fromAgentID, Client.Self.Balance, "TestClient.GiveAll");
            return("Gave $" + amount + " to " + fromAgentID);
        }
 public static void AddElem_asset_id(UUID e, osUTF8 sb)
 {
     if (e.IsZero())
     {
         sb.Append(osUTF8Const.XMLelement_asset_id_Empty);
     }
     else
     {
         sb.Append(osUTF8Const.XMLelement_asset_id_Start);
         sb.AppendUUID(e);
         sb.Append(osUTF8Const.XMLuuidEnd);
     }
 }
 public static void AddElem(UUID e, osUTF8 sb)
 {
     if (e.IsZero())
     {
         sb.Append(osUTF8Const.XMLuuidEmpty);
     }
     else
     {
         sb.Append(osUTF8Const.XMLuuidStart);
         sb.AppendUUID(e);
         sb.Append(osUTF8Const.XMLuuidEnd);
     }
 }
        public static void AddElem(string name, UUID e, osUTF8 sb)
        {
            sb.Append(osUTF8Const.XMLkeyStart);
            sb.AppendASCII(name);
            sb.Append(osUTF8Const.XMLkeyEnd);

            if (e.IsZero())
            {
                sb.Append(osUTF8Const.XMLuuidEmpty);
            }
            else
            {
                sb.Append(osUTF8Const.XMLuuidStart);
                sb.AppendUUID(e);
                sb.Append(osUTF8Const.XMLuuidEnd);
            }
        }
示例#5
0
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
            {
                return("Usage: wear [outfit name] eg: 'wear Clothing/My Outfit");
            }

            string target = String.Empty;

            for (int ct = 0; ct < args.Length; ct++)
            {
                target += args[ct] + " ";
            }

            target = target.TrimEnd();

            UUID folder = Client.Inventory.FindObjectByPath(Client.Inventory.Store.RootFolder.UUID, Client.Self.AgentID, target, 20 * 1000);

            if (folder.IsZero())
            {
                return("Outfit path " + target + " not found");
            }

            List <InventoryBase> contents = Client.Inventory.FolderContents(folder, Client.Self.AgentID, true, true, InventorySortOrder.ByName, 20 * 1000);
            List <InventoryItem> items    = new List <InventoryItem>();

            if (contents == null)
            {
                return("Failed to get contents of " + target);
            }

            foreach (InventoryBase item in contents)
            {
                if (item is InventoryItem)
                {
                    items.Add((InventoryItem)item);
                }
            }

            Client.Appearance.ReplaceOutfit(items);

            return("Starting to change outfit to " + target);
        }
        private static string nameFromID(UUID id)
        {
            string result = null;

            if (id.IsZero())
            {
                return(result);
            }

            // Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
            result = "x";

            // Base64 encode and replace the pieces of base64 that are less compatible
            // with e-mail local-parts.
            // See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
            byte[] encbuff = id.GetBytes();
            result += Convert.ToBase64String(encbuff);
            result  = result.Replace('+', '-');
            result  = result.Replace('/', '_');

            return(result);
        }
示例#7
0
        private static JsonData SerializeJsonNoDefaults(OSD osd)
        {
            switch (osd.Type)
            {
            case OSDType.Boolean:
                bool b = osd.AsBoolean();
                if (!b)
                {
                    return(null);
                }

                return(new JsonData(b));

            case OSDType.Integer:
                int v = osd.AsInteger();
                if (v == 0)
                {
                    return(null);
                }

                return(new JsonData(v));

            case OSDType.Real:
                double d = osd.AsReal();
                if (d == 0.0d)
                {
                    return(null);
                }

                return(new JsonData(d));

            case OSDType.String:
            case OSDType.Date:
            case OSDType.URI:
            case OSDType.OSDUTF8:
            case OSDType.LLSDxml:
                string str = osd.AsString();
                if (String.IsNullOrEmpty(str))
                {
                    return(null);
                }

                return(new JsonData(str));

            case OSDType.UUID:
                UUID uuid = osd.AsUUID();
                if (uuid.IsZero())
                {
                    return(null);
                }

                return(new JsonData(uuid.ToString()));

            case OSDType.Binary:
                byte[] binary = osd.AsBinary();
                if (binary.Length == 0)
                {
                    return(null);
                }

                JsonData jsonbinarray = new JsonData();
                jsonbinarray.SetJsonType(JsonType.Array);
                for (int i = 0; i < binary.Length; i++)
                {
                    jsonbinarray.Add(new JsonData(binary[i]));
                }
                return(jsonbinarray);

            case OSDType.Array:
                JsonData jsonarray = new JsonData();
                jsonarray.SetJsonType(JsonType.Array);
                OSDArray array = (OSDArray)osd;
                for (int i = 0; i < array.Count; i++)
                {
                    jsonarray.Add(SerializeJson(array[i], false));
                }
                return(jsonarray);

            case OSDType.Map:
                JsonData jsonmap = new JsonData();
                jsonmap.SetJsonType(JsonType.Object);
                OSDMap map = (OSDMap)osd;
                foreach (KeyValuePair <string, OSD> kvp in map)
                {
                    JsonData data = SerializeJsonNoDefaults(kvp.Value);
                    if (data != null)
                    {
                        jsonmap[kvp.Key] = data;
                    }
                }
                return(jsonmap);

            case OSDType.Unknown:
            default:
                return(null);
            }
        }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
            {
                return(Description);
            }

            groupName         = String.Empty;
            resolvedGroupID   = UUID.Zero;
            resolvedGroupName = String.Empty;

            if (args[0].ToLower() == "uuid")
            {
                if (args.Length < 2)
                {
                    return(Description);
                }

                if (!UUID.TryParse((resolvedGroupName = groupName = args[1]), out resolvedGroupID))
                {
                    return(resolvedGroupName + " doesn't seem a valid UUID");
                }
            }
            else
            {
                for (int i = 0; i < args.Length; i++)
                {
                    groupName += args[i] + " ";
                }
                groupName = groupName.Trim();

                Client.Directory.DirGroupsReply += Directory_DirGroups;

                queryID = Client.Directory.StartGroupSearch(groupName, 0);

                GetGroupsSearchEvent.WaitOne(60000, false);

                Client.Directory.DirGroupsReply -= Directory_DirGroups;

                GetGroupsSearchEvent.Reset();
            }

            if (resolvedGroupID.IsZero())
            {
                if (string.IsNullOrEmpty(resolvedGroupName))
                {
                    return("Unable to obtain UUID for group " + groupName);
                }
                else
                {
                    return(resolvedGroupName);
                }
            }

            Client.Groups.GroupJoinedReply += Groups_OnGroupJoined;
            Client.Groups.RequestJoinGroup(resolvedGroupID);

            /* A.Biondi
             * TODO: implement the pay to join procedure.
             */

            GetGroupsSearchEvent.WaitOne(60000, false);

            Client.Groups.GroupJoinedReply -= Groups_GroupJoined;
            GetGroupsSearchEvent.Reset();
            Client.ReloadGroupsCache();

            if (joinedGroup)
            {
                return("Joined the group " + resolvedGroupName);
            }
            return("Unable to join the group " + resolvedGroupName);
        }