Example #1
0
        public DateTime llSetParcelMusicURL(string url)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILandObject land = parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);

                if (land == null)
                {
                    return(DateTime.Now);
                }

                if (!World.Permissions.CanEditParcel(m_host.OwnerID, land))
                {
                    return(DateTime.Now);
                }

                land.SetMusicUrl(url);
            }

            return(PScriptSleep(m_sleepMsOnSetParcelMusicURL));
        }
Example #2
0
        /**
         * @brief Allow any member of group given by config SetParcelMusicURLGroup to set music URL.
         *        Code modelled after llSetParcelMusicURL().
         * @param newurl = new URL to set (or "" to leave it alone)
         * @returns previous URL string
         */
        public string xmrSetParcelMusicURLGroup(string newurl)
        {
            string groupname = m_ScriptEngine.Config.GetString("SetParcelMusicURLGroup", "");

            if (groupname == "")
            {
                throw new ApplicationException("no SetParcelMusicURLGroup config param set");
            }

            IGroupsModule igm = World.RequestModuleInterface <IGroupsModule> ();

            if (igm == null)
            {
                throw new ApplicationException("no GroupsModule loaded");
            }

            GroupRecord grouprec = igm.GetGroupRecord(groupname);

            if (grouprec == null)
            {
                throw new ApplicationException("no such group " + groupname);
            }

            GroupMembershipData gmd = igm.GetMembershipData(grouprec.GroupID, m_host.OwnerID);

            if (gmd == null)
            {
                throw new ApplicationException("not a member of group " + groupname);
            }

            ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);

            if (land == null)
            {
                throw new ApplicationException("no land at " + m_host.AbsolutePosition.ToString());
            }
            string oldurl = land.GetMusicUrl();

            if (oldurl == null)
            {
                oldurl = "";
            }
            if ((newurl != null) && (newurl != ""))
            {
                land.SetMusicUrl(newurl);
            }
            return(oldurl);
        }