Esempio n. 1
0
 /// <summary>
 /// Send a packet to the simulator the avatar is currently occupying
 /// </summary>
 /// <param name="packet">Packet to send</param>
 public void SendPacket(Packet packet)
 {
     if (CurrentSim != null && CurrentSim.Connected)
     {
         CurrentSim.SendPacket(packet, true);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Send a raw byte array as a packet to the specified simulator
 /// </summary>
 /// <param name="payload">Byte array containing a packet</param>
 /// <param name="simulator">Simulator to send the packet to</param>
 /// <param name="setSequence">Whether to set the second, third, and fourth
 /// bytes of the payload to the current sequence number</param>
 public void SendPacket(byte[] payload, Simulator simulator, bool setSequence)
 {
     if (simulator != null)
     {
         simulator.SendPacket(payload, setSequence);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Send a packet to a specified simulator
 /// </summary>
 /// <param name="packet">Packet to send</param>
 /// <param name="simulator">Simulator to send the packet to</param>
 public void SendPacket(Packet packet, Simulator simulator)
 {
     if (simulator != null)
     {
         simulator.SendPacket(packet, true);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Send a raw byte array as a packet to the specified simulator
 /// </summary>
 /// <param name="payload">Byte array containing a packet</param>
 /// <param name="simulator">Simulator to send the packet to</param>
 /// <param name="setSequence">Whether to set the second, third, and fourth
 /// bytes of the payload to the current sequence number</param>
 public void SendPacket(byte[] payload, Simulator simulator, bool setSequence)
 {
     if (simulator != null)
         simulator.SendPacket(payload, setSequence);
 }
Esempio n. 5
0
 /// <summary>
 /// Send a packet to a specified simulator
 /// </summary>
 /// <param name="packet">Packet to send</param>
 /// <param name="simulator">Simulator to send the packet to</param>
 public void SendPacket(Packet packet, Simulator simulator)
 {
     if (simulator != null)
         simulator.SendPacket(packet, true);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="packet"></param>
 /// <param name="simulator"></param>
 public void SendPacket(Packet packet, Simulator simulator)
 {
     if (simulator.Connected)
     {
         simulator.SendPacket(packet, true);
     }
 }
        private void ParcelPropertiesHandler(Packet packet, Simulator simulator)
        {
            ParcelPropertiesPacket properties = (ParcelPropertiesPacket)packet;

            byte[] Bitmap = properties.ParcelData.Bitmap;
            int LocalID = properties.ParcelData.LocalID;

            // Mark this area as downloaded
            int x, y, index, subindex;
            byte val;

            for (x = 0; x < 64; x++)
            {
                for (y = 0; y < 64; y++)
                {
                    if (simulator.Region.ParcelMarked[y, x] == 0)
                    {
                        index = ((x * 64) + y);
                        subindex = index % 8;
                        index /= 8;

                        val = Bitmap[index];

                        simulator.Region.ParcelMarked[y, x] = ((val >> subindex) & 1) == 1 ? LocalID : 0;
                    }
                }
            }

            // Fire off the next request, if we are downloading the whole sim
            bool hasTriggered = false;
            if (simulator.Region.ParcelDownloading)
            {
                for (x = 0; x < 64; x++)
                {
                    for (y = 0; y < 64; y++)
                    {
                        if (simulator.Region.ParcelMarked[x, y] == 0)
                        {
                            ParcelPropertiesRequestPacket tPacket = new ParcelPropertiesRequestPacket();
                            tPacket.AgentData.AgentID = Client.Network.AgentID;
                            tPacket.AgentData.SessionID = Client.Network.SessionID;
                            tPacket.ParcelData.SequenceID = -10000;
                            tPacket.ParcelData.West = (x * 4.0f);
                            tPacket.ParcelData.South = (y * 4.0f);
                            tPacket.ParcelData.East = (x * 4.0f) + 4.0f;
                            tPacket.ParcelData.North = (y * 4.0f) + 4.0f;

                            simulator.SendPacket((Packet)tPacket, true);

                            hasTriggered = true;

                            goto exit;
                        }
                    }
                }
            exit:
                ;
            }

            // This map is complete, fire callback
            if (!hasTriggered)
            {
                simulator.Region.FilledParcels();
            }

            Parcel parcel = null;

            lock (simulator.Region.Parcels)
            {
                if (!simulator.Region.Parcels.ContainsKey(LocalID))
                {
                    simulator.Region.Parcels[LocalID] = new Parcel(simulator);
                }

                parcel = simulator.Region.Parcels[LocalID];
            }

            // Save this parcels data
            // TODO: Lots of values are not being stored, Parcel needs to be expanded to take all the data.
            // August2006:  God help me should I have to type this out again... argh.
            // October2006: I really shouldnt have typed that.
            parcel.RequestResult       = properties.ParcelData.RequestResult;
            parcel.SequenceID          = properties.ParcelData.SequenceID;
            parcel.SnapSelection       = properties.ParcelData.SnapSelection;
            parcel.SelfCount           = properties.ParcelData.SelfCount;
            parcel.OtherCount          = properties.ParcelData.OtherCount;
            parcel.PublicCount         = properties.ParcelData.PublicCount;
            parcel.LocalID             = LocalID;
            parcel.OwnerID             = properties.ParcelData.OwnerID;
            parcel.IsGroupOwned        = properties.ParcelData.IsGroupOwned;
            parcel.AuctionID           = properties.ParcelData.AuctionID;
            parcel.ReservedNewbie      = properties.ParcelData.ReservedNewbie;
            parcel.ClaimDate           = properties.ParcelData.ClaimDate;
            parcel.ClaimPrice          = properties.ParcelData.ClaimPrice;
            parcel.RentPrice           = properties.ParcelData.RentPrice;
            parcel.AABBMin             = properties.ParcelData.AABBMin;
            parcel.AABBMax             = properties.ParcelData.AABBMax;
            parcel.Bitmap              = properties.ParcelData.Bitmap;
            parcel.Area                = properties.ParcelData.Area;
            parcel.Status              = properties.ParcelData.Status;
            parcel.SimWideMaxObjects   = properties.ParcelData.SimWideMaxPrims;
            parcel.SimWideTotalObjects = properties.ParcelData.SimWideTotalPrims;
            parcel.MaxObjects          = properties.ParcelData.MaxPrims;
            parcel.TotalObjects        = properties.ParcelData.TotalPrims;
            parcel.OwnerObjects        = properties.ParcelData.OwnerPrims;
            parcel.GroupObjects        = properties.ParcelData.GroupPrims;
            parcel.OtherObjects        = properties.ParcelData.OtherPrims;
            parcel.ParcelObjectBonus   = properties.ParcelData.ParcelPrimBonus;
            parcel.OtherCleanTime      = properties.ParcelData.OtherCleanTime;
            parcel.ParcelFlags         = properties.ParcelData.ParcelFlags;
            parcel.SalePrice           = properties.ParcelData.SalePrice;
            parcel.Name                = Helpers.FieldToString(properties.ParcelData.Name);
            parcel.Desc                = Helpers.FieldToString(properties.ParcelData.Desc);
            parcel.MusicURL            = Helpers.FieldToString(properties.ParcelData.MusicURL);
            parcel.MediaURL            = Helpers.FieldToString(properties.ParcelData.MediaURL);
            parcel.MediaID             = properties.ParcelData.MediaID;
            parcel.MediaAutoScale      = properties.ParcelData.MediaAutoScale;
            parcel.GroupID             = properties.ParcelData.GroupID;
            parcel.PassPrice           = properties.ParcelData.PassPrice;
            parcel.PassHours           = properties.ParcelData.PassHours;
            parcel.Category            = properties.ParcelData.Category;
            parcel.AuthBuyerID         = properties.ParcelData.AuthBuyerID;
            parcel.SnapshotID          = properties.ParcelData.SnapshotID;
            parcel.UserLocation        = properties.ParcelData.UserLocation;
            parcel.UserLookAt          = properties.ParcelData.UserLookAt;
            parcel.LandingType         = properties.ParcelData.LandingType;
        }
Esempio n. 8
0
        private void ParcelPropertiesHandler(Packet packet, Simulator simulator)
        {
            ParcelPropertiesPacket properties = (ParcelPropertiesPacket)packet;

            byte[] Bitmap  = properties.ParcelData.Bitmap;
            int    LocalID = properties.ParcelData.LocalID;

            // Mark this area as downloaded
            int  x, y, index, subindex;
            byte val;

            for (x = 0; x < 64; x++)
            {
                for (y = 0; y < 64; y++)
                {
                    if (simulator.Region.ParcelMarked[y, x] == 0)
                    {
                        index    = ((x * 64) + y);
                        subindex = index % 8;
                        index   /= 8;

                        val = Bitmap[index];

                        simulator.Region.ParcelMarked[y, x] = ((val >> subindex) & 1) == 1 ? LocalID : 0;
                    }
                }
            }

            // Fire off the next request, if we are downloading the whole sim
            bool hasTriggered = false;

            if (simulator.Region.ParcelDownloading)
            {
                for (x = 0; x < 64; x++)
                {
                    for (y = 0; y < 64; y++)
                    {
                        if (simulator.Region.ParcelMarked[x, y] == 0)
                        {
                            ParcelPropertiesRequestPacket tPacket = new ParcelPropertiesRequestPacket();
                            tPacket.AgentData.AgentID     = Client.Network.AgentID;
                            tPacket.AgentData.SessionID   = Client.Network.SessionID;
                            tPacket.ParcelData.SequenceID = -10000;
                            tPacket.ParcelData.West       = (x * 4.0f);
                            tPacket.ParcelData.South      = (y * 4.0f);
                            tPacket.ParcelData.East       = (x * 4.0f) + 4.0f;
                            tPacket.ParcelData.North      = (y * 4.0f) + 4.0f;

                            simulator.SendPacket((Packet)tPacket, true);

                            hasTriggered = true;

                            goto exit;
                        }
                    }
                }
exit:
                ;
            }

            // This map is complete, fire callback
            if (!hasTriggered)
            {
                simulator.Region.FilledParcels();
            }

            Parcel parcel = null;

            lock (simulator.Region.Parcels)
            {
                if (!simulator.Region.Parcels.ContainsKey(LocalID))
                {
                    simulator.Region.Parcels[LocalID] = new Parcel(simulator);
                }

                parcel = simulator.Region.Parcels[LocalID];
            }

            // Save this parcels data
            // TODO: Lots of values are not being stored, Parcel needs to be expanded to take all the data.
            // August2006:  God help me should I have to type this out again... argh.
            // October2006: I really shouldnt have typed that.
            parcel.RequestResult       = properties.ParcelData.RequestResult;
            parcel.SequenceID          = properties.ParcelData.SequenceID;
            parcel.SnapSelection       = properties.ParcelData.SnapSelection;
            parcel.SelfCount           = properties.ParcelData.SelfCount;
            parcel.OtherCount          = properties.ParcelData.OtherCount;
            parcel.PublicCount         = properties.ParcelData.PublicCount;
            parcel.LocalID             = LocalID;
            parcel.OwnerID             = properties.ParcelData.OwnerID;
            parcel.IsGroupOwned        = properties.ParcelData.IsGroupOwned;
            parcel.AuctionID           = properties.ParcelData.AuctionID;
            parcel.ReservedNewbie      = properties.ParcelData.ReservedNewbie;
            parcel.ClaimDate           = properties.ParcelData.ClaimDate;
            parcel.ClaimPrice          = properties.ParcelData.ClaimPrice;
            parcel.RentPrice           = properties.ParcelData.RentPrice;
            parcel.AABBMin             = properties.ParcelData.AABBMin;
            parcel.AABBMax             = properties.ParcelData.AABBMax;
            parcel.Bitmap              = properties.ParcelData.Bitmap;
            parcel.Area                = properties.ParcelData.Area;
            parcel.Status              = properties.ParcelData.Status;
            parcel.SimWideMaxObjects   = properties.ParcelData.SimWideMaxPrims;
            parcel.SimWideTotalObjects = properties.ParcelData.SimWideTotalPrims;
            parcel.MaxObjects          = properties.ParcelData.MaxPrims;
            parcel.TotalObjects        = properties.ParcelData.TotalPrims;
            parcel.OwnerObjects        = properties.ParcelData.OwnerPrims;
            parcel.GroupObjects        = properties.ParcelData.GroupPrims;
            parcel.OtherObjects        = properties.ParcelData.OtherPrims;
            parcel.ParcelObjectBonus   = properties.ParcelData.ParcelPrimBonus;
            parcel.OtherCleanTime      = properties.ParcelData.OtherCleanTime;
            parcel.ParcelFlags         = properties.ParcelData.ParcelFlags;
            parcel.SalePrice           = properties.ParcelData.SalePrice;
            parcel.Name                = Helpers.FieldToString(properties.ParcelData.Name);
            parcel.Desc                = Helpers.FieldToString(properties.ParcelData.Desc);
            parcel.MusicURL            = Helpers.FieldToString(properties.ParcelData.MusicURL);
            parcel.MediaURL            = Helpers.FieldToString(properties.ParcelData.MediaURL);
            parcel.MediaID             = properties.ParcelData.MediaID;
            parcel.MediaAutoScale      = properties.ParcelData.MediaAutoScale;
            parcel.GroupID             = properties.ParcelData.GroupID;
            parcel.PassPrice           = properties.ParcelData.PassPrice;
            parcel.PassHours           = properties.ParcelData.PassHours;
            parcel.Category            = properties.ParcelData.Category;
            parcel.AuthBuyerID         = properties.ParcelData.AuthBuyerID;
            parcel.SnapshotID          = properties.ParcelData.SnapshotID;
            parcel.UserLocation        = properties.ParcelData.UserLocation;
            parcel.UserLookAt          = properties.ParcelData.UserLookAt;
            parcel.LandingType         = properties.ParcelData.LandingType;
        }