aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer')
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs198
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs22
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionServerBase.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/VersionInfo.cs2
4 files changed, 210 insertions, 14 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 579928c..55ff8a1 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Framework.Interfaces; 4using OpenSim.Framework.Interfaces;
5using OpenSim.Framework.Inventory; 5using OpenSim.Framework.Inventory;
6using OpenSim.Framework.Types;
6using libsecondlife; 7using libsecondlife;
7using libsecondlife.Packets; 8using libsecondlife.Packets;
8 9
@@ -32,6 +33,8 @@ namespace OpenSim
32 public event UpdatePrimVector OnUpdatePrimScale; 33 public event UpdatePrimVector OnUpdatePrimScale;
33 public event StatusChange OnChildAgentStatus; 34 public event StatusChange OnChildAgentStatus;
34 public event GenericCall2 OnStopMovement; 35 public event GenericCall2 OnStopMovement;
36 public event NewAvatar OnNewAvatar;
37 public event GenericCall6 OnRemoveAvatar;
35 38
36 public LLVector3 StartPos 39 public LLVector3 StartPos
37 { 40 {
@@ -70,7 +73,7 @@ namespace OpenSim
70 this.OutPacket(reply); 73 this.OutPacket(reply);
71 } 74 }
72 75
73 public void SendAppearance(AvatarWearable[] wearables) 76 public void SendWearables(AvatarWearable[] wearables)
74 { 77 {
75 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); 78 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
76 aw.AgentData.AgentID = this.AgentID; 79 aw.AgentData.AgentID = this.AgentID;
@@ -90,6 +93,199 @@ namespace OpenSim
90 93
91 this.OutPacket(aw); 94 this.OutPacket(aw);
92 } 95 }
96
97 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
98 {
99 AvatarAppearancePacket avp = new AvatarAppearancePacket();
100 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
101 avp.ObjectData.TextureEntry = textureEntry;
102
103 AvatarAppearancePacket.VisualParamBlock avblock = null;
104 for (int i = 0; i < 218; i++)
105 {
106 avblock = new AvatarAppearancePacket.VisualParamBlock();
107 avblock.ParamValue = visualParams[i];
108 avp.VisualParam[i] = avblock;
109 }
110
111 avp.Sender.IsTrial = false;
112 avp.Sender.ID = agentID;
113 OutPacket(avp);
114 }
115
116 /// <summary>
117 /// Send the region heightmap to the client
118 /// </summary>
119 /// <param name="map">heightmap</param>
120 public virtual void SendLayerData(float[] map)
121 {
122 try
123 {
124 int[] patches = new int[4];
125
126 for (int y = 0; y < 16; y++)
127 {
128 for (int x = 0; x < 16; x = x + 4)
129 {
130 patches[0] = x + 0 + y * 16;
131 patches[1] = x + 1 + y * 16;
132 patches[2] = x + 2 + y * 16;
133 patches[3] = x + 3 + y * 16;
134
135 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
136 OutPacket(layerpack);
137 }
138 }
139 }
140 catch (Exception e)
141 {
142 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString());
143 }
144 }
145
146 /// <summary>
147 /// Sends a specified patch to a client
148 /// </summary>
149 /// <param name="px">Patch coordinate (x) 0..16</param>
150 /// <param name="py">Patch coordinate (y) 0..16</param>
151 /// <param name="map">heightmap</param>
152 public void SendLayerData(int px, int py, float[] map)
153 {
154 try
155 {
156 int[] patches = new int[1];
157 int patchx, patchy;
158 patchx = px / 16;
159 patchy = py / 16;
160
161 patches[0] = patchx + 0 + patchy * 16;
162
163 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
164 OutPacket(layerpack);
165 }
166 catch (Exception e)
167 {
168 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString());
169 }
170 }
171
172 public void SendRegionHandshake(RegionInfo regionInfo)
173 {
174 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
175 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
176 RegionHandshakePacket handshake = new RegionHandshakePacket();
177
178 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
179 handshake.RegionInfo.BillableFactor = 0;
180 handshake.RegionInfo.IsEstateManager = false;
181 handshake.RegionInfo.TerrainHeightRange00 = regionInfo.TerrainHeightRange00;
182 handshake.RegionInfo.TerrainHeightRange01 = regionInfo.TerrainHeightRange01;
183 handshake.RegionInfo.TerrainHeightRange10 = regionInfo.TerrainHeightRange10;
184 handshake.RegionInfo.TerrainHeightRange11 = regionInfo.TerrainHeightRange11;
185 handshake.RegionInfo.TerrainStartHeight00 = regionInfo.TerrainStartHeight00;
186 handshake.RegionInfo.TerrainStartHeight01 = regionInfo.TerrainStartHeight01;
187 handshake.RegionInfo.TerrainStartHeight10 = regionInfo.TerrainStartHeight10;
188 handshake.RegionInfo.TerrainStartHeight11 = regionInfo.TerrainStartHeight11;
189 handshake.RegionInfo.SimAccess = 13;
190 handshake.RegionInfo.WaterHeight = regionInfo.RegionWaterHeight;
191 uint regionFlags = 72458694;
192 if (regionInfo.RegionTerraform)
193 {
194 regionFlags -= 64;
195 }
196 handshake.RegionInfo.RegionFlags = regionFlags;
197 handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0");
198 handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
199 handshake.RegionInfo.TerrainBase0 = regionInfo.TerrainBase0;
200 handshake.RegionInfo.TerrainBase1 = regionInfo.TerrainBase1;
201 handshake.RegionInfo.TerrainBase2 = regionInfo.TerrainBase2;
202 handshake.RegionInfo.TerrainBase3 = regionInfo.TerrainBase3;
203 handshake.RegionInfo.TerrainDetail0 = regionInfo.TerrainDetail0;
204 handshake.RegionInfo.TerrainDetail1 = regionInfo.TerrainDetail1;
205 handshake.RegionInfo.TerrainDetail2 = regionInfo.TerrainDetail2;
206 handshake.RegionInfo.TerrainDetail3 = regionInfo.TerrainDetail3;
207 handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
208
209 OutPacket(handshake);
210 }
211
212 public void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos)
213 {
214 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
215 //send a objectupdate packet with information about the clients avatar
216
217 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
218 objupdate.RegionData.RegionHandle = regionInfo.RegionHandle;
219 objupdate.RegionData.TimeDilation = 64096;
220 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
221 objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket();
222 //give this avatar object a local id and assign the user a name
223
224 objupdate.ObjectData[0].ID = avatarLocalID;
225 objupdate.ObjectData[0].FullID = avatarID;
226 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName + " \0");
227 libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
228 byte[] pb = pos2.GetBytes();
229 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
230
231 OutPacket(objupdate);
232
233 }
234
235 protected void SetDefaultPacketValues(ref ObjectUpdatePacket.ObjectDataBlock objdata)
236 {
237 objdata.PSBlock = new byte[0];
238 objdata.ExtraParams = new byte[1];
239 objdata.MediaURL = new byte[0];
240 objdata.NameValue = new byte[0];
241 objdata.Text = new byte[0];
242 objdata.TextColor = new byte[4];
243 objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
244 objdata.JointPivot = new LLVector3(0, 0, 0);
245 objdata.Material = 4;
246 objdata.TextureAnim = new byte[0];
247 objdata.Sound = LLUUID.Zero;
248 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
249 objdata.TextureEntry = ntex.ToBytes();
250 objdata.State = 0;
251 objdata.Data = new byte[0];
252
253 objdata.ObjectData = new byte[76];
254 objdata.ObjectData[15] = 128;
255 objdata.ObjectData[16] = 63;
256 objdata.ObjectData[56] = 128;
257 objdata.ObjectData[61] = 102;
258 objdata.ObjectData[62] = 40;
259 objdata.ObjectData[63] = 61;
260 objdata.ObjectData[64] = 189;
261 }
262
263 protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket()
264 {
265 libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
266
267 SetDefaultPacketValues(ref objdata);
268 objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
269 objdata.PathCurve = 16;
270 objdata.ProfileCurve = 1;
271 objdata.PathScaleX = 100;
272 objdata.PathScaleY = 100;
273 objdata.ParentID = 0;
274 objdata.OwnerID = LLUUID.Zero;
275 objdata.Scale = new LLVector3(1, 1, 1);
276 objdata.PCode = 47;
277 System.Text.Encoding enc = System.Text.Encoding.ASCII;
278 libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
279 pos.X = 100f;
280 objdata.ID = 8880000;
281 objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
282 libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f);
283 //objdata.FullID=user.AgentID;
284 byte[] pb = pos.GetBytes();
285 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
286
287 return objdata;
288 }
93 #endregion 289 #endregion
94 290
95 } 291 }
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index 0419b7a..4d1634c 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -52,12 +52,16 @@ namespace OpenSim
52 /// </summary> 52 /// </summary>
53 public partial class ClientView : ClientViewBase, IClientAPI 53 public partial class ClientView : ClientViewBase, IClientAPI
54 { 54 {
55 public static TerrainManager TerrainManager;
56
55 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients 57 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
56 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance 58 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance
57 59
58 public LLUUID AgentID; 60 public LLUUID AgentID;
59 public LLUUID SessionID; 61 public LLUUID SessionID;
60 public LLUUID SecureSessionID = LLUUID.Zero; 62 public LLUUID SecureSessionID = LLUUID.Zero;
63 public string FirstName;
64 public string LastName;
61 public bool m_child = false; 65 public bool m_child = false;
62 private UseCircuitCodePacket cirpack; 66 private UseCircuitCodePacket cirpack;
63 public Thread ClientThread; 67 public Thread ClientThread;
@@ -112,13 +116,9 @@ namespace OpenSim
112 { 116 {
113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); 117 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
114 this.m_child = false; 118 this.m_child = false;
115 //this.m_world.RemoveViewerAgent(this);
116
117 this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); 119 this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
118 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); 120 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
119
120 OnChildAgentStatus(this.m_child); 121 OnChildAgentStatus(this.m_child);
121 //this.InitNewClient();
122 } 122 }
123 123
124 public void DowngradeClient() 124 public void DowngradeClient()
@@ -126,8 +126,7 @@ namespace OpenSim
126 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child"); 126 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
127 this.m_child = true; 127 this.m_child = true;
128 OnChildAgentStatus(this.m_child); 128 OnChildAgentStatus(this.m_child);
129 //this.m_world.RemoveViewerAgent(this); 129
130 //this.m_world.AddViewerAgent(this);
131 } 130 }
132 131
133 public void KillClient() 132 public void KillClient()
@@ -230,8 +229,8 @@ namespace OpenSim
230 229
231 protected virtual void InitNewClient() 230 protected virtual void InitNewClient()
232 { 231 {
233 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 232 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
234 // this.ClientAvatar = m_world.AddViewerAgent(this); 233 OnNewAvatar(this, this.AgentID, this.m_child);
235 } 234 }
236 235
237 protected virtual void AuthUser() 236 protected virtual void AuthUser()
@@ -251,13 +250,14 @@ namespace OpenSim
251 this.AgentID = cirpack.CircuitCode.ID; 250 this.AgentID = cirpack.CircuitCode.ID;
252 this.SessionID = cirpack.CircuitCode.SessionID; 251 this.SessionID = cirpack.CircuitCode.SessionID;
253 this.CircuitCode = cirpack.CircuitCode.Code; 252 this.CircuitCode = cirpack.CircuitCode.Code;
254 InitNewClient(); 253 this.FirstName = sessionInfo.LoginInfo.First;
255 //this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; 254 this.LastName = sessionInfo.LoginInfo.Last;
256 // this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; 255
257 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) 256 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
258 { 257 {
259 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; 258 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession;
260 } 259 }
260 InitNewClient();
261 261
262 ClientLoop(); 262 ClientLoop();
263 } 263 }
diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
index 7f18d34..3b9c6e0 100644
--- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
+++ b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
@@ -46,7 +46,7 @@ namespace OpenSim
46 protected List<RegionInfo> regionData = new List<RegionInfo>(); 46 protected List<RegionInfo> regionData = new List<RegionInfo>();
47 protected List<IWorld> m_localWorld = new List<IWorld>(); 47 protected List<IWorld> m_localWorld = new List<IWorld>();
48 protected BaseHttpServer httpServer; 48 protected BaseHttpServer httpServer;
49 protected AuthenticateSessionsBase AuthenticateSessionsHandler; 49 protected List<AuthenticateSessionsBase> AuthenticateSessionsHandler = new List<AuthenticateSessionsBase>();
50 50
51 protected ConsoleBase m_console; 51 protected ConsoleBase m_console;
52 52
diff --git a/OpenSim/OpenSim.RegionServer/VersionInfo.cs b/OpenSim/OpenSim.RegionServer/VersionInfo.cs
index 38b6685..686024e 100644
--- a/OpenSim/OpenSim.RegionServer/VersionInfo.cs
+++ b/OpenSim/OpenSim.RegionServer/VersionInfo.cs
@@ -32,6 +32,6 @@ namespace OpenSim
32 /// </summary> 32 /// </summary>
33 public class VersionInfo 33 public class VersionInfo
34 { 34 {
35 public static string Version = "0.2, SVN build "; 35 public static string Version = "0.3, SVN build ";
36 } 36 }
37} 37}