diff options
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/General/NullClientAPI.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/PermissionManager.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 47 |
11 files changed, 123 insertions, 27 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index ff794f9..f39d0c7 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -216,5 +216,6 @@ namespace OpenSim.Framework.Interfaces | |||
216 | void SendAlertMessage(string message); | 216 | void SendAlertMessage(string message); |
217 | void SendAgentAlertMessage(string message, bool modal); | 217 | void SendAgentAlertMessage(string message, bool modal); |
218 | void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); | 218 | void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); |
219 | bool AddMoney( int debit ); | ||
219 | } | 220 | } |
220 | } | 221 | } |
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index 876c9b3..e85b88f 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs | |||
@@ -145,6 +145,11 @@ namespace OpenSim.Framework | |||
145 | public void SendAgentAlertMessage(string message, bool modal) { } | 145 | public void SendAgentAlertMessage(string message, bool modal) { } |
146 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } | 146 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } |
147 | 147 | ||
148 | |||
149 | public bool AddMoney(int debit) | ||
150 | { | ||
151 | return false; | ||
152 | } | ||
148 | } | 153 | } |
149 | } | 154 | } |
150 | 155 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 1e3685b..f380c25 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -38,6 +38,27 @@ namespace OpenSim.Region.ClientStack | |||
38 | { | 38 | { |
39 | public partial class ClientView | 39 | public partial class ClientView |
40 | { | 40 | { |
41 | private int m_moneyBalance; | ||
42 | |||
43 | public int MoneyBalance | ||
44 | { | ||
45 | get { return m_moneyBalance; } | ||
46 | } | ||
47 | |||
48 | public bool AddMoney( int debit ) | ||
49 | { | ||
50 | if( m_moneyBalance + debit >= 0 ) | ||
51 | { | ||
52 | m_moneyBalance += debit; | ||
53 | SendMoneyBalance( LLUUID.Zero, true, Helpers.StringToField("Poof Poof!"), m_moneyBalance ); | ||
54 | return true; | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | return false; | ||
59 | } | ||
60 | } | ||
61 | |||
41 | protected override void ProcessInPacket(Packet Pack) | 62 | protected override void ProcessInPacket(Packet Pack) |
42 | { | 63 | { |
43 | ack_pack(Pack); | 64 | ack_pack(Pack); |
@@ -521,7 +542,7 @@ namespace OpenSim.Region.ClientStack | |||
521 | #endregion | 542 | #endregion |
522 | 543 | ||
523 | case PacketType.MoneyBalanceRequest: | 544 | case PacketType.MoneyBalanceRequest: |
524 | this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000); | 545 | SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); |
525 | break; | 546 | break; |
526 | case PacketType.UUIDNameRequest: | 547 | case PacketType.UUIDNameRequest: |
527 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; | 548 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 1375f6c..5a60096 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -87,6 +87,8 @@ namespace OpenSim.Region.ClientStack | |||
87 | 87 | ||
88 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions ) | 88 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions ) |
89 | { | 89 | { |
90 | m_moneyBalance = 1000; | ||
91 | |||
90 | m_scene = scene; | 92 | m_scene = scene; |
91 | m_clientThreads = clientThreads; | 93 | m_clientThreads = clientThreads; |
92 | m_assetCache = assetCache; | 94 | m_assetCache = assetCache; |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 2698d3f..1daf5c3 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -91,16 +91,23 @@ namespace OpenSim.Region.Environment | |||
91 | 91 | ||
92 | #region Object Permissions | 92 | #region Object Permissions |
93 | 93 | ||
94 | protected virtual bool GenericObjectPermission(LLUUID user, LLUUID obj) | 94 | protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId) |
95 | { | 95 | { |
96 | // Default: deny | 96 | // Default: deny |
97 | bool permission = false; | 97 | bool permission = false; |
98 | 98 | ||
99 | if( !m_scene.Entities.ContainsKey( objId )) | ||
100 | { | ||
101 | return false; | ||
102 | } | ||
103 | |||
99 | // If it's not an object, we cant edit it. | 104 | // If it's not an object, we cant edit it. |
100 | if (!(m_scene.Entities[obj] is SceneObjectGroup)) | 105 | if (!(m_scene.Entities[objId] is SceneObjectGroup)) |
106 | { | ||
101 | return false; | 107 | return false; |
102 | 108 | } | |
103 | SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj]; | 109 | |
110 | SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId]; | ||
104 | LLUUID taskOwner = null; | 111 | LLUUID taskOwner = null; |
105 | 112 | ||
106 | // Object owners should be able to edit their own content | 113 | // Object owners should be able to edit their own content |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index afa4ea5..10bdd54 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -752,7 +752,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
752 | } | 752 | } |
753 | } | 753 | } |
754 | 754 | ||
755 | public void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 755 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
756 | { | 756 | { |
757 | this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); | 757 | this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); |
758 | } | 758 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 3bd83aa..77d936d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -863,5 +863,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
863 | m_rootPart.Text = text; | 863 | m_rootPart.Text = text; |
864 | m_rootPart.ScheduleTerseUpdate(); | 864 | m_rootPart.ScheduleTerseUpdate(); |
865 | } | 865 | } |
866 | |||
867 | public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient) | ||
868 | { | ||
869 | if( m_rootPart.LocalID == localId ) | ||
870 | { | ||
871 | OnGrabGroup(offsetPos, remoteClient); | ||
872 | } | ||
873 | else | ||
874 | { | ||
875 | SceneObjectPart part = GetChildPrim(localId); | ||
876 | OnGrabPart(part, offsetPos, remoteClient); | ||
877 | } | ||
878 | } | ||
879 | |||
880 | public virtual void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient) | ||
881 | { | ||
882 | part.OnGrab(offsetPos, remoteClient); | ||
883 | } | ||
884 | |||
885 | public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) | ||
886 | { | ||
887 | |||
888 | } | ||
866 | } | 889 | } |
867 | } | 890 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index c4752a5..8e570d4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -566,6 +566,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
566 | public virtual void UpdateMovement() | 566 | public virtual void UpdateMovement() |
567 | { | 567 | { |
568 | } | 568 | } |
569 | |||
570 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | ||
571 | { | ||
572 | } | ||
569 | } | 573 | } |
570 | } | 574 | } |
571 | 575 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs index b1da33a..5821b9f 100644 --- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | |||
@@ -5,6 +5,7 @@ using OpenSim.Region.Environment.Scenes; | |||
5 | using Axiom.Math; | 5 | using Axiom.Math; |
6 | using libsecondlife; | 6 | using libsecondlife; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.Interfaces; | ||
8 | 9 | ||
9 | namespace SimpleApp | 10 | namespace SimpleApp |
10 | { | 11 | { |
@@ -35,6 +36,8 @@ namespace SimpleApp | |||
35 | base.UpdateMovement(); | 36 | base.UpdateMovement(); |
36 | } | 37 | } |
37 | 38 | ||
39 | |||
40 | |||
38 | public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) | 41 | public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) |
39 | : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) | 42 | : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) |
40 | { | 43 | { |
@@ -51,5 +54,25 @@ namespace SimpleApp | |||
51 | 54 | ||
52 | UpdateParentIDs(); | 55 | UpdateParentIDs(); |
53 | } | 56 | } |
57 | |||
58 | public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient) | ||
59 | { | ||
60 | m_parts.Remove(part.UUID); | ||
61 | remoteClient.SendKillObject(m_regionHandle, part.LocalID); | ||
62 | remoteClient.AddMoney(1); | ||
63 | remoteClient.SendChatMessage("Poof!", 1, Pos, "Party Party", LLUUID.Zero); | ||
64 | } | ||
65 | |||
66 | public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) | ||
67 | { | ||
68 | if( m_parts.Count == 1 ) | ||
69 | { | ||
70 | m_parts.Remove(m_rootPart.UUID); | ||
71 | m_scene.RemoveEntity(this); | ||
72 | remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID); | ||
73 | remoteClient.AddMoney(50); | ||
74 | remoteClient.SendChatMessage("KABLAM!!!", 1, Pos, "Groupie Groupie", LLUUID.Zero); | ||
75 | } | ||
76 | } | ||
54 | } | 77 | } |
55 | } | 78 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index c0132f5..8bd7496 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -202,5 +202,10 @@ namespace SimpleApp | |||
202 | 202 | ||
203 | count++; | 203 | count++; |
204 | } | 204 | } |
205 | |||
206 | public bool AddMoney(int debit) | ||
207 | { | ||
208 | return false; | ||
209 | } | ||
205 | } | 210 | } |
206 | } | 211 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 92dd61b..6cf8974 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -41,38 +41,43 @@ namespace SimpleApp | |||
41 | this.CreateTerrainTexture(); | 41 | this.CreateTerrainTexture(); |
42 | } | 42 | } |
43 | 43 | ||
44 | public override void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | ||
45 | { | ||
46 | foreach (EntityBase ent in Entities.Values) | ||
47 | { | ||
48 | if (ent is SceneObjectGroup) | ||
49 | { | ||
50 | SceneObjectGroup obj = ent as SceneObjectGroup; | ||
51 | |||
52 | if( obj.HasChildPrim( localID ) ) | ||
53 | { | ||
54 | obj.ObjectGrabHandler(localID, offsetPos, remoteClient); | ||
55 | return; | ||
56 | } | ||
57 | } | ||
58 | } | ||
59 | |||
60 | base.ProcessObjectGrab(localID, offsetPos, remoteClient); | ||
61 | } | ||
62 | |||
44 | #region IWorld Members | 63 | #region IWorld Members |
45 | 64 | ||
46 | override public void AddNewClient(IClientAPI client, bool child) | 65 | override public void AddNewClient(IClientAPI client, bool child) |
47 | { | 66 | { |
67 | SubscribeToClientEvents(client); | ||
68 | |||
69 | ScenePresence avatar = CreateAndAddScenePresence(client); | ||
70 | avatar.Pos = new LLVector3(128, 128, 26); | ||
71 | |||
48 | LLVector3 pos = new LLVector3(128, 128, 128); | 72 | LLVector3 pos = new LLVector3(128, 128, 128); |
49 | 73 | ||
50 | client.OnRegionHandShakeReply += SendLayerData; | ||
51 | /*client.OnChatFromViewer += | ||
52 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | ||
53 | { | ||
54 | // Echo it (so you know what you typed) | ||
55 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
56 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); | ||
57 | }; | ||
58 | */ | ||
59 | client.OnChatFromViewer += this.SimChat; | ||
60 | client.OnAddPrim += AddNewPrim; | ||
61 | client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; | ||
62 | client.OnRequestMapBlocks += this.RequestMapBlocks; | ||
63 | client.OnTeleportLocationRequest += this.RequestTeleportLocation; | ||
64 | client.OnGrabUpdate += this.MoveObject; | ||
65 | client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; | ||
66 | |||
67 | client.OnCompleteMovementToRegion += delegate() | 74 | client.OnCompleteMovementToRegion += delegate() |
68 | { | 75 | { |
69 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); | 76 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); |
70 | }; | 77 | }; |
71 | 78 | ||
72 | client.SendRegionHandshake(m_regInfo); | ||
73 | 79 | ||
74 | ScenePresence avatar = CreateAndAddScenePresence(client); | 80 | client.SendRegionHandshake(m_regInfo); |
75 | avatar.Pos = new LLVector3(128, 128, 26); | ||
76 | } | 81 | } |
77 | 82 | ||
78 | #endregion | 83 | #endregion |