aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC
diff options
context:
space:
mode:
authoronefang2019-09-11 16:36:50 +1000
committeronefang2019-09-11 16:36:50 +1000
commit50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch)
tree52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Region/OptionalModules/World/NPC
parentRenamed branch to SledjChisl. (diff)
parentBump to release flavour, build 0. (diff)
downloadopensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip
opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz
opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2
opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz
Merge branch 'SledjChisl'
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs181
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs99
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs8
3 files changed, 228 insertions, 60 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index fb644b7..bb23f2f 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -43,9 +43,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
43 public class NPCAvatar : IClientAPI, INPC 43 public class NPCAvatar : IClientAPI, INPC
44 { 44 {
45 public bool SenseAsAgent { get; set; } 45 public bool SenseAsAgent { get; set; }
46 public UUID Owner
47 {
48 get { return m_ownerID;}
49 }
46 50
47 public delegate void ChatToNPC( 51 public delegate void ChatToNPC(
48 string message, byte type, Vector3 fromPos, string fromName, 52 string message, byte type, Vector3 fromPos, string fromName,
49 UUID fromAgentID, UUID ownerID, byte source, byte audible); 53 UUID fromAgentID, UUID ownerID, byte source, byte audible);
50 54
51 /// <summary> 55 /// <summary>
@@ -61,9 +65,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC
61 private readonly string m_firstname; 65 private readonly string m_firstname;
62 private readonly string m_lastname; 66 private readonly string m_lastname;
63 private readonly Vector3 m_startPos; 67 private readonly Vector3 m_startPos;
64 private readonly UUID m_uuid; 68 private UUID m_uuid = UUID.Random();
65 private readonly Scene m_scene; 69 private readonly Scene m_scene;
66 private readonly UUID m_ownerID; 70 private readonly UUID m_ownerID;
71 private UUID m_hostGroupID;
72 private string m_profileAbout = "";
73 private UUID m_profileImage = UUID.Zero;
74 private string m_born;
75 public List<uint> SelectedObjects {get; private set;}
67 76
68 public NPCAvatar( 77 public NPCAvatar(
69 string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) 78 string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene)
@@ -75,6 +84,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
75 m_scene = scene; 84 m_scene = scene;
76 m_ownerID = ownerID; 85 m_ownerID = ownerID;
77 SenseAsAgent = senseAsAgent; 86 SenseAsAgent = senseAsAgent;
87 m_hostGroupID = UUID.Zero;
78 } 88 }
79 89
80 public NPCAvatar( 90 public NPCAvatar(
@@ -87,6 +97,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC
87 m_scene = scene; 97 m_scene = scene;
88 m_ownerID = ownerID; 98 m_ownerID = ownerID;
89 SenseAsAgent = senseAsAgent; 99 SenseAsAgent = senseAsAgent;
100 m_hostGroupID = UUID.Zero;
101 }
102
103 public string profileAbout
104 {
105 get { return m_profileAbout; }
106 set
107 {
108 if(value.Length > 255)
109 m_profileAbout = value.Substring(0,255);
110 else
111 m_profileAbout = value;
112 }
113 }
114
115 public UUID profileImage
116 {
117 get { return m_profileImage; }
118 set { m_profileImage = value; }
90 } 119 }
91 120
92 public IScene Scene 121 public IScene Scene
@@ -94,6 +123,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
94 get { return m_scene; } 123 get { return m_scene; }
95 } 124 }
96 125
126 public int PingTimeMS { get { return 0; } }
127
97 public UUID OwnerID 128 public UUID OwnerID
98 { 129 {
99 get { return m_ownerID; } 130 get { return m_ownerID; }
@@ -187,9 +218,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
187 { 218 {
188 219
189 } 220 }
190 221
191 public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot, 222 public void SendFindAgent(UUID HunterID, UUID PreyID, double GlobalX, double GlobalY)
192 Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook) 223 {
224
225 }
226
227 public void SendSitResponse(UUID TargetID, Vector3 OffsetPos,
228 Quaternion SitOrientation, bool autopilot,
229 Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
193 { 230 {
194 231
195 } 232 }
@@ -248,7 +285,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
248#pragma warning disable 67 285#pragma warning disable 67
249 public event Action<IClientAPI> OnLogout; 286 public event Action<IClientAPI> OnLogout;
250 public event ObjectPermissions OnObjectPermissions; 287 public event ObjectPermissions OnObjectPermissions;
251 288 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
252 public event MoneyTransferRequest OnMoneyTransferRequest; 289 public event MoneyTransferRequest OnMoneyTransferRequest;
253 public event ParcelBuy OnParcelBuy; 290 public event ParcelBuy OnParcelBuy;
254 public event Action<IClientAPI> OnConnectionClosed; 291 public event Action<IClientAPI> OnConnectionClosed;
@@ -268,6 +305,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
268 public event ObjectDrop OnObjectDrop; 305 public event ObjectDrop OnObjectDrop;
269 public event StartAnim OnStartAnim; 306 public event StartAnim OnStartAnim;
270 public event StopAnim OnStopAnim; 307 public event StopAnim OnStopAnim;
308 public event ChangeAnim OnChangeAnim;
271 public event LinkObjects OnLinkObjects; 309 public event LinkObjects OnLinkObjects;
272 public event DelinkObjects OnDelinkObjects; 310 public event DelinkObjects OnDelinkObjects;
273 public event RequestMapBlocks OnRequestMapBlocks; 311 public event RequestMapBlocks OnRequestMapBlocks;
@@ -280,6 +318,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
280 public event SetAlwaysRun OnSetAlwaysRun; 318 public event SetAlwaysRun OnSetAlwaysRun;
281 319
282 public event DeRezObject OnDeRezObject; 320 public event DeRezObject OnDeRezObject;
321 public event RezRestoreToWorld OnRezRestoreToWorld;
283 public event Action<IClientAPI> OnRegionHandShakeReply; 322 public event Action<IClientAPI> OnRegionHandShakeReply;
284 public event GenericCall1 OnRequestWearables; 323 public event GenericCall1 OnRequestWearables;
285 public event Action<IClientAPI, bool> OnCompleteMovementToRegion; 324 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
@@ -318,6 +357,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
318 public event UpdatePrimTexture OnUpdatePrimTexture; 357 public event UpdatePrimTexture OnUpdatePrimTexture;
319 public event UpdateVector OnUpdatePrimGroupPosition; 358 public event UpdateVector OnUpdatePrimGroupPosition;
320 public event UpdateVector OnUpdatePrimSinglePosition; 359 public event UpdateVector OnUpdatePrimSinglePosition;
360 public event ClientChangeObject onClientChangeObject;
321 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 361 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
322 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; 362 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
323 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 363 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
@@ -456,7 +496,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
456 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 496 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
457 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 497 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
458 public event ClassifiedDelete OnClassifiedDelete; 498 public event ClassifiedDelete OnClassifiedDelete;
459 public event ClassifiedDelete OnClassifiedGodDelete; 499 public event ClassifiedGodDelete OnClassifiedGodDelete;
460 500
461 public event EventNotificationAddRequest OnEventNotificationAddRequest; 501 public event EventNotificationAddRequest OnEventNotificationAddRequest;
462 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 502 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
@@ -479,7 +519,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
479 public event AvatarInterestUpdate OnAvatarInterestUpdate; 519 public event AvatarInterestUpdate OnAvatarInterestUpdate;
480 520
481 public event PlacesQuery OnPlacesQuery; 521 public event PlacesQuery OnPlacesQuery;
482 522
483 public event FindAgentUpdate OnFindAgent; 523 public event FindAgentUpdate OnFindAgent;
484 public event TrackAgentUpdate OnTrackAgent; 524 public event TrackAgentUpdate OnTrackAgent;
485 public event NewUserReport OnUserReport; 525 public event NewUserReport OnUserReport;
@@ -495,11 +535,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
495 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 535 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
496 public event SimWideDeletesDelegate OnSimWideDeletes; 536 public event SimWideDeletesDelegate OnSimWideDeletes;
497 public event SendPostcard OnSendPostcard; 537 public event SendPostcard OnSendPostcard;
538 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
498 public event MuteListEntryUpdate OnUpdateMuteListEntry; 539 public event MuteListEntryUpdate OnUpdateMuteListEntry;
499 public event MuteListEntryRemove OnRemoveMuteListEntry; 540 public event MuteListEntryRemove OnRemoveMuteListEntry;
500 public event GodlikeMessage onGodlikeMessage; 541 public event GodlikeMessage onGodlikeMessage;
501 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 542 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
502 543 public event GenericCall2 OnUpdateThrottles;
503#pragma warning restore 67 544#pragma warning restore 67
504 545
505 #endregion 546 #endregion
@@ -522,6 +563,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
522 public virtual UUID AgentId 563 public virtual UUID AgentId
523 { 564 {
524 get { return m_uuid; } 565 get { return m_uuid; }
566 set { m_uuid = value; }
525 } 567 }
526 568
527 public UUID SessionId 569 public UUID SessionId
@@ -562,24 +604,40 @@ namespace OpenSim.Region.OptionalModules.World.NPC
562 } 604 }
563 public UUID ActiveGroupId 605 public UUID ActiveGroupId
564 { 606 {
565 get { return UUID.Zero; } 607 get { return m_hostGroupID; }
608 set { m_hostGroupID = value; }
566 } 609 }
567 610
568 public string ActiveGroupName 611 public string ActiveGroupName
569 { 612 {
570 get { return String.Empty; } 613 get { return String.Empty; }
614 set { }
571 } 615 }
572 616
573 public ulong ActiveGroupPowers 617 public ulong ActiveGroupPowers
574 { 618 {
575 get { return 0; } 619 get { return 0; }
620 set { }
621 }
622
623 public string Born
624 {
625 get { return m_born; }
626 set { m_born = value; }
576 } 627 }
577 628
578 public bool IsGroupMember(UUID groupID) 629 public bool IsGroupMember(UUID groupID)
579 { 630 {
580 return false; 631 return (m_hostGroupID == groupID);
632 }
633
634 public Dictionary<UUID, ulong> GetGroupPowers()
635 {
636 return new Dictionary<UUID, ulong>();
581 } 637 }
582 638
639 public void SetGroupPowers(Dictionary<UUID, ulong> powers) { }
640
583 public ulong GetGroupPowers(UUID groupID) 641 public ulong GetGroupPowers(UUID groupID)
584 { 642 {
585 return 0; 643 return 0;
@@ -627,6 +685,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
627 public virtual void SetChildAgentThrottle(byte[] throttle) 685 public virtual void SetChildAgentThrottle(byte[] throttle)
628 { 686 {
629 } 687 }
688
689 public virtual void SetChildAgentThrottle(byte[] throttle, float factor)
690 {
691
692 }
693
694 public void SetAgentThrottleSilent(int throttle, int setting)
695 {
696
697
698 }
630 public byte[] GetThrottlesPacked(float multiplier) 699 public byte[] GetThrottlesPacked(float multiplier)
631 { 700 {
632 return new byte[0]; 701 return new byte[0];
@@ -665,6 +734,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
665 734
666 } 735 }
667 736
737 public virtual bool CanSendLayerData()
738 {
739 return false;
740 }
741
668 public virtual void SendLayerData(float[] map) 742 public virtual void SendLayerData(float[] map)
669 { 743 {
670 } 744 }
@@ -676,9 +750,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
676 { 750 {
677 } 751 }
678 752
679 public virtual void SendWindData(Vector2[] windSpeeds) { } 753 public virtual void SendWindData(int version, Vector2[] windSpeeds) { }
680 754
681 public virtual void SendCloudData(float[] cloudCover) { } 755 public virtual void SendCloudData(int version, float[] cloudCover) { }
682 756
683 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 757 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
684 { 758 {
@@ -739,7 +813,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
739 { 813 {
740 } 814 }
741 815
742 public void SendAvatarDataImmediate(ISceneEntity avatar) 816 public void SendEntityFullUpdateImmediate(ISceneEntity avatar)
817 {
818 }
819
820 public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
743 { 821 {
744 } 822 }
745 823
@@ -772,6 +850,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
772 { 850 {
773 } 851 }
774 852
853 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId)
854 {
855 }
856
775 public virtual void SendRemoveInventoryItem(UUID itemID) 857 public virtual void SendRemoveInventoryItem(UUID itemID)
776 { 858 {
777 } 859 }
@@ -788,7 +870,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
788 { 870 {
789 } 871 }
790 872
791 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) 873 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory)
792 { 874 {
793 } 875 }
794 public virtual void SendAbortXferPacket(ulong xferID) 876 public virtual void SendAbortXferPacket(ulong xferID)
@@ -833,6 +915,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
833 { 915 {
834 } 916 }
835 917
918 public void SendAlertMessage(string message, string info)
919 {
920 }
921
836 public void SendSystemAlertMessage(string message) 922 public void SendSystemAlertMessage(string message)
837 { 923 {
838 } 924 }
@@ -849,7 +935,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
849 OnRegionHandShakeReply(this); 935 OnRegionHandShakeReply(this);
850 } 936 }
851 } 937 }
852 938
853 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 939 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
854 { 940 {
855 } 941 }
@@ -869,7 +955,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
869 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec) 955 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
870 { 956 {
871 } 957 }
872 958
873 public void SendImageNotFound(UUID imageid) 959 public void SendImageNotFound(UUID imageid)
874 { 960 {
875 } 961 }
@@ -877,7 +963,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
877 public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData) 963 public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
878 { 964 {
879 } 965 }
880 966
881 public void SendShutdownConnectionNotice() 967 public void SendShutdownConnectionNotice()
882 { 968 {
883 } 969 }
@@ -888,7 +974,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
888 974
889 public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags) 975 public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
890 { 976 {
891 977
892 } 978 }
893 979
894 public void SendObjectPropertiesReply(ISceneEntity entity) 980 public void SendObjectPropertiesReply(ISceneEntity entity)
@@ -902,12 +988,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
902 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) 988 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
903 { 989 {
904 } 990 }
905 991
906 public void SendViewerTime(int phase) 992 public void SendViewerTime(int phase)
907 { 993 {
908 } 994 }
909 995
910 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, 996 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] membershipType,
911 string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, 997 string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL,
912 UUID partnerID) 998 UUID partnerID)
913 { 999 {
@@ -933,10 +1019,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
933 1019
934 public void Close() 1020 public void Close()
935 { 1021 {
936 Close(false); 1022 Close(true, false);
937 } 1023 }
938 1024
939 public void Close(bool force) 1025 public void Close(bool sendStop, bool force)
940 { 1026 {
941 // Remove ourselves from the scene 1027 // Remove ourselves from the scene
942 m_scene.RemoveClient(AgentId, false); 1028 m_scene.RemoveClient(AgentId, false);
@@ -947,7 +1033,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
947 // We never start the client, so always fail. 1033 // We never start the client, so always fail.
948 throw new NotImplementedException(); 1034 throw new NotImplementedException();
949 } 1035 }
950 1036
951 public void Stop() 1037 public void Stop()
952 { 1038 {
953 } 1039 }
@@ -1142,11 +1228,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1142 public void SendJoinGroupReply(UUID groupID, bool success) 1228 public void SendJoinGroupReply(UUID groupID, bool success)
1143 { 1229 {
1144 } 1230 }
1145 1231
1146 public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success) 1232 public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success)
1147 { 1233 {
1148 } 1234 }
1149 1235
1150 public void SendLeaveGroupReply(UUID groupID, bool success) 1236 public void SendLeaveGroupReply(UUID groupID, bool success)
1151 { 1237 {
1152 } 1238 }
@@ -1155,6 +1241,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1155 { 1241 {
1156 } 1242 }
1157 1243
1244 public void SendAgentGroupDataUpdate(UUID avatarID, GroupMembershipData[] data)
1245 {
1246 }
1247
1158 public void SendTerminateFriend(UUID exFriendID) 1248 public void SendTerminateFriend(UUID exFriendID)
1159 { 1249 {
1160 } 1250 }
@@ -1208,10 +1298,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1208 { 1298 {
1209 } 1299 }
1210 1300
1301 public void UpdateGroupMembership(GroupMembershipData[] data)
1302 {
1303 }
1304
1305 public void GroupMembershipRemove(UUID GroupID)
1306 {
1307 }
1308
1309 public void GroupMembershipAddReplace(UUID GroupID,ulong GroupPowers)
1310 {
1311 }
1312
1211 public void SendUseCachedMuteList() 1313 public void SendUseCachedMuteList()
1212 { 1314 {
1213 } 1315 }
1214 1316
1317 public void SendEmpytMuteList()
1318 {
1319 }
1320
1215 public void SendMuteListUpdate(string filename) 1321 public void SendMuteListUpdate(string filename)
1216 { 1322 {
1217 } 1323 }
@@ -1220,7 +1326,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1220 { 1326 {
1221 } 1327 }
1222 #endregion 1328 #endregion
1223 1329
1224 public void SendRebakeAvatarTextures(UUID textureID) 1330 public void SendRebakeAvatarTextures(UUID textureID)
1225 { 1331 {
1226 } 1332 }
@@ -1228,15 +1334,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1228 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) 1334 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
1229 { 1335 {
1230 } 1336 }
1231 1337
1232 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) 1338 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
1233 { 1339 {
1234 } 1340 }
1235 1341
1236 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier) 1342 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
1237 { 1343 {
1238 } 1344 }
1239 1345
1240 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1346 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1241 { 1347 {
1242 } 1348 }
@@ -1256,7 +1362,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1256 public void SendTextBoxRequest(string message, int chatChannel, string objectname, UUID ownerID, string ownerFirstName, string ownerLastName, UUID objectId) 1362 public void SendTextBoxRequest(string message, int chatChannel, string objectname, UUID ownerID, string ownerFirstName, string ownerLastName, UUID objectId)
1257 { 1363 {
1258 } 1364 }
1259 1365
1260 public void SendAgentTerseUpdate(ISceneEntity presence) 1366 public void SendAgentTerseUpdate(ISceneEntity presence)
1261 { 1367 {
1262 } 1368 }
@@ -1265,9 +1371,22 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1265 { 1371 {
1266 } 1372 }
1267 1373
1374 public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
1375 {
1376 }
1377
1268 public void SendPartPhysicsProprieties(ISceneEntity entity) 1378 public void SendPartPhysicsProprieties(ISceneEntity entity)
1269 { 1379 {
1270 } 1380 }
1271 1381
1382 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
1383 {
1384 }
1385
1386 public int GetAgentThrottleSilent(int throttle)
1387 {
1388 return 0;
1389 }
1390
1272 } 1391 }
1273} 1392}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 3b94dff..ced82e6 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -52,6 +52,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
52 private Dictionary<UUID, NPCAvatar> m_avatars = 52 private Dictionary<UUID, NPCAvatar> m_avatars =
53 new Dictionary<UUID, NPCAvatar>(); 53 new Dictionary<UUID, NPCAvatar>();
54 54
55
56
57 private NPCOptionsFlags m_NPCOptionFlags;
58 public NPCOptionsFlags NPCOptionFlags {get {return m_NPCOptionFlags;}}
59
55 public bool Enabled { get; private set; } 60 public bool Enabled { get; private set; }
56 61
57 public void Initialise(IConfigSource source) 62 public void Initialise(IConfigSource source)
@@ -59,6 +64,21 @@ namespace OpenSim.Region.OptionalModules.World.NPC
59 IConfig config = source.Configs["NPC"]; 64 IConfig config = source.Configs["NPC"];
60 65
61 Enabled = (config != null && config.GetBoolean("Enabled", false)); 66 Enabled = (config != null && config.GetBoolean("Enabled", false));
67 m_NPCOptionFlags = NPCOptionsFlags.None;
68 if(Enabled)
69 {
70 if(config.GetBoolean("AllowNotOwned", true))
71 m_NPCOptionFlags |= NPCOptionsFlags.AllowNotOwned;
72
73 if(config.GetBoolean("AllowSenseAsAvatar", true))
74 m_NPCOptionFlags |= NPCOptionsFlags.AllowSenseAsAvatar;
75
76 if(config.GetBoolean("AllowCloneOtherAvatars", true))
77 m_NPCOptionFlags |= NPCOptionsFlags.AllowCloneOtherAvatars;
78
79 if(config.GetBoolean("NoNPCGroup", true))
80 m_NPCOptionFlags |= NPCOptionsFlags.NoNPCGroup;
81 }
62 } 82 }
63 83
64 public void AddRegion(Scene scene) 84 public void AddRegion(Scene scene)
@@ -137,17 +157,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC
137 } 157 }
138 158
139 public UUID CreateNPC(string firstname, string lastname, 159 public UUID CreateNPC(string firstname, string lastname,
140 Vector3 position, UUID owner, bool senseAsAgent, Scene scene, 160 Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
141 AvatarAppearance appearance) 161 AvatarAppearance appearance)
142 { 162 {
143 return CreateNPC(firstname, lastname, position, UUID.Zero, owner, senseAsAgent, scene, appearance); 163 return CreateNPC(firstname, lastname, position, UUID.Zero, owner, "", UUID.Zero, senseAsAgent, scene, appearance);
144 } 164 }
145 165
146 public UUID CreateNPC(string firstname, string lastname, 166 public UUID CreateNPC(string firstname, string lastname,
147 Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene, 167 Vector3 position, UUID agentID, UUID owner, string groupTitle, UUID groupID, bool senseAsAgent, Scene scene,
148 AvatarAppearance appearance) 168 AvatarAppearance appearance)
149 { 169 {
150 NPCAvatar npcAvatar = null; 170 NPCAvatar npcAvatar = null;
171 string born = DateTime.UtcNow.ToString();
151 172
152 try 173 try
153 { 174 {
@@ -167,10 +188,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
167 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, 188 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0,
168 int.MaxValue); 189 int.MaxValue);
169 190
170 m_log.DebugFormat( 191// m_log.DebugFormat(
171 "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", 192// "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
172 firstname, lastname, npcAvatar.AgentId, owner, 193// firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName);
173 senseAsAgent, position, scene.RegionInfo.RegionName);
174 194
175 AgentCircuitData acd = new AgentCircuitData(); 195 AgentCircuitData acd = new AgentCircuitData();
176 acd.AgentID = npcAvatar.AgentId; 196 acd.AgentID = npcAvatar.AgentId;
@@ -181,30 +201,44 @@ namespace OpenSim.Region.OptionalModules.World.NPC
181 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 201 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
182 acd.Appearance = npcAppearance; 202 acd.Appearance = npcAppearance;
183 203
184 lock (m_avatars) 204 /*
205 for (int i = 0;
206 i < acd.Appearance.Texture.FaceTextures.Length; i++)
185 { 207 {
186 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, 208 m_log.DebugFormat(
187 acd); 209 "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
188 scene.AddNewAgent(npcAvatar, PresenceType.Npc); 210 acd.AgentID, i,
211 acd.Appearance.Texture.FaceTextures[i]);
212 }
213 */
189 214
190 ScenePresence sp; 215// ManualResetEvent ev = new ManualResetEvent(false);
191 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
192 {
193 sp.CompleteMovement(npcAvatar, false);
194 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
195 m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name);
196 216
197 return npcAvatar.AgentId; 217// Util.FireAndForget(delegate(object x) {
198 } 218 lock (m_avatars)
199 else
200 { 219 {
201 m_log.WarnFormat( 220 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
202 "[NPC MODULE]: Could not find scene presence for NPC {0} {1}", 221 scene.AddNewAgent(npcAvatar, PresenceType.Npc);
203 sp.Name, sp.UUID);
204 222
205 return UUID.Zero; 223 ScenePresence sp;
224 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
225 {
226 npcAvatar.Born = born;
227 npcAvatar.ActiveGroupId = groupID;
228 sp.CompleteMovement(npcAvatar, false);
229 sp.Grouptitle = groupTitle;
230 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
231// m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name);
232 }
206 } 233 }
207 } 234// ev.Set();
235// });
236
237// ev.WaitOne();
238
239// m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
240
241 return npcAvatar.AgentId;
208 } 242 }
209 243
210 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, 244 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos,
@@ -220,6 +254,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
220 if (sp.IsSatOnObject || sp.SitGround) 254 if (sp.IsSatOnObject || sp.SitGround)
221 return false; 255 return false;
222 256
257// m_log.DebugFormat(
258// "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
259// sp.Name, pos, scene.RegionInfo.RegionName,
260// noFly, landAtTarget);
261
223 sp.MoveToTarget(pos, noFly, landAtTarget); 262 sp.MoveToTarget(pos, noFly, landAtTarget);
224 sp.SetAlwaysRun = running; 263 sp.SetAlwaysRun = running;
225 264
@@ -382,6 +421,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
382 { 421 {
383 if (m_avatars.TryGetValue(agentID, out av)) 422 if (m_avatars.TryGetValue(agentID, out av))
384 { 423 {
424 /*
425 m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
426 agentID, av.Name);
427 */
385 doRemove = true; 428 doRemove = true;
386 } 429 }
387 } 430 }
@@ -410,9 +453,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
410 { 453 {
411 NPCAvatar av; 454 NPCAvatar av;
412 if (m_avatars.TryGetValue(npcID, out av)) 455 if (m_avatars.TryGetValue(npcID, out av))
456 {
457 if (npcID == callerID)
458 return true;
413 return CheckPermissions(av, callerID); 459 return CheckPermissions(av, callerID);
460 }
414 else 461 else
462 {
415 return false; 463 return false;
464 }
416 } 465 }
417 } 466 }
418 467
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 77dfd40..9a1ea73 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
112 // ScenePresence.SendInitialData() to reset our entire appearance. 112 // ScenePresence.SendInitialData() to reset our entire appearance.
113 m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); 113 m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
114 114
115 m_afMod.SetAppearance(sp, originalTe, null, null); 115 m_afMod.SetAppearance(sp, originalTe, null, new WearableCacheItem[0] );
116 116
117 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); 117 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
118 118
@@ -209,10 +209,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
209 UserAccountHelpers.CreateUserWithInventory(m_scene, userId); 209 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
210 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); 210 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
211 211
212 InventoryItemBase att1Item 212 InventoryItemBase att1Item
213 = UserInventoryHelpers.CreateInventoryItem( 213 = UserInventoryHelpers.CreateInventoryItem(
214 m_scene, "att1", TestHelpers.ParseTail(0x2), TestHelpers.ParseTail(0x3), sp.UUID, InventoryType.Object); 214 m_scene, "att1", TestHelpers.ParseTail(0x2), TestHelpers.ParseTail(0x3), sp.UUID, InventoryType.Object);
215 InventoryItemBase att2Item 215 InventoryItemBase att2Item
216 = UserInventoryHelpers.CreateInventoryItem( 216 = UserInventoryHelpers.CreateInventoryItem(
217 m_scene, "att2", TestHelpers.ParseTail(0x12), TestHelpers.ParseTail(0x13), sp.UUID, InventoryType.Object); 217 m_scene, "att2", TestHelpers.ParseTail(0x12), TestHelpers.ParseTail(0x13), sp.UUID, InventoryType.Object);
218 218
@@ -483,4 +483,4 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
483 Assert.That(npc.ParentID, Is.EqualTo(0)); 483 Assert.That(npc.ParentID, Is.EqualTo(0));
484 } 484 }
485 } 485 }
486} \ No newline at end of file 486}