Example #1
0
        public virtual OSDMap Pack()
        {
            OSDMap args = new OSDMap();

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

            args["region_handle"] = OSD.FromString(RegionHandle.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) && (Appearance.Texture != null))
            {
                args["texture_entry"] = OSD.FromBinary(Appearance.Texture.GetBytes());
            }

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

            // We might not pass this in all cases...
            if (Appearance != null)
            {
                OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES * 2);
                for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
                {
                    AvatarWearable wearable = Appearance.GetWearableOfType(i);
                    wears.Add(OSD.FromUUID(wearable.ItemID));
                    wears.Add(OSD.FromUUID(wearable.AssetID));
                }

                args["wearables"] = wears;
            }

            if (!String.IsNullOrEmpty(CallbackURI))
            {
                args["callback_uri"] = OSD.FromString(CallbackURI);
            }

            if (SatOnGroup != UUID.Zero)
            {
                args["sat_on_group"] = OSD.FromUUID(SatOnGroup);
                args["sat_on_prim"]  = OSD.FromUUID(SatOnPrim);
                args["sit_offset"]   = OSD.FromString(SatOnPrimOffset.ToString());
            }

            return(args);
        }
Example #2
0
        private static void CreateParametersForAppearance(AvatarAppearance appearance, Dictionary<string, object> parms)
        {
            parms.Add("?owner", appearance.Owner.ToString());
            parms.Add("?serial", appearance.Serial);
            parms.Add("?visual_params", appearance.VisualParams);
            parms.Add("?texture", appearance.Texture.GetBytes());
            parms.Add("?avatar_height", appearance.AvatarHeight);

            // The Old Mechanism. 1:1 point to wearable
            AvatarWearable wearable;
            wearable = appearance.GetWearableOfType(AvatarWearable.BODY);
            parms.Add("?body_item", wearable.ItemID.ToString());
            parms.Add("?body_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.SKIN);
            parms.Add("?skin_item", wearable.ItemID.ToString());
            parms.Add("?skin_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.HAIR);
            parms.Add("?hair_item", wearable.ItemID.ToString());
            parms.Add("?hair_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.EYES);
            parms.Add("?eyes_item", wearable.ItemID.ToString());
            parms.Add("?eyes_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.SHIRT);
            parms.Add("?shirt_item", wearable.ItemID.ToString());
            parms.Add("?shirt_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.PANTS);
            parms.Add("?pants_item", wearable.ItemID.ToString());
            parms.Add("?pants_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.SHOES);
            parms.Add("?shoes_item", wearable.ItemID.ToString());
            parms.Add("?shoes_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.SOCKS);
            parms.Add("?socks_item", wearable.ItemID.ToString());
            parms.Add("?socks_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.JACKET);
            parms.Add("?jacket_item", wearable.ItemID.ToString());
            parms.Add("?jacket_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.GLOVES);
            parms.Add("?gloves_item", wearable.ItemID.ToString());
            parms.Add("?gloves_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.UNDERSHIRT);
            parms.Add("?undershirt_item", wearable.ItemID.ToString());
            parms.Add("?undershirt_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.UNDERPANTS);
            parms.Add("?underpants_item", wearable.ItemID.ToString());
            parms.Add("?underpants_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.SKIRT);
            parms.Add("?skirt_item", wearable.ItemID.ToString());
            parms.Add("?skirt_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.ALPHA);
            parms.Add("?alpha_item", wearable.ItemID.ToString());
            parms.Add("?alpha_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.TATTOO);
            parms.Add("?tattoo_item", wearable.ItemID.ToString());
            parms.Add("?tattoo_asset", wearable.AssetID.ToString());
            wearable = appearance.GetWearableOfType(AvatarWearable.PHYSICS);
            parms.Add("?physics_item", wearable.ItemID.ToString());
            parms.Add("?physics_asset", wearable.AssetID.ToString());
        }