aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Agent_Manager.cs52
-rw-r--r--AssetManagement.cs460
-rw-r--r--Asset_manager.cs73
-rw-r--r--Controller.cs89
-rw-r--r--Globals.cs3
-rw-r--r--GridManager.cs2
-rw-r--r--InventoryManager.cs240
-rw-r--r--Login_manager.cs77
-rw-r--r--Physics_manager.cs4
-rw-r--r--Prim_manager.cs4
-rw-r--r--SceneGraphManager.cs40
-rw-r--r--Script_manager.cs4
-rw-r--r--Second-server.csproj5
-rw-r--r--StorageManager.cs4
-rw-r--r--Texture_manager.cs11
-rw-r--r--bin/Release/new-login.dat2
16 files changed, 965 insertions, 105 deletions
diff --git a/Agent_Manager.cs b/Agent_Manager.cs
index 9aa8d7f..2f5ceba 100644
--- a/Agent_Manager.cs
+++ b/Agent_Manager.cs
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3* 3*
4* Redistribution and use in source and binary forms, with or without 4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met: 5* modification, are permitted provided that the following conditions are met:
@@ -44,6 +44,7 @@ namespace OpenSim
44 private uint local_numer=0; 44 private uint local_numer=0;
45 private Server server; 45 private Server server;
46 public PrimManager Prim_Manager; 46 public PrimManager Prim_Manager;
47 public AssetManagement Asset_Manager;
47 48
48 private libsecondlife.Packets.RegionHandshakePacket RegionPacket; 49 private libsecondlife.Packets.RegionHandshakePacket RegionPacket;
49 private System.Text.Encoding enc = System.Text.Encoding.ASCII; 50 private System.Text.Encoding enc = System.Text.Encoding.ASCII;
@@ -101,7 +102,7 @@ namespace OpenSim
101 /// <param name="first"></param> 102 /// <param name="first"></param>
102 /// <param name="last"></param> 103 /// <param name="last"></param>
103 /// <returns></returns> 104 /// <returns></returns>
104 public bool NewAgent(User_Agent_info User_info, string first, string last) 105 public bool NewAgent(User_Agent_info User_info, string first, string last ,LLUUID BaseFolder,LLUUID InventoryFolder)
105 { 106 {
106 AvatarData agent=new AvatarData(); 107 AvatarData agent=new AvatarData();
107 agent.FullID=User_info.AgentID; 108 agent.FullID=User_info.AgentID;
@@ -109,7 +110,13 @@ namespace OpenSim
109 agent.NetInfo.first_name=first; 110 agent.NetInfo.first_name=first;
110 agent.NetInfo.last_name=last; 111 agent.NetInfo.last_name=last;
111 agent.Position=new LLVector3(100,100,22); 112 agent.Position=new LLVector3(100,100,22);
113 agent.BaseFolder=BaseFolder;
114 agent.InventoryFolder=InventoryFolder;
112 this.AgentList.Add(agent.FullID,agent); 115 this.AgentList.Add(agent.FullID,agent);
116
117 //Create new Wearable Assets and place in Inventory
118 this.Asset_Manager.CreateNewInventorySet(ref agent,User_info);
119
113 return(true); 120 return(true);
114 } 121 }
115 122
@@ -343,29 +350,27 @@ namespace OpenSim
343 /// <param name="user"></param> 350 /// <param name="user"></param>
344 public void SendIntialAvatarAppearance(User_Agent_info user) 351 public void SendIntialAvatarAppearance(User_Agent_info user)
345 { 352 {
346 353 AvatarData Agent=this.AgentList[user.AgentID];
347 AgentWearablesUpdatePacket aw=new AgentWearablesUpdatePacket(); 354 AgentWearablesUpdatePacket aw=new AgentWearablesUpdatePacket();
348 aw.AgentData.AgentID=user.AgentID; 355 aw.AgentData.AgentID=user.AgentID;
349 aw.AgentData.SerialNum=0;//(uint)appc; 356 aw.AgentData.SerialNum=0;
350 //appc++; 357 aw.AgentData.SessionID=user.SessionID;
351 aw.AgentData.SessionID=user.SessionID;//new LLUUID("00000000-0000-0000-0000-000000000000");//user.SessionID;
352 358
353 aw.WearableData= new AgentWearablesUpdatePacket.WearableDataBlock[13]; 359 aw.WearableData= new AgentWearablesUpdatePacket.WearableDataBlock[13];
354 AgentWearablesUpdatePacket.WearableDataBlock awb=null; 360 AgentWearablesUpdatePacket.WearableDataBlock awb=null;
355 awb=new AgentWearablesUpdatePacket.WearableDataBlock(); 361 awb=new AgentWearablesUpdatePacket.WearableDataBlock();
356 awb.WearableType=(byte)0; 362 awb.WearableType=(byte)0;
357 awb.AssetID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 363 awb.AssetID=Agent.Wearables[0].AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
358 awb.ItemID=new LLUUID("b7878441893b094917f791174bc8401c"); 364 awb.ItemID=Agent.Wearables[0].ItemID;//new LLUUID("b7878441893b094917f791174bc8401c");
359 aw.WearableData[0]=awb; 365 aw.WearableData[0]=awb;
360 366
361 /*awb=new AgentWearablesUpdatePacket.WearableDataBlock(); 367 awb=new AgentWearablesUpdatePacket.WearableDataBlock();
362 awb.WearableType=(byte)1; 368 awb.WearableType=(byte)1;
363 awb.AssetID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49"); 369 awb.AssetID=Agent.Wearables[1].AssetID;//new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
364 awb.ItemID=new LLUUID("193f0876fc11d143797454352f9c9c26"); 370 awb.ItemID=Agent.Wearables[1].ItemID;//new LLUUID("193f0876fc11d143797454352f9c9c26");
365 //awb.ItemID=new LLUUID("00000000-0000-0000-0000-000000000000"); 371 aw.WearableData[1]=awb;
366 aw.WearableData[1]=awb;*/
367 372
368 for(int i=1; i<13; i++) 373 for(int i=2; i<13; i++)
369 { 374 {
370 awb=new AgentWearablesUpdatePacket.WearableDataBlock(); 375 awb=new AgentWearablesUpdatePacket.WearableDataBlock();
371 awb.WearableType=(byte)i; 376 awb.WearableType=(byte)i;
@@ -412,6 +417,7 @@ namespace OpenSim
412 server.SendPacket(avp,true,user); 417 server.SendPacket(avp,true,user);
413 418
414 } 419 }
420
415 /// <summary> 421 /// <summary>
416 /// 422 ///
417 /// </summary> 423 /// </summary>
@@ -638,9 +644,27 @@ namespace OpenSim
638 public bool Walk=false; 644 public bool Walk=false;
639 public bool Started=false; 645 public bool Started=false;
640 //public TextureEntry TextureEntry; 646 //public TextureEntry TextureEntry;
647 public AvatarWearable[] Wearables;
648 public LLUUID InventoryFolder;
649 public LLUUID BaseFolder;
641 650
642 public AvatarData() 651 public AvatarData()
643 { 652 {
653 Wearables=new AvatarWearable[2]; //should be 13
654 for(int i=0; i<2; i++)
655 {
656 Wearables[i]=new AvatarWearable();
657 }
658 }
659 }
660
661 public class AvatarWearable
662 {
663 public LLUUID AssetID;
664 public LLUUID ItemID;
665
666 public AvatarWearable()
667 {
644 668
645 } 669 }
646 } 670 }
diff --git a/AssetManagement.cs b/AssetManagement.cs
new file mode 100644
index 0000000..adc8bd5
--- /dev/null
+++ b/AssetManagement.cs
@@ -0,0 +1,460 @@
1/*
2 *
3Copyright (c) OpenSim project, http://sim.opensecondlife.org/
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 <organization> 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 <copyright holder> ``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 <copyright holder> 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 */
28
29using System;
30using System.Collections.Generic;
31using libsecondlife;
32using System.Collections;
33using libsecondlife.Packets;
34using libsecondlife.AssetSystem;
35using System.IO;
36
37namespace OpenSim
38{
39 /// <summary>
40 /// Asset and Image management
41 /// </summary>
42 public class AssetManagement
43 {
44 public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets;
45 public Dictionary<libsecondlife.LLUUID,TextureImage> Textures;
46
47 public ArrayList AssetRequests=new ArrayList(); //should change to a generic
48 public ArrayList TextureRequests=new ArrayList();
49 // public ArrayList uploads=new ArrayList();
50 private Server server;
51 public InventoryManager InventoryManager;
52 private System.Text.Encoding enc = System.Text.Encoding.ASCII;
53
54 /// <summary>
55 ///
56 /// </summary>
57 /// <param name="server"></param>
58 public AssetManagement(Server server)
59 {
60 this.server=server;
61 Textures=new Dictionary<libsecondlife.LLUUID,TextureImage> ();
62 Assets=new Dictionary<libsecondlife.LLUUID,AssetInfo> ();
63 this.initialise();
64 }
65
66 /// <summary>
67 ///
68 /// </summary>
69 private void initialise()
70 {
71 //Shape and skin base assets
72 AssetInfo Asset=new AssetInfo();
73 Asset.filename="base_shape.dat";
74 Asset.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
75 this.LoadAsset(Asset);
76 this.Assets.Add(Asset.Full_ID,Asset);
77
78 Asset=new AssetInfo();
79 Asset.filename="base_skin.dat";
80 Asset.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
81 this.LoadAsset(Asset);
82 this.Assets.Add(Asset.Full_ID,Asset);
83
84 //our test images
85 //Change these filenames to images you want to use.
86 TextureImage Image=new TextureImage();
87 Image.filename="testpic2.jp2";
88 Image.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005");
89 Image.Name="test Texture";
90 this.LoadImage(Image);
91 this.Textures.Add(Image.Full_ID,Image);
92
93 Image=new TextureImage();
94 Image.filename="map_base.jp2";
95 Image.Full_ID=new LLUUID("00000000-0000-0000-7007-000000000006");
96 this.LoadImage(Image);
97 this.Textures.Add(Image.Full_ID,Image);
98
99 Image=new TextureImage();
100 Image.filename="map1.jp2";
101 Image.Full_ID=new LLUUID("00000000-0000-0000-7009-000000000008");
102 this.LoadImage(Image);
103 this.Textures.Add(Image.Full_ID,Image);
104 }
105
106 /// <summary>
107 ///
108 /// </summary>
109 /// <param name="UserInfo"></param>
110 /// <param name="AssetID"></param>
111 /// <param name="TransferRequest"></param>
112 #region AssetRegion
113
114 public void AddAssetRequest(User_Agent_info UserInfo, LLUUID AssetID, TransferRequestPacket TransferRequest)
115 {
116
117 if(!this.Assets.ContainsKey(AssetID))
118 {
119 //not found asset
120 return;
121 }
122 AssetInfo info=this.Assets[AssetID];
123 //for now as it will be only skin or shape request just send back the asset
124 TransferInfoPacket Transfer=new TransferInfoPacket();
125 Transfer.TransferInfo.ChannelType=2;
126 Transfer.TransferInfo.Status=0;
127 Transfer.TransferInfo.TargetType=0;
128 Transfer.TransferInfo.Params=TransferRequest.TransferInfo.Params;
129 Transfer.TransferInfo.Size=info.data.Length;
130 Transfer.TransferInfo.TransferID=TransferRequest.TransferInfo.TransferID;
131
132 server.SendPacket(Transfer,true,UserInfo);
133
134 TransferPacketPacket TransferPacket=new TransferPacketPacket();
135 TransferPacket.TransferData.Packet=0;
136 TransferPacket.TransferData.ChannelType=2;
137 TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
138 if(info.data.Length>1000) //but needs to be less than 2000 at the moment
139 {
140 byte[] chunk=new byte[1000];
141 Array.Copy(info.data,chunk,1000);
142 TransferPacket.TransferData.Data=chunk;
143 TransferPacket.TransferData.Status=0;
144 server.SendPacket(TransferPacket,true,UserInfo);
145
146 TransferPacket=new TransferPacketPacket();
147 TransferPacket.TransferData.Packet=1;
148 TransferPacket.TransferData.ChannelType=2;
149 TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
150 byte[] chunk1=new byte[(info.data.Length-1000)];
151 Array.Copy(info.data,1000,chunk1,0,chunk1.Length);
152 TransferPacket.TransferData.Data=chunk1;
153 TransferPacket.TransferData.Status=1;
154 server.SendPacket(TransferPacket,true,UserInfo);
155 }
156 else
157 {
158 TransferPacket.TransferData.Status=1; //last packet? so set to 1
159 TransferPacket.TransferData.Data=info.data;
160 server.SendPacket(TransferPacket,true,UserInfo);
161 }
162
163 }
164
165 public void CreateNewInventorySet(ref AvatarData Avata,User_Agent_info UserInfo)
166 {
167 //Create Folders
168 LLUUID BaseFolder=Avata.BaseFolder;
169 InventoryManager.CreateNewFolder(UserInfo,Avata.InventoryFolder);
170 InventoryManager.CreateNewFolder(UserInfo, BaseFolder);
171
172 //Give a copy of default shape
173 AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")];
174 AssetInfo Shape=this.CloneAsset(UserInfo.AgentID,Base);
175
176 Shape.filename="";
177 Shape.Name="Default Shape";
178 Shape.Description="Default Shape";
179 Shape.InvType=18;
180 Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
181
182 byte[] Agentid=enc.GetBytes(UserInfo.AgentID.ToStringHyphenated());
183 Array.Copy(Agentid,0,Shape.data,294,Agentid.Length);
184 this.Assets.Add(Shape.Full_ID,Shape);
185
186 Avata.Wearables[0].ItemID=InventoryManager.AddToInventory(UserInfo,BaseFolder,Shape);
187 Avata.Wearables[0].AssetID=Shape.Full_ID;
188
189 //Give copy of default skin
190 Base=this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")];
191 AssetInfo Skin=this.CloneAsset(UserInfo.AgentID,Base);
192
193 Skin.filename="";
194 Skin.Name="Default Skin";
195 Skin.Description="Default Skin";
196 Skin.InvType=18;
197 Skin.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
198
199 Array.Copy(Agentid,0,Skin.data,238,Agentid.Length);
200 this.Assets.Add(Skin.Full_ID,Skin);
201
202 Avata.Wearables[1].ItemID=InventoryManager.AddToInventory(UserInfo,BaseFolder,Skin);
203 Avata.Wearables[1].AssetID=Skin.Full_ID;
204
205 //give a copy of test texture
206 TextureImage Texture=this.CloneImage(UserInfo.AgentID,Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]);
207 this.Textures.Add(Texture.Full_ID,Texture);
208 InventoryManager.AddToInventory(UserInfo,BaseFolder,Texture);
209
210 }
211
212
213 private void LoadAsset(AssetInfo info)
214 {
215 //should request Asset from storage manager
216 //but for now read from file
217
218 string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\assets\";
219 string filename=data_path+@info.filename;
220 FileInfo fInfo = new FileInfo(filename);
221
222 long numBytes = fInfo.Length;
223
224 FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
225 byte[] idata=new byte[numBytes];
226 BinaryReader br = new BinaryReader(fStream);
227 idata= br.ReadBytes((int)numBytes);
228 br.Close();
229 fStream.Close();
230 info.data=idata;
231 info.loaded=true;
232 }
233
234 public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset)
235 {
236 AssetInfo NewAsset=new AssetInfo();
237 NewAsset.data=new byte[SourceAsset.data.Length];
238 Array.Copy(SourceAsset.data,NewAsset.data,SourceAsset.data.Length);
239 NewAsset.Full_ID=LLUUID.Random();
240 NewAsset.Type=SourceAsset.Type;
241 NewAsset.InvType=SourceAsset.InvType;
242 return(NewAsset);
243 }
244 #endregion
245
246 #region TextureRegion
247 public void AddTextureRequest(User_Agent_info user, LLUUID image_id)
248 {
249
250 if(!this.Textures.ContainsKey(image_id))
251 {
252 //not found image so send back image not in data base message
253 ImageNotInDatabasePacket im_not=new ImageNotInDatabasePacket();
254 im_not.ImageID.ID=image_id;
255 server.SendPacket(im_not,true,user);
256 return;
257 }
258 TextureImage imag=this.Textures[image_id];
259 TextureRequest req=new TextureRequest();
260 req.RequestUser=user;
261 req.RequestImage=image_id;
262 req.image_info=imag;
263
264 if(imag.data.LongLength>1000) //should be bigger or smaller?
265 {
266 //over 1000 bytes so split up file
267 req.num_packets=(int)imag.data.LongLength/1000;
268 req.num_packets++;
269 }
270 else
271 {
272 req.num_packets=1;
273 }
274
275 this.TextureRequests.Add(req);
276
277 }
278
279 public void AddTexture(LLUUID image_id, string name, byte[] data)
280 {
281
282 }
283 public void DoWork(ulong time)
284 {
285 if(this.TextureRequests.Count==0)
286 {
287 //no requests waiting
288 return;
289 }
290 int num;
291 //should be running in its own thread but for now is called by timer
292 if(this.TextureRequests.Count<5)
293 {
294 //lower than 5 so do all of them
295 num=this.TextureRequests.Count;
296 }
297 else
298 {
299 num=5;
300 }
301 TextureRequest req;
302 for(int i=0; i<num; i++)
303 {
304 req=(TextureRequest)this.TextureRequests[i];
305
306 if(req.packet_counter==0)
307 {
308 //first time for this request so send imagedata packet
309 if(req.num_packets==1)
310 {
311 //only one packet so send whole file
312 ImageDataPacket im=new ImageDataPacket();
313 im.ImageID.Packets=1;
314 im.ImageID.ID=req.image_info.Full_ID;
315 im.ImageID.Size=(uint)req.image_info.data.Length;
316 im.ImageData.Data=req.image_info.data;
317 im.ImageID.Codec=2;
318 server.SendPacket(im,true,req.RequestUser);
319 req.packet_counter++;
320 req.image_info.last_used=time;
321 System.Console.WriteLine("sent texture: "+req.image_info.Full_ID);
322 }
323 else
324 {
325 //more than one packet so split file up
326 }
327 }
328 else
329 {
330 //send imagepacket
331
332 }
333 }
334
335 //remove requests that have been completed
336 for(int i=0; i<num; i++)
337 {
338 req=(TextureRequest)this.TextureRequests[i];
339 if(req.packet_counter==req.num_packets)
340 {
341 this.TextureRequests.Remove(req);
342 }
343 }
344 }
345
346 public void RecieveTexture(Packet pack)
347 {
348
349 }
350
351 private void LoadImage(TextureImage im)
352 {
353 //should request Image from StorageManager
354 //but for now read from file
355
356 string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\textures\";
357 string filename=data_path+@im.filename;
358 FileInfo fInfo = new FileInfo(filename);
359
360 long numBytes = fInfo.Length;
361
362 FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
363 byte[] idata=new byte[numBytes];
364 BinaryReader br = new BinaryReader(fStream);
365 idata= br.ReadBytes((int)numBytes);
366 br.Close();
367 fStream.Close();
368 im.data=idata;
369 im.loaded=true;
370 }
371
372 public TextureImage CloneImage(LLUUID NewOwner,TextureImage Source)
373 {
374 TextureImage NewImage=new TextureImage();
375 NewImage.data=new byte[Source.data.Length];
376 Array.Copy(Source.data,NewImage.data,Source.data.Length);
377 NewImage.filename=Source.filename;
378 NewImage.Full_ID=LLUUID.Random();
379 NewImage.Name=Source.Name;
380 return(NewImage);
381 }
382
383 #endregion
384 }
385
386 public class AssetRequest
387 {
388 public User_Agent_info RequestUser;
389 public LLUUID RequestImage;
390 public AssetInfo asset_inf;
391 public long data_pointer=0;
392 public int num_packets=0;
393 public int packet_counter=0;
394
395 public AssetRequest()
396 {
397
398 }
399 }
400 public class AssetInfo:AssetBase
401 {
402 //public byte[] data;
403 //public LLUUID Full_ID;
404 public string filename;
405 public bool loaded;
406 public ulong last_used; //need to add a tick/time counter and keep record
407 // of how often images are requested to unload unused ones.
408
409 public AssetInfo()
410 {
411
412 }
413 }
414
415 public class AssetBase
416 {
417 public byte[] data;
418 public LLUUID Full_ID;
419 public sbyte Type;
420 public sbyte InvType;
421 public string Name;
422 public string Description;
423
424 public AssetBase()
425 {
426
427 }
428 }
429 public class TextureRequest
430 {
431 public User_Agent_info RequestUser;
432 public LLUUID RequestImage;
433 public TextureImage image_info;
434 public long data_pointer=0;
435 public int num_packets=0;
436 public int packet_counter=0;
437
438 public TextureRequest()
439 {
440
441 }
442 }
443 public class TextureImage: AssetBase
444 {
445 //public byte[] data;
446 //public LLUUID Full_ID;
447 //public string name;
448 public string filename;
449 public bool loaded;
450 public ulong last_used; //need to add a tick/time counter and keep record
451 // of how often images are requested to unload unused ones.
452
453 public TextureImage()
454 {
455
456 }
457 }
458
459
460}
diff --git a/Asset_manager.cs b/Asset_manager.cs
index 20cf3a1..94832f7 100644
--- a/Asset_manager.cs
+++ b/Asset_manager.cs
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3 3
4* Copyright (c) <year>, <copyright holder> 4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 5* All rights reserved.
@@ -45,6 +45,9 @@ namespace OpenSim
45 public ArrayList requests=new ArrayList(); //should change to a generic 45 public ArrayList requests=new ArrayList(); //should change to a generic
46 // public ArrayList uploads=new ArrayList(); 46 // public ArrayList uploads=new ArrayList();
47 private Server server; 47 private Server server;
48 public TextureManager TextureMan;
49 public InventoryManager InventoryManager;
50 private System.Text.Encoding enc = System.Text.Encoding.ASCII;
48 51
49 public AssetManager(Server serve) 52 public AssetManager(Server serve)
50 { 53 {
@@ -55,7 +58,7 @@ namespace OpenSim
55 58
56 public void AddRequest(User_Agent_info user, LLUUID asset_id, TransferRequestPacket tran_req) 59 public void AddRequest(User_Agent_info user, LLUUID asset_id, TransferRequestPacket tran_req)
57 { 60 {
58 61 Console.WriteLine("Asset Request "+ asset_id);
59 if(!this.Assets.ContainsKey(asset_id)) 62 if(!this.Assets.ContainsKey(asset_id))
60 { 63 {
61 //not found asset 64 //not found asset
@@ -103,7 +106,44 @@ namespace OpenSim
103 server.SendPacket(tran_p,true,user); 106 server.SendPacket(tran_p,true,user);
104 } 107 }
105 108
109 }
110 public void CreateNewBaseSet(ref AvatarData Avata,User_Agent_info UserInfo)
111 {
112 //LLUUID BaseFolder=new LLUUID("4f5f559e-77a0-a4b9-84f9-8c74c07f7cfc");//*/"4fb2dab6-a987-da66-05ee-96ca82bccbf1");
113 //LLUUID BaseFolder=new LLUUID("480e2d92-61f6-9f16-f4f5-0f77cfa4f8f9");
114 LLUUID BaseFolder=Avata.BaseFolder;
115 InventoryManager.CreateNewFolder(UserInfo,Avata.InventoryFolder);
116 InventoryManager.CreateNewFolder(UserInfo, BaseFolder);
117
118 AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")];
119 AssetInfo Shape=new AssetInfo();
120
121 Shape.filename="";
122 Shape.data=new byte[Base.data.Length];
123 Array.Copy(Base.data,Shape.data,Base.data.Length);
124 Shape.Full_ID=LLUUID.Random();
125 Shape.Name="Default Skin";
126 Shape.Description="Default";
127 Shape.InvType=18;
128
129 Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
130 byte[] Agentid=enc.GetBytes(UserInfo.AgentID.ToStringHyphenated());
131 Array.Copy(Agentid,0,Shape.data,294,Agentid.Length);
132 this.Assets.Add(Shape.Full_ID,Shape);
133 /*FileStream fStream = new FileStream("Assetshape.dat", FileMode.CreateNew);
134 BinaryWriter bw = new BinaryWriter(fStream);
135 bw.Write(Shape.data);
136 bw.Close();
137 fStream.Close();*/
106 138
139 Avata.Wearables[0].ItemID=InventoryManager.AddToInventory(UserInfo,BaseFolder,Shape);
140 Avata.Wearables[0].AssetID=Shape.Full_ID;
141 //Avata.RootFolder=BaseFolder;
142
143 //give test texture
144
145 TextureImage Texture=TextureMan.textures[new LLUUID("00000000-0000-0000-5005-000000000005")];
146 InventoryManager.AddToInventory(UserInfo,BaseFolder,Texture);
107 147
108 } 148 }
109 149
@@ -115,6 +155,13 @@ namespace OpenSim
115 im.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 155 im.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
116 this.loadAsset(im); 156 this.loadAsset(im);
117 this.Assets.Add(im.Full_ID,im); 157 this.Assets.Add(im.Full_ID,im);
158
159
160 im=new AssetInfo();
161 im.filename="base_skin.dat";
162 im.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
163 this.loadAsset(im);
164 this.Assets.Add(im.Full_ID,im);
118 } 165 }
119 private void loadAsset(AssetInfo info) 166 private void loadAsset(AssetInfo info)
120 { 167 {
@@ -152,11 +199,10 @@ namespace OpenSim
152 199
153 } 200 }
154 } 201 }
155 public class AssetInfo 202 public class AssetInfo:AssetBase
156 { 203 {
157 public byte[] data; 204 //public byte[] data;
158 public LLUUID Full_ID; 205 //public LLUUID Full_ID;
159 public string name;
160 public string filename; 206 public string filename;
161 public bool loaded; 207 public bool loaded;
162 public ulong last_used; //need to add a tick/time counter and keep record 208 public ulong last_used; //need to add a tick/time counter and keep record
@@ -167,4 +213,19 @@ namespace OpenSim
167 213
168 } 214 }
169 } 215 }
216
217 public class AssetBase
218 {
219 public byte[] data;
220 public LLUUID Full_ID;
221 public sbyte Type;
222 public sbyte InvType;
223 public string Name;
224 public string Description;
225
226 public AssetBase()
227 {
228
229 }
230 }
170} 231}
diff --git a/Controller.cs b/Controller.cs
index f2bd85c..0a6fee9 100644
--- a/Controller.cs
+++ b/Controller.cs
@@ -1,7 +1,7 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3
3 4
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 5* All rights reserved.
6* 6*
7* Redistribution and use in source and binary forms, with or without 7* Redistribution and use in source and binary forms, with or without
@@ -58,9 +58,10 @@ namespace OpenSim
58 public Logon _login; 58 public Logon _login;
59 private AgentManager Agent_Manager; 59 private AgentManager Agent_Manager;
60 private PrimManager Prim_Manager; 60 private PrimManager Prim_Manager;
61 private TextureManager Texture_Manager; 61 // private TextureManager Texture_Manager;
62 private AssetManager Asset_Manager; 62 private AssetManagement Asset_Manager;
63 private GridManager Grid_Manager; 63 private GridManager Grid_Manager;
64 private InventoryManager Inventory_Manager;
64 private LoginManager Login_Manager; //built in login server 65 private LoginManager Login_Manager; //built in login server
65 private ulong time; //ticks 66 private ulong time; //ticks
66 private Timer timer1 = new Timer(); 67 private Timer timer1 = new Timer();
@@ -71,10 +72,14 @@ namespace OpenSim
71 server = new Server( this ); 72 server = new Server( this );
72 Agent_Manager = new AgentManager( this.server ); 73 Agent_Manager = new AgentManager( this.server );
73 Prim_Manager = new PrimManager( this.server ); 74 Prim_Manager = new PrimManager( this.server );
74 Texture_Manager = new TextureManager( this.server ); 75 // Texture_Manager = new TextureManager( this.server );
75 Asset_Manager = new AssetManager( this.server ); 76 Asset_Manager = new AssetManagement( this.server );
76 Prim_Manager.Agent_Manager = Agent_Manager; 77 Prim_Manager.Agent_Manager = Agent_Manager;
77 Agent_Manager.Prim_Manager = Prim_Manager; 78 Agent_Manager.Prim_Manager = Prim_Manager;
79 Agent_Manager.Asset_Manager=Asset_Manager;
80 Inventory_Manager=new InventoryManager(this.server);
81 Asset_Manager.InventoryManager=Inventory_Manager;
82 // Asset_Manager.TextureMan=Texture_Manager;
78 Grid_Manager=new GridManager(this.server,Agent_Manager); 83 Grid_Manager=new GridManager(this.server,Agent_Manager);
79 if(Globals.Instance.LoginSever) 84 if(Globals.Instance.LoginSever)
80 { 85 {
@@ -89,80 +94,93 @@ namespace OpenSim
89 94
90 } 95 }
91 public void MainCallback( Packet pack, User_Agent_info User_info ) { 96 public void MainCallback( Packet pack, User_Agent_info User_info ) {
92 //System.Console.WriteLine(pack.Type); 97
93 if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) { 98 /*if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) {
94 // System.Console.WriteLine(pack.Type); 99 //Log packet?
100 // System.Console.WriteLine(pack.Type);
95 //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; 101 //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type;
96 } 102 }*/
103
104 //should replace with a switch
97 if( pack.Type == PacketType.AgentSetAppearance ) { 105 if( pack.Type == PacketType.AgentSetAppearance ) {
98 // System.Console.WriteLine(pack); 106 // System.Console.WriteLine(pack);
99 //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; 107 //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type;
100 108
101 } 109 }
102 if(pack.Type== PacketType.MapBlockRequest) 110 else if( pack.Type == PacketType.FetchInventory)
111 {
112 FetchInventoryPacket FetchInventory=(FetchInventoryPacket)pack;
113 Inventory_Manager.FetchInventory(User_info,FetchInventory);
114 }
115 else if( pack.Type == PacketType.FetchInventoryDescendents)
116 {
117 FetchInventoryDescendentsPacket Fetch=(FetchInventoryDescendentsPacket)pack;
118 Inventory_Manager.FetchInventoryDescendents(User_info,Fetch);
119 }
120 else if(pack.Type== PacketType.MapBlockRequest)
103 { 121 {
104 //int MinX, MinY, MaxX, MaxY; 122 //int MinX, MinY, MaxX, MaxY;
105 MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack; 123 MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack;
106 this.Grid_Manager.RequestMapBlock(User_info,MapRequest.PositionData.MinX,MapRequest.PositionData.MinY,MapRequest.PositionData.MaxX,MapRequest.PositionData.MaxY); 124 this.Grid_Manager.RequestMapBlock(User_info,MapRequest.PositionData.MinX,MapRequest.PositionData.MinY,MapRequest.PositionData.MaxX,MapRequest.PositionData.MaxY);
107 125
108 } 126 }
109 if(pack.Type== PacketType.CloseCircuit) 127 else if(pack.Type== PacketType.CloseCircuit)
110 { 128 {
111 this.Agent_Manager.RemoveAgent(User_info); 129 this.Agent_Manager.RemoveAgent(User_info);
112 } 130 }
113 if(pack.Type== PacketType.MapLayerRequest) 131 else if(pack.Type== PacketType.MapLayerRequest)
114 { 132 {
115 this.Grid_Manager.RequestMapLayer(User_info); 133 this.Grid_Manager.RequestMapLayer(User_info);
116 134
117 } 135 }
118 if((pack.Type== PacketType.TeleportRequest ) ||(pack.Type== PacketType.TeleportLocationRequest)) 136 else if((pack.Type== PacketType.TeleportRequest ) ||(pack.Type== PacketType.TeleportLocationRequest))
119 { 137 {
120 TeleportLocationRequestPacket Request=(TeleportLocationRequestPacket)pack; 138 TeleportLocationRequestPacket Request=(TeleportLocationRequestPacket)pack;
121 139
122 this.Grid_Manager.RequestTeleport(User_info,Request); 140 this.Grid_Manager.RequestTeleport(User_info,Request);
123 141
124 } 142 }
125 if( pack.Type == PacketType.TransferRequest ) { 143 else if( pack.Type == PacketType.TransferRequest ) {
126 TransferRequestPacket tran = (TransferRequestPacket)pack; 144 TransferRequestPacket tran = (TransferRequestPacket)pack;
127 LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 ); 145 LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 );
128 146
129 if( ( id == new LLUUID( "66c41e39-38f9-f75a-024e-585989bfab73" ) ) || ( id == new LLUUID( "e0ee49b5a4184df8d3c9a65361fe7f49" ) ) ) { 147 // if( ( id == new LLUUID( "66c41e39-38f9-f75a-024e-585989bfab73" ) ) || ( id == new LLUUID( "e0ee49b5a4184df8d3c9a65361fe7f49" ) ) ) {
130 Asset_Manager.AddRequest( User_info, id, tran ); 148 Asset_Manager.AddAssetRequest( User_info, id, tran );
131 } 149 // }
132 150
133 } 151 }
134 if( ( pack.Type == PacketType.StartPingCheck ) ) { 152 else if( ( pack.Type == PacketType.StartPingCheck ) ) {
135 //reply to pingcheck 153 //reply to pingcheck
136 libsecondlife.Packets.StartPingCheckPacket startp = (libsecondlife.Packets.StartPingCheckPacket)pack; 154 libsecondlife.Packets.StartPingCheckPacket startp = (libsecondlife.Packets.StartPingCheckPacket)pack;
137 libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket(); 155 libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket();
138 endping.PingID.PingID = startp.PingID.PingID; 156 endping.PingID.PingID = startp.PingID.PingID;
139 server.SendPacket( endping, true, User_info ); 157 server.SendPacket( endping, true, User_info );
140 } 158 }
141 if( pack.Type == PacketType.CompleteAgentMovement ) { 159 else if( pack.Type == PacketType.CompleteAgentMovement ) {
142 // new client 160 // new client
143 Agent_Manager.AgentJoin( User_info ); 161 Agent_Manager.AgentJoin( User_info );
144 } 162 }
145 if( pack.Type == PacketType.RequestImage ) { 163 else if( pack.Type == PacketType.RequestImage ) {
146 RequestImagePacket image_req = (RequestImagePacket)pack; 164 RequestImagePacket image_req = (RequestImagePacket)pack;
147 for( int i = 0; i < image_req.RequestImage.Length; i++ ) { 165 for( int i = 0; i < image_req.RequestImage.Length; i++ ) {
148 this.Texture_Manager.AddRequest( User_info, image_req.RequestImage[ i ].Image ); 166 this.Asset_Manager.AddTextureRequest( User_info, image_req.RequestImage[ i ].Image );
149 167
150 } 168 }
151 } 169 }
152 if( pack.Type == PacketType.RegionHandshakeReply ) { 170 else if( pack.Type == PacketType.RegionHandshakeReply ) {
153 //recieved regionhandshake so can now start sending info 171 //recieved regionhandshake so can now start sending info
154 Agent_Manager.SendInitialData( User_info ); 172 Agent_Manager.SendInitialData( User_info );
155 //this.setuptemplates("objectupate164.dat",User_info,false); 173 //this.setuptemplates("objectupate164.dat",User_info,false);
156 } 174 }
157 if( pack.Type == PacketType.ObjectAdd ) { 175 else if( pack.Type == PacketType.ObjectAdd ) {
158 ObjectAddPacket ad = (ObjectAddPacket)pack; 176 ObjectAddPacket ad = (ObjectAddPacket)pack;
159 Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad ); 177 Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad );
160 //this.send_prim(User_info,ad.ObjectData.RayEnd, ad); 178 //this.send_prim(User_info,ad.ObjectData.RayEnd, ad);
161 } 179 }
162 if( pack.Type == PacketType.ObjectPosition ) { 180 else if( pack.Type == PacketType.ObjectPosition ) {
163 //System.Console.WriteLine(pack.ToString()); 181 //System.Console.WriteLine(pack.ToString());
164 } 182 }
165 if( pack.Type == PacketType.MultipleObjectUpdate ) { 183 else if( pack.Type == PacketType.MultipleObjectUpdate ) {
166 //System.Console.WriteLine(pack.ToString()); 184 //System.Console.WriteLine(pack.ToString());
167 MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack; 185 MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack;
168 186
@@ -185,11 +203,12 @@ namespace OpenSim
185 } 203 }
186 } 204 }
187 } 205 }
188 if( pack.Type == PacketType.AgentWearablesRequest ) { 206 else if( pack.Type == PacketType.AgentWearablesRequest ) {
189 Agent_Manager.SendIntialAvatarAppearance( User_info ); 207 Agent_Manager.SendIntialAvatarAppearance( User_info );
190 } 208 }
191 209
192 if( pack.Type == PacketType.AgentUpdate ) { 210 else if( pack.Type == PacketType.AgentUpdate )
211 {
193 AgentUpdatePacket ag = (AgentUpdatePacket)pack; 212 AgentUpdatePacket ag = (AgentUpdatePacket)pack;
194 uint mask = ag.AgentData.ControlFlags & ( 1 ); 213 uint mask = ag.AgentData.ControlFlags & ( 1 );
195 AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID ); 214 AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID );
@@ -224,8 +243,7 @@ namespace OpenSim
224 } 243 }
225 } 244 }
226 } 245 }
227 246 else if( pack.Type == PacketType.ChatFromViewer ) {
228 if( pack.Type == PacketType.ChatFromViewer ) {
229 ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; 247 ChatFromViewerPacket chat = (ChatFromViewerPacket)pack;
230 System.Text.Encoding enc = System.Text.Encoding.ASCII; 248 System.Text.Encoding enc = System.Text.Encoding.ASCII;
231 249
@@ -252,14 +270,17 @@ namespace OpenSim
252 public void NewUserCallback( User_Agent_info UserInfo ) { 270 public void NewUserCallback( User_Agent_info UserInfo ) {
253 Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode); 271 Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode);
254 string first,last; 272 string first,last;
273 LLUUID Base,Inventory;
255 lock(_login) 274 lock(_login)
256 { 275 {
257 first=_login.first; 276 first=_login.first;
258 last=_login.last; 277 last=_login.last;
278 Base=_login.BaseFolder;
279 Inventory=_login.InventoryFolder;
259 280
260 //should get agentid and sessionid so they can be checked. 281 //should get agentid and sessionid so they can be checked.
261 } 282 }
262 Agent_Manager.NewAgent( UserInfo ,first,last); 283 Agent_Manager.NewAgent( UserInfo ,first,last,Base,Inventory);
263 //now because of the lack of Global account management (User server etc) 284 //now because of the lack of Global account management (User server etc)
264 //we need to reset the names back to default incase a teleport happens 285 //we need to reset the names back to default incase a teleport happens
265 //which will not have a Login name set, so they will use default names 286 //which will not have a Login name set, so they will use default names
@@ -277,7 +298,7 @@ namespace OpenSim
277 void Timer1Tick( object sender, System.EventArgs e ) { 298 void Timer1Tick( object sender, System.EventArgs e ) {
278 this.time++; 299 this.time++;
279 Agent_Manager.UpdatePositions(); 300 Agent_Manager.UpdatePositions();
280 Texture_Manager.DoWork( time ); 301 this.Asset_Manager.DoWork( time );
281 } 302 }
282 } 303 }
283 public class Logon 304 public class Logon
@@ -286,6 +307,8 @@ namespace OpenSim
286 public string last="User"; 307 public string last="User";
287 public LLUUID Agent; 308 public LLUUID Agent;
288 public LLUUID Session; 309 public LLUUID Session;
310 public LLUUID InventoryFolder;
311 public LLUUID BaseFolder;
289 public Logon() 312 public Logon()
290 { 313 {
291 314
diff --git a/Globals.cs b/Globals.cs
index 5763b67..44dae82 100644
--- a/Globals.cs
+++ b/Globals.cs
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3 3
4* Copyright (c) <year>, <copyright holder> 4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 5* All rights reserved.
@@ -53,6 +53,7 @@ namespace OpenSim
53 public int IpPort=1000; 53 public int IpPort=1000;
54 54
55 public bool LoginSever=true; 55 public bool LoginSever=true;
56 public ushort LoginServerPort=8080;
56 57
57 //public string RegionName= "The Other\0"; 58 //public string RegionName= "The Other\0";
58 //public ulong RegionHandle= 1095113581519872; 59 //public ulong RegionHandle= 1095113581519872;
diff --git a/GridManager.cs b/GridManager.cs
index 52ac789..c6b7c49 100644
--- a/GridManager.cs
+++ b/GridManager.cs
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3 3
4* Copyright (c) <year>, <copyright holder> 4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 5* All rights reserved.
diff --git a/InventoryManager.cs b/InventoryManager.cs
new file mode 100644
index 0000000..bbc340e
--- /dev/null
+++ b/InventoryManager.cs
@@ -0,0 +1,240 @@
1/*
2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of the <organization> nor the
12 * names of its contributors may be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27using System;
28using System.Collections.Generic;
29using libsecondlife;
30using libsecondlife.Packets;
31using libsecondlife.AssetSystem;
32using System.IO;
33
34namespace OpenSim
35{
36 /// <summary>
37 /// Description of InventoryManager.
38 /// </summary>
39 public class InventoryManager
40 {
41 private System.Text.Encoding enc = System.Text.Encoding.ASCII;
42 public Dictionary<LLUUID, InventoryFolder> Folders;
43 public Dictionary<LLUUID, InventoryItem> Items;
44 private Server server;
45
46 /// <summary>
47 ///
48 /// </summary>
49 /// <param name="serve"></param>
50 public InventoryManager(Server serve)
51 {
52 server=serve;
53 Folders=new Dictionary<LLUUID, InventoryFolder>();
54 Items=new Dictionary<LLUUID, InventoryItem>();
55 }
56
57 /// <summary>
58 ///
59 /// </summary>
60 /// <param name="UserInfo"></param>
61 /// <param name="FolderID"></param>
62 /// <param name="Asset"></param>
63 /// <returns></returns>
64 public LLUUID AddToInventory(User_Agent_info UserInfo, LLUUID FolderID,AssetBase Asset)
65 {
66 if(this.Folders.ContainsKey(FolderID))
67 {
68 LLUUID NewItemID=LLUUID.Random();
69
70 InventoryItem Item=new InventoryItem();
71 Item.FolderID=FolderID;
72 Item.OwnerID=UserInfo.AgentID;
73 Item.AssetID=Asset.Full_ID;
74 Item.ItemID=NewItemID;
75 Item.Type=Asset.Type;
76 Item.Name=Asset.Name;
77 Item.Description=Asset.Description;
78 Item.InvType=Asset.InvType;
79 this.Items.Add(Item.ItemID,Item);
80 InventoryFolder Folder=Folders[Item.FolderID];
81 Folder.Items.Add(Item);
82 return(Item.ItemID);
83 }
84 else
85 {
86 return(null);
87 }
88 }
89
90 /// <summary>
91 ///
92 /// </summary>
93 /// <param name="UserInfo"></param>
94 /// <param name="NewFolder"></param>
95 /// <returns></returns>
96 public bool CreateNewFolder(User_Agent_info UserInfo, LLUUID NewFolder)
97 {
98 InventoryFolder Folder=new InventoryFolder();
99 Folder.FolderID=NewFolder;
100 Folder.OwnerID=UserInfo.AgentID;
101 this.Folders.Add(Folder.FolderID,Folder);
102
103 return(true);
104 }
105
106 /// <summary>
107 ///
108 /// </summary>
109 /// <param name="User_info"></param>
110 /// <param name="FetchDescend"></param>
111 public void FetchInventoryDescendents(User_Agent_info User_info,FetchInventoryDescendentsPacket FetchDescend)
112 {
113 if(FetchDescend.InventoryData.FetchItems)
114 {
115 if(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID))
116 {
117
118 InventoryFolder Folder=this.Folders[FetchDescend.InventoryData.FolderID];
119 InventoryDescendentsPacket Descend=new InventoryDescendentsPacket();
120 Descend.AgentData.AgentID=User_info.AgentID;
121 Descend.AgentData.OwnerID=Folder.OwnerID;//User_info.AgentID;
122 Descend.AgentData.FolderID=FetchDescend.InventoryData.FolderID;//Folder.FolderID;//new LLUUID("4fb2dab6-a987-da66-05ee-96ca82bccbf1");
123 Descend.AgentData.Descendents=Folder.Items.Count;
124 Descend.AgentData.Version=Folder.Items.Count;
125
126 Descend.ItemData=new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
127 for(int i=0; i<Folder.Items.Count ; i++)
128 {
129
130 InventoryItem Item=Folder.Items[i];
131 Descend.ItemData[i]=new InventoryDescendentsPacket.ItemDataBlock();
132 Descend.ItemData[i].ItemID=Item.ItemID;//new LLUUID("b7878441893b094917f791174bc8401c");
133 Descend.ItemData[i].AssetID=Item.AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
134 Descend.ItemData[i].CreatorID=Item.CreatorID;//User_info.AgentID;
135 Descend.ItemData[i].BaseMask=2147483647;
136 Descend.ItemData[i].CreationDate=1000;
137 Descend.ItemData[i].Description=enc.GetBytes(Item.Description+"\0");
138 Descend.ItemData[i].EveryoneMask=2147483647;;
139 Descend.ItemData[i].Flags=1;
140 Descend.ItemData[i].FolderID=Item.FolderID;//new LLUUID("4fb2dab6-a987-da66-05ee-96ca82bccbf1");
141 Descend.ItemData[i].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
142 Descend.ItemData[i].GroupMask=2147483647;
143 Descend.ItemData[i].InvType=Item.InvType;
144 Descend.ItemData[i].Name=enc.GetBytes(Item.Name+"\0");
145 Descend.ItemData[i].NextOwnerMask=2147483647;
146 Descend.ItemData[i].OwnerID=Item.OwnerID;//User_info.AgentID;
147 Descend.ItemData[i].OwnerMask=2147483647;;
148 Descend.ItemData[i].SalePrice=100;
149 Descend.ItemData[i].SaleType=0;
150 Descend.ItemData[i].Type=Item.Type;//libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
151 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,2147483647,1,2147483647,2147483647,2147483647);
152 }
153 server.SendPacket(Descend,true,User_info);
154
155 }
156 }
157 else
158 {
159 Console.WriteLine("fetch subfolders");
160 }
161 }
162
163 /// <summary>
164 ///
165 /// </summary>
166 /// <param name="User_info"></param>
167 public void FetchInventory(User_Agent_info User_info, FetchInventoryPacket FetchItems)
168 {
169
170 for(int i=0; i<FetchItems.InventoryData.Length; i++)
171 {
172 if(this.Items.ContainsKey(FetchItems.InventoryData[i].ItemID))
173 {
174
175 InventoryItem Item=Items[FetchItems.InventoryData[i].ItemID];
176 FetchInventoryReplyPacket InventoryReply=new FetchInventoryReplyPacket();
177 InventoryReply.AgentData.AgentID=User_info.AgentID;
178 InventoryReply.InventoryData=new FetchInventoryReplyPacket.InventoryDataBlock[1];
179 InventoryReply.InventoryData[0]=new FetchInventoryReplyPacket.InventoryDataBlock();
180 InventoryReply.InventoryData[0].ItemID=Item.ItemID;//new LLUUID("b7878441893b094917f791174bc8401c");
181 InventoryReply.InventoryData[0].AssetID=Item.AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
182 InventoryReply.InventoryData[0].CreatorID=Item.CreatorID;//User_info.AgentID;
183 InventoryReply.InventoryData[0].BaseMask=2147483647;
184 InventoryReply.InventoryData[0].CreationDate=1000;
185 InventoryReply.InventoryData[0].Description=enc.GetBytes( Item.Description+"\0");
186 InventoryReply.InventoryData[0].EveryoneMask=2147483647;;
187 InventoryReply.InventoryData[0].Flags=1;
188 InventoryReply.InventoryData[0].FolderID=Item.FolderID;//new LLUUID("4fb2dab6-a987-da66-05ee-96ca82bccbf1");
189 InventoryReply.InventoryData[0].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
190 InventoryReply.InventoryData[0].GroupMask=2147483647;
191 InventoryReply.InventoryData[0].InvType=Item.InvType;
192 InventoryReply.InventoryData[0].Name=enc.GetBytes(Item.Name+"\0");
193 InventoryReply.InventoryData[0].NextOwnerMask=2147483647;
194 InventoryReply.InventoryData[0].OwnerID=Item.OwnerID;//User_info.AgentID;
195 InventoryReply.InventoryData[0].OwnerMask=2147483647;;
196 InventoryReply.InventoryData[0].SalePrice=100;
197 InventoryReply.InventoryData[0].SaleType=0;
198 InventoryReply.InventoryData[0].Type=Item.Type;//libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
199 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,2147483647,1,2147483647,2147483647,2147483647);
200 server.SendPacket(InventoryReply,true,User_info);
201 }
202 }
203 }
204 }
205
206 public class InventoryFolder
207 {
208 public List<InventoryItem> Items;
209 //public List<InventoryFolder> Subfolders;
210
211 public LLUUID FolderID;
212 public LLUUID OwnerID;
213 public LLUUID ParentID;
214
215
216 public InventoryFolder()
217 {
218 Items=new List<InventoryItem>();
219 }
220
221 }
222
223 public class InventoryItem
224 {
225 public LLUUID FolderID;
226 public LLUUID OwnerID;
227 public LLUUID ItemID;
228 public LLUUID AssetID;
229 public LLUUID CreatorID=LLUUID.Zero;//new LLUUID("3d924400-038e-6ad9-920b-cfbb9b40585c");
230 public sbyte InvType;
231 public sbyte Type;
232 public string Name;
233 public string Description;
234
235 public InventoryItem()
236 {
237
238 }
239 }
240}
diff --git a/Login_manager.cs b/Login_manager.cs
index a41bde3..c8251b6 100644
--- a/Login_manager.cs
+++ b/Login_manager.cs
@@ -1,6 +1,5 @@
1/*Copyright (c) 2007 Michael Wright 1/*
2 2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/>
3* Copyright (c) <year>, <copyright holder>
4* All rights reserved. 3* All rights reserved.
5* 4*
6* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
@@ -34,6 +33,7 @@ using System.Text;
34using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
35using System.Threading; 34using System.Threading;
36using System.Collections; 35using System.Collections;
36using System.Xml;
37using libsecondlife; 37using libsecondlife;
38 38
39namespace OpenSim 39namespace OpenSim
@@ -48,7 +48,7 @@ namespace OpenSim
48 Login=login; 48 Login=login;
49 } 49 }
50 public Logon Login; 50 public Logon Login;
51 public ushort loginPort = 8080; 51 public ushort loginPort = Globals.Instance.LoginServerPort;
52 public IPAddress clientAddress = IPAddress.Loopback; 52 public IPAddress clientAddress = IPAddress.Loopback;
53 public IPAddress remoteAddress = IPAddress.Any; 53 public IPAddress remoteAddress = IPAddress.Any;
54 private Socket loginServer; 54 private Socket loginServer;
@@ -128,7 +128,7 @@ namespace OpenSim
128 // read the HTTP body into a buffer 128 // read the HTTP body into a buffer
129 char[] content = new char[contentLength]; 129 char[] content = new char[contentLength];
130 reader.Read(content, 0, contentLength); 130 reader.Read(content, 0, contentLength);
131 // System.Text.Encoding enc = System.Text.Encoding.ASCII; 131 //System.Text.Encoding enc = System.Text.Encoding.ASCII;
132 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); 132 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
133 Hashtable requestData = (Hashtable)request.Params[0]; 133 Hashtable requestData = (Hashtable)request.Params[0];
134 134
@@ -162,6 +162,41 @@ namespace OpenSim
162 int SessionRand=this.RandomClass.Next(1,999); 162 int SessionRand=this.RandomClass.Next(1,999);
163 Session=new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); 163 Session=new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
164 164
165
166 StreamReader SR;
167 string ResponseString="";
168 string lines;
169 SR=File.OpenText("new-login.dat");
170
171 lines=SR.ReadLine();
172
173 while(lines!="end-mfile")
174 {
175
176 ResponseString+=lines;
177 lines=SR.ReadLine();
178 }
179 SR.Close();
180
181 XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString);
182 Hashtable responseData = (Hashtable)response.Value;
183
184 responseData["agent_id"]=Agent.ToStringHyphenated();
185 responseData["session_id"]=Session.ToStringHyphenated();
186 ArrayList InventoryList=(ArrayList) responseData["inventory-skeleton"];
187 Hashtable Inventory1=(Hashtable)InventoryList[0];
188 Hashtable Inventory2=(Hashtable)InventoryList[1];
189 LLUUID BaseFolderID=LLUUID.Random();
190 LLUUID InventoryFolderID=LLUUID.Random();
191 Inventory2["name"]="Base";
192 Inventory2["folder_id"]=BaseFolderID.ToStringHyphenated();
193 Inventory1["folder_id"]=InventoryFolderID.ToStringHyphenated();
194
195 ArrayList InventoryRoot=(ArrayList) responseData["inventory-root"];
196 Hashtable Inventoryroot=(Hashtable)InventoryRoot[0];
197 Inventoryroot["folder_id"]=InventoryFolderID.ToStringHyphenated();
198
199
165 //copy data to login object 200 //copy data to login object
166 lock(Login) 201 lock(Login)
167 { 202 {
@@ -169,38 +204,18 @@ namespace OpenSim
169 Login.last=last; 204 Login.last=last;
170 Login.Agent=Agent; 205 Login.Agent=Agent;
171 Login.Session=Session; 206 Login.Session=Session;
207 Login.BaseFolder=BaseFolderID;
208 Login.InventoryFolder=InventoryFolderID;
172 } 209 }
173 210
174 // forward the XML-RPC response to the client 211 // forward the XML-RPC response to the client
175 writer.WriteLine("HTTP/1.0 200 OK"); 212 writer.WriteLine("HTTP/1.0 200 OK");
176 writer.WriteLine("Content-type: text/xml"); 213 writer.WriteLine("Content-type: text/xml");
177 writer.WriteLine(); 214 writer.WriteLine();
178 215
179 216 XmlTextWriter responseWriter = new XmlTextWriter(writer);
180 StreamReader SR; 217 XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
181 string lines; 218 responseWriter.Close();
182 SR=File.OpenText("login.dat");
183 lines=SR.ReadLine();
184 writer.WriteLine(lines);
185
186 lines=SR.ReadLine();
187 //lines="<member><name>session_id</name><value><string>"+Agent.ToString()+"</string></value></member>";
188 lines="<member><name>session_id</name><value><string>99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead</string></value></member>";
189 writer.WriteLine(lines);
190 lines=SR.ReadLine();
191 writer.WriteLine(lines);
192 lines=SR.ReadLine();
193 //lines="<member><name>agent_id</name><value><string>"+Session.ToString()+"</string></value></member>";
194 lines="<member><name>agent_id</name><value><string>aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797</string></value></member>";
195 writer.WriteLine(lines);
196 lines=SR.ReadLine();
197
198 while(lines!="end-mfile")
199 {
200 writer.WriteLine(lines);
201 lines=SR.ReadLine();
202 }
203 SR.Close();
204 } 219 }
205 } 220 }
206 } 221 }
diff --git a/Physics_manager.cs b/Physics_manager.cs
index 82b581c..17f3340 100644
--- a/Physics_manager.cs
+++ b/Physics_manager.cs
@@ -1,7 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 3* All rights reserved.
6* 4*
7* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
diff --git a/Prim_manager.cs b/Prim_manager.cs
index 1dc075b..56eccfc 100644
--- a/Prim_manager.cs
+++ b/Prim_manager.cs
@@ -1,7 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 3* All rights reserved.
6* 4*
7* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
diff --git a/SceneGraphManager.cs b/SceneGraphManager.cs
new file mode 100644
index 0000000..739eccb
--- /dev/null
+++ b/SceneGraphManager.cs
@@ -0,0 +1,40 @@
1/*
2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*/
26
27using System;
28
29namespace OpenSim
30{
31 /// <summary>
32 /// Description of SceneGraphManager.
33 /// </summary>
34 public class SceneGraphManager
35 {
36 public SceneGraphManager()
37 {
38 }
39 }
40}
diff --git a/Script_manager.cs b/Script_manager.cs
index 354247b..87a32d0 100644
--- a/Script_manager.cs
+++ b/Script_manager.cs
@@ -1,7 +1,5 @@
1/* 1/*
2 * Copyright (c) 2007 Michael Wright 2 Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 3* All rights reserved.
6* 4*
7* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
diff --git a/Second-server.csproj b/Second-server.csproj
index bb1c558..5f626d3 100644
--- a/Second-server.csproj
+++ b/Second-server.csproj
@@ -45,15 +45,16 @@
45 <Compile Include="Agent_Manager.cs" /> 45 <Compile Include="Agent_Manager.cs" />
46 <Compile Include="Controller.cs" /> 46 <Compile Include="Controller.cs" />
47 <Compile Include="Prim_manager.cs" /> 47 <Compile Include="Prim_manager.cs" />
48 <Compile Include="Texture_manager.cs" />
49 <Compile Include="Login_manager.cs" /> 48 <Compile Include="Login_manager.cs" />
50 <Compile Include="Physics_manager.cs" /> 49 <Compile Include="Physics_manager.cs" />
51 <Compile Include="Asset_manager.cs" />
52 <Compile Include="Script_manager.cs" /> 50 <Compile Include="Script_manager.cs" />
53 <Compile Include="Server.cs" /> 51 <Compile Include="Server.cs" />
54 <Compile Include="StorageManager.cs" /> 52 <Compile Include="StorageManager.cs" />
55 <Compile Include="GridManager.cs" /> 53 <Compile Include="GridManager.cs" />
56 <Compile Include="Globals.cs" /> 54 <Compile Include="Globals.cs" />
55 <Compile Include="InventoryManager.cs" />
56 <Compile Include="SceneGraphManager.cs" />
57 <Compile Include="AssetManagement.cs" />
57 </ItemGroup> 58 </ItemGroup>
58 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> 59 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
59</Project> \ No newline at end of file 60</Project> \ No newline at end of file
diff --git a/StorageManager.cs b/StorageManager.cs
index 2c6b7e0..596e4e6 100644
--- a/StorageManager.cs
+++ b/StorageManager.cs
@@ -1,7 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 3* All rights reserved.
6* 4*
7* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
diff --git a/Texture_manager.cs b/Texture_manager.cs
index 7177cb6..daf1452 100644
--- a/Texture_manager.cs
+++ b/Texture_manager.cs
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3 3
4* Copyright (c) <year>, <copyright holder> 4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 5* All rights reserved.
@@ -165,6 +165,7 @@ namespace OpenSim
165 TextureImage im=new TextureImage(); 165 TextureImage im=new TextureImage();
166 im.filename="testpic2.jp2"; 166 im.filename="testpic2.jp2";
167 im.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005"); 167 im.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005");
168 im.Name="test Texture";
168 this.LoadImage(im); 169 this.LoadImage(im);
169 this.textures.Add(im.Full_ID,im); 170 this.textures.Add(im.Full_ID,im);
170 171
@@ -219,11 +220,11 @@ namespace OpenSim
219 220
220 } 221 }
221 } 222 }
222 public class TextureImage 223 public class TextureImage: AssetBase
223 { 224 {
224 public byte[] data; 225 //public byte[] data;
225 public LLUUID Full_ID; 226 //public LLUUID Full_ID;
226 public string name; 227 //public string name;
227 public string filename; 228 public string filename;
228 public bool loaded; 229 public bool loaded;
229 public ulong last_used; //need to add a tick/time counter and keep record 230 public ulong last_used; //need to add a tick/time counter and keep record
diff --git a/bin/Release/new-login.dat b/bin/Release/new-login.dat
new file mode 100644
index 0000000..4833533
--- /dev/null
+++ b/bin/Release/new-login.dat
@@ -0,0 +1,2 @@
1<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><struct><member><name>message</name><value><string>Welcome to OpenSim</string></value></member><member><name>session_id</name><value><string>99998888-8520-4f52-8ec1-0b1d5cd6aead</string></value></member><member><name>inventory-skel-lib</name><value><array><data /></array></value></member><member><name>sim_port</name><value><i4>1000</i4></value></member><member><name>agent_access</name><value><string>M</string></value></member><member><name>event_notifications</name><value><array><data /></array></value></member><member><name>start_location</name><value><string>last</string></value></member><member><name>global-textures</name><value><array><data><value><struct><member><name>sun_texture_id</name><value><string>cce0f112-878f-4586-a2e2-a8f104bba271</string></value></member><member><name>cloud_texture_id</name><value><string>fc4b9f0b-d008-45c6-96a4-01dd947ac621</string></value></member><member><name>moon_texture_id</name><value><string>d07f6eed-b96a-47cd-b51d-400ad4a1c428</string></value></member></struct></value></data></array></value></member><member><name>seconds_since_epoch</name><value><i4>1169908672</i4></value></member><member><name>first_name</name><value><string>"Test"</string></value></member><member><name>circuit_code</name><value><i4>50633318</i4></value></member><member><name>event_categories</name><value><array><data /></array></value></member><member><name>login-flags</name><value><array><data><value><struct><member><name>stipend_since_login</name><value><string>N</string></value></member><member><name>ever_logged_in</name><value><string>Y</string></value></member><member><name>gendered</name><value><string>Y</string></value></member><member><name>daylight_savings</name><value><string>N</string></value></member></struct></value></data></array></value></member><member><name>seed_capability</name><value /></member><member><name>home</name><value><string>{'region_handle':[r258560, r259840], 'position':[r41.6589, r100.8374, r22.5072], 'look_at':[r-0.57343, r-0.819255,r0]}</string></value></member><member><name>secure_session_id</name><value><string>71810f75-7437-49fb-8963-02b8fd1b95bf</string></value></member><member><name>last_name</name><value><string>User</string></value></member><member><name>ui-config</name><value><array><data><value><struct><member><name>allow_first_life</name><value><string>Y</string></value></member></struct></value></data></array></value></member><member><name>classified_categories</name><value><array><data><value><struct><member><name>category_name</name><value><string>Shopping</string></value></member><member><name>category_id</name><value><i4>1</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>Land Rental</string></value></member><member><name>category_id</name><value><i4>2</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>Property Rental</string></value></member><member><name>category_id</name><value><i4>3</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>Special Attraction</string></value></member><member><name>category_id</name><value><i4>4</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>New Products</string></value></member><member><name>category_id</name><value><i4>5</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>Employment</string></value></member><member><name>category_id</name><value><i4>6</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>Wanted</string></value></member><member><name>category_id</name><value><i4>7</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>Service</string></value></member><member><name>category_id</name><value><i4>8</i4></value></member></struct></value><value><struct><member><name>category_name</name><value><string>Personal</string></value></member><member><name>category_id</name><value><i4>9</i4></value></member></struct></value></data></array></value></member><member><name>region_x</name><value><i4>255232</i4></value></member><member><name>inventory-skeleton</name><value><array><data><value><struct><member><name>name</name><value><string>My Inventory</string></value></member><member><name>parent_id</name><value><string>00000000-0000-0000-0000-000000000000</string></value></member><member><name>version</name><value><i4>4</i4></value></member><member><name>type_default</name><value><i4>8</i4></value></member><member><name>folder_id</name><value><string>f798e114-c10f-409b-a90d-a11577ff1de8</string></value></member></struct></value><value><struct><member><name>name</name><value><string>Textures</string></value></member><member><name>parent_id</name><value><string>f798e114-c10f-409b-a90d-a11577ff1de8</string></value></member><member><name>version</name><value><i4>1</i4></value></member><member><name>type_default</name><value><i4>0</i4></value></member><member><name>folder_id</name><value><string>fc8b4059-30bb-43a8-a042-46f5b431ad82</string></value></member></struct></value></data></array></value></member><member><name>sim_ip</name><value><string>127.0.0.1</string></value></member><member><name>region_y</name><value><i4>254976</i4></value></member><member><name>gestures</name><value><array><data /></array></value></member><member><name>inventory-lib-owner</name><value><array><data /></array></value></member><member><name>inventory-root</name><value><array><data><value><struct><member><name>folder_id</name><value><string>f798e114-c10f-409b-a90d-a11577ff1de8</string></value></member></struct></value></data></array></value></member><member><name>login</name><value><string>true</string></value></member><member><name>look_at</name><value><string>[r0.99949799999999999756,r0.03166859999999999814,r0]</string></value></member><member><name>agent_id</name><value><string>aaaabbbb-8932-0271-8664-58f53e442797</string></value></member><member><name>inventory-lib-root</name><value><array><data /></array></value></member><member><name>initial-outfit</name><value><array><data><value><struct><member><name>folder_name</name><value><string>Nightclub Female</string></value></member><member><name>gender</name><value><string>female</string></value></member></struct></value></data></array></value></member></struct></value></param></params></methodResponse>
2end-mfile \ No newline at end of file