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