brokenplugins
MW 2007-02-04 11:36:35 +00:00
parent dc2316de9c
commit 8c80d98252
11 changed files with 865 additions and 887 deletions

View File

@ -41,23 +41,23 @@ namespace OpenSim
{
public Dictionary<libsecondlife.LLUUID,AvatarData> AgentList;
private uint local_numer=0;
private Server server;
private uint _localNumber=0;
private Server _server;
public PrimManager Prim_Manager;
public AssetManagement Asset_Manager;
public AssetManagement assetManager;
private libsecondlife.Packets.RegionHandshakePacket RegionPacket;
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
/// <summary>
///
/// </summary>
/// <param name="serve"></param>
public AgentManager(Server serve)
public AgentManager(Server server)
{
AgentList=new Dictionary<libsecondlife.LLUUID,AvatarData>();
server=serve;
AgentList = new Dictionary<libsecondlife.LLUUID,AvatarData>();
_server = server;
this.initialise();
}
@ -74,8 +74,8 @@ namespace OpenSim
}
else
{
AvatarData ad=this.AgentList[id];
return ad;
AvatarData avatar = this.AgentList[id];
return avatar;
}
}
/// <summary>
@ -84,7 +84,7 @@ namespace OpenSim
/// <param name="agent"></param>
public void AddAgent(AvatarData agent)
{
this.AgentList.Add(agent.FullID,agent);
this.AgentList.Add(agent.FullID, agent);
}
/// <summary>
///
@ -102,20 +102,20 @@ namespace OpenSim
/// <param name="first"></param>
/// <param name="last"></param>
/// <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();
agent.FullID=User_info.AgentID;
agent.NetInfo=User_info;
agent.NetInfo.first_name=first;
agent.NetInfo.last_name=last;
agent.Position=new LLVector3(100,100,22);
agent.BaseFolder=BaseFolder;
agent.InventoryFolder=InventoryFolder;
this.AgentList.Add(agent.FullID,agent);
AvatarData agent = new AvatarData();
agent.FullID = userInfo.AgentID;
agent.NetInfo = userInfo;
agent.NetInfo.first_name =first;
agent.NetInfo.last_name = last;
agent.Position = new LLVector3(100, 100, 22);
agent.BaseFolder = baseFolder;
agent.InventoryFolder = inventoryFolder;
this.AgentList.Add(agent.FullID, agent);
//Create new Wearable Assets and place in Inventory
this.Asset_Manager.CreateNewInventorySet(ref agent,User_info);
this.assetManager.CreateNewInventorySet(ref agent, userInfo);
return(true);
}
@ -124,9 +124,9 @@ namespace OpenSim
///
/// </summary>
/// <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
}
@ -135,20 +135,20 @@ namespace OpenSim
///
/// </summary>
/// <param name="User_info"></param>
public void AgentJoin(User_Agent_info User_info)
public void AgentJoin(UserAgentInfo userInfo)
{
//send region data
server.SendPacket(RegionPacket,true,User_info);
_server.SendPacket(RegionPacket,true, userInfo);
//inform client of join comlete
libsecondlife.Packets.AgentMovementCompletePacket mov=new AgentMovementCompletePacket();
mov.AgentData.SessionID=User_info.SessionID;
mov.AgentData.AgentID=User_info.AgentID;
mov.Data.RegionHandle=Globals.Instance.RegionHandle;
mov.Data.Timestamp=1169838966;
mov.Data.Position=new LLVector3(100f,100f,22f);
mov.Data.LookAt=new LLVector3(0.99f,0.042f,0);
server.SendPacket(mov,true,User_info);
libsecondlife.Packets.AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.AgentData.SessionID = userInfo.SessionID;
mov.AgentData.AgentID = userInfo.AgentID;
mov.Data.RegionHandle = Globals.Instance.RegionHandle;
mov.Data.Timestamp = 1169838966;
mov.Data.Position = new LLVector3(100f, 100f, 22f);
mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
_server.SendPacket(mov, true, userInfo);
}
/// <summary>
@ -157,12 +157,12 @@ namespace OpenSim
public void UpdatePositions()
{
//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.Y+=(kp.Value.Velocity.Y*0.2f);
kp.Value.Position.Z+=(kp.Value.Velocity.Z*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.Z += (kp.Value.Velocity.Z * 0.2f);
}
}
@ -172,31 +172,31 @@ namespace OpenSim
private void initialise()
{
//Region data
RegionPacket=new RegionHandshakePacket();
RegionPacket.RegionInfo.BillableFactor=0;
RegionPacket.RegionInfo.IsEstateManager=false;
RegionPacket.RegionInfo.TerrainHeightRange00=60;
RegionPacket.RegionInfo.TerrainHeightRange01=60;
RegionPacket.RegionInfo.TerrainHeightRange10=60;
RegionPacket.RegionInfo.TerrainHeightRange11=60;
RegionPacket.RegionInfo.TerrainStartHeight00=20;
RegionPacket.RegionInfo.TerrainStartHeight01=20;
RegionPacket.RegionInfo.TerrainStartHeight10=20;
RegionPacket.RegionInfo.TerrainStartHeight11=20;
RegionPacket.RegionInfo.SimAccess=13;
RegionPacket.RegionInfo.WaterHeight=5;
RegionPacket.RegionInfo.RegionFlags=72458694;
RegionPacket.RegionInfo.SimName=enc.GetBytes( Globals.Instance.RegionName);
RegionPacket.RegionInfo.SimOwner=new LLUUID("00000000-0000-0000-0000-000000000000");
RegionPacket.RegionInfo.TerrainBase0=new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
RegionPacket.RegionInfo.TerrainBase1=new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
RegionPacket.RegionInfo.TerrainBase2=new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
RegionPacket.RegionInfo.TerrainBase3=new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
RegionPacket.RegionInfo.TerrainDetail0=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.TerrainDetail3=new LLUUID("00000000-0000-0000-0000-000000000000");
RegionPacket.RegionInfo.CacheID=new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
RegionPacket = new RegionHandshakePacket();
RegionPacket.RegionInfo.BillableFactor = 0;
RegionPacket.RegionInfo.IsEstateManager = false;
RegionPacket.RegionInfo.TerrainHeightRange00 = 60;
RegionPacket.RegionInfo.TerrainHeightRange01 = 60;
RegionPacket.RegionInfo.TerrainHeightRange10 = 60;
RegionPacket.RegionInfo.TerrainHeightRange11 = 60;
RegionPacket.RegionInfo.TerrainStartHeight00 = 20;
RegionPacket.RegionInfo.TerrainStartHeight01 = 20;
RegionPacket.RegionInfo.TerrainStartHeight10 = 20;
RegionPacket.RegionInfo.TerrainStartHeight11 = 20;
RegionPacket.RegionInfo.SimAccess = 13;
RegionPacket.RegionInfo.WaterHeight = 5;
RegionPacket.RegionInfo.RegionFlags = 72458694;
RegionPacket.RegionInfo.SimName = _enc.GetBytes( Globals.Instance.RegionName);
RegionPacket.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
RegionPacket.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
RegionPacket.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
RegionPacket.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
RegionPacket.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
RegionPacket.RegionInfo.TerrainDetail0 = 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.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
RegionPacket.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
this.SetupTemplate("objectupate168.dat");
}
@ -208,7 +208,7 @@ namespace OpenSim
private void SetupTemplate(string name)
{
int i=0;
int i = 0;
FileInfo fInfo = new FileInfo(name);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
@ -217,19 +217,19 @@ namespace OpenSim
br.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;
libsecondlife.LLVector3 pos=new LLVector3(objdata.ObjectData, 16);
pos.X=100f;
objdata.ID=8880000;
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 pos = new LLVector3(objdata.ObjectData, 16);
pos.X = 100f;
objdata.ID = 8880000;
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);
//objdata.FullID=user.AgentID;
byte[] pb=pos.GetBytes();
Array.Copy(pb,0,objdata.ObjectData,16,pb.Length);
byte[] pb = pos.GetBytes();
Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
AvatarTemplate=objdata;
AvatarTemplate = objdata;
}
@ -237,52 +237,52 @@ namespace OpenSim
///
/// </summary>
/// <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
string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\layer_data\";
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\layer_data\";
//send layerdata
LayerDataPacket layerpack=new LayerDataPacket();
layerpack.LayerID.Type=76;
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata0.dat");
LayerDataPacket layerpack = new LayerDataPacket();
layerpack.LayerID.Type = 76;
this.SendLayerData(userInfo,ref layerpack, data_path+@"layerdata0.dat");
LayerDataPacket layerpack1=new LayerDataPacket();
layerpack1.LayerID.Type=76;
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata1.dat");
LayerDataPacket layerpack1 = new LayerDataPacket();
layerpack1.LayerID.Type = 76;
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata1.dat");
LayerDataPacket layerpack2=new LayerDataPacket();
layerpack2.LayerID.Type=56;
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata2.dat");
LayerDataPacket layerpack2 = new LayerDataPacket();
layerpack2.LayerID.Type = 56;
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata2.dat");
LayerDataPacket layerpack3=new LayerDataPacket();
layerpack3.LayerID.Type=55;
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata3.dat");
LayerDataPacket layerpack3 = new LayerDataPacket();
layerpack3.LayerID.Type = 55;
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata3.dat");
LayerDataPacket layerpack4=new LayerDataPacket();
layerpack4.LayerID.Type=56;
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata4.dat");
LayerDataPacket layerpack4 = new LayerDataPacket();
layerpack4.LayerID.Type = 56;
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata4.dat");
LayerDataPacket layerpack5=new LayerDataPacket();
layerpack5.LayerID.Type=55;
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata5.dat");
LayerDataPacket layerpack5 = new LayerDataPacket();
layerpack5.LayerID.Type = 55;
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata5.dat");
//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
//prim_man.send_existing_prims(User_info);
//send update about clients avatar
this.SendInitialAvatarPosition(User_info);
this.SendInitialAvatarPosition(userInfo);
//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>
/// <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
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation=64096;
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation = 64096;
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
objupdate.ObjectData[0].ID=8880000+this.local_numer;
User_info.localID=objupdate.ObjectData[0].ID;
objupdate.ObjectData[0].ID = 8880000 + this._localNumber;
userInfo.localID = objupdate.ObjectData[0].ID;
//User_info.name="Test"+this.local_numer+" User";
this.GetAgent(User_info.AgentID).Started=true;
objupdate.ObjectData[0].FullID=User_info.AgentID;
objupdate.ObjectData[0].NameValue=enc.GetBytes("FirstName STRING RW SV "+User_info.first_name+"\nLastName STRING RW SV "+User_info.last_name+" \0");
User_info.name="FirstName STRING RW SV "+User_info.first_name+"\nLastName STRING RW SV "+User_info.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);
this.GetAgent(userInfo.AgentID).Started = true;
objupdate.ObjectData[0].FullID = userInfo.AgentID;
objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0");
userInfo.name = "FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0";
byte[] pb=pos2.GetBytes();
libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,16,pb.Length);
this.local_numer++;
byte[] pb = pos2.GetBytes();
server.SendPacket(objupdate,true,User_info);
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
this._localNumber++;
_server.SendPacket(objupdate, true, userInfo);
//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);
this.SendOtherAppearance(kp.Value.NetInfo,objupdate.ObjectData[0].FullID);
_server.SendPacket(objupdate, true, kp.Value.NetInfo);
this.SendOtherAppearance(kp.Value.NetInfo, objupdate.ObjectData[0].FullID);
}
}
@ -335,38 +334,38 @@ namespace OpenSim
///
/// </summary>
/// <param name="user"></param>
public void SendIntialAvatarAppearance(User_Agent_info user)
public void SendIntialAvatarAppearance(UserAgentInfo userInfo)
{
AvatarData Agent=this.AgentList[user.AgentID];
AgentWearablesUpdatePacket aw=new AgentWearablesUpdatePacket();
aw.AgentData.AgentID=user.AgentID;
aw.AgentData.SerialNum=0;
aw.AgentData.SessionID=user.SessionID;
AvatarData Agent = this.AgentList[userInfo.AgentID];
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
aw.AgentData.AgentID = userInfo.AgentID;
aw.AgentData.SerialNum = 0;
aw.AgentData.SessionID = userInfo.SessionID;
aw.WearableData= new AgentWearablesUpdatePacket.WearableDataBlock[13];
AgentWearablesUpdatePacket.WearableDataBlock awb=null;
awb=new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType=(byte)0;
awb.AssetID=Agent.Wearables[0].AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
awb.ItemID=Agent.Wearables[0].ItemID;//new LLUUID("b7878441893b094917f791174bc8401c");
aw.WearableData[0]=awb;
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
AgentWearablesUpdatePacket.WearableDataBlock awb = null;
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType = (byte)0;
awb.AssetID = Agent.Wearables[0].AssetID;
awb.ItemID = Agent.Wearables[0].ItemID;
aw.WearableData[0] = awb;
awb=new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType=(byte)1;
awb.AssetID=Agent.Wearables[1].AssetID;//new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
awb.ItemID=Agent.Wearables[1].ItemID;//new LLUUID("193f0876fc11d143797454352f9c9c26");
aw.WearableData[1]=awb;
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType =(byte)1;
awb.AssetID = Agent.Wearables[1].AssetID;
awb.ItemID = Agent.Wearables[1].ItemID;
aw.WearableData[1] = awb;
for(int i=2; i<13; i++)
{
awb=new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType=(byte)i;
awb.AssetID=new LLUUID("00000000-0000-0000-0000-000000000000");
awb.ItemID=new LLUUID("00000000-0000-0000-0000-000000000000");
aw.WearableData[i]=awb;
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType = (byte)i;
awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
aw.WearableData[i] = awb;
}
server.SendPacket(aw,true,user);
_server.SendPacket(aw, true, userInfo);
}
/// <summary>
@ -374,34 +373,33 @@ namespace OpenSim
/// </summary>
/// <param name="user"></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);
FileInfo fInfo = new FileInfo("Avatar_texture3.dat");
long numBytes = fInfo.Length;
FileStream fStream = new FileStream("Avatar_texture3.dat", FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);
avp.ObjectData.TextureEntry= br.ReadBytes((int)numBytes);
avp.ObjectData.TextureEntry = br.ReadBytes((int)numBytes);
br.Close();
fStream.Close();
AvatarAppearancePacket.VisualParamBlock avblock=null;
for(int i=0; i<218; i++)
AvatarAppearancePacket.VisualParamBlock avblock = null;
for(int i = 0; i < 218; i++)
{
avblock=new AvatarAppearancePacket.VisualParamBlock();
avblock.ParamValue=(byte)100;
avp.VisualParam[i]=avblock;
avblock = new AvatarAppearancePacket.VisualParamBlock();
avblock.ParamValue = (byte)100;
avp.VisualParam[i] = avblock;
}
avp.Sender.IsTrial=false;
avp.Sender.ID=id;
server.SendPacket(avp,true,user);
avp.Sender.IsTrial = false;
avp.Sender.ID = id;
_server.SendPacket(avp, true, userInfo);
}
@ -410,29 +408,27 @@ namespace OpenSim
/// </summary>
/// <param name="User_info"></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
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation=64500;
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation = 64500;
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
objupdate.ObjectData[0].ID=avd.NetInfo.localID;
objupdate.ObjectData[0].FullID=avd.NetInfo.AgentID;//new LLUUID("00000000-0000-0000-5665-000000000034");
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");
libsecondlife.LLVector3 pos2=new LLVector3(avd.Position.X,avd.Position.Y,avd.Position.Z);
objupdate.ObjectData[0].ID = avatar.NetInfo.localID;
objupdate.ObjectData[0].FullID = avatar.NetInfo.AgentID;
objupdate.ObjectData[0].NameValue = _enc.GetBytes(avatar.NetInfo.name);
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);
this._localNumber++;
Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,16,pb.Length);
this.local_numer++;
server.SendPacket(objupdate,true,User_info);
this.SendOtherAppearance(User_info,avd.NetInfo.AgentID);//new LLUUID("00000000-0000-0000-5665-000000000034"));
_server.SendPacket(objupdate, true, userInfo);
this.SendOtherAppearance(userInfo, avatar.NetInfo.AgentID);
}
@ -441,26 +437,26 @@ namespace OpenSim
/// </summary>
/// <param name="User_info"></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();
reply.ChatData.Audible=1;
reply.ChatData.Message=enc.GetBytes(line);
reply.ChatData.ChatType=1;
reply.ChatData.SourceType=1;
reply.ChatData.Position=new LLVector3(120,100,21); //should set to actual position
reply.ChatData.FromName=enc.GetBytes(User_info.first_name +" "+User_info.last_name +"\0"); //enc.GetBytes("Echo: \0"); //and actual name
reply.ChatData.OwnerID=User_info.AgentID;
reply.ChatData.SourceID=User_info.AgentID;
libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
reply.ChatData.Audible = 1;
reply.ChatData.Message = _enc.GetBytes(line);
reply.ChatData.ChatType = 1;
reply.ChatData.SourceType = 1;
reply.ChatData.Position = new LLVector3(120, 100, 21); //should set to actual position
reply.ChatData.FromName = _enc.GetBytes(userInfo.first_name + " " + userInfo.last_name + "\0");
reply.ChatData.OwnerID = userInfo.AgentID;
reply.ChatData.SourceID = userInfo.AgentID;
//echo to sender
server.SendPacket(reply,true,User_info);
_server.SendPacket(reply, true, userInfo);
//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="av_id"></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;
//ID=av_id;
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];
Console.WriteLine("sending move");
uint ID = userInfo.localID;
byte[] bytes = new byte[60];
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;
libsecondlife.LLVector3 pos2=new LLVector3(x,y,z);
im.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
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 >> 8) % 256);
bytes[i++] = (byte)((ID >> 16) % 256);
bytes[i++] = (byte)((ID >> 24) % 256);
bytes[i++]=0;
bytes[i++]=1;
bytes[i++] = 0;
bytes[i++] = 1;
i+=14;
bytes[i++]=128;
bytes[i++]=63;
byte[] pb=pos2.GetBytes();
i += 14;
bytes[i++] = 128;
bytes[i++] = 63;
byte[] pb = pos2.GetBytes();
Array.Copy(pb,0,bytes,i,pb.Length);
i+=12;
ushort ac=32767;
Axiom.MathLib.Vector3 v3=new Axiom.MathLib.Vector3(1,0,0);
Axiom.MathLib.Quaternion q=new Axiom.MathLib.Quaternion(body.W,body.X,body.Y,body.Z);
Axiom.MathLib.Vector3 direc=q*v3;
Array.Copy(pb, 0, bytes, i, pb.Length);
i += 12;
ushort ac = 32767;
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(body.W, body.X, body.Y, body.Z);
Axiom.MathLib.Vector3 direc = q * v3;
direc.Normalize();
direc=direc*(0.03f);
direc.x+=1;
direc.y+=1;
direc.z+=1;
ushort dx,dy,dz;
dx=(ushort)(32768*direc.x);
dy=(ushort)(32768*direc.y);
dz=(ushort)(32768*direc.z);
direc = direc * (0.03f);
direc.x += 1;
direc.y += 1;
direc.z += 1;
ushort dx, dy, dz;
dx = (ushort)(32768 * direc.x);
dy = (ushort)(32768 * direc.y);
dz = (ushort)(32768 * direc.z);
//vel
if(!stop)
@ -582,14 +578,14 @@ namespace OpenSim
dat.Data=bytes;
server.SendPacket(im,true,user);
_server.SendPacket(im, true, userInfo);
//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="lay"></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);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);
byte [] data1 = br.ReadBytes((int)numBytes);
br.Close();
fStream.Close();
lay.LayerData.Data=data1;
server.SendPacket(lay,true,User_info);
//System.Console.WriteLine("sent");
layer.LayerData.Data = data1;
_server.SendPacket(layer, true, userInfo);
}
}
public class AvatarData
{
public User_Agent_info NetInfo;
public UserAgentInfo NetInfo;
public LLUUID FullID;
public LLVector3 Position;
public LLVector3 Velocity=new LLVector3(0,0,0);
public LLVector3 Velocity = new LLVector3(0,0,0);
//public LLQuaternion Rotation;
public bool Walk=false;
public bool Started=false;
public bool Walk = false;
public bool Started = false;
//public TextureEntry TextureEntry;
public AvatarWearable[] Wearables;
public LLUUID InventoryFolder;
@ -638,9 +628,9 @@ namespace OpenSim
public AvatarData()
{
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();
}
}
}

View File

@ -44,22 +44,23 @@ namespace OpenSim
public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets;
public Dictionary<libsecondlife.LLUUID,TextureImage> Textures;
public ArrayList AssetRequests=new ArrayList(); //should change to a generic
public ArrayList TextureRequests=new ArrayList();
// public ArrayList uploads=new ArrayList();
private Server server;
public InventoryManager InventoryManager;
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
public ArrayList AssetRequests = new ArrayList(); //should change to a generic
public ArrayList TextureRequests = new ArrayList();
//public ArrayList uploads=new ArrayList();
private Server _server;
private InventoryManager _inventoryManager;
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
/// <summary>
///
/// </summary>
/// <param name="server"></param>
public AssetManagement(Server server)
/// <param name="_server"></param>
public AssetManagement(Server server, InventoryManager inventoryManager)
{
this.server=server;
Textures=new Dictionary<libsecondlife.LLUUID,TextureImage> ();
Assets=new Dictionary<libsecondlife.LLUUID,AssetInfo> ();
this._server = server;
this._inventoryManager = inventoryManager;
Textures = new Dictionary<libsecondlife.LLUUID,TextureImage> ();
Assets = new Dictionary<libsecondlife.LLUUID,AssetInfo> ();
this.initialise();
}
@ -69,38 +70,38 @@ namespace OpenSim
private void initialise()
{
//Shape and skin base assets
AssetInfo Asset=new AssetInfo();
Asset.filename="base_shape.dat";
Asset.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
AssetInfo Asset = new AssetInfo();
Asset.filename = "base_shape.dat";
Asset.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
this.LoadAsset(Asset, false);
this.Assets.Add(Asset.Full_ID, Asset);
this.Assets.Add(Asset.FullID, Asset);
Asset=new AssetInfo();
Asset.filename="base_skin.dat";
Asset.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
Asset = new AssetInfo();
Asset.filename = "base_skin.dat";
Asset.FullID = new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
this.LoadAsset(Asset, false);
this.Assets.Add(Asset.Full_ID, Asset);
this.Assets.Add(Asset.FullID, Asset);
//our test images
//Change these filenames to images you want to use.
TextureImage Image=new TextureImage();
Image.filename="testpic2.jp2";
Image.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005");
Image.Name="test Texture";
TextureImage Image = new TextureImage();
Image.filename = "testpic2.jp2";
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
Image.Name = "test Texture";
this.LoadAsset(Image, true);
this.Textures.Add(Image.Full_ID, Image);
this.Textures.Add(Image.FullID, Image);
Image=new TextureImage();
Image.filename="map_base.jp2";
Image.Full_ID=new LLUUID("00000000-0000-0000-7007-000000000006");
Image = new TextureImage();
Image.filename = "map_base.jp2";
Image.FullID = new LLUUID("00000000-0000-0000-7007-000000000006");
this.LoadAsset(Image, true);
this.Textures.Add(Image.Full_ID, Image);
this.Textures.Add(Image.FullID, Image);
Image=new TextureImage();
Image.filename="map1.jp2";
Image.Full_ID=new LLUUID("00000000-0000-0000-7009-000000000008");
Image = new TextureImage();
Image.filename = "map1.jp2";
Image.FullID = new LLUUID("00000000-0000-0000-7009-000000000008");
this.LoadAsset(Image, true);
this.Textures.Add(Image.Full_ID, Image);
this.Textures.Add(Image.FullID, Image);
}
/// <summary>
@ -111,101 +112,101 @@ namespace OpenSim
/// <param name="TransferRequest"></param>
#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
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
TransferInfoPacket Transfer=new TransferInfoPacket();
Transfer.TransferInfo.ChannelType=2;
Transfer.TransferInfo.Status=0;
Transfer.TransferInfo.TargetType=0;
Transfer.TransferInfo.Params=TransferRequest.TransferInfo.Params;
Transfer.TransferInfo.Size=info.data.Length;
Transfer.TransferInfo.TransferID=TransferRequest.TransferInfo.TransferID;
TransferInfoPacket Transfer = new TransferInfoPacket();
Transfer.TransferInfo.ChannelType = 2;
Transfer.TransferInfo.Status = 0;
Transfer.TransferInfo.TargetType = 0;
Transfer.TransferInfo.Params = transferRequest.TransferInfo.Params;
Transfer.TransferInfo.Size = info.data.Length;
Transfer.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
server.SendPacket(Transfer, true, UserInfo);
_server.SendPacket(Transfer, true, userInfo);
TransferPacketPacket TransferPacket=new TransferPacketPacket();
TransferPacket.TransferData.Packet=0;
TransferPacket.TransferData.ChannelType=2;
TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
TransferPacketPacket TransferPacket = new TransferPacketPacket();
TransferPacket.TransferData.Packet = 0;
TransferPacket.TransferData.ChannelType = 2;
TransferPacket.TransferData.TransferID=transferRequest.TransferInfo.TransferID;
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);
TransferPacket.TransferData.Data=chunk;
TransferPacket.TransferData.Status=0;
server.SendPacket(TransferPacket,true,UserInfo);
TransferPacket.TransferData.Data = chunk;
TransferPacket.TransferData.Status = 0;
_server.SendPacket(TransferPacket,true,userInfo);
TransferPacket=new TransferPacketPacket();
TransferPacket.TransferData.Packet=1;
TransferPacket.TransferData.ChannelType=2;
TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
byte[] chunk1=new byte[(info.data.Length-1000)];
TransferPacket = new TransferPacketPacket();
TransferPacket.TransferData.Packet = 1;
TransferPacket.TransferData.ChannelType = 2;
TransferPacket.TransferData.TransferID = transferRequest.TransferInfo.TransferID;
byte[] chunk1 = new byte[(info.data.Length-1000)];
Array.Copy(info.data, 1000, chunk1, 0, chunk1.Length);
TransferPacket.TransferData.Data=chunk1;
TransferPacket.TransferData.Status=1;
server.SendPacket(TransferPacket, true, UserInfo);
TransferPacket.TransferData.Data = chunk1;
TransferPacket.TransferData.Status = 1;
_server.SendPacket(TransferPacket, true, userInfo);
}
else
{
TransferPacket.TransferData.Status=1; //last packet? so set to 1
TransferPacket.TransferData.Data=info.data;
server.SendPacket(TransferPacket, true, UserInfo);
TransferPacket.TransferData.Status = 1; //last packet? so set to 1
TransferPacket.TransferData.Data = info.data;
_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
LLUUID BaseFolder=Avata.BaseFolder;
InventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder);
InventoryManager.CreateNewFolder(UserInfo, BaseFolder);
LLUUID BaseFolder = Avata.BaseFolder;
_inventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder);
_inventoryManager.CreateNewFolder(UserInfo, BaseFolder);
//Give a copy of default shape
AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")];
AssetInfo Shape=this.CloneAsset(UserInfo.AgentID, Base);
AssetInfo Base = this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")];
AssetInfo Shape = this.CloneAsset(UserInfo.AgentID, Base);
Shape.filename="";
Shape.Name="Default Shape";
Shape.Description="Default Shape";
Shape.InvType=18;
Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
Shape.filename = "";
Shape.Name = "Default Shape";
Shape.Description = "Default Shape";
Shape.InvType = 18;
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);
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].AssetID=Shape.Full_ID;
Avata.Wearables[0].ItemID = _inventoryManager.AddToInventory(UserInfo, BaseFolder, Shape);
Avata.Wearables[0].AssetID = Shape.FullID;
//Give copy of default skin
Base=this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")];
Base = this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")];
AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base);
Skin.filename="";
Skin.Name="Default Skin";
Skin.Description="Default Skin";
Skin.InvType=18;
Skin.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
Skin.filename = "";
Skin.Name = "Default Skin";
Skin.Description = "Default Skin";
Skin.InvType = 18;
Skin.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
Array.Copy(Agentid,0,Skin.data,238,Agentid.Length);
this.Assets.Add(Skin.Full_ID, Skin);
this.Assets.Add(Skin.FullID, Skin);
Avata.Wearables[1].ItemID=InventoryManager.AddToInventory(UserInfo, BaseFolder, Skin);
Avata.Wearables[1].AssetID=Skin.Full_ID;
Avata.Wearables[1].ItemID = _inventoryManager.AddToInventory(UserInfo, BaseFolder, Skin);
Avata.Wearables[1].AssetID = Skin.FullID;
//give a copy of test texture
TextureImage Texture=this.CloneImage(UserInfo.AgentID,Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]);
this.Textures.Add(Texture.Full_ID, Texture);
InventoryManager.AddToInventory(UserInfo, BaseFolder, Texture);
TextureImage Texture = this.CloneImage(UserInfo.AgentID, Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]);
this.Textures.Add(Texture.FullID, Texture);
_inventoryManager.AddToInventory(UserInfo, BaseFolder, Texture);
}
@ -217,116 +218,116 @@ namespace OpenSim
string folder;
if(Image)
{
folder=@"\textures\";
folder = @"\textures\";
}
else
{
folder=@"\assets\";
folder = @"\assets\";
}
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);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
byte[] idata=new byte[numBytes];
byte[] idata = new byte[numBytes];
BinaryReader br = new BinaryReader(fStream);
idata= br.ReadBytes((int)numBytes);
br.Close();
fStream.Close();
info.data=idata;
info.data = idata;
//info.loaded=true;
}
public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset)
{
AssetInfo NewAsset=new AssetInfo();
NewAsset.data=new byte[SourceAsset.data.Length];
Array.Copy(SourceAsset.data,NewAsset.data,SourceAsset.data.Length);
NewAsset.Full_ID=LLUUID.Random();
NewAsset.Type=SourceAsset.Type;
NewAsset.InvType=SourceAsset.InvType;
AssetInfo NewAsset = new AssetInfo();
NewAsset.data = new byte[SourceAsset.data.Length];
Array.Copy(SourceAsset.data, NewAsset.data, SourceAsset.data.Length);
NewAsset.FullID = LLUUID.Random();
NewAsset.Type = SourceAsset.Type;
NewAsset.InvType = SourceAsset.InvType;
return(NewAsset);
}
#endregion
#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
ImageNotInDatabasePacket im_not=new ImageNotInDatabasePacket();
im_not.ImageID.ID=image_id;
server.SendPacket(im_not, true, user);
ImageNotInDatabasePacket im_not = new ImageNotInDatabasePacket();
im_not.ImageID.ID=imageID;
_server.SendPacket(im_not, true, userInfo);
return;
}
TextureImage imag=this.Textures[image_id];
TextureRequest req=new TextureRequest();
req.RequestUser=user;
req.RequestImage=image_id;
req.image_info=imag;
TextureImage imag = this.Textures[imageID];
TextureRequest req = new TextureRequest();
req.RequestUser = userInfo;
req.RequestImage = imageID;
req.image_info = imag;
if(imag.data.LongLength>1000) //should be bigger or smaller?
{
//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++;
}
else
{
req.num_packets=1;
req.num_packets = 1;
}
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)
{
if(this.TextureRequests.Count==0)
if(this.TextureRequests.Count == 0)
{
//no requests waiting
return;
}
int num;
//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
num=this.TextureRequests.Count;
num = this.TextureRequests.Count;
}
else
{
num=5;
}
TextureRequest req;
for(int i=0; i<num; i++)
for(int i = 0; i < num; 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
if(req.num_packets==1)
if(req.num_packets == 1)
{
//only one packet so send whole file
ImageDataPacket im=new ImageDataPacket();
im.ImageID.Packets=1;
im.ImageID.ID=req.image_info.Full_ID;
im.ImageID.Size=(uint)req.image_info.data.Length;
im.ImageData.Data=req.image_info.data;
im.ImageID.Codec=2;
server.SendPacket(im,true,req.RequestUser);
ImageDataPacket im = new ImageDataPacket();
im.ImageID.Packets = 1;
im.ImageID.ID = req.image_info.FullID;
im.ImageID.Size = (uint)req.image_info.data.Length;
im.ImageData.Data = req.image_info.data;
im.ImageID.Codec = 2;
_server.SendPacket(im, true, req.RequestUser);
req.packet_counter++;
req.image_info.last_used=time;
System.Console.WriteLine("sent texture: "+req.image_info.Full_ID);
req.image_info.last_used = time;
System.Console.WriteLine("sent texture: "+req.image_info.FullID);
}
else
{
@ -341,10 +342,10 @@ namespace OpenSim
}
//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];
if(req.packet_counter==req.num_packets)
if(req.packet_counter == req.num_packets)
{
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();
NewImage.data=new byte[Source.data.Length];
Array.Copy(Source.data,NewImage.data,Source.data.Length);
NewImage.filename=Source.filename;
NewImage.Full_ID=LLUUID.Random();
NewImage.Name=Source.Name;
return(NewImage);
TextureImage newImage = new TextureImage();
newImage.data = new byte[source.data.Length];
Array.Copy(source.data,newImage.data,source.data.Length);
newImage.filename = source.filename;
newImage.FullID = LLUUID.Random();
newImage.Name = source.Name;
return(newImage);
}
#endregion
@ -372,12 +373,12 @@ namespace OpenSim
public class AssetRequest
{
public User_Agent_info RequestUser;
public UserAgentInfo RequestUser;
public LLUUID RequestImage;
public AssetInfo asset_inf;
public long data_pointer=0;
public int num_packets=0;
public int packet_counter=0;
public long data_pointer = 0;
public int num_packets = 0;
public int packet_counter = 0;
public AssetRequest()
{
@ -401,7 +402,7 @@ namespace OpenSim
public class AssetBase
{
public byte[] data;
public LLUUID Full_ID;
public LLUUID FullID;
public sbyte Type;
public sbyte InvType;
public string Name;
@ -415,12 +416,12 @@ namespace OpenSim
}
public class TextureRequest
{
public User_Agent_info RequestUser;
public UserAgentInfo RequestUser;
public LLUUID RequestImage;
public TextureImage image_info;
public long data_pointer=0;
public int num_packets=0;
public int packet_counter=0;
public long data_pointer = 0;
public int num_packets = 0;
public int packet_counter = 0;
public TextureRequest()
{

View File

@ -43,47 +43,46 @@ namespace OpenSim
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class Controller : ServerCallback {
public partial class Controller : ServerCallback
{
[STAThread]
public static void Main( string[] args ) {
public static void Main( string[] args )
{
Controller c = new Controller();
while( true ) // fuckin' a
System.Threading.Thread.Sleep( 1000 );
}
public Server server;
public Logon _login;
private AgentManager Agent_Manager;
private PrimManager Prim_Manager;
private AssetManagement Asset_Manager;
private GridManager Grid_Manager;
private InventoryManager Inventory_Manager;
private LoginManager Login_Manager; //built in login server
private Server _server;
private Logon _login;
private AgentManager _agentManager;
private PrimManager _primManager;
private AssetManagement _assetManager;
private GridManager _gridManager;
private InventoryManager _inventoryManager;
private LoginManager _loginManager; //built in login server
private ulong time; //ticks
private Timer timer1 = new Timer();
public Controller() {
_login=new Logon(); // should create a list for these.
server = new Server( this );
Agent_Manager = new AgentManager( this.server );
Prim_Manager = new PrimManager( this.server );
Asset_Manager = new AssetManagement( this.server );
Prim_Manager.Agent_Manager = Agent_Manager;
Agent_Manager.Prim_Manager = Prim_Manager;
Agent_Manager.Asset_Manager=Asset_Manager;
Inventory_Manager=new InventoryManager(this.server);
Asset_Manager.InventoryManager=Inventory_Manager;
Grid_Manager=new GridManager(this.server,Agent_Manager);
_login = new Logon(); // should create a list for these.
_server = new Server( this );
_agentManager = new AgentManager( this._server );
_primManager = new PrimManager( this._server );
_inventoryManager = new InventoryManager(this._server);
_assetManager = new AssetManagement(this._server, _inventoryManager );
_primManager.AgentManagement = _agentManager;
_agentManager.Prim_Manager = _primManager;
_agentManager.assetManager = _assetManager;
_gridManager = new GridManager(this._server, _agentManager);
if(Globals.Instance.LoginSever)
{
Console.WriteLine("Starting login Server");
Login_Manager = new LoginManager(_login); // startup
Login_Manager.Startup(); // login server
_loginManager = new LoginManager(_login); // startup
_loginManager.Startup(); // login server
}
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 ) ) {
//Log packet?
// System.Console.WriteLine(pack.Type);
//this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type;
//System.Console.WriteLine(pack.Type);
//this.richTextBox1.Text = this.richTextBox1.Text + "\n " + pack.Type;
}*/
//should replace with a switch
if( pack.Type == PacketType.AgentSetAppearance ) {
//System.Console.WriteLine(pack);
//this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type;
}
else if( pack.Type == PacketType.FetchInventory)
{
FetchInventoryPacket FetchInventory=(FetchInventoryPacket)pack;
Inventory_Manager.FetchInventory(User_info,FetchInventory);
FetchInventoryPacket FetchInventory = (FetchInventoryPacket)pack;
_inventoryManager.FetchInventory(userInfo, FetchInventory);
}
else if( pack.Type == PacketType.FetchInventoryDescendents)
{
FetchInventoryDescendentsPacket Fetch=(FetchInventoryDescendentsPacket)pack;
Inventory_Manager.FetchInventoryDescendents(User_info,Fetch);
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)pack;
_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;
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;
this.Grid_Manager.RequestTeleport(User_info,Request);
TeleportLocationRequestPacket Request = (TeleportLocationRequestPacket)pack;
this._gridManager.RequestTeleport(userInfo,Request);
}
else if( pack.Type == PacketType.TransferRequest ) {
TransferRequestPacket tran = (TransferRequestPacket)pack;
LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 );
Asset_Manager.AddAssetRequest( User_info, id, tran );
TransferRequestPacket transfer = (TransferRequestPacket)pack;
LLUUID id = new LLUUID( transfer.TransferInfo.Params, 0 );
_assetManager.AddAssetRequest( userInfo, id, transfer );
}
else if( ( pack.Type == PacketType.StartPingCheck ) ) {
//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();
endping.PingID.PingID = startp.PingID.PingID;
server.SendPacket( endping, true, User_info );
endping.PingID.PingID = startping.PingID.PingID;
_server.SendPacket(endping, true, userInfo );
}
else if( pack.Type == PacketType.CompleteAgentMovement )
{
// new client
Agent_Manager.AgentJoin( User_info );
_agentManager.AgentJoin(userInfo );
}
else if( pack.Type == PacketType.RequestImage )
{
RequestImagePacket image_req = (RequestImagePacket)pack;
for( int i = 0; i < image_req.RequestImage.Length; i++ )
RequestImagePacket imageRequest = (RequestImagePacket)pack;
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 ) {
//recieved regionhandshake so can now start sending info
Agent_Manager.SendInitialData( User_info );
//this.setuptemplates("objectupate164.dat",User_info,false);
_agentManager.SendInitialData(userInfo );
}
else if( pack.Type == PacketType.ObjectAdd )
{
ObjectAddPacket ad = (ObjectAddPacket)pack;
Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad );
//this.send_prim(User_info,ad.ObjectData.RayEnd, ad);
_primManager.CreatePrim(userInfo, ad.ObjectData.RayEnd, ad );
}
else if( pack.Type == PacketType.ObjectPosition ) {
//System.Console.WriteLine(pack.ToString());
}
else if( pack.Type == PacketType.MultipleObjectUpdate ) {
//System.Console.WriteLine(pack.ToString());
MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack;
else if( pack.Type == PacketType.MultipleObjectUpdate )
{
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.LLQuaternion rot=new LLQuaternion(mupd.ObjectData[i].Data,12,true);
Prim_Manager.UpdatePrimPosition( User_info, pos, mupd.ObjectData[ i ].ObjectLocalID ,false ,libsecondlife.LLQuaternion.Identity);
libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[ i ].Data, 0 );
_primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID ,false ,libsecondlife.LLQuaternion.Identity);
//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.LLQuaternion rot=new LLQuaternion(mupd.ObjectData[i].Data,0,true);
Prim_Manager.UpdatePrimPosition( User_info, pos, mupd.ObjectData[ i ].ObjectLocalID ,true ,rot);
libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
_primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID, true ,rot);
}
}
}
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;
uint mask = ag.AgentData.ControlFlags & ( 1 );
AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID );
if( m_av != null )
// System.Console.WriteLine("agent update");
AgentUpdatePacket agent = (AgentUpdatePacket)pack;
uint mask = agent.AgentData.ControlFlags & ( 1 );
AvatarData avatar = _agentManager.GetAgent(userInfo.AgentID );
if(avatar != null )
{
if( m_av.Started )
if(avatar.Started )
{
if( mask == ( 1 ) )
{
if( !m_av.Walk )
if(!avatar.Walk)
{
//start walking
Agent_Manager.SendMoveCommand( User_info, false, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation );
_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.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;
direc.Normalize();
direc = direc * ( ( 0.03f ) * 128f );
m_av.Velocity.X = direc.x;
m_av.Velocity.Y = direc.y;
m_av.Velocity.Z = direc.z;
m_av.Walk = true;
avatar.Velocity.X = direc.x;
avatar.Velocity.Y = direc.y;
avatar.Velocity.Z = direc.z;
avatar.Walk = true;
}
}
else
{
if( m_av.Walk )
if(avatar.Walk)
{
//walking but key not pressed so need to stop
Agent_Manager.SendMoveCommand( User_info, true, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation );
m_av.Walk = false;
m_av.Velocity.X = 0;
m_av.Velocity.Y = 0;
m_av.Velocity.Z = 0;
_agentManager.SendMoveCommand(userInfo, true, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation );
avatar.Walk = false;
avatar.Velocity.X = 0;
avatar.Velocity.Y = 0;
avatar.Velocity.Z = 0;
}
}
}
}
else
{
}
}
else if( pack.Type == PacketType.ChatFromViewer )
{
ChatFromViewerPacket chat = (ChatFromViewerPacket)pack;
System.Text.Encoding enc = System.Text.Encoding.ASCII;
string myString = enc.GetString( chat.ChatData.Message );
string myString = enc.GetString(chat.ChatData.Message );
if( myString != "" ) {
string[] comp = new string[ 10 ];
string delimStr = " , ";
@ -271,34 +263,32 @@ namespace OpenSim
}
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;
LLUUID Base,Inventory;
lock(_login)
{
first=_login.first;
last=_login.last;
first=_login.First;
last=_login.Last;
Base=_login.BaseFolder;
Inventory=_login.InventoryFolder;
//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)
//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
lock(_login)
{
_login.first="Test";
_login.last="User";
_login.First="Test";
_login.Last="User";
}
}
@ -308,14 +298,14 @@ namespace OpenSim
void Timer1Tick( object sender, System.EventArgs e ) {
this.time++;
Agent_Manager.UpdatePositions();
this.Asset_Manager.DoWork( time );
_agentManager.UpdatePositions();
this._assetManager.DoWork( time );
}
}
public class Logon
{
public string first="Test";
public string last="User";
public string First = "Test";
public string Last = "User";
public LLUUID Agent;
public LLUUID Session;
public LLUUID InventoryFolder;

View File

@ -38,8 +38,10 @@ namespace OpenSim
{
private static Globals instance = new Globals();
public static Globals Instance {
get {
public static Globals Instance
{
get
{
return instance;
}
}
@ -48,17 +50,13 @@ namespace OpenSim
{
}
public string RegionName="Test Sandbox\0";
public ulong RegionHandle= 1096213093147648;
public int IpPort=1000;
public string RegionName = "Test Sandbox\0";
public ulong RegionHandle = 1096213093147648;
public int IpPort = 1000;
public bool LoginSever=true;
public ushort LoginServerPort=8080;
public bool LoginSever = true;
public ushort LoginServerPort = 8080;
//public string RegionName= "The Other\0";
//public ulong RegionHandle= 1095113581519872;
//public int IpPort=1020;
//public bool LoginSever=false;
}
}

View File

@ -44,21 +44,21 @@ namespace OpenSim
/// </summary>
public class GridManager
{
private Server server;
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
private AgentManager AgentManager;
private Dictionary<ulong,RegionInfo> Grid;
private Server _server;
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
private AgentManager _agentManager;
public Dictionary<ulong,RegionInfo> Grid;
/// <summary>
///
/// </summary>
/// <param name="serve"></param>
/// <param name="agentManager"></param>
public GridManager(Server serve, AgentManager agentManager)
public GridManager(Server server, AgentManager agentManager)
{
Grid=new Dictionary<ulong, RegionInfo>();
server=serve;
AgentManager=agentManager;
Grid = new Dictionary<ulong, RegionInfo>();
_server = server;
_agentManager = agentManager;
LoadGrid();
}
@ -66,20 +66,20 @@ namespace OpenSim
///
/// </summary>
/// <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
MapLayerReplyPacket MapReply=new MapLayerReplyPacket();
MapReply.AgentData.AgentID=UserInfo.AgentID;
MapReply.AgentData.Flags=0;
MapReply.LayerData=new MapLayerReplyPacket.LayerDataBlock[1];
MapReply.LayerData[0]=new MapLayerReplyPacket.LayerDataBlock();
MapReply.LayerData[0].Bottom=800;
MapReply.LayerData[0].Left=800;
MapReply.LayerData[0].Top=1200;
MapReply.LayerData[0].Right=1200;
MapReply.LayerData[0].ImageID=new LLUUID("00000000-0000-0000-7007-000000000006");
server.SendPacket(MapReply,true,UserInfo);
MapLayerReplyPacket MapReply = new MapLayerReplyPacket();
MapReply.AgentData.AgentID = userInfo.AgentID;
MapReply.AgentData.Flags = 0;
MapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
MapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
MapReply.LayerData[0].Bottom = 800;
MapReply.LayerData[0].Left = 800;
MapReply.LayerData[0].Top = 1200;
MapReply.LayerData[0].Right = 1200;
MapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-7007-000000000006");
_server.SendPacket(MapReply, true, userInfo);
}
/// <summary>
@ -90,28 +90,28 @@ namespace OpenSim
/// <param name="MinY"></param>
/// <param name="MaxX"></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
RegionInfo Region=RegionPair.Value;
if(((Region.X>MinX) && (Region.X<MaxX)) && ((Region.Y>MinY) && (Region.Y<MaxY)))
RegionInfo Region = RegionPair.Value;
if(((Region.X > minX) && (Region.X < maxX)) && ((Region.Y > minY) && (Region.Y < maxY)))
{
MapBlockReplyPacket MapReply=new MapBlockReplyPacket();
MapReply.AgentData.AgentID=UserInfo.AgentID;
MapReply.AgentData.Flags=0;
MapReply.Data=new MapBlockReplyPacket.DataBlock[1];
MapReply.Data[0]=new MapBlockReplyPacket.DataBlock();
MapReply.Data[0].MapImageID=Region.ImageID;
MapReply.Data[0].X=Region.X;
MapReply.Data[0].Y=Region.Y;
MapReply.Data[0].WaterHeight=Region.WaterHeight;
MapReply.Data[0].Name=enc.GetBytes( Region.Name);
MapReply.Data[0].RegionFlags=72458694;
MapReply.Data[0].Access=13;
MapReply.Data[0].Agents=1;
server.SendPacket(MapReply,true,UserInfo);
MapBlockReplyPacket MapReply = new MapBlockReplyPacket();
MapReply.AgentData.AgentID = userInfo.AgentID;
MapReply.AgentData.Flags = 0;
MapReply.Data = new MapBlockReplyPacket.DataBlock[1];
MapReply.Data[0] = new MapBlockReplyPacket.DataBlock();
MapReply.Data[0].MapImageID = Region.ImageID;
MapReply.Data[0].X = Region.X;
MapReply.Data[0].Y = Region.Y;
MapReply.Data[0].WaterHeight = Region.WaterHeight;
MapReply.Data[0].Name = _enc.GetBytes( Region.Name);
MapReply.Data[0].RegionFlags = 72458694;
MapReply.Data[0].Access = 13;
MapReply.Data[0].Agents = 1;
_server.SendPacket(MapReply, true, userInfo);
}
}
@ -122,35 +122,35 @@ namespace OpenSim
/// </summary>
/// <param name="UserInfo"></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];
libsecondlife.Packets.TeleportStartPacket TeleportStart=new TeleportStartPacket();
TeleportStart.Info.TeleportFlags=16;
server.SendPacket(TeleportStart,true,UserInfo);
RegionInfo Region = Grid[request.Info.RegionHandle];
libsecondlife.Packets.TeleportStartPacket TeleportStart = new TeleportStartPacket();
TeleportStart.Info.TeleportFlags = 16;
_server.SendPacket(TeleportStart, true, userInfo);
libsecondlife.Packets.TeleportFinishPacket Teleport=new TeleportFinishPacket();
Teleport.Info.AgentID=UserInfo.AgentID;
Teleport.Info.RegionHandle=Request.Info.RegionHandle;
Teleport.Info.SimAccess=13;
Teleport.Info.SeedCapability=new byte[0];
libsecondlife.Packets.TeleportFinishPacket Teleport = new TeleportFinishPacket();
Teleport.Info.AgentID = userInfo.AgentID;
Teleport.Info.RegionHandle = request.Info.RegionHandle;
Teleport.Info.SimAccess = 13;
Teleport.Info.SeedCapability = new byte[0];
System.Net.IPAddress oIP=System.Net.IPAddress.Parse(Region.IPAddress.Address);
byte[] byteIP=oIP.GetAddressBytes();
System.Net.IPAddress oIP = System.Net.IPAddress.Parse(Region.IPAddress.Address);
byte[] byteIP = oIP.GetAddressBytes();
uint ip=(uint)byteIP[3]<<24;
ip+=(uint)byteIP[2]<<16;
ip+=(uint)byteIP[1]<<8;
ip+=(uint)byteIP[0];
Teleport.Info.SimIP=ip;
Teleport.Info.SimPort=Region.IPAddress.Port;
Teleport.Info.LocationID=4;
Teleport.Info.TeleportFlags= 1 << 4;;
server.SendPacket(Teleport,true,UserInfo);
Teleport.Info.SimIP = ip;
Teleport.Info.SimPort = Region.IPAddress.Port;
Teleport.Info.LocationID = 4;
Teleport.Info.TeleportFlags = 1 << 4;;
_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
//but for now we read static xml files
ulong CurrentHandle=0;
bool Login=true;
ulong CurrentHandle = 0;
bool Login = true;
XmlDocument doc = new XmlDocument();
try {
doc.Load(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"Grid.ini" ));
doc.Load(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Grid.ini" ));
}
catch ( Exception e)
{
@ -189,102 +189,102 @@ namespace OpenSim
if (nodes.HasChildNodes) {
foreach( XmlNode xmlnc in nodes.ChildNodes)
{
if(xmlnc.Name=="Region")
if(xmlnc.Name == "Region")
{
string xmlAttri;
RegionInfo Region=new RegionInfo();
if(xmlnc.Attributes["Name"]!=null)
RegionInfo Region = new RegionInfo();
if(xmlnc.Attributes["Name"] != null)
{
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Name")).Value;
Region.Name=xmlAttri+" \0";
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Name")).Value;
Region.Name = xmlAttri+" \0";
}
if(xmlnc.Attributes["ImageID"]!=null)
if(xmlnc.Attributes["ImageID"] != null)
{
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("ImageID")).Value;
Region.ImageID=new LLUUID(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("ImageID")).Value;
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;
Region.IPAddress.Address=xmlAttri;
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Address")).Value;
Region.IPAddress.Address = xmlAttri;
}
if(xmlnc.Attributes["IP_Port"]!=null)
if(xmlnc.Attributes["IP_Port"] != null)
{
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Port")).Value;
Region.IPAddress.Port=Convert.ToUInt16(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Port")).Value;
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;
Region.X=Convert.ToUInt16(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_X")).Value;
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;
Region.Y=Convert.ToUInt16(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_Y")).Value;
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;
uint Rx=0,Ry=0;
if(xmlnc.Attributes["RegionHandle"]!=null)
uint Rx = 0, Ry = 0;
if(xmlnc.Attributes["RegionHandle"] != null)
{
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("RegionHandle")).Value;
CurrentHandle=Convert.ToUInt64(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("RegionHandle")).Value;
CurrentHandle = Convert.ToUInt64(xmlAttri);
}
else
{
if(xmlnc.Attributes["Region_X"]!=null)
if(xmlnc.Attributes["Region_X"] != null)
{
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_X")).Value;
Rx=Convert.ToUInt32(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_X")).Value;
Rx = Convert.ToUInt32(xmlAttri);
}
if(xmlnc.Attributes["Region_Y"]!=null)
if(xmlnc.Attributes["Region_Y"] != null)
{
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_Y")).Value;
Ry=Convert.ToUInt32(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_Y")).Value;
Ry = Convert.ToUInt32(xmlAttri);
}
}
if(xmlnc.Attributes["LoginServer"]!=null)
if(xmlnc.Attributes["LoginServer"] != null)
{
xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("LoginServer")).Value;
Login=Convert.ToBoolean(xmlAttri);
xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("LoginServer")).Value;
Login = Convert.ToBoolean(xmlAttri);
}
if(CurrentHandle==0)
if(CurrentHandle == 0)
{
//no RegionHandle set
//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
{
//seems to be no Region location set
// so set default
CurrentHandle=1096213093147648;
CurrentHandle = 1096213093147648;
}
}
}
}
//finished loading grid, now set Globals to current region
if(CurrentHandle!=0)
if(CurrentHandle != 0)
{
if(Grid.ContainsKey(CurrentHandle))
{
RegionInfo Region=Grid[CurrentHandle];
Globals.Instance.RegionHandle=Region.Handle;
Globals.Instance.RegionName=Region.Name;
Globals.Instance.IpPort=Region.IPAddress.Port;
Globals.Instance.LoginSever=Login;
RegionInfo Region = Grid[CurrentHandle];
Globals.Instance.RegionHandle = Region.Handle;
Globals.Instance.RegionName = Region.Name;
Globals.Instance.IpPort = Region.IPAddress.Port;
Globals.Instance.LoginSever = Login;
}
}
@ -317,8 +317,8 @@ namespace OpenSim
}
set
{
x=value;
Handle=Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256));
x = value;
Handle = Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256));
}
}
public ushort Y
@ -329,33 +329,33 @@ namespace OpenSim
}
set
{
y=value;
Handle=Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256));
y = value;
Handle = Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256));
}
}
public ulong Handle
{
get
{
if(handle>0)
if(handle > 0)
{
return(handle);
}
else
{
return(Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256)));
return(Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256)));
}
}
set
{
handle=value;
handle = value;
}
}
public RegionInfo()
{
this.IPAddress=new RegionIP();
this.IPAddress = new RegionIP();
}
}
public class RegionIP

View File

@ -38,20 +38,20 @@ namespace OpenSim
/// </summary>
public class InventoryManager
{
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
public Dictionary<LLUUID, InventoryFolder> Folders;
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;
/// <summary>
///
/// </summary>
/// <param name="serve"></param>
public InventoryManager(Server serve)
public InventoryManager(Server server)
{
server=serve;
_server = server;
Folders=new Dictionary<LLUUID, InventoryFolder>();
Items=new Dictionary<LLUUID, InventoryItem>();
}
@ -63,23 +63,23 @@ namespace OpenSim
/// <param name="FolderID"></param>
/// <param name="Asset"></param>
/// <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();
Item.FolderID=FolderID;
Item.OwnerID=UserInfo.AgentID;
Item.AssetID=Asset.Full_ID;
Item.ItemID=NewItemID;
Item.Type=Asset.Type;
Item.Name=Asset.Name;
Item.Description=Asset.Description;
Item.InvType=Asset.InvType;
this.Items.Add(Item.ItemID,Item);
InventoryFolder Folder=Folders[Item.FolderID];
InventoryItem Item = new InventoryItem();
Item.FolderID = folderID;
Item.OwnerID = userInfo.AgentID;
Item.AssetID = asset.FullID;
Item.ItemID = NewItemID;
Item.Type = asset.Type;
Item.Name = asset.Name;
Item.Description = asset.Description;
Item.InvType = asset.InvType;
this.Items.Add(Item.ItemID, Item);
InventoryFolder Folder = Folders[Item.FolderID];
Folder.Items.Add(Item);
return(Item.ItemID);
}
@ -95,12 +95,12 @@ namespace OpenSim
/// <param name="UserInfo"></param>
/// <param name="NewFolder"></param>
/// <returns></returns>
public bool CreateNewFolder(User_Agent_info UserInfo, LLUUID NewFolder)
public bool CreateNewFolder(UserAgentInfo userInfo, LLUUID newFolder)
{
InventoryFolder Folder=new InventoryFolder();
Folder.FolderID=NewFolder;
Folder.OwnerID=UserInfo.AgentID;
this.Folders.Add(Folder.FolderID,Folder);
InventoryFolder Folder = new InventoryFolder();
Folder.FolderID = newFolder;
Folder.OwnerID = userInfo.AgentID;
this.Folders.Add(Folder.FolderID, Folder);
return(true);
}
@ -110,49 +110,49 @@ namespace OpenSim
/// </summary>
/// <param name="User_info"></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(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID))
{
InventoryFolder Folder=this.Folders[FetchDescend.InventoryData.FolderID];
InventoryDescendentsPacket Descend=new InventoryDescendentsPacket();
Descend.AgentData.AgentID=User_info.AgentID;
Descend.AgentData.OwnerID=Folder.OwnerID;
Descend.AgentData.FolderID=FetchDescend.InventoryData.FolderID;
Descend.AgentData.Descendents=Folder.Items.Count;
Descend.AgentData.Version=Folder.Items.Count;
InventoryFolder Folder = this.Folders[FetchDescend.InventoryData.FolderID];
InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
Descend.AgentData.AgentID = userInfo.AgentID;
Descend.AgentData.OwnerID = Folder.OwnerID;
Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
Descend.AgentData.Descendents = Folder.Items.Count;
Descend.AgentData.Version = Folder.Items.Count;
Descend.ItemData=new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
for(int i=0; i<Folder.Items.Count ; i++)
Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
for(int i = 0; i < Folder.Items.Count ; i++)
{
InventoryItem Item=Folder.Items[i];
Descend.ItemData[i]=new InventoryDescendentsPacket.ItemDataBlock();
Descend.ItemData[i].ItemID=Item.ItemID;
Descend.ItemData[i].AssetID=Item.AssetID;
Descend.ItemData[i].CreatorID=Item.CreatorID;
Descend.ItemData[i].BaseMask=FULL_MASK_PERMISSIONS;
Descend.ItemData[i].CreationDate=1000;
Descend.ItemData[i].Description=enc.GetBytes(Item.Description+"\0");
Descend.ItemData[i].EveryoneMask=FULL_MASK_PERMISSIONS;
Descend.ItemData[i].Flags=1;
Descend.ItemData[i].FolderID=Item.FolderID;
Descend.ItemData[i].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
Descend.ItemData[i].GroupMask=FULL_MASK_PERMISSIONS;
Descend.ItemData[i].InvType=Item.InvType;
Descend.ItemData[i].Name=enc.GetBytes(Item.Name+"\0");
Descend.ItemData[i].NextOwnerMask=FULL_MASK_PERMISSIONS;
Descend.ItemData[i].OwnerID=Item.OwnerID;
Descend.ItemData[i].OwnerMask=FULL_MASK_PERMISSIONS;
Descend.ItemData[i].SalePrice=100;
Descend.ItemData[i].SaleType=0;
Descend.ItemData[i].Type=Item.Type;
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] = new InventoryDescendentsPacket.ItemDataBlock();
Descend.ItemData[i].ItemID = Item.ItemID;
Descend.ItemData[i].AssetID = Item.AssetID;
Descend.ItemData[i].CreatorID = Item.CreatorID;
Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
Descend.ItemData[i].CreationDate = 1000;
Descend.ItemData[i].Description = _enc.GetBytes(Item.Description+"\0");
Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
Descend.ItemData[i].Flags = 1;
Descend.ItemData[i].FolderID = Item.FolderID;
Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
Descend.ItemData[i].InvType = Item.InvType;
Descend.ItemData[i].Name = _enc.GetBytes(Item.Name+"\0");
Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
Descend.ItemData[i].OwnerID = Item.OwnerID;
Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
Descend.ItemData[i].SalePrice = 100;
Descend.ItemData[i].SaleType = 0;
Descend.ItemData[i].Type = Item.Type;
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>
/// <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))
{
InventoryItem Item=Items[FetchItems.InventoryData[i].ItemID];
FetchInventoryReplyPacket InventoryReply=new FetchInventoryReplyPacket();
InventoryReply.AgentData.AgentID=User_info.AgentID;
InventoryReply.InventoryData=new FetchInventoryReplyPacket.InventoryDataBlock[1];
InventoryReply.InventoryData[0]=new FetchInventoryReplyPacket.InventoryDataBlock();
InventoryReply.InventoryData[0].ItemID=Item.ItemID;
InventoryReply.InventoryData[0].AssetID=Item.AssetID;
InventoryReply.InventoryData[0].CreatorID=Item.CreatorID;
InventoryReply.InventoryData[0].BaseMask=FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].CreationDate=1000;
InventoryReply.InventoryData[0].Description=enc.GetBytes( Item.Description+"\0");
InventoryReply.InventoryData[0].EveryoneMask=FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].Flags=1;
InventoryReply.InventoryData[0].FolderID=Item.FolderID;
InventoryReply.InventoryData[0].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000");
InventoryReply.InventoryData[0].GroupMask=FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].InvType=Item.InvType;
InventoryReply.InventoryData[0].Name=enc.GetBytes(Item.Name+"\0");
InventoryReply.InventoryData[0].NextOwnerMask=FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].OwnerID=Item.OwnerID;
InventoryReply.InventoryData[0].OwnerMask=FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].SalePrice=100;
InventoryReply.InventoryData[0].SaleType=0;
InventoryReply.InventoryData[0].Type=Item.Type;
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);
InventoryItem Item = Items[FetchItems.InventoryData[i].ItemID];
FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
InventoryReply.AgentData.AgentID = userInfo.AgentID;
InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
InventoryReply.InventoryData[0].ItemID = Item.ItemID;
InventoryReply.InventoryData[0].AssetID = Item.AssetID;
InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].CreationDate = 1000;
InventoryReply.InventoryData[0].Description = _enc.GetBytes( Item.Description+"\0");
InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].Flags = 1;
InventoryReply.InventoryData[0].FolderID = Item.FolderID;
InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].InvType = Item.InvType;
InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name+"\0");
InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
InventoryReply.InventoryData[0].SalePrice = 100;
InventoryReply.InventoryData[0].SaleType = 0;
InventoryReply.InventoryData[0].Type = Item.Type;
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, userInfo);
}
}
}
@ -217,7 +217,7 @@ namespace OpenSim
public InventoryFolder()
{
Items=new List<InventoryItem>();
Items = new List<InventoryItem>();
}
}
@ -228,7 +228,7 @@ namespace OpenSim
public LLUUID OwnerID;
public LLUUID ItemID;
public LLUUID AssetID;
public LLUUID CreatorID=LLUUID.Zero;
public LLUUID CreatorID = LLUUID.Zero;
public sbyte InvType;
public sbyte Type;
public string Name;

View File

@ -116,7 +116,8 @@ namespace OpenSim
int contentLength = 0;
// read HTTP header
do {
do
{
// read one line of the header
line = reader.ReadLine();
@ -145,72 +146,72 @@ namespace OpenSim
//get login name
if(requestData.Contains("first"))
{
first=(string)requestData["first"];
first = (string)requestData["first"];
}
else
{
first="test";
first = "test";
}
if(requestData.Contains("last"))
{
last=(string)requestData["last"];
last = (string)requestData["last"];
}
else
{
last="User"+NumClients.ToString();
last = "User"+NumClients.ToString();
}
NumClients++;
//create a agent and session LLUUID
int AgentRand=this.RandomClass.Next(1,9999);
Agent=new LLUUID("99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead");
int SessionRand=this.RandomClass.Next(1,999);
Session=new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
int AgentRand = this.RandomClass.Next(1,9999);
Agent = new LLUUID("99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead");
int SessionRand = this.RandomClass.Next(1,999);
Session = new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797");
StreamReader SR;
string ResponseString="";
string ResponseString = "";
string lines;
SR=File.OpenText("new-login.dat");
lines=SR.ReadLine();
while(lines!="end-mfile")
while(lines != "end-mfile")
{
ResponseString+=lines;
lines=SR.ReadLine();
ResponseString += lines;
lines = SR.ReadLine();
}
SR.Close();
XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString);
Hashtable responseData = (Hashtable)response.Value;
responseData["agent_id"]=Agent.ToStringHyphenated();
responseData["session_id"]=Session.ToStringHyphenated();
ArrayList InventoryList=(ArrayList) responseData["inventory-skeleton"];
Hashtable Inventory1=(Hashtable)InventoryList[0];
Hashtable Inventory2=(Hashtable)InventoryList[1];
LLUUID BaseFolderID=LLUUID.Random();
LLUUID InventoryFolderID=LLUUID.Random();
Inventory2["name"]="Base";
Inventory2["folder_id"]=BaseFolderID.ToStringHyphenated();
Inventory1["folder_id"]=InventoryFolderID.ToStringHyphenated();
responseData["agent_id"] = Agent.ToStringHyphenated();
responseData["session_id"] = Session.ToStringHyphenated();
ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"];
Hashtable Inventory1 = (Hashtable)InventoryList[0];
Hashtable Inventory2 = (Hashtable)InventoryList[1];
LLUUID BaseFolderID = LLUUID.Random();
LLUUID InventoryFolderID = LLUUID.Random();
Inventory2["name"] = "Base";
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
ArrayList InventoryRoot=(ArrayList) responseData["inventory-root"];
Hashtable Inventoryroot=(Hashtable)InventoryRoot[0];
Inventoryroot["folder_id"]=InventoryFolderID.ToStringHyphenated();
ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"];
Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
//copy data to login object
lock(Login)
{
Login.first=first;
Login.last=last;
Login.Agent=Agent;
Login.Session=Session;
Login.BaseFolder=BaseFolderID;
Login.InventoryFolder=InventoryFolderID;
Login.First = first;
Login.Last = last;
Login.Agent = Agent;
Login.Session = Session;
Login.BaseFolder = BaseFolderID;
Login.InventoryFolder = InventoryFolderID;
}
// forward the XML-RPC response to the client

View File

@ -40,11 +40,10 @@ namespace OpenSim
/// </summary>
public class PrimManager
{
private Server server;
public AgentManager Agent_Manager;
private uint prim_count;
private Server _server;
private uint _primCount;
public AgentManager AgentManagement;
public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock PrimTemplate;
public Dictionary<libsecondlife.LLUUID,PrimInfo> PrimList;
@ -52,10 +51,10 @@ namespace OpenSim
///
/// </summary>
/// <param name="serve"></param>
public PrimManager(Server serve)
public PrimManager(Server server)
{
server=serve;
PrimList=new Dictionary<libsecondlife.LLUUID,PrimInfo> ();
_server = server;
PrimList = new Dictionary<libsecondlife.LLUUID,PrimInfo> ();
this.SetupTemplates("objectupate164.dat");
}
@ -66,58 +65,59 @@ namespace OpenSim
/// <param name="User_info"></param>
/// <param name="p1"></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();
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation=64096;
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
PrimData PData=new PrimData();
objupdate.ObjectData[0]=this.PrimTemplate;
PData.OwnerID=objupdate.ObjectData[0].OwnerID=User_info.AgentID;
PData.PCode=objupdate.ObjectData[0].PCode=add_pack.ObjectData.PCode;
PData.PathBegin=objupdate.ObjectData[0].PathBegin=add_pack.ObjectData.PathBegin;
PData.PathEnd=objupdate.ObjectData[0].PathEnd=add_pack.ObjectData.PathEnd;
PData.PathScaleX=objupdate.ObjectData[0].PathScaleX=add_pack.ObjectData.PathScaleX;
PData.PathScaleY=objupdate.ObjectData[0].PathScaleY=add_pack.ObjectData.PathScaleY;
PData.PathShearX=objupdate.ObjectData[0].PathShearX=add_pack.ObjectData.PathShearX;
PData.PathShearY=objupdate.ObjectData[0].PathShearY=add_pack.ObjectData.PathShearY;
PData.PathSkew=objupdate.ObjectData[0].PathSkew=add_pack.ObjectData.PathSkew;
PData.ProfileBegin=objupdate.ObjectData[0].ProfileBegin=add_pack.ObjectData.ProfileBegin;
PData.ProfileEnd=objupdate.ObjectData[0].ProfileEnd=add_pack.ObjectData.ProfileEnd;
PData.Scale=objupdate.ObjectData[0].Scale=add_pack.ObjectData.Scale;//new LLVector3(1,1,1);
PData.PathCurve=objupdate.ObjectData[0].PathCurve=add_pack.ObjectData.PathCurve;
PData.ProfileCurve=objupdate.ObjectData[0].ProfileCurve=add_pack.ObjectData.ProfileCurve;
PData.ParentID=objupdate.ObjectData[0].ParentID=0;
PData.ProfileHollow=objupdate.ObjectData[0].ProfileHollow=add_pack.ObjectData.ProfileHollow;
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
PrimData PData = new PrimData();
objupdate.ObjectData[0] = this.PrimTemplate;
PData.OwnerID=objupdate.ObjectData[0].OwnerID = userInfo.AgentID;
PData.PCode=objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
PData.PathBegin=objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
PData.PathEnd=objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
PData.PathScaleX=objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
PData.PathScaleY=objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
PData.PathShearX=objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
PData.PathShearY=objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
PData.PathSkew=objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
PData.ProfileBegin=objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
PData.ProfileEnd=objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
PData.Scale=objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
PData.PathCurve=objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
PData.ProfileCurve=objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
PData.ParentID=objupdate.ObjectData[0].ParentID = 0;
PData.ProfileHollow=objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
//finish off copying rest of shape data
objupdate.ObjectData[0].ID=(uint)(702000+prim_count);
objupdate.ObjectData[0].FullID=new LLUUID("edba7151-5857-acc5-b30b-f01efefda"+prim_count.ToString("000"));
objupdate.ObjectData[0].ID = (uint)(702000 + _primCount);
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda"+_primCount.ToString("000"));
//update position
byte[] pb=p1.GetBytes();
Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,0,pb.Length);
byte[] pb = pos1.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
prim_count++;
server.SendPacket(objupdate,true,User_info);
_primCount++;
_server.SendPacket(objupdate, true, userInfo);
//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
PrimInfo NewPrim=new PrimInfo();
NewPrim.FullID=objupdate.ObjectData[0].FullID;
NewPrim.LocalID=objupdate.ObjectData[0].ID;
NewPrim.Position=p1;
NewPrim.data=PData;
PrimInfo NewPrim = new PrimInfo();
NewPrim.FullID = objupdate.ObjectData[0].FullID;
NewPrim.LocalID = objupdate.ObjectData[0].ID;
NewPrim.Position = pos1;
NewPrim.Data = PData;
this.PrimList.Add(NewPrim.FullID,NewPrim);
this.PrimList.Add(NewPrim.FullID, NewPrim);
//store rest of data
@ -131,62 +131,62 @@ namespace OpenSim
/// <param name="LocalID"></param>
/// <param name="setRotation"></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)
{
if(kp.Value.LocalID==LocalID)
if(kp.Value.LocalID == localID)
{
pri=kp.Value;
pri = kp.Value;
}
}
if(pri==null)
if(pri == null)
{
return;
}
uint ID=pri.LocalID;
libsecondlife.LLVector3 pos2=new LLVector3(position.X,position.Y,position.Z);
uint ID = pri.LocalID;
libsecondlife.LLVector3 pos2 = new LLVector3(position.X, position.Y, position.Z);
libsecondlife.LLQuaternion rotation2;
if(!setRotation)
{
pri.Position=pos2;
rotation2=new LLQuaternion(pri.Rotation.X,pri.Rotation.Y,pri.Rotation.Z,pri.Rotation.W);
pri.Position = pos2;
rotation2 = new LLQuaternion(pri.Rotation.X, pri.Rotation.Y, pri.Rotation.Z, pri.Rotation.W);
}
else
{
rotation2=new LLQuaternion(rotation.X,rotation.Y,rotation.Z,rotation.W);
pos2=pri.Position;
pri.Rotation=rotation;
rotation2=new LLQuaternion(rotation.X, rotation.Y, rotation.Z, rotation.W);
pos2 = pri.Position;
pri.Rotation = rotation;
}
rotation2.W+=1;
rotation2.X+=1;
rotation2.Y+=1;
rotation2.Z+=1;
rotation2.W += 1;
rotation2.X += 1;
rotation2.Y += 1;
rotation2.Z += 1;
byte[] bytes=new byte[60];
byte[] bytes = new byte[60];
ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket();
im.RegionData.RegionHandle=Globals.Instance.RegionHandle;
im.RegionData.TimeDilation=64096;
im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
int i=0;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
im.ObjectData[0]=dat;
dat.TextureEntry=PrimTemplate.TextureEntry;
ImprovedTerseObjectUpdatePacket im = new ImprovedTerseObjectUpdatePacket();
im.RegionData.RegionHandle = Globals.Instance.RegionHandle;
im.RegionData.TimeDilation = 64096;
im.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
int i = 0;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
im.ObjectData[0] = dat;
dat.TextureEntry = PrimTemplate.TextureEntry;
bytes[i++] = (byte)(ID % 256);
bytes[i++] = (byte)((ID >> 8) % 256);
bytes[i++] = (byte)((ID >> 16) % 256);
bytes[i++] = (byte)((ID >> 24) % 256);
bytes[i++]=0;
bytes[i++]=0;//1;
bytes[i++]= 0;
bytes[i++]= 0;
byte[] pb=pos2.GetBytes();
pri.Position=pos2;
Array.Copy(pb,0,bytes,i,pb.Length);
i+=12;
ushort ac=32767;
byte[] pb = pos2.GetBytes();
pri.Position = pos2;
Array.Copy(pb, 0, bytes, i, pb.Length);
i += 12;
ushort ac = 32767;
//vel
bytes[i++] = (byte)(ac % 256);
@ -205,10 +205,10 @@ namespace OpenSim
bytes[i++] = (byte)((ac >> 8) % 256);
ushort rw, rx,ry,rz;
rw=(ushort)(32768*rotation2.W);
rx=(ushort)(32768*rotation2.X);
ry=(ushort)(32768*rotation2.Y);
rz=(ushort)(32768*rotation2.Z);
rw = (ushort)(32768 * rotation2.W);
rx = (ushort)(32768 * rotation2.X);
ry = (ushort)(32768 * rotation2.Y);
rz = (ushort)(32768 * rotation2.Z);
//rot
bytes[i++] = (byte)(rx % 256);
@ -230,11 +230,11 @@ namespace OpenSim
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>
/// <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
}
@ -254,12 +254,12 @@ namespace OpenSim
/// <param name="name"></param>
public void SetupTemplates(string name)
{
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation=64096;
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
int i=0;
int i = 0;
FileInfo fInfo = new FileInfo(name);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
@ -268,18 +268,18 @@ namespace OpenSim
br.Close();
fStream.Close();
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
objupdate.ObjectData[0]=objdata;
this.PrimTemplate=objdata;
objdata.UpdateFlags=objdata.UpdateFlags+12-16+32+256;
objdata.OwnerID=new LLUUID("00000000-0000-0000-0000-000000000000");
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
objupdate.ObjectData[0] = objdata;
this.PrimTemplate = objdata;
objdata.UpdateFlags = objdata.UpdateFlags + 12 - 16 + 32 + 256;
objdata.OwnerID = new LLUUID("00000000-0000-0000-0000-000000000000");
//test adding a new texture to object , to test image downloading
LLObject.TextureEntry te=new LLObject.TextureEntry(objdata.TextureEntry,0,objdata.TextureEntry.Length);
te.DefaultTexture.TextureID=new LLUUID("00000000-0000-0000-5005-000000000005");
LLObject.TextureEntry te = new LLObject.TextureEntry(objdata.TextureEntry, 0, objdata.TextureEntry.Length);
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>
@ -287,34 +287,34 @@ namespace OpenSim
/// </summary>
/// <param name="name"></param>
/// <param name="user"></param>
public void ReadPrimDatabase(string name,User_Agent_info user)
public void ReadPrimDatabase(string name, UserAgentInfo userInfo)
{
StreamReader SR;
string line;
SR=File.OpenText(name);
string [] comp= new string[10];
string [] comp = new string[10];
string delimStr = " , ";
char [] delimiter = delimStr.ToCharArray();
line=SR.ReadLine();
while(line!="end")
while(line != "end")
{
comp=line.Split(delimiter);
if(comp[0]=="ObjPack")
comp = line.Split(delimiter);
if(comp[0] == "ObjPack")
{
int num=Convert.ToInt32(comp[2]);
int start=Convert.ToInt32(comp[1]);
ObjectUpdatePacket objupdate=new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation=64096;
objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num];
int num = Convert.ToInt32(comp[2]);
int start = Convert.ToInt32(comp[1]);
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num];
// int count=0;
string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\";
for(int cc=0; cc<num; cc++)
for(int cc = 0; cc < num; cc++)
{
string filenam=data_path+@"prim_updates"+start+".dat";
int i=0;
string filenam = data_path+@"prim_updates"+start+".dat";
int i = 0;
//FileInfo fInfo = new FileInfo("objectupate"+start+".dat");
FileInfo fInfo = new FileInfo(filenam);
long numBytes = fInfo.Length;
@ -325,12 +325,12 @@ namespace OpenSim
br.Close();
fStream.Close();
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i);
objupdate.ObjectData[cc]=objdata;
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
objupdate.ObjectData[cc] = objdata;
start++;
}
server.SendPacket(objupdate,true,user);
line=SR.ReadLine();
_server.SendPacket(objupdate, true, userInfo);
line = SR.ReadLine();
}
}
SR.Close();
@ -344,7 +344,7 @@ namespace OpenSim
public LLQuaternion Rotation=LLQuaternion.Identity;
public uint LocalID;
public LLUUID FullID;
public PrimData data;
public PrimData Data;
public PrimInfo()
{

View File

@ -78,11 +78,11 @@ namespace OpenSim
#region Lua Functions
public void ScriptRegister( script_object_interface script)
public void ScriptRegister(script_object_interface script)
{
//called by scripts to register themselves
}
public void MoveObject(float x ,float y, float z)
public void MoveObject(float x , float y, float z)
{
}

View File

@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.1.0.2017
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libsecondlife", "..\..\libsecondlife\libsecondlife-cs\libsecondlife.csproj", "{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET 1.1 = Debug|.NET 1.1

View File

@ -45,8 +45,8 @@ namespace OpenSim
public interface ServerCallback
{
//should replace with delegates
void MainCallback(Packet pack, User_Agent_info User_info);
void NewUserCallback(User_Agent_info User_info);
void MainCallback(Packet pack, UserAgentInfo User_info);
void NewUserCallback(UserAgentInfo User_info);
void ErrorCallback(string text);
}
public class Server
@ -197,7 +197,7 @@ namespace OpenSim
/// </summary>
/// <param name="packet">Packet to be sent</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;
int bytes;
@ -324,7 +324,7 @@ namespace OpenSim
/// <summary>
/// Sends out pending acknowledgements
/// </summary>
private void SendAcks(User_Agent_info User_info)
private void SendAcks(UserAgentInfo User_info)
{
lock (User_info.PendingAcks)
{
@ -358,7 +358,7 @@ namespace OpenSim
/// <summary>
/// Resend unacknowledged packets
/// </summary>
private void ResendUnacked(User_Agent_info User_info)
private void ResendUnacked(UserAgentInfo User_info)
{
if (connected)
{
@ -397,7 +397,7 @@ namespace OpenSim
// Update the disconnect flag so this sim doesn't time out
DisconnectCandidate = false;
User_Agent_info User_info=null;
UserAgentInfo User_info=null;
lock (RecvBuffer)
{
@ -416,7 +416,7 @@ namespace OpenSim
if (packet.Type == PacketType.UseCircuitCode)
{
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.AgentID=cir_pack.CircuitCode.ID;
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;
// 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++)
{
temp_agent=(User_Agent_info)this.User_agents[ii];
temp_agent=(UserAgentInfo)this.User_agents[ii];
IPEndPoint ag_ip=(IPEndPoint)temp_agent.endpoint;
//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
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);
ResendUnacked(user);
@ -619,7 +619,7 @@ namespace OpenSim
}
}
public class User_Agent_info
public class UserAgentInfo
{
public EndPoint endpoint;
public LLUUID AgentID;
@ -636,7 +636,7 @@ namespace OpenSim
// ACKs that are queued up to be sent to the simulator
public Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
public User_Agent_info()
public UserAgentInfo()
{
}