* Extracted and refactored several large methods. Needs moving of packet handling into ClientView.

afrisby
Adam Frisby 2007-08-04 00:29:25 +00:00
parent dc7279118f
commit 8c5271a6e0
1 changed files with 172 additions and 148 deletions

View File

@ -72,9 +72,34 @@ namespace OpenSim.Region.Environment
{
case "getinfo":
this.sendRegionInfoPacketToAll();
break;
case "setregioninfo":
estateSetRegionInfoHandler(packet);
break;
case "texturebase":
estateTextureBaseHandler(packet);
break;
case "texturedetail":
estateTextureDetailHandler(packet);
break;
case "textureheights":
estateTextureHeightsHandler(packet);
break;
case "texturecommit":
sendRegionHandshakeToAll();
break;
case "setregionterrain":
estateSetRegionTerrainHandler(packet);
break;
default:
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
break;
}
}
}
private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet)
{
if (packet.ParamList.Length != 9)
{
MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
@ -127,61 +152,28 @@ namespace OpenSim.Region.Environment
sendRegionInfoPacketToAll();
}
break;
case "texturebase":
foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
{
string s = Helpers.FieldToUTF8String(block.Parameter);
string[] splitField = s.Split(' ');
if (splitField.Length == 2)
{
LLUUID tempUUID = new LLUUID(splitField[1]);
switch (Convert.ToInt16(splitField[0]))
{
case 0:
m_regInfo.estateSettings.terrainBase0 = tempUUID;
break;
case 1:
m_regInfo.estateSettings.terrainBase1 = tempUUID;
break;
case 2:
m_regInfo.estateSettings.terrainBase2 = tempUUID;
break;
case 3:
m_regInfo.estateSettings.terrainBase3 = tempUUID;
break;
}
}
}
break;
case "texturedetail":
foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
{
string s = Helpers.FieldToUTF8String(block.Parameter);
string[] splitField = s.Split(' ');
if (splitField.Length == 2)
private void estateSetRegionTerrainHandler(EstateOwnerMessagePacket packet)
{
LLUUID tempUUID = new LLUUID(splitField[1]);
switch (Convert.ToInt16(splitField[0]))
if (packet.ParamList.Length != 9)
{
case 0:
m_regInfo.estateSettings.terrainDetail0 = tempUUID;
break;
case 1:
m_regInfo.estateSettings.terrainDetail1 = tempUUID;
break;
case 2:
m_regInfo.estateSettings.terrainDetail2 = tempUUID;
break;
case 3:
m_regInfo.estateSettings.terrainDetail3 = tempUUID;
break;
MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
}
else
{
m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
sendRegionInfoPacketToAll();
}
}
}
break;
case "textureheights":
private void estateTextureHeightsHandler(EstateOwnerMessagePacket packet)
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
{
@ -214,29 +206,61 @@ namespace OpenSim.Region.Environment
}
}
}
break;
case "texturecommit":
sendRegionHandshakeToAll();
break;
case "setregionterrain":
if (packet.ParamList.Length != 9)
{
MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
}
else
{
m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
sendRegionInfoPacketToAll();
private void estateTextureDetailHandler(EstateOwnerMessagePacket packet)
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
{
string s = Helpers.FieldToUTF8String(block.Parameter);
string[] splitField = s.Split(' ');
if (splitField.Length == 2)
{
LLUUID tempUUID = new LLUUID(splitField[1]);
switch (Convert.ToInt16(splitField[0]))
{
case 0:
m_regInfo.estateSettings.terrainDetail0 = tempUUID;
break;
case 1:
m_regInfo.estateSettings.terrainDetail1 = tempUUID;
break;
case 2:
m_regInfo.estateSettings.terrainDetail2 = tempUUID;
break;
case 3:
m_regInfo.estateSettings.terrainDetail3 = tempUUID;
break;
}
}
}
}
private void estateTextureBaseHandler(EstateOwnerMessagePacket packet)
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
{
string s = Helpers.FieldToUTF8String(block.Parameter);
string[] splitField = s.Split(' ');
if (splitField.Length == 2)
{
LLUUID tempUUID = new LLUUID(splitField[1]);
switch (Convert.ToInt16(splitField[0]))
{
case 0:
m_regInfo.estateSettings.terrainBase0 = tempUUID;
break;
default:
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
case 1:
m_regInfo.estateSettings.terrainBase1 = tempUUID;
break;
case 2:
m_regInfo.estateSettings.terrainBase2 = tempUUID;
break;
case 3:
m_regInfo.estateSettings.terrainBase3 = tempUUID;
break;
}
}
}
}