diff options
author | Teravus Ovares | 2008-04-17 05:07:14 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-17 05:07:14 +0000 |
commit | 244bfcde5b86180981e99ac9e88eb394f20bcd09 (patch) | |
tree | a163db049045c03e475779ce082a3cdfe74aea20 /OpenSim/Region/Environment | |
parent | moved the Thread.Sleep(500), to the correct side of the ar.AsyncWaitHandle.... (diff) | |
download | opensim-SC-244bfcde5b86180981e99ac9e88eb394f20bcd09.zip opensim-SC-244bfcde5b86180981e99ac9e88eb394f20bcd09.tar.gz opensim-SC-244bfcde5b86180981e99ac9e88eb394f20bcd09.tar.bz2 opensim-SC-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.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 46 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneEvents.cs | 4 |
3 files changed, 60 insertions, 10 deletions
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; |