Beispiel #1
0
        public void SendInitialPosition()
        {
            System.Text.Encoding _enc = System.Text.Encoding.ASCII;
            //send a objectupdate packet with information about the clients avatar

            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();

            objupdate.RegionData.RegionHandle = m_regionHandle;
            objupdate.RegionData.TimeDilation = 64096;
            objupdate.ObjectData    = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
            objupdate.ObjectData[0] = AvatarTemplate;
            //give this avatar object a local id and assign the user a name

            objupdate.ObjectData[0].ID = this.localid;
            this.uuid = objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
            libsecondlife.LLVector3 pos2 = new LLVector3((float)this.Pos.X, (float)this.Pos.Y, (float)this.Pos.Z);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
            m_world._localNumber++;
            foreach (SimClient client in m_clientThreads.Values)
            {
                client.OutPacket(objupdate);
                if (client.AgentID != ControllingClient.AgentID)
                {
                    //the below line is already in Simclient.cs at line number 245 , directly below the call to this method
                    //if there is a problem/bug with that , then lets fix it there rather than duplicating it here
                    //client.ClientAvatar.SendAppearanceToOtherAgent(this.ControllingClient);

                    SendAppearanceToOtherAgent(client);
                }
            }
        }
Beispiel #2
0
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            Primitive closest         = null;
            double    closestDistance = Double.MaxValue;

            Client.Network.CurrentSim.Objects.ForEach(
                delegate(Primitive prim)
            {
                float distance = LLVector3.Dist(Client.Self.SimPosition, prim.Position);

                if (closest == null || distance < closestDistance)
                {
                    closest         = prim;
                    closestDistance = distance;
                }
            }
                );

            if (closest != null)
            {
                Client.Self.RequestSit(closest.ID, LLVector3.Zero);
                Client.Self.Sit();

                return("Sat on " + closest.ID + ". Distance: " + closestDistance);
            }
            else
            {
                return("Couldn't find a nearby prim to sit on");
            }
        }
        private void SendAvatarDataToAll(AvatarData avatar)
        {
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();

            objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
            objupdate.RegionData.TimeDilation = 0;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            objupdate.ObjectData[0]           = _avatarTemplate;
            objupdate.ObjectData[0].ID        = avatar.LocalID;
            objupdate.ObjectData[0].FullID    = avatar.NetInfo.User.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + avatar.NetInfo.User.FirstName + "\nLastName STRING RW SV " + avatar.NetInfo.User.LastName + " \0");

            libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);

            SendInfo send = new SendInfo();

            send.Incr    = true;
            send.NetInfo = avatar.NetInfo;
            send.Packet  = objupdate;
            send.SentTo  = 1;            //to all clients
            this._updateSender.SendList.Enqueue(send);
        }
        //test only
        private void SendAvatarData(NetworkInfo userInfo)
        {
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();

            objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
            objupdate.RegionData.TimeDilation = 64096;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            objupdate.ObjectData[0] = _avatarTemplate;
            //give this avatar object a local id and assign the user a name
            objupdate.ObjectData[0].ID  = 8880000;           // + this._localNumber;
            userInfo.User.AvatarLocalID = objupdate.ObjectData[0].ID;
            //User_info.name="Test"+this.local_numer+" User";
            //this.GetAgent(userInfo.UserAgentID).Started = true;
            objupdate.ObjectData[0].FullID    = userInfo.User.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + userInfo.User.FirstName + "\nLastName STRING RW SV " + userInfo.User.LastName + " \0");
            //userInfo.User.FullName = "FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0";

            libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);

            //this._localNumber++;
            _server.SendPacket(objupdate, true, userInfo);
        }
        //test only
        private void SetupTemplate(string name)
        {
            //should be replaced with completely code generated packets
            int          i        = 0;
            FileInfo     fInfo    = new FileInfo(name);
            long         numBytes = fInfo.Length;
            FileStream   fStream  = new FileStream(name, FileMode.Open, FileAccess.Read);
            BinaryReader br       = new BinaryReader(fStream);

            byte [] data1 = br.ReadBytes((int)numBytes);
            br.Close();
            fStream.Close();

            libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);

            System.Text.Encoding    enc = System.Text.Encoding.ASCII;
            libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
            pos.X             = 100f;
            objdata.ID        = 8880000;
            objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
            libsecondlife.LLVector3 pos2 = new LLVector3(13.981f, 100.0f, 20.0f);
            //objdata.FullID=user.AgentID;
            byte[] pb = pos.GetBytes();
            Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);

            _avatarTemplate = objdata;
        }
Beispiel #6
0
        public void ObjectAddHandler(Packet packet, Simulator simulator)
        {
            LLVector3 position = null;

            if (WaitingOnUpdate)
            {
                CurrentPrimMutex.WaitOne();

                foreach (Block block in packet.Blocks())
                {
                    foreach (Field field in block.Fields)
                    {
                        if (field.Layout.Name == "RayEnd")
                        {
                            position = (LLVector3)field.Data;
                        }
                    }
                }

                txtLog.AppendText("Received an ObjectAdd, setting CurrentPrim position to " + position.ToString());
                CurrentPrim.Position = position;

                CurrentPrimMutex.ReleaseMutex();
            }
        }
Beispiel #7
0
        public void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
        {
            LLUUID fromAgentID   = im.FromAgentID;
            string fromAgentName = im.FromAgentName;
            //LLUUID toAgentID = im.ToAgentID;
            LLUUID               regionID    = im.RegionID;
            LLVector3            position    = im.Position;
            InstantMessageDialog dialog      = im.Dialog;
            bool                 groupIM     = im.GroupIM;
            LLUUID               imSessionID = im.IMSessionID;
            DateTime             timestamp   = im.Timestamp;
            string               message     = im.Message;
            InstantMessageOnline offline     = im.Offline;

            byte[]    binaryBucket   = im.BinaryBucket;
            uint      parentEstateID = im.ParentEstateID;
            Hashtable item           = new Hashtable();

            item.Add("MessageType", "InstantMessage");
            item.Add("FromAgentID", fromAgentID);
            item.Add("FromAgentName", fromAgentName);
            item.Add("ParentEstateID", parentEstateID.ToString());
            item.Add("RegionID", regionID);
            item.Add("Position", position);
            item.Add("Dialog", dialog);
            item.Add("GroupIM", groupIM);
            item.Add("IMSessionID", imSessionID);
            item.Add("Timestamp", timestamp);
            item.Add("Message", message);
            item.Add("Offline", offline);
            item.Add("BinaryBucket", binaryBucket);
            enqueue(item);
        }
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length == 1)
            {
                try
                {
                    string             treeName = args[0].Trim(new char[] { ' ' });
                    ObjectManager.Tree tree     = (ObjectManager.Tree)Enum.Parse(typeof(ObjectManager.Tree), treeName);

                    LLVector3 treePosition = new LLVector3(Client.Self.Position.X, Client.Self.Position.Y,
                                                           Client.Self.Position.Z);
                    treePosition.Z += 3.0f;

                    Client.Objects.AddTree(Client.Network.CurrentSim, new LLVector3(0.5f, 0.5f, 0.5f),
                                           LLQuaternion.Identity, treePosition, tree, TestClient.GroupID, false);

                    return("Attempted to rez a " + treeName + " tree");
                }
                catch (Exception)
                {
                    return("Type !tree for usage");
                }
            }

            string usage = "Usage: !tree [";

            foreach (string value in Enum.GetNames(typeof(ObjectManager.Tree)))
            {
                usage += value + ",";
            }
            usage  = usage.TrimEnd(new char[] { ',' });
            usage += "]";
            return(usage);
        }
Beispiel #9
0
 public int GetRectangularDeviation(LLVector3 aabbmin, LLVector3 aabbmax, int area)
 {
     int xlength = (int)(aabbmax.X - aabbmin.X);
     int ylength = (int)(aabbmax.Y - aabbmin.Y);
     int aabbarea = xlength * ylength;
     return (aabbarea - area) / 16;
 }
Beispiel #10
0
 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
 {
     if (this._physActor != null)
     {
         if (this._physActor.Kinematic == pack.AgentData.UsePhysics)
         {
             this._physActor.Kinematic = !pack.AgentData.UsePhysics; //if Usephysics = true, then Kinematic should = false
         }
         this.physicsEnabled = pack.AgentData.UsePhysics;
         if (this._physActor.Kinematic == false)
         {
             LLVector3 pos = this.Pos;
             this.UpdatePosition(pos);
             pos.Z += 0.000001f;
             this.UpdatePosition(pos);
             this.physicstest = true;
         }
         else
         {
             PhysicsVector vec = this._physActor.Position;
             LLVector3     pos = new LLVector3(vec.X, vec.Y, vec.Z);
             this.Pos        = pos;
             this.updateFlag = true;
         }
     }
 }
        public Packet GiveItemViaImprovedInstantMessage(
            LLUUID ID
            , LLUUID ToAgentID
            , String FromAgentName
            , LLVector3 FromAgentLoc
            , InventoryItem Item
            )
        {
            byte[] BinaryBucket = new byte[17];
            BinaryBucket[0] = (byte)Item.Type;
            Array.Copy(Item.ItemID.Data, 0, BinaryBucket, 1, 16);

            ImprovedInstantMessagePacket p = new ImprovedInstantMessagePacket();

            p.AgentData.AgentID   = AgentID;
            p.AgentData.SessionID = SessionID;

            p.MessageBlock.ID            = ID;
            p.MessageBlock.ToAgentID     = ToAgentID;
            p.MessageBlock.Offline       = (byte)0;
            p.MessageBlock.Timestamp     = Helpers.GetUnixTime();
            p.MessageBlock.Message       = Helpers.StringToField(Item.Name);
            p.MessageBlock.Dialog        = (byte)4;
            p.MessageBlock.BinaryBucket  = BinaryBucket;
            p.MessageBlock.FromAgentName = Helpers.StringToField(FromAgentName);
            p.MessageBlock.Position      = FromAgentLoc;

            // TODO: Either overload this method to allow inclusion of region info or
            // overload the ImprovedInstantMessage in the avatar class to allow item payloads
            p.MessageBlock.RegionID       = LLUUID.Zero;
            p.MessageBlock.ParentEstateID = (uint)0;

            return(p);
        }
 public UserProfile()
 {
     Circuits         = new Dictionary <LLUUID, uint>();
     Inventory        = new AgentInventory();
     homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
     homepos          = new LLVector3();
     homelookat       = new LLVector3();
 }
Beispiel #13
0
 private void processLandmark(string temp)
 {
     Console.Write(temp + "\n");
     string[] parts = temp.Split('\n');
     int.TryParse(parts[0].Substring(17, 1), out _Version);
     LLUUID.TryParse(parts[1].Substring(10, 36), out _Region);
     LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out _Pos);
 }
Beispiel #14
0
        public void Friends_OnFriendFound(LLUUID agentID, ulong regionHandle, LLVector3 location)
        {
            Hashtable item = new Hashtable();

            item.Add("MessageType", "FriendFound");
            item.Add("Location", location);
            item.Add("RegionHandle", regionHandle.ToString()); // String to avoid upsetting JavaScript.
            enqueue(item);
        }
Beispiel #15
0
 /// <summary>
 /// Creates a new Entity (should not occur on it's own)
 /// </summary>
 public Entity()
 {
     uuid     = new libsecondlife.LLUUID();
     localid  = 0;
     m_pos    = new LLVector3();
     velocity = new LLVector3();
     rotation = new Quaternion();
     m_name   = "(basic entity)";
     children = new List <Entity>();
 }
Beispiel #16
0
 /// <summary>
 /// Aims at the specified position, enters mouselook, presses and
 /// releases the left mouse button, and leaves mouselook
 /// </summary>
 /// <param name="target">Target to shoot at</param>
 /// <returns></returns>
 public static bool Shoot(SecondLife client, LLVector3 target)
 {
     if (client.Self.Movement.TurnToward(target))
     {
         return(Shoot(client));
     }
     else
     {
         return(false);
     }
 }
Beispiel #17
0
 public void UpgradeClient()
 {
     OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent");
     this.m_child = false;
     this.m_world.RemoveViewerAgent(this);
     if (!this.m_sandboxMode)
     {
         this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos;
         ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child = false;
     }
     this.InitNewClient();
 }
Beispiel #18
0
        public Packet RezObject(InventoryItem iitem, LLVector3 TargetPos)
        {
            if (iitem.Type != 6)
            {
                Client.Log("RezObject has only been tested with items of type 6", Helpers.LogLevel.Warning);
            }

            RezObjectPacket p = new RezObjectPacket();

            p.AgentData.AgentID   = AgentID;
            p.AgentData.SessionID = SessionID;
            p.AgentData.GroupID   = LLUUID.Zero;

            p.InventoryData.TransactionID = LLUUID.Random();

            p.InventoryData.GroupOwned    = iitem.GroupOwned;
            p.InventoryData.CRC           = iitem.CRC;
            p.InventoryData.CreationDate  = iitem.CreationDate;
            p.InventoryData.SaleType      = iitem.SaleType;
            p.InventoryData.BaseMask      = iitem.BaseMask;
            p.InventoryData.Name          = Helpers.StringToField(iitem.Name);
            p.InventoryData.InvType       = iitem.InvType;
            p.InventoryData.Type          = iitem.Type;
            p.InventoryData.GroupID       = iitem.GroupID;
            p.InventoryData.SalePrice     = iitem.SalePrice;
            p.InventoryData.OwnerID       = iitem.OwnerID;
            p.InventoryData.CreatorID     = iitem.CreatorID;
            p.InventoryData.ItemID        = iitem.ItemID;
            p.InventoryData.FolderID      = iitem.FolderID;
            p.InventoryData.EveryoneMask  = iitem.EveryoneMask;
            p.InventoryData.Description   = Helpers.StringToField(iitem.Description);
            p.InventoryData.Flags         = iitem.Flags;
            p.InventoryData.NextOwnerMask = iitem.NextOwnerMask;
            p.InventoryData.GroupMask     = iitem.GroupMask;
            p.InventoryData.OwnerMask     = iitem.OwnerMask;

            p.RezData.FromTaskID           = LLUUID.Zero;
            p.RezData.BypassRaycast        = 1;
            p.RezData.RayStart             = Client.Self.Position;
            p.RezData.RayEnd               = TargetPos;
            p.RezData.RayTargetID          = LLUUID.Zero;
            p.RezData.RayEndIsIntersection = false;
            p.RezData.RezSelected          = false;
            p.RezData.RemoveItem           = false;
            p.RezData.ItemFlags            = iitem.Flags;
            p.RezData.GroupMask            = iitem.GroupMask;
            p.RezData.EveryoneMask         = iitem.EveryoneMask;
            p.RezData.NextOwnerMask        = iitem.NextOwnerMask;

            return(p);
        }
 public ChatEventArgs(
     string message, SLChatType type, LLVector3 sourcePos, SLSourceType sourceType,
     LLUUID sourceId, LLUUID ownerId, string fromName,
     bool audible, byte command, LLUUID commandId)
 {
     _message    = message;
     _type       = type;
     _sourcePos  = sourcePos;
     _sourceType = sourceType;
     _sourceId   = sourceId;
     _ownerId    = ownerId;
     _fromName   = fromName;
     _audible    = audible;
     _command    = command;
     _commandId  = commandId;
 }
 public void SetEntityPosition(uint localID, float x, float y, float z)
 {
     foreach (Entity entity in this.Entities.Values)
     {
         if (entity.localid == localID && entity is Primitive)
         {
             LLVector3 pos = entity.Pos;
             pos.X = x;
             pos.Y = y;
             Primitive prim = entity as Primitive;
             // Of course, we really should have asked the physEngine if this is possible, and if not, returned false.
             prim.UpdatePosition(pos);
             // Console.WriteLine("script- setting entity " + localID + " positon");
         }
     }
 }
		public override void Think()
		{
            // Find the target position
            lock (Client.Network.Simulators)
            {
                for (int i = 0; i < Client.Network.Simulators.Count; i++)
                {
                    Avatar targetAv;

                    if (Client.Network.Simulators[i].ObjectsAvatars.TryGetValue(targetLocalID, out targetAv))
                    {
                        float distance = 0.0f;

                        if (Client.Network.Simulators[i] == Client.Network.CurrentSim)
                        {
                            distance = LLVector3.Dist(targetAv.Position, Client.Self.SimPosition);
                        }
                        else
                        {
                            // FIXME: Calculate global distances
                        }

                        if (distance > DISTANCE_BUFFER)
                        {
                            uint regionX, regionY;
                            Helpers.LongToUInts(Client.Network.Simulators[i].Handle, out regionX, out regionY);

                            double xTarget = (double)targetAv.Position.X + (double)regionX;
                            double yTarget = (double)targetAv.Position.Y + (double)regionY;
                            double zTarget = targetAv.Position.Z - 2f;

                            Logger.DebugLog(String.Format("[Autopilot] {0} meters away from the target, starting autopilot to <{1},{2},{3}>",
                                distance, xTarget, yTarget, zTarget), Client);

                            Client.Self.AutoPilot(xTarget, yTarget, zTarget);
                        }
                        else
                        {
                            // We are in range of the target and moving, stop moving
                            Client.Self.AutoPilotCancel();
                        }
                    }
                }
            }

			base.Think();
		}
 public InstantMessageEventArgs(
     LLUUID fromAgentId, LLUUID toAgentId, uint parentEstateId, LLUUID regionId,
     LLVector3 position, bool offline, byte dialog, LLUUID id,
     DateTime timestamp, string fromAgentName, string message, string binaryBucket)
 {
     _fromAgentId    = fromAgentId;
     _toAgentId      = toAgentId;
     _parentEstateId = parentEstateId;
     _regionId       = regionId;
     _position       = position;
     _offline        = offline;
     _dialog         = dialog;
     _id             = id;
     _timestamp      = timestamp;
     _fromAgentName  = fromAgentName;
     _message        = message;
     _binaryBucket   = binaryBucket;
 }
Beispiel #23
0
        private void MyOnFrame(IScriptContext context)
        {
            LLVector3 pos = context.Entity.Pos;

            IScriptReadonlyEntity avatar;

            if (context.TryGetRandomAvatar(out avatar))
            {
                LLVector3 avatarPos = avatar.Pos;

                float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2;
                float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2;

                LLVector3 newPos = new LLVector3(x, y, pos.Z);

                context.Entity.Pos = newPos;
            }
        }
Beispiel #24
0
        protected bool MultipleObjUpdate(SimClient simClient, Packet packet)
        {
            MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;

            for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
            {
                if (multipleupdate.ObjectData[i].Type == 9) //change position
                {
                    libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
                    foreach (Entity ent in m_world.Entities.Values)
                    {
                        if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
                        {
                            ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
                        }
                    }
                    //should update stored position of the prim
                }
                else if (multipleupdate.ObjectData[i].Type == 10)//rotation
                {
                    libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
                    foreach (Entity ent in m_world.Entities.Values)
                    {
                        if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
                        {
                            ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
                            ((OpenSim.world.Primitive)ent).UpdateFlag = true;
                        }
                    }
                }
                else if (multipleupdate.ObjectData[i].Type == 13)//scale
                {
                    libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
                    foreach (Entity ent in m_world.Entities.Values)
                    {
                        if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
                        {
                            ((OpenSim.world.Primitive)ent).Scale = scale;
                        }
                    }
                }
            }
            return(true);
        }
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            // *** parse arguments ***
            if ((args.Length < 1) || (args.Length > 2))
            {
                return("Usage: findobjects [radius] <search-string>");
            }
            float  radius       = float.Parse(args[0]);
            string searchString = (args.Length > 1)? args[1] : "";

            // *** get current location ***
            LLVector3 location = Client.Self.SimPosition;

            // *** find all objects in radius ***
            List <Primitive> prims = Client.Network.CurrentSim.Objects.FindAll(
                delegate(Primitive prim) {
                LLVector3 pos = prim.Position;
                return((prim.ParentID == 0) && (pos != LLVector3.Zero) && (LLVector3.Dist(pos, location) < radius));
            }
                );

            // *** request properties of these objects ***
            bool complete = RequestObjectProperties(prims, 250);

            foreach (Primitive p in prims)
            {
                string name = p.Properties.Name;
                if ((name != null) && (name.Contains(searchString)))
                {
                    Console.WriteLine(String.Format("Object '{0}': {1}", name, p.ID.ToString()));
                }
            }

            if (!complete)
            {
                Console.WriteLine("Warning: Unable to retrieve full properties for:");
                foreach (LLUUID uuid in PrimsWaiting.Keys)
                {
                    Console.WriteLine(uuid);
                }
            }

            return("Done searching");
        }
Beispiel #26
0
        public void UpdateClient(SimClient RemoteClient)
        {
            LLVector3 lPos;

            if (this._physActor != null && this.physicsEnabled)
            {
                PhysicsVector pPos = this._physActor.Position;
                lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
            }
            else
            {
                lPos = this.Pos;
            }
            byte[] pb = lPos.GetBytes();
            Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length);

            // OurPacket should be update with the follwing in updateShape() rather than having to do it here
            OurPacket.ObjectData[0].OwnerID       = this.primData.OwnerID;
            OurPacket.ObjectData[0].PCode         = this.primData.PCode;
            OurPacket.ObjectData[0].PathBegin     = this.primData.PathBegin;
            OurPacket.ObjectData[0].PathEnd       = this.primData.PathEnd;
            OurPacket.ObjectData[0].PathScaleX    = this.primData.PathScaleX;
            OurPacket.ObjectData[0].PathScaleY    = this.primData.PathScaleY;
            OurPacket.ObjectData[0].PathShearX    = this.primData.PathShearX;
            OurPacket.ObjectData[0].PathShearY    = this.primData.PathShearY;
            OurPacket.ObjectData[0].PathSkew      = this.primData.PathSkew;
            OurPacket.ObjectData[0].ProfileBegin  = this.primData.ProfileBegin;
            OurPacket.ObjectData[0].ProfileEnd    = this.primData.ProfileEnd;
            OurPacket.ObjectData[0].Scale         = this.primData.Scale;
            OurPacket.ObjectData[0].PathCurve     = this.primData.PathCurve;
            OurPacket.ObjectData[0].ProfileCurve  = this.primData.ProfileCurve;
            OurPacket.ObjectData[0].ParentID      = this.primData.ParentID;
            OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
            //finish off copying rest of shape data
            OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
            OurPacket.ObjectData[0].PathRevolutions  = this.primData.PathRevolutions;
            OurPacket.ObjectData[0].PathTaperX       = this.primData.PathTaperX;
            OurPacket.ObjectData[0].PathTaperY       = this.primData.PathTaperY;
            OurPacket.ObjectData[0].PathTwist        = this.primData.PathTwist;
            OurPacket.ObjectData[0].PathTwistBegin   = this.primData.PathTwistBegin;

            RemoteClient.OutPacket(OurPacket);
        }
Beispiel #27
0
 public void UpdatePosition(LLVector3 pos)
 {
     this.Pos = pos;
     if (this._physActor != null) // && this.physicsEnabled)
     {
         try
         {
             lock (m_world.LockPhysicsEngine)
             {
                 this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
             }
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
     this.updateFlag = true;
 }
Beispiel #28
0
        private void Self_OnInstantMessage(LLUUID fromAgentID, string fromAgentName, LLUUID toAgentID, uint parentEstateID,
                                           LLUUID regionID, LLVector3 position, byte dialog, bool groupIM, LLUUID imSessionID, DateTime timestamp,
                                           string message, byte offline, byte[] binaryBucket)
        {
            if (Master.Length > 0)
            {
                if (fromAgentName.ToLower().Trim() != Master.ToLower().Trim())
                {
                    // Received an IM from someone that is not the bot's master, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not master): " + message + "@" + regionID.ToString() + ":" + position.ToString());
                    return;
                }
            }
            else
            {
                if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID))
                {
                    // Received an IM from someone outside the bot's group, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not in group): " + message + "@" + regionID.ToString() + ":" + position.ToString());
                    return;
                }
            }

            Console.WriteLine("<IM>" + fromAgentName + ": " + message);

            if (Self.ID == toAgentID)
            {
                if (dialog == 22)
                {
                    Console.WriteLine("Accepting teleport lure");
                    Self.TeleportLureRespond(fromAgentID, true);
                }
                else
                {
                    DoCommand(message, fromAgentID, imSessionID);
                }
            }
            else
            {
                // This shouldn't happen
                Console.WriteLine("A bot that we aren't tracking received an IM?");
            }
        }
Beispiel #29
0
    // SayToUser: send a message to the user as in-world chat
    private static void SayToUser(string message)
    {
        Hashtable blocks = new Hashtable();
        Hashtable fields;

        fields               = new Hashtable();
        fields["FromName"]   = "Analyst";
        fields["SourceID"]   = new LLUUID(true);
        fields["OwnerID"]    = agentID;
        fields["SourceType"] = (byte)2;
        fields["ChatType"]   = (byte)1;
        fields["Audible"]    = (byte)1;
        fields["Position"]   = new LLVector3(0, 0, 0);
        fields["Message"]    = message;
        blocks[fields]       = "ChatData";
        Packet packet = PacketBuilder.BuildPacket("ChatFromSimulator", protocolManager, blocks, Helpers.MSG_RELIABLE);

        proxy.InjectPacket(packet, Direction.Incoming);
    }
Beispiel #30
0
        public void ObjectUpdateHandler(Packet packet, Simulator simulator)
        {
            uint   id   = 0;
            LLUUID uuid = null;

            if (WaitingOnUpdate)
            {
                CurrentPrimMutex.WaitOne();

                foreach (Block block in packet.Blocks())
                {
                    foreach (Field field in block.Fields)
                    {
                        if (field.Layout.Name == "ID")
                        {
                            id = (uint)field.Data;
                        }
                        else if (field.Layout.Name == "FullID")
                        {
                            uuid = (LLUUID)field.Data;
                        }
                        else if (field.Layout.Name == "ObjectData")
                        {
                            byte[]    byteArray = (byte[])field.Data;
                            LLVector3 position  = new LLVector3(byteArray, 0);
                            if (CurrentPrim != null && position != CurrentPrim.Position)
                            {
                                txtLog.AppendText(position.ToString() + " doesn't match CurrentPrim.Position " +
                                                  CurrentPrim.Position.ToString() + "\n" /* + ", ignoring"*/);
                                //return;
                            }
                        }
                    }
                }

                CurrentPrim.ID   = id;
                CurrentPrim.UUID = uuid;

                WaitingOnUpdate = false;

                CurrentPrimMutex.ReleaseMutex();
            }
        }