forked from borzh/botrix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole_commands.h
More file actions
1224 lines (1037 loc) · 37.4 KB
/
console_commands.h
File metadata and controls
1224 lines (1037 loc) · 37.4 KB
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
#ifndef __BOTRIX_CONSOLE_COMMANDS_H__
#define __BOTRIX_CONSOLE_COMMANDS_H__
#include <good/memory.h>
#include "types.h"
#include "clients.h"
#include "item.h"
#include "type2string.h"
#include "public/tier1/convar.h"
#include "public/edict.h"
//****************************************************************************************************************
/// Console command.
//****************************************************************************************************************
class CConsoleCommand
{
public:
CConsoleCommand( char *szCommand, TCommandAccessFlags iCommandAccessFlags = FCommandAccessNone ):
m_sCommand(szCommand), m_iAccessLevel(iCommandAccessFlags) {}
virtual ~CConsoleCommand() {}
bool IsCommand( const char* szCommand ) { return m_sCommand == szCommand; }
bool HasAccess( CClient* pClient )
{
TCommandAccessFlags access = pClient ? pClient->iCommandAccessFlags : FCommandAccessAll;
return FLAG_ALL_SET(m_iAccessLevel, access);
}
virtual TCommandResult Execute( CClient* pClient, int argc, const char** argv ) = 0;
virtual void PrintCommand( edict_t* pPrintTo, int indent = 0);
#if defined(BOTRIX_NO_COMMAND_COMPLETION)
#elif defined(BOTRIX_OLD_COMMAND_COMPLETION)
virtual int AutoComplete( const char* partial, int partialLength,
char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ],
int strIndex, int charIndex );
#else
virtual int AutoComplete( char* partial, int partialLength, CUtlVector<CUtlString>& cCommands, int charIndex );
#endif
protected:
CConsoleCommand() : m_iAccessLevel(0), m_bAutoCompleteOnlyOneArgument(false) {}
good::string m_sCommand;
int m_iAccessLevel;
good::string m_sHelp;
good::string m_sDescription;
StringVector m_cAutoCompleteArguments;
bool m_bAutoCompleteOnlyOneArgument;
};
//****************************************************************************************************************
/// Container of commands.
//****************************************************************************************************************
class CConsoleCommandContainer: public CConsoleCommand
{
public:
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
void Add( CConsoleCommand* newCommand ) { m_aCommands.push_back( good::unique_ptr<CConsoleCommand>(newCommand) ); }
virtual void PrintCommand( edict_t* pPrintTo, int indent = 0);
#if defined(BOTRIX_NO_COMMAND_COMPLETION)
#elif defined(BOTRIX_OLD_COMMAND_COMPLETION)
virtual int AutoComplete( const char* partial, int partialLength,
char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ],
int strIndex, int charIndex );
#else
virtual int AutoComplete( char* partial, int partialLength, CUtlVector< CUtlString > &commands, int charIndex );
#endif
protected:
good::vector< good::unique_ptr<CConsoleCommand> > m_aCommands;
};
//****************************************************************************************************************
// Waypoint commands.
//****************************************************************************************************************
class CWaypointDrawFlagCommand: public CConsoleCommand
{
public:
CWaypointDrawFlagCommand();
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointResetCommand: public CConsoleCommand
{
public:
CWaypointResetCommand()
{
m_sCommand = "reset";
m_sHelp = "reset current waypoint to nearest";
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointCreateCommand: public CConsoleCommand
{
public:
CWaypointCreateCommand()
{
m_sCommand = "create";
m_sHelp = "create new waypoint at current player's position";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointRemoveCommand: public CConsoleCommand
{
public:
CWaypointRemoveCommand()
{
m_sCommand = "remove";
m_sHelp = "delete given or current waypoint";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointMoveCommand: public CConsoleCommand
{
public:
CWaypointMoveCommand()
{
m_sCommand = "move";
m_sHelp = "moves destination or given waypoint to current player's position";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointAutoCreateCommand: public CConsoleCommand
{
public:
CWaypointAutoCreateCommand()
{
m_sCommand = "autocreate";
m_sHelp = "automatically create new waypoints ('off' - disable, 'on' - enable)";
m_sDescription = "Waypoint will be added when player goes too far from current one.";
m_iAccessLevel = FCommandAccessWaypoint;
m_cAutoCompleteArguments.push_back("on");
m_cAutoCompleteArguments.push_back("off");
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointInfoCommand: public CConsoleCommand
{
public:
CWaypointInfoCommand()
{
m_sCommand = "info";
m_sHelp = "display info of current waypoint at console";
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointDestinationCommand: public CConsoleCommand
{
public:
CWaypointDestinationCommand()
{
m_sCommand = "destination";
m_sHelp = "lock given or current waypoint as path 'destination'";
m_sDescription = "Set to -1 to unlock.";
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointSaveCommand: public CConsoleCommand
{
public:
CWaypointSaveCommand()
{
m_sCommand = "save";
m_sHelp = "save waypoints";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointLoadCommand: public CConsoleCommand
{
public:
CWaypointLoadCommand()
{
m_sCommand = "load";
m_sHelp = "load waypoints";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointClearCommand: public CConsoleCommand
{
public:
CWaypointClearCommand()
{
m_sCommand = "clear";
m_sHelp = "delete all waypoints";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointAddTypeCommand: public CConsoleCommand
{
public:
CWaypointAddTypeCommand()
{
m_sCommand = "addtype";
m_sHelp = "add type to waypoint";
m_sDescription = good::string("Can be mix of: ") + CTypeToString::WaypointFlagsToString(FWaypointAll);
m_iAccessLevel = FCommandAccessWaypoint;
for ( int i=0; i < EWaypointFlagTotal; ++i )
m_cAutoCompleteArguments.push_back( CTypeToString::WaypointFlagsToString(1<<i).duplicate() );
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointRemoveTypeCommand: public CConsoleCommand
{
public:
CWaypointRemoveTypeCommand()
{
m_sCommand = "removetype";
m_sHelp = "remove all waypoint types";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointArgumentCommand: public CConsoleCommand
{
public:
CWaypointArgumentCommand();
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointVisibilityCommand: public CConsoleCommand
{
public:
CWaypointVisibilityCommand();
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
//****************************************************************************************************************
// Area waypoint commands.
//****************************************************************************************************************
class CWaypointAreaRemoveCommand: public CConsoleCommand
{
public:
CWaypointAreaRemoveCommand()
{
m_sCommand = "remove";
m_sHelp = "delete waypoint area";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointAreaRenameCommand: public CConsoleCommand
{
public:
CWaypointAreaRenameCommand()
{
m_sCommand = "rename";
m_sHelp = "rename waypoint area";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointAreaSetCommand: public CConsoleCommand
{
public:
CWaypointAreaSetCommand()
{
m_sCommand = "set";
m_sHelp = "set waypoint area";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CWaypointAreaShowCommand: public CConsoleCommand
{
public:
CWaypointAreaShowCommand()
{
m_sCommand = "show";
m_sHelp = "print all waypoint areas";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
//****************************************************************************************************************
// Path waypoint commands.
//****************************************************************************************************************
class CPathDistanceCommand: public CConsoleCommand
{
public:
CPathDistanceCommand()
{
m_sCommand = "distance";
m_sHelp = "set distance to add default paths & auto add waypoints";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CPathDrawCommand: public CConsoleCommand
{
public:
CPathDrawCommand();
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CPathCreateCommand: public CConsoleCommand
{
public:
CPathCreateCommand()
{
m_sCommand = "create";
m_sHelp = "create path (from current waypoint to 'destination')";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CPathRemoveCommand: public CConsoleCommand
{
public:
CPathRemoveCommand()
{
m_sCommand = "remove";
m_sHelp = "remove path (from current waypoint to 'destination')";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CPathAutoCreateCommand: public CConsoleCommand
{
public:
CPathAutoCreateCommand()
{
m_sCommand = "autocreate";
m_sHelp = "enable auto path creation for new waypoints ('off' - disable, 'on' - enable)";
m_sDescription = "If disabled, only path from 'destination' to new waypoint will be added";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
/*
class CPathSwapCommand: public CConsoleCommand
{
public:
CPathSwapCommand()
{
m_sCommand = "swap";
m_sHelp = "set current waypoint as 'destination' and teleport to old 'destination'";
m_sDescription = "If argument is provided, then teleport there";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
*/
class CPathAddTypeCommand: public CConsoleCommand
{
public:
CPathAddTypeCommand()
{
m_sCommand = "addtype";
m_sHelp = "add path type (from current waypoint to 'destination').";
m_sDescription = good::string("Can be mix of: ") + CTypeToString::PathFlagsToString(FPathAll);
m_iAccessLevel = FCommandAccessWaypoint;
for ( int i=0; i < EPathFlagTotal; ++i )
m_cAutoCompleteArguments.push_back( CTypeToString::PathFlagsToString(1<<i).duplicate() );
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CPathRemoveTypeCommand: public CConsoleCommand
{
public:
CPathRemoveTypeCommand()
{
m_sCommand = "removetype";
m_sHelp = "remove path type (from current waypoint to 'destination')";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CPathArgumentCommand: public CConsoleCommand
{
public:
CPathArgumentCommand()
{
m_sCommand = "argument";
m_sHelp = "set path arguments.";
m_sDescription = "First parameter is time to wait before action, and second is action duration.";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CPathInfoCommand: public CConsoleCommand
{
public:
CPathInfoCommand()
{
m_sCommand = "info";
m_sHelp = "display path info on console (from current waypoint to 'destination')";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
//****************************************************************************************************************
// Weapon commands.
//****************************************************************************************************************
class CBotWeaponAddCommand: public CConsoleCommand
{
public:
CBotWeaponAddCommand()
{
m_sCommand = "add";
m_sHelp = "add a weapon to bot";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotWeaponAllowCommand: public CConsoleCommand
{
public:
CBotWeaponAllowCommand()
{
m_sCommand = "allow";
m_sHelp = "allow bots to use given weapons";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotWeaponForbidCommand: public CConsoleCommand
{
public:
CBotWeaponForbidCommand()
{
m_sCommand = "forbid";
m_sHelp = "forbid bots to use given weapons";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotWeaponRemoveCommand: public CConsoleCommand
{
public:
CBotWeaponRemoveCommand()
{
m_sCommand = "remove";
m_sHelp = "remove all weapons from bot";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotWeaponUnknownCommand: public CConsoleCommand
{
public:
CBotWeaponUnknownCommand()
{
m_sCommand = "unknown";
m_sHelp = "bot assumption about unknown weapons ('melee' or 'ranged')";
m_sDescription = "If bot grabs or respawns with unknown weapon, choose it to be marked as melee or ranged";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
//****************************************************************************************************************
// Bot commands.
//****************************************************************************************************************
class CBotAddCommand: public CConsoleCommand
{
public:
CBotAddCommand()
{
m_sCommand = "add";
m_sHelp = "add bot";
if ( CMod::aClassNames.size() )
m_sDescription = "Optional parameters: <bot-name> <intelligence> <team> <class>. ";
else
m_sDescription = "Optional parameters: <bot-name> <intelligence> <team>. ";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotCommandCommand: public CConsoleCommand
{
public:
CBotCommandCommand()
{
m_sCommand = "command";
m_sHelp = "execute console command by bot";
m_sDescription = "Parameters: <bot-name> <command>. Example: 'botrix bot command all kill'.";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotKickCommand: public CConsoleCommand
{
public:
CBotKickCommand()
{
m_sCommand = "kick";
m_sHelp = "kick bot";
m_sDescription = "Parameters: <empty/bot-name/all> will kick random/selected/all bots.";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotDebugCommand: public CConsoleCommand
{
public:
CBotDebugCommand()
{
m_sCommand = "debug";
m_sHelp = "show bot debug messages on server";
m_sDescription = "Parameters: <bot-name> <on/off>.";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigQuotaCommand: public CConsoleCommand
{
public:
CBotConfigQuotaCommand()
{
m_sCommand = "quota";
m_sHelp = "set bots+players quota.";
m_sDescription = "You can use 'n-m' to have m bots per n players. Set to 0 to disable quota.";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigIntelligenceCommand: public CConsoleCommand
{
public:
CBotConfigIntelligenceCommand()
{
m_sCommand = "intelligence";
m_sHelp = "set min/max bot intelligence";
m_sDescription = "Arguments: <min> <max>. Can be one of: random fool stupied normal smart pro";// TODO: intelligence flags to string.
m_iAccessLevel = FCommandAccessBot;
m_cAutoCompleteArguments.push_back("random");
for ( int i=0; i < EBotIntelligenceTotal; ++i )
m_cAutoCompleteArguments.push_back( CTypeToString::IntelligenceToString(i).duplicate() );
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigTeamCommand: public CConsoleCommand
{
public:
CBotConfigTeamCommand()
{
m_sCommand = "team";
m_sHelp = "set default bot team";
m_sDescription = good::string("Can be one of: ") + CTypeToString::TeamFlagsToString(-1);
m_iAccessLevel = FCommandAccessBot;
m_cAutoCompleteArguments.push_back("random");
for ( int i=0; i < CMod::aTeamsNames.size(); ++i )
m_cAutoCompleteArguments.push_back( CTypeToString::TeamToString(i).duplicate() );
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigClassCommand: public CConsoleCommand
{
public:
CBotConfigClassCommand()
{
m_sCommand = "class";
m_sHelp = "set default bot class";
m_sDescription = good::string("Can be one of: random ") + CTypeToString::ClassFlagsToString(-1);
m_iAccessLevel = FCommandAccessBot;
m_cAutoCompleteArguments.push_back("random");
for ( int i=0; i < CMod::aClassNames.size(); ++i )
m_cAutoCompleteArguments.push_back( CTypeToString::ClassToString(i).duplicate() );
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigChangeClassCommand: public CConsoleCommand
{
public:
CBotConfigChangeClassCommand()
{
m_sCommand = "change-class";
m_sHelp = "change bot class to another random class after x rounds.";
m_sDescription = "Set to 0 to disable.";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigSuicideCommand: public CConsoleCommand
{
public:
CBotConfigSuicideCommand()
{
m_sCommand = "suicide";
m_sHelp = "when staying far from waypoints for this time (in seconds), suicide";
m_sDescription = "Set to 0 to disable.";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigStrategyFlagsCommand: public CConsoleCommand
{
public:
CBotConfigStrategyFlagsCommand()
{
m_sCommand = "flags";
m_sHelp = "set bot fight strategy flags";
m_sDescription = good::string("Can be mix of: ") + CTypeToString::StrategyFlagsToString(FFightStrategyAll);
m_iAccessLevel = FCommandAccessBot;
for ( int i=0; i < EFightStrategyFlagTotal; ++i )
m_cAutoCompleteArguments.push_back( CTypeToString::StrategyFlagsToString(1<<i).duplicate() );
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigStrategySetCommand: public CConsoleCommand
{
public:
CBotConfigStrategySetCommand()
{
m_sCommand = "set";
m_sHelp = "set bot fight strategy argument";
m_sDescription = good::string("Can be one of: ") + CTypeToString::StrategyArgs();
m_iAccessLevel = FCommandAccessBot;
for ( int i=0; i < EFightStrategyArgTotal; ++i )
m_cAutoCompleteArguments.push_back( CTypeToString::StrategyArgToString(i).duplicate() );
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotConfigStrategyCommand: public CConsoleCommandContainer
{
public:
CBotConfigStrategyCommand()
{
m_sCommand = "strategy";
Add(new CBotConfigStrategyFlagsCommand);
Add(new CBotConfigStrategySetCommand);
}
};
class CBotConfigCommand: public CConsoleCommandContainer
{
public:
CBotConfigCommand()
{
m_sCommand = "config";
Add(new CBotConfigQuotaCommand);
Add(new CBotConfigIntelligenceCommand);
Add(new CBotConfigTeamCommand);
if ( CMod::aClassNames.size() )
{
Add(new CBotConfigClassCommand);
Add(new CBotConfigChangeClassCommand);
}
Add(new CBotConfigSuicideCommand);
Add(new CBotConfigStrategyCommand);
}
};
class CBotAllyCommand: public CConsoleCommand
{
public:
CBotAllyCommand()
{
m_sCommand = "ally";
m_sHelp = "will not attack another user/bot";
m_sDescription = "";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotAttackCommand: public CConsoleCommand
{
public:
CBotAttackCommand()
{
m_sCommand = "attack";
m_sHelp = "forces bot to start/stop attacking";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotMoveCommand: public CConsoleCommand
{
public:
CBotMoveCommand()
{
m_sCommand = "move";
m_sHelp = "forces bot to start/stop moving";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotPauseCommand: public CConsoleCommand
{
public:
CBotPauseCommand()
{
m_sCommand = "pause";
m_sHelp = "pause/resume given or all bots";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotWeaponCommand: public CConsoleCommandContainer
{
public:
CBotWeaponCommand()
{
m_sCommand = "weapon";
Add(new CBotWeaponAddCommand);
Add(new CBotWeaponAllowCommand);
Add(new CBotWeaponForbidCommand);
//Add(new CBotWeaponRemoveCommand);
Add(new CBotWeaponUnknownCommand);
}
};
class CBotDrawPathCommand: public CConsoleCommand
{
public:
CBotDrawPathCommand()
{
m_sCommand = "drawpath";
m_sHelp = "defines how to draw bot's path";
m_sDescription = good::string("Can be 'none' / 'all' / 'next' or mix of: ") + CTypeToString::PathDrawFlagsToString(FPathDrawAll);
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CBotTestPathCommand: public CConsoleCommand
{
public:
CBotTestPathCommand()
{
m_sCommand = "test";
m_sHelp = "create bot to test path from given (or current) to given (or destination) waypoints";
m_iAccessLevel = FCommandAccessBot;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
//****************************************************************************************************************
// Item commands.
//****************************************************************************************************************
class CItemDrawCommand: public CConsoleCommand
{
public:
CItemDrawCommand()
{
m_sCommand = "draw";
m_sHelp = "defines which items to draw";
m_sDescription = good::string("Can be 'none' / 'all' / 'next' or mix of: ") + CTypeToString::EntityTypeFlagsToString(EItemTypeAll);
m_iAccessLevel = FCommandAccessWaypoint; // User doesn't have control over items, he only can draw them.
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CItemDrawTypeCommand: public CConsoleCommand
{
public:
CItemDrawTypeCommand()
{
m_sCommand = "drawtype";
m_sHelp = "defines how to draw items";
m_sDescription = good::string("Can be 'none' / 'all' / 'next' or mix of: ") + CTypeToString::ItemDrawFlagsToString(FItemDrawAll);
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CItemReloadCommand: public CConsoleCommand
{
public:
CItemReloadCommand()
{
m_sCommand = "reload";
m_sHelp = "reload all items (will recalculate nearest waypoints)";
m_iAccessLevel = FCommandAccessWaypoint;
}
TCommandResult Execute( CClient* pClient, int /*argc*/, const char** /*argv*/ )
{
if ( pClient == NULL )
return ECommandError;
CItems::MapUnloaded();
CItems::MapLoaded();
return ECommandPerformed;
}
};
//****************************************************************************************************************
// Config commands.
//****************************************************************************************************************
class CConfigAdminsSetAccessCommand: public CConsoleCommand
{
public:
CConfigAdminsSetAccessCommand()
{
m_sCommand = "access";
m_sHelp = "set access flags for given admin";
m_sDescription = good::string("Arguments: <steam id> <access flags>. Can be none / all / mix of: ") +
CTypeToString::AccessFlagsToString(FCommandAccessAll);
m_iAccessLevel = FCommandAccessConfig;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CConfigAdminsShowCommand: public CConsoleCommand
{
public:
CConfigAdminsShowCommand()
{
m_sCommand = "show";
m_sHelp = "show admins currently on server";
m_iAccessLevel = FCommandAccessConfig;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CConfigEventsCommand: public CConsoleCommand
{
public:
CConfigEventsCommand()
{
m_sCommand = "event";
m_sHelp = "display events on console ('off' - disable, 'on' - enable)";
m_iAccessLevel = FCommandAccessConfig;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
class CConfigLogCommand: public CConsoleCommand
{
public:
CConfigLogCommand()
{
m_sCommand = "log";
m_sHelp = "set console log level (none, trace, debug, info, warning, error).";
m_iAccessLevel = FCommandAccessConfig;
}
TCommandResult Execute( CClient* pClient, int argc, const char** argv );
};
//****************************************************************************************************************
// Admins: show admins and set admin flags.
//****************************************************************************************************************
class CConfigAdminsCommand: public CConsoleCommandContainer
{
public:
CConfigAdminsCommand()
{
m_sCommand = "admins";
Add(new CConfigAdminsSetAccessCommand);
Add(new CConfigAdminsShowCommand);
}
};
//****************************************************************************************************************
// Waypoint areas: show/set/rename waypoint area.
//****************************************************************************************************************
class CWaypointAreaCommand: public CConsoleCommandContainer
{
public:
CWaypointAreaCommand()
{
m_sCommand = "area";
Add(new CWaypointAreaRemoveCommand);
Add(new CWaypointAreaRenameCommand);
Add(new CWaypointAreaSetCommand);
Add(new CWaypointAreaShowCommand);
}
};
//****************************************************************************************************************
// Container of all commands starting with "waypoint".
//****************************************************************************************************************