Inheritance: UDPBase, IDisposable
Esempio n. 1
1
 public void Objects_OnObjectProperties11(Simulator simulator, Primitive prim, Primitive.ObjectProperties props)
 {
     //Primitive prim = GetPrimitive(props.ObjectID, simulator);
     if (prim == null)
     {
         prim = GetPrimitive(props.ObjectID, simulator);
     }
     DeclareProperties(prim, props, simulator);
     if (prim != null)
     {
         prim.RegionHandle = simulator.Handle;
         SimObject updateMe = GetSimObject(prim, simulator);
         if (updateMe == null)
         {
             return;
         }
         if (prim.ParentID == 0 && !SimRegion.OutOfRegion(prim.Position))
         {
             updateMe.ResetPrim(prim, client, simulator);
         }
         if (MaintainObjectProperties)
         {
             //updateMe.Properties = null;
             updateMe.Properties = (props);
         }
         //Debug("UpdateProperties: {0}", updateMe.DebugInfo());
         describePrimToAI(prim, simulator);
     }
 }
Esempio n. 2
1
        private void ProcessAnimationsPacket(Packet packet, Simulator simulator)
        {
            if (!(packet is AvatarAnimationPacket))
                return;

            AvatarAnimationPacket animation = (AvatarAnimationPacket)packet;

            SimData simData;
            if (!Ox.DataStore.World.SimCollection.TryGet(simulator.ID.ToString(), out simData))
                return;

            ObjectData objectData;
            if (!simData.TryGet(animation.Sender.ID.ToString(), out objectData))
                return;

            if (!(objectData is AvatarData))
                return;

            AvatarData avatarData = objectData as AvatarData;

            List<AvatarData.Animation> anims = new List<AvatarData.Animation>();
            foreach (AvatarAnimationPacket.AnimationListBlock block in animation.AnimationList)
                anims.Add(new AvatarData.Animation(block.AnimID.ToString(), block.AnimSequenceID));
            avatarData.UpdateAnimation(anims.ToArray());

            string msg = JsonUtil.SerializeMessage(JsonType.ObjectUpdated, new JsonObjectUpdated(
                simulator.ID.ToString(),
                animation.Sender.ID.ToString(),
                (int)JsonObjectUpdated.PrimType.Avatar,
                (int)JsonObjectUpdated.Type.UpdateAnimation
                ));
            Ox.EventFire(msg, true);
        }
        public ntfPermissions(RadegastInstance instance, Simulator simulator, UUID taskID, UUID itemID, string objectName, string objectOwner, ScriptPermission questions)
            : base(NotificationType.PermissionsRequest)
        {
            InitializeComponent();

            this.instance = instance;
            this.simulator = simulator;
            this.taskID = taskID;
            this.itemID = itemID;
            this.objectName = objectName;
            this.objectOwner = objectOwner;
            this.questions = questions;

            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = "Object " + objectName + " owned by " + objectOwner + " is asking permission to " + questions.ToString() + ". Do you accept?";

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtMessage.Text;
            args.Buttons.Add(btnYes);
            args.Buttons.Add(btnNo);
            args.Buttons.Add(btnMute);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
Esempio n. 4
1
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="simulator"></param>
        /// <param name="seedcaps"></param>
        internal Caps(Simulator simulator, string seedcaps)
        {
            Simulator = simulator;
            _SeedCapsURI = seedcaps;

            MakeSeedRequest();
        }
Esempio n. 5
1
 public void SendPacket(Packet packet, Simulator sim)
 {
     if (OnPacketSent != null)
     {
         OnPacketSent(packet, sim);
     }
 }
Esempio n. 6
1
        void Objects_OnNewAvatar(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
        {
            if (enabled)
            {
                // Search this avatar for textures
                for (int i = 0; i < avatar.Textures.FaceTextures.Length; i++)
                {
                    Primitive.TextureEntryFace face = avatar.Textures.FaceTextures[i];

                    if (face != null)
                    {
                        if (!alreadyRequested.ContainsKey(face.TextureID))
                        {
                            alreadyRequested[face.TextureID] = face.TextureID;

                            // Determine if this is a baked outfit texture or a normal texture
                            ImageType type = ImageType.Normal;
                            AppearanceManager.TextureIndex index = (AppearanceManager.TextureIndex)i;
                            switch (index)
                            {
                                case AppearanceManager.TextureIndex.EyesBaked:
                                case AppearanceManager.TextureIndex.HeadBaked:
                                case AppearanceManager.TextureIndex.LowerBaked:
                                case AppearanceManager.TextureIndex.SkirtBaked:
                                case AppearanceManager.TextureIndex.UpperBaked:
                                    type = ImageType.Baked;
                                    break;
                            }

                            Client.Assets.RequestImage(face.TextureID, type);
                        }
                    }
                }
            }
        }
 private bool Network_SkipEvent(PacketType type, Simulator sim)
 {
     if (PacketTypeRegional.Contains(type))
     {
         if (!IsMaster(sim)) return true;
     }
     return false;
 }
Esempio n. 8
1
 public LandPatchReceivedEventArgs(Simulator simulator, int x, int y, int patchSize, float[] heightMap)
 {
     this.m_Simulator = simulator;
     this.m_X = x;
     this.m_Y = y;
     this.m_PatchSize = patchSize;
     this.m_HeightMap = heightMap;
 }
Esempio n. 9
1
        public static string Serialize(Simulator settings, RegionSettings reg)
        {
            StringWriter sw = new StringWriter();
            XmlTextWriter xtw = new XmlTextWriter(sw);
            xtw.Formatting = Formatting.Indented;
            xtw.WriteStartDocument();

            xtw.WriteStartElement("RegionSettings");

            xtw.WriteStartElement("General");
            xtw.WriteElementString("AllowDamage", ((settings.Flags & RegionFlags.AllowDamage) != 0).ToString());
            xtw.WriteElementString("AllowLandResell", ((settings.Flags & RegionFlags.BlockLandResell) == 0).ToString());
            xtw.WriteElementString("AllowLandJoinDivide", ((settings.Flags & RegionFlags.AllowParcelChanges) != 0).ToString());
            xtw.WriteElementString("BlockFly", ((settings.Flags & RegionFlags.NoFly) != 0).ToString());
            xtw.WriteElementString("BlockLandShowInSearch", ((settings.Flags & RegionFlags.BlockParcelSearch) != 0).ToString());
            xtw.WriteElementString("BlockTerraform", ((settings.Flags & RegionFlags.BlockTerraform) != 0).ToString());
            xtw.WriteElementString("DisableCollisions", ((settings.Flags & RegionFlags.SkipCollisions) != 0).ToString());
            xtw.WriteElementString("DisablePhysics", ((settings.Flags & RegionFlags.SkipPhysics) != 0).ToString());
            xtw.WriteElementString("DisableScripts", ((settings.Flags & RegionFlags.SkipScripts) != 0).ToString());
            xtw.WriteElementString("MaturityRating", settings.Access.ToString());
            xtw.WriteElementString("RestrictPushing", ((settings.Flags & RegionFlags.RestrictPushObject) != 0).ToString());
            xtw.WriteElementString("AgentLimit", reg.AgentLimit.ToString());
            xtw.WriteElementString("ObjectBonus", reg.ObjectBonus.ToString());
            xtw.WriteEndElement();

            xtw.WriteStartElement("GroundTextures");
            xtw.WriteElementString("Texture1", settings.TerrainDetail0.ToString());
            xtw.WriteElementString("Texture2", settings.TerrainDetail1.ToString());
            xtw.WriteElementString("Texture3", settings.TerrainDetail2.ToString());
            xtw.WriteElementString("Texture4", settings.TerrainDetail3.ToString());
            xtw.WriteElementString("ElevationLowSW", settings.TerrainStartHeight00.ToString());
            xtw.WriteElementString("ElevationLowNW", settings.TerrainStartHeight01.ToString());
            xtw.WriteElementString("ElevationLowSE", settings.TerrainStartHeight10.ToString());
            xtw.WriteElementString("ElevationLowNE", settings.TerrainStartHeight11.ToString());
            xtw.WriteElementString("ElevationHighSW", settings.TerrainHeightRange00.ToString());
            xtw.WriteElementString("ElevationHighNW", settings.TerrainHeightRange01.ToString());
            xtw.WriteElementString("ElevationHighSE", settings.TerrainHeightRange10.ToString());
            xtw.WriteElementString("ElevationHighNE", settings.TerrainHeightRange11.ToString());
            xtw.WriteEndElement();

            xtw.WriteStartElement("Terrain");
            xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString());
            xtw.WriteElementString("TerrainRaiseLimit", reg.TerrainRaiseLimit.ToString());
            xtw.WriteElementString("TerrainLowerLimit", reg.TerrainLowerLimit.ToString());
            xtw.WriteElementString("UseEstateSun", reg.UseEstateSun.ToString());
            xtw.WriteElementString("FixedSun", reg.FixedSun.ToString());
            //todo xtw.WriteElementString("SunPosition", settings.SunPosition.ToString());
            // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which
            // calculates it automatically according to the date and other factors.
            xtw.WriteEndElement();

            xtw.WriteEndElement();

            xtw.Close();
            sw.Close();

            return sw.ToString();
        }
Esempio n. 10
1
 private void AgentDataUpdateHandler(Packet packet, Simulator sim)
 {
     AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;
     if (p.AgentData.AgentID == Client.Self.AgentID)
     {
         activeGroup = Utils.BytesToString(p.AgentData.GroupName) + " ( " + Utils.BytesToString(p.AgentData.GroupTitle) + " )";
         GroupsEvent.Set();
     }
 }
Esempio n. 11
1
 /// <summary>
 /// Construct a new instance of the SoundTriggerEventArgs class
 /// </summary>
 /// <param name="sim">Simulator where the event originated</param>
 /// <param name="soundID">The sound asset id</param>
 /// <param name="ownerID">The ID of the owner</param>
 /// <param name="objectID">The ID of the object</param>
 /// <param name="gain">The volume level</param>
 /// <param name="flags">The <see cref="SoundFlags"/></param>
 public AttachedSoundEventArgs(Simulator sim, UUID soundID, UUID ownerID, UUID objectID, float gain, SoundFlags flags)
 {
     this.m_Simulator = sim;
     this.m_SoundID = soundID;
     this.m_OwnerID = ownerID;
     this.m_ObjectID = objectID;
     this.m_Gain = gain;
     this.m_Flags = flags;
 }
Esempio n. 12
1
 private void AgentDataUpdateHandler(Packet packet, Simulator sim)
 {
     AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;
     if (p.AgentData.AgentID == Client.Self.AgentID)
     {
         activeGroup = Helpers.FieldToUTF8String(p.AgentData.GroupName) + " ( " + Helpers.FieldToUTF8String(p.AgentData.GroupTitle) + " )";
         GroupsEvent.Set();
     }
 }
Esempio n. 13
1
        void Nurse_OnInstantMessage(InstantMessage im, Simulator simulator)
        {
            if (im.Message.Equals("Reset"))
            {
                Reset();
                return;
            }

            if (im.Message.Equals("Stop"))
            {
                Stop();
                return;
            }

            if (im.Message.Equals("Start"))
            {
                Start();
                return;
            }

            if (state != States.idle)
            {
                client.Self.InstantMessage(im.FromAgentID, "busy");
                return;
            }

            List<Vector3> wayPointList = null;
            if (im.Message.Equals("thirsty"))
            {
                state = States.water;
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, "room5");
                client.Self.Chat("Ok " + im.FromAgentName + ", I'll get you a drink.", 0, ChatType.Normal);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("I'm getting water for the patient in " + roomName, 0, ChatType.Normal);
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, roomName);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("Here is your water.", 0, ChatType.Normal);
            }
            if (im.Message.Equals("pain"))
            {
                state = States.drugs;
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, "pharmacy");
                client.Self.Chat("Ok " + im.FromAgentName + ", I'll see what they have in the pharmacy", 0, ChatType.Normal);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("I'm getting drugs for the patient in " + roomName, 0, ChatType.Normal);
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, roomName);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("Here is your morphine.", 0, ChatType.Normal);
            }

            state = States.travelling;
            wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, "lobby");
            TraverseWayPoints(wayPointList);

            state = States.idle;
        }
Esempio n. 14
1
 static void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
 {
     if (im.Dialog == InstantMessageDialog.RequestTeleport)
     {
         if (im.FromAgentID == _MasterID)
         {
             _Client.Self.TeleportLureRespond(im.FromAgentID, true);
         }
     }
 }
Esempio n. 15
1
        void Objects_OnObjectProperties(Simulator simulator, Primitive.ObjectProperties properties)
        {
            lock (PrimsWaiting) {
                Primitive prim;
                if (PrimsWaiting.TryGetValue(properties.ObjectID, out prim)) {
                    prim.Properties = properties;
                }
                PrimsWaiting.Remove(properties.ObjectID);

                if (PrimsWaiting.Count == 0)
                    AllPropertiesReceived.Set();
            }
        }
Esempio n. 16
1
 private object AsRLocation(Simulator simulator, Vector3d targetPos, SimPosition pos)
 {
     Vector3 lpos = new Vector3((float)targetPos.X, (float)targetPos.Y, (float)targetPos.Z);
     SimRegion r = SimRegion.GetRegion(simulator);
     if (targetPos == Vector3d.Zero)
     {
         if (r == null)
         {
             if (pos != null && pos.IsRegionAttached) return new SimHeading(pos);
             return SimHeading.UNKNOWN;
         }
         return r;
     }
     return new SimHeading(pos, lpos);
 }
Esempio n. 17
1
        private void DecompressLand(Simulator simulator, BitPack bitpack, TerrainPatch.GroupHeader group)
        {
            int x;
            int y;
            int[] patches = new int[32 * 32];
            int count = 0;

            while (true)
            {
                TerrainPatch.Header header = TerrainCompressor.DecodePatchHeader(bitpack);

                if (header.QuantWBits == TerrainCompressor.END_OF_PATCHES)
                    break;

                x = header.X;
                y = header.Y;

                if (x >= TerrainCompressor.PATCHES_PER_EDGE || y >= TerrainCompressor.PATCHES_PER_EDGE)
                {
                    Logger.Log(String.Format(
                        "Invalid LayerData land packet, x={0}, y={1}, dc_offset={2}, range={3}, quant_wbits={4}, patchids={5}, count={6}",
                        x, y, header.DCOffset, header.Range, header.QuantWBits, header.PatchIDs, count),
                        Helpers.LogLevel.Warning, Client);
                    return;
                }

                // Decode this patch
                TerrainCompressor.DecodePatch(patches, bitpack, header, group.PatchSize);

                // Decompress this patch
                float[] heightmap = TerrainCompressor.DecompressPatch(patches, header, group);

                count++;

                try { OnLandPatchReceived(new LandPatchReceivedEventArgs(simulator, x, y, group.PatchSize, heightmap)); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }

                if (Client.Settings.STORE_LAND_PATCHES)
                {
                    TerrainPatch patch = new TerrainPatch();
                    patch.Data = heightmap;
                    patch.X = x;
                    patch.Y = y;
                    simulator.Terrain[y * 16 + x] = patch;
                }
            }
        }
Esempio n. 18
1
        public frmStats(METAboltInstance instance)
        {
            InitializeComponent();

            string msg1 = "Click for online help/guidance";
            toolTip = new Popup(customToolTip = new CustomToolTip(instance, msg1));
            toolTip.AutoClose = false;
            toolTip.FocusOnOpen = false;
            toolTip.ShowingAnimation = toolTip.HidingAnimation = PopupAnimations.Blend;

            this.instance = instance;
            client = this.instance.Client;

            sim = client.Network.CurrentSim;

            client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged);
        }
Esempio n. 19
1
 public bool IsMaster(Simulator simulator)
 {
     lock (MasteringRegions)
     {
         if (simulator == null) return client.Network.CurrentSim == null || MasteringRegions.Count == 0;
         if (MasteringRegions.Contains(simulator.Handle)) return true;
         lock (SimMaster)
         {
             if (!SimMaster.ContainsKey(simulator.Handle))
             {
                 SimMaster[simulator.Handle] = this;
                 MasteringRegions.AddTo(simulator.Handle);
                 return true;
             }
         }
         return false;
     }
 }
Esempio n. 20
1
 private object AsLocation(Simulator simulator, Vector3 position, SimPosition pos)
 {
     SimRegion r = SimRegion.GetRegion(simulator);
     if (position == Vector3.Zero)
     {
         if (r == null)
         {
             if (pos != null && pos.IsRegionAttached) return new SimHeading(pos);
             return SimHeading.UNKNOWN;
         }
         return r;
     }
     Quaternion rot = Quaternion.Identity;
     if (pos != null && pos.IsRegionAttached)
     {
         rot = pos.SimRotation;
     }
     return new SimHeading(r.GetPathStore(position), position, rot);
 }
Esempio n. 21
1
        void Objects_OnNewPrim(Simulator simulator, Primitive prim, ulong regionHandle, ushort timeDilation)
        {
            if (enabled)
            {
                // Search this prim for textures
                for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
                {
                    Primitive.TextureEntryFace face = prim.Textures.FaceTextures[i];

                    if (face != null)
                    {
                        if (!alreadyRequested.ContainsKey(face.TextureID))
                        {
                            alreadyRequested[face.TextureID] = face.TextureID;
                            Client.Assets.RequestImage(face.TextureID, ImageType.Normal);
                        }
                    }
                }
            }
        }
        public LLRegionContext(RegionContextBase rcontext, AssetContextBase acontext,
                               LLTerrainInfo tinfo, OMV.Simulator sim)
            : base(rcontext, acontext)
        {
            m_terrainInfo = tinfo;

            // until we have a better protocol, we know the sims are a fixed size
            m_size = new OMV.Vector3(256f, 256f, 8000f);

            // believe it or not the world coordinates of a sim are hidden in the handle
            uint x, y;

            OMV.Utils.LongToUInts(sim.Handle, out x, out y);
            m_worldBase = new OMV.Vector3d((double)x, (double)y, 0d);

            m_simulator = sim;

            // this should be more general as "GRID/SIM"
            m_name = new EntityName(sim.Name);

            // a cache of requested localIDs so we don't ask too often
            m_recentLocalIDRequests = new Dictionary <uint, int>();

            this.RegisterInterface <LLRegionContext>(this);
        }
Esempio n. 23
0
        /// <summary>
        /// Routine called on a separate thread to load the avatars and objects from the simulators
        /// into LookingGlass.
        /// </summary>
        /// <param name="loadParam"></param>
        private static void LoadSims(Object loadParam)
        {
            LogManager.Log.Log(LogLevel.DCOMM, "LoadWorldObjects: starting to load sim objects");
            try {
                Object[]             loadParams = (Object[])loadParam;
                List <OMV.Simulator> simsToLoad = (List <OMV.Simulator>)loadParams[0];
                OMV.GridClient       netComm    = (OMV.GridClient)loadParams[1];
                CommLLLP             worldComm  = (CommLLLP)loadParams[2];

                OMV.Simulator simm = null;
                try {
                    foreach (OMV.Simulator sim in simsToLoad)
                    {
                        simm = sim;
                        LoadASim(sim, netComm, worldComm);
                    }
                }
                catch (Exception e) {
                    LogManager.Log.Log(LogLevel.DBADERROR, "LoadWorldObjects: exception loading {0}: {1}",
                                       (simm == null ? "NULL" : simm.Name), e.ToString());
                }
            }
            catch (Exception e) {
                LogManager.Log.Log(LogLevel.DBADERROR, "LoadWorldObjects: exception: {0}", e.ToString());
            }
            LogManager.Log.Log(LogLevel.DCOMM, "LoadWorldObjects: completed loading sim objects");
        }
Esempio n. 24
0
        // Return 'true' if we don't have this region in our world yet
        private static bool WeDontKnowAboutThisSimulator(OMV.Simulator sim, OMV.GridClient netComm, CommLLLP worldComm)
        {
            LLRegionContext regn = worldComm.FindRegion(delegate(LLRegionContext rgn) {
                return(rgn.Simulator.ID == sim.ID);
            });

            return(regn == null);
        }
Esempio n. 25
0
        private static void AddObjects(OMV.Simulator sim, OMV.GridClient netComm, CommLLLP worldComm)
        {
            LogManager.Log.Log(LogLevel.DCOMM, "LoadWorldObjects: loading {0} primitives", sim.ObjectsPrimitives.Count);
            List <OMV.Primitive> primsToNew = new List <OpenMetaverse.Primitive>();

            sim.ObjectsPrimitives.ForEach(delegate(OMV.Primitive prim) {
                primsToNew.Add(prim);
            });
            foreach (OMV.Primitive prim in primsToNew)
            {
                // TODO: how can we tell if this prim might be an attachment?
                worldComm.Objects_ObjectUpdate(netComm, new OpenMetaverse.PrimEventArgs(sim, prim, 0, true, false));
            }
        }
Esempio n. 26
0
        private static void AddAvatars(OMV.Simulator sim, OMV.GridClient netComm, CommLLLP worldComm)
        {
            LogManager.Log.Log(LogLevel.DCOMM, "LoadWorldObjects: loading {0} avatars", sim.ObjectsAvatars.Count);
            List <OMV.Avatar> avatarsToNew = new List <OpenMetaverse.Avatar>();

            sim.ObjectsAvatars.ForEach(delegate(OMV.Avatar av) {
                avatarsToNew.Add(av);
            });
            // this happens outside the avatar list lock
            foreach (OMV.Avatar av in avatarsToNew)
            {
                worldComm.Objects_AvatarUpdate(netComm, new OMV.AvatarUpdateEventArgs(sim, av, 0, true));
            }
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;

            OpenMetaverse.Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim;

            StringBuilder output = new StringBuilder();

            output.AppendLine(CurSim.ToString());
            output.Append("UUID: ");
            output.AppendLine(CurSim.ID.ToString());
            output.Append("RegionID: ");
            output.AppendLine(CurSim.RegionID.ToString());
            uint x, y;

            Utils.LongToUInts(CurSim.Handle, out x, out y);
            output.AppendLine(String.Format("Handle: {0} (X: {1} Y: {2})", CurSim.Handle, x, y));
            output.Append("Access: ");
            output.AppendLine(CurSim.Access.ToString());
            output.Append("Flags: ");
            output.AppendLine(CurSim.Flags.ToString());
            output.Append("TerrainBase0: ");
            output.AppendLine(CurSim.TerrainBase0.ToString());
            output.Append("TerrainBase1: ");
            output.AppendLine(CurSim.TerrainBase1.ToString());
            output.Append("TerrainBase2: ");
            output.AppendLine(CurSim.TerrainBase2.ToString());
            output.Append("TerrainBase3: ");
            output.AppendLine(CurSim.TerrainBase3.ToString());
            output.Append("TerrainDetail0: ");
            output.AppendLine(CurSim.TerrainDetail0.ToString());
            output.Append("TerrainDetail1: ");
            output.AppendLine(CurSim.TerrainDetail1.ToString());
            output.Append("TerrainDetail2: ");
            output.AppendLine(CurSim.TerrainDetail2.ToString());
            output.Append("TerrainDetail3: ");
            output.AppendLine(CurSim.TerrainDetail3.ToString());
            output.Append("Water Height: ");
            output.AppendLine(CurSim.WaterHeight.ToString());

            return(Success(output.ToString()));
        }
Esempio n. 28
0
 private void OnMovingTowards_OnObjectUpdated(Simulator simulator, ObjectUpdate update, ulong regionHandle, ushort timeDilation)
 {
     if (update.LocalID == Mover.LocalID)
     {
         UpdateAll();
     }
     else
     {
         Primitive prim = Client.WorldSystem.GetPrimitive(update.LocalID);
         if (IsFacing(prim))
         {
             if (!MoverFaceing.Contains(prim))
                 MoverFaceing.Add(prim);
         }
         else
         {
             if (MoverFaceing.Contains(prim))
                 MoverFaceing.Remove(prim);
         }
     }
 }
        public LLRegionContext(RegionContextBase rcontext, AssetContextBase acontext, 
                        LLTerrainInfo tinfo, OMV.Simulator sim)
            : base(rcontext, acontext)
        {
            m_terrainInfo = tinfo;

            // until we have a better protocol, we know the sims are a fixed size
            m_size = new OMV.Vector3(256f, 256f, 8000f);

            // believe it or not the world coordinates of a sim are hidden in the handle
            uint x, y;
            OMV.Utils.LongToUInts(sim.Handle, out x, out y);
            m_worldBase = new OMV.Vector3d((double)x, (double)y, 0d);

            m_simulator = sim;

            // this should be more general as "GRID/SIM"
            m_name = new EntityName(sim.Name);

            // a cache of requested localIDs so we don't ask too often
            m_recentLocalIDRequests = new Dictionary<uint, int>();

            this.RegisterInterface<LLRegionContext>(this);
        }
Esempio n. 30
0
        public string GetSerializedAttachmentPrims(Simulator sim, uint localID)
        {
            List<Primitive> prims = sim.ObjectsPrimitives.FindAll(
                delegate(Primitive prim)
                {
                    return (prim.LocalID == localID || prim.ParentID == localID);
                }
            );

            RequestObjectProperties(prims, 500);

            int i = prims.FindIndex(
                delegate(Primitive prim)
                {
                    return (prim.LocalID == localID);
                }
            );

            if (i >= 0) {
                prims[i].ParentID = 0;
            }

            return OSDParser.SerializeLLSDXmlString(ClientHelpers.PrimListToOSD(prims));
        }
Esempio n. 31
0
        void Terrain_OnLandPatch(Simulator simulator, int x, int y, int width, float[] data)
        {
            if (x >= 16 || y >= 16)
            {
                Console.WriteLine("Bad patch coordinates, x = " + x + ", y = " + y);
                return;
            }

            if (width != 16)
            {
                Console.WriteLine("Unhandled patch size " + width + "x" + width);
                return;
            }

            Bitmap patch = new Bitmap(16, 16, PixelFormat.Format24bppRgb);

            for (int yp = 0; yp < 16; yp++)
            {
                for (int xp = 0; xp < 16; xp++)
                {
                    float height = data[yp * 16 + xp];
                    int colorVal = Helpers.FloatToByte(height, 0.0f, 60.0f);
                    int lesserVal = (int)((float)colorVal * 0.75f);
                    Color color;

                    if (height >= simulator.WaterHeight)
                        color = Color.FromArgb(lesserVal, colorVal, lesserVal);
                    else
                        color = Color.FromArgb(lesserVal, lesserVal, colorVal);

                    patch.SetPixel(xp, yp, color);
                }
            }

            Boxes[x, y].Image = (System.Drawing.Image)patch;
        }
Esempio n. 32
0
 /// <summary>
 /// Construct a new instance of the InstantMessageEventArgs object
 /// </summary>
 /// <param name="im">the InstantMessage object</param>
 /// <param name="simulator">the simulator where the InstantMessage origniated</param>
 public InstantMessageEventArgs(InstantMessage im, Simulator simulator)
 {
     this.m_IM = im;
     this.m_Simulator = simulator;
 }
Esempio n. 33
0
 public dPovTerrain(TestClient Client)
 {
     mClient = Client;
     mSim = mClient.Network.CurrentSim;
 }
Esempio n. 34
0
 public OutgoingPacket(Simulator simulator, UDPPacketBuffer buffer, PacketType type)
 {
     Client    = simulator;
     Buffer    = buffer;
     this.Type = type;
 }
Esempio n. 35
0
        /// <summary></summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
        private void EstateOwnerMessageHandler(Packet packet, Simulator simulator)
        {
            EstateOwnerMessagePacket message = (EstateOwnerMessagePacket)packet;
            uint   estateID;
            string method = Utils.BytesToString(message.MethodData.Method);

            //List<string> parameters = new List<string>();

            if (method == "estateupdateinfo")
            {
                string estateName  = Utils.BytesToString(message.ParamList[0].Parameter);
                UUID   estateOwner = new UUID(Utils.BytesToString(message.ParamList[1].Parameter));
                estateID = Utils.BytesToUInt(message.ParamList[2].Parameter);

                /*
                 * foreach (EstateOwnerMessagePacket.ParamListBlock param in message.ParamList)
                 * {
                 *  parameters.Add(Utils.BytesToString(param.Parameter));
                 * }
                 */
                bool denyNoPaymentInfo;
                if (Utils.BytesToUInt(message.ParamList[8].Parameter) == 0)
                {
                    denyNoPaymentInfo = true;
                }
                else
                {
                    denyNoPaymentInfo = false;
                }

                if (OnGetEstateUpdateInfo != null)
                {
                    try
                    {
                        OnGetEstateUpdateInfo(estateName, estateOwner, estateID, denyNoPaymentInfo);
                    }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }

            else if (method == "setaccess")
            {
                int count;
                estateID = Utils.BytesToUInt(message.ParamList[0].Parameter);
                if (message.ParamList.Length > 1)
                {
                    //param comes in as a string for some reason
                    uint param;
                    if (!uint.TryParse(Utils.BytesToString(message.ParamList[1].Parameter), out param))
                    {
                        return;
                    }

                    EstateAccessReplyDelta accessType = (EstateAccessReplyDelta)param;

                    switch (accessType)
                    {
                    case EstateAccessReplyDelta.EstateManagers:
                        if (OnGetEstateManagers != null)
                        {
                            if (message.ParamList.Length > 5)
                            {
                                if (!int.TryParse(Utils.BytesToString(message.ParamList[5].Parameter), out count))
                                {
                                    return;
                                }
                                List <UUID> managers = new List <UUID>();
                                for (int i = 6; i < message.ParamList.Length; i++)
                                {
                                    try
                                    {
                                        UUID managerID = new UUID(message.ParamList[i].Parameter, 0);
                                        managers.Add(managerID);
                                    }
                                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                                }
                                try { OnGetEstateManagers(estateID, count, managers); }
                                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                            }
                        }
                        break;

                    case EstateAccessReplyDelta.EstateBans:
                        if (OnGetEstateBans != null)
                        {
                            if (message.ParamList.Length > 6)
                            {
                                if (!int.TryParse(Utils.BytesToString(message.ParamList[4].Parameter), out count))
                                {
                                    return;
                                }
                                List <UUID> bannedUsers = new List <UUID>();
                                for (int i = 7; i < message.ParamList.Length; i++)
                                {
                                    try
                                    {
                                        UUID bannedID = new UUID(message.ParamList[i].Parameter, 0);
                                        bannedUsers.Add(bannedID);
                                    }
                                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                                }
                                try { OnGetEstateBans(estateID, count, bannedUsers); }
                                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                            }
                        }
                        break;

                    case EstateAccessReplyDelta.AllowedUsers:
                        if (OnGetAllowedUsers != null)
                        {
                            if (message.ParamList.Length > 5)
                            {
                                if (!int.TryParse(Utils.BytesToString(message.ParamList[2].Parameter), out count))
                                {
                                    return;
                                }
                                List <UUID> allowedUsers = new List <UUID>();
                                for (int i = 6; i < message.ParamList.Length; i++)
                                {
                                    try
                                    {
                                        UUID allowedID = new UUID(message.ParamList[i].Parameter, 0);
                                        allowedUsers.Add(allowedID);
                                    }
                                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                                }
                                try { OnGetAllowedUsers(estateID, count, allowedUsers); }
                                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                            }
                        }
                        break;

                    case EstateAccessReplyDelta.AllowedGroups:
                        if (OnGetAllowedGroups != null)
                        {
                            if (message.ParamList.Length > 5)
                            {
                                if (!int.TryParse(Utils.BytesToString(message.ParamList[3].Parameter), out count))
                                {
                                    return;
                                }
                                List <UUID> allowedGroups = new List <UUID>();
                                for (int i = 5; i < message.ParamList.Length; i++)
                                {
                                    try
                                    {
                                        UUID groupID = new UUID(message.ParamList[i].Parameter, 0);
                                        allowedGroups.Add(groupID);
                                    }
                                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                                }
                                try { OnGetAllowedGroups(estateID, count, allowedGroups); }
                                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                            }
                        }
                        break;
                    }
                }
            }

            /*
             * Console.WriteLine("--- " + method + " ---");
             * foreach (EstateOwnerMessagePacket.ParamListBlock block in message.ParamList)
             * {
             *  Console.WriteLine(Utils.BytesToString(block.Parameter));
             * }
             * Console.WriteLine("------");
             */
        }
 public override void Dispose()
 {
     base.Dispose();
     m_simulator = null;
 }
Esempio n. 37
0
        private void MapItemReplyHandler(Packet packet, Simulator simulator)
        {
            if (OnGridItems != null)
            {
                MapItemReplyPacket reply = (MapItemReplyPacket)packet;
                GridItemType       type  = (GridItemType)reply.RequestData.ItemType;
                List <GridItem>    items = new List <GridItem>();

                for (int i = 0; i < reply.Data.Length; i++)
                {
                    string name = Utils.BytesToString(reply.Data[i].Name);

                    switch (type)
                    {
                    case GridItemType.AgentLocations:
                        GridAgentLocation location = new GridAgentLocation();
                        location.GlobalX     = reply.Data[i].X;
                        location.GlobalY     = reply.Data[i].Y;
                        location.Identifier  = name;
                        location.AvatarCount = reply.Data[i].Extra;

                        items.Add(location);

                        break;

                    case GridItemType.Classified:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.LandForSale:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.MatureEvent:
                    case GridItemType.PgEvent:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.Popular:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.Telehub:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    default:
                        Logger.Log("Unknown map item type " + type, Helpers.LogLevel.Warning, Client);
                        break;
                    }
                }

                try { OnGridItems(type, items); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
            }
        }
        private void UpdateHeightMap(RegionContextBase reg)
        {
            int stride  = TerrainPatchStride;
            int stride2 = stride * TerrainPatchWidth;

            lock (this) {
                float[,] newHM = new float[TerrainPatchWidth, TerrainPatchLength];
                float minHeight = 999999f;
                float maxHeight = 0f;

                if ((reg == null) || !(reg is LLRegionContext))
                {
                    // things are not set up so create a default, flat heightmap
                    LogManager.Log.Log(LogLevel.DWORLDDETAIL,
                                       "LLTerrainInfo: Building default zero terrain");
                    CreateZeroHeight(ref newHM);
                    minHeight = maxHeight = 0f;
                }
                else
                {
                    try {
                        LLRegionContext llreg = (LLRegionContext)reg;
                        OMV.Simulator   sim   = llreg.Simulator;

                        int nullPatchCount = 0;
                        for (int px = 0; px < stride; px++)
                        {
                            for (int py = 0; py < stride; py++)
                            {
                                OMV.TerrainPatch pat = sim.Terrain[px + py * stride];
                                if (pat == null)
                                {
                                    // if no patch, it's all zeros
                                    if (0.0f < minHeight)
                                    {
                                        minHeight = 0.0f;
                                    }
                                    if (0.0f > maxHeight)
                                    {
                                        maxHeight = 0.0f;
                                    }
                                    for (int xx = 0; xx < stride; xx++)
                                    {
                                        for (int yy = 0; yy < stride; yy++)
                                        {
                                            // newHM[(py * stride + yy), (px * stride + xx)] = 0.0f;
                                            newHM[(px * stride + xx), (py * stride + yy)] = 0.0f;
                                        }
                                    }
                                    nullPatchCount++;
                                }
                                else
                                {
                                    for (int xx = 0; xx < stride; xx++)
                                    {
                                        for (int yy = 0; yy < stride; yy++)
                                        {
                                            float height = pat.Data[xx + yy * stride];
                                            // newHM[(py * stride + yy), (px * stride + xx)] = height;
                                            newHM[(px * stride + xx), (py * stride + yy)] = height;
                                            if (height < minHeight)
                                            {
                                                minHeight = height;
                                            }
                                            if (height > maxHeight)
                                            {
                                                maxHeight = height;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        // LogManager.Log.Log(LogLevel.DWORLDDETAIL,
                        //         "LLTerrainInfo: UpdateHeightMap: {0} null patches = {1}", sim.Name, nullPatchCount);
                    }
                    catch {
                        // this usually happens when first starting a region
                        LogManager.Log.Log(LogLevel.DWORLDDETAIL,
                                           "LLTerrainInfo: Exception building terrain. Defaulting to zero.");
                        CreateZeroHeight(ref newHM);
                        minHeight = maxHeight = 0f;
                    }
                }
                m_heightMap       = newHM;
                m_heightMapWidth  = TerrainPatchWidth; // X
                m_heightMapLength = TerrainPatchLength;
                m_minimumHeight   = minHeight;
                m_maximumHeight   = maxHeight;
                LogManager.Log.Log(LogLevel.DWORLDDETAIL,
                                   "LLTerrainInfo: New terrain:"
                                   + " min=" + m_minimumHeight.ToString()
                                   + " max=" + m_maximumHeight.ToString()
                                   );
            }
        }
Esempio n. 39
0
 private void DecompressCloud(Simulator simulator, BitPack bitpack, TerrainPatch.GroupHeader group)
 {
     // FIXME:
 }
Esempio n. 40
0
 public CoarseLocationUpdateEventArgs(Simulator simulator, List <UUID> newEntries, List <UUID> removedEntries)
 {
     this.m_Simulator      = simulator;
     this.m_NewEntries     = newEntries;
     this.m_RemovedEntries = removedEntries;
 }
Esempio n. 41
0
            /// <summary>
            /// Send new AgentUpdate packet to update our current camera
            /// position and rotation
            /// </summary>
            /// <param name="reliable">Whether to require server acknowledgement
            /// of this packet</param>
            /// <param name="simulator">Simulator to send the update to</param>
            public void SendUpdate(bool reliable, Simulator simulator)
            {
                // Since version 1.40.4 of the Linden simulator, sending this update
                // causes corruption of the agent position in the simulator
                if (simulator != null && (!simulator.AgentMovementComplete))
                {
                    return;
                }

                Vector3 origin = Camera.Position;
                Vector3 xAxis  = Camera.LeftAxis;
                Vector3 yAxis  = Camera.AtAxis;
                Vector3 zAxis  = Camera.UpAxis;

                // Attempted to sort these in a rough order of how often they might change
                if (agentControls == 0 &&
                    yAxis == LastCameraYAxis &&
                    origin == LastCameraCenter &&
                    State == lastState &&
                    HeadRotation == LastHeadRotation &&
                    BodyRotation == LastBodyRotation &&
                    xAxis == LastCameraXAxis &&
                    Camera.Far == LastFar &&
                    zAxis == LastCameraZAxis)
                {
                    ++duplicateCount;
                }
                else
                {
                    duplicateCount = 0;
                }

                if (Client.Settings.DISABLE_AGENT_UPDATE_DUPLICATE_CHECK || duplicateCount < 10)
                {
                    // Store the current state to do duplicate checking
                    LastHeadRotation = HeadRotation;
                    LastBodyRotation = BodyRotation;
                    LastCameraYAxis  = yAxis;
                    LastCameraCenter = origin;
                    LastCameraXAxis  = xAxis;
                    LastCameraZAxis  = zAxis;
                    LastFar          = Camera.Far;
                    lastState        = State;

                    // Build the AgentUpdate packet and send it
                    AgentUpdatePacket update = new AgentUpdatePacket();
                    update.Header.Reliable = reliable;

                    update.AgentData.AgentID        = Client.Self.AgentID;
                    update.AgentData.SessionID      = Client.Self.SessionID;
                    update.AgentData.HeadRotation   = HeadRotation;
                    update.AgentData.BodyRotation   = BodyRotation;
                    update.AgentData.CameraAtAxis   = yAxis;
                    update.AgentData.CameraCenter   = origin;
                    update.AgentData.CameraLeftAxis = xAxis;
                    update.AgentData.CameraUpAxis   = zAxis;
                    update.AgentData.Far            = Camera.Far;
                    update.AgentData.State          = (byte)State;
                    update.AgentData.ControlFlags   = agentControls;
                    update.AgentData.Flags          = (byte)Flags;

                    Client.Network.SendPacket(update, simulator);

                    if (autoResetControls)
                    {
                        ResetControlFlags();
                    }
                }
            }
Esempio n. 42
0
 /// <summary>
 /// Construct a new instance of the RegionCrossedEventArgs class
 /// </summary>
 /// <param name="oldSim">The simulator your agent just left</param>
 /// <param name="newSim">The simulator your agent is now in</param>
 public RegionCrossedEventArgs(Simulator oldSim, Simulator newSim)
 {
     this.m_OldSimulator = oldSim;
     this.m_NewSimulator = newSim;
 }
Esempio n. 43
0
 /// <summary>
 /// Construct a new instance of the AttachedSoundGainChangedEventArgs class
 /// </summary>
 /// <param name="sim">Simulator where the event originated</param>
 /// <param name="objectID">The ID of the Object</param>
 /// <param name="gain">The new volume level</param>
 public AttachedSoundGainChangeEventArgs(Simulator sim, UUID objectID, float gain)
 {
     this.m_Simulator = sim;
     this.m_ObjectID  = objectID;
     this.m_Gain      = gain;
 }
Esempio n. 44
0
 private static void SkipUUID(UUID obj, Simulator sim)
 {           
 }
Esempio n. 45
0
 public static void LoadASim(OMV.Simulator sim, OMV.GridClient netComm, CommLLLP worldComm)
 {
     LogManager.Log.Log(LogLevel.DCOMM, "LoadWorldObjects: loading avatars and objects for sim {0}", sim.Name);
     AddAvatars(sim, netComm, worldComm);
     AddObjects(sim, netComm, worldComm);
 }
        private void RequiredVoiceVersionEventHandler(string capsKey, IMessage message, Simulator simulator)
        {
            RequiredVoiceVersionMessage msg = (RequiredVoiceVersionMessage)message;

                if (VOICE_MAJOR_VERSION != msg.MajorVersion)
                {
                    Logger.Log(String.Format("Voice version mismatch! Got {0}, expecting {1}. Disabling the voice manager", msg.MajorVersion, VOICE_MAJOR_VERSION), Helpers.LogLevel.Error, Client);
                    Enabled = false;
                }
                else
                {
                    Logger.DebugLog("Voice version " + msg.MajorVersion + " verified", Client);
                }
        }
Esempio n. 47
0
 /// <summary>
 /// Plays a sound in the specified sim
 /// </summary>
 /// <param name="soundID">UUID of the sound to be played.</param>
 /// <param name="sim">UUID of the sound to be played.</param>
 /// <param name="position">position for the sound to be played at. Normally the avatar.</param>
 /// <param name="gain">volume of the sound, from 0.0 to 1.0</param>
 public void SendSoundTrigger(UUID soundID, Simulator sim, Vector3 position, float gain)
 {
     SendSoundTrigger(soundID, sim.Handle, position, gain);
 }