diff options
Diffstat (limited to 'InventoryManager.cs')
-rw-r--r-- | InventoryManager.cs | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/InventoryManager.cs b/InventoryManager.cs index 72c9607..17f7f5c 100644 --- a/InventoryManager.cs +++ b/InventoryManager.cs | |||
@@ -38,20 +38,20 @@ namespace OpenSim | |||
38 | /// </summary> | 38 | /// </summary> |
39 | public class InventoryManager | 39 | public class InventoryManager |
40 | { | 40 | { |
41 | private System.Text.Encoding enc = System.Text.Encoding.ASCII; | 41 | |
42 | public Dictionary<LLUUID, InventoryFolder> Folders; | 42 | public Dictionary<LLUUID, InventoryFolder> Folders; |
43 | public Dictionary<LLUUID, InventoryItem> Items; | 43 | public Dictionary<LLUUID, InventoryItem> Items; |
44 | private Server server; | 44 | private Server _server; |
45 | 45 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; | |
46 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | 46 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// | 49 | /// |
50 | /// </summary> | 50 | /// </summary> |
51 | /// <param name="serve"></param> | 51 | /// <param name="serve"></param> |
52 | public InventoryManager(Server serve) | 52 | public InventoryManager(Server server) |
53 | { | 53 | { |
54 | server=serve; | 54 | _server = server; |
55 | Folders=new Dictionary<LLUUID, InventoryFolder>(); | 55 | Folders=new Dictionary<LLUUID, InventoryFolder>(); |
56 | Items=new Dictionary<LLUUID, InventoryItem>(); | 56 | Items=new Dictionary<LLUUID, InventoryItem>(); |
57 | } | 57 | } |
@@ -63,23 +63,23 @@ namespace OpenSim | |||
63 | /// <param name="FolderID"></param> | 63 | /// <param name="FolderID"></param> |
64 | /// <param name="Asset"></param> | 64 | /// <param name="Asset"></param> |
65 | /// <returns></returns> | 65 | /// <returns></returns> |
66 | public LLUUID AddToInventory(User_Agent_info UserInfo, LLUUID FolderID,AssetBase Asset) | 66 | public LLUUID AddToInventory(UserAgentInfo userInfo, LLUUID folderID, AssetBase asset) |
67 | { | 67 | { |
68 | if(this.Folders.ContainsKey(FolderID)) | 68 | if(this.Folders.ContainsKey(folderID)) |
69 | { | 69 | { |
70 | LLUUID NewItemID=LLUUID.Random(); | 70 | LLUUID NewItemID = LLUUID.Random(); |
71 | 71 | ||
72 | InventoryItem Item=new InventoryItem(); | 72 | InventoryItem Item = new InventoryItem(); |
73 | Item.FolderID=FolderID; | 73 | Item.FolderID = folderID; |
74 | Item.OwnerID=UserInfo.AgentID; | 74 | Item.OwnerID = userInfo.AgentID; |
75 | Item.AssetID=Asset.Full_ID; | 75 | Item.AssetID = asset.FullID; |
76 | Item.ItemID=NewItemID; | 76 | Item.ItemID = NewItemID; |
77 | Item.Type=Asset.Type; | 77 | Item.Type = asset.Type; |
78 | Item.Name=Asset.Name; | 78 | Item.Name = asset.Name; |
79 | Item.Description=Asset.Description; | 79 | Item.Description = asset.Description; |
80 | Item.InvType=Asset.InvType; | 80 | Item.InvType = asset.InvType; |
81 | this.Items.Add(Item.ItemID,Item); | 81 | this.Items.Add(Item.ItemID, Item); |
82 | InventoryFolder Folder=Folders[Item.FolderID]; | 82 | InventoryFolder Folder = Folders[Item.FolderID]; |
83 | Folder.Items.Add(Item); | 83 | Folder.Items.Add(Item); |
84 | return(Item.ItemID); | 84 | return(Item.ItemID); |
85 | } | 85 | } |
@@ -95,12 +95,12 @@ namespace OpenSim | |||
95 | /// <param name="UserInfo"></param> | 95 | /// <param name="UserInfo"></param> |
96 | /// <param name="NewFolder"></param> | 96 | /// <param name="NewFolder"></param> |
97 | /// <returns></returns> | 97 | /// <returns></returns> |
98 | public bool CreateNewFolder(User_Agent_info UserInfo, LLUUID NewFolder) | 98 | public bool CreateNewFolder(UserAgentInfo userInfo, LLUUID newFolder) |
99 | { | 99 | { |
100 | InventoryFolder Folder=new InventoryFolder(); | 100 | InventoryFolder Folder = new InventoryFolder(); |
101 | Folder.FolderID=NewFolder; | 101 | Folder.FolderID = newFolder; |
102 | Folder.OwnerID=UserInfo.AgentID; | 102 | Folder.OwnerID = userInfo.AgentID; |
103 | this.Folders.Add(Folder.FolderID,Folder); | 103 | this.Folders.Add(Folder.FolderID, Folder); |
104 | 104 | ||
105 | return(true); | 105 | return(true); |
106 | } | 106 | } |
@@ -110,49 +110,49 @@ namespace OpenSim | |||
110 | /// </summary> | 110 | /// </summary> |
111 | /// <param name="User_info"></param> | 111 | /// <param name="User_info"></param> |
112 | /// <param name="FetchDescend"></param> | 112 | /// <param name="FetchDescend"></param> |
113 | public void FetchInventoryDescendents(User_Agent_info User_info,FetchInventoryDescendentsPacket FetchDescend) | 113 | public void FetchInventoryDescendents(UserAgentInfo userInfo, FetchInventoryDescendentsPacket FetchDescend) |
114 | { | 114 | { |
115 | if(FetchDescend.InventoryData.FetchItems) | 115 | if(FetchDescend.InventoryData.FetchItems) |
116 | { | 116 | { |
117 | if(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID)) | 117 | if(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID)) |
118 | { | 118 | { |
119 | 119 | ||
120 | InventoryFolder Folder=this.Folders[FetchDescend.InventoryData.FolderID]; | 120 | InventoryFolder Folder = this.Folders[FetchDescend.InventoryData.FolderID]; |
121 | InventoryDescendentsPacket Descend=new InventoryDescendentsPacket(); | 121 | InventoryDescendentsPacket Descend = new InventoryDescendentsPacket(); |
122 | Descend.AgentData.AgentID=User_info.AgentID; | 122 | Descend.AgentData.AgentID = userInfo.AgentID; |
123 | Descend.AgentData.OwnerID=Folder.OwnerID; | 123 | Descend.AgentData.OwnerID = Folder.OwnerID; |
124 | Descend.AgentData.FolderID=FetchDescend.InventoryData.FolderID; | 124 | Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID; |
125 | Descend.AgentData.Descendents=Folder.Items.Count; | 125 | Descend.AgentData.Descendents = Folder.Items.Count; |
126 | Descend.AgentData.Version=Folder.Items.Count; | 126 | Descend.AgentData.Version = Folder.Items.Count; |
127 | 127 | ||
128 | Descend.ItemData=new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; | 128 | Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; |
129 | for(int i=0; i<Folder.Items.Count ; i++) | 129 | for(int i = 0; i < Folder.Items.Count ; i++) |
130 | { | 130 | { |
131 | 131 | ||
132 | InventoryItem Item=Folder.Items[i]; | 132 | InventoryItem Item=Folder.Items[i]; |
133 | Descend.ItemData[i]=new InventoryDescendentsPacket.ItemDataBlock(); | 133 | Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); |
134 | Descend.ItemData[i].ItemID=Item.ItemID; | 134 | Descend.ItemData[i].ItemID = Item.ItemID; |
135 | Descend.ItemData[i].AssetID=Item.AssetID; | 135 | Descend.ItemData[i].AssetID = Item.AssetID; |
136 | Descend.ItemData[i].CreatorID=Item.CreatorID; | 136 | Descend.ItemData[i].CreatorID = Item.CreatorID; |
137 | Descend.ItemData[i].BaseMask=FULL_MASK_PERMISSIONS; | 137 | Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; |
138 | Descend.ItemData[i].CreationDate=1000; | 138 | Descend.ItemData[i].CreationDate = 1000; |
139 | Descend.ItemData[i].Description=enc.GetBytes(Item.Description+"\0"); | 139 | Descend.ItemData[i].Description = _enc.GetBytes(Item.Description+"\0"); |
140 | Descend.ItemData[i].EveryoneMask=FULL_MASK_PERMISSIONS; | 140 | Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; |
141 | Descend.ItemData[i].Flags=1; | 141 | Descend.ItemData[i].Flags = 1; |
142 | Descend.ItemData[i].FolderID=Item.FolderID; | 142 | Descend.ItemData[i].FolderID = Item.FolderID; |
143 | Descend.ItemData[i].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000"); | 143 | Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
144 | Descend.ItemData[i].GroupMask=FULL_MASK_PERMISSIONS; | 144 | Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; |
145 | Descend.ItemData[i].InvType=Item.InvType; | 145 | Descend.ItemData[i].InvType = Item.InvType; |
146 | Descend.ItemData[i].Name=enc.GetBytes(Item.Name+"\0"); | 146 | Descend.ItemData[i].Name = _enc.GetBytes(Item.Name+"\0"); |
147 | Descend.ItemData[i].NextOwnerMask=FULL_MASK_PERMISSIONS; | 147 | Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; |
148 | Descend.ItemData[i].OwnerID=Item.OwnerID; | 148 | Descend.ItemData[i].OwnerID = Item.OwnerID; |
149 | Descend.ItemData[i].OwnerMask=FULL_MASK_PERMISSIONS; | 149 | Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; |
150 | Descend.ItemData[i].SalePrice=100; | 150 | Descend.ItemData[i].SalePrice = 100; |
151 | Descend.ItemData[i].SaleType=0; | 151 | Descend.ItemData[i].SaleType = 0; |
152 | Descend.ItemData[i].Type=Item.Type; | 152 | Descend.ItemData[i].Type = Item.Type; |
153 | Descend.ItemData[i].CRC=libsecondlife.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); | 153 | Descend.ItemData[i].CRC=libsecondlife.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); |
154 | } | 154 | } |
155 | server.SendPacket(Descend,true,User_info); | 155 | _server.SendPacket(Descend, true, userInfo); |
156 | 156 | ||
157 | } | 157 | } |
158 | } | 158 | } |
@@ -166,40 +166,40 @@ namespace OpenSim | |||
166 | /// | 166 | /// |
167 | /// </summary> | 167 | /// </summary> |
168 | /// <param name="User_info"></param> | 168 | /// <param name="User_info"></param> |
169 | public void FetchInventory(User_Agent_info User_info, FetchInventoryPacket FetchItems) | 169 | public void FetchInventory(UserAgentInfo userInfo, FetchInventoryPacket FetchItems) |
170 | { | 170 | { |
171 | 171 | ||
172 | for(int i=0; i<FetchItems.InventoryData.Length; i++) | 172 | for(int i = 0; i < FetchItems.InventoryData.Length; i++) |
173 | { | 173 | { |
174 | if(this.Items.ContainsKey(FetchItems.InventoryData[i].ItemID)) | 174 | if(this.Items.ContainsKey(FetchItems.InventoryData[i].ItemID)) |
175 | { | 175 | { |
176 | 176 | ||
177 | InventoryItem Item=Items[FetchItems.InventoryData[i].ItemID]; | 177 | InventoryItem Item = Items[FetchItems.InventoryData[i].ItemID]; |
178 | FetchInventoryReplyPacket InventoryReply=new FetchInventoryReplyPacket(); | 178 | FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket(); |
179 | InventoryReply.AgentData.AgentID=User_info.AgentID; | 179 | InventoryReply.AgentData.AgentID = userInfo.AgentID; |
180 | InventoryReply.InventoryData=new FetchInventoryReplyPacket.InventoryDataBlock[1]; | 180 | InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; |
181 | InventoryReply.InventoryData[0]=new FetchInventoryReplyPacket.InventoryDataBlock(); | 181 | InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); |
182 | InventoryReply.InventoryData[0].ItemID=Item.ItemID; | 182 | InventoryReply.InventoryData[0].ItemID = Item.ItemID; |
183 | InventoryReply.InventoryData[0].AssetID=Item.AssetID; | 183 | InventoryReply.InventoryData[0].AssetID = Item.AssetID; |
184 | InventoryReply.InventoryData[0].CreatorID=Item.CreatorID; | 184 | InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; |
185 | InventoryReply.InventoryData[0].BaseMask=FULL_MASK_PERMISSIONS; | 185 | InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; |
186 | InventoryReply.InventoryData[0].CreationDate=1000; | 186 | InventoryReply.InventoryData[0].CreationDate = 1000; |
187 | InventoryReply.InventoryData[0].Description=enc.GetBytes( Item.Description+"\0"); | 187 | InventoryReply.InventoryData[0].Description = _enc.GetBytes( Item.Description+"\0"); |
188 | InventoryReply.InventoryData[0].EveryoneMask=FULL_MASK_PERMISSIONS; | 188 | InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; |
189 | InventoryReply.InventoryData[0].Flags=1; | 189 | InventoryReply.InventoryData[0].Flags = 1; |
190 | InventoryReply.InventoryData[0].FolderID=Item.FolderID; | 190 | InventoryReply.InventoryData[0].FolderID = Item.FolderID; |
191 | InventoryReply.InventoryData[0].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000"); | 191 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
192 | InventoryReply.InventoryData[0].GroupMask=FULL_MASK_PERMISSIONS; | 192 | InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; |
193 | InventoryReply.InventoryData[0].InvType=Item.InvType; | 193 | InventoryReply.InventoryData[0].InvType = Item.InvType; |
194 | InventoryReply.InventoryData[0].Name=enc.GetBytes(Item.Name+"\0"); | 194 | InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name+"\0"); |
195 | InventoryReply.InventoryData[0].NextOwnerMask=FULL_MASK_PERMISSIONS; | 195 | InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; |
196 | InventoryReply.InventoryData[0].OwnerID=Item.OwnerID; | 196 | InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; |
197 | InventoryReply.InventoryData[0].OwnerMask=FULL_MASK_PERMISSIONS; | 197 | InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; |
198 | InventoryReply.InventoryData[0].SalePrice=100; | 198 | InventoryReply.InventoryData[0].SalePrice = 100; |
199 | InventoryReply.InventoryData[0].SaleType=0; | 199 | InventoryReply.InventoryData[0].SaleType = 0; |
200 | InventoryReply.InventoryData[0].Type=Item.Type; | 200 | InventoryReply.InventoryData[0].Type = Item.Type; |
201 | InventoryReply.InventoryData[0].CRC=libsecondlife.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); | 201 | InventoryReply.InventoryData[0].CRC = libsecondlife.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); |
202 | server.SendPacket(InventoryReply,true,User_info); | 202 | _server.SendPacket(InventoryReply, true, userInfo); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
@@ -217,7 +217,7 @@ namespace OpenSim | |||
217 | 217 | ||
218 | public InventoryFolder() | 218 | public InventoryFolder() |
219 | { | 219 | { |
220 | Items=new List<InventoryItem>(); | 220 | Items = new List<InventoryItem>(); |
221 | } | 221 | } |
222 | 222 | ||
223 | } | 223 | } |
@@ -228,7 +228,7 @@ namespace OpenSim | |||
228 | public LLUUID OwnerID; | 228 | public LLUUID OwnerID; |
229 | public LLUUID ItemID; | 229 | public LLUUID ItemID; |
230 | public LLUUID AssetID; | 230 | public LLUUID AssetID; |
231 | public LLUUID CreatorID=LLUUID.Zero; | 231 | public LLUUID CreatorID = LLUUID.Zero; |
232 | public sbyte InvType; | 232 | public sbyte InvType; |
233 | public sbyte Type; | 233 | public sbyte Type; |
234 | public string Name; | 234 | public string Name; |