* Did a bit of estate work. Added some fields to EstateSettings.xml for estate managers.

* You can put UUIDs in those fields to give other users some ability to help manage a sim you own.
* Also started decoding the EstateOwnerMessage packet convolutions.
afrisby
Teravus Ovares 2008-01-02 10:06:43 +00:00
parent 4b4ee98070
commit 3a83be1721
4 changed files with 349 additions and 5 deletions

View File

@ -487,6 +487,204 @@ namespace OpenSim.Framework
} }
} }
private LLUUID m_estateManager0;
private LLUUID m_estateManager1;
private LLUUID m_estateManager2;
private LLUUID m_estateManager3;
private LLUUID m_estateManager4;
private LLUUID m_estateManager5;
private LLUUID m_estateManager6;
private LLUUID m_estateManager7;
private LLUUID m_estateManager8;
private LLUUID m_estateManager9;
public LLUUID[] estateManagers
{
get {
// returns a condensed array of LLUUIDs
return GetEstateManagers();
}
set
{
// Sets a Condensed array of LLUUIDS
int i = 0;
for (i = 0; i < value.Length; i++)
{
switch (i)
{
case 0:
m_estateManager0 = value[i];
break;
case 1:
m_estateManager1 = value[i];
break;
case 2:
m_estateManager2 = value[i];
break;
case 3:
m_estateManager3 = value[i];
break;
case 4:
m_estateManager4 = value[i];
break;
case 5:
m_estateManager5 = value[i];
break;
case 6:
m_estateManager6 = value[i];
break;
case 7:
m_estateManager7 = value[i];
break;
case 8:
m_estateManager8 = value[i];
break;
case 9:
m_estateManager9 = value[i];
break;
}
}
// Clear the rest of them.. as they're no longer valid
for (int j = i; j < 10; j++)
{
switch (i)
{
case 0:
m_estateManager0 = LLUUID.Zero;
break;
case 1:
m_estateManager1 = LLUUID.Zero;
break;
case 2:
m_estateManager2 = LLUUID.Zero;
break;
case 3:
m_estateManager3 = LLUUID.Zero;
break;
case 4:
m_estateManager4 = LLUUID.Zero;
break;
case 5:
m_estateManager5 = LLUUID.Zero;
break;
case 6:
m_estateManager6 = LLUUID.Zero;
break;
case 7:
m_estateManager7 = LLUUID.Zero;
break;
case 8:
m_estateManager8 = LLUUID.Zero;
break;
case 9:
m_estateManager9 = LLUUID.Zero;
break;
}
}
for (i = 0; i < 10; i++)
{
// Writes out the Estate managers to the XML file.
configMember.forceSetConfigurationOption("estate_manager_" + i, (GetEstateManagerAtPos(i)).ToString());
}
}
}
#region EstateManager Get Methods to sort out skipped spots in the XML (suser error)
private LLUUID GetEstateManagerAtPos(int pos)
{
// This is a helper for writing them out to the xml file
switch (pos)
{
case 0:
return m_estateManager0;
case 1:
return m_estateManager1;
case 2:
return m_estateManager2;
case 3:
return m_estateManager3;
case 4:
return m_estateManager4;
case 5:
return m_estateManager5;
case 6:
return m_estateManager6;
case 7:
return m_estateManager7;
case 8:
return m_estateManager8;
case 9:
return m_estateManager9;
default:
return LLUUID.Zero;
}
}
private LLUUID[] GetEstateManagers()
{
int numEstateManagers = GetNumberOfEstateManagers();
LLUUID[] rEstateManagers = new LLUUID[numEstateManagers];
int pos = 0;
for (int i = 0; i < numEstateManagers; i++)
{
pos = GetNextEstateManager(pos);
rEstateManagers[i] = GetEstateManagerAtPos(pos);
}
return rEstateManagers;
}
private int GetNextEstateManager(int startpos)
{
// This is a utility function that skips over estate managers set to LLUUID.Zero
int i = startpos;
for (i=startpos;i<10;i++)
{
if (GetEstateManagerAtPos(i) != LLUUID.Zero) return i;
}
return i;
}
private int GetNumberOfEstateManagers()
{
// This function returns the number of estate managers set
// Regardless of whether there is a skipped spot
int numEstateManagers = 0;
if (m_estateManager0 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager1 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager2 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager3 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager4 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager5 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager6 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager7 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager8 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager9 != LLUUID.Zero) numEstateManagers++;
return numEstateManagers;
}
#endregion
private ConfigurationMember configMember; private ConfigurationMember configMember;
public EstateSettings() public EstateSettings()
@ -582,6 +780,28 @@ namespace OpenSim.Framework
"20.0", true); "20.0", true);
configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true); "", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_4", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_5", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_6", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_7", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_8", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_9", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -703,6 +923,38 @@ namespace OpenSim.Framework
case "terrain_image_id": case "terrain_image_id":
m_terrainImageID = (LLUUID) configuration_result; m_terrainImageID = (LLUUID) configuration_result;
break; break;
case "estate_manager_0":
m_estateManager0 = (LLUUID)configuration_result;
break;
case "estate_manager_1":
m_estateManager1 = (LLUUID)configuration_result;
break;
case "estate_manager_2":
m_estateManager2 = (LLUUID)configuration_result;
break;
case "estate_manager_3":
m_estateManager3 = (LLUUID)configuration_result;
break;
case "estate_manager_4":
m_estateManager4 = (LLUUID)configuration_result;
break;
case "estate_manager_5":
m_estateManager5 = (LLUUID)configuration_result;
break;
case "estate_manager_6":
m_estateManager6 = (LLUUID)configuration_result;
break;
case "estate_manager_7":
m_estateManager7 = (LLUUID)configuration_result;
break;
case "estate_manager_8":
m_estateManager8 = (LLUUID)configuration_result;
break;
case "estate_manager_9":
m_estateManager9 = (LLUUID)configuration_result;
break;
} }
return true; return true;

View File

@ -44,6 +44,15 @@ namespace OpenSim.Region.Environment
private Scene m_scene; private Scene m_scene;
private RegionInfo m_regInfo; private RegionInfo m_regInfo;
public enum EstateAccessCodex : uint
{
AccessOptions = 17,
AllowedGroups = 18,
EstateBans = 20,
EstateManagers = 24
}
public EstateManager(Scene scene, RegionInfo reginfo) public EstateManager(Scene scene, RegionInfo reginfo)
{ {
m_scene = scene; m_scene = scene;
@ -146,7 +155,13 @@ namespace OpenSim.Region.Environment
switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
{ {
case "getinfo": case "getinfo":
sendRegionInfoPacketToAll(); sendRegionInfoPacketToAll();
if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
{
sendDetailedEstateData(remote_client, packet);
}
break; break;
case "setregioninfo": case "setregioninfo":
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
@ -187,6 +202,69 @@ namespace OpenSim.Region.Environment
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
break; break;
} }
}
private void sendDetailedEstateData(IClientAPI remote_client, EstateOwnerMessagePacket packet)
{
LLUUID invoice = packet.MethodData.Invoice;
packet.AgentData.TransactionID = LLUUID.Random();
packet.MethodData.Method = Helpers.StringToField("estateupdateinfo");
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[9];
for (int i = 0; i < 9; i++)
{
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
}
//Sending Estate Settings
returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarFirstName + m_scene.RegionInfo.MasterAvatarLastName);
returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString());
returnblock[2].Parameter = Helpers.IntToBytes((int)m_scene.RegionInfo.EstateSettings.estateID);
returnblock[3].Parameter = Helpers.IntToBytes(269516800);
returnblock[4].Parameter = Helpers.IntToBytes(0);
returnblock[5].Parameter = Helpers.IntToBytes(1);
returnblock[6].Parameter = Helpers.StringToField(LLUUID.Random().ToString());
returnblock[7].Parameter = Helpers.IntToBytes(1160895077);
returnblock[8].Parameter = Helpers.IntToBytes(1);
packet.ParamList = returnblock;
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
// Stuck here at the moment The client sends a bunch of getinfo methods that need to be decoded the hard way
//Sending Estate Managers
packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = LLUUID.Random();
packet.AgentData.AgentID=remote_client.AgentId;
packet.AgentData.SessionID=remote_client.SessionId;
packet.MethodData.Invoice = invoice;
packet.MethodData.Method = Helpers.StringToField("setaccess");
LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers;
returnblock = new EstateOwnerMessagePacket.ParamListBlock[6+EstateManagers.Length];
for (int i = 0; i < (6 + EstateManagers.Length); i++)
{
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
}
int j=0;
returnblock[j].Parameter = Helpers.IntToBytes((int)m_scene.RegionInfo.EstateSettings.estateID); j++;
returnblock[j].Parameter = Helpers.IntToBytes((int)EstateAccessCodex.EstateManagers); j++;
returnblock[j].Parameter = Helpers.IntToBytes(0); j++;
returnblock[j].Parameter = Helpers.IntToBytes(0); j++;
returnblock[j].Parameter = Helpers.IntToBytes(0); j++;
returnblock[j].Parameter = Helpers.IntToBytes(EstateManagers.Length); j++;
for (int i = 0; i < EstateManagers.Length; i++)
{
returnblock[j].Parameter = Helpers.StringToField(EstateManagers[i].ToString()); j++;
}
packet.ParamList = returnblock;
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
} }
private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet) private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet)

View File

@ -83,13 +83,20 @@ namespace OpenSim.Region.Environment
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
} }
protected virtual bool IsEstateManager(LLUUID user) public virtual bool IsEstateManager(LLUUID user)
{ {
if (m_bypassPermissions) if (m_bypassPermissions)
{ {
return true; return true;
} }
LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
for (int i = 0; i < estatemanagers.Length; i++)
{
if (estatemanagers[i] == user)
return true;
}
return false; return false;
} }
@ -414,7 +421,7 @@ namespace OpenSim.Region.Environment
#region Estate Permissions #region Estate Permissions
protected virtual bool GenericEstatePermission(LLUUID user) public virtual bool GenericEstatePermission(LLUUID user)
{ {
// Default: deny // Default: deny
bool permission = false; bool permission = false;
@ -439,8 +446,8 @@ namespace OpenSim.Region.Environment
{ {
// Since this is potentially going on a grid... // Since this is potentially going on a grid...
//return GenericEstatePermission(AgentId); return GenericEstatePermission(user);
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; //return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
} }
#endregion #endregion

View File

@ -320,7 +320,14 @@ namespace OpenSim.Region.Environment.Scenes
// TODO: m_animations and m_animationSeqs should always be of the same length. // TODO: m_animations and m_animationSeqs should always be of the same length.
// Move them into an object to (hopefully) avoid threading issues. // Move them into an object to (hopefully) avoid threading issues.
m_animations.Add(Animations.AnimsLLUUID["STAND"]); try
{
m_animations.Add(Animations.AnimsLLUUID["STAND"]);
}
catch (KeyNotFoundException)
{
MainLog.Instance.Warn("AVATAR", "KeyNotFound Exception playing avatar stand animation");
}
m_animationSeqs.Add(1); m_animationSeqs.Add(1);
RegisterToEvents(); RegisterToEvents();