Clean up
parent
dc2316de9c
commit
8c80d98252
476
Agent_Manager.cs
476
Agent_Manager.cs
|
@ -41,23 +41,23 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
public Dictionary<libsecondlife.LLUUID,AvatarData> AgentList;
|
public Dictionary<libsecondlife.LLUUID,AvatarData> AgentList;
|
||||||
|
|
||||||
private uint local_numer=0;
|
private uint _localNumber=0;
|
||||||
private Server server;
|
private Server _server;
|
||||||
public PrimManager Prim_Manager;
|
public PrimManager Prim_Manager;
|
||||||
public AssetManagement Asset_Manager;
|
public AssetManagement assetManager;
|
||||||
|
|
||||||
private libsecondlife.Packets.RegionHandshakePacket RegionPacket;
|
private libsecondlife.Packets.RegionHandshakePacket RegionPacket;
|
||||||
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
|
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serve"></param>
|
/// <param name="serve"></param>
|
||||||
public AgentManager(Server serve)
|
public AgentManager(Server server)
|
||||||
{
|
{
|
||||||
AgentList=new Dictionary<libsecondlife.LLUUID,AvatarData>();
|
AgentList = new Dictionary<libsecondlife.LLUUID,AvatarData>();
|
||||||
server=serve;
|
_server = server;
|
||||||
this.initialise();
|
this.initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AvatarData ad=this.AgentList[id];
|
AvatarData avatar = this.AgentList[id];
|
||||||
return ad;
|
return avatar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -84,7 +84,7 @@ namespace OpenSim
|
||||||
/// <param name="agent"></param>
|
/// <param name="agent"></param>
|
||||||
public void AddAgent(AvatarData agent)
|
public void AddAgent(AvatarData agent)
|
||||||
{
|
{
|
||||||
this.AgentList.Add(agent.FullID,agent);
|
this.AgentList.Add(agent.FullID, agent);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -102,20 +102,20 @@ namespace OpenSim
|
||||||
/// <param name="first"></param>
|
/// <param name="first"></param>
|
||||||
/// <param name="last"></param>
|
/// <param name="last"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool NewAgent(User_Agent_info User_info, string first, string last ,LLUUID BaseFolder,LLUUID InventoryFolder)
|
public bool NewAgent(UserAgentInfo userInfo, string first, string last, LLUUID baseFolder, LLUUID inventoryFolder)
|
||||||
{
|
{
|
||||||
AvatarData agent=new AvatarData();
|
AvatarData agent = new AvatarData();
|
||||||
agent.FullID=User_info.AgentID;
|
agent.FullID = userInfo.AgentID;
|
||||||
agent.NetInfo=User_info;
|
agent.NetInfo = userInfo;
|
||||||
agent.NetInfo.first_name=first;
|
agent.NetInfo.first_name =first;
|
||||||
agent.NetInfo.last_name=last;
|
agent.NetInfo.last_name = last;
|
||||||
agent.Position=new LLVector3(100,100,22);
|
agent.Position = new LLVector3(100, 100, 22);
|
||||||
agent.BaseFolder=BaseFolder;
|
agent.BaseFolder = baseFolder;
|
||||||
agent.InventoryFolder=InventoryFolder;
|
agent.InventoryFolder = inventoryFolder;
|
||||||
this.AgentList.Add(agent.FullID,agent);
|
this.AgentList.Add(agent.FullID, agent);
|
||||||
|
|
||||||
//Create new Wearable Assets and place in Inventory
|
//Create new Wearable Assets and place in Inventory
|
||||||
this.Asset_Manager.CreateNewInventorySet(ref agent,User_info);
|
this.assetManager.CreateNewInventorySet(ref agent, userInfo);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,9 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UserInfo"></param>
|
/// <param name="UserInfo"></param>
|
||||||
public void RemoveAgent(User_Agent_info UserInfo)
|
public void RemoveAgent(UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
this.AgentList.Remove(UserInfo.AgentID);
|
this.AgentList.Remove(userInfo.AgentID);
|
||||||
|
|
||||||
//tell other clients to delete this avatar
|
//tell other clients to delete this avatar
|
||||||
}
|
}
|
||||||
|
@ -135,20 +135,20 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
public void AgentJoin(User_Agent_info User_info)
|
public void AgentJoin(UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
//send region data
|
//send region data
|
||||||
server.SendPacket(RegionPacket,true,User_info);
|
_server.SendPacket(RegionPacket,true, userInfo);
|
||||||
|
|
||||||
//inform client of join comlete
|
//inform client of join comlete
|
||||||
libsecondlife.Packets.AgentMovementCompletePacket mov=new AgentMovementCompletePacket();
|
libsecondlife.Packets.AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
||||||
mov.AgentData.SessionID=User_info.SessionID;
|
mov.AgentData.SessionID = userInfo.SessionID;
|
||||||
mov.AgentData.AgentID=User_info.AgentID;
|
mov.AgentData.AgentID = userInfo.AgentID;
|
||||||
mov.Data.RegionHandle=Globals.Instance.RegionHandle;
|
mov.Data.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
mov.Data.Timestamp=1169838966;
|
mov.Data.Timestamp = 1169838966;
|
||||||
mov.Data.Position=new LLVector3(100f,100f,22f);
|
mov.Data.Position = new LLVector3(100f, 100f, 22f);
|
||||||
mov.Data.LookAt=new LLVector3(0.99f,0.042f,0);
|
mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
|
||||||
server.SendPacket(mov,true,User_info);
|
_server.SendPacket(mov, true, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -157,12 +157,12 @@ namespace OpenSim
|
||||||
public void UpdatePositions()
|
public void UpdatePositions()
|
||||||
{
|
{
|
||||||
//update positions
|
//update positions
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList)
|
||||||
{
|
{
|
||||||
|
|
||||||
kp.Value.Position.X+=(kp.Value.Velocity.X*0.2f);
|
kp.Value.Position.X += (kp.Value.Velocity.X * 0.2f);
|
||||||
kp.Value.Position.Y+=(kp.Value.Velocity.Y*0.2f);
|
kp.Value.Position.Y += (kp.Value.Velocity.Y * 0.2f);
|
||||||
kp.Value.Position.Z+=(kp.Value.Velocity.Z*0.2f);
|
kp.Value.Position.Z += (kp.Value.Velocity.Z * 0.2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,31 +172,31 @@ namespace OpenSim
|
||||||
private void initialise()
|
private void initialise()
|
||||||
{
|
{
|
||||||
//Region data
|
//Region data
|
||||||
RegionPacket=new RegionHandshakePacket();
|
RegionPacket = new RegionHandshakePacket();
|
||||||
RegionPacket.RegionInfo.BillableFactor=0;
|
RegionPacket.RegionInfo.BillableFactor = 0;
|
||||||
RegionPacket.RegionInfo.IsEstateManager=false;
|
RegionPacket.RegionInfo.IsEstateManager = false;
|
||||||
RegionPacket.RegionInfo.TerrainHeightRange00=60;
|
RegionPacket.RegionInfo.TerrainHeightRange00 = 60;
|
||||||
RegionPacket.RegionInfo.TerrainHeightRange01=60;
|
RegionPacket.RegionInfo.TerrainHeightRange01 = 60;
|
||||||
RegionPacket.RegionInfo.TerrainHeightRange10=60;
|
RegionPacket.RegionInfo.TerrainHeightRange10 = 60;
|
||||||
RegionPacket.RegionInfo.TerrainHeightRange11=60;
|
RegionPacket.RegionInfo.TerrainHeightRange11 = 60;
|
||||||
RegionPacket.RegionInfo.TerrainStartHeight00=20;
|
RegionPacket.RegionInfo.TerrainStartHeight00 = 20;
|
||||||
RegionPacket.RegionInfo.TerrainStartHeight01=20;
|
RegionPacket.RegionInfo.TerrainStartHeight01 = 20;
|
||||||
RegionPacket.RegionInfo.TerrainStartHeight10=20;
|
RegionPacket.RegionInfo.TerrainStartHeight10 = 20;
|
||||||
RegionPacket.RegionInfo.TerrainStartHeight11=20;
|
RegionPacket.RegionInfo.TerrainStartHeight11 = 20;
|
||||||
RegionPacket.RegionInfo.SimAccess=13;
|
RegionPacket.RegionInfo.SimAccess = 13;
|
||||||
RegionPacket.RegionInfo.WaterHeight=5;
|
RegionPacket.RegionInfo.WaterHeight = 5;
|
||||||
RegionPacket.RegionInfo.RegionFlags=72458694;
|
RegionPacket.RegionInfo.RegionFlags = 72458694;
|
||||||
RegionPacket.RegionInfo.SimName=enc.GetBytes( Globals.Instance.RegionName);
|
RegionPacket.RegionInfo.SimName = _enc.GetBytes( Globals.Instance.RegionName);
|
||||||
RegionPacket.RegionInfo.SimOwner=new LLUUID("00000000-0000-0000-0000-000000000000");
|
RegionPacket.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
RegionPacket.RegionInfo.TerrainBase0=new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
RegionPacket.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||||
RegionPacket.RegionInfo.TerrainBase1=new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
RegionPacket.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||||
RegionPacket.RegionInfo.TerrainBase2=new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
RegionPacket.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
||||||
RegionPacket.RegionInfo.TerrainBase3=new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
RegionPacket.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
||||||
RegionPacket.RegionInfo.TerrainDetail0=new LLUUID("00000000-0000-0000-0000-000000000000");
|
RegionPacket.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
RegionPacket.RegionInfo.TerrainDetail1=new LLUUID("00000000-0000-0000-0000-000000000000");
|
RegionPacket.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
RegionPacket.RegionInfo.TerrainDetail2=new LLUUID("00000000-0000-0000-0000-000000000000");
|
RegionPacket.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
RegionPacket.RegionInfo.TerrainDetail3=new LLUUID("00000000-0000-0000-0000-000000000000");
|
RegionPacket.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
RegionPacket.RegionInfo.CacheID=new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
|
RegionPacket.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
|
||||||
|
|
||||||
this.SetupTemplate("objectupate168.dat");
|
this.SetupTemplate("objectupate168.dat");
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ namespace OpenSim
|
||||||
private void SetupTemplate(string name)
|
private void SetupTemplate(string name)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i=0;
|
int i = 0;
|
||||||
FileInfo fInfo = new FileInfo(name);
|
FileInfo fInfo = new FileInfo(name);
|
||||||
long numBytes = fInfo.Length;
|
long numBytes = fInfo.Length;
|
||||||
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
||||||
|
@ -217,19 +217,19 @@ namespace OpenSim
|
||||||
br.Close();
|
br.Close();
|
||||||
fStream.Close();
|
fStream.Close();
|
||||||
|
|
||||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
|
||||||
|
|
||||||
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||||
libsecondlife.LLVector3 pos=new LLVector3(objdata.ObjectData, 16);
|
libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
|
||||||
pos.X=100f;
|
pos.X = 100f;
|
||||||
objdata.ID=8880000;
|
objdata.ID = 8880000;
|
||||||
objdata.NameValue=enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
|
objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
|
||||||
libsecondlife.LLVector3 pos2=new LLVector3(13.981f,100.0f,20.0f);
|
libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f);
|
||||||
//objdata.FullID=user.AgentID;
|
//objdata.FullID=user.AgentID;
|
||||||
byte[] pb=pos.GetBytes();
|
byte[] pb = pos.GetBytes();
|
||||||
Array.Copy(pb,0,objdata.ObjectData,16,pb.Length);
|
Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
|
||||||
|
|
||||||
AvatarTemplate=objdata;
|
AvatarTemplate = objdata;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,52 +237,52 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
public void SendInitialData(User_Agent_info User_info)
|
public void SendInitialData(UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
|
|
||||||
//shouldn't have to read all this in from disk for every new client
|
//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
|
//send layerdata
|
||||||
LayerDataPacket layerpack=new LayerDataPacket();
|
LayerDataPacket layerpack = new LayerDataPacket();
|
||||||
layerpack.LayerID.Type=76;
|
layerpack.LayerID.Type = 76;
|
||||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata0.dat");
|
this.SendLayerData(userInfo,ref layerpack, data_path+@"layerdata0.dat");
|
||||||
|
|
||||||
LayerDataPacket layerpack1=new LayerDataPacket();
|
LayerDataPacket layerpack1 = new LayerDataPacket();
|
||||||
layerpack1.LayerID.Type=76;
|
layerpack1.LayerID.Type = 76;
|
||||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata1.dat");
|
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata1.dat");
|
||||||
|
|
||||||
LayerDataPacket layerpack2=new LayerDataPacket();
|
LayerDataPacket layerpack2 = new LayerDataPacket();
|
||||||
layerpack2.LayerID.Type=56;
|
layerpack2.LayerID.Type = 56;
|
||||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata2.dat");
|
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata2.dat");
|
||||||
|
|
||||||
LayerDataPacket layerpack3=new LayerDataPacket();
|
LayerDataPacket layerpack3 = new LayerDataPacket();
|
||||||
layerpack3.LayerID.Type=55;
|
layerpack3.LayerID.Type = 55;
|
||||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata3.dat");
|
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata3.dat");
|
||||||
|
|
||||||
LayerDataPacket layerpack4=new LayerDataPacket();
|
LayerDataPacket layerpack4 = new LayerDataPacket();
|
||||||
layerpack4.LayerID.Type=56;
|
layerpack4.LayerID.Type = 56;
|
||||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata4.dat");
|
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata4.dat");
|
||||||
|
|
||||||
LayerDataPacket layerpack5=new LayerDataPacket();
|
LayerDataPacket layerpack5 = new LayerDataPacket();
|
||||||
layerpack5.LayerID.Type=55;
|
layerpack5.LayerID.Type = 55;
|
||||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata5.dat");
|
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata5.dat");
|
||||||
|
|
||||||
//send intial set of captured prims data?
|
//send intial set of captured prims data?
|
||||||
this.Prim_Manager.ReadPrimDatabase( "objectdatabase.ini",User_info);
|
this.Prim_Manager.ReadPrimDatabase( "objectdatabase.ini", userInfo);
|
||||||
|
|
||||||
//send prims that have been created by users
|
//send prims that have been created by users
|
||||||
//prim_man.send_existing_prims(User_info);
|
//prim_man.send_existing_prims(User_info);
|
||||||
|
|
||||||
//send update about clients avatar
|
//send update about clients avatar
|
||||||
this.SendInitialAvatarPosition(User_info);
|
this.SendInitialAvatarPosition(userInfo);
|
||||||
|
|
||||||
//send updates about all other users
|
//send updates about all other users
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList)
|
||||||
{
|
{
|
||||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
if(kp.Value.NetInfo.AgentID != userInfo.AgentID)
|
||||||
{
|
{
|
||||||
this.SendOtherAvatarPosition(User_info,kp.Value);
|
this.SendOtherAvatarPosition(userInfo, kp.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,41 +291,40 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
public void SendInitialAvatarPosition(User_Agent_info User_info)
|
public void SendInitialAvatarPosition(UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
//send a objectupdate packet with information about the clients avatar
|
//send a objectupdate packet with information about the clients avatar
|
||||||
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
objupdate.RegionData.TimeDilation=64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
objupdate.ObjectData[0]=AvatarTemplate;
|
objupdate.ObjectData[0] = AvatarTemplate;
|
||||||
//give this avatar object a local id and assign the user a name
|
//give this avatar object a local id and assign the user a name
|
||||||
objupdate.ObjectData[0].ID=8880000+this.local_numer;
|
objupdate.ObjectData[0].ID = 8880000 + this._localNumber;
|
||||||
User_info.localID=objupdate.ObjectData[0].ID;
|
userInfo.localID = objupdate.ObjectData[0].ID;
|
||||||
//User_info.name="Test"+this.local_numer+" User";
|
//User_info.name="Test"+this.local_numer+" User";
|
||||||
this.GetAgent(User_info.AgentID).Started=true;
|
this.GetAgent(userInfo.AgentID).Started = true;
|
||||||
objupdate.ObjectData[0].FullID=User_info.AgentID;
|
objupdate.ObjectData[0].FullID = userInfo.AgentID;
|
||||||
objupdate.ObjectData[0].NameValue=enc.GetBytes("FirstName STRING RW SV "+User_info.first_name+"\nLastName STRING RW SV "+User_info.last_name+" \0");
|
objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0");
|
||||||
User_info.name="FirstName STRING RW SV "+User_info.first_name+"\nLastName STRING RW SV "+User_info.last_name+" \0";
|
userInfo.name = "FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0";
|
||||||
//User_info.last_name="User";
|
|
||||||
//User_info.first_name="Test"+this.local_numer;
|
|
||||||
libsecondlife.LLVector3 pos2=new LLVector3(100f,100.0f,22.0f);
|
|
||||||
|
|
||||||
byte[] pb=pos2.GetBytes();
|
libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
|
||||||
|
|
||||||
|
byte[] pb = pos2.GetBytes();
|
||||||
|
|
||||||
Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,16,pb.Length);
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||||
this.local_numer++;
|
this._localNumber++;
|
||||||
|
|
||||||
server.SendPacket(objupdate,true,User_info);
|
_server.SendPacket(objupdate, true, userInfo);
|
||||||
|
|
||||||
//send this info to other existing clients
|
//send this info to other existing clients
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList)
|
||||||
{
|
{
|
||||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
if(kp.Value.NetInfo.AgentID != userInfo.AgentID)
|
||||||
{
|
{
|
||||||
server.SendPacket(objupdate,true,kp.Value.NetInfo);
|
_server.SendPacket(objupdate, true, kp.Value.NetInfo);
|
||||||
this.SendOtherAppearance(kp.Value.NetInfo,objupdate.ObjectData[0].FullID);
|
this.SendOtherAppearance(kp.Value.NetInfo, objupdate.ObjectData[0].FullID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,38 +334,38 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
public void SendIntialAvatarAppearance(User_Agent_info user)
|
public void SendIntialAvatarAppearance(UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
AvatarData Agent=this.AgentList[user.AgentID];
|
AvatarData Agent = this.AgentList[userInfo.AgentID];
|
||||||
AgentWearablesUpdatePacket aw=new AgentWearablesUpdatePacket();
|
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
|
||||||
aw.AgentData.AgentID=user.AgentID;
|
aw.AgentData.AgentID = userInfo.AgentID;
|
||||||
aw.AgentData.SerialNum=0;
|
aw.AgentData.SerialNum = 0;
|
||||||
aw.AgentData.SessionID=user.SessionID;
|
aw.AgentData.SessionID = userInfo.SessionID;
|
||||||
|
|
||||||
aw.WearableData= new AgentWearablesUpdatePacket.WearableDataBlock[13];
|
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
|
||||||
AgentWearablesUpdatePacket.WearableDataBlock awb=null;
|
AgentWearablesUpdatePacket.WearableDataBlock awb = null;
|
||||||
awb=new AgentWearablesUpdatePacket.WearableDataBlock();
|
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
|
||||||
awb.WearableType=(byte)0;
|
awb.WearableType = (byte)0;
|
||||||
awb.AssetID=Agent.Wearables[0].AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
awb.AssetID = Agent.Wearables[0].AssetID;
|
||||||
awb.ItemID=Agent.Wearables[0].ItemID;//new LLUUID("b7878441893b094917f791174bc8401c");
|
awb.ItemID = Agent.Wearables[0].ItemID;
|
||||||
aw.WearableData[0]=awb;
|
aw.WearableData[0] = awb;
|
||||||
|
|
||||||
awb=new AgentWearablesUpdatePacket.WearableDataBlock();
|
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
|
||||||
awb.WearableType=(byte)1;
|
awb.WearableType =(byte)1;
|
||||||
awb.AssetID=Agent.Wearables[1].AssetID;//new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
|
awb.AssetID = Agent.Wearables[1].AssetID;
|
||||||
awb.ItemID=Agent.Wearables[1].ItemID;//new LLUUID("193f0876fc11d143797454352f9c9c26");
|
awb.ItemID = Agent.Wearables[1].ItemID;
|
||||||
aw.WearableData[1]=awb;
|
aw.WearableData[1] = awb;
|
||||||
|
|
||||||
for(int i=2; i<13; i++)
|
for(int i=2; i<13; i++)
|
||||||
{
|
{
|
||||||
awb=new AgentWearablesUpdatePacket.WearableDataBlock();
|
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
|
||||||
awb.WearableType=(byte)i;
|
awb.WearableType = (byte)i;
|
||||||
awb.AssetID=new LLUUID("00000000-0000-0000-0000-000000000000");
|
awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
awb.ItemID=new LLUUID("00000000-0000-0000-0000-000000000000");
|
awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
aw.WearableData[i]=awb;
|
aw.WearableData[i] = awb;
|
||||||
}
|
}
|
||||||
|
|
||||||
server.SendPacket(aw,true,user);
|
_server.SendPacket(aw, true, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -374,34 +373,33 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
public void SendOtherAppearance(User_Agent_info user,LLUUID id)
|
public void SendOtherAppearance(UserAgentInfo userInfo, LLUUID id)
|
||||||
{
|
{
|
||||||
AvatarAppearancePacket avp=new AvatarAppearancePacket();
|
AvatarAppearancePacket avp = new AvatarAppearancePacket();
|
||||||
|
|
||||||
|
|
||||||
avp.VisualParam=new AvatarAppearancePacket.VisualParamBlock[218];
|
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
|
||||||
//avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes);
|
//avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes);
|
||||||
|
|
||||||
FileInfo fInfo = new FileInfo("Avatar_texture3.dat");
|
FileInfo fInfo = new FileInfo("Avatar_texture3.dat");
|
||||||
|
|
||||||
long numBytes = fInfo.Length;
|
long numBytes = fInfo.Length;
|
||||||
FileStream fStream = new FileStream("Avatar_texture3.dat", FileMode.Open, FileAccess.Read);
|
FileStream fStream = new FileStream("Avatar_texture3.dat", FileMode.Open, FileAccess.Read);
|
||||||
BinaryReader br = new BinaryReader(fStream);
|
BinaryReader br = new BinaryReader(fStream);
|
||||||
avp.ObjectData.TextureEntry= br.ReadBytes((int)numBytes);
|
avp.ObjectData.TextureEntry = br.ReadBytes((int)numBytes);
|
||||||
br.Close();
|
br.Close();
|
||||||
fStream.Close();
|
fStream.Close();
|
||||||
|
|
||||||
AvatarAppearancePacket.VisualParamBlock avblock=null;
|
AvatarAppearancePacket.VisualParamBlock avblock = null;
|
||||||
for(int i=0; i<218; i++)
|
for(int i = 0; i < 218; i++)
|
||||||
{
|
{
|
||||||
avblock=new AvatarAppearancePacket.VisualParamBlock();
|
avblock = new AvatarAppearancePacket.VisualParamBlock();
|
||||||
avblock.ParamValue=(byte)100;
|
avblock.ParamValue = (byte)100;
|
||||||
avp.VisualParam[i]=avblock;
|
avp.VisualParam[i] = avblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
avp.Sender.IsTrial=false;
|
avp.Sender.IsTrial = false;
|
||||||
avp.Sender.ID=id;
|
avp.Sender.ID = id;
|
||||||
server.SendPacket(avp,true,user);
|
_server.SendPacket(avp, true, userInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,29 +408,27 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
/// <param name="avd"></param>
|
/// <param name="avd"></param>
|
||||||
public void SendOtherAvatarPosition(User_Agent_info User_info, AvatarData avd)
|
public void SendOtherAvatarPosition(UserAgentInfo userInfo, AvatarData avatar)
|
||||||
{
|
{
|
||||||
//send a objectupdate packet with information about the clients avatar
|
//send a objectupdate packet with information about the clients avatar
|
||||||
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
objupdate.RegionData.TimeDilation=64500;
|
objupdate.RegionData.TimeDilation = 64500;
|
||||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
objupdate.ObjectData[0]=AvatarTemplate;
|
objupdate.ObjectData[0] = AvatarTemplate;
|
||||||
//give this avatar object a local id and assign the user a name
|
//give this avatar object a local id and assign the user a name
|
||||||
objupdate.ObjectData[0].ID=avd.NetInfo.localID;
|
objupdate.ObjectData[0].ID = avatar.NetInfo.localID;
|
||||||
objupdate.ObjectData[0].FullID=avd.NetInfo.AgentID;//new LLUUID("00000000-0000-0000-5665-000000000034");
|
objupdate.ObjectData[0].FullID = avatar.NetInfo.AgentID;
|
||||||
objupdate.ObjectData[0].NameValue=enc.GetBytes(avd.NetInfo.name);//enc.GetBytes("FirstName STRING RW SV Test"+ this.local_numer+"\nLastName STRING RW SV User \0");
|
objupdate.ObjectData[0].NameValue = _enc.GetBytes(avatar.NetInfo.name);
|
||||||
libsecondlife.LLVector3 pos2=new LLVector3(avd.Position.X,avd.Position.Y,avd.Position.Z);
|
libsecondlife.LLVector3 pos2 = new LLVector3(avatar.Position.X, avatar.Position.Y, avatar.Position.Z);
|
||||||
|
|
||||||
byte[] pb=pos2.GetBytes();
|
byte[] pb = pos2.GetBytes();
|
||||||
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||||
Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,16,pb.Length);
|
this._localNumber++;
|
||||||
this.local_numer++;
|
|
||||||
|
|
||||||
server.SendPacket(objupdate,true,User_info);
|
_server.SendPacket(objupdate, true, userInfo);
|
||||||
|
this.SendOtherAppearance(userInfo, avatar.NetInfo.AgentID);
|
||||||
this.SendOtherAppearance(User_info,avd.NetInfo.AgentID);//new LLUUID("00000000-0000-0000-5665-000000000034"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,26 +437,26 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
/// <param name="line"></param>
|
/// <param name="line"></param>
|
||||||
public void SendChatMessage(User_Agent_info User_info, string line)
|
public void SendChatMessage(UserAgentInfo userInfo, string line)
|
||||||
{
|
{
|
||||||
libsecondlife.Packets.ChatFromSimulatorPacket reply=new ChatFromSimulatorPacket();
|
libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
|
||||||
reply.ChatData.Audible=1;
|
reply.ChatData.Audible = 1;
|
||||||
reply.ChatData.Message=enc.GetBytes(line);
|
reply.ChatData.Message = _enc.GetBytes(line);
|
||||||
reply.ChatData.ChatType=1;
|
reply.ChatData.ChatType = 1;
|
||||||
reply.ChatData.SourceType=1;
|
reply.ChatData.SourceType = 1;
|
||||||
reply.ChatData.Position=new LLVector3(120,100,21); //should set to actual position
|
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.FromName = _enc.GetBytes(userInfo.first_name + " " + userInfo.last_name + "\0");
|
||||||
reply.ChatData.OwnerID=User_info.AgentID;
|
reply.ChatData.OwnerID = userInfo.AgentID;
|
||||||
reply.ChatData.SourceID=User_info.AgentID;
|
reply.ChatData.SourceID = userInfo.AgentID;
|
||||||
//echo to sender
|
//echo to sender
|
||||||
server.SendPacket(reply,true,User_info);
|
_server.SendPacket(reply, true, userInfo);
|
||||||
|
|
||||||
//send to all users
|
//send to all users
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList)
|
||||||
{
|
{
|
||||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
if(kp.Value.NetInfo.AgentID!=userInfo.AgentID)
|
||||||
{
|
{
|
||||||
server.SendPacket(reply,true,kp.Value.NetInfo);
|
_server.SendPacket(reply, true, kp.Value.NetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,54 +471,54 @@ namespace OpenSim
|
||||||
/// <param name="z"></param>
|
/// <param name="z"></param>
|
||||||
/// <param name="av_id"></param>
|
/// <param name="av_id"></param>
|
||||||
/// <param name="body"></param>
|
/// <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)
|
public void SendMoveCommand(UserAgentInfo userInfo, bool stop, float x, float y, float z, uint avatarID, libsecondlife.LLQuaternion body)
|
||||||
{
|
{
|
||||||
uint ID=user.localID;
|
Console.WriteLine("sending move");
|
||||||
//ID=av_id;
|
uint ID = userInfo.localID;
|
||||||
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;
|
int i=0;
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
|
||||||
|
|
||||||
im.ObjectData[0]=dat;
|
ImprovedTerseObjectUpdatePacket im = new ImprovedTerseObjectUpdatePacket();
|
||||||
|
im.RegionData.RegionHandle = Globals.Instance.RegionHandle;;
|
||||||
|
im.RegionData.TimeDilation = 64096;
|
||||||
|
|
||||||
dat.TextureEntry=AvatarTemplate.TextureEntry;
|
im.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
libsecondlife.LLVector3 pos2=new LLVector3(x,y,z);
|
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
||||||
|
|
||||||
|
im.ObjectData[0] = dat;
|
||||||
|
|
||||||
|
dat.TextureEntry = AvatarTemplate.TextureEntry;
|
||||||
|
libsecondlife.LLVector3 pos2 = new LLVector3(x, y, z);
|
||||||
|
|
||||||
bytes[i++] = (byte)(ID % 256);
|
bytes[i++] = (byte)(ID % 256);
|
||||||
bytes[i++] = (byte)((ID >> 8) % 256);
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
||||||
bytes[i++] = (byte)((ID >> 16) % 256);
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||||
|
|
||||||
bytes[i++]=0;
|
bytes[i++] = 0;
|
||||||
bytes[i++]=1;
|
bytes[i++] = 1;
|
||||||
|
|
||||||
i+=14;
|
i += 14;
|
||||||
bytes[i++]=128;
|
bytes[i++] = 128;
|
||||||
bytes[i++]=63;
|
bytes[i++] = 63;
|
||||||
byte[] pb=pos2.GetBytes();
|
byte[] pb = pos2.GetBytes();
|
||||||
|
|
||||||
Array.Copy(pb,0,bytes,i,pb.Length);
|
Array.Copy(pb, 0, bytes, i, pb.Length);
|
||||||
i+=12;
|
i += 12;
|
||||||
ushort ac=32767;
|
ushort ac = 32767;
|
||||||
Axiom.MathLib.Vector3 v3=new Axiom.MathLib.Vector3(1,0,0);
|
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.Quaternion q = new Axiom.MathLib.Quaternion(body.W, body.X, body.Y, body.Z);
|
||||||
Axiom.MathLib.Vector3 direc=q*v3;
|
Axiom.MathLib.Vector3 direc = q * v3;
|
||||||
direc.Normalize();
|
direc.Normalize();
|
||||||
|
|
||||||
direc=direc*(0.03f);
|
direc = direc * (0.03f);
|
||||||
direc.x+=1;
|
direc.x += 1;
|
||||||
direc.y+=1;
|
direc.y += 1;
|
||||||
direc.z+=1;
|
direc.z += 1;
|
||||||
ushort dx,dy,dz;
|
ushort dx, dy, dz;
|
||||||
dx=(ushort)(32768*direc.x);
|
dx = (ushort)(32768 * direc.x);
|
||||||
dy=(ushort)(32768*direc.y);
|
dy = (ushort)(32768 * direc.y);
|
||||||
dz=(ushort)(32768*direc.z);
|
dz = (ushort)(32768 * direc.z);
|
||||||
|
|
||||||
//vel
|
//vel
|
||||||
if(!stop)
|
if(!stop)
|
||||||
|
@ -582,14 +578,14 @@ namespace OpenSim
|
||||||
|
|
||||||
dat.Data=bytes;
|
dat.Data=bytes;
|
||||||
|
|
||||||
server.SendPacket(im,true,user);
|
_server.SendPacket(im, true, userInfo);
|
||||||
|
|
||||||
//should send to all users.
|
//should send to all users.
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList)
|
foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList)
|
||||||
{
|
{
|
||||||
if(kp.Value.NetInfo.AgentID!=user.AgentID)
|
if(kp.Value.NetInfo.AgentID != userInfo.AgentID)
|
||||||
{
|
{
|
||||||
server.SendPacket(im,true,kp.Value.NetInfo);
|
_server.SendPacket(im, true, kp.Value.NetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -600,36 +596,30 @@ namespace OpenSim
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
/// <param name="lay"></param>
|
/// <param name="lay"></param>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
public void SendLayerData(User_Agent_info User_info,ref LayerDataPacket lay,string name)
|
public void SendLayerData(UserAgentInfo userInfo, ref LayerDataPacket layer, string name)
|
||||||
{
|
{
|
||||||
FileInfo fInfo = new FileInfo(name);
|
FileInfo fInfo = new FileInfo(name);
|
||||||
|
|
||||||
long numBytes = fInfo.Length;
|
long numBytes = fInfo.Length;
|
||||||
|
|
||||||
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
BinaryReader br = new BinaryReader(fStream);
|
BinaryReader br = new BinaryReader(fStream);
|
||||||
|
|
||||||
byte [] data1 = br.ReadBytes((int)numBytes);
|
byte [] data1 = br.ReadBytes((int)numBytes);
|
||||||
|
|
||||||
br.Close();
|
br.Close();
|
||||||
|
|
||||||
fStream.Close();
|
fStream.Close();
|
||||||
lay.LayerData.Data=data1;
|
layer.LayerData.Data = data1;
|
||||||
server.SendPacket(lay,true,User_info);
|
_server.SendPacket(layer, true, userInfo);
|
||||||
//System.Console.WriteLine("sent");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AvatarData
|
public class AvatarData
|
||||||
{
|
{
|
||||||
public User_Agent_info NetInfo;
|
public UserAgentInfo NetInfo;
|
||||||
public LLUUID FullID;
|
public LLUUID FullID;
|
||||||
public LLVector3 Position;
|
public LLVector3 Position;
|
||||||
public LLVector3 Velocity=new LLVector3(0,0,0);
|
public LLVector3 Velocity = new LLVector3(0,0,0);
|
||||||
//public LLQuaternion Rotation;
|
//public LLQuaternion Rotation;
|
||||||
public bool Walk=false;
|
public bool Walk = false;
|
||||||
public bool Started=false;
|
public bool Started = false;
|
||||||
//public TextureEntry TextureEntry;
|
//public TextureEntry TextureEntry;
|
||||||
public AvatarWearable[] Wearables;
|
public AvatarWearable[] Wearables;
|
||||||
public LLUUID InventoryFolder;
|
public LLUUID InventoryFolder;
|
||||||
|
@ -638,9 +628,9 @@ namespace OpenSim
|
||||||
public AvatarData()
|
public AvatarData()
|
||||||
{
|
{
|
||||||
Wearables=new AvatarWearable[2]; //should be 13
|
Wearables=new AvatarWearable[2]; //should be 13
|
||||||
for(int i=0; i<2; i++)
|
for(int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
Wearables[i]=new AvatarWearable();
|
Wearables[i] = new AvatarWearable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,22 +44,23 @@ namespace OpenSim
|
||||||
public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets;
|
public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets;
|
||||||
public Dictionary<libsecondlife.LLUUID,TextureImage> Textures;
|
public Dictionary<libsecondlife.LLUUID,TextureImage> Textures;
|
||||||
|
|
||||||
public ArrayList AssetRequests=new ArrayList(); //should change to a generic
|
public ArrayList AssetRequests = new ArrayList(); //should change to a generic
|
||||||
public ArrayList TextureRequests=new ArrayList();
|
public ArrayList TextureRequests = new ArrayList();
|
||||||
// public ArrayList uploads=new ArrayList();
|
//public ArrayList uploads=new ArrayList();
|
||||||
private Server server;
|
private Server _server;
|
||||||
public InventoryManager InventoryManager;
|
private InventoryManager _inventoryManager;
|
||||||
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="server"></param>
|
/// <param name="_server"></param>
|
||||||
public AssetManagement(Server server)
|
public AssetManagement(Server server, InventoryManager inventoryManager)
|
||||||
{
|
{
|
||||||
this.server=server;
|
this._server = server;
|
||||||
Textures=new Dictionary<libsecondlife.LLUUID,TextureImage> ();
|
this._inventoryManager = inventoryManager;
|
||||||
Assets=new Dictionary<libsecondlife.LLUUID,AssetInfo> ();
|
Textures = new Dictionary<libsecondlife.LLUUID,TextureImage> ();
|
||||||
|
Assets = new Dictionary<libsecondlife.LLUUID,AssetInfo> ();
|
||||||
this.initialise();
|
this.initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,38 +70,38 @@ namespace OpenSim
|
||||||
private void initialise()
|
private void initialise()
|
||||||
{
|
{
|
||||||
//Shape and skin base assets
|
//Shape and skin base assets
|
||||||
AssetInfo Asset=new AssetInfo();
|
AssetInfo Asset = new AssetInfo();
|
||||||
Asset.filename="base_shape.dat";
|
Asset.filename = "base_shape.dat";
|
||||||
Asset.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
Asset.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||||
this.LoadAsset(Asset, false);
|
this.LoadAsset(Asset, false);
|
||||||
this.Assets.Add(Asset.Full_ID, Asset);
|
this.Assets.Add(Asset.FullID, Asset);
|
||||||
|
|
||||||
Asset=new AssetInfo();
|
Asset = new AssetInfo();
|
||||||
Asset.filename="base_skin.dat";
|
Asset.filename = "base_skin.dat";
|
||||||
Asset.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
|
Asset.FullID = new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
|
||||||
this.LoadAsset(Asset, false);
|
this.LoadAsset(Asset, false);
|
||||||
this.Assets.Add(Asset.Full_ID, Asset);
|
this.Assets.Add(Asset.FullID, Asset);
|
||||||
|
|
||||||
//our test images
|
//our test images
|
||||||
//Change these filenames to images you want to use.
|
//Change these filenames to images you want to use.
|
||||||
TextureImage Image=new TextureImage();
|
TextureImage Image = new TextureImage();
|
||||||
Image.filename="testpic2.jp2";
|
Image.filename = "testpic2.jp2";
|
||||||
Image.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005");
|
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||||
Image.Name="test Texture";
|
Image.Name = "test Texture";
|
||||||
this.LoadAsset(Image, true);
|
this.LoadAsset(Image, true);
|
||||||
this.Textures.Add(Image.Full_ID, Image);
|
this.Textures.Add(Image.FullID, Image);
|
||||||
|
|
||||||
Image=new TextureImage();
|
Image = new TextureImage();
|
||||||
Image.filename="map_base.jp2";
|
Image.filename = "map_base.jp2";
|
||||||
Image.Full_ID=new LLUUID("00000000-0000-0000-7007-000000000006");
|
Image.FullID = new LLUUID("00000000-0000-0000-7007-000000000006");
|
||||||
this.LoadAsset(Image, true);
|
this.LoadAsset(Image, true);
|
||||||
this.Textures.Add(Image.Full_ID, Image);
|
this.Textures.Add(Image.FullID, Image);
|
||||||
|
|
||||||
Image=new TextureImage();
|
Image = new TextureImage();
|
||||||
Image.filename="map1.jp2";
|
Image.filename = "map1.jp2";
|
||||||
Image.Full_ID=new LLUUID("00000000-0000-0000-7009-000000000008");
|
Image.FullID = new LLUUID("00000000-0000-0000-7009-000000000008");
|
||||||
this.LoadAsset(Image, true);
|
this.LoadAsset(Image, true);
|
||||||
this.Textures.Add(Image.Full_ID, Image);
|
this.Textures.Add(Image.FullID, Image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -111,101 +112,101 @@ namespace OpenSim
|
||||||
/// <param name="TransferRequest"></param>
|
/// <param name="TransferRequest"></param>
|
||||||
#region AssetRegion
|
#region AssetRegion
|
||||||
|
|
||||||
public void AddAssetRequest(User_Agent_info UserInfo, LLUUID AssetID, TransferRequestPacket TransferRequest)
|
public void AddAssetRequest(UserAgentInfo userInfo, LLUUID assetID, TransferRequestPacket transferRequest)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!this.Assets.ContainsKey(AssetID))
|
if(!this.Assets.ContainsKey(assetID))
|
||||||
{
|
{
|
||||||
//not found asset
|
//not found asset
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AssetInfo info=this.Assets[AssetID];
|
AssetInfo info = this.Assets[assetID];
|
||||||
//for now as it will be only skin or shape request just send back the asset
|
//for now as it will be only skin or shape request just send back the asset
|
||||||
TransferInfoPacket Transfer=new TransferInfoPacket();
|
TransferInfoPacket Transfer = new TransferInfoPacket();
|
||||||
Transfer.TransferInfo.ChannelType=2;
|
Transfer.TransferInfo.ChannelType = 2;
|
||||||
Transfer.TransferInfo.Status=0;
|
Transfer.TransferInfo.Status = 0;
|
||||||
Transfer.TransferInfo.TargetType=0;
|
Transfer.TransferInfo.TargetType = 0;
|
||||||
Transfer.TransferInfo.Params=TransferRequest.TransferInfo.Params;
|
Transfer.TransferInfo.Params = transferRequest.TransferInfo.Params;
|
||||||
Transfer.TransferInfo.Size=info.data.Length;
|
Transfer.TransferInfo.Size = info.data.Length;
|
||||||
Transfer.TransferInfo.TransferID=TransferRequest.TransferInfo.TransferID;
|
Transfer.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
|
||||||
|
|
||||||
server.SendPacket(Transfer, true, UserInfo);
|
_server.SendPacket(Transfer, true, userInfo);
|
||||||
|
|
||||||
TransferPacketPacket TransferPacket=new TransferPacketPacket();
|
TransferPacketPacket TransferPacket = new TransferPacketPacket();
|
||||||
TransferPacket.TransferData.Packet=0;
|
TransferPacket.TransferData.Packet = 0;
|
||||||
TransferPacket.TransferData.ChannelType=2;
|
TransferPacket.TransferData.ChannelType = 2;
|
||||||
TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
|
TransferPacket.TransferData.TransferID=transferRequest.TransferInfo.TransferID;
|
||||||
if(info.data.Length>1000) //but needs to be less than 2000 at the moment
|
if(info.data.Length>1000) //but needs to be less than 2000 at the moment
|
||||||
{
|
{
|
||||||
byte[] chunk=new byte[1000];
|
byte[] chunk = new byte[1000];
|
||||||
Array.Copy(info.data,chunk,1000);
|
Array.Copy(info.data,chunk,1000);
|
||||||
TransferPacket.TransferData.Data=chunk;
|
TransferPacket.TransferData.Data = chunk;
|
||||||
TransferPacket.TransferData.Status=0;
|
TransferPacket.TransferData.Status = 0;
|
||||||
server.SendPacket(TransferPacket,true,UserInfo);
|
_server.SendPacket(TransferPacket,true,userInfo);
|
||||||
|
|
||||||
TransferPacket=new TransferPacketPacket();
|
TransferPacket = new TransferPacketPacket();
|
||||||
TransferPacket.TransferData.Packet=1;
|
TransferPacket.TransferData.Packet = 1;
|
||||||
TransferPacket.TransferData.ChannelType=2;
|
TransferPacket.TransferData.ChannelType = 2;
|
||||||
TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
|
TransferPacket.TransferData.TransferID = transferRequest.TransferInfo.TransferID;
|
||||||
byte[] chunk1=new byte[(info.data.Length-1000)];
|
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.Data = chunk1;
|
||||||
TransferPacket.TransferData.Status=1;
|
TransferPacket.TransferData.Status = 1;
|
||||||
server.SendPacket(TransferPacket, true, UserInfo);
|
_server.SendPacket(TransferPacket, true, userInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TransferPacket.TransferData.Status=1; //last packet? so set to 1
|
TransferPacket.TransferData.Status = 1; //last packet? so set to 1
|
||||||
TransferPacket.TransferData.Data=info.data;
|
TransferPacket.TransferData.Data = info.data;
|
||||||
server.SendPacket(TransferPacket, true, UserInfo);
|
_server.SendPacket(TransferPacket, true, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateNewInventorySet(ref AvatarData Avata,User_Agent_info UserInfo)
|
public void CreateNewInventorySet(ref AvatarData Avata,UserAgentInfo UserInfo)
|
||||||
{
|
{
|
||||||
//Create Folders
|
//Create Folders
|
||||||
LLUUID BaseFolder=Avata.BaseFolder;
|
LLUUID BaseFolder = Avata.BaseFolder;
|
||||||
InventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder);
|
_inventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder);
|
||||||
InventoryManager.CreateNewFolder(UserInfo, BaseFolder);
|
_inventoryManager.CreateNewFolder(UserInfo, BaseFolder);
|
||||||
|
|
||||||
//Give a copy of default shape
|
//Give a copy of default shape
|
||||||
AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")];
|
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.filename = "";
|
||||||
Shape.Name="Default Shape";
|
Shape.Name = "Default Shape";
|
||||||
Shape.Description="Default Shape";
|
Shape.Description = "Default Shape";
|
||||||
Shape.InvType=18;
|
Shape.InvType = 18;
|
||||||
Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
Shape.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
||||||
|
|
||||||
byte[] Agentid=enc.GetBytes(UserInfo.AgentID.ToStringHyphenated());
|
byte[] Agentid = _enc.GetBytes(UserInfo.AgentID.ToStringHyphenated());
|
||||||
Array.Copy(Agentid, 0, Shape.data, 294, Agentid.Length);
|
Array.Copy(Agentid, 0, Shape.data, 294, Agentid.Length);
|
||||||
this.Assets.Add(Shape.Full_ID, Shape);
|
this.Assets.Add(Shape.FullID, 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;
|
Avata.Wearables[0].AssetID = Shape.FullID;
|
||||||
|
|
||||||
//Give copy of default skin
|
//Give copy of default skin
|
||||||
Base=this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")];
|
Base = this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")];
|
||||||
AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base);
|
AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base);
|
||||||
|
|
||||||
Skin.filename="";
|
Skin.filename = "";
|
||||||
Skin.Name="Default Skin";
|
Skin.Name = "Default Skin";
|
||||||
Skin.Description="Default Skin";
|
Skin.Description = "Default Skin";
|
||||||
Skin.InvType=18;
|
Skin.InvType = 18;
|
||||||
Skin.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
Skin.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
||||||
|
|
||||||
Array.Copy(Agentid,0,Skin.data,238,Agentid.Length);
|
Array.Copy(Agentid,0,Skin.data,238,Agentid.Length);
|
||||||
this.Assets.Add(Skin.Full_ID, Skin);
|
this.Assets.Add(Skin.FullID, 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;
|
Avata.Wearables[1].AssetID = Skin.FullID;
|
||||||
|
|
||||||
//give a copy of test texture
|
//give a copy of test texture
|
||||||
TextureImage Texture=this.CloneImage(UserInfo.AgentID,Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]);
|
TextureImage Texture = this.CloneImage(UserInfo.AgentID, Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]);
|
||||||
this.Textures.Add(Texture.Full_ID, Texture);
|
this.Textures.Add(Texture.FullID, Texture);
|
||||||
InventoryManager.AddToInventory(UserInfo, BaseFolder, Texture);
|
_inventoryManager.AddToInventory(UserInfo, BaseFolder, Texture);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,116 +218,116 @@ namespace OpenSim
|
||||||
string folder;
|
string folder;
|
||||||
if(Image)
|
if(Image)
|
||||||
{
|
{
|
||||||
folder=@"\textures\";
|
folder = @"\textures\";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
folder=@"\assets\";
|
folder = @"\assets\";
|
||||||
}
|
}
|
||||||
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + folder;
|
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + folder;
|
||||||
string filename=data_path+@info.filename;
|
string filename = data_path+@info.filename;
|
||||||
FileInfo fInfo = new FileInfo(filename);
|
FileInfo fInfo = new FileInfo(filename);
|
||||||
|
|
||||||
long numBytes = fInfo.Length;
|
long numBytes = fInfo.Length;
|
||||||
|
|
||||||
FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
|
FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
|
||||||
byte[] idata=new byte[numBytes];
|
byte[] idata = new byte[numBytes];
|
||||||
BinaryReader br = new BinaryReader(fStream);
|
BinaryReader br = new BinaryReader(fStream);
|
||||||
idata= br.ReadBytes((int)numBytes);
|
idata= br.ReadBytes((int)numBytes);
|
||||||
br.Close();
|
br.Close();
|
||||||
fStream.Close();
|
fStream.Close();
|
||||||
info.data=idata;
|
info.data = idata;
|
||||||
//info.loaded=true;
|
//info.loaded=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset)
|
public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset)
|
||||||
{
|
{
|
||||||
AssetInfo NewAsset=new AssetInfo();
|
AssetInfo NewAsset = new AssetInfo();
|
||||||
NewAsset.data=new byte[SourceAsset.data.Length];
|
NewAsset.data = new byte[SourceAsset.data.Length];
|
||||||
Array.Copy(SourceAsset.data,NewAsset.data,SourceAsset.data.Length);
|
Array.Copy(SourceAsset.data, NewAsset.data, SourceAsset.data.Length);
|
||||||
NewAsset.Full_ID=LLUUID.Random();
|
NewAsset.FullID = LLUUID.Random();
|
||||||
NewAsset.Type=SourceAsset.Type;
|
NewAsset.Type = SourceAsset.Type;
|
||||||
NewAsset.InvType=SourceAsset.InvType;
|
NewAsset.InvType = SourceAsset.InvType;
|
||||||
return(NewAsset);
|
return(NewAsset);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region TextureRegion
|
#region TextureRegion
|
||||||
public void AddTextureRequest(User_Agent_info user, LLUUID image_id)
|
public void AddTextureRequest(UserAgentInfo userInfo, LLUUID imageID)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!this.Textures.ContainsKey(image_id))
|
if(!this.Textures.ContainsKey(imageID))
|
||||||
{
|
{
|
||||||
//not found image so send back image not in data base message
|
//not found image so send back image not in data base message
|
||||||
ImageNotInDatabasePacket im_not=new ImageNotInDatabasePacket();
|
ImageNotInDatabasePacket im_not = new ImageNotInDatabasePacket();
|
||||||
im_not.ImageID.ID=image_id;
|
im_not.ImageID.ID=imageID;
|
||||||
server.SendPacket(im_not, true, user);
|
_server.SendPacket(im_not, true, userInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TextureImage imag=this.Textures[image_id];
|
TextureImage imag = this.Textures[imageID];
|
||||||
TextureRequest req=new TextureRequest();
|
TextureRequest req = new TextureRequest();
|
||||||
req.RequestUser=user;
|
req.RequestUser = userInfo;
|
||||||
req.RequestImage=image_id;
|
req.RequestImage = imageID;
|
||||||
req.image_info=imag;
|
req.image_info = imag;
|
||||||
|
|
||||||
if(imag.data.LongLength>1000) //should be bigger or smaller?
|
if(imag.data.LongLength>1000) //should be bigger or smaller?
|
||||||
{
|
{
|
||||||
//over 1000 bytes so split up file
|
//over 1000 bytes so split up file
|
||||||
req.num_packets=(int)imag.data.LongLength/1000;
|
req.num_packets = (int)imag.data.LongLength/1000;
|
||||||
req.num_packets++;
|
req.num_packets++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
req.num_packets=1;
|
req.num_packets = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.TextureRequests.Add(req);
|
this.TextureRequests.Add(req);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTexture(LLUUID image_id, string name, byte[] data)
|
public void AddTexture(LLUUID imageID, string name, byte[] data)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public void DoWork(ulong time)
|
public void DoWork(ulong time)
|
||||||
{
|
{
|
||||||
if(this.TextureRequests.Count==0)
|
if(this.TextureRequests.Count == 0)
|
||||||
{
|
{
|
||||||
//no requests waiting
|
//no requests waiting
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int num;
|
int num;
|
||||||
//should be running in its own thread but for now is called by timer
|
//should be running in its own thread but for now is called by timer
|
||||||
if(this.TextureRequests.Count<5)
|
if(this.TextureRequests.Count < 5)
|
||||||
{
|
{
|
||||||
//lower than 5 so do all of them
|
//lower than 5 so do all of them
|
||||||
num=this.TextureRequests.Count;
|
num = this.TextureRequests.Count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
num=5;
|
num=5;
|
||||||
}
|
}
|
||||||
TextureRequest req;
|
TextureRequest req;
|
||||||
for(int i=0; i<num; i++)
|
for(int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
req=(TextureRequest)this.TextureRequests[i];
|
req=(TextureRequest)this.TextureRequests[i];
|
||||||
|
|
||||||
if(req.packet_counter==0)
|
if(req.packet_counter == 0)
|
||||||
{
|
{
|
||||||
//first time for this request so send imagedata packet
|
//first time for this request so send imagedata packet
|
||||||
if(req.num_packets==1)
|
if(req.num_packets == 1)
|
||||||
{
|
{
|
||||||
//only one packet so send whole file
|
//only one packet so send whole file
|
||||||
ImageDataPacket im=new ImageDataPacket();
|
ImageDataPacket im = new ImageDataPacket();
|
||||||
im.ImageID.Packets=1;
|
im.ImageID.Packets = 1;
|
||||||
im.ImageID.ID=req.image_info.Full_ID;
|
im.ImageID.ID = req.image_info.FullID;
|
||||||
im.ImageID.Size=(uint)req.image_info.data.Length;
|
im.ImageID.Size = (uint)req.image_info.data.Length;
|
||||||
im.ImageData.Data=req.image_info.data;
|
im.ImageData.Data = req.image_info.data;
|
||||||
im.ImageID.Codec=2;
|
im.ImageID.Codec = 2;
|
||||||
server.SendPacket(im,true,req.RequestUser);
|
_server.SendPacket(im, true, req.RequestUser);
|
||||||
req.packet_counter++;
|
req.packet_counter++;
|
||||||
req.image_info.last_used=time;
|
req.image_info.last_used = time;
|
||||||
System.Console.WriteLine("sent texture: "+req.image_info.Full_ID);
|
System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -341,10 +342,10 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove requests that have been completed
|
//remove requests that have been completed
|
||||||
for(int i=0; i<num; i++)
|
for(int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
req=(TextureRequest)this.TextureRequests[i];
|
req=(TextureRequest)this.TextureRequests[i];
|
||||||
if(req.packet_counter==req.num_packets)
|
if(req.packet_counter == req.num_packets)
|
||||||
{
|
{
|
||||||
this.TextureRequests.Remove(req);
|
this.TextureRequests.Remove(req);
|
||||||
}
|
}
|
||||||
|
@ -356,15 +357,15 @@ namespace OpenSim
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextureImage CloneImage(LLUUID NewOwner,TextureImage Source)
|
public TextureImage CloneImage(LLUUID newOwner, TextureImage source)
|
||||||
{
|
{
|
||||||
TextureImage NewImage=new TextureImage();
|
TextureImage newImage = new TextureImage();
|
||||||
NewImage.data=new byte[Source.data.Length];
|
newImage.data = new byte[source.data.Length];
|
||||||
Array.Copy(Source.data,NewImage.data,Source.data.Length);
|
Array.Copy(source.data,newImage.data,source.data.Length);
|
||||||
NewImage.filename=Source.filename;
|
newImage.filename = source.filename;
|
||||||
NewImage.Full_ID=LLUUID.Random();
|
newImage.FullID = LLUUID.Random();
|
||||||
NewImage.Name=Source.Name;
|
newImage.Name = source.Name;
|
||||||
return(NewImage);
|
return(newImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -372,12 +373,12 @@ namespace OpenSim
|
||||||
|
|
||||||
public class AssetRequest
|
public class AssetRequest
|
||||||
{
|
{
|
||||||
public User_Agent_info RequestUser;
|
public UserAgentInfo RequestUser;
|
||||||
public LLUUID RequestImage;
|
public LLUUID RequestImage;
|
||||||
public AssetInfo asset_inf;
|
public AssetInfo asset_inf;
|
||||||
public long data_pointer=0;
|
public long data_pointer = 0;
|
||||||
public int num_packets=0;
|
public int num_packets = 0;
|
||||||
public int packet_counter=0;
|
public int packet_counter = 0;
|
||||||
|
|
||||||
public AssetRequest()
|
public AssetRequest()
|
||||||
{
|
{
|
||||||
|
@ -401,7 +402,7 @@ namespace OpenSim
|
||||||
public class AssetBase
|
public class AssetBase
|
||||||
{
|
{
|
||||||
public byte[] data;
|
public byte[] data;
|
||||||
public LLUUID Full_ID;
|
public LLUUID FullID;
|
||||||
public sbyte Type;
|
public sbyte Type;
|
||||||
public sbyte InvType;
|
public sbyte InvType;
|
||||||
public string Name;
|
public string Name;
|
||||||
|
@ -413,14 +414,14 @@ namespace OpenSim
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class TextureRequest
|
public class TextureRequest
|
||||||
{
|
{
|
||||||
public User_Agent_info RequestUser;
|
public UserAgentInfo RequestUser;
|
||||||
public LLUUID RequestImage;
|
public LLUUID RequestImage;
|
||||||
public TextureImage image_info;
|
public TextureImage image_info;
|
||||||
public long data_pointer=0;
|
public long data_pointer = 0;
|
||||||
public int num_packets=0;
|
public int num_packets = 0;
|
||||||
public int packet_counter=0;
|
public int packet_counter = 0;
|
||||||
|
|
||||||
public TextureRequest()
|
public TextureRequest()
|
||||||
{
|
{
|
||||||
|
@ -435,7 +436,7 @@ namespace OpenSim
|
||||||
//public string name;
|
//public string name;
|
||||||
public bool loaded;
|
public bool loaded;
|
||||||
public ulong last_used; //need to add a tick/time counter and keep record
|
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()
|
public TextureImage()
|
||||||
{
|
{
|
||||||
|
|
228
Controller.cs
228
Controller.cs
|
@ -43,47 +43,46 @@ namespace OpenSim
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of MainForm.
|
/// Description of MainForm.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Controller : ServerCallback {
|
public partial class Controller : ServerCallback
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main( string[] args ) {
|
public static void Main( string[] args )
|
||||||
|
{
|
||||||
Controller c = new Controller();
|
Controller c = new Controller();
|
||||||
while( true ) // fuckin' a
|
while( true ) // fuckin' a
|
||||||
System.Threading.Thread.Sleep( 1000 );
|
System.Threading.Thread.Sleep( 1000 );
|
||||||
|
|
||||||
}
|
}
|
||||||
public Server server;
|
|
||||||
public Logon _login;
|
private Server _server;
|
||||||
private AgentManager Agent_Manager;
|
private Logon _login;
|
||||||
private PrimManager Prim_Manager;
|
private AgentManager _agentManager;
|
||||||
private AssetManagement Asset_Manager;
|
private PrimManager _primManager;
|
||||||
private GridManager Grid_Manager;
|
private AssetManagement _assetManager;
|
||||||
private InventoryManager Inventory_Manager;
|
private GridManager _gridManager;
|
||||||
private LoginManager Login_Manager; //built in login server
|
private InventoryManager _inventoryManager;
|
||||||
|
private LoginManager _loginManager; //built in login server
|
||||||
private ulong time; //ticks
|
private ulong time; //ticks
|
||||||
private Timer timer1 = new Timer();
|
private Timer timer1 = new Timer();
|
||||||
|
|
||||||
|
|
||||||
public Controller() {
|
public Controller() {
|
||||||
_login=new Logon(); // should create a list for these.
|
_login = new Logon(); // should create a list for these.
|
||||||
server = new Server( this );
|
_server = new Server( this );
|
||||||
Agent_Manager = new AgentManager( this.server );
|
_agentManager = new AgentManager( this._server );
|
||||||
Prim_Manager = new PrimManager( this.server );
|
_primManager = new PrimManager( this._server );
|
||||||
Asset_Manager = new AssetManagement( this.server );
|
_inventoryManager = new InventoryManager(this._server);
|
||||||
Prim_Manager.Agent_Manager = Agent_Manager;
|
_assetManager = new AssetManagement(this._server, _inventoryManager );
|
||||||
Agent_Manager.Prim_Manager = Prim_Manager;
|
_primManager.AgentManagement = _agentManager;
|
||||||
Agent_Manager.Asset_Manager=Asset_Manager;
|
_agentManager.Prim_Manager = _primManager;
|
||||||
Inventory_Manager=new InventoryManager(this.server);
|
_agentManager.assetManager = _assetManager;
|
||||||
Asset_Manager.InventoryManager=Inventory_Manager;
|
_gridManager = new GridManager(this._server, _agentManager);
|
||||||
Grid_Manager=new GridManager(this.server,Agent_Manager);
|
|
||||||
|
|
||||||
if(Globals.Instance.LoginSever)
|
if(Globals.Instance.LoginSever)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Starting login Server");
|
Console.WriteLine("Starting login Server");
|
||||||
Login_Manager = new LoginManager(_login); // startup
|
_loginManager = new LoginManager(_login); // startup
|
||||||
Login_Manager.Startup(); // login server
|
_loginManager.Startup(); // login server
|
||||||
}
|
}
|
||||||
|
|
||||||
timer1.Enabled = true;
|
timer1.Enabled = true;
|
||||||
|
@ -92,169 +91,162 @@ namespace OpenSim
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void MainCallback( Packet pack, User_Agent_info User_info ) {
|
public void MainCallback( Packet pack, UserAgentInfo userInfo )
|
||||||
|
{
|
||||||
|
|
||||||
/*if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) {
|
/*if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) {
|
||||||
//Log packet?
|
//Log packet?
|
||||||
// System.Console.WriteLine(pack.Type);
|
//System.Console.WriteLine(pack.Type);
|
||||||
//this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type;
|
//this.richTextBox1.Text = this.richTextBox1.Text + "\n " + pack.Type;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
//should replace with a switch
|
//should replace with a switch
|
||||||
if( pack.Type == PacketType.AgentSetAppearance ) {
|
if( pack.Type == PacketType.AgentSetAppearance ) {
|
||||||
//System.Console.WriteLine(pack);
|
|
||||||
//this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.FetchInventory)
|
else if( pack.Type == PacketType.FetchInventory)
|
||||||
{
|
{
|
||||||
FetchInventoryPacket FetchInventory=(FetchInventoryPacket)pack;
|
FetchInventoryPacket FetchInventory = (FetchInventoryPacket)pack;
|
||||||
Inventory_Manager.FetchInventory(User_info,FetchInventory);
|
_inventoryManager.FetchInventory(userInfo, FetchInventory);
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.FetchInventoryDescendents)
|
else if( pack.Type == PacketType.FetchInventoryDescendents)
|
||||||
{
|
{
|
||||||
FetchInventoryDescendentsPacket Fetch=(FetchInventoryDescendentsPacket)pack;
|
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)pack;
|
||||||
Inventory_Manager.FetchInventoryDescendents(User_info,Fetch);
|
_inventoryManager.FetchInventoryDescendents(userInfo, Fetch);
|
||||||
}
|
}
|
||||||
else if(pack.Type== PacketType.MapBlockRequest)
|
else if(pack.Type == PacketType.MapBlockRequest)
|
||||||
{
|
{
|
||||||
//int MinX, MinY, MaxX, MaxY;
|
|
||||||
MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack;
|
MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack;
|
||||||
this.Grid_Manager.RequestMapBlock(User_info,MapRequest.PositionData.MinX,MapRequest.PositionData.MinY,MapRequest.PositionData.MaxX,MapRequest.PositionData.MaxY);
|
this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(pack.Type== PacketType.CloseCircuit)
|
else if(pack.Type == PacketType.CloseCircuit)
|
||||||
{
|
{
|
||||||
this.Agent_Manager.RemoveAgent(User_info);
|
this._agentManager.RemoveAgent(userInfo);
|
||||||
}
|
}
|
||||||
else if(pack.Type== PacketType.MapLayerRequest)
|
else if(pack.Type == PacketType.MapLayerRequest)
|
||||||
{
|
{
|
||||||
this.Grid_Manager.RequestMapLayer(User_info);
|
this._gridManager.RequestMapLayer(userInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if((pack.Type== PacketType.TeleportRequest ) ||(pack.Type== PacketType.TeleportLocationRequest))
|
else if((pack.Type == PacketType.TeleportRequest ) || (pack.Type == PacketType.TeleportLocationRequest))
|
||||||
{
|
{
|
||||||
TeleportLocationRequestPacket Request=(TeleportLocationRequestPacket)pack;
|
TeleportLocationRequestPacket Request = (TeleportLocationRequestPacket)pack;
|
||||||
|
this._gridManager.RequestTeleport(userInfo,Request);
|
||||||
this.Grid_Manager.RequestTeleport(User_info,Request);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.TransferRequest ) {
|
else if( pack.Type == PacketType.TransferRequest ) {
|
||||||
TransferRequestPacket tran = (TransferRequestPacket)pack;
|
TransferRequestPacket transfer = (TransferRequestPacket)pack;
|
||||||
LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 );
|
LLUUID id = new LLUUID( transfer.TransferInfo.Params, 0 );
|
||||||
Asset_Manager.AddAssetRequest( User_info, id, tran );
|
_assetManager.AddAssetRequest( userInfo, id, transfer );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( ( pack.Type == PacketType.StartPingCheck ) ) {
|
else if( ( pack.Type == PacketType.StartPingCheck ) ) {
|
||||||
//reply to pingcheck
|
//reply to pingcheck
|
||||||
libsecondlife.Packets.StartPingCheckPacket startp = (libsecondlife.Packets.StartPingCheckPacket)pack;
|
libsecondlife.Packets.StartPingCheckPacket startping = (libsecondlife.Packets.StartPingCheckPacket)pack;
|
||||||
libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket();
|
libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket();
|
||||||
endping.PingID.PingID = startp.PingID.PingID;
|
endping.PingID.PingID = startping.PingID.PingID;
|
||||||
server.SendPacket( endping, true, User_info );
|
_server.SendPacket(endping, true, userInfo );
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.CompleteAgentMovement )
|
else if( pack.Type == PacketType.CompleteAgentMovement )
|
||||||
{
|
{
|
||||||
// new client
|
_agentManager.AgentJoin(userInfo );
|
||||||
Agent_Manager.AgentJoin( User_info );
|
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.RequestImage )
|
else if( pack.Type == PacketType.RequestImage )
|
||||||
{
|
{
|
||||||
RequestImagePacket image_req = (RequestImagePacket)pack;
|
RequestImagePacket imageRequest = (RequestImagePacket)pack;
|
||||||
for( int i = 0; i < image_req.RequestImage.Length; i++ )
|
for( int i = 0; i < imageRequest.RequestImage.Length; i++ )
|
||||||
{
|
{
|
||||||
this.Asset_Manager.AddTextureRequest( User_info, image_req.RequestImage[ i ].Image );
|
this._assetManager.AddTextureRequest(userInfo, imageRequest.RequestImage[i].Image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.RegionHandshakeReply ) {
|
else if( pack.Type == PacketType.RegionHandshakeReply ) {
|
||||||
//recieved regionhandshake so can now start sending info
|
//recieved regionhandshake so can now start sending info
|
||||||
Agent_Manager.SendInitialData( User_info );
|
_agentManager.SendInitialData(userInfo );
|
||||||
//this.setuptemplates("objectupate164.dat",User_info,false);
|
}
|
||||||
}
|
|
||||||
else if( pack.Type == PacketType.ObjectAdd )
|
else if( pack.Type == PacketType.ObjectAdd )
|
||||||
{
|
{
|
||||||
ObjectAddPacket ad = (ObjectAddPacket)pack;
|
ObjectAddPacket ad = (ObjectAddPacket)pack;
|
||||||
Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad );
|
_primManager.CreatePrim(userInfo, ad.ObjectData.RayEnd, ad );
|
||||||
//this.send_prim(User_info,ad.ObjectData.RayEnd, ad);
|
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.ObjectPosition ) {
|
else if( pack.Type == PacketType.ObjectPosition ) {
|
||||||
//System.Console.WriteLine(pack.ToString());
|
//System.Console.WriteLine(pack.ToString());
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.MultipleObjectUpdate ) {
|
else if( pack.Type == PacketType.MultipleObjectUpdate )
|
||||||
//System.Console.WriteLine(pack.ToString());
|
{
|
||||||
MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack;
|
MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)pack;
|
||||||
|
|
||||||
for( int i = 0; i < mupd.ObjectData.Length; i++ )
|
for( int i = 0; i < multipleupdate.ObjectData.Length; i++ )
|
||||||
{
|
{
|
||||||
if( mupd.ObjectData[ i ].Type == 9 ) //change position
|
if( multipleupdate.ObjectData[ i ].Type == 9 ) //change position
|
||||||
{
|
{
|
||||||
libsecondlife.LLVector3 pos = new LLVector3( mupd.ObjectData[ i ].Data, 0 );
|
libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[ i ].Data, 0 );
|
||||||
// libsecondlife.LLQuaternion rot=new LLQuaternion(mupd.ObjectData[i].Data,12,true);
|
_primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID ,false ,libsecondlife.LLQuaternion.Identity);
|
||||||
Prim_Manager.UpdatePrimPosition( User_info, pos, mupd.ObjectData[ i ].ObjectLocalID ,false ,libsecondlife.LLQuaternion.Identity);
|
|
||||||
//should update stored position of the prim
|
//should update stored position of the prim
|
||||||
}
|
}
|
||||||
else if( mupd.ObjectData[ i ].Type == 10 )
|
else if(multipleupdate.ObjectData[i].Type == 10 )//rotation
|
||||||
{
|
{
|
||||||
//System.Console.WriteLine(mupd.ObjectData[ i ].Type);
|
|
||||||
//System.Console.WriteLine(mupd);
|
|
||||||
libsecondlife.LLVector3 pos = new LLVector3(100,100,22);
|
libsecondlife.LLVector3 pos = new LLVector3(100,100,22);
|
||||||
libsecondlife.LLQuaternion rot=new LLQuaternion(mupd.ObjectData[i].Data,0,true);
|
libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
|
||||||
Prim_Manager.UpdatePrimPosition( User_info, pos, mupd.ObjectData[ i ].ObjectLocalID ,true ,rot);
|
_primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID, true ,rot);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.AgentWearablesRequest )
|
else if( pack.Type == PacketType.AgentWearablesRequest )
|
||||||
{
|
{
|
||||||
Agent_Manager.SendIntialAvatarAppearance( User_info );
|
_agentManager.SendIntialAvatarAppearance(userInfo );
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.AgentUpdate )
|
else if(pack.Type == PacketType.AgentUpdate)
|
||||||
{
|
{
|
||||||
AgentUpdatePacket ag = (AgentUpdatePacket)pack;
|
// System.Console.WriteLine("agent update");
|
||||||
uint mask = ag.AgentData.ControlFlags & ( 1 );
|
AgentUpdatePacket agent = (AgentUpdatePacket)pack;
|
||||||
AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID );
|
uint mask = agent.AgentData.ControlFlags & ( 1 );
|
||||||
if( m_av != null )
|
AvatarData avatar = _agentManager.GetAgent(userInfo.AgentID );
|
||||||
{
|
if(avatar != null )
|
||||||
if( m_av.Started )
|
{
|
||||||
|
if(avatar.Started )
|
||||||
{
|
{
|
||||||
if( mask == ( 1 ) )
|
if( mask == ( 1 ) )
|
||||||
{
|
{
|
||||||
if( !m_av.Walk )
|
if(!avatar.Walk)
|
||||||
{
|
{
|
||||||
//start walking
|
//start walking
|
||||||
Agent_Manager.SendMoveCommand( User_info, false, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation );
|
_agentManager.SendMoveCommand(userInfo, false, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation );
|
||||||
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 );
|
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 );
|
||||||
Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion( ag.AgentData.BodyRotation.W, ag.AgentData.BodyRotation.X, ag.AgentData.BodyRotation.Y, ag.AgentData.BodyRotation.Z );
|
Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion( agent.AgentData.BodyRotation.W, agent.AgentData.BodyRotation.X, agent.AgentData.BodyRotation.Y, agent.AgentData.BodyRotation.Z );
|
||||||
Axiom.MathLib.Vector3 direc = q * v3;
|
Axiom.MathLib.Vector3 direc = q * v3;
|
||||||
direc.Normalize();
|
direc.Normalize();
|
||||||
direc = direc * ( ( 0.03f ) * 128f );
|
direc = direc * ( ( 0.03f ) * 128f );
|
||||||
|
|
||||||
m_av.Velocity.X = direc.x;
|
avatar.Velocity.X = direc.x;
|
||||||
m_av.Velocity.Y = direc.y;
|
avatar.Velocity.Y = direc.y;
|
||||||
m_av.Velocity.Z = direc.z;
|
avatar.Velocity.Z = direc.z;
|
||||||
m_av.Walk = true;
|
avatar.Walk = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_av.Walk )
|
if(avatar.Walk)
|
||||||
{
|
{
|
||||||
//walking but key not pressed so need to stop
|
//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 );
|
_agentManager.SendMoveCommand(userInfo, true, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation );
|
||||||
m_av.Walk = false;
|
avatar.Walk = false;
|
||||||
m_av.Velocity.X = 0;
|
avatar.Velocity.X = 0;
|
||||||
m_av.Velocity.Y = 0;
|
avatar.Velocity.Y = 0;
|
||||||
m_av.Velocity.Z = 0;
|
avatar.Velocity.Z = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( pack.Type == PacketType.ChatFromViewer )
|
else if( pack.Type == PacketType.ChatFromViewer )
|
||||||
{
|
{
|
||||||
ChatFromViewerPacket chat = (ChatFromViewerPacket)pack;
|
ChatFromViewerPacket chat = (ChatFromViewerPacket)pack;
|
||||||
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||||
|
|
||||||
string myString = enc.GetString( chat.ChatData.Message );
|
string myString = enc.GetString(chat.ChatData.Message );
|
||||||
if( myString != "" ) {
|
if( myString != "" ) {
|
||||||
string[] comp = new string[ 10 ];
|
string[] comp = new string[ 10 ];
|
||||||
string delimStr = " , ";
|
string delimStr = " , ";
|
||||||
|
@ -271,34 +263,32 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Agent_Manager.SendChatMessage( User_info, line );
|
_agentManager.SendChatMessage(userInfo, line );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void NewUserCallback( User_Agent_info UserInfo )
|
public void NewUserCallback(UserAgentInfo userInfo )
|
||||||
{
|
{
|
||||||
Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode);
|
Console.WriteLine( "new user - {0} - has joined [session {1}]", userInfo.AgentID.ToString(), userInfo.SessionID.ToString() +"curcuit used"+userInfo.circuitCode);
|
||||||
string first,last;
|
string first,last;
|
||||||
LLUUID Base,Inventory;
|
LLUUID Base,Inventory;
|
||||||
lock(_login)
|
lock(_login)
|
||||||
{
|
{
|
||||||
first=_login.first;
|
first=_login.First;
|
||||||
last=_login.last;
|
last=_login.Last;
|
||||||
Base=_login.BaseFolder;
|
Base=_login.BaseFolder;
|
||||||
Inventory=_login.InventoryFolder;
|
Inventory=_login.InventoryFolder;
|
||||||
|
|
||||||
//should get agentid and sessionid so they can be checked.
|
//should get agentid and sessionid so they can be checked.
|
||||||
}
|
}
|
||||||
Agent_Manager.NewAgent( UserInfo ,first,last,Base,Inventory);
|
_agentManager.NewAgent(userInfo, first, last, Base, Inventory);
|
||||||
//now because of the lack of Global account management (User server etc)
|
//now because of the lack of Global account management (User server etc)
|
||||||
//we need to reset the names back to default incase a teleport happens
|
//we need to reset the names back to default incase a teleport happens
|
||||||
//which will not have a Login name set, so they will use default names
|
//which will not have a Login name set, so they will use default names
|
||||||
lock(_login)
|
lock(_login)
|
||||||
{
|
{
|
||||||
_login.first="Test";
|
_login.First="Test";
|
||||||
_login.last="User";
|
_login.Last="User";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,14 +298,14 @@ namespace OpenSim
|
||||||
|
|
||||||
void Timer1Tick( object sender, System.EventArgs e ) {
|
void Timer1Tick( object sender, System.EventArgs e ) {
|
||||||
this.time++;
|
this.time++;
|
||||||
Agent_Manager.UpdatePositions();
|
_agentManager.UpdatePositions();
|
||||||
this.Asset_Manager.DoWork( time );
|
this._assetManager.DoWork( time );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Logon
|
public class Logon
|
||||||
{
|
{
|
||||||
public string first="Test";
|
public string First = "Test";
|
||||||
public string last="User";
|
public string Last = "User";
|
||||||
public LLUUID Agent;
|
public LLUUID Agent;
|
||||||
public LLUUID Session;
|
public LLUUID Session;
|
||||||
public LLUUID InventoryFolder;
|
public LLUUID InventoryFolder;
|
||||||
|
|
20
Globals.cs
20
Globals.cs
|
@ -38,8 +38,10 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
private static Globals instance = new Globals();
|
private static Globals instance = new Globals();
|
||||||
|
|
||||||
public static Globals Instance {
|
public static Globals Instance
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,17 +50,13 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RegionName="Test Sandbox\0";
|
public string RegionName = "Test Sandbox\0";
|
||||||
public ulong RegionHandle= 1096213093147648;
|
public ulong RegionHandle = 1096213093147648;
|
||||||
public int IpPort=1000;
|
public int IpPort = 1000;
|
||||||
|
|
||||||
public bool LoginSever=true;
|
public bool LoginSever = true;
|
||||||
public ushort LoginServerPort=8080;
|
public ushort LoginServerPort = 8080;
|
||||||
|
|
||||||
//public string RegionName= "The Other\0";
|
|
||||||
//public ulong RegionHandle= 1095113581519872;
|
|
||||||
//public int IpPort=1020;
|
|
||||||
//public bool LoginSever=false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
226
GridManager.cs
226
GridManager.cs
|
@ -44,21 +44,21 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GridManager
|
public class GridManager
|
||||||
{
|
{
|
||||||
private Server server;
|
private Server _server;
|
||||||
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
private AgentManager AgentManager;
|
private AgentManager _agentManager;
|
||||||
private Dictionary<ulong,RegionInfo> Grid;
|
public Dictionary<ulong,RegionInfo> Grid;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serve"></param>
|
/// <param name="serve"></param>
|
||||||
/// <param name="agentManager"></param>
|
/// <param name="agentManager"></param>
|
||||||
public GridManager(Server serve, AgentManager agentManager)
|
public GridManager(Server server, AgentManager agentManager)
|
||||||
{
|
{
|
||||||
Grid=new Dictionary<ulong, RegionInfo>();
|
Grid = new Dictionary<ulong, RegionInfo>();
|
||||||
server=serve;
|
_server = server;
|
||||||
AgentManager=agentManager;
|
_agentManager = agentManager;
|
||||||
LoadGrid();
|
LoadGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,20 +66,20 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UserInfo"></param>
|
/// <param name="UserInfo"></param>
|
||||||
public void RequestMapLayer(User_Agent_info UserInfo)
|
public void RequestMapLayer(UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
//send a layer covering the 800,800 - 1200,1200 area
|
//send a layer covering the 800,800 - 1200,1200 area
|
||||||
MapLayerReplyPacket MapReply=new MapLayerReplyPacket();
|
MapLayerReplyPacket MapReply = new MapLayerReplyPacket();
|
||||||
MapReply.AgentData.AgentID=UserInfo.AgentID;
|
MapReply.AgentData.AgentID = userInfo.AgentID;
|
||||||
MapReply.AgentData.Flags=0;
|
MapReply.AgentData.Flags = 0;
|
||||||
MapReply.LayerData=new MapLayerReplyPacket.LayerDataBlock[1];
|
MapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
|
||||||
MapReply.LayerData[0]=new MapLayerReplyPacket.LayerDataBlock();
|
MapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
|
||||||
MapReply.LayerData[0].Bottom=800;
|
MapReply.LayerData[0].Bottom = 800;
|
||||||
MapReply.LayerData[0].Left=800;
|
MapReply.LayerData[0].Left = 800;
|
||||||
MapReply.LayerData[0].Top=1200;
|
MapReply.LayerData[0].Top = 1200;
|
||||||
MapReply.LayerData[0].Right=1200;
|
MapReply.LayerData[0].Right = 1200;
|
||||||
MapReply.LayerData[0].ImageID=new LLUUID("00000000-0000-0000-7007-000000000006");
|
MapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-7007-000000000006");
|
||||||
server.SendPacket(MapReply,true,UserInfo);
|
_server.SendPacket(MapReply, true, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -90,28 +90,28 @@ namespace OpenSim
|
||||||
/// <param name="MinY"></param>
|
/// <param name="MinY"></param>
|
||||||
/// <param name="MaxX"></param>
|
/// <param name="MaxX"></param>
|
||||||
/// <param name="MaxY"></param>
|
/// <param name="MaxY"></param>
|
||||||
public void RequestMapBlock(User_Agent_info UserInfo, int MinX, int MinY,int MaxX,int MaxY)
|
public void RequestMapBlock(UserAgentInfo userInfo, int minX, int minY,int maxX,int maxY)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<ulong,RegionInfo> RegionPair in this.Grid)
|
foreach (KeyValuePair<ulong, RegionInfo> RegionPair in this.Grid)
|
||||||
{
|
{
|
||||||
//check Region is inside the requested area
|
//check Region is inside the requested area
|
||||||
RegionInfo Region=RegionPair.Value;
|
RegionInfo Region = RegionPair.Value;
|
||||||
if(((Region.X>MinX) && (Region.X<MaxX)) && ((Region.Y>MinY) && (Region.Y<MaxY)))
|
if(((Region.X > minX) && (Region.X < maxX)) && ((Region.Y > minY) && (Region.Y < maxY)))
|
||||||
{
|
{
|
||||||
MapBlockReplyPacket MapReply=new MapBlockReplyPacket();
|
MapBlockReplyPacket MapReply = new MapBlockReplyPacket();
|
||||||
MapReply.AgentData.AgentID=UserInfo.AgentID;
|
MapReply.AgentData.AgentID = userInfo.AgentID;
|
||||||
MapReply.AgentData.Flags=0;
|
MapReply.AgentData.Flags = 0;
|
||||||
MapReply.Data=new MapBlockReplyPacket.DataBlock[1];
|
MapReply.Data = new MapBlockReplyPacket.DataBlock[1];
|
||||||
MapReply.Data[0]=new MapBlockReplyPacket.DataBlock();
|
MapReply.Data[0] = new MapBlockReplyPacket.DataBlock();
|
||||||
MapReply.Data[0].MapImageID=Region.ImageID;
|
MapReply.Data[0].MapImageID = Region.ImageID;
|
||||||
MapReply.Data[0].X=Region.X;
|
MapReply.Data[0].X = Region.X;
|
||||||
MapReply.Data[0].Y=Region.Y;
|
MapReply.Data[0].Y = Region.Y;
|
||||||
MapReply.Data[0].WaterHeight=Region.WaterHeight;
|
MapReply.Data[0].WaterHeight = Region.WaterHeight;
|
||||||
MapReply.Data[0].Name=enc.GetBytes( Region.Name);
|
MapReply.Data[0].Name = _enc.GetBytes( Region.Name);
|
||||||
MapReply.Data[0].RegionFlags=72458694;
|
MapReply.Data[0].RegionFlags = 72458694;
|
||||||
MapReply.Data[0].Access=13;
|
MapReply.Data[0].Access = 13;
|
||||||
MapReply.Data[0].Agents=1;
|
MapReply.Data[0].Agents = 1;
|
||||||
server.SendPacket(MapReply,true,UserInfo);
|
_server.SendPacket(MapReply, true, userInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,35 +122,35 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UserInfo"></param>
|
/// <param name="UserInfo"></param>
|
||||||
/// <param name="Request"></param>
|
/// <param name="Request"></param>
|
||||||
public void RequestTeleport(User_Agent_info UserInfo, TeleportLocationRequestPacket Request)
|
public void RequestTeleport(UserAgentInfo userInfo, TeleportLocationRequestPacket request)
|
||||||
{
|
{
|
||||||
if(Grid.ContainsKey(Request.Info.RegionHandle))
|
if(Grid.ContainsKey(request.Info.RegionHandle))
|
||||||
{
|
{
|
||||||
RegionInfo Region=Grid[Request.Info.RegionHandle];
|
RegionInfo Region = Grid[request.Info.RegionHandle];
|
||||||
libsecondlife.Packets.TeleportStartPacket TeleportStart=new TeleportStartPacket();
|
libsecondlife.Packets.TeleportStartPacket TeleportStart = new TeleportStartPacket();
|
||||||
TeleportStart.Info.TeleportFlags=16;
|
TeleportStart.Info.TeleportFlags = 16;
|
||||||
server.SendPacket(TeleportStart,true,UserInfo);
|
_server.SendPacket(TeleportStart, true, userInfo);
|
||||||
|
|
||||||
libsecondlife.Packets.TeleportFinishPacket Teleport=new TeleportFinishPacket();
|
libsecondlife.Packets.TeleportFinishPacket Teleport = new TeleportFinishPacket();
|
||||||
Teleport.Info.AgentID=UserInfo.AgentID;
|
Teleport.Info.AgentID = userInfo.AgentID;
|
||||||
Teleport.Info.RegionHandle=Request.Info.RegionHandle;
|
Teleport.Info.RegionHandle = request.Info.RegionHandle;
|
||||||
Teleport.Info.SimAccess=13;
|
Teleport.Info.SimAccess = 13;
|
||||||
Teleport.Info.SeedCapability=new byte[0];
|
Teleport.Info.SeedCapability = new byte[0];
|
||||||
|
|
||||||
System.Net.IPAddress oIP=System.Net.IPAddress.Parse(Region.IPAddress.Address);
|
System.Net.IPAddress oIP = System.Net.IPAddress.Parse(Region.IPAddress.Address);
|
||||||
byte[] byteIP=oIP.GetAddressBytes();
|
byte[] byteIP = oIP.GetAddressBytes();
|
||||||
uint ip=(uint)byteIP[3]<<24;
|
uint ip=(uint)byteIP[3]<<24;
|
||||||
ip+=(uint)byteIP[2]<<16;
|
ip+=(uint)byteIP[2]<<16;
|
||||||
ip+=(uint)byteIP[1]<<8;
|
ip+=(uint)byteIP[1]<<8;
|
||||||
ip+=(uint)byteIP[0];
|
ip+=(uint)byteIP[0];
|
||||||
|
|
||||||
Teleport.Info.SimIP=ip;
|
Teleport.Info.SimIP = ip;
|
||||||
Teleport.Info.SimPort=Region.IPAddress.Port;
|
Teleport.Info.SimPort = Region.IPAddress.Port;
|
||||||
Teleport.Info.LocationID=4;
|
Teleport.Info.LocationID = 4;
|
||||||
Teleport.Info.TeleportFlags= 1 << 4;;
|
Teleport.Info.TeleportFlags = 1 << 4;;
|
||||||
server.SendPacket(Teleport,true,UserInfo);
|
_server.SendPacket(Teleport, true, userInfo);
|
||||||
|
|
||||||
this.AgentManager.RemoveAgent(UserInfo);
|
this._agentManager.RemoveAgent(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -162,13 +162,13 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
//should connect to a space server to see what grids there are
|
//should connect to a space server to see what grids there are
|
||||||
//but for now we read static xml files
|
//but for now we read static xml files
|
||||||
ulong CurrentHandle=0;
|
ulong CurrentHandle = 0;
|
||||||
bool Login=true;
|
bool Login = true;
|
||||||
|
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
doc.Load(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"Grid.ini" ));
|
doc.Load(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Grid.ini" ));
|
||||||
}
|
}
|
||||||
catch ( Exception e)
|
catch ( Exception e)
|
||||||
{
|
{
|
||||||
|
@ -189,102 +189,102 @@ namespace OpenSim
|
||||||
if (nodes.HasChildNodes) {
|
if (nodes.HasChildNodes) {
|
||||||
foreach( XmlNode xmlnc in nodes.ChildNodes)
|
foreach( XmlNode xmlnc in nodes.ChildNodes)
|
||||||
{
|
{
|
||||||
if(xmlnc.Name=="Region")
|
if(xmlnc.Name == "Region")
|
||||||
{
|
{
|
||||||
string xmlAttri;
|
string xmlAttri;
|
||||||
RegionInfo Region=new RegionInfo();
|
RegionInfo Region = new RegionInfo();
|
||||||
if(xmlnc.Attributes["Name"]!=null)
|
if(xmlnc.Attributes["Name"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Name")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Name")).Value;
|
||||||
Region.Name=xmlAttri+" \0";
|
Region.Name = xmlAttri+" \0";
|
||||||
}
|
}
|
||||||
if(xmlnc.Attributes["ImageID"]!=null)
|
if(xmlnc.Attributes["ImageID"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("ImageID")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("ImageID")).Value;
|
||||||
Region.ImageID=new LLUUID(xmlAttri);
|
Region.ImageID = new LLUUID(xmlAttri);
|
||||||
}
|
}
|
||||||
if(xmlnc.Attributes["IP_Address"]!=null)
|
if(xmlnc.Attributes["IP_Address"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Address")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Address")).Value;
|
||||||
Region.IPAddress.Address=xmlAttri;
|
Region.IPAddress.Address = xmlAttri;
|
||||||
}
|
}
|
||||||
if(xmlnc.Attributes["IP_Port"]!=null)
|
if(xmlnc.Attributes["IP_Port"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Port")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Port")).Value;
|
||||||
Region.IPAddress.Port=Convert.ToUInt16(xmlAttri);
|
Region.IPAddress.Port = Convert.ToUInt16(xmlAttri);
|
||||||
}
|
}
|
||||||
if(xmlnc.Attributes["Location_X"]!=null)
|
if(xmlnc.Attributes["Location_X"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_X")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_X")).Value;
|
||||||
Region.X=Convert.ToUInt16(xmlAttri);
|
Region.X = Convert.ToUInt16(xmlAttri);
|
||||||
}
|
}
|
||||||
if(xmlnc.Attributes["Location_Y"]!=null)
|
if(xmlnc.Attributes["Location_Y"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_Y")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_Y")).Value;
|
||||||
Region.Y=Convert.ToUInt16(xmlAttri);
|
Region.Y = Convert.ToUInt16(xmlAttri);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Grid.Add(Region.Handle,Region);
|
this.Grid.Add(Region.Handle, Region);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(xmlnc.Name=="CurrentRegion")
|
if(xmlnc.Name == "CurrentRegion")
|
||||||
{
|
{
|
||||||
|
|
||||||
string xmlAttri;
|
string xmlAttri;
|
||||||
uint Rx=0,Ry=0;
|
uint Rx = 0, Ry = 0;
|
||||||
if(xmlnc.Attributes["RegionHandle"]!=null)
|
if(xmlnc.Attributes["RegionHandle"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("RegionHandle")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("RegionHandle")).Value;
|
||||||
CurrentHandle=Convert.ToUInt64(xmlAttri);
|
CurrentHandle = Convert.ToUInt64(xmlAttri);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(xmlnc.Attributes["Region_X"]!=null)
|
if(xmlnc.Attributes["Region_X"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_X")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_X")).Value;
|
||||||
Rx=Convert.ToUInt32(xmlAttri);
|
Rx = Convert.ToUInt32(xmlAttri);
|
||||||
}
|
}
|
||||||
if(xmlnc.Attributes["Region_Y"]!=null)
|
if(xmlnc.Attributes["Region_Y"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_Y")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_Y")).Value;
|
||||||
Ry=Convert.ToUInt32(xmlAttri);
|
Ry = Convert.ToUInt32(xmlAttri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(xmlnc.Attributes["LoginServer"]!=null)
|
if(xmlnc.Attributes["LoginServer"] != null)
|
||||||
{
|
{
|
||||||
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("LoginServer")).Value;
|
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("LoginServer")).Value;
|
||||||
Login=Convert.ToBoolean(xmlAttri);
|
Login = Convert.ToBoolean(xmlAttri);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(CurrentHandle==0)
|
if(CurrentHandle == 0)
|
||||||
{
|
{
|
||||||
//no RegionHandle set
|
//no RegionHandle set
|
||||||
//so check for Region X and Y
|
//so check for Region X and Y
|
||||||
if((Rx >0) && (Ry>0))
|
if((Rx > 0) && (Ry > 0))
|
||||||
{
|
{
|
||||||
CurrentHandle=Helpers.UIntsToLong((Rx*256),(Ry*256));
|
CurrentHandle = Helpers.UIntsToLong((Rx*256), (Ry*256));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//seems to be no Region location set
|
//seems to be no Region location set
|
||||||
// so set default
|
// so set default
|
||||||
CurrentHandle=1096213093147648;
|
CurrentHandle = 1096213093147648;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//finished loading grid, now set Globals to current region
|
//finished loading grid, now set Globals to current region
|
||||||
if(CurrentHandle!=0)
|
if(CurrentHandle != 0)
|
||||||
{
|
{
|
||||||
if(Grid.ContainsKey(CurrentHandle))
|
if(Grid.ContainsKey(CurrentHandle))
|
||||||
{
|
{
|
||||||
RegionInfo Region=Grid[CurrentHandle];
|
RegionInfo Region = Grid[CurrentHandle];
|
||||||
Globals.Instance.RegionHandle=Region.Handle;
|
Globals.Instance.RegionHandle = Region.Handle;
|
||||||
Globals.Instance.RegionName=Region.Name;
|
Globals.Instance.RegionName = Region.Name;
|
||||||
Globals.Instance.IpPort=Region.IPAddress.Port;
|
Globals.Instance.IpPort = Region.IPAddress.Port;
|
||||||
Globals.Instance.LoginSever=Login;
|
Globals.Instance.LoginSever = Login;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,8 +317,8 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
x=value;
|
x = value;
|
||||||
Handle=Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256));
|
Handle = Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ushort Y
|
public ushort Y
|
||||||
|
@ -329,33 +329,33 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
y=value;
|
y = value;
|
||||||
Handle=Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256));
|
Handle = Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ulong Handle
|
public ulong Handle
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(handle>0)
|
if(handle > 0)
|
||||||
{
|
{
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return(Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256)));
|
return(Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
handle=value;
|
handle = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionInfo()
|
public RegionInfo()
|
||||||
{
|
{
|
||||||
this.IPAddress=new RegionIP();
|
this.IPAddress = new RegionIP();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class RegionIP
|
public class RegionIP
|
||||||
|
|
|
@ -38,20 +38,20 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class InventoryManager
|
public class InventoryManager
|
||||||
{
|
{
|
||||||
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
|
||||||
public Dictionary<LLUUID, InventoryFolder> Folders;
|
public Dictionary<LLUUID, InventoryFolder> Folders;
|
||||||
public Dictionary<LLUUID, InventoryItem> Items;
|
public Dictionary<LLUUID, InventoryItem> Items;
|
||||||
private Server server;
|
private Server _server;
|
||||||
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
private const uint FULL_MASK_PERMISSIONS = 2147483647;
|
private const uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serve"></param>
|
/// <param name="serve"></param>
|
||||||
public InventoryManager(Server serve)
|
public InventoryManager(Server server)
|
||||||
{
|
{
|
||||||
server=serve;
|
_server = server;
|
||||||
Folders=new Dictionary<LLUUID, InventoryFolder>();
|
Folders=new Dictionary<LLUUID, InventoryFolder>();
|
||||||
Items=new Dictionary<LLUUID, InventoryItem>();
|
Items=new Dictionary<LLUUID, InventoryItem>();
|
||||||
}
|
}
|
||||||
|
@ -63,23 +63,23 @@ namespace OpenSim
|
||||||
/// <param name="FolderID"></param>
|
/// <param name="FolderID"></param>
|
||||||
/// <param name="Asset"></param>
|
/// <param name="Asset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public LLUUID AddToInventory(User_Agent_info UserInfo, LLUUID FolderID,AssetBase Asset)
|
public LLUUID AddToInventory(UserAgentInfo userInfo, LLUUID folderID, AssetBase asset)
|
||||||
{
|
{
|
||||||
if(this.Folders.ContainsKey(FolderID))
|
if(this.Folders.ContainsKey(folderID))
|
||||||
{
|
{
|
||||||
LLUUID NewItemID=LLUUID.Random();
|
LLUUID NewItemID = LLUUID.Random();
|
||||||
|
|
||||||
InventoryItem Item=new InventoryItem();
|
InventoryItem Item = new InventoryItem();
|
||||||
Item.FolderID=FolderID;
|
Item.FolderID = folderID;
|
||||||
Item.OwnerID=UserInfo.AgentID;
|
Item.OwnerID = userInfo.AgentID;
|
||||||
Item.AssetID=Asset.Full_ID;
|
Item.AssetID = asset.FullID;
|
||||||
Item.ItemID=NewItemID;
|
Item.ItemID = NewItemID;
|
||||||
Item.Type=Asset.Type;
|
Item.Type = asset.Type;
|
||||||
Item.Name=Asset.Name;
|
Item.Name = asset.Name;
|
||||||
Item.Description=Asset.Description;
|
Item.Description = asset.Description;
|
||||||
Item.InvType=Asset.InvType;
|
Item.InvType = asset.InvType;
|
||||||
this.Items.Add(Item.ItemID,Item);
|
this.Items.Add(Item.ItemID, Item);
|
||||||
InventoryFolder Folder=Folders[Item.FolderID];
|
InventoryFolder Folder = Folders[Item.FolderID];
|
||||||
Folder.Items.Add(Item);
|
Folder.Items.Add(Item);
|
||||||
return(Item.ItemID);
|
return(Item.ItemID);
|
||||||
}
|
}
|
||||||
|
@ -95,12 +95,12 @@ namespace OpenSim
|
||||||
/// <param name="UserInfo"></param>
|
/// <param name="UserInfo"></param>
|
||||||
/// <param name="NewFolder"></param>
|
/// <param name="NewFolder"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool CreateNewFolder(User_Agent_info UserInfo, LLUUID NewFolder)
|
public bool CreateNewFolder(UserAgentInfo userInfo, LLUUID newFolder)
|
||||||
{
|
{
|
||||||
InventoryFolder Folder=new InventoryFolder();
|
InventoryFolder Folder = new InventoryFolder();
|
||||||
Folder.FolderID=NewFolder;
|
Folder.FolderID = newFolder;
|
||||||
Folder.OwnerID=UserInfo.AgentID;
|
Folder.OwnerID = userInfo.AgentID;
|
||||||
this.Folders.Add(Folder.FolderID,Folder);
|
this.Folders.Add(Folder.FolderID, Folder);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
@ -110,49 +110,49 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
/// <param name="FetchDescend"></param>
|
/// <param name="FetchDescend"></param>
|
||||||
public void FetchInventoryDescendents(User_Agent_info User_info,FetchInventoryDescendentsPacket FetchDescend)
|
public void FetchInventoryDescendents(UserAgentInfo userInfo, FetchInventoryDescendentsPacket FetchDescend)
|
||||||
{
|
{
|
||||||
if(FetchDescend.InventoryData.FetchItems)
|
if(FetchDescend.InventoryData.FetchItems)
|
||||||
{
|
{
|
||||||
if(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID))
|
if(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID))
|
||||||
{
|
{
|
||||||
|
|
||||||
InventoryFolder Folder=this.Folders[FetchDescend.InventoryData.FolderID];
|
InventoryFolder Folder = this.Folders[FetchDescend.InventoryData.FolderID];
|
||||||
InventoryDescendentsPacket Descend=new InventoryDescendentsPacket();
|
InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
|
||||||
Descend.AgentData.AgentID=User_info.AgentID;
|
Descend.AgentData.AgentID = userInfo.AgentID;
|
||||||
Descend.AgentData.OwnerID=Folder.OwnerID;
|
Descend.AgentData.OwnerID = Folder.OwnerID;
|
||||||
Descend.AgentData.FolderID=FetchDescend.InventoryData.FolderID;
|
Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
|
||||||
Descend.AgentData.Descendents=Folder.Items.Count;
|
Descend.AgentData.Descendents = Folder.Items.Count;
|
||||||
Descend.AgentData.Version=Folder.Items.Count;
|
Descend.AgentData.Version = Folder.Items.Count;
|
||||||
|
|
||||||
Descend.ItemData=new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
|
Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
|
||||||
for(int i=0; i<Folder.Items.Count ; i++)
|
for(int i = 0; i < Folder.Items.Count ; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
InventoryItem Item=Folder.Items[i];
|
InventoryItem Item=Folder.Items[i];
|
||||||
Descend.ItemData[i]=new InventoryDescendentsPacket.ItemDataBlock();
|
Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
|
||||||
Descend.ItemData[i].ItemID=Item.ItemID;
|
Descend.ItemData[i].ItemID = Item.ItemID;
|
||||||
Descend.ItemData[i].AssetID=Item.AssetID;
|
Descend.ItemData[i].AssetID = Item.AssetID;
|
||||||
Descend.ItemData[i].CreatorID=Item.CreatorID;
|
Descend.ItemData[i].CreatorID = Item.CreatorID;
|
||||||
Descend.ItemData[i].BaseMask=FULL_MASK_PERMISSIONS;
|
Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
|
||||||
Descend.ItemData[i].CreationDate=1000;
|
Descend.ItemData[i].CreationDate = 1000;
|
||||||
Descend.ItemData[i].Description=enc.GetBytes(Item.Description+"\0");
|
Descend.ItemData[i].Description = _enc.GetBytes(Item.Description+"\0");
|
||||||
Descend.ItemData[i].EveryoneMask=FULL_MASK_PERMISSIONS;
|
Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
|
||||||
Descend.ItemData[i].Flags=1;
|
Descend.ItemData[i].Flags = 1;
|
||||||
Descend.ItemData[i].FolderID=Item.FolderID;
|
Descend.ItemData[i].FolderID = Item.FolderID;
|
||||||
Descend.ItemData[i].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
|
Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
Descend.ItemData[i].GroupMask=FULL_MASK_PERMISSIONS;
|
Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
|
||||||
Descend.ItemData[i].InvType=Item.InvType;
|
Descend.ItemData[i].InvType = Item.InvType;
|
||||||
Descend.ItemData[i].Name=enc.GetBytes(Item.Name+"\0");
|
Descend.ItemData[i].Name = _enc.GetBytes(Item.Name+"\0");
|
||||||
Descend.ItemData[i].NextOwnerMask=FULL_MASK_PERMISSIONS;
|
Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
Descend.ItemData[i].OwnerID=Item.OwnerID;
|
Descend.ItemData[i].OwnerID = Item.OwnerID;
|
||||||
Descend.ItemData[i].OwnerMask=FULL_MASK_PERMISSIONS;
|
Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
Descend.ItemData[i].SalePrice=100;
|
Descend.ItemData[i].SalePrice = 100;
|
||||||
Descend.ItemData[i].SaleType=0;
|
Descend.ItemData[i].SaleType = 0;
|
||||||
Descend.ItemData[i].Type=Item.Type;
|
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);
|
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);
|
_server.SendPacket(Descend, true, userInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,40 +166,40 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
public void FetchInventory(User_Agent_info User_info, FetchInventoryPacket FetchItems)
|
public void FetchInventory(UserAgentInfo userInfo, FetchInventoryPacket FetchItems)
|
||||||
{
|
{
|
||||||
|
|
||||||
for(int i=0; i<FetchItems.InventoryData.Length; i++)
|
for(int i = 0; i < FetchItems.InventoryData.Length; i++)
|
||||||
{
|
{
|
||||||
if(this.Items.ContainsKey(FetchItems.InventoryData[i].ItemID))
|
if(this.Items.ContainsKey(FetchItems.InventoryData[i].ItemID))
|
||||||
{
|
{
|
||||||
|
|
||||||
InventoryItem Item=Items[FetchItems.InventoryData[i].ItemID];
|
InventoryItem Item = Items[FetchItems.InventoryData[i].ItemID];
|
||||||
FetchInventoryReplyPacket InventoryReply=new FetchInventoryReplyPacket();
|
FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
|
||||||
InventoryReply.AgentData.AgentID=User_info.AgentID;
|
InventoryReply.AgentData.AgentID = userInfo.AgentID;
|
||||||
InventoryReply.InventoryData=new FetchInventoryReplyPacket.InventoryDataBlock[1];
|
InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
|
||||||
InventoryReply.InventoryData[0]=new FetchInventoryReplyPacket.InventoryDataBlock();
|
InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
|
||||||
InventoryReply.InventoryData[0].ItemID=Item.ItemID;
|
InventoryReply.InventoryData[0].ItemID = Item.ItemID;
|
||||||
InventoryReply.InventoryData[0].AssetID=Item.AssetID;
|
InventoryReply.InventoryData[0].AssetID = Item.AssetID;
|
||||||
InventoryReply.InventoryData[0].CreatorID=Item.CreatorID;
|
InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
|
||||||
InventoryReply.InventoryData[0].BaseMask=FULL_MASK_PERMISSIONS;
|
InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
|
||||||
InventoryReply.InventoryData[0].CreationDate=1000;
|
InventoryReply.InventoryData[0].CreationDate = 1000;
|
||||||
InventoryReply.InventoryData[0].Description=enc.GetBytes( Item.Description+"\0");
|
InventoryReply.InventoryData[0].Description = _enc.GetBytes( Item.Description+"\0");
|
||||||
InventoryReply.InventoryData[0].EveryoneMask=FULL_MASK_PERMISSIONS;
|
InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
|
||||||
InventoryReply.InventoryData[0].Flags=1;
|
InventoryReply.InventoryData[0].Flags = 1;
|
||||||
InventoryReply.InventoryData[0].FolderID=Item.FolderID;
|
InventoryReply.InventoryData[0].FolderID = Item.FolderID;
|
||||||
InventoryReply.InventoryData[0].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
|
InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
InventoryReply.InventoryData[0].GroupMask=FULL_MASK_PERMISSIONS;
|
InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
|
||||||
InventoryReply.InventoryData[0].InvType=Item.InvType;
|
InventoryReply.InventoryData[0].InvType = Item.InvType;
|
||||||
InventoryReply.InventoryData[0].Name=enc.GetBytes(Item.Name+"\0");
|
InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name+"\0");
|
||||||
InventoryReply.InventoryData[0].NextOwnerMask=FULL_MASK_PERMISSIONS;
|
InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
InventoryReply.InventoryData[0].OwnerID=Item.OwnerID;
|
InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
|
||||||
InventoryReply.InventoryData[0].OwnerMask=FULL_MASK_PERMISSIONS;
|
InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
|
||||||
InventoryReply.InventoryData[0].SalePrice=100;
|
InventoryReply.InventoryData[0].SalePrice = 100;
|
||||||
InventoryReply.InventoryData[0].SaleType=0;
|
InventoryReply.InventoryData[0].SaleType = 0;
|
||||||
InventoryReply.InventoryData[0].Type=Item.Type;
|
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);
|
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);
|
_server.SendPacket(InventoryReply, true, userInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ namespace OpenSim
|
||||||
|
|
||||||
public InventoryFolder()
|
public InventoryFolder()
|
||||||
{
|
{
|
||||||
Items=new List<InventoryItem>();
|
Items = new List<InventoryItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ namespace OpenSim
|
||||||
public LLUUID OwnerID;
|
public LLUUID OwnerID;
|
||||||
public LLUUID ItemID;
|
public LLUUID ItemID;
|
||||||
public LLUUID AssetID;
|
public LLUUID AssetID;
|
||||||
public LLUUID CreatorID=LLUUID.Zero;
|
public LLUUID CreatorID = LLUUID.Zero;
|
||||||
public sbyte InvType;
|
public sbyte InvType;
|
||||||
public sbyte Type;
|
public sbyte Type;
|
||||||
public string Name;
|
public string Name;
|
||||||
|
|
|
@ -116,7 +116,8 @@ namespace OpenSim
|
||||||
int contentLength = 0;
|
int contentLength = 0;
|
||||||
|
|
||||||
// read HTTP header
|
// read HTTP header
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
// read one line of the header
|
// read one line of the header
|
||||||
line = reader.ReadLine();
|
line = reader.ReadLine();
|
||||||
|
|
||||||
|
@ -145,72 +146,72 @@ namespace OpenSim
|
||||||
//get login name
|
//get login name
|
||||||
if(requestData.Contains("first"))
|
if(requestData.Contains("first"))
|
||||||
{
|
{
|
||||||
first=(string)requestData["first"];
|
first = (string)requestData["first"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
first="test";
|
first = "test";
|
||||||
}
|
}
|
||||||
if(requestData.Contains("last"))
|
if(requestData.Contains("last"))
|
||||||
{
|
{
|
||||||
last=(string)requestData["last"];
|
last = (string)requestData["last"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
last="User"+NumClients.ToString();
|
last = "User"+NumClients.ToString();
|
||||||
}
|
}
|
||||||
NumClients++;
|
NumClients++;
|
||||||
|
|
||||||
//create a agent and session LLUUID
|
//create a agent and session LLUUID
|
||||||
int AgentRand=this.RandomClass.Next(1,9999);
|
int AgentRand = this.RandomClass.Next(1,9999);
|
||||||
Agent=new LLUUID("99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead");
|
Agent = new LLUUID("99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead");
|
||||||
int SessionRand=this.RandomClass.Next(1,999);
|
int SessionRand = this.RandomClass.Next(1,999);
|
||||||
Session=new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
|
Session = new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
|
||||||
|
|
||||||
|
|
||||||
StreamReader SR;
|
StreamReader SR;
|
||||||
string ResponseString="";
|
string ResponseString = "";
|
||||||
string lines;
|
string lines;
|
||||||
SR=File.OpenText("new-login.dat");
|
SR=File.OpenText("new-login.dat");
|
||||||
|
|
||||||
lines=SR.ReadLine();
|
lines=SR.ReadLine();
|
||||||
|
|
||||||
while(lines!="end-mfile")
|
while(lines != "end-mfile")
|
||||||
{
|
{
|
||||||
|
|
||||||
ResponseString+=lines;
|
ResponseString += lines;
|
||||||
lines=SR.ReadLine();
|
lines = SR.ReadLine();
|
||||||
}
|
}
|
||||||
SR.Close();
|
SR.Close();
|
||||||
|
|
||||||
XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString);
|
XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString);
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
Hashtable responseData = (Hashtable)response.Value;
|
||||||
|
|
||||||
responseData["agent_id"]=Agent.ToStringHyphenated();
|
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||||
responseData["session_id"]=Session.ToStringHyphenated();
|
responseData["session_id"] = Session.ToStringHyphenated();
|
||||||
ArrayList InventoryList=(ArrayList) responseData["inventory-skeleton"];
|
ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"];
|
||||||
Hashtable Inventory1=(Hashtable)InventoryList[0];
|
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||||
Hashtable Inventory2=(Hashtable)InventoryList[1];
|
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||||
LLUUID BaseFolderID=LLUUID.Random();
|
LLUUID BaseFolderID = LLUUID.Random();
|
||||||
LLUUID InventoryFolderID=LLUUID.Random();
|
LLUUID InventoryFolderID = LLUUID.Random();
|
||||||
Inventory2["name"]="Base";
|
Inventory2["name"] = "Base";
|
||||||
Inventory2["folder_id"]=BaseFolderID.ToStringHyphenated();
|
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||||
Inventory1["folder_id"]=InventoryFolderID.ToStringHyphenated();
|
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||||
|
|
||||||
ArrayList InventoryRoot=(ArrayList) responseData["inventory-root"];
|
ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"];
|
||||||
Hashtable Inventoryroot=(Hashtable)InventoryRoot[0];
|
Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
|
||||||
Inventoryroot["folder_id"]=InventoryFolderID.ToStringHyphenated();
|
Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||||
|
|
||||||
|
|
||||||
//copy data to login object
|
//copy data to login object
|
||||||
lock(Login)
|
lock(Login)
|
||||||
{
|
{
|
||||||
Login.first=first;
|
Login.First = first;
|
||||||
Login.last=last;
|
Login.Last = last;
|
||||||
Login.Agent=Agent;
|
Login.Agent = Agent;
|
||||||
Login.Session=Session;
|
Login.Session = Session;
|
||||||
Login.BaseFolder=BaseFolderID;
|
Login.BaseFolder = BaseFolderID;
|
||||||
Login.InventoryFolder=InventoryFolderID;
|
Login.InventoryFolder = InventoryFolderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// forward the XML-RPC response to the client
|
// forward the XML-RPC response to the client
|
||||||
|
|
236
Prim_manager.cs
236
Prim_manager.cs
|
@ -40,11 +40,10 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PrimManager
|
public class PrimManager
|
||||||
{
|
{
|
||||||
private Server server;
|
private Server _server;
|
||||||
public AgentManager Agent_Manager;
|
private uint _primCount;
|
||||||
|
|
||||||
private uint prim_count;
|
|
||||||
|
|
||||||
|
public AgentManager AgentManagement;
|
||||||
public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock PrimTemplate;
|
public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock PrimTemplate;
|
||||||
public Dictionary<libsecondlife.LLUUID,PrimInfo> PrimList;
|
public Dictionary<libsecondlife.LLUUID,PrimInfo> PrimList;
|
||||||
|
|
||||||
|
@ -52,10 +51,10 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serve"></param>
|
/// <param name="serve"></param>
|
||||||
public PrimManager(Server serve)
|
public PrimManager(Server server)
|
||||||
{
|
{
|
||||||
server=serve;
|
_server = server;
|
||||||
PrimList=new Dictionary<libsecondlife.LLUUID,PrimInfo> ();
|
PrimList = new Dictionary<libsecondlife.LLUUID,PrimInfo> ();
|
||||||
this.SetupTemplates("objectupate164.dat");
|
this.SetupTemplates("objectupate164.dat");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -66,58 +65,59 @@ namespace OpenSim
|
||||||
/// <param name="User_info"></param>
|
/// <param name="User_info"></param>
|
||||||
/// <param name="p1"></param>
|
/// <param name="p1"></param>
|
||||||
/// <param name="add_pack"></param>
|
/// <param name="add_pack"></param>
|
||||||
public void CreatePrim(User_Agent_info User_info, libsecondlife.LLVector3 p1, ObjectAddPacket add_pack)
|
public void CreatePrim(UserAgentInfo userInfo, libsecondlife.LLVector3 pos1, ObjectAddPacket addPacket)
|
||||||
{
|
{
|
||||||
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
objupdate.RegionData.TimeDilation=64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
|
||||||
PrimData PData=new PrimData();
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
objupdate.ObjectData[0]=this.PrimTemplate;
|
PrimData PData = new PrimData();
|
||||||
PData.OwnerID=objupdate.ObjectData[0].OwnerID=User_info.AgentID;
|
objupdate.ObjectData[0] = this.PrimTemplate;
|
||||||
PData.PCode=objupdate.ObjectData[0].PCode=add_pack.ObjectData.PCode;
|
PData.OwnerID=objupdate.ObjectData[0].OwnerID = userInfo.AgentID;
|
||||||
PData.PathBegin=objupdate.ObjectData[0].PathBegin=add_pack.ObjectData.PathBegin;
|
PData.PCode=objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
|
||||||
PData.PathEnd=objupdate.ObjectData[0].PathEnd=add_pack.ObjectData.PathEnd;
|
PData.PathBegin=objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
|
||||||
PData.PathScaleX=objupdate.ObjectData[0].PathScaleX=add_pack.ObjectData.PathScaleX;
|
PData.PathEnd=objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
|
||||||
PData.PathScaleY=objupdate.ObjectData[0].PathScaleY=add_pack.ObjectData.PathScaleY;
|
PData.PathScaleX=objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
|
||||||
PData.PathShearX=objupdate.ObjectData[0].PathShearX=add_pack.ObjectData.PathShearX;
|
PData.PathScaleY=objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
|
||||||
PData.PathShearY=objupdate.ObjectData[0].PathShearY=add_pack.ObjectData.PathShearY;
|
PData.PathShearX=objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
|
||||||
PData.PathSkew=objupdate.ObjectData[0].PathSkew=add_pack.ObjectData.PathSkew;
|
PData.PathShearY=objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
|
||||||
PData.ProfileBegin=objupdate.ObjectData[0].ProfileBegin=add_pack.ObjectData.ProfileBegin;
|
PData.PathSkew=objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
|
||||||
PData.ProfileEnd=objupdate.ObjectData[0].ProfileEnd=add_pack.ObjectData.ProfileEnd;
|
PData.ProfileBegin=objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
|
||||||
PData.Scale=objupdate.ObjectData[0].Scale=add_pack.ObjectData.Scale;//new LLVector3(1,1,1);
|
PData.ProfileEnd=objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
|
||||||
PData.PathCurve=objupdate.ObjectData[0].PathCurve=add_pack.ObjectData.PathCurve;
|
PData.Scale=objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
|
||||||
PData.ProfileCurve=objupdate.ObjectData[0].ProfileCurve=add_pack.ObjectData.ProfileCurve;
|
PData.PathCurve=objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
|
||||||
PData.ParentID=objupdate.ObjectData[0].ParentID=0;
|
PData.ProfileCurve=objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
|
||||||
PData.ProfileHollow=objupdate.ObjectData[0].ProfileHollow=add_pack.ObjectData.ProfileHollow;
|
PData.ParentID=objupdate.ObjectData[0].ParentID = 0;
|
||||||
|
PData.ProfileHollow=objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
|
||||||
//finish off copying rest of shape data
|
//finish off copying rest of shape data
|
||||||
|
|
||||||
objupdate.ObjectData[0].ID=(uint)(702000+prim_count);
|
objupdate.ObjectData[0].ID = (uint)(702000 + _primCount);
|
||||||
objupdate.ObjectData[0].FullID=new LLUUID("edba7151-5857-acc5-b30b-f01efefda"+prim_count.ToString("000"));
|
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda"+_primCount.ToString("000"));
|
||||||
|
|
||||||
//update position
|
//update position
|
||||||
byte[] pb=p1.GetBytes();
|
byte[] pb = pos1.GetBytes();
|
||||||
Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,0,pb.Length);
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
|
||||||
|
|
||||||
prim_count++;
|
_primCount++;
|
||||||
server.SendPacket(objupdate,true,User_info);
|
_server.SendPacket(objupdate, true, userInfo);
|
||||||
|
|
||||||
//should send to all users
|
//should send to all users
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in Agent_Manager.AgentList)
|
foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in AgentManagement.AgentList)
|
||||||
{
|
{
|
||||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
if(kp.Value.NetInfo.AgentID != userInfo.AgentID)
|
||||||
{
|
{
|
||||||
server.SendPacket(objupdate,true,kp.Value.NetInfo);
|
_server.SendPacket(objupdate, true, kp.Value.NetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//should store this infomation
|
//should store this infomation
|
||||||
PrimInfo NewPrim=new PrimInfo();
|
PrimInfo NewPrim = new PrimInfo();
|
||||||
NewPrim.FullID=objupdate.ObjectData[0].FullID;
|
NewPrim.FullID = objupdate.ObjectData[0].FullID;
|
||||||
NewPrim.LocalID=objupdate.ObjectData[0].ID;
|
NewPrim.LocalID = objupdate.ObjectData[0].ID;
|
||||||
NewPrim.Position=p1;
|
NewPrim.Position = pos1;
|
||||||
NewPrim.data=PData;
|
NewPrim.Data = PData;
|
||||||
|
|
||||||
this.PrimList.Add(NewPrim.FullID,NewPrim);
|
this.PrimList.Add(NewPrim.FullID, NewPrim);
|
||||||
|
|
||||||
//store rest of data
|
//store rest of data
|
||||||
|
|
||||||
|
@ -131,62 +131,62 @@ namespace OpenSim
|
||||||
/// <param name="LocalID"></param>
|
/// <param name="LocalID"></param>
|
||||||
/// <param name="setRotation"></param>
|
/// <param name="setRotation"></param>
|
||||||
/// <param name="rotation"></param>
|
/// <param name="rotation"></param>
|
||||||
public void UpdatePrimPosition(User_Agent_info User,LLVector3 position,uint LocalID,bool setRotation, LLQuaternion rotation)
|
public void UpdatePrimPosition(UserAgentInfo userInfo, LLVector3 position, uint localID, bool setRotation, LLQuaternion rotation)
|
||||||
{
|
{
|
||||||
PrimInfo pri=null;
|
PrimInfo pri = null;
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,PrimInfo> kp in this.PrimList)
|
foreach (KeyValuePair<libsecondlife.LLUUID,PrimInfo> kp in this.PrimList)
|
||||||
{
|
{
|
||||||
if(kp.Value.LocalID==LocalID)
|
if(kp.Value.LocalID == localID)
|
||||||
{
|
{
|
||||||
pri=kp.Value;
|
pri = kp.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(pri==null)
|
if(pri == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint ID=pri.LocalID;
|
uint ID = pri.LocalID;
|
||||||
libsecondlife.LLVector3 pos2=new LLVector3(position.X,position.Y,position.Z);
|
libsecondlife.LLVector3 pos2 = new LLVector3(position.X, position.Y, position.Z);
|
||||||
libsecondlife.LLQuaternion rotation2;
|
libsecondlife.LLQuaternion rotation2;
|
||||||
if(!setRotation)
|
if(!setRotation)
|
||||||
{
|
{
|
||||||
pri.Position=pos2;
|
pri.Position = pos2;
|
||||||
rotation2=new LLQuaternion(pri.Rotation.X,pri.Rotation.Y,pri.Rotation.Z,pri.Rotation.W);
|
rotation2 = new LLQuaternion(pri.Rotation.X, pri.Rotation.Y, pri.Rotation.Z, pri.Rotation.W);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rotation2=new LLQuaternion(rotation.X,rotation.Y,rotation.Z,rotation.W);
|
rotation2=new LLQuaternion(rotation.X, rotation.Y, rotation.Z, rotation.W);
|
||||||
pos2=pri.Position;
|
pos2 = pri.Position;
|
||||||
pri.Rotation=rotation;
|
pri.Rotation = rotation;
|
||||||
}
|
}
|
||||||
rotation2.W+=1;
|
rotation2.W += 1;
|
||||||
rotation2.X+=1;
|
rotation2.X += 1;
|
||||||
rotation2.Y+=1;
|
rotation2.Y += 1;
|
||||||
rotation2.Z+=1;
|
rotation2.Z += 1;
|
||||||
|
|
||||||
byte[] bytes=new byte[60];
|
byte[] bytes = new byte[60];
|
||||||
|
|
||||||
ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket();
|
ImprovedTerseObjectUpdatePacket im = new ImprovedTerseObjectUpdatePacket();
|
||||||
im.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
im.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
im.RegionData.TimeDilation=64096;
|
im.RegionData.TimeDilation = 64096;
|
||||||
im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
im.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
int i=0;
|
int i = 0;
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
||||||
im.ObjectData[0]=dat;
|
im.ObjectData[0] = dat;
|
||||||
dat.TextureEntry=PrimTemplate.TextureEntry;
|
dat.TextureEntry = PrimTemplate.TextureEntry;
|
||||||
|
|
||||||
bytes[i++] = (byte)(ID % 256);
|
bytes[i++] = (byte)(ID % 256);
|
||||||
bytes[i++] = (byte)((ID >> 8) % 256);
|
bytes[i++] = (byte)((ID >> 8) % 256);
|
||||||
bytes[i++] = (byte)((ID >> 16) % 256);
|
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||||
bytes[i++]=0;
|
bytes[i++]= 0;
|
||||||
bytes[i++]=0;//1;
|
bytes[i++]= 0;
|
||||||
|
|
||||||
byte[] pb=pos2.GetBytes();
|
byte[] pb = pos2.GetBytes();
|
||||||
pri.Position=pos2;
|
pri.Position = pos2;
|
||||||
Array.Copy(pb,0,bytes,i,pb.Length);
|
Array.Copy(pb, 0, bytes, i, pb.Length);
|
||||||
i+=12;
|
i += 12;
|
||||||
ushort ac=32767;
|
ushort ac = 32767;
|
||||||
|
|
||||||
//vel
|
//vel
|
||||||
bytes[i++] = (byte)(ac % 256);
|
bytes[i++] = (byte)(ac % 256);
|
||||||
|
@ -205,10 +205,10 @@ namespace OpenSim
|
||||||
bytes[i++] = (byte)((ac >> 8) % 256);
|
bytes[i++] = (byte)((ac >> 8) % 256);
|
||||||
|
|
||||||
ushort rw, rx,ry,rz;
|
ushort rw, rx,ry,rz;
|
||||||
rw=(ushort)(32768*rotation2.W);
|
rw = (ushort)(32768 * rotation2.W);
|
||||||
rx=(ushort)(32768*rotation2.X);
|
rx = (ushort)(32768 * rotation2.X);
|
||||||
ry=(ushort)(32768*rotation2.Y);
|
ry = (ushort)(32768 * rotation2.Y);
|
||||||
rz=(ushort)(32768*rotation2.Z);
|
rz = (ushort)(32768 * rotation2.Z);
|
||||||
|
|
||||||
//rot
|
//rot
|
||||||
bytes[i++] = (byte)(rx % 256);
|
bytes[i++] = (byte)(rx % 256);
|
||||||
|
@ -230,11 +230,11 @@ namespace OpenSim
|
||||||
|
|
||||||
dat.Data=bytes;
|
dat.Data=bytes;
|
||||||
|
|
||||||
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in Agent_Manager.AgentList)
|
foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in AgentManagement.AgentList)
|
||||||
{
|
{
|
||||||
if(kp.Value.NetInfo.AgentID!=User.AgentID)
|
if(kp.Value.NetInfo.AgentID!=userInfo.AgentID)
|
||||||
{
|
{
|
||||||
server.SendPacket(im,true,kp.Value.NetInfo);
|
_server.SendPacket(im, true, kp.Value.NetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ namespace OpenSim
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
public void SendExistingPrims(User_Agent_info user)
|
public void SendExistingPrims(UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
//send data for already created prims to a new joining user
|
//send data for already created prims to a new joining user
|
||||||
}
|
}
|
||||||
|
@ -254,12 +254,12 @@ namespace OpenSim
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
public void SetupTemplates(string name)
|
public void SetupTemplates(string name)
|
||||||
{
|
{
|
||||||
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
objupdate.RegionData.TimeDilation=64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
int i=0;
|
int i = 0;
|
||||||
FileInfo fInfo = new FileInfo(name);
|
FileInfo fInfo = new FileInfo(name);
|
||||||
long numBytes = fInfo.Length;
|
long numBytes = fInfo.Length;
|
||||||
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
||||||
|
@ -268,18 +268,18 @@ namespace OpenSim
|
||||||
br.Close();
|
br.Close();
|
||||||
fStream.Close();
|
fStream.Close();
|
||||||
|
|
||||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
||||||
objupdate.ObjectData[0]=objdata;
|
objupdate.ObjectData[0] = objdata;
|
||||||
this.PrimTemplate=objdata;
|
this.PrimTemplate = objdata;
|
||||||
objdata.UpdateFlags=objdata.UpdateFlags+12-16+32+256;
|
objdata.UpdateFlags = objdata.UpdateFlags + 12 - 16 + 32 + 256;
|
||||||
objdata.OwnerID=new LLUUID("00000000-0000-0000-0000-000000000000");
|
objdata.OwnerID = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
//test adding a new texture to object , to test image downloading
|
//test adding a new texture to object , to test image downloading
|
||||||
LLObject.TextureEntry te=new LLObject.TextureEntry(objdata.TextureEntry,0,objdata.TextureEntry.Length);
|
LLObject.TextureEntry te = new LLObject.TextureEntry(objdata.TextureEntry, 0, objdata.TextureEntry.Length);
|
||||||
te.DefaultTexture.TextureID=new LLUUID("00000000-0000-0000-5005-000000000005");
|
te.DefaultTexture.TextureID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||||
|
|
||||||
LLObject.TextureEntry ntex=new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
||||||
|
|
||||||
objdata.TextureEntry=ntex.ToBytes();
|
objdata.TextureEntry = ntex.ToBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -287,34 +287,34 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
public void ReadPrimDatabase(string name,User_Agent_info user)
|
public void ReadPrimDatabase(string name, UserAgentInfo userInfo)
|
||||||
{
|
{
|
||||||
StreamReader SR;
|
StreamReader SR;
|
||||||
string line;
|
string line;
|
||||||
SR=File.OpenText(name);
|
SR=File.OpenText(name);
|
||||||
string [] comp= new string[10];
|
string [] comp = new string[10];
|
||||||
string delimStr = " , ";
|
string delimStr = " , ";
|
||||||
char [] delimiter = delimStr.ToCharArray();
|
char [] delimiter = delimStr.ToCharArray();
|
||||||
|
|
||||||
line=SR.ReadLine();
|
line=SR.ReadLine();
|
||||||
while(line!="end")
|
while(line != "end")
|
||||||
{
|
{
|
||||||
comp=line.Split(delimiter);
|
comp = line.Split(delimiter);
|
||||||
if(comp[0]=="ObjPack")
|
if(comp[0] == "ObjPack")
|
||||||
{
|
{
|
||||||
int num=Convert.ToInt32(comp[2]);
|
int num = Convert.ToInt32(comp[2]);
|
||||||
int start=Convert.ToInt32(comp[1]);
|
int start = Convert.ToInt32(comp[1]);
|
||||||
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
|
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
|
||||||
objupdate.RegionData.TimeDilation=64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num];
|
||||||
|
|
||||||
// int count=0;
|
// int count=0;
|
||||||
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\";
|
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\";
|
||||||
for(int cc=0; cc<num; cc++)
|
for(int cc = 0; cc < num; cc++)
|
||||||
{
|
{
|
||||||
string filenam=data_path+@"prim_updates"+start+".dat";
|
string filenam = data_path+@"prim_updates"+start+".dat";
|
||||||
int i=0;
|
int i = 0;
|
||||||
//FileInfo fInfo = new FileInfo("objectupate"+start+".dat");
|
//FileInfo fInfo = new FileInfo("objectupate"+start+".dat");
|
||||||
FileInfo fInfo = new FileInfo(filenam);
|
FileInfo fInfo = new FileInfo(filenam);
|
||||||
long numBytes = fInfo.Length;
|
long numBytes = fInfo.Length;
|
||||||
|
@ -325,12 +325,12 @@ namespace OpenSim
|
||||||
br.Close();
|
br.Close();
|
||||||
fStream.Close();
|
fStream.Close();
|
||||||
|
|
||||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
|
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
|
||||||
objupdate.ObjectData[cc]=objdata;
|
objupdate.ObjectData[cc] = objdata;
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
server.SendPacket(objupdate,true,user);
|
_server.SendPacket(objupdate, true, userInfo);
|
||||||
line=SR.ReadLine();
|
line = SR.ReadLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SR.Close();
|
SR.Close();
|
||||||
|
@ -344,7 +344,7 @@ namespace OpenSim
|
||||||
public LLQuaternion Rotation=LLQuaternion.Identity;
|
public LLQuaternion Rotation=LLQuaternion.Identity;
|
||||||
public uint LocalID;
|
public uint LocalID;
|
||||||
public LLUUID FullID;
|
public LLUUID FullID;
|
||||||
public PrimData data;
|
public PrimData Data;
|
||||||
|
|
||||||
public PrimInfo()
|
public PrimInfo()
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,11 +78,11 @@ namespace OpenSim
|
||||||
|
|
||||||
#region Lua Functions
|
#region Lua Functions
|
||||||
|
|
||||||
public void ScriptRegister( script_object_interface script)
|
public void ScriptRegister(script_object_interface script)
|
||||||
{
|
{
|
||||||
//called by scripts to register themselves
|
//called by scripts to register themselves
|
||||||
}
|
}
|
||||||
public void MoveObject(float x ,float y, float z)
|
public void MoveObject(float x , float y, float z)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# SharpDevelop 2.1.0.2017
|
# SharpDevelop 2.1.0.2017
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libsecondlife", "..\..\libsecondlife\libsecondlife-cs\libsecondlife.csproj", "{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|.NET 1.1 = Debug|.NET 1.1
|
Debug|.NET 1.1 = Debug|.NET 1.1
|
||||||
|
|
24
Server.cs
24
Server.cs
|
@ -45,8 +45,8 @@ namespace OpenSim
|
||||||
public interface ServerCallback
|
public interface ServerCallback
|
||||||
{
|
{
|
||||||
//should replace with delegates
|
//should replace with delegates
|
||||||
void MainCallback(Packet pack, User_Agent_info User_info);
|
void MainCallback(Packet pack, UserAgentInfo User_info);
|
||||||
void NewUserCallback(User_Agent_info User_info);
|
void NewUserCallback(UserAgentInfo User_info);
|
||||||
void ErrorCallback(string text);
|
void ErrorCallback(string text);
|
||||||
}
|
}
|
||||||
public class Server
|
public class Server
|
||||||
|
@ -197,7 +197,7 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packet">Packet to be sent</param>
|
/// <param name="packet">Packet to be sent</param>
|
||||||
/// <param name="incrementSequence">Increment sequence number?</param>
|
/// <param name="incrementSequence">Increment sequence number?</param>
|
||||||
public void SendPacket(Packet packet, bool incrementSequence, User_Agent_info User_info)
|
public void SendPacket(Packet packet, bool incrementSequence, UserAgentInfo User_info)
|
||||||
{
|
{
|
||||||
byte[] buffer;
|
byte[] buffer;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
@ -324,7 +324,7 @@ namespace OpenSim
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends out pending acknowledgements
|
/// Sends out pending acknowledgements
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendAcks(User_Agent_info User_info)
|
private void SendAcks(UserAgentInfo User_info)
|
||||||
{
|
{
|
||||||
lock (User_info.PendingAcks)
|
lock (User_info.PendingAcks)
|
||||||
{
|
{
|
||||||
|
@ -358,7 +358,7 @@ namespace OpenSim
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resend unacknowledged packets
|
/// Resend unacknowledged packets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ResendUnacked(User_Agent_info User_info)
|
private void ResendUnacked(UserAgentInfo User_info)
|
||||||
{
|
{
|
||||||
if (connected)
|
if (connected)
|
||||||
{
|
{
|
||||||
|
@ -397,7 +397,7 @@ namespace OpenSim
|
||||||
|
|
||||||
// Update the disconnect flag so this sim doesn't time out
|
// Update the disconnect flag so this sim doesn't time out
|
||||||
DisconnectCandidate = false;
|
DisconnectCandidate = false;
|
||||||
User_Agent_info User_info=null;
|
UserAgentInfo User_info=null;
|
||||||
|
|
||||||
lock (RecvBuffer)
|
lock (RecvBuffer)
|
||||||
{
|
{
|
||||||
|
@ -416,7 +416,7 @@ namespace OpenSim
|
||||||
if (packet.Type == PacketType.UseCircuitCode)
|
if (packet.Type == PacketType.UseCircuitCode)
|
||||||
{
|
{
|
||||||
UseCircuitCodePacket cir_pack=(UseCircuitCodePacket)packet;
|
UseCircuitCodePacket cir_pack=(UseCircuitCodePacket)packet;
|
||||||
User_Agent_info new_user=new User_Agent_info();
|
UserAgentInfo new_user=new UserAgentInfo();
|
||||||
new_user.circuitCode=cir_pack.CircuitCode.Code;
|
new_user.circuitCode=cir_pack.CircuitCode.Code;
|
||||||
new_user.AgentID=cir_pack.CircuitCode.ID;
|
new_user.AgentID=cir_pack.CircuitCode.ID;
|
||||||
new_user.SessionID=cir_pack.CircuitCode.SessionID;
|
new_user.SessionID=cir_pack.CircuitCode.SessionID;
|
||||||
|
@ -429,13 +429,13 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
User_Agent_info temp_agent=null;
|
UserAgentInfo temp_agent=null;
|
||||||
IPEndPoint send_ip=(IPEndPoint)epSender;
|
IPEndPoint send_ip=(IPEndPoint)epSender;
|
||||||
// this.callback_object.error("incoming: address is "+send_ip.Address +"port number is: "+send_ip.Port.ToString());
|
// this.callback_object.error("incoming: address is "+send_ip.Address +"port number is: "+send_ip.Port.ToString());
|
||||||
|
|
||||||
for(int ii=0; ii<this.User_agents.Count ; ii++)
|
for(int ii=0; ii<this.User_agents.Count ; ii++)
|
||||||
{
|
{
|
||||||
temp_agent=(User_Agent_info)this.User_agents[ii];
|
temp_agent=(UserAgentInfo)this.User_agents[ii];
|
||||||
IPEndPoint ag_ip=(IPEndPoint)temp_agent.endpoint;
|
IPEndPoint ag_ip=(IPEndPoint)temp_agent.endpoint;
|
||||||
//this.callback_object.error("searching: address is "+ag_ip.Address +"port number is: "+ag_ip.Port.ToString());
|
//this.callback_object.error("searching: address is "+ag_ip.Address +"port number is: "+ag_ip.Port.ToString());
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ namespace OpenSim
|
||||||
//TODO for each user_agent_info
|
//TODO for each user_agent_info
|
||||||
for(int i=0; i<this.User_agents.Count; i++)
|
for(int i=0; i<this.User_agents.Count; i++)
|
||||||
{
|
{
|
||||||
User_Agent_info user=(User_Agent_info)this.User_agents[i];
|
UserAgentInfo user=(UserAgentInfo)this.User_agents[i];
|
||||||
|
|
||||||
SendAcks(user);
|
SendAcks(user);
|
||||||
ResendUnacked(user);
|
ResendUnacked(user);
|
||||||
|
@ -619,7 +619,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class User_Agent_info
|
public class UserAgentInfo
|
||||||
{
|
{
|
||||||
public EndPoint endpoint;
|
public EndPoint endpoint;
|
||||||
public LLUUID AgentID;
|
public LLUUID AgentID;
|
||||||
|
@ -636,7 +636,7 @@ namespace OpenSim
|
||||||
// ACKs that are queued up to be sent to the simulator
|
// ACKs that are queued up to be sent to the simulator
|
||||||
public Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
|
public Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
|
||||||
|
|
||||||
public User_Agent_info()
|
public UserAgentInfo()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue