Basic Inventory support and clean up
parent
c113086dcd
commit
dc2316de9c
295
Agent_Manager.cs
295
Agent_Manager.cs
|
@ -207,30 +207,18 @@ namespace OpenSim
|
|||
/// <param name="name"></param>
|
||||
private void SetupTemplate(string name)
|
||||
{
|
||||
/*ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
||||
objupdate.RegionData.RegionHandle=1096213093147648;
|
||||
objupdate.RegionData.TimeDilation=64096;
|
||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
*/
|
||||
|
||||
int i=0;
|
||||
FileInfo fInfo = new FileInfo(name);
|
||||
|
||||
long numBytes = fInfo.Length;
|
||||
|
||||
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
||||
|
||||
BinaryReader br = new BinaryReader(fStream);
|
||||
|
||||
byte [] data1 = br.ReadBytes((int)numBytes);
|
||||
|
||||
br.Close();
|
||||
|
||||
fStream.Close();
|
||||
|
||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
||||
|
||||
//objupdate.ObjectData[0]=objdata;
|
||||
|
||||
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||
libsecondlife.LLVector3 pos=new LLVector3(objdata.ObjectData, 16);
|
||||
pos.X=100f;
|
||||
|
@ -239,7 +227,6 @@ namespace OpenSim
|
|||
libsecondlife.LLVector3 pos2=new LLVector3(13.981f,100.0f,20.0f);
|
||||
//objdata.FullID=user.AgentID;
|
||||
byte[] pb=pos.GetBytes();
|
||||
|
||||
Array.Copy(pb,0,objdata.ObjectData,16,pb.Length);
|
||||
|
||||
AvatarTemplate=objdata;
|
||||
|
@ -254,50 +241,50 @@ namespace OpenSim
|
|||
{
|
||||
|
||||
//shouldn't have to read all this in from disk for every new client
|
||||
string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\layer_data\";
|
||||
string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\layer_data\";
|
||||
|
||||
//send layerdata
|
||||
LayerDataPacket layerpack=new LayerDataPacket();
|
||||
layerpack.LayerID.Type=76;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata0.dat");
|
||||
//send layerdata
|
||||
LayerDataPacket layerpack=new LayerDataPacket();
|
||||
layerpack.LayerID.Type=76;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata0.dat");
|
||||
|
||||
LayerDataPacket layerpack1=new LayerDataPacket();
|
||||
layerpack1.LayerID.Type=76;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata1.dat");
|
||||
LayerDataPacket layerpack1=new LayerDataPacket();
|
||||
layerpack1.LayerID.Type=76;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata1.dat");
|
||||
|
||||
LayerDataPacket layerpack2=new LayerDataPacket();
|
||||
layerpack2.LayerID.Type=56;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata2.dat");
|
||||
LayerDataPacket layerpack2=new LayerDataPacket();
|
||||
layerpack2.LayerID.Type=56;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata2.dat");
|
||||
|
||||
LayerDataPacket layerpack3=new LayerDataPacket();
|
||||
layerpack3.LayerID.Type=55;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata3.dat");
|
||||
LayerDataPacket layerpack3=new LayerDataPacket();
|
||||
layerpack3.LayerID.Type=55;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata3.dat");
|
||||
|
||||
LayerDataPacket layerpack4=new LayerDataPacket();
|
||||
layerpack4.LayerID.Type=56;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata4.dat");
|
||||
LayerDataPacket layerpack4=new LayerDataPacket();
|
||||
layerpack4.LayerID.Type=56;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata4.dat");
|
||||
|
||||
LayerDataPacket layerpack5=new LayerDataPacket();
|
||||
layerpack5.LayerID.Type=55;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata5.dat");
|
||||
LayerDataPacket layerpack5=new LayerDataPacket();
|
||||
layerpack5.LayerID.Type=55;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata5.dat");
|
||||
|
||||
//send intial set of captured prims data?
|
||||
this.Prim_Manager.ReadPrimDatabase( "objectdatabase.ini",User_info);
|
||||
//send intial set of captured prims data?
|
||||
this.Prim_Manager.ReadPrimDatabase( "objectdatabase.ini",User_info);
|
||||
|
||||
//send prims that have been created by users
|
||||
//prim_man.send_existing_prims(User_info);
|
||||
//send prims that have been created by users
|
||||
//prim_man.send_existing_prims(User_info);
|
||||
|
||||
//send update about clients avatar
|
||||
this.SendInitialAvatarPosition(User_info);
|
||||
//send update about clients avatar
|
||||
this.SendInitialAvatarPosition(User_info);
|
||||
|
||||
//send updates about all other users
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
||||
//send updates about all other users
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
||||
{
|
||||
this.SendOtherAvatarPosition(User_info,kp.Value);
|
||||
}
|
||||
this.SendOtherAvatarPosition(User_info,kp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -456,26 +443,26 @@ namespace OpenSim
|
|||
/// <param name="line"></param>
|
||||
public void SendChatMessage(User_Agent_info User_info, string line)
|
||||
{
|
||||
libsecondlife.Packets.ChatFromSimulatorPacket reply=new ChatFromSimulatorPacket();
|
||||
reply.ChatData.Audible=1;
|
||||
reply.ChatData.Message=enc.GetBytes(line);
|
||||
reply.ChatData.ChatType=1;
|
||||
reply.ChatData.SourceType=1;
|
||||
reply.ChatData.Position=new LLVector3(120,100,21); //should set to actual position
|
||||
reply.ChatData.FromName=enc.GetBytes(User_info.first_name +" "+User_info.last_name +"\0"); //enc.GetBytes("Echo: \0"); //and actual name
|
||||
reply.ChatData.OwnerID=User_info.AgentID;
|
||||
reply.ChatData.SourceID=User_info.AgentID;
|
||||
//echo to sender
|
||||
server.SendPacket(reply,true,User_info);
|
||||
libsecondlife.Packets.ChatFromSimulatorPacket reply=new ChatFromSimulatorPacket();
|
||||
reply.ChatData.Audible=1;
|
||||
reply.ChatData.Message=enc.GetBytes(line);
|
||||
reply.ChatData.ChatType=1;
|
||||
reply.ChatData.SourceType=1;
|
||||
reply.ChatData.Position=new LLVector3(120,100,21); //should set to actual position
|
||||
reply.ChatData.FromName=enc.GetBytes(User_info.first_name +" "+User_info.last_name +"\0"); //enc.GetBytes("Echo: \0"); //and actual name
|
||||
reply.ChatData.OwnerID=User_info.AgentID;
|
||||
reply.ChatData.SourceID=User_info.AgentID;
|
||||
//echo to sender
|
||||
server.SendPacket(reply,true,User_info);
|
||||
|
||||
//send to all users
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
||||
{
|
||||
server.SendPacket(reply,true,kp.Value.NetInfo);
|
||||
}
|
||||
}
|
||||
//send to all users
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
||||
{
|
||||
server.SendPacket(reply,true,kp.Value.NetInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -490,121 +477,121 @@ namespace OpenSim
|
|||
/// <param name="body"></param>
|
||||
public void SendMoveCommand(User_Agent_info user, bool stop,float x, float y, float z, uint av_id, libsecondlife.LLQuaternion body)
|
||||
{
|
||||
uint ID=user.localID;
|
||||
//ID=av_id;
|
||||
byte[] bytes=new byte[60];
|
||||
uint ID=user.localID;
|
||||
//ID=av_id;
|
||||
byte[] bytes=new byte[60];
|
||||
|
||||
ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket();
|
||||
im.RegionData.RegionHandle=Globals.Instance.RegionHandle;;
|
||||
im.RegionData.TimeDilation=64096;
|
||||
ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket();
|
||||
im.RegionData.RegionHandle=Globals.Instance.RegionHandle;;
|
||||
im.RegionData.TimeDilation=64096;
|
||||
|
||||
im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
int i=0;
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
||||
im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
int i=0;
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
||||
|
||||
im.ObjectData[0]=dat;
|
||||
im.ObjectData[0]=dat;
|
||||
|
||||
dat.TextureEntry=AvatarTemplate.TextureEntry;
|
||||
libsecondlife.LLVector3 pos2=new LLVector3(x,y,z);
|
||||
dat.TextureEntry=AvatarTemplate.TextureEntry;
|
||||
libsecondlife.LLVector3 pos2=new LLVector3(x,y,z);
|
||||
|
||||
bytes[i++] = (byte)(ID % 256);
|
||||
bytes[i++] = (byte)((ID >> 8) % 256);
|
||||
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||
bytes[i++] = (byte)(ID % 256);
|
||||
bytes[i++] = (byte)((ID >> 8) % 256);
|
||||
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||
|
||||
bytes[i++]=0;
|
||||
bytes[i++]=1;
|
||||
bytes[i++]=0;
|
||||
bytes[i++]=1;
|
||||
|
||||
i+=14;
|
||||
bytes[i++]=128;
|
||||
bytes[i++]=63;
|
||||
byte[] pb=pos2.GetBytes();
|
||||
i+=14;
|
||||
bytes[i++]=128;
|
||||
bytes[i++]=63;
|
||||
byte[] pb=pos2.GetBytes();
|
||||
|
||||
Array.Copy(pb,0,bytes,i,pb.Length);
|
||||
i+=12;
|
||||
ushort ac=32767;
|
||||
Axiom.MathLib.Vector3 v3=new Axiom.MathLib.Vector3(1,0,0);
|
||||
Axiom.MathLib.Quaternion q=new Axiom.MathLib.Quaternion(body.W,body.X,body.Y,body.Z);
|
||||
Axiom.MathLib.Vector3 direc=q*v3;
|
||||
direc.Normalize();
|
||||
Array.Copy(pb,0,bytes,i,pb.Length);
|
||||
i+=12;
|
||||
ushort ac=32767;
|
||||
Axiom.MathLib.Vector3 v3=new Axiom.MathLib.Vector3(1,0,0);
|
||||
Axiom.MathLib.Quaternion q=new Axiom.MathLib.Quaternion(body.W,body.X,body.Y,body.Z);
|
||||
Axiom.MathLib.Vector3 direc=q*v3;
|
||||
direc.Normalize();
|
||||
|
||||
direc=direc*(0.03f);
|
||||
direc.x+=1;
|
||||
direc.y+=1;
|
||||
direc.z+=1;
|
||||
ushort dx,dy,dz;
|
||||
dx=(ushort)(32768*direc.x);
|
||||
dy=(ushort)(32768*direc.y);
|
||||
dz=(ushort)(32768*direc.z);
|
||||
direc=direc*(0.03f);
|
||||
direc.x+=1;
|
||||
direc.y+=1;
|
||||
direc.z+=1;
|
||||
ushort dx,dy,dz;
|
||||
dx=(ushort)(32768*direc.x);
|
||||
dy=(ushort)(32768*direc.y);
|
||||
dz=(ushort)(32768*direc.z);
|
||||
|
||||
//vel
|
||||
if(!stop)
|
||||
{
|
||||
bytes[i++] = (byte)(dx % 256);
|
||||
bytes[i++] = (byte)((dx >> 8) % 256);
|
||||
//vel
|
||||
if(!stop)
|
||||
{
|
||||
bytes[i++] = (byte)(dx % 256);
|
||||
bytes[i++] = (byte)((dx >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(dy % 256);
|
||||
bytes[i++] = (byte)((dy >> 8) % 256);
|
||||
bytes[i++] = (byte)(dy % 256);
|
||||
bytes[i++] = (byte)((dy >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(dz % 256);
|
||||
bytes[i++] = (byte)((dz >> 8) % 256);
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(dz % 256);
|
||||
bytes[i++] = (byte)((dz >> 8) % 256);
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
}
|
||||
//accel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
}
|
||||
//accel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
//rot
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
//rot
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
//rotation vel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
//rotation vel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
dat.Data=bytes;
|
||||
dat.Data=bytes;
|
||||
|
||||
server.SendPacket(im,true,user);
|
||||
server.SendPacket(im,true,user);
|
||||
|
||||
//should send to all users.
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=user.AgentID)
|
||||
{
|
||||
server.SendPacket(im,true,kp.Value.NetInfo);
|
||||
}
|
||||
}
|
||||
//should send to all users.
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=user.AgentID)
|
||||
{
|
||||
server.SendPacket(im,true,kp.Value.NetInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -72,14 +72,14 @@ namespace OpenSim
|
|||
AssetInfo Asset=new AssetInfo();
|
||||
Asset.filename="base_shape.dat";
|
||||
Asset.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
this.LoadAsset(Asset);
|
||||
this.Assets.Add(Asset.Full_ID,Asset);
|
||||
this.LoadAsset(Asset, false);
|
||||
this.Assets.Add(Asset.Full_ID, Asset);
|
||||
|
||||
Asset=new AssetInfo();
|
||||
Asset.filename="base_skin.dat";
|
||||
Asset.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
|
||||
this.LoadAsset(Asset);
|
||||
this.Assets.Add(Asset.Full_ID,Asset);
|
||||
this.LoadAsset(Asset, false);
|
||||
this.Assets.Add(Asset.Full_ID, Asset);
|
||||
|
||||
//our test images
|
||||
//Change these filenames to images you want to use.
|
||||
|
@ -87,20 +87,20 @@ namespace OpenSim
|
|||
Image.filename="testpic2.jp2";
|
||||
Image.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||
Image.Name="test Texture";
|
||||
this.LoadImage(Image);
|
||||
this.Textures.Add(Image.Full_ID,Image);
|
||||
this.LoadAsset(Image, true);
|
||||
this.Textures.Add(Image.Full_ID, Image);
|
||||
|
||||
Image=new TextureImage();
|
||||
Image.filename="map_base.jp2";
|
||||
Image.Full_ID=new LLUUID("00000000-0000-0000-7007-000000000006");
|
||||
this.LoadImage(Image);
|
||||
this.Textures.Add(Image.Full_ID,Image);
|
||||
this.LoadAsset(Image, true);
|
||||
this.Textures.Add(Image.Full_ID, Image);
|
||||
|
||||
Image=new TextureImage();
|
||||
Image.filename="map1.jp2";
|
||||
Image.Full_ID=new LLUUID("00000000-0000-0000-7009-000000000008");
|
||||
this.LoadImage(Image);
|
||||
this.Textures.Add(Image.Full_ID,Image);
|
||||
this.LoadAsset(Image, true);
|
||||
this.Textures.Add(Image.Full_ID, Image);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -129,7 +129,7 @@ namespace OpenSim
|
|||
Transfer.TransferInfo.Size=info.data.Length;
|
||||
Transfer.TransferInfo.TransferID=TransferRequest.TransferInfo.TransferID;
|
||||
|
||||
server.SendPacket(Transfer,true,UserInfo);
|
||||
server.SendPacket(Transfer, true, UserInfo);
|
||||
|
||||
TransferPacketPacket TransferPacket=new TransferPacketPacket();
|
||||
TransferPacket.TransferData.Packet=0;
|
||||
|
@ -148,16 +148,16 @@ namespace OpenSim
|
|||
TransferPacket.TransferData.ChannelType=2;
|
||||
TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
|
||||
byte[] chunk1=new byte[(info.data.Length-1000)];
|
||||
Array.Copy(info.data,1000,chunk1,0,chunk1.Length);
|
||||
Array.Copy(info.data, 1000, chunk1, 0, chunk1.Length);
|
||||
TransferPacket.TransferData.Data=chunk1;
|
||||
TransferPacket.TransferData.Status=1;
|
||||
server.SendPacket(TransferPacket,true,UserInfo);
|
||||
server.SendPacket(TransferPacket, true, UserInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
TransferPacket.TransferData.Status=1; //last packet? so set to 1
|
||||
TransferPacket.TransferData.Data=info.data;
|
||||
server.SendPacket(TransferPacket,true,UserInfo);
|
||||
server.SendPacket(TransferPacket, true, UserInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -166,12 +166,12 @@ namespace OpenSim
|
|||
{
|
||||
//Create Folders
|
||||
LLUUID BaseFolder=Avata.BaseFolder;
|
||||
InventoryManager.CreateNewFolder(UserInfo,Avata.InventoryFolder);
|
||||
InventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder);
|
||||
InventoryManager.CreateNewFolder(UserInfo, BaseFolder);
|
||||
|
||||
//Give a copy of default shape
|
||||
AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")];
|
||||
AssetInfo Shape=this.CloneAsset(UserInfo.AgentID,Base);
|
||||
AssetInfo Shape=this.CloneAsset(UserInfo.AgentID, Base);
|
||||
|
||||
Shape.filename="";
|
||||
Shape.Name="Default Shape";
|
||||
|
@ -180,15 +180,15 @@ namespace OpenSim
|
|||
Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
||||
|
||||
byte[] Agentid=enc.GetBytes(UserInfo.AgentID.ToStringHyphenated());
|
||||
Array.Copy(Agentid,0,Shape.data,294,Agentid.Length);
|
||||
this.Assets.Add(Shape.Full_ID,Shape);
|
||||
Array.Copy(Agentid, 0, Shape.data, 294, Agentid.Length);
|
||||
this.Assets.Add(Shape.Full_ID, Shape);
|
||||
|
||||
Avata.Wearables[0].ItemID=InventoryManager.AddToInventory(UserInfo,BaseFolder,Shape);
|
||||
Avata.Wearables[0].ItemID=InventoryManager.AddToInventory(UserInfo, BaseFolder, Shape);
|
||||
Avata.Wearables[0].AssetID=Shape.Full_ID;
|
||||
|
||||
//Give copy of default skin
|
||||
Base=this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")];
|
||||
AssetInfo Skin=this.CloneAsset(UserInfo.AgentID,Base);
|
||||
AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base);
|
||||
|
||||
Skin.filename="";
|
||||
Skin.Name="Default Skin";
|
||||
|
@ -197,25 +197,33 @@ namespace OpenSim
|
|||
Skin.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
||||
|
||||
Array.Copy(Agentid,0,Skin.data,238,Agentid.Length);
|
||||
this.Assets.Add(Skin.Full_ID,Skin);
|
||||
this.Assets.Add(Skin.Full_ID, Skin);
|
||||
|
||||
Avata.Wearables[1].ItemID=InventoryManager.AddToInventory(UserInfo,BaseFolder,Skin);
|
||||
Avata.Wearables[1].ItemID=InventoryManager.AddToInventory(UserInfo, BaseFolder, Skin);
|
||||
Avata.Wearables[1].AssetID=Skin.Full_ID;
|
||||
|
||||
//give a copy of test texture
|
||||
TextureImage Texture=this.CloneImage(UserInfo.AgentID,Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]);
|
||||
this.Textures.Add(Texture.Full_ID,Texture);
|
||||
InventoryManager.AddToInventory(UserInfo,BaseFolder,Texture);
|
||||
this.Textures.Add(Texture.Full_ID, Texture);
|
||||
InventoryManager.AddToInventory(UserInfo, BaseFolder, Texture);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void LoadAsset(AssetInfo info)
|
||||
private void LoadAsset(AssetBase info, bool Image)
|
||||
{
|
||||
//should request Asset from storage manager
|
||||
//but for now read from file
|
||||
|
||||
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\assets\";
|
||||
string folder;
|
||||
if(Image)
|
||||
{
|
||||
folder=@"\textures\";
|
||||
}
|
||||
else
|
||||
{
|
||||
folder=@"\assets\";
|
||||
}
|
||||
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + folder;
|
||||
string filename=data_path+@info.filename;
|
||||
FileInfo fInfo = new FileInfo(filename);
|
||||
|
||||
|
@ -228,7 +236,7 @@ namespace OpenSim
|
|||
br.Close();
|
||||
fStream.Close();
|
||||
info.data=idata;
|
||||
info.loaded=true;
|
||||
//info.loaded=true;
|
||||
}
|
||||
|
||||
public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset)
|
||||
|
@ -252,7 +260,7 @@ namespace OpenSim
|
|||
//not found image so send back image not in data base message
|
||||
ImageNotInDatabasePacket im_not=new ImageNotInDatabasePacket();
|
||||
im_not.ImageID.ID=image_id;
|
||||
server.SendPacket(im_not,true,user);
|
||||
server.SendPacket(im_not, true, user);
|
||||
return;
|
||||
}
|
||||
TextureImage imag=this.Textures[image_id];
|
||||
|
@ -348,27 +356,6 @@ namespace OpenSim
|
|||
|
||||
}
|
||||
|
||||
private void LoadImage(TextureImage im)
|
||||
{
|
||||
//should request Image from StorageManager
|
||||
//but for now read from file
|
||||
|
||||
string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\textures\";
|
||||
string filename=data_path+@im.filename;
|
||||
FileInfo fInfo = new FileInfo(filename);
|
||||
|
||||
long numBytes = fInfo.Length;
|
||||
|
||||
FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
|
||||
byte[] idata=new byte[numBytes];
|
||||
BinaryReader br = new BinaryReader(fStream);
|
||||
idata= br.ReadBytes((int)numBytes);
|
||||
br.Close();
|
||||
fStream.Close();
|
||||
im.data=idata;
|
||||
im.loaded=true;
|
||||
}
|
||||
|
||||
public TextureImage CloneImage(LLUUID NewOwner,TextureImage Source)
|
||||
{
|
||||
TextureImage NewImage=new TextureImage();
|
||||
|
@ -401,7 +388,6 @@ namespace OpenSim
|
|||
{
|
||||
//public byte[] data;
|
||||
//public LLUUID Full_ID;
|
||||
public string filename;
|
||||
public bool loaded;
|
||||
public ulong last_used; //need to add a tick/time counter and keep record
|
||||
// of how often images are requested to unload unused ones.
|
||||
|
@ -420,13 +406,14 @@ namespace OpenSim
|
|||
public sbyte InvType;
|
||||
public string Name;
|
||||
public string Description;
|
||||
public string filename;
|
||||
|
||||
public AssetBase()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
public class TextureRequest
|
||||
public class TextureRequest
|
||||
{
|
||||
public User_Agent_info RequestUser;
|
||||
public LLUUID RequestImage;
|
||||
|
@ -442,13 +429,13 @@ namespace OpenSim
|
|||
}
|
||||
public class TextureImage: AssetBase
|
||||
{
|
||||
//any need for this class now most has been moved into AssetBase?
|
||||
//public byte[] data;
|
||||
//public LLUUID Full_ID;
|
||||
//public string name;
|
||||
public string filename;
|
||||
public bool loaded;
|
||||
public ulong last_used; //need to add a tick/time counter and keep record
|
||||
// of how often images are requested to unload unused ones.
|
||||
// of how often images are requested to unload unused ones.
|
||||
|
||||
public TextureImage()
|
||||
{
|
||||
|
|
|
@ -58,7 +58,6 @@ namespace OpenSim
|
|||
public Logon _login;
|
||||
private AgentManager Agent_Manager;
|
||||
private PrimManager Prim_Manager;
|
||||
// private TextureManager Texture_Manager;
|
||||
private AssetManagement Asset_Manager;
|
||||
private GridManager Grid_Manager;
|
||||
private InventoryManager Inventory_Manager;
|
||||
|
@ -72,21 +71,21 @@ namespace OpenSim
|
|||
server = new Server( this );
|
||||
Agent_Manager = new AgentManager( this.server );
|
||||
Prim_Manager = new PrimManager( this.server );
|
||||
// Texture_Manager = new TextureManager( this.server );
|
||||
Asset_Manager = new AssetManagement( this.server );
|
||||
Prim_Manager.Agent_Manager = Agent_Manager;
|
||||
Agent_Manager.Prim_Manager = Prim_Manager;
|
||||
Agent_Manager.Asset_Manager=Asset_Manager;
|
||||
Inventory_Manager=new InventoryManager(this.server);
|
||||
Asset_Manager.InventoryManager=Inventory_Manager;
|
||||
// Asset_Manager.TextureMan=Texture_Manager;
|
||||
Grid_Manager=new GridManager(this.server,Agent_Manager);
|
||||
|
||||
if(Globals.Instance.LoginSever)
|
||||
{
|
||||
Console.WriteLine("Starting login Server");
|
||||
Login_Manager = new LoginManager(_login); // startup
|
||||
Login_Manager.Startup(); // login server
|
||||
}
|
||||
|
||||
timer1.Enabled = true;
|
||||
timer1.Interval = 200;
|
||||
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
|
||||
|
@ -103,7 +102,7 @@ namespace OpenSim
|
|||
|
||||
//should replace with a switch
|
||||
if( pack.Type == PacketType.AgentSetAppearance ) {
|
||||
// System.Console.WriteLine(pack);
|
||||
//System.Console.WriteLine(pack);
|
||||
//this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type;
|
||||
|
||||
}
|
||||
|
@ -143,10 +142,7 @@ namespace OpenSim
|
|||
else if( pack.Type == PacketType.TransferRequest ) {
|
||||
TransferRequestPacket tran = (TransferRequestPacket)pack;
|
||||
LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 );
|
||||
|
||||
// if( ( id == new LLUUID( "66c41e39-38f9-f75a-024e-585989bfab73" ) ) || ( id == new LLUUID( "e0ee49b5a4184df8d3c9a65361fe7f49" ) ) ) {
|
||||
Asset_Manager.AddAssetRequest( User_info, id, tran );
|
||||
// }
|
||||
Asset_Manager.AddAssetRequest( User_info, id, tran );
|
||||
|
||||
}
|
||||
else if( ( pack.Type == PacketType.StartPingCheck ) ) {
|
||||
|
@ -156,23 +152,26 @@ namespace OpenSim
|
|||
endping.PingID.PingID = startp.PingID.PingID;
|
||||
server.SendPacket( endping, true, User_info );
|
||||
}
|
||||
else if( pack.Type == PacketType.CompleteAgentMovement ) {
|
||||
else if( pack.Type == PacketType.CompleteAgentMovement )
|
||||
{
|
||||
// new client
|
||||
Agent_Manager.AgentJoin( User_info );
|
||||
}
|
||||
else if( pack.Type == PacketType.RequestImage ) {
|
||||
}
|
||||
else if( pack.Type == PacketType.RequestImage )
|
||||
{
|
||||
RequestImagePacket image_req = (RequestImagePacket)pack;
|
||||
for( int i = 0; i < image_req.RequestImage.Length; i++ ) {
|
||||
for( int i = 0; i < image_req.RequestImage.Length; i++ )
|
||||
{
|
||||
this.Asset_Manager.AddTextureRequest( User_info, image_req.RequestImage[ i ].Image );
|
||||
|
||||
}
|
||||
}
|
||||
else if( pack.Type == PacketType.RegionHandshakeReply ) {
|
||||
else if( pack.Type == PacketType.RegionHandshakeReply ) {
|
||||
//recieved regionhandshake so can now start sending info
|
||||
Agent_Manager.SendInitialData( User_info );
|
||||
//this.setuptemplates("objectupate164.dat",User_info,false);
|
||||
}
|
||||
else if( pack.Type == PacketType.ObjectAdd ) {
|
||||
else if( pack.Type == PacketType.ObjectAdd )
|
||||
{
|
||||
ObjectAddPacket ad = (ObjectAddPacket)pack;
|
||||
Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad );
|
||||
//this.send_prim(User_info,ad.ObjectData.RayEnd, ad);
|
||||
|
@ -184,7 +183,8 @@ namespace OpenSim
|
|||
//System.Console.WriteLine(pack.ToString());
|
||||
MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack;
|
||||
|
||||
for( int i = 0; i < mupd.ObjectData.Length; i++ ) {
|
||||
for( int i = 0; i < mupd.ObjectData.Length; i++ )
|
||||
{
|
||||
if( mupd.ObjectData[ i ].Type == 9 ) //change position
|
||||
{
|
||||
libsecondlife.LLVector3 pos = new LLVector3( mupd.ObjectData[ i ].Data, 0 );
|
||||
|
@ -203,19 +203,23 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( pack.Type == PacketType.AgentWearablesRequest ) {
|
||||
else if( pack.Type == PacketType.AgentWearablesRequest )
|
||||
{
|
||||
Agent_Manager.SendIntialAvatarAppearance( User_info );
|
||||
}
|
||||
|
||||
else if( pack.Type == PacketType.AgentUpdate )
|
||||
{
|
||||
AgentUpdatePacket ag = (AgentUpdatePacket)pack;
|
||||
uint mask = ag.AgentData.ControlFlags & ( 1 );
|
||||
AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID );
|
||||
if( m_av != null ) {
|
||||
if( m_av.Started ) {
|
||||
if( mask == ( 1 ) ) {
|
||||
if( !m_av.Walk ) {
|
||||
if( m_av != null )
|
||||
{
|
||||
if( m_av.Started )
|
||||
{
|
||||
if( mask == ( 1 ) )
|
||||
{
|
||||
if( !m_av.Walk )
|
||||
{
|
||||
//start walking
|
||||
Agent_Manager.SendMoveCommand( User_info, false, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation );
|
||||
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 );
|
||||
|
@ -230,8 +234,10 @@ namespace OpenSim
|
|||
m_av.Walk = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( m_av.Walk ) {
|
||||
else
|
||||
{
|
||||
if( m_av.Walk )
|
||||
{
|
||||
//walking but key not pressed so need to stop
|
||||
Agent_Manager.SendMoveCommand( User_info, true, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation );
|
||||
m_av.Walk = false;
|
||||
|
@ -243,7 +249,8 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( pack.Type == PacketType.ChatFromViewer ) {
|
||||
else if( pack.Type == PacketType.ChatFromViewer )
|
||||
{
|
||||
ChatFromViewerPacket chat = (ChatFromViewerPacket)pack;
|
||||
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||
|
||||
|
@ -256,21 +263,25 @@ namespace OpenSim
|
|||
|
||||
line = myString;
|
||||
comp = line.Split( delimiter );
|
||||
if( comp[ 0 ] == "pos" ) {
|
||||
if( comp[ 0 ] == "pos" )
|
||||
{
|
||||
}
|
||||
else if( comp[ 0 ] == "veloc" ) {
|
||||
else if( comp[ 0 ] == "veloc" )
|
||||
{
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Agent_Manager.SendChatMessage( User_info, line );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void NewUserCallback( User_Agent_info UserInfo ) {
|
||||
public void NewUserCallback( User_Agent_info UserInfo )
|
||||
{
|
||||
Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode);
|
||||
string first,last;
|
||||
LLUUID Base,Inventory;
|
||||
string first,last;
|
||||
LLUUID Base,Inventory;
|
||||
lock(_login)
|
||||
{
|
||||
first=_login.first;
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace OpenSim
|
|||
public Dictionary<LLUUID, InventoryItem> Items;
|
||||
private Server server;
|
||||
|
||||
private const uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -118,8 +120,8 @@ namespace OpenSim
|
|||
InventoryFolder Folder=this.Folders[FetchDescend.InventoryData.FolderID];
|
||||
InventoryDescendentsPacket Descend=new InventoryDescendentsPacket();
|
||||
Descend.AgentData.AgentID=User_info.AgentID;
|
||||
Descend.AgentData.OwnerID=Folder.OwnerID;//User_info.AgentID;
|
||||
Descend.AgentData.FolderID=FetchDescend.InventoryData.FolderID;//Folder.FolderID;//new LLUUID("4fb2dab6-a987-da66-05ee-96ca82bccbf1");
|
||||
Descend.AgentData.OwnerID=Folder.OwnerID;
|
||||
Descend.AgentData.FolderID=FetchDescend.InventoryData.FolderID;
|
||||
Descend.AgentData.Descendents=Folder.Items.Count;
|
||||
Descend.AgentData.Version=Folder.Items.Count;
|
||||
|
||||
|
@ -129,26 +131,26 @@ namespace OpenSim
|
|||
|
||||
InventoryItem Item=Folder.Items[i];
|
||||
Descend.ItemData[i]=new InventoryDescendentsPacket.ItemDataBlock();
|
||||
Descend.ItemData[i].ItemID=Item.ItemID;//new LLUUID("b7878441893b094917f791174bc8401c");
|
||||
Descend.ItemData[i].AssetID=Item.AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
Descend.ItemData[i].CreatorID=Item.CreatorID;//User_info.AgentID;
|
||||
Descend.ItemData[i].BaseMask=2147483647;
|
||||
Descend.ItemData[i].ItemID=Item.ItemID;
|
||||
Descend.ItemData[i].AssetID=Item.AssetID;
|
||||
Descend.ItemData[i].CreatorID=Item.CreatorID;
|
||||
Descend.ItemData[i].BaseMask=FULL_MASK_PERMISSIONS;
|
||||
Descend.ItemData[i].CreationDate=1000;
|
||||
Descend.ItemData[i].Description=enc.GetBytes(Item.Description+"\0");
|
||||
Descend.ItemData[i].EveryoneMask=2147483647;;
|
||||
Descend.ItemData[i].EveryoneMask=FULL_MASK_PERMISSIONS;
|
||||
Descend.ItemData[i].Flags=1;
|
||||
Descend.ItemData[i].FolderID=Item.FolderID;//new LLUUID("4fb2dab6-a987-da66-05ee-96ca82bccbf1");
|
||||
Descend.ItemData[i].FolderID=Item.FolderID;
|
||||
Descend.ItemData[i].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||
Descend.ItemData[i].GroupMask=2147483647;
|
||||
Descend.ItemData[i].GroupMask=FULL_MASK_PERMISSIONS;
|
||||
Descend.ItemData[i].InvType=Item.InvType;
|
||||
Descend.ItemData[i].Name=enc.GetBytes(Item.Name+"\0");
|
||||
Descend.ItemData[i].NextOwnerMask=2147483647;
|
||||
Descend.ItemData[i].OwnerID=Item.OwnerID;//User_info.AgentID;
|
||||
Descend.ItemData[i].OwnerMask=2147483647;;
|
||||
Descend.ItemData[i].NextOwnerMask=FULL_MASK_PERMISSIONS;
|
||||
Descend.ItemData[i].OwnerID=Item.OwnerID;
|
||||
Descend.ItemData[i].OwnerMask=FULL_MASK_PERMISSIONS;
|
||||
Descend.ItemData[i].SalePrice=100;
|
||||
Descend.ItemData[i].SaleType=0;
|
||||
Descend.ItemData[i].Type=Item.Type;//libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
||||
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);
|
||||
Descend.ItemData[i].Type=Item.Type;
|
||||
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);
|
||||
}
|
||||
server.SendPacket(Descend,true,User_info);
|
||||
|
||||
|
@ -177,26 +179,26 @@ namespace OpenSim
|
|||
InventoryReply.AgentData.AgentID=User_info.AgentID;
|
||||
InventoryReply.InventoryData=new FetchInventoryReplyPacket.InventoryDataBlock[1];
|
||||
InventoryReply.InventoryData[0]=new FetchInventoryReplyPacket.InventoryDataBlock();
|
||||
InventoryReply.InventoryData[0].ItemID=Item.ItemID;//new LLUUID("b7878441893b094917f791174bc8401c");
|
||||
InventoryReply.InventoryData[0].AssetID=Item.AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
InventoryReply.InventoryData[0].CreatorID=Item.CreatorID;//User_info.AgentID;
|
||||
InventoryReply.InventoryData[0].BaseMask=2147483647;
|
||||
InventoryReply.InventoryData[0].ItemID=Item.ItemID;
|
||||
InventoryReply.InventoryData[0].AssetID=Item.AssetID;
|
||||
InventoryReply.InventoryData[0].CreatorID=Item.CreatorID;
|
||||
InventoryReply.InventoryData[0].BaseMask=FULL_MASK_PERMISSIONS;
|
||||
InventoryReply.InventoryData[0].CreationDate=1000;
|
||||
InventoryReply.InventoryData[0].Description=enc.GetBytes( Item.Description+"\0");
|
||||
InventoryReply.InventoryData[0].EveryoneMask=2147483647;;
|
||||
InventoryReply.InventoryData[0].EveryoneMask=FULL_MASK_PERMISSIONS;
|
||||
InventoryReply.InventoryData[0].Flags=1;
|
||||
InventoryReply.InventoryData[0].FolderID=Item.FolderID;//new LLUUID("4fb2dab6-a987-da66-05ee-96ca82bccbf1");
|
||||
InventoryReply.InventoryData[0].FolderID=Item.FolderID;
|
||||
InventoryReply.InventoryData[0].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||
InventoryReply.InventoryData[0].GroupMask=2147483647;
|
||||
InventoryReply.InventoryData[0].GroupMask=FULL_MASK_PERMISSIONS;
|
||||
InventoryReply.InventoryData[0].InvType=Item.InvType;
|
||||
InventoryReply.InventoryData[0].Name=enc.GetBytes(Item.Name+"\0");
|
||||
InventoryReply.InventoryData[0].NextOwnerMask=2147483647;
|
||||
InventoryReply.InventoryData[0].OwnerID=Item.OwnerID;//User_info.AgentID;
|
||||
InventoryReply.InventoryData[0].OwnerMask=2147483647;;
|
||||
InventoryReply.InventoryData[0].NextOwnerMask=FULL_MASK_PERMISSIONS;
|
||||
InventoryReply.InventoryData[0].OwnerID=Item.OwnerID;
|
||||
InventoryReply.InventoryData[0].OwnerMask=FULL_MASK_PERMISSIONS;
|
||||
InventoryReply.InventoryData[0].SalePrice=100;
|
||||
InventoryReply.InventoryData[0].SaleType=0;
|
||||
InventoryReply.InventoryData[0].Type=Item.Type;//libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
||||
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);
|
||||
InventoryReply.InventoryData[0].Type=Item.Type;
|
||||
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);
|
||||
server.SendPacket(InventoryReply,true,User_info);
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +228,7 @@ namespace OpenSim
|
|||
public LLUUID OwnerID;
|
||||
public LLUUID ItemID;
|
||||
public LLUUID AssetID;
|
||||
public LLUUID CreatorID=LLUUID.Zero;//new LLUUID("3d924400-038e-6ad9-920b-cfbb9b40585c");
|
||||
public LLUUID CreatorID=LLUUID.Zero;
|
||||
public sbyte InvType;
|
||||
public sbyte Type;
|
||||
public string Name;
|
||||
|
|
|
@ -70,38 +70,43 @@ namespace OpenSim
|
|||
runLoginProxy.Start();
|
||||
}
|
||||
|
||||
private void RunLoginProxy() {
|
||||
try {
|
||||
for (;;) {
|
||||
Socket client = loginServer.Accept();
|
||||
IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
|
||||
private void RunLoginProxy()
|
||||
{
|
||||
try
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
Socket client = loginServer.Accept();
|
||||
IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
|
||||
|
||||
|
||||
NetworkStream networkStream = new NetworkStream(client);
|
||||
StreamReader networkReader = new StreamReader(networkStream);
|
||||
StreamWriter networkWriter = new StreamWriter(networkStream);
|
||||
NetworkStream networkStream = new NetworkStream(client);
|
||||
StreamReader networkReader = new StreamReader(networkStream);
|
||||
StreamWriter networkWriter = new StreamWriter(networkStream);
|
||||
|
||||
try
|
||||
{
|
||||
ProxyLogin(networkReader, networkWriter);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
|
||||
networkWriter.Close();
|
||||
networkReader.Close();
|
||||
networkStream.Close();
|
||||
|
||||
client.Close();
|
||||
|
||||
// send any packets queued for injection
|
||||
|
||||
try
|
||||
{
|
||||
ProxyLogin(networkReader, networkWriter);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
|
||||
networkWriter.Close();
|
||||
networkReader.Close();
|
||||
networkStream.Close();
|
||||
|
||||
client.Close();
|
||||
|
||||
// send any packets queued for injection
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine(e.StackTrace);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine(e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
285
Prim_manager.cs
285
Prim_manager.cs
|
@ -133,130 +133,110 @@ namespace OpenSim
|
|||
/// <param name="rotation"></param>
|
||||
public void UpdatePrimPosition(User_Agent_info User,LLVector3 position,uint LocalID,bool setRotation, LLQuaternion rotation)
|
||||
{
|
||||
PrimInfo pri=null;
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,PrimInfo> kp in this.PrimList)
|
||||
{
|
||||
if(kp.Value.LocalID==LocalID)
|
||||
{
|
||||
pri=kp.Value;
|
||||
}
|
||||
}
|
||||
if(pri==null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint ID=pri.LocalID;
|
||||
libsecondlife.LLVector3 pos2=new LLVector3(position.X,position.Y,position.Z);
|
||||
libsecondlife.LLQuaternion rotation2;
|
||||
if(!setRotation)
|
||||
{
|
||||
pri.Position=pos2;
|
||||
rotation2=new LLQuaternion(pri.Rotation.X,pri.Rotation.Y,pri.Rotation.Z,pri.Rotation.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation2=new LLQuaternion(rotation.X,rotation.Y,rotation.Z,rotation.W);
|
||||
PrimInfo pri=null;
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,PrimInfo> kp in this.PrimList)
|
||||
{
|
||||
if(kp.Value.LocalID==LocalID)
|
||||
{
|
||||
pri=kp.Value;
|
||||
}
|
||||
}
|
||||
if(pri==null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint ID=pri.LocalID;
|
||||
libsecondlife.LLVector3 pos2=new LLVector3(position.X,position.Y,position.Z);
|
||||
libsecondlife.LLQuaternion rotation2;
|
||||
if(!setRotation)
|
||||
{
|
||||
pri.Position=pos2;
|
||||
rotation2=new LLQuaternion(pri.Rotation.X,pri.Rotation.Y,pri.Rotation.Z,pri.Rotation.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation2=new LLQuaternion(rotation.X,rotation.Y,rotation.Z,rotation.W);
|
||||
pos2=pri.Position;
|
||||
pri.Rotation=rotation;
|
||||
}
|
||||
rotation2.W+=1;
|
||||
rotation2.X+=1;
|
||||
rotation2.Y+=1;
|
||||
rotation2.Z+=1;
|
||||
|
||||
pos2=pri.Position;
|
||||
pri.Rotation=rotation;
|
||||
}
|
||||
rotation2.W+=1;
|
||||
rotation2.X+=1;
|
||||
rotation2.Y+=1;
|
||||
rotation2.Z+=1;
|
||||
byte[] bytes=new byte[60];
|
||||
|
||||
byte[] bytes=new byte[60];
|
||||
ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket();
|
||||
im.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
||||
im.RegionData.TimeDilation=64096;
|
||||
im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
int i=0;
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
||||
im.ObjectData[0]=dat;
|
||||
dat.TextureEntry=PrimTemplate.TextureEntry;
|
||||
|
||||
ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket();
|
||||
im.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
||||
im.RegionData.TimeDilation=64096;
|
||||
im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
int i=0;
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
||||
im.ObjectData[0]=dat;
|
||||
dat.TextureEntry=PrimTemplate.TextureEntry;
|
||||
//System.Console.WriteLine("new position is :"+position);
|
||||
bytes[i++] = (byte)(ID % 256);
|
||||
bytes[i++] = (byte)((ID >> 8) % 256);
|
||||
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||
bytes[i++]=0;
|
||||
bytes[i++]=0;//1;
|
||||
|
||||
bytes[i++] = (byte)(ID % 256);
|
||||
bytes[i++] = (byte)((ID >> 8) % 256);
|
||||
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||
bytes[i++]=0;
|
||||
bytes[i++]=0;//1;
|
||||
byte[] pb=pos2.GetBytes();
|
||||
pri.Position=pos2;
|
||||
Array.Copy(pb,0,bytes,i,pb.Length);
|
||||
i+=12;
|
||||
ushort ac=32767;
|
||||
|
||||
// i+=14;
|
||||
// bytes[i++]=128;
|
||||
// bytes[i++]=63;
|
||||
byte[] pb=pos2.GetBytes();
|
||||
pri.Position=pos2;
|
||||
Array.Copy(pb,0,bytes,i,pb.Length);
|
||||
i+=12;
|
||||
ushort ac=32767;
|
||||
//vel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
//vel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
//accel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
//accel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
ushort rw, rx,ry,rz;
|
||||
rw=(ushort)(32768*rotation2.W);
|
||||
rx=(ushort)(32768*rotation2.X);
|
||||
ry=(ushort)(32768*rotation2.Y);
|
||||
rz=(ushort)(32768*rotation2.Z);
|
||||
|
||||
//if(setRotation)
|
||||
//{
|
||||
//rot
|
||||
bytes[i++] = (byte)(rx % 256);
|
||||
bytes[i++] = (byte)((rx >> 8) % 256);
|
||||
bytes[i++] = (byte)(ry % 256);
|
||||
bytes[i++] = (byte)((ry >> 8) % 256);
|
||||
bytes[i++] = (byte)(rz % 256);
|
||||
bytes[i++] = (byte)((rz >> 8) % 256);
|
||||
bytes[i++] = (byte)(rw % 256);
|
||||
bytes[i++] = (byte)((rw >> 8) % 256);
|
||||
|
||||
ushort rw, rx,ry,rz;
|
||||
rw=(ushort)(32768*rotation2.W);
|
||||
rx=(ushort)(32768*rotation2.X);
|
||||
ry=(ushort)(32768*rotation2.Y);
|
||||
rz=(ushort)(32768*rotation2.Z);
|
||||
//rotation vel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
|
||||
//rot
|
||||
bytes[i++] = (byte)(rx % 256);
|
||||
bytes[i++] = (byte)((rx >> 8) % 256);
|
||||
bytes[i++] = (byte)(ry % 256);
|
||||
bytes[i++] = (byte)((ry >> 8) % 256);
|
||||
bytes[i++] = (byte)(rz % 256);
|
||||
bytes[i++] = (byte)((rz >> 8) % 256);
|
||||
bytes[i++] = (byte)(rw % 256);
|
||||
bytes[i++] = (byte)((rw >> 8) % 256);
|
||||
//}
|
||||
/*else
|
||||
{
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
}*/
|
||||
//rotation vel
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
bytes[i++] = (byte)(ac % 256);
|
||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||
dat.Data=bytes;
|
||||
|
||||
dat.Data=bytes;
|
||||
//server.SendPacket(im,true,user);
|
||||
//should send to all users.
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in Agent_Manager.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=User.AgentID)
|
||||
{
|
||||
server.SendPacket(im,true,kp.Value.NetInfo);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in Agent_Manager.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=User.AgentID)
|
||||
{
|
||||
server.SendPacket(im,true,kp.Value.NetInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -310,49 +290,50 @@ namespace OpenSim
|
|||
public void ReadPrimDatabase(string name,User_Agent_info user)
|
||||
{
|
||||
StreamReader SR;
|
||||
string line;
|
||||
SR=File.OpenText(name);
|
||||
string line;
|
||||
SR=File.OpenText(name);
|
||||
string [] comp= new string[10];
|
||||
string delimStr = " , ";
|
||||
char [] delimiter = delimStr.ToCharArray();
|
||||
char [] delimiter = delimStr.ToCharArray();
|
||||
|
||||
line=SR.ReadLine();
|
||||
while(line!="end")
|
||||
{
|
||||
comp=line.Split(delimiter);
|
||||
if(comp[0]=="ObjPack"){
|
||||
int num=Convert.ToInt32(comp[2]);
|
||||
int start=Convert.ToInt32(comp[1]);
|
||||
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
||||
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation=64096;
|
||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num];
|
||||
|
||||
// int count=0;
|
||||
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\";
|
||||
for(int cc=0; cc<num; cc++)
|
||||
{
|
||||
string filenam=data_path+@"prim_updates"+start+".dat";
|
||||
int i=0;
|
||||
//FileInfo fInfo = new FileInfo("objectupate"+start+".dat");
|
||||
FileInfo fInfo = new FileInfo(filenam);
|
||||
long numBytes = fInfo.Length;
|
||||
//FileStream fStream = new FileStream("objectupate"+start+".dat", FileMode.Open, FileAccess.Read);
|
||||
FileStream fStream = new FileStream(filenam, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fStream);
|
||||
byte [] data1 = br.ReadBytes((int)numBytes);
|
||||
br.Close();
|
||||
fStream.Close();
|
||||
|
||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
||||
objupdate.ObjectData[cc]=objdata;
|
||||
start++;
|
||||
}
|
||||
server.SendPacket(objupdate,true,user);
|
||||
line=SR.ReadLine();
|
||||
}
|
||||
}
|
||||
SR.Close();
|
||||
while(line!="end")
|
||||
{
|
||||
comp=line.Split(delimiter);
|
||||
if(comp[0]=="ObjPack")
|
||||
{
|
||||
int num=Convert.ToInt32(comp[2]);
|
||||
int start=Convert.ToInt32(comp[1]);
|
||||
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
||||
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation=64096;
|
||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num];
|
||||
|
||||
// int count=0;
|
||||
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\";
|
||||
for(int cc=0; cc<num; cc++)
|
||||
{
|
||||
string filenam=data_path+@"prim_updates"+start+".dat";
|
||||
int i=0;
|
||||
//FileInfo fInfo = new FileInfo("objectupate"+start+".dat");
|
||||
FileInfo fInfo = new FileInfo(filenam);
|
||||
long numBytes = fInfo.Length;
|
||||
//FileStream fStream = new FileStream("objectupate"+start+".dat", FileMode.Open, FileAccess.Read);
|
||||
FileStream fStream = new FileStream(filenam, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fStream);
|
||||
byte [] data1 = br.ReadBytes((int)numBytes);
|
||||
br.Close();
|
||||
fStream.Close();
|
||||
|
||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
||||
objupdate.ObjectData[cc]=objdata;
|
||||
start++;
|
||||
}
|
||||
server.SendPacket(objupdate,true,user);
|
||||
line=SR.ReadLine();
|
||||
}
|
||||
}
|
||||
SR.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
172
Server.cs
172
Server.cs
|
@ -42,14 +42,14 @@ namespace OpenSim
|
|||
/// <summary>
|
||||
/// Description of Server.
|
||||
/// </summary>
|
||||
public interface ServerCallback
|
||||
public interface ServerCallback
|
||||
{
|
||||
//should replace with delegates
|
||||
void MainCallback(Packet pack, User_Agent_info User_info);
|
||||
void NewUserCallback(User_Agent_info User_info);
|
||||
void ErrorCallback(string text);
|
||||
}
|
||||
public class Server
|
||||
public class Server
|
||||
{
|
||||
/// <summary>A public reference to the client that this Simulator object
|
||||
/// is attached to</summary>
|
||||
|
@ -93,8 +93,6 @@ namespace OpenSim
|
|||
}
|
||||
|
||||
private ServerCallback CallbackObject;
|
||||
//private NetworkManager Network;
|
||||
// private Dictionary<PacketType, List<NetworkManager.PacketCallback>> Callbacks;
|
||||
private uint Sequence = 0;
|
||||
private object SequenceLock = new object();
|
||||
private byte[] RecvBuffer = new byte[4096];
|
||||
|
@ -102,12 +100,6 @@ namespace OpenSim
|
|||
private byte[] ZeroOutBuffer = new byte[4096];
|
||||
private Socket Connection = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
private AsyncCallback ReceivedData;
|
||||
// Packets we sent out that need ACKs from the simulator
|
||||
// private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
|
||||
// Sequence numbers of packets we've received from the simulator
|
||||
// private Queue<uint> Inbox;
|
||||
// ACKs that are queued up to be sent to the simulator
|
||||
//private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
|
||||
private bool connected = false;
|
||||
private uint circuitCode;
|
||||
private IPEndPoint ipEndPoint;
|
||||
|
@ -129,62 +121,38 @@ namespace OpenSim
|
|||
public Server(ServerCallback s_callback)
|
||||
{
|
||||
|
||||
this.CallbackObject=s_callback;
|
||||
// Client = client;
|
||||
// Network = client.Network;
|
||||
// Callbacks = callbacks;
|
||||
// Region = new Region(client);
|
||||
// circuitCode = circuit;
|
||||
// Inbox = new Queue<uint>(Settings.INBOX_SIZE);
|
||||
AckTimer = new System.Timers.Timer(Settings.NETWORK_TICK_LENGTH);
|
||||
AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
|
||||
this.CallbackObject=s_callback; //should be using delegate
|
||||
AckTimer = new System.Timers.Timer(Settings.NETWORK_TICK_LENGTH);
|
||||
AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
|
||||
|
||||
// Initialize the callback for receiving a new packet
|
||||
ReceivedData = new AsyncCallback(this.OnReceivedData);
|
||||
// Initialize the callback for receiving a new packet
|
||||
ReceivedData = new AsyncCallback(this.OnReceivedData);
|
||||
|
||||
// Client.Log("Connecting to " + ip.ToString() + ":" + port, Helpers.LogLevel.Info);
|
||||
// Client.Log("Connecting to " + ip.ToString() + ":" + port, Helpers.LogLevel.Info);
|
||||
|
||||
try
|
||||
{
|
||||
// Create an endpoint that we will be communicating with (need it in two
|
||||
// types due to .NET weirdness)
|
||||
// ipEndPoint = new IPEndPoint(ip, port);
|
||||
ipEndPoint = new IPEndPoint(IPAddress.Any, Globals.Instance.IpPort);
|
||||
try
|
||||
{
|
||||
// Create an endpoint that we will be communicating with (need it in two
|
||||
// types due to .NET weirdness)
|
||||
// ipEndPoint = new IPEndPoint(ip, port);
|
||||
ipEndPoint = new IPEndPoint(IPAddress.Any, Globals.Instance.IpPort);
|
||||
endPoint = (EndPoint)ipEndPoint;
|
||||
|
||||
|
||||
endPoint = (EndPoint)ipEndPoint;
|
||||
|
||||
// Associate this simulator's socket with the given ip/port and start listening
|
||||
Connection.Bind(endPoint);
|
||||
|
||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||
// Associate this simulator's socket with the given ip/port and start listening
|
||||
Connection.Bind(endPoint);
|
||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||
//The epSender identifies the incoming clients
|
||||
epSender = (EndPoint) ipeSender;
|
||||
Connection.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||
epSender = (EndPoint) ipeSender;
|
||||
Connection.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||
|
||||
// Start the ACK timer
|
||||
AckTimer.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
// Start the ACK timer
|
||||
AckTimer.Start();
|
||||
|
||||
|
||||
|
||||
// Track the current time for timeout purposes
|
||||
//int start = Environment.TickCount;
|
||||
|
||||
/* while (true)
|
||||
{
|
||||
if (connected || Environment.TickCount - start > Settings.SIMULATOR_TIMEOUT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
System.Threading.Thread.Sleep(10);
|
||||
}*/
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Client.Log(e.ToString(), Helpers.LogLevel.Error);
|
||||
System.Console.WriteLine(e.Message);
|
||||
}
|
||||
System.Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -292,7 +260,6 @@ namespace OpenSim
|
|||
packet.Type != PacketType.LogoutRequest)
|
||||
{
|
||||
packet.Header.AckList = new uint[User_info.PendingAcks.Count];
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (uint ack in User_info.PendingAcks.Values)
|
||||
|
@ -345,37 +312,6 @@ namespace OpenSim
|
|||
/// <param name="payload">The packet payload</param>
|
||||
/// <param name="setSequence">Whether the second, third, and fourth bytes
|
||||
/// should be modified to the current stream sequence number</param>
|
||||
/* public void SendPacket(byte[] payload, bool setSequence)
|
||||
{
|
||||
if (connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (setSequence && payload.Length > 3)
|
||||
{
|
||||
lock (SequenceLock)
|
||||
{
|
||||
payload[1] = (byte)(Sequence >> 16);
|
||||
payload[2] = (byte)(Sequence >> 8);
|
||||
payload[3] = (byte)(Sequence % 256);
|
||||
Sequence++;
|
||||
}
|
||||
}
|
||||
|
||||
Connection.Send(payload, payload.Length, SocketFlags.None);
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// Client.Log(e.ToString(), Helpers.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Client.Log("Attempted to send a " + payload.Length + " byte payload when " +
|
||||
// "we are disconnected", Helpers.LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/// <summary>
|
||||
/// Returns Simulator Name as a String
|
||||
/// </summary>
|
||||
|
@ -615,56 +551,8 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
// this.callback_object.error("calling callback");
|
||||
this.CallbackObject.MainCallback(packet,User_info);
|
||||
// this.callback_object.error("finished");
|
||||
// Fire the registered packet events
|
||||
#region FireCallbacks
|
||||
/* if (Callbacks.ContainsKey(packet.Type))
|
||||
{
|
||||
List<NetworkManager.PacketCallback> callbackArray = Callbacks[packet.Type];
|
||||
|
||||
// Fire any registered callbacks
|
||||
foreach (NetworkManager.PacketCallback callback in callbackArray)
|
||||
{
|
||||
if (callback != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback(packet, this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Client.Log("Caught an exception in a packet callback: " + e.ToString(),
|
||||
Helpers.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Callbacks.ContainsKey(PacketType.Default))
|
||||
{
|
||||
List<NetworkManager.PacketCallback> callbackArray = Callbacks[PacketType.Default];
|
||||
|
||||
// Fire any registered callbacks
|
||||
foreach (NetworkManager.PacketCallback callback in callbackArray)
|
||||
{
|
||||
if (callback != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback(packet, this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Client.Log("Caught an exception in a packet callback: " + e.ToString(),
|
||||
Helpers.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endregion FireCallbacks
|
||||
}
|
||||
|
||||
private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
|
||||
|
@ -677,8 +565,8 @@ namespace OpenSim
|
|||
{
|
||||
User_Agent_info user=(User_Agent_info)this.User_agents[i];
|
||||
|
||||
SendAcks(user);
|
||||
ResendUnacked(user);
|
||||
SendAcks(user);
|
||||
ResendUnacked(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +619,7 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
public class User_Agent_info
|
||||
public class User_Agent_info
|
||||
{
|
||||
public EndPoint endpoint;
|
||||
public LLUUID AgentID;
|
||||
|
|
Loading…
Reference in New Issue