Remove "Dwell" support from core and replace it with calls to methods

on IDwellModule
avinationmerge
Melanie Thielker 2010-09-05 14:16:42 +02:00
parent 5cbc4e2a5f
commit e593607171
10 changed files with 74 additions and 108 deletions

View File

@ -638,9 +638,9 @@ ELSE
//Insert new values //Insert new values
string sql = @"INSERT INTO [land] string sql = @"INSERT INTO [land]
([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) ([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime])
VALUES VALUES
(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; (@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)";
using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
@ -954,7 +954,6 @@ VALUES
newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
try try
{ {
@ -1357,7 +1356,6 @@ VALUES
parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
return parameters.ToArray(); return parameters.ToArray();
} }

View File

@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL
"MusicURL, PassHours, PassPrice, SnapshotUUID, " + "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
"UserLocationX, UserLocationY, UserLocationZ, " + "UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"?UUID, ?RegionUUID, " + "?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL
"?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL
UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
newData.AuthBuyerID = authedbuyer; newData.AuthBuyerID = authedbuyer;
newData.SnapshotID = snapshotID; newData.SnapshotID = snapshotID;
@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
cmd.Parameters.AddWithValue("Dwell", land.Dwell);
cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
cmd.Parameters.AddWithValue("MediaType", land.MediaType); cmd.Parameters.AddWithValue("MediaType", land.MediaType);
cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);

View File

@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite
createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "AuthbuyerID", typeof(String));
createCol(land, "OtherCleanTime", typeof(Int32)); createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
return newData; return newData;
} }
@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite
row["UserLookAtZ"] = land.UserLookAt.Z; row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime; row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
row["MediaType"] = land.MediaType; row["MediaType"] = land.MediaType;
row["MediaDescription"] = land.MediaDescription; row["MediaDescription"] = land.MediaDescription;
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();

View File

@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy
createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "AuthbuyerID", typeof(String));
createCol(land, "OtherCleanTime", typeof(Int32)); createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
return newData; return newData;
} }
@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy
row["UserLookAtZ"] = land.UserLookAt.Z; row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime; row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
} }
/// <summary> /// <summary>

View File

@ -88,7 +88,6 @@ namespace OpenSim.Framework
private UUID _snapshotID = UUID.Zero; private UUID _snapshotID = UUID.Zero;
private Vector3 _userLocation = new Vector3(); private Vector3 _userLocation = new Vector3();
private Vector3 _userLookAt = new Vector3(); private Vector3 _userLookAt = new Vector3();
private int _dwell = 0;
private int _otherCleanTime = 0; private int _otherCleanTime = 0;
private string _mediaType = "none/none"; private string _mediaType = "none/none";
private string _mediaDescription = ""; private string _mediaDescription = "";
@ -619,18 +618,6 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// Deprecated idea. Number of visitors ~= free money
/// </summary>
public int Dwell {
get {
return _dwell;
}
set {
_dwell = value;
}
}
/// <summary> /// <summary>
/// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
/// the parcel and isn't set to the same 'group' as the parcel. /// the parcel and isn't set to the same 'group' as the parcel.
@ -703,7 +690,6 @@ namespace OpenSim.Framework
landData._userLocation = _userLocation; landData._userLocation = _userLocation;
landData._userLookAt = _userLookAt; landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime; landData._otherCleanTime = _otherCleanTime;
landData._dwell = _dwell;
landData._mediaType = _mediaType; landData._mediaType = _mediaType;
landData._mediaDescription = _mediaDescription; landData._mediaDescription = _mediaDescription;
landData._mediaWidth = _mediaWidth; landData._mediaWidth = _mediaWidth;

View File

@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External
landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); // No longer used here
xtr.ReadElementString("Dwell");
landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
xtr.ReadEndElement(); xtr.ReadEndElement();
@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); xtw.WriteElementString("Dwell", "0");
xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
xtw.WriteEndElement(); xtw.WriteEndElement();

View File

@ -57,12 +57,14 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
WebRequest request = WebRequest.Create(requestUrl); WebRequest request = WebRequest.Create(requestUrl);
request.Method = verb; request.Method = verb;
string respstring = String.Empty;
using (MemoryStream buffer = new MemoryStream())
{
if ((verb == "POST") || (verb == "PUT")) if ((verb == "POST") || (verb == "PUT"))
{ {
request.ContentType = "text/www-form-urlencoded"; request.ContentType = "text/www-form-urlencoded";
MemoryStream buffer = new MemoryStream();
int length = 0; int length = 0;
using (StreamWriter writer = new StreamWriter(buffer)) using (StreamWriter writer = new StreamWriter(buffer))
{ {
@ -85,21 +87,11 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
finally finally
{ {
// If this is closed, it will be disposed internally, if (requestStream != null)
// but the above write is asynchronous and may hit after requestStream.Close();
// we're through here. So the thread handling that will
// throw and put us back into the catch above. Isn't
// .NET great?
//if (requestStream != null)
// requestStream.Close();
// Let's not close this
//buffer.Close();
} }
} }
string respstring = String.Empty;
try try
{ {
using (WebResponse resp = request.GetResponse()) using (WebResponse resp = request.GetResponse())
@ -132,6 +124,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// This is what happens when there is invalid XML // This is what happens when there is invalid XML
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
} }
}
return respstring; return respstring;
} }
} }

View File

@ -2687,6 +2687,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
{ {
float dwell = 0.0f;
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
if (dwellModule != null)
dwell = dwellModule.GetDwell(land.GlobalID);
ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
reply.AgentData.AgentID = m_agentId; reply.AgentData.AgentID = m_agentId;
reply.Data.ParcelID = parcelID; reply.Data.ParcelID = parcelID;
@ -2711,7 +2715,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
reply.Data.GlobalZ = pos.Z; reply.Data.GlobalZ = pos.Z;
reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SimName = Utils.StringToBytes(info.RegionName);
reply.Data.SnapshotID = land.SnapshotID; reply.Data.SnapshotID = land.SnapshotID;
reply.Data.Dwell = land.Dwell; reply.Data.Dwell = dwell;
reply.Data.SalePrice = land.SalePrice; reply.Data.SalePrice = land.SalePrice;
reply.Data.AuctionID = (int)land.AuctionID; reply.Data.AuctionID = (int)land.AuctionID;

View File

@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Land
client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelReclaim += ClientOnParcelReclaim;
client.OnParcelInfoRequest += ClientOnParcelInfoRequest; client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
// client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
client.OnPreAgentUpdate += ClientOnPreAgentUpdate; client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
@ -1512,18 +1511,6 @@ namespace OpenSim.Region.CoreModules.World.Land
#endregion #endregion
private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient)
{
ILandObject selectedParcel = null;
lock (m_landList)
{
if (!m_landList.TryGetValue(localID, out selectedParcel))
return;
}
remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell);
}
private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
{ {
if (parcelID == UUID.Zero) if (parcelID == UUID.Zero)

View File

@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
ILandChannel landChannel = m_scene.LandChannel; ILandChannel landChannel = m_scene.LandChannel;
List<ILandObject> parcels = landChannel.AllParcels(); List<ILandObject> parcels = landChannel.AllParcels();
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
if (parcels != null) if (parcels != null)
{ {
@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
xmlparcel.AppendChild(infouuid); xmlparcel.AppendChild(infouuid);
XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
dwell.InnerText = parcel.Dwell.ToString(); if (dwellModule != null)
dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString();
else
dwell.InnerText = "0";
xmlparcel.AppendChild(dwell); xmlparcel.AppendChild(dwell);
//TODO: figure how to figure out teleport system landData.landingType //TODO: figure how to figure out teleport system landData.landingType