forked from procon-plugin/vip-slot-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VipSlotManager.cs
3111 lines (2946 loc) · 179 KB
/
VipSlotManager.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
/* VipSlotManager.cs - Procon Plugin [BF3, BF4, BFH, BC2]
Version: 1.0.0.6
Code Credit:
PapaCharlie9 (forum.myrcon.com) - Basic Plugin Template Part (BasicPlugin.cs)
[GWC]XpKiller (forum.myrcon.com) - MySQL Main Functions (CChatGUIDStatsLogger.inc)
[VdSk]LmaA-aD - Sponsoring BF3 & BFH Gameserver for testing Plugin
Development by [email protected]
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 VipSlotManager : PRoConPluginAPI, IPRoConPluginInterface {
/* Inherited:
this.PunkbusterPlayerInfoList = new Dictionary<String, CPunkbusterInfo>();
this.FrostbitePlayerInfoList = new Dictionary<String, CPlayerInfo>();
*/
private bool fIsEnabled;
private bool gotVipsGS;
private bool firstCheck;
private bool AggressiveJoin;
private bool isForceSync;
private bool SqlTableExist;
private bool AdkatsRunning;
private int fDebugLevel;
private int SyncCounter;
private int DBCleanerCounter = (new Random().Next(960, 990));
private int vipsCurrentlyOnline;
private int start_delay = (new Random().Next(40, 100));
private double ticketLoserTeam;
private string CurrentGameMode;
private string ServerIP;
private string ServerPort;
private string NewLiner;
private string GetGameType;
private DateTime LayerStartingTime = DateTime.UtcNow;
private DateTime CurrentRoundEndTime = DateTime.UtcNow;
private DateTime LastSync = DateTime.UtcNow;
private DateTime LastAggressiveJoinKickTime = DateTime.UtcNow.AddMinutes(-5);
private List<string> vipsGS = new List<string>();
private List<string> vipmsg = new List<string>();
private List<string> vipsExpired = new List<string>();
private List<string> SqlVipsActiveNamesOnly = new List<string>();
private List<string> kickedForVip = new List<string>();
private List<string> GetPlayerGuid = new List<string>();
private List<string> RoundTempVips = new List<string>();
private Dictionary<String, int> SqlVipsActive = new Dictionary<string, int>();
private Dictionary<String, int> playerTeamID = new Dictionary<string, int>();
private Dictionary<String, int> playerSquadID = new Dictionary<string, int>();
private Dictionary<String, String> SquadLederList = new Dictionary<string, string>();
private Dictionary<String, String> Guid2Check = new Dictionary<string, string>();
private Dictionary<String, DateTime> onJoinSpammer = new Dictionary<string, DateTime>();
private Dictionary<String, String> NameGuidList = new Dictionary<string, string>();
private Dictionary<String, int> AggressiveVips = new Dictionary<string, int>();
private MySql.Data.MySqlClient.MySqlTransaction MySqlTrans;
private string SettingStrSqlHostname;
private string SettingStrSqlPort;
private string SettingStrSqlDatabase;
private string SettingStrSqlUsername;
private string SettingStrSqlPassword;
private string SettingGameType;
private string SettingStrSqlServerGroup;
private int SettingSyncInterval;
private string SettingSyncGs2Sql;
private enumBoolYesNo SettingProconRulzIni;
private enumBoolYesNo SettingAdminCmd;
private enumBoolYesNo SettingPluginCmd;
private enumBoolYesNo SettingVipCmd;
private enumBoolYesNo SettingLeadCmd;
private enumBoolYesNo SettingIgnoreVipLeader;
private enumBoolYesNo SettingLeadByCRose;
private enumBoolYesNo SettingKillmeCmd;
private enumBoolYesNo SettingSwitchmeCmd;
private enumBoolYesNo SettingChatReq;
private string SettingInfoCommands;
private string SettingInfoCmdRegMatch;
private string SettingInfoVip1;
private string SettingInfoVip2;
private string SettingInfoVip3;
private enumBoolYesNo SettingInfoSay;
private enumBoolYesNo SettingVipJoin;
private string SettingVipJoinMsg;
private enumBoolYesNo SettingNonVipJoin;
private string SettingNonVipJoinMsg;
private enumBoolYesNo SettingVipSpawn;
private string SettingVipSpawnMsg;
private string SettingVipSpawnMsg2;
private string SettingVipSpawnMsg3;
private string SettingVipSpawnYell;
private enumBoolYesNo SettingVipSpawnMsgSay;
private enumBoolYesNo SettingVipSpawnMsg2Say;
private enumBoolYesNo SettingVipSpawnMsg3Say;
private enumBoolYesNo SettingVipSpawnYellAll;
private int SettingVipSpawnMsgDelay;
private enumBoolYesNo SettingVipExp;
private string SettingVipExpMsg;
private string SettingVipExpMsg2;
private string SettingVipExpYell;
private int SettingVipExpDelay;
private enumBoolYesNo SettingForceSync;
private enumBoolYesNo SettingMiniManager;
private int SettingYellDuring;
private int SettingDBCleaner;
private int SettingAggressiveJoinKickAbuseMax;
private enumBoolYesNo EAGuidTracking;
private enumBoolYesNo SettingAggressiveJoin;
private enumBoolYesNo SettingAdkatsLog;
private enumBoolYesNo SettingAdkatsLogNonVipKick;
private enumBoolYesNo SettingAdkatsLogVipChanged;
private enumBoolYesNo SettingAdkatsLogVipAggressiveJoinAbuse;
private enumBoolYesNo SettingAggressiveJoinKickAbuse;
private string SettingAggressiveJoinKick;
private string SettingAggressiveJoinMsg;
private string SettingAggressiveJoinMsgType;
private string SettingAggressiveJoinKickAbuseMsg;
private string SettingAggressiveJoinKickAbuseMsgType;
public VipSlotManager() {
this.fIsEnabled = false;
this.gotVipsGS = false;
this.firstCheck = false;
this.AggressiveJoin = false;
this.fDebugLevel = 3;
this.SyncCounter = 999;
this.ServerIP = String.Empty;
this.ServerPort = String.Empty;
this.isForceSync = false;
this.SqlTableExist = false;
this.AdkatsRunning = false;
this.ticketLoserTeam = 0;
this.CurrentGameMode = String.Empty;
this.NewLiner = "";
this.vipsCurrentlyOnline = 0;
this.SettingStrSqlHostname = String.Empty;
this.SettingStrSqlPort = "3306";
this.SettingStrSqlDatabase = String.Empty;
this.SettingStrSqlUsername = String.Empty;
this.SettingStrSqlPassword = String.Empty;
this.SettingGameType = "AUTOMATIC";
this.SettingStrSqlServerGroup = "1";
this.SettingSyncInterval = 5;
this.SettingSyncGs2Sql = "yes (30 days first Plugin installation only)";
this.SettingProconRulzIni = enumBoolYesNo.No;
this.SettingAdminCmd = enumBoolYesNo.Yes;
this.SettingPluginCmd = enumBoolYesNo.Yes;
this.SettingVipCmd = enumBoolYesNo.No;
this.SettingLeadCmd = enumBoolYesNo.No;
this.SettingIgnoreVipLeader = enumBoolYesNo.Yes;
this.SettingLeadByCRose = enumBoolYesNo.No;
this.SettingKillmeCmd = enumBoolYesNo.No;
this.SettingSwitchmeCmd = enumBoolYesNo.No;
this.SettingChatReq = enumBoolYesNo.Yes;
this.SettingInfoCommands = "!vip,!slot,!reserved,!buy";
this.SettingInfoCmdRegMatch = "^!vip|^!slot|^!reserved|^!buy";
this.SettingInfoVip1 = "Buy a !VIP SLOT for 4 Euro / Month";
this.SettingInfoVip2 = "!VIP SLOT includes: Reserved Slot, Auto Balancer Whitelist, High Ping Whitelist";
this.SettingInfoVip3 = "!VIP %player% valid for: %time%";
this.SettingInfoSay = enumBoolYesNo.Yes;
this.SettingVipJoin = enumBoolYesNo.No;
this.SettingVipJoinMsg = "%player% with !VIP SLOT joined the server";
this.SettingNonVipJoin = enumBoolYesNo.No;
this.SettingNonVipJoinMsg = "%player% joined the server";
this.SettingVipSpawn = enumBoolYesNo.Yes;
this.SettingVipSpawnMsg = "%player% welcome! Enjoy your !VIP SLOT";
this.SettingVipSpawnMsg2 = "!VIP SLOT valid for: %time%";
this.SettingVipSpawnMsg3 = String.Empty;
this.SettingVipSpawnYell = String.Empty;
this.SettingVipSpawnMsgSay = enumBoolYesNo.Yes;
this.SettingVipSpawnMsg2Say = enumBoolYesNo.No;
this.SettingVipSpawnMsg3Say = enumBoolYesNo.No;
this.SettingVipSpawnYellAll = enumBoolYesNo.No;
this.SettingVipSpawnMsgDelay = 7;
this.SettingVipExp = enumBoolYesNo.Yes;
this.SettingVipExpMsg = "%player% your !VIP SLOT has expired";
this.SettingVipExpMsg2 = "You can buy a !VIP SLOT on our website";
this.SettingVipExpYell = "%player% your !VIP SLOT has expired";
this.SettingVipExpDelay = 7;
this.SettingForceSync = enumBoolYesNo.No;
this.SettingMiniManager = enumBoolYesNo.No;
this.SettingYellDuring = 15;
this.SettingDBCleaner = 60;
this.EAGuidTracking = enumBoolYesNo.No;
this.SettingAggressiveJoin = enumBoolYesNo.No;
this.SettingAdkatsLog = enumBoolYesNo.No;
this.SettingAdkatsLogNonVipKick = enumBoolYesNo.No;
this.SettingAdkatsLogVipChanged = enumBoolYesNo.No;
this.SettingAdkatsLogVipAggressiveJoinAbuse = enumBoolYesNo.No;
this.SettingAggressiveJoinKick = "%player% got disconnected to make room for !VIP on full server";
this.SettingAggressiveJoinMsg = "%player% welcome back! " + System.Environment.NewLine + "You got KICKED randomly because a !VIP joined on full server :/";
this.SettingAggressiveJoinMsgType = "Private Yell and Private Say";
this.SettingAggressiveJoinKickAbuse = enumBoolYesNo.Yes;
this.SettingAggressiveJoinKickAbuseMax = 3;
this.SettingAggressiveJoinKickAbuseMsg = "%player% you can bypass the server queue on next round (too many rejoins per round).";
this.SettingAggressiveJoinKickAbuseMsgType = "Private Say";
}
//////////////////////
// BasicPlugin.cs part by [email protected]
//////////////////////
public enum MessageType { Warning, Error, Exception, Normal };
public String FormatMessage(String msg, MessageType type) {
String prefix = "[^b" + GetPluginName() + "^n] ";
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 OnPluginLoadingEnv(List<string> lstPluginEnv) {
this.GetGameType = lstPluginEnv[1].ToUpper();
if (this.SettingGameType == "AUTOMATIC") {
if (this.GetGameType == "BF3") {this.NewLiner = "\n"; this.SettingGameType = "BF3";}
if (this.GetGameType == "BF4") {this.NewLiner = "\n"; this.SettingGameType = "BF4";}
if (this.GetGameType == "BFHL") {this.NewLiner = ""; this.SettingGameType = "BFH";}
if (this.GetGameType == "BFBC2") {this.NewLiner = ""; this.SettingGameType = "BC2";}
}
}
public String GetPluginName() {
return "VIP Slot Manager";
}
public String GetPluginVersion() {
return "1.0.0.6";
}
public String GetPluginAuthor() {
return "maxdralle";
}
public String GetPluginWebsite() {
return "github.com/procon-plugin/vip-slot-manager";
}
public String GetPluginDescription() {
return @"
Credits:<br>
PapaCharlie9 (forum.myrcon.com) - Basic Plugin Template Part (BasicPlugin.cs)<br>
[GWC]XpKiller (forum.myrcon.com) - MySQL Functions (CChatGUIDStatsLogger.inc)<br>
[VdSk]LmaA-aD - Sponsoring BF3 & BFH Gameserver for testing Plugin
<p></p><p></p>
<h2>VIP Slot Manager [BF3, BF4, BFH, BC2]</h2>
<p>If you find this plugin useful, please feel free to donante.</p>
<p><form action='https://www.paypal.com/cgi-bin/webscr' target='_blank' method='post'>
<input type='hidden' name='cmd' value='_s-xclick'>
<input type='hidden' name='hosted_button_id' value='M7UQ2566MNNE4'>
<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img alt='' border='0' src='https://www.paypalobjects.com/de_DE/i/scr/pixel.gif' width='1' height='1'>
</form></p>
<h2>Description</h2>
<p>This FREE Plugin gives you full control over reserved VIP Slots, with many customizations and features. It includes a time management control for each VIP player. This means you can add VIP players for a custom time period, whether it be 30 days, or longer. Expired VIP Slots will be disabled automatically. It is also possible to manage multiple Gameservers with one global list of VIPs or alternatively each Gamerserver separately with his own list of VIPs.</p>
<p>The Plugin supports a web-based interface to manage a single Gameserver or many Gameservers with different VIP players. This means you can add, edit and remove VIP Slots via the admin website. It is highly recommended to use a website for administrative purposes! </p>
<p>In addition, you can customize any in-game message based on player events. For example, a welcome message for valid VIPs only, such as '%player% your VIP Slot is still valid for: %time%'.</p>
<p><u>NEW</u>: The Aggressive Join detection keeps you informed if a NON-VIP player got kicked to make room for a VIP on full server. If the kicked player rejoins, the Plugin sends him a customized message.</p>
<p></p>
<h2>Installation</h2>
<p><u>IMPORTANT</u>: This Plugin requires a MySQL database with INNODB support.</p>
<p><b>1.</b> Disable the Plugin VIP Slot Manager and open the Plugin settings.</p>
<p><b>2.</b> In the settings, you will find the section <b>'1. MySQL Details'</b>. There simply enter your MySQL details (host IP, port, database name, username, password).</p>
<p><b>3.</b> In the section <b>'2. Main Settings'</b> you can choose your <b>'Gameserver Type'</b>.</p>
<p><b>4.</b> The <b>'Server Group'</b> is an important setting, for when you have more than one Gameserver. If two or more Gameservers use the same MySQL database, then the VIP players are valid for all these Gameservers with the same <b>'Gameserver Type'</b> and <b>'Server Group'</b> ID. You can change the ID in order to manage the VIPs for each Gameserver separately.</p>
<p><b>5.</b> Enable the Plugin.</p>
<p><b>6.</b> Install the website (optional): In the downloaded ZIP file you find a free website template for this job. Before you upload the website replace your SQL details (SQL Server IP, dbName, dbUser, dbPW) in the 'config.php' file. The default login (user, pw) after the installation: admin , admin</p>
<p>After the first start the Plugin will connect to the MySQL database to automatically create tables for the Plugin. After the table is created, it will sync all VIP players from the Gameserver to the MySQL database. All the imported VIP players will get a valid VIP Slot for 30 days by the default settings <b>'Import NEW VIPS from Gameserver to SQL' = yes (30 days first Plugin installation only)</b>. This means that all your VIPs will stay within the SQL database and on your Gameserver! This setting will be changed after the first Sync/Import is completed successfully.</p>
<p></p>
<h2>Website (highly recommended)</h2>
<p>The easiest way to manage reserved VIP Slots is a website with access to the MySQL database. In this way you can manage a single Gameserver or many Gameservers with different VIP players. It gives you full control. You can add, edit and remove VIP players via the website. After a few minutes, the Plugin on each Gameserver receives the updated information automatically and will do the rest.</p>
<p>It is highly recommended to use a website for administrative purposes! You can find a free website template for this purpose within the downloaded ZIP file from this Plugin. It requires a webspace with PHP support and access to the SQL database.</p>
<p></p>
<h2>Sync Settings</h2>
<p>All VIP informations are stored within the SQL database, in addition to the VIP Slot remaining time for each VIP player. The Plugin updates the Gameserver with the valid VIP Slots. Expired VIP Slots will be removed automatically.</p>
<p><b>Multiple Gameservers with one global list of VIPs (optional)</b><br>
The following Plugin settings are important to provide multiple Gameservers with one global list of VIPs. The settings <b>'MySQL details'</b>, <b>'Gameserver Type'</b>, <b>'Server Group'</b>, <b>'Import NEW VIPs from Gameserver to SQL'</b>, <b>'Notify Vip Slot Expiered'</b>, <b>'EA GUID Tracking'</b> and <b>'Aggressive Join Abuse Protection'</b> have to be exactly equal on all Gameservers. In addition, the setting <b>'Import NEW VIPs from Gameserver to SQL'</b> must be set to <b>'no (remove)'</b>. In this way the Plugin and the VIP Sync works perfect.</p>
<p><b>Server Groups</b><br>
Based on the Plugin settings <b>'Gameserver Type'</b> and <b>'Server Group'</b> the VIPs are valid for one or more Gameserver. If two Gameservers use the same <b>'Server Group'</b> ID, then the VIP players are valid for both Gameservers. You can change the <b>'Server Group'</b> ID in order to manage the VIPs for each Gameserver separately.</p>
<p><u>IMPORTANT</u>: If two or more Gameservers use the same <b>'Server Group'</b> than the Plugin setting <b>'Import NEW VIPs from Gameserver to SQL'</b> must be set to <b>no (remove)</b>.</p>
<p><b>Sync Update Interval</b><br>
The Sync between the MySQL database and the Gameserver starts automatically every few minutes. You can change the Sync interval in the Plugin setting <b>'Sync Interval between SQL and Gameserver'</b>.</p>
<p><b>Advanced Import</b><br>
This feature is important for the first Plugin start and the first Sync to the SQL database. If the Plugin is found on the reserved slot list on the Gameserver a NEW VIP without an entry into the SQL database (or with the VIP status 'inactive / expired'), then you can configurate what the Plugin have to do with this NEW VIP. Based on the Plugin settings <b>'Import NEW VIPs from Gameserver to SQL'</b> you can select the following options:</p>
<ul><li><b>yes (first Plugin installation)</b> - The new VIP player will be added to the SQL database. The new VIP will be activated and valid for the next 30 days. This default setting will be changed to 'no (remove)' after the first Sync/Import is completed successfully. This setting is <u>recommended</u> for the first Plugin start and the first Sync to the SQL database.</li>
<li><b>no (ignore)</b> - The new VIP player will stay on the Gameserver without an entry in the SQL. It is not a valid VIP for the Plugin. The player will stay in the reserved slot list on the Gameserver. The player can not use VIP Commands.</li>
<li><b>no (remove)</b> - The new VIP player will be removed from the Gameserver reserved slot list. This default setting is <u>recommended</u> after the Plugin configuration and the first Sync to SQL is completed successfully. This default setting is also required to enable the function <b>'EA GUID Tracking'</b>, the function<b>'Aggressive Join Abuse Protection'</b> or if two or more Gameservers use the same <b>'Server Group'</b> ID.</li>
<li><b>yes (as inactive)</b> - The new VIP player will be added to the SQL database with the status 'inactive'. The player will be removed from the Gameserver. On the website with access to the SQL database, you can edit the VIP status to activate them.</li>
<li><b>yes (for 7/30/90/365 days)</b> - The new VIP player will be added to the SQL database. The new VIP will be activated and valid for the next 30 days.</li>
<li><b>yes (permanent)</b> - The new VIP player will be added to the SQL database. The new VIP will be activated and valid for the next 7 years (permanent).</li></ul>
<p><b>Manual Force Sync</b><br>
For a quick one time Sync you can use the <b>'Force Sync SQL and Gameserver NOW'</b> function in the settings. The proconrulz.ini file will also be updated (if this feature is enabled).</p>
<p></p>
<h2>Notify & In-Game Messages</h2>
<p>You can enable, disable and customize every single in-game message based on chat and player events. OnJoin, OnSpawn and OnChat are trigger events.</p>
<p>You do not have to use all the available textboxes for messages, leave it blank if you do not need it.</p>
<p>The 'Replacement Strings' below are available for any message:</p>
<table border ='1'>
<tr><th>Replacement String</th><th>Effect</th></tr>
<tr><td>%player%</td><td>Will be replaced by the playername</td></tr>
<tr><td>%time%</td><td>Will be replaced by the VIP Slot remaining time (for valid VIPs only)</td></tr>
<tr><td>%total%</td><td>Will be replaced by the total number of all valid VIPs on this server</td></tr>
<tr><td>%online%</td><td>Will be replaced by the number of online VIPs</td></tr>
</table>
<blockquote><b>Sample Message:</b><br>
!VIP %player% valid for: %time%<br>
!VIPs online: %online%/%total%</blockquote>
<p></p><p></p>
<h2>In-Game VIP Commands</h2>
<p>These commands are for valid VIP Slot players only. Each command can be enabled or disabled separately.</p>
<blockquote><h4>!lead</h4>take squad leader position</blockquote>
<blockquote><h4>!killme</h4>admin kill without death in scoreboard</blockquote>
<blockquote><h4>!switchme</h4>switch between teams</blockquote>
<p></p><p></p>
<h2>In-Game Admin Commands</h2>
<p>These commands are for in-game admins only. Admins need the privilege 'Can Edit Reserved Slots List'. You can enable or disable this function in the setting <b>'Enable In-Game Admin Commands'</b>.</p>
<p><u>IMPORTANT</u>: Requires the <full playername> with case sensitive!</p>
<blockquote><h4>!addvip <full playername> <days></h4>e.g. !addvip SniperBen 30<br>e.g. !addvip SniperBen +7</blockquote>
<blockquote><h4>!removevip <full playername></h4>e.g. !removevip SniperBen</blockquote>
<blockquote><h4>!checkvip <full playername></h4>e.g. !checkvip SniperBen</blockquote>
<blockquote><h4>!changevip <old playername> <new playername></h4>e.g. !changevip SniperBen SniperBenni</blockquote>
<blockquote><h4>!addsemivip <full playername></h4>e.g. !addsemivip SniperBen</blockquote>
<p></p>
<p>The command <b>!addvip</b> with <b>30</b> days adds and activates a player’s VIP status for the next 30 days. The time period of 30 days is fixed. When you enter this command more than once it has no effect on the time period.</p>
<p>The command <b>!addvip</b> with <b>+7</b> days checks the VIP player’s remaining time (e.g. the VIP Slot is still valid for 5 days). Then the Plugin ADDS 7 days to the 'old' time period. For example: old time period (5 days) + new time period (7 days) = total time period (12 days). Now the VIP Slot is valid for 12 days.</p>
<p>The command <b>!removevip</b> will remove the VIP from the Gameserver. The player will stay in the SQL database and be marked as 'status inactive'.</p>
<p>The command <b>!addsemivip</b> will add an Semi VIP Slot temporary (valid on current Gameserver till round end / player rejoin). The plugin setting <b>'Aggressive Join Abuse Protection'</b> must be enabled to handle Semi VIPs.</p>
<p></p>
<h2>Other Plugin Support</h2>
<p>Other Plugins such as ProconRulz/InsaneLimits can use special commands to remove or add a VIP Slot for a custom time period. Other Plugins can send commands as a 'hidden say' within the in-game chat. Other players will not see this in-game message, but the Plugin receives this information. In the Procon PC Tool you can enter the commands to (say, all players). You can enable or disable this function in the setting <b>'Enable Commands for other Plugins'</b>.</p>
<p>Commands (hidden admin say)</p>
<blockquote><h4>/vsm-addvip <full playername> <days></h4>e.g. /vsm-addvip SniperBen 30<br>e.g. /vsm-addvip SniperBen +7</blockquote>
<blockquote><h4>/vsm-removevip <full playername></h4>e.g. /vsm-removevip SniperBen</blockquote>
<blockquote><h4>/vsm-changevip <old playername> <new playername></h4>e.g. /vsm-changevip SniperBen SniperBenni</blockquote>
<blockquote><h4>/vsm-addsemivip <full playername></h4>e.g. /vsm-addsemivip SniperBen</blockquote>
<p></p>
<blockquote><b>Sample Code for ProconRulz (perform 5 knife kills = VIP Slot for 7 days):</b><br>
On Kill; Damage Melee; if %c% == 5; Say /vsm-addvip %p% +7</blockquote>
<p></p><p></p>
<h2>Advanced ProconRulz Support</h2>
<p>The VIP Slot Manager Plugin can store a list of valid VIPs in the proconrulz.ini file. This file stays on your Procon Layer Server (path: CONFIGS/proconrulz_<ip>_<port>.ini). When you read this file within the Plugin ProconRulz (%ini_vipslotmanager_<playername>%) you will get the VIP timestamp in seconds. This means you can check the VIP status without any player protection for weapon rule punishment (kill, kick, ban). You can enable or disable this function within the setting <b>'On Round End write VIPs in proconrulz.ini file'</b>.</p>
<p>For a quick one time update to the proconrulz.ini file you can use the <b>'Force Sync SQL and Gameserver NOW'</b> function in the settings.</p>
<p><u>IMPORTANT</u>: Requires Read+Write file permission in the directory /configs/ on your Procon Layer.</p>
<blockquote><b>Sample Code for ProconRulz (in-game command '!check' returns the VIP player status):</b><br>
On Say; Text !check; if %ini_vipslotmanager_%p%% != 0; Say Yes, you are a VIP<br>
On Say; Text !check; if %ini_vipslotmanager_%p%% == 0; Say No, you are NOT a VIP</blockquote>
<p></p><p></p>
<h2>Aggressive Join for VIPs</h2>
<p>The 'Aggressive Join' is a server setting that allows VIPs to join a full server without waiting. A random NON-VIP player will be kicked to make room for a VIP.</p>
<p>The Plugin can detect this kind of kick and keeps you informed if a NON-VIP player got kicked to make room for a VIP on full server. If the kicked player rejoins, the Plugin sends him a customized message. You can enable, disable and customize this feature in the setting <b>'Private Message after NON-VIP got kicked and rejoins'</b>.</p>
<p>In addition, the Plugin can disable the 'Aggressive Join' close on round end to keep as many players as possible on the server. On the next round it will be enabled automatically. This feature works for the following game modes: ConquestLarge, ConquestSmall, TDM and Chainlink. You can enable or disable this function in the setting <b>'Temporary disable the Aggressive Join close on round end'</b>.</p>
<p><b>Aggressive Join Abuse Protection</b><br>
The function <b>'Aggressive Join Abuse Protection'</b> is also helpful to track each VIP if he rejoins too many times with an 'Aggressive Join Kick' on full server. When a single VIP triggered is his max. threshold (custom setting value) of this kind of rejoins per round, then he can not rejoin again with 'Aggressive Join Kick' privilege till next round. In this case, if he rejoins again in the same round, then he can NOT bypass the server queue. He have to wait like normal players. While he is on the server, the Gameserver and all Plugins handles him as an valid VIP but without 'Aggressive Join Kick' privilege. All other VIPs can still join with 'Aggressive Join Kick' privilege. On next round he can join again with 'Aggressive Join Kick' privilege.</b></p>
<p></p>
<h2>Advanced Settings</h2>
<p><b>Debug Level</b><br>
1 - Errors will be displayed.<br>
2 - will also show log entries for added and removed VIP players.<br>
3 - will also show log entries when a VIP player joins the server.<br>
4 - will also show log entries when a player uses the in-game commands (e.g. !lead, !killme).<br>
5 - just for development and testing.</p>
<p><b>Manual Force Sync</b><br>
For a quick one time Sync you can use the <b>'Force Sync SQL and Gameserver NOW'</b> function in the settings. The proconrulz.ini file will also be updated (if this feature is enabled).</p>
<p><b>Auto Database Cleaner</b><br>
This feature reduces the Sync traffic between SQL and Gameserver. It is necessary because the Sync is limited (max. 800 active/expired VIPs for each Server Group). Each Sync includes a list of valid VIPs and expired VIPs. Expired VIPs will get a notify message on the next spawn event. But if the player does not join the server for long time period (60 days by default setting), then this feature will remove him from the Sync in order to reduce the traffic. It changes the player status from 'expired' to 'inactive' and the player will not recives the expired VIP Slot message.</p>
<p>In addition, old VIPs with the status 'inactive' will be deleted after 365 days automatically.</p>
<p><b>VIP EA GUID Tracking</b><br>
If a VIP changes his playername then his VIP Slot will be updated to the new playername automatically. After a VIP joins the server, the Plugin links his playername to his EA GUID. If he joins again with a new/changed playername then his VIP Slot will be updated to the new playername for all <b>Server Groups</b> on current <b>Gameserver Type</b> in SQL database (e.g. for all BF4 Groups 1-99). After the VIP Slot has expired the EA GUID will be unlinked.</p>
<p><u>IMPORTANT</u>: If the Plugins runs on two or more Gameservers with the same <b>'Gametype'</b>, then the Plugin setting <b>'Import NEW VIPs from GS to SQL'</b> must be set to <b>'no (remove)'</b> on ALL Gameservers to use this function. You can enable or disable the tracking function in the setting <b>'EA GUID Tracking'</b>.</p>
<p></p>
<h2>How to add, edit and remove VIPs</h2>
<p><b>Website (highly recommended)</b><br>
The easiest way to manage reserved VIP Slots is a website with access to the MySQL database. You can find a free website template in the downloaded ZIP file from this Plugin. It is highly recommended that you use it!</p>
<p><b>In-Game Admin Commands</b><br>
As an in-game admin you can use the commands: !addvip, !checkvip, and !removevip for the current Gameserver (Server Group).</p>
<p><b>Procon PC Tool</b><br>
In the Plugin settings you can use the <b>'Mini Manager - Print VIP list'</b> to display the current VIP list with players remaining time on your Procon PC Tool Chat tab.<br>
You can also use the commands from the 'Other Plugin Support' function to add and remove VIP Slots. You can enter the commands in the Procon PC Tool chat as a hidden admin say (e.g. /vsm-addvip SniperBen +7). Nobody will see the commands within the in-game chat.</p>
<p></p>
<h2>FAQ</h2>
<p><b>Do I need a new MySQL database?</b><br>
No. For this Plugin, it is NOT necessary to create a new MySQL database. You can use the same MySQL database as the Statslogger Plugin.</p>
<p><b>How to manage two or more Gameservers?</b><br>
With the web-based interface you can manage a single Gameserver or many Gameservers with different VIP players. If two Gameservers use the same <b>'Server Group'</b> ID (Plugin settings) (Plugin settings), then the VIP players are valid for both Gameservers. You can change the <b>'Server Group'</b> ID in order to manage the VIPs for each Gameserver separately. If two or more Gameservers use the same <b>'Server Group'</b> on the same SQL database then the Plugin setting <b>'Import NEW VIPs from Gameserver to SQL'</b> must be set to <b>no (remove)</b>.</p>
<p><b>AdKats Plugin</b><br>
It is possible to use the VIP Slot Manager and the AdKats Plugin. Please make sure that Adkats do not manage the reserved VIP Slots. This is disabled by default. Open the settings from Adkats Plugin, then go to Adkats > A16. Orchestration Settings > Feed Server Reserved Slots > False</p>
<p><b>What is the diffenence between 'add 30' and 'add +30'?</b><br>
The command with + checks the VIP players remaining time (e.g. the VIP Slot is still valid for 5 days), then the Plugin ADDS 30 days to the 'old' time period. For example: old time period (5 days) + new time period (30 days) = total time period (35 days). Now the VIP Slot is valid for 35 days.</p>
<p><b>How to clean up the database?</b><br>
With the website you can clean up the database to remove all old VIPs with the status 'inactive'. Go to the website. Type 'inactive' into the search box. Mark all entires (click on the first VIP and then hold down the SHIFT key on your keyboard and click on the last VIP). Then open the drop down menu and click on 'DELETE' to delete the marked entries.</p>
<p><b>Witch Games are supported?</b><br>
The Plugin works fine for BF3, BF4, BFH and BFBC2. The support for other Games are still not tested.</p>
<p><b>Where can I find updates and support?</b><br>
Updates and support will be handled through the procon thread or on github website:<br>
https://github.com/procon-plugin/vip-slot-manager<br>
https://forum.myrcon.com/showthread.php?17050-VIP-Slot-Manager-Plugin</p>
<p></p>
<h2>Development</h2>
<p><b>Changelog</b></p>
<blockquote><h4>1.0.0.6 (23.06.2018)</h4>
- Add: Aggressive Join Abuse Protection (optional)<br/>
- Add: Command !addsemivip to add temporary VIP till round end / rejoin (optional)<br/>
- Add: Advanced Log to Adkats (optional)<br/>
- Add: Alternative Link to github<br/>
</blockquote><br>
<blockquote><h4>1.0.0.5 (26.01.2018)</h4>
- Add: VIP EA Guid Tracking to update playername changes automatically (optional)<br/>
- Add: Command !changevip to change VIP Slot playername<br/>
- Modification: In-Game VIP Command !lead (optional VIP protection)<br/>
- Modification: Small code improvements<br/>
- Fix: SQL Credentials after server restart<br/>
- Fix: BC2 Procon compatibility<br/>
- Fix: Website compatibility to php 5.6 / 7.0 / 7.1 / 7.2. New features and filters for better workflow<br/>
</blockquote><br>
<blockquote><h4>1.0.0.4 (04.10.2017)</h4>
- Add: Aggressive Join features<br/>
</blockquote><br>
<blockquote><h4>1.0.0.3 (12.08.2017)</h4>
- Add: Auto Correction for case sensitive difference in playername<br/>
- Add: Auto Database Cleaner<br/>
- Fix: Website (add days button)<br/>
</blockquote><br>
<blockquote><h4>1.0.0.2 (09.05.2017)</h4>
- Fix: Website blank site<br/>
</blockquote><br>
<blockquote><h4>1.0.0.1 (02.05.2017)</h4>
- Fix: In-Game VIP Commands<br/>
</blockquote><br>
<blockquote><h4>1.0.0.0 (20.01.2017)</h4>
- First Release<br/>
</blockquote><br>
";
}
public List<CPluginVariable> GetPluginVariables() {
return GetDisplayPluginVariables();
}
public List<CPluginVariable> GetDisplayPluginVariables() {
List<CPluginVariable> lstReturn = new List<CPluginVariable>();
lstReturn.Add(new CPluginVariable("1. MySQL Details|Host", this.SettingStrSqlHostname.GetType(), this.SettingStrSqlHostname));
lstReturn.Add(new CPluginVariable("1. MySQL Details|Port", this.SettingStrSqlPort.GetType(), this.SettingStrSqlPort));
lstReturn.Add(new CPluginVariable("1. MySQL Details|Database", this.SettingStrSqlDatabase.GetType(), this.SettingStrSqlDatabase));
lstReturn.Add(new CPluginVariable("1. MySQL Details|Username", this.SettingStrSqlUsername.GetType(), this.SettingStrSqlUsername));
lstReturn.Add(new CPluginVariable("1. MySQL Details|Password", this.SettingStrSqlPassword.GetType(), this.SettingStrSqlPassword));
lstReturn.Add(new CPluginVariable("2. Main Settings|Gameserver Type", "enum.SettingGameType(AUTOMATIC|BF3|BF4|BFH|BC2)", this.SettingGameType));
lstReturn.Add(new CPluginVariable("2. Main Settings|Server Group (1-99)", this.SettingStrSqlServerGroup.GetType(), this.SettingStrSqlServerGroup));
lstReturn.Add(new CPluginVariable("3. Sync Settings|Sync Interval between SQL and Gameserver. Minutes (2-60)", this.SettingSyncInterval.GetType(), this.SettingSyncInterval));
lstReturn.Add(new CPluginVariable("3. Sync Settings|Import NEW VIPS from Gameserver to SQL", "enum.SettingSyncGs2Sql(yes (30 days first Plugin installation only)|no (ignore)|no (remove from Gameserver)|yes (as inactive)|yes (for 7 days)|yes (for 30 days)|yes (for 90 days)|yes (for 365 days)|yes (permanent))", this.SettingSyncGs2Sql));
lstReturn.Add(new CPluginVariable("4. Commands|Enable In-Game Admin Commands?", typeof(enumBoolYesNo), this.SettingAdminCmd));
lstReturn.Add(new CPluginVariable("4. Commands|Enable Commands for other Plugins?", typeof(enumBoolYesNo), this.SettingPluginCmd));
lstReturn.Add(new CPluginVariable("4. Commands|Enable In-Game VIP Commands?", typeof(enumBoolYesNo), this.SettingVipCmd));
if (this.SettingVipCmd == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("4. Commands| - Enable VIP Command !lead", typeof(enumBoolYesNo), this.SettingLeadCmd));
if (this.SettingLeadCmd == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("4. Commands| - VIP can take from other VIP", typeof(enumBoolYesNo), this.SettingIgnoreVipLeader));
lstReturn.Add(new CPluginVariable("4. Commands| - Enforce Commo Rose Request from VIPs", typeof(enumBoolYesNo), this.SettingLeadByCRose));
}
lstReturn.Add(new CPluginVariable("4. Commands| - Enable VIP Command !killme", typeof(enumBoolYesNo), this.SettingKillmeCmd));
lstReturn.Add(new CPluginVariable("4. Commands| - Enable VIP Command !switchme", typeof(enumBoolYesNo), this.SettingSwitchmeCmd));
}
lstReturn.Add(new CPluginVariable("3. Sync Settings|On Round End write VIPs in proconrulz.ini file?", typeof(enumBoolYesNo), this.SettingProconRulzIni));
lstReturn.Add(new CPluginVariable("5. Notify - Chat Request|Show VIP Slot Infos on Chat request?", typeof(enumBoolYesNo), this.SettingChatReq));
if (this.SettingChatReq == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("5. Notify - Chat Request|Chat Commands", this.SettingInfoCommands.GetType(), this.SettingInfoCommands));
lstReturn.Add(new CPluginVariable("5. Notify - Chat Request|First Info Message", this.SettingInfoVip1.GetType(), this.SettingInfoVip1));
lstReturn.Add(new CPluginVariable("5. Notify - Chat Request|Second Info Message", this.SettingInfoVip2.GetType(), this.SettingInfoVip2));
lstReturn.Add(new CPluginVariable("5. Notify - Chat Request|Private Message to valid VIPs only", this.SettingInfoVip3.GetType(), this.SettingInfoVip3));
lstReturn.Add(new CPluginVariable("5. Notify - Chat Request|Send to all Players?", typeof(enumBoolYesNo), this.SettingInfoSay));
}
lstReturn.Add(new CPluginVariable("6. Notify - Join Message|Show Message when VIP is joining?", typeof(enumBoolYesNo), this.SettingVipJoin));
if (this.SettingVipJoin == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("6. Notify - Join Message| - VIP Player Join Message", this.SettingVipJoinMsg.GetType(), this.SettingVipJoinMsg));
}
lstReturn.Add(new CPluginVariable("6. Notify - Join Message|Show Message when NON-VIP is joining?", typeof(enumBoolYesNo), this.SettingNonVipJoin));
if (this.SettingNonVipJoin == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("6. Notify - Join Message| - NON-VIP Join Message", this.SettingNonVipJoinMsg.GetType(), this.SettingNonVipJoinMsg));
}
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Show Message when VIP is spawning (each round first spawn)?", typeof(enumBoolYesNo), this.SettingVipSpawn));
if (this.SettingVipSpawn == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|First VIP Spawn Message", this.SettingVipSpawnMsg.GetType(), this.SettingVipSpawnMsg));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Second VIP Spawn Message", this.SettingVipSpawnMsg2.GetType(), this.SettingVipSpawnMsg2));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Third VIP Spawn Message", this.SettingVipSpawnMsg3.GetType(), this.SettingVipSpawnMsg3));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|VIP Spawn Yell", this.SettingVipSpawnYell.GetType(), this.SettingVipSpawnYell));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Send First Msg to all Players?", typeof(enumBoolYesNo), this.SettingVipSpawnMsgSay));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Send Second Msg to all Players?", typeof(enumBoolYesNo), this.SettingVipSpawnMsg2Say));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Send Third Msg to all Players?", typeof(enumBoolYesNo), this.SettingVipSpawnMsg3Say));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Send Yell to all Players?", typeof(enumBoolYesNo), this.SettingVipSpawnYellAll));
lstReturn.Add(new CPluginVariable("7. Notify - Spawn Message|Send Message Delay in sec. (0-20)", this.SettingVipSpawnMsgDelay.GetType(), this.SettingVipSpawnMsgDelay));
}
lstReturn.Add(new CPluginVariable("8. Notify - VIP Slot Expired|Show Private Message when VIP Slot expired?", typeof(enumBoolYesNo), this.SettingVipExp));
if (this.SettingVipExp == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("8. Notify - VIP Slot Expired|First Slot Expired Message", this.SettingVipExpMsg.GetType(), this.SettingVipExpMsg));
lstReturn.Add(new CPluginVariable("8. Notify - VIP Slot Expired|Second Slot Expired Message", this.SettingVipExpMsg2.GetType(), this.SettingVipExpMsg2));
lstReturn.Add(new CPluginVariable("8. Notify - VIP Slot Expired|Slot Expired Yell", this.SettingVipExpYell.GetType(), this.SettingVipExpYell));
lstReturn.Add(new CPluginVariable("8. Notify - VIP Slot Expired|Delay for send Message in sec. (0-20)", this.SettingVipExpDelay.GetType(), this.SettingVipExpDelay));
}
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs|Temporary disable the 'Aggressive Join' close on round end (Conquest, TDM and Chainlink only)", typeof(enumBoolYesNo), this.SettingAggressiveJoin));
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs|Public Say Message when NON-VIP got kicked for VIP", this.SettingAggressiveJoinKick.GetType(), this.SettingAggressiveJoinKick));
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs|Private Message after NON-VIP got kicked and rejoins", this.SettingAggressiveJoinMsg.GetType(), this.SettingAggressiveJoinMsg));
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs| - Send Private Message as:", "enum.SettingAggressiveJoinMsgType(Private Yell and Private Say|Private Yell|Private Say|Say to all Players)", this.SettingAggressiveJoinMsgType));
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs|Enable Aggressive Join Abuse Protection", typeof(enumBoolYesNo), this.SettingAggressiveJoinKickAbuse));
if (this.SettingAggressiveJoinKickAbuse == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs| - Each VIP can rejoin with an Aggressive Join Kick on full server maximal: (# per round)", this.SettingAggressiveJoinKickAbuseMax.GetType(), this.SettingAggressiveJoinKickAbuseMax));
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs| - Private Message to target VIP if he triggered his max. threshold per round", this.SettingAggressiveJoinKickAbuseMsg.GetType(), this.SettingAggressiveJoinKickAbuseMsg));
lstReturn.Add(new CPluginVariable("8. Server - Aggressive Join for VIPs| - Send Private Msg as:", "enum.SettingAggressiveJoinKickAbuseMsgType(Private Yell and Private Say|Private Yell|Private Say)", this.SettingAggressiveJoinKickAbuseMsgType));
}
lstReturn.Add(new CPluginVariable("9. Advanced Settings|Debug Level (1-5)", this.fDebugLevel.GetType(), this.fDebugLevel));
lstReturn.Add(new CPluginVariable("9. Advanced Settings|Force Sync SQL and Gameserver NOW", typeof(enumBoolYesNo), this.SettingForceSync));
lstReturn.Add(new CPluginVariable("9. Advanced Settings|Mini Manager - Print VIP list with time", typeof(enumBoolYesNo), this.SettingMiniManager));
lstReturn.Add(new CPluginVariable("9. Advanced Settings|During for Yell and PYell in sec. (5-60)", this.SettingYellDuring.GetType(), this.SettingYellDuring));
lstReturn.Add(new CPluginVariable("9. Advanced Settings|Auto DB Cleaner (set expired VIPs without join event to inactive after # days)", this.SettingDBCleaner.GetType(), this.SettingDBCleaner));
lstReturn.Add(new CPluginVariable("9. Advanced Settings|Enable EA Guid Tracking and update playername changes", typeof(enumBoolYesNo), this.EAGuidTracking));
lstReturn.Add(new CPluginVariable("9. Advanced Settings|Enable Advanced Log to Adkats", typeof(enumBoolYesNo), this.SettingAdkatsLog));
if (this.SettingAdkatsLog == enumBoolYesNo.Yes) {
lstReturn.Add(new CPluginVariable("9. Advanced Settings| - NON-VIP got kicked for VIP", typeof(enumBoolYesNo), this.SettingAdkatsLogNonVipKick));
lstReturn.Add(new CPluginVariable("9. Advanced Settings| - VIP changed his playername", typeof(enumBoolYesNo), this.SettingAdkatsLogVipChanged));
lstReturn.Add(new CPluginVariable("9. Advanced Settings| - VIP triggered Aggressive Join Abuse Protection (min. threshold from settings: 2)", typeof(enumBoolYesNo), this.SettingAdkatsLogVipAggressiveJoinAbuse));
}
return lstReturn;
}
public void SetPluginVariable(String strVariable, String strValue) {
bool layerReady = (((DateTime.UtcNow - this.LayerStartingTime).TotalSeconds) > 30);
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, @"Host").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.firstCheck)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
if (strValue.Length <= 100) { this.SettingStrSqlHostname = strValue.Replace(System.Environment.NewLine, ""); }
} else if (Regex.Match(strVariable, @"Port").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.firstCheck)) { 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.firstCheck)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
if (strValue.Length <= 100) { this.SettingStrSqlDatabase = strValue.Replace(System.Environment.NewLine, ""); }
} else if (Regex.Match(strVariable, @"Username").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.firstCheck)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
if (strValue.Length <= 100) { this.SettingStrSqlUsername = strValue.Replace(System.Environment.NewLine, ""); }
} else if (Regex.Match(strVariable, @"Password").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.firstCheck)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
if (strValue.Length <= 100) { this.SettingStrSqlPassword = strValue.Replace(System.Environment.NewLine, ""); }
} else if (Regex.Match(strVariable, @"Gameserver Type").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.firstCheck)) { ConsoleError("SQL Settings locked! Please disable the Plugin and try again..."); return; }
this.SettingGameType = strValue;
if (strValue == "AUTOMATIC") {
if (this.GetGameType == "BF3") {this.NewLiner = "\n"; this.SettingGameType = "BF3";}
if (this.GetGameType == "BF4") {this.NewLiner = "\n"; this.SettingGameType = "BF4";}
if (this.GetGameType == "BFHL") {this.NewLiner = ""; this.SettingGameType = "BFH";}
if (this.GetGameType == "BFBC2") {this.NewLiner = ""; this.SettingGameType = "BC2";}
}
if (strValue == "BF3") { this.NewLiner = "\n"; }
if (strValue == "BF4") { this.NewLiner = "\n"; }
if (strValue == "BFH") { this.NewLiner = ""; }
if (strValue == "BC2") { this.NewLiner = ""; }
} else if (Regex.Match(strVariable, @"Server Group").Success) {
if ((this.fIsEnabled) && (layerReady) && (this.firstCheck)) { ConsoleError("Setting 'Server Group' locked! Please disable the Plugin and try again..."); return; }
int tmpserverid = 1;
int.TryParse(strValue, out tmpserverid);
if (tmpserverid > 0 && tmpserverid < 100) {
this.SettingStrSqlServerGroup = tmpserverid.ToString();
} else {
ConsoleError("Invalid value for MySQL Server Group. It must be a number between 1 and 99. (e.g.: 1)");
}
} else if (Regex.Match(strVariable, @"Delay for send Message").Success) {
int tmpMsgDel2 = 0;
int.TryParse(strValue, out tmpMsgDel2);
if (tmpMsgDel2 >= 0 && tmpMsgDel2 < 21) {
this.SettingVipExpDelay = tmpMsgDel2;
} else {
ConsoleError("Invalid value for Send Message Delay. It must be a number between 0 and 20. (e.g.: 0 for no delay)");
}
} else if (Regex.Match(strVariable, @"Sync Interval between SQL and Gameserver").Success) {
int tmpIntr = 0;
int.TryParse(strValue, out tmpIntr);
if (tmpIntr >= 2 && tmpIntr < 61) {
this.SettingSyncInterval = tmpIntr;
} else {
ConsoleError("Invalid value for Sync Interval. It must be a number between 2 and 60");
}
} else if (Regex.Match(strVariable, @"Import NEW VIPS from Gameserver to SQL").Success) {
this.SettingSyncGs2Sql = strValue;
} else if (Regex.Match(strVariable, @"On Round End write VIPs in proconrulz.ini file?").Success) {
this.SettingProconRulzIni = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Game Admin Commands?").Success) {
this.SettingAdminCmd = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Enable Commands for other Plugins").Success) {
this.SettingPluginCmd = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Game VIP Commands?").Success) {
this.SettingVipCmd = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"lead").Success) {
this.SettingLeadCmd = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"VIP can take from other VIP").Success) {
this.SettingIgnoreVipLeader = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Enforce Commo Rose Request from VIPs").Success) {
this.SettingLeadByCRose = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"killme").Success) {
this.SettingKillmeCmd = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"switchme").Success) {
this.SettingSwitchmeCmd = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Show VIP Slot Infos on Chat request?").Success) {
this.SettingChatReq = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Chat Commands").Success) {
if ((strValue.Length < 3) || (strValue.Length > 100)) {
this.SettingInfoCommands = "!vip,!slot,!reserved,!buy";
GenRegMatch();
} else {
this.SettingInfoCommands = strValue.Replace(System.Environment.NewLine, ",").Replace(" ", "").Replace(";", ",").Replace(",,", ",");
GenRegMatch();
}
} else if (Regex.Match(strVariable, @"First Info Message").Success) {
if ((strValue.Length >= 3) && (strValue.Length <= 100)) {
this.SettingInfoVip1 = strValue.Replace(System.Environment.NewLine, "");
} else {
ConsoleError("Invalid value for First Info Message (min. 3 and max. 100 chararcters)");
}
} else if (Regex.Match(strVariable, @"Second Info Message").Success) {
this.SettingInfoVip2 = strValue.Replace(System.Environment.NewLine, "");
} else if (Regex.Match(strVariable, @"Private Message to valid VIPs only").Success) {
this.SettingInfoVip3 = strValue;
} else if (Regex.Match(strVariable, @"Send to all Players?").Success) {
this.SettingInfoSay = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Show Message when VIP is joining?").Success) {
this.SettingVipJoin = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @" - VIP Player Join Message").Success) {
if ((strValue.Length < 3) || (strValue.Length > 100)) {
this.SettingVipJoinMsg = "%player% with !VIP SLOT joined the server";
} else {
this.SettingVipJoinMsg = strValue.Replace(System.Environment.NewLine, "");
}
} else if (Regex.Match(strVariable, @"Show Message when NON-VIP is joining?").Success) {
this.SettingNonVipJoin = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @" - NON-VIP Join Message").Success) {
if ((strValue.Length < 3) || (strValue.Length > 100)) {
this.SettingNonVipJoinMsg = "%player% joined the server";
} else {
this.SettingNonVipJoinMsg = strValue.Replace(System.Environment.NewLine, "");
}
} else if (Regex.Match(strVariable, @"Show Message when VIP is spawning").Success) {
this.SettingVipSpawn = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"First VIP Spawn Message").Success) {
if ((strValue.Length < 3) || (strValue.Length > 100)) {
this.SettingVipSpawnMsg = String.Empty;
} else {
this.SettingVipSpawnMsg = strValue;
}
} else if (Regex.Match(strVariable, @"Second VIP Spawn Message").Success) {
if (strValue.Length <= 100) { this.SettingVipSpawnMsg2 = strValue.Replace(System.Environment.NewLine, ""); }
} else if (Regex.Match(strVariable, @"Third VIP Spawn Message").Success) {
if (strValue.Length <= 100) { this.SettingVipSpawnMsg3 = strValue.Replace(System.Environment.NewLine, ""); }
} else if (Regex.Match(strVariable, @"VIP Spawn Yell").Success) {
if (strValue.Length <= 100) { this.SettingVipSpawnYell = strValue; }
} else if (Regex.Match(strVariable, @"Send First Msg to all Players?").Success) {
this.SettingVipSpawnMsgSay = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Send Second Msg to all Players?").Success) {
this.SettingVipSpawnMsg2Say = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Send Third Msg to all Players?").Success) {
this.SettingVipSpawnMsg3Say = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Send Yell to all Players?").Success) {
this.SettingVipSpawnYellAll = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Send Message Delay").Success) {
int tmpMsgDel = 0;
int.TryParse(strValue, out tmpMsgDel);
if (tmpMsgDel >= 0 && tmpMsgDel < 21) {
this.SettingVipSpawnMsgDelay = tmpMsgDel;
} else {
ConsoleError("Invalid value for Send Message Delay. It must be a number between 0 and 20. (e.g.: 0 for no delay)");
}
} else if (Regex.Match(strVariable, @"Show Private Message when VIP Slot expired?").Success) {
if (strValue.Length <= 100) { this.SettingVipExp = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); }
} else if (Regex.Match(strVariable, @"First Slot Expired Message").Success) {
if (strValue.Length > 100) {
this.SettingVipExpMsg = "%player% your !VIP SLOT has expired";
} else {
this.SettingVipExpMsg = strValue.Replace(System.Environment.NewLine, "");
}
} else if (Regex.Match(strVariable, @"Second Slot Expired Message").Success) {
if (strValue.Length <= 100) { this.SettingVipExpMsg2 = strValue.Replace(System.Environment.NewLine, ""); }
} else if (Regex.Match(strVariable, @"Slot Expired Yell").Success) {
if (strValue.Length <= 100) { this.SettingVipExpYell = strValue; }
} else if (Regex.Match(strVariable, @"Temporary disable the").Success) {
if ((enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue) == enumBoolYesNo.Yes) {
ConsoleWrite("'Aggressive Join' server setting enabled. Close on round end it will be disabled to keep as many players as possible on the server. On next round it will be enabled automatically. This feature works for the following game modes: ConquestLarge, ConquestSmall, TDM and Chainlink.");
}
this.SettingAggressiveJoin = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"Public Say Message when NON-VIP got kicked for VIP").Success) {
this.SettingAggressiveJoinKick = strValue;
} else if (Regex.Match(strVariable, @"Private Message after NON-VIP got kicked and rejoins").Success) {
if (strValue.Length <= 100) { this.SettingAggressiveJoinMsg = strValue; }
} else if (Regex.Match(strVariable, @"Send Private Message as:").Success) {
this.SettingAggressiveJoinMsgType = strValue;
} else if (Regex.Match(strVariable, @"Enable Aggressive Join Abuse Protection").Success) {
this.SettingAggressiveJoinKickAbuse = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
if ((enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue) == enumBoolYesNo.Yes) {
if ((layerReady) && (this.SettingSyncGs2Sql != "no (remove from Gameserver)") && (this.SettingSyncGs2Sql != "no (ignore)") && (this.SettingSyncGs2Sql != "yes (30 days first Plugin installation only)")) {
ConsoleWrite("ERROR: The setting 'Import NEW VIPS from Gameserver to SQL' must be set to 'NO (remove) to use 'Aggressive Join Abuse Protection'");
this.SettingAggressiveJoinKickAbuse = enumBoolYesNo.No;
}
} else {
if (layerReady) { this.AggressiveJoinAbuseCleaner(); }
}
} else if (Regex.Match(strVariable, @"Each VIP can rejoin with an Aggressive Join Kick on full server").Success) {
int tmpMaxRejoin = 0;
int.TryParse(strValue, out tmpMaxRejoin);
if (tmpMaxRejoin >= 0 && tmpMaxRejoin < 10) {
this.SettingAggressiveJoinKickAbuseMax = tmpMaxRejoin;
} else {
this.SettingAggressiveJoinKickAbuseMax = 3;
ConsoleError("Invalid value. It must be a number between 0 and 10. (e.g.: 3 - for max. 3 rejoins on full server)");
}
} else if (Regex.Match(strVariable, @"Private Message to target VIP if he triggered his max").Success) {
if (strValue.Length <= 100) { this.SettingAggressiveJoinKickAbuseMsg = strValue; }
} else if (Regex.Match(strVariable, @"Send Private Msg as:").Success) {
this.SettingAggressiveJoinKickAbuseMsgType = strValue;
} else if (Regex.Match(strVariable, @"Force Sync SQL and Gameserver NOW").Success) {
if ((enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue) == enumBoolYesNo.Yes) {
if (this.fIsEnabled) {
this.ProconVipList();
if (this.firstCheck) {
ConsoleWrite("[ForceSync] ^bForce Sync started...^n");
DebugWrite("[ForceSync] Receive VIP players from Gameserver and Sync with SQL", 3);
this.isForceSync = true;
this.ExecuteCommand("procon.protected.tasks.add", "VipSlotManager", "2", "1", "1", "procon.protected.plugins.call", "VipSlotManager", "SyncVipList");
} else {
ConsoleError("Force Sync canceled! Still loading VIPs from Gameserver");
}
} else {
ConsoleError("Force Sync canceled! Please enable the Plugin and try again...");
}
}
this.SettingForceSync = enumBoolYesNo.No;
} else if (Regex.Match(strVariable, @"Print VIP list with time").Success) {
if ((enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue) == enumBoolYesNo.Yes) {
if (this.fIsEnabled) {
if (this.firstCheck) {
this.DisplayVips();
} else {
ConsoleError("Mini Manager canceled! Still loading VIPs from Gameserver");
}
} else {
ConsoleError("Mini Manager canceled! Please enable the Plugin and try again...");
}
}
this.SettingMiniManager = enumBoolYesNo.No;
} else if (Regex.Match(strVariable, @"During for Yell and PYell in sec").Success) {
int tmpyelltime = 1;
int.TryParse(strValue, out tmpyelltime);
if (tmpyelltime >= 5 && tmpyelltime <= 60) {
this.SettingYellDuring = tmpyelltime;
} else {
ConsoleError("Invalid value for Yell During. Time must be a number between 5 and 60. (e.g.: 15)");
}
} 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;
this.DBCleanerCounter = (new Random().Next(960, 990));
} else {
ConsoleError("Invalid value. It must be a number between 1 and 999. (e.g.: 90)");
}
} else if (Regex.Match(strVariable, @"Enable EA Guid Tracking and update playername changes").Success) {
this.EAGuidTracking = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
if (layerReady) {
if (this.EAGuidTracking == enumBoolYesNo.Yes) {
ConsoleWrite("EA GUID Tracking enabled.");
ConsoleWrite("EA GUID Tracking > ^bIMPORTANT INFO:^n If the Plugins runs on two or more " + this.SettingGameType + " Gameservers, then the Plugin setting 'Import NEW VIPs from GS to SQL'^n must be set to 'no (remove)^n' on ALL " + this.SettingGameType + " Gameservers to enable the 'EA GUID Tracking'.");
ConsoleWrite("EA GUID Tracking > INFO: If a valid VIP joins the server, then his playername will be linked to his EA GUID. If he joins again with a new/changed playername then his VIP Slot will be updated to the new playername for all " + this.strBlack(this.SettingGameType) + " Server Groups in SQL database.");
} else {
this.Guid2Check.Clear();
this.GetPlayerGuid.Clear();
}
if ((this.EAGuidTracking == enumBoolYesNo.Yes) && ((this.SettingGameType != this.GetGameType.Replace("BFHL","BFH").Replace("BFBC", "BC")) && (this.GetGameType != String.Empty) && (this.SettingGameType != "AUTOMATIC"))) { ConsoleWrite("WARNING: YOU selected " + this.strBlack(this.SettingGameType) + " as Gametype but Plugin detects " + this.strBlack(this.GetGameType) + ". EA GUID Tracking can NOT work correctly because the same player can have a diffrent EA GUID on a diffrent BF Version."); }
}
} else if (Regex.Match(strVariable, @"Enable Advanced Log to Adkats").Success) {
this.SettingAdkatsLog = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"NON-VIP got kicked for VIP").Success) {
this.SettingAdkatsLogNonVipKick = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"VIP changed his playername").Success) {
this.SettingAdkatsLogVipChanged = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
} else if (Regex.Match(strVariable, @"VIP triggered Aggressive Join Abuse Protection").Success) {
this.SettingAdkatsLogVipAggressiveJoinAbuse = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
}
}
//////////////////////
// Server Events
//////////////////////
public void OnPluginLoaded(String strHostName, String strPort, String strPRoConVersion) {
this.RegisterEvents(this.GetType().Name, "OnServerInfo", "OnPlayerJoin", "OnPlayerDisconnected", "OnPlayerSpawned", "OnGlobalChat", "OnTeamChat", "OnSquadChat", "OnRoundOver", "OnLevelLoaded", "OnLoadingLevel", "OnReservedSlotsList", "OnReservedSlotsListAggressiveJoin", "OnListPlayers", "OnSquadLeader");
this.ServerIP = strHostName;
this.ServerPort = strPort;
if (this.SettingGameType == "AUTOMATIC") {
if (this.GetGameType == "BF3") { this.SettingGameType = "BF3";}
if (this.GetGameType == "BF4") { this.SettingGameType = "BF4";}
if (this.GetGameType == "BFHL") { this.SettingGameType = "BFH";}
if (this.GetGameType == "BFBC2") { this.SettingGameType = "BC2";}
}
if (this.GetGameType == "BF3") { this.NewLiner = "\n"; }
if (this.GetGameType == "BF4") { this.NewLiner = "\n"; }
if (this.GetGameType == "BFHL") { this.NewLiner = ""; }
if (this.GetGameType == "BFBC2") { this.NewLiner = ""; }
}
public void OnPluginEnable() {
this.fIsEnabled = true;
this.gotVipsGS = false;
this.firstCheck = false;
this.SqlTableExist = false;
this.SyncCounter = 999;
this.DBCleanerCounter = (new Random().Next(960, 990));
ConsoleWrite("^b^2Enabled!^0^n");
if (this.SettingGameType == "AUTOMATIC") {
ConsoleError("[Checkup] ERROR: Please go to the Plugin settings and select a valid 'GameType'. Shutdown Plugin");
return;
}
if (this.SettingGameType != this.GetGameType.Replace("BFHL","BFH").Replace("BFBC", "BC")) { ConsoleWrite("Info about your current Plugin settings: YOU selected " + this.strBlack(this.SettingGameType) + " as Gametype but Plugin detects " + this.strBlack(this.GetGameType)); }
ConsoleWrite("Main Settings loaded. ^nServer Group: ^b" + this.SettingGameType + " - " + this.SettingStrSqlServerGroup + "^n");
if ((this.SettingSyncGs2Sql != "no (remove from Gameserver)") && (this.SettingSyncGs2Sql != "yes (30 days first Plugin installation only)")) {ConsoleWrite("Info about your current Plugin settings: If two or more Gameservers use the same 'Server Group' ID then the Plugin setting 'Import NEW VIPs from GS to SQL'^n must be set to 'no (remove)^n'. This setting is also required to use the 'Aggressive Join Kick Protection'.");}
this.ProconVipList();
this.GenRegMatch();
this.ExecuteCommand("procon.protected.tasks.add", "VipSlotManager", "3", "9", "20", "procon.protected.plugins.call", "VipSlotManager", "PluginStarter");
if (this.GetGameType == "BFBC2") { this.ExecuteCommand("procon.protected.tasks.add", "VipSlotManager", "5", "100", "-1", "procon.protected.send", "reservedSlots.list"); } //bfbc2
}
public void OnPluginDisable() {
this.ExecuteCommand("procon.protected.tasks.remove", "VipSlotManager");
this.AggressiveJoinAbuseCleaner();
this.fIsEnabled = false;
this.SqlVipsActive.Clear();
this.SqlVipsActiveNamesOnly.Clear();
this.onJoinSpammer.Clear();
this.vipsExpired.Clear();
this.kickedForVip.Clear();
this.vipmsg.Clear();
this.playerTeamID.Clear();
this.playerSquadID.Clear();
this.SquadLederList.Clear();
this.Guid2Check.Clear();
this.GetPlayerGuid.Clear();
this.vipsGS.Clear();
this.NameGuidList.Clear();
this.SyncCounter = 999;
this.SqlTableExist = false;
this.gotVipsGS = false;
this.firstCheck = false;
ConsoleWrite("^b^8Disabled!^0^n");
}
public override void OnReservedSlotsList(List<string> soldierNames) {
if (!this.fIsEnabled) { return; }
DebugWrite("[OnReservedSlotsList] Receive VIP players from Gameserver (reservedSlotList)", 5);
this.vipsGS = soldierNames;
this.gotVipsGS = true;
}
public override void OnReservedSlotsListAggressiveJoin(bool isEnabled) {
this.AggressiveJoin = isEnabled;
}
public override void OnSquadLeader(int teamId, int squadId, string soldierName) {
if ((teamId > 0) && (squadId > 0)) {
if (this.SquadLederList.ContainsKey(teamId.ToString() + squadId.ToString())) {
this.SquadLederList[teamId.ToString() + squadId.ToString()] = soldierName;
} else {
this.SquadLederList.Add(teamId.ToString() + squadId.ToString(), soldierName);
}
if (this.playerTeamID.ContainsKey(soldierName)) {
this.playerTeamID[soldierName] = teamId;
} else {
this.playerTeamID.Add(soldierName, teamId);
}
if (this.playerSquadID.ContainsKey(soldierName)) {
this.playerSquadID[soldierName] = squadId;
} else {
this.playerSquadID.Add(soldierName, squadId);
}
}
}
public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset) {
if (!this.fIsEnabled) { return; }
try {
if (CPlayerSubset.PlayerSubsetType.All == subset.Subset) {
DebugWrite("[OnListPlayers] Receive playerlist with TeamID and SquadID", 5);
this.vipsCurrentlyOnline = 0;
// this.NameGuidList.Clear();
foreach (CPlayerInfo playerinfo in players) {
if (this.SqlVipsActive.ContainsKey(playerinfo.SoldierName)) { this.vipsCurrentlyOnline++; }
if (this.playerTeamID.ContainsKey(playerinfo.SoldierName)) {
this.playerTeamID[playerinfo.SoldierName] = playerinfo.TeamID;
} else {
this.playerTeamID.Add(playerinfo.SoldierName, playerinfo.TeamID);
}
if (this.playerSquadID.ContainsKey(playerinfo.SoldierName)) {
this.playerSquadID[playerinfo.SoldierName] = playerinfo.SquadID;
} else {
this.playerSquadID.Add(playerinfo.SoldierName, playerinfo.SquadID);
}
if (playerinfo.GUID.StartsWith("EA_")) {