From 6fbc64af5e2d179e2235f21645dd717a4066592d Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 4 Feb 2008 10:39:30 +0000 Subject: * Whole buncha stuff. --- OpenSim/Region/ClientStack/ClientView.cs | 17 ++++++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 8 +++++ OpenSim/Region/Environment/Scenes/Scene.cs | 10 ++++-- OpenSim/Region/Environment/Scenes/SceneEvents.cs | 38 +++++++++++++++++++--- .../Region/Examples/SimpleApp/MyNpcCharacter.cs | 2 ++ .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 12 +++++++ 6 files changed, 80 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 4aceac0..7f62d4d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -578,6 +578,8 @@ namespace OpenSim.Region.ClientStack public event PacketStats OnPacketStats; + public event MoneyTransferRequest OnMoneyTransferRequest; + #region Scene/Avatar to Client @@ -2044,6 +2046,21 @@ namespace OpenSim.Region.ClientStack AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); + AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); + } + + private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) + { + MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack; + + if (OnMoneyTransferRequest != null) + { + OnMoneyTransferRequest(money.MoneyData.SourceID, money.MoneyData.DestID, + money.MoneyData.Amount, money.MoneyData.TransactionType, + Util.FieldToString(money.MoneyData.Description)); + } + + return true; } private bool HandleViewerEffect(IClientAPI sender, Packet Pack) diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 5a7d4de..8adb281 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -138,6 +138,14 @@ namespace OpenSim.Region.Environment.Scenes } } + public virtual void ProcessMoneyTransferRequest(LLUUID source, LLUUID destination, int amount, int transactiontype, string description) + { + EventManager.MoneyTransferArgs args = new EventManager.MoneyTransferArgs( + source, destination, amount, transactiontype, description); + + EventManager.TriggerMoneyTransfer(this, args); + } + public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) { EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index c99cac0..89fd5ea 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1078,7 +1078,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) + public virtual SceneObjectGroup AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) { SceneObjectGroup sceneOb = new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); @@ -1093,18 +1093,21 @@ namespace OpenSim.Region.Environment.Scenes } // if not phantom, add to physics sceneOb.ApplyPhysics(m_physicalPrim); + + return sceneOb; } - public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position, + public SceneObjectGroup AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position, Tree treeType, bool newTree) { + LLUUID uuid = this.RegionInfo.MasterAvatarAssignedUUID; PrimitiveBaseShape treeShape = new PrimitiveBaseShape(); treeShape.PathCurve = 16; treeShape.PathEnd = 49900; treeShape.PCode = newTree ? (byte) PCode.NewTree : (byte) PCode.Tree; treeShape.Scale = scale; treeShape.State = (byte) treeType; - AddNewPrim(LLUUID.Random(), position, rotation, treeShape,(byte)1,LLVector3.Zero,LLUUID.Zero,(byte)1); + return AddNewPrim(uuid, position, rotation, treeShape); } public void RemovePrim(uint localID, LLUUID avatar_deleter) @@ -1253,6 +1256,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnUpdateTaskInventory += UpdateTaskInventory; client.OnGrabObject += ProcessObjectGrab; + client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; client.OnPacketStats += AddPacketStats; diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 4e9a258..51d1b32 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -129,6 +129,31 @@ namespace OpenSim.Region.Environment.Scenes public event ScriptChangedEvent OnScriptChangedEvent; + public class MoneyTransferArgs : System.EventArgs + { + public LLUUID sender; + public LLUUID reciever; + + // Always false. The SL protocol sucks. + public bool authenticated = false; + + public int amount; + public int transactiontype; + public string description; + + public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) { + sender = asender; + reciever = areciever; + amount = aamount; + transactiontype = atransactiontype; + description = adescription; + } + } + + public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e); + + public event MoneyTransferEvent OnMoneyTransfer; + public void TriggerOnScriptChangedEvent(uint localID, uint change) { if (OnScriptChangedEvent != null) @@ -191,16 +216,21 @@ namespace OpenSim.Region.Environment.Scenes public void TriggerParcelPrimCountUpdate() { - /* - * Removed by Adam to prevent some exceptions, temporary. - * */ if (OnParcelPrimCountUpdate != null) { OnParcelPrimCountUpdate(); + } + } + + public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e) + { + if (OnMoneyTransfer != null) + { + OnMoneyTransfer(sender, e); } - } + public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) { if (OnParcelPrimCountAdd != null) diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 6ae74e6..453320c 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -47,6 +47,8 @@ namespace SimpleApp public event Action OnLogout; public event ObjectPermissions OnObjectPermissions; + + public event MoneyTransferRequest OnMoneyTransferRequest; public event Action OnConnectionClosed; public event ImprovedInstantMessage OnInstantMessage; diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 3d5f106..76183ae 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -3199,6 +3199,18 @@ namespace OpenSim.Region.ScriptEngine.Common World.SendGeneralAlert(msg); } + public void osSetRot(LLUUID target, Quaternion rotation) + { + if (World.Entities.ContainsKey(target)) + { + World.Entities[target].Rotation = rotation; + } + else + { + LSLError("osSetRot: Invalid target"); + } + } + public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { -- cgit v1.1