aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs')
-rw-r--r--OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs293
1 files changed, 0 insertions, 293 deletions
diff --git a/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs b/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
deleted file mode 100644
index 0bf0615..0000000
--- a/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
+++ /dev/null
@@ -1,293 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using OpenSim.Framework.Types;
6using OpenSim.RegionServer.Simulator;
7using OpenSim.RegionServer.Client;
8
9using libsecondlife;
10using libsecondlife.Packets;
11
12namespace OpenSim.RegionServer.Estate
13{
14
15 /// <summary>
16 /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings
17 /// </summary>
18 public class EstateManager
19 {
20 private World m_world;
21
22 public EstateManager(World world)
23 {
24 m_world = world; //Estate settings found at world.m_regInfo.estateSettings
25 }
26
27 private bool convertParamStringToBool(byte[] field)
28 {
29 string s = Helpers.FieldToUTF8String(field);
30 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true")
31 {
32 return true;
33 }
34 return false;
35 }
36
37 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, ClientView remote_client)
38 {
39 if (remote_client.AgentID == m_world.m_regInfo.MasterAvatarAssignedUUID)
40 {
41 switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
42 {
43 case "getinfo":
44 Console.WriteLine("GETINFO Requested");
45 this.sendRegionInfoPacketToAll();
46
47 break;
48 case "setregioninfo":
49 if (packet.ParamList.Length != 9)
50 {
51 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
52 }
53 else
54 {
55 m_world.m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None;
56
57 if (convertParamStringToBool(packet.ParamList[0].Parameter))
58 {
59 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform;
60 }
61
62 if (convertParamStringToBool(packet.ParamList[1].Parameter))
63 {
64 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly;
65 }
66
67 if (convertParamStringToBool(packet.ParamList[2].Parameter))
68 {
69 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage;
70 }
71
72 if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
73 {
74 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell;
75 }
76
77
78 int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
79 m_world.m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
80
81 float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
82 m_world.m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
83
84 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
85 m_world.m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel;
86
87
88 if (convertParamStringToBool(packet.ParamList[7].Parameter))
89 {
90 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject;
91 }
92
93 if (convertParamStringToBool(packet.ParamList[8].Parameter))
94 {
95 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges;
96 }
97
98 sendRegionInfoPacketToAll();
99
100 }
101 break;
102 case "texturebase":
103 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
104 {
105 string s = Helpers.FieldToUTF8String(block.Parameter);
106 string[] splitField = s.Split(' ');
107 if (splitField.Length == 2)
108 {
109 LLUUID tempUUID = new LLUUID(splitField[1]);
110 switch (Convert.ToInt16(splitField[0]))
111 {
112 case 0:
113 m_world.m_regInfo.estateSettings.terrainBase0 = tempUUID;
114 break;
115 case 1:
116 m_world.m_regInfo.estateSettings.terrainBase1 = tempUUID;
117 break;
118 case 2:
119 m_world.m_regInfo.estateSettings.terrainBase2 = tempUUID;
120 break;
121 case 3:
122 m_world.m_regInfo.estateSettings.terrainBase3 = tempUUID;
123 break;
124 }
125 }
126 }
127 break;
128 case "texturedetail":
129 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
130 {
131
132 string s = Helpers.FieldToUTF8String(block.Parameter);
133 string[] splitField = s.Split(' ');
134 if (splitField.Length == 2)
135 {
136 LLUUID tempUUID = new LLUUID(splitField[1]);
137 switch (Convert.ToInt16(splitField[0]))
138 {
139 case 0:
140 m_world.m_regInfo.estateSettings.terrainDetail0 = tempUUID;
141 break;
142 case 1:
143 m_world.m_regInfo.estateSettings.terrainDetail1 = tempUUID;
144 break;
145 case 2:
146 m_world.m_regInfo.estateSettings.terrainDetail2 = tempUUID;
147 break;
148 case 3:
149 m_world.m_regInfo.estateSettings.terrainDetail3 = tempUUID;
150 break;
151 }
152 }
153 }
154 break;
155 case "textureheights":
156 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
157 {
158
159 string s = Helpers.FieldToUTF8String(block.Parameter);
160 string[] splitField = s.Split(' ');
161 if (splitField.Length == 3)
162 {
163
164 float tempHeightLow = (float)Convert.ToDecimal(splitField[1]);
165 float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]);
166
167 switch (Convert.ToInt16(splitField[0]))
168 {
169 case 0:
170 m_world.m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow;
171 m_world.m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh;
172 break;
173 case 1:
174 m_world.m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow;
175 m_world.m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh;
176 break;
177 case 2:
178 m_world.m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow;
179 m_world.m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh;
180 break;
181 case 3:
182 m_world.m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow;
183 m_world.m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh;
184 break;
185 }
186 }
187 }
188 break;
189 case "texturecommit":
190 sendRegionHandshakeToAll();
191 break;
192 case "setregionterrain":
193 if (packet.ParamList.Length != 9)
194 {
195 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
196 }
197 else
198 {
199 m_world.m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
200 m_world.m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
201 m_world.m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
202 m_world.m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
203 m_world.m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
204
205 sendRegionInfoPacketToAll();
206 }
207 break;
208 default:
209 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
210 break;
211 }
212 }
213 }
214
215 public void sendRegionInfoPacketToAll()
216 {
217 foreach (OpenSim.RegionServer.Simulator.Avatar av in m_world.Avatars.Values)
218 {
219 this.sendRegionInfoPacket(av.ControllingClient);
220 }
221 }
222
223 public void sendRegionHandshakeToAll()
224 {
225 foreach (OpenSim.RegionServer.Simulator.Avatar av in m_world.Avatars.Values)
226 {
227 this.sendRegionHandshake(av.ControllingClient);
228 }
229 }
230
231 public void sendRegionInfoPacket(ClientView remote_client)
232 {
233
234 RegionInfoPacket regionInfoPacket = new RegionInfoPacket();
235 regionInfoPacket.AgentData.AgentID = remote_client.AgentID;
236 regionInfoPacket.AgentData.SessionID = remote_client.SessionID;
237 regionInfoPacket.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor;
238 regionInfoPacket.RegionInfo.EstateID = m_world.m_regInfo.estateSettings.estateID;
239 regionInfoPacket.RegionInfo.MaxAgents = m_world.m_regInfo.estateSettings.maxAgents;
240 regionInfoPacket.RegionInfo.ObjectBonusFactor = m_world.m_regInfo.estateSettings.objectBonusFactor;
241 regionInfoPacket.RegionInfo.ParentEstateID = m_world.m_regInfo.estateSettings.parentEstateID;
242 regionInfoPacket.RegionInfo.PricePerMeter = m_world.m_regInfo.estateSettings.pricePerMeter;
243 regionInfoPacket.RegionInfo.RedirectGridX = m_world.m_regInfo.estateSettings.redirectGridX;
244 regionInfoPacket.RegionInfo.RedirectGridY = m_world.m_regInfo.estateSettings.redirectGridY;
245 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_world.m_regInfo.estateSettings.regionFlags;
246 regionInfoPacket.RegionInfo.SimAccess = (byte)m_world.m_regInfo.estateSettings.simAccess;
247 regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_world.m_regInfo.RegionName);
248 regionInfoPacket.RegionInfo.SunHour = m_world.m_regInfo.estateSettings.sunHour;
249 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_world.m_regInfo.estateSettings.terrainLowerLimit;
250 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_world.m_regInfo.estateSettings.terrainRaiseLimit;
251 regionInfoPacket.RegionInfo.UseEstateSun = !m_world.m_regInfo.estateSettings.useFixedSun;
252 regionInfoPacket.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight;
253
254 remote_client.OutPacket(regionInfoPacket);
255 }
256
257 public void sendRegionHandshake(ClientView remote_client)
258 {
259 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
260 RegionHandshakePacket handshake = new RegionHandshakePacket();
261
262 handshake.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor;
263 handshake.RegionInfo.IsEstateManager = false;
264 handshake.RegionInfo.TerrainHeightRange00 = m_world.m_regInfo.estateSettings.terrainHeightRange0;
265 handshake.RegionInfo.TerrainHeightRange01 = m_world.m_regInfo.estateSettings.terrainHeightRange1;
266 handshake.RegionInfo.TerrainHeightRange10 = m_world.m_regInfo.estateSettings.terrainHeightRange2;
267 handshake.RegionInfo.TerrainHeightRange11 = m_world.m_regInfo.estateSettings.terrainHeightRange3;
268 handshake.RegionInfo.TerrainStartHeight00 = m_world.m_regInfo.estateSettings.terrainStartHeight0;
269 handshake.RegionInfo.TerrainStartHeight01 = m_world.m_regInfo.estateSettings.terrainStartHeight1;
270 handshake.RegionInfo.TerrainStartHeight10 = m_world.m_regInfo.estateSettings.terrainStartHeight2;
271 handshake.RegionInfo.TerrainStartHeight11 = m_world.m_regInfo.estateSettings.terrainStartHeight3;
272 handshake.RegionInfo.SimAccess = (byte)m_world.m_regInfo.estateSettings.simAccess;
273 handshake.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight;
274
275
276 handshake.RegionInfo.RegionFlags = (uint)m_world.m_regInfo.estateSettings.regionFlags;
277
278 handshake.RegionInfo.SimName = _enc.GetBytes(m_world.m_regInfo.RegionName + "\0");
279 handshake.RegionInfo.SimOwner = m_world.m_regInfo.MasterAvatarAssignedUUID;
280 handshake.RegionInfo.TerrainBase0 = m_world.m_regInfo.estateSettings.terrainBase0;
281 handshake.RegionInfo.TerrainBase1 = m_world.m_regInfo.estateSettings.terrainBase1;
282 handshake.RegionInfo.TerrainBase2 = m_world.m_regInfo.estateSettings.terrainBase2;
283 handshake.RegionInfo.TerrainBase3 = m_world.m_regInfo.estateSettings.terrainBase3;
284 handshake.RegionInfo.TerrainDetail0 = m_world.m_regInfo.estateSettings.terrainDetail0;
285 handshake.RegionInfo.TerrainDetail1 = m_world.m_regInfo.estateSettings.terrainDetail1;
286 handshake.RegionInfo.TerrainDetail2 = m_world.m_regInfo.estateSettings.terrainDetail2;
287 handshake.RegionInfo.TerrainDetail3 = m_world.m_regInfo.estateSettings.terrainDetail3;
288 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
289
290 remote_client.OutPacket(handshake);
291 }
292 }
293}