From 2a2ef42e64e202c81762adf0cc0e4cb1393f71ef Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 24 Apr 2008 12:27:24 +0000 Subject: [PATCH] replace hard tabs with 4 spaces to be consistant in the source. Please adjust your editors to not use hard tabs. --- OpenSim/Framework/AssetLandmark.cs | 2 +- OpenSim/Framework/BlockingQueue.cs | 6 +- OpenSim/Framework/IClientAPI.cs | 20 +- OpenSim/Framework/InventoryFolderBase.cs | 72 +-- OpenSim/Framework/InventoryItemBase.cs | 156 +++--- OpenSim/Framework/OSUUID.cs | 2 +- OpenSim/Framework/TaskInventoryItem.cs | 16 +- OpenSim/Framework/Util.cs | 8 +- OpenSim/Region/Application/OpenSimMain.cs | 6 +- OpenSim/Region/ClientStack/ClientView.cs | 90 ++-- .../DataSnapshot/DataSnapshotManager.cs | 6 +- .../Modules/BetaGridLikeMoneyModule.cs | 492 +++++++++--------- .../Modules/LandManagement/LandChannel.cs | 16 +- .../Modules/LandManagement/LandObject.cs | 18 +- .../Environment/Scenes/Scene.Inventory.cs | 10 +- .../Scenes/Scene.PacketHandlers.cs | 4 +- .../Scenes/SceneObjectPart.Inventory.cs | 56 +- .../Environment/Scenes/SceneObjectPart.cs | 16 +- .../Environment/Scenes/ScenePresence.cs | 122 ++--- .../Examples/SimpleModule/MyNpcCharacter.cs | 24 +- .../Common/LSL_BuiltIn_Commands.cs | 384 +++++++------- .../Common/ScriptEngineBase/EventManager.cs | 10 +- 22 files changed, 768 insertions(+), 768 deletions(-) diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index 974a632f51..f322636955 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs @@ -35,7 +35,7 @@ namespace OpenSim.Framework public int Version; public LLVector3 Position; public LLUUID RegionID; - public ulong RegionHandle; + public ulong RegionHandle; public AssetLandmark(AssetBase a) { diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index 31e756e756..dbb3d8411d 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs @@ -68,9 +68,9 @@ namespace OpenSim.Framework public int Count() { lock(m_queueSync) - { - return m_queue.Count; - } + { + return m_queue.Count; + } } public T[] GetQueueArray() diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 28047e7317..388dfd716f 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -440,9 +440,9 @@ namespace OpenSim.Framework public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID); - public delegate void ScriptAnswer(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, int answer); - public delegate void RequestPayPrice(IClientAPI remoteClient, LLUUID objectID); - + public delegate void ScriptAnswer(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, int answer); + public delegate void RequestPayPrice(IClientAPI remoteClient, LLUUID objectID); + public interface IClientAPI { event ImprovedInstantMessage OnInstantMessage; @@ -559,13 +559,13 @@ namespace OpenSim.Framework event MoneyBalanceRequest OnMoneyBalanceRequest; event UpdateAvatarProperties OnUpdateAvatarProperties; event ParcelBuy OnParcelBuy; - event RequestPayPrice OnRequestPayPrice ; + event RequestPayPrice OnRequestPayPrice ; event ObjectIncludeInSearch OnObjectIncludeInSearch; event UUIDNameRequest OnTeleportHomeRequest; - - event ScriptAnswer OnScriptAnswer; + + event ScriptAnswer OnScriptAnswer; LLVector3 StartPos { get; set; } @@ -578,8 +578,8 @@ namespace OpenSim.Framework string FirstName { get; } string LastName { get; } - - int NextAnimationSequenceNumber { get; } + + int NextAnimationSequenceNumber { get; } /// /// Returns the full name of the agent/avatar represented by this client @@ -624,7 +624,7 @@ namespace OpenSim.Framework void SendTeleportFailed(string reason); void SendTeleportLocationStart(); void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); - void SendPayPrice(LLUUID objectID, int[] payPrice); + void SendPayPrice(LLUUID objectID, int[] payPrice); void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID); @@ -703,7 +703,7 @@ namespace OpenSim.Framework void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); - void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question); + void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question); byte[] GetThrottlesPacked(float multiplier); diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index 8e276e9bdf..d3af3c7f29 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs @@ -67,57 +67,57 @@ namespace OpenSim.Framework private ushort _version; public string Name { - get { - return _name; - } - set { - _name = value; - } + get { + return _name; + } + set { + _name = value; + } } public LLUUID Owner { - get { - return _owner; - } - set { - _owner = value; - } + get { + return _owner; + } + set { + _owner = value; + } } public LLUUID ParentID { - get { - return _parentID; - } - set { - _parentID = value; - } + get { + return _parentID; + } + set { + _parentID = value; + } } public LLUUID ID { - get { - return _id; - } - set { - _id = value; - } + get { + return _id; + } + set { + _id = value; + } } public short Type { - get { - return _type; - } - set { - _type = value; - } + get { + return _type; + } + set { + _type = value; + } } public ushort Version { - get { - return _version; - } - set { - _version = value; - } + get { + return _version; + } + set { + _version = value; + } } } } diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 6ed2961be4..ccb81634e9 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -100,120 +100,120 @@ namespace OpenSim.Framework private uint _everyOnePermissions; public LLUUID ID { - get { - return _id; - } - set { - _id = value; - } + get { + return _id; + } + set { + _id = value; + } } public int InvType { - get { - return _invType; - } - set { - _invType = value; - } + get { + return _invType; + } + set { + _invType = value; + } } public LLUUID Folder { - get { - return _folder; - } - set { - _folder = value; - } + get { + return _folder; + } + set { + _folder = value; + } } public LLUUID Owner { - get { - return _owner; - } - set { - _owner = value; - } + get { + return _owner; + } + set { + _owner = value; + } } public LLUUID Creator { - get { - return _creator; - } - set { - _creator = value; - } + get { + return _creator; + } + set { + _creator = value; + } } public string Name { - get { - return _name; - } - set { - _name = value; - } + get { + return _name; + } + set { + _name = value; + } } public string Description { - get { - return _description; - } - set { - _description = value; - } + get { + return _description; + } + set { + _description = value; + } } public uint NextPermissions { - get { - return _nextPermissions; - } - set { - _nextPermissions = value; - } + get { + return _nextPermissions; + } + set { + _nextPermissions = value; + } } public uint CurrentPermissions { - get { - return _currentPermissions; - } - set { - _currentPermissions = value; - } + get { + return _currentPermissions; + } + set { + _currentPermissions = value; + } } public uint BasePermissions { - get { - return _basePermissions; - } - set { - _basePermissions = value; - } + get { + return _basePermissions; + } + set { + _basePermissions = value; + } } public uint EveryOnePermissions { - get { - return _everyOnePermissions; - } - set { - _everyOnePermissions = value; - } + get { + return _everyOnePermissions; + } + set { + _everyOnePermissions = value; + } } public int AssetType { - get { - return _assetType; - } - set { - _assetType = value; - } + get { + return _assetType; + } + set { + _assetType = value; + } } public LLUUID AssetID { - get { - return _assetID; - } - set { - _assetID = value; - } + get { + return _assetID; + } + set { + _assetID = value; + } } } } diff --git a/OpenSim/Framework/OSUUID.cs b/OpenSim/Framework/OSUUID.cs index 169c0e3e06..90de347490 100644 --- a/OpenSim/Framework/OSUUID.cs +++ b/OpenSim/Framework/OSUUID.cs @@ -34,7 +34,7 @@ namespace OpenSim.Framework public class OSUUID: IComparable { public Guid UUID; - + public OSUUID() {} /* Constructors */ diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 1eff6966a9..615644b3c2 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -154,14 +154,14 @@ namespace OpenSim.Framework "lsl_text", String.Empty, String.Empty, - "bodypart", + "bodypart", String.Empty, "snapshot", String.Empty, String.Empty, "wearable", - "animation", - "gesture" + "animation", + "gesture" }; @@ -183,15 +183,15 @@ namespace OpenSim.Framework "lsltext", "lslbyte", "txtr_tga", - "bodypart", + "bodypart", "trash", "snapshot", "lstndfnd", "snd_wav", "img_tga", "jpeg", - "animatn", - "gesture" + "animatn", + "gesture" }; public LLUUID ItemID = LLUUID.Zero; @@ -214,8 +214,8 @@ namespace OpenSim.Framework public string Name = String.Empty; public string Description = String.Empty; public uint CreationDate = 0; - public LLUUID PermsGranter; - public int PermsMask; + public LLUUID PermsGranter; + public int PermsMask; public LLUUID ParentPartID = LLUUID.Zero; diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 239651949d..8114957e7a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -622,15 +622,15 @@ namespace OpenSim.Framework } return returnstring; } - - static public XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) + + static public XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) { return SendXmlRpcCommand(url, methodName, args); } - + static public XmlRpcResponse SendXmlRpcCommand(string url, string methodName, object[] args) { - XmlRpcRequest client = new XmlRpcRequest(methodName, args); + XmlRpcRequest client = new XmlRpcRequest(methodName, args); return client.Send(url, 6000); } diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index b0ca496922..20945784ad 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -249,7 +249,7 @@ namespace OpenSim config.Set("enabled", "false"); } - if (DefaultConfig.Configs["Voice"] == null) + if (DefaultConfig.Configs["Voice"] == null) DefaultConfig.AddConfig("Voice"); config = DefaultConfig.Configs["Voice"]; if (config != null) @@ -522,8 +522,8 @@ namespace OpenSim m_log.Info("[MODULES]: Loading Region's modules"); List modules = m_moduleLoader.PickupModules(scene, "."); - // This needs to be ahead of the script engine load, so the - // script module can pick up events exposed by a module + // This needs to be ahead of the script engine load, so the + // script module can pick up events exposed by a module m_moduleLoader.InitialiseSharedModules(scene); //m_moduleLoader.PickupModules(scene, "ScriptEngines"); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 0a6431d3f6..5b9bfdb079 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -91,7 +91,7 @@ namespace OpenSim.Region.ClientStack private readonly uint m_circuitCode; private int m_moneyBalance; - private int m_animationSequenceNumber = 1; + private int m_animationSequenceNumber = 1; private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL @@ -233,8 +233,8 @@ namespace OpenSim.Region.ClientStack private RequestAsset handlerRequestAsset = null; // OnRequestAsset; private UUIDNameRequest handlerTeleportHomeRequest = null; - private ScriptAnswer handlerScriptAnswer = null; - private RequestPayPrice handlerRequestPayPrice = null; + private ScriptAnswer handlerScriptAnswer = null; + private RequestPayPrice handlerRequestPayPrice = null; private ObjectDeselect handlerObjectDetach = null; /* Properties */ @@ -307,10 +307,10 @@ namespace OpenSim.Region.ClientStack get { return m_moneyBalance; } } - public int NextAnimationSequenceNumber - { - get { return m_animationSequenceNumber++; } - } + public int NextAnimationSequenceNumber + { + get { return m_animationSequenceNumber++; } + } /* METHODS */ @@ -793,8 +793,8 @@ namespace OpenSim.Region.ClientStack public event UUIDNameRequest OnTeleportHomeRequest; - public event ScriptAnswer OnScriptAnswer; - public event RequestPayPrice OnRequestPayPrice; + public event ScriptAnswer OnScriptAnswer; + public event RequestPayPrice OnRequestPayPrice; #region Scene/Avatar to Client @@ -1171,28 +1171,28 @@ namespace OpenSim.Region.ClientStack OutPacket(money, ThrottleOutPacketType.Task); } - public void SendPayPrice(LLUUID objectID, int[] payPrice) - { - if(payPrice[0] == 0 && - payPrice[1] == 0 && - payPrice[2] == 0 && - payPrice[3] == 0 && - payPrice[4] == 0) - return; + public void SendPayPrice(LLUUID objectID, int[] payPrice) + { + if(payPrice[0] == 0 && + payPrice[1] == 0 && + payPrice[2] == 0 && + payPrice[3] == 0 && + payPrice[4] == 0) + return; - PayPriceReplyPacket payPriceReply = (PayPriceReplyPacket)PacketPool.Instance.GetPacket(PacketType.PayPriceReply); - payPriceReply.ObjectData.ObjectID = objectID; - payPriceReply.ObjectData.DefaultPayPrice = payPrice[0]; + PayPriceReplyPacket payPriceReply = (PayPriceReplyPacket)PacketPool.Instance.GetPacket(PacketType.PayPriceReply); + payPriceReply.ObjectData.ObjectID = objectID; + payPriceReply.ObjectData.DefaultPayPrice = payPrice[0]; - payPriceReply.ButtonData=new PayPriceReplyPacket.ButtonDataBlock[4]; - payPriceReply.ButtonData[0]=new PayPriceReplyPacket.ButtonDataBlock(); - payPriceReply.ButtonData[0].PayButton = payPrice[1]; - payPriceReply.ButtonData[1]=new PayPriceReplyPacket.ButtonDataBlock(); - payPriceReply.ButtonData[1].PayButton = payPrice[2]; - payPriceReply.ButtonData[2]=new PayPriceReplyPacket.ButtonDataBlock(); - payPriceReply.ButtonData[2].PayButton = payPrice[3]; - payPriceReply.ButtonData[3]=new PayPriceReplyPacket.ButtonDataBlock(); - payPriceReply.ButtonData[3].PayButton = payPrice[4]; + payPriceReply.ButtonData=new PayPriceReplyPacket.ButtonDataBlock[4]; + payPriceReply.ButtonData[0]=new PayPriceReplyPacket.ButtonDataBlock(); + payPriceReply.ButtonData[0].PayButton = payPrice[1]; + payPriceReply.ButtonData[1]=new PayPriceReplyPacket.ButtonDataBlock(); + payPriceReply.ButtonData[1].PayButton = payPrice[2]; + payPriceReply.ButtonData[2]=new PayPriceReplyPacket.ButtonDataBlock(); + payPriceReply.ButtonData[2].PayButton = payPrice[3]; + payPriceReply.ButtonData[3]=new PayPriceReplyPacket.ButtonDataBlock(); + payPriceReply.ButtonData[3].PayButton = payPrice[4]; OutPacket(payPriceReply, ThrottleOutPacketType.Task); } @@ -2530,8 +2530,8 @@ namespace OpenSim.Region.ClientStack return true; } - public void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question) - { + public void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question) + { ScriptQuestionPacket scriptQuestion = (ScriptQuestionPacket)PacketPool.Instance.GetPacket(PacketType.ScriptQuestion); scriptQuestion.Data = new ScriptQuestionPacket.DataBlock(); // TODO: don't create new blocks if recycling an old packet @@ -2542,7 +2542,7 @@ namespace OpenSim.Region.ClientStack scriptQuestion.Data.ObjectOwner = Helpers.StringToField(ownerName); OutPacket(scriptQuestion, ThrottleOutPacketType.Task); - } + } protected virtual bool Logout(IClientAPI client, Packet packet) { @@ -3915,14 +3915,14 @@ namespace OpenSim.Region.ClientStack } break; - case PacketType.ScriptAnswerYes: + case PacketType.ScriptAnswerYes: ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack; - handlerScriptAnswer = OnScriptAnswer; - if (handlerScriptAnswer != null) - { - handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions); - } + handlerScriptAnswer = OnScriptAnswer; + if (handlerScriptAnswer != null) + { + handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions); + } break; #endregion @@ -4613,14 +4613,14 @@ namespace OpenSim.Region.ClientStack // TODO: handle this packet //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); break; - case PacketType.RequestPayPrice: + case PacketType.RequestPayPrice: RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack; - handlerRequestPayPrice = OnRequestPayPrice; - if (handlerRequestPayPrice != null) - { - handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID); - } - break; + handlerRequestPayPrice = OnRequestPayPrice; + if (handlerRequestPayPrice != null) + { + handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID); + } + break; #endregion diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 682763bdef..f3b50ae97a 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.DataSnapshot #region IRegionModule public void Close() { - + } public void Initialise(Scene scene, IConfigSource config) @@ -81,7 +81,7 @@ namespace OpenSim.Region.DataSnapshot m_configLoaded = true; m_log.Info("[DATASNAPSHOT]: Loading configuration"); //Read from the config for options - lock (m_syncInit) { + lock (m_syncInit) { try { m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); if (config.Configs["Startup"].GetBoolean("gridmode", true)) @@ -152,7 +152,7 @@ namespace OpenSim.Region.DataSnapshot public string Name { - get { return "External Data Generator"; } + get { return "External Data Generator"; } } public void PostInitialise() diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs index bd0660fcb7..34f8238806 100644 --- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs @@ -54,20 +54,20 @@ namespace OpenSim.Region.Environment.Modules /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux /// - public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); + public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); - public interface IMoneyModule : IRegionModule - { - bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount); + public interface IMoneyModule : IRegionModule + { + bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount); - event ObjectPaid OnObjectPaid; - } + event ObjectPaid OnObjectPaid; + } public class BetaGridLikeMoneyModule: IMoneyModule { - public event ObjectPaid OnObjectPaid; + public event ObjectPaid OnObjectPaid; - private ObjectPaid handerOnObjectPaid; + private ObjectPaid handerOnObjectPaid; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -134,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules IConfig startupConfig = m_gConfig.Configs["Startup"]; IConfig economyConfig = m_gConfig.Configs["Economy"]; - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); ReadConfigAndPopulate(scene, startupConfig, "Startup"); ReadConfigAndPopulate(scene, economyConfig, "Economy"); @@ -320,7 +320,7 @@ namespace OpenSim.Region.Environment.Modules // Subscribe to Money messages client.OnEconomyDataRequest += EconomyDataRequestHandler; client.OnMoneyBalanceRequest += SendMoneyBalance; - client.OnRequestPayPrice += requestPayPrice; + client.OnRequestPayPrice += requestPayPrice; client.OnLogout += ClientClosed; @@ -328,20 +328,20 @@ namespace OpenSim.Region.Environment.Modules #region event Handlers - public void requestPayPrice(IClientAPI client, LLUUID objectID) - { - Scene scene=LocateSceneClientIn(client.AgentId); - if(scene == null) - return; + public void requestPayPrice(IClientAPI client, LLUUID objectID) + { + Scene scene=LocateSceneClientIn(client.AgentId); + if(scene == null) + return; - SceneObjectPart task=scene.GetSceneObjectPart(objectID); - if(task == null) - return; - SceneObjectGroup group=task.ParentGroup; - SceneObjectPart root=group.RootPart; + SceneObjectPart task=scene.GetSceneObjectPart(objectID); + if(task == null) + return; + SceneObjectGroup group=task.ParentGroup; + SceneObjectPart root=group.RootPart; - client.SendPayPrice(objectID, root.PayPrice); - } + client.SendPayPrice(objectID, root.PayPrice); + } /// /// When the client closes the connection we remove their accounting info from memory to free up resources. @@ -380,52 +380,52 @@ namespace OpenSim.Region.Environment.Modules private void ValidateLandBuy (Object osender, EventManager.LandBuyArgs e) { - if (m_MoneyAddress.Length == 0) - { - lock (m_KnownClientFunds) - { - if (m_KnownClientFunds.ContainsKey(e.agentId)) - { - // Does the sender have enough funds to give? - if (m_KnownClientFunds[e.agentId] >= e.parcelPrice) - { - lock(e) - { - e.economyValidated=true; - } - } - } - } - } - else - { - if(GetRemoteBalance(e.agentId) >= e.parcelPrice) - { - lock(e) - { - e.economyValidated=true; - } - } - } + if (m_MoneyAddress.Length == 0) + { + lock (m_KnownClientFunds) + { + if (m_KnownClientFunds.ContainsKey(e.agentId)) + { + // Does the sender have enough funds to give? + if (m_KnownClientFunds[e.agentId] >= e.parcelPrice) + { + lock(e) + { + e.economyValidated=true; + } + } + } + } + } + else + { + if(GetRemoteBalance(e.agentId) >= e.parcelPrice) + { + lock(e) + { + e.economyValidated=true; + } + } + } } private void processLandBuy(Object osender, EventManager.LandBuyArgs e) { - lock(e) - { - if(e.economyValidated == true && e.transactionID == 0) - { - e.transactionID=Util.UnixTimeSinceEpoch(); + lock(e) + { + if(e.economyValidated == true && e.transactionID == 0) + { + e.transactionID=Util.UnixTimeSinceEpoch(); - if(doMoneyTransfer(e.agentId, e.parcelOwnerID, e.parcelPrice, 0, "Land purchase")) - { - lock (e) - { - e.amountDebited = e.parcelPrice; - } - } - } - } + if(doMoneyTransfer(e.agentId, e.parcelOwnerID, e.parcelPrice, 0, "Land purchase")) + { + lock (e) + { + e.amountDebited = e.parcelPrice; + } + } + } + } } /// @@ -438,47 +438,47 @@ namespace OpenSim.Region.Environment.Modules IClientAPI sender = null; IClientAPI receiver = null; - if(m_MoneyAddress.Length > 0) // Handled on server - e.description=String.Empty; + if(m_MoneyAddress.Length > 0) // Handled on server + e.description=String.Empty; - if(e.transactiontype == 5008) // Object gets paid - { - sender = LocateClientObject(e.sender); - if (sender != null) - { - SceneObjectPart part=findPrim(e.receiver); - if(part == null) - return; + if(e.transactiontype == 5008) // Object gets paid + { + sender = LocateClientObject(e.sender); + if (sender != null) + { + SceneObjectPart part=findPrim(e.receiver); + if(part == null) + return; - string name=resolveAgentName(part.OwnerID); - if(name == String.Empty) - name="(hippos)"; + string name=resolveAgentName(part.OwnerID); + if(name == String.Empty) + name="(hippos)"; - receiver = LocateClientObject(part.OwnerID); + receiver = LocateClientObject(part.OwnerID); - string description=String.Format("Paid {0} via object {1}", name, e.description); - bool transactionresult = doMoneyTransfer(e.sender, part.OwnerID, e.amount, e.transactiontype, description); + string description=String.Format("Paid {0} via object {1}", name, e.description); + bool transactionresult = doMoneyTransfer(e.sender, part.OwnerID, e.amount, e.transactiontype, description); - if(transactionresult) - { - ObjectPaid handlerOnObjectPaid = OnObjectPaid; - if(handlerOnObjectPaid != null) - { - handlerOnObjectPaid(e.receiver, e.sender, e.amount); - } - } + if(transactionresult) + { + ObjectPaid handlerOnObjectPaid = OnObjectPaid; + if(handlerOnObjectPaid != null) + { + handlerOnObjectPaid(e.receiver, e.sender, e.amount); + } + } - if (e.sender != e.receiver) - { - sender.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.sender)); - } - if(receiver != null) - { - receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(part.OwnerID)); - } - } - return; - } + if (e.sender != e.receiver) + { + sender.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.sender)); + } + if(receiver != null) + { + receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(part.OwnerID)); + } + } + return; + } sender = LocateClientObject(e.sender); if (sender != null) @@ -652,45 +652,45 @@ namespace OpenSim.Region.Environment.Modules { // If we don't know about the sender, then the sender can't // actually be here and therefore this is likely fraud or outdated. - if (m_MoneyAddress.Length == 0) - { - if (m_KnownClientFunds.ContainsKey(Sender)) - { - // Does the sender have enough funds to give? - if (m_KnownClientFunds[Sender] >= amount) - { - // Subtract the funds from the senders account - m_KnownClientFunds[Sender] -= amount; + if (m_MoneyAddress.Length == 0) + { + if (m_KnownClientFunds.ContainsKey(Sender)) + { + // Does the sender have enough funds to give? + if (m_KnownClientFunds[Sender] >= amount) + { + // Subtract the funds from the senders account + m_KnownClientFunds[Sender] -= amount; - // do we know about the receiver? - if (!m_KnownClientFunds.ContainsKey(Receiver)) - { - // Make a record for them so they get the updated balance when they login - CheckExistAndRefreshFunds(Receiver); - } - if (m_enabled) - { - //Add the amount to the Receiver's funds - m_KnownClientFunds[Receiver] += amount; - result = true; - } - } - else - { - // These below are redundant to make this clearer to read - result = false; - } - } - else - { - result = false; - } - } - else - { - result = TransferMoneyonMoneyServer(Sender, Receiver, amount, transactiontype, description); - } - } + // do we know about the receiver? + if (!m_KnownClientFunds.ContainsKey(Receiver)) + { + // Make a record for them so they get the updated balance when they login + CheckExistAndRefreshFunds(Receiver); + } + if (m_enabled) + { + //Add the amount to the Receiver's funds + m_KnownClientFunds[Receiver] += amount; + result = true; + } + } + else + { + // These below are redundant to make this clearer to read + result = false; + } + } + else + { + result = false; + } + } + else + { + result = TransferMoneyonMoneyServer(Sender, Receiver, amount, transactiontype, description); + } + } } return result; } @@ -1003,50 +1003,50 @@ namespace OpenSim.Region.Environment.Modules return MoneyRespData; } - private SceneObjectPart findPrim(LLUUID objectID) - { + private SceneObjectPart findPrim(LLUUID objectID) + { lock (m_scenel) { foreach (Scene s in m_scenel.Values) - { - SceneObjectPart part=s.GetSceneObjectPart(objectID); - if(part != null) - { - return part; - } - } + { + SceneObjectPart part=s.GetSceneObjectPart(objectID); + if(part != null) + { + return part; + } + } } - return null; - } + return null; + } - private string resolveObjectName(LLUUID objectID) - { - SceneObjectPart part=findPrim(objectID); - if(part != null) - { - return part.Name; - } - return String.Empty; - } + private string resolveObjectName(LLUUID objectID) + { + SceneObjectPart part=findPrim(objectID); + if(part != null) + { + return part.Name; + } + return String.Empty; + } - private string resolveAgentName(LLUUID agentID) + private string resolveAgentName(LLUUID agentID) { // try avatar username surname - Scene scene=GetRandomScene(); + Scene scene=GetRandomScene(); UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(agentID); if (profile != null) { string avatarname = profile.FirstName + " " + profile.SurName; return avatarname; } - return String.Empty; - } + return String.Empty; + } - public bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount) - { - string description=String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); - return doMoneyTransfer(fromID, toID, amount, 2, description); - } + public bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount) + { + string description=String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); + return doMoneyTransfer(fromID, toID, amount, 2, description); + } /// /// Informs the Money Grid Server of a transfer. @@ -1134,63 +1134,63 @@ namespace OpenSim.Region.Environment.Modules } - public int GetRemoteBalance(LLUUID agentId) - { - int funds = 0; + public int GetRemoteBalance(LLUUID agentId) + { + int funds = 0; - IClientAPI aClient = LocateClientObject(agentId); - if (aClient != null) - { - Scene s = LocateSceneClientIn(agentId); - if (s != null) - { - if (m_MoneyAddress.Length > 0) - { - Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); - if ((bool)hbinfo["success"] == true) - { - try - { - funds = (Int32)hbinfo["funds"]; - } - catch (ArgumentException) - { - } - catch (FormatException) - { - } - catch (OverflowException) - { - m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); - aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); - } - catch (InvalidCastException) - { - funds = 0; - } + IClientAPI aClient = LocateClientObject(agentId); + if (aClient != null) + { + Scene s = LocateSceneClientIn(agentId); + if (s != null) + { + if (m_MoneyAddress.Length > 0) + { + Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); + if ((bool)hbinfo["success"] == true) + { + try + { + funds = (Int32)hbinfo["funds"]; + } + catch (ArgumentException) + { + } + catch (FormatException) + { + } + catch (OverflowException) + { + m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); + aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); + } + catch (InvalidCastException) + { + funds = 0; + } - } - else - { - m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); - aClient.SendAlertMessage((string)hbinfo["errorMessage"]); - } - } + } + else + { + m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); + aClient.SendAlertMessage((string)hbinfo["errorMessage"]); + } + } - SetLocalFundsForAgentID(agentId, funds); - SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero); - } - else - { - m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene."); - } - } - else - { - m_log.Debug("[MONEY]: Got balance request update for agent that isn't here."); - } - return funds; - } + SetLocalFundsForAgentID(agentId, funds); + SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero); + } + else + { + m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene."); + } + } + else + { + m_log.Debug("[MONEY]: Got balance request update for agent that isn't here."); + } + return funds; + } public XmlRpcResponse GridMoneyUpdate(XmlRpcRequest request) { @@ -1204,7 +1204,7 @@ namespace OpenSim.Region.Environment.Modules Helpers.TryParse((string)requestData["agentId"], out agentId); if (agentId != LLUUID.Zero) { - GetRemoteBalance(agentId); + GetRemoteBalance(agentId); } else @@ -1228,7 +1228,7 @@ namespace OpenSim.Region.Environment.Modules /// XMLRPC handler to send alert message and sound to client /// public XmlRpcResponse UserAlert(XmlRpcRequest request) - { + { XmlRpcResponse ret = new XmlRpcResponse(); Hashtable retparam = new Hashtable(); Hashtable requestData = (Hashtable)request.Params[0]; @@ -1236,36 +1236,36 @@ namespace OpenSim.Region.Environment.Modules LLUUID agentId = LLUUID.Zero; LLUUID soundId = LLUUID.Zero; - Helpers.TryParse((string)requestData["agentId"], out agentId); - Helpers.TryParse((string)requestData["soundId"], out soundId); - string text=(string)requestData["text"]; - string secret=(string)requestData["secret"]; + Helpers.TryParse((string)requestData["agentId"], out agentId); + Helpers.TryParse((string)requestData["soundId"], out soundId); + string text=(string)requestData["text"]; + string secret=(string)requestData["secret"]; - Scene userScene = GetRandomScene(); - if(userScene.RegionInfo.regionSecret.ToString() == secret) - { - IClientAPI client = LocateClientObject(agentId); + Scene userScene = GetRandomScene(); + if(userScene.RegionInfo.regionSecret.ToString() == secret) + { + IClientAPI client = LocateClientObject(agentId); - if (client != null) - { - if(soundId != LLUUID.Zero) - client.SendPlayAttachedSound(soundId, LLUUID.Zero, LLUUID.Zero, 1.0f, 0); - client.SendBlueBoxMessage(LLUUID.Zero, LLUUID.Zero, "", text); - retparam.Add("success", true); - } - else - { - retparam.Add("success", false); - } - } - else - { - retparam.Add("success", false); - } + if (client != null) + { + if(soundId != LLUUID.Zero) + client.SendPlayAttachedSound(soundId, LLUUID.Zero, LLUUID.Zero, 1.0f, 0); + client.SendBlueBoxMessage(LLUUID.Zero, LLUUID.Zero, "", text); + retparam.Add("success", true); + } + else + { + retparam.Add("success", false); + } + } + else + { + retparam.Add("success", false); + } ret.Value = retparam; return ret; - } + } # region Standalone box enablers only diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs index 561c5cfa99..e2414b0863 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs @@ -949,12 +949,12 @@ namespace OpenSim.Region.Environment.Modules.LandManagement } } - // If the economy has been validated by the economy module, - // and land has been validated as well, this method transfers - // the land ownership + // If the economy has been validated by the economy module, + // and land has been validated as well, this method transfers + // the land ownership public void handleLandBuyRequest(Object o, EventManager.LandBuyArgs e) - { + { if (e.economyValidated && e.landValidated) { lock (landList) @@ -966,11 +966,11 @@ namespace OpenSim.Region.Environment.Modules.LandManagement } } } - } + } - // After receiving a land buy packet, first the data needs to - // be validated. This method validates the right to buy the - // parcel + // After receiving a land buy packet, first the data needs to + // be validated. This method validates the right to buy the + // parcel public void handleLandValidationRequest(Object o, EventManager.LandBuyArgs e) { diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs index f9684e6483..6e87a1c9c5 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs @@ -73,20 +73,20 @@ namespace OpenSim.Region.Environment.Modules.LandManagement public LandData landData { - get - { - return m_landData; - } + get + { + return m_landData; + } - set - { - m_landData = value; - } + set + { + m_landData = value; + } } public LLUUID regionUUID { - get { return m_scene.RegionInfo.RegionID; } + get { return m_scene.RegionInfo.RegionID; } } #endregion diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 9bf6728667..40650f3957 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -730,11 +730,11 @@ namespace OpenSim.Region.Environment.Scenes if (item != null) { - group.AddInventoryItem(remoteClient, primLocalID, item, copyID); - m_log.InfoFormat( - "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", - item.Name, primLocalID, remoteClient.Name); - group.GetProperties(remoteClient); + group.AddInventoryItem(remoteClient, primLocalID, item, copyID); + m_log.InfoFormat( + "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", + item.Name, primLocalID, remoteClient.Name); + group.GetProperties(remoteClient); } else { diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 8fdb468df3..5e0b8ba403 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -134,10 +134,10 @@ namespace OpenSim.Region.Environment.Scenes EventManager.LandBuyArgs args = new EventManager.LandBuyArgs( agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated); - // First, allow all validators a stab at it + // First, allow all validators a stab at it m_eventManager.TriggerValidateLandBuy(this, args); - // Then, check validation and transfer + // Then, check validation and transfer m_eventManager.TriggerLandBuy(this, args); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 6e815a6385..dd361bf36c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -258,32 +258,32 @@ namespace OpenSim.Region.Environment.Scenes } } - // Assumes a lock is held on the inventory - private bool InventoryContainsName(string name) - { - foreach (TaskInventoryItem item in m_taskInventory.Values) - { - if(item.Name == name) - return true; - } - return false; - } + // Assumes a lock is held on the inventory + private bool InventoryContainsName(string name) + { + foreach (TaskInventoryItem item in m_taskInventory.Values) + { + if(item.Name == name) + return true; + } + return false; + } - private string FindAvailableInventoryName(string name) - { - if(!InventoryContainsName(name)) - return name; + private string FindAvailableInventoryName(string name) + { + if(!InventoryContainsName(name)) + return name; - int suffix=1; - while(suffix < 256) - { - string tryName=String.Format("{0} {1}", name, suffix); - if(!InventoryContainsName(tryName)) - return tryName; - suffix++; - } - return String.Empty; - } + int suffix=1; + while(suffix < 256) + { + string tryName=String.Format("{0} {1}", name, suffix); + if(!InventoryContainsName(tryName)) + return tryName; + suffix++; + } + return String.Empty; + } /// /// Add an item to this prim's inventory. @@ -295,11 +295,11 @@ namespace OpenSim.Region.Environment.Scenes item.CreationDate = 1000; item.ParentPartID = UUID; - string name=FindAvailableInventoryName(item.Name); - if(name == String.Empty) - return; + string name=FindAvailableInventoryName(item.Name); + if(name == String.Empty) + return; - item.Name=name; + item.Name=name; lock (m_taskInventory) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 099d0f0763..0608fa7bb0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -97,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes public uint Category; // TODO: This needs to be persisted in next XML version update! - [XmlIgnore] public int[] PayPrice = {0,0,0,0,0}; + [XmlIgnore] public int[] PayPrice = {0,0,0,0,0}; [XmlIgnore] public bool m_IsAttachment = false; @@ -2038,18 +2038,18 @@ namespace OpenSim.Region.Environment.Scenes } } - if(soundID == LLUUID.Zero) - return; + if(soundID == LLUUID.Zero) + return; List avatarts = m_parentGroup.Scene.GetAvatars(); foreach (ScenePresence p in avatarts) { - double dis=Util.GetDistanceTo(p.AbsolutePosition, position); - if(dis > 100.0) // Max audio distance - continue; + double dis=Util.GetDistanceTo(p.AbsolutePosition, position); + if(dis > 100.0) // Max audio distance + continue; - // Scale by distance - volume*=((100.0-dis)/100.0); + // Scale by distance + volume*=((100.0-dis)/100.0); if (triggered) { diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 3f70108253..94dbbb3d9a 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes } m_pos = value; - m_parentPosition=new LLVector3(0, 0, 0); + m_parentPosition=new LLVector3(0, 0, 0); } } @@ -362,7 +362,7 @@ namespace OpenSim.Region.Environment.Scenes // Move them into an object to (hopefully) avoid threading issues. try { - SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); + SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); } catch (KeyNotFoundException) { @@ -547,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes AddToPhysicalScene(); m_physicsActor.Flying = isFlying; - SendAnimPack(); + SendAnimPack(); m_scene.SwapRootAgentCount(false); m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid); @@ -570,15 +570,15 @@ namespace OpenSim.Region.Environment.Scenes /// public void MakeChildAgent() { - if(m_animations.Count > 0) - { - LLUUID movement=m_animations[0]; + if(m_animations.Count > 0) + { + LLUUID movement=m_animations[0]; - m_animations.Clear(); - m_animationSeqs.Clear(); + m_animations.Clear(); + m_animationSeqs.Clear(); - SetMovementAnimation(movement); - } + SetMovementAnimation(movement); + } // m_log.DebugFormat( // "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", // Name, UUID, m_scene.RegionInfo.RegionName); @@ -611,10 +611,10 @@ namespace OpenSim.Region.Environment.Scenes /// public void Teleport(LLVector3 pos) { - RemoveFromPhysicalScene(); - Velocity = new LLVector3(0, 0, 0); + RemoveFromPhysicalScene(); + Velocity = new LLVector3(0, 0, 0); AbsolutePosition = pos; - AddToPhysicalScene(); + AddToPhysicalScene(); SendTerseUpdateToAllClients(); } @@ -1055,12 +1055,12 @@ namespace OpenSim.Region.Environment.Scenes public void AddAnimation(LLUUID animID) { - if(m_isChildAgent) - return; + if(m_isChildAgent) + return; - // Don't let this animation become the movement animation - if(m_animations.Count < 1) - SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); + // Don't let this animation become the movement animation + if(m_animations.Count < 1) + SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); if (!m_animations.Contains(animID)) { @@ -1072,8 +1072,8 @@ namespace OpenSim.Region.Environment.Scenes public void RemoveAnimation(LLUUID animID) { - if(m_isChildAgent) - return; + if(m_isChildAgent) + return; if (m_animations.Contains(animID)) { @@ -1083,21 +1083,21 @@ namespace OpenSim.Region.Environment.Scenes } else { - // What a HACK!! Anim list really needs to be an object! - int idx; + // What a HACK!! Anim list really needs to be an object! + int idx; - for(idx=0;idx < m_animations.Count;idx++) - { - if(m_animations[idx] == animID) - { - int seq=m_animationSeqs[idx]; + for(idx=0;idx < m_animations.Count;idx++) + { + if(m_animations[idx] == animID) + { + int seq=m_animationSeqs[idx]; - m_animations.Remove(animID); - m_animationSeqs.Remove(seq); - SendAnimPack(); - break; - } - } + m_animations.Remove(animID); + m_animationSeqs.Remove(seq); + SendAnimPack(); + break; + } + } } } } @@ -1119,33 +1119,33 @@ namespace OpenSim.Region.Environment.Scenes /// protected void SetMovementAnimation(LLUUID anim) { - if(m_animations.Count < 1) - { - m_animations.Add(Animations.AnimsLLUUID["STAND"]); - m_animationSeqs.Add(1); + if(m_animations.Count < 1) + { + m_animations.Add(Animations.AnimsLLUUID["STAND"]); + m_animationSeqs.Add(1); - SendAnimPack(); - } - else - { - try - { - if (m_animations[0] != anim) - { - m_animations[0] = anim; - m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; - } - SendAnimPack(); - } - catch - { - m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery..."); - m_animations[0] = anim; - m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; - SendAnimPack(); - } - } - } + SendAnimPack(); + } + else + { + try + { + if (m_animations[0] != anim) + { + m_animations[0] = anim; + m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; + } + SendAnimPack(); + } + catch + { + m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery..."); + m_animations[0] = anim; + m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; + SendAnimPack(); + } + } + } /// /// This method handles agent movement related animations @@ -1536,8 +1536,8 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAnimPack(LLUUID[] animations, int[] seqs) { - if(m_isChildAgent) - return; + if(m_isChildAgent) + return; m_scene.Broadcast( delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); }); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 0aa3240009..2586ac5fed 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -167,8 +167,8 @@ namespace OpenSim.Region.Examples.SimpleModule public event ObjectIncludeInSearch OnObjectIncludeInSearch; public event UUIDNameRequest OnTeleportHomeRequest; - public event ScriptAnswer OnScriptAnswer; - public event RequestPayPrice OnRequestPayPrice; + public event ScriptAnswer OnScriptAnswer; + public event RequestPayPrice OnRequestPayPrice; #pragma warning restore 67 @@ -221,10 +221,10 @@ namespace OpenSim.Region.Examples.SimpleModule get { return FirstName + LastName; } } - public virtual int NextAnimationSequenceNumber - { - get { return 1; } - } + public virtual int NextAnimationSequenceNumber + { + get { return 1; } + } public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType) { @@ -344,9 +344,9 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public virtual void SendPayPrice(LLUUID objectID, int[] payPrice) - { - } + public virtual void SendPayPrice(LLUUID objectID, int[] payPrice) + { + } public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) @@ -603,8 +603,8 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendScriptQuestion(LLUUID objectID, string taskName, string ownerName, LLUUID itemID, int question) - { - } + public void SendScriptQuestion(LLUUID objectID, string taskName, string ownerName, LLUUID itemID, int question) + { + } } } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 3778c09f6f..3273023d8e 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.ScriptEngine.Common private DateTime m_timer = DateTime.Now; private string m_state = "default"; - private bool m_waitingForScriptAnswer=false; + private bool m_waitingForScriptAnswer=false; public string State @@ -121,50 +121,50 @@ namespace OpenSim.Region.ScriptEngine.Common return World.GetCommander(name); } - private LLUUID InventorySelf() - { - LLUUID invItemID=new LLUUID(); + private LLUUID InventorySelf() + { + LLUUID invItemID=new LLUUID(); foreach (KeyValuePair inv in m_host.TaskInventory) { if(inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) { - invItemID=inv.Key; - break; + invItemID=inv.Key; + break; } } - return invItemID; - } + return invItemID; + } - private LLUUID InventoryKey(string name, int type) - { + private LLUUID InventoryKey(string name, int type) + { m_host.AddScriptLPS(1); foreach (KeyValuePair inv in m_host.TaskInventory) { - if(inv.Value.Name == name) - { - if(inv.Value.Type != type) - return LLUUID.Zero; + if(inv.Value.Name == name) + { + if(inv.Value.Type != type) + return LLUUID.Zero; - return inv.Value.AssetID.ToString(); - } - } - return LLUUID.Zero; - } + return inv.Value.AssetID.ToString(); + } + } + return LLUUID.Zero; + } - private LLUUID InventoryKey(string name) - { + private LLUUID InventoryKey(string name) + { m_host.AddScriptLPS(1); foreach (KeyValuePair inv in m_host.TaskInventory) { - if(inv.Value.Name == name) - { - return inv.Value.AssetID.ToString(); - } - } - return LLUUID.Zero; - } + if(inv.Value.Name == name) + { + return inv.Value.AssetID.ToString(); + } + } + return LLUUID.Zero; + } //These are the implementations of the various ll-functions used by the LSL scripts. //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 @@ -947,15 +947,15 @@ namespace OpenSim.Region.ScriptEngine.Common { m_host.AddScriptLPS(1); - LLUUID textureID=new LLUUID(); + LLUUID textureID=new LLUUID(); - if(!LLUUID.TryParse(texture, out textureID)) - { - textureID=InventoryKey(texture, (int)AssetType.Texture); - } + if(!LLUUID.TryParse(texture, out textureID)) + { + textureID=InventoryKey(texture, (int)AssetType.Texture); + } - if(textureID == LLUUID.Zero) - return; + if(textureID == LLUUID.Zero) + return; LLObject.TextureEntry tex = m_host.Shape.Textures; @@ -1610,41 +1610,41 @@ namespace OpenSim.Region.ScriptEngine.Common public int llGiveMoney(string destination, int amount) { - LLUUID invItemID=InventorySelf(); - if(invItemID == LLUUID.Zero) - return 0; + LLUUID invItemID=InventorySelf(); + if(invItemID == LLUUID.Zero) + return 0; m_host.AddScriptLPS(1); - if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) - return 0; + if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) + return 0; - if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0) - { - LSLError("No permissions to give money"); - return 0; - } + if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0) + { + LSLError("No permissions to give money"); + return 0; + } - LLUUID toID=new LLUUID(); + LLUUID toID=new LLUUID(); - if(!LLUUID.TryParse(destination, out toID)) - { - LSLError("Bad key in llGiveMoney"); - return 0; - } + if(!LLUUID.TryParse(destination, out toID)) + { + LSLError("Bad key in llGiveMoney"); + return 0; + } - IMoneyModule money=World.RequestModuleInterface(); + IMoneyModule money=World.RequestModuleInterface(); - if(money == null) - { - NotImplemented("llGiveMoney"); - return 0; - } + if(money == null) + { + NotImplemented("llGiveMoney"); + return 0; + } - bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); + bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); - if(result) - return 1; + if(result) + return 1; return 0; } @@ -1883,57 +1883,57 @@ namespace OpenSim.Region.ScriptEngine.Common { m_host.AddScriptLPS(1); - LLUUID invItemID=InventorySelf(); - if(invItemID == LLUUID.Zero) - return; + LLUUID invItemID=InventorySelf(); + if(invItemID == LLUUID.Zero) + return; - if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) - return; + if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) + return; - if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) - { - // Do NOT try to parse LLUUID, animations cannot be triggered by ID - LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); - if(animID == LLUUID.Zero) - return; + if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) + { + // Do NOT try to parse LLUUID, animations cannot be triggered by ID + LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); + if(animID == LLUUID.Zero) + return; if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) { ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; - presence.AddAnimation(animID); - } - } + presence.AddAnimation(animID); + } + } } public void llStopAnimation(string anim) { m_host.AddScriptLPS(1); - LLUUID invItemID=InventorySelf(); - if(invItemID == LLUUID.Zero) - return; + LLUUID invItemID=InventorySelf(); + if(invItemID == LLUUID.Zero) + return; - if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) - return; + if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) + return; - if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) - { - LLUUID animID = new LLUUID(); + if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) + { + LLUUID animID = new LLUUID(); - if(!LLUUID.TryParse(anim, out animID)) - { - animID=InventoryKey(anim); - } + if(!LLUUID.TryParse(anim, out animID)) + { + animID=InventoryKey(anim); + } - if(animID == LLUUID.Zero) - return; + if(animID == LLUUID.Zero) + return; if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) { ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; - presence.RemoveAnimation(animID); - } - } + presence.RemoveAnimation(animID); + } + } } public void llPointAt() @@ -1972,108 +1972,108 @@ namespace OpenSim.Region.ScriptEngine.Common public void llRequestPermissions(string agent, int perm) { - LLUUID agentID=new LLUUID(); + LLUUID agentID=new LLUUID(); - if(!LLUUID.TryParse(agent, out agentID)) - return; + if(!LLUUID.TryParse(agent, out agentID)) + return; - LLUUID invItemID=InventorySelf(); + LLUUID invItemID=InventorySelf(); - if(invItemID == LLUUID.Zero) - return; // Not in a prim? How?? + if(invItemID == LLUUID.Zero) + return; // Not in a prim? How?? - if(agentID == LLUUID.Zero || perm == 0) // Releasing permissions - { - m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero; - m_host.TaskInventory[invItemID].PermsMask=0; + if(agentID == LLUUID.Zero || perm == 0) // Releasing permissions + { + m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero; + m_host.TaskInventory[invItemID].PermsMask=0; - m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( - m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( + m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); - return; - } + return; + } m_host.AddScriptLPS(1); - bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state + bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state - if(attachment && agent == m_host.OwnerID) - { - // When attached, certain permissions are implicit if requested from owner - int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | - BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | - BuiltIn_Commands_BaseClass.PERMISSION_ATTACH; + if(attachment && agent == m_host.OwnerID) + { + // When attached, certain permissions are implicit if requested from owner + int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | + BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | + BuiltIn_Commands_BaseClass.PERMISSION_ATTACH; - if((perm & (~implicitPerms)) == 0) // Requested only implicit perms - { - m_host.TaskInventory[invItemID].PermsGranter=agentID; - m_host.TaskInventory[invItemID].PermsMask=perm; + if((perm & (~implicitPerms)) == 0) // Requested only implicit perms + { + m_host.TaskInventory[invItemID].PermsGranter=agentID; + m_host.TaskInventory[invItemID].PermsMask=perm; - m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( - m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( + m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); - return; - } - } - else if(m_host.m_sitTargetAvatar == agentID) // Sitting avatar - { - // When agent is sitting, certain permissions are implicit if requested from sitting agent - int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | - BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA; + return; + } + } + else if(m_host.m_sitTargetAvatar == agentID) // Sitting avatar + { + // When agent is sitting, certain permissions are implicit if requested from sitting agent + int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | + BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA; - if((perm & (~implicitPerms)) == 0) // Requested only implicit perms - { - m_host.TaskInventory[invItemID].PermsGranter=agentID; - m_host.TaskInventory[invItemID].PermsMask=perm; + if((perm & (~implicitPerms)) == 0) // Requested only implicit perms + { + m_host.TaskInventory[invItemID].PermsGranter=agentID; + m_host.TaskInventory[invItemID].PermsMask=perm; - m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( - m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( + m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); - return; - } - } + return; + } + } - if (World.m_innerScene.ScenePresences.ContainsKey(agentID)) - { - string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID); - if(ownerName == String.Empty) - ownerName="(hippos)"; + if (World.m_innerScene.ScenePresences.ContainsKey(agentID)) + { + string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID); + if(ownerName == String.Empty) + ownerName="(hippos)"; - ScenePresence presence = World.m_innerScene.ScenePresences[agentID]; - if(!m_waitingForScriptAnswer) - { - m_host.TaskInventory[invItemID].PermsGranter=agentID; - m_host.TaskInventory[invItemID].PermsMask=0; - presence.ControllingClient.OnScriptAnswer+=handleScriptAnswer; - m_waitingForScriptAnswer=true; - } + ScenePresence presence = World.m_innerScene.ScenePresences[agentID]; + if(!m_waitingForScriptAnswer) + { + m_host.TaskInventory[invItemID].PermsGranter=agentID; + m_host.TaskInventory[invItemID].PermsMask=0; + presence.ControllingClient.OnScriptAnswer+=handleScriptAnswer; + m_waitingForScriptAnswer=true; + } - presence.ControllingClient.SendScriptQuestion(m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); - return; - } + presence.ControllingClient.SendScriptQuestion(m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); + return; + } - // Requested agent is not in range, refuse perms - m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( - m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); + // Requested agent is not in range, refuse perms + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( + m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); } - void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer) - { - if(taskID != m_host.UUID) - return; + void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer) + { + if(taskID != m_host.UUID) + return; - LLUUID invItemID=InventorySelf(); + LLUUID invItemID=InventorySelf(); - if(invItemID == LLUUID.Zero) - return; + if(invItemID == LLUUID.Zero) + return; - client.OnScriptAnswer-=handleScriptAnswer; - m_waitingForScriptAnswer=false; + client.OnScriptAnswer-=handleScriptAnswer; + m_waitingForScriptAnswer=false; - m_host.TaskInventory[invItemID].PermsMask=answer; - m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( - m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)answer}); - } + m_host.TaskInventory[invItemID].PermsMask=answer; + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( + m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)answer}); + } public string llGetPermissionsKey() { @@ -2083,7 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Common { if(item.Type == 10 && item.ItemID == m_itemID) { - return item.PermsGranter.ToString(); + return item.PermsGranter.ToString(); } } @@ -2098,7 +2098,7 @@ namespace OpenSim.Region.ScriptEngine.Common { if(item.Type == 10 && item.ItemID == m_itemID) { - return item.PermsMask; + return item.PermsMask; } } @@ -3997,24 +3997,24 @@ namespace OpenSim.Region.ScriptEngine.Common LSLError("First parameter to llDialog needs to be a key"); return; } - if(buttons.Length > 12) - { + if(buttons.Length > 12) + { LSLError("No more than 12 buttons can be shown"); return; - } + } string[] buts = new string[buttons.Length]; for(int i = 0; i < buttons.Length; i++) { - if(buttons.Data[i].ToString() == String.Empty) - { - LSLError("button label cannot be blank"); - return; - } - if(buttons.Data[i].ToString().Length > 24) - { - LSLError("button label cannot be longer than 24 characters"); - return; - } + if(buttons.Data[i].ToString() == String.Empty) + { + LSLError("button label cannot be blank"); + return; + } + if(buttons.Data[i].ToString().Length > 24) + { + LSLError("button label cannot be longer than 24 characters"); + return; + } buts[i] = buttons.Data[i].ToString(); } World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); @@ -5137,16 +5137,16 @@ namespace OpenSim.Region.ScriptEngine.Common { m_host.AddScriptLPS(1); - if(quick_pay_buttons.Data.Length != 4) - { - LSLError("List must have 4 elements"); - return; - } - m_host.ParentGroup.RootPart.PayPrice[0]=price; - m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0]; - m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1]; - m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2]; - m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3]; + if(quick_pay_buttons.Data.Length != 4) + { + LSLError("List must have 4 elements"); + return; + } + m_host.ParentGroup.RootPart.PayPrice[0]=price; + m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0]; + m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1]; + m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2]; + m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3]; } public LSL_Types.Vector3 llGetCameraPos() diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index c2e320994b..d3e99482a8 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs @@ -71,11 +71,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; // TODO: HOOK ALL EVENTS UP TO SERVER! - IMoneyModule money=myScriptEngine.World.RequestModuleInterface(); - if(money != null) - { - money.OnObjectPaid+=HandleObjectPaid; - } + IMoneyModule money=myScriptEngine.World.RequestModuleInterface(); + if(money != null) + { + money.OnObjectPaid+=HandleObjectPaid; + } } }