diff options
author | MW | 2007-02-04 11:36:35 +0000 |
---|---|---|
committer | MW | 2007-02-04 11:36:35 +0000 |
commit | 8c80d98252f376a815e522c705a3c576dfc16f75 (patch) | |
tree | 89e779435d3e9ea2a58b814d81a64e44e4067cc6 | |
parent | Basic Inventory support and clean up (diff) | |
download | opensim-SC_OLD-8c80d98252f376a815e522c705a3c576dfc16f75.zip opensim-SC_OLD-8c80d98252f376a815e522c705a3c576dfc16f75.tar.gz opensim-SC_OLD-8c80d98252f376a815e522c705a3c576dfc16f75.tar.bz2 opensim-SC_OLD-8c80d98252f376a815e522c705a3c576dfc16f75.tar.xz |
Clean up
-rw-r--r-- | Agent_Manager.cs | 480 | ||||
-rw-r--r-- | AssetManagement.cs | 299 | ||||
-rw-r--r-- | Controller.cs | 228 | ||||
-rw-r--r-- | Globals.cs | 20 | ||||
-rw-r--r-- | GridManager.cs | 226 | ||||
-rw-r--r-- | InventoryManager.cs | 172 | ||||
-rw-r--r-- | Login_manager.cs | 65 | ||||
-rw-r--r-- | Prim_manager.cs | 236 | ||||
-rw-r--r-- | Script_manager.cs | 4 | ||||
-rw-r--r-- | Second-server.sln | 2 | ||||
-rw-r--r-- | Server.cs | 24 |
11 files changed, 867 insertions, 889 deletions
diff --git a/Agent_Manager.cs b/Agent_Manager.cs index 769ee2a..5ff40cd 100644 --- a/Agent_Manager.cs +++ b/Agent_Manager.cs | |||
@@ -41,23 +41,23 @@ namespace OpenSim | |||
41 | { | 41 | { |
42 | public Dictionary<libsecondlife.LLUUID,AvatarData> AgentList; | 42 | public Dictionary<libsecondlife.LLUUID,AvatarData> AgentList; |
43 | 43 | ||
44 | private uint local_numer=0; | 44 | private uint _localNumber=0; |
45 | private Server server; | 45 | private Server _server; |
46 | public PrimManager Prim_Manager; | 46 | public PrimManager Prim_Manager; |
47 | public AssetManagement Asset_Manager; | 47 | public AssetManagement assetManager; |
48 | 48 | ||
49 | private libsecondlife.Packets.RegionHandshakePacket RegionPacket; | 49 | private libsecondlife.Packets.RegionHandshakePacket RegionPacket; |
50 | private System.Text.Encoding enc = System.Text.Encoding.ASCII; | 50 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
51 | public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | 51 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// | 54 | /// |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="serve"></param> | 56 | /// <param name="serve"></param> |
57 | public AgentManager(Server serve) | 57 | public AgentManager(Server server) |
58 | { | 58 | { |
59 | AgentList=new Dictionary<libsecondlife.LLUUID,AvatarData>(); | 59 | AgentList = new Dictionary<libsecondlife.LLUUID,AvatarData>(); |
60 | server=serve; | 60 | _server = server; |
61 | this.initialise(); | 61 | this.initialise(); |
62 | } | 62 | } |
63 | 63 | ||
@@ -74,8 +74,8 @@ namespace OpenSim | |||
74 | } | 74 | } |
75 | else | 75 | else |
76 | { | 76 | { |
77 | AvatarData ad=this.AgentList[id]; | 77 | AvatarData avatar = this.AgentList[id]; |
78 | return ad; | 78 | return avatar; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | /// <summary> | 81 | /// <summary> |
@@ -84,7 +84,7 @@ namespace OpenSim | |||
84 | /// <param name="agent"></param> | 84 | /// <param name="agent"></param> |
85 | public void AddAgent(AvatarData agent) | 85 | public void AddAgent(AvatarData agent) |
86 | { | 86 | { |
87 | this.AgentList.Add(agent.FullID,agent); | 87 | this.AgentList.Add(agent.FullID, agent); |
88 | } | 88 | } |
89 | /// <summary> | 89 | /// <summary> |
90 | /// | 90 | /// |
@@ -102,20 +102,20 @@ namespace OpenSim | |||
102 | /// <param name="first"></param> | 102 | /// <param name="first"></param> |
103 | /// <param name="last"></param> | 103 | /// <param name="last"></param> |
104 | /// <returns></returns> | 104 | /// <returns></returns> |
105 | public bool NewAgent(User_Agent_info User_info, string first, string last ,LLUUID BaseFolder,LLUUID InventoryFolder) | 105 | public bool NewAgent(UserAgentInfo userInfo, string first, string last, LLUUID baseFolder, LLUUID inventoryFolder) |
106 | { | 106 | { |
107 | AvatarData agent=new AvatarData(); | 107 | AvatarData agent = new AvatarData(); |
108 | agent.FullID=User_info.AgentID; | 108 | agent.FullID = userInfo.AgentID; |
109 | agent.NetInfo=User_info; | 109 | agent.NetInfo = userInfo; |
110 | agent.NetInfo.first_name=first; | 110 | agent.NetInfo.first_name =first; |
111 | agent.NetInfo.last_name=last; | 111 | agent.NetInfo.last_name = last; |
112 | agent.Position=new LLVector3(100,100,22); | 112 | agent.Position = new LLVector3(100, 100, 22); |
113 | agent.BaseFolder=BaseFolder; | 113 | agent.BaseFolder = baseFolder; |
114 | agent.InventoryFolder=InventoryFolder; | 114 | agent.InventoryFolder = inventoryFolder; |
115 | this.AgentList.Add(agent.FullID,agent); | 115 | this.AgentList.Add(agent.FullID, agent); |
116 | 116 | ||
117 | //Create new Wearable Assets and place in Inventory | 117 | //Create new Wearable Assets and place in Inventory |
118 | this.Asset_Manager.CreateNewInventorySet(ref agent,User_info); | 118 | this.assetManager.CreateNewInventorySet(ref agent, userInfo); |
119 | 119 | ||
120 | return(true); | 120 | return(true); |
121 | } | 121 | } |
@@ -124,9 +124,9 @@ namespace OpenSim | |||
124 | /// | 124 | /// |
125 | /// </summary> | 125 | /// </summary> |
126 | /// <param name="UserInfo"></param> | 126 | /// <param name="UserInfo"></param> |
127 | public void RemoveAgent(User_Agent_info UserInfo) | 127 | public void RemoveAgent(UserAgentInfo userInfo) |
128 | { | 128 | { |
129 | this.AgentList.Remove(UserInfo.AgentID); | 129 | this.AgentList.Remove(userInfo.AgentID); |
130 | 130 | ||
131 | //tell other clients to delete this avatar | 131 | //tell other clients to delete this avatar |
132 | } | 132 | } |
@@ -135,20 +135,20 @@ namespace OpenSim | |||
135 | /// | 135 | /// |
136 | /// </summary> | 136 | /// </summary> |
137 | /// <param name="User_info"></param> | 137 | /// <param name="User_info"></param> |
138 | public void AgentJoin(User_Agent_info User_info) | 138 | public void AgentJoin(UserAgentInfo userInfo) |
139 | { | 139 | { |
140 | //send region data | 140 | //send region data |
141 | server.SendPacket(RegionPacket,true,User_info); | 141 | _server.SendPacket(RegionPacket,true, userInfo); |
142 | 142 | ||
143 | //inform client of join comlete | 143 | //inform client of join comlete |
144 | libsecondlife.Packets.AgentMovementCompletePacket mov=new AgentMovementCompletePacket(); | 144 | libsecondlife.Packets.AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); |
145 | mov.AgentData.SessionID=User_info.SessionID; | 145 | mov.AgentData.SessionID = userInfo.SessionID; |
146 | mov.AgentData.AgentID=User_info.AgentID; | 146 | mov.AgentData.AgentID = userInfo.AgentID; |
147 | mov.Data.RegionHandle=Globals.Instance.RegionHandle; | 147 | mov.Data.RegionHandle = Globals.Instance.RegionHandle; |
148 | mov.Data.Timestamp=1169838966; | 148 | mov.Data.Timestamp = 1169838966; |
149 | mov.Data.Position=new LLVector3(100f,100f,22f); | 149 | mov.Data.Position = new LLVector3(100f, 100f, 22f); |
150 | mov.Data.LookAt=new LLVector3(0.99f,0.042f,0); | 150 | mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); |
151 | server.SendPacket(mov,true,User_info); | 151 | _server.SendPacket(mov, true, userInfo); |
152 | } | 152 | } |
153 | 153 | ||
154 | /// <summary> | 154 | /// <summary> |
@@ -157,12 +157,12 @@ namespace OpenSim | |||
157 | public void UpdatePositions() | 157 | public void UpdatePositions() |
158 | { | 158 | { |
159 | //update positions | 159 | //update positions |
160 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList) | 160 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) |
161 | { | 161 | { |
162 | 162 | ||
163 | kp.Value.Position.X+=(kp.Value.Velocity.X*0.2f); | 163 | kp.Value.Position.X += (kp.Value.Velocity.X * 0.2f); |
164 | kp.Value.Position.Y+=(kp.Value.Velocity.Y*0.2f); | 164 | kp.Value.Position.Y += (kp.Value.Velocity.Y * 0.2f); |
165 | kp.Value.Position.Z+=(kp.Value.Velocity.Z*0.2f); | 165 | kp.Value.Position.Z += (kp.Value.Velocity.Z * 0.2f); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
@@ -172,31 +172,31 @@ namespace OpenSim | |||
172 | private void initialise() | 172 | private void initialise() |
173 | { | 173 | { |
174 | //Region data | 174 | //Region data |
175 | RegionPacket=new RegionHandshakePacket(); | 175 | RegionPacket = new RegionHandshakePacket(); |
176 | RegionPacket.RegionInfo.BillableFactor=0; | 176 | RegionPacket.RegionInfo.BillableFactor = 0; |
177 | RegionPacket.RegionInfo.IsEstateManager=false; | 177 | RegionPacket.RegionInfo.IsEstateManager = false; |
178 | RegionPacket.RegionInfo.TerrainHeightRange00=60; | 178 | RegionPacket.RegionInfo.TerrainHeightRange00 = 60; |
179 | RegionPacket.RegionInfo.TerrainHeightRange01=60; | 179 | RegionPacket.RegionInfo.TerrainHeightRange01 = 60; |
180 | RegionPacket.RegionInfo.TerrainHeightRange10=60; | 180 | RegionPacket.RegionInfo.TerrainHeightRange10 = 60; |
181 | RegionPacket.RegionInfo.TerrainHeightRange11=60; | 181 | RegionPacket.RegionInfo.TerrainHeightRange11 = 60; |
182 | RegionPacket.RegionInfo.TerrainStartHeight00=20; | 182 | RegionPacket.RegionInfo.TerrainStartHeight00 = 20; |
183 | RegionPacket.RegionInfo.TerrainStartHeight01=20; | 183 | RegionPacket.RegionInfo.TerrainStartHeight01 = 20; |
184 | RegionPacket.RegionInfo.TerrainStartHeight10=20; | 184 | RegionPacket.RegionInfo.TerrainStartHeight10 = 20; |
185 | RegionPacket.RegionInfo.TerrainStartHeight11=20; | 185 | RegionPacket.RegionInfo.TerrainStartHeight11 = 20; |
186 | RegionPacket.RegionInfo.SimAccess=13; | 186 | RegionPacket.RegionInfo.SimAccess = 13; |
187 | RegionPacket.RegionInfo.WaterHeight=5; | 187 | RegionPacket.RegionInfo.WaterHeight = 5; |
188 | RegionPacket.RegionInfo.RegionFlags=72458694; | 188 | RegionPacket.RegionInfo.RegionFlags = 72458694; |
189 | RegionPacket.RegionInfo.SimName=enc.GetBytes( Globals.Instance.RegionName); | 189 | RegionPacket.RegionInfo.SimName = _enc.GetBytes( Globals.Instance.RegionName); |
190 | RegionPacket.RegionInfo.SimOwner=new LLUUID("00000000-0000-0000-0000-000000000000"); | 190 | RegionPacket.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); |
191 | RegionPacket.RegionInfo.TerrainBase0=new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | 191 | RegionPacket.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); |
192 | RegionPacket.RegionInfo.TerrainBase1=new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); | 192 | RegionPacket.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); |
193 | RegionPacket.RegionInfo.TerrainBase2=new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); | 193 | RegionPacket.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); |
194 | RegionPacket.RegionInfo.TerrainBase3=new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); | 194 | RegionPacket.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); |
195 | RegionPacket.RegionInfo.TerrainDetail0=new LLUUID("00000000-0000-0000-0000-000000000000"); | 195 | RegionPacket.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); |
196 | RegionPacket.RegionInfo.TerrainDetail1=new LLUUID("00000000-0000-0000-0000-000000000000"); | 196 | RegionPacket.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); |
197 | RegionPacket.RegionInfo.TerrainDetail2=new LLUUID("00000000-0000-0000-0000-000000000000"); | 197 | RegionPacket.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); |
198 | RegionPacket.RegionInfo.TerrainDetail3=new LLUUID("00000000-0000-0000-0000-000000000000"); | 198 | RegionPacket.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); |
199 | RegionPacket.RegionInfo.CacheID=new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); | 199 | RegionPacket.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); |
200 | 200 | ||
201 | this.SetupTemplate("objectupate168.dat"); | 201 | this.SetupTemplate("objectupate168.dat"); |
202 | } | 202 | } |
@@ -208,7 +208,7 @@ namespace OpenSim | |||
208 | private void SetupTemplate(string name) | 208 | private void SetupTemplate(string name) |
209 | { | 209 | { |
210 | 210 | ||
211 | int i=0; | 211 | int i = 0; |
212 | FileInfo fInfo = new FileInfo(name); | 212 | FileInfo fInfo = new FileInfo(name); |
213 | long numBytes = fInfo.Length; | 213 | long numBytes = fInfo.Length; |
214 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | 214 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); |
@@ -217,19 +217,19 @@ namespace OpenSim | |||
217 | br.Close(); | 217 | br.Close(); |
218 | fStream.Close(); | 218 | fStream.Close(); |
219 | 219 | ||
220 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i); | 220 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); |
221 | 221 | ||
222 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 222 | System.Text.Encoding enc = System.Text.Encoding.ASCII; |
223 | libsecondlife.LLVector3 pos=new LLVector3(objdata.ObjectData, 16); | 223 | libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); |
224 | pos.X=100f; | 224 | pos.X = 100f; |
225 | objdata.ID=8880000; | 225 | objdata.ID = 8880000; |
226 | objdata.NameValue=enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); | 226 | objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); |
227 | libsecondlife.LLVector3 pos2=new LLVector3(13.981f,100.0f,20.0f); | 227 | libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f); |
228 | //objdata.FullID=user.AgentID; | 228 | //objdata.FullID=user.AgentID; |
229 | byte[] pb=pos.GetBytes(); | 229 | byte[] pb = pos.GetBytes(); |
230 | Array.Copy(pb,0,objdata.ObjectData,16,pb.Length); | 230 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); |
231 | 231 | ||
232 | AvatarTemplate=objdata; | 232 | AvatarTemplate = objdata; |
233 | 233 | ||
234 | } | 234 | } |
235 | 235 | ||
@@ -237,52 +237,52 @@ namespace OpenSim | |||
237 | /// | 237 | /// |
238 | /// </summary> | 238 | /// </summary> |
239 | /// <param name="User_info"></param> | 239 | /// <param name="User_info"></param> |
240 | public void SendInitialData(User_Agent_info User_info) | 240 | public void SendInitialData(UserAgentInfo userInfo) |
241 | { | 241 | { |
242 | 242 | ||
243 | //shouldn't have to read all this in from disk for every new client | 243 | //shouldn't have to read all this in from disk for every new client |
244 | string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\layer_data\"; | 244 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\layer_data\"; |
245 | 245 | ||
246 | //send layerdata | 246 | //send layerdata |
247 | LayerDataPacket layerpack=new LayerDataPacket(); | 247 | LayerDataPacket layerpack = new LayerDataPacket(); |
248 | layerpack.LayerID.Type=76; | 248 | layerpack.LayerID.Type = 76; |
249 | this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata0.dat"); | 249 | this.SendLayerData(userInfo,ref layerpack, data_path+@"layerdata0.dat"); |
250 | 250 | ||
251 | LayerDataPacket layerpack1=new LayerDataPacket(); | 251 | LayerDataPacket layerpack1 = new LayerDataPacket(); |
252 | layerpack1.LayerID.Type=76; | 252 | layerpack1.LayerID.Type = 76; |
253 | this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata1.dat"); | 253 | this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata1.dat"); |
254 | 254 | ||
255 | LayerDataPacket layerpack2=new LayerDataPacket(); | 255 | LayerDataPacket layerpack2 = new LayerDataPacket(); |
256 | layerpack2.LayerID.Type=56; | 256 | layerpack2.LayerID.Type = 56; |
257 | this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata2.dat"); | 257 | this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata2.dat"); |
258 | 258 | ||
259 | LayerDataPacket layerpack3=new LayerDataPacket(); | 259 | LayerDataPacket layerpack3 = new LayerDataPacket(); |
260 | layerpack3.LayerID.Type=55; | 260 | layerpack3.LayerID.Type = 55; |
261 | this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata3.dat"); | 261 | this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata3.dat"); |
262 | 262 | ||
263 | LayerDataPacket layerpack4=new LayerDataPacket(); | 263 | LayerDataPacket layerpack4 = new LayerDataPacket(); |
264 | layerpack4.LayerID.Type=56; | 264 | layerpack4.LayerID.Type = 56; |
265 | this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata4.dat"); | 265 | this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata4.dat"); |
266 | 266 | ||
267 | LayerDataPacket layerpack5=new LayerDataPacket(); | 267 | LayerDataPacket layerpack5 = new LayerDataPacket(); |
268 | layerpack5.LayerID.Type=55; | 268 | layerpack5.LayerID.Type = 55; |
269 | this.SendLayerData(User_info,ref layerpack,data_path+@"layerdata5.dat"); | 269 | this.SendLayerData(userInfo, ref layerpack, data_path+@"layerdata5.dat"); |
270 | 270 | ||
271 | //send intial set of captured prims data? | 271 | //send intial set of captured prims data? |
272 | this.Prim_Manager.ReadPrimDatabase( "objectdatabase.ini",User_info); | 272 | this.Prim_Manager.ReadPrimDatabase( "objectdatabase.ini", userInfo); |
273 | 273 | ||
274 | //send prims that have been created by users | 274 | //send prims that have been created by users |
275 | //prim_man.send_existing_prims(User_info); | 275 | //prim_man.send_existing_prims(User_info); |
276 | 276 | ||
277 | //send update about clients avatar | 277 | //send update about clients avatar |
278 | this.SendInitialAvatarPosition(User_info); | 278 | this.SendInitialAvatarPosition(userInfo); |
279 | 279 | ||
280 | //send updates about all other users | 280 | //send updates about all other users |
281 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList) | 281 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) |
282 | { | 282 | { |
283 | if(kp.Value.NetInfo.AgentID!=User_info.AgentID) | 283 | if(kp.Value.NetInfo.AgentID != userInfo.AgentID) |
284 | { | 284 | { |
285 | this.SendOtherAvatarPosition(User_info,kp.Value); | 285 | this.SendOtherAvatarPosition(userInfo, kp.Value); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | } | 288 | } |
@@ -291,41 +291,40 @@ namespace OpenSim | |||
291 | /// | 291 | /// |
292 | /// </summary> | 292 | /// </summary> |
293 | /// <param name="User_info"></param> | 293 | /// <param name="User_info"></param> |
294 | public void SendInitialAvatarPosition(User_Agent_info User_info) | 294 | public void SendInitialAvatarPosition(UserAgentInfo userInfo) |
295 | { | 295 | { |
296 | //send a objectupdate packet with information about the clients avatar | 296 | //send a objectupdate packet with information about the clients avatar |
297 | ObjectUpdatePacket objupdate=new ObjectUpdatePacket(); | 297 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
298 | objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle; | 298 | objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle; |
299 | objupdate.RegionData.TimeDilation=64096; | 299 | objupdate.RegionData.TimeDilation = 64096; |
300 | objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 300 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
301 | 301 | ||
302 | objupdate.ObjectData[0]=AvatarTemplate; | 302 | objupdate.ObjectData[0] = AvatarTemplate; |
303 | //give this avatar object a local id and assign the user a name | 303 | //give this avatar object a local id and assign the user a name |
304 | objupdate.ObjectData[0].ID=8880000+this.local_numer; | 304 | objupdate.ObjectData[0].ID = 8880000 + this._localNumber; |
305 | User_info.localID=objupdate.ObjectData[0].ID; | 305 | userInfo.localID = objupdate.ObjectData[0].ID; |
306 | //User_info.name="Test"+this.local_numer+" User"; | 306 | //User_info.name="Test"+this.local_numer+" User"; |
307 | this.GetAgent(User_info.AgentID).Started=true; | 307 | this.GetAgent(userInfo.AgentID).Started = true; |
308 | objupdate.ObjectData[0].FullID=User_info.AgentID; | 308 | objupdate.ObjectData[0].FullID = userInfo.AgentID; |
309 | objupdate.ObjectData[0].NameValue=enc.GetBytes("FirstName STRING RW SV "+User_info.first_name+"\nLastName STRING RW SV "+User_info.last_name+" \0"); | 309 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0"); |
310 | User_info.name="FirstName STRING RW SV "+User_info.first_name+"\nLastName STRING RW SV "+User_info.last_name+" \0"; | 310 | userInfo.name = "FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0"; |
311 | //User_info.last_name="User"; | 311 | |
312 | //User_info.first_name="Test"+this.local_numer; | 312 | libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f); |
313 | libsecondlife.LLVector3 pos2=new LLVector3(100f,100.0f,22.0f); | 313 | |
314 | 314 | byte[] pb = pos2.GetBytes(); | |
315 | byte[] pb=pos2.GetBytes(); | ||
316 | 315 | ||
317 | Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,16,pb.Length); | 316 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
318 | this.local_numer++; | 317 | this._localNumber++; |
319 | 318 | ||
320 | server.SendPacket(objupdate,true,User_info); | 319 | _server.SendPacket(objupdate, true, userInfo); |
321 | 320 | ||
322 | //send this info to other existing clients | 321 | //send this info to other existing clients |
323 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList) | 322 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) |
324 | { | 323 | { |
325 | if(kp.Value.NetInfo.AgentID!=User_info.AgentID) | 324 | if(kp.Value.NetInfo.AgentID != userInfo.AgentID) |
326 | { | 325 | { |
327 | server.SendPacket(objupdate,true,kp.Value.NetInfo); | 326 | _server.SendPacket(objupdate, true, kp.Value.NetInfo); |
328 | this.SendOtherAppearance(kp.Value.NetInfo,objupdate.ObjectData[0].FullID); | 327 | this.SendOtherAppearance(kp.Value.NetInfo, objupdate.ObjectData[0].FullID); |
329 | } | 328 | } |
330 | } | 329 | } |
331 | 330 | ||
@@ -335,38 +334,38 @@ namespace OpenSim | |||
335 | /// | 334 | /// |
336 | /// </summary> | 335 | /// </summary> |
337 | /// <param name="user"></param> | 336 | /// <param name="user"></param> |
338 | public void SendIntialAvatarAppearance(User_Agent_info user) | 337 | public void SendIntialAvatarAppearance(UserAgentInfo userInfo) |
339 | { | 338 | { |
340 | AvatarData Agent=this.AgentList[user.AgentID]; | 339 | AvatarData Agent = this.AgentList[userInfo.AgentID]; |
341 | AgentWearablesUpdatePacket aw=new AgentWearablesUpdatePacket(); | 340 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); |
342 | aw.AgentData.AgentID=user.AgentID; | 341 | aw.AgentData.AgentID = userInfo.AgentID; |
343 | aw.AgentData.SerialNum=0; | 342 | aw.AgentData.SerialNum = 0; |
344 | aw.AgentData.SessionID=user.SessionID; | 343 | aw.AgentData.SessionID = userInfo.SessionID; |
345 | 344 | ||
346 | aw.WearableData= new AgentWearablesUpdatePacket.WearableDataBlock[13]; | 345 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; |
347 | AgentWearablesUpdatePacket.WearableDataBlock awb=null; | 346 | AgentWearablesUpdatePacket.WearableDataBlock awb = null; |
348 | awb=new AgentWearablesUpdatePacket.WearableDataBlock(); | 347 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
349 | awb.WearableType=(byte)0; | 348 | awb.WearableType = (byte)0; |
350 | awb.AssetID=Agent.Wearables[0].AssetID;//new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 349 | awb.AssetID = Agent.Wearables[0].AssetID; |
351 | awb.ItemID=Agent.Wearables[0].ItemID;//new LLUUID("b7878441893b094917f791174bc8401c"); | 350 | awb.ItemID = Agent.Wearables[0].ItemID; |
352 | aw.WearableData[0]=awb; | 351 | aw.WearableData[0] = awb; |
353 | 352 | ||
354 | awb=new AgentWearablesUpdatePacket.WearableDataBlock(); | 353 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
355 | awb.WearableType=(byte)1; | 354 | awb.WearableType =(byte)1; |
356 | awb.AssetID=Agent.Wearables[1].AssetID;//new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49"); | 355 | awb.AssetID = Agent.Wearables[1].AssetID; |
357 | awb.ItemID=Agent.Wearables[1].ItemID;//new LLUUID("193f0876fc11d143797454352f9c9c26"); | 356 | awb.ItemID = Agent.Wearables[1].ItemID; |
358 | aw.WearableData[1]=awb; | 357 | aw.WearableData[1] = awb; |
359 | 358 | ||
360 | for(int i=2; i<13; i++) | 359 | for(int i=2; i<13; i++) |
361 | { | 360 | { |
362 | awb=new AgentWearablesUpdatePacket.WearableDataBlock(); | 361 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
363 | awb.WearableType=(byte)i; | 362 | awb.WearableType = (byte)i; |
364 | awb.AssetID=new LLUUID("00000000-0000-0000-0000-000000000000"); | 363 | awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
365 | awb.ItemID=new LLUUID("00000000-0000-0000-0000-000000000000"); | 364 | awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
366 | aw.WearableData[i]=awb; | 365 | aw.WearableData[i] = awb; |
367 | } | 366 | } |
368 | 367 | ||
369 | server.SendPacket(aw,true,user); | 368 | _server.SendPacket(aw, true, userInfo); |
370 | } | 369 | } |
371 | 370 | ||
372 | /// <summary> | 371 | /// <summary> |
@@ -374,34 +373,33 @@ namespace OpenSim | |||
374 | /// </summary> | 373 | /// </summary> |
375 | /// <param name="user"></param> | 374 | /// <param name="user"></param> |
376 | /// <param name="id"></param> | 375 | /// <param name="id"></param> |
377 | public void SendOtherAppearance(User_Agent_info user,LLUUID id) | 376 | public void SendOtherAppearance(UserAgentInfo userInfo, LLUUID id) |
378 | { | 377 | { |
379 | AvatarAppearancePacket avp=new AvatarAppearancePacket(); | 378 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); |
380 | 379 | ||
381 | 380 | ||
382 | avp.VisualParam=new AvatarAppearancePacket.VisualParamBlock[218]; | 381 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; |
383 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); | 382 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); |
384 | 383 | ||
385 | FileInfo fInfo = new FileInfo("Avatar_texture3.dat"); | 384 | FileInfo fInfo = new FileInfo("Avatar_texture3.dat"); |
386 | |||
387 | long numBytes = fInfo.Length; | 385 | long numBytes = fInfo.Length; |
388 | FileStream fStream = new FileStream("Avatar_texture3.dat", FileMode.Open, FileAccess.Read); | 386 | FileStream fStream = new FileStream("Avatar_texture3.dat", FileMode.Open, FileAccess.Read); |
389 | BinaryReader br = new BinaryReader(fStream); | 387 | BinaryReader br = new BinaryReader(fStream); |
390 | avp.ObjectData.TextureEntry= br.ReadBytes((int)numBytes); | 388 | avp.ObjectData.TextureEntry = br.ReadBytes((int)numBytes); |
391 | br.Close(); | 389 | br.Close(); |
392 | fStream.Close(); | 390 | fStream.Close(); |
393 | 391 | ||
394 | AvatarAppearancePacket.VisualParamBlock avblock=null; | 392 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
395 | for(int i=0; i<218; i++) | 393 | for(int i = 0; i < 218; i++) |
396 | { | 394 | { |
397 | avblock=new AvatarAppearancePacket.VisualParamBlock(); | 395 | avblock = new AvatarAppearancePacket.VisualParamBlock(); |
398 | avblock.ParamValue=(byte)100; | 396 | avblock.ParamValue = (byte)100; |
399 | avp.VisualParam[i]=avblock; | 397 | avp.VisualParam[i] = avblock; |
400 | } | 398 | } |
401 | 399 | ||
402 | avp.Sender.IsTrial=false; | 400 | avp.Sender.IsTrial = false; |
403 | avp.Sender.ID=id; | 401 | avp.Sender.ID = id; |
404 | server.SendPacket(avp,true,user); | 402 | _server.SendPacket(avp, true, userInfo); |
405 | 403 | ||
406 | } | 404 | } |
407 | 405 | ||
@@ -410,29 +408,27 @@ namespace OpenSim | |||
410 | /// </summary> | 408 | /// </summary> |
411 | /// <param name="User_info"></param> | 409 | /// <param name="User_info"></param> |
412 | /// <param name="avd"></param> | 410 | /// <param name="avd"></param> |
413 | public void SendOtherAvatarPosition(User_Agent_info User_info, AvatarData avd) | 411 | public void SendOtherAvatarPosition(UserAgentInfo userInfo, AvatarData avatar) |
414 | { | 412 | { |
415 | //send a objectupdate packet with information about the clients avatar | 413 | //send a objectupdate packet with information about the clients avatar |
416 | ObjectUpdatePacket objupdate=new ObjectUpdatePacket(); | 414 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
417 | objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle; | 415 | objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle; |
418 | objupdate.RegionData.TimeDilation=64500; | 416 | objupdate.RegionData.TimeDilation = 64500; |
419 | objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 417 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
420 | 418 | ||
421 | objupdate.ObjectData[0]=AvatarTemplate; | 419 | objupdate.ObjectData[0] = AvatarTemplate; |
422 | //give this avatar object a local id and assign the user a name | 420 | //give this avatar object a local id and assign the user a name |
423 | objupdate.ObjectData[0].ID=avd.NetInfo.localID; | 421 | objupdate.ObjectData[0].ID = avatar.NetInfo.localID; |
424 | objupdate.ObjectData[0].FullID=avd.NetInfo.AgentID;//new LLUUID("00000000-0000-0000-5665-000000000034"); | 422 | objupdate.ObjectData[0].FullID = avatar.NetInfo.AgentID; |
425 | 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"); | 423 | objupdate.ObjectData[0].NameValue = _enc.GetBytes(avatar.NetInfo.name); |
426 | libsecondlife.LLVector3 pos2=new LLVector3(avd.Position.X,avd.Position.Y,avd.Position.Z); | 424 | libsecondlife.LLVector3 pos2 = new LLVector3(avatar.Position.X, avatar.Position.Y, avatar.Position.Z); |
427 | 425 | ||
428 | byte[] pb=pos2.GetBytes(); | 426 | byte[] pb = pos2.GetBytes(); |
429 | 427 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | |
430 | Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,16,pb.Length); | 428 | this._localNumber++; |
431 | this.local_numer++; | ||
432 | |||
433 | server.SendPacket(objupdate,true,User_info); | ||
434 | 429 | ||
435 | this.SendOtherAppearance(User_info,avd.NetInfo.AgentID);//new LLUUID("00000000-0000-0000-5665-000000000034")); | 430 | _server.SendPacket(objupdate, true, userInfo); |
431 | this.SendOtherAppearance(userInfo, avatar.NetInfo.AgentID); | ||
436 | 432 | ||
437 | } | 433 | } |
438 | 434 | ||
@@ -441,26 +437,26 @@ namespace OpenSim | |||
441 | /// </summary> | 437 | /// </summary> |
442 | /// <param name="User_info"></param> | 438 | /// <param name="User_info"></param> |
443 | /// <param name="line"></param> | 439 | /// <param name="line"></param> |
444 | public void SendChatMessage(User_Agent_info User_info, string line) | 440 | public void SendChatMessage(UserAgentInfo userInfo, string line) |
445 | { | 441 | { |
446 | libsecondlife.Packets.ChatFromSimulatorPacket reply=new ChatFromSimulatorPacket(); | 442 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); |
447 | reply.ChatData.Audible=1; | 443 | reply.ChatData.Audible = 1; |
448 | reply.ChatData.Message=enc.GetBytes(line); | 444 | reply.ChatData.Message = _enc.GetBytes(line); |
449 | reply.ChatData.ChatType=1; | 445 | reply.ChatData.ChatType = 1; |
450 | reply.ChatData.SourceType=1; | 446 | reply.ChatData.SourceType = 1; |
451 | reply.ChatData.Position=new LLVector3(120,100,21); //should set to actual position | 447 | reply.ChatData.Position = new LLVector3(120, 100, 21); //should set to actual position |
452 | reply.ChatData.FromName=enc.GetBytes(User_info.first_name +" "+User_info.last_name +"\0"); //enc.GetBytes("Echo: \0"); //and actual name | 448 | reply.ChatData.FromName = _enc.GetBytes(userInfo.first_name + " " + userInfo.last_name + "\0"); |
453 | reply.ChatData.OwnerID=User_info.AgentID; | 449 | reply.ChatData.OwnerID = userInfo.AgentID; |
454 | reply.ChatData.SourceID=User_info.AgentID; | 450 | reply.ChatData.SourceID = userInfo.AgentID; |
455 | //echo to sender | 451 | //echo to sender |
456 | server.SendPacket(reply,true,User_info); | 452 | _server.SendPacket(reply, true, userInfo); |
457 | 453 | ||
458 | //send to all users | 454 | //send to all users |
459 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList) | 455 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) |
460 | { | 456 | { |
461 | if(kp.Value.NetInfo.AgentID!=User_info.AgentID) | 457 | if(kp.Value.NetInfo.AgentID!=userInfo.AgentID) |
462 | { | 458 | { |
463 | server.SendPacket(reply,true,kp.Value.NetInfo); | 459 | _server.SendPacket(reply, true, kp.Value.NetInfo); |
464 | } | 460 | } |
465 | } | 461 | } |
466 | } | 462 | } |
@@ -475,54 +471,54 @@ namespace OpenSim | |||
475 | /// <param name="z"></param> | 471 | /// <param name="z"></param> |
476 | /// <param name="av_id"></param> | 472 | /// <param name="av_id"></param> |
477 | /// <param name="body"></param> | 473 | /// <param name="body"></param> |
478 | public void SendMoveCommand(User_Agent_info user, bool stop,float x, float y, float z, uint av_id, libsecondlife.LLQuaternion body) | 474 | public void SendMoveCommand(UserAgentInfo userInfo, bool stop, float x, float y, float z, uint avatarID, libsecondlife.LLQuaternion body) |
479 | { | 475 | { |
480 | uint ID=user.localID; | 476 | Console.WriteLine("sending move"); |
481 | //ID=av_id; | 477 | uint ID = userInfo.localID; |
482 | byte[] bytes=new byte[60]; | 478 | byte[] bytes = new byte[60]; |
479 | int i=0; | ||
483 | 480 | ||
484 | ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket(); | 481 | ImprovedTerseObjectUpdatePacket im = new ImprovedTerseObjectUpdatePacket(); |
485 | im.RegionData.RegionHandle=Globals.Instance.RegionHandle;; | 482 | im.RegionData.RegionHandle = Globals.Instance.RegionHandle;; |
486 | im.RegionData.TimeDilation=64096; | 483 | im.RegionData.TimeDilation = 64096; |
487 | 484 | ||
488 | im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 485 | im.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
489 | int i=0; | 486 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
490 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
491 | 487 | ||
492 | im.ObjectData[0]=dat; | 488 | im.ObjectData[0] = dat; |
493 | 489 | ||
494 | dat.TextureEntry=AvatarTemplate.TextureEntry; | 490 | dat.TextureEntry = AvatarTemplate.TextureEntry; |
495 | libsecondlife.LLVector3 pos2=new LLVector3(x,y,z); | 491 | libsecondlife.LLVector3 pos2 = new LLVector3(x, y, z); |
496 | 492 | ||
497 | bytes[i++] = (byte)(ID % 256); | 493 | bytes[i++] = (byte)(ID % 256); |
498 | bytes[i++] = (byte)((ID >> 8) % 256); | 494 | bytes[i++] = (byte)((ID >> 8) % 256); |
499 | bytes[i++] = (byte)((ID >> 16) % 256); | 495 | bytes[i++] = (byte)((ID >> 16) % 256); |
500 | bytes[i++] = (byte)((ID >> 24) % 256); | 496 | bytes[i++] = (byte)((ID >> 24) % 256); |
501 | 497 | ||
502 | bytes[i++]=0; | 498 | bytes[i++] = 0; |
503 | bytes[i++]=1; | 499 | bytes[i++] = 1; |
504 | 500 | ||
505 | i+=14; | 501 | i += 14; |
506 | bytes[i++]=128; | 502 | bytes[i++] = 128; |
507 | bytes[i++]=63; | 503 | bytes[i++] = 63; |
508 | byte[] pb=pos2.GetBytes(); | 504 | byte[] pb = pos2.GetBytes(); |
509 | 505 | ||
510 | Array.Copy(pb,0,bytes,i,pb.Length); | 506 | Array.Copy(pb, 0, bytes, i, pb.Length); |
511 | i+=12; | 507 | i += 12; |
512 | ushort ac=32767; | 508 | ushort ac = 32767; |
513 | Axiom.MathLib.Vector3 v3=new Axiom.MathLib.Vector3(1,0,0); | 509 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); |
514 | Axiom.MathLib.Quaternion q=new Axiom.MathLib.Quaternion(body.W,body.X,body.Y,body.Z); | 510 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(body.W, body.X, body.Y, body.Z); |
515 | Axiom.MathLib.Vector3 direc=q*v3; | 511 | Axiom.MathLib.Vector3 direc = q * v3; |
516 | direc.Normalize(); | 512 | direc.Normalize(); |
517 | 513 | ||
518 | direc=direc*(0.03f); | 514 | direc = direc * (0.03f); |
519 | direc.x+=1; | 515 | direc.x += 1; |
520 | direc.y+=1; | 516 | direc.y += 1; |
521 | direc.z+=1; | 517 | direc.z += 1; |
522 | ushort dx,dy,dz; | 518 | ushort dx, dy, dz; |
523 | dx=(ushort)(32768*direc.x); | 519 | dx = (ushort)(32768 * direc.x); |
524 | dy=(ushort)(32768*direc.y); | 520 | dy = (ushort)(32768 * direc.y); |
525 | dz=(ushort)(32768*direc.z); | 521 | dz = (ushort)(32768 * direc.z); |
526 | 522 | ||
527 | //vel | 523 | //vel |
528 | if(!stop) | 524 | if(!stop) |
@@ -582,14 +578,14 @@ namespace OpenSim | |||
582 | 578 | ||
583 | dat.Data=bytes; | 579 | dat.Data=bytes; |
584 | 580 | ||
585 | server.SendPacket(im,true,user); | 581 | _server.SendPacket(im, true, userInfo); |
586 | 582 | ||
587 | //should send to all users. | 583 | //should send to all users. |
588 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in this.AgentList) | 584 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in this.AgentList) |
589 | { | 585 | { |
590 | if(kp.Value.NetInfo.AgentID!=user.AgentID) | 586 | if(kp.Value.NetInfo.AgentID != userInfo.AgentID) |
591 | { | 587 | { |
592 | server.SendPacket(im,true,kp.Value.NetInfo); | 588 | _server.SendPacket(im, true, kp.Value.NetInfo); |
593 | } | 589 | } |
594 | } | 590 | } |
595 | } | 591 | } |
@@ -600,36 +596,30 @@ namespace OpenSim | |||
600 | /// <param name="User_info"></param> | 596 | /// <param name="User_info"></param> |
601 | /// <param name="lay"></param> | 597 | /// <param name="lay"></param> |
602 | /// <param name="name"></param> | 598 | /// <param name="name"></param> |
603 | public void SendLayerData(User_Agent_info User_info,ref LayerDataPacket lay,string name) | 599 | public void SendLayerData(UserAgentInfo userInfo, ref LayerDataPacket layer, string name) |
604 | { | 600 | { |
605 | FileInfo fInfo = new FileInfo(name); | 601 | FileInfo fInfo = new FileInfo(name); |
606 | |||
607 | long numBytes = fInfo.Length; | 602 | long numBytes = fInfo.Length; |
608 | |||
609 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | 603 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); |
610 | |||
611 | BinaryReader br = new BinaryReader(fStream); | 604 | BinaryReader br = new BinaryReader(fStream); |
612 | |||
613 | byte [] data1 = br.ReadBytes((int)numBytes); | 605 | byte [] data1 = br.ReadBytes((int)numBytes); |
614 | |||
615 | br.Close(); | 606 | br.Close(); |
616 | |||
617 | fStream.Close(); | 607 | fStream.Close(); |
618 | lay.LayerData.Data=data1; | 608 | layer.LayerData.Data = data1; |
619 | server.SendPacket(lay,true,User_info); | 609 | _server.SendPacket(layer, true, userInfo); |
620 | //System.Console.WriteLine("sent"); | 610 | |
621 | } | 611 | } |
622 | } | 612 | } |
623 | 613 | ||
624 | public class AvatarData | 614 | public class AvatarData |
625 | { | 615 | { |
626 | public User_Agent_info NetInfo; | 616 | public UserAgentInfo NetInfo; |
627 | public LLUUID FullID; | 617 | public LLUUID FullID; |
628 | public LLVector3 Position; | 618 | public LLVector3 Position; |
629 | public LLVector3 Velocity=new LLVector3(0,0,0); | 619 | public LLVector3 Velocity = new LLVector3(0,0,0); |
630 | //public LLQuaternion Rotation; | 620 | //public LLQuaternion Rotation; |
631 | public bool Walk=false; | 621 | public bool Walk = false; |
632 | public bool Started=false; | 622 | public bool Started = false; |
633 | //public TextureEntry TextureEntry; | 623 | //public TextureEntry TextureEntry; |
634 | public AvatarWearable[] Wearables; | 624 | public AvatarWearable[] Wearables; |
635 | public LLUUID InventoryFolder; | 625 | public LLUUID InventoryFolder; |
@@ -638,9 +628,9 @@ namespace OpenSim | |||
638 | public AvatarData() | 628 | public AvatarData() |
639 | { | 629 | { |
640 | Wearables=new AvatarWearable[2]; //should be 13 | 630 | Wearables=new AvatarWearable[2]; //should be 13 |
641 | for(int i=0; i<2; i++) | 631 | for(int i = 0; i < 2; i++) |
642 | { | 632 | { |
643 | Wearables[i]=new AvatarWearable(); | 633 | Wearables[i] = new AvatarWearable(); |
644 | } | 634 | } |
645 | } | 635 | } |
646 | } | 636 | } |
diff --git a/AssetManagement.cs b/AssetManagement.cs index a43a969..07b2b57 100644 --- a/AssetManagement.cs +++ b/AssetManagement.cs | |||
@@ -44,22 +44,23 @@ namespace OpenSim | |||
44 | public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets; | 44 | public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets; |
45 | public Dictionary<libsecondlife.LLUUID,TextureImage> Textures; | 45 | public Dictionary<libsecondlife.LLUUID,TextureImage> Textures; |
46 | 46 | ||
47 | public ArrayList AssetRequests=new ArrayList(); //should change to a generic | 47 | public ArrayList AssetRequests = new ArrayList(); //should change to a generic |
48 | public ArrayList TextureRequests=new ArrayList(); | 48 | public ArrayList TextureRequests = new ArrayList(); |
49 | // public ArrayList uploads=new ArrayList(); | 49 | //public ArrayList uploads=new ArrayList(); |
50 | private Server server; | 50 | private Server _server; |
51 | public InventoryManager InventoryManager; | 51 | private InventoryManager _inventoryManager; |
52 | private System.Text.Encoding enc = System.Text.Encoding.ASCII; | 52 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// | 55 | /// |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <param name="server"></param> | 57 | /// <param name="_server"></param> |
58 | public AssetManagement(Server server) | 58 | public AssetManagement(Server server, InventoryManager inventoryManager) |
59 | { | 59 | { |
60 | this.server=server; | 60 | this._server = server; |
61 | Textures=new Dictionary<libsecondlife.LLUUID,TextureImage> (); | 61 | this._inventoryManager = inventoryManager; |
62 | Assets=new Dictionary<libsecondlife.LLUUID,AssetInfo> (); | 62 | Textures = new Dictionary<libsecondlife.LLUUID,TextureImage> (); |
63 | Assets = new Dictionary<libsecondlife.LLUUID,AssetInfo> (); | ||
63 | this.initialise(); | 64 | this.initialise(); |
64 | } | 65 | } |
65 | 66 | ||
@@ -69,38 +70,38 @@ namespace OpenSim | |||
69 | private void initialise() | 70 | private void initialise() |
70 | { | 71 | { |
71 | //Shape and skin base assets | 72 | //Shape and skin base assets |
72 | AssetInfo Asset=new AssetInfo(); | 73 | AssetInfo Asset = new AssetInfo(); |
73 | Asset.filename="base_shape.dat"; | 74 | Asset.filename = "base_shape.dat"; |
74 | Asset.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 75 | Asset.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
75 | this.LoadAsset(Asset, false); | 76 | this.LoadAsset(Asset, false); |
76 | this.Assets.Add(Asset.Full_ID, Asset); | 77 | this.Assets.Add(Asset.FullID, Asset); |
77 | 78 | ||
78 | Asset=new AssetInfo(); | 79 | Asset = new AssetInfo(); |
79 | Asset.filename="base_skin.dat"; | 80 | Asset.filename = "base_skin.dat"; |
80 | Asset.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49"); | 81 | Asset.FullID = new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49"); |
81 | this.LoadAsset(Asset, false); | 82 | this.LoadAsset(Asset, false); |
82 | this.Assets.Add(Asset.Full_ID, Asset); | 83 | this.Assets.Add(Asset.FullID, Asset); |
83 | 84 | ||
84 | //our test images | 85 | //our test images |
85 | //Change these filenames to images you want to use. | 86 | //Change these filenames to images you want to use. |
86 | TextureImage Image=new TextureImage(); | 87 | TextureImage Image = new TextureImage(); |
87 | Image.filename="testpic2.jp2"; | 88 | Image.filename = "testpic2.jp2"; |
88 | Image.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005"); | 89 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); |
89 | Image.Name="test Texture"; | 90 | Image.Name = "test Texture"; |
90 | this.LoadAsset(Image, true); | 91 | this.LoadAsset(Image, true); |
91 | this.Textures.Add(Image.Full_ID, Image); | 92 | this.Textures.Add(Image.FullID, Image); |
92 | 93 | ||
93 | Image=new TextureImage(); | 94 | Image = new TextureImage(); |
94 | Image.filename="map_base.jp2"; | 95 | Image.filename = "map_base.jp2"; |
95 | Image.Full_ID=new LLUUID("00000000-0000-0000-7007-000000000006"); | 96 | Image.FullID = new LLUUID("00000000-0000-0000-7007-000000000006"); |
96 | this.LoadAsset(Image, true); | 97 | this.LoadAsset(Image, true); |
97 | this.Textures.Add(Image.Full_ID, Image); | 98 | this.Textures.Add(Image.FullID, Image); |
98 | 99 | ||
99 | Image=new TextureImage(); | 100 | Image = new TextureImage(); |
100 | Image.filename="map1.jp2"; | 101 | Image.filename = "map1.jp2"; |
101 | Image.Full_ID=new LLUUID("00000000-0000-0000-7009-000000000008"); | 102 | Image.FullID = new LLUUID("00000000-0000-0000-7009-000000000008"); |
102 | this.LoadAsset(Image, true); | 103 | this.LoadAsset(Image, true); |
103 | this.Textures.Add(Image.Full_ID, Image); | 104 | this.Textures.Add(Image.FullID, Image); |
104 | } | 105 | } |
105 | 106 | ||
106 | /// <summary> | 107 | /// <summary> |
@@ -111,101 +112,101 @@ namespace OpenSim | |||
111 | /// <param name="TransferRequest"></param> | 112 | /// <param name="TransferRequest"></param> |
112 | #region AssetRegion | 113 | #region AssetRegion |
113 | 114 | ||
114 | public void AddAssetRequest(User_Agent_info UserInfo, LLUUID AssetID, TransferRequestPacket TransferRequest) | 115 | public void AddAssetRequest(UserAgentInfo userInfo, LLUUID assetID, TransferRequestPacket transferRequest) |
115 | { | 116 | { |
116 | 117 | ||
117 | if(!this.Assets.ContainsKey(AssetID)) | 118 | if(!this.Assets.ContainsKey(assetID)) |
118 | { | 119 | { |
119 | //not found asset | 120 | //not found asset |
120 | return; | 121 | return; |
121 | } | 122 | } |
122 | AssetInfo info=this.Assets[AssetID]; | 123 | AssetInfo info = this.Assets[assetID]; |
123 | //for now as it will be only skin or shape request just send back the asset | 124 | //for now as it will be only skin or shape request just send back the asset |
124 | TransferInfoPacket Transfer=new TransferInfoPacket(); | 125 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
125 | Transfer.TransferInfo.ChannelType=2; | 126 | Transfer.TransferInfo.ChannelType = 2; |
126 | Transfer.TransferInfo.Status=0; | 127 | Transfer.TransferInfo.Status = 0; |
127 | Transfer.TransferInfo.TargetType=0; | 128 | Transfer.TransferInfo.TargetType = 0; |
128 | Transfer.TransferInfo.Params=TransferRequest.TransferInfo.Params; | 129 | Transfer.TransferInfo.Params = transferRequest.TransferInfo.Params; |
129 | Transfer.TransferInfo.Size=info.data.Length; | 130 | Transfer.TransferInfo.Size = info.data.Length; |
130 | Transfer.TransferInfo.TransferID=TransferRequest.TransferInfo.TransferID; | 131 | Transfer.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; |
131 | 132 | ||
132 | server.SendPacket(Transfer, true, UserInfo); | 133 | _server.SendPacket(Transfer, true, userInfo); |
133 | 134 | ||
134 | TransferPacketPacket TransferPacket=new TransferPacketPacket(); | 135 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); |
135 | TransferPacket.TransferData.Packet=0; | 136 | TransferPacket.TransferData.Packet = 0; |
136 | TransferPacket.TransferData.ChannelType=2; | 137 | TransferPacket.TransferData.ChannelType = 2; |
137 | TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID; | 138 | TransferPacket.TransferData.TransferID=transferRequest.TransferInfo.TransferID; |
138 | if(info.data.Length>1000) //but needs to be less than 2000 at the moment | 139 | if(info.data.Length>1000) //but needs to be less than 2000 at the moment |
139 | { | 140 | { |
140 | byte[] chunk=new byte[1000]; | 141 | byte[] chunk = new byte[1000]; |
141 | Array.Copy(info.data,chunk,1000); | 142 | Array.Copy(info.data,chunk,1000); |
142 | TransferPacket.TransferData.Data=chunk; | 143 | TransferPacket.TransferData.Data = chunk; |
143 | TransferPacket.TransferData.Status=0; | 144 | TransferPacket.TransferData.Status = 0; |
144 | server.SendPacket(TransferPacket,true,UserInfo); | 145 | _server.SendPacket(TransferPacket,true,userInfo); |
145 | 146 | ||
146 | TransferPacket=new TransferPacketPacket(); | 147 | TransferPacket = new TransferPacketPacket(); |
147 | TransferPacket.TransferData.Packet=1; | 148 | TransferPacket.TransferData.Packet = 1; |
148 | TransferPacket.TransferData.ChannelType=2; | 149 | TransferPacket.TransferData.ChannelType = 2; |
149 | TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID; | 150 | TransferPacket.TransferData.TransferID = transferRequest.TransferInfo.TransferID; |
150 | byte[] chunk1=new byte[(info.data.Length-1000)]; | 151 | byte[] chunk1 = new byte[(info.data.Length-1000)]; |
151 | Array.Copy(info.data, 1000, chunk1, 0, chunk1.Length); | 152 | Array.Copy(info.data, 1000, chunk1, 0, chunk1.Length); |
152 | TransferPacket.TransferData.Data=chunk1; | 153 | TransferPacket.TransferData.Data = chunk1; |
153 | TransferPacket.TransferData.Status=1; | 154 | TransferPacket.TransferData.Status = 1; |
154 | server.SendPacket(TransferPacket, true, UserInfo); | 155 | _server.SendPacket(TransferPacket, true, userInfo); |
155 | } | 156 | } |
156 | else | 157 | else |
157 | { | 158 | { |
158 | TransferPacket.TransferData.Status=1; //last packet? so set to 1 | 159 | TransferPacket.TransferData.Status = 1; //last packet? so set to 1 |
159 | TransferPacket.TransferData.Data=info.data; | 160 | TransferPacket.TransferData.Data = info.data; |
160 | server.SendPacket(TransferPacket, true, UserInfo); | 161 | _server.SendPacket(TransferPacket, true, userInfo); |
161 | } | 162 | } |
162 | 163 | ||
163 | } | 164 | } |
164 | 165 | ||
165 | public void CreateNewInventorySet(ref AvatarData Avata,User_Agent_info UserInfo) | 166 | public void CreateNewInventorySet(ref AvatarData Avata,UserAgentInfo UserInfo) |
166 | { | 167 | { |
167 | //Create Folders | 168 | //Create Folders |
168 | LLUUID BaseFolder=Avata.BaseFolder; | 169 | LLUUID BaseFolder = Avata.BaseFolder; |
169 | InventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder); | 170 | _inventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder); |
170 | InventoryManager.CreateNewFolder(UserInfo, BaseFolder); | 171 | _inventoryManager.CreateNewFolder(UserInfo, BaseFolder); |
171 | 172 | ||
172 | //Give a copy of default shape | 173 | //Give a copy of default shape |
173 | AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")]; | 174 | AssetInfo Base = this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")]; |
174 | AssetInfo Shape=this.CloneAsset(UserInfo.AgentID, Base); | 175 | AssetInfo Shape = this.CloneAsset(UserInfo.AgentID, Base); |
175 | 176 | ||
176 | Shape.filename=""; | 177 | Shape.filename = ""; |
177 | Shape.Name="Default Shape"; | 178 | Shape.Name = "Default Shape"; |
178 | Shape.Description="Default Shape"; | 179 | Shape.Description = "Default Shape"; |
179 | Shape.InvType=18; | 180 | Shape.InvType = 18; |
180 | Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; | 181 | Shape.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; |
181 | 182 | ||
182 | byte[] Agentid=enc.GetBytes(UserInfo.AgentID.ToStringHyphenated()); | 183 | byte[] Agentid = _enc.GetBytes(UserInfo.AgentID.ToStringHyphenated()); |
183 | Array.Copy(Agentid, 0, Shape.data, 294, Agentid.Length); | 184 | Array.Copy(Agentid, 0, Shape.data, 294, Agentid.Length); |
184 | this.Assets.Add(Shape.Full_ID, Shape); | 185 | this.Assets.Add(Shape.FullID, Shape); |
185 | 186 | ||
186 | Avata.Wearables[0].ItemID=InventoryManager.AddToInventory(UserInfo, BaseFolder, Shape); | 187 | Avata.Wearables[0].ItemID = _inventoryManager.AddToInventory(UserInfo, BaseFolder, Shape); |
187 | Avata.Wearables[0].AssetID=Shape.Full_ID; | 188 | Avata.Wearables[0].AssetID = Shape.FullID; |
188 | 189 | ||
189 | //Give copy of default skin | 190 | //Give copy of default skin |
190 | Base=this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")]; | 191 | Base = this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")]; |
191 | AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base); | 192 | AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base); |
192 | 193 | ||
193 | Skin.filename=""; | 194 | Skin.filename = ""; |
194 | Skin.Name="Default Skin"; | 195 | Skin.Name = "Default Skin"; |
195 | Skin.Description="Default Skin"; | 196 | Skin.Description = "Default Skin"; |
196 | Skin.InvType=18; | 197 | Skin.InvType = 18; |
197 | Skin.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; | 198 | Skin.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; |
198 | 199 | ||
199 | Array.Copy(Agentid,0,Skin.data,238,Agentid.Length); | 200 | Array.Copy(Agentid,0,Skin.data,238,Agentid.Length); |
200 | this.Assets.Add(Skin.Full_ID, Skin); | 201 | this.Assets.Add(Skin.FullID, Skin); |
201 | 202 | ||
202 | Avata.Wearables[1].ItemID=InventoryManager.AddToInventory(UserInfo, BaseFolder, Skin); | 203 | Avata.Wearables[1].ItemID = _inventoryManager.AddToInventory(UserInfo, BaseFolder, Skin); |
203 | Avata.Wearables[1].AssetID=Skin.Full_ID; | 204 | Avata.Wearables[1].AssetID = Skin.FullID; |
204 | 205 | ||
205 | //give a copy of test texture | 206 | //give a copy of test texture |
206 | TextureImage Texture=this.CloneImage(UserInfo.AgentID,Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]); | 207 | TextureImage Texture = this.CloneImage(UserInfo.AgentID, Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]); |
207 | this.Textures.Add(Texture.Full_ID, Texture); | 208 | this.Textures.Add(Texture.FullID, Texture); |
208 | InventoryManager.AddToInventory(UserInfo, BaseFolder, Texture); | 209 | _inventoryManager.AddToInventory(UserInfo, BaseFolder, Texture); |
209 | 210 | ||
210 | } | 211 | } |
211 | 212 | ||
@@ -217,116 +218,116 @@ namespace OpenSim | |||
217 | string folder; | 218 | string folder; |
218 | if(Image) | 219 | if(Image) |
219 | { | 220 | { |
220 | folder=@"\textures\"; | 221 | folder = @"\textures\"; |
221 | } | 222 | } |
222 | else | 223 | else |
223 | { | 224 | { |
224 | folder=@"\assets\"; | 225 | folder = @"\assets\"; |
225 | } | 226 | } |
226 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + folder; | 227 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + folder; |
227 | string filename=data_path+@info.filename; | 228 | string filename = data_path+@info.filename; |
228 | FileInfo fInfo = new FileInfo(filename); | 229 | FileInfo fInfo = new FileInfo(filename); |
229 | 230 | ||
230 | long numBytes = fInfo.Length; | 231 | long numBytes = fInfo.Length; |
231 | 232 | ||
232 | FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read); | 233 | FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read); |
233 | byte[] idata=new byte[numBytes]; | 234 | byte[] idata = new byte[numBytes]; |
234 | BinaryReader br = new BinaryReader(fStream); | 235 | BinaryReader br = new BinaryReader(fStream); |
235 | idata= br.ReadBytes((int)numBytes); | 236 | idata= br.ReadBytes((int)numBytes); |
236 | br.Close(); | 237 | br.Close(); |
237 | fStream.Close(); | 238 | fStream.Close(); |
238 | info.data=idata; | 239 | info.data = idata; |
239 | //info.loaded=true; | 240 | //info.loaded=true; |
240 | } | 241 | } |
241 | 242 | ||
242 | public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset) | 243 | public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset) |
243 | { | 244 | { |
244 | AssetInfo NewAsset=new AssetInfo(); | 245 | AssetInfo NewAsset = new AssetInfo(); |
245 | NewAsset.data=new byte[SourceAsset.data.Length]; | 246 | NewAsset.data = new byte[SourceAsset.data.Length]; |
246 | Array.Copy(SourceAsset.data,NewAsset.data,SourceAsset.data.Length); | 247 | Array.Copy(SourceAsset.data, NewAsset.data, SourceAsset.data.Length); |
247 | NewAsset.Full_ID=LLUUID.Random(); | 248 | NewAsset.FullID = LLUUID.Random(); |
248 | NewAsset.Type=SourceAsset.Type; | 249 | NewAsset.Type = SourceAsset.Type; |
249 | NewAsset.InvType=SourceAsset.InvType; | 250 | NewAsset.InvType = SourceAsset.InvType; |
250 | return(NewAsset); | 251 | return(NewAsset); |
251 | } | 252 | } |
252 | #endregion | 253 | #endregion |
253 | 254 | ||
254 | #region TextureRegion | 255 | #region TextureRegion |
255 | public void AddTextureRequest(User_Agent_info user, LLUUID image_id) | 256 | public void AddTextureRequest(UserAgentInfo userInfo, LLUUID imageID) |
256 | { | 257 | { |
257 | 258 | ||
258 | if(!this.Textures.ContainsKey(image_id)) | 259 | if(!this.Textures.ContainsKey(imageID)) |
259 | { | 260 | { |
260 | //not found image so send back image not in data base message | 261 | //not found image so send back image not in data base message |
261 | ImageNotInDatabasePacket im_not=new ImageNotInDatabasePacket(); | 262 | ImageNotInDatabasePacket im_not = new ImageNotInDatabasePacket(); |
262 | im_not.ImageID.ID=image_id; | 263 | im_not.ImageID.ID=imageID; |
263 | server.SendPacket(im_not, true, user); | 264 | _server.SendPacket(im_not, true, userInfo); |
264 | return; | 265 | return; |
265 | } | 266 | } |
266 | TextureImage imag=this.Textures[image_id]; | 267 | TextureImage imag = this.Textures[imageID]; |
267 | TextureRequest req=new TextureRequest(); | 268 | TextureRequest req = new TextureRequest(); |
268 | req.RequestUser=user; | 269 | req.RequestUser = userInfo; |
269 | req.RequestImage=image_id; | 270 | req.RequestImage = imageID; |
270 | req.image_info=imag; | 271 | req.image_info = imag; |
271 | 272 | ||
272 | if(imag.data.LongLength>1000) //should be bigger or smaller? | 273 | if(imag.data.LongLength>1000) //should be bigger or smaller? |
273 | { | 274 | { |
274 | //over 1000 bytes so split up file | 275 | //over 1000 bytes so split up file |
275 | req.num_packets=(int)imag.data.LongLength/1000; | 276 | req.num_packets = (int)imag.data.LongLength/1000; |
276 | req.num_packets++; | 277 | req.num_packets++; |
277 | } | 278 | } |
278 | else | 279 | else |
279 | { | 280 | { |
280 | req.num_packets=1; | 281 | req.num_packets = 1; |
281 | } | 282 | } |
282 | 283 | ||
283 | this.TextureRequests.Add(req); | 284 | this.TextureRequests.Add(req); |
284 | 285 | ||
285 | } | 286 | } |
286 | 287 | ||
287 | public void AddTexture(LLUUID image_id, string name, byte[] data) | 288 | public void AddTexture(LLUUID imageID, string name, byte[] data) |
288 | { | 289 | { |
289 | 290 | ||
290 | } | 291 | } |
291 | public void DoWork(ulong time) | 292 | public void DoWork(ulong time) |
292 | { | 293 | { |
293 | if(this.TextureRequests.Count==0) | 294 | if(this.TextureRequests.Count == 0) |
294 | { | 295 | { |
295 | //no requests waiting | 296 | //no requests waiting |
296 | return; | 297 | return; |
297 | } | 298 | } |
298 | int num; | 299 | int num; |
299 | //should be running in its own thread but for now is called by timer | 300 | //should be running in its own thread but for now is called by timer |
300 | if(this.TextureRequests.Count<5) | 301 | if(this.TextureRequests.Count < 5) |
301 | { | 302 | { |
302 | //lower than 5 so do all of them | 303 | //lower than 5 so do all of them |
303 | num=this.TextureRequests.Count; | 304 | num = this.TextureRequests.Count; |
304 | } | 305 | } |
305 | else | 306 | else |
306 | { | 307 | { |
307 | num=5; | 308 | num=5; |
308 | } | 309 | } |
309 | TextureRequest req; | 310 | TextureRequest req; |
310 | for(int i=0; i<num; i++) | 311 | for(int i = 0; i < num; i++) |
311 | { | 312 | { |
312 | req=(TextureRequest)this.TextureRequests[i]; | 313 | req=(TextureRequest)this.TextureRequests[i]; |
313 | 314 | ||
314 | if(req.packet_counter==0) | 315 | if(req.packet_counter == 0) |
315 | { | 316 | { |
316 | //first time for this request so send imagedata packet | 317 | //first time for this request so send imagedata packet |
317 | if(req.num_packets==1) | 318 | if(req.num_packets == 1) |
318 | { | 319 | { |
319 | //only one packet so send whole file | 320 | //only one packet so send whole file |
320 | ImageDataPacket im=new ImageDataPacket(); | 321 | ImageDataPacket im = new ImageDataPacket(); |
321 | im.ImageID.Packets=1; | 322 | im.ImageID.Packets = 1; |
322 | im.ImageID.ID=req.image_info.Full_ID; | 323 | im.ImageID.ID = req.image_info.FullID; |
323 | im.ImageID.Size=(uint)req.image_info.data.Length; | 324 | im.ImageID.Size = (uint)req.image_info.data.Length; |
324 | im.ImageData.Data=req.image_info.data; | 325 | im.ImageData.Data = req.image_info.data; |
325 | im.ImageID.Codec=2; | 326 | im.ImageID.Codec = 2; |
326 | server.SendPacket(im,true,req.RequestUser); | 327 | _server.SendPacket(im, true, req.RequestUser); |
327 | req.packet_counter++; | 328 | req.packet_counter++; |
328 | req.image_info.last_used=time; | 329 | req.image_info.last_used = time; |
329 | System.Console.WriteLine("sent texture: "+req.image_info.Full_ID); | 330 | System.Console.WriteLine("sent texture: "+req.image_info.FullID); |
330 | } | 331 | } |
331 | else | 332 | else |
332 | { | 333 | { |
@@ -341,10 +342,10 @@ namespace OpenSim | |||
341 | } | 342 | } |
342 | 343 | ||
343 | //remove requests that have been completed | 344 | //remove requests that have been completed |
344 | for(int i=0; i<num; i++) | 345 | for(int i = 0; i < num; i++) |
345 | { | 346 | { |
346 | req=(TextureRequest)this.TextureRequests[i]; | 347 | req=(TextureRequest)this.TextureRequests[i]; |
347 | if(req.packet_counter==req.num_packets) | 348 | if(req.packet_counter == req.num_packets) |
348 | { | 349 | { |
349 | this.TextureRequests.Remove(req); | 350 | this.TextureRequests.Remove(req); |
350 | } | 351 | } |
@@ -356,15 +357,15 @@ namespace OpenSim | |||
356 | 357 | ||
357 | } | 358 | } |
358 | 359 | ||
359 | public TextureImage CloneImage(LLUUID NewOwner,TextureImage Source) | 360 | public TextureImage CloneImage(LLUUID newOwner, TextureImage source) |
360 | { | 361 | { |
361 | TextureImage NewImage=new TextureImage(); | 362 | TextureImage newImage = new TextureImage(); |
362 | NewImage.data=new byte[Source.data.Length]; | 363 | newImage.data = new byte[source.data.Length]; |
363 | Array.Copy(Source.data,NewImage.data,Source.data.Length); | 364 | Array.Copy(source.data,newImage.data,source.data.Length); |
364 | NewImage.filename=Source.filename; | 365 | newImage.filename = source.filename; |
365 | NewImage.Full_ID=LLUUID.Random(); | 366 | newImage.FullID = LLUUID.Random(); |
366 | NewImage.Name=Source.Name; | 367 | newImage.Name = source.Name; |
367 | return(NewImage); | 368 | return(newImage); |
368 | } | 369 | } |
369 | 370 | ||
370 | #endregion | 371 | #endregion |
@@ -372,12 +373,12 @@ namespace OpenSim | |||
372 | 373 | ||
373 | public class AssetRequest | 374 | public class AssetRequest |
374 | { | 375 | { |
375 | public User_Agent_info RequestUser; | 376 | public UserAgentInfo RequestUser; |
376 | public LLUUID RequestImage; | 377 | public LLUUID RequestImage; |
377 | public AssetInfo asset_inf; | 378 | public AssetInfo asset_inf; |
378 | public long data_pointer=0; | 379 | public long data_pointer = 0; |
379 | public int num_packets=0; | 380 | public int num_packets = 0; |
380 | public int packet_counter=0; | 381 | public int packet_counter = 0; |
381 | 382 | ||
382 | public AssetRequest() | 383 | public AssetRequest() |
383 | { | 384 | { |
@@ -401,7 +402,7 @@ namespace OpenSim | |||
401 | public class AssetBase | 402 | public class AssetBase |
402 | { | 403 | { |
403 | public byte[] data; | 404 | public byte[] data; |
404 | public LLUUID Full_ID; | 405 | public LLUUID FullID; |
405 | public sbyte Type; | 406 | public sbyte Type; |
406 | public sbyte InvType; | 407 | public sbyte InvType; |
407 | public string Name; | 408 | public string Name; |
@@ -413,14 +414,14 @@ namespace OpenSim | |||
413 | 414 | ||
414 | } | 415 | } |
415 | } | 416 | } |
416 | public class TextureRequest | 417 | public class TextureRequest |
417 | { | 418 | { |
418 | public User_Agent_info RequestUser; | 419 | public UserAgentInfo RequestUser; |
419 | public LLUUID RequestImage; | 420 | public LLUUID RequestImage; |
420 | public TextureImage image_info; | 421 | public TextureImage image_info; |
421 | public long data_pointer=0; | 422 | public long data_pointer = 0; |
422 | public int num_packets=0; | 423 | public int num_packets = 0; |
423 | public int packet_counter=0; | 424 | public int packet_counter = 0; |
424 | 425 | ||
425 | public TextureRequest() | 426 | public TextureRequest() |
426 | { | 427 | { |
@@ -435,7 +436,7 @@ namespace OpenSim | |||
435 | //public string name; | 436 | //public string name; |
436 | public bool loaded; | 437 | public bool loaded; |
437 | public ulong last_used; //need to add a tick/time counter and keep record | 438 | public ulong last_used; //need to add a tick/time counter and keep record |
438 | // of how often images are requested to unload unused ones. | 439 | // of how often images are requested to unload unused ones. |
439 | 440 | ||
440 | public TextureImage() | 441 | public TextureImage() |
441 | { | 442 | { |
diff --git a/Controller.cs b/Controller.cs index 3ace638..6282ce3 100644 --- a/Controller.cs +++ b/Controller.cs | |||
@@ -43,47 +43,46 @@ namespace OpenSim | |||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Description of MainForm. | 44 | /// Description of MainForm. |
45 | /// </summary> | 45 | /// </summary> |
46 | public partial class Controller : ServerCallback { | 46 | public partial class Controller : ServerCallback |
47 | 47 | { | |
48 | |||
49 | 48 | ||
50 | [STAThread] | 49 | [STAThread] |
51 | public static void Main( string[] args ) { | 50 | public static void Main( string[] args ) |
51 | { | ||
52 | Controller c = new Controller(); | 52 | Controller c = new Controller(); |
53 | while( true ) // fuckin' a | 53 | while( true ) // fuckin' a |
54 | System.Threading.Thread.Sleep( 1000 ); | 54 | System.Threading.Thread.Sleep( 1000 ); |
55 | |||
56 | } | 55 | } |
57 | public Server server; | 56 | |
58 | public Logon _login; | 57 | private Server _server; |
59 | private AgentManager Agent_Manager; | 58 | private Logon _login; |
60 | private PrimManager Prim_Manager; | 59 | private AgentManager _agentManager; |
61 | private AssetManagement Asset_Manager; | 60 | private PrimManager _primManager; |
62 | private GridManager Grid_Manager; | 61 | private AssetManagement _assetManager; |
63 | private InventoryManager Inventory_Manager; | 62 | private GridManager _gridManager; |
64 | private LoginManager Login_Manager; //built in login server | 63 | private InventoryManager _inventoryManager; |
64 | private LoginManager _loginManager; //built in login server | ||
65 | private ulong time; //ticks | 65 | private ulong time; //ticks |
66 | private Timer timer1 = new Timer(); | 66 | private Timer timer1 = new Timer(); |
67 | 67 | ||
68 | 68 | ||
69 | public Controller() { | 69 | public Controller() { |
70 | _login=new Logon(); // should create a list for these. | 70 | _login = new Logon(); // should create a list for these. |
71 | server = new Server( this ); | 71 | _server = new Server( this ); |
72 | Agent_Manager = new AgentManager( this.server ); | 72 | _agentManager = new AgentManager( this._server ); |
73 | Prim_Manager = new PrimManager( this.server ); | 73 | _primManager = new PrimManager( this._server ); |
74 | Asset_Manager = new AssetManagement( this.server ); | 74 | _inventoryManager = new InventoryManager(this._server); |
75 | Prim_Manager.Agent_Manager = Agent_Manager; | 75 | _assetManager = new AssetManagement(this._server, _inventoryManager ); |
76 | Agent_Manager.Prim_Manager = Prim_Manager; | 76 | _primManager.AgentManagement = _agentManager; |
77 | Agent_Manager.Asset_Manager=Asset_Manager; | 77 | _agentManager.Prim_Manager = _primManager; |
78 | Inventory_Manager=new InventoryManager(this.server); | 78 | _agentManager.assetManager = _assetManager; |
79 | Asset_Manager.InventoryManager=Inventory_Manager; | 79 | _gridManager = new GridManager(this._server, _agentManager); |
80 | Grid_Manager=new GridManager(this.server,Agent_Manager); | ||
81 | 80 | ||
82 | if(Globals.Instance.LoginSever) | 81 | if(Globals.Instance.LoginSever) |
83 | { | 82 | { |
84 | Console.WriteLine("Starting login Server"); | 83 | Console.WriteLine("Starting login Server"); |
85 | Login_Manager = new LoginManager(_login); // startup | 84 | _loginManager = new LoginManager(_login); // startup |
86 | Login_Manager.Startup(); // login server | 85 | _loginManager.Startup(); // login server |
87 | } | 86 | } |
88 | 87 | ||
89 | timer1.Enabled = true; | 88 | timer1.Enabled = true; |
@@ -92,169 +91,162 @@ namespace OpenSim | |||
92 | 91 | ||
93 | 92 | ||
94 | } | 93 | } |
95 | public void MainCallback( Packet pack, User_Agent_info User_info ) { | 94 | public void MainCallback( Packet pack, UserAgentInfo userInfo ) |
95 | { | ||
96 | 96 | ||
97 | /*if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) { | 97 | /*if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) { |
98 | //Log packet? | 98 | //Log packet? |
99 | // System.Console.WriteLine(pack.Type); | 99 | //System.Console.WriteLine(pack.Type); |
100 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; | 100 | //this.richTextBox1.Text = this.richTextBox1.Text + "\n " + pack.Type; |
101 | }*/ | 101 | }*/ |
102 | 102 | ||
103 | //should replace with a switch | 103 | //should replace with a switch |
104 | if( pack.Type == PacketType.AgentSetAppearance ) { | 104 | if( pack.Type == PacketType.AgentSetAppearance ) { |
105 | //System.Console.WriteLine(pack); | 105 | |
106 | //this.richTextBox1.Text=this.richTextBox1.Text+"\n "+pack.Type; | ||
107 | |||
108 | } | 106 | } |
109 | else if( pack.Type == PacketType.FetchInventory) | 107 | else if( pack.Type == PacketType.FetchInventory) |
110 | { | 108 | { |
111 | FetchInventoryPacket FetchInventory=(FetchInventoryPacket)pack; | 109 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)pack; |
112 | Inventory_Manager.FetchInventory(User_info,FetchInventory); | 110 | _inventoryManager.FetchInventory(userInfo, FetchInventory); |
113 | } | 111 | } |
114 | else if( pack.Type == PacketType.FetchInventoryDescendents) | 112 | else if( pack.Type == PacketType.FetchInventoryDescendents) |
115 | { | 113 | { |
116 | FetchInventoryDescendentsPacket Fetch=(FetchInventoryDescendentsPacket)pack; | 114 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)pack; |
117 | Inventory_Manager.FetchInventoryDescendents(User_info,Fetch); | 115 | _inventoryManager.FetchInventoryDescendents(userInfo, Fetch); |
118 | } | 116 | } |
119 | else if(pack.Type== PacketType.MapBlockRequest) | 117 | else if(pack.Type == PacketType.MapBlockRequest) |
120 | { | 118 | { |
121 | //int MinX, MinY, MaxX, MaxY; | ||
122 | MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack; | 119 | MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack; |
123 | this.Grid_Manager.RequestMapBlock(User_info,MapRequest.PositionData.MinX,MapRequest.PositionData.MinY,MapRequest.PositionData.MaxX,MapRequest.PositionData.MaxY); | 120 | this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); |
124 | 121 | ||
125 | } | 122 | } |
126 | else if(pack.Type== PacketType.CloseCircuit) | 123 | else if(pack.Type == PacketType.CloseCircuit) |
127 | { | 124 | { |
128 | this.Agent_Manager.RemoveAgent(User_info); | 125 | this._agentManager.RemoveAgent(userInfo); |
129 | } | 126 | } |
130 | else if(pack.Type== PacketType.MapLayerRequest) | 127 | else if(pack.Type == PacketType.MapLayerRequest) |
131 | { | 128 | { |
132 | this.Grid_Manager.RequestMapLayer(User_info); | 129 | this._gridManager.RequestMapLayer(userInfo); |
133 | |||
134 | } | 130 | } |
135 | else if((pack.Type== PacketType.TeleportRequest ) ||(pack.Type== PacketType.TeleportLocationRequest)) | 131 | else if((pack.Type == PacketType.TeleportRequest ) || (pack.Type == PacketType.TeleportLocationRequest)) |
136 | { | 132 | { |
137 | TeleportLocationRequestPacket Request=(TeleportLocationRequestPacket)pack; | 133 | TeleportLocationRequestPacket Request = (TeleportLocationRequestPacket)pack; |
138 | 134 | this._gridManager.RequestTeleport(userInfo,Request); | |
139 | this.Grid_Manager.RequestTeleport(User_info,Request); | ||
140 | 135 | ||
141 | } | 136 | } |
142 | else if( pack.Type == PacketType.TransferRequest ) { | 137 | else if( pack.Type == PacketType.TransferRequest ) { |
143 | TransferRequestPacket tran = (TransferRequestPacket)pack; | 138 | TransferRequestPacket transfer = (TransferRequestPacket)pack; |
144 | LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 ); | 139 | LLUUID id = new LLUUID( transfer.TransferInfo.Params, 0 ); |
145 | Asset_Manager.AddAssetRequest( User_info, id, tran ); | 140 | _assetManager.AddAssetRequest( userInfo, id, transfer ); |
146 | |||
147 | } | 141 | } |
148 | else if( ( pack.Type == PacketType.StartPingCheck ) ) { | 142 | else if( ( pack.Type == PacketType.StartPingCheck ) ) { |
149 | //reply to pingcheck | 143 | //reply to pingcheck |
150 | libsecondlife.Packets.StartPingCheckPacket startp = (libsecondlife.Packets.StartPingCheckPacket)pack; | 144 | libsecondlife.Packets.StartPingCheckPacket startping = (libsecondlife.Packets.StartPingCheckPacket)pack; |
151 | libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket(); | 145 | libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket(); |
152 | endping.PingID.PingID = startp.PingID.PingID; | 146 | endping.PingID.PingID = startping.PingID.PingID; |
153 | server.SendPacket( endping, true, User_info ); | 147 | _server.SendPacket(endping, true, userInfo ); |
154 | } | 148 | } |
155 | else if( pack.Type == PacketType.CompleteAgentMovement ) | 149 | else if( pack.Type == PacketType.CompleteAgentMovement ) |
156 | { | 150 | { |
157 | // new client | 151 | _agentManager.AgentJoin(userInfo ); |
158 | Agent_Manager.AgentJoin( User_info ); | ||
159 | } | 152 | } |
160 | else if( pack.Type == PacketType.RequestImage ) | 153 | else if( pack.Type == PacketType.RequestImage ) |
161 | { | 154 | { |
162 | RequestImagePacket image_req = (RequestImagePacket)pack; | 155 | RequestImagePacket imageRequest = (RequestImagePacket)pack; |
163 | for( int i = 0; i < image_req.RequestImage.Length; i++ ) | 156 | for( int i = 0; i < imageRequest.RequestImage.Length; i++ ) |
164 | { | 157 | { |
165 | this.Asset_Manager.AddTextureRequest( User_info, image_req.RequestImage[ i ].Image ); | 158 | this._assetManager.AddTextureRequest(userInfo, imageRequest.RequestImage[i].Image); |
166 | } | 159 | } |
167 | } | 160 | } |
168 | else if( pack.Type == PacketType.RegionHandshakeReply ) { | 161 | else if( pack.Type == PacketType.RegionHandshakeReply ) { |
169 | //recieved regionhandshake so can now start sending info | 162 | //recieved regionhandshake so can now start sending info |
170 | Agent_Manager.SendInitialData( User_info ); | 163 | _agentManager.SendInitialData(userInfo ); |
171 | //this.setuptemplates("objectupate164.dat",User_info,false); | 164 | } |
172 | } | ||
173 | else if( pack.Type == PacketType.ObjectAdd ) | 165 | else if( pack.Type == PacketType.ObjectAdd ) |
174 | { | 166 | { |
175 | ObjectAddPacket ad = (ObjectAddPacket)pack; | 167 | ObjectAddPacket ad = (ObjectAddPacket)pack; |
176 | Prim_Manager.CreatePrim( User_info, ad.ObjectData.RayEnd, ad ); | 168 | _primManager.CreatePrim(userInfo, ad.ObjectData.RayEnd, ad ); |
177 | //this.send_prim(User_info,ad.ObjectData.RayEnd, ad); | ||
178 | } | 169 | } |
179 | else if( pack.Type == PacketType.ObjectPosition ) { | 170 | else if( pack.Type == PacketType.ObjectPosition ) { |
180 | //System.Console.WriteLine(pack.ToString()); | 171 | //System.Console.WriteLine(pack.ToString()); |
181 | } | 172 | } |
182 | else if( pack.Type == PacketType.MultipleObjectUpdate ) { | 173 | else if( pack.Type == PacketType.MultipleObjectUpdate ) |
183 | //System.Console.WriteLine(pack.ToString()); | 174 | { |
184 | MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack; | 175 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)pack; |
185 | 176 | ||
186 | for( int i = 0; i < mupd.ObjectData.Length; i++ ) | 177 | for( int i = 0; i < multipleupdate.ObjectData.Length; i++ ) |
187 | { | 178 | { |
188 | if( mupd.ObjectData[ i ].Type == 9 ) //change position | 179 | if( multipleupdate.ObjectData[ i ].Type == 9 ) //change position |
189 | { | 180 | { |
190 | libsecondlife.LLVector3 pos = new LLVector3( mupd.ObjectData[ i ].Data, 0 ); | 181 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[ i ].Data, 0 ); |
191 | // libsecondlife.LLQuaternion rot=new LLQuaternion(mupd.ObjectData[i].Data,12,true); | 182 | _primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID ,false ,libsecondlife.LLQuaternion.Identity); |
192 | Prim_Manager.UpdatePrimPosition( User_info, pos, mupd.ObjectData[ i ].ObjectLocalID ,false ,libsecondlife.LLQuaternion.Identity); | ||
193 | //should update stored position of the prim | 183 | //should update stored position of the prim |
194 | } | 184 | } |
195 | else if( mupd.ObjectData[ i ].Type == 10 ) | 185 | else if(multipleupdate.ObjectData[i].Type == 10 )//rotation |
196 | { | 186 | { |
197 | //System.Console.WriteLine(mupd.ObjectData[ i ].Type); | ||
198 | //System.Console.WriteLine(mupd); | ||
199 | libsecondlife.LLVector3 pos = new LLVector3(100,100,22); | 187 | libsecondlife.LLVector3 pos = new LLVector3(100,100,22); |
200 | libsecondlife.LLQuaternion rot=new LLQuaternion(mupd.ObjectData[i].Data,0,true); | 188 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); |
201 | Prim_Manager.UpdatePrimPosition( User_info, pos, mupd.ObjectData[ i ].ObjectLocalID ,true ,rot); | 189 | _primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID, true ,rot); |
202 | |||
203 | } | 190 | } |
204 | } | 191 | } |
205 | } | 192 | } |
206 | else if( pack.Type == PacketType.AgentWearablesRequest ) | 193 | else if( pack.Type == PacketType.AgentWearablesRequest ) |
207 | { | 194 | { |
208 | Agent_Manager.SendIntialAvatarAppearance( User_info ); | 195 | _agentManager.SendIntialAvatarAppearance(userInfo ); |
209 | } | 196 | } |
210 | else if( pack.Type == PacketType.AgentUpdate ) | 197 | else if(pack.Type == PacketType.AgentUpdate) |
211 | { | 198 | { |
212 | AgentUpdatePacket ag = (AgentUpdatePacket)pack; | 199 | // System.Console.WriteLine("agent update"); |
213 | uint mask = ag.AgentData.ControlFlags & ( 1 ); | 200 | AgentUpdatePacket agent = (AgentUpdatePacket)pack; |
214 | AvatarData m_av = Agent_Manager.GetAgent( User_info.AgentID ); | 201 | uint mask = agent.AgentData.ControlFlags & ( 1 ); |
215 | if( m_av != null ) | 202 | AvatarData avatar = _agentManager.GetAgent(userInfo.AgentID ); |
216 | { | 203 | if(avatar != null ) |
217 | if( m_av.Started ) | 204 | { |
205 | if(avatar.Started ) | ||
218 | { | 206 | { |
219 | if( mask == ( 1 ) ) | 207 | if( mask == ( 1 ) ) |
220 | { | 208 | { |
221 | if( !m_av.Walk ) | 209 | if(!avatar.Walk) |
222 | { | 210 | { |
223 | //start walking | 211 | //start walking |
224 | Agent_Manager.SendMoveCommand( User_info, false, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation ); | 212 | _agentManager.SendMoveCommand(userInfo, false, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation ); |
225 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 ); | 213 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 ); |
226 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion( ag.AgentData.BodyRotation.W, ag.AgentData.BodyRotation.X, ag.AgentData.BodyRotation.Y, ag.AgentData.BodyRotation.Z ); | 214 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion( agent.AgentData.BodyRotation.W, agent.AgentData.BodyRotation.X, agent.AgentData.BodyRotation.Y, agent.AgentData.BodyRotation.Z ); |
227 | Axiom.MathLib.Vector3 direc = q * v3; | 215 | Axiom.MathLib.Vector3 direc = q * v3; |
228 | direc.Normalize(); | 216 | direc.Normalize(); |
229 | direc = direc * ( ( 0.03f ) * 128f ); | 217 | direc = direc * ( ( 0.03f ) * 128f ); |
230 | 218 | ||
231 | m_av.Velocity.X = direc.x; | 219 | avatar.Velocity.X = direc.x; |
232 | m_av.Velocity.Y = direc.y; | 220 | avatar.Velocity.Y = direc.y; |
233 | m_av.Velocity.Z = direc.z; | 221 | avatar.Velocity.Z = direc.z; |
234 | m_av.Walk = true; | 222 | avatar.Walk = true; |
235 | } | 223 | } |
236 | } | 224 | } |
237 | else | 225 | else |
238 | { | 226 | { |
239 | if( m_av.Walk ) | 227 | if(avatar.Walk) |
240 | { | 228 | { |
241 | //walking but key not pressed so need to stop | 229 | //walking but key not pressed so need to stop |
242 | Agent_Manager.SendMoveCommand( User_info, true, m_av.Position.X, m_av.Position.Y, m_av.Position.Z, 0, ag.AgentData.BodyRotation ); | 230 | _agentManager.SendMoveCommand(userInfo, true, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation ); |
243 | m_av.Walk = false; | 231 | avatar.Walk = false; |
244 | m_av.Velocity.X = 0; | 232 | avatar.Velocity.X = 0; |
245 | m_av.Velocity.Y = 0; | 233 | avatar.Velocity.Y = 0; |
246 | m_av.Velocity.Z = 0; | 234 | avatar.Velocity.Z = 0; |
247 | } | 235 | } |
248 | } | 236 | } |
249 | } | 237 | } |
250 | } | 238 | } |
239 | else | ||
240 | { | ||
241 | |||
242 | } | ||
251 | } | 243 | } |
252 | else if( pack.Type == PacketType.ChatFromViewer ) | 244 | else if( pack.Type == PacketType.ChatFromViewer ) |
253 | { | 245 | { |
254 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; | 246 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; |
255 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 247 | System.Text.Encoding enc = System.Text.Encoding.ASCII; |
256 | 248 | ||
257 | string myString = enc.GetString( chat.ChatData.Message ); | 249 | string myString = enc.GetString(chat.ChatData.Message ); |
258 | if( myString != "" ) { | 250 | if( myString != "" ) { |
259 | string[] comp = new string[ 10 ]; | 251 | string[] comp = new string[ 10 ]; |
260 | string delimStr = " , "; | 252 | string delimStr = " , "; |
@@ -271,34 +263,32 @@ namespace OpenSim | |||
271 | } | 263 | } |
272 | else | 264 | else |
273 | { | 265 | { |
274 | Agent_Manager.SendChatMessage( User_info, line ); | 266 | _agentManager.SendChatMessage(userInfo, line ); |
275 | |||
276 | } | 267 | } |
277 | } | 268 | } |
278 | } | 269 | } |
279 | } | 270 | } |
280 | public void NewUserCallback( User_Agent_info UserInfo ) | 271 | public void NewUserCallback(UserAgentInfo userInfo ) |
281 | { | 272 | { |
282 | Console.WriteLine( "new user - {0} - has joined [session {1}]", UserInfo.AgentID.ToString(), UserInfo.SessionID.ToString() +"curcuit used"+UserInfo.circuitCode); | 273 | Console.WriteLine( "new user - {0} - has joined [session {1}]", userInfo.AgentID.ToString(), userInfo.SessionID.ToString() +"curcuit used"+userInfo.circuitCode); |
283 | string first,last; | 274 | string first,last; |
284 | LLUUID Base,Inventory; | 275 | LLUUID Base,Inventory; |
285 | lock(_login) | 276 | lock(_login) |
286 | { | 277 | { |
287 | first=_login.first; | 278 | first=_login.First; |
288 | last=_login.last; | 279 | last=_login.Last; |
289 | Base=_login.BaseFolder; | 280 | Base=_login.BaseFolder; |
290 | Inventory=_login.InventoryFolder; | 281 | Inventory=_login.InventoryFolder; |
291 | |||
292 | //should get agentid and sessionid so they can be checked. | 282 | //should get agentid and sessionid so they can be checked. |
293 | } | 283 | } |
294 | Agent_Manager.NewAgent( UserInfo ,first,last,Base,Inventory); | 284 | _agentManager.NewAgent(userInfo, first, last, Base, Inventory); |
295 | //now because of the lack of Global account management (User server etc) | 285 | //now because of the lack of Global account management (User server etc) |
296 | //we need to reset the names back to default incase a teleport happens | 286 | //we need to reset the names back to default incase a teleport happens |
297 | //which will not have a Login name set, so they will use default names | 287 | //which will not have a Login name set, so they will use default names |
298 | lock(_login) | 288 | lock(_login) |
299 | { | 289 | { |
300 | _login.first="Test"; | 290 | _login.First="Test"; |
301 | _login.last="User"; | 291 | _login.Last="User"; |
302 | } | 292 | } |
303 | } | 293 | } |
304 | 294 | ||
@@ -308,14 +298,14 @@ namespace OpenSim | |||
308 | 298 | ||
309 | void Timer1Tick( object sender, System.EventArgs e ) { | 299 | void Timer1Tick( object sender, System.EventArgs e ) { |
310 | this.time++; | 300 | this.time++; |
311 | Agent_Manager.UpdatePositions(); | 301 | _agentManager.UpdatePositions(); |
312 | this.Asset_Manager.DoWork( time ); | 302 | this._assetManager.DoWork( time ); |
313 | } | 303 | } |
314 | } | 304 | } |
315 | public class Logon | 305 | public class Logon |
316 | { | 306 | { |
317 | public string first="Test"; | 307 | public string First = "Test"; |
318 | public string last="User"; | 308 | public string Last = "User"; |
319 | public LLUUID Agent; | 309 | public LLUUID Agent; |
320 | public LLUUID Session; | 310 | public LLUUID Session; |
321 | public LLUUID InventoryFolder; | 311 | public LLUUID InventoryFolder; |
@@ -38,8 +38,10 @@ namespace OpenSim | |||
38 | { | 38 | { |
39 | private static Globals instance = new Globals(); | 39 | private static Globals instance = new Globals(); |
40 | 40 | ||
41 | public static Globals Instance { | 41 | public static Globals Instance |
42 | get { | 42 | { |
43 | get | ||
44 | { | ||
43 | return instance; | 45 | return instance; |
44 | } | 46 | } |
45 | } | 47 | } |
@@ -48,17 +50,13 @@ namespace OpenSim | |||
48 | { | 50 | { |
49 | } | 51 | } |
50 | 52 | ||
51 | public string RegionName="Test Sandbox\0"; | 53 | public string RegionName = "Test Sandbox\0"; |
52 | public ulong RegionHandle= 1096213093147648; | 54 | public ulong RegionHandle = 1096213093147648; |
53 | public int IpPort=1000; | 55 | public int IpPort = 1000; |
54 | 56 | ||
55 | public bool LoginSever=true; | 57 | public bool LoginSever = true; |
56 | public ushort LoginServerPort=8080; | 58 | public ushort LoginServerPort = 8080; |
57 | 59 | ||
58 | //public string RegionName= "The Other\0"; | ||
59 | //public ulong RegionHandle= 1095113581519872; | ||
60 | //public int IpPort=1020; | ||
61 | //public bool LoginSever=false; | ||
62 | 60 | ||
63 | } | 61 | } |
64 | } | 62 | } |
diff --git a/GridManager.cs b/GridManager.cs index c6b7c49..c52bd51 100644 --- a/GridManager.cs +++ b/GridManager.cs | |||
@@ -44,21 +44,21 @@ namespace OpenSim | |||
44 | /// </summary> | 44 | /// </summary> |
45 | public class GridManager | 45 | public class GridManager |
46 | { | 46 | { |
47 | private Server server; | 47 | private Server _server; |
48 | private System.Text.Encoding enc = System.Text.Encoding.ASCII; | 48 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
49 | private AgentManager AgentManager; | 49 | private AgentManager _agentManager; |
50 | private Dictionary<ulong,RegionInfo> Grid; | 50 | public Dictionary<ulong,RegionInfo> Grid; |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// | 53 | /// |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <param name="serve"></param> | 55 | /// <param name="serve"></param> |
56 | /// <param name="agentManager"></param> | 56 | /// <param name="agentManager"></param> |
57 | public GridManager(Server serve, AgentManager agentManager) | 57 | public GridManager(Server server, AgentManager agentManager) |
58 | { | 58 | { |
59 | Grid=new Dictionary<ulong, RegionInfo>(); | 59 | Grid = new Dictionary<ulong, RegionInfo>(); |
60 | server=serve; | 60 | _server = server; |
61 | AgentManager=agentManager; | 61 | _agentManager = agentManager; |
62 | LoadGrid(); | 62 | LoadGrid(); |
63 | } | 63 | } |
64 | 64 | ||
@@ -66,20 +66,20 @@ namespace OpenSim | |||
66 | /// | 66 | /// |
67 | /// </summary> | 67 | /// </summary> |
68 | /// <param name="UserInfo"></param> | 68 | /// <param name="UserInfo"></param> |
69 | public void RequestMapLayer(User_Agent_info UserInfo) | 69 | public void RequestMapLayer(UserAgentInfo userInfo) |
70 | { | 70 | { |
71 | //send a layer covering the 800,800 - 1200,1200 area | 71 | //send a layer covering the 800,800 - 1200,1200 area |
72 | MapLayerReplyPacket MapReply=new MapLayerReplyPacket(); | 72 | MapLayerReplyPacket MapReply = new MapLayerReplyPacket(); |
73 | MapReply.AgentData.AgentID=UserInfo.AgentID; | 73 | MapReply.AgentData.AgentID = userInfo.AgentID; |
74 | MapReply.AgentData.Flags=0; | 74 | MapReply.AgentData.Flags = 0; |
75 | MapReply.LayerData=new MapLayerReplyPacket.LayerDataBlock[1]; | 75 | MapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; |
76 | MapReply.LayerData[0]=new MapLayerReplyPacket.LayerDataBlock(); | 76 | MapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); |
77 | MapReply.LayerData[0].Bottom=800; | 77 | MapReply.LayerData[0].Bottom = 800; |
78 | MapReply.LayerData[0].Left=800; | 78 | MapReply.LayerData[0].Left = 800; |
79 | MapReply.LayerData[0].Top=1200; | 79 | MapReply.LayerData[0].Top = 1200; |
80 | MapReply.LayerData[0].Right=1200; | 80 | MapReply.LayerData[0].Right = 1200; |
81 | MapReply.LayerData[0].ImageID=new LLUUID("00000000-0000-0000-7007-000000000006"); | 81 | MapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-7007-000000000006"); |
82 | server.SendPacket(MapReply,true,UserInfo); | 82 | _server.SendPacket(MapReply, true, userInfo); |
83 | } | 83 | } |
84 | 84 | ||
85 | /// <summary> | 85 | /// <summary> |
@@ -90,28 +90,28 @@ namespace OpenSim | |||
90 | /// <param name="MinY"></param> | 90 | /// <param name="MinY"></param> |
91 | /// <param name="MaxX"></param> | 91 | /// <param name="MaxX"></param> |
92 | /// <param name="MaxY"></param> | 92 | /// <param name="MaxY"></param> |
93 | public void RequestMapBlock(User_Agent_info UserInfo, int MinX, int MinY,int MaxX,int MaxY) | 93 | public void RequestMapBlock(UserAgentInfo userInfo, int minX, int minY,int maxX,int maxY) |
94 | { | 94 | { |
95 | foreach (KeyValuePair<ulong,RegionInfo> RegionPair in this.Grid) | 95 | foreach (KeyValuePair<ulong, RegionInfo> RegionPair in this.Grid) |
96 | { | 96 | { |
97 | //check Region is inside the requested area | 97 | //check Region is inside the requested area |
98 | RegionInfo Region=RegionPair.Value; | 98 | RegionInfo Region = RegionPair.Value; |
99 | if(((Region.X>MinX) && (Region.X<MaxX)) && ((Region.Y>MinY) && (Region.Y<MaxY))) | 99 | if(((Region.X > minX) && (Region.X < maxX)) && ((Region.Y > minY) && (Region.Y < maxY))) |
100 | { | 100 | { |
101 | MapBlockReplyPacket MapReply=new MapBlockReplyPacket(); | 101 | MapBlockReplyPacket MapReply = new MapBlockReplyPacket(); |
102 | MapReply.AgentData.AgentID=UserInfo.AgentID; | 102 | MapReply.AgentData.AgentID = userInfo.AgentID; |
103 | MapReply.AgentData.Flags=0; | 103 | MapReply.AgentData.Flags = 0; |
104 | MapReply.Data=new MapBlockReplyPacket.DataBlock[1]; | 104 | MapReply.Data = new MapBlockReplyPacket.DataBlock[1]; |
105 | MapReply.Data[0]=new MapBlockReplyPacket.DataBlock(); | 105 | MapReply.Data[0] = new MapBlockReplyPacket.DataBlock(); |
106 | MapReply.Data[0].MapImageID=Region.ImageID; | 106 | MapReply.Data[0].MapImageID = Region.ImageID; |
107 | MapReply.Data[0].X=Region.X; | 107 | MapReply.Data[0].X = Region.X; |
108 | MapReply.Data[0].Y=Region.Y; | 108 | MapReply.Data[0].Y = Region.Y; |
109 | MapReply.Data[0].WaterHeight=Region.WaterHeight; | 109 | MapReply.Data[0].WaterHeight = Region.WaterHeight; |
110 | MapReply.Data[0].Name=enc.GetBytes( Region.Name); | 110 | MapReply.Data[0].Name = _enc.GetBytes( Region.Name); |
111 | MapReply.Data[0].RegionFlags=72458694; | 111 | MapReply.Data[0].RegionFlags = 72458694; |
112 | MapReply.Data[0].Access=13; | 112 | MapReply.Data[0].Access = 13; |
113 | MapReply.Data[0].Agents=1; | 113 | MapReply.Data[0].Agents = 1; |
114 | server.SendPacket(MapReply,true,UserInfo); | 114 | _server.SendPacket(MapReply, true, userInfo); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
@@ -122,35 +122,35 @@ namespace OpenSim | |||
122 | /// </summary> | 122 | /// </summary> |
123 | /// <param name="UserInfo"></param> | 123 | /// <param name="UserInfo"></param> |
124 | /// <param name="Request"></param> | 124 | /// <param name="Request"></param> |
125 | public void RequestTeleport(User_Agent_info UserInfo, TeleportLocationRequestPacket Request) | 125 | public void RequestTeleport(UserAgentInfo userInfo, TeleportLocationRequestPacket request) |
126 | { | 126 | { |
127 | if(Grid.ContainsKey(Request.Info.RegionHandle)) | 127 | if(Grid.ContainsKey(request.Info.RegionHandle)) |
128 | { | 128 | { |
129 | RegionInfo Region=Grid[Request.Info.RegionHandle]; | 129 | RegionInfo Region = Grid[request.Info.RegionHandle]; |
130 | libsecondlife.Packets.TeleportStartPacket TeleportStart=new TeleportStartPacket(); | 130 | libsecondlife.Packets.TeleportStartPacket TeleportStart = new TeleportStartPacket(); |
131 | TeleportStart.Info.TeleportFlags=16; | 131 | TeleportStart.Info.TeleportFlags = 16; |
132 | server.SendPacket(TeleportStart,true,UserInfo); | 132 | _server.SendPacket(TeleportStart, true, userInfo); |
133 | 133 | ||
134 | libsecondlife.Packets.TeleportFinishPacket Teleport=new TeleportFinishPacket(); | 134 | libsecondlife.Packets.TeleportFinishPacket Teleport = new TeleportFinishPacket(); |
135 | Teleport.Info.AgentID=UserInfo.AgentID; | 135 | Teleport.Info.AgentID = userInfo.AgentID; |
136 | Teleport.Info.RegionHandle=Request.Info.RegionHandle; | 136 | Teleport.Info.RegionHandle = request.Info.RegionHandle; |
137 | Teleport.Info.SimAccess=13; | 137 | Teleport.Info.SimAccess = 13; |
138 | Teleport.Info.SeedCapability=new byte[0]; | 138 | Teleport.Info.SeedCapability = new byte[0]; |
139 | 139 | ||
140 | System.Net.IPAddress oIP=System.Net.IPAddress.Parse(Region.IPAddress.Address); | 140 | System.Net.IPAddress oIP = System.Net.IPAddress.Parse(Region.IPAddress.Address); |
141 | byte[] byteIP=oIP.GetAddressBytes(); | 141 | byte[] byteIP = oIP.GetAddressBytes(); |
142 | uint ip=(uint)byteIP[3]<<24; | 142 | uint ip=(uint)byteIP[3]<<24; |
143 | ip+=(uint)byteIP[2]<<16; | 143 | ip+=(uint)byteIP[2]<<16; |
144 | ip+=(uint)byteIP[1]<<8; | 144 | ip+=(uint)byteIP[1]<<8; |
145 | ip+=(uint)byteIP[0]; | 145 | ip+=(uint)byteIP[0]; |
146 | 146 | ||
147 | Teleport.Info.SimIP=ip; | 147 | Teleport.Info.SimIP = ip; |
148 | Teleport.Info.SimPort=Region.IPAddress.Port; | 148 | Teleport.Info.SimPort = Region.IPAddress.Port; |
149 | Teleport.Info.LocationID=4; | 149 | Teleport.Info.LocationID = 4; |
150 | Teleport.Info.TeleportFlags= 1 << 4;; | 150 | Teleport.Info.TeleportFlags = 1 << 4;; |
151 | server.SendPacket(Teleport,true,UserInfo); | 151 | _server.SendPacket(Teleport, true, userInfo); |
152 | 152 | ||
153 | this.AgentManager.RemoveAgent(UserInfo); | 153 | this._agentManager.RemoveAgent(userInfo); |
154 | } | 154 | } |
155 | 155 | ||
156 | } | 156 | } |
@@ -162,13 +162,13 @@ namespace OpenSim | |||
162 | { | 162 | { |
163 | //should connect to a space server to see what grids there are | 163 | //should connect to a space server to see what grids there are |
164 | //but for now we read static xml files | 164 | //but for now we read static xml files |
165 | ulong CurrentHandle=0; | 165 | ulong CurrentHandle = 0; |
166 | bool Login=true; | 166 | bool Login = true; |
167 | 167 | ||
168 | XmlDocument doc = new XmlDocument(); | 168 | XmlDocument doc = new XmlDocument(); |
169 | 169 | ||
170 | try { | 170 | try { |
171 | doc.Load(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"Grid.ini" )); | 171 | doc.Load(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Grid.ini" )); |
172 | } | 172 | } |
173 | catch ( Exception e) | 173 | catch ( Exception e) |
174 | { | 174 | { |
@@ -189,102 +189,102 @@ namespace OpenSim | |||
189 | if (nodes.HasChildNodes) { | 189 | if (nodes.HasChildNodes) { |
190 | foreach( XmlNode xmlnc in nodes.ChildNodes) | 190 | foreach( XmlNode xmlnc in nodes.ChildNodes) |
191 | { | 191 | { |
192 | if(xmlnc.Name=="Region") | 192 | if(xmlnc.Name == "Region") |
193 | { | 193 | { |
194 | string xmlAttri; | 194 | string xmlAttri; |
195 | RegionInfo Region=new RegionInfo(); | 195 | RegionInfo Region = new RegionInfo(); |
196 | if(xmlnc.Attributes["Name"]!=null) | 196 | if(xmlnc.Attributes["Name"] != null) |
197 | { | 197 | { |
198 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Name")).Value; | 198 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Name")).Value; |
199 | Region.Name=xmlAttri+" \0"; | 199 | Region.Name = xmlAttri+" \0"; |
200 | } | 200 | } |
201 | if(xmlnc.Attributes["ImageID"]!=null) | 201 | if(xmlnc.Attributes["ImageID"] != null) |
202 | { | 202 | { |
203 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("ImageID")).Value; | 203 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("ImageID")).Value; |
204 | Region.ImageID=new LLUUID(xmlAttri); | 204 | Region.ImageID = new LLUUID(xmlAttri); |
205 | } | 205 | } |
206 | if(xmlnc.Attributes["IP_Address"]!=null) | 206 | if(xmlnc.Attributes["IP_Address"] != null) |
207 | { | 207 | { |
208 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Address")).Value; | 208 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Address")).Value; |
209 | Region.IPAddress.Address=xmlAttri; | 209 | Region.IPAddress.Address = xmlAttri; |
210 | } | 210 | } |
211 | if(xmlnc.Attributes["IP_Port"]!=null) | 211 | if(xmlnc.Attributes["IP_Port"] != null) |
212 | { | 212 | { |
213 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Port")).Value; | 213 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("IP_Port")).Value; |
214 | Region.IPAddress.Port=Convert.ToUInt16(xmlAttri); | 214 | Region.IPAddress.Port = Convert.ToUInt16(xmlAttri); |
215 | } | 215 | } |
216 | if(xmlnc.Attributes["Location_X"]!=null) | 216 | if(xmlnc.Attributes["Location_X"] != null) |
217 | { | 217 | { |
218 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_X")).Value; | 218 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_X")).Value; |
219 | Region.X=Convert.ToUInt16(xmlAttri); | 219 | Region.X = Convert.ToUInt16(xmlAttri); |
220 | } | 220 | } |
221 | if(xmlnc.Attributes["Location_Y"]!=null) | 221 | if(xmlnc.Attributes["Location_Y"] != null) |
222 | { | 222 | { |
223 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_Y")).Value; | 223 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Location_Y")).Value; |
224 | Region.Y=Convert.ToUInt16(xmlAttri); | 224 | Region.Y = Convert.ToUInt16(xmlAttri); |
225 | } | 225 | } |
226 | 226 | ||
227 | this.Grid.Add(Region.Handle,Region); | 227 | this.Grid.Add(Region.Handle, Region); |
228 | 228 | ||
229 | } | 229 | } |
230 | if(xmlnc.Name=="CurrentRegion") | 230 | if(xmlnc.Name == "CurrentRegion") |
231 | { | 231 | { |
232 | 232 | ||
233 | string xmlAttri; | 233 | string xmlAttri; |
234 | uint Rx=0,Ry=0; | 234 | uint Rx = 0, Ry = 0; |
235 | if(xmlnc.Attributes["RegionHandle"]!=null) | 235 | if(xmlnc.Attributes["RegionHandle"] != null) |
236 | { | 236 | { |
237 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("RegionHandle")).Value; | 237 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("RegionHandle")).Value; |
238 | CurrentHandle=Convert.ToUInt64(xmlAttri); | 238 | CurrentHandle = Convert.ToUInt64(xmlAttri); |
239 | 239 | ||
240 | } | 240 | } |
241 | else | 241 | else |
242 | { | 242 | { |
243 | if(xmlnc.Attributes["Region_X"]!=null) | 243 | if(xmlnc.Attributes["Region_X"] != null) |
244 | { | 244 | { |
245 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_X")).Value; | 245 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_X")).Value; |
246 | Rx=Convert.ToUInt32(xmlAttri); | 246 | Rx = Convert.ToUInt32(xmlAttri); |
247 | } | 247 | } |
248 | if(xmlnc.Attributes["Region_Y"]!=null) | 248 | if(xmlnc.Attributes["Region_Y"] != null) |
249 | { | 249 | { |
250 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_Y")).Value; | 250 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("Region_Y")).Value; |
251 | Ry=Convert.ToUInt32(xmlAttri); | 251 | Ry = Convert.ToUInt32(xmlAttri); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | if(xmlnc.Attributes["LoginServer"]!=null) | 254 | if(xmlnc.Attributes["LoginServer"] != null) |
255 | { | 255 | { |
256 | xmlAttri=((XmlAttribute)xmlnc.Attributes.GetNamedItem("LoginServer")).Value; | 256 | xmlAttri = ((XmlAttribute)xmlnc.Attributes.GetNamedItem("LoginServer")).Value; |
257 | Login=Convert.ToBoolean(xmlAttri); | 257 | Login = Convert.ToBoolean(xmlAttri); |
258 | 258 | ||
259 | } | 259 | } |
260 | if(CurrentHandle==0) | 260 | if(CurrentHandle == 0) |
261 | { | 261 | { |
262 | //no RegionHandle set | 262 | //no RegionHandle set |
263 | //so check for Region X and Y | 263 | //so check for Region X and Y |
264 | if((Rx >0) && (Ry>0)) | 264 | if((Rx > 0) && (Ry > 0)) |
265 | { | 265 | { |
266 | CurrentHandle=Helpers.UIntsToLong((Rx*256),(Ry*256)); | 266 | CurrentHandle = Helpers.UIntsToLong((Rx*256), (Ry*256)); |
267 | } | 267 | } |
268 | else | 268 | else |
269 | { | 269 | { |
270 | //seems to be no Region location set | 270 | //seems to be no Region location set |
271 | // so set default | 271 | // so set default |
272 | CurrentHandle=1096213093147648; | 272 | CurrentHandle = 1096213093147648; |
273 | } | 273 | } |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | //finished loading grid, now set Globals to current region | 278 | //finished loading grid, now set Globals to current region |
279 | if(CurrentHandle!=0) | 279 | if(CurrentHandle != 0) |
280 | { | 280 | { |
281 | if(Grid.ContainsKey(CurrentHandle)) | 281 | if(Grid.ContainsKey(CurrentHandle)) |
282 | { | 282 | { |
283 | RegionInfo Region=Grid[CurrentHandle]; | 283 | RegionInfo Region = Grid[CurrentHandle]; |
284 | Globals.Instance.RegionHandle=Region.Handle; | 284 | Globals.Instance.RegionHandle = Region.Handle; |
285 | Globals.Instance.RegionName=Region.Name; | 285 | Globals.Instance.RegionName = Region.Name; |
286 | Globals.Instance.IpPort=Region.IPAddress.Port; | 286 | Globals.Instance.IpPort = Region.IPAddress.Port; |
287 | Globals.Instance.LoginSever=Login; | 287 | Globals.Instance.LoginSever = Login; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
@@ -317,8 +317,8 @@ namespace OpenSim | |||
317 | } | 317 | } |
318 | set | 318 | set |
319 | { | 319 | { |
320 | x=value; | 320 | x = value; |
321 | Handle=Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256)); | 321 | Handle = Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256)); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | public ushort Y | 324 | public ushort Y |
@@ -329,33 +329,33 @@ namespace OpenSim | |||
329 | } | 329 | } |
330 | set | 330 | set |
331 | { | 331 | { |
332 | y=value; | 332 | y = value; |
333 | Handle=Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256)); | 333 | Handle = Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256)); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | public ulong Handle | 336 | public ulong Handle |
337 | { | 337 | { |
338 | get | 338 | get |
339 | { | 339 | { |
340 | if(handle>0) | 340 | if(handle > 0) |
341 | { | 341 | { |
342 | return(handle); | 342 | return(handle); |
343 | } | 343 | } |
344 | else | 344 | else |
345 | { | 345 | { |
346 | return(Helpers.UIntsToLong((((uint)x)*256),(((uint)y)*256))); | 346 | return(Helpers.UIntsToLong((((uint)x)*256), (((uint)y)*256))); |
347 | } | 347 | } |
348 | } | 348 | } |
349 | set | 349 | set |
350 | { | 350 | { |
351 | handle=value; | 351 | handle = value; |
352 | } | 352 | } |
353 | 353 | ||
354 | } | 354 | } |
355 | 355 | ||
356 | public RegionInfo() | 356 | public RegionInfo() |
357 | { | 357 | { |
358 | this.IPAddress=new RegionIP(); | 358 | this.IPAddress = new RegionIP(); |
359 | } | 359 | } |
360 | } | 360 | } |
361 | public class RegionIP | 361 | public class RegionIP |
diff --git a/InventoryManager.cs b/InventoryManager.cs index 72c9607..17f7f5c 100644 --- a/InventoryManager.cs +++ b/InventoryManager.cs | |||
@@ -38,20 +38,20 @@ namespace OpenSim | |||
38 | /// </summary> | 38 | /// </summary> |
39 | public class InventoryManager | 39 | public class InventoryManager |
40 | { | 40 | { |
41 | private System.Text.Encoding enc = System.Text.Encoding.ASCII; | 41 | |
42 | public Dictionary<LLUUID, InventoryFolder> Folders; | 42 | public Dictionary<LLUUID, InventoryFolder> Folders; |
43 | public Dictionary<LLUUID, InventoryItem> Items; | 43 | public Dictionary<LLUUID, InventoryItem> Items; |
44 | private Server server; | 44 | private Server _server; |
45 | 45 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; | |
46 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | 46 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// | 49 | /// |
50 | /// </summary> | 50 | /// </summary> |
51 | /// <param name="serve"></param> | 51 | /// <param name="serve"></param> |
52 | public InventoryManager(Server serve) | 52 | public InventoryManager(Server server) |
53 | { | 53 | { |
54 | server=serve; | 54 | _server = server; |
55 | Folders=new Dictionary<LLUUID, InventoryFolder>(); | 55 | Folders=new Dictionary<LLUUID, InventoryFolder>(); |
56 | Items=new Dictionary<LLUUID, InventoryItem>(); | 56 | Items=new Dictionary<LLUUID, InventoryItem>(); |
57 | } | 57 | } |
@@ -63,23 +63,23 @@ namespace OpenSim | |||
63 | /// <param name="FolderID"></param> | 63 | /// <param name="FolderID"></param> |
64 | /// <param name="Asset"></param> | 64 | /// <param name="Asset"></param> |
65 | /// <returns></returns> | 65 | /// <returns></returns> |
66 | public LLUUID AddToInventory(User_Agent_info UserInfo, LLUUID FolderID,AssetBase Asset) | 66 | public LLUUID AddToInventory(UserAgentInfo userInfo, LLUUID folderID, AssetBase asset) |
67 | { | 67 | { |
68 | if(this.Folders.ContainsKey(FolderID)) | 68 | if(this.Folders.ContainsKey(folderID)) |
69 | { | 69 | { |
70 | LLUUID NewItemID=LLUUID.Random(); | 70 | LLUUID NewItemID = LLUUID.Random(); |
71 | 71 | ||
72 | InventoryItem Item=new InventoryItem(); | 72 | InventoryItem Item = new InventoryItem(); |
73 | Item.FolderID=FolderID; | 73 | Item.FolderID = folderID; |
74 | Item.OwnerID=UserInfo.AgentID; | 74 | Item.OwnerID = userInfo.AgentID; |
75 | Item.AssetID=Asset.Full_ID; | 75 | Item.AssetID = asset.FullID; |
76 | Item.ItemID=NewItemID; | 76 | Item.ItemID = NewItemID; |
77 | Item.Type=Asset.Type; | 77 | Item.Type = asset.Type; |
78 | Item.Name=Asset.Name; | 78 | Item.Name = asset.Name; |
79 | Item.Description=Asset.Description; | 79 | Item.Description = asset.Description; |
80 | Item.InvType=Asset.InvType; | 80 | Item.InvType = asset.InvType; |
81 | this.Items.Add(Item.ItemID,Item); | 81 | this.Items.Add(Item.ItemID, Item); |
82 | InventoryFolder Folder=Folders[Item.FolderID]; | 82 | InventoryFolder Folder = Folders[Item.FolderID]; |
83 | Folder.Items.Add(Item); | 83 | Folder.Items.Add(Item); |
84 | return(Item.ItemID); | 84 | return(Item.ItemID); |
85 | } | 85 | } |
@@ -95,12 +95,12 @@ namespace OpenSim | |||
95 | /// <param name="UserInfo"></param> | 95 | /// <param name="UserInfo"></param> |
96 | /// <param name="NewFolder"></param> | 96 | /// <param name="NewFolder"></param> |
97 | /// <returns></returns> | 97 | /// <returns></returns> |
98 | public bool CreateNewFolder(User_Agent_info UserInfo, LLUUID NewFolder) | 98 | public bool CreateNewFolder(UserAgentInfo userInfo, LLUUID newFolder) |
99 | { | 99 | { |
100 | InventoryFolder Folder=new InventoryFolder(); | 100 | InventoryFolder Folder = new InventoryFolder(); |
101 | Folder.FolderID=NewFolder; | 101 | Folder.FolderID = newFolder; |
102 | Folder.OwnerID=UserInfo.AgentID; | 102 | Folder.OwnerID = userInfo.AgentID; |
103 | this.Folders.Add(Folder.FolderID,Folder); | 103 | this.Folders.Add(Folder.FolderID, Folder); |
104 | 104 | ||
105 | return(true); | 105 | return(true); |
106 | } | 106 | } |
@@ -110,49 +110,49 @@ namespace OpenSim | |||
110 | /// </summary> | 110 | /// </summary> |
111 | /// <param name="User_info"></param> | 111 | /// <param name="User_info"></param> |
112 | /// <param name="FetchDescend"></param> | 112 | /// <param name="FetchDescend"></param> |
113 | public void FetchInventoryDescendents(User_Agent_info User_info,FetchInventoryDescendentsPacket FetchDescend) | 113 | public void FetchInventoryDescendents(UserAgentInfo userInfo, FetchInventoryDescendentsPacket FetchDescend) |
114 | { | 114 | { |
115 | if(FetchDescend.InventoryData.FetchItems) | 115 | if(FetchDescend.InventoryData.FetchItems) |
116 | { | 116 | { |
117 | if(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID)) | 117 | if(this.Folders.ContainsKey(FetchDescend.InventoryData.FolderID)) |
118 | { | 118 | { |
119 | 119 | ||
120 | InventoryFolder Folder=this.Folders[FetchDescend.InventoryData.FolderID]; | 120 | InventoryFolder Folder = this.Folders[FetchDescend.InventoryData.FolderID]; |
121 | InventoryDescendentsPacket Descend=new InventoryDescendentsPacket(); | 121 | InventoryDescendentsPacket Descend = new InventoryDescendentsPacket(); |
122 | Descend.AgentData.AgentID=User_info.AgentID; | 122 | Descend.AgentData.AgentID = userInfo.AgentID; |
123 | Descend.AgentData.OwnerID=Folder.OwnerID; | 123 | Descend.AgentData.OwnerID = Folder.OwnerID; |
124 | Descend.AgentData.FolderID=FetchDescend.InventoryData.FolderID; | 124 | Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID; |
125 | Descend.AgentData.Descendents=Folder.Items.Count; | 125 | Descend.AgentData.Descendents = Folder.Items.Count; |
126 | Descend.AgentData.Version=Folder.Items.Count; | 126 | Descend.AgentData.Version = Folder.Items.Count; |
127 | 127 | ||
128 | Descend.ItemData=new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; | 128 | Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; |
129 | for(int i=0; i<Folder.Items.Count ; i++) | 129 | for(int i = 0; i < Folder.Items.Count ; i++) |
130 | { | 130 | { |
131 | 131 | ||
132 | InventoryItem Item=Folder.Items[i]; | 132 | InventoryItem Item=Folder.Items[i]; |
133 | Descend.ItemData[i]=new InventoryDescendentsPacket.ItemDataBlock(); | 133 | Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); |
134 | Descend.ItemData[i].ItemID=Item.ItemID; | 134 | Descend.ItemData[i].ItemID = Item.ItemID; |
135 | Descend.ItemData[i].AssetID=Item.AssetID; | 135 | Descend.ItemData[i].AssetID = Item.AssetID; |
136 | Descend.ItemData[i].CreatorID=Item.CreatorID; | 136 | Descend.ItemData[i].CreatorID = Item.CreatorID; |
137 | Descend.ItemData[i].BaseMask=FULL_MASK_PERMISSIONS; | 137 | Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; |
138 | Descend.ItemData[i].CreationDate=1000; | 138 | Descend.ItemData[i].CreationDate = 1000; |
139 | Descend.ItemData[i].Description=enc.GetBytes(Item.Description+"\0"); | 139 | Descend.ItemData[i].Description = _enc.GetBytes(Item.Description+"\0"); |
140 | Descend.ItemData[i].EveryoneMask=FULL_MASK_PERMISSIONS; | 140 | Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; |
141 | Descend.ItemData[i].Flags=1; | 141 | Descend.ItemData[i].Flags = 1; |
142 | Descend.ItemData[i].FolderID=Item.FolderID; | 142 | Descend.ItemData[i].FolderID = Item.FolderID; |
143 | Descend.ItemData[i].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000"); | 143 | Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
144 | Descend.ItemData[i].GroupMask=FULL_MASK_PERMISSIONS; | 144 | Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; |
145 | Descend.ItemData[i].InvType=Item.InvType; | 145 | Descend.ItemData[i].InvType = Item.InvType; |
146 | Descend.ItemData[i].Name=enc.GetBytes(Item.Name+"\0"); | 146 | Descend.ItemData[i].Name = _enc.GetBytes(Item.Name+"\0"); |
147 | Descend.ItemData[i].NextOwnerMask=FULL_MASK_PERMISSIONS; | 147 | Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; |
148 | Descend.ItemData[i].OwnerID=Item.OwnerID; | 148 | Descend.ItemData[i].OwnerID = Item.OwnerID; |
149 | Descend.ItemData[i].OwnerMask=FULL_MASK_PERMISSIONS; | 149 | Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; |
150 | Descend.ItemData[i].SalePrice=100; | 150 | Descend.ItemData[i].SalePrice = 100; |
151 | Descend.ItemData[i].SaleType=0; | 151 | Descend.ItemData[i].SaleType = 0; |
152 | Descend.ItemData[i].Type=Item.Type; | 152 | Descend.ItemData[i].Type = Item.Type; |
153 | 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); | 153 | 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); |
154 | } | 154 | } |
155 | server.SendPacket(Descend,true,User_info); | 155 | _server.SendPacket(Descend, true, userInfo); |
156 | 156 | ||
157 | } | 157 | } |
158 | } | 158 | } |
@@ -166,40 +166,40 @@ namespace OpenSim | |||
166 | /// | 166 | /// |
167 | /// </summary> | 167 | /// </summary> |
168 | /// <param name="User_info"></param> | 168 | /// <param name="User_info"></param> |
169 | public void FetchInventory(User_Agent_info User_info, FetchInventoryPacket FetchItems) | 169 | public void FetchInventory(UserAgentInfo userInfo, FetchInventoryPacket FetchItems) |
170 | { | 170 | { |
171 | 171 | ||
172 | for(int i=0; i<FetchItems.InventoryData.Length; i++) | 172 | for(int i = 0; i < FetchItems.InventoryData.Length; i++) |
173 | { | 173 | { |
174 | if(this.Items.ContainsKey(FetchItems.InventoryData[i].ItemID)) | 174 | if(this.Items.ContainsKey(FetchItems.InventoryData[i].ItemID)) |
175 | { | 175 | { |
176 | 176 | ||
177 | InventoryItem Item=Items[FetchItems.InventoryData[i].ItemID]; | 177 | InventoryItem Item = Items[FetchItems.InventoryData[i].ItemID]; |
178 | FetchInventoryReplyPacket InventoryReply=new FetchInventoryReplyPacket(); | 178 | FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket(); |
179 | InventoryReply.AgentData.AgentID=User_info.AgentID; | 179 | InventoryReply.AgentData.AgentID = userInfo.AgentID; |
180 | InventoryReply.InventoryData=new FetchInventoryReplyPacket.InventoryDataBlock[1]; | 180 | InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; |
181 | InventoryReply.InventoryData[0]=new FetchInventoryReplyPacket.InventoryDataBlock(); | 181 | InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); |
182 | InventoryReply.InventoryData[0].ItemID=Item.ItemID; | 182 | InventoryReply.InventoryData[0].ItemID = Item.ItemID; |
183 | InventoryReply.InventoryData[0].AssetID=Item.AssetID; | 183 | InventoryReply.InventoryData[0].AssetID = Item.AssetID; |
184 | InventoryReply.InventoryData[0].CreatorID=Item.CreatorID; | 184 | InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; |
185 | InventoryReply.InventoryData[0].BaseMask=FULL_MASK_PERMISSIONS; | 185 | InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; |
186 | InventoryReply.InventoryData[0].CreationDate=1000; | 186 | InventoryReply.InventoryData[0].CreationDate = 1000; |
187 | InventoryReply.InventoryData[0].Description=enc.GetBytes( Item.Description+"\0"); | 187 | InventoryReply.InventoryData[0].Description = _enc.GetBytes( Item.Description+"\0"); |
188 | InventoryReply.InventoryData[0].EveryoneMask=FULL_MASK_PERMISSIONS; | 188 | InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; |
189 | InventoryReply.InventoryData[0].Flags=1; | 189 | InventoryReply.InventoryData[0].Flags = 1; |
190 | InventoryReply.InventoryData[0].FolderID=Item.FolderID; | 190 | InventoryReply.InventoryData[0].FolderID = Item.FolderID; |
191 | InventoryReply.InventoryData[0].GroupID=new LLUUID("00000000-0000-0000-0000-000000000000"); | 191 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
192 | InventoryReply.InventoryData[0].GroupMask=FULL_MASK_PERMISSIONS; | 192 | InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; |
193 | InventoryReply.InventoryData[0].InvType=Item.InvType; | 193 | InventoryReply.InventoryData[0].InvType = Item.InvType; |
194 | InventoryReply.InventoryData[0].Name=enc.GetBytes(Item.Name+"\0"); | 194 | InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name+"\0"); |
195 | InventoryReply.InventoryData[0].NextOwnerMask=FULL_MASK_PERMISSIONS; | 195 | InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; |
196 | InventoryReply.InventoryData[0].OwnerID=Item.OwnerID; | 196 | InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; |
197 | InventoryReply.InventoryData[0].OwnerMask=FULL_MASK_PERMISSIONS; | 197 | InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; |
198 | InventoryReply.InventoryData[0].SalePrice=100; | 198 | InventoryReply.InventoryData[0].SalePrice = 100; |
199 | InventoryReply.InventoryData[0].SaleType=0; | 199 | InventoryReply.InventoryData[0].SaleType = 0; |
200 | InventoryReply.InventoryData[0].Type=Item.Type; | 200 | InventoryReply.InventoryData[0].Type = Item.Type; |
201 | 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); | 201 | 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); |
202 | server.SendPacket(InventoryReply,true,User_info); | 202 | _server.SendPacket(InventoryReply, true, userInfo); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
@@ -217,7 +217,7 @@ namespace OpenSim | |||
217 | 217 | ||
218 | public InventoryFolder() | 218 | public InventoryFolder() |
219 | { | 219 | { |
220 | Items=new List<InventoryItem>(); | 220 | Items = new List<InventoryItem>(); |
221 | } | 221 | } |
222 | 222 | ||
223 | } | 223 | } |
@@ -228,7 +228,7 @@ namespace OpenSim | |||
228 | public LLUUID OwnerID; | 228 | public LLUUID OwnerID; |
229 | public LLUUID ItemID; | 229 | public LLUUID ItemID; |
230 | public LLUUID AssetID; | 230 | public LLUUID AssetID; |
231 | public LLUUID CreatorID=LLUUID.Zero; | 231 | public LLUUID CreatorID = LLUUID.Zero; |
232 | public sbyte InvType; | 232 | public sbyte InvType; |
233 | public sbyte Type; | 233 | public sbyte Type; |
234 | public string Name; | 234 | public string Name; |
diff --git a/Login_manager.cs b/Login_manager.cs index dc90613..2d4f524 100644 --- a/Login_manager.cs +++ b/Login_manager.cs | |||
@@ -116,7 +116,8 @@ namespace OpenSim | |||
116 | int contentLength = 0; | 116 | int contentLength = 0; |
117 | 117 | ||
118 | // read HTTP header | 118 | // read HTTP header |
119 | do { | 119 | do |
120 | { | ||
120 | // read one line of the header | 121 | // read one line of the header |
121 | line = reader.ReadLine(); | 122 | line = reader.ReadLine(); |
122 | 123 | ||
@@ -145,72 +146,72 @@ namespace OpenSim | |||
145 | //get login name | 146 | //get login name |
146 | if(requestData.Contains("first")) | 147 | if(requestData.Contains("first")) |
147 | { | 148 | { |
148 | first=(string)requestData["first"]; | 149 | first = (string)requestData["first"]; |
149 | } | 150 | } |
150 | else | 151 | else |
151 | { | 152 | { |
152 | first="test"; | 153 | first = "test"; |
153 | } | 154 | } |
154 | if(requestData.Contains("last")) | 155 | if(requestData.Contains("last")) |
155 | { | 156 | { |
156 | last=(string)requestData["last"]; | 157 | last = (string)requestData["last"]; |
157 | } | 158 | } |
158 | else | 159 | else |
159 | { | 160 | { |
160 | last="User"+NumClients.ToString(); | 161 | last = "User"+NumClients.ToString(); |
161 | } | 162 | } |
162 | NumClients++; | 163 | NumClients++; |
163 | 164 | ||
164 | //create a agent and session LLUUID | 165 | //create a agent and session LLUUID |
165 | int AgentRand=this.RandomClass.Next(1,9999); | 166 | int AgentRand = this.RandomClass.Next(1,9999); |
166 | Agent=new LLUUID("99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead"); | 167 | Agent = new LLUUID("99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead"); |
167 | int SessionRand=this.RandomClass.Next(1,999); | 168 | int SessionRand = this.RandomClass.Next(1,999); |
168 | Session=new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); | 169 | Session = new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); |
169 | 170 | ||
170 | 171 | ||
171 | StreamReader SR; | 172 | StreamReader SR; |
172 | string ResponseString=""; | 173 | string ResponseString = ""; |
173 | string lines; | 174 | string lines; |
174 | SR=File.OpenText("new-login.dat"); | 175 | SR=File.OpenText("new-login.dat"); |
175 | 176 | ||
176 | lines=SR.ReadLine(); | 177 | lines=SR.ReadLine(); |
177 | 178 | ||
178 | while(lines!="end-mfile") | 179 | while(lines != "end-mfile") |
179 | { | 180 | { |
180 | 181 | ||
181 | ResponseString+=lines; | 182 | ResponseString += lines; |
182 | lines=SR.ReadLine(); | 183 | lines = SR.ReadLine(); |
183 | } | 184 | } |
184 | SR.Close(); | 185 | SR.Close(); |
185 | 186 | ||
186 | XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString); | 187 | XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString); |
187 | Hashtable responseData = (Hashtable)response.Value; | 188 | Hashtable responseData = (Hashtable)response.Value; |
188 | 189 | ||
189 | responseData["agent_id"]=Agent.ToStringHyphenated(); | 190 | responseData["agent_id"] = Agent.ToStringHyphenated(); |
190 | responseData["session_id"]=Session.ToStringHyphenated(); | 191 | responseData["session_id"] = Session.ToStringHyphenated(); |
191 | ArrayList InventoryList=(ArrayList) responseData["inventory-skeleton"]; | 192 | ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; |
192 | Hashtable Inventory1=(Hashtable)InventoryList[0]; | 193 | Hashtable Inventory1 = (Hashtable)InventoryList[0]; |
193 | Hashtable Inventory2=(Hashtable)InventoryList[1]; | 194 | Hashtable Inventory2 = (Hashtable)InventoryList[1]; |
194 | LLUUID BaseFolderID=LLUUID.Random(); | 195 | LLUUID BaseFolderID = LLUUID.Random(); |
195 | LLUUID InventoryFolderID=LLUUID.Random(); | 196 | LLUUID InventoryFolderID = LLUUID.Random(); |
196 | Inventory2["name"]="Base"; | 197 | Inventory2["name"] = "Base"; |
197 | Inventory2["folder_id"]=BaseFolderID.ToStringHyphenated(); | 198 | Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); |
198 | Inventory1["folder_id"]=InventoryFolderID.ToStringHyphenated(); | 199 | Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); |
199 | 200 | ||
200 | ArrayList InventoryRoot=(ArrayList) responseData["inventory-root"]; | 201 | ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; |
201 | Hashtable Inventoryroot=(Hashtable)InventoryRoot[0]; | 202 | Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; |
202 | Inventoryroot["folder_id"]=InventoryFolderID.ToStringHyphenated(); | 203 | Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); |
203 | 204 | ||
204 | 205 | ||
205 | //copy data to login object | 206 | //copy data to login object |
206 | lock(Login) | 207 | lock(Login) |
207 | { | 208 | { |
208 | Login.first=first; | 209 | Login.First = first; |
209 | Login.last=last; | 210 | Login.Last = last; |
210 | Login.Agent=Agent; | 211 | Login.Agent = Agent; |
211 | Login.Session=Session; | 212 | Login.Session = Session; |
212 | Login.BaseFolder=BaseFolderID; | 213 | Login.BaseFolder = BaseFolderID; |
213 | Login.InventoryFolder=InventoryFolderID; | 214 | Login.InventoryFolder = InventoryFolderID; |
214 | } | 215 | } |
215 | 216 | ||
216 | // forward the XML-RPC response to the client | 217 | // forward the XML-RPC response to the client |
diff --git a/Prim_manager.cs b/Prim_manager.cs index 856bffe..aa1c32a 100644 --- a/Prim_manager.cs +++ b/Prim_manager.cs | |||
@@ -40,11 +40,10 @@ namespace OpenSim | |||
40 | /// </summary> | 40 | /// </summary> |
41 | public class PrimManager | 41 | public class PrimManager |
42 | { | 42 | { |
43 | private Server server; | 43 | private Server _server; |
44 | public AgentManager Agent_Manager; | 44 | private uint _primCount; |
45 | |||
46 | private uint prim_count; | ||
47 | 45 | ||
46 | public AgentManager AgentManagement; | ||
48 | public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock PrimTemplate; | 47 | public libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock PrimTemplate; |
49 | public Dictionary<libsecondlife.LLUUID,PrimInfo> PrimList; | 48 | public Dictionary<libsecondlife.LLUUID,PrimInfo> PrimList; |
50 | 49 | ||
@@ -52,10 +51,10 @@ namespace OpenSim | |||
52 | /// | 51 | /// |
53 | /// </summary> | 52 | /// </summary> |
54 | /// <param name="serve"></param> | 53 | /// <param name="serve"></param> |
55 | public PrimManager(Server serve) | 54 | public PrimManager(Server server) |
56 | { | 55 | { |
57 | server=serve; | 56 | _server = server; |
58 | PrimList=new Dictionary<libsecondlife.LLUUID,PrimInfo> (); | 57 | PrimList = new Dictionary<libsecondlife.LLUUID,PrimInfo> (); |
59 | this.SetupTemplates("objectupate164.dat"); | 58 | this.SetupTemplates("objectupate164.dat"); |
60 | 59 | ||
61 | } | 60 | } |
@@ -66,58 +65,59 @@ namespace OpenSim | |||
66 | /// <param name="User_info"></param> | 65 | /// <param name="User_info"></param> |
67 | /// <param name="p1"></param> | 66 | /// <param name="p1"></param> |
68 | /// <param name="add_pack"></param> | 67 | /// <param name="add_pack"></param> |
69 | public void CreatePrim(User_Agent_info User_info, libsecondlife.LLVector3 p1, ObjectAddPacket add_pack) | 68 | public void CreatePrim(UserAgentInfo userInfo, libsecondlife.LLVector3 pos1, ObjectAddPacket addPacket) |
70 | { | 69 | { |
71 | ObjectUpdatePacket objupdate=new ObjectUpdatePacket(); | 70 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
72 | objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle; | 71 | objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle; |
73 | objupdate.RegionData.TimeDilation=64096; | 72 | objupdate.RegionData.TimeDilation = 64096; |
74 | objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 73 | |
75 | PrimData PData=new PrimData(); | 74 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
76 | objupdate.ObjectData[0]=this.PrimTemplate; | 75 | PrimData PData = new PrimData(); |
77 | PData.OwnerID=objupdate.ObjectData[0].OwnerID=User_info.AgentID; | 76 | objupdate.ObjectData[0] = this.PrimTemplate; |
78 | PData.PCode=objupdate.ObjectData[0].PCode=add_pack.ObjectData.PCode; | 77 | PData.OwnerID=objupdate.ObjectData[0].OwnerID = userInfo.AgentID; |
79 | PData.PathBegin=objupdate.ObjectData[0].PathBegin=add_pack.ObjectData.PathBegin; | 78 | PData.PCode=objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; |
80 | PData.PathEnd=objupdate.ObjectData[0].PathEnd=add_pack.ObjectData.PathEnd; | 79 | PData.PathBegin=objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; |
81 | PData.PathScaleX=objupdate.ObjectData[0].PathScaleX=add_pack.ObjectData.PathScaleX; | 80 | PData.PathEnd=objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; |
82 | PData.PathScaleY=objupdate.ObjectData[0].PathScaleY=add_pack.ObjectData.PathScaleY; | 81 | PData.PathScaleX=objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX; |
83 | PData.PathShearX=objupdate.ObjectData[0].PathShearX=add_pack.ObjectData.PathShearX; | 82 | PData.PathScaleY=objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY; |
84 | PData.PathShearY=objupdate.ObjectData[0].PathShearY=add_pack.ObjectData.PathShearY; | 83 | PData.PathShearX=objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX; |
85 | PData.PathSkew=objupdate.ObjectData[0].PathSkew=add_pack.ObjectData.PathSkew; | 84 | PData.PathShearY=objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY; |
86 | PData.ProfileBegin=objupdate.ObjectData[0].ProfileBegin=add_pack.ObjectData.ProfileBegin; | 85 | PData.PathSkew=objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew; |
87 | PData.ProfileEnd=objupdate.ObjectData[0].ProfileEnd=add_pack.ObjectData.ProfileEnd; | 86 | PData.ProfileBegin=objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin; |
88 | PData.Scale=objupdate.ObjectData[0].Scale=add_pack.ObjectData.Scale;//new LLVector3(1,1,1); | 87 | PData.ProfileEnd=objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd; |
89 | PData.PathCurve=objupdate.ObjectData[0].PathCurve=add_pack.ObjectData.PathCurve; | 88 | PData.Scale=objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale; |
90 | PData.ProfileCurve=objupdate.ObjectData[0].ProfileCurve=add_pack.ObjectData.ProfileCurve; | 89 | PData.PathCurve=objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve; |
91 | PData.ParentID=objupdate.ObjectData[0].ParentID=0; | 90 | PData.ProfileCurve=objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; |
92 | PData.ProfileHollow=objupdate.ObjectData[0].ProfileHollow=add_pack.ObjectData.ProfileHollow; | 91 | PData.ParentID=objupdate.ObjectData[0].ParentID = 0; |
92 | PData.ProfileHollow=objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
93 | //finish off copying rest of shape data | 93 | //finish off copying rest of shape data |
94 | 94 | ||
95 | objupdate.ObjectData[0].ID=(uint)(702000+prim_count); | 95 | objupdate.ObjectData[0].ID = (uint)(702000 + _primCount); |
96 | objupdate.ObjectData[0].FullID=new LLUUID("edba7151-5857-acc5-b30b-f01efefda"+prim_count.ToString("000")); | 96 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda"+_primCount.ToString("000")); |
97 | 97 | ||
98 | //update position | 98 | //update position |
99 | byte[] pb=p1.GetBytes(); | 99 | byte[] pb = pos1.GetBytes(); |
100 | Array.Copy(pb,0,objupdate.ObjectData[0].ObjectData,0,pb.Length); | 100 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); |
101 | 101 | ||
102 | prim_count++; | 102 | _primCount++; |
103 | server.SendPacket(objupdate,true,User_info); | 103 | _server.SendPacket(objupdate, true, userInfo); |
104 | 104 | ||
105 | //should send to all users | 105 | //should send to all users |
106 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in Agent_Manager.AgentList) | 106 | foreach (KeyValuePair<libsecondlife.LLUUID, AvatarData> kp in AgentManagement.AgentList) |
107 | { | 107 | { |
108 | if(kp.Value.NetInfo.AgentID!=User_info.AgentID) | 108 | if(kp.Value.NetInfo.AgentID != userInfo.AgentID) |
109 | { | 109 | { |
110 | server.SendPacket(objupdate,true,kp.Value.NetInfo); | 110 | _server.SendPacket(objupdate, true, kp.Value.NetInfo); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | //should store this infomation | 113 | //should store this infomation |
114 | PrimInfo NewPrim=new PrimInfo(); | 114 | PrimInfo NewPrim = new PrimInfo(); |
115 | NewPrim.FullID=objupdate.ObjectData[0].FullID; | 115 | NewPrim.FullID = objupdate.ObjectData[0].FullID; |
116 | NewPrim.LocalID=objupdate.ObjectData[0].ID; | 116 | NewPrim.LocalID = objupdate.ObjectData[0].ID; |
117 | NewPrim.Position=p1; | 117 | NewPrim.Position = pos1; |
118 | NewPrim.data=PData; | 118 | NewPrim.Data = PData; |
119 | 119 | ||
120 | this.PrimList.Add(NewPrim.FullID,NewPrim); | 120 | this.PrimList.Add(NewPrim.FullID, NewPrim); |
121 | 121 | ||
122 | //store rest of data | 122 | //store rest of data |
123 | 123 | ||
@@ -131,62 +131,62 @@ namespace OpenSim | |||
131 | /// <param name="LocalID"></param> | 131 | /// <param name="LocalID"></param> |
132 | /// <param name="setRotation"></param> | 132 | /// <param name="setRotation"></param> |
133 | /// <param name="rotation"></param> | 133 | /// <param name="rotation"></param> |
134 | public void UpdatePrimPosition(User_Agent_info User,LLVector3 position,uint LocalID,bool setRotation, LLQuaternion rotation) | 134 | public void UpdatePrimPosition(UserAgentInfo userInfo, LLVector3 position, uint localID, bool setRotation, LLQuaternion rotation) |
135 | { | 135 | { |
136 | PrimInfo pri=null; | 136 | PrimInfo pri = null; |
137 | foreach (KeyValuePair<libsecondlife.LLUUID,PrimInfo> kp in this.PrimList) | 137 | foreach (KeyValuePair<libsecondlife.LLUUID,PrimInfo> kp in this.PrimList) |
138 | { | 138 | { |
139 | if(kp.Value.LocalID==LocalID) | 139 | if(kp.Value.LocalID == localID) |
140 | { | 140 | { |
141 | pri=kp.Value; | 141 | pri = kp.Value; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | if(pri==null) | 144 | if(pri == null) |
145 | { | 145 | { |
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | uint ID=pri.LocalID; | 148 | uint ID = pri.LocalID; |
149 | libsecondlife.LLVector3 pos2=new LLVector3(position.X,position.Y,position.Z); | 149 | libsecondlife.LLVector3 pos2 = new LLVector3(position.X, position.Y, position.Z); |
150 | libsecondlife.LLQuaternion rotation2; | 150 | libsecondlife.LLQuaternion rotation2; |
151 | if(!setRotation) | 151 | if(!setRotation) |
152 | { | 152 | { |
153 | pri.Position=pos2; | 153 | pri.Position = pos2; |
154 | rotation2=new LLQuaternion(pri.Rotation.X,pri.Rotation.Y,pri.Rotation.Z,pri.Rotation.W); | 154 | rotation2 = new LLQuaternion(pri.Rotation.X, pri.Rotation.Y, pri.Rotation.Z, pri.Rotation.W); |
155 | } | 155 | } |
156 | else | 156 | else |
157 | { | 157 | { |
158 | rotation2=new LLQuaternion(rotation.X,rotation.Y,rotation.Z,rotation.W); | 158 | rotation2=new LLQuaternion(rotation.X, rotation.Y, rotation.Z, rotation.W); |
159 | pos2=pri.Position; | 159 | pos2 = pri.Position; |
160 | pri.Rotation=rotation; | 160 | pri.Rotation = rotation; |
161 | } | 161 | } |
162 | rotation2.W+=1; | 162 | rotation2.W += 1; |
163 | rotation2.X+=1; | 163 | rotation2.X += 1; |
164 | rotation2.Y+=1; | 164 | rotation2.Y += 1; |
165 | rotation2.Z+=1; | 165 | rotation2.Z += 1; |
166 | 166 | ||
167 | byte[] bytes=new byte[60]; | 167 | byte[] bytes = new byte[60]; |
168 | 168 | ||
169 | ImprovedTerseObjectUpdatePacket im=new ImprovedTerseObjectUpdatePacket(); | 169 | ImprovedTerseObjectUpdatePacket im = new ImprovedTerseObjectUpdatePacket(); |
170 | im.RegionData.RegionHandle=Globals.Instance.RegionHandle; | 170 | im.RegionData.RegionHandle = Globals.Instance.RegionHandle; |
171 | im.RegionData.TimeDilation=64096; | 171 | im.RegionData.TimeDilation = 64096; |
172 | im.ObjectData=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 172 | im.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
173 | int i=0; | 173 | int i = 0; |
174 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat=new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | 174 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
175 | im.ObjectData[0]=dat; | 175 | im.ObjectData[0] = dat; |
176 | dat.TextureEntry=PrimTemplate.TextureEntry; | 176 | dat.TextureEntry = PrimTemplate.TextureEntry; |
177 | 177 | ||
178 | bytes[i++] = (byte)(ID % 256); | 178 | bytes[i++] = (byte)(ID % 256); |
179 | bytes[i++] = (byte)((ID >> 8) % 256); | 179 | bytes[i++] = (byte)((ID >> 8) % 256); |
180 | bytes[i++] = (byte)((ID >> 16) % 256); | 180 | bytes[i++] = (byte)((ID >> 16) % 256); |
181 | bytes[i++] = (byte)((ID >> 24) % 256); | 181 | bytes[i++] = (byte)((ID >> 24) % 256); |
182 | bytes[i++]=0; | 182 | bytes[i++]= 0; |
183 | bytes[i++]=0;//1; | 183 | bytes[i++]= 0; |
184 | 184 | ||
185 | byte[] pb=pos2.GetBytes(); | 185 | byte[] pb = pos2.GetBytes(); |
186 | pri.Position=pos2; | 186 | pri.Position = pos2; |
187 | Array.Copy(pb,0,bytes,i,pb.Length); | 187 | Array.Copy(pb, 0, bytes, i, pb.Length); |
188 | i+=12; | 188 | i += 12; |
189 | ushort ac=32767; | 189 | ushort ac = 32767; |
190 | 190 | ||
191 | //vel | 191 | //vel |
192 | bytes[i++] = (byte)(ac % 256); | 192 | bytes[i++] = (byte)(ac % 256); |
@@ -205,10 +205,10 @@ namespace OpenSim | |||
205 | bytes[i++] = (byte)((ac >> 8) % 256); | 205 | bytes[i++] = (byte)((ac >> 8) % 256); |
206 | 206 | ||
207 | ushort rw, rx,ry,rz; | 207 | ushort rw, rx,ry,rz; |
208 | rw=(ushort)(32768*rotation2.W); | 208 | rw = (ushort)(32768 * rotation2.W); |
209 | rx=(ushort)(32768*rotation2.X); | 209 | rx = (ushort)(32768 * rotation2.X); |
210 | ry=(ushort)(32768*rotation2.Y); | 210 | ry = (ushort)(32768 * rotation2.Y); |
211 | rz=(ushort)(32768*rotation2.Z); | 211 | rz = (ushort)(32768 * rotation2.Z); |
212 | 212 | ||
213 | //rot | 213 | //rot |
214 | bytes[i++] = (byte)(rx % 256); | 214 | bytes[i++] = (byte)(rx % 256); |
@@ -230,11 +230,11 @@ namespace OpenSim | |||
230 | 230 | ||
231 | dat.Data=bytes; | 231 | dat.Data=bytes; |
232 | 232 | ||
233 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in Agent_Manager.AgentList) | 233 | foreach (KeyValuePair<libsecondlife.LLUUID,AvatarData> kp in AgentManagement.AgentList) |
234 | { | 234 | { |
235 | if(kp.Value.NetInfo.AgentID!=User.AgentID) | 235 | if(kp.Value.NetInfo.AgentID!=userInfo.AgentID) |
236 | { | 236 | { |
237 | server.SendPacket(im,true,kp.Value.NetInfo); | 237 | _server.SendPacket(im, true, kp.Value.NetInfo); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
@@ -243,7 +243,7 @@ namespace OpenSim | |||
243 | /// | 243 | /// |
244 | /// </summary> | 244 | /// </summary> |
245 | /// <param name="user"></param> | 245 | /// <param name="user"></param> |
246 | public void SendExistingPrims(User_Agent_info user) | 246 | public void SendExistingPrims(UserAgentInfo userInfo) |
247 | { | 247 | { |
248 | //send data for already created prims to a new joining user | 248 | //send data for already created prims to a new joining user |
249 | } | 249 | } |
@@ -254,12 +254,12 @@ namespace OpenSim | |||
254 | /// <param name="name"></param> | 254 | /// <param name="name"></param> |
255 | public void SetupTemplates(string name) | 255 | public void SetupTemplates(string name) |
256 | { | 256 | { |
257 | ObjectUpdatePacket objupdate=new ObjectUpdatePacket(); | 257 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
258 | objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle; | 258 | objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle; |
259 | objupdate.RegionData.TimeDilation=64096; | 259 | objupdate.RegionData.TimeDilation = 64096; |
260 | objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 260 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
261 | 261 | ||
262 | int i=0; | 262 | int i = 0; |
263 | FileInfo fInfo = new FileInfo(name); | 263 | FileInfo fInfo = new FileInfo(name); |
264 | long numBytes = fInfo.Length; | 264 | long numBytes = fInfo.Length; |
265 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | 265 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); |
@@ -268,18 +268,18 @@ namespace OpenSim | |||
268 | br.Close(); | 268 | br.Close(); |
269 | fStream.Close(); | 269 | fStream.Close(); |
270 | 270 | ||
271 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i); | 271 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i); |
272 | objupdate.ObjectData[0]=objdata; | 272 | objupdate.ObjectData[0] = objdata; |
273 | this.PrimTemplate=objdata; | 273 | this.PrimTemplate = objdata; |
274 | objdata.UpdateFlags=objdata.UpdateFlags+12-16+32+256; | 274 | objdata.UpdateFlags = objdata.UpdateFlags + 12 - 16 + 32 + 256; |
275 | objdata.OwnerID=new LLUUID("00000000-0000-0000-0000-000000000000"); | 275 | objdata.OwnerID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
276 | //test adding a new texture to object , to test image downloading | 276 | //test adding a new texture to object , to test image downloading |
277 | LLObject.TextureEntry te=new LLObject.TextureEntry(objdata.TextureEntry,0,objdata.TextureEntry.Length); | 277 | LLObject.TextureEntry te = new LLObject.TextureEntry(objdata.TextureEntry, 0, objdata.TextureEntry.Length); |
278 | te.DefaultTexture.TextureID=new LLUUID("00000000-0000-0000-5005-000000000005"); | 278 | te.DefaultTexture.TextureID = new LLUUID("00000000-0000-0000-5005-000000000005"); |
279 | 279 | ||
280 | LLObject.TextureEntry ntex=new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | 280 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); |
281 | 281 | ||
282 | objdata.TextureEntry=ntex.ToBytes(); | 282 | objdata.TextureEntry = ntex.ToBytes(); |
283 | } | 283 | } |
284 | 284 | ||
285 | /// <summary> | 285 | /// <summary> |
@@ -287,34 +287,34 @@ namespace OpenSim | |||
287 | /// </summary> | 287 | /// </summary> |
288 | /// <param name="name"></param> | 288 | /// <param name="name"></param> |
289 | /// <param name="user"></param> | 289 | /// <param name="user"></param> |
290 | public void ReadPrimDatabase(string name,User_Agent_info user) | 290 | public void ReadPrimDatabase(string name, UserAgentInfo userInfo) |
291 | { | 291 | { |
292 | StreamReader SR; | 292 | StreamReader SR; |
293 | string line; | 293 | string line; |
294 | SR=File.OpenText(name); | 294 | SR=File.OpenText(name); |
295 | string [] comp= new string[10]; | 295 | string [] comp = new string[10]; |
296 | string delimStr = " , "; | 296 | string delimStr = " , "; |
297 | char [] delimiter = delimStr.ToCharArray(); | 297 | char [] delimiter = delimStr.ToCharArray(); |
298 | 298 | ||
299 | line=SR.ReadLine(); | 299 | line=SR.ReadLine(); |
300 | while(line!="end") | 300 | while(line != "end") |
301 | { | 301 | { |
302 | comp=line.Split(delimiter); | 302 | comp = line.Split(delimiter); |
303 | if(comp[0]=="ObjPack") | 303 | if(comp[0] == "ObjPack") |
304 | { | 304 | { |
305 | int num=Convert.ToInt32(comp[2]); | 305 | int num = Convert.ToInt32(comp[2]); |
306 | int start=Convert.ToInt32(comp[1]); | 306 | int start = Convert.ToInt32(comp[1]); |
307 | ObjectUpdatePacket objupdate=new ObjectUpdatePacket(); | 307 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
308 | objupdate.RegionData.RegionHandle=Globals.Instance.RegionHandle; | 308 | objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle; |
309 | objupdate.RegionData.TimeDilation=64096; | 309 | objupdate.RegionData.TimeDilation = 64096; |
310 | objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num]; | 310 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num]; |
311 | 311 | ||
312 | // int count=0; | 312 | // int count=0; |
313 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\"; | 313 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\"; |
314 | for(int cc=0; cc<num; cc++) | 314 | for(int cc = 0; cc < num; cc++) |
315 | { | 315 | { |
316 | string filenam=data_path+@"prim_updates"+start+".dat"; | 316 | string filenam = data_path+@"prim_updates"+start+".dat"; |
317 | int i=0; | 317 | int i = 0; |
318 | //FileInfo fInfo = new FileInfo("objectupate"+start+".dat"); | 318 | //FileInfo fInfo = new FileInfo("objectupate"+start+".dat"); |
319 | FileInfo fInfo = new FileInfo(filenam); | 319 | FileInfo fInfo = new FileInfo(filenam); |
320 | long numBytes = fInfo.Length; | 320 | long numBytes = fInfo.Length; |
@@ -325,12 +325,12 @@ namespace OpenSim | |||
325 | br.Close(); | 325 | br.Close(); |
326 | fStream.Close(); | 326 | fStream.Close(); |
327 | 327 | ||
328 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1,ref i); | 328 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); |
329 | objupdate.ObjectData[cc]=objdata; | 329 | objupdate.ObjectData[cc] = objdata; |
330 | start++; | 330 | start++; |
331 | } | 331 | } |
332 | server.SendPacket(objupdate,true,user); | 332 | _server.SendPacket(objupdate, true, userInfo); |
333 | line=SR.ReadLine(); | 333 | line = SR.ReadLine(); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | SR.Close(); | 336 | SR.Close(); |
@@ -344,7 +344,7 @@ namespace OpenSim | |||
344 | public LLQuaternion Rotation=LLQuaternion.Identity; | 344 | public LLQuaternion Rotation=LLQuaternion.Identity; |
345 | public uint LocalID; | 345 | public uint LocalID; |
346 | public LLUUID FullID; | 346 | public LLUUID FullID; |
347 | public PrimData data; | 347 | public PrimData Data; |
348 | 348 | ||
349 | public PrimInfo() | 349 | public PrimInfo() |
350 | { | 350 | { |
diff --git a/Script_manager.cs b/Script_manager.cs index 87a32d0..26b87f1 100644 --- a/Script_manager.cs +++ b/Script_manager.cs | |||
@@ -78,11 +78,11 @@ namespace OpenSim | |||
78 | 78 | ||
79 | #region Lua Functions | 79 | #region Lua Functions |
80 | 80 | ||
81 | public void ScriptRegister( script_object_interface script) | 81 | public void ScriptRegister(script_object_interface script) |
82 | { | 82 | { |
83 | //called by scripts to register themselves | 83 | //called by scripts to register themselves |
84 | } | 84 | } |
85 | public void MoveObject(float x ,float y, float z) | 85 | public void MoveObject(float x , float y, float z) |
86 | { | 86 | { |
87 | 87 | ||
88 | } | 88 | } |
diff --git a/Second-server.sln b/Second-server.sln index 2575f51..44be1db 100644 --- a/Second-server.sln +++ b/Second-server.sln | |||
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 9.00 | |||
3 | # SharpDevelop 2.1.0.2017 | 3 | # SharpDevelop 2.1.0.2017 |
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}" | 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}" |
5 | EndProject | 5 | EndProject |
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libsecondlife", "..\..\libsecondlife\libsecondlife-cs\libsecondlife.csproj", "{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}" | ||
7 | EndProject | ||
8 | Global | 6 | Global |
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
10 | Debug|.NET 1.1 = Debug|.NET 1.1 | 8 | Debug|.NET 1.1 = Debug|.NET 1.1 |
@@ -45,8 +45,8 @@ namespace OpenSim | |||
45 | public interface ServerCallback | 45 | public interface ServerCallback |
46 | { | 46 | { |
47 | //should replace with delegates | 47 | //should replace with delegates |
48 | void MainCallback(Packet pack, User_Agent_info User_info); | 48 | void MainCallback(Packet pack, UserAgentInfo User_info); |
49 | void NewUserCallback(User_Agent_info User_info); | 49 | void NewUserCallback(UserAgentInfo User_info); |
50 | void ErrorCallback(string text); | 50 | void ErrorCallback(string text); |
51 | } | 51 | } |
52 | public class Server | 52 | public class Server |
@@ -197,7 +197,7 @@ namespace OpenSim | |||
197 | /// </summary> | 197 | /// </summary> |
198 | /// <param name="packet">Packet to be sent</param> | 198 | /// <param name="packet">Packet to be sent</param> |
199 | /// <param name="incrementSequence">Increment sequence number?</param> | 199 | /// <param name="incrementSequence">Increment sequence number?</param> |
200 | public void SendPacket(Packet packet, bool incrementSequence, User_Agent_info User_info) | 200 | public void SendPacket(Packet packet, bool incrementSequence, UserAgentInfo User_info) |
201 | { | 201 | { |
202 | byte[] buffer; | 202 | byte[] buffer; |
203 | int bytes; | 203 | int bytes; |
@@ -324,7 +324,7 @@ namespace OpenSim | |||
324 | /// <summary> | 324 | /// <summary> |
325 | /// Sends out pending acknowledgements | 325 | /// Sends out pending acknowledgements |
326 | /// </summary> | 326 | /// </summary> |
327 | private void SendAcks(User_Agent_info User_info) | 327 | private void SendAcks(UserAgentInfo User_info) |
328 | { | 328 | { |
329 | lock (User_info.PendingAcks) | 329 | lock (User_info.PendingAcks) |
330 | { | 330 | { |
@@ -358,7 +358,7 @@ namespace OpenSim | |||
358 | /// <summary> | 358 | /// <summary> |
359 | /// Resend unacknowledged packets | 359 | /// Resend unacknowledged packets |
360 | /// </summary> | 360 | /// </summary> |
361 | private void ResendUnacked(User_Agent_info User_info) | 361 | private void ResendUnacked(UserAgentInfo User_info) |
362 | { | 362 | { |
363 | if (connected) | 363 | if (connected) |
364 | { | 364 | { |
@@ -397,7 +397,7 @@ namespace OpenSim | |||
397 | 397 | ||
398 | // Update the disconnect flag so this sim doesn't time out | 398 | // Update the disconnect flag so this sim doesn't time out |
399 | DisconnectCandidate = false; | 399 | DisconnectCandidate = false; |
400 | User_Agent_info User_info=null; | 400 | UserAgentInfo User_info=null; |
401 | 401 | ||
402 | lock (RecvBuffer) | 402 | lock (RecvBuffer) |
403 | { | 403 | { |
@@ -416,7 +416,7 @@ namespace OpenSim | |||
416 | if (packet.Type == PacketType.UseCircuitCode) | 416 | if (packet.Type == PacketType.UseCircuitCode) |
417 | { | 417 | { |
418 | UseCircuitCodePacket cir_pack=(UseCircuitCodePacket)packet; | 418 | UseCircuitCodePacket cir_pack=(UseCircuitCodePacket)packet; |
419 | User_Agent_info new_user=new User_Agent_info(); | 419 | UserAgentInfo new_user=new UserAgentInfo(); |
420 | new_user.circuitCode=cir_pack.CircuitCode.Code; | 420 | new_user.circuitCode=cir_pack.CircuitCode.Code; |
421 | new_user.AgentID=cir_pack.CircuitCode.ID; | 421 | new_user.AgentID=cir_pack.CircuitCode.ID; |
422 | new_user.SessionID=cir_pack.CircuitCode.SessionID; | 422 | new_user.SessionID=cir_pack.CircuitCode.SessionID; |
@@ -429,13 +429,13 @@ namespace OpenSim | |||
429 | } | 429 | } |
430 | 430 | ||
431 | 431 | ||
432 | User_Agent_info temp_agent=null; | 432 | UserAgentInfo temp_agent=null; |
433 | IPEndPoint send_ip=(IPEndPoint)epSender; | 433 | IPEndPoint send_ip=(IPEndPoint)epSender; |
434 | // this.callback_object.error("incoming: address is "+send_ip.Address +"port number is: "+send_ip.Port.ToString()); | 434 | // this.callback_object.error("incoming: address is "+send_ip.Address +"port number is: "+send_ip.Port.ToString()); |
435 | 435 | ||
436 | for(int ii=0; ii<this.User_agents.Count ; ii++) | 436 | for(int ii=0; ii<this.User_agents.Count ; ii++) |
437 | { | 437 | { |
438 | temp_agent=(User_Agent_info)this.User_agents[ii]; | 438 | temp_agent=(UserAgentInfo)this.User_agents[ii]; |
439 | IPEndPoint ag_ip=(IPEndPoint)temp_agent.endpoint; | 439 | IPEndPoint ag_ip=(IPEndPoint)temp_agent.endpoint; |
440 | //this.callback_object.error("searching: address is "+ag_ip.Address +"port number is: "+ag_ip.Port.ToString()); | 440 | //this.callback_object.error("searching: address is "+ag_ip.Address +"port number is: "+ag_ip.Port.ToString()); |
441 | 441 | ||
@@ -563,7 +563,7 @@ namespace OpenSim | |||
563 | //TODO for each user_agent_info | 563 | //TODO for each user_agent_info |
564 | for(int i=0; i<this.User_agents.Count; i++) | 564 | for(int i=0; i<this.User_agents.Count; i++) |
565 | { | 565 | { |
566 | User_Agent_info user=(User_Agent_info)this.User_agents[i]; | 566 | UserAgentInfo user=(UserAgentInfo)this.User_agents[i]; |
567 | 567 | ||
568 | SendAcks(user); | 568 | SendAcks(user); |
569 | ResendUnacked(user); | 569 | ResendUnacked(user); |
@@ -619,7 +619,7 @@ namespace OpenSim | |||
619 | } | 619 | } |
620 | } | 620 | } |
621 | 621 | ||
622 | public class User_Agent_info | 622 | public class UserAgentInfo |
623 | { | 623 | { |
624 | public EndPoint endpoint; | 624 | public EndPoint endpoint; |
625 | public LLUUID AgentID; | 625 | public LLUUID AgentID; |
@@ -636,7 +636,7 @@ namespace OpenSim | |||
636 | // ACKs that are queued up to be sent to the simulator | 636 | // ACKs that are queued up to be sent to the simulator |
637 | public Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | 637 | public Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); |
638 | 638 | ||
639 | public User_Agent_info() | 639 | public UserAgentInfo() |
640 | { | 640 | { |
641 | 641 | ||
642 | } | 642 | } |