diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/EstateManager.cs | 320 |
1 files changed, 172 insertions, 148 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs index 3af6fb2..b8bc949 100644 --- a/OpenSim/Region/Environment/EstateManager.cs +++ b/OpenSim/Region/Environment/EstateManager.cs | |||
@@ -72,167 +72,24 @@ namespace OpenSim.Region.Environment | |||
72 | { | 72 | { |
73 | case "getinfo": | 73 | case "getinfo": |
74 | this.sendRegionInfoPacketToAll(); | 74 | this.sendRegionInfoPacketToAll(); |
75 | |||
76 | break; | 75 | break; |
77 | case "setregioninfo": | 76 | case "setregioninfo": |
78 | if (packet.ParamList.Length != 9) | 77 | estateSetRegionInfoHandler(packet); |
79 | { | ||
80 | MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | m_regInfo.estateSettings.regionFlags = Simulator.RegionFlags.None; | ||
85 | |||
86 | if (convertParamStringToBool(packet.ParamList[0].Parameter)) | ||
87 | { | ||
88 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockTerraform; | ||
89 | } | ||
90 | |||
91 | if (convertParamStringToBool(packet.ParamList[1].Parameter)) | ||
92 | { | ||
93 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.NoFly; | ||
94 | } | ||
95 | |||
96 | if (convertParamStringToBool(packet.ParamList[2].Parameter)) | ||
97 | { | ||
98 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowDamage; | ||
99 | } | ||
100 | |||
101 | if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) | ||
102 | { | ||
103 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockLandResell; | ||
104 | } | ||
105 | |||
106 | |||
107 | int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); | ||
108 | m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; | ||
109 | |||
110 | float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | ||
111 | m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; | ||
112 | |||
113 | int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); | ||
114 | m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; | ||
115 | |||
116 | |||
117 | if (convertParamStringToBool(packet.ParamList[7].Parameter)) | ||
118 | { | ||
119 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.RestrictPushObject; | ||
120 | } | ||
121 | |||
122 | if (convertParamStringToBool(packet.ParamList[8].Parameter)) | ||
123 | { | ||
124 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges; | ||
125 | } | ||
126 | |||
127 | sendRegionInfoPacketToAll(); | ||
128 | |||
129 | } | ||
130 | break; | 78 | break; |
131 | case "texturebase": | 79 | case "texturebase": |
132 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | 80 | estateTextureBaseHandler(packet); |
133 | { | ||
134 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
135 | string[] splitField = s.Split(' '); | ||
136 | if (splitField.Length == 2) | ||
137 | { | ||
138 | LLUUID tempUUID = new LLUUID(splitField[1]); | ||
139 | switch (Convert.ToInt16(splitField[0])) | ||
140 | { | ||
141 | case 0: | ||
142 | m_regInfo.estateSettings.terrainBase0 = tempUUID; | ||
143 | break; | ||
144 | case 1: | ||
145 | m_regInfo.estateSettings.terrainBase1 = tempUUID; | ||
146 | break; | ||
147 | case 2: | ||
148 | m_regInfo.estateSettings.terrainBase2 = tempUUID; | ||
149 | break; | ||
150 | case 3: | ||
151 | m_regInfo.estateSettings.terrainBase3 = tempUUID; | ||
152 | break; | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | break; | 81 | break; |
157 | case "texturedetail": | 82 | case "texturedetail": |
158 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | 83 | estateTextureDetailHandler(packet); |
159 | { | ||
160 | |||
161 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
162 | string[] splitField = s.Split(' '); | ||
163 | if (splitField.Length == 2) | ||
164 | { | ||
165 | LLUUID tempUUID = new LLUUID(splitField[1]); | ||
166 | switch (Convert.ToInt16(splitField[0])) | ||
167 | { | ||
168 | case 0: | ||
169 | m_regInfo.estateSettings.terrainDetail0 = tempUUID; | ||
170 | break; | ||
171 | case 1: | ||
172 | m_regInfo.estateSettings.terrainDetail1 = tempUUID; | ||
173 | break; | ||
174 | case 2: | ||
175 | m_regInfo.estateSettings.terrainDetail2 = tempUUID; | ||
176 | break; | ||
177 | case 3: | ||
178 | m_regInfo.estateSettings.terrainDetail3 = tempUUID; | ||
179 | break; | ||
180 | } | ||
181 | } | ||
182 | } | ||
183 | break; | 84 | break; |
184 | case "textureheights": | 85 | case "textureheights": |
185 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | 86 | estateTextureHeightsHandler(packet); |
186 | { | ||
187 | |||
188 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
189 | string[] splitField = s.Split(' '); | ||
190 | if (splitField.Length == 3) | ||
191 | { | ||
192 | |||
193 | float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); | ||
194 | float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); | ||
195 | |||
196 | switch (Convert.ToInt16(splitField[0])) | ||
197 | { | ||
198 | case 0: | ||
199 | m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; | ||
200 | m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; | ||
201 | break; | ||
202 | case 1: | ||
203 | m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; | ||
204 | m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; | ||
205 | break; | ||
206 | case 2: | ||
207 | m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; | ||
208 | m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; | ||
209 | break; | ||
210 | case 3: | ||
211 | m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; | ||
212 | m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; | ||
213 | break; | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | break; | 87 | break; |
218 | case "texturecommit": | 88 | case "texturecommit": |
219 | sendRegionHandshakeToAll(); | 89 | sendRegionHandshakeToAll(); |
220 | break; | 90 | break; |
221 | case "setregionterrain": | 91 | case "setregionterrain": |
222 | if (packet.ParamList.Length != 9) | 92 | estateSetRegionTerrainHandler(packet); |
223 | { | ||
224 | MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); | ||
225 | } | ||
226 | else | ||
227 | { | ||
228 | m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); | ||
229 | m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); | ||
230 | m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); | ||
231 | m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); | ||
232 | m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | ||
233 | |||
234 | sendRegionInfoPacketToAll(); | ||
235 | } | ||
236 | break; | 93 | break; |
237 | default: | 94 | default: |
238 | MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); | 95 | MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); |
@@ -241,6 +98,173 @@ namespace OpenSim.Region.Environment | |||
241 | } | 98 | } |
242 | } | 99 | } |
243 | 100 | ||
101 | private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet) | ||
102 | { | ||
103 | if (packet.ParamList.Length != 9) | ||
104 | { | ||
105 | MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | m_regInfo.estateSettings.regionFlags = Simulator.RegionFlags.None; | ||
110 | |||
111 | if (convertParamStringToBool(packet.ParamList[0].Parameter)) | ||
112 | { | ||
113 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockTerraform; | ||
114 | } | ||
115 | |||
116 | if (convertParamStringToBool(packet.ParamList[1].Parameter)) | ||
117 | { | ||
118 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.NoFly; | ||
119 | } | ||
120 | |||
121 | if (convertParamStringToBool(packet.ParamList[2].Parameter)) | ||
122 | { | ||
123 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowDamage; | ||
124 | } | ||
125 | |||
126 | if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) | ||
127 | { | ||
128 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockLandResell; | ||
129 | } | ||
130 | |||
131 | |||
132 | int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); | ||
133 | m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; | ||
134 | |||
135 | float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | ||
136 | m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; | ||
137 | |||
138 | int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); | ||
139 | m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; | ||
140 | |||
141 | |||
142 | if (convertParamStringToBool(packet.ParamList[7].Parameter)) | ||
143 | { | ||
144 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.RestrictPushObject; | ||
145 | } | ||
146 | |||
147 | if (convertParamStringToBool(packet.ParamList[8].Parameter)) | ||
148 | { | ||
149 | m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges; | ||
150 | } | ||
151 | |||
152 | sendRegionInfoPacketToAll(); | ||
153 | |||
154 | } | ||
155 | } | ||
156 | |||
157 | private void estateSetRegionTerrainHandler(EstateOwnerMessagePacket packet) | ||
158 | { | ||
159 | if (packet.ParamList.Length != 9) | ||
160 | { | ||
161 | MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); | ||
166 | m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); | ||
167 | m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); | ||
168 | m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); | ||
169 | m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | ||
170 | |||
171 | sendRegionInfoPacketToAll(); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | private void estateTextureHeightsHandler(EstateOwnerMessagePacket packet) | ||
176 | { | ||
177 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | ||
178 | { | ||
179 | |||
180 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
181 | string[] splitField = s.Split(' '); | ||
182 | if (splitField.Length == 3) | ||
183 | { | ||
184 | |||
185 | float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); | ||
186 | float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); | ||
187 | |||
188 | switch (Convert.ToInt16(splitField[0])) | ||
189 | { | ||
190 | case 0: | ||
191 | m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; | ||
192 | m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; | ||
193 | break; | ||
194 | case 1: | ||
195 | m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; | ||
196 | m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; | ||
197 | break; | ||
198 | case 2: | ||
199 | m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; | ||
200 | m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; | ||
201 | break; | ||
202 | case 3: | ||
203 | m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; | ||
204 | m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; | ||
205 | break; | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | |||
211 | private void estateTextureDetailHandler(EstateOwnerMessagePacket packet) | ||
212 | { | ||
213 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | ||
214 | { | ||
215 | |||
216 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
217 | string[] splitField = s.Split(' '); | ||
218 | if (splitField.Length == 2) | ||
219 | { | ||
220 | LLUUID tempUUID = new LLUUID(splitField[1]); | ||
221 | switch (Convert.ToInt16(splitField[0])) | ||
222 | { | ||
223 | case 0: | ||
224 | m_regInfo.estateSettings.terrainDetail0 = tempUUID; | ||
225 | break; | ||
226 | case 1: | ||
227 | m_regInfo.estateSettings.terrainDetail1 = tempUUID; | ||
228 | break; | ||
229 | case 2: | ||
230 | m_regInfo.estateSettings.terrainDetail2 = tempUUID; | ||
231 | break; | ||
232 | case 3: | ||
233 | m_regInfo.estateSettings.terrainDetail3 = tempUUID; | ||
234 | break; | ||
235 | } | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | |||
240 | private void estateTextureBaseHandler(EstateOwnerMessagePacket packet) | ||
241 | { | ||
242 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | ||
243 | { | ||
244 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
245 | string[] splitField = s.Split(' '); | ||
246 | if (splitField.Length == 2) | ||
247 | { | ||
248 | LLUUID tempUUID = new LLUUID(splitField[1]); | ||
249 | switch (Convert.ToInt16(splitField[0])) | ||
250 | { | ||
251 | case 0: | ||
252 | m_regInfo.estateSettings.terrainBase0 = tempUUID; | ||
253 | break; | ||
254 | case 1: | ||
255 | m_regInfo.estateSettings.terrainBase1 = tempUUID; | ||
256 | break; | ||
257 | case 2: | ||
258 | m_regInfo.estateSettings.terrainBase2 = tempUUID; | ||
259 | break; | ||
260 | case 3: | ||
261 | m_regInfo.estateSettings.terrainBase3 = tempUUID; | ||
262 | break; | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | } | ||
267 | |||
244 | public void sendRegionInfoPacketToAll() | 268 | public void sendRegionInfoPacketToAll() |
245 | { | 269 | { |
246 | List<Avatar> avatars = m_scene.RequestAvatarList(); | 270 | List<Avatar> avatars = m_scene.RequestAvatarList(); |