diff options
author | UbitUmarov | 2012-09-11 23:06:29 +0100 |
---|---|---|
committer | UbitUmarov | 2012-09-11 23:06:29 +0100 |
commit | 013e94af5d45a7c99e46e01d9c5965a79ac1b231 (patch) | |
tree | 86e1a03119734a7a6d0511ccbff90de385478738 /OpenSim/Region/ClientStack/Linden | |
parent | let LLSDAssetUploadRequest include asset_resources information plus let (diff) | |
download | opensim-SC_OLD-013e94af5d45a7c99e46e01d9c5965a79ac1b231.zip opensim-SC_OLD-013e94af5d45a7c99e46e01d9c5965a79ac1b231.tar.gz opensim-SC_OLD-013e94af5d45a7c99e46e01d9c5965a79ac1b231.tar.bz2 opensim-SC_OLD-013e94af5d45a7c99e46e01d9c5965a79ac1b231.tar.xz |
report mesh upload costs ( fake values)
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index df43991..90ac8ce 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -463,7 +463,26 @@ namespace OpenSim.Region.ClientStack.Linden | |||
463 | if (mm != null) | 463 | if (mm != null) |
464 | { | 464 | { |
465 | // XPTO: The cost should be calculated about here | 465 | // XPTO: The cost should be calculated about here |
466 | cost = (uint)mm.UploadCharge; | 466 | |
467 | if (llsdRequest.asset_type == "mesh") | ||
468 | { | ||
469 | if (llsdRequest.asset_resources == null) | ||
470 | { | ||
471 | client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); | ||
472 | |||
473 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | ||
474 | errorResponse.uploader = ""; | ||
475 | errorResponse.state = "error"; | ||
476 | return errorResponse; | ||
477 | } | ||
478 | |||
479 | uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; | ||
480 | textures_cost *= (uint)mm.UploadCharge; | ||
481 | |||
482 | cost = textures_cost; | ||
483 | } | ||
484 | else | ||
485 | cost = (uint)mm.UploadCharge; | ||
467 | 486 | ||
468 | if (!mm.UploadCovered(client.AgentId, (int)cost)) | 487 | if (!mm.UploadCovered(client.AgentId, (int)cost)) |
469 | { | 488 | { |
@@ -486,9 +505,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
486 | UUID parentFolder = llsdRequest.folder_id; | 505 | UUID parentFolder = llsdRequest.folder_id; |
487 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 506 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
488 | 507 | ||
508 | uint uploadCost = cost; | ||
509 | // don't charge for meshs until we done them | ||
510 | if (llsdRequest.asset_type == "mesh") | ||
511 | uploadCost = 0; | ||
512 | |||
489 | AssetUploaderWithCost uploader = | 513 | AssetUploaderWithCost uploader = |
490 | new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 514 | new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
491 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); | 515 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, uploadCost); |
492 | 516 | ||
493 | m_HostCapsObj.HttpListener.AddStreamHandler( | 517 | m_HostCapsObj.HttpListener.AddStreamHandler( |
494 | new BinaryStreamHandler( | 518 | new BinaryStreamHandler( |
@@ -506,11 +530,31 @@ namespace OpenSim.Region.ClientStack.Linden | |||
506 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + | 530 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + |
507 | uploaderPath; | 531 | uploaderPath; |
508 | 532 | ||
533 | |||
509 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | 534 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); |
510 | uploadResponse.uploader = uploaderURL; | 535 | uploadResponse.uploader = uploaderURL; |
511 | uploadResponse.state = "upload"; | 536 | uploadResponse.state = "upload"; |
537 | uploadResponse.upload_price = (int)cost; | ||
538 | |||
539 | // use fake values for now | ||
540 | if (llsdRequest.asset_type == "mesh") | ||
541 | { | ||
542 | uploadResponse.data = new LLSDAssetUploadResponseData(); | ||
543 | uploadResponse.data.model_streaming_cost = 1.0; | ||
544 | uploadResponse.data.simulation_cost = 1.5; | ||
545 | |||
546 | uploadResponse.data.physics_cost = 2.0; | ||
547 | uploadResponse.data.resource_cost = 3.0; | ||
548 | uploadResponse.data.upload_price_breakdown.mesh_instance = 1; | ||
549 | uploadResponse.data.upload_price_breakdown.mesh_physics = 2; | ||
550 | uploadResponse.data.upload_price_breakdown.mesh_streaming = 3; | ||
551 | uploadResponse.data.upload_price_breakdown.texture = 5; | ||
552 | uploadResponse.data.upload_price_breakdown.model = 4; | ||
553 | } | ||
554 | |||
512 | uploader.OnUpLoad += UploadCompleteHandler; | 555 | uploader.OnUpLoad += UploadCompleteHandler; |
513 | return uploadResponse; | 556 | return uploadResponse; |
557 | |||
514 | } | 558 | } |
515 | 559 | ||
516 | /// <summary> | 560 | /// <summary> |