コード例 #1
0
        public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
        {
            m_log.InfoFormat("[Groups] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            foreach (osGroup existingGroup in m_Groups.Values)
            {
                if (existingGroup.Name.ToLower().Trim().Equals(name.ToLower().Trim()))
                {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
                    return(UUID.Zero);
                }
            }

            osGroup newGroup = new osGroup();

            newGroup.GroupID        = UUID.Random();
            newGroup.Name           = name;
            newGroup.Charter        = charter;
            newGroup.ShowInList     = showInList;
            newGroup.InsigniaID     = insigniaID;
            newGroup.MembershipFee  = membershipFee;
            newGroup.OpenEnrollment = openEnrollment;
            newGroup.AllowPublish   = allowPublish;
            newGroup.MaturePublish  = maturePublish;

            newGroup.PowersMask = AllGroupPowers;
            newGroup.FounderID  = remoteClient.AgentId;


            // Setup members role
            osgRole everyoneRole = AddRole2Group(newGroup, "Everyone", "Everyone in the group is in the everyone role.", "Everyone Title", m_DefaultEveryonePowers, UUID.Zero);

            // Setup owners role
            osgRole ownerRole = AddRole2Group(newGroup, "Owners", "Owners of " + newGroup.Name, "Owner of " + newGroup.Name, AllGroupPowers);


            osGroupMemberInfo Member = AddAgentToGroup(remoteClient.AgentId, newGroup);

            // Put the founder in the owner and everyone role
            Member.Roles.Add(ownerRole.RoleID, ownerRole);

            // Add founder to owner & everyone's local lists of members
            ownerRole.RoleMembers.Add(Member.AgentID, Member);

            // Add group to module
            m_Groups.Add(newGroup.GroupID, newGroup);


            remoteClient.SendCreateGroupReply(newGroup.GroupID, true, "Group created successfullly");

            // Set this as the founder's active group
            ActivateGroup(remoteClient, newGroup.GroupID);

            // The above sends this out too as of 4/3/09
            // UpdateClientWithGroupInfo(remoteClient);


            return(newGroup.GroupID);
        }
コード例 #2
0
        public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
        {
            if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called in {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Scene.RegionInfo.RegionName);

            if (m_groupData.GetGroupRecord(GetRequestingAgentIDStr(remoteClient), UUID.Zero, name) != null)
            {
                remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
                return UUID.Zero;
            }

            // check user level
            ScenePresence avatar = null;
            Scene scene = (Scene)remoteClient.Scene;
            scene.TryGetScenePresence(remoteClient.AgentId, out avatar);

            if (avatar != null)
            {
                if (avatar.UserLevel < m_levelGroupCreate)
                {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
                    return UUID.Zero;
                }
            }

            // check funds
            // is there is a money module present ?
            IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
            if (money != null)
            {
                // do the transaction, that is if the agent has got sufficient funds
                if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group.");
                    return UUID.Zero;
                }
            }

            string reason = string.Empty;
            UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, 
                allowPublish, maturePublish, remoteClient.AgentId, out reason);

            if (groupID != UUID.Zero)
            {
                if (money != null)
                    money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);

                remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");

                // Update the founder with new group information.
                SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
            }
            else
                remoteClient.SendCreateGroupReply(groupID, false, reason);

            return groupID;
        }
コード例 #3
0
ファイル: GroupsModule.cs プロジェクト: 4U2NV/opensim
        public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
        {
            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null)
            {
                remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
                return UUID.Zero;
            }
            // is there is a money module present ?
            IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
            if (money != null)
            {
                // do the transaction, that is if the agent has got sufficient funds
                if (!money.AmountCovered(remoteClient, money.GroupCreationCharge)) {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group.");
                    return UUID.Zero;
                }
                money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation");
            }
            UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));

            remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");

            // Update the founder with new group information.
            SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));

            return groupID;
        }
コード例 #4
0
        public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID,
            int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
        {
            if (m_debugEnabled)
                MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);

            if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null)
            {
                remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
                return UUID.Zero;
            }
            // is there is a money module present ?
            IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
            if (money != null)
            {
                try
                {
                    // do the transaction, that is if the agent has got sufficient funds
                    if (!money.Charge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation", TransactionType.GroupCreate))
                    {
                        remoteClient.SendCreateGroupReply(UUID.Zero, false,
                                                          "You have got insuficient funds to create a group.");
                        return UUID.Zero;
                    }
                }
                catch
                {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false,
                                                      "A money related exception occured, please contact your grid administrator.");
                    return UUID.Zero;
                }
            }
            UUID groupID = UUID.Random();
            m_groupData.CreateGroup(groupID, name, charter, showInList,
                                                    insigniaID, membershipFee, openEnrollment, allowPublish,
                                                    maturePublish, GetRequestingAgentID(remoteClient), UUID.Random());

            remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
            m_cachedGroupTitles[remoteClient.AgentId] =
                AttemptFindGroupMembershipData(remoteClient.AgentId, remoteClient.AgentId, groupID);
            m_cachedGroupMemberships.Remove(remoteClient.AgentId);
            RemoveFromGroupPowersCache(remoteClient.AgentId, remoteClient.ActiveGroupId);
            // Update the founder with new group information.
            SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));

            return groupID;
        }
コード例 #5
0
        // Classifieds Update
        public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName, string queryDescription, UUID queryParcelID,
                                         uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags,
                                         int queryclassifiedPrice, IClientAPI remoteClient)
        {
            Hashtable ReqHash = new Hashtable();

            Scene       s    = (Scene)remoteClient.Scene;
            Vector3     pos  = remoteClient.SceneAgent.AbsolutePosition;
            ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);

            if (land == null)
            {
                ReqHash["parcelname"] = String.Empty;
            }
            else
            {
                ReqHash["parcelname"] = land.LandData.Name;
            }

            ReqHash["creatorUUID"]     = remoteClient.AgentId.ToString();
            ReqHash["classifiedUUID"]  = queryclassifiedID.ToString();
            ReqHash["category"]        = queryCategory.ToString();
            ReqHash["name"]            = queryName;
            ReqHash["description"]     = queryDescription;
            ReqHash["parentestate"]    = queryParentEstate.ToString();
            ReqHash["snapshotUUID"]    = querySnapshotID.ToString();
            ReqHash["sim_name"]        = remoteClient.Scene.RegionInfo.RegionName;
            ReqHash["globalpos"]       = queryGlobalPos.ToString();
            ReqHash["classifiedFlags"] = queryclassifiedFlags.ToString();
            ReqHash["classifiedPrice"] = queryclassifiedPrice.ToString();

            ScenePresence p = FindPresence(remoteClient.AgentId);


            string serverURI = string.Empty;

            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);

            Vector3 avaPos = p.AbsolutePosition;

            // Getting the parceluuid for this parcel
            ReqHash["parcelUUID"] = p.currentParcelUUID.ToString();

            // Getting the global position for the Avatar
            Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX * Constants.RegionSize + avaPos.X,
                                            remoteClient.Scene.RegionInfo.RegionLocY * Constants.RegionSize + avaPos.Y,
                                            avaPos.Z);

            ReqHash["pos_global"] = posGlobal.ToString();

            //Check available funds if there is a money module present
            IMoneyModule money = s.RequestModuleInterface <IMoneyModule>();

            if (money != null)
            {
                if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
                {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a classified ad.");
                    return;
                }
            }

            Hashtable result = GenericXMLRPCRequest(ReqHash,
                                                    "classified_update", serverURI);

            if (!Convert.ToBoolean(result["success"]))
            {
                remoteClient.SendAgentAlertMessage(
                    result["errorMessage"].ToString(), false);
                return;
            }

            if (money != null && Convert.ToBoolean(result["created"]))
            {
                money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice,
                                  MoneyTransactionType.ClassifiedCharge,
                                  queryName);
            }
        }
コード例 #6
0
        public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
        {
            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            GroupRequestID grID = GetClientGroupRequestID(remoteClient);

            if (m_groupData.GetGroupRecord(grID, UUID.Zero, name) != null)
            {
                remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
                return UUID.Zero;
            }
            
            UUID groupID = m_groupData.CreateGroup(grID, name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId);

            remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");

            // Update the founder with new group information.
            SendAgentGroupDataUpdate(remoteClient, remoteClient.AgentId);

            return groupID;
        }
コード例 #7
0
        // Classifieds Update
        public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName, string queryDescription, UUID queryParcelID,
                                         uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags,
                                         int queryclassifiedPrice, IClientAPI remoteClient)
        {
            Hashtable ReqHash = new Hashtable();

            Scene s = (Scene) remoteClient.Scene;
            Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
            ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);

            if (land == null)
                ReqHash["parcelname"] = String.Empty;
            else
                ReqHash["parcelname"] = land.LandData.Name;

            ReqHash["creatorUUID"] = remoteClient.AgentId.ToString();
            ReqHash["classifiedUUID"] = queryclassifiedID.ToString();
            ReqHash["category"] = queryCategory.ToString();
            ReqHash["name"] = queryName;
            ReqHash["description"] = queryDescription;
            ReqHash["parentestate"] = queryParentEstate.ToString();
            ReqHash["snapshotUUID"] = querySnapshotID.ToString();
            ReqHash["sim_name"] = remoteClient.Scene.RegionInfo.RegionName;
            ReqHash["globalpos"] = queryGlobalPos.ToString();
            ReqHash["classifiedFlags"] = queryclassifiedFlags.ToString();
            ReqHash["classifiedPrice"] = queryclassifiedPrice.ToString();

            ScenePresence p = FindPresence(remoteClient.AgentId);


            string serverURI = string.Empty;
            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);

            Vector3 avaPos = p.AbsolutePosition;

            // Getting the parceluuid for this parcel
            ReqHash["parcelUUID"] = p.currentParcelUUID.ToString();

            // Getting the global position for the Avatar
            Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX * Constants.RegionSize + avaPos.X,
                                            remoteClient.Scene.RegionInfo.RegionLocY * Constants.RegionSize + avaPos.Y,
                                            avaPos.Z);

            ReqHash["pos_global"] = posGlobal.ToString();

            //Check available funds if there is a money module present
            IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
            if (money != null)
            {
                if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
                {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a classified ad.");
                    return;
                }
            }

            Hashtable result = GenericXMLRPCRequest(ReqHash,
                    "classified_update", serverURI);

            if (!Convert.ToBoolean(result["success"]))
            {
                remoteClient.SendAgentAlertMessage(
                        result["errorMessage"].ToString(), false);
                return;
            }

            if (money != null && Convert.ToBoolean(result["created"]))
            {
                money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice,
                                  MoneyTransactionType.ClassifiedCharge,
                                  queryName);
            }
        }