diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/CAPS/SimHttp.cs | 143 | ||||
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 14 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/Avatar.cs | 61 |
3 files changed, 132 insertions, 86 deletions
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs index 77c6bb8..c3f4801 100644 --- a/OpenSim.RegionServer/CAPS/SimHttp.cs +++ b/OpenSim.RegionServer/CAPS/SimHttp.cs | |||
@@ -119,84 +119,89 @@ namespace OpenSim.CAPS | |||
119 | private string ParseREST(string requestBody, string requestURL, string requestMethod) | 119 | private string ParseREST(string requestBody, string requestURL, string requestMethod) |
120 | { | 120 | { |
121 | string responseString = ""; | 121 | string responseString = ""; |
122 | switch (requestURL) | 122 | try |
123 | { | 123 | { |
124 | case "/Admin/Accounts": | 124 | switch (requestURL) |
125 | if (requestMethod == "GET") | 125 | { |
126 | { | 126 | case "/Admin/Accounts": |
127 | responseString = "<p> Account management </p>"; | 127 | if (requestMethod == "GET") |
128 | responseString += "<br> "; | ||
129 | responseString += "<p> Create New Account </p>"; | ||
130 | responseString += NewAccountForm; | ||
131 | } | ||
132 | break; | ||
133 | case "/Admin/Clients": | ||
134 | if (requestMethod == "GET") | ||
135 | { | ||
136 | responseString = " <p> Listing connected Clients </p>" ; | ||
137 | OpenSim.world.Avatar TempAv; | ||
138 | foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) | ||
139 | { | 128 | { |
140 | if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") | 129 | responseString = "<p> Account management </p>"; |
141 | { | 130 | responseString += "<br> "; |
142 | TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; | 131 | responseString += "<p> Create New Account </p>"; |
143 | responseString += "<p>"; | 132 | responseString += NewAccountForm; |
144 | responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); | ||
145 | responseString += "</p>"; | ||
146 | } | ||
147 | } | 133 | } |
148 | } | 134 | break; |
149 | break; | 135 | case "/Admin/Clients": |
150 | case "/Admin/NewAccount": | 136 | if (requestMethod == "GET") |
151 | if (requestMethod == "POST") | ||
152 | { | ||
153 | string[] comp = new string[10]; | ||
154 | string[] passw = new string[3]; | ||
155 | string delimStr = "&"; | ||
156 | char[] delimiter = delimStr.ToCharArray(); | ||
157 | string delimStr2 = "="; | ||
158 | char[] delimiter2 = delimStr2.ToCharArray(); | ||
159 | |||
160 | //Console.WriteLine(requestBody); | ||
161 | comp = requestBody.Split(delimiter); | ||
162 | passw = comp[3].Split(delimiter2); | ||
163 | if (passw[1] == passWord) | ||
164 | { | 137 | { |
165 | responseString = "<p> New Account created </p>"; | 138 | responseString = " <p> Listing connected Clients </p>"; |
139 | OpenSim.world.Avatar TempAv; | ||
140 | foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) | ||
141 | { | ||
142 | if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") | ||
143 | { | ||
144 | TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; | ||
145 | responseString += "<p>"; | ||
146 | responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); | ||
147 | responseString += "</p>"; | ||
148 | } | ||
149 | } | ||
166 | } | 150 | } |
167 | else | 151 | break; |
152 | case "/Admin/NewAccount": | ||
153 | if (requestMethod == "POST") | ||
168 | { | 154 | { |
169 | responseString = "<p> Admin password is incorrect, please login with the correct password</p>"; | 155 | string[] comp = new string[10]; |
170 | responseString += "<br><br>" + LoginForm; | 156 | string[] passw = new string[3]; |
157 | string delimStr = "&"; | ||
158 | char[] delimiter = delimStr.ToCharArray(); | ||
159 | string delimStr2 = "="; | ||
160 | char[] delimiter2 = delimStr2.ToCharArray(); | ||
161 | |||
162 | //Console.WriteLine(requestBody); | ||
163 | comp = requestBody.Split(delimiter); | ||
164 | passw = comp[3].Split(delimiter2); | ||
165 | if (passw[1] == passWord) | ||
166 | { | ||
167 | responseString = "<p> New Account created </p>"; | ||
168 | } | ||
169 | else | ||
170 | { | ||
171 | responseString = "<p> Admin password is incorrect, please login with the correct password</p>"; | ||
172 | responseString += "<br><br>" + LoginForm; | ||
173 | } | ||
171 | } | 174 | } |
172 | 175 | break; | |
173 | 176 | case "/Admin/Login": | |
174 | } | 177 | if (requestMethod == "POST") |
175 | break; | ||
176 | case "/Admin/Login": | ||
177 | if (requestMethod == "POST") | ||
178 | { | ||
179 | Console.WriteLine(requestBody); | ||
180 | if (requestBody == passWord) | ||
181 | { | 178 | { |
182 | responseString = "<p> Login Successful </p>"; | 179 | // Console.WriteLine(requestBody); |
180 | if (requestBody == passWord) | ||
181 | { | ||
182 | responseString = "<p> Login Successful </p>"; | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | responseString = "<p> Password Error </p>"; | ||
187 | responseString += "<p> Please Login with the correct password </p>"; | ||
188 | responseString += "<br><br> " + LoginForm; | ||
189 | } | ||
183 | } | 190 | } |
184 | else | 191 | break; |
192 | case "/Admin/Welcome": | ||
193 | if (requestMethod == "GET") | ||
185 | { | 194 | { |
186 | responseString = "<p> PassWord Error </p>"; | 195 | responseString = "Welcome to the OpenSim Admin Page"; |
187 | responseString += "<p> Please Login with the correct password </p>"; | 196 | responseString += "<br><br><br> " + LoginForm; |
188 | responseString += "<br><br> " + LoginForm; | ||
189 | } | ||
190 | } | ||
191 | break; | ||
192 | case "/Admin/Welcome": | ||
193 | if (requestMethod == "GET") | ||
194 | { | ||
195 | responseString = "Welcome to the OpenSim Admin Page"; | ||
196 | responseString += "<br><br><br> " + LoginForm; | ||
197 | 197 | ||
198 | } | 198 | } |
199 | break; | 199 | break; |
200 | } | ||
201 | } | ||
202 | catch (Exception e) | ||
203 | { | ||
204 | Console.WriteLine(e.ToString()); | ||
200 | } | 205 | } |
201 | 206 | ||
202 | return responseString; | 207 | return responseString; |
@@ -210,7 +215,7 @@ namespace OpenSim.CAPS | |||
210 | 215 | ||
211 | public void HandleRequest(Object stateinfo) | 216 | public void HandleRequest(Object stateinfo) |
212 | { | 217 | { |
213 | // Console.WriteLine("new http incoming"); | 218 | // Console.WriteLine("new http incoming"); |
214 | HttpListenerContext context = (HttpListenerContext)stateinfo; | 219 | HttpListenerContext context = (HttpListenerContext)stateinfo; |
215 | 220 | ||
216 | HttpListenerRequest request = context.Request; | 221 | HttpListenerRequest request = context.Request; |
@@ -265,7 +270,7 @@ namespace OpenSim.CAPS | |||
265 | response.AddHeader("Content-type", "text/html"); | 270 | response.AddHeader("Content-type", "text/html"); |
266 | } | 271 | } |
267 | break; | 272 | break; |
268 | 273 | ||
269 | } | 274 | } |
270 | 275 | ||
271 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); | 276 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); |
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 811e8b8..ef82d98 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -124,6 +124,15 @@ namespace OpenSim | |||
124 | } | 124 | } |
125 | OpenSimRoot.Instance.LocalWorld.GetInitialPrims(this); | 125 | OpenSimRoot.Instance.LocalWorld.GetInitialPrims(this); |
126 | break; | 126 | break; |
127 | case PacketType.AgentIsNowWearing: | ||
128 | AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; | ||
129 | //Console.WriteLine(Pack.ToString()); | ||
130 | break; | ||
131 | case PacketType.AgentSetAppearance: | ||
132 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | ||
133 | // Console.WriteLine(appear.ToString()); | ||
134 | this.ClientAvatar.SetAppearance(appear); | ||
135 | break; | ||
127 | case PacketType.ObjectAdd: | 136 | case PacketType.ObjectAdd: |
128 | OpenSimRoot.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this); | 137 | OpenSimRoot.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this); |
129 | break; | 138 | break; |
@@ -279,7 +288,7 @@ namespace OpenSim | |||
279 | 288 | ||
280 | break; | 289 | break; |
281 | case PacketType.AssetUploadRequest: | 290 | case PacketType.AssetUploadRequest: |
282 | //this.debug = true; | 291 | this.debug = true; |
283 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | 292 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; |
284 | // Console.WriteLine(Pack.ToString()); | 293 | // Console.WriteLine(Pack.ToString()); |
285 | // if (request.AssetBlock.Type == 0) | 294 | // if (request.AssetBlock.Type == 0) |
@@ -318,7 +327,6 @@ namespace OpenSim | |||
318 | OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); | 327 | OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); |
319 | break; | 328 | break; |
320 | case PacketType.UpdateInventoryItem: | 329 | case PacketType.UpdateInventoryItem: |
321 | /* | ||
322 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | 330 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; |
323 | for (int i = 0; i < update.InventoryData.Length; i++) | 331 | for (int i = 0; i < update.InventoryData.Length; i++) |
324 | { | 332 | { |
@@ -338,7 +346,7 @@ namespace OpenSim | |||
338 | } | 346 | } |
339 | } | 347 | } |
340 | } | 348 | } |
341 | }*/ | 349 | } |
342 | break; | 350 | break; |
343 | case PacketType.ViewerEffect: | 351 | case PacketType.ViewerEffect: |
344 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | 352 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; |
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index c8a4539..75f2cff 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs | |||
@@ -5,6 +5,7 @@ using System.Text; | |||
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using libsecondlife.Packets; | 6 | using libsecondlife.Packets; |
7 | using OpenSim.Physics.Manager; | 7 | using OpenSim.Physics.Manager; |
8 | using OpenSim.Framework.Inventory; | ||
8 | using Axiom.MathLib; | 9 | using Axiom.MathLib; |
9 | 10 | ||
10 | namespace OpenSim.world | 11 | namespace OpenSim.world |
@@ -25,6 +26,9 @@ namespace OpenSim.world | |||
25 | private List<NewForce> forcesList = new List<NewForce>(); | 26 | private List<NewForce> forcesList = new List<NewForce>(); |
26 | private short _updateCount = 0; | 27 | private short _updateCount = 0; |
27 | private Axiom.MathLib.Quaternion bodyRot; | 28 | private Axiom.MathLib.Quaternion bodyRot; |
29 | private LLObject.TextureEntry avatarAppearanceTexture = null; | ||
30 | private byte[] visualParams; | ||
31 | private AvatarWearable[] Wearables; | ||
28 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | 32 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); |
29 | 33 | ||
30 | public Avatar(SimClient TheClient) | 34 | public Avatar(SimClient TheClient) |
@@ -34,6 +38,21 @@ namespace OpenSim.world | |||
34 | localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); | 38 | localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); |
35 | position = new LLVector3(100.0f, 100.0f, 30.0f); | 39 | position = new LLVector3(100.0f, 100.0f, 30.0f); |
36 | position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; | 40 | position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; |
41 | visualParams = new byte[218]; | ||
42 | for (int i = 0; i < 218; i++) | ||
43 | { | ||
44 | visualParams[i] = 100; | ||
45 | } | ||
46 | Wearables = new AvatarWearable[13]; //should be 13 of these | ||
47 | for (int i = 0; i < 13; i++) | ||
48 | { | ||
49 | Wearables[i] = new AvatarWearable(); | ||
50 | } | ||
51 | this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
52 | this.Wearables[0].ItemID = LLUUID.Random(); | ||
53 | |||
54 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
55 | |||
37 | } | 56 | } |
38 | 57 | ||
39 | public PhysicsActor PhysActor | 58 | public PhysicsActor PhysActor |
@@ -97,7 +116,6 @@ namespace OpenSim.world | |||
97 | _updateCount++; | 116 | _updateCount++; |
98 | if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) | 117 | if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) |
99 | { | 118 | { |
100 | //Console.WriteLine("been a while since update so have one"); | ||
101 | //It has been a while since last update was sent so lets send one. | 119 | //It has been a while since last update was sent so lets send one. |
102 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | 120 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); |
103 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 121 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
@@ -119,6 +137,7 @@ namespace OpenSim.world | |||
119 | } | 137 | } |
120 | 138 | ||
121 | } | 139 | } |
140 | this.positionLastFrame = pos2; | ||
122 | } | 141 | } |
123 | 142 | ||
124 | public static void SetupTemplate(string name) | 143 | public static void SetupTemplate(string name) |
@@ -204,18 +223,13 @@ namespace OpenSim.world | |||
204 | aw.AgentData.SessionID = ControllingClient.SessionID; | 223 | aw.AgentData.SessionID = ControllingClient.SessionID; |
205 | 224 | ||
206 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | 225 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; |
207 | AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 226 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
208 | awb.WearableType = (byte)0; | 227 | for (int i = 0; i < 13; i++) |
209 | awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
210 | awb.ItemID = LLUUID.Random(); | ||
211 | aw.WearableData[0] = awb; | ||
212 | |||
213 | for (int i = 1; i < 13; i++) | ||
214 | { | 228 | { |
215 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 229 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
216 | awb.WearableType = (byte)i; | 230 | awb.WearableType = (byte)i; |
217 | awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 231 | awb.AssetID = this.Wearables[i].AssetID; |
218 | awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 232 | awb.ItemID = this.Wearables[i].ItemID; |
219 | aw.WearableData[i] = awb; | 233 | aw.WearableData[i] = awb; |
220 | } | 234 | } |
221 | 235 | ||
@@ -253,14 +267,15 @@ namespace OpenSim.world | |||
253 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 267 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; |
254 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); | 268 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); |
255 | 269 | ||
256 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); | 270 | //LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); |
257 | avp.ObjectData.TextureEntry = ntex.ToBytes(); | 271 | //avp.ObjectData.TextureEntry = ntex.ToBytes(); |
272 | avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); | ||
258 | 273 | ||
259 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 274 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
260 | for (int i = 0; i < 218; i++) | 275 | for (int i = 0; i < 218; i++) |
261 | { | 276 | { |
262 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | 277 | avblock = new AvatarAppearancePacket.VisualParamBlock(); |
263 | avblock.ParamValue = (byte)100; | 278 | avblock.ParamValue = visualParams[i]; |
264 | avp.VisualParam[i] = avblock; | 279 | avp.VisualParam[i] = avblock; |
265 | } | 280 | } |
266 | 281 | ||
@@ -269,6 +284,24 @@ namespace OpenSim.world | |||
269 | userInfo.OutPacket(avp); | 284 | userInfo.OutPacket(avp); |
270 | 285 | ||
271 | } | 286 | } |
287 | public void SetAppearance(AgentSetAppearancePacket appear) | ||
288 | { | ||
289 | LLObject.TextureEntry tex = new LLObject.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | ||
290 | this.avatarAppearanceTexture = tex; | ||
291 | for (int i = 0; i < appear.VisualParam.Length; i++) | ||
292 | { | ||
293 | this.visualParams[i] = appear.VisualParam[i].ParamValue; | ||
294 | } | ||
295 | |||
296 | foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) | ||
297 | { | ||
298 | if (client.AgentID != ControllingClient.AgentID) | ||
299 | { | ||
300 | SendAppearanceToOtherAgent(client); | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | |||
272 | 305 | ||
273 | public void HandleUpdate(AgentUpdatePacket pack) | 306 | public void HandleUpdate(AgentUpdatePacket pack) |
274 | { | 307 | { |
@@ -479,7 +512,7 @@ namespace OpenSim.world | |||
479 | int i = 0; | 512 | int i = 0; |
480 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | 513 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
481 | 514 | ||
482 | dat.TextureEntry = AvatarTemplate.TextureEntry; | 515 | dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; |
483 | libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); | 516 | libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); |
484 | 517 | ||
485 | uint ID = this.localid; | 518 | uint ID = this.localid; |