Пример #1
0
        public void SellLandObjects(UUID previousOwner)
        {
            // m_log.DebugFormat(
            //    "[LAND OBJECT]: Request to sell objects in {0} from {1}", LandData.Name, previousOwner);

            if (LandData.IsGroupOwned)
            {
                return;
            }

            IBuySellModule m_BuySellModule = m_scene.RequestModuleInterface <IBuySellModule>();

            if (m_BuySellModule == null)
            {
                m_log.Error("[LAND OBJECT]: BuySellModule not found");
                return;
            }

            ScenePresence sp;

            if (!m_scene.TryGetScenePresence(LandData.OwnerID, out sp))
            {
                m_log.Error("[LAND OBJECT]: New owner is not present in scene");
                return;
            }

            primsOverMe.ForEach(delegate(SceneObjectGroup obj)
            {
                if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero &&
                    (obj.GetEffectivePermissions() & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
                {
                    m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
                }
            });
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        private Hashtable deliverObject(Hashtable requestData)
        {
            Hashtable rparms = new Hashtable();

            rparms["success"] = false;
            try
            {
                Dictionary <string, string> d = new Dictionary <string, string>();
                d.Add("method", "deliverObject");
                d.Add("id", (string)requestData["id"]);

                Dictionary <string, string> response = m_communication.DoRequestDictionary(d);
                if (response != null && response["success"] == "TRUE" || response["success"] == "1")
                {
                    UInt32 localID      = UInt32.Parse(response["localID"]);
                    UUID   receiverUUID = UUID.Parse(response["receiverUUID"]);
                    UUID   categoryID   = UUID.Parse(response["categoryID"]);
                    byte   saleType     = byte.Parse(response["saleType"]);
                    int    salePrice    = response.ContainsKey("salePrice") ? Int32.Parse(response["salePrice"]) : 0;

                    IClientAPI sender = m_sceneHandler.LocateClientObject(receiverUUID);
                    if (sender == null)
                    {
                        throw new Exception("Avatar " + receiverUUID.ToString() + " does not reside in this region");
                    }

                    Scene s = m_sceneHandler.LocateSceneClientIn(receiverUUID);
                    if (s == null)
                    {
                        throw new Exception("Could not find the receiver's current scene");
                    }

                    IBuySellModule buyModule = s.RequestModuleInterface <IBuySellModule>();
                    if (buyModule != null)
                    {
                        m_log.Debug("Call BuyObject from delicerObject");
                        buyModule.BuyObject(sender, categoryID, localID, saleType, salePrice);
                    }
                    else
                    {
                        throw new Exception("Could not find IBuySellModule");
                    }
                    rparms["success"] = true;
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[{0}]: deliverObject() Exception: {1} - {2}", Name, e.Message, e.StackTrace);
            }
            return(rparms);
        }
Пример #4
0
        public void ObjectBuy(IClientAPI remoteClient, UUID agentID, UUID sessionID, UUID groupID, UUID categoryID, uint localID, byte saleType, int salePrice)
        {
            m_log.DebugFormat("User {0} buys object {1} for {2} OMC", agentID, localID, salePrice);
            Scene           s    = m_sceneHandler.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)
            {
                m_log.Debug("Sale Price is 0");
                IBuySellModule buyModule = s.RequestModuleInterface <IBuySellModule>();
                if (buyModule != null)
                {
                    m_log.Debug("Call BuyObject if sale price is 0");
                    //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", m_sceneHandler.GetObjectLocation(part));

                DoMoneyTransfer(remoteClient.AgentId, part.OwnerID, salePrice, (int)TransactionType.BUY_OBJECT, buyObject);
            }
        }