aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-17 05:07:14 +0000
committerTeravus Ovares2008-04-17 05:07:14 +0000
commit244bfcde5b86180981e99ac9e88eb394f20bcd09 (patch)
treea163db049045c03e475779ce082a3cdfe74aea20
parentmoved the Thread.Sleep(500), to the correct side of the ar.AsyncWaitHandle.... (diff)
downloadopensim-SC_OLD-244bfcde5b86180981e99ac9e88eb394f20bcd09.zip
opensim-SC_OLD-244bfcde5b86180981e99ac9e88eb394f20bcd09.tar.gz
opensim-SC_OLD-244bfcde5b86180981e99ac9e88eb394f20bcd09.tar.bz2
opensim-SC_OLD-244bfcde5b86180981e99ac9e88eb394f20bcd09.tar.xz
* 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.
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs87
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs51
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs6
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs46
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs4
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs1
9 files changed, 205 insertions, 23 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 75e6fcd..236bfe7 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -556,6 +556,9 @@ namespace OpenSim.Framework
556 event ParcelBuy OnParcelBuy; 556 event ParcelBuy OnParcelBuy;
557 557
558 event ObjectIncludeInSearch OnObjectIncludeInSearch; 558 event ObjectIncludeInSearch OnObjectIncludeInSearch;
559
560 event UUIDNameRequest OnTeleportHomeRequest;
561
559 562
560 LLVector3 StartPos { get; set; } 563 LLVector3 StartPos { get; set; }
561 564
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index cf3f8d8..2a53d7b 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -363,6 +363,93 @@ namespace OpenSim.Grid.UserServer
363 if (requestData.Contains("ProfileURL")) 363 if (requestData.Contains("ProfileURL"))
364 { 364 {
365 } 365 }
366 if (requestData.Contains("home_region"))
367 {
368 try
369 {
370 userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]);
371 }
372 catch (ArgumentException)
373 {
374 m_log.Error("[PROFILE]:Failed to set home region, Invalid Argument");
375 }
376 catch (FormatException)
377 {
378 m_log.Error("[PROFILE]:Failed to set home region, Invalid Format");
379 }
380 catch (OverflowException)
381 {
382 m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
383 }
384
385 }
386 if (requestData.Contains("home_pos_x"))
387 {
388 try
389 {
390 userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]);
391 }
392 catch (System.InvalidCastException)
393 {
394 m_log.Error("[PROFILE]:Failed to set home postion x");
395 }
396
397 }
398 if (requestData.Contains("home_pos_y"))
399 {
400 try
401 {
402 userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]);
403 }
404 catch (System.InvalidCastException)
405 {
406 m_log.Error("[PROFILE]:Failed to set home postion y");
407 }
408 }
409 if (requestData.Contains("home_pos_z"))
410 {
411 try
412 {
413 userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]);
414 }
415 catch (System.InvalidCastException)
416 {
417 m_log.Error("[PROFILE]:Failed to set home postion z");
418 }
419 }
420 if (requestData.Contains("home_look_x"))
421 {
422 try
423 {
424 userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]);
425 }
426 catch (System.InvalidCastException)
427 {
428 m_log.Error("[PROFILE]:Failed to set home lookat x");
429 }
430 }
431 if (requestData.Contains("home_look_y"))
432 {
433 try
434 {
435 userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]);
436 }
437 catch (System.InvalidCastException)
438 {
439 m_log.Error("[PROFILE]:Failed to set home lookat y");
440 }
441 }
442 if (requestData.Contains("home_look_z"))
443 {
444 try
445 {
446 userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]);
447 }
448 catch (System.InvalidCastException)
449 {
450 m_log.Error("[PROFILE]:Failed to set home lookat z");
451 }
452 }
366 // call plugin! 453 // call plugin!
367 bool ret = UpdateUserProfileProperties(userProfile); 454 bool ret = UpdateUserProfileProperties(userProfile);
368 responseData["returnString"] = ret.ToString(); 455 responseData["returnString"] = ret.ToString();
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 9c56c52..7a3cff1 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -227,6 +227,7 @@ namespace OpenSim.Region.ClientStack
227 private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation; 227 private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation;
228 private PacketStats handlerPacketStats = null; // OnPacketStats;# 228 private PacketStats handlerPacketStats = null; // OnPacketStats;#
229 private RequestAsset handlerRequestAsset = null; // OnRequestAsset; 229 private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
230 private UUIDNameRequest handlerTeleportHomeRequest = null;
230 231
231 232
232 /* Properties */ 233 /* Properties */
@@ -776,6 +777,7 @@ namespace OpenSim.Region.ClientStack
776 public event MoneyBalanceRequest OnMoneyBalanceRequest; 777 public event MoneyBalanceRequest OnMoneyBalanceRequest;
777 public event ParcelBuy OnParcelBuy; 778 public event ParcelBuy OnParcelBuy;
778 779
780 public event UUIDNameRequest OnTeleportHomeRequest;
779 781
780 #region Scene/Avatar to Client 782 #region Scene/Avatar to Client
781 783
@@ -4188,19 +4190,48 @@ namespace OpenSim.Region.ClientStack
4188 case PacketType.TeleportLandmarkRequest: 4190 case PacketType.TeleportLandmarkRequest:
4189 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 4191 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
4190 LLUUID lmid = tpReq.Info.LandmarkID; 4192 LLUUID lmid = tpReq.Info.LandmarkID;
4191 AssetBase lma = m_assetCache.GetAsset(lmid, false); 4193 AssetLandmark lm;
4192 4194 if (lmid != LLUUID.Zero)
4193 if(lma == null)
4194 { 4195 {
4195 // Failed to find landmark 4196 AssetBase lma = m_assetCache.GetAsset(lmid, false);
4196 4197
4197 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 4198 if (lma == null)
4198 tpCancel.Info.SessionID = tpReq.Info.SessionID; 4199 {
4199 tpCancel.Info.AgentID = tpReq.Info.AgentID; 4200 // Failed to find landmark
4200 OutPacket(tpCancel, ThrottleOutPacketType.Task); 4201
4202 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
4203 tpCancel.Info.SessionID = tpReq.Info.SessionID;
4204 tpCancel.Info.AgentID = tpReq.Info.AgentID;
4205 OutPacket(tpCancel, ThrottleOutPacketType.Task);
4206 }
4207
4208
4209 try
4210 {
4211 lm = new AssetLandmark(lma);
4212 }
4213 catch (NullReferenceException)
4214 {
4215 // asset not found generates null ref inside the assetlandmark constructor.
4216 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
4217 tpCancel.Info.SessionID = tpReq.Info.SessionID;
4218 tpCancel.Info.AgentID = tpReq.Info.AgentID;
4219 OutPacket(tpCancel, ThrottleOutPacketType.Task);
4220 break;
4221 }
4222 }
4223 else
4224 {
4225
4226 // Teleport home request
4227 handlerTeleportHomeRequest = OnTeleportHomeRequest;
4228 if (handlerTeleportHomeRequest != null)
4229 {
4230 handlerTeleportHomeRequest(this.AgentId,this);
4231 }
4232 break;
4201 } 4233 }
4202 4234
4203 AssetLandmark lm = new AssetLandmark(lma);
4204 handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; 4235 handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
4205 if (handlerTeleportLandmarkRequest != null) 4236 if (handlerTeleportLandmarkRequest != null)
4206 { 4237 {
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 9a7274c..1135ddd 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -579,9 +579,9 @@ namespace OpenSim.Region.Communications.OGS1
579 { 579 {
580 m_log.Debug("[CONNECTION DEBUGGING]: Main agent detected"); 580 m_log.Debug("[CONNECTION DEBUGGING]: Main agent detected");
581 agentData.startpos = 581 agentData.startpos =
582 new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), 582 new LLVector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
583 Convert.ToUInt32(requestData["startpos_y"]), 583 (float)Convert.ToDecimal((string)requestData["startpos_y"]),
584 Convert.ToUInt32(requestData["startpos_z"])); 584 (float)Convert.ToDecimal((string)requestData["startpos_z"]));
585 agentData.child = false; 585 agentData.child = false;
586 } 586 }
587 587
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 5873eb8..c140213 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -314,6 +314,16 @@ namespace OpenSim.Region.Communications.OGS1
314 param["AboutText"] = UserProfile.AboutText; 314 param["AboutText"] = UserProfile.AboutText;
315 param["FLAboutText"] = UserProfile.FirstLifeAboutText; 315 param["FLAboutText"] = UserProfile.FirstLifeAboutText;
316 //param["ProfileURL"] = UserProfile.ProfileURL.ToString(); 316 //param["ProfileURL"] = UserProfile.ProfileURL.ToString();
317
318 param["home_region"] = UserProfile.HomeRegion.ToString();
319
320 param["home_pos_x"] = UserProfile.HomeLocationX.ToString();
321 param["home_pos_y"] = UserProfile.HomeLocationY.ToString();
322 param["home_pos_z"] = UserProfile.HomeLocationZ.ToString();
323 param["home_look_x"] = UserProfile.HomeLookAtX.ToString();
324 param["home_look_y"] = UserProfile.HomeLookAtY.ToString();
325 param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
326
317 IList parameters = new ArrayList(); 327 IList parameters = new ArrayList();
318 parameters.Add(param); 328 parameters.Add(param);
319 329
diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
index aef0f81..9727a8b 100644
--- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
+++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
@@ -423,7 +423,7 @@ namespace OpenSim.Region.Environment.Modules
423 { 423 {
424 if (e.parcelPrice >= 0) 424 if (e.parcelPrice >= 0)
425 { 425 {
426 doMoneyTranfer(agentId, e.parcelOwnerID, e.parcelPrice); 426 doMoneyTransfer(agentId, e.parcelOwnerID, e.parcelPrice);
427 lock (e) 427 lock (e)
428 { 428 {
429 e.transactionID = Util.UnixTimeSinceEpoch(); 429 e.transactionID = Util.UnixTimeSinceEpoch();
@@ -446,13 +446,15 @@ namespace OpenSim.Region.Environment.Modules
446 IClientAPI sender = null; 446 IClientAPI sender = null;
447 IClientAPI receiver = null; 447 IClientAPI receiver = null;
448 448
449 m_log.WarnFormat("[MONEY] Explicit transfer of {0} from {1} to {2}", e.amount, e.sender.ToString(), e.receiver.ToString());
450
449 sender = LocateClientObject(e.sender); 451 sender = LocateClientObject(e.sender);
450 if (sender != null) 452 if (sender != null)
451 { 453 {
452 receiver = LocateClientObject(e.reciever); 454 receiver = LocateClientObject(e.receiver);
453 bool transactionresult = doMoneyTranfer(e.sender, e.reciever, e.amount); 455 bool transactionresult = doMoneyTransfer(e.sender, e.receiver, e.amount);
454 456
455 if (e.sender != e.reciever) 457 if (e.sender != e.receiver)
456 { 458 {
457 if (sender != null) 459 if (sender != null)
458 { 460 {
@@ -462,14 +464,14 @@ namespace OpenSim.Region.Environment.Modules
462 464
463 if (receiver != null) 465 if (receiver != null)
464 { 466 {
465 receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.reciever)); 467 receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.receiver));
466 } 468 }
467 469
468 470
469 } 471 }
470 else 472 else
471 { 473 {
472 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()); 474 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());
473 } 475 }
474 } 476 }
475 477
@@ -490,7 +492,7 @@ namespace OpenSim.Region.Environment.Modules
490 // Use this to exclude Region Owners (2), Estate Managers(1), Users (0), Disabled(-1) 492 // Use this to exclude Region Owners (2), Estate Managers(1), Users (0), Disabled(-1)
491 if (PriceUpload > 0 && userlevel <= UserLevelPaysFees) 493 if (PriceUpload > 0 && userlevel <= UserLevelPaysFees)
492 { 494 {
493 doMoneyTranfer(Uploader, EconomyBaseAccount, PriceUpload); 495 doMoneyTransfer(Uploader, EconomyBaseAccount, PriceUpload);
494 } 496 }
495 } 497 }
496 498
@@ -634,8 +636,10 @@ namespace OpenSim.Region.Environment.Modules
634 /// <param name="Receiver"></param> 636 /// <param name="Receiver"></param>
635 /// <param name="amount"></param> 637 /// <param name="amount"></param>
636 /// <returns></returns> 638 /// <returns></returns>
637 private bool doMoneyTranfer(LLUUID Sender, LLUUID Receiver, int amount) 639 private bool doMoneyTransfer(LLUUID Sender, LLUUID Receiver, int amount)
638 { 640 {
641 m_log.WarnFormat("[MONEY] Transfer {0} from {1} to {2}", amount, Sender.ToString(), Receiver.ToString());
642
639 bool result = false; 643 bool result = false;
640 if (amount >= 0) 644 if (amount >= 0)
641 { 645 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 08cf3d8..20572a9 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1581,9 +1581,55 @@ namespace OpenSim.Region.Environment.Scenes
1581 1581
1582 client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable; 1582 client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable;
1583 1583
1584 client.OnTeleportHomeRequest += TeleportClientHome;
1585
1586 client.OnSetStartLocationRequest += SetHomeRezPoint;
1587
1584 EventManager.TriggerOnNewClient(client); 1588 EventManager.TriggerOnNewClient(client);
1585 } 1589 }
1590 public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client)
1591 {
1592 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId);
1593 if (UserProfile != null)
1594 {
1595 ulong homeRegion = UserProfile.HomeRegion;
1596 LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ);
1597 LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt);
1598 RequestTeleportLocation(client, homeRegion, homePostion,homeLookat,(uint)0);
1599
1600 }
1601
1586 1602
1603 }
1604
1605 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags)
1606 {
1607 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId);
1608 if (UserProfile != null)
1609 {
1610 // I know I'm ignoring the regionHandle provided by the teleport location request.
1611 // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
1612 UserProfile.HomeRegion = RegionInfo.RegionHandle;
1613
1614 // We cast these to an int so as not to cause a breaking change with old regions
1615 // Newer regions treat this as a float on the ExpectUser method.. so we need to wait a few
1616 // releases before setting these to floats. (r4257)
1617 UserProfile.HomeLocationX = (int)position.X;
1618 UserProfile.HomeLocationY = (int)position.Y;
1619 UserProfile.HomeLocationZ = (int)position.Z;
1620 UserProfile.HomeLookAtX = (int)lookAt.X;
1621 UserProfile.HomeLookAtY = (int)lookAt.Y;
1622 UserProfile.HomeLookAtZ = (int)lookAt.Z;
1623 CommsManager.UserService.UpdateUserProfileProperties(UserProfile);
1624
1625 remoteClient.SendAgentAlertMessage("Set home to here if supported by login service",false);
1626 }
1627 else
1628 {
1629 remoteClient.SendAgentAlertMessage("Set Home request Failed",false);
1630 }
1631
1632 }
1587 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) 1633 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
1588 { 1634 {
1589 ScenePresence avatar = null; 1635 ScenePresence avatar = null;
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 67edf6b..89c519e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes
158 public class MoneyTransferArgs : System.EventArgs 158 public class MoneyTransferArgs : System.EventArgs
159 { 159 {
160 public LLUUID sender; 160 public LLUUID sender;
161 public LLUUID reciever; 161 public LLUUID receiver;
162 162
163 // Always false. The SL protocol sucks. 163 // Always false. The SL protocol sucks.
164 public bool authenticated = false; 164 public bool authenticated = false;
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Environment.Scenes
169 169
170 public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) { 170 public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) {
171 sender = asender; 171 sender = asender;
172 reciever = areciever; 172 receiver = areciever;
173 amount = aamount; 173 amount = aamount;
174 transactiontype = atransactiontype; 174 transactiontype = atransactiontype;
175 description = adescription; 175 description = adescription;
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 426ab7e..a9f7fb9 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -163,6 +163,7 @@ namespace OpenSim.Region.Examples.SimpleModule
163 public event UpdateAvatarProperties OnUpdateAvatarProperties; 163 public event UpdateAvatarProperties OnUpdateAvatarProperties;
164 164
165 public event ObjectIncludeInSearch OnObjectIncludeInSearch; 165 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
166 public event UUIDNameRequest OnTeleportHomeRequest;
166 167
167 168
168#pragma warning restore 67 169#pragma warning restore 67