/// <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; } } }