/
EventSink.cs
2601 lines (2156 loc) · 60.1 KB
/
EventSink.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
#region References
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using Server.Accounting;
using Server.Commands;
using Server.ContextMenus;
using Server.Guilds;
using Server.Items;
using Server.Network;
#endregion
namespace Server
{
public delegate void OnItemObtainedEventHandler(OnItemObtainedEventArgs e);
public delegate void CheckEquipItemEventHandler(CheckEquipItemEventArgs e);
public delegate void ContextMenuEventHandler(ContextMenuEventArgs e);
public delegate void WorldBroadcastEventHandler(WorldBroadcastEventArgs e);
public delegate void CharacterCreatedEventHandler(CharacterCreatedEventArgs e);
public delegate void OpenDoorMacroEventHandler(OpenDoorMacroEventArgs e);
public delegate void SpeechEventHandler(SpeechEventArgs e);
public delegate void LoginEventHandler(LoginEventArgs e);
public delegate void ServerListEventHandler(ServerListEventArgs e);
public delegate void MovementEventHandler(MovementEventArgs e);
public delegate void HungerChangedEventHandler(HungerChangedEventArgs e);
public delegate void CrashedEventHandler(CrashedEventArgs e);
public delegate void ShutdownEventHandler(ShutdownEventArgs e);
public delegate void HelpRequestEventHandler(HelpRequestEventArgs e);
public delegate void DisarmRequestEventHandler(DisarmRequestEventArgs e);
public delegate void StunRequestEventHandler(StunRequestEventArgs e);
public delegate void OpenSpellbookRequestEventHandler(OpenSpellbookRequestEventArgs e);
public delegate void CastSpellRequestEventHandler(CastSpellRequestEventArgs e);
public delegate void BandageTargetRequestEventHandler(BandageTargetRequestEventArgs e);
public delegate void AnimateRequestEventHandler(AnimateRequestEventArgs e);
public delegate void LogoutEventHandler(LogoutEventArgs e);
public delegate void SocketConnectEventHandler(SocketConnectEventArgs e);
public delegate void ConnectedEventHandler(ConnectedEventArgs e);
public delegate void DisconnectedEventHandler(DisconnectedEventArgs e);
public delegate void RenameRequestEventHandler(RenameRequestEventArgs e);
public delegate void PlayerDeathEventHandler(PlayerDeathEventArgs e);
public delegate void CreatureDeathEventHandler(CreatureDeathEventArgs e);
public delegate void VirtueGumpRequestEventHandler(VirtueGumpRequestEventArgs e);
public delegate void VirtueItemRequestEventHandler(VirtueItemRequestEventArgs e);
public delegate void VirtueMacroRequestEventHandler(VirtueMacroRequestEventArgs e);
public delegate void AccountLoginEventHandler(AccountLoginEventArgs e);
public delegate void PaperdollRequestEventHandler(PaperdollRequestEventArgs e);
public delegate void ProfileRequestEventHandler(ProfileRequestEventArgs e);
public delegate void ChangeProfileRequestEventHandler(ChangeProfileRequestEventArgs e);
public delegate void AggressiveActionEventHandler(AggressiveActionEventArgs e);
public delegate void GameLoginEventHandler(GameLoginEventArgs e);
public delegate void DeleteRequestEventHandler(DeleteRequestEventArgs e);
public delegate void WorldLoadEventHandler();
public delegate void WorldSaveEventHandler(WorldSaveEventArgs e);
public delegate void BeforeWorldSaveEventHandler(BeforeWorldSaveEventArgs e);
public delegate void AfterWorldSaveEventHandler(AfterWorldSaveEventArgs e);
public delegate void SetAbilityEventHandler(SetAbilityEventArgs e);
public delegate void FastWalkEventHandler(FastWalkEventArgs e);
public delegate void ServerStartedEventHandler();
public delegate void CreateGuildHandler(CreateGuildEventArgs e);
public delegate void GuildGumpRequestHandler(GuildGumpRequestArgs e);
public delegate void QuestGumpRequestHandler(QuestGumpRequestArgs e);
public delegate void ClientVersionReceivedHandler(ClientVersionReceivedArgs e);
public delegate void ClientTypeReceivedHandler(ClientTypeReceivedArgs e);
public delegate void OnKilledByEventHandler(OnKilledByEventArgs e);
public delegate void OnItemUseEventHandler(OnItemUseEventArgs e);
public delegate void OnEnterRegionEventHandler(OnEnterRegionEventArgs e);
public delegate void OnConsumeEventHandler(OnConsumeEventArgs e);
public delegate void OnPropertyChangedEventHandler(OnPropertyChangedEventArgs e);
public delegate void BODUsedEventHandler(BODUsedEventArgs e);
public delegate void BODOfferEventHandler(BODOfferEventArgs e);
public delegate void ResourceHarvestAttemptEventHandler(ResourceHarvestAttemptEventArgs e);
public delegate void ResourceHarvestSuccessEventHandler(ResourceHarvestSuccessEventArgs e);
public delegate void CraftSuccessEventHandler(CraftSuccessEventArgs e);
public delegate void SkillGainEventHandler(SkillGainEventArgs e);
public delegate void SkillCheckEventHandler(SkillCheckEventArgs e);
public delegate void SkillCapChangeEventHandler(SkillCapChangeEventArgs e);
public delegate void StatCapChangeEventHandler(StatCapChangeEventArgs e);
public delegate void QuestCompleteEventHandler(QuestCompleteEventArgs e);
public delegate void ItemCreatedEventHandler(ItemCreatedEventArgs e);
public delegate void ItemDeletedEventHandler(ItemDeletedEventArgs e);
public delegate void MobileCreatedEventHandler(MobileCreatedEventArgs e);
public delegate void MobileDeletedEventHandler(MobileDeletedEventArgs e);
public delegate void TargetedSpellEventHandler(TargetedSpellEventArgs e);
public delegate void TargetedSkillEventHandler(TargetedSkillEventArgs e);
public delegate void TargetedItemUseEventHandler(TargetedItemUseEventArgs e);
public delegate void EquipMacroEventHandler(EquipMacroEventArgs e);
public delegate void UnequipMacroEventHandler(UnequipMacroEventArgs e);
public delegate void TargetByResourceMacroEventHandler(TargetByResourceMacroEventArgs e);
public delegate void JoinGuildEventHandler(JoinGuildEventArgs e);
public delegate void TameCreatureEventHandler(TameCreatureEventArgs e);
public delegate void ValidVendorPurchaseEventHandler(ValidVendorPurchaseEventArgs e);
public delegate void ValidVendorSellEventHandler(ValidVendorSellEventArgs e);
public delegate void CorpseLootEventHandler(CorpseLootEventArgs e);
public delegate void RepairItemEventHandler(RepairItemEventArgs e);
public delegate void AlterItemEventHandler(AlterItemEventArgs e);
public delegate void PlacePlayerVendorEventHandler(PlacePlayerVendorEventArgs e);
public delegate void FameChangeEventHandler(FameChangeEventArgs e);
public delegate void KarmaChangeEventHandler(KarmaChangeEventArgs e);
public delegate void VirtueLevelChangeEventHandler(VirtueLevelChangeEventArgs e);
public delegate void PlayerMurderedEventHandler(PlayerMurderedEventArgs e);
public delegate void AccountGoldChangeEventHandler(AccountGoldChangeEventArgs e);
public delegate void ContainerDroppedToEventHandler(ContainerDroppedToEventArgs e);
public delegate void TeleportMovementEventHandler(TeleportMovementEventArgs e);
public delegate void MultiDesignQueryHandler(MultiDesignQueryEventArgs e);
public class OnItemObtainedEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly Item m_Item;
public OnItemObtainedEventArgs(Mobile from, Item item)
{
m_Mobile = from;
m_Item = item;
}
public Mobile Mobile => m_Mobile;
public Item Item => m_Item;
}
public class CheckEquipItemEventArgs : EventArgs
{
public Mobile Mobile { get; }
public Item Item { get; }
public bool Message { get; }
public bool Block { get; set; }
public CheckEquipItemEventArgs(Mobile m, Item item, bool message)
{
Mobile = m;
Item = item;
Message = message;
}
}
public class ContextMenuEventArgs : EventArgs
{
public Mobile Mobile { get; }
public IEntity Target { get; }
public List<ContextMenuEntry> Entries { get; }
public ContextMenuEventArgs(Mobile m, IEntity target, List<ContextMenuEntry> entries)
{
Mobile = m;
Target = target;
Entries = entries;
}
}
public class WorldBroadcastEventArgs : EventArgs
{
public int Hue { get; set; }
public bool Ascii { get; set; }
public AccessLevel Access { get; set; }
public string Text { get; set; }
public WorldBroadcastEventArgs(int hue, bool ascii, AccessLevel access, string text)
{
Hue = hue;
Ascii = ascii;
Access = access;
Text = text;
}
}
public class ClientVersionReceivedArgs : EventArgs
{
private readonly NetState m_State;
private readonly ClientVersion m_Version;
public NetState State => m_State;
public ClientVersion Version => m_Version;
public ClientVersionReceivedArgs(NetState state, ClientVersion cv)
{
m_State = state;
m_Version = cv;
}
}
public class ClientTypeReceivedArgs : EventArgs
{
private readonly NetState m_State;
public NetState State => m_State;
public ClientTypeReceivedArgs(NetState state)
{
m_State = state;
}
}
public class CreateGuildEventArgs : EventArgs
{
public int Id { get; set; }
public BaseGuild Guild { get; set; }
public CreateGuildEventArgs(int id)
{
Id = id;
}
}
public class GuildGumpRequestArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public GuildGumpRequestArgs(Mobile mobile)
{
m_Mobile = mobile;
}
}
public class QuestGumpRequestArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public QuestGumpRequestArgs(Mobile mobile)
{
m_Mobile = mobile;
}
}
public class SetAbilityEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly int m_Index;
public Mobile Mobile => m_Mobile;
public int Index => m_Index;
public SetAbilityEventArgs(Mobile mobile, int index)
{
m_Mobile = mobile;
m_Index = index;
}
}
public class DeleteRequestEventArgs : EventArgs
{
private readonly NetState m_State;
private readonly int m_Index;
public NetState State => m_State;
public int Index => m_Index;
public DeleteRequestEventArgs(NetState state, int index)
{
m_State = state;
m_Index = index;
}
}
public class GameLoginEventArgs : EventArgs
{
private readonly NetState m_State;
private readonly string m_Username;
private readonly string m_Password;
public NetState State => m_State;
public string Username => m_Username;
public string Password => m_Password;
public bool Accepted { get; set; }
public CityInfo[] CityInfo { get; set; }
public GameLoginEventArgs(NetState state, string un, string pw)
{
m_State = state;
m_Username = un;
m_Password = pw;
}
}
public class AggressiveActionEventArgs : EventArgs
{
private Mobile m_Aggressed;
private Mobile m_Aggressor;
private bool m_Criminal;
public Mobile Aggressed => m_Aggressed;
public Mobile Aggressor => m_Aggressor;
public bool Criminal => m_Criminal;
private static readonly Queue<AggressiveActionEventArgs> m_Pool = new Queue<AggressiveActionEventArgs>();
public static AggressiveActionEventArgs Create(Mobile aggressed, Mobile aggressor, bool criminal)
{
AggressiveActionEventArgs args;
if (m_Pool.Count > 0)
{
args = m_Pool.Dequeue();
args.m_Aggressed = aggressed;
args.m_Aggressor = aggressor;
args.m_Criminal = criminal;
}
else
{
args = new AggressiveActionEventArgs(aggressed, aggressor, criminal);
}
return args;
}
private AggressiveActionEventArgs(Mobile aggressed, Mobile aggressor, bool criminal)
{
m_Aggressed = aggressed;
m_Aggressor = aggressor;
m_Criminal = criminal;
}
public void Free()
{
m_Pool.Enqueue(this);
}
}
public class ProfileRequestEventArgs : EventArgs
{
private readonly Mobile m_Beholder;
private readonly Mobile m_Beheld;
public Mobile Beholder => m_Beholder;
public Mobile Beheld => m_Beheld;
public ProfileRequestEventArgs(Mobile beholder, Mobile beheld)
{
m_Beholder = beholder;
m_Beheld = beheld;
}
}
public class ChangeProfileRequestEventArgs : EventArgs
{
private readonly Mobile m_Beholder;
private readonly Mobile m_Beheld;
private readonly string m_Text;
public Mobile Beholder => m_Beholder;
public Mobile Beheld => m_Beheld;
public string Text => m_Text;
public ChangeProfileRequestEventArgs(Mobile beholder, Mobile beheld, string text)
{
m_Beholder = beholder;
m_Beheld = beheld;
m_Text = text;
}
}
public class PaperdollRequestEventArgs : EventArgs
{
private readonly Mobile m_Beholder;
private readonly Mobile m_Beheld;
public Mobile Beholder => m_Beholder;
public Mobile Beheld => m_Beheld;
public PaperdollRequestEventArgs(Mobile beholder, Mobile beheld)
{
m_Beholder = beholder;
m_Beheld = beheld;
}
}
public class AccountLoginEventArgs : EventArgs
{
private readonly NetState m_State;
private readonly string m_Username;
private readonly string m_Password;
public NetState State => m_State;
public string Username => m_Username;
public string Password => m_Password;
public bool Accepted { get; set; }
public ALRReason RejectReason { get; set; }
public AccountLoginEventArgs(NetState state, string username, string password)
{
m_State = state;
m_Username = username;
m_Password = password;
Accepted = true;
}
}
public class VirtueItemRequestEventArgs : EventArgs
{
private readonly Mobile m_Beholder;
private readonly Mobile m_Beheld;
private readonly int m_GumpID;
public Mobile Beholder => m_Beholder;
public Mobile Beheld => m_Beheld;
public int GumpID => m_GumpID;
public VirtueItemRequestEventArgs(Mobile beholder, Mobile beheld, int gumpID)
{
m_Beholder = beholder;
m_Beheld = beheld;
m_GumpID = gumpID;
}
}
public class VirtueGumpRequestEventArgs : EventArgs
{
private readonly Mobile m_Beholder;
private readonly Mobile m_Beheld;
public Mobile Beholder => m_Beholder;
public Mobile Beheld => m_Beheld;
public VirtueGumpRequestEventArgs(Mobile beholder, Mobile beheld)
{
m_Beholder = beholder;
m_Beheld = beheld;
}
}
public class VirtueMacroRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly int m_VirtueID;
public Mobile Mobile => m_Mobile;
public int VirtueID => m_VirtueID;
public VirtueMacroRequestEventArgs(Mobile mobile, int virtueID)
{
m_Mobile = mobile;
m_VirtueID = virtueID;
}
}
public class PlayerDeathEventArgs : EventArgs
{
public Mobile Mobile { get; }
public Mobile Killer { get; }
public Container Corpse { get; }
public PlayerDeathEventArgs(Mobile mobile)
: this(mobile, mobile.LastKiller, mobile.Corpse)
{ }
public PlayerDeathEventArgs(Mobile mobile, Mobile killer, Container corpse)
{
Mobile = mobile;
Killer = killer;
Corpse = corpse;
}
}
public class CreatureDeathEventArgs : EventArgs
{
public Mobile Creature { get; }
public Mobile Killer { get; }
public Container Corpse { get; }
public List<Item> ForcedLoot { get; private set; }
public bool PreventDefault { get; set; }
public bool PreventDelete { get; set; }
public bool ClearCorpse { get; set; }
public CreatureDeathEventArgs(Mobile creature)
: this(creature, creature.LastKiller, creature.Corpse)
{ }
public CreatureDeathEventArgs(Mobile creature, Mobile killer, Container corpse)
{
Creature = creature;
Killer = killer;
Corpse = corpse;
ForcedLoot = new List<Item>();
}
public void ClearLoot(bool free)
{
if (free)
{
ForcedLoot.Clear();
ForcedLoot.TrimExcess();
}
else
{
ForcedLoot = new List<Item>();
}
}
}
public class RenameRequestEventArgs : EventArgs
{
private readonly Mobile m_From;
private readonly Mobile m_Target;
private readonly string m_Name;
public Mobile From => m_From;
public Mobile Target => m_Target;
public string Name => m_Name;
public RenameRequestEventArgs(Mobile from, Mobile target, string name)
{
m_From = from;
m_Target = target;
m_Name = name;
}
}
public class LogoutEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public LogoutEventArgs(Mobile m)
{
m_Mobile = m;
}
}
public class SocketConnectEventArgs : EventArgs
{
private readonly Socket m_Socket;
public Socket Socket => m_Socket;
public bool AllowConnection { get; set; }
public SocketConnectEventArgs(Socket s)
{
m_Socket = s;
AllowConnection = true;
}
}
public class ConnectedEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public ConnectedEventArgs(Mobile m)
{
m_Mobile = m;
}
}
public class DisconnectedEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public DisconnectedEventArgs(Mobile m)
{
m_Mobile = m;
}
}
public class AnimateRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly string m_Action;
public Mobile Mobile => m_Mobile;
public string Action => m_Action;
public AnimateRequestEventArgs(Mobile m, string action)
{
m_Mobile = m;
m_Action = action;
}
}
public class CastSpellRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly Item m_Spellbook;
private readonly int m_SpellID;
public Mobile Mobile => m_Mobile;
public Item Spellbook => m_Spellbook;
public int SpellID => m_SpellID;
public CastSpellRequestEventArgs(Mobile m, int spellID, Item book)
{
m_Mobile = m;
m_Spellbook = book;
m_SpellID = spellID;
}
}
public class BandageTargetRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly Item m_Bandage;
private readonly Mobile m_Target;
public Mobile Mobile => m_Mobile;
public Item Bandage => m_Bandage;
public Mobile Target => m_Target;
public BandageTargetRequestEventArgs(Mobile m, Item bandage, Mobile target)
{
m_Mobile = m;
m_Bandage = bandage;
m_Target = target;
}
}
public class OpenSpellbookRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly int m_Type;
public Mobile Mobile => m_Mobile;
public int Type => m_Type;
public OpenSpellbookRequestEventArgs(Mobile m, int type)
{
m_Mobile = m;
m_Type = type;
}
}
public class StunRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public StunRequestEventArgs(Mobile m)
{
m_Mobile = m;
}
}
public class DisarmRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public DisarmRequestEventArgs(Mobile m)
{
m_Mobile = m;
}
}
public class HelpRequestEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public HelpRequestEventArgs(Mobile m)
{
m_Mobile = m;
}
}
public class ShutdownEventArgs : EventArgs
{ }
public class CrashedEventArgs : EventArgs
{
private readonly Exception m_Exception;
public Exception Exception => m_Exception;
public bool Close { get; set; }
public CrashedEventArgs(Exception e)
{
m_Exception = e;
}
}
public class HungerChangedEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
private readonly int m_OldValue;
public Mobile Mobile => m_Mobile;
public int OldValue => m_OldValue;
public HungerChangedEventArgs(Mobile mobile, int oldValue)
{
m_Mobile = mobile;
m_OldValue = oldValue;
}
}
public class MovementEventArgs : EventArgs
{
private Mobile m_Mobile;
private Direction m_Direction;
private bool m_Blocked;
public Mobile Mobile => m_Mobile;
public Direction Direction => m_Direction;
public bool Blocked { get => m_Blocked; set => m_Blocked = value; }
private static readonly Queue<MovementEventArgs> m_Pool = new Queue<MovementEventArgs>();
public static MovementEventArgs Create(Mobile mobile, Direction dir)
{
MovementEventArgs args;
if (m_Pool.Count > 0)
{
args = m_Pool.Dequeue();
args.m_Mobile = mobile;
args.m_Direction = dir;
args.m_Blocked = false;
}
else
{
args = new MovementEventArgs(mobile, dir);
}
return args;
}
public MovementEventArgs(Mobile mobile, Direction dir)
{
m_Mobile = mobile;
m_Direction = dir;
}
public void Free()
{
m_Pool.Enqueue(this);
}
}
public class ServerListEventArgs : EventArgs
{
private readonly NetState m_State;
private readonly IAccount m_Account;
private readonly List<ServerInfo> m_Servers;
public NetState State => m_State;
public IAccount Account => m_Account;
public bool Rejected { get; set; }
public List<ServerInfo> Servers => m_Servers;
public void AddServer(string name, IPEndPoint address)
{
AddServer(name, 0, TimeZone.CurrentTimeZone, address);
}
public void AddServer(string name, int fullPercent, TimeZone tz, IPEndPoint address)
{
m_Servers.Add(new ServerInfo(name, fullPercent, tz, address));
}
public ServerListEventArgs(NetState state, IAccount account)
{
m_State = state;
m_Account = account;
m_Servers = new List<ServerInfo>();
}
}
public struct SkillNameValue
{
private readonly SkillName m_Name;
private readonly int m_Value;
public SkillName Name => m_Name;
public int Value => m_Value;
public SkillNameValue(SkillName name, int value)
{
m_Name = name;
m_Value = value;
}
}
public class CharacterCreatedEventArgs : EventArgs
{
private readonly NetState m_State;
private readonly IAccount m_Account;
private readonly CityInfo m_City;
private readonly SkillNameValue[] m_Skills;
private readonly int m_ShirtHue;
private readonly int m_PantsHue;
private readonly int m_HairID;
private readonly int m_HairHue;
private readonly int m_BeardID;
private readonly int m_BeardHue;
private readonly string m_Name;
private readonly bool m_Female;
private readonly int m_Hue;
private readonly int m_Str;
private readonly int m_Dex;
private readonly int m_Int;
private readonly Race m_Race;
private readonly int m_Face;
private readonly int m_FaceHue;
public NetState State => m_State;
public IAccount Account => m_Account;
public Mobile Mobile { get; set; }
public string Name => m_Name;
public bool Female => m_Female;
public int Hue => m_Hue;
public int Str => m_Str;
public int Dex => m_Dex;
public int Int => m_Int;
public CityInfo City => m_City;
public SkillNameValue[] Skills => m_Skills;
public int ShirtHue => m_ShirtHue;
public int PantsHue => m_PantsHue;
public int HairID => m_HairID;
public int HairHue => m_HairHue;
public int BeardID => m_BeardID;
public int BeardHue => m_BeardHue;
public int Profession { get; set; }
public Race Race => m_Race;
public int FaceID => m_Face;
public int FaceHue => m_FaceHue;
public CharacterCreatedEventArgs(
NetState state,
IAccount a,
string name,
bool female,
int hue,
int str,
int dex,
int intel,
CityInfo city,
SkillNameValue[] skills,
int shirtHue,
int pantsHue,
int hairID,
int hairHue,
int beardID,
int beardHue,
int profession,
Race race)
: this(state, a, name, female, hue, str, dex, intel, city, skills, shirtHue, pantsHue, hairID, hairHue, beardID, beardHue, profession, race, 0, 0)
{
}
public CharacterCreatedEventArgs(
NetState state,
IAccount a,
string name,
bool female,
int hue,
int str,
int dex,
int intel,
CityInfo city,
SkillNameValue[] skills,
int shirtHue,
int pantsHue,
int hairID,
int hairHue,
int beardID,
int beardHue,
int profession,
Race race,
int faceID,
int faceHue)
{
m_State = state;
m_Account = a;
m_Name = name;
m_Female = female;
m_Hue = hue;
m_Str = str;
m_Dex = dex;
m_Int = intel;
m_City = city;
m_Skills = skills;
m_ShirtHue = shirtHue;
m_PantsHue = pantsHue;
m_HairID = hairID;
m_HairHue = hairHue;
m_BeardID = beardID;
m_BeardHue = beardHue;
Profession = profession;
m_Race = race;
m_Face = faceID;
m_FaceHue = faceHue;
}
}
public class OpenDoorMacroEventArgs : EventArgs
{
private readonly Mobile m_Mobile;
public Mobile Mobile => m_Mobile;
public OpenDoorMacroEventArgs(Mobile mobile)
{
m_Mobile = mobile;