* Implements 'Set Home to Here'
* Implements 'Teleport Home' * User Server has to be updated for it to save your home in grid mode * home position accuracy is in int because the grid comms ExpectUser method tries to convert to Uint and crashes if it gets a float. Added a convert to decimal in ExpectUser but to avoid a breaking change with old revisions, kept the save value in int for now. Eventually it needs to be a float, but lets release another incremental version before doing that.0.6.0-stable
parent
770c395e86
commit
244bfcde5b
|
@ -557,6 +557,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
event ObjectIncludeInSearch OnObjectIncludeInSearch;
|
event ObjectIncludeInSearch OnObjectIncludeInSearch;
|
||||||
|
|
||||||
|
event UUIDNameRequest OnTeleportHomeRequest;
|
||||||
|
|
||||||
|
|
||||||
LLVector3 StartPos { get; set; }
|
LLVector3 StartPos { get; set; }
|
||||||
|
|
||||||
LLUUID AgentId { get; }
|
LLUUID AgentId { get; }
|
||||||
|
|
|
@ -363,6 +363,93 @@ namespace OpenSim.Grid.UserServer
|
||||||
if (requestData.Contains("ProfileURL"))
|
if (requestData.Contains("ProfileURL"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
if (requestData.Contains("home_region"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]);
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home region, Invalid Argument");
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home region, Invalid Format");
|
||||||
|
}
|
||||||
|
catch (OverflowException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (requestData.Contains("home_pos_x"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]);
|
||||||
|
}
|
||||||
|
catch (System.InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home postion x");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (requestData.Contains("home_pos_y"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]);
|
||||||
|
}
|
||||||
|
catch (System.InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home postion y");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestData.Contains("home_pos_z"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]);
|
||||||
|
}
|
||||||
|
catch (System.InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home postion z");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestData.Contains("home_look_x"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]);
|
||||||
|
}
|
||||||
|
catch (System.InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home lookat x");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestData.Contains("home_look_y"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]);
|
||||||
|
}
|
||||||
|
catch (System.InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home lookat y");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestData.Contains("home_look_z"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]);
|
||||||
|
}
|
||||||
|
catch (System.InvalidCastException)
|
||||||
|
{
|
||||||
|
m_log.Error("[PROFILE]:Failed to set home lookat z");
|
||||||
|
}
|
||||||
|
}
|
||||||
// call plugin!
|
// call plugin!
|
||||||
bool ret = UpdateUserProfileProperties(userProfile);
|
bool ret = UpdateUserProfileProperties(userProfile);
|
||||||
responseData["returnString"] = ret.ToString();
|
responseData["returnString"] = ret.ToString();
|
||||||
|
|
|
@ -227,6 +227,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation;
|
private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation;
|
||||||
private PacketStats handlerPacketStats = null; // OnPacketStats;#
|
private PacketStats handlerPacketStats = null; // OnPacketStats;#
|
||||||
private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
|
private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
|
||||||
|
private UUIDNameRequest handlerTeleportHomeRequest = null;
|
||||||
|
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
@ -776,6 +777,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
public event ParcelBuy OnParcelBuy;
|
public event ParcelBuy OnParcelBuy;
|
||||||
|
|
||||||
|
public event UUIDNameRequest OnTeleportHomeRequest;
|
||||||
|
|
||||||
#region Scene/Avatar to Client
|
#region Scene/Avatar to Client
|
||||||
|
|
||||||
|
@ -4188,6 +4190,9 @@ namespace OpenSim.Region.ClientStack
|
||||||
case PacketType.TeleportLandmarkRequest:
|
case PacketType.TeleportLandmarkRequest:
|
||||||
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
|
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
|
||||||
LLUUID lmid = tpReq.Info.LandmarkID;
|
LLUUID lmid = tpReq.Info.LandmarkID;
|
||||||
|
AssetLandmark lm;
|
||||||
|
if (lmid != LLUUID.Zero)
|
||||||
|
{
|
||||||
AssetBase lma = m_assetCache.GetAsset(lmid, false);
|
AssetBase lma = m_assetCache.GetAsset(lmid, false);
|
||||||
|
|
||||||
if (lma == null)
|
if (lma == null)
|
||||||
|
@ -4200,7 +4205,33 @@ namespace OpenSim.Region.ClientStack
|
||||||
OutPacket(tpCancel, ThrottleOutPacketType.Task);
|
OutPacket(tpCancel, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetLandmark lm = new AssetLandmark(lma);
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lm = new AssetLandmark(lma);
|
||||||
|
}
|
||||||
|
catch (NullReferenceException)
|
||||||
|
{
|
||||||
|
// asset not found generates null ref inside the assetlandmark constructor.
|
||||||
|
TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
|
||||||
|
tpCancel.Info.SessionID = tpReq.Info.SessionID;
|
||||||
|
tpCancel.Info.AgentID = tpReq.Info.AgentID;
|
||||||
|
OutPacket(tpCancel, ThrottleOutPacketType.Task);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// Teleport home request
|
||||||
|
handlerTeleportHomeRequest = OnTeleportHomeRequest;
|
||||||
|
if (handlerTeleportHomeRequest != null)
|
||||||
|
{
|
||||||
|
handlerTeleportHomeRequest(this.AgentId,this);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
|
handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
|
||||||
if (handlerTeleportLandmarkRequest != null)
|
if (handlerTeleportLandmarkRequest != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -579,9 +579,9 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
{
|
{
|
||||||
m_log.Debug("[CONNECTION DEBUGGING]: Main agent detected");
|
m_log.Debug("[CONNECTION DEBUGGING]: Main agent detected");
|
||||||
agentData.startpos =
|
agentData.startpos =
|
||||||
new LLVector3(Convert.ToUInt32(requestData["startpos_x"]),
|
new LLVector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
|
||||||
Convert.ToUInt32(requestData["startpos_y"]),
|
(float)Convert.ToDecimal((string)requestData["startpos_y"]),
|
||||||
Convert.ToUInt32(requestData["startpos_z"]));
|
(float)Convert.ToDecimal((string)requestData["startpos_z"]));
|
||||||
agentData.child = false;
|
agentData.child = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,16 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
param["AboutText"] = UserProfile.AboutText;
|
param["AboutText"] = UserProfile.AboutText;
|
||||||
param["FLAboutText"] = UserProfile.FirstLifeAboutText;
|
param["FLAboutText"] = UserProfile.FirstLifeAboutText;
|
||||||
//param["ProfileURL"] = UserProfile.ProfileURL.ToString();
|
//param["ProfileURL"] = UserProfile.ProfileURL.ToString();
|
||||||
|
|
||||||
|
param["home_region"] = UserProfile.HomeRegion.ToString();
|
||||||
|
|
||||||
|
param["home_pos_x"] = UserProfile.HomeLocationX.ToString();
|
||||||
|
param["home_pos_y"] = UserProfile.HomeLocationY.ToString();
|
||||||
|
param["home_pos_z"] = UserProfile.HomeLocationZ.ToString();
|
||||||
|
param["home_look_x"] = UserProfile.HomeLookAtX.ToString();
|
||||||
|
param["home_look_y"] = UserProfile.HomeLookAtY.ToString();
|
||||||
|
param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
|
||||||
|
|
||||||
IList parameters = new ArrayList();
|
IList parameters = new ArrayList();
|
||||||
parameters.Add(param);
|
parameters.Add(param);
|
||||||
|
|
||||||
|
|
|
@ -423,7 +423,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
{
|
{
|
||||||
if (e.parcelPrice >= 0)
|
if (e.parcelPrice >= 0)
|
||||||
{
|
{
|
||||||
doMoneyTranfer(agentId, e.parcelOwnerID, e.parcelPrice);
|
doMoneyTransfer(agentId, e.parcelOwnerID, e.parcelPrice);
|
||||||
lock (e)
|
lock (e)
|
||||||
{
|
{
|
||||||
e.transactionID = Util.UnixTimeSinceEpoch();
|
e.transactionID = Util.UnixTimeSinceEpoch();
|
||||||
|
@ -446,13 +446,15 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
IClientAPI sender = null;
|
IClientAPI sender = null;
|
||||||
IClientAPI receiver = null;
|
IClientAPI receiver = null;
|
||||||
|
|
||||||
|
m_log.WarnFormat("[MONEY] Explicit transfer of {0} from {1} to {2}", e.amount, e.sender.ToString(), e.receiver.ToString());
|
||||||
|
|
||||||
sender = LocateClientObject(e.sender);
|
sender = LocateClientObject(e.sender);
|
||||||
if (sender != null)
|
if (sender != null)
|
||||||
{
|
{
|
||||||
receiver = LocateClientObject(e.reciever);
|
receiver = LocateClientObject(e.receiver);
|
||||||
bool transactionresult = doMoneyTranfer(e.sender, e.reciever, e.amount);
|
bool transactionresult = doMoneyTransfer(e.sender, e.receiver, e.amount);
|
||||||
|
|
||||||
if (e.sender != e.reciever)
|
if (e.sender != e.receiver)
|
||||||
{
|
{
|
||||||
if (sender != null)
|
if (sender != null)
|
||||||
{
|
{
|
||||||
|
@ -462,14 +464,14 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
|
|
||||||
if (receiver != null)
|
if (receiver != null)
|
||||||
{
|
{
|
||||||
receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.reciever));
|
receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" + e.sender.ToString() + " Reciver: " + e.reciever.ToString() + " Amount: " + e.amount.ToString());
|
m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" + e.sender.ToString() + " Reciver: " + e.receiver.ToString() + " Amount: " + e.amount.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +492,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
// Use this to exclude Region Owners (2), Estate Managers(1), Users (0), Disabled(-1)
|
// Use this to exclude Region Owners (2), Estate Managers(1), Users (0), Disabled(-1)
|
||||||
if (PriceUpload > 0 && userlevel <= UserLevelPaysFees)
|
if (PriceUpload > 0 && userlevel <= UserLevelPaysFees)
|
||||||
{
|
{
|
||||||
doMoneyTranfer(Uploader, EconomyBaseAccount, PriceUpload);
|
doMoneyTransfer(Uploader, EconomyBaseAccount, PriceUpload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,8 +636,10 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
/// <param name="Receiver"></param>
|
/// <param name="Receiver"></param>
|
||||||
/// <param name="amount"></param>
|
/// <param name="amount"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private bool doMoneyTranfer(LLUUID Sender, LLUUID Receiver, int amount)
|
private bool doMoneyTransfer(LLUUID Sender, LLUUID Receiver, int amount)
|
||||||
{
|
{
|
||||||
|
m_log.WarnFormat("[MONEY] Transfer {0} from {1} to {2}", amount, Sender.ToString(), Receiver.ToString());
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (amount >= 0)
|
if (amount >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1581,9 +1581,55 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable;
|
client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable;
|
||||||
|
|
||||||
|
client.OnTeleportHomeRequest += TeleportClientHome;
|
||||||
|
|
||||||
|
client.OnSetStartLocationRequest += SetHomeRezPoint;
|
||||||
|
|
||||||
EventManager.TriggerOnNewClient(client);
|
EventManager.TriggerOnNewClient(client);
|
||||||
}
|
}
|
||||||
|
public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client)
|
||||||
|
{
|
||||||
|
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId);
|
||||||
|
if (UserProfile != null)
|
||||||
|
{
|
||||||
|
ulong homeRegion = UserProfile.HomeRegion;
|
||||||
|
LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ);
|
||||||
|
LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt);
|
||||||
|
RequestTeleportLocation(client, homeRegion, homePostion,homeLookat,(uint)0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags)
|
||||||
|
{
|
||||||
|
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId);
|
||||||
|
if (UserProfile != null)
|
||||||
|
{
|
||||||
|
// I know I'm ignoring the regionHandle provided by the teleport location request.
|
||||||
|
// reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
|
||||||
|
UserProfile.HomeRegion = RegionInfo.RegionHandle;
|
||||||
|
|
||||||
|
// We cast these to an int so as not to cause a breaking change with old regions
|
||||||
|
// Newer regions treat this as a float on the ExpectUser method.. so we need to wait a few
|
||||||
|
// releases before setting these to floats. (r4257)
|
||||||
|
UserProfile.HomeLocationX = (int)position.X;
|
||||||
|
UserProfile.HomeLocationY = (int)position.Y;
|
||||||
|
UserProfile.HomeLocationZ = (int)position.Z;
|
||||||
|
UserProfile.HomeLookAtX = (int)lookAt.X;
|
||||||
|
UserProfile.HomeLookAtY = (int)lookAt.Y;
|
||||||
|
UserProfile.HomeLookAtZ = (int)lookAt.Z;
|
||||||
|
CommsManager.UserService.UpdateUserProfileProperties(UserProfile);
|
||||||
|
|
||||||
|
remoteClient.SendAgentAlertMessage("Set home to here if supported by login service",false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remoteClient.SendAgentAlertMessage("Set Home request Failed",false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
||||||
{
|
{
|
||||||
ScenePresence avatar = null;
|
ScenePresence avatar = null;
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public class MoneyTransferArgs : System.EventArgs
|
public class MoneyTransferArgs : System.EventArgs
|
||||||
{
|
{
|
||||||
public LLUUID sender;
|
public LLUUID sender;
|
||||||
public LLUUID reciever;
|
public LLUUID receiver;
|
||||||
|
|
||||||
// Always false. The SL protocol sucks.
|
// Always false. The SL protocol sucks.
|
||||||
public bool authenticated = false;
|
public bool authenticated = false;
|
||||||
|
@ -169,7 +169,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) {
|
public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) {
|
||||||
sender = asender;
|
sender = asender;
|
||||||
reciever = areciever;
|
receiver = areciever;
|
||||||
amount = aamount;
|
amount = aamount;
|
||||||
transactiontype = atransactiontype;
|
transactiontype = atransactiontype;
|
||||||
description = adescription;
|
description = adescription;
|
||||||
|
|
|
@ -163,6 +163,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
public event UpdateAvatarProperties OnUpdateAvatarProperties;
|
public event UpdateAvatarProperties OnUpdateAvatarProperties;
|
||||||
|
|
||||||
public event ObjectIncludeInSearch OnObjectIncludeInSearch;
|
public event ObjectIncludeInSearch OnObjectIncludeInSearch;
|
||||||
|
public event UUIDNameRequest OnTeleportHomeRequest;
|
||||||
|
|
||||||
|
|
||||||
#pragma warning restore 67
|
#pragma warning restore 67
|
||||||
|
|
Loading…
Reference in New Issue