/// <summary> /// Sends the details about what /// </summary> /// <param name="client"></param> /// <param name="agentID"></param> /// <param name="groupID"></param> /// <param name="transactionID"></param> /// <param name="sessionID"></param> /// <param name="currentInterval"></param> /// <param name="intervalDays"></param> private void client_OnGroupAccountDetailsRequest(IClientAPI client, UUID agentID, UUID groupID, UUID transactionID, UUID sessionID, int currentInterval, int intervalDays) { IGroupsModule groupsModule = client.Scene.RequestModuleInterface <IGroupsModule>(); if (groupsModule != null && groupsModule.GroupPermissionCheck(agentID, groupID, GroupPowers.Accountable)) { IMoneyModule moneyModule = client.Scene.RequestModuleInterface <IMoneyModule>(); if (moneyModule != null) { int amt = moneyModule.Balance(groupID); List <GroupAccountHistory> history = moneyModule.GetTransactions(groupID, agentID, currentInterval, intervalDays); history = (from h in history where h.Stipend select h).ToList(); //We don't want payments, we only want stipends which we sent to users GroupBalance balance = moneyModule.GetGroupBalance(groupID); client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, amt, currentInterval, intervalDays, Util.BuildYMDDateString( balance.StartingDate.AddDays(-currentInterval * intervalDays)), history.ToArray()); } else { client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, 0, currentInterval, intervalDays, "Never", new GroupAccountHistory[0]); } } }
/// <summary> /// Classifieds info update. /// </summary> /// <param name='queryclassifiedID'> /// Queryclassified I. /// </param> /// <param name='queryCategory'> /// Query category. /// </param> /// <param name='queryName'> /// Query name. /// </param> /// <param name='queryDescription'> /// Query description. /// </param> /// <param name='queryParcelID'> /// Query parcel I. /// </param> /// <param name='queryParentEstate'> /// Query parent estate. /// </param> /// <param name='querySnapshotID'> /// Query snapshot I. /// </param> /// <param name='queryGlobalPos'> /// Query global position. /// </param> /// <param name='queryclassifiedFlags'> /// Queryclassified flags. /// </param> /// <param name='queryclassifiedPrice'> /// Queryclassified price. /// </param> /// <param name='remoteClient'> /// Remote client. /// </param> public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName, string queryDescription, UUID queryParcelID, uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags, int queryclassifiedPrice, IClientAPI remoteClient) { Scene s = (Scene)remoteClient.Scene; IMoneyModule money = s.RequestModuleInterface <IMoneyModule>(); if (money != null) { if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice)) { remoteClient.SendAgentAlertMessage("You do not have enough money to create requested classified.", false); return; } money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge); } UserClassifiedAdd ad = new UserClassifiedAdd(); Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); ScenePresence p = FindPresence(remoteClient.AgentId); string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if (land == null) { ad.ParcelName = string.Empty; } else { ad.ParcelName = land.LandData.Name; } ad.CreatorId = remoteClient.AgentId; ad.ClassifiedId = queryclassifiedID; ad.Category = Convert.ToInt32(queryCategory); ad.Name = queryName; ad.Description = queryDescription; ad.ParentEstate = Convert.ToInt32(queryParentEstate); ad.SnapshotId = querySnapshotID; ad.SimName = remoteClient.Scene.RegionInfo.RegionName; ad.GlobalPos = queryGlobalPos.ToString(); ad.Flags = queryclassifiedFlags; ad.Price = queryclassifiedPrice; ad.ParcelId = p.currentParcelUUID; object Ad = ad; OSD.SerializeMembers(Ad); if (!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage( "Error updating classified", false); return; } }
private bool ChargeUser(string asset_type, OSDMap map, out int charge, out int resourceCost) { IMoneyModule mm = m_service.Registry.RequestModuleInterface <IMoneyModule>(); charge = 0; resourceCost = 0; if (mm != null) { if (asset_type == "texture" || asset_type == "animation" || asset_type == "snapshot" || asset_type == "sound") { charge = mm.UploadCharge; } else if (asset_type == "mesh" || asset_type == "object") { OSDMap meshMap = (OSDMap)map["asset_resources"]; OSDArray instance_list = (OSDArray)meshMap["instance_list"]; OSDArray mesh_list = (OSDArray)meshMap["mesh_list"]; OSDArray texture_list = (OSDArray)meshMap["texture_list"]; charge = texture_list.Count * mm.UploadCharge + meshMap.Count * mm.UploadCharge; resourceCost = meshMap.Count * mm.UploadCharge; } if (charge > 0 && !mm.Charge(m_service.AgentID, mm.UploadCharge, "Upload Charge")) { return(false); } } return(true); }
public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge) { IMoneyModule moneyModule = m_registry.RequestModuleInterface <IMoneyModule>(); if (moneyModule != null) { bool success = moneyModule.Charge(agentID, amount, text); if (!success) { return(false); } IScheduleService scheduler = m_registry.RequestModuleInterface <IScheduleService>(); if (scheduler != null) { OSDMap itemInfo = new OSDMap(); itemInfo.Add("AgentID", agentID); itemInfo.Add("Amount", amount); itemInfo.Add("Text", text); SchedulerItem item = new SchedulerItem("ScheduledPayment", OSDParser.SerializeJsonString(itemInfo), false, DateTime.Now.AddDays(daysUntilNextCharge) - DateTime.Now); itemInfo.Add("SchedulerID", item.id); scheduler.Save(item); } } return(true); }
/// <summary> /// /// </summary> /// <param name="llsdRequest"></param> /// <returns></returns> public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) { if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || llsdRequest.asset_type == "sound") { IClientAPI client = null; IScene scene = null; if (GetClient != null) { client = GetClient(m_agentID); scene = client.Scene; IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.UploadCovered(client, mm.UploadCharge)) { if (client != null) { client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); } LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); errorResponse.uploader = ""; errorResponse.state = "error"; return(errorResponse); } } } } string assetName = llsdRequest.name; string assetDes = llsdRequest.description; string capsBase = "/CAPS/" + m_capsObjectPath; UUID newAsset = UUID.Random(); UUID newInvItem = UUID.Random(); UUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); m_httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); string protocol = "http://"; if (m_httpListener.UseSSL) { protocol = "https://"; } string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; uploader.OnUpLoad += UploadCompleteHandler; return(uploadResponse); }
public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge, TransactionType type, string identifer, bool chargeImmediately) { IMoneyModule moneyModule = m_registry.RequestModuleInterface <IMoneyModule>(); if (moneyModule != null) { if (chargeImmediately) { bool success = moneyModule.Charge(agentID, amount, text, type); if (!success) { return(false); } } IScheduleService scheduler = m_registry.RequestModuleInterface <IScheduleService>(); if (scheduler != null) { OSDMap itemInfo = new OSDMap(); itemInfo.Add("AgentID", agentID); itemInfo.Add("Amount", amount); itemInfo.Add("Text", text); itemInfo.Add("Type", (int)type); SchedulerItem item = new SchedulerItem("ScheduledPayment" + identifer, OSDParser.SerializeJsonString(itemInfo), false, DateTime.UtcNow, daysUntilNextCharge, RepeatType.days, agentID); itemInfo.Add("SchedulerID", item.id); scheduler.Save(item); } } return(true); }
private object ChargeNext(string functionName, object parameters) { if (functionName == "ScheduledPayment") { OSDMap itemInfo = (OSDMap)OSDParser.DeserializeJson(parameters.ToString()); IMoneyModule moneyModule = m_registry.RequestModuleInterface <IMoneyModule>(); UUID agentID = itemInfo["AgentID"]; string scdID = itemInfo["SchedulerID"]; string text = itemInfo["Text"]; int amount = itemInfo["Amount"]; if (CheckWhetherUserShouldPay(agentID, text)) { bool success = moneyModule.Charge(agentID, amount, text); if (!success) { if (OnUserDidNotPay != null) { OnUserDidNotPay(agentID, text); } } } else { IScheduleService scheduler = m_registry.RequestModuleInterface <IScheduleService>(); if (scheduler != null) { scheduler.Remove(scdID); } } } return(null); }
public void HookUpRegionEvents(IScene Scene) { //MainConsole.Instance.Info("[" + myScriptEngine.ScriptEngineName + // "]: Hooking up to server events"); Scene.EventManager.OnObjectGrab += touch_start; Scene.EventManager.OnObjectGrabbing += touch; Scene.EventManager.OnObjectDeGrab += touch_end; Scene.EventManager.OnScriptChangedEvent += changed; Scene.EventManager.OnScriptAtTargetEvent += at_target; Scene.EventManager.OnScriptNotAtTargetEvent += not_at_target; Scene.EventManager.OnScriptAtRotTargetEvent += at_rot_target; Scene.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; Scene.EventManager.OnScriptControlEvent += control; Scene.EventManager.OnScriptColliderStart += collision_start; Scene.EventManager.OnScriptColliding += collision; Scene.EventManager.OnScriptCollidingEnd += collision_end; Scene.EventManager.OnScriptLandColliderStart += land_collision_start; Scene.EventManager.OnScriptLandColliding += land_collision; Scene.EventManager.OnScriptLandColliderEnd += land_collision_end; Scene.EventManager.OnAttach += attach; Scene.EventManager.OnScriptMovingStartEvent += moving_start; Scene.EventManager.OnScriptMovingEndEvent += moving_end; Scene.EventManager.OnRezScripts += rez_scripts; IMoneyModule moneyModule = Scene.RequestModuleInterface <IMoneyModule>(); if (moneyModule != null) { moneyModule.OnObjectPaid += money; } }
public EventManager(XEngine _ScriptEngine) { myScriptEngine = _ScriptEngine; // m_log.Info("[XEngine] Hooking up to server events"); myScriptEngine.World.EventManager.OnAttach += attach; myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnObjectGrabbing += touch; myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; myScriptEngine.World.EventManager.OnScriptMovingStartEvent += moving_start; myScriptEngine.World.EventManager.OnScriptMovingEndEvent += moving_end; myScriptEngine.World.EventManager.OnScriptControlEvent += control; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start; myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision; myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end; IMoneyModule money = myScriptEngine.World.RequestModuleInterface <IMoneyModule>(); if (money != null) { money.OnObjectPaid += HandleObjectPaid; } }
private void client_OnGroupAccountSummaryRequest(IClientAPI client, UUID agentID, UUID groupID, UUID requestID, int currentInterval, int intervalDays) { IGroupsModule groupsModule = client.Scene.RequestModuleInterface <IGroupsModule>(); if (groupsModule != null && groupsModule.GroupPermissionCheck(agentID, groupID, GroupPowers.Accountable)) { IMoneyModule moneyModule = client.Scene.RequestModuleInterface <IMoneyModule>(); if (moneyModule != null) { int amt = moneyModule.Balance(groupID); GroupBalance balance = moneyModule.GetGroupBalance(groupID); client.SendGroupAccountingSummary(client, groupID, requestID, amt, balance.TotalTierDebit, balance.TotalTierCredits, Util.BuildYMDDateString( balance.StartingDate.AddDays(-currentInterval * intervalDays)), currentInterval, intervalDays, Util.BuildYMDDateString(balance.StartingDate.AddDays(intervalDays)), Util.BuildYMDDateString( balance.StartingDate.AddDays(-(currentInterval + 1) * intervalDays)), balance.ParcelDirectoryFee, balance.LandFee, balance.GroupFee, balance.ObjectFee); } else { client.SendGroupAccountingSummary(client, groupID, requestID, 0, 0, 0, "Never", currentInterval, intervalDays, "Never", "Never", 0, 0, 0, 0); } } }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transaction"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && tempFile == false) { Scene scene = (Scene)remoteClient.Scene; IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.UploadCovered(remoteClient)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } //m_log.Debug("asset upload of " + assetID); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); if (uploader != null) { uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); } }
private object ChargeNext(string functionName, object parameters) { if (functionName.StartsWith("ScheduledPayment")) { OSDMap itemInfo = (OSDMap)OSDParser.DeserializeJson(parameters.ToString()); IMoneyModule moneyModule = m_registry.RequestModuleInterface <IMoneyModule>(); UUID agentID = itemInfo["AgentID"]; string scdID = itemInfo["SchedulerID"]; string text = itemInfo["Text"]; int amount = itemInfo["Amount"]; TransactionType type = !itemInfo.ContainsKey("Type") ? TransactionType.SystemGenerated : (TransactionType)itemInfo["Type"].AsInteger(); if (CheckWhetherUserShouldPay(agentID, text)) { bool success = moneyModule.Charge(agentID, amount, text, type); if (!success) { if (OnUserDidNotPay != null) { OnUserDidNotPay(agentID, functionName.Replace("ScheduledPayment", ""), text); } } } else { IScheduleService scheduler = m_registry.RequestModuleInterface <IScheduleService>(); if (scheduler != null) { scheduler.Remove(scdID); } } } return(null); }
private void InitEvents() { m_log.Info("[YEngine] Hooking up to server events"); this.World.EventManager.OnAttach += attach; this.World.EventManager.OnObjectGrab += touch_start; this.World.EventManager.OnObjectGrabbing += touch; this.World.EventManager.OnObjectDeGrab += touch_end; this.World.EventManager.OnScriptChangedEvent += changed; this.World.EventManager.OnScriptAtTargetEvent += at_target; this.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; this.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; this.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; this.World.EventManager.OnScriptMovingStartEvent += moving_start; this.World.EventManager.OnScriptMovingEndEvent += moving_end; this.World.EventManager.OnScriptControlEvent += control; this.World.EventManager.OnScriptColliderStart += collision_start; this.World.EventManager.OnScriptColliding += collision; this.World.EventManager.OnScriptCollidingEnd += collision_end; this.World.EventManager.OnScriptLandColliderStart += land_collision_start; this.World.EventManager.OnScriptLandColliding += land_collision; this.World.EventManager.OnScriptLandColliderEnd += land_collision_end; IMoneyModule money = this.World.RequestModuleInterface <IMoneyModule>(); if (money != null) { money.OnObjectPaid += HandleObjectPaid; } }
public void HookUpEvents() { m_log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events"); myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; myScriptEngine.World.EventManager.OnScriptControlEvent += control; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; IMoneyModule money = myScriptEngine.World.RequestModuleInterface <IMoneyModule>(); if (money != null) { money.OnObjectPaid += HandleObjectPaid; } }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transaction"></param> /// <param name="type"></param> /// <param name="data"></param> /// <param name="storeLocal"></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // MainConsole.Instance.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && !tempFile) { IScene scene = remoteClient.Scene; IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.Charge(remoteClient.AgentId, mm.UploadCharge, "Upload asset", TransactionType.UploadCharge)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); if (uploader != null) { uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); } }
private void DoCreateItem(uint callbackID) { m_createItem = false; // don't create or bill for the same item more than once try { m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset, AssetRequestInfo.GenericNetRequest()); } catch (AssetServerException e) { ourClient.SendAgentAlertMessage("Unable to upload asset. Please try again later.", false); m_log.ErrorFormat("[ASSET TRANSACTIONS] Asset storage failed: {0}", e); return; } CachedUserInfo userInfo = m_userTransactions.Manager.MyScene.CommsManager.UserService.GetUserDetails( ourClient.AgentId); if (userInfo != null) { InventoryItemBase item = new InventoryItemBase(); item.Owner = ourClient.AgentId; item.CreatorId = ourClient.AgentId.ToString(); item.ID = UUID.Random(); item.AssetID = m_asset.FullID; item.Description = m_description; item.Name = m_name; item.AssetType = type; item.InvType = invType; item.Folder = InventFolder; item.BasePermissions = (uint)(PermissionMask.All | PermissionMask.Export); item.CurrentPermissions = (uint)(PermissionMask.All | PermissionMask.Export); item.GroupPermissions = (uint)PermissionMask.None; item.EveryOnePermissions = (uint)PermissionMask.None; item.NextPermissions = nextPerm; item.Flags = (uint)wearableType; item.CreationDate = Util.UnixTimeSinceEpoch(); userInfo.AddItem(item); ourClient.SendInventoryItemCreateUpdate(item, callbackID); // Charge for the upload if appropriate. IMoneyModule mm = ourClient.Scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (mm.UploadChargeApplies((AssetType)m_asset.Type) && !m_asset.Temporary) { mm.ApplyUploadCharge(ourClient.AgentId); } } } else { m_log.ErrorFormat("[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", ourClient.AgentId); } }
public void IncomingCapsRequest(UUID agentID, Framework.Services.GridRegion region, ISimulationBase simbase, ref OSDMap capURLs) { m_agentID = agentID; m_moneyModule = simbase.ApplicationRegistry.RequestModuleInterface <IMoneyModule> (); m_assetService = simbase.ApplicationRegistry.RequestModuleInterface <IAssetService> (); m_inventoryService = simbase.ApplicationRegistry.RequestModuleInterface <IInventoryService> (); m_libraryService = simbase.ApplicationRegistry.RequestModuleInterface <ILibraryService> (); m_inventoryData = Framework.Utilities.DataManager.RequestPlugin <IInventoryData> (); HttpServerHandle method; string uri; method = (path, request, httpRequest, httpResponse) => HandleFetchInventoryDescendents(request, m_agentID); uri = "/CAPS/FetchInventoryDescendents/" + UUID.Random() + "/"; capURLs ["WebFetchInventoryDescendents"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchInventoryDescendents"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchInventoryDescendents2"] = MainServer.Instance.ServerURI + uri; m_uris.Add(uri); MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method)); method = (path, request, httpRequest, httpResponse) => HandleFetchLibDescendents(request, m_agentID); uri = "/CAPS/FetchLibDescendents/" + UUID.Random() + "/"; capURLs ["FetchLibDescendents"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchLibDescendents2"] = MainServer.Instance.ServerURI + uri; m_uris.Add(uri); MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method)); method = (path, request, httpRequest, httpResponse) => HandleFetchInventory(request, m_agentID); uri = "/CAPS/FetchInventory/" + UUID.Random() + "/"; capURLs ["FetchInventory"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchInventory2"] = MainServer.Instance.ServerURI + uri; m_uris.Add(uri); MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method)); method = (path, request, httpRequest, httpResponse) => HandleFetchLib(request, m_agentID); uri = "/CAPS/FetchLib/" + UUID.Random() + "/"; capURLs ["FetchLib"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchLib2"] = MainServer.Instance.ServerURI + uri; m_uris.Add(uri); MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method)); uri = "/CAPS/NewFileAgentInventory/" + UUID.Random() + "/"; capURLs ["NewFileAgentInventory"] = MainServer.Instance.ServerURI + uri; m_uris.Add(uri); MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, NewAgentInventoryRequest)); uri = "/CAPS/NewFileAgentInventoryVariablePrice/" + UUID.Random() + "/"; capURLs ["NewFileAgentInventoryVariablePrice"] = MainServer.Instance.ServerURI + uri; m_uris.Add(uri); MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, NewAgentInventoryRequestVariablePrice)); uri = "/CAPS/CreateInventoryCategory/" + UUID.Random() + "/"; capURLs ["CreateInventoryCategory"] = MainServer.Instance.ServerURI + uri; m_uris.Add(uri); MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, CreateInventoryCategory)); }
public void IncomingCapsRequest (UUID agentID, Framework.Services.GridRegion region, ISimulationBase simbase, ref OSDMap capURLs) { m_agentID = agentID; m_moneyModule = simbase.ApplicationRegistry.RequestModuleInterface<IMoneyModule> (); m_assetService = simbase.ApplicationRegistry.RequestModuleInterface<IAssetService> (); m_inventoryService = simbase.ApplicationRegistry.RequestModuleInterface<IInventoryService> (); m_libraryService = simbase.ApplicationRegistry.RequestModuleInterface<ILibraryService> (); m_inventoryData = Framework.Utilities.DataManager.RequestPlugin<IInventoryData> (); HttpServerHandle method; string uri; method = (path, request, httpRequest, httpResponse) => HandleFetchInventoryDescendents (request, m_agentID); uri = "/CAPS/FetchInventoryDescendents/" + UUID.Random () + "/"; capURLs ["WebFetchInventoryDescendents"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchInventoryDescendents"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchInventoryDescendents2"] = MainServer.Instance.ServerURI + uri; m_uris.Add (uri); MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method)); method = (path, request, httpRequest, httpResponse) => HandleFetchLibDescendents (request, m_agentID); uri = "/CAPS/FetchLibDescendents/" + UUID.Random () + "/"; capURLs ["FetchLibDescendents"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchLibDescendents2"] = MainServer.Instance.ServerURI + uri; m_uris.Add (uri); MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method)); method = (path, request, httpRequest, httpResponse) => HandleFetchInventory (request, m_agentID); uri = "/CAPS/FetchInventory/" + UUID.Random () + "/"; capURLs ["FetchInventory"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchInventory2"] = MainServer.Instance.ServerURI + uri; m_uris.Add (uri); MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method)); method = (path, request, httpRequest, httpResponse) => HandleFetchLib (request, m_agentID); uri = "/CAPS/FetchLib/" + UUID.Random () + "/"; capURLs ["FetchLib"] = MainServer.Instance.ServerURI + uri; capURLs ["FetchLib2"] = MainServer.Instance.ServerURI + uri; m_uris.Add (uri); MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method)); uri = "/CAPS/NewFileAgentInventory/" + UUID.Random () + "/"; capURLs ["NewFileAgentInventory"] = MainServer.Instance.ServerURI + uri; m_uris.Add (uri); MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, NewAgentInventoryRequest)); uri = "/CAPS/NewFileAgentInventoryVariablePrice/" + UUID.Random () + "/"; capURLs ["NewFileAgentInventoryVariablePrice"] = MainServer.Instance.ServerURI + uri; m_uris.Add (uri); MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, NewAgentInventoryRequestVariablePrice)); uri = "/CAPS/CreateInventoryCategory/" + UUID.Random () + "/"; capURLs ["CreateInventoryCategory"] = MainServer.Instance.ServerURI + uri; m_uris.Add (uri); MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, CreateInventoryCategory)); }
public void FinishedStartup() { IMoneyModule moneyModule = m_registry.RequestModuleInterface <IMoneyModule>(); if (moneyModule != null) //Only register if money is enabled { // Register the GroupPayments Engine } }
public void FinishedStartup() { IMoneyModule moneyModule = m_registry.RequestModuleInterface <IMoneyModule>(); if (moneyModule != null)//Only register if money is enabled { m_registry.RegisterModuleInterface <IScheduledMoneyModule>(this); m_registry.RequestModuleInterface <ISimulationBase>().EventManager.RegisterEventHandler("ScheduledPayment", ChargeNext); } }
public LSL_String llTransferLindenDollars(LSL_String destination, LSL_Integer amt) { LSL_String transferID = UUID.Random().ToString(); IMoneyModule moneyMod = World.RequestModuleInterface <IMoneyModule>(); LSL_String data = ""; LSL_Integer success = LSL_Integer.FALSE; TaskInventoryItem item = m_host.TaskInventory[m_itemID]; UUID destID; if (item.PermsGranter == UUID.Zero || (item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) { data = llList2CSV(new LSL_List("MISSING_PERMISSION_DEBIT")); } else if (!UUID.TryParse(destination, out destID)) { data = llList2CSV(new LSL_List("INVALID_AGENT")); } else if (amt <= 0) { data = llList2CSV(new LSL_List("INVALID_AMOUNT")); } else if (!World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, destID).Valid) { data = llList2CSV(new LSL_List("LINDENDOLLAR_ENTITYDOESNOTEXIST")); } else if (m_host.ParentEntity.OwnerID == m_host.ParentEntity.GroupID) { data = llList2CSV(new LSL_List("GROUP_OWNED")); } else if (moneyMod != null) { success = moneyMod.Transfer(UUID.Parse(destination), m_host.OwnerID, amt, "", TransactionType.ObjectPays); data = llList2CSV(success ? new LSL_List(destination, amt) : new LSL_List("LINDENDOLLAR_INSUFFICIENTFUNDS")); } else { data = llList2CSV(new LSL_List("SERVICE_ERROR")); } m_ScriptEngine.PostScriptEvent( m_itemID, m_host.UUID, new EventParams("transaction_result", new object[] { transferID, success, data }, new DetectParams[0]), EventPriority.FirstStart ); return(transferID); }
protected void ObjectBuy(IClientAPI remoteClient, UUID sessionID, UUID groupID, UUID categoryID, uint localID, byte saleType, int salePrice) { // 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.. ISceneChildEntity part = remoteClient.Scene.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; } IMoneyModule moneyMod = remoteClient.Scene.RequestModuleInterface <IMoneyModule>(); if (moneyMod != null) { if ( !moneyMod.Transfer(part.OwnerID, remoteClient.AgentId, part.ParentUUID, UUID.Zero, part.SalePrice, "Object Purchase", TransactionType.ObjectPay)) { remoteClient.SendAgentAlertMessage("You do not have enough money to buy this object.", false); return; } } BuyObject(remoteClient, categoryID, localID, saleType, salePrice); }
public void AddRegion(IScene scene) { if (!m_Enabled) return; m_Scenelist.Add(scene); scene.RegisterModuleInterface(this); scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClosingClient += OnClosingClient; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; moneyService = scene.RequestModuleInterface<IMoneyModule>(); }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transactionID"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transactionID, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // m_log.DebugFormat( // "[ASSET TRANSACTION MODULE]: HandleUDPUploadRequest - assetID: {0}, transaction {1}, type {2}, storeLocal {3}, tempFile {4}, data.Length {5}", // assetID, transactionID, type, storeLocal, tempFile, data.Length); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && tempFile == false) { ScenePresence avatar = null; Scene scene = (Scene)remoteClient.Scene; scene.TryGetScenePresence(remoteClient.AgentId, out avatar); // check user level if (avatar != null) { if (avatar.UserLevel < m_levelUpload) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); return; } } // check funds IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.UploadCovered(remoteClient.AgentId, mm.UploadCharge)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transactionID); uploader.StartUpload(remoteClient, assetID, transactionID, type, data, storeLocal, tempFile); }
public void AddRegion(IScene scene) { if (!m_Enabled) { return; } m_Scenelist.Add(scene); scene.RegisterModuleInterface(this); scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClosingClient += OnClosingClient; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; moneyService = scene.RequestModuleInterface <IMoneyModule>(); }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transaction"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && tempFile == false) { ScenePresence avatar = null; Scene scene = (Scene)remoteClient.Scene; scene.TryGetScenePresence(remoteClient.AgentId, out avatar); // check user level if (avatar != null) { if (avatar.UserLevel < m_levelUpload) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); return; } } // check funds IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.UploadCovered(remoteClient.AgentId, mm.UploadCharge)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name = "remoteClient"></param> /// <param name = "assetID"></param> /// <param name = "transaction"></param> /// <param name = "type"></param> /// <param name = "data"></param> /// </param> /// <param name = "tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // MainConsole.Instance.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && tempFile == false) { IScene scene = remoteClient.Scene; IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.Charge(remoteClient, mm.UploadCharge)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); IMonitorModule monitorModule = m_scene.RequestModuleInterface <IMonitorModule>(); if (monitorModule != null) { INetworkMonitor networkMonitor = (INetworkMonitor) monitorModule.GetMonitor(m_scene.RegionInfo.RegionID.ToString(), MonitorModuleHelper.NetworkMonitor); networkMonitor.AddPendingUploads(1); } AssetXferUploader uploader = transactions.RequestXferUploader(transaction); if (uploader != null) { uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); } }
public void HookUpEvents() { m_log.Info("[" + myScriptEngine.ScriptEngineName + "]: Attaching to object events"); myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; myScriptEngine.World.EventManager.OnBotPathUpdateEvent += bot_update; myScriptEngine.World.EventManager.OnScriptControlEvent += control; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; myScriptEngine.World.EventManager.OnScriptLandCollidingStart += land_collision_start; myScriptEngine.World.EventManager.OnScriptLandCollidingEnd += land_collision_end; myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision; myScriptEngine.World.EventManager.OnObjectGrabUpdate += new EventManager.ObjectGrabUpdateDelegate(EventManager_OnObjectGrabUpdate); myScriptEngine.World.EventManager.OnAttachObject += new EventManager.AttachObject(EventManager_OnAttachObject); myScriptEngine.World.EventManager.OnDetachObject += new EventManager.DetachObject(EventManager_OnDetachObject); myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += EventManager_OnScriptAtRotTargetEvent; myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += EventManager_OnScriptNotAtRotTargetEvent; IMoneyModule money = myScriptEngine.World.RequestModuleInterface <IMoneyModule>(); if (money != null) { money.OnObjectPaid += HandleObjectPaid; } }
private object StipendsPayOutEvent(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 & Constants.USER_FLAG_MEMBER) == Constants.USER_FLAG_MEMBER))) { 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(); MainConsole.Instance.Info("[MONEY MODULE] Stipend Payment for " + ua.FirstName + " " + ua.LastName + " is now running"); if (m_currencyService.UserCurrencyTransfer(ua.PrincipalID, UUID.Zero, (uint)m_options.Stipend, "Stipend Payment", TransactionType.StipendPayment, transid)) { return(transid.ToString()); } } return(""); }
public void Initialize(Scene scene, IConfigSource config) { if (!m_Enabled) { return; } //TODO: At some point, strip this out of the ini file, in Search Module, // we're going to recycle the Profile connection string however to make // life a bit easier. IConfig profileConfig = config.Configs["Startup"]; string connstr = profileConfig.GetString("core_connection_string", String.Empty); m_log.Info("[PROFILE] Profile module is activated"); //TODO: Bad assumption on my part that we're enabling it and the connstr is actually // valid, but I'm sick of dinking with this thing :) m_Enabled = true; _connFactory = new ConnectionFactory("MySQL", connstr); string storageConnStr = profileConfig.GetString("storage_connection_string", String.Empty); _regionConnFactory = new ConnectionFactory("MySQL", storageConnStr); IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { _currencyString = mm.GetCurrencySymbol(); } // Hook up events scene.EventManager.OnNewClient += OnNewClient; }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transaction"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); Scene scene = (Scene)remoteClient.Scene; IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm == null) { remoteClient.SendAgentAlertMessage("Server configuration error - cannot upload asset.", false); return; } if (mm.UploadChargeApplies((AssetType)type) && !tempFile) { if (!mm.UploadCovered(remoteClient.AgentId)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } //m_log.Debug("asset upload of " + assetID); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); if (uploader == null) { remoteClient.SendAgentAlertMessage("Server error uploading asset. Could not allocate uploader.", false); return; } // m_log.Debug("HandleUDPUploadRequest(Initialize) - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); // Okay, start the upload. uploader.Initialize(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); }
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_dustCurrencyService.UserCurrencyTransfer(ua.PrincipalID, m_options.BankerPrincipalID, UUID.Zero, UUID.Zero, (uint)m_options.Stipend, "Stipend Payment", TransactionType.StipendPayment, transid)) { return(transid.ToString()); } } return(""); }
public void FinishedStartup () { moneyModule = m_registry.RequestModuleInterface<IMoneyModule> (); if ((moneyModule != null) && moneyModule.IsLocal) //Only register if money is enabled and is local { m_registry.RegisterModuleInterface<IScheduledMoneyModule> (this); eventManager.RegisterEventHandler ("ScheduledPayment", ChargeNext); scheduler = m_registry.RequestModuleInterface<IScheduleService> (); sched_database = Framework.Utilities.DataManager.RequestPlugin<ISchedulerDataPlugin> (); currencySymbol = moneyModule.InWorldCurrencySymbol; getStipendConfig (); AddCommands (); // Set up Timer taskTimer.Enabled = false; taskTimer.Elapsed += SchedulerTimerElapsed; InitializeScheduleTimer (); } }
/// <summary> /// Calculate (possibly variable priced) charges. /// </summary> /// <param name="asset_type"></param> /// <param name="map"></param> /// <param name="charge"></param> /// <param name="resourceCost"></param> /// <returns>upload charge to user</returns> private void CalculateCosts(IMoneyModule mm, string asset_type, OSDMap map, out int uploadCost, out int resourceCost) { uploadCost = 0; resourceCost = 0; if (mm != null) { int upload_price = mm.GetEconomyData().PriceUpload; if (asset_type == "texture" || asset_type == "animation" || asset_type == "snapshot" || asset_type == "sound") { uploadCost = upload_price; resourceCost = 0; } else if (asset_type == "mesh" || asset_type == "object") { OSDMap meshMap = (OSDMap)map["asset_resources"]; int meshCount = meshMap.ContainsKey("mesh_list") ? ((OSDArray)meshMap["mesh_list"]).Count : 0; int textureCount = meshMap.ContainsKey("texture_list") ? ((OSDArray)meshMap["texture_list"]).Count : 0; uploadCost = mm.MeshUploadCharge(meshCount, textureCount); // simplified resource cost, for now // see http://wiki.secondlife.com/wiki/Mesh/Mesh_physics for LL implementation resourceCost = meshCount * upload_price; } } }
public void Start(IConfigSource config, IRegistryCore registry) { if (!m_enabled) return; m_scheduler = registry.RequestModuleInterface<IScheduleService>(); m_money = registry.RequestModuleInterface<IMoneyModule>(); m_scheduler.Register("CLASSBILL", Classified_Billing); }
private string dotransaction(UUID from, UUID to, int amount, int type, string message) { IClientAPI clientAPI = LocateClient (from); Scene scene = (Scene)clientAPI.Scene; m_MoneyModule = scene.RequestModuleInterface<IMoneyModule> (); m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule> (); if (m_MoneyModule == null) { return "No Money Module Configured"; } bool flag = m_MoneyModule.AmountCovered (from, amount); if (flag) { scene.ProcessMoneyTransferRequest (from, to, amount, type, message); if (m_TransferModule != null) { GridInstantMessage im = new GridInstantMessage( scene, UUID.Zero, "Web Store", from, (byte)InstantMessageDialog.MessageFromAgent, "You made a Web Store purchase your item will be delivered shortly", false, new Vector3()); m_TransferModule.SendInstantMessage (im, delegate(bool success) { }); } m_Database.UpdateTranPaid (transID); return "transaction ok"; } return "Insuficient Funds"; }