-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSquadManager.cs
4161 lines (3449 loc) · 156 KB
/
SquadManager.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
/* SquadManager.cs
Copyright 2015 by LumPenPacK
* Contact: prei[-@-]me.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, without restriction.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
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 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;
namespace PRoConEvents
{
//Aliases
using EventType = PRoCon.Core.Events.EventType;
using CapturableEvent = PRoCon.Core.Events.CapturableEvents;
public class SquadManager : PRoConPluginAPI, IPRoConPluginInterface
{
private int fDebugLevel;
private bool enabled;
private Squads squads;
private bool WaitingSquadList;
private bool WaitingSquadLeaders;
private bool BuildComplete;
private bool BuildCompleteMessageSent;
private String GameMode;
private bool? SquadSwitchPossible;
private double RoundTime;
private List<NewPlayer> NewPlayersQueue;
private List<String> RestoreOnRoundStart;
private bool started;
private System.Timers.Timer aTimer;
private System.Timers.Timer bTimer;
private System.Timers.Timer cTimer;
private System.Timers.Timer PluginIntervalTimer;
private List<CPlayerInfo> PlayersList;
private bool? ReservedSlotsReceived;
private List<Vote> Votes;
bool RestoreComplete;
private List<SquadInviter> ListSquadInviters;
private int ServerSize;
private int CurrentPlayers;
private int[] CurrentPlayersTeams;
private List<List<object>> JoinSwitchQueue;
private List<Squad> SquadChangeOnDeadQueue;
public List<String> Messages;
private int MessageCounter;
public static String[] SQUAD_NAMES = new String[] { "None",
"Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel",
"India", "Juliet", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa",
"Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "Xray",
"Yankee", "Zulu", "Haggard", "Sweetwater", "Preston", "Redford", "Faith", "Celeste", "VIRTUAL"};
// Settings
private bool RestoreSquads;
private bool RemoveIdleLeader;
private bool RemoveNoOrdersLeader;
private bool SendWarnings = false;
private int NoOrdersWarnings = 3;
private List<String> WhiteList;
private bool UseReservedList;
private List<String> ReservedSlots;
private bool VoteDismiss;
private static int VotesNeededDismiss;
private bool UseLeaderList;
private bool Enforce;
private bool YellVote;
private static int VoteDuration;
private int MaxWaiting;
private bool YellWarnings;
private int MaxIdleTime;
private bool ExcludeRush;
private bool ExcludeChainLink;
private bool InviteCommand;
private static int MaxInvites;
private bool SquadLeadersOnly;
private bool AllowTeamSwitches;
private static bool WriteMessages;
private int Interval;
private static int HowManyInviteMessages;
private bool MoveLead;
private bool UnlockSquads;
private bool Regroup;
private bool RegroupSquadOnly;
private bool MergeSquads;
private bool UseAdminList;
public class Squad
{
private int[] ID { get; set; }
private List<String> Members { get; set; }
private String Leader;
private DateTime LastUpdated { get; set; }
private int LeaderIdleTime { get; set; }
private DateTime LastOrder { get; set; }
private int LeaderOrders { get; set; }
private int OrderWarnings { get; set; }
public Squad(String FirstPlayer, int TeamID, int SquadID)
{
this.Members = new List<String>();
this.Members.Add(FirstPlayer);
if (TeamID > 0 && SquadID > 0)
this.Leader = FirstPlayer;
else
this.Leader = "#NONE#";
this.ID = new int[2] { TeamID, SquadID };
this.LeaderIdleTime = 0;
this.LastUpdated = DateTime.Now.AddSeconds(-300);
this.LastOrder = DateTime.Now;
this.LeaderOrders = 0;
this.OrderWarnings = 0;
}
public Squad(int TeamID, int SquadID)
{
this.Members = new List<String>();
if (TeamID > 0 && SquadID > 0)
this.Leader = String.Empty;
else
this.Leader = "#NONE#";
this.ID = new int[2] { TeamID, SquadID };
this.LeaderIdleTime = 0;
this.LastUpdated = DateTime.Now.AddSeconds(-300);
this.LastOrder = DateTime.Now;
this.LeaderOrders = 0;
this.OrderWarnings = 0;
}
public int[] getID()
{
return this.ID;
}
public int getID(int i)
{
return this.ID[i];
}
public void AddPlayer(String member)
{
if (!this.Members.Contains(member))
{
if (this.Members.Count == 0)
{
SetSquadLeader(member);
}
this.Members.Add(member);
}
}
public int[] RemPlayer(String member)
{
int[] RequestLeader = new int[2];
this.Members.Remove(member);
if (this.Leader.Equals(member))
{
if (this.Members.Count == 1)
{
SetSquadLeader(member);
}
else if (this.Members.Count == 0)
{
SetSquadLeader(String.Empty);
}
RequestLeader[0] = getID(0);
RequestLeader[1] = getID(1);
}
return RequestLeader;
}
public void SetSquadLeader(String leader)
{
if (getID(1) == 0)
this.Leader = "#NONE#";
else
this.Leader = leader;
this.LeaderIdleTime = 0;
this.LastUpdated = DateTime.Now.AddSeconds(-300);
this.LastOrder = DateTime.Now;
this.LeaderOrders = 0;
this.OrderWarnings = 0;
}
public void UnsetSquadLeader()
{
if (getID(1) == 0)
this.Leader = "#NONE#";
else
this.Leader = String.Empty;
this.LeaderIdleTime = 0;
this.LastUpdated = DateTime.Now.AddSeconds(-300);
this.LastOrder = DateTime.Now;
this.LeaderOrders = 0;
this.OrderWarnings = 0;
}
public String GetSquadLeader()
{
return this.Leader;
}
public String GetNoSquadLeader()
{
if (getID(1) == 0)
{
return "#NONE#";
}
if (Members.Count == 1)
{
return String.Empty;
}
//Choose next player in squad after current leader
int index = (Members.IndexOf(GetSquadLeader()) + 1) % getSize();
return Members[index];
}
public int getOrderWarnings()
{
return this.OrderWarnings;
}
public void setOrderWarnings()
{
this.OrderWarnings++;
}
public String getName()
{
return SQUAD_NAMES[getID(1)];
}
public void setID(int i, int value)
{
this.ID[i] = value;
}
public void OnRoundStart()
{
this.LeaderIdleTime = 0;
this.LastUpdated = DateTime.Now.AddSeconds(-300);
this.LastOrder = DateTime.Now;
this.LeaderOrders = 0;
this.OrderWarnings = 0;
}
public void setLeaderOrders()
{
this.LeaderOrders++;
this.LastOrder = DateTime.Now;
}
public int getLeaderOrders()
{
return this.LeaderOrders;
}
public int getTimeLastOrders()
{
return Convert.ToInt32(DateTime.Now.Subtract(this.LastOrder).TotalSeconds);
}
public void setLeaderIdle(int IdleTime)
{
this.LeaderIdleTime = IdleTime;
this.LastUpdated = DateTime.Now;
}
public int getLeaderIdleTimeSeconds()
{
return this.LeaderIdleTime;
}
public int getLeaderIdleTimeLastUpdateSeconds()
{
if (LastUpdated == null)
return Convert.ToInt32(DateTime.Now.Subtract(DateTime.Now.AddSeconds(-300)).TotalSeconds);
else
return Convert.ToInt32(DateTime.Now.Subtract(this.LastUpdated).TotalSeconds);
}
public List<String> getMembers()
{
return this.Members;
}
public bool isMember(String SoldierName)
{
return this.Members.Contains(SoldierName);
}
public bool isMember(CPlayerInfo Soldier)
{
return this.Members.Contains(Soldier.SoldierName);
}
public int getSize()
{
return Members.Count;
}
public bool Equals(Squad OtherSquad)
{
return this.getID(0).Equals(OtherSquad.getID(0)) && this.getID(1).Equals(OtherSquad.getID(1));
}
}
public class VirtualSquad : Squad
{
bool opened;
bool SquadLeaderIsSet;
int NewSquadID;
public VirtualSquad(String FirstPlayer, int TeamID, int SquadID)
: base(FirstPlayer, TeamID, SquadID)
{
}
public VirtualSquad(int TeamID, int SquadID)
: base(TeamID, SquadID)
{
}
public void Open()
{
this.opened = true;
}
public void Close()
{
this.opened = false;
}
public bool IsSquadOpen()
{
return opened;
}
public bool SquadLeaderKnown()
{
return SquadLeaderIsSet;
}
public void SetSquadLeaderKnown()
{
SquadLeaderIsSet = true;
}
public void SetNewSquadID(int i)
{
NewSquadID = i;
}
public int GetNewSquadID()
{
return NewSquadID;
}
}
public class Squads
{
private List<Squad> SquadList { get; set; }
public Squads()
{
this.SquadList = new List<Squad>();
}
public void AddSquad(Squad squad)
{
if (!this.SquadList.Contains(squad))
this.SquadList.Add(squad);
}
public void RemSquad(Squad squad)
{
this.SquadList.Remove(squad);
}
public int[] AddPlayer(String SoldierName, int TeamID, int SquadID)
{
int[] RequestLeader = new int[2];
bool SquadFound = false;
bool PlayerDelete = false;
if (String.IsNullOrEmpty(SoldierName))
return RequestLeader;
foreach (Squad squad in SquadList)
{
if (squad.getMembers().Contains(SoldierName))
{
RequestLeader = squad.RemPlayer(SoldierName);
PlayerDelete = true;
}
if (squad.getID(0) == TeamID && squad.getID(1) == SquadID)
{
squad.AddPlayer(SoldierName);
if (PlayerDelete)
return RequestLeader;
SquadFound = true;
}
}
if (SquadFound)
return RequestLeader;
Squad NewSquad = new Squad(SoldierName, TeamID, SquadID);
SquadList.Add(NewSquad);
return RequestLeader;
}
public void AddPlayer(CPlayerInfo player)
{
if (player == null)
return;
AddPlayer(player.SoldierName, player.TeamID, player.SquadID);
}
public int[] RemPlayer(String SoldierName)
{
int[] RequestLeader = new int[2];
foreach (Squad squad in SquadList)
{
if (squad.getMembers().Contains(SoldierName))
{
RequestLeader = squad.RemPlayer(SoldierName);
/*if (squad.getMembers().Count == 0)
SquadList.Remove(squad);*/
}
}
return RequestLeader;
}
public Squad SearchSquad(int TeamID, int SquadID)
{
foreach (Squad squad in SquadList)
{
if (squad.getID(0) == TeamID && squad.getID(1) == SquadID)
return squad;
}
return null;
}
public Squad SearchSquad(CPlayerInfo Soldier)
{
if (Soldier == null || String.IsNullOrEmpty(Soldier.SoldierName))
return null;
return SearchSquad(Soldier.TeamID, Soldier.SquadID);
}
public Squad SearchSquad(String SoldierName)
{
if (String.IsNullOrEmpty(SoldierName))
return null;
foreach (Squad squad in SquadList)
{
if (squad.isMember(SoldierName))
return squad;
}
return null;
}
public List<Squad> getSquads()
{
return this.SquadList;
}
public List<String> getSquadLeaders()
{
List<String> SquadLeaders = new List<String>();
foreach (Squad squad in SquadList)
if (squad.GetSquadLeader() != String.Empty && squad.getID(0) > 0 && squad.getID(1) > 0)
SquadLeaders.Add(squad.GetSquadLeader());
return SquadLeaders;
}
public int FindEmptySquad(int TeamID)
{
bool[] TakenSquads = new bool[32];
foreach (Squad squad in SquadList)
{
if (squad.getID(0) == TeamID && squad.getID(1) > 0)
{
TakenSquads[squad.getID(1)] = true;
if (squad.getMembers().Count == 0)
{
return squad.getID(1);
}
}
}
for (int i = 1; i < TakenSquads.Length; i++)
{
if (TakenSquads[i] == false)
return i;
}
return -1;
}
public void Clear()
{
SquadList.Clear();
}
}
public class Vote
{
private List<String> YesVotes;
private String StartedBy;
private DateTime TimeStamp;
private int[] SquadID;
private bool ResultSent;
private bool VoteCanceled;
public Vote(String StartedBy, int TeamID, int SquadID)
{
this.YesVotes = new List<String>();
this.StartedBy = StartedBy;
this.TimeStamp = DateTime.Now;
this.ResultSent = false;
this.VoteCanceled = false;
if (TeamID < 1 || SquadID < 1)
this.SquadID = new int[2] { -1, -1 };
else
this.SquadID = new int[2] { TeamID, SquadID };
}
public bool getResultSent()
{
return this.ResultSent;
}
public void setResultSent(bool b)
{
this.ResultSent = b;
}
public String VoteYes(String Voter)
{
if (Voter == getVoteInitiator())
return "You've already voted by starting this vote.";
else if (YesVotes.Contains(Voter))
return "You've already voted.";
else
{
YesVotes.Add(Voter);
return "Your vote has been counted.";
}
}
public void RemoveVote(String Voter)
{
YesVotes.Remove(Voter);
if (Voter == getVoteInitiator())
this.TimeStamp = DateTime.Now.AddSeconds(-9999);
}
public String getVoteInitiator()
{
return this.StartedBy;
}
public int getVoteAge()
{
return Convert.ToInt32(DateTime.Now.Subtract(this.TimeStamp).TotalSeconds);
}
public bool VoteIsRunning()
{
if (getVoteAge() > VoteDuration)
return false;
else
return true;
}
public int getVoteID(int i)
{
if (i == 0 || i == 1)
return SquadID[i];
else
return -1;
}
public int getVoteResult()
{
if (VoteCanceled)
return 4;
if (YesVotes.Count >= VotesNeededDismiss)
return 2;
if (VoteIsRunning())
return 1;
else
return 3;
}
public void setVoteCanceled(bool b)
{
this.VoteCanceled = b;
}
}
public class NewPlayer
{
int TeamID, SquadID;
String SoldierName;
public NewPlayer(String SoldierName)
{
this.SoldierName = SoldierName;
}
public NewPlayer(String SoldierName, int TeamID, int SquadID)
{
this.SoldierName = SoldierName;
this.TeamID = TeamID;
this.SquadID = SquadID;
}
public void setTeamID(int TeamID)
{
this.TeamID = TeamID;
}
public void setSquadID(int SquadID)
{
this.SquadID = SquadID;
}
public int getTeamID()
{
return TeamID;
}
public int getSquadID()
{
return SquadID;
}
public String getSoldierName()
{
return SoldierName;
}
}
public class SquadInviter
{
String inviter;
int RoundInvites;
List<String> invitees;
List<List<object>> MessagesSentTo;
public SquadInviter(String Inviter)
{
this.inviter = Inviter;
this.RoundInvites = 0;
this.invitees = new List<String>();
this.MessagesSentTo = new List<List<object>>();
}
public void RemoveInvite(String inviteeLeft)
{
invitees.Remove(inviteeLeft);
}
/* Inviter left ---> Could be used to spam players
public void RemoveInvite()
{
}
*/
public void SendInvite(String invitee)
{
List<object> message = new List<object>();
message.Add(invitee);
message.Add(0);
MessagesSentTo.Add(message);
this.invitees.Add(invitee);
this.RoundInvites++;
}
public void SendMessageTo(String recipient)
{
foreach (List<object> entry in MessagesSentTo)
{
if ((String)entry[0] == recipient)
entry[1] = (int)entry[1] + 1;
}
}
public void SendMessageTo(String recipient, int Count)
{
foreach (List<object> entry in MessagesSentTo)
{
if ((String)entry[0] == recipient)
entry[1] = Count;
}
}
public List<String> getInvitees()
{
return this.invitees;
}
public String getInviter()
{
return this.inviter;
}
public int getRoundInvites()
{
return this.RoundInvites;
}
public int getMessagesSentTo(String AskRecipient)
{
foreach (List<object> entry in MessagesSentTo)
{
if ((String)entry[0] == AskRecipient)
return (int)entry[1];
}
return int.MaxValue;
}
}
public SquadManager()
{
WaitingSquadList = true;
WaitingSquadLeaders = true;
BuildComplete = false;
BuildCompleteMessageSent = false;
squads = new Squads();
GameMode = String.Empty;
SquadSwitchPossible = null;
RoundTime = 0.0;
ServerSize = 0;
ReservedSlots = new List<String>();
ReservedSlotsReceived = null;
NewPlayersQueue = new List<NewPlayer>();
started = true;
PlayersList = new List<CPlayerInfo>();
RestoreOnRoundStart = new List<String>();
Votes = new List<Vote>();
RestoreComplete = true;
ListSquadInviters = new List<SquadInviter>();
CurrentPlayers = 0;
JoinSwitchQueue = new List<List<object>>(); // TeamOrigin, TeamDestination, SquadOrigin, SquadDestion, force
SquadChangeOnDeadQueue = new List<Squad>(); // TeamDestination, SquadDestion,
CurrentPlayersTeams = new int[4];
MessageCounter = 0;
bTimer = new System.Timers.Timer();
bTimer.Interval = 30000;
bTimer.Elapsed += new ElapsedEventHandler(SpawnPossible);
bTimer.Stop();
PluginIntervalTimer = new System.Timers.Timer();
PluginIntervalTimer.Interval = 30000;
PluginIntervalTimer.Elapsed += new ElapsedEventHandler(PluginInterval);
PluginIntervalTimer.Stop();
cTimer = new System.Timers.Timer();
cTimer.Interval = 20000;
cTimer.Elapsed += new ElapsedEventHandler(PerformSwitchQueueBeforeScramble);
cTimer.Stop();
Messages = new List<String>();
// Settings
RestoreSquads = false;
RemoveIdleLeader = false;
RemoveNoOrdersLeader = false;
SendWarnings = false;
NoOrdersWarnings = 3;
WhiteList = new List<String>();
UseReservedList = false;
UseAdminList = true;
VoteDismiss = false;
VotesNeededDismiss = 3;
UseLeaderList = false;
Enforce = true;
MaxIdleTime = 30;
YellVote = false;
VoteDuration = 30;
MaxWaiting = 3;
YellWarnings = false;
ExcludeRush = true;
ExcludeChainLink = true;
InviteCommand = true;
MaxInvites = 3;
SquadLeadersOnly = false;
AllowTeamSwitches = true;
WriteMessages = true;
Interval = 120;
HowManyInviteMessages = 3;
MoveLead = true;
UnlockSquads = false;
Regroup = true;
RegroupSquadOnly = false;
MergeSquads = true;
}
public enum MessageType
{
Warning, Error, Exception, Normal
};
public String FormatMessage(String msg, MessageType type)
{
String prefix = "[^bSquadManager^n] ";
if (type.Equals(MessageType.Warning))
prefix += "^1^bWARNING^0^n: ";
else if (type.Equals(MessageType.Error))
prefix += "^1^bERROR^0^n: ";
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(msg, MessageType.Error);
}
public void ConsoleException(String msg)
{
ConsoleWrite(msg, MessageType.Exception);
}
public void DebugWrite(string msg, int level)
{
if (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 "SquadManager";
}
public string GetPluginVersion()
{
return "0.9.9.2";
}
public string GetPluginAuthor()
{
return "LumPenPacK";
}
public string GetPluginWebsite()
{
return "TBD";
}
public string GetPluginDescription()
{
return @"<h1>Squad Manager with the goal to improve Squad and Team Play</h1>
<p>Supported Games:</b> BF4<br>
Supported Game Modes:</b> All but not tested with SQDM yet.</p><br>
<p>Do you think this plug-in useful and you want to support my work on future updates?</p>
<form action=""https://www.paypal.com/cgi-bin/webscr"" method=""post"" target=""_blank"">
<input type=""hidden"" name=""cmd"" value=""_s-xclick"">
<input type=""hidden"" name=""hosted_button_id"" value=""H6MM23JN4SVHL"">
<input type=""image"" src=""https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_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>
<h2><p>Features and Settings</p></h2>
<blockquote>
<p><b>1 - Restore Squad Leaders</b><br>
Use this feature to restore Squad Leaders after Team Scramble.<br>
For balancing reasons the plug-in doesn't restore Squads structure. This should be done by the Balancing tool, otherwise this plug-in would destroy the Team Scramble between the rounds.<br>
That's the reason why you should primarily use this option with Team Scramble that doesn't destroy Squads.<br>
It was tested with MULTIBalancer's ""Keep Squads Together"" feature.
</p>
</blockquote>
<blockquote>
<p><b>2 - Dismiss Idle Squad Leaders</b><br>
With this option the plugin gives anyone else Squad Lead if the current Squad Leader is idling.<br>
The old Squad Leader stays in the Squad and a random other player from the Squad takes over Squad Lead.<br>
At the moment the new Squad Leader will be chosen randomly. For future updates there will be an option to choose the new Leader based on stats or reputation. <br>
You can choose the <b>Maximum Idle Time in seconds</b>. This value should be >= 30s since Squad Leaders idle times aren't updated faster than every 30s.<br>
</p>
</blockquote>
<blockquote>
<p><b>3 - Dismiss No Orders Squad Leaders</b><br>
With this option the plugin gives anyone else Squad Lead if the current Squad Leader is giving no Squad Orders.<br>
The old Squad Leader stays in the Squad and a random other player from the Squad takes over Squad Lead.<br>
At the moment the new Squad Leader will be chosen randomly. For future updates there will be an option to choose the new Leader based on stats or reputation. <br>
Please note: Only Squad Leader commands via Comme Rose can be counted as Orders.<br>
<b>Only on Conquest</b> disables this feature on any other game Mode than Conquest.<br>
<b>Maximum waiting time for orders (minutes)</b> determines how long the plug-in waits for Squad Orders before it will warn or remove a Squad Leaders.<br>
If you enable <b>Send warnings before dismiss)</b>, a Squad Leader will get your selected number of warnings before dismiss.<br>