public XmlRpcResponse PreflightBuyLandPrepFunc(XmlRpcRequest request, IPEndPoint ep) { Hashtable requestData = (Hashtable)request.Params[0]; XmlRpcResponse ret = new XmlRpcResponse(); Hashtable retparam = new Hashtable(); Hashtable membershiplevels = new Hashtable(); membershiplevels.Add("levels", membershiplevels); Hashtable landuse = new Hashtable(); Hashtable level = new Hashtable { { "id", "00000000-0000-0000-0000-000000000000" }, { m_connector.GetConfig().UpgradeMembershipUri, "Premium Membership" } }; if (requestData.ContainsKey("agentId") && requestData.ContainsKey("currencyBuy")) { UUID agentId; UUID.TryParse((string)requestData["agentId"], out agentId); UserCurrency currency = m_connector.GetUserCurrency(agentId); IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>("IProfileConnector").GetUserProfile(agentId); //IClientCapsService client = m_dustCurrencyService.Registry.RequestModuleInterface<ICapsService>().GetClientCapsService(agentId); OSDMap replyData = null; bool response = false; UserInfo user = m_agentInfoService.GetUserInfo(agentId.ToString()); if (user == null) { landuse.Add("action", false); retparam.Add("success", false); retparam.Add("currency", currency); retparam.Add("membership", level); retparam.Add("landuse", landuse); retparam.Add("confirm", "asdfajsdkfjasdkfjalsdfjasdf"); ret.Value = retparam; } else { OSDMap map = new OSDMap(); map["Method"] = "GetLandData"; map["AgentID"] = agentId; m_syncMessagePoster.Get(user.CurrentRegionURI, map, (o) => { replyData = o; response = true; }); while (!response) { Thread.Sleep(10); } if (replyData == null || replyData["Success"] == false) { landuse.Add("action", false); retparam.Add("success", false); retparam.Add("currency", currency); retparam.Add("membership", level); retparam.Add("landuse", landuse); retparam.Add("confirm", "asdfajsdkfjasdkfjalsdfjasdf"); ret.Value = retparam; } else { //if (client != null) // m_dustCurrencyService.SendGridMessage(agentId, String.Format(m_dustCurrencyService.m_options.MessgeBeforeBuyLand, profile.DisplayName, replyData.ContainsKey("SalePrice")), false, UUID.Zero); if (replyData.ContainsKey("SalePrice")) { // I think, this might be usable if they don't have the money // Hashtable currencytable = new Hashtable { { "estimatedCost", replyData["SalePrice"].AsInteger() } }; int landTierNeeded = (int)(currency.LandInUse + replyData["Area"].AsInteger()); bool needsUpgrade = false; switch (profile.MembershipGroup) { case "Premium": case "": needsUpgrade = landTierNeeded >= currency.Tier; break; case "Banned": needsUpgrade = true; break; } // landuse.Add("action", m_DustCurrencyService.m_options.upgradeMembershipUri); landuse.Add("action", needsUpgrade); retparam.Add("success", true); retparam.Add("currency", currency); retparam.Add("membership", level); retparam.Add("landuse", landuse); retparam.Add("confirm", "asdfajsdkfjasdkfjalsdfjasdf"); ret.Value = retparam; } } } } return(ret); }
public int Balance(UUID agentID) { return((int)m_connector.GetUserCurrency(agentID).Amount); }