Clean up
parent
dc2316de9c
commit
8c80d98252
180
Agent_Manager.cs
180
Agent_Manager.cs
|
@ -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;
|
||||
_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>
|
||||
|
@ -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.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;
|
||||
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.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,User_info);
|
||||
_server.SendPacket(mov, true, userInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -186,7 +186,7 @@ namespace OpenSim
|
|||
RegionPacket.RegionInfo.SimAccess = 13;
|
||||
RegionPacket.RegionInfo.WaterHeight = 5;
|
||||
RegionPacket.RegionInfo.RegionFlags = 72458694;
|
||||
RegionPacket.RegionInfo.SimName=enc.GetBytes( Globals.Instance.RegionName);
|
||||
RegionPacket.RegionInfo.SimName = _enc.GetBytes( Globals.Instance.RegionName);
|
||||
RegionPacket.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||
RegionPacket.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||
RegionPacket.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||
|
@ -237,7 +237,7 @@ 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
|
||||
|
@ -246,43 +246,43 @@ namespace OpenSim
|
|||
//send layerdata
|
||||
LayerDataPacket layerpack = new LayerDataPacket();
|
||||
layerpack.LayerID.Type = 76;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata0.dat");
|
||||
this.SendLayerData(userInfo,ref layerpack, data_path+@"layerdata0.dat");
|
||||
|
||||
LayerDataPacket layerpack1 = new LayerDataPacket();
|
||||
layerpack1.LayerID.Type = 76;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata1.dat");
|
||||
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata1.dat");
|
||||
|
||||
LayerDataPacket layerpack2 = new LayerDataPacket();
|
||||
layerpack2.LayerID.Type = 56;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata2.dat");
|
||||
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata2.dat");
|
||||
|
||||
LayerDataPacket layerpack3 = new LayerDataPacket();
|
||||
layerpack3.LayerID.Type = 55;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata3.dat");
|
||||
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata3.dat");
|
||||
|
||||
LayerDataPacket layerpack4 = new LayerDataPacket();
|
||||
layerpack4.LayerID.Type = 56;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata4.dat");
|
||||
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata4.dat");
|
||||
|
||||
LayerDataPacket layerpack5 = new LayerDataPacket();
|
||||
layerpack5.LayerID.Type = 55;
|
||||
this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata5.dat");
|
||||
this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata5.dat");
|
||||
|
||||
//send intial set of captured prims data?
|
||||
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)
|
||||
{
|
||||
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,7 +291,7 @@ 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();
|
||||
|
@ -301,30 +301,29 @@ namespace OpenSim
|
|||
|
||||
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;
|
||||
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";
|
||||
|
||||
libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
|
||||
|
||||
byte[] pb = pos2.GetBytes();
|
||||
|
||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||
this.local_numer++;
|
||||
this._localNumber++;
|
||||
|
||||
server.SendPacket(objupdate,true,User_info);
|
||||
_server.SendPacket(objupdate, true, userInfo);
|
||||
|
||||
//send this info to other existing clients
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList)
|
||||
{
|
||||
if(kp.Value.NetInfo.AgentID!=User_info.AgentID)
|
||||
if(kp.Value.NetInfo.AgentID != userInfo.AgentID)
|
||||
{
|
||||
server.SendPacket(objupdate,true,kp.Value.NetInfo);
|
||||
_server.SendPacket(objupdate, true, kp.Value.NetInfo);
|
||||
this.SendOtherAppearance(kp.Value.NetInfo, objupdate.ObjectData[0].FullID);
|
||||
}
|
||||
}
|
||||
|
@ -335,26 +334,26 @@ 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];
|
||||
AvatarData Agent = this.AgentList[userInfo.AgentID];
|
||||
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
|
||||
aw.AgentData.AgentID=user.AgentID;
|
||||
aw.AgentData.AgentID = userInfo.AgentID;
|
||||
aw.AgentData.SerialNum = 0;
|
||||
aw.AgentData.SessionID=user.SessionID;
|
||||
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");
|
||||
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");
|
||||
awb.AssetID = Agent.Wearables[1].AssetID;
|
||||
awb.ItemID = Agent.Wearables[1].ItemID;
|
||||
aw.WearableData[1] = awb;
|
||||
|
||||
for(int i=2; i<13; i++)
|
||||
|
@ -366,7 +365,7 @@ namespace OpenSim
|
|||
aw.WearableData[i] = awb;
|
||||
}
|
||||
|
||||
server.SendPacket(aw,true,user);
|
||||
_server.SendPacket(aw, true, userInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -374,7 +373,7 @@ 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();
|
||||
|
||||
|
@ -383,7 +382,6 @@ namespace OpenSim
|
|||
//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);
|
||||
|
@ -401,7 +399,7 @@ namespace OpenSim
|
|||
|
||||
avp.Sender.IsTrial = false;
|
||||
avp.Sender.ID = id;
|
||||
server.SendPacket(avp,true,user);
|
||||
_server.SendPacket(avp, true, userInfo);
|
||||
|
||||
}
|
||||
|
||||
|
@ -410,7 +408,7 @@ 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();
|
||||
|
@ -420,19 +418,17 @@ namespace OpenSim
|
|||
|
||||
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();
|
||||
|
||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||
this.local_numer++;
|
||||
this._localNumber++;
|
||||
|
||||
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.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;
|
||||
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)
|
||||
{
|
||||
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,18 +471,18 @@ 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;
|
||||
Console.WriteLine("sending move");
|
||||
uint ID = userInfo.localID;
|
||||
byte[] bytes = new byte[60];
|
||||
int i=0;
|
||||
|
||||
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;
|
||||
|
@ -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)
|
||||
{
|
||||
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,30 +596,24 @@ 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);
|
||||
|
|
|
@ -47,17 +47,18 @@ namespace OpenSim
|
|||
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;
|
||||
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;
|
||||
this._server = server;
|
||||
this._inventoryManager = inventoryManager;
|
||||
Textures = new Dictionary<libsecondlife.LLUUID,TextureImage> ();
|
||||
Assets = new Dictionary<libsecondlife.LLUUID,AssetInfo> ();
|
||||
this.initialise();
|
||||
|
@ -71,36 +72,36 @@ namespace OpenSim
|
|||
//Shape and skin base assets
|
||||
AssetInfo Asset = new AssetInfo();
|
||||
Asset.filename = "base_shape.dat";
|
||||
Asset.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
Asset.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
this.LoadAsset(Asset, false);
|
||||
this.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.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.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.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.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,63 +112,63 @@ 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.Params = transferRequest.TransferInfo.Params;
|
||||
Transfer.TransferInfo.Size = info.data.Length;
|
||||
Transfer.TransferInfo.TransferID=TransferRequest.TransferInfo.TransferID;
|
||||
Transfer.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
|
||||
|
||||
server.SendPacket(Transfer, true, UserInfo);
|
||||
_server.SendPacket(Transfer, true, userInfo);
|
||||
|
||||
TransferPacketPacket TransferPacket = new TransferPacketPacket();
|
||||
TransferPacket.TransferData.Packet = 0;
|
||||
TransferPacket.TransferData.ChannelType = 2;
|
||||
TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
|
||||
TransferPacket.TransferData.TransferID=transferRequest.TransferInfo.TransferID;
|
||||
if(info.data.Length>1000) //but needs to be less than 2000 at the moment
|
||||
{
|
||||
byte[] chunk = new byte[1000];
|
||||
Array.Copy(info.data,chunk,1000);
|
||||
TransferPacket.TransferData.Data = chunk;
|
||||
TransferPacket.TransferData.Status = 0;
|
||||
server.SendPacket(TransferPacket,true,UserInfo);
|
||||
_server.SendPacket(TransferPacket,true,userInfo);
|
||||
|
||||
TransferPacket = new TransferPacketPacket();
|
||||
TransferPacket.TransferData.Packet = 1;
|
||||
TransferPacket.TransferData.ChannelType = 2;
|
||||
TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID;
|
||||
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);
|
||||
_server.SendPacket(TransferPacket, true, userInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
TransferPacket.TransferData.Status = 1; //last packet? so set to 1
|
||||
TransferPacket.TransferData.Data = info.data;
|
||||
server.SendPacket(TransferPacket, true, UserInfo);
|
||||
_server.SendPacket(TransferPacket, true, userInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
_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")];
|
||||
|
@ -179,12 +180,12 @@ namespace OpenSim
|
|||
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")];
|
||||
|
@ -197,15 +198,15 @@ namespace OpenSim
|
|||
Skin.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
|
||||
|
||||
Array.Copy(Agentid,0,Skin.data,238,Agentid.Length);
|
||||
this.Assets.Add(Skin.Full_ID, Skin);
|
||||
this.Assets.Add(Skin.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);
|
||||
this.Textures.Add(Texture.FullID, Texture);
|
||||
_inventoryManager.AddToInventory(UserInfo, BaseFolder, Texture);
|
||||
|
||||
}
|
||||
|
||||
|
@ -244,7 +245,7 @@ namespace OpenSim
|
|||
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.FullID = LLUUID.Random();
|
||||
NewAsset.Type = SourceAsset.Type;
|
||||
NewAsset.InvType = SourceAsset.InvType;
|
||||
return(NewAsset);
|
||||
|
@ -252,21 +253,21 @@ namespace OpenSim
|
|||
#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);
|
||||
im_not.ImageID.ID=imageID;
|
||||
_server.SendPacket(im_not, true, userInfo);
|
||||
return;
|
||||
}
|
||||
TextureImage imag=this.Textures[image_id];
|
||||
TextureImage imag = this.Textures[imageID];
|
||||
TextureRequest req = new TextureRequest();
|
||||
req.RequestUser=user;
|
||||
req.RequestImage=image_id;
|
||||
req.RequestUser = userInfo;
|
||||
req.RequestImage = imageID;
|
||||
req.image_info = imag;
|
||||
|
||||
if(imag.data.LongLength>1000) //should be bigger or smaller?
|
||||
|
@ -284,7 +285,7 @@ namespace OpenSim
|
|||
|
||||
}
|
||||
|
||||
public void AddTexture(LLUUID image_id, string name, byte[] data)
|
||||
public void AddTexture(LLUUID imageID, string name, byte[] data)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -319,14 +320,14 @@ namespace OpenSim
|
|||
//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.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);
|
||||
_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);
|
||||
System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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,7 +373,7 @@ 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;
|
||||
|
@ -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,7 +416,7 @@ 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;
|
||||
|
|
190
Controller.cs
190
Controller.cs
|
@ -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);
|
||||
_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,7 +91,8 @@ 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?
|
||||
|
@ -102,152 +102,144 @@ namespace OpenSim
|
|||
|
||||
//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);
|
||||
_inventoryManager.FetchInventory(userInfo, FetchInventory);
|
||||
}
|
||||
else if( pack.Type == PacketType.FetchInventoryDescendents)
|
||||
{
|
||||
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)pack;
|
||||
Inventory_Manager.FetchInventoryDescendents(User_info,Fetch);
|
||||
_inventoryManager.FetchInventoryDescendents(userInfo, Fetch);
|
||||
}
|
||||
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)
|
||||
{
|
||||
this.Agent_Manager.RemoveAgent(User_info);
|
||||
this._agentManager.RemoveAgent(userInfo);
|
||||
}
|
||||
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))
|
||||
{
|
||||
TeleportLocationRequestPacket Request = (TeleportLocationRequestPacket)pack;
|
||||
|
||||
this.Grid_Manager.RequestTeleport(User_info,Request);
|
||||
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)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
|
@ -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;
|
||||
|
|
10
Globals.cs
10
Globals.cs
|
@ -38,8 +38,10 @@ namespace OpenSim
|
|||
{
|
||||
private static Globals instance = new Globals();
|
||||
|
||||
public static Globals Instance {
|
||||
get {
|
||||
public static Globals Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
@ -55,10 +57,6 @@ namespace OpenSim
|
|||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
_server = server;
|
||||
_agentManager = agentManager;
|
||||
LoadGrid();
|
||||
}
|
||||
|
||||
|
@ -66,11 +66,11 @@ 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.AgentID = userInfo.AgentID;
|
||||
MapReply.AgentData.Flags = 0;
|
||||
MapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
|
||||
MapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
|
||||
|
@ -79,7 +79,7 @@ namespace OpenSim
|
|||
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);
|
||||
_server.SendPacket(MapReply, true, userInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -90,16 +90,16 @@ 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)
|
||||
{
|
||||
//check Region is inside the requested area
|
||||
RegionInfo Region = RegionPair.Value;
|
||||
if(((Region.X>MinX) && (Region.X<MaxX)) && ((Region.Y>MinY) && (Region.Y<MaxY)))
|
||||
if(((Region.X > minX) && (Region.X < maxX)) && ((Region.Y > minY) && (Region.Y < maxY)))
|
||||
{
|
||||
MapBlockReplyPacket MapReply = new MapBlockReplyPacket();
|
||||
MapReply.AgentData.AgentID=UserInfo.AgentID;
|
||||
MapReply.AgentData.AgentID = userInfo.AgentID;
|
||||
MapReply.AgentData.Flags = 0;
|
||||
MapReply.Data = new MapBlockReplyPacket.DataBlock[1];
|
||||
MapReply.Data[0] = new MapBlockReplyPacket.DataBlock();
|
||||
|
@ -107,11 +107,11 @@ namespace OpenSim
|
|||
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].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);
|
||||
_server.SendPacket(MapReply, true, userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,18 +122,18 @@ 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];
|
||||
RegionInfo Region = Grid[request.Info.RegionHandle];
|
||||
libsecondlife.Packets.TeleportStartPacket TeleportStart = new TeleportStartPacket();
|
||||
TeleportStart.Info.TeleportFlags = 16;
|
||||
server.SendPacket(TeleportStart,true,UserInfo);
|
||||
_server.SendPacket(TeleportStart, true, userInfo);
|
||||
|
||||
libsecondlife.Packets.TeleportFinishPacket Teleport = new TeleportFinishPacket();
|
||||
Teleport.Info.AgentID=UserInfo.AgentID;
|
||||
Teleport.Info.RegionHandle=Request.Info.RegionHandle;
|
||||
Teleport.Info.AgentID = userInfo.AgentID;
|
||||
Teleport.Info.RegionHandle = request.Info.RegionHandle;
|
||||
Teleport.Info.SimAccess = 13;
|
||||
Teleport.Info.SeedCapability = new byte[0];
|
||||
|
||||
|
@ -148,9 +148,9 @@ namespace OpenSim
|
|||
Teleport.Info.SimPort = Region.IPAddress.Port;
|
||||
Teleport.Info.LocationID = 4;
|
||||
Teleport.Info.TeleportFlags = 1 << 4;;
|
||||
server.SendPacket(Teleport,true,UserInfo);
|
||||
_server.SendPacket(Teleport, true, userInfo);
|
||||
|
||||
this.AgentManager.RemoveAgent(UserInfo);
|
||||
this._agentManager.RemoveAgent(userInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,21 +63,21 @@ 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();
|
||||
|
||||
InventoryItem Item = new InventoryItem();
|
||||
Item.FolderID=FolderID;
|
||||
Item.OwnerID=UserInfo.AgentID;
|
||||
Item.AssetID=Asset.Full_ID;
|
||||
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;
|
||||
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);
|
||||
|
@ -95,11 +95,11 @@ 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;
|
||||
Folder.FolderID = newFolder;
|
||||
Folder.OwnerID = userInfo.AgentID;
|
||||
this.Folders.Add(Folder.FolderID, Folder);
|
||||
|
||||
return(true);
|
||||
|
@ -110,7 +110,7 @@ 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)
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ namespace OpenSim
|
|||
|
||||
InventoryFolder Folder = this.Folders[FetchDescend.InventoryData.FolderID];
|
||||
InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
|
||||
Descend.AgentData.AgentID=User_info.AgentID;
|
||||
Descend.AgentData.AgentID = userInfo.AgentID;
|
||||
Descend.AgentData.OwnerID = Folder.OwnerID;
|
||||
Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
|
||||
Descend.AgentData.Descendents = Folder.Items.Count;
|
||||
|
@ -136,14 +136,14 @@ namespace OpenSim
|
|||
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].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].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;
|
||||
|
@ -152,7 +152,7 @@ namespace OpenSim
|
|||
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,7 +166,7 @@ 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++)
|
||||
|
@ -176,7 +176,7 @@ namespace OpenSim
|
|||
|
||||
InventoryItem Item = Items[FetchItems.InventoryData[i].ItemID];
|
||||
FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
|
||||
InventoryReply.AgentData.AgentID=User_info.AgentID;
|
||||
InventoryReply.AgentData.AgentID = userInfo.AgentID;
|
||||
InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
|
||||
InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
|
||||
InventoryReply.InventoryData[0].ItemID = Item.ItemID;
|
||||
|
@ -184,14 +184,14 @@ namespace OpenSim
|
|||
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].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].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;
|
||||
|
@ -199,7 +199,7 @@ namespace OpenSim
|
|||
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);
|
||||
_server.SendPacket(InventoryReply, true, userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,8 @@ namespace OpenSim
|
|||
int contentLength = 0;
|
||||
|
||||
// read HTTP header
|
||||
do {
|
||||
do
|
||||
{
|
||||
// read one line of the header
|
||||
line = reader.ReadLine();
|
||||
|
||||
|
@ -205,8 +206,8 @@ namespace OpenSim
|
|||
//copy data to login object
|
||||
lock(Login)
|
||||
{
|
||||
Login.first=first;
|
||||
Login.last=last;
|
||||
Login.First = first;
|
||||
Login.Last = last;
|
||||
Login.Agent = Agent;
|
||||
Login.Session = Session;
|
||||
Login.BaseFolder = BaseFolderID;
|
||||
|
|
|
@ -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,9 +51,9 @@ namespace OpenSim
|
|||
///
|
||||
/// </summary>
|
||||
/// <param name="serve"></param>
|
||||
public PrimManager(Server serve)
|
||||
public PrimManager(Server server)
|
||||
{
|
||||
server=serve;
|
||||
_server = server;
|
||||
PrimList = new Dictionary<libsecondlife.LLUUID,PrimInfo> ();
|
||||
this.SetupTemplates("objectupate164.dat");
|
||||
|
||||
|
@ -66,56 +65,57 @@ 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.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=add_pack.ObjectData.ProfileHollow;
|
||||
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();
|
||||
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;
|
||||
NewPrim.Position = pos1;
|
||||
NewPrim.Data = PData;
|
||||
|
||||
this.PrimList.Add(NewPrim.FullID, NewPrim);
|
||||
|
||||
|
@ -131,12 +131,12 @@ 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;
|
||||
foreach (KeyValuePair<libsecondlife.LLUUID,PrimInfo> kp in this.PrimList)
|
||||
{
|
||||
if(kp.Value.LocalID==LocalID)
|
||||
if(kp.Value.LocalID == localID)
|
||||
{
|
||||
pri = kp.Value;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ namespace OpenSim
|
|||
bytes[i++] = (byte)((ID >> 16) % 256);
|
||||
bytes[i++] = (byte)((ID >> 24) % 256);
|
||||
bytes[i++]= 0;
|
||||
bytes[i++]=0;//1;
|
||||
bytes[i++]= 0;
|
||||
|
||||
byte[] pb = pos2.GetBytes();
|
||||
pri.Position = pos2;
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ 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;
|
||||
|
@ -329,7 +329,7 @@ namespace OpenSim
|
|||
objupdate.ObjectData[cc] = objdata;
|
||||
start++;
|
||||
}
|
||||
server.SendPacket(objupdate,true,user);
|
||||
_server.SendPacket(objupdate, true, userInfo);
|
||||
line = SR.ReadLine();
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
24
Server.cs
24
Server.cs
|
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue