aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs175
1 files changed, 0 insertions, 175 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs
deleted file mode 100644
index c5f8921..0000000
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs
+++ /dev/null
@@ -1,175 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using log4net;
30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Services.Interfaces;
37
38namespace OpenSim.Region.Framework.Scenes.Hypergrid
39{
40 public partial class HGScene : Scene
41 {
42 #region Fields
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
45 private HGAssetMapper m_assMapper;
46 public HGAssetMapper AssetMapper
47 {
48 get { return m_assMapper; }
49 }
50
51 private IHyperAssetService m_hyper;
52 private IHyperAssetService HyperAssets
53 {
54 get
55 {
56 if (m_hyper == null)
57 m_hyper = RequestModuleInterface<IHyperAssetService>();
58 return m_hyper;
59 }
60 }
61
62 #endregion
63
64 #region Constructors
65
66 public HGScene(RegionInfo regInfo, AgentCircuitManager authen,
67 SceneCommunicationService sceneGridService,
68 StorageManager storeManager,
69 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
70 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
71 : base(regInfo, authen, sceneGridService, storeManager, moduleLoader,
72 dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion)
73 {
74 m_log.Info("[HGScene]: Starting HGScene.");
75 m_assMapper = new HGAssetMapper(this);
76
77 EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
78 }
79
80 #endregion
81
82 #region Event handlers
83
84 public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel)
85 {
86 UserAccount userInfo = UserAccountService.GetUserAccount(RegionInfo.ScopeID, avatarID);
87 if (userInfo != null)
88 {
89 m_assMapper.Post(assetID, avatarID);
90 }
91 }
92
93 #endregion
94
95 #region Overrides of Scene.Inventory methods
96
97 ///
98 /// CapsUpdateInventoryItemAsset
99 ///
100 public override UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
101 {
102 UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data);
103
104 UploadInventoryItem(remoteClient.AgentId, newAssetID, "", 0);
105
106 return newAssetID;
107 }
108
109 ///
110 /// DeleteToInventory
111 ///
112 public override UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient)
113 {
114 UUID assetID = base.DeleteToInventory(action, folderID, objectGroup, remoteClient);
115
116 if (!assetID.Equals(UUID.Zero))
117 {
118 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
119 }
120 else
121 m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
122
123 return assetID;
124 }
125
126 ///
127 /// RezObject
128 ///
129 public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
130 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
131 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
132 {
133 m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID);
134
135 //if (fromTaskID.Equals(UUID.Zero))
136 //{
137 InventoryItemBase item = new InventoryItemBase(itemID);
138 item.Owner = remoteClient.AgentId;
139 item = InventoryService.GetItem(item);
140 //if (item == null)
141 //{ // Fetch the item
142 // item = new InventoryItemBase();
143 // item.Owner = remoteClient.AgentId;
144 // item.ID = itemID;
145 // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
146 //}
147 if (item != null)
148 {
149 m_assMapper.Get(item.AssetID, remoteClient.AgentId);
150
151 }
152 //}
153
154 // OK, we're done fetching. Pass it up to the default RezObject
155 return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
156 RezSelected, RemoveItem, fromTaskID, attachment);
157
158 }
159
160 protected override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
161 {
162 string userAssetServer = HyperAssets.GetUserAssetServer(sender);
163 if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer()))
164 m_assMapper.Get(item.AssetID, sender);
165
166 userAssetServer = HyperAssets.GetUserAssetServer(receiver);
167 if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer()))
168 m_assMapper.Post(item.AssetID, receiver);
169 }
170
171 #endregion
172
173 }
174
175}