diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
4 files changed, 58 insertions, 41 deletions
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 1345db9..bcb21d0 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | |||
@@ -203,8 +203,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
203 | { | 203 | { |
204 | } | 204 | } |
205 | 205 | ||
206 | public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount) | 206 | public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount, UUID txn, out string result) |
207 | { | 207 | { |
208 | result = String.Empty; | ||
208 | string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); | 209 | string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); |
209 | 210 | ||
210 | bool give_result = doMoneyTransfer(fromID, toID, amount, 2, description); | 211 | bool give_result = doMoneyTransfer(fromID, toID, amount, 2, description); |
@@ -840,6 +841,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
840 | if (module != null) | 841 | if (module != null) |
841 | module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice); | 842 | module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice); |
842 | } | 843 | } |
844 | |||
845 | public void MoveMoney(UUID fromAgentID, UUID toAgentID, int amount, string text) | ||
846 | { | ||
847 | } | ||
843 | } | 848 | } |
844 | 849 | ||
845 | public enum TransactionType : int | 850 | public enum TransactionType : int |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index a895ee1..c88ccc5 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
61 | private readonly string m_firstname; | 61 | private readonly string m_firstname; |
62 | private readonly string m_lastname; | 62 | private readonly string m_lastname; |
63 | private readonly Vector3 m_startPos; | 63 | private readonly Vector3 m_startPos; |
64 | private readonly UUID m_uuid = UUID.Random(); | 64 | private UUID m_uuid = UUID.Random(); |
65 | private readonly Scene m_scene; | 65 | private readonly Scene m_scene; |
66 | private readonly UUID m_ownerID; | 66 | private readonly UUID m_ownerID; |
67 | 67 | ||
@@ -235,7 +235,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
235 | #pragma warning disable 67 | 235 | #pragma warning disable 67 |
236 | public event Action<IClientAPI> OnLogout; | 236 | public event Action<IClientAPI> OnLogout; |
237 | public event ObjectPermissions OnObjectPermissions; | 237 | public event ObjectPermissions OnObjectPermissions; |
238 | 238 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | |
239 | public event MoneyTransferRequest OnMoneyTransferRequest; | 239 | public event MoneyTransferRequest OnMoneyTransferRequest; |
240 | public event ParcelBuy OnParcelBuy; | 240 | public event ParcelBuy OnParcelBuy; |
241 | public event Action<IClientAPI> OnConnectionClosed; | 241 | public event Action<IClientAPI> OnConnectionClosed; |
@@ -255,6 +255,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
255 | public event ObjectDrop OnObjectDrop; | 255 | public event ObjectDrop OnObjectDrop; |
256 | public event StartAnim OnStartAnim; | 256 | public event StartAnim OnStartAnim; |
257 | public event StopAnim OnStopAnim; | 257 | public event StopAnim OnStopAnim; |
258 | public event ChangeAnim OnChangeAnim; | ||
258 | public event LinkObjects OnLinkObjects; | 259 | public event LinkObjects OnLinkObjects; |
259 | public event DelinkObjects OnDelinkObjects; | 260 | public event DelinkObjects OnDelinkObjects; |
260 | public event RequestMapBlocks OnRequestMapBlocks; | 261 | public event RequestMapBlocks OnRequestMapBlocks; |
@@ -305,6 +306,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
305 | public event UpdatePrimTexture OnUpdatePrimTexture; | 306 | public event UpdatePrimTexture OnUpdatePrimTexture; |
306 | public event UpdateVector OnUpdatePrimGroupPosition; | 307 | public event UpdateVector OnUpdatePrimGroupPosition; |
307 | public event UpdateVector OnUpdatePrimSinglePosition; | 308 | public event UpdateVector OnUpdatePrimSinglePosition; |
309 | public event ClientChangeObject onClientChangeObject; | ||
308 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 310 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
309 | public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; | 311 | public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; |
310 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | 312 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; |
@@ -443,7 +445,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
443 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 445 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
444 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 446 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
445 | public event ClassifiedDelete OnClassifiedDelete; | 447 | public event ClassifiedDelete OnClassifiedDelete; |
446 | public event ClassifiedDelete OnClassifiedGodDelete; | 448 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
447 | 449 | ||
448 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 450 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
449 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 451 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
@@ -482,11 +484,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
482 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 484 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
483 | public event SimWideDeletesDelegate OnSimWideDeletes; | 485 | public event SimWideDeletesDelegate OnSimWideDeletes; |
484 | public event SendPostcard OnSendPostcard; | 486 | public event SendPostcard OnSendPostcard; |
487 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
485 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 488 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
486 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 489 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
487 | public event GodlikeMessage onGodlikeMessage; | 490 | public event GodlikeMessage onGodlikeMessage; |
488 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 491 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
489 | 492 | public event GenericCall2 OnUpdateThrottles; | |
490 | #pragma warning restore 67 | 493 | #pragma warning restore 67 |
491 | 494 | ||
492 | #endregion | 495 | #endregion |
@@ -509,6 +512,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
509 | public virtual UUID AgentId | 512 | public virtual UUID AgentId |
510 | { | 513 | { |
511 | get { return m_uuid; } | 514 | get { return m_uuid; } |
515 | set { m_uuid = value; } | ||
512 | } | 516 | } |
513 | 517 | ||
514 | public UUID SessionId | 518 | public UUID SessionId |
@@ -614,6 +618,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
614 | public virtual void SetChildAgentThrottle(byte[] throttle) | 618 | public virtual void SetChildAgentThrottle(byte[] throttle) |
615 | { | 619 | { |
616 | } | 620 | } |
621 | |||
622 | public void SetAgentThrottleSilent(int throttle, int setting) | ||
623 | { | ||
624 | |||
625 | |||
626 | } | ||
617 | public byte[] GetThrottlesPacked(float multiplier) | 627 | public byte[] GetThrottlesPacked(float multiplier) |
618 | { | 628 | { |
619 | return new byte[0]; | 629 | return new byte[0]; |
@@ -759,6 +769,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
759 | { | 769 | { |
760 | } | 770 | } |
761 | 771 | ||
772 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
773 | { | ||
774 | } | ||
775 | |||
762 | public virtual void SendRemoveInventoryItem(UUID itemID) | 776 | public virtual void SendRemoveInventoryItem(UUID itemID) |
763 | { | 777 | { |
764 | } | 778 | } |
@@ -775,7 +789,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
775 | { | 789 | { |
776 | } | 790 | } |
777 | 791 | ||
778 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) | 792 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
779 | { | 793 | { |
780 | } | 794 | } |
781 | public virtual void SendAbortXferPacket(ulong xferID) | 795 | public virtual void SendAbortXferPacket(ulong xferID) |
@@ -920,10 +934,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
920 | 934 | ||
921 | public void Close() | 935 | public void Close() |
922 | { | 936 | { |
923 | Close(false); | 937 | Close(true, false); |
924 | } | 938 | } |
925 | 939 | ||
926 | public void Close(bool force) | 940 | public void Close(bool sendStop, bool force) |
927 | { | 941 | { |
928 | // Remove ourselves from the scene | 942 | // Remove ourselves from the scene |
929 | m_scene.RemoveClient(AgentId, false); | 943 | m_scene.RemoveClient(AgentId, false); |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index fffe1ab..9ec4740 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -145,10 +145,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
145 | npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, | 145 | npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, |
146 | int.MaxValue); | 146 | int.MaxValue); |
147 | 147 | ||
148 | m_log.DebugFormat( | 148 | // m_log.DebugFormat( |
149 | "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", | 149 | // "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", |
150 | firstname, lastname, npcAvatar.AgentId, owner, | 150 | // firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName); |
151 | senseAsAgent, position, scene.RegionInfo.RegionName); | ||
152 | 151 | ||
153 | AgentCircuitData acd = new AgentCircuitData(); | 152 | AgentCircuitData acd = new AgentCircuitData(); |
154 | acd.AgentID = npcAvatar.AgentId; | 153 | acd.AgentID = npcAvatar.AgentId; |
@@ -171,36 +170,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
171 | } | 170 | } |
172 | */ | 171 | */ |
173 | 172 | ||
174 | lock (m_avatars) | 173 | ManualResetEvent ev = new ManualResetEvent(false); |
175 | { | ||
176 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, | ||
177 | acd); | ||
178 | scene.AddNewAgent(npcAvatar, PresenceType.Npc); | ||
179 | 174 | ||
180 | ScenePresence sp; | 175 | Util.FireAndForget(delegate(object x) { |
181 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 176 | lock (m_avatars) |
182 | { | 177 | { |
183 | /* | 178 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); |
184 | m_log.DebugFormat( | 179 | scene.AddNewAgent(npcAvatar, PresenceType.Npc); |
185 | "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", | ||
186 | sp.Name, sp.UUID); | ||
187 | */ | ||
188 | |||
189 | sp.CompleteMovement(npcAvatar, false); | ||
190 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | ||
191 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | ||
192 | 180 | ||
193 | return npcAvatar.AgentId; | 181 | ScenePresence sp; |
182 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | ||
183 | { | ||
184 | sp.CompleteMovement(npcAvatar, false); | ||
185 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | ||
186 | // m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | ||
187 | } | ||
194 | } | 188 | } |
195 | else | 189 | ev.Set(); |
196 | { | 190 | }); |
197 | m_log.WarnFormat( | ||
198 | "[NPC MODULE]: Could not find scene presence for NPC {0} {1}", | ||
199 | sp.Name, sp.UUID); | ||
200 | 191 | ||
201 | return UUID.Zero; | 192 | ev.WaitOne(); |
202 | } | 193 | |
203 | } | 194 | // m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); |
195 | |||
196 | return npcAvatar.AgentId; | ||
204 | } | 197 | } |
205 | 198 | ||
206 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, | 199 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, |
@@ -408,9 +401,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
408 | { | 401 | { |
409 | NPCAvatar av; | 402 | NPCAvatar av; |
410 | if (m_avatars.TryGetValue(npcID, out av)) | 403 | if (m_avatars.TryGetValue(npcID, out av)) |
404 | { | ||
405 | if (npcID == callerID) | ||
406 | return true; | ||
411 | return CheckPermissions(av, callerID); | 407 | return CheckPermissions(av, callerID); |
408 | } | ||
412 | else | 409 | else |
410 | { | ||
413 | return false; | 411 | return false; |
412 | } | ||
414 | } | 413 | } |
415 | } | 414 | } |
416 | 415 | ||
@@ -422,8 +421,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
422 | /// <returns>true if they do, false if they don't.</returns> | 421 | /// <returns>true if they do, false if they don't.</returns> |
423 | private bool CheckPermissions(NPCAvatar av, UUID callerID) | 422 | private bool CheckPermissions(NPCAvatar av, UUID callerID) |
424 | { | 423 | { |
425 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || | 424 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID; |
426 | av.OwnerID == callerID; | ||
427 | } | 425 | } |
428 | } | 426 | } |
429 | } \ No newline at end of file | 427 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index f841d5c..20c178c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
110 | // ScenePresence.SendInitialData() to reset our entire appearance. | 110 | // ScenePresence.SendInitialData() to reset our entire appearance. |
111 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); | 111 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); |
112 | 112 | ||
113 | m_afMod.SetAppearance(sp, originalTe, null); | 113 | m_afMod.SetAppearance(sp, originalTe, null, new WearableCacheItem[0] ); |
114 | 114 | ||
115 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); | 115 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
116 | 116 | ||