aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
diff options
context:
space:
mode:
authormingchen2007-06-08 03:54:03 +0000
committermingchen2007-06-08 03:54:03 +0000
commit269ff893df525ad5ea8ad8fbe2528f7045dec8d9 (patch)
tree6b3957c356c76a59b360bf938ddea9c64932a26e /OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
parent*Added basic support for EstateOwnerMessage (diff)
downloadopensim-SC-269ff893df525ad5ea8ad8fbe2528f7045dec8d9.zip
opensim-SC-269ff893df525ad5ea8ad8fbe2528f7045dec8d9.tar.gz
opensim-SC-269ff893df525ad5ea8ad8fbe2528f7045dec8d9.tar.bz2
opensim-SC-269ff893df525ad5ea8ad8fbe2528f7045dec8d9.tar.xz
*Added Estate Tools for terrain texturing, terrain texturing heights per corner, water height, region flags, etc basic settings
*Parcel now sends ParcelProperties when the owner changes information as soon as the information is changed
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs271
1 files changed, 250 insertions, 21 deletions
diff --git a/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs b/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
index 33996d0..7a34334 100644
--- a/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
+++ b/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs
@@ -24,6 +24,16 @@ namespace OpenSim.RegionServer.Estate
24 m_world = world; //Estate settings found at world.m_regInfo.estateSettings 24 m_world = world; //Estate settings found at world.m_regInfo.estateSettings
25 } 25 }
26 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
27 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, ClientView remote_client) 37 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, ClientView remote_client)
28 { 38 {
29 if (remote_client.AgentID == m_world.m_regInfo.MasterAvatarAssignedUUID) 39 if (remote_client.AgentID == m_world.m_regInfo.MasterAvatarAssignedUUID)
@@ -32,27 +42,168 @@ namespace OpenSim.RegionServer.Estate
32 { 42 {
33 case "getinfo": 43 case "getinfo":
34 Console.WriteLine("GETINFO Requested"); 44 Console.WriteLine("GETINFO Requested");
35 RegionInfoPacket regionInfoPacket = new RegionInfoPacket(); 45 this.sendRegionInfoPacketToAll();
36 regionInfoPacket.AgentData.AgentID = remote_client.AgentID; 46
37 regionInfoPacket.AgentData.SessionID = remote_client.SessionID; 47 break;
38 regionInfoPacket.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor; 48 case "setregioninfo":
39 regionInfoPacket.RegionInfo.EstateID = m_world.m_regInfo.estateSettings.estateID; 49 if (packet.ParamList.Length != 9)
40 regionInfoPacket.RegionInfo.MaxAgents = m_world.m_regInfo.estateSettings.maxAgents; 50 {
41 regionInfoPacket.RegionInfo.ObjectBonusFactor = m_world.m_regInfo.estateSettings.objectBonusFactor; 51 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
42 regionInfoPacket.RegionInfo.ParentEstateID = m_world.m_regInfo.estateSettings.parentEstateID; 52 }
43 regionInfoPacket.RegionInfo.PricePerMeter = m_world.m_regInfo.estateSettings.pricePerMeter; 53 else
44 regionInfoPacket.RegionInfo.RedirectGridX = m_world.m_regInfo.estateSettings.redirectGridX; 54 {
45 regionInfoPacket.RegionInfo.RedirectGridY = m_world.m_regInfo.estateSettings.redirectGridY; 55 m_world.m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None;
46 regionInfoPacket.RegionInfo.RegionFlags = m_world.m_regInfo.estateSettings.regionFlags; 56
47 regionInfoPacket.RegionInfo.SimAccess = m_world.m_regInfo.estateSettings.simAccess; 57 if (convertParamStringToBool(packet.ParamList[0].Parameter))
48 regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_world.m_regInfo.RegionName); 58 {
49 regionInfoPacket.RegionInfo.SunHour = m_world.m_regInfo.estateSettings.sunHour; 59 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform;
50 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_world.m_regInfo.estateSettings.terrainLowerLimit; 60 }
51 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_world.m_regInfo.estateSettings.terrainRaiseLimit; 61
52 regionInfoPacket.RegionInfo.UseEstateSun = m_world.m_regInfo.estateSettings.useEstateSun; 62 if (convertParamStringToBool(packet.ParamList[1].Parameter))
53 regionInfoPacket.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight; 63 {
54 64 m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly;
55 remote_client.OutPacket(regionInfoPacket); 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 }
56 break; 207 break;
57 default: 208 default:
58 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); 209 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
@@ -60,5 +211,83 @@ namespace OpenSim.RegionServer.Estate
60 } 211 }
61 } 212 }
62 } 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.estateSettings.waterHeight + "\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 }
63 } 292 }
64} 293}