forked from cinderblocks/libremetaverse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAgentManager.cs
5708 lines (5037 loc) · 233 KB
/
AgentManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2006-2016, openmetaverse.co
* Copyright (c) 2019-2024, Sjofn LLC
* All rights reserved.
*
* - Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Neither the name of the openmetaverse.co nor the names
* of its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using OpenMetaverse.StructuredData;
using OpenMetaverse.Assets;
using OpenMetaverse.Packets;
using OpenMetaverse.Interfaces;
using OpenMetaverse.Messages.Linden;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections;
namespace OpenMetaverse
{
#region Enums
/// <summary>
/// Permission request flags, asked when a script wants to control an Avatar
/// </summary>
[Flags]
public enum ScriptPermission : int
{
/// <summary>Placeholder for empty values, shouldn't ever see this</summary>
None = 0,
/// <summary>Script wants ability to take money from you</summary>
Debit = 1 << 1,
/// <summary>Script wants to take camera controls for you</summary>
TakeControls = 1 << 2,
/// <summary>Script wants to remap avatars controls</summary>
RemapControls = 1 << 3,
/// <summary>Script wants to trigger avatar animations</summary>
/// <remarks>This function is not implemented on the grid</remarks>
TriggerAnimation = 1 << 4,
/// <summary>Script wants to attach or detach the prim or primset to your avatar</summary>
Attach = 1 << 5,
/// <summary>Script wants permission to release ownership</summary>
/// <remarks>This function is not implemented on the grid
/// The concept of "public" objects does not exist anymore.</remarks>
ReleaseOwnership = 1 << 6,
/// <summary>Script wants ability to link/delink with other prims</summary>
ChangeLinks = 1 << 7,
/// <summary>Script wants permission to change joints</summary>
/// <remarks>This function is not implemented on the grid</remarks>
ChangeJoints = 1 << 8,
/// <summary>Script wants permissions to change permissions</summary>
/// <remarks>This function is not implemented on the grid</remarks>
ChangePermissions = 1 << 9,
/// <summary>Script wants to track avatars camera position and rotation </summary>
TrackCamera = 1 << 10,
/// <summary>Script wants to control your camera</summary>
ControlCamera = 1 << 11,
/// <summary>Script wants the ability to teleport you</summary>
Teleport = 1 << 12
}
/// <summary>
/// Special commands used in Instant Messages
/// </summary>
public enum InstantMessageDialog : byte
{
/// <summary>Indicates a regular IM from another agent</summary>
MessageFromAgent = 0,
/// <summary>Simple notification box with an OK button</summary>
MessageBox = 1,
// <summary>Used to show a countdown notification with an OK
// button, deprecated now</summary>
//[Obsolete]
//MessageBoxCountdown = 2,
/// <summary>You've been invited to join a group.</summary>
GroupInvitation = 3,
/// <summary>Inventory offer</summary>
InventoryOffered = 4,
/// <summary>Accepted inventory offer</summary>
InventoryAccepted = 5,
/// <summary>Declined inventory offer</summary>
InventoryDeclined = 6,
/// <summary>Group vote</summary>
GroupVote = 7,
// <summary>A message to everyone in the agent's group, no longer
// used</summary>
//[Obsolete]
//DeprecatedGroupMessage = 8,
/// <summary>An object is offering its inventory</summary>
TaskInventoryOffered = 9,
/// <summary>Accept an inventory offer from an object</summary>
TaskInventoryAccepted = 10,
/// <summary>Decline an inventory offer from an object</summary>
TaskInventoryDeclined = 11,
/// <summary>Unknown</summary>
NewUserDefault = 12,
/// <summary>Start a session, or add users to a session</summary>
SessionAdd = 13,
/// <summary>Start a session, but don't prune offline users</summary>
SessionOfflineAdd = 14,
/// <summary>Start a session with your group</summary>
SessionGroupStart = 15,
/// <summary>Start a session without a calling card (finder or objects)</summary>
SessionCardlessStart = 16,
/// <summary>Send a message to a session</summary>
SessionSend = 17,
/// <summary>Leave a session</summary>
SessionDrop = 18,
/// <summary>Indicates that the IM is from an object</summary>
MessageFromObject = 19,
/// <summary>Sent an IM to a busy user, this is the auto response</summary>
BusyAutoResponse = 20,
/// <summary>Shows the message in the console and chat history</summary>
ConsoleAndChatHistory = 21,
/// <summary>Send a teleport lure</summary>
RequestTeleport = 22,
/// <summary>Response sent to the agent who initiated a teleport invitation</summary>
AcceptTeleport = 23,
/// <summary>Response sent to the agent who initiated a teleport invitation</summary>
DenyTeleport = 24,
/// <summary>Forceful admin teleport</summary>
GodLikeRequestTeleport = 25,
/// <summary>Request a teleport lure</summary>
RequestLure = 26,
// <summary>Notification of a new group election, this is
// deprecated</summary>
//[Obsolete]
//DeprecatedGroupElection = 27,
/// <summary>IM to tell the user to go to an URL</summary>
GotoUrl = 28,
/// <summary>IM for help</summary>
Session911Start = 29,
/// <summary>IM sent automatically on call for help, sends a lure
/// to each Helper reached</summary>
Lure911 = 30,
/// <summary>Like an IM but won't go to email</summary>
FromTaskAsAlert = 31,
/// <summary>IM from a group officer to all group members</summary>
GroupNotice = 32,
/// <summary>Unknown</summary>
GroupNoticeInventoryAccepted = 33,
/// <summary>Unknown</summary>
GroupNoticeInventoryDeclined = 34,
/// <summary>Accept a group invitation</summary>
GroupInvitationAccept = 35,
/// <summary>Decline a group invitation</summary>
GroupInvitationDecline = 36,
/// <summary>Unknown</summary>
GroupNoticeRequested = 37,
/// <summary>An avatar is offering you friendship</summary>
FriendshipOffered = 38,
/// <summary>An avatar has accepted your friendship offer</summary>
FriendshipAccepted = 39,
/// <summary>An avatar has declined your friendship offer</summary>
FriendshipDeclined = 40,
/// <summary>Indicates that a user has started typing</summary>
StartTyping = 41,
/// <summary>Indicates that a user has stopped typing</summary>
StopTyping = 42
}
/// <summary>
/// Flag in Instant Messages, whether the IM should be delivered to
/// offline avatars as well
/// </summary>
public enum InstantMessageOnline
{
/// <summary>Only deliver to online avatars</summary>
Online = 0,
/// <summary>If the avatar is offline the message will be held until
/// they login next, and possibly forwarded to their e-mail account</summary>
Offline = 1
}
/// <summary>
/// Conversion type to denote Chat Packet types in an easier-to-understand format
/// </summary>
public enum ChatType : byte
{
/// <summary>Whisper (5m radius)</summary>
Whisper = 0,
/// <summary>Normal chat (10/20m radius), what the official viewer typically sends</summary>
Normal = 1,
/// <summary>Shouting! (100m radius)</summary>
Shout = 2,
// <summary>Say chat (10/20m radius) - The official viewer will
// print "[4:15] You say, hey" instead of "[4:15] You: hey"</summary>
//[Obsolete]
//Say = 3,
/// <summary>Event message when an Avatar has begun to type</summary>
StartTyping = 4,
/// <summary>Event message when an Avatar has stopped typing</summary>
StopTyping = 5,
/// <summary>Send the message to the debug channel</summary>
Debug = 6,
/// <summary>Event message when an object uses llOwnerSay</summary>
OwnerSay = 8,
/// <summary>Event message when an object uses llRegionSayTo</summary>
RegionSayTo = 9,
/// <summary>Special value to support llRegionSay, never sent to the client</summary>
RegionSay = byte.MaxValue,
}
/// <summary>
/// Identifies the source of a chat message
/// </summary>
public enum ChatSourceType : byte
{
/// <summary>Chat from the grid or simulator</summary>
System = 0,
/// <summary>Chat from another avatar</summary>
Agent = 1,
/// <summary>Chat from an object</summary>
Object = 2
}
/// <summary>
///
/// </summary>
public enum ChatAudibleLevel : sbyte
{
/// <summary></summary>
Not = -1,
/// <summary></summary>
Barely = 0,
/// <summary></summary>
Fully = 1
}
/// <summary>
/// Effect type used in ViewerEffect packets
/// </summary>
public enum EffectType : byte
{
/// <summary></summary>
Text = 0,
/// <summary></summary>
Icon,
/// <summary></summary>
Connector,
/// <summary></summary>
FlexibleObject,
/// <summary></summary>
AnimalControls,
/// <summary></summary>
AnimationObject,
/// <summary></summary>
Cloth,
/// <summary>Project a beam from a source to a destination, such as
/// the one used when editing an object</summary>
Beam,
/// <summary></summary>
Glow,
/// <summary></summary>
Point,
/// <summary></summary>
Trail,
/// <summary>Create a swirl of particles around an object</summary>
Sphere,
/// <summary></summary>
Spiral,
/// <summary></summary>
Edit,
/// <summary>Cause an avatar to look at an object</summary>
LookAt,
/// <summary>Cause an avatar to point at an object</summary>
PointAt
}
/// <summary>
/// The action an avatar is doing when looking at something, used in
/// ViewerEffect packets for the LookAt effect
/// </summary>
public enum LookAtType : byte
{
/// <summary></summary>
None,
/// <summary></summary>
Idle,
/// <summary></summary>
AutoListen,
/// <summary></summary>
FreeLook,
/// <summary></summary>
Respond,
/// <summary></summary>
Hover,
/// <summary>Deprecated</summary>
[Obsolete]
Conversation,
/// <summary></summary>
Select,
/// <summary></summary>
Focus,
/// <summary></summary>
Mouselook,
/// <summary></summary>
Clear
}
/// <summary>
/// The action an avatar is doing when pointing at something, used in
/// ViewerEffect packets for the PointAt effect
/// </summary>
public enum PointAtType : byte
{
/// <summary></summary>
None,
/// <summary></summary>
Select,
/// <summary></summary>
Grab,
/// <summary></summary>
Clear
}
/// <summary>
/// Money transaction types
/// </summary>
public enum MoneyTransactionType : int
{
/// <summary></summary>
None = 0,
/// <summary></summary>
FailSimulatorTimeout = 1,
/// <summary></summary>
FailDataserverTimeout = 2,
/// <summary></summary>
ObjectClaim = 1000,
/// <summary></summary>
LandClaim = 1001,
/// <summary></summary>
GroupCreate = 1002,
/// <summary></summary>
ObjectPublicClaim = 1003,
/// <summary></summary>
GroupJoin = 1004,
/// <summary></summary>
TeleportCharge = 1100,
/// <summary></summary>
UploadCharge = 1101,
/// <summary></summary>
LandAuction = 1102,
/// <summary></summary>
ClassifiedCharge = 1103,
/// <summary></summary>
ObjectTax = 2000,
/// <summary></summary>
LandTax = 2001,
/// <summary></summary>
LightTax = 2002,
/// <summary></summary>
ParcelDirFee = 2003,
/// <summary></summary>
GroupTax = 2004,
/// <summary></summary>
ClassifiedRenew = 2005,
/// <summary></summary>
GiveInventory = 3000,
/// <summary></summary>
ObjectSale = 5000,
/// <summary></summary>
Gift = 5001,
/// <summary></summary>
LandSale = 5002,
/// <summary></summary>
ReferBonus = 5003,
/// <summary></summary>
InventorySale = 5004,
/// <summary></summary>
RefundPurchase = 5005,
/// <summary></summary>
LandPassSale = 5006,
/// <summary></summary>
DwellBonus = 5007,
/// <summary></summary>
PayObject = 5008,
/// <summary></summary>
ObjectPays = 5009,
/// <summary></summary>
GroupLandDeed = 6001,
/// <summary></summary>
GroupObjectDeed = 6002,
/// <summary></summary>
GroupLiability = 6003,
/// <summary></summary>
GroupDividend = 6004,
/// <summary></summary>
GroupMembershipDues = 6005,
/// <summary></summary>
ObjectRelease = 8000,
/// <summary></summary>
LandRelease = 8001,
/// <summary></summary>
ObjectDelete = 8002,
/// <summary></summary>
ObjectPublicDecay = 8003,
/// <summary></summary>
ObjectPublicDelete = 8004,
/// <summary></summary>
LindenAdjustment = 9000,
/// <summary></summary>
LindenGrant = 9001,
/// <summary></summary>
LindenPenalty = 9002,
/// <summary></summary>
EventFee = 9003,
/// <summary></summary>
EventPrize = 9004,
/// <summary></summary>
StipendBasic = 10000,
/// <summary></summary>
StipendDeveloper = 10001,
/// <summary></summary>
StipendAlways = 10002,
/// <summary></summary>
StipendDaily = 10003,
/// <summary></summary>
StipendRating = 10004,
/// <summary></summary>
StipendDelta = 10005
}
/// <summary>
///
/// </summary>
[Flags]
public enum TransactionFlags : byte
{
/// <summary></summary>
None = 0,
/// <summary></summary>
SourceGroup = 1,
/// <summary></summary>
DestGroup = 2,
/// <summary></summary>
OwnerGroup = 4,
/// <summary></summary>
SimultaneousContribution = 8,
/// <summary></summary>
ContributionRemoval = 16
}
/// <summary>
///
/// </summary>
public enum MeanCollisionType : byte
{
/// <summary></summary>
None,
/// <summary></summary>
Bump,
/// <summary></summary>
LLPushObject,
/// <summary></summary>
SelectedObjectCollide,
/// <summary></summary>
ScriptedObjectCollide,
/// <summary></summary>
PhysicalObjectCollide
}
/// <summary>
/// Flags sent when a script takes or releases a control
/// </summary>
/// <remarks>NOTE: (need to verify) These might be a subset of the ControlFlags enum in Movement,</remarks>
[Flags]
public enum ScriptControlChange : uint
{
/// <summary>No Flags set</summary>
None = 0,
/// <summary>Forward (W or up Arrow)</summary>
Forward = 1,
/// <summary>Back (S or down arrow)</summary>
Back = 2,
/// <summary>Move left (shift+A or left arrow)</summary>
Left = 4,
/// <summary>Move right (shift+D or right arrow)</summary>
Right = 8,
/// <summary>Up (E or PgUp)</summary>
Up = 16,
/// <summary>Down (C or PgDown)</summary>
Down = 32,
/// <summary>Rotate left (A or left arrow)</summary>
RotateLeft = 256,
/// <summary>Rotate right (D or right arrow)</summary>
RotateRight = 512,
/// <summary>Left Mouse Button</summary>
LeftButton = 268435456,
/// <summary>Left Mouse button in MouseLook</summary>
MouseLookLeftButton = 1073741824
}
/// <summary>
/// Currently only used to hide your group title
/// </summary>
[Flags]
public enum AgentFlags : byte
{
/// <summary>No flags set</summary>
None = 0,
/// <summary>Hide your group title</summary>
HideTitle = 0x01,
}
/// <summary>
/// Action state of the avatar, which can currently be typing and
/// editing
/// </summary>
[Flags]
public enum AgentState : byte
{
/// <summary></summary>
None = 0x00,
/// <summary></summary>
Typing = 0x04,
/// <summary></summary>
Editing = 0x10
}
/// <summary>
/// Current teleport status
/// </summary>
public enum TeleportStatus
{
/// <summary>Unknown status</summary>
None,
/// <summary>Teleport initialized</summary>
Start,
/// <summary>Teleport in progress</summary>
Progress,
/// <summary>Teleport failed</summary>
Failed,
/// <summary>Teleport completed</summary>
Finished,
/// <summary>Teleport cancelled</summary>
Cancelled
}
/// <summary>
///
/// </summary>
[Flags]
public enum TeleportFlags : uint
{
/// <summary>No flags set, or teleport failed</summary>
Default = 0,
/// <summary>Set when newbie leaves help island for first time</summary>
SetHomeToTarget = 1 << 0,
/// <summary></summary>
SetLastToTarget = 1 << 1,
/// <summary>Via Lure</summary>
ViaLure = 1 << 2,
/// <summary>Via Landmark</summary>
ViaLandmark = 1 << 3,
/// <summary>Via Location</summary>
ViaLocation = 1 << 4,
/// <summary>Via Home</summary>
ViaHome = 1 << 5,
/// <summary>Via Telehub</summary>
ViaTelehub = 1 << 6,
/// <summary>Via Login</summary>
ViaLogin = 1 << 7,
/// <summary>Linden Summoned</summary>
ViaGodlikeLure = 1 << 8,
/// <summary>Linden Forced me</summary>
Godlike = 1 << 9,
/// <summary></summary>
NineOneOne = 1 << 10,
/// <summary>Agent Teleported Home via Script</summary>
DisableCancel = 1 << 11,
/// <summary></summary>
ViaRegionID = 1 << 12,
/// <summary></summary>
IsFlying = 1 << 13,
/// <summary></summary>
ResetHome = 1 << 14,
/// <summary>forced to new location for example when avatar is banned or ejected</summary>
ForceRedirect = 1 << 15,
/// <summary>Teleport Finished via a Lure</summary>
FinishedViaLure = 1 << 26,
/// <summary>Finished, Sim Changed</summary>
FinishedViaNewSim = 1 << 28,
/// <summary>Finished, Same Sim</summary>
FinishedViaSameSim = 1 << 29
}
/// <summary>
///
/// </summary>
[Flags]
public enum TeleportLureFlags
{
/// <summary></summary>
NormalLure = 0,
/// <summary></summary>
GodlikeLure = 1,
/// <summary></summary>
GodlikePursuit = 2
}
/// <summary>
///
/// </summary>
[Flags]
public enum ScriptSensorTypeFlags
{
/// <summary></summary>
Agent = 1,
/// <summary></summary>
Active = 2,
/// <summary></summary>
Passive = 4,
/// <summary></summary>
Scripted = 8,
}
/// <summary>
/// Type of mute entry
/// </summary>
public enum MuteType
{
/// <summary>Object muted by name</summary>
ByName = 0,
/// <summary>Muted resident</summary>
Resident = 1,
/// <summary>Object muted by UUID</summary>
Object = 2,
/// <summary>Muted group</summary>
Group = 3,
/// <summary>Muted external entry</summary>
External = 4
}
/// <summary>
/// Flags of mute entry
/// </summary>
[Flags]
public enum MuteFlags : int
{
/// <summary>No exceptions</summary>
Default = 0x0,
/// <summary>Don't mute text chat</summary>
TextChat = 0x1,
/// <summary>Don't mute voice chat</summary>
VoiceChat = 0x2,
/// <summary>Don't mute particles</summary>
Particles = 0x4,
/// <summary>Don't mute sounds</summary>
ObjectSounds = 0x8,
/// <summary>Don't mute</summary>
All = 0xf
}
#endregion Enums
#region Structs
/// <summary>
/// Instant Message
/// </summary>
public struct InstantMessage
{
/// <summary>Key of sender</summary>
public UUID FromAgentID;
/// <summary>Name of sender</summary>
public string FromAgentName;
/// <summary>Key of destination avatar</summary>
public UUID ToAgentID;
/// <summary>ID of originating estate</summary>
public uint ParentEstateID;
/// <summary>Key of originating region</summary>
public UUID RegionID;
/// <summary>Coordinates in originating region</summary>
public Vector3 Position;
/// <summary>Instant message type</summary>
public InstantMessageDialog Dialog;
/// <summary>Group IM session toggle</summary>
public bool GroupIM;
/// <summary>Key of IM session, for Group Messages, the groups UUID</summary>
public UUID IMSessionID;
/// <summary>Timestamp of the instant message</summary>
public DateTime Timestamp;
/// <summary>Instant message text</summary>
public string Message;
/// <summary>Whether this message is held for offline avatars</summary>
public InstantMessageOnline Offline;
/// <summary>Context specific packed data</summary>
public byte[] BinaryBucket;
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
public override string ToString()
{
return Helpers.StructToString(this);
}
}
/// <summary>Represents muted object or resident</summary>
public class MuteEntry
{
/// <summary>Type of the mute entry</summary>
public MuteType Type;
/// <summary>UUID of the mute etnry</summary>
public UUID ID;
/// <summary>Mute entry name</summary>
public string Name;
/// <summary>Mute flags</summary>
public MuteFlags Flags;
}
/// <summary>Transaction detail sent with MoneyBalanceReply message</summary>
public class TransactionInfo
{
/// <summary>Type of the transaction</summary>
public int TransactionType; // FIXME: this should be an enum
/// <summary>UUID of the transaction source</summary>
public UUID SourceID;
/// <summary>Is the transaction source a group</summary>
public bool IsSourceGroup;
/// <summary>UUID of the transaction destination</summary>
public UUID DestID;
/// <summary>Is transaction destination a group</summary>
public bool IsDestGroup;
/// <summary>Transaction amount</summary>
public int Amount;
/// <summary>Transaction description</summary>
public string ItemDescription;
}
#endregion Structs
/// <summary>
/// Manager class for our own avatar
/// </summary>
public partial class AgentManager
{
#region Delegates
/// <summary>
/// Called once attachment resource usage information has been collected
/// </summary>
/// <param name="success">Indicates if operation was successfull</param>
/// <param name="info">Attachment resource usage information</param>
public delegate void AttachmentResourcesCallback(bool success, AttachmentResourcesMessage info);
#endregion Delegates
#region Event Delegates
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<ChatEventArgs> m_Chat;
/// <summary>Raises the ChatFromSimulator event</summary>
/// <param name="e">A ChatEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnChat(ChatEventArgs e)
{
EventHandler<ChatEventArgs> handler = m_Chat;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_ChatLock = new object();
/// <summary>Raised when a scripted object or agent within range sends a public message</summary>
public event EventHandler<ChatEventArgs> ChatFromSimulator
{
add { lock (m_ChatLock) { m_Chat += value; } }
remove { lock (m_ChatLock) { m_Chat -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<ScriptDialogEventArgs> m_ScriptDialog;
/// <summary>Raises the ScriptDialog event</summary>
/// <param name="e">A ScriptDialogEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnScriptDialog(ScriptDialogEventArgs e)
{
EventHandler<ScriptDialogEventArgs> handler = m_ScriptDialog;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_ScriptDialogLock = new object();
/// <summary>Raised when a scripted object sends a dialog box containing possible
/// options an agent can respond to</summary>
public event EventHandler<ScriptDialogEventArgs> ScriptDialog
{
add { lock (m_ScriptDialogLock) { m_ScriptDialog += value; } }
remove { lock (m_ScriptDialogLock) { m_ScriptDialog -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<ScriptQuestionEventArgs> m_ScriptQuestion;
/// <summary>Raises the ScriptQuestion event</summary>
/// <param name="e">A ScriptQuestionEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnScriptQuestion(ScriptQuestionEventArgs e)
{
EventHandler<ScriptQuestionEventArgs> handler = m_ScriptQuestion;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_ScriptQuestionLock = new object();
/// <summary>Raised when an object requests a change in the permissions an agent has permitted</summary>
public event EventHandler<ScriptQuestionEventArgs> ScriptQuestion
{
add { lock (m_ScriptQuestionLock) { m_ScriptQuestion += value; } }
remove { lock (m_ScriptQuestionLock) { m_ScriptQuestion -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<LoadUrlEventArgs> m_LoadURL;
/// <summary>Raises the LoadURL event</summary>
/// <param name="e">A LoadUrlEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnLoadURL(LoadUrlEventArgs e)
{
EventHandler<LoadUrlEventArgs> handler = m_LoadURL;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_LoadUrlLock = new object();
/// <summary>Raised when a script requests an agent open the specified URL</summary>
public event EventHandler<LoadUrlEventArgs> LoadURL
{
add { lock (m_LoadUrlLock) { m_LoadURL += value; } }
remove { lock (m_LoadUrlLock) { m_LoadURL -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<BalanceEventArgs> m_Balance;
/// <summary>Raises the MoneyBalance event</summary>
/// <param name="e">A BalanceEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnBalance(BalanceEventArgs e)
{
EventHandler<BalanceEventArgs> handler = m_Balance;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_BalanceLock = new object();
/// <summary>Raised when an agents currency balance is updated</summary>
public event EventHandler<BalanceEventArgs> MoneyBalance
{
add { lock (m_BalanceLock) { m_Balance += value; } }
remove { lock (m_BalanceLock) { m_Balance -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<MoneyBalanceReplyEventArgs> m_MoneyBalance;
/// <summary>Raises the MoneyBalanceReply event</summary>
/// <param name="e">A MoneyBalanceReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnMoneyBalanceReply(MoneyBalanceReplyEventArgs e)
{
EventHandler<MoneyBalanceReplyEventArgs> handler = m_MoneyBalance;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_MoneyBalanceReplyLock = new object();
/// <summary>Raised when a transaction occurs involving currency such as a land purchase</summary>
public event EventHandler<MoneyBalanceReplyEventArgs> MoneyBalanceReply
{
add { lock (m_MoneyBalanceReplyLock) { m_MoneyBalance += value; } }
remove { lock (m_MoneyBalanceReplyLock) { m_MoneyBalance -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<InstantMessageEventArgs> m_InstantMessage;
/// <summary>Raises the IM event</summary>
/// <param name="e">A InstantMessageEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnInstantMessage(InstantMessageEventArgs e)
{
EventHandler<InstantMessageEventArgs> handler = m_InstantMessage;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_InstantMessageLock = new object();
/// <summary>Raised when an ImprovedInstantMessage packet is received from the simulator, this is used for everything from
/// private messaging to friendship offers. The Dialog field defines what type of message has arrived</summary>
public event EventHandler<InstantMessageEventArgs> IM
{
add { lock (m_InstantMessageLock) { m_InstantMessage += value; } }
remove { lock (m_InstantMessageLock) { m_InstantMessage -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<TeleportEventArgs> m_Teleport;
/// <summary>Raises the TeleportProgress event</summary>
/// <param name="e">A TeleportEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnTeleport(TeleportEventArgs e)
{
EventHandler<TeleportEventArgs> handler = m_Teleport;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_TeleportLock = new object();
/// <summary>Raised when an agent has requested a teleport to another location, or when responding to a lure. Raised multiple times
/// for each teleport indicating the progress of the request</summary>
public event EventHandler<TeleportEventArgs> TeleportProgress
{
add { lock (m_TeleportLock) { m_Teleport += value; } }
remove { lock (m_TeleportLock) { m_Teleport += value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<AgentDataReplyEventArgs> m_AgentData;
/// <summary>Raises the AgentDataReply event</summary>
/// <param name="e">A AgentDataReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnAgentData(AgentDataReplyEventArgs e)
{
EventHandler<AgentDataReplyEventArgs> handler = m_AgentData;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_AgentDataLock = new object();
/// <summary>Raised when a simulator sends agent specific information for our avatar.</summary>
public event EventHandler<AgentDataReplyEventArgs> AgentDataReply
{
add { lock (m_AgentDataLock) { m_AgentData += value; } }
remove { lock (m_AgentDataLock) { m_AgentData -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<AnimationsChangedEventArgs> m_AnimationsChanged;
/// <summary>Raises the AnimationsChanged event</summary>
/// <param name="e">A AnimationsChangedEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnAnimationsChanged(AnimationsChangedEventArgs e)
{
EventHandler<AnimationsChangedEventArgs> handler = m_AnimationsChanged;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>
private readonly object m_AnimationsChangedLock = new object();
/// <summary>Raised when our agents animation playlist changes</summary>
public event EventHandler<AnimationsChangedEventArgs> AnimationsChanged
{
add { lock (m_AnimationsChangedLock) { m_AnimationsChanged += value; } }
remove { lock (m_AnimationsChangedLock) { m_AnimationsChanged -= value; } }
}
/// <summary>The event subscribers. null if no subscribers</summary>
private EventHandler<MeanCollisionEventArgs> m_MeanCollision;
/// <summary>Raises the MeanCollision event</summary>
/// <param name="e">A MeanCollisionEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnMeanCollision(MeanCollisionEventArgs e)
{
EventHandler<MeanCollisionEventArgs> handler = m_MeanCollision;
handler?.Invoke(this, e);
}
/// <summary>Thread sync lock object</summary>