Pack() public method

Create an OSDMap from the appearance data
public Pack ( ) : OSDMap
return OSDMap
Example #1
0
        /// <summary>
        /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
        /// </summary>
        /// <returns>map of the agent circuit data</returns>
        public OSDMap PackAgentCircuitData()
        {
            OSDMap args = new OSDMap();

            args["agent_id"]  = OSD.FromUUID(AgentID);
            args["caps_path"] = OSD.FromString(CapsPath);

            #region OPENSIM ONLY

            args["first_name"] = OSD.FromString(firstname);
            args["last_name"]  = OSD.FromString(lastname);

            #endregion

            args["child"]             = OSD.FromBoolean(child);
            args["circuit_code"]      = OSD.FromString(circuitcode.ToString());
            args["secure_session_id"] = OSD.FromUUID(SecureSessionID);
            args["session_id"]        = OSD.FromUUID(SessionID);

            args["service_session_id"] = OSD.FromString(ServiceSessionID);
            args["start_pos"]          = OSD.FromString(startpos.ToString());
            args["client_ip"]          = OSD.FromString(IPAddress);
            args["otherInfo"]          = OSDParser.SerializeLLSDXmlString(OtherInformation);
            args["teleport_flags"]     = OSD.FromUInteger(teleportFlags);

            if (Appearance != null)
            {
                args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);

                OSDMap appmap = Appearance.Pack();
                args["packed_appearance"] = appmap;
            }

            return(args);
        }
Example #2
0
        /// <summary>
        /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
        /// </summary>
        /// <returns>map of the agent circuit data</returns>
        public OSDMap PackAgentCircuitData()
        {
            OSDMap args = new OSDMap();

            args["agent_id"]    = OSD.FromUUID(AgentID);
            args["base_folder"] = OSD.FromUUID(BaseFolder);
            args["caps_path"]   = OSD.FromString(CapsPath);

            if (ChildrenCapSeeds != null)
            {
                OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
                foreach (KeyValuePair <ulong, string> kvp in ChildrenCapSeeds)
                {
                    OSDMap pair = new OSDMap();
                    pair["handle"] = OSD.FromString(kvp.Key.ToString());
                    pair["seed"]   = OSD.FromString(kvp.Value);
                    childrenSeeds.Add(pair);
                }
                if (ChildrenCapSeeds.Count > 0)
                {
                    args["children_seeds"] = childrenSeeds;
                }
            }
            args["child"]             = OSD.FromBoolean(child);
            args["circuit_code"]      = OSD.FromString(circuitcode.ToString());
            args["first_name"]        = OSD.FromString(firstname);
            args["last_name"]         = OSD.FromString(lastname);
            args["inventory_folder"]  = OSD.FromUUID(InventoryFolder);
            args["secure_session_id"] = OSD.FromUUID(SecureSessionID);
            args["session_id"]        = OSD.FromUUID(SessionID);

            args["service_session_id"] = OSD.FromString(ServiceSessionID);
            args["start_pos"]          = OSD.FromString(startpos.ToString());
            args["client_ip"]          = OSD.FromString(IPAddress);
            args["viewer"]             = OSD.FromString(Viewer);
            args["channel"]            = OSD.FromString(Channel);
            args["mac"] = OSD.FromString(Mac);
            args["id0"] = OSD.FromString(Id0);

            if (Appearance != null)
            {
                args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);

                OSDMap appmap = Appearance.Pack();
                args["packed_appearance"] = appmap;
            }

            // Old, bad  way. Keeping it fow now for backwards compatibility
            // OBSOLETE -- soon to be deleted
            if (ServiceURLs != null && ServiceURLs.Count > 0)
            {
                OSDArray urls = new OSDArray(ServiceURLs.Count * 2);
                foreach (KeyValuePair <string, object> kvp in ServiceURLs)
                {
                    //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value);
                    urls.Add(OSD.FromString(kvp.Key));
                    urls.Add(OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString()));
                }
                args["service_urls"] = urls;
            }

            // again, this time the right way
            if (ServiceURLs != null && ServiceURLs.Count > 0)
            {
                OSDMap urls = new OSDMap();
                foreach (KeyValuePair <string, object> kvp in ServiceURLs)
                {
                    //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value);
                    urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString());
                }
                args["serviceurls"] = urls;
            }

            return(args);
        }
        public virtual OSDMap Pack(EntityTransferContext ctx)
        {
            int wearablesCount = -1;

//            m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");

            OSDMap args = new OSDMap();

            args["message_type"] = OSD.FromString("AgentData");

            args["region_id"]    = OSD.FromString(RegionID.ToString());
            args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"]   = OSD.FromUUID(AgentID);
            args["session_uuid"] = OSD.FromUUID(SessionID);

            args["position"]  = OSD.FromString(Position.ToString());
            args["velocity"]  = OSD.FromString(Velocity.ToString());
            args["center"]    = OSD.FromString(Center.ToString());
            args["size"]      = OSD.FromString(Size.ToString());
            args["at_axis"]   = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"]   = OSD.FromString(UpAxis.ToString());

            //backwards compatibility
            args["changed_grid"]  = OSD.FromBoolean(SenderWantsToWaitForRoot);
            args["wait_for_root"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
            args["far"]           = OSD.FromReal(Far);
            args["aspect"]        = OSD.FromReal(Aspect);

            if ((Throttles != null) && (Throttles.Length > 0))
            {
                args["throttles"] = OSD.FromBinary(Throttles);
            }

            args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
            args["head_rotation"]    = OSD.FromString(HeadRotation.ToString());
            args["body_rotation"]    = OSD.FromString(BodyRotation.ToString());
            args["control_flags"]    = OSD.FromString(ControlFlags.ToString());

            args["energy_level"] = OSD.FromReal(EnergyLevel);
            args["god_level"]    = OSD.FromString(GodLevel.ToString());
            args["always_run"]   = OSD.FromBoolean(AlwaysRun);
            args["prey_agent"]   = OSD.FromUUID(PreyAgent);
            args["agent_access"] = OSD.FromString(AgentAccess.ToString());

            args["active_group_id"] = OSD.FromUUID(ActiveGroupID);

            if ((Groups != null) && (Groups.Length > 0))
            {
                OSDArray groups = new OSDArray(Groups.Length);
                foreach (AgentGroupData agd in Groups)
                {
                    groups.Add(agd.PackUpdateMessage());
                }
                args["groups"] = groups;
            }

            if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
            {
                OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
                foreach (KeyValuePair <ulong, string> kvp in ChildrenCapSeeds)
                {
                    OSDMap pair = new OSDMap();
                    pair["handle"] = OSD.FromString(kvp.Key.ToString());
                    pair["seed"]   = OSD.FromString(kvp.Value);
                    childrenSeeds.Add(pair);
                }
                args["children_seeds"] = childrenSeeds;
            }

            if ((Anims != null) && (Anims.Length > 0))
            {
                OSDArray anims = new OSDArray(Anims.Length);
                foreach (Animation aanim in Anims)
                {
                    anims.Add(aanim.PackUpdateMessage());
                }
                args["animations"] = anims;
            }

            if (DefaultAnim != null)
            {
                args["default_animation"] = DefaultAnim.PackUpdateMessage();
            }

            if (AnimState != null)
            {
                args["animation_state"] = AnimState.PackUpdateMessage();
            }

            if (MovementAnimationOverRides.Count > 0)
            {
                OSDArray AOs = new OSDArray(MovementAnimationOverRides.Count);
                {
                    foreach (KeyValuePair <string, UUID> kvp in MovementAnimationOverRides)
                    {
                        OSDMap ao = new OSDMap(2);
                        ao["state"] = OSD.FromString(kvp.Key);
                        ao["uuid"]  = OSD.FromUUID(kvp.Value);
                        AOs.Add(ao);
                    }
                }
                args["movementAO"] = AOs;
            }

            if (MotionState != 0)
            {
                args["motion_state"] = OSD.FromInteger(MotionState);
            }

            if (Appearance != null)
            {
                args["packed_appearance"] = Appearance.Pack(ctx);
            }

            //if ((AgentTextures != null) && (AgentTextures.Length > 0))
            //{
            //    OSDArray textures = new OSDArray(AgentTextures.Length);
            //    foreach (UUID uuid in AgentTextures)
            //        textures.Add(OSD.FromUUID(uuid));
            //    args["agent_textures"] = textures;
            //}

            // The code to pack textures, visuals, wearables and attachments
            // should be removed; packed appearance contains the full appearance
            // This is retained for backward compatibility only

/*  then lets remove
 *          if (Appearance.Texture != null)
 *          {
 *              byte[] rawtextures = Appearance.Texture.GetBytes();
 *              args["texture_entry"] = OSD.FromBinary(rawtextures);
 *          }
 *
 *          if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0))
 *              args["visual_params"] = OSD.FromBinary(Appearance.VisualParams);
 *
 *          // We might not pass this in all cases...
 *          if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
 *          {
 *              OSDArray wears = new OSDArray(Appearance.Wearables.Length);
 *              foreach (AvatarWearable awear in Appearance.Wearables)
 *                  wears.Add(awear.Pack());
 *
 *              args["wearables"] = wears;
 *          }
 *
 *          List<AvatarAttachment> attachments = Appearance.GetAttachments();
 *          if ((attachments != null) && (attachments.Count > 0))
 *          {
 *              OSDArray attachs = new OSDArray(attachments.Count);
 *              foreach (AvatarAttachment att in attachments)
 *                  attachs.Add(att.Pack());
 *              args["attachments"] = attachs;
 *          }
 *          // End of code to remove
 */
            if ((Controllers != null) && (Controllers.Length > 0))
            {
                OSDArray controls = new OSDArray(Controllers.Length);
                foreach (ControllerData ctl in Controllers)
                {
                    controls.Add(ctl.PackUpdateMessage());
                }
                args["controllers"] = controls;
            }

            if ((CallbackURI != null) && (!CallbackURI.Equals("")))
            {
                args["callback_uri"] = OSD.FromString(CallbackURI);
            }

            // Attachment objects for fatpack messages
            if (AttachmentObjects != null)
            {
                int      i       = 0;
                OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
                foreach (ISceneObject so in AttachmentObjects)
                {
                    OSDMap info = new OSDMap(4);
                    info["sog"]      = OSD.FromString(so.ToXml2());
                    info["extra"]    = OSD.FromString(so.ExtraToXmlString());
                    info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
                    try
                    {
                        info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
                    }
                    catch (IndexOutOfRangeException)
                    {
                        m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list.");
                    }

                    attObjs.Add(info);
                }
                args["attach_objects"] = attObjs;
            }

            args["parent_part"] = OSD.FromUUID(ParentPart);
            args["sit_offset"]  = OSD.FromString(SitOffset.ToString());

            return(args);
        }
        // <summary>
        // </summary>
        // <param name=""></param>
        public bool SetAppearance(UUID userID, AvatarAppearance appearance)
        {
            OSDMap map = appearance.Pack();
            if (map == null)
            {
                m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID);
                return false;
            }

            // m_log.DebugFormat("[SIMIAN AVATAR CONNECTOR] save appearance for {0}",userID);

            NameValueCollection requestArgs = new NameValueCollection
                {
                        { "RequestMethod", "AddUserData" },
                        { "UserID", userID.ToString() },
                        { "LLPackedAppearance", OSDParser.SerializeJsonString(map) }
                };

            OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
            bool success = response["Success"].AsBoolean();

            if (! success)
                m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to save appearance for {0}: {1}",
                                 userID,response["Message"].AsString());

            return success;
        }
Example #5
0
        public virtual OSDMap Pack(EntityTransferContext ctx)
        {
//            m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");

            OSDMap args = new OSDMap();

            args["message_type"] = OSD.FromString("AgentData");

            args["region_id"]    = OSD.FromString(RegionID.ToString());
            args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"]   = OSD.FromUUID(AgentID);
            args["session_uuid"] = OSD.FromUUID(SessionID);

            args["position"]  = OSD.FromString(Position.ToString());
            args["velocity"]  = OSD.FromString(Velocity.ToString());
            args["center"]    = OSD.FromString(Center.ToString());
            args["size"]      = OSD.FromString(Size.ToString());
            args["at_axis"]   = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"]   = OSD.FromString(UpAxis.ToString());

            //backwards compatibility
            args["changed_grid"]  = OSD.FromBoolean(SenderWantsToWaitForRoot);
            args["wait_for_root"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
            args["far"]           = OSD.FromReal(Far);
            args["aspect"]        = OSD.FromReal(Aspect);

            if ((Throttles != null) && (Throttles.Length > 0))
            {
                args["throttles"] = OSD.FromBinary(Throttles);
            }

            args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
            args["head_rotation"]    = OSD.FromString(HeadRotation.ToString());
            args["body_rotation"]    = OSD.FromString(BodyRotation.ToString());
            args["control_flags"]    = OSD.FromString(ControlFlags.ToString());

            args["energy_level"] = OSD.FromReal(EnergyLevel);
            //args["god_level"] = OSD.FromString(GodLevel.ToString());
            if (GodData != null)
            {
                args["god_data"] = GodData;
                OSDMap g = (OSDMap)GodData;
                if (g.ContainsKey("ViewerUiIsGod"))
                {
                    args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;
                }
                ;
            }
            args["always_run"]   = OSD.FromBoolean(AlwaysRun);
            args["prey_agent"]   = OSD.FromUUID(PreyAgent);
            args["agent_access"] = OSD.FromString(AgentAccess.ToString());

            args["agent_cof"]     = OSD.FromUUID(agentCOF);
            args["crossingflags"] = OSD.FromInteger(CrossingFlags);
            if (CrossingFlags != 0)
            {
                args["crossExtraFlags"] = OSD.FromInteger(CrossExtraFlags);
            }

            args["active_group_id"]   = OSD.FromUUID(ActiveGroupID);
            args["active_group_name"] = OSD.FromString(ActiveGroupName);
            if (ActiveGroupTitle != null)
            {
                args["active_group_title"] = OSD.FromString(ActiveGroupTitle);
            }

            if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
            {
                OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
                foreach (KeyValuePair <ulong, string> kvp in ChildrenCapSeeds)
                {
                    OSDMap pair = new OSDMap();
                    pair["handle"] = OSD.FromString(kvp.Key.ToString());
                    pair["seed"]   = OSD.FromString(kvp.Value);
                    childrenSeeds.Add(pair);
                }
                args["children_seeds"] = childrenSeeds;
            }

            if ((Anims != null) && (Anims.Length > 0))
            {
                OSDArray anims = new OSDArray(Anims.Length);
                foreach (Animation aanim in Anims)
                {
                    anims.Add(aanim.PackUpdateMessage());
                }
                args["animations"] = anims;
            }

            if (DefaultAnim != null)
            {
                args["default_animation"] = DefaultAnim.PackUpdateMessage();
            }

            if (AnimState != null)
            {
                args["animation_state"] = AnimState.PackUpdateMessage();
            }

            if (MovementAnimationOverRides.Count > 0)
            {
                OSDArray AOs = new OSDArray(MovementAnimationOverRides.Count);
                {
                    foreach (KeyValuePair <string, UUID> kvp in MovementAnimationOverRides)
                    {
                        OSDMap ao = new OSDMap(2);
                        ao["state"] = OSD.FromString(kvp.Key);
                        ao["uuid"]  = OSD.FromUUID(kvp.Value);
                        AOs.Add(ao);
                    }
                }
                args["movementAO"] = AOs;
            }

            if (MotionState != 0)
            {
                args["motion_state"] = OSD.FromInteger(MotionState);
            }

            if (Appearance != null)
            {
                args["packed_appearance"] = Appearance.Pack(ctx);
            }

            if ((Controllers != null) && (Controllers.Length > 0))
            {
                OSDArray controls = new OSDArray(Controllers.Length);
                foreach (ControllerData ctl in Controllers)
                {
                    controls.Add(ctl.PackUpdateMessage());
                }
                args["controllers"] = controls;
            }

            if ((CallbackURI != null) && (!CallbackURI.Equals("")))
            {
                args["callback_uri"] = OSD.FromString(CallbackURI);
            }

            if ((NewCallbackURI != null) && (!NewCallbackURI.Equals("")))
            {
                args["cb_uri"] = OSD.FromString(NewCallbackURI);
            }

            // Attachment objects for fatpack messages
            if (AttachmentObjects != null)
            {
                int      i       = 0;
                OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
                foreach (ISceneObject so in AttachmentObjects)
                {
                    OSDMap info = new OSDMap(4);
                    info["sog"]      = OSD.FromString(so.ToXml2());
                    info["extra"]    = OSD.FromString(so.ExtraToXmlString());
                    info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
                    try
                    {
                        info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
                    }
                    catch (IndexOutOfRangeException)
                    {
                        m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list.");
                    }

                    attObjs.Add(info);
                }
                args["attach_objects"] = attObjs;
            }

            args["parent_part"] = OSD.FromUUID(ParentPart);
            args["sit_offset"]  = OSD.FromString(SitOffset.ToString());

            return(args);
        }
        public virtual OSDMap Pack()
        {
// DEBUG ON
            m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data");
// DEBUG OFF

            OSDMap args = new OSDMap();

            args["message_type"] = OSD.FromString("AgentData");

            args["region_id"]    = OSD.FromString(RegionID.ToString());
            args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"]   = OSD.FromUUID(AgentID);
            args["session_uuid"] = OSD.FromUUID(SessionID);

            args["position"]  = OSD.FromString(Position.ToString());
            args["velocity"]  = OSD.FromString(Velocity.ToString());
            args["center"]    = OSD.FromString(Center.ToString());
            args["size"]      = OSD.FromString(Size.ToString());
            args["at_axis"]   = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"]   = OSD.FromString(UpAxis.ToString());


            args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
            args["far"]          = OSD.FromReal(Far);
            args["aspect"]       = OSD.FromReal(Aspect);

            if ((Throttles != null) && (Throttles.Length > 0))
            {
                args["throttles"] = OSD.FromBinary(Throttles);
            }

            args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
            args["head_rotation"]    = OSD.FromString(HeadRotation.ToString());
            args["body_rotation"]    = OSD.FromString(BodyRotation.ToString());
            args["control_flags"]    = OSD.FromString(ControlFlags.ToString());

            args["energy_level"] = OSD.FromReal(EnergyLevel);
            args["god_level"]    = OSD.FromString(GodLevel.ToString());
            args["always_run"]   = OSD.FromBoolean(AlwaysRun);
            args["prey_agent"]   = OSD.FromUUID(PreyAgent);
            args["agent_access"] = OSD.FromString(AgentAccess.ToString());

            args["active_group_id"] = OSD.FromUUID(ActiveGroupID);

            if ((Groups != null) && (Groups.Length > 0))
            {
                OSDArray groups = new OSDArray(Groups.Length);
                foreach (AgentGroupData agd in Groups)
                {
                    groups.Add(agd.PackUpdateMessage());
                }
                args["groups"] = groups;
            }

            if ((Anims != null) && (Anims.Length > 0))
            {
                OSDArray anims = new OSDArray(Anims.Length);
                foreach (Animation aanim in Anims)
                {
                    anims.Add(aanim.PackUpdateMessage());
                }
                args["animations"] = anims;
            }

            if (Appearance != null)
            {
                args["packed_appearance"] = Appearance.Pack();
            }

            //if ((AgentTextures != null) && (AgentTextures.Length > 0))
            //{
            //    OSDArray textures = new OSDArray(AgentTextures.Length);
            //    foreach (UUID uuid in AgentTextures)
            //        textures.Add(OSD.FromUUID(uuid));
            //    args["agent_textures"] = textures;
            //}

            // The code to pack textures, visuals, wearables and attachments
            // should be removed; packed appearance contains the full appearance
            // This is retained for backward compatibility only
            if (Appearance.Texture != null)
            {
                byte[] rawtextures = Appearance.Texture.GetBytes();
                args["texture_entry"] = OSD.FromBinary(rawtextures);
            }

            if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0))
            {
                args["visual_params"] = OSD.FromBinary(Appearance.VisualParams);
            }

            // We might not pass this in all cases...
            if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
            {
                OSDArray wears = new OSDArray(Appearance.Wearables.Length);
                foreach (AvatarWearable awear in Appearance.Wearables)
                {
                    wears.Add(awear.Pack());
                }

                args["wearables"] = wears;
            }

            List <AvatarAttachment> attachments = Appearance.GetAttachments();

            if ((attachments != null) && (attachments.Count > 0))
            {
                OSDArray attachs = new OSDArray(attachments.Count);
                foreach (AvatarAttachment att in attachments)
                {
                    attachs.Add(att.Pack());
                }
                args["attachments"] = attachs;
            }
            // End of code to remove

            if ((Controllers != null) && (Controllers.Length > 0))
            {
                OSDArray controls = new OSDArray(Controllers.Length);
                foreach (ControllerData ctl in Controllers)
                {
                    controls.Add(ctl.PackUpdateMessage());
                }
                args["controllers"] = controls;
            }


            if ((CallbackURI != null) && (!CallbackURI.Equals("")))
            {
                args["callback_uri"] = OSD.FromString(CallbackURI);
            }


            return(args);
        }
        public virtual OSDMap Pack()
        {
            // DEBUG ON
            //m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data");
            // DEBUG OFF

            OSDMap args = new OSDMap();

            args["message_type"] = OSD.FromString("AgentData");

            args["region_id"]    = OSD.FromString(RegionID.ToString());
            args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"]   = OSD.FromUUID(AgentID);
            args["session_uuid"] = OSD.FromUUID(SessionID);

            args["position"]  = OSD.FromString(Position.ToString());
            args["velocity"]  = OSD.FromString(Velocity.ToString());
            args["center"]    = OSD.FromString(Center.ToString());
            args["size"]      = OSD.FromString(Size.ToString());
            args["at_axis"]   = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"]   = OSD.FromString(UpAxis.ToString());

            args["far"]    = OSD.FromReal(Far);
            args["aspect"] = OSD.FromReal(Aspect);

            if ((Throttles != null) && (Throttles.Length > 0))
            {
                args["throttles"] = OSD.FromBinary(Throttles);
            }

            args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
            args["head_rotation"]    = OSD.FromString(HeadRotation.ToString());
            args["body_rotation"]    = OSD.FromString(BodyRotation.ToString());
            args["control_flags"]    = OSD.FromString(ControlFlags.ToString());

            args["energy_level"]           = OSD.FromReal(EnergyLevel);
            args["speed"]                  = OSD.FromString(Speed.ToString());
            args["god_level"]              = OSD.FromString(GodLevel.ToString());
            args["draw_distance"]          = OSD.FromReal(DrawDistance);
            args["always_run"]             = OSD.FromBoolean(AlwaysRun);
            args["sent_initial_wearables"] = OSD.FromBoolean(SentInitialWearables);
            args["prey_agent"]             = OSD.FromUUID(PreyAgent);
            args["agent_access"]           = OSD.FromString(AgentAccess.ToString());

            args["active_group_id"] = OSD.FromUUID(ActiveGroupID);

            if ((Groups != null) && (Groups.Length > 0))
            {
                OSDArray groups = new OSDArray(Groups.Length);
                foreach (AgentGroupData agd in Groups)
                {
                    groups.Add(agd.PackUpdateMessage());
                }
                args["groups"] = groups;
            }

            if ((Anims != null) && (Anims.Length > 0))
            {
                OSDArray anims = new OSDArray(Anims.Length);
                foreach (Animation aanim in Anims)
                {
                    anims.Add(aanim.PackUpdateMessage());
                }
                args["animations"] = anims;
            }

            if (Appearance != null)
            {
                args["packed_appearance"] = Appearance.Pack();
            }

            if ((Controllers != null) && (Controllers.Length > 0))
            {
                OSDArray controls = new OSDArray(Controllers.Length);
                foreach (ControllerData ctl in Controllers)
                {
                    controls.Add(ctl.PackUpdateMessage());
                }
                args["controllers"] = controls;
            }

            return(args);
        }