Exemple #1
0
        public XmlRpcResponse LandBuyFunc(XmlRpcRequest request, IPEndPoint ep)
        {
            Hashtable requestData = (Hashtable)request.Params[0];

            bool success = false;

            if (requestData.ContainsKey("agentId") && requestData.ContainsKey("currencyBuy") &&
                m_connector.GetConfig().CanBuyCurrencyInworld)
            {
                UUID agentId;
                if (UUID.TryParse((string)requestData["agentId"], out agentId))
                {
                    uint amountBuying = uint.Parse(requestData["currencyBuy"].ToString());
                    m_connector.UserCurrencyTransfer(agentId, UUID.Zero, UUID.Zero, UUID.Zero, amountBuying,
                                                     "Inworld purchase", TransactionType.SystemGenerated, UUID.Zero);
                    success = true;
                }
            }
            XmlRpcResponse returnval  = new XmlRpcResponse();
            Hashtable      returnresp = new Hashtable {
                { "success", success }
            };

            returnval.Value = returnresp;
            return(returnval);
        }
Exemple #2
0
        private bool EventManager_OnValidateBuyLand(EventManager.LandBuyArgs e)
        {
            IParcelManagementModule parcelMangaement = GetSceneFor(e.agentId).RequestModuleInterface <IParcelManagementModule>();

            if (parcelMangaement == null)
            {
                return(false);
            }
            ILandObject lob = parcelMangaement.GetLandObject(e.parcelLocalID);

            if (lob != null)
            {
                UUID AuthorizedID = lob.LandData.AuthBuyerID;
                int  saleprice    = lob.LandData.SalePrice;
                UUID pOwnerID     = lob.LandData.OwnerID;

                bool landforsale = ((lob.LandData.Flags &
                                     (uint)
                                     (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects |
                                      ParcelFlags.SellParcelObjects)) != 0);
                if ((AuthorizedID == UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice &&
                    landforsale)
                {
                    if (m_connector.UserCurrencyTransfer(lob.LandData.OwnerID, e.agentId,
                                                         (uint)saleprice, "Land Buy", TransactionType.LandSale,
                                                         UUID.Zero))
                    {
                        e.parcelOwnerID = pOwnerID;
                        e.landValidated = true;
                        return(true);
                    }
                    else
                    {
                        e.landValidated = false;
                    }
                }
            }
            return(false);
        }
        private object StupendsPayOutEvent(string functionName, object parameters)
        {
            if (functionName != "StipendsPayout")
            {
                return(null);
            }
            StipendsInfo si = new StipendsInfo();

            si.FromOSD((OSDMap)OSDParser.DeserializeJson(parameters.ToString()));
            IUserAccountService userService = m_registry.RequestModuleInterface <IUserAccountService>();
            UserAccount         ua          = userService.GetUserAccount(null, si.AgentID);

            if ((ua != null) && (ua.UserFlags >= 0) && ((!m_options.StipendsPremiumOnly) || ((ua.UserLevel & 600) == 600)))
            {
                if (m_options.GiveStipendsOnlyWhenLoggedIn)
                {
                    ICapsService       capsService = m_registry.RequestModuleInterface <ICapsService>();
                    IClientCapsService client      = capsService.GetClientCapsService(ua.PrincipalID);
                    if (client == null)
                    {
                        return("");
                    }
                }
                IMoneyModule mo = m_registry.RequestModuleInterface <IMoneyModule>();
                if (mo == null)
                {
                    return(null);
                }
                UUID transid = UUID.Random();
                if (m_currencyService.UserCurrencyTransfer(ua.PrincipalID, UUID.Zero, UUID.Zero, UUID.Zero, (uint)m_options.Stipend, "Stipend Payment", TransactionType.StipendPayment, transid))
                {
                    return(transid.ToString());
                }
            }
            return("");
        }