-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventLogger.cs
1462 lines (1336 loc) · 80.7 KB
/
EventLogger.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
/* EventLogger.cs - Procon Plugin [BF3, BF4, BFH, BC2]
Version: 1.0.0.0
Development by maxdralle@gmx.com
This plugin file is part of PRoCon Frostbite.
This plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PRoCon Frostbite. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Collections;
using System.Net;
using System.Web;
using System.Data;
using System.Threading;
using System.Timers;
using System.Diagnostics;
using System.Reflection;
using System.Linq;
using PRoCon.Core;
using PRoCon.Core.Plugin;
using PRoCon.Core.Plugin.Commands;
using PRoCon.Core.Players;
using PRoCon.Core.Players.Items;
using PRoCon.Core.Battlemap;
using PRoCon.Core.Maps;
using MySql.Data.MySqlClient;
namespace PRoConEvents {
//Aliases
using EventType = PRoCon.Core.Events.EventType;
using CapturableEvent = PRoCon.Core.Events.CapturableEvents;
public class EventLogger : PRoConPluginAPI, IPRoConPluginInterface {
/* Inherited:
this.PunkbusterPlayerInfoList = new Dictionary<String, CPunkbusterInfo>();
this.FrostbitePlayerInfoList = new Dictionary<String, CPlayerInfo>();
*/
private bool fIsEnabled;
private string ServerIP;
private string ServerPort;
private DateTime OnRoundOverTime = DateTime.UtcNow;
private enumBoolYesNo SettingPlayerDisconnectedChat;
private enumBoolYesNo SettingPlayerDisconnectedConsole;
private enumBoolYesNo SettingPlayerDisconnectedLogfile;
private enumBoolYesNo SettingPlayerDisconnectedDB;
private enumBoolYesNo SettingPlayerKickedChat;
private enumBoolYesNo SettingPlayerKickedConsole;
private enumBoolYesNo SettingPlayerKickedLogfile;
private enumBoolYesNo SettingPlayerKickedDB;
private enumBoolYesNo SettingPlayerKickedByAdminChat;
private enumBoolYesNo SettingPlayerKickedByAdminConsole;
private enumBoolYesNo SettingPlayerKickedByAdminLogfile;
private enumBoolYesNo SettingPlayerKickedByAdminDB;
private enumBoolYesNo SettingPlayerKilledByAdminChat;
private enumBoolYesNo SettingPlayerKilledByAdminConsole;
private enumBoolYesNo SettingPlayerKilledByAdminLogfile;
private enumBoolYesNo SettingPlayerKilledByAdminDB;
private enumBoolYesNo SettingPlayerMovedByAdminChat;
private enumBoolYesNo SettingPlayerMovedByAdminConsole;
private enumBoolYesNo SettingPlayerMovedByAdminLogfile;
private enumBoolYesNo SettingPlayerMovedByAdminDB;
private enumBoolYesNo SettingPlayerForceMovedByAdminChat;
private enumBoolYesNo SettingPlayerForceMovedByAdminConsole;
private enumBoolYesNo SettingPlayerForceMovedByAdminLogfile;
private enumBoolYesNo SettingPlayerForceMovedByAdminDB;
private enumBoolYesNo SettingBanAddedChat;
private enumBoolYesNo SettingBanAddedConsole;
private enumBoolYesNo SettingBanAddedLogfile;
private enumBoolYesNo SettingBanAddedDB;
private enumBoolYesNo SettingTimeBanAddedChat;
private enumBoolYesNo SettingTimeBanAddedConsole;
private enumBoolYesNo SettingTimeBanAddedLogfile;
private enumBoolYesNo SettingTimeBanAddedDB;
private enumBoolYesNo SettingProconLayerChat;
private enumBoolYesNo SettingProconLayerConsole;
private enumBoolYesNo SettingProconLayerLogfile;
private enumBoolYesNo SettingProconLayerDB;
private List<string> tmpLogfile = new List<string>();
private List<string> AdkatsBanCheckList = new List<string>();
private Dictionary<String, DateTime> onJoinTime = new Dictionary<string, DateTime>();
private Dictionary<String, DateTime> AdkatsBanChecked = new Dictionary<string, DateTime>();
private Dictionary<String, String> AdkatsBanned = new Dictionary<string, String>();
private Dictionary<String, String> GuidToNameList = new Dictionary<string, String>();
private string SettingFilterPlayername;
private string SettingFilterReason;
private enumBoolYesNo SettingNoEmptyStringInDisReason;
private enumBoolYesNo SettingBetweenRoundsNoLog;
private enumBoolYesNo SettingUsePassword;
private string SettingPassword;
private string SettingPasswordCheck;
private string SettingFilterAutoBan;
private enumBoolYesNo SettingLocked;
private enumBoolYesNo SettingEnableBanEnforcer;
private enumBoolYesNo SettingEnableBanEnforcerOnlyPerma;
private string SettingAdkatsDBIP;
private string SettingAdkatsDBName;
private string SettingAdkatsDBUser;
private string SettingAdkatsDBPw;
private string SettingAdkatsBanReason;
private int SettingAdkatsSyncTime;
private enumBoolYesNo SettingSqlEnabled;
private string SettingStrSqlHostname;
private string SettingStrSqlPort;
private string SettingStrSqlDatabase;
private string SettingStrSqlUsername;
private string SettingStrSqlPassword;
private string SettingStrSqlGameserver;
private int SettingDBCleaner;
private DateTime LayerStartingTime = DateTime.UtcNow;
private DateTime lastOnListPlayersTS = DateTime.UtcNow;
private DateTime lastAdkatsSyncTS = DateTime.UtcNow;
private int fDebugLevel;
private bool SqlTableExist;
public EventLogger() {
this.fIsEnabled = false;
this.ServerIP = String.Empty;
this.ServerPort = String.Empty;
this.SettingPlayerDisconnectedChat = enumBoolYesNo.Yes;
this.SettingPlayerDisconnectedConsole = enumBoolYesNo.Yes;
this.SettingPlayerDisconnectedLogfile = enumBoolYesNo.Yes;
this.SettingPlayerDisconnectedDB = enumBoolYesNo.No;
this.SettingPlayerKickedChat = enumBoolYesNo.No;
this.SettingPlayerKickedConsole = enumBoolYesNo.No;
this.SettingPlayerKickedLogfile = enumBoolYesNo.No;
this.SettingPlayerKickedDB = enumBoolYesNo.No;
this.SettingPlayerKickedByAdminChat = enumBoolYesNo.No;
this.SettingPlayerKickedByAdminConsole = enumBoolYesNo.No;
this.SettingPlayerKickedByAdminLogfile = enumBoolYesNo.No;
this.SettingPlayerKickedByAdminDB = enumBoolYesNo.No;
this.SettingPlayerKilledByAdminChat = enumBoolYesNo.No;
this.SettingPlayerKilledByAdminConsole = enumBoolYesNo.No;
this.SettingPlayerKilledByAdminLogfile = enumBoolYesNo.No;
this.SettingPlayerKilledByAdminDB = enumBoolYesNo.No;
this.SettingPlayerMovedByAdminChat = enumBoolYesNo.No;
this.SettingPlayerMovedByAdminConsole = enumBoolYesNo.No;
this.SettingPlayerMovedByAdminLogfile = enumBoolYesNo.No;
this.SettingPlayerMovedByAdminDB = enumBoolYesNo.No;
this.SettingPlayerForceMovedByAdminChat = enumBoolYesNo.No;
this.SettingPlayerForceMovedByAdminConsole = enumBoolYesNo.No;
this.SettingPlayerForceMovedByAdminLogfile = enumBoolYesNo.No;
this.SettingPlayerForceMovedByAdminDB = enumBoolYesNo.No;
this.SettingBanAddedChat = enumBoolYesNo.No;
this.SettingBanAddedConsole = enumBoolYesNo.No;
this.SettingBanAddedLogfile = enumBoolYesNo.No;
this.SettingBanAddedDB = enumBoolYesNo.No;
this.SettingTimeBanAddedChat = enumBoolYesNo.No;
this.SettingTimeBanAddedConsole = enumBoolYesNo.No;
this.SettingTimeBanAddedLogfile = enumBoolYesNo.No;
this.SettingTimeBanAddedDB = enumBoolYesNo.No;
this.SettingProconLayerChat = enumBoolYesNo.No;
this.SettingProconLayerConsole = enumBoolYesNo.No;
this.SettingProconLayerLogfile = enumBoolYesNo.No;
this.SettingProconLayerDB = enumBoolYesNo.No;
this.SettingFilterAutoBan = "^Restricted Area!$|^Restricted Area$|^PunkBuster kicked player.*Cheater banned by GGC-Stream.NET*Ban on GUID|^PunkBuster kicked player.*Cheater banned by GGC-Stream.*Ban on GUID|^PunkBuster permanent ban issued on this Game Server for player|^PunkBuster kicked player.*Violation.*AIMBOT|^PunkBuster kicked player.*Violation.*MULTIHACK|^PunkBuster kicked player.*Violation.*WALLHACK|^PunkBuster kicked player.*Violation.*GAME HACK|^PunkBuster kicked player.*Violation.*GAMEHACK|^PunkBuster kicked player.*enforced a previous MBi Ban for|BF4DB.*Appeal at.*bf4db.com/player/ban";
this.SettingFilterPlayername = String.Empty;
this.SettingFilterReason = "PLAYER_CONN_LOST|Service Communication Failure|PLAYER_LEFT|Missing Content";
this.SettingNoEmptyStringInDisReason = enumBoolYesNo.Yes;
this.SettingBetweenRoundsNoLog = enumBoolYesNo.Yes;
this.SettingEnableBanEnforcer = enumBoolYesNo.No;
this.SettingEnableBanEnforcerOnlyPerma = enumBoolYesNo.No;
this.SettingAdkatsDBIP = String.Empty;
this.SettingAdkatsDBName = String.Empty;
this.SettingAdkatsDBUser = String.Empty;
this.SettingAdkatsDBPw = String.Empty;
this.SettingAdkatsBanReason = "Shared Ban for %player% ...";
this.SettingAdkatsSyncTime = 20;
this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Layer restart detected.");
this.SettingUsePassword = enumBoolYesNo.No;
this.SettingPassword = String.Empty;
this.SettingPasswordCheck = String.Empty;
this.SettingLocked = enumBoolYesNo.No;
this.SettingStrSqlHostname = String.Empty;
this.SettingStrSqlPort = "3306";
this.SettingStrSqlDatabase = String.Empty;
this.SettingStrSqlUsername = String.Empty;
this.SettingStrSqlPassword = String.Empty;
this.SettingStrSqlGameserver = "#0 xy";
this.SettingDBCleaner = 3;
this.SettingSqlEnabled = enumBoolYesNo.No;
this.fDebugLevel = 3;
this.SqlTableExist = false;
}
public enum MessageType { Warning, Error, Exception, Normal };
public String FormatMessage(String msg, MessageType type) {
String prefix = "[Event Logger] ";
if (type.Equals(MessageType.Warning))
prefix += "^1^bWARNING^0^n: ";
else if (type.Equals(MessageType.Error))
prefix += "^1^bERROR^n^0: ";
else if (type.Equals(MessageType.Exception))
prefix += "^1^bEXCEPTION^0^n: ";
return prefix + msg;
}
public void LogWrite(String msg) {
this.ExecuteCommand("procon.protected.pluginconsole.write", msg);
}
public void ConsoleWrite(String msg, MessageType type) {
LogWrite(FormatMessage(msg, type));
}
public void ConsoleWrite(String msg) {
ConsoleWrite(msg, MessageType.Normal);
}
public void ConsoleWarn(String msg) {
ConsoleWrite(msg, MessageType.Warning);
}
public void ConsoleError(String msg) {
ConsoleWrite("^8" + msg + "^0", MessageType.Error);
}
public void ConsoleException(String msg) {
ConsoleWrite(msg, MessageType.Exception);
}
public void DebugWrite(String msg, int level) {
if (this.fDebugLevel >= level) ConsoleWrite(msg, MessageType.Normal);
}
public void ServerCommand(params String[] args) {
List<String> list = new List<String>();
list.Add("procon.protected.send");
list.AddRange(args);
this.ExecuteCommand(list.ToArray());
}
public String GetPluginName() {
return "Event Logger";
}
public String GetPluginVersion() {
return "1.0.0.0";
}
public String GetPluginAuthor() {
return "maxdralle";
}
public String GetPluginWebsite() {
return "forum.myrcon.com/member.php?37189-maxdralle";
}
public String GetPluginDescription() {
return @"
<h2>Description</h2>
<p>Logfile path: Procon Layer / CONFIGS/EVENT-LOGGER.txt</p>
<p>Logfile auto delete: beginning of the month</p>
<p>SQL database table: event_logger</p>
<p></p>
<p></p>
<blockquote><b>Sample Code to create SQL log entrie via ProconRulz (ingame cmd !log):</b><br>
On Say; Text !log; Exec procon.protected.plugins.call EventLogger SqlLog "Test Entrie" %p% "SAMPLE LOG > test test asdf";</blockquote>
<p></p>
";
}
public List<CPluginVariable> GetPluginVariables() {
List<CPluginVariable> lstReturn = new List<CPluginVariable>();
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)|Enable SQL", typeof(enumBoolYesNo), this.SettingSqlEnabled));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Host", this.SettingStrSqlHostname.GetType(), this.SettingStrSqlHostname));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Port", this.SettingStrSqlPort.GetType(), this.SettingStrSqlPort));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Database", this.SettingStrSqlDatabase.GetType(), this.SettingStrSqlDatabase));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Username", this.SettingStrSqlUsername.GetType(), this.SettingStrSqlUsername));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Passwd.", this.SettingStrSqlPassword.GetType(), this.SettingStrSqlPassword));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Gameserver name", this.SettingStrSqlGameserver.GetType(), this.SettingStrSqlGameserver));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Auto DB Cleaner (delete old log after xy days)", this.SettingDBCleaner.GetType(), this.SettingDBCleaner));
lstReturn.Add(new CPluginVariable("0. MySQL Details (optional)| - Debug Level (1-5)", this.fDebugLevel.GetType(), this.fDebugLevel));
lstReturn.Add(new CPluginVariable("1. Events|Player Disconnected - show in chat windows", typeof(enumBoolYesNo), this.SettingPlayerDisconnectedChat));
lstReturn.Add(new CPluginVariable("1. Events|Player Disconnected - show in plugin console", typeof(enumBoolYesNo), this.SettingPlayerDisconnectedConsole));
lstReturn.Add(new CPluginVariable("1. Events|Player Disconnected - save to logfile", typeof(enumBoolYesNo), this.SettingPlayerDisconnectedLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Player Disconnected - save to SQL", typeof(enumBoolYesNo), this.SettingPlayerDisconnectedDB));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked - show in chat windows", typeof(enumBoolYesNo), this.SettingPlayerKickedChat));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked - show in plugin console", typeof(enumBoolYesNo), this.SettingPlayerKickedConsole));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked - save to logfile", typeof(enumBoolYesNo), this.SettingPlayerKickedLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked - save to SQL", typeof(enumBoolYesNo), this.SettingPlayerKickedDB));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked By Admin - show in chat windows", typeof(enumBoolYesNo), this.SettingPlayerKickedByAdminChat));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked By Admin - show in plugin console", typeof(enumBoolYesNo), this.SettingPlayerKickedByAdminConsole));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked By Admin - save to logfile", typeof(enumBoolYesNo), this.SettingPlayerKickedByAdminLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Player Kicked By Admin - save to SQL", typeof(enumBoolYesNo), this.SettingPlayerKickedByAdminDB));
lstReturn.Add(new CPluginVariable("1. Events|Player Killed By Admin - show in chat windows", typeof(enumBoolYesNo), this.SettingPlayerKilledByAdminChat));
lstReturn.Add(new CPluginVariable("1. Events|Player Killed By Admin - show in plugin console", typeof(enumBoolYesNo), this.SettingPlayerKilledByAdminConsole));
lstReturn.Add(new CPluginVariable("1. Events|Player Killed By Admin - save to logfile", typeof(enumBoolYesNo), this.SettingPlayerKilledByAdminLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Player Killed By Admin - save to SQL", typeof(enumBoolYesNo), this.SettingPlayerKilledByAdminDB));
lstReturn.Add(new CPluginVariable("1. Events|Player Moved By Admin - show in chat windows", typeof(enumBoolYesNo), this.SettingPlayerMovedByAdminChat));
lstReturn.Add(new CPluginVariable("1. Events|Player Moved By Admin - show in plugin console", typeof(enumBoolYesNo), this.SettingPlayerMovedByAdminConsole));
lstReturn.Add(new CPluginVariable("1. Events|Player Moved By Admin - save to logfile", typeof(enumBoolYesNo), this.SettingPlayerMovedByAdminLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Player Moved By Admin - save to SQL", typeof(enumBoolYesNo), this.SettingPlayerMovedByAdminDB));
lstReturn.Add(new CPluginVariable("1. Events|Player Force Moved By Admin - show in chat windows", typeof(enumBoolYesNo), this.SettingPlayerForceMovedByAdminChat));
lstReturn.Add(new CPluginVariable("1. Events|Player Force Moved By Admin - show in plugin console", typeof(enumBoolYesNo), this.SettingPlayerForceMovedByAdminConsole));
lstReturn.Add(new CPluginVariable("1. Events|Player Force Moved By Admin - save to logfile", typeof(enumBoolYesNo), this.SettingPlayerForceMovedByAdminLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Player Force Moved By Admin - save to SQL", typeof(enumBoolYesNo), this.SettingPlayerForceMovedByAdminDB));
lstReturn.Add(new CPluginVariable("1. Events|Time-Ban - show in chat windows", typeof(enumBoolYesNo), this.SettingTimeBanAddedChat));
lstReturn.Add(new CPluginVariable("1. Events|Time-Ban - show in plugin console", typeof(enumBoolYesNo), this.SettingTimeBanAddedConsole));
lstReturn.Add(new CPluginVariable("1. Events|Time-Ban - save to logfile", typeof(enumBoolYesNo), this.SettingTimeBanAddedLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Time-Ban - save to SQL", typeof(enumBoolYesNo), this.SettingTimeBanAddedDB));
lstReturn.Add(new CPluginVariable("1. Events|Perma-Ban - show in chat windows", typeof(enumBoolYesNo), this.SettingBanAddedChat));
lstReturn.Add(new CPluginVariable("1. Events|Perma-Ban - show in plugin console", typeof(enumBoolYesNo), this.SettingBanAddedConsole));
lstReturn.Add(new CPluginVariable("1. Events|Perma-Ban - save to logfile", typeof(enumBoolYesNo), this.SettingBanAddedLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Perma-Ban - save to SQL", typeof(enumBoolYesNo), this.SettingBanAddedDB));
lstReturn.Add(new CPluginVariable("1. Events|Procon Layer Accounts - show in chat windows", typeof(enumBoolYesNo), this.SettingProconLayerChat));
lstReturn.Add(new CPluginVariable("1. Events|Procon Layer Accounts - show in plugin console", typeof(enumBoolYesNo), this.SettingProconLayerConsole));
lstReturn.Add(new CPluginVariable("1. Events|Procon Layer Accounts - save to logfile", typeof(enumBoolYesNo), this.SettingProconLayerLogfile));
lstReturn.Add(new CPluginVariable("1. Events|Procon Layer Accounts - save to SQL", typeof(enumBoolYesNo), this.SettingProconLayerDB));
lstReturn.Add(new CPluginVariable("2. Filter|Exclude Filter Regex Playername", this.SettingFilterPlayername.GetType(), this.SettingFilterPlayername));
lstReturn.Add(new CPluginVariable("2. Filter|Exclude Filter Regex Reason", this.SettingFilterReason.GetType(), this.SettingFilterReason));
lstReturn.Add(new CPluginVariable("2. Filter|Exclude Empty String in Disconnect Reason", typeof(enumBoolYesNo), this.SettingNoEmptyStringInDisReason));
lstReturn.Add(new CPluginVariable("2. Filter|Exclude Force Moved by Admin on round end", typeof(enumBoolYesNo), this.SettingBetweenRoundsNoLog));
lstReturn.Add(new CPluginVariable("2. Filter|Auto Perma Ban if Disconnected Reason triggers this Regex Filter", this.SettingFilterAutoBan.GetType(), this.SettingFilterAutoBan));
lstReturn.Add(new CPluginVariable("3. Plugin Protection|Password needed to edit settings", typeof(enumBoolYesNo), this.SettingUsePassword));
if (this.SettingUsePassword == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("3. Plugin Protection|Change Password", this.SettingPassword.GetType(), this.SettingPassword));
lstReturn.Add(new CPluginVariable("3. Plugin Protection|LOCK SETTINGS NOW", typeof(enumBoolYesNo), this.SettingLocked));
}
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Enable Ban Enforcer form Adkats DB", typeof(enumBoolYesNo), this.SettingEnableBanEnforcer));
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Enforce Perma Ban Only", typeof(enumBoolYesNo), this.SettingEnableBanEnforcerOnlyPerma));
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Adkats DB IP:", this.SettingAdkatsDBIP.GetType(), this.SettingAdkatsDBIP));
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Adkats DB Name:", this.SettingAdkatsDBName.GetType(), this.SettingAdkatsDBName));
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Adkats DB User:", this.SettingAdkatsDBUser.GetType(), this.SettingAdkatsDBUser));
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Adkats DB Pw:", this.SettingAdkatsDBPw.GetType(), this.SettingAdkatsDBPw));
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Change All Kick/Ban Reason to", this.SettingAdkatsBanReason.GetType(), this.SettingAdkatsBanReason));
lstReturn.Add(new CPluginVariable("5. Adkats Ban Enforcer|Check clear players again after xy minutes", this.SettingAdkatsSyncTime.GetType(), this.SettingAdkatsSyncTime));
return lstReturn;
}
public List<CPluginVariable> GetDisplayPluginVariables() {
List<CPluginVariable> lstReturn = new List<CPluginVariable>();
lstReturn.Add(new CPluginVariable("3. Plugin Protection|LOCK SETTINGS NOW", typeof(enumBoolYesNo), this.SettingLocked));
if (this.SettingLocked == enumBoolYesNo.Yes) {
lstReturn.Clear();
lstReturn.Add(new CPluginVariable("Plugin Protection|Enter Password to unlock settings", this.SettingPasswordCheck.GetType(), this.SettingPasswordCheck));
return lstReturn;
} else {
return GetPluginVariables();
}
}
public void SetPluginVariable(String strVariable, String strValue) {
bool layerReady = (((DateTime.UtcNow - this.LayerStartingTime).TotalSeconds) > 60);
if (this.SettingLocked == enumBoolYesNo.Yes) {
if (Regex.Match(strVariable, @"Enter Password to unlock settings").Success) {
if (this.SettingPassword == strValue) {
// show settings
this.SettingLocked = enumBoolYesNo.No;
if (this.SettingProconLayerChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlugin Protection^n > Settings unlocked.") ; }
if (this.SettingProconLayerConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlugin Protection^n > Settings unlocked.") ; }
if (this.SettingProconLayerLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Plugin Protection > Settings unlocked.") ; }
//this.GetDisplayPluginVariables();
} else {
ConsoleWrite("^b^8WRONG PASSWORD!^0^n");
if (this.SettingProconLayerChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlugin Protection^n > Wrong password to unlock settings.") ; }
if (this.SettingProconLayerConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlugin Protection^n > Wrong password to unlock settings.") ; }
if (this.SettingProconLayerLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Plugin Protection > Wrong password to unlock settings.") ; }
}
}
}
if (Regex.Match(strVariable, @"Debug Level").Success) {
int tmp = 3;
int.TryParse(strValue, out tmp);
if (tmp >= 0 && tmp <= 5) {
this.fDebugLevel = tmp;
} else {
ConsoleError("Invalid value for Debug Level: '" + strValue + "'. It must be a number between 1 and 5. (e.g.: 3)");
}
} else if (Regex.Match(strVariable, @"Enable SQL").Success) {
this.SettingSqlEnabled = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
if ((this.SettingProconLayerChat == enumBoolYesNo.Yes) && (this.fIsEnabled) && (layerReady)) { this.SqlLog("","",""); }
} else if (Regex.Match(strVariable, @"Host").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.SqlTableExist)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
this.SettingStrSqlHostname = strValue.Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Port").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.SqlTableExist)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
int tmpport = 3306;
int.TryParse(strValue, out tmpport);
if (tmpport > 0 && tmpport < 65536) {
this.SettingStrSqlPort = tmpport.ToString();
} else {
ConsoleError("Invalid value for MySQL Port: '" + strValue + "'. Port must be a number between 1 and 65535. (e.g.: 3306)");
}
} else if (Regex.Match(strVariable, @"Database").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.SqlTableExist)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
this.SettingStrSqlDatabase = strValue.Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Username").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.SqlTableExist)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
this.SettingStrSqlUsername = strValue.Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Passwd.").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.SqlTableExist)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
this.SettingStrSqlPassword = strValue.Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Gameserver name").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.SqlTableExist)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
this.SettingStrSqlGameserver = strValue;
} else if (Regex.Match(strVariable, @"Auto DB Cleaner").Success) {
int tmpDBCleaner = 1;
int.TryParse(strValue, out tmpDBCleaner);
if (tmpDBCleaner >= 1 && tmpDBCleaner <= 999) {
this.SettingDBCleaner = tmpDBCleaner;
} else {
ConsoleError("Invalid value. It must be a number between 1 and 999. (e.g.: 90)");
}
} else if (Regex.Match(strVariable, @"Player Disconnected - show in chat windows").Success) {
this.SettingPlayerDisconnectedChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Disconnected - show in plugin console").Success) {
this.SettingPlayerDisconnectedConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Disconnected - save to logfile").Success) {
this.SettingPlayerDisconnectedLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Disconnected - save to SQL").Success) {
this.SettingPlayerDisconnectedDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked - show in chat windows").Success) {
this.SettingPlayerKickedChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked - show in plugin console").Success) {
this.SettingPlayerKickedConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked - save to logfile").Success) {
this.SettingPlayerKickedLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked - save to SQL").Success) {
this.SettingPlayerKickedDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked By Admin - show in chat windows").Success) {
this.SettingPlayerKickedByAdminChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked By Admin - show in plugin console").Success) {
this.SettingPlayerKickedByAdminConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked By Admin - save to logfile").Success) {
this.SettingPlayerKickedByAdminLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Kicked By Admin - save to SQL").Success) {
this.SettingPlayerKickedByAdminDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Killed By Admin - show in chat windows").Success) {
this.SettingPlayerKilledByAdminChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Killed By Admin - show in plugin console").Success) {
this.SettingPlayerKilledByAdminConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Killed By Admin - save to logfile").Success) {
this.SettingPlayerKilledByAdminLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Killed By Admin - save to SQL").Success) {
this.SettingPlayerKilledByAdminDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Moved By Admin - show in chat windows").Success) {
this.SettingPlayerMovedByAdminChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Moved By Admin - show in plugin console").Success) {
this.SettingPlayerMovedByAdminConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Moved By Admin - save to logfile").Success) {
this.SettingPlayerMovedByAdminLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Moved By Admin - save to SQL").Success) {
this.SettingPlayerMovedByAdminDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Force Moved By Admin - show in chat windows").Success) {
this.SettingPlayerForceMovedByAdminChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Force Moved By Admin - show in plugin console").Success) {
this.SettingPlayerForceMovedByAdminConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Force Moved By Admin - save to logfile").Success) {
this.SettingPlayerForceMovedByAdminLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Player Force Moved By Admin - save to SQL").Success) {
this.SettingPlayerForceMovedByAdminDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Time-Ban - show in chat windows").Success) {
this.SettingTimeBanAddedChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Time-Ban - show in plugin console").Success) {
this.SettingTimeBanAddedConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Time-Ban - save to logfile").Success) {
this.SettingTimeBanAddedLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Time-Ban - save to SQL").Success) {
this.SettingTimeBanAddedDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Perma-Ban - show in chat windows").Success) {
this.SettingBanAddedChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Perma-Ban - show in plugin console").Success) {
this.SettingBanAddedConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Perma-Ban - save to logfile").Success) {
this.SettingBanAddedLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Perma-Ban - save to SQL").Success) {
this.SettingBanAddedDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Procon Layer Accounts - show in chat windows").Success) {
this.SettingProconLayerChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Procon Layer Accounts - show in plugin console").Success) {
this.SettingProconLayerConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Procon Layer Accounts - save to logfile").Success) {
this.SettingProconLayerLogfile = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Procon Layer Accounts - save to SQL").Success) {
this.SettingProconLayerDB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Exclude Filter Regex Playername").Success) {
this.SettingFilterPlayername = strValue;
} else if (Regex.Match(strVariable, @"Exclude Filter Regex Reason").Success) {
this.SettingFilterReason = strValue;
} else if (Regex.Match(strVariable, @"Exclude Empty String in Disconnect Reason").Success) {
this.SettingNoEmptyStringInDisReason = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Exclude Force Moved by Admin on round end").Success) {
this.SettingBetweenRoundsNoLog = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Auto Perma Ban if Disconnected Reason triggers this Regex Filter").Success) {
this.SettingFilterAutoBan = strValue;
} else if (Regex.Match(strVariable, @"Enable Ban Enforcer form Adkats DB").Success) {
this.SettingEnableBanEnforcer = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Enforce Perma Ban Only").Success) {
this.SettingEnableBanEnforcerOnlyPerma = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Adkats DB IP").Success) {
this.SettingAdkatsDBIP = strValue.Replace(System.Environment.NewLine, "").Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Adkats DB Name").Success) {
this.SettingAdkatsDBName = strValue.Replace(System.Environment.NewLine, "").Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Adkats DB User").Success) {
this.SettingAdkatsDBUser = strValue.Replace(System.Environment.NewLine, "").Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Adkats DB Pw").Success) {
this.SettingAdkatsDBPw = strValue.Replace(System.Environment.NewLine, "").Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Change All Kick/Ban Reason to").Success) {
this.SettingAdkatsBanReason = strValue.Replace(System.Environment.NewLine, "").Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Check clear players again after xy minutes").Success) {
int tmpSyncBan = 1;
int.TryParse(strValue, out tmpSyncBan);
if (tmpSyncBan >= 10 && tmpSyncBan <= 240) {
this.SettingAdkatsSyncTime = tmpSyncBan;
} else {
ConsoleError("Invalid value. It must be a number between 10 and 240. (e.g.: 20)");
}
} else if (Regex.Match(strVariable, @"Password needed to edit settings").Success) {
this.SettingUsePassword = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Change Password").Success) {
this.SettingPassword = strValue;
} else if (Regex.Match(strVariable, @"LOCK SETTINGS NOW").Success) {
if (this.SettingPassword != String.Empty) {
this.SettingLocked = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
if (this.SettingProconLayerChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlugin Protection^n > Settings locked.") ; }
if (this.SettingProconLayerConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlugin Protection^n > Settings locked.") ; }
if (this.SettingProconLayerLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Plugin Protection > Settings locked.") ; }
} else {
ConsoleWrite("^b^8ERROR:^0^n Set a password to lock settings");
}
}
}
//////////////////////
//Server Events
//////////////////////
public void OnPluginLoaded(String strHostName, String strPort, String strPRoConVersion) {
this.RegisterEvents(this.GetType().Name, "OnPunkbusterMessage", "OnPlayerJoin", "OnListPlayers", "OnPlayerDisconnected", "OnRoundOver", "OnPlayerKicked", "OnPlayerKickedByAdmin", "OnPlayerKilledByAdmin", "OnPlayerMovedByAdmin", "OnBanAdded", "OnAccountCreated", "OnAccountDeleted", "OnAccountLogin", "OnAccountLogout");
this.ServerIP = strHostName;
this.ServerPort = strPort;
}
public void OnPluginEnable() {
this.fIsEnabled = true;
ConsoleWrite("^b^2Enabled!^0^n");
if (this.SettingProconLayerLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Plugin enabled."); }
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "500", "999", "-1", "procon.protected.plugins.call", "EventLogger", "WriteLogfile");
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "300", "9999", "-1", "procon.protected.plugins.call", "EventLogger", "AutoDBCleaner");
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "20", "30", "1", "procon.protected.plugins.call", "EventLogger", "SqlLog", "", "", "");
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "60", "1", "1", "procon.protected.plugins.call", "EventLogger", "CheckRestart");
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "60", "29", "-1", "procon.protected.plugins.call", "EventLogger", "AdkatsBanEnforcerThread");
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "5", "80000", "-1", "procon.protected.plugins.call", "EventLogger", "TmpListCleaner");
}
public void OnPluginDisable() {
if (this.SettingProconLayerLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Plugin disabled."); }
this.WriteLogfile();
this.onJoinTime.Clear();
this.ExecuteCommand("procon.protected.tasks.remove", "EventLogger");
TmpListCleaner();
this.fIsEnabled = false;
ConsoleWrite("^b^8Disabled!^0^n");
}
public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset) {
if (!this.fIsEnabled) { return; }
if (this.SettingEnableBanEnforcer == enumBoolYesNo.No) { return; }
if (DateTime.UtcNow.Subtract(this.lastOnListPlayersTS).TotalSeconds >= 20) {
try {
if (CPlayerSubset.PlayerSubsetType.All == subset.Subset) {
this.lastOnListPlayersTS = DateTime.UtcNow;
DebugWrite("[OnListPlayers] Receive playerlist with EAGUID", 5);
foreach (CPlayerInfo playerinfo in players) {
if (playerinfo.GUID.StartsWith("EA_")) {
if (this.GuidToNameList.ContainsKey(playerinfo.GUID)) {
if (this.GuidToNameList[playerinfo.GUID] != playerinfo.SoldierName) { this.GuidToNameList[playerinfo.GUID] = playerinfo.SoldierName; }
} else {
this.GuidToNameList.Add(playerinfo.GUID, playerinfo.SoldierName);
}
if (this.AdkatsBanned.ContainsKey(playerinfo.GUID)) {
// banned player found
// xxxxxxxxxx kick with yell
DebugWrite("[BanEnforceThread] Kick BANNED player (Adkats DB): ^b" + playerinfo.SoldierName + "^n: " + this.AdkatsBanned[playerinfo.GUID], 2);
this.ExecuteCommand("procon.protected.send", "admin.yell", this.AdkatsBanned[playerinfo.GUID], "10", "player", playerinfo.SoldierName);
this.ExecuteCommand("procon.protected.send", "admin.say", this.AdkatsBanned[playerinfo.GUID], "player", playerinfo.SoldierName);
this.ExecuteCommand("procon.protected.chat.write", "(PlayerYell " + playerinfo.SoldierName + ") " + this.AdkatsBanned[playerinfo.GUID]);
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "5", "1", "1", "procon.protected.send", "admin.kickPlayer", playerinfo.SoldierName, this.AdkatsBanned[playerinfo.GUID]);
} else {
if (this.AdkatsBanChecked.ContainsKey(playerinfo.GUID)) {
if (DateTime.UtcNow.Subtract(this.AdkatsBanChecked[playerinfo.GUID]).TotalSeconds >= (60 + (this.SettingAdkatsSyncTime * 60))) {
// time to check again
if (!this.AdkatsBanCheckList.Contains(playerinfo.GUID)) { this.AdkatsBanCheckList.Add(playerinfo.GUID); }
}
} else {
// check player
if (!this.AdkatsBanCheckList.Contains(playerinfo.GUID)) { this.AdkatsBanCheckList.Add(playerinfo.GUID); }
}
}
}
}
}
}
catch (Exception ex) {
DebugWrite("[OnListPlayers] ^bERROR:^n On Event OnListPlayers. ERROR: " + ex, 5);
}
}
}
public void OnPunkbusterMessage(string strPunkbusterMessage) {
return;
string violation = @"PunkBuster Server: VIOLATION \(([a-zA-Z]+)\) \#([0-9]+)\: ([a-zA-Z0-9_\-]+) \(slot #([0-9]+)\) Violation \(([a-zA-Z]+)\) \#([0-9]+) \[([0-9a-f]{32})\(-\) (([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}))\:([0-9]{1,5})\]";
Match computedViolation = Regex.Match(strPunkbusterMessage, violation, RegexOptions.IgnoreCase);
if (computedViolation.Success)
{
DebugWrite("punkbuster orig msg: " + strPunkbusterMessage , 1);
String playerName = computedViolation.Groups[3].Value;
String encodedMsg = System.Uri.EscapeDataString(strPunkbusterMessage);
DebugWrite("punkbuster ban: ^b" + playerName + "^n for: " + encodedMsg, 1);
}
}
public void AdkatsBanEnforcerThread() {
if (!this.fIsEnabled) { return; }
if (this.SettingEnableBanEnforcer == enumBoolYesNo.No) { return; }
if (this.AdkatsBanCheckList.Count <= 0) { return; }
if (DateTime.UtcNow.Subtract(this.lastAdkatsSyncTS).TotalSeconds >= 25) {
Thread ThreadWorkerEventLogger1 = new Thread(new ThreadStart(delegate() {
string tmp_adkats_db_login = "Server=" + this.SettingAdkatsDBIP + ";Port=3306;Database=" + this.SettingAdkatsDBName + ";" + "Uid=" + this.SettingAdkatsDBUser + ";" + "Pwd=" + this.SettingAdkatsDBPw + ";" + "Connection Timeout=5;";
try {
string SQL = String.Empty;
string tmp_eaguid = String.Empty;
string tmp_banreason = String.Empty;
string tmp_playername = String.Empty;
string tmp_currentName = String.Empty;
int tmp_time = 0;
int tmp_counter = 0;
List<string> tmp_list = new List<string>();
tmp_list = this.AdkatsBanCheckList;
using (MySqlConnection Con = new MySqlConnection(this.AdkatsSqlLogin())) {
this.lastAdkatsSyncTS = DateTime.UtcNow;
Con.Open();
if (Con.State == ConnectionState.Open) {
try {
foreach (string pguid in tmp_list) {
tmp_banreason = String.Empty;
tmp_playername = String.Empty;
tmp_counter++;
if (!this.fIsEnabled) { return; }
if (tmp_counter <= 16) {
// check player
tmp_eaguid = pguid;
SQL = "SELECT tpd.`SoldierName`, tpd.`EAGUID`, tpd.`PlayerID`, abr.`record_message`, TIMESTAMPDIFF(Minute,UTC_TIMESTAMP(),adk.`ban_endTime`) AS timestamp FROM `tbl_playerdata` tpd INNER JOIN `tbl_server_player` tsp ON tsp.`PlayerID` = tpd.`PlayerID` INNER JOIN `adkats_bans` adk ON adk.`player_id` = tpd.`PlayerID` LEFT JOIN `adkats_records_main` abr ON abr.`record_id` = adk.`latest_record_id` WHERE adk.`ban_status` = 'Active' AND tpd.`EAGUID` = '" + tmp_eaguid + "' GROUP BY tpd.`PlayerID` ORDER BY tpd.`SoldierName` ASC";
DebugWrite("[BanEnforceThread] Checking EA-GUID: " + pguid + ". SQL Cmd: " + SQL, 5);
using (MySqlCommand MyCommand = new MySqlCommand(SQL)) {
DataTable resultTable = this.AdkatsSQLquery(MyCommand);
if (resultTable.Rows != null) {
foreach (DataRow row in resultTable.Rows) {
// reading sql
tmp_time = Convert.ToInt32(row["timestamp"]);
tmp_banreason = row["record_message"].ToString();
tmp_playername = row["SoldierName"].ToString();
}
if (((this.SettingEnableBanEnforcerOnlyPerma == enumBoolYesNo.Yes) && (tmp_time > 525600)) || (this.SettingEnableBanEnforcerOnlyPerma == enumBoolYesNo.No)) {
if ((tmp_banreason.Length > 2) && (tmp_playername != String.Empty)) {
// banned player found
tmp_currentName = this.GuidToName(pguid);
tmp_banreason = this.BanTimeString(tmp_time) + this.BanReasonCleaned(tmp_banreason, tmp_currentName);
DebugWrite("[BanEnforceThread] Kick BANNED player (Adkats DB): ^b" + tmp_currentName + "^n: " + tmp_banreason, 2);
if (!this.AdkatsBanned.ContainsKey(pguid) && (tmp_time > 5000)) { this.AdkatsBanned.Add(pguid, tmp_banreason); }
if (this.AdkatsBanned.ContainsKey(pguid) && (tmp_time < 5000)) { this.AdkatsBanned.Remove(pguid); }
this.ExecuteCommand("procon.protected.send", "admin.yell", tmp_banreason, "10", "player", tmp_currentName);
this.ExecuteCommand("procon.protected.send", "admin.say", tmp_banreason, "player", tmp_currentName);
this.ExecuteCommand("procon.protected.chat.write", "(PlayerYell " + tmp_currentName + ") " + tmp_banreason);
//this.ExecuteCommand("procon.protected.send", "admin.kickPlayer", tmp_currentName, tmp_banreason);
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "15", "1", "1", "procon.protected.send", "admin.kickPlayer", tmp_currentName, tmp_banreason);
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "12", "1", "1", "procon.protected.send", "admin.yell", tmp_banreason, "10", "player", tmp_currentName);
this.ExecuteCommand("procon.protected.tasks.add", "EventLogger", "12", "1", "1", "admin.say", tmp_banreason, "player", tmp_currentName);
if (this.AdkatsBanChecked.ContainsKey(pguid)) { this.AdkatsBanChecked.Remove(pguid); }
}
}
}
}
if ((tmp_banreason.Length < 1) || (tmp_playername == String.Empty) || ((this.SettingEnableBanEnforcerOnlyPerma == enumBoolYesNo.Yes) && (tmp_time > 525600))) {
if (this.AdkatsBanChecked.ContainsKey(pguid)) {
this.AdkatsBanChecked[pguid] = DateTime.UtcNow;
} else {
this.AdkatsBanChecked.Add(pguid, DateTime.UtcNow);
}
}
}
}
this.AdkatsBanCheckList.Clear();
if (Con.State == ConnectionState.Open) {
DebugWrite("[BanEnforceThread] Close SQL Connection (Con)", 5);
Con.Close();
}
}
catch (Exception c) {
ConsoleError("[BanEnforceThread] Error, can not read from SQL database (MyCommand): " + c);
}
if (Con.State == ConnectionState.Open) {
DebugWrite("[BanEnforceThread] Close SQL Connection (Con)", 5);
Con.Close();
}
}
}
}
catch (Exception c) {
DebugWrite("[BanEnforceThread] ^bERROR: Check your SQL credentials from Adkats DB^n", 1);
ConsoleError("[BanEnforceThread] Error (Con): " + c );
}
}));
ThreadWorkerEventLogger1.IsBackground = true;
ThreadWorkerEventLogger1.Name = "ThreadWorkerEventLogger1";
ThreadWorkerEventLogger1.Start();
}
}
public override void OnPlayerJoin(String soldierName) {
if (!this.onJoinTime.ContainsKey(soldierName)) {
this.onJoinTime.Add(soldierName, DateTime.UtcNow);
}
}
public override void OnRoundOver(int winningTeamId) {
this.OnRoundOverTime = DateTime.UtcNow;
}
public override void OnPlayerDisconnected(String playerName, String reason) {
if (!this.fIsEnabled) { return; }
if (this.onJoinTime.ContainsKey(playerName)) {this.onJoinTime.Remove(playerName);}
if ((this.SettingPlayerDisconnectedConsole == enumBoolYesNo.Yes) || (this.SettingPlayerDisconnectedChat == enumBoolYesNo.Yes) || (this.SettingPlayerDisconnectedLogfile == enumBoolYesNo.Yes) || (this.SettingPlayerDisconnectedDB == enumBoolYesNo.Yes) || (this.SettingFilterAutoBan.Length > 4)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (playerName != String.Empty)) {
if (Regex.Match(playerName, this.SettingFilterPlayername).Success) {
return;
}
}
if ((this.SettingFilterReason != String.Empty) && (reason != String.Empty)) {
if (Regex.Match(reason, this.SettingFilterReason).Success) {
return;
}
}
if (this.SettingNoEmptyStringInDisReason == enumBoolYesNo.Yes) {
if (reason == String.Empty) {
return;
}
}
if ((this.SettingFilterAutoBan.Length > 4) && (reason.Length > 4)) {
if (!reason.StartsWith("Triggered ")) {
if (Regex.Match(reason, this.SettingFilterAutoBan).Success) {
string tmp_reason = reason;
if ((reason.Contains("PunkBuster kicked player")) && (reason.Contains("Cheater banned by GGC-Stream.NET")) && (this.SettingFilterAutoBan.Contains("banned by GGC-Stream"))) {
// special, import ggc stream bans
Match regexMatch1 = Regex.Match(reason, "GUID \\w+");
if (regexMatch1.Success) {
if (regexMatch1.Groups[0].Value.Length > 2) {
tmp_reason = "Cheater banned by GGC-Stream (" + regexMatch1.Groups[0].Value.Replace("GUID ", "") + ")";
}
}
} else if ((reason.Contains("PunkBuster kicked player")) && (reason.Contains("Violation")) && (this.SettingFilterAutoBan.Contains("PunkBuster")) && (this.SettingFilterAutoBan.Contains("Violation"))) {
// special, import punkbuster bans
Match regexMatch2 = Regex.Match(reason, "Violation\\s\\(\\w+\\)\\s.+");
if (regexMatch2.Success) {
if (regexMatch2.Groups[0].Value.Length > 2) {
tmp_reason = "PunkBuster ban " + regexMatch2.Groups[0].Value;
}
}
} else if ((reason.Contains("PunkBuster permanent ban issued on this Game Server for player")) && (reason.Contains("GUID BAN")) && (this.SettingFilterAutoBan.Contains("PunkBuster permanent ban issued on this Game Server for player"))) {
// special, import punkbuster bans
tmp_reason = "PunkBuster ban detected";
}
// Check for pbbans unofficial bans, e.g. "PunkBuster kicked player THE_SQUADs_manky (for 1200 minutes) ... PBBans.com enforced a previous MBi Ban for THE_SQUADs_manky. [Admin Decision]"
else if ((reason.Contains("PunkBuster kicked player")) && (reason.Contains("PBBans.com enforced a previous MBi Ban")) && (this.SettingFilterAutoBan.Contains("enforced a previous MBi Ban"))) {
// special, import unofficial pbbans MBi bans
Match regexMatch3 = Regex.Match(reason, "previous MBi Ban for \\S+");
if (regexMatch3.Success) {
if (regexMatch3.Groups[0].Value.Length > 2) {
tmp_reason = "PunkBuster previous MBi Ban (" + regexMatch3.Groups[0].Value.Replace("previous MBi Ban for ", "") + ")";
}
}
}
// Check for BF4DB bans, e.g. "[BF4DB] Suspicious Stats. Appeal at https://bf4db.com/player/ban/2942 [ARPAdmin]"
else if ((reason.Contains("[BF4DB]")) && (reason.Contains("Appeal at")) && (this.SettingFilterAutoBan.Contains("BF4DB"))) {
// special, import unofficial pbbans MBi bans
Match regexMatch4 = Regex.Match(reason, @"\s*([^\n\r]*)Appeal at");
if (regexMatch4.Success) {
if (regexMatch4.Groups[1].Value.Length > 2) {
tmp_reason = "[BF4DB] ( " + regexMatch4.Groups[1].Value.Replace("[BF4DB] ", "") + ")";
tmp_reason = tmp_reason.Replace("Battlefield ", "BF").Replace("Battlefield", "BF").Replace("Suspicious", "Susp.");
}
}
}
// perma ban
tmp_reason = "Triggered " + tmp_reason;
if (tmp_reason.Length > 80) { tmp_reason = tmp_reason.Substring(0, 80); }
DebugWrite("[PlayerDisconnected] [AutoBan] Ban player " + playerName + ". Reason: " + tmp_reason , 2);
this.ExecuteCommand("procon.protected.send", "banList.add", "name", playerName, "perm", tmp_reason);
this.ExecuteCommand("procon.protected.send", "banList.save");
this.ExecuteCommand("procon.protected.send", "banList.list");
}
}
}
if (this.SettingPlayerDisconnectedConsole == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlayer Disconnected^n > " + this.strBlack(playerName) + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerDisconnectedChat == enumBoolYesNo.Yes) { ConsoleWrite("^bPlayer Disconnected^n > " + this.strBlack(playerName) + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerDisconnectedLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Player Disconnected > " + playerName + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerDisconnectedDB == enumBoolYesNo.Yes) { this.SqlLog("Player Disconnected", playerName, reason) ; }
}
//if ((this.AggressiveJoin) && (reason == "PLAYER_KICKED")) {
}
public override void OnPlayerKicked(String soldierName, String reason) {
if (!this.fIsEnabled) { return; }
if ((this.SettingPlayerKickedChat == enumBoolYesNo.Yes) || (this.SettingPlayerKickedConsole == enumBoolYesNo.Yes) || (this.SettingPlayerKickedLogfile == enumBoolYesNo.Yes) || (this.SettingPlayerKickedDB == enumBoolYesNo.Yes)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (soldierName != String.Empty)) {
if (Regex.Match(soldierName, this.SettingFilterPlayername).Success) {
return;
}
}
if ((this.SettingFilterReason != String.Empty) && (reason != String.Empty)) {
if (Regex.Match(reason, this.SettingFilterReason).Success) {
return;
}
}
if (this.SettingPlayerKickedChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlayer Kicked^n > " + this.strBlack(soldierName) + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerKickedConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlayer Kicked^n > " + this.strBlack(soldierName) + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerKickedLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Player Kicked > " + soldierName + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerKickedDB == enumBoolYesNo.Yes) { this.SqlLog("Player Kicked", soldierName, reason) ; }
}
}
public override void OnPlayerKickedByAdmin(String soldierName, String reason) {
if (!this.fIsEnabled) { return; }
if ((this.SettingPlayerKickedByAdminChat == enumBoolYesNo.Yes) || (this.SettingPlayerKickedByAdminConsole == enumBoolYesNo.Yes) || (this.SettingPlayerKickedByAdminLogfile == enumBoolYesNo.Yes) || (this.SettingPlayerKickedByAdminDB == enumBoolYesNo.Yes)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (soldierName != String.Empty)) {
if (Regex.Match(soldierName, this.SettingFilterPlayername).Success) {
return;
}
}
if ((this.SettingFilterReason != String.Empty) && (reason != String.Empty)) {
if (Regex.Match(reason, this.SettingFilterReason).Success) {
return;
}
}
if (this.SettingPlayerKickedByAdminChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlayer Kicked By Admin^n > " + this.strBlack(soldierName) + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerKickedByAdminConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlayer Kicked By Admin^n > " + this.strBlack(soldierName) + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerKickedByAdminLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Kicked By Admin > " + soldierName + " - RESAON: " + reason + " -") ; }
if (this.SettingPlayerKickedByAdminDB == enumBoolYesNo.Yes) { this.SqlLog("Player Kicked By Admin", soldierName, reason) ; }
}
}
public override void OnPlayerKilledByAdmin(String soldierName) {
if (!this.fIsEnabled) { return; }
if ((this.SettingPlayerKilledByAdminChat == enumBoolYesNo.Yes) || (this.SettingPlayerKilledByAdminConsole == enumBoolYesNo.Yes) || (this.SettingPlayerKilledByAdminLogfile == enumBoolYesNo.Yes) || (this.SettingPlayerKilledByAdminDB == enumBoolYesNo.Yes)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (soldierName != String.Empty)) {
if (Regex.Match(soldierName, this.SettingFilterPlayername).Success) {
return;
}
}
if (this.SettingPlayerKilledByAdminChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlayer Killed By Admin^n > " + this.strBlack(soldierName)) ; }
if (this.SettingPlayerKilledByAdminConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlayer Killed By Admin^n > " + this.strBlack(soldierName)) ; }
if (this.SettingPlayerKilledByAdminLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Killed By Admin > " + soldierName) ; }
if (this.SettingPlayerKilledByAdminDB == enumBoolYesNo.Yes) { this.SqlLog("Player Kicked By Admin", soldierName, "") ; }
}
}
public override void OnPlayerMovedByAdmin(string soldierName, int destinationTeamId, int destinationSquadId, bool forceKilled) {
if (!this.fIsEnabled) { return; }
if (this.SettingBetweenRoundsNoLog == enumBoolYesNo.Yes) {
if (((DateTime.UtcNow - this.OnRoundOverTime).TotalSeconds) < 80) {
return;
}
if (this.onJoinTime.ContainsKey(soldierName)) {
if (((DateTime.UtcNow - this.onJoinTime[soldierName]).TotalSeconds) < 240) {
return;
} else {
this.onJoinTime.Remove(soldierName);
}
}
}
if (forceKilled) {
if ((this.SettingPlayerForceMovedByAdminChat == enumBoolYesNo.Yes) || (this.SettingPlayerForceMovedByAdminConsole == enumBoolYesNo.Yes) || (this.SettingPlayerForceMovedByAdminLogfile == enumBoolYesNo.Yes) || (this.SettingPlayerForceMovedByAdminDB == enumBoolYesNo.Yes)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (soldierName != String.Empty)) {
if (Regex.Match(soldierName, this.SettingFilterPlayername).Success) {
return;
}
}
if (this.SettingPlayerForceMovedByAdminChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlayer Force Moved By Admin^n > " + this.strBlack(soldierName)) ; }
if (this.SettingPlayerForceMovedByAdminConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlayer Force Moved By Admin^n > " + this.strBlack(soldierName)) ; }
if (this.SettingPlayerForceMovedByAdminLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Player Force Moved By Admin > " + soldierName) ; }
if (this.SettingPlayerForceMovedByAdminDB == enumBoolYesNo.Yes) { this.SqlLog("Player Force Moved By Admin", soldierName, "") ; }
}
} else {
if ((this.SettingPlayerMovedByAdminChat == enumBoolYesNo.Yes) || (this.SettingPlayerMovedByAdminConsole == enumBoolYesNo.Yes) || (this.SettingPlayerMovedByAdminLogfile == enumBoolYesNo.Yes)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (soldierName != String.Empty)) {
if (Regex.Match(soldierName, this.SettingFilterPlayername).Success) {
return;
}
}
if (this.SettingPlayerMovedByAdminChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPlayer Moved By Admin^n > " + this.strBlack(soldierName)) ; }
if (this.SettingPlayerMovedByAdminConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPlayer Moved By Admin^n > " + this.strBlack(soldierName)) ; }
if (this.SettingPlayerMovedByAdminLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Player Moved By Admin > " + soldierName) ; }
if (this.SettingPlayerForceMovedByAdminDB == enumBoolYesNo.Yes) { this.SqlLog("Player Moved By Admin", soldierName, "") ; }
}
}
}
//public override void OnPlayerKilled(Kill kKillerVictimDetails) {
// DebugWrite("[OnPlayerKilled] " + kKillerVictimDetails.Killer.SoldierName + " killed " + this.strBlack(kKillerVictimDetails.Victim.SoldierName), 5);
//}
public override void OnBanAdded(CBanInfo ban) {
if (!this.fIsEnabled) { return; }
if (ban.BanLength.Subset == TimeoutSubset.TimeoutSubsetType.Permanent) {
if ((this.SettingBanAddedChat == enumBoolYesNo.Yes) || (this.SettingBanAddedConsole == enumBoolYesNo.Yes) || (this.SettingBanAddedLogfile == enumBoolYesNo.Yes) || (this.SettingBanAddedDB == enumBoolYesNo.Yes)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (ban.SoldierName != String.Empty)) {
if (Regex.Match(ban.SoldierName, this.SettingFilterPlayername).Success) {
return;
}
}
if ((this.SettingFilterReason != String.Empty) && (ban.Reason != String.Empty)) {
if (Regex.Match(ban.Reason, this.SettingFilterReason).Success) {
return;
}
}
if (this.SettingBanAddedChat == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", "Event Logger > ^bPerma-Ban^n > " + this.strBlack(ban.SoldierName) + " ( " + ban.Guid + " ) - RESAON: " + ban.Reason + " -") ; }
if (this.SettingBanAddedConsole == enumBoolYesNo.Yes) { ConsoleWrite("^bPerma-Ban^n > " + this.strBlack(ban.SoldierName) + " ( " + ban.Guid + " ) - RESAON: " + ban.Reason + " -") ; }
if (this.SettingBanAddedLogfile == enumBoolYesNo.Yes) { this.tmpLogfile.Add("[" + DateTime.Now.ToString() + "] Event Logger > Perma-Ban > " + ban.SoldierName + " ( " + ban.Guid + " ) - - RESAON: " + ban.Reason + " -") ; }
if (this.SettingBanAddedDB == enumBoolYesNo.Yes) { this.SqlLog("Perma-Ban", ban.SoldierName + " ( " + ban.Guid + " )", ban.Reason) ; }
}
} else if (ban.BanLength.Subset == TimeoutSubset.TimeoutSubsetType.Round) {
if ((this.SettingTimeBanAddedChat == enumBoolYesNo.Yes) || (this.SettingTimeBanAddedConsole == enumBoolYesNo.Yes) || (this.SettingTimeBanAddedLogfile == enumBoolYesNo.Yes)) {
//filter
if ((this.SettingFilterPlayername != String.Empty) && (ban.SoldierName != String.Empty)) {
if (Regex.Match(ban.SoldierName, this.SettingFilterPlayername).Success) {
return;
}
}
if ((this.SettingFilterReason != String.Empty) && (ban.Reason != String.Empty)) {
if (Regex.Match(ban.Reason, this.SettingFilterReason).Success) {