Ejemplo n.º 1
0
        public LSL_Key llRequestDisplayName(LSL_Key uuid)
        {
            UUID userID = UUID.Zero;

            if (!UUID.TryParse(uuid, out userID))
            {
                // => complain loudly, as specified by the LSL docs
                Error("llRequestDisplayName", "Failed to parse uuid for avatar.");

                return(UUID.Zero.ToString());
            }

            DataserverPlugin dataserverPlugin = (DataserverPlugin)m_ScriptEngine.GetScriptPlugin("Dataserver");
            UUID             tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, uuid.ToString());

            Util.FireAndForget(delegate {
                string name = "";
                IProfileConnector connector =
                    Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>();
                if (connector != null)
                {
                    IUserProfileInfo info = connector.GetUserProfile(userID);
                    if (info != null)
                    {
                        name = info.DisplayName;
                    }
                }
                dataserverPlugin.AddReply(uuid.ToString(),
                                          name, 100);
            });

            PScriptSleep(m_sleepMsOnRequestUserName);
            return(tid.ToString());
        }
Ejemplo n.º 2
0
        public LSL_Key llRequestUsername(LSL_Key uuid)
        {
            UUID userID = UUID.Zero;

            if (!UUID.TryParse(uuid, out userID))
            {
                // => complain loudly, as specified by the LSL docs
                Error("llRequestUsername", "Failed to parse uuid for avatar.");

                return(UUID.Zero.ToString());
            }

            DataserverPlugin dataserverPlugin = (DataserverPlugin)m_ScriptEngine.GetScriptPlugin("Dataserver");
            UUID             tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, uuid.ToString());

            Util.FireAndForget(delegate {
                string name          = "";
                UserAccount userAcct =
                    World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, userID);
                name = userAcct.Name;
                dataserverPlugin.AddReply(uuid.ToString(), name, 100);
            });

            PScriptSleep(m_sleepMsOnRequestUserName);
            return(tid.ToString());
        }
Ejemplo n.º 3
0
        public DateTime llTeleportAgentHome(LSL_Key _agent)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            string agent = _agent.ToString();

            UUID agentId = new UUID();

            if (UUID.TryParse(agent, out agentId))
            {
                IScenePresence presence = World.GetScenePresence(agentId);
                if (presence != null)
                {
                    // agent must be over the owners land
                    IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>();
                    if (parcelManagement != null)
                    {
                        if (m_host.OwnerID != parcelManagement.GetLandObject(
                                presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID&&
                            !World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false))
                        {
                            return(PScriptSleep(m_sleepMsOnTeleportAgentHome));
                        }
                    }

                    //Send disable cancel so that the agent cannot attempt to stay in the region
                    presence.ControllingClient.SendTeleportStart((uint)TeleportFlags.DisableCancel);
                    IEntityTransferModule transferModule = World.RequestModuleInterface <IEntityTransferModule>();
                    if (transferModule != null)
                    {
                        transferModule.TeleportHome(agentId, presence.ControllingClient);
                    }
                    else
                    {
                        presence.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator.");
                    }
                }
            }
            return(PScriptSleep(m_sleepMsOnTeleportAgentHome));
        }
Ejemplo n.º 4
0
        public DateTime llTeleportAgentHome(LSL_Key _agent)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return DateTime.Now;

            string agent = _agent.ToString();

            UUID agentId = new UUID();
            if (UUID.TryParse(agent, out agentId))
            {
                IScenePresence presence = World.GetScenePresence(agentId);
                if (presence != null)
                {
                    // agent must be over the owners land
                    IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
                    if (parcelManagement != null)
                    {
                        if (m_host.OwnerID != parcelManagement.GetLandObject(
                            presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID &&
                            !World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false))
                        {
                            return PScriptSleep(m_sleepMsOnTeleportAgentHome);
                        }
                    }

                    //Send disable cancel so that the agent cannot attempt to stay in the region
                    presence.ControllingClient.SendTeleportStart((uint)TeleportFlags.DisableCancel);
                    IEntityTransferModule transferModule = World.RequestModuleInterface<IEntityTransferModule>();
                    if (transferModule != null)
                        transferModule.TeleportHome(agentId, presence.ControllingClient);
                    else
                        presence.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator.");
                }
            }
            return PScriptSleep(m_sleepMsOnTeleportAgentHome);
        }
Ejemplo n.º 5
0
        public LSL_Key llRequestDisplayName(LSL_Key uuid)
        {
            UUID userID = UUID.Zero;

            if (!UUID.TryParse(uuid, out userID))
            {
                // => complain loudly, as specified by the LSL docs
                Error("llRequestDisplayName", "Failed to parse uuid for avatar.");

                return UUID.Zero.ToString();
            }

            DataserverPlugin dataserverPlugin = (DataserverPlugin)m_ScriptEngine.GetScriptPlugin("Dataserver");
            UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, uuid.ToString());

            Util.FireAndForget(delegate
                                   {
                                       string name = "";
                                       IProfileConnector connector =
                                           Framework.Utilities.DataManager.RequestPlugin<IProfileConnector>();
                                       if (connector != null)
                                       {
                                           IUserProfileInfo info = connector.GetUserProfile(userID);
                                           if (info != null)
                                               name = info.DisplayName;
                                       }
                                       dataserverPlugin.AddReply(uuid.ToString(),
                                                                 name, 100);
                                   });

            PScriptSleep(m_sleepMsOnRequestUserName);
            return tid.ToString();
        }
Ejemplo n.º 6
0
        public LSL_Key llRequestUsername(LSL_Key uuid)
        {
            UUID userID = UUID.Zero;

            if (!UUID.TryParse(uuid, out userID))
            {
                // => complain loudly, as specified by the LSL docs
                Error("llRequestUsername", "Failed to parse uuid for avatar.");

                return UUID.Zero.ToString();
            }

            DataserverPlugin dataserverPlugin = (DataserverPlugin)m_ScriptEngine.GetScriptPlugin("Dataserver");
            UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, uuid.ToString());

            Util.FireAndForget(delegate
                                   {
                                       string name = "";
                                       UserAccount info =
                                           World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, userID);
                                       if (info != null)
                                           name = info.Name;
                                       dataserverPlugin.AddReply(uuid.ToString(), name, 100);
                                   });

            PScriptSleep(m_sleepMsOnRequestUserName);
            return tid.ToString();
        }