aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Assets
diff options
context:
space:
mode:
authorSean Dague2007-07-16 15:40:11 +0000
committerSean Dague2007-07-16 15:40:11 +0000
commit2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch)
treee3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/ClientStack/Assets
parent*Trunk compiles now (diff)
downloadopensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Region/ClientStack/Assets')
-rw-r--r--OpenSim/Region/ClientStack/Assets/InventoryCache.cs676
1 files changed, 338 insertions, 338 deletions
diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
index e2cfa46..1bb6c07 100644
--- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
+++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
@@ -1,338 +1,338 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets; 33using libsecondlife.Packets;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Inventory; 35using OpenSim.Framework.Inventory;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Region.ClientStack; 37using OpenSim.Region.ClientStack;
38 38
39namespace OpenSim.Assets 39namespace OpenSim.Assets
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// Description of InventoryManager. 42 /// Description of InventoryManager.
43 /// </summary> 43 /// </summary>
44 public class InventoryCache 44 public class InventoryCache
45 { 45 {
46 private Dictionary<LLUUID, AgentInventory> _agentsInventory; 46 private Dictionary<LLUUID, AgentInventory> _agentsInventory;
47 private List<UserServerRequest> _serverRequests; //list of requests made to user server. 47 private List<UserServerRequest> _serverRequests; //list of requests made to user server.
48 private Encoding _enc = Encoding.ASCII; 48 private Encoding _enc = Encoding.ASCII;
49 private const uint FULL_MASK_PERMISSIONS = 2147483647; 49 private const uint FULL_MASK_PERMISSIONS = 2147483647;
50 50
51 public InventoryCache() 51 public InventoryCache()
52 { 52 {
53 _agentsInventory = new Dictionary<LLUUID, AgentInventory>(); 53 _agentsInventory = new Dictionary<LLUUID, AgentInventory>();
54 _serverRequests = new List<UserServerRequest>(); 54 _serverRequests = new List<UserServerRequest>();
55 } 55 }
56 56
57 public void AddNewAgentsInventory(AgentInventory agentInventory) 57 public void AddNewAgentsInventory(AgentInventory agentInventory)
58 { 58 {
59 if (!this._agentsInventory.ContainsKey(agentInventory.AgentID)) 59 if (!this._agentsInventory.ContainsKey(agentInventory.AgentID))
60 { 60 {
61 this._agentsInventory.Add(agentInventory.AgentID, agentInventory); 61 this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
62 } 62 }
63 } 63 }
64 64
65 public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver) 65 public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver)
66 { 66 {
67 AgentInventory res = null; 67 AgentInventory res = null;
68 if (!this._agentsInventory.ContainsKey(agentID)) 68 if (!this._agentsInventory.ContainsKey(agentID))
69 { 69 {
70 res = userserver.RequestAgentsInventory(agentID); 70 res = userserver.RequestAgentsInventory(agentID);
71 this._agentsInventory.Add(agentID,res); 71 this._agentsInventory.Add(agentID,res);
72 } 72 }
73 return res; 73 return res;
74 } 74 }
75 75
76 public AgentInventory GetAgentsInventory(LLUUID agentID) 76 public AgentInventory GetAgentsInventory(LLUUID agentID)
77 { 77 {
78 if (this._agentsInventory.ContainsKey(agentID)) 78 if (this._agentsInventory.ContainsKey(agentID))
79 { 79 {
80 return this._agentsInventory[agentID]; 80 return this._agentsInventory[agentID];
81 } 81 }
82 82
83 return null; 83 return null;
84 } 84 }
85 85
86 public void ClientLeaving(LLUUID clientID, IUserServer userserver) 86 public void ClientLeaving(LLUUID clientID, IUserServer userserver)
87 { 87 {
88 if (this._agentsInventory.ContainsKey(clientID)) 88 if (this._agentsInventory.ContainsKey(clientID))
89 { 89 {
90 if (userserver != null) 90 if (userserver != null)
91 { 91 {
92 userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]); 92 userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]);
93 } 93 }
94 this._agentsInventory.Remove(clientID); 94 this._agentsInventory.Remove(clientID);
95 } 95 }
96 } 96 }
97 97
98 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID) 98 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID)
99 { 99 {
100 return this.CreateNewInventoryFolder(remoteClient, folderID, 0); 100 return this.CreateNewInventoryFolder(remoteClient, folderID, 0);
101 } 101 }
102 102
103 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type) 103 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type)
104 { 104 {
105 bool res = false; 105 bool res = false;
106 if (folderID != LLUUID.Zero) //don't create a folder with a zero id 106 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
107 { 107 {
108 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 108 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
109 { 109 {
110 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type); 110 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type);
111 } 111 }
112 } 112 }
113 return res; 113 return res;
114 } 114 }
115 115
116 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent) 116 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent)
117 { 117 {
118 bool res = false; 118 bool res = false;
119 if (folderID != LLUUID.Zero) //don't create a folder with a zero id 119 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
120 { 120 {
121 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 121 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
122 { 122 {
123 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent); 123 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent);
124 } 124 }
125 } 125 }
126 return res; 126 return res;
127 } 127 }
128 128
129 public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, AssetBase asset) 129 public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, AssetBase asset)
130 { 130 {
131 LLUUID newItem = null; 131 LLUUID newItem = null;
132 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 132 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
133 { 133 {
134 newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset); 134 newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset);
135 if (newItem != null) 135 if (newItem != null)
136 { 136 {
137 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem]; 137 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem];
138 this.SendItemUpdateCreate(remoteClient, Item); 138 this.SendItemUpdateCreate(remoteClient, Item);
139 } 139 }
140 } 140 }
141 141
142 return newItem; 142 return newItem;
143 } 143 }
144 public bool DeleteInventoryItem(ClientView remoteClient, LLUUID itemID) 144 public bool DeleteInventoryItem(ClientView remoteClient, LLUUID itemID)
145 { 145 {
146 bool res = false; 146 bool res = false;
147 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 147 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
148 { 148 {
149 res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID); 149 res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID);
150 if (res) 150 if (res)
151 { 151 {
152 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); 152 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
153 remove.AgentData.AgentID = remoteClient.AgentID; 153 remove.AgentData.AgentID = remoteClient.AgentID;
154 remove.AgentData.SessionID = remoteClient.SessionID; 154 remove.AgentData.SessionID = remoteClient.SessionID;
155 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; 155 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
156 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); 156 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
157 remove.InventoryData[0].ItemID = itemID; 157 remove.InventoryData[0].ItemID = itemID;
158 remoteClient.OutPacket(remove); 158 remoteClient.OutPacket(remove);
159 } 159 }
160 } 160 }
161 161
162 return res; 162 return res;
163 } 163 }
164 164
165 public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, AssetBase asset) 165 public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, AssetBase asset)
166 { 166 {
167 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 167 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
168 { 168 {
169 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset); 169 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset);
170 if (res) 170 if (res)
171 { 171 {
172 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; 172 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID];
173 this.SendItemUpdateCreate(remoteClient, Item); 173 this.SendItemUpdateCreate(remoteClient, Item);
174 } 174 }
175 return res; 175 return res;
176 } 176 }
177 177
178 return false; 178 return false;
179 } 179 }
180 180
181 public bool UpdateInventoryItemDetails(ClientView remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) 181 public bool UpdateInventoryItemDetails(ClientView remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
182 { 182 {
183 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 183 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
184 { 184 {
185 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet); 185 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet);
186 if (res) 186 if (res)
187 { 187 {
188 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; 188 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID];
189 this.SendItemUpdateCreate(remoteClient, Item); 189 this.SendItemUpdateCreate(remoteClient, Item);
190 } 190 }
191 return res; 191 return res;
192 } 192 }
193 193
194 return false; 194 return false;
195 } 195 }
196 196
197 public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend) 197 public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend)
198 { 198 {
199 199
200 if (this._agentsInventory.ContainsKey(userInfo.AgentID)) 200 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
201 { 201 {
202 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; 202 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
203 if (FetchDescend.InventoryData.FetchItems) 203 if (FetchDescend.InventoryData.FetchItems)
204 { 204 {
205 if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID)) 205 if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID))
206 { 206 {
207 InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID]; 207 InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID];
208 InventoryDescendentsPacket Descend = new InventoryDescendentsPacket(); 208 InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
209 Descend.AgentData.AgentID = userInfo.AgentID; 209 Descend.AgentData.AgentID = userInfo.AgentID;
210 Descend.AgentData.OwnerID = Folder.OwnerID; 210 Descend.AgentData.OwnerID = Folder.OwnerID;
211 Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID; 211 Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
212 Descend.AgentData.Descendents = Folder.Items.Count; 212 Descend.AgentData.Descendents = Folder.Items.Count;
213 Descend.AgentData.Version = Folder.Items.Count; 213 Descend.AgentData.Version = Folder.Items.Count;
214 214
215 215
216 Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; 216 Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
217 for (int i = 0; i < Folder.Items.Count; i++) 217 for (int i = 0; i < Folder.Items.Count; i++)
218 { 218 {
219 219
220 InventoryItem Item = Folder.Items[i]; 220 InventoryItem Item = Folder.Items[i];
221 Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); 221 Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
222 Descend.ItemData[i].ItemID = Item.ItemID; 222 Descend.ItemData[i].ItemID = Item.ItemID;
223 Descend.ItemData[i].AssetID = Item.AssetID; 223 Descend.ItemData[i].AssetID = Item.AssetID;
224 Descend.ItemData[i].CreatorID = Item.CreatorID; 224 Descend.ItemData[i].CreatorID = Item.CreatorID;
225 Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; 225 Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
226 Descend.ItemData[i].CreationDate = 1000; 226 Descend.ItemData[i].CreationDate = 1000;
227 Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0"); 227 Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0");
228 Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; 228 Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
229 Descend.ItemData[i].Flags = 1; 229 Descend.ItemData[i].Flags = 1;
230 Descend.ItemData[i].FolderID = Item.FolderID; 230 Descend.ItemData[i].FolderID = Item.FolderID;
231 Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 231 Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
232 Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; 232 Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
233 Descend.ItemData[i].InvType = Item.InvType; 233 Descend.ItemData[i].InvType = Item.InvType;
234 Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0"); 234 Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0");
235 Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; 235 Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
236 Descend.ItemData[i].OwnerID = Item.OwnerID; 236 Descend.ItemData[i].OwnerID = Item.OwnerID;
237 Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; 237 Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
238 Descend.ItemData[i].SalePrice = 100; 238 Descend.ItemData[i].SalePrice = 100;
239 Descend.ItemData[i].SaleType = 0; 239 Descend.ItemData[i].SaleType = 0;
240 Descend.ItemData[i].Type = Item.Type; 240 Descend.ItemData[i].Type = Item.Type;
241 Descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 241 Descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
242 } 242 }
243 243
244 userInfo.OutPacket(Descend); 244 userInfo.OutPacket(Descend);
245 245
246 } 246 }
247 } 247 }
248 else 248 else
249 { 249 {
250 Console.WriteLine("fetch subfolders"); 250 Console.WriteLine("fetch subfolders");
251 } 251 }
252 } 252 }
253 } 253 }
254 254
255 public void FetchInventory(ClientView userInfo, FetchInventoryPacket FetchItems) 255 public void FetchInventory(ClientView userInfo, FetchInventoryPacket FetchItems)
256 { 256 {
257 if (this._agentsInventory.ContainsKey(userInfo.AgentID)) 257 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
258 { 258 {
259 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; 259 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
260 260
261 for (int i = 0; i < FetchItems.InventoryData.Length; i++) 261 for (int i = 0; i < FetchItems.InventoryData.Length; i++)
262 { 262 {
263 if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID)) 263 if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID))
264 { 264 {
265 InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID]; 265 InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID];
266 FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket(); 266 FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
267 InventoryReply.AgentData.AgentID = userInfo.AgentID; 267 InventoryReply.AgentData.AgentID = userInfo.AgentID;
268 InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; 268 InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
269 InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); 269 InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
270 InventoryReply.InventoryData[0].ItemID = Item.ItemID; 270 InventoryReply.InventoryData[0].ItemID = Item.ItemID;
271 InventoryReply.InventoryData[0].AssetID = Item.AssetID; 271 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
272 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; 272 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
273 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; 273 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
274 InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 274 InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
275 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); 275 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
276 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; 276 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
277 InventoryReply.InventoryData[0].Flags = 0; 277 InventoryReply.InventoryData[0].Flags = 0;
278 InventoryReply.InventoryData[0].FolderID = Item.FolderID; 278 InventoryReply.InventoryData[0].FolderID = Item.FolderID;
279 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 279 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
280 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; 280 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
281 InventoryReply.InventoryData[0].InvType = Item.InvType; 281 InventoryReply.InventoryData[0].InvType = Item.InvType;
282 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); 282 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
283 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; 283 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
284 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; 284 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
285 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; 285 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
286 InventoryReply.InventoryData[0].SalePrice = 100; 286 InventoryReply.InventoryData[0].SalePrice = 100;
287 InventoryReply.InventoryData[0].SaleType = 0; 287 InventoryReply.InventoryData[0].SaleType = 0;
288 InventoryReply.InventoryData[0].Type = Item.Type; 288 InventoryReply.InventoryData[0].Type = Item.Type;
289 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 289 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
290 userInfo.OutPacket(InventoryReply); 290 userInfo.OutPacket(InventoryReply);
291 } 291 }
292 } 292 }
293 } 293 }
294 } 294 }
295 295
296 private void SendItemUpdateCreate(ClientView remoteClient, InventoryItem Item) 296 private void SendItemUpdateCreate(ClientView remoteClient, InventoryItem Item)
297 { 297 {
298 298
299 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); 299 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
300 InventoryReply.AgentData.AgentID = remoteClient.AgentID; 300 InventoryReply.AgentData.AgentID = remoteClient.AgentID;
301 InventoryReply.AgentData.SimApproved = true; 301 InventoryReply.AgentData.SimApproved = true;
302 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; 302 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
303 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); 303 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
304 InventoryReply.InventoryData[0].ItemID = Item.ItemID; 304 InventoryReply.InventoryData[0].ItemID = Item.ItemID;
305 InventoryReply.InventoryData[0].AssetID = Item.AssetID; 305 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
306 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; 306 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
307 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; 307 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
308 InventoryReply.InventoryData[0].CreationDate = 1000; 308 InventoryReply.InventoryData[0].CreationDate = 1000;
309 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); 309 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
310 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; 310 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
311 InventoryReply.InventoryData[0].Flags = 0; 311 InventoryReply.InventoryData[0].Flags = 0;
312 InventoryReply.InventoryData[0].FolderID = Item.FolderID; 312 InventoryReply.InventoryData[0].FolderID = Item.FolderID;
313 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 313 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
314 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; 314 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
315 InventoryReply.InventoryData[0].InvType = Item.InvType; 315 InventoryReply.InventoryData[0].InvType = Item.InvType;
316 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); 316 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
317 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; 317 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
318 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; 318 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
319 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; 319 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
320 InventoryReply.InventoryData[0].SalePrice = 100; 320 InventoryReply.InventoryData[0].SalePrice = 100;
321 InventoryReply.InventoryData[0].SaleType = 0; 321 InventoryReply.InventoryData[0].SaleType = 0;
322 InventoryReply.InventoryData[0].Type = Item.Type; 322 InventoryReply.InventoryData[0].Type = Item.Type;
323 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 323 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
324 324
325 remoteClient.OutPacket(InventoryReply); 325 remoteClient.OutPacket(InventoryReply);
326 } 326 }
327 } 327 }
328 328
329 329
330 330
331 public class UserServerRequest 331 public class UserServerRequest
332 { 332 {
333 public UserServerRequest() 333 public UserServerRequest()
334 { 334 {
335 335
336 } 336 }
337 } 337 }
338} 338}