private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName)
{
m_host.AddScriptLPS(1);
// Get a reference to the land data and make sure the owner of the script
// can modify it
ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y);
if (startLandObject == null)
{
OSSLShoutError("There is no land at that location");
return;
}
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
{
OSSLShoutError("You do not have permission to modify the parcel");
return;
}
// Create a new land data object we can modify
LandData newLand = startLandObject.LandData.Copy();
UUID uuid;
// Process the rules, not sure what the impact would be of changing owner or group
for (int idx = 0; idx < rules.Length;)
{
int code = rules.GetLSLIntegerItem(idx++);
string arg = rules.GetLSLStringItem(idx++);
switch (code)
{
case ScriptBaseClass.PARCEL_DETAILS_NAME:
newLand.Name = arg;
break;
case ScriptBaseClass.PARCEL_DETAILS_DESC:
newLand.Description = arg;
break;
case ScriptBaseClass.PARCEL_DETAILS_OWNER:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
if (UUID.TryParse(arg, out uuid))
newLand.OwnerID = uuid;
break;
case ScriptBaseClass.PARCEL_DETAILS_GROUP:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
if (UUID.TryParse(arg, out uuid))
newLand.GroupID = uuid;
break;
case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
newLand.ClaimDate = Convert.ToInt32(arg);
if (newLand.ClaimDate == 0)
newLand.ClaimDate = Util.UnixTimeSinceEpoch();
break;
}
}
World.LandChannel.UpdateLandObject(newLand.LocalID,newLand);
}