当前位置: 首页>>代码示例>>C#>>正文


C# IClientAPI.SendAgentAlertMessage方法代码示例

本文整理汇总了C#中IClientAPI.SendAgentAlertMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IClientAPI.SendAgentAlertMessage方法的具体用法?C# IClientAPI.SendAgentAlertMessage怎么用?C# IClientAPI.SendAgentAlertMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IClientAPI的用法示例。


在下文中一共展示了IClientAPI.SendAgentAlertMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClassifiedInfoRequest

        public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient)
        {
            Hashtable ReqHash = new Hashtable();
            ReqHash["classifiedID"] = queryClassifiedID.ToString();

            Hashtable result = GenericXMLRPCRequest(ReqHash,
                    "classifieds_info_query");

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

            ArrayList dataArray = (ArrayList)result["data"];
            if (dataArray.Count == 0)
            {
                // something bad happened here, if we could return an
                // event after the search,
                // we should be able to find it here
                // TODO do some (more) sensible error-handling here
                remoteClient.SendAgentAlertMessage("Couldn't find any classifieds.",
                        false);
                return;
            }

            Hashtable d = (Hashtable)dataArray[0];

            Vector3 globalPos = new Vector3();
            Vector3.TryParse(d["posglobal"].ToString(), out globalPos);

            remoteClient.SendClassifiedInfoReply(
                    new UUID(d["classifieduuid"].ToString()),
                    new UUID(d["creatoruuid"].ToString()),
                    Convert.ToUInt32(d["creationdate"]),
                    Convert.ToUInt32(d["expirationdate"]),
                    Convert.ToUInt32(d["category"]),
                    d["name"].ToString(),
                    d["description"].ToString(),
                    new UUID(d["parceluuid"].ToString()),
                    Convert.ToUInt32(d["parentestate"]),
                    new UUID(d["snapshotuuid"].ToString()),
                    d["simname"].ToString(),
                    globalPos,
                    d["parcelname"].ToString(),
                    Convert.ToByte(d["classifiedflags"]),
                    Convert.ToInt32(d["priceforlisting"]));
        }
开发者ID:unethika,项目名称:mod_nslmodules,代码行数:49,代码来源:OpenSearch.cs

示例2: DirClassifiedQuery

        public void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID, 
										string queryText, uint queryFlags, uint category, int queryStart)
        {
            Hashtable ReqHash 		= new Hashtable();
            ReqHash["text"] 		= queryText;
            ReqHash["flags"] 		= queryFlags.ToString();
            ReqHash["category"] 	= category.ToString();
            ReqHash["query_start"] 	= queryStart.ToString();

            Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_classified_query");

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

            ArrayList dataArray = (ArrayList)result["data"];

            int count = dataArray.Count;
            if (count > 100) count = 101;

            DirClassifiedReplyData[] data = new DirClassifiedReplyData[count];

            int i = 0;
            foreach (Object o in dataArray)
            {
                Hashtable d = (Hashtable)o;

                string name = d["name"].ToString();
                if (Enc!=null) name = Enc.GetString(Convert.FromBase64String(name));

                data[i] 				= new DirClassifiedReplyData();
                data[i].classifiedID 	= new UUID(d["classifiedid"].ToString());
                data[i].name 			= name;
                data[i].classifiedFlags = Convert.ToByte(d["classifiedflags"]);
                data[i].creationDate 	= Convert.ToUInt32(d["creation_date"]);
                data[i].expirationDate 	= Convert.ToUInt32(d["expiration_date"]);
                data[i].price 			= Convert.ToInt32(d["priceforlisting"]);
                i++;
                if (i >= count) break;
            }

            remoteClient.SendDirClassifiedReply(queryID, data);
        }
开发者ID:unethika,项目名称:mod_nslmodules,代码行数:45,代码来源:OpenSearch.cs

示例3: AvatarInterestsUpdate

        ///////////////////////////////////////////////////////////////////////////////////////////////
        //
        // Interests
        //
        // Update Interests
        public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages)
        {
            Hashtable ReqHash = new Hashtable();

            ReqHash["avatar_id"]  	 = remoteClient.AgentId.ToString();
            ReqHash["WantToMask"] 	 = wantmask.ToString();
            ReqHash["WantToText"] 	 = wanttext;
            ReqHash["SkillsMask"] 	 = skillsmask.ToString();
            ReqHash["SkillsText"] 	 = skillstext;
            ReqHash["LanguagesText"] = languages;

            Hashtable result = GenericXMLRPCRequest(ReqHash, "avatar_interests_update");

            if (!Convert.ToBoolean(result["success"]))
            {
                remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false);
                return;
            }
        }
开发者ID:unethika,项目名称:mod_nslmodules,代码行数:24,代码来源:OpenProfile.cs

示例4: GroupRoleUpdate

        public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType)
        {
            if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            // Security Checks are handled in the Groups Service.

            switch ((OpenMetaverse.GroupRoleUpdate)updateType)
            {
                case OpenMetaverse.GroupRoleUpdate.Create:
                    string reason = string.Empty;
                    if (!m_groupData.AddGroupRole(GetRequestingAgentIDStr(remoteClient), groupID, UUID.Random(), name, description, title, powers, out reason))
                        remoteClient.SendAgentAlertMessage("Unable to create role: " + reason, false);
                    break;

                case OpenMetaverse.GroupRoleUpdate.Delete:
                    m_groupData.RemoveGroupRole(GetRequestingAgentIDStr(remoteClient), groupID, roleID);
                    break;

                case OpenMetaverse.GroupRoleUpdate.UpdateAll:
                case OpenMetaverse.GroupRoleUpdate.UpdateData:
                case OpenMetaverse.GroupRoleUpdate.UpdatePowers:
                    if (m_debugEnabled)
                    {
                        GroupPowers gp = (GroupPowers)powers;
                        m_log.DebugFormat("[Groups]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString());
                    }
                    m_groupData.UpdateGroupRole(GetRequestingAgentIDStr(remoteClient), groupID, roleID, name, description, title, powers);
                    break;

                case OpenMetaverse.GroupRoleUpdate.NoUpdate:
                default:
                    // No Op
                    break;

            }

            // TODO: This update really should send out updates for everyone in the role that just got changed.
            SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
        }
开发者ID:JamesStallings,项目名称:opensimulator,代码行数:39,代码来源:GroupsModule.cs

示例5: OnInstantMessage

        private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
        {
            if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            //m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
            // Group invitations
            if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
            {
                UUID inviteID = new UUID(im.imSessionID);
                GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);

                if (inviteInfo == null)
                {
                    if (m_debugEnabled) m_log.WarnFormat("[Groups]: Received an Invite IM for an invite that does not exist {0}.", inviteID);
                    return;
                }

                //m_log.DebugFormat("[XXX]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID);

                UUID fromAgentID = new UUID(im.fromAgentID);
                UUID invitee = UUID.Zero;
                string tmp = string.Empty;
                Util.ParseUniversalUserIdentifier(inviteInfo.AgentID, out invitee, out tmp, out tmp, out tmp, out tmp);
                if ((inviteInfo != null) && (fromAgentID == invitee))
                {
                    // Accept
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept)
                    {
                        //m_log.DebugFormat("[XXX]: Received an accept invite notice.");

                        // and the sessionid is the role
                        string reason = string.Empty;
                        if (!m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
                            remoteClient.SendAgentAlertMessage("Unable to add you to the group: " + reason, false);
                        else
                        {
                            GridInstantMessage msg = new GridInstantMessage();
                            msg.imSessionID = UUID.Zero.Guid;
                            msg.fromAgentID = UUID.Zero.Guid;
                            msg.toAgentID = invitee.Guid;
                            msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
                            msg.fromAgentName = "Groups";
                            msg.message = string.Format("You have been added to the group.");
                            msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageBox;
                            msg.fromGroup = false;
                            msg.offline = (byte)0;
                            msg.ParentEstateID = 0;
                            msg.Position = Vector3.Zero;
                            msg.RegionID = UUID.Zero.Guid;
                            msg.binaryBucket = new byte[0];

                            OutgoingInstantMessage(msg, invitee);

                            UpdateAllClientsWithGroupInfo(invitee);
                        }

                        m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);

                    }

                    // Reject
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
                    {
                        if (m_debugEnabled) m_log.DebugFormat("[Groups]: Received a reject invite notice.");
                        m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);

                        m_groupData.RemoveAgentFromGroup(GetRequestingAgentIDStr(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID);
                    }
                }
            }

            // Group notices
            if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
            {
                if (!m_groupNoticesEnabled)
                {
                    return;
                }

                UUID GroupID = new UUID(im.toAgentID);
                if (m_groupData.GetGroupRecord(GetRequestingAgentIDStr(remoteClient), GroupID, null) != null)
                {
                    UUID NoticeID = UUID.Random();
                    string Subject = im.message.Substring(0, im.message.IndexOf('|'));
                    string Message = im.message.Substring(Subject.Length + 1);

                    InventoryItemBase item = null;
                    bool hasAttachment = false;

                    if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0)
                    {
                        hasAttachment = true;
                        string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
                        binBucket = binBucket.Remove(0, 14).Trim();

                        OSD binBucketOSD = OSDParser.DeserializeLLSDXml(binBucket);
                        if (binBucketOSD is OSDMap)
                        {
                            OSDMap binBucketMap = (OSDMap)binBucketOSD;

//.........这里部分代码省略.........
开发者ID:JamesStallings,项目名称:opensimulator,代码行数:101,代码来源:GroupsModule.cs

示例6: ObjectBuy

        public void ObjectBuy(IClientAPI remoteClient, UUID agentID, UUID sessionID, UUID groupID, UUID categoryID,
                uint localID, byte saleType, int salePrice)
        {
            if (salePrice < 0) return;

            if (salePrice > 0)
            {   // allow users with negative balances to buy freebies
                int avatarFunds = getCurrentBalance(agentID);
                if (avatarFunds < salePrice)
                {
                    // The viewer runs a check on monies balance, however, let's make sure another viewer
                    // can't exploit this by removing and check their funds ourselves.
                    remoteClient.SendAgentAlertMessage("Insufficient funds to purchase this item!", false);
                    return;
                }
            }

            IClientAPI sourceAvatarClient = LocateClientObject(remoteClient.AgentId);
            if (sourceAvatarClient == null)
            {
				sourceAvatarClient.SendAgentAlertMessage("Purchase failed. No Controlling client found for sourceAvatar!", false);
                return;
            }

            Scene s = LocateSceneClientIn(remoteClient.AgentId);
            //Scene s = GetScenePresence(remoteClient.AgentId);

            SceneObjectPart objectPart = s.GetSceneObjectPart(localID);
            if (objectPart == null)
            {
				sourceAvatarClient.SendAgentAlertMessage("Purchase failed. The object was not found.", false);
                return;
            }

			/////  Prevent purchase spoofing, as well as viewer bugs.  /////
			// Verify that the object is actually for sale
			if (objectPart.ObjectSaleType == (byte)SaleType.Not)
			{
				remoteClient.SendAgentAlertMessage("Purchase failed. The item is not for sale.", false);
				return;
			}
			// Verify that the viewer sale type actually matches the correct sale type of the object
			if (saleType != objectPart.ObjectSaleType)
			{
				remoteClient.SendAgentAlertMessage("Purchase failed.  The sale type does not match.", false);
				return;
			}
			// Verify that the buyer is paying the correct amount
			if (salePrice != objectPart.SalePrice)
			{
				remoteClient.SendAgentAlertMessage("Purchase failed.  The payment price does not match the sale price.", false);
				return;
			}

            string objName = objectPart.ParentGroup.RootPart.Name;
            Vector3 pos = objectPart.AbsolutePosition;
            int posx = (int)(pos.X + 0.5);
            int posy = (int)(pos.Y + 0.5);
            int posz = (int)(pos.Z + 0.5);
            string transDesc = String.Format("{0} in {1} at <{2},{3},{4}>", objName, objectPart.ParentGroup.Scene.RegionInfo.RegionName, posx, posy, posz);

            string sourceAlertText = "Purchased " + objName + " for Iz$" + salePrice;
            string destAlertText = resolveAgentName(agentID) + " paid you Iz$" + salePrice + " via " + objName;

            int transType = (int)MoneyTransactionType.ObjectSale;
            UUID transID = UUID.Zero;

            TransactionInfoBlock transInfo = new TransactionInfoBlock();
            transInfo.Amount = salePrice;
            transInfo.TransactionType = transType;
            transInfo.SourceID = remoteClient.AgentId;
            transInfo.DestID = objectPart.OwnerID;
            transInfo.IsSourceGroup = false;
            transInfo.IsDestGroup = false;
            transInfo.ItemDescription = Util.StringToBytes256(objName);

            if (agentID == objectPart.OwnerID)
            {
                // we'll let them test the buy, but nothing happens money wise.
                if (!s.PerformObjectBuy(remoteClient, categoryID, localID, saleType))
                    return;
                sourceAvatarClient.SendBlueBoxMessage(agentID, "", sourceAlertText);
            }
            else
            {
                if (salePrice == 0)
                {
                    // We need to add a counter here for Freebies thus bypassing the DB for transactions cause
                    // Freebies are a pain to have to track in the transaction history.
                    if (!s.PerformObjectBuy(remoteClient, categoryID, localID, saleType))
                        return;
                }
                else
                {
                    UUID originalOwnerID = objectPart.OwnerID;  // capture the original seller's UUID for the money transfer
                    if (!s.PerformObjectBuy(remoteClient, categoryID, localID, saleType))    // changes objectPart.OwnerID
                        return;
                    transID = doMoneyTransfer(remoteClient.AgentId, originalOwnerID, salePrice, transType, transDesc);
                }
                SendMoneyBalanceTransaction(sourceAvatarClient, transID, true, sourceAlertText, transInfo);
//.........这里部分代码省略.........
开发者ID:zwagoth,项目名称:halcyon,代码行数:101,代码来源:AvatarCurrency.cs

示例7: CapsUpdateTaskInventoryScriptAsset

        /// <summary>
        /// Capability originating call to update the asset of a script in a prim's (task's) inventory
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="itemID"></param>
        /// <param name="primID">The prim which contains the item to update</param>
        /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
        /// <param name="data"></param>
        public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId,
                                                       UUID primId, bool isScriptRunning, byte[] data)
        {
            if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId))
            {
                remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
                return new ArrayList();
            }

            // Retrieve group
            SceneObjectPart part = GetSceneObjectPart(primId);
            if (null == part.ParentGroup)
            {
                m_log.ErrorFormat(
                    "[PRIM INVENTORY]: " +
                    "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
                    itemId, primId);

                return new ArrayList();
            }
            
            // Retrieve item
            TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId);

            if (null == item)
            {
                m_log.ErrorFormat(
                    "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for caps script update "
                        + " but the item does not exist in this inventory",
                    itemId, part.Name, part.UUID);

                return new ArrayList();
            }

            AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId);
            AssetService.Store(asset);

            // Update item with new asset
            item.AssetID = asset.FullID;

            if (part.ParentGroup.UpdateInventoryItem(item))
                if(item.InvType == (int)InventoryType.LSL)
                    remoteClient.SendAgentAlertMessage("Script saved", false);                        
            
            part.GetProperties(remoteClient);

            // Trigger rerunning of script (use TriggerRezScript event, see RezScript)
            ArrayList errors = new ArrayList();

            if (isScriptRunning)
            {
                // Needs to determine which engine was running it and use that
                //
                part.Inventory.UpdateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0);
                errors = part.Inventory.GetScriptErrors(item.ItemID, DefaultScriptEngine);
            }
            else
            {
                remoteClient.SendAgentAlertMessage("Script saved", false);
            }

            part.ParentGroup.ResumeScripts();
            return errors;
        }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:72,代码来源:Scene.Inventory.cs

示例8: ParcelBuyPass

        public void ParcelBuyPass(IClientAPI client, UUID agentID, int ParcelLocalID)
        {
            ILandObject landObject = GetLandObject(ParcelLocalID);
            if (landObject == null)
            {
                client.SendAlertMessage("Could not find the parcel you are currently on.");
                return;
            }

            if (landObject.IsBannedFromLand(agentID))
            {
                client.SendAlertMessage("You cannot buy a pass as you are banned from this parcel.");
                return;
            }

            IMoneyModule module = m_scene.RequestModuleInterface<IMoneyModule>();
            if (module != null)
                if (
                    !module.Transfer(landObject.LandData.OwnerID, client.AgentId, landObject.LandData.PassPrice,
                                     "Parcel Pass"))
                {
                    client.SendAlertMessage("You do not have enough funds to complete this transaction.");
                    return;
                }

            ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry
                                                        {
                                                            AgentID = agentID,
                                                            Flags = AccessList.Access,
                                                            Time = DateTime.Now.AddHours(landObject.LandData.PassHours)
                                                        };
            landObject.LandData.ParcelAccessList.Add(entry);
            client.SendAgentAlertMessage("You have been added to the parcel access list.", false);
        }
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:34,代码来源:ParcelManagementModule.cs

示例9: ObjectBuy

        public void ObjectBuy(IClientAPI remoteClient, UUID agentID,
                UUID sessionID, UUID groupID, UUID categoryID,
                uint localID, byte saleType, int salePrice)
        {
            if (!m_sellEnabled)
            {
                remoteClient.SendBlueBoxMessage(UUID.Zero, "", "Buying is not implemented in this version");
                return;
            }

            if (salePrice != 0)
            {
                remoteClient.SendBlueBoxMessage(UUID.Zero, "", "Buying anything for a price other than zero is not implemented");
                return;
            }

            Scene s = LocateSceneClientIn(remoteClient.AgentId);

            // Implmenting base sale data checking here so the default OpenSimulator implementation isn't useless 
            // combined with other implementations.  We're actually validating that the client is sending the data
            // that it should.   In theory, the client should already know what to send here because it'll see it when it
            // gets the object data.   If the data sent by the client doesn't match the object, the viewer probably has an 
            // old idea of what the object properties are.   Viewer developer Hazim informed us that the base module 
            // didn't check the client sent data against the object do any.   Since the base modules are the 
            // 'crowning glory' examples of good practice..

            // Validate that the object exists in the scene the user is in
            SceneObjectPart part = s.GetSceneObjectPart(localID);
            if (part == null)
            {
                remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false);
                return;
            }
            
            // Validate that the client sent the price that the object is being sold for 
            if (part.SalePrice != salePrice)
            {
                remoteClient.SendAgentAlertMessage("Cannot buy at this price. Buy Failed. If you continue to get this relog.", false);
                return;
            }

            // Validate that the client sent the proper sale type the object has set 
            if (part.ObjectSaleType != saleType)
            {
                remoteClient.SendAgentAlertMessage("Cannot buy this way. Buy Failed. If you continue to get this relog.", false);
                return;
            }

            IBuySellModule module = s.RequestModuleInterface<IBuySellModule>();
            if (module != null)
                module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice);
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:52,代码来源:SampleMoneyModule.cs

示例10: CapsUpdateInventoryItemAsset

        /// <summary>
        /// Capability originating call to update the asset of an item in an agent's inventory
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="itemID"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
        {
            InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
            item = m_Scene.InventoryService.GetItem(item);

            if (item != null)
            {
                if ((InventoryType)item.InvType == InventoryType.Notecard)
                {
                    if (!m_Scene.Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId))
                    {
                        remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false);
                        return UUID.Zero;
                    }

                    remoteClient.SendAgentAlertMessage("Notecard saved", false);
                }
                else if ((InventoryType)item.InvType == InventoryType.LSL)
                {
                    if (!m_Scene.Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId))
                    {
                        remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
                        return UUID.Zero;
                    }

                    remoteClient.SendAgentAlertMessage("Script saved", false);
                }

                AssetBase asset =
                    CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString());
                item.AssetID = asset.FullID;
                m_Scene.AssetService.Store(asset);

                m_Scene.InventoryService.UpdateItem(item);

                // remoteClient.SendInventoryItemCreateUpdate(item);
                return (asset.FullID);
            }
            else
            {
                m_log.ErrorFormat(
                    "[AGENT INVENTORY]: Could not find item {0} for caps inventory update",
                    itemID);
            }

            return UUID.Zero;
        }
开发者ID:gumho,项目名称:diva-distribution,代码行数:54,代码来源:InventoryAccessModule.cs

示例11: ObjectBuy

        public void ObjectBuy(IClientAPI remoteClient, UUID agentID, UUID sessionID, UUID groupID, UUID categoryID, uint localID, byte saleType, int salePrice)
        {
            Scene s = SceneHandler.Instance.LocateSceneClientIn(remoteClient.AgentId);
            SceneObjectPart part = s.GetSceneObjectPart(localID);
            if (part == null)
            {
                remoteClient.SendAgentAlertMessage("Unable to buy now. The object can not be found.", false);
                return;
            }

            if (salePrice == 0)
            {
                IBuySellModule buyModule = s.RequestModuleInterface<IBuySellModule>();
                if (buyModule != null)
                {
                    buyModule.BuyObject(remoteClient, categoryID, localID, saleType, salePrice);
                }
                else
                {
                    throw new Exception("Could not find IBuySellModule");
                }
            }
            else
            {
                Dictionary<string, string> buyObject = new Dictionary<string, string>();
                buyObject.Add("categoryID", categoryID.ToString());
                buyObject.Add("localID", Convert.ToString(localID));
                buyObject.Add("saleType", saleType.ToString());
                buyObject.Add("objectUUID", part.UUID.ToString());
                buyObject.Add("objectName", part.Name);
                buyObject.Add("objectDescription", part.Description);
                buyObject.Add("objectLocation", SceneHandler.Instance.GetObjectLocation(part));

                DoMoneyTransfer(remoteClient.AgentId, part.OwnerID, salePrice, (int)TransactionType.BUY_OBJECT, buyObject);
            }
        }
开发者ID:PixelTomsen,项目名称:OMEconomy-Modules,代码行数:36,代码来源:OMCurrency.cs

示例12: Client_OnObjectAttach

        private void Client_OnObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
        {
//            m_log.DebugFormat(
//                "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
//                objectLocalID, remoteClient.Name, AttachmentPt, silent);

            if (!Enabled)
                return;

            try
            {
                ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);

                if (sp == null)
                {
                    m_log.ErrorFormat(
                        "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId);
                    return;
                }

                // If we can't take it, we can't attach it!
                SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
                if (part == null)
                    return;

                if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
                {
                    remoteClient.SendAgentAlertMessage(
                        "You don't have sufficient permissions to attach this object", false);

                    return;
                }

                // TODO: this short circuits multiple attachments functionality  in  LL viewer 2.1+ and should
                // be removed when that functionality is implemented in opensim
                AttachmentPt &= 0x7f;

                // Calls attach with a Zero position
                AttachObject(sp, part.ParentGroup, AttachmentPt, false, false);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace);
            }
        }
开发者ID:p07r0457,项目名称:opensim,代码行数:45,代码来源:AttachmentsModule.cs

示例13: HandleAgentRequestSit

        public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
        {
            if (IsChildAgent)
            {
                remoteClient.SendAgentAlertMessage("Cannot sit on an object in a different region.", false);
                return;
            }

            StandUp(false, true);

            //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
            SceneObjectPart part = FindNextAvailableSitTarget(targetID);
            if (part == null)
            {
                m_log.Warn("[SCENE PRESENCE]: Sit requested on unknown object: " + targetID.ToString());
                return;
            }

            if (part.RegionHandle != remoteClient.Scene.RegionInfo.RegionHandle)
            {
                //m_log.InfoFormat("[SCENE PRESENCE]: Viewer requested a sit to the wrong region server: {0} {1}", remoteClient.Name, remoteClient.AgentId);
                remoteClient.SendAgentAlertMessage("Cannot sit on an object in a different region.", false);
                return;
            }

            m_nextSitAnimation = "SIT";

            if (!String.IsNullOrEmpty(part.SitAnimation))
            {
                m_nextSitAnimation = part.SitAnimation;
            }
            m_requestedSitTargetID = part.LocalId;
            m_requestedSitTargetUUID = part.UUID;
            //m_requestedSitOffset = offset;

            SendSitResponse(remoteClient, targetID, offset);
        }
开发者ID:emperorstarfinder,项目名称:halcyon,代码行数:37,代码来源:ScenePresence.cs

示例14: SendSitResponse

        private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset)
        {
            // The viewer requires parent ID, position and rotation to be relative to the root prim.
            // Internally, we will continue to track parentID, offset and m_bodyRot relative to the child prim.
            // The following three variables with a 'v' prefix refer to the viewer-centric model.
            UUID vParentID;     // parentID to send to viewer, always the root prim
            Vector3 vPos;       // viewer position of avatar relative to root prim
            Quaternion vRot;    // viewer rotation of avatar relative to root prim

            // We'll use the next two to update the internal avatar position and rotation.
            Vector3 avSitPos;
            Quaternion avSitRot;

            Vector3 cameraEyeOffset = Vector3.Zero;
            Vector3 cameraAtOffset = Vector3.Zero;
            bool forceMouselook = false;

            DumpDebug("SendSitResponse", "n/a");
            SceneObjectPart part = null;
            lock (m_scene.SyncRoot)
            {
                part = FindNextAvailableSitTarget(targetID);
                if (part == null)
                {
                    m_log.Error("[SCENE PRESENCE]: SendSitResponse could not find part " + targetID.ToString());
                    remoteClient.SendAgentAlertMessage("Could not sit - seat could not be found in region.", false);
                    return;
                }

                SitTargetInfo sitInfo = part.ParentGroup.SitTargetForPart(part.UUID);

                // First, remove the PhysicsActor since we're going to be sitting, so that physics doesn't interfere while we're doing this update.
                if (PhysicsActor != null)
                {
                    RemoveFromPhysicalScene();
                }

                // Determine position to sit at based on scene geometry; don't trust offset from client
                // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it

                // The viewer requires parent ID, position and rotation to be relative to the root prim.
                // Internally, we will continue to track parentID, offset and m_bodyRot relative to the child prim.
                // The following three variables with a 'v' prefix refer to the viewer-centric model.
                SceneObjectPart rootPart = part.ParentGroup.RootPart;
                vParentID = rootPart.UUID;         // parentID to send to viewer, always the root prim
                vPos = Vector3.Zero;            // viewer position of avatar relative to root prim
                vRot = Quaternion.Identity;  // viewer rotation of avatar relative to root prim
                avSitPos = Vector3.Zero;
                avSitRot = rootPart.RotationOffset;

                if (part != rootPart)
                {
                    vRot *= part.RotationOffset;
                    avSitRot *= part.RotationOffset;
                }

                // Viewer seems to draw the avatar based on the hip position.
                // If you don't include HipOffset (which is raising the avatar 
                // since it's normally negative), then the viewer will draw 
                // the avatar walking with toes underground/inside prim.
                // Full updates were missing this, so a rebake would reproduce it.
                // This adjustment gives the viewer the position it expects.
                vPos.Z -= m_appearance.HipOffset;

                if (sitInfo.IsSet)
                {
                    avSitPos += sitInfo.Offset;
                    if (ADJUST_SIT_TARGET)
                    {
                        // If we want to support previous IW sit target offsets, rather than SL-accurate sit targets,
                        // we need to apply the OpenSim sit target correction adjustment.
                        avSitPos += m_sitTargetCorrectionOffset;
                    }
                    avSitRot *= sitInfo.Rotation;
                    vRot *= sitInfo.Rotation;
                }
                else
                {
                    // Make up a desired facing, relative to the child prim seated on.
                    // We'll use the prim rotation for now.
//                    avSitPos += Vector3.Zero;         // could put the avatar on top of the prim
//                    avSitRot *= Quaternion.Identity;  // could face the avatar to the side clicked on
//                    vRot *= Quaternion.Identity;  // could face the avatar to the side clicked on
                }

#if false
                // I believe this is correct for root-relative storage but not for now, 
                // while we want to maintain it relative to the parentID pointing at child prim.
                avSitPos += part.OffsetPosition;
                if (part == rootPart)
                    avSitPos *= rootPart.RotationOffset;
#endif
                // The only thing left to make avSitPos completely absolute would be to add rootPart.AbsolutePosition
                // but SetAgentPositionInfo takes that as a parameter.

                lock (m_posInfo)
                {
                    // Update these together
                    SetAgentPositionInfo(null, true, avSitPos, part, part.AbsolutePosition, Vector3.Zero);
                    // now update the part to reflect the new avatar
//.........这里部分代码省略.........
开发者ID:emperorstarfinder,项目名称:halcyon,代码行数:101,代码来源:ScenePresence.cs

示例15: AttachObject

        /// <summary>
        /// Attach a scene object to an avatar.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="objectLocalID"></param>
        /// <param name="AttachmentPt"></param>
        /// <param name="rot"></param>
        /// <param name="attachPos"></param>
        /// <param name="silent"></param>
        /// <returns>true if the attachment was successful, false otherwise</returns>
        protected internal bool AttachObject(
            IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
        {
            SceneObjectGroup group = GetGroupByPrim(objectLocalID);
            if (group != null)
            {
                if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
                {
                    // If the attachment point isn't the same as the one previously used
                    // set it's offset position = 0 so that it appears on the attachment point
                    // and not in a weird location somewhere unknown.
                    if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
                    {
                        attachPos = Vector3.Zero;
                    }

                    // AttachmentPt 0 means the client chose to 'wear' the attachment.
                    if (AttachmentPt == 0)
                    {
                        // Check object for stored attachment point
                        AttachmentPt = (uint)group.GetAttachmentPoint();
                    }

                    // if we still didn't find a suitable attachment point.......
                    if (AttachmentPt == 0)
                    {
                        // Stick it on left hand with Zero Offset from the attachment point.
                        AttachmentPt = (uint)AttachmentPoint.LeftHand;
                        attachPos = Vector3.Zero;
                    }

                    group.SetAttachmentPoint((byte)AttachmentPt);
                    group.AbsolutePosition = attachPos;

                    // Saves and gets itemID
                    UUID itemId;

                    if (group.GetFromItemID() == UUID.Zero)
                    {
                        m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId);
                    }
                    else
                    {
                        itemId = group.GetFromItemID();
                    }

                    m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);

                    group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
                    // In case it is later dropped again, don't let
                    // it get cleaned up
                    //
                    group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
                    group.HasGroupChanged = false;
                }
                else
                {
                    remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false);
                    return false;
                }
            }
            else
            {
                m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID);
                return false;
            }

            return true;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:79,代码来源:SceneGraph.cs


注:本文中的IClientAPI.SendAgentAlertMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。