예제 #1
0
        void ObjectShapeHandler(Packet packet, Agent agent)
        {
            ObjectShapePacket shape = (ObjectShapePacket)packet;

            for (int i = 0; i < shape.ObjectData.Length; i++)
            {
                ObjectShapePacket.ObjectDataBlock block = shape.ObjectData[i];

                SimulationObject obj;
                if (server.Scene.TryGetObject(block.ObjectLocalID, out obj))
                {
                    Primitive.ConstructionData data = obj.Prim.PrimData;

                    data.PathBegin        = Primitive.UnpackBeginCut(block.PathBegin);
                    data.PathCurve        = (PathCurve)block.PathCurve;
                    data.PathEnd          = Primitive.UnpackEndCut(block.PathEnd);
                    data.PathRadiusOffset = Primitive.UnpackPathTwist(block.PathRadiusOffset);
                    data.PathRevolutions  = Primitive.UnpackPathRevolutions(block.PathRevolutions);
                    data.PathScaleX       = Primitive.UnpackPathScale(block.PathScaleX);
                    data.PathScaleY       = Primitive.UnpackPathScale(block.PathScaleY);
                    data.PathShearX       = Primitive.UnpackPathShear((sbyte)block.PathShearX);
                    data.PathShearY       = Primitive.UnpackPathShear((sbyte)block.PathShearY);
                    data.PathSkew         = Primitive.UnpackPathTwist(block.PathSkew);
                    data.PathTaperX       = Primitive.UnpackPathTaper(block.PathTaperX);
                    data.PathTaperY       = Primitive.UnpackPathTaper(block.PathTaperY);
                    data.PathTwist        = Primitive.UnpackPathTwist(block.PathTwist);
                    data.PathTwistBegin   = Primitive.UnpackPathTwist(block.PathTwistBegin);
                    data.ProfileBegin     = Primitive.UnpackBeginCut(block.ProfileBegin);
                    data.profileCurve     = block.ProfileCurve;
                    data.ProfileEnd       = Primitive.UnpackEndCut(block.ProfileEnd);
                    data.ProfileHollow    = Primitive.UnpackProfileHollow(block.ProfileHollow);

                    server.Scene.ObjectModify(this, obj, data);
                }
                else
                {
                    Logger.Log("Got an ObjectShape packet for unknown object " + block.ObjectLocalID,
                               Helpers.LogLevel.Warning);
                }
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="shapeBlock"></param>
        public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
        {
            SceneObjectPart part = GetChildPart(localID);
            if (part != null)
            {
                part.UpdateShape(shapeBlock);

                if (part.PhysActor != null)
                    m_scene.SceneGraph.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
            }
        }
예제 #3
0
        /// <summary>
        /// Update the shape of this part.
        /// </summary>
        /// <param name="shapeBlock"></param>
        public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
        {
            m_shape.PathBegin = shapeBlock.PathBegin;
            m_shape.PathEnd = shapeBlock.PathEnd;
            m_shape.PathScaleX = shapeBlock.PathScaleX;
            m_shape.PathScaleY = shapeBlock.PathScaleY;
            m_shape.PathShearX = shapeBlock.PathShearX;
            m_shape.PathShearY = shapeBlock.PathShearY;
            m_shape.PathSkew = shapeBlock.PathSkew;
            m_shape.ProfileBegin = shapeBlock.ProfileBegin;
            m_shape.ProfileEnd = shapeBlock.ProfileEnd;
            m_shape.PathCurve = shapeBlock.PathCurve;
            m_shape.ProfileCurve = shapeBlock.ProfileCurve;
            m_shape.ProfileHollow = shapeBlock.ProfileHollow;
            m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
            m_shape.PathRevolutions = shapeBlock.PathRevolutions;
            m_shape.PathTaperX = shapeBlock.PathTaperX;
            m_shape.PathTaperY = shapeBlock.PathTaperY;
            m_shape.PathTwist = shapeBlock.PathTwist;
            m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;

            if (PhysActor != null)
            {
                PhysActor.Shape = m_shape;
                ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
            }

            // This is what makes vehicle trailers work
            // A script in a child prim re-issues
            // llSetPrimitiveParams(PRIM_TYPE) every few seconds. That
            // prevents autoreturn. This is not well known. It also works
            // in SL.
            //
            if (ParentGroup.RootPart != this)
                ParentGroup.RootPart.Rezzed = DateTime.UtcNow;

            ParentGroup.HasGroupChanged = true;
            TriggerScriptChangedEvent(Changed.SHAPE);
            ScheduleFullUpdate();
        }
예제 #4
0
        /// <summary>
        /// Set the Shape data of an object
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="prim">Data describing the prim shape</param>
        public void SetShape(Simulator simulator, uint localID, Primitive.ConstructionData prim)
        {
            ObjectShapePacket shape = new ObjectShapePacket();

            shape.AgentData.AgentID = Client.Self.AgentID;
            shape.AgentData.SessionID = Client.Self.SessionID;

            shape.ObjectData = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock[1];
            shape.ObjectData[0] = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock();

            shape.ObjectData[0].ObjectLocalID = localID;

            shape.ObjectData[0].PathCurve = (byte)prim.PathCurve;
            shape.ObjectData[0].PathBegin = Primitive.PackBeginCut(prim.PathBegin);
            shape.ObjectData[0].PathEnd = Primitive.PackEndCut(prim.PathEnd);
            shape.ObjectData[0].PathScaleX = Primitive.PackPathScale(prim.PathScaleX);
            shape.ObjectData[0].PathScaleY = Primitive.PackPathScale(prim.PathScaleY);
            shape.ObjectData[0].PathShearX = (byte)Primitive.PackPathShear(prim.PathShearX);
            shape.ObjectData[0].PathShearY = (byte)Primitive.PackPathShear(prim.PathShearY);
            shape.ObjectData[0].PathTwist = Primitive.PackPathTwist(prim.PathTwist);
            shape.ObjectData[0].PathTwistBegin = Primitive.PackPathTwist(prim.PathTwistBegin);
            shape.ObjectData[0].PathRadiusOffset = Primitive.PackPathTwist(prim.PathRadiusOffset);
            shape.ObjectData[0].PathTaperX = Primitive.PackPathTaper(prim.PathTaperX);
            shape.ObjectData[0].PathTaperY = Primitive.PackPathTaper(prim.PathTaperY);
            shape.ObjectData[0].PathRevolutions = Primitive.PackPathRevolutions(prim.PathRevolutions);
            shape.ObjectData[0].PathSkew = Primitive.PackPathTwist(prim.PathSkew);

            shape.ObjectData[0].ProfileCurve = prim.profileCurve;
            shape.ObjectData[0].ProfileBegin = Primitive.PackBeginCut(prim.ProfileBegin);
            shape.ObjectData[0].ProfileEnd = Primitive.PackEndCut(prim.ProfileEnd);
            shape.ObjectData[0].ProfileHollow = Primitive.PackProfileHollow(prim.ProfileHollow);

            Client.Network.SendPacket(shape, simulator);
        }
예제 #5
0
        /// <summary>
        /// Set the sculptie texture and data on an object
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="sculpt">A <seealso cref="Primitive.SculptData"/> object containing the data to set</param>
        public void SetSculpt(Simulator simulator, uint localID, Primitive.SculptData sculpt)
        {
            ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket();

            extra.AgentData.AgentID = Client.Self.AgentID;
            extra.AgentData.SessionID = Client.Self.SessionID;

            extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1];
            extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock();
            extra.ObjectData[0].ObjectLocalID = localID;
            extra.ObjectData[0].ParamType = (byte)ExtraParamType.Sculpt;
            extra.ObjectData[0].ParamInUse = true;
            extra.ObjectData[0].ParamData = sculpt.GetBytes();
            extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length;

            Client.Network.SendPacket(extra, simulator);

            // Not sure why, but if you don't send this the sculpted prim disappears
            ObjectShapePacket shape = new ObjectShapePacket();

            shape.AgentData.AgentID = Client.Self.AgentID;
            shape.AgentData.SessionID = Client.Self.SessionID;

            shape.ObjectData = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock[1];
            shape.ObjectData[0] = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock();
            shape.ObjectData[0].ObjectLocalID = localID;
            shape.ObjectData[0].PathScaleX = 100;
            shape.ObjectData[0].PathScaleY = 150;
            shape.ObjectData[0].PathCurve = 32;

            Client.Network.SendPacket(shape, simulator);
        }
예제 #6
0
        /// <summary>
        /// Update the shape of this part.
        /// </summary>
        /// <param name="shapeBlock"></param>
        public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
        {
            IOpenRegionSettingsModule module = ParentGroup.Scene.RequestModuleInterface<IOpenRegionSettingsModule>();
            if (module != null)
            {
                if (shapeBlock.ProfileHollow > module.MaximumHollowSize * 500 &&
                    module.MaximumHollowSize != -1) //This is so that it works correctly, since the packet sends (N * 500)
                {
                    shapeBlock.ProfileHollow = (ushort)(module.MaximumHollowSize * 500);
                }
                if (shapeBlock.PathScaleY > (200 - (module.MinimumHoleSize * 100)) &&
                    module.MinimumHoleSize != -1 && shapeBlock.PathCurve == 32) //This is how the packet is set up... so this is how we check for it...
                {
                    shapeBlock.PathScaleY = Convert.ToByte((200 - (module.MinimumHoleSize * 100)));
                }
            }

            m_shape.PathBegin = shapeBlock.PathBegin;
            m_shape.PathEnd = shapeBlock.PathEnd;
            m_shape.PathScaleX = shapeBlock.PathScaleX;
            m_shape.PathScaleY = shapeBlock.PathScaleY;
            m_shape.PathShearX = shapeBlock.PathShearX;
            m_shape.PathShearY = shapeBlock.PathShearY;
            m_shape.PathSkew = shapeBlock.PathSkew;
            m_shape.ProfileBegin = shapeBlock.ProfileBegin;
            m_shape.ProfileEnd = shapeBlock.ProfileEnd;
            m_shape.PathCurve = shapeBlock.PathCurve;
            m_shape.ProfileCurve = shapeBlock.ProfileCurve;

            m_shape.ProfileHollow = shapeBlock.ProfileHollow;
            m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
            m_shape.PathRevolutions = shapeBlock.PathRevolutions;
            m_shape.PathTaperX = shapeBlock.PathTaperX;
            m_shape.PathTaperY = shapeBlock.PathTaperY;
            m_shape.PathTwist = shapeBlock.PathTwist;
            m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;

            Shape = m_shape;

            if (PhysActor != null)
            {
                PhysActor.Shape = m_shape;
                m_parentGroup.Scene.SceneGraph.PhysicsScene.AddPhysicsActorTaint(PhysActor);
            }

            // This is what makes vehicle trailers work
            // A script in a child prim re-issues
            // llSetPrimitiveParams(PRIM_TYPE) every few seconds. That
            // prevents autoreturn. This is not well known. It also works
            // in SL.
            //
            if (ParentGroup.RootPart != this)
                ParentGroup.RootPart.Rezzed = DateTime.UtcNow;

            ParentGroup.HasGroupChanged = true;
            ScheduleUpdate(PrimUpdateFlags.Shape);
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="shapeBlock"></param>
        public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
        {
            SceneObjectPart part = GetPart(localID);
            if (part != null)
            {
                part.UpdateShape(shapeBlock);

                PhysicsActor pa = m_rootPart.PhysActor;

                if (pa != null)
                    m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
            }
        }
예제 #8
0
        ///<summary>
        ///</summary>
        ///<param name = "shapeBlock"></param>
        ///<param name="localID"></param>
        public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
        {
            SceneObjectPart part = (SceneObjectPart) GetChildPart(localID);
            if (part != null)
            {
                part.UpdateShape(shapeBlock);

                if (part.PhysActor != null)
                    m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
                m_ValidgrpOOB = false;
            }
        }
예제 #9
0
        /// <summary>
        /// Update the shape of this part.
        /// </summary>
        /// <param name="shapeBlock"></param>
        public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
        {
            m_shape.PathBegin = shapeBlock.PathBegin;
            m_shape.PathEnd = shapeBlock.PathEnd;
            m_shape.PathScaleX = shapeBlock.PathScaleX;
            m_shape.PathScaleY = shapeBlock.PathScaleY;
            m_shape.PathShearX = shapeBlock.PathShearX;
            m_shape.PathShearY = shapeBlock.PathShearY;
            m_shape.PathSkew = shapeBlock.PathSkew;
            m_shape.ProfileBegin = shapeBlock.ProfileBegin;
            m_shape.ProfileEnd = shapeBlock.ProfileEnd;
            m_shape.PathCurve = shapeBlock.PathCurve;
            m_shape.ProfileCurve = shapeBlock.ProfileCurve;
            m_shape.ProfileHollow = shapeBlock.ProfileHollow;
            m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
            m_shape.PathRevolutions = shapeBlock.PathRevolutions;
            m_shape.PathTaperX = shapeBlock.PathTaperX;
            m_shape.PathTaperY = shapeBlock.PathTaperY;
            m_shape.PathTwist = shapeBlock.PathTwist;
            m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;

            PhysicsActor physActor = PhysActor;
            if (physActor != null)
            {
                physActor.Shape = m_shape;
            }

            // We calculate mesh ServerWeight seperately on upload.  Any change to the shape
            // however is to a non-mesh one (there is no way to force a prim to be a mesh).
            // So reset ServerWeight and StreamingCost to be 1.0 which is default for all other prims.
            ServerWeight = 1.0f;
            StreamingCost = 1.0f;

            // This is what makes vehicle trailers work
            // A script in a child prim re-issues
            // llSetPrimitiveParams(PRIM_TYPE) every few seconds. That
            // prevents autoreturn. This is not well known. It also works
            // in SL.
            //
            if (ParentGroup.RootPart != this)
                ParentGroup.RootPart.Rezzed = DateTime.Now;

            ParentGroup.HasGroupChanged = true;
            ScheduleFullUpdate(PrimUpdateFlags.Shape);
        }
예제 #10
0
 /// <summary>
 /// </summary>
 /// <param name="shapeBlock"></param>
 /// <param name="localID"></param>
 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
 {
     SceneObjectPart part = (SceneObjectPart) GetChildPart(localID);
     if (part != null)
     {
         part.UpdateShape(shapeBlock);
         m_ValidgrpOOB = false;
     }
 }
예제 #11
0
        /// <summary>
        ///   Having this function because I found when scripts updated the shape.. over and over, it would fill up the memory
        ///   Having the extra paramater updatePhysics can prevent physics updates on the changes
        ///   The onlyplace this effects is if a script changes the shape
        ///   If the LocklessQueue gets updated this can be removed
        /// </summary>
        /// <param name = "shapeBlock"></param>
        /// <param name="UpdatePhysics"></param>
        public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, bool UpdatePhysics)
        {
            IOpenRegionSettingsModule module = ParentGroup.Scene.RequestModuleInterface<IOpenRegionSettingsModule>();
            if (module != null)
            {
                if (shapeBlock.ProfileHollow > (module.MaximumHollowSize * 500) &&
                    module.MaximumHollowSize != -1)
                //This is so that it works correctly, since the packet sends (N * 500)
                {
                    shapeBlock.ProfileHollow = (ushort)(module.MaximumHollowSize * 500);
                }
                if (shapeBlock.PathScaleY > (200 - (module.MinimumHoleSize * 100)) &&
                    module.MinimumHoleSize != -1 && shapeBlock.PathCurve == 32)
                //This is how the packet is set up... so this is how we check for it...
                {
                    shapeBlock.PathScaleY = Convert.ToByte((200 - (module.MinimumHoleSize * 100)));
                }
            }

            m_shape.PathBegin = shapeBlock.PathBegin;
            m_shape.PathEnd = shapeBlock.PathEnd;
            m_shape.PathScaleX = shapeBlock.PathScaleX;
            m_shape.PathScaleY = shapeBlock.PathScaleY;
            m_shape.PathShearX = shapeBlock.PathShearX;
            m_shape.PathShearY = shapeBlock.PathShearY;
            m_shape.PathSkew = shapeBlock.PathSkew;
            m_shape.ProfileBegin = shapeBlock.ProfileBegin;
            m_shape.ProfileEnd = shapeBlock.ProfileEnd;
            m_shape.PathCurve = shapeBlock.PathCurve;
            m_shape.ProfileCurve = shapeBlock.ProfileCurve;

            m_shape.ProfileHollow = shapeBlock.ProfileHollow;
            m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
            m_shape.PathRevolutions = shapeBlock.PathRevolutions;
            m_shape.PathTaperX = shapeBlock.PathTaperX;
            m_shape.PathTaperY = shapeBlock.PathTaperY;
            m_shape.PathTwist = shapeBlock.PathTwist;
            m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;

            if (m_shape.SculptEntry && UpdatePhysics)
                m_parentGroup.Scene.AssetService.Get(m_shape.SculptTexture.ToString(), true, AssetReceived);
            else
            {
                Shape = m_shape;

                if ((UpdatePhysics) && (PhysActor != null))
                    PhysActor.Shape = m_shape;
            }

            // This is what makes vehicle trailers work
            // A script in a child prim re-issues
            // llSetPrimitiveParams(PRIM_TYPE) every few seconds. That
            // prevents autoreturn. This also works in SL.
            if (ParentGroup.RootPart != this)
                ParentGroup.RootPart.Rezzed = DateTime.UtcNow;

            ValidpartOOB = false;
            ParentGroup.HasGroupChanged = true;
            ScheduleUpdate(PrimUpdateFlags.FullUpdate);
        }
예제 #12
0
 /// <summary>
 ///   Update the shape of this part.
 /// </summary>
 /// <param name = "shapeBlock"></param>
 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
 {
     UpdateShape(shapeBlock, true);
 }
예제 #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shapeBlock"></param>
 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
 {
     SceneObjectPart part = GetChildPart(localID);
     if (part != null)
     {
         part.UpdateShape(shapeBlock);
     }
 }
예제 #14
0
        protected virtual void ProcessInPacket(Packet Pack)
        {
            ack_pack(Pack);
            if (debug)
            {
                if (Pack.Type != PacketType.AgentUpdate)
                {
                    Console.WriteLine(Pack.Type.ToString());
                }
            }

            if (this.ProcessPacketMethod(Pack))
            {
                //there is a handler registered that handled this packet type
                return;
            }
            else
            {
                System.Text.Encoding _enc = System.Text.Encoding.ASCII;

                switch (Pack.Type)
                {
                case PacketType.CompleteAgentMovement:
                    if (this.m_child)
                    {
                        this.UpgradeClient();
                    }
                    ClientAvatar.CompleteMovement(m_world);
                    ClientAvatar.SendInitialPosition();
                    break;

                case PacketType.RegionHandshakeReply:
                    m_world.SendLayerData(this);
                    break;

                case PacketType.AgentWearablesRequest:
                    ClientAvatar.SendInitialAppearance();
                    foreach (SimClient client in m_clientThreads.Values)
                    {
                        if (client.AgentID != this.AgentID)
                        {
                            ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
                            this.OutPacket(objupdate);
                            client.ClientAvatar.SendAppearanceToOtherAgent(this);
                        }
                    }
                    m_world.GetInitialPrims(this);
                    break;

                case PacketType.AgentIsNowWearing:
                    AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
                    //Console.WriteLine(Pack.ToString());
                    break;

                case PacketType.AgentSetAppearance:
                    AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
                    // Console.WriteLine(appear.ToString());
                    this.ClientAvatar.SetAppearance(appear);
                    break;

                case PacketType.ObjectAdd:
                    m_world.AddNewPrim((ObjectAddPacket)Pack, this);
                    break;

                case PacketType.ObjectLink:
                    OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
                    ObjectLinkPacket        link         = (ObjectLinkPacket)Pack;
                    uint                    parentprimid = 0;
                    OpenSim.world.Primitive parentprim   = null;
                    if (link.ObjectData.Length > 1)
                    {
                        parentprimid = link.ObjectData[0].ObjectLocalID;
                        foreach (Entity ent in m_world.Entities.Values)
                        {
                            if (ent.localid == parentprimid)
                            {
                                parentprim = (OpenSim.world.Primitive)ent;
                            }
                        }
                        for (int i = 1; i < link.ObjectData.Length; i++)
                        {
                            foreach (Entity ent in m_world.Entities.Values)
                            {
                                if (ent.localid == link.ObjectData[i].ObjectLocalID)
                                {
                                    ((OpenSim.world.Primitive)ent).MakeParent(parentprim);
                                }
                            }
                        }
                    }
                    break;

                case PacketType.ObjectScale:
                    OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
                    break;

                case PacketType.ObjectShape:
                    ObjectShapePacket shape = (ObjectShapePacket)Pack;
                    for (int i = 0; i < shape.ObjectData.Length; i++)
                    {
                        foreach (Entity ent in m_world.Entities.Values)
                        {
                            if (ent.localid == shape.ObjectData[i].ObjectLocalID)
                            {
                                ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
                            }
                        }
                    }
                    break;

                case PacketType.RequestImage:
                    RequestImagePacket imageRequest = (RequestImagePacket)Pack;
                    for (int i = 0; i < imageRequest.RequestImage.Length; i++)
                    {
                        m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
                    }
                    break;

                case PacketType.TransferRequest:
                    //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
                    TransferRequestPacket transfer = (TransferRequestPacket)Pack;
                    m_assetCache.AddAssetRequest(this, transfer);
                    break;

                case PacketType.AgentUpdate:
                    ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
                    break;

                case PacketType.ObjectImage:
                    ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
                    for (int i = 0; i < imagePack.ObjectData.Length; i++)
                    {
                        foreach (Entity ent in m_world.Entities.Values)
                        {
                            if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
                            {
                                ((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
                            }
                        }
                    }
                    break;

                case PacketType.ObjectFlagUpdate:
                    ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
                    foreach (Entity ent in m_world.Entities.Values)
                    {
                        if (ent.localid == flags.AgentData.ObjectLocalID)
                        {
                            ((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
                        }
                    }
                    break;

                case PacketType.AssetUploadRequest:
                    AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
                    this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
                    break;

                case PacketType.RequestXfer:
                    //Console.WriteLine(Pack.ToString());
                    break;

                case PacketType.SendXferPacket:
                    this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
                    break;

                case PacketType.CreateInventoryFolder:
                    CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
                    m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
                    //Console.WriteLine(Pack.ToString());
                    break;

                case PacketType.CreateInventoryItem:
                    //Console.WriteLine(Pack.ToString());
                    CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
                    if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
                    {
                        this.UploadAssets.CreateInventoryItem(createItem);
                    }
                    else
                    {
                        // Console.Write(Pack.ToString());
                        this.CreateInventoryItem(createItem);
                    }
                    break;

                case PacketType.FetchInventory:
                    //Console.WriteLine("fetch item packet");
                    FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
                    m_inventoryCache.FetchInventory(this, FetchInventory);
                    break;

                case PacketType.FetchInventoryDescendents:
                    FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
                    m_inventoryCache.FetchInventoryDescendents(this, Fetch);
                    break;

                case PacketType.UpdateInventoryItem:
                    UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
                    //Console.WriteLine(Pack.ToString());
                    for (int i = 0; i < update.InventoryData.Length; i++)
                    {
                        if (update.InventoryData[i].TransactionID != LLUUID.Zero)
                        {
                            AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
                            if (asset != null)
                            {
                                // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
                                m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
                            }
                            else
                            {
                                asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
                                if (asset != null)
                                {
                                    //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
                                    m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
                                }
                                else
                                {
                                    //Console.WriteLine("trying to update inventory item, but asset is null");
                                }
                            }
                        }
                        else
                        {
                            m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]);;
                        }
                    }
                    break;

                case PacketType.ViewerEffect:
                    ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
                    foreach (SimClient client in m_clientThreads.Values)
                    {
                        if (client.AgentID != this.AgentID)
                        {
                            viewer.AgentData.AgentID   = client.AgentID;
                            viewer.AgentData.SessionID = client.SessionID;
                            client.OutPacket(viewer);
                        }
                    }
                    break;

                case PacketType.RequestTaskInventory:
                    // Console.WriteLine(Pack.ToString());
                    RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
                    ReplyTaskInventoryPacket   replytask   = new ReplyTaskInventoryPacket();
                    bool foundent = false;
                    foreach (Entity ent in m_world.Entities.Values)
                    {
                        if (ent.localid == requesttask.InventoryData.LocalID)
                        {
                            replytask.InventoryData.TaskID   = ent.uuid;
                            replytask.InventoryData.Serial   = 0;
                            replytask.InventoryData.Filename = new byte[0];
                            foundent = true;
                        }
                    }
                    if (foundent)
                    {
                        this.OutPacket(replytask);
                    }
                    break;

                case PacketType.UpdateTaskInventory:
                    // Console.WriteLine(Pack.ToString());
                    UpdateTaskInventoryPacket updatetask  = (UpdateTaskInventoryPacket)Pack;
                    AgentInventory            myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
                    if (myinventory != null)
                    {
                        if (updatetask.UpdateData.Key == 0)
                        {
                            if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null)
                            {
                                if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7)
                                {
                                    LLUUID    noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID;
                                    AssetBase assBase = this.m_assetCache.GetAsset(noteaid);
                                    if (assBase != null)
                                    {
                                        foreach (Entity ent in m_world.Entities.Values)
                                        {
                                            if (ent.localid == updatetask.UpdateData.LocalID)
                                            {
                                                if (ent is OpenSim.world.Primitive)
                                                {
                                                    this.m_world.AddScript(ent, Util.FieldToString(assBase.Data));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;

                case PacketType.AgentAnimation:
                    if (!m_child)
                    {
                        AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
                        for (int i = 0; i < AgentAni.AnimationList.Length; i++)
                        {
                            if (AgentAni.AnimationList[i].StartAnim)
                            {
                                ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
                                ClientAvatar.anim_seq     = 1;
                                ClientAvatar.SendAnimPack();
                            }
                        }
                    }
                    break;

                case PacketType.ObjectSelect:
                    ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
                    for (int i = 0; i < incomingselect.ObjectData.Length; i++)
                    {
                        foreach (Entity ent in m_world.Entities.Values)
                        {
                            if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
                            {
                                ((OpenSim.world.Primitive)ent).GetProperites(this);
                                break;
                            }
                        }
                    }
                    break;
                }
            }
        }
예제 #15
0
 public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
 {
     this.primData.PathBegin = addPacket.PathBegin;
     this.primData.PathEnd = addPacket.PathEnd;
     this.primData.PathScaleX = addPacket.PathScaleX;
     this.primData.PathScaleY = addPacket.PathScaleY;
     this.primData.PathShearX = addPacket.PathShearX;
     this.primData.PathShearY = addPacket.PathShearY;
     this.primData.PathSkew = addPacket.PathSkew;
     this.primData.ProfileBegin = addPacket.ProfileBegin;
     this.primData.ProfileEnd = addPacket.ProfileEnd;
     this.primData.PathCurve = addPacket.PathCurve;
     this.primData.ProfileCurve = addPacket.ProfileCurve;
     this.primData.ProfileHollow = addPacket.ProfileHollow;
     this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
     this.primData.PathRevolutions = addPacket.PathRevolutions;
     this.primData.PathTaperX = addPacket.PathTaperX;
     this.primData.PathTaperY = addPacket.PathTaperY;
     this.primData.PathTwist = addPacket.PathTwist;
     this.primData.PathTwistBegin = addPacket.PathTwistBegin;
     this.dirtyFlag = true;
 }