diff options
Diffstat (limited to '')
-rw-r--r-- | Controller.cs | 89 |
1 files changed, 56 insertions, 33 deletions
diff --git a/Controller.cs b/Controller.cs index f2bd85c..0a6fee9 100644 --- a/Controller.cs +++ b/Controller.cs | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) 2007 Michael Wright | 2 | Copyright (c) OpenSim project, http://sim.opensecondlife.org/ |
3 | |||
3 | 4 | ||
4 | * Copyright (c) <year>, <copyright holder> | ||
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without |
@@ -58,9 +58,10 @@ namespace OpenSim | |||
58 | public Logon _login; | 58 | public Logon _login; |
59 | private AgentManager Agent_Manager; | 59 | private AgentManager Agent_Manager; |
60 | private PrimManager Prim_Manager; | 60 | private PrimManager Prim_Manager; |
61 | private TextureManager Texture_Manager; | 61 | // private TextureManager Texture_Manager; |
62 | private AssetManager Asset_Manager; | 62 | private AssetManagement Asset_Manager; |
63 | private GridManager Grid_Manager; | 63 | private GridManager Grid_Manager; |
64 | private InventoryManager Inventory_Manager; | ||
64 | private LoginManager Login_Manager; //built in login server | 65 | private LoginManager Login_Manager; //built in login server |
65 | private ulong time; //ticks | 66 | private ulong time; //ticks |
66 | private Timer timer1 = new Timer(); | 67 | private Timer timer1 = new Timer(); |
@@ -71,10 +72,14 @@ namespace OpenSim | |||
71 | server = new Server( this ); | 72 | server = new Server( this ); |
72 | Agent_Manager = new AgentManager( this.server ); | 73 | Agent_Manager = new AgentManager( this.server ); |
73 | Prim_Manager = new PrimManager( this.server ); | 74 | Prim_Manager = new PrimManager( this.server ); |
74 | Texture_Manager = new TextureManager( this.server ); | 75 | // Texture_Manager = new TextureManager( this.server ); |
75 | Asset_Manager = new AssetManager( this.server ); | 76 | Asset_Manager = new AssetManagement( this.server ); |
76 | Prim_Manager.Agent_Manager = Agent_Manager; | 77 | Prim_Manager.Agent_Manager = Agent_Manager; |
77 | Agent_Manager.Prim_Manager = Prim_Manager; | 78 | Agent_Manager.Prim_Manager = Prim_Manager; |
79 | Agent_Manager.Asset_Manager=Asset_Manager; | ||
80 | Inventory_Manager=new InventoryManager(this.server); | ||
81 | Asset_Manager.InventoryManager=Inventory_Manager; | ||
82 | // Asset_Manager.TextureMan=Texture_Manager; | ||
78 | Grid_Manager=new GridManager(this.server,Agent_Manager); | 83 | Grid_Manager=new GridManager(this.server,Agent_Manager); |
79 | if(Globals.Instance.LoginSever) | 84 | if(Globals.Instance.LoginSever) |
80 | { | 85 | { |
@@ -89,80 +94,93 @@ namespace OpenSim | |||
89 | 94 | ||
90 | } | 95 | } |
91 | public void MainCallback( Packet pack, User_Agent_info User_info ) { | 96 | public void MainCallback( Packet pack, User_Agent_info User_info ) { |
92 | //System.Console.WriteLine(pack.Type); | 97 | |
93 | if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) { | 98 | /*if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) { |
94 | // System.Console.WriteLine(pack.Type); | 99 | //Log packet? |
100 | // System.Console.WriteLine(pack.Type); | ||
95 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; | 101 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; |
96 | } | 102 | }*/ |
103 | |||
104 | //should replace with a switch | ||
97 | if( pack.Type == PacketType.AgentSetAppearance ) { | 105 | if( pack.Type == PacketType.AgentSetAppearance ) { |
98 | // System.Console.WriteLine(pack); | 106 | // System.Console.WriteLine(pack); |
99 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; | 107 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; |
100 | 108 | ||
101 | } | 109 | } |
102 | if(pack.Type== PacketType.MapBlockRequest) | 110 | else if( pack.Type == PacketType.FetchInventory) |
111 | { | ||
112 | FetchInventoryPacket FetchInventory=(FetchInventoryPacket)pack; | ||
113 | Inventory_Manager.FetchInventory(User_info,FetchInventory); | ||
114 | } | ||
115 | else if( pack.Type == PacketType.FetchInventoryDescendents) | ||
116 | { | ||
117 | FetchInventoryDescendentsPacket Fetch=(FetchInventoryDescendentsPacket)pack; | ||
118 | Inventory_Manager.FetchInventoryDescendents(User_info,Fetch); | ||
119 | } | ||
120 | else if(pack.Type== PacketType.MapBlockRequest) | ||
103 | { | 121 | { |
104 | //int MinX, MinY, MaxX, MaxY; | 122 | //int MinX, MinY, MaxX, MaxY; |
105 | MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack; | 123 | MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack; |
106 | this.Grid_Manager.RequestMapBlock(User_info,MapRequest.PositionData.MinX,MapRequest.PositionData.MinY,MapRequest.PositionData.MaxX,MapRequest.PositionData.MaxY); | 124 | this.Grid_Manager.RequestMapBlock(User_info,MapRequest.PositionData.MinX,MapRequest.PositionData.MinY,MapRequest.PositionData.MaxX,MapRequest.PositionData.MaxY); |
107 | 125 | ||
108 | } | 126 | } |
109 | if(pack.Type== PacketType.CloseCircuit) | 127 | else if(pack.Type== PacketType.CloseCircuit) |
110 | { | 128 | { |
111 | this.Agent_Manager.RemoveAgent(User_info); | 129 | this.Agent_Manager.RemoveAgent(User_info); |
112 | } | 130 | } |
113 | if(pack.Type== PacketType.MapLayerRequest) | 131 | else if(pack.Type== PacketType.MapLayerRequest) |
114 | { | 132 | { |
115 | this.Grid_Manager.RequestMapLayer(User_info); | 133 | this.Grid_Manager.RequestMapLayer(User_info); |
116 | 134 | ||
117 | } | 135 | } |
118 | if((pack.Type== PacketType.TeleportRequest ) ||(pack.Type== PacketType.TeleportLocationRequest)) | 136 | else if((pack.Type== PacketType.TeleportRequest ) ||(pack.Type== PacketType.TeleportLocationRequest)) |
119 | { | 137 | { |
120 | TeleportLocationRequestPacket Request=(TeleportLocationRequestPacket)pack; | 138 | TeleportLocationRequestPacket Request=(TeleportLocationRequestPacket)pack; |
121 | 139 | ||
122 | this.Grid_Manager.RequestTeleport(User_info,Request); | 140 | this.Grid_Manager.RequestTeleport(User_info,Request); |
123 | 141 | ||
124 | } | 142 | } |
125 | if( pack.Type == PacketType.TransferRequest ) { | 143 | else if( pack.Type == PacketType.TransferRequest ) { |
126 | TransferRequestPacket tran = (TransferRequestPacket)pack; | 144 | TransferRequestPacket tran = (TransferRequestPacket)pack; |
127 | LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 ); | 145 | LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 ); |
128 | 146 | ||
129 | if( ( id == new LLUUID( "66c41e39-38f9-f75a-024e-585989bfab73" ) ) || ( id == new LLUUID( "e0ee49b5a4184df8d3c9a65361fe7f49" ) ) ) { | 147 | // if( ( id == new LLUUID( "66c41e39-38f9-f75a-024e-585989bfab73" ) ) || ( id == new LLUUID( "e0ee49b5a4184df8d3c9a65361fe7f49" ) ) ) { |
130 | Asset_Manager.AddRequest( User_info, id, tran ); | 148 | Asset_Manager.AddAssetRequest( User_info, id, tran ); |
131 | } | 149 | // } |
132 | 150 | ||
133 | } | 151 | } |
134 | if( ( pack.Type == PacketType.StartPingCheck ) ) { | 152 | else if( ( pack.Type == PacketType.StartPingCheck ) ) { |
135 | //reply to pingcheck | 153 | //reply to pingcheck |
136 | libsecondlife.Packets.StartPingCheckPacket startp = (libsecondlife.Packets.StartPingCheckPacket)pack; | 154 | libsecondlife.Packets.StartPingCheckPacket startp = (libsecondlife.Packets.StartPingCheckPacket)pack; |
137 | libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket(); | 155 | libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket(); |
138 | endping.PingID.PingID = startp.PingID.PingID; | 156 | endping.PingID.PingID = startp.PingID.PingID; |
139 | server.SendPacket( endping, true, User_info ); | 157 | server.SendPacket( endping, true, User_info ); |
140 | } | 158 | } |
141 | if( pack.Type == PacketType.CompleteAgentMovement ) { | 159 | else if( pack.Type == PacketType.CompleteAgentMovement ) { |
142 | // new client | 160 | // new client |
143 | Agent_Manager.AgentJoin( User_info ); | 161 | Agent_Manager.AgentJoin( User_info ); |
144 | } | 162 | } |
145 | if( pack.Type == PacketType.RequestImage ) { | 163 | else if( pack.Type == PacketType.RequestImage ) { |
146 | RequestImagePacket image_req = (RequestImagePacket)pack; | 164 | RequestImagePacket image_req = (RequestImagePacket)pack; |
147 | for( int i = 0; i < image_req.RequestImage.Length; i++ ) { | 165 | for( int i = 0; i < image_req.RequestImage.Length; i++ ) { |
148 | this.Texture_Manager.AddRequest( User_info, image_req.RequestImage[ i ].Image ); | 166 | this.Asset_Manager.AddTextureRequest( User_info, image_req.RequestImage[ i ].Image ); |
149 | 167 | ||
150 | } | 168 | } |
151 | } | 169 | } |
152 | if( pack.Type == PacketType.RegionHandshakeReply ) { | 170 | else if( pack.Type == PacketType.RegionHandshakeReply ) { |
153 | //recieved regionhandshake so can now start sending info | 171 | //recieved regionhandshake so can now start sending info |
154 | Agent_Manager.SendInitialData( User_info ); | 172 | Agent_Manager.SendInitialData( User_info ); |
155 | //this.setuptemplates("objectupate164.dat",User_info,false); | 173 | //this.setuptemplates("objectupate164.dat",User_info,false); |
156 | } | 174 | } |
157 | if( pack.Type == PacketType.ObjectAdd ) { | 175 | else if( pack.Type == PacketType.ObjectAdd ) { |
158 | ObjectAddPacket ad = (ObjectAddPacket)pack; | 176 | ObjectAddPacket ad = (ObjectAddPacket)pack; |
159 | Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad ); | 177 | Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad ); |
160 | //this.send_prim(User_info,ad.ObjectData.RayEnd, ad); | 178 | //this.send_prim(User_info,ad.ObjectData.RayEnd, ad); |
161 | } | 179 | } |
162 | if( pack.Type == PacketType.ObjectPosition ) { | 180 | else if( pack.Type == PacketType.ObjectPosition ) { |
163 | //System.Console.WriteLine(pack.ToString()); | 181 | //System.Console.WriteLine(pack.ToString()); |
164 | } | 182 | } |
165 | if( pack.Type == PacketType.MultipleObjectUpdate ) { | 183 | else if( pack.Type == PacketType.MultipleObjectUpdate ) { |
166 | //System.Console.WriteLine(pack.ToString()); | 184 | //System.Console.WriteLine(pack.ToString()); |
167 | MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack; | 185 | MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack; |
168 | 186 | ||
@@ -185,11 +203,12 @@ namespace OpenSim | |||
185 | } | 203 | } |
186 | } | 204 | } |
187 | } | 205 | } |
188 | if( pack.Type == PacketType.AgentWearablesRequest ) { | 206 | else if( pack.Type == PacketType.AgentWearablesRequest ) { |
189 | Agent_Manager.SendIntialAvatarAppearance( User_info ); | 207 | Agent_Manager.SendIntialAvatarAppearance( User_info ); |
190 | } | 208 | } |
191 | 209 | ||
192 | if( pack.Type == PacketType.AgentUpdate ) { | 210 | else if( pack.Type == PacketType.AgentUpdate ) |
211 | { | ||
193 | AgentUpdatePacket ag = (AgentUpdatePacket)pack; | 212 | AgentUpdatePacket ag = (AgentUpdatePacket)pack; |
194 | uint mask = ag.AgentData.ControlFlags & ( 1 ); | 213 | uint mask = ag.AgentData.ControlFlags & ( 1 ); |
195 | AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID ); | 214 | AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID ); |
@@ -224,8 +243,7 @@ namespace OpenSim | |||
224 | } | 243 | } |
225 | } | 244 | } |
226 | } | 245 | } |
227 | 246 | else if( pack.Type == PacketType.ChatFromViewer ) { | |
228 | if( pack.Type == PacketType.ChatFromViewer ) { | ||
229 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; | 247 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; |
230 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 248 | System.Text.Encoding enc = System.Text.Encoding.ASCII; |
231 | 249 | ||
@@ -252,14 +270,17 @@ namespace OpenSim | |||
252 | public void NewUserCallback( User_Agent_info UserInfo ) { | 270 | public void NewUserCallback( User_Agent_info UserInfo ) { |
253 | Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode); | 271 | Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode); |
254 | string first,last; | 272 | string first,last; |
273 | LLUUID Base,Inventory; | ||
255 | lock(_login) | 274 | lock(_login) |
256 | { | 275 | { |
257 | first=_login.first; | 276 | first=_login.first; |
258 | last=_login.last; | 277 | last=_login.last; |
278 | Base=_login.BaseFolder; | ||
279 | Inventory=_login.InventoryFolder; | ||
259 | 280 | ||
260 | //should get agentid and sessionid so they can be checked. | 281 | //should get agentid and sessionid so they can be checked. |
261 | } | 282 | } |
262 | Agent_Manager.NewAgent( UserInfo ,first,last); | 283 | Agent_Manager.NewAgent( UserInfo ,first,last,Base,Inventory); |
263 | //now because of the lack of Global account management (User server etc) | 284 | //now because of the lack of Global account management (User server etc) |
264 | //we need to reset the names back to default incase a teleport happens | 285 | //we need to reset the names back to default incase a teleport happens |
265 | //which will not have a Login name set, so they will use default names | 286 | //which will not have a Login name set, so they will use default names |
@@ -277,7 +298,7 @@ namespace OpenSim | |||
277 | void Timer1Tick( object sender, System.EventArgs e ) { | 298 | void Timer1Tick( object sender, System.EventArgs e ) { |
278 | this.time++; | 299 | this.time++; |
279 | Agent_Manager.UpdatePositions(); | 300 | Agent_Manager.UpdatePositions(); |
280 | Texture_Manager.DoWork( time ); | 301 | this.Asset_Manager.DoWork( time ); |
281 | } | 302 | } |
282 | } | 303 | } |
283 | public class Logon | 304 | public class Logon |
@@ -286,6 +307,8 @@ namespace OpenSim | |||
286 | public string last="User"; | 307 | public string last="User"; |
287 | public LLUUID Agent; | 308 | public LLUUID Agent; |
288 | public LLUUID Session; | 309 | public LLUUID Session; |
310 | public LLUUID InventoryFolder; | ||
311 | public LLUUID BaseFolder; | ||
289 | public Logon() | 312 | public Logon() |
290 | { | 313 | { |
291 | 314 | ||