OpenMetaverse.ObjectManager.BuyObject C# (CSharp) Method

BuyObject() public method

Attempt to purchase an original object, a copy, or the contents of an object
public BuyObject ( Simulator simulator, uint localID, SaleType saleType, int price, UUID groupID, UUID categoryID ) : void
simulator Simulator The the object is located
localID uint The Local ID of the object
saleType SaleType Whether the original, a copy, or the object /// contents are on sale. This is used for verification, if the this /// sale type is not valid for the object the purchase will fail
price int Price of the object. This is used for /// verification, if it does not match the actual price the purchase /// will fail
groupID UUID Group ID that will be associated with the new /// purchase
categoryID UUID Inventory folder UUID where the object or objects /// purchased should be placed
return void
        public void BuyObject(Simulator simulator, uint localID, SaleType saleType, int price, UUID groupID,
            UUID categoryID)
        {
            ObjectBuyPacket buy = new ObjectBuyPacket();

            buy.AgentData.AgentID = Client.Self.AgentID;
            buy.AgentData.SessionID = Client.Self.SessionID;
            buy.AgentData.GroupID = groupID;
            buy.AgentData.CategoryID = categoryID;

            buy.ObjectData = new ObjectBuyPacket.ObjectDataBlock[1];
            buy.ObjectData[0] = new ObjectBuyPacket.ObjectDataBlock();
            buy.ObjectData[0].ObjectLocalID = localID;
            buy.ObjectData[0].SaleType = (byte)saleType;
            buy.ObjectData[0].SalePrice = price;

            Client.Network.SendPacket(buy, simulator);
        }