diff options
author | MW | 2007-02-03 21:09:54 +0000 |
---|---|---|
committer | MW | 2007-02-03 21:09:54 +0000 |
commit | dc2316de9c7a7168263e7a367b4c69189f9bc232 (patch) | |
tree | 57b639a77d585f5ded98f283d24a02617faf5b1a /Controller.cs | |
parent | (no commit message) (diff) | |
download | opensim-SC-dc2316de9c7a7168263e7a367b4c69189f9bc232.zip opensim-SC-dc2316de9c7a7168263e7a367b4c69189f9bc232.tar.gz opensim-SC-dc2316de9c7a7168263e7a367b4c69189f9bc232.tar.bz2 opensim-SC-dc2316de9c7a7168263e7a367b4c69189f9bc232.tar.xz |
Basic Inventory support and clean up
Diffstat (limited to '')
-rw-r--r-- | Controller.cs | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/Controller.cs b/Controller.cs index 0a6fee9..3ace638 100644 --- a/Controller.cs +++ b/Controller.cs | |||
@@ -58,7 +58,6 @@ 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; | ||
62 | private AssetManagement Asset_Manager; | 61 | private AssetManagement Asset_Manager; |
63 | private GridManager Grid_Manager; | 62 | private GridManager Grid_Manager; |
64 | private InventoryManager Inventory_Manager; | 63 | private InventoryManager Inventory_Manager; |
@@ -72,21 +71,21 @@ namespace OpenSim | |||
72 | server = new Server( this ); | 71 | server = new Server( this ); |
73 | Agent_Manager = new AgentManager( this.server ); | 72 | Agent_Manager = new AgentManager( this.server ); |
74 | Prim_Manager = new PrimManager( this.server ); | 73 | Prim_Manager = new PrimManager( this.server ); |
75 | // Texture_Manager = new TextureManager( this.server ); | ||
76 | Asset_Manager = new AssetManagement( this.server ); | 74 | Asset_Manager = new AssetManagement( this.server ); |
77 | Prim_Manager.Agent_Manager = Agent_Manager; | 75 | Prim_Manager.Agent_Manager = Agent_Manager; |
78 | Agent_Manager.Prim_Manager = Prim_Manager; | 76 | Agent_Manager.Prim_Manager = Prim_Manager; |
79 | Agent_Manager.Asset_Manager=Asset_Manager; | 77 | Agent_Manager.Asset_Manager=Asset_Manager; |
80 | Inventory_Manager=new InventoryManager(this.server); | 78 | Inventory_Manager=new InventoryManager(this.server); |
81 | Asset_Manager.InventoryManager=Inventory_Manager; | 79 | Asset_Manager.InventoryManager=Inventory_Manager; |
82 | // Asset_Manager.TextureMan=Texture_Manager; | ||
83 | Grid_Manager=new GridManager(this.server,Agent_Manager); | 80 | Grid_Manager=new GridManager(this.server,Agent_Manager); |
81 | |||
84 | if(Globals.Instance.LoginSever) | 82 | if(Globals.Instance.LoginSever) |
85 | { | 83 | { |
86 | Console.WriteLine("Starting login Server"); | 84 | Console.WriteLine("Starting login Server"); |
87 | Login_Manager = new LoginManager(_login); // startup | 85 | Login_Manager = new LoginManager(_login); // startup |
88 | Login_Manager.Startup(); // login server | 86 | Login_Manager.Startup(); // login server |
89 | } | 87 | } |
88 | |||
90 | timer1.Enabled = true; | 89 | timer1.Enabled = true; |
91 | timer1.Interval = 200; | 90 | timer1.Interval = 200; |
92 | timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); | 91 | timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); |
@@ -103,7 +102,7 @@ namespace OpenSim | |||
103 | 102 | ||
104 | //should replace with a switch | 103 | //should replace with a switch |
105 | if( pack.Type == PacketType.AgentSetAppearance ) { | 104 | if( pack.Type == PacketType.AgentSetAppearance ) { |
106 | // System.Console.WriteLine(pack); | 105 | //System.Console.WriteLine(pack); |
107 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; | 106 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; |
108 | 107 | ||
109 | } | 108 | } |
@@ -142,11 +141,8 @@ namespace OpenSim | |||
142 | } | 141 | } |
143 | else if( pack.Type == PacketType.TransferRequest ) { | 142 | else if( pack.Type == PacketType.TransferRequest ) { |
144 | TransferRequestPacket tran = (TransferRequestPacket)pack; | 143 | TransferRequestPacket tran = (TransferRequestPacket)pack; |
145 | LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 ); | 144 | LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 ); |
146 | 145 | Asset_Manager.AddAssetRequest( User_info, id, tran ); | |
147 | // if( ( id == new LLUUID( "66c41e39-38f9-f75a-024e-585989bfab73" ) ) || ( id == new LLUUID( "e0ee49b5a4184df8d3c9a65361fe7f49" ) ) ) { | ||
148 | Asset_Manager.AddAssetRequest( User_info, id, tran ); | ||
149 | // } | ||
150 | 146 | ||
151 | } | 147 | } |
152 | else if( ( pack.Type == PacketType.StartPingCheck ) ) { | 148 | else if( ( pack.Type == PacketType.StartPingCheck ) ) { |
@@ -156,23 +152,26 @@ namespace OpenSim | |||
156 | endping.PingID.PingID = startp.PingID.PingID; | 152 | endping.PingID.PingID = startp.PingID.PingID; |
157 | server.SendPacket( endping, true, User_info ); | 153 | server.SendPacket( endping, true, User_info ); |
158 | } | 154 | } |
159 | else if( pack.Type == PacketType.CompleteAgentMovement ) { | 155 | else if( pack.Type == PacketType.CompleteAgentMovement ) |
156 | { | ||
160 | // new client | 157 | // new client |
161 | Agent_Manager.AgentJoin( User_info ); | 158 | Agent_Manager.AgentJoin( User_info ); |
162 | } | 159 | } |
163 | else if( pack.Type == PacketType.RequestImage ) { | 160 | else if( pack.Type == PacketType.RequestImage ) |
161 | { | ||
164 | RequestImagePacket image_req = (RequestImagePacket)pack; | 162 | RequestImagePacket image_req = (RequestImagePacket)pack; |
165 | for( int i = 0; i < image_req.RequestImage.Length; i++ ) { | 163 | for( int i = 0; i < image_req.RequestImage.Length; i++ ) |
164 | { | ||
166 | this.Asset_Manager.AddTextureRequest( User_info, image_req.RequestImage[ i ].Image ); | 165 | this.Asset_Manager.AddTextureRequest( User_info, image_req.RequestImage[ i ].Image ); |
167 | |||
168 | } | 166 | } |
169 | } | 167 | } |
170 | else if( pack.Type == PacketType.RegionHandshakeReply ) { | 168 | else if( pack.Type == PacketType.RegionHandshakeReply ) { |
171 | //recieved regionhandshake so can now start sending info | 169 | //recieved regionhandshake so can now start sending info |
172 | Agent_Manager.SendInitialData( User_info ); | 170 | Agent_Manager.SendInitialData( User_info ); |
173 | //this.setuptemplates("objectupate164.dat",User_info,false); | 171 | //this.setuptemplates("objectupate164.dat",User_info,false); |
174 | } | 172 | } |
175 | else if( pack.Type == PacketType.ObjectAdd ) { | 173 | else if( pack.Type == PacketType.ObjectAdd ) |
174 | { | ||
176 | ObjectAddPacket ad = (ObjectAddPacket)pack; | 175 | ObjectAddPacket ad = (ObjectAddPacket)pack; |
177 | Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad ); | 176 | Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad ); |
178 | //this.send_prim(User_info,ad.ObjectData.RayEnd, ad); | 177 | //this.send_prim(User_info,ad.ObjectData.RayEnd, ad); |
@@ -184,7 +183,8 @@ namespace OpenSim | |||
184 | //System.Console.WriteLine(pack.ToString()); | 183 | //System.Console.WriteLine(pack.ToString()); |
185 | MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack; | 184 | MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack; |
186 | 185 | ||
187 | for( int i = 0; i < mupd.ObjectData.Length; i++ ) { | 186 | for( int i = 0; i < mupd.ObjectData.Length; i++ ) |
187 | { | ||
188 | if( mupd.ObjectData[ i ].Type == 9 ) //change position | 188 | if( mupd.ObjectData[ i ].Type == 9 ) //change position |
189 | { | 189 | { |
190 | libsecondlife.LLVector3 pos = new LLVector3( mupd.ObjectData[ i ].Data, 0 ); | 190 | libsecondlife.LLVector3 pos = new LLVector3( mupd.ObjectData[ i ].Data, 0 ); |
@@ -203,19 +203,23 @@ namespace OpenSim | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | else if( pack.Type == PacketType.AgentWearablesRequest ) { | 206 | else if( pack.Type == PacketType.AgentWearablesRequest ) |
207 | { | ||
207 | Agent_Manager.SendIntialAvatarAppearance( User_info ); | 208 | Agent_Manager.SendIntialAvatarAppearance( User_info ); |
208 | } | 209 | } |
209 | |||
210 | else if( pack.Type == PacketType.AgentUpdate ) | 210 | else if( pack.Type == PacketType.AgentUpdate ) |
211 | { | 211 | { |
212 | AgentUpdatePacket ag = (AgentUpdatePacket)pack; | 212 | AgentUpdatePacket ag = (AgentUpdatePacket)pack; |
213 | uint mask = ag.AgentData.ControlFlags & ( 1 ); | 213 | uint mask = ag.AgentData.ControlFlags & ( 1 ); |
214 | AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID ); | 214 | AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID ); |
215 | if( m_av != null ) { | 215 | if( m_av != null ) |
216 | if( m_av.Started ) { | 216 | { |
217 | if( mask == ( 1 ) ) { | 217 | if( m_av.Started ) |
218 | if( !m_av.Walk ) { | 218 | { |
219 | if( mask == ( 1 ) ) | ||
220 | { | ||
221 | if( !m_av.Walk ) | ||
222 | { | ||
219 | //start walking | 223 | //start walking |
220 | Agent_Manager.SendMoveCommand( User_info, false, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation ); | 224 | Agent_Manager.SendMoveCommand( User_info, false, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation ); |
221 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 ); | 225 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 ); |
@@ -230,8 +234,10 @@ namespace OpenSim | |||
230 | m_av.Walk = true; | 234 | m_av.Walk = true; |
231 | } | 235 | } |
232 | } | 236 | } |
233 | else { | 237 | else |
234 | if( m_av.Walk ) { | 238 | { |
239 | if( m_av.Walk ) | ||
240 | { | ||
235 | //walking but key not pressed so need to stop | 241 | //walking but key not pressed so need to stop |
236 | Agent_Manager.SendMoveCommand( User_info, true, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation ); | 242 | Agent_Manager.SendMoveCommand( User_info, true, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation ); |
237 | m_av.Walk = false; | 243 | m_av.Walk = false; |
@@ -243,7 +249,8 @@ namespace OpenSim | |||
243 | } | 249 | } |
244 | } | 250 | } |
245 | } | 251 | } |
246 | else if( pack.Type == PacketType.ChatFromViewer ) { | 252 | else if( pack.Type == PacketType.ChatFromViewer ) |
253 | { | ||
247 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; | 254 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; |
248 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 255 | System.Text.Encoding enc = System.Text.Encoding.ASCII; |
249 | 256 | ||
@@ -256,21 +263,25 @@ namespace OpenSim | |||
256 | 263 | ||
257 | line = myString; | 264 | line = myString; |
258 | comp = line.Split( delimiter ); | 265 | comp = line.Split( delimiter ); |
259 | if( comp[ 0 ] == "pos" ) { | 266 | if( comp[ 0 ] == "pos" ) |
267 | { | ||
260 | } | 268 | } |
261 | else if( comp[ 0 ] == "veloc" ) { | 269 | else if( comp[ 0 ] == "veloc" ) |
270 | { | ||
262 | } | 271 | } |
263 | else { | 272 | else |
273 | { | ||
264 | Agent_Manager.SendChatMessage( User_info, line ); | 274 | Agent_Manager.SendChatMessage( User_info, line ); |
265 | 275 | ||
266 | } | 276 | } |
267 | } | 277 | } |
268 | } | 278 | } |
269 | } | 279 | } |
270 | public void NewUserCallback( User_Agent_info UserInfo ) { | 280 | public void NewUserCallback( User_Agent_info UserInfo ) |
281 | { | ||
271 | Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode); | 282 | Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode); |
272 | string first,last; | 283 | string first,last; |
273 | LLUUID Base,Inventory; | 284 | LLUUID Base,Inventory; |
274 | lock(_login) | 285 | lock(_login) |
275 | { | 286 | { |
276 | first=_login.first; | 287 | first=_login.first; |