Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

WormbotReporter.MutWormbot


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658
01659
01660
01661
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820
01821
01822
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061
02062
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107
02108
02109
02110
02111
02112
02113
02114
02115
02116
02117
02118
02119
02120
02121
02122
02123
02124
02125
02126
02127
02128
02129
02130
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171
02172
02173
02174
02175
02176
02177
02178
02179
02180
02181
02182
02183
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245
02246
02247
02248
02249
02250
02251
02252
02253
02254
02255
02256
02257
02258
02259
02260
02261
02262
02263
02264
02265
02266
02267
02268
02269
02270
02271
02272
02273
02274
02275
02276
02277
02278
02279
02280
02281
02282
02283
02284
02285
02286
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296
/******************************************************************************
Copyright (c) 2005-2006 by Wormbo <wormbo@onlinehome.de>
$Id$

Wormbo's IRC Reporter Bot.
******************************************************************************/


class MutWormbot extends Mutator
		dependson(WIR_IRCConnection);


//=============================================================================
// Structs
//=============================================================================

struct TItemName {
	var config name   ItemClass;
	var config string ItemName;
	var config bool   Important;
	var config byte   IRCColor;
};

struct TPickupBase {
	var xPickupBase Base;
	var string      LocationName;
};

struct TPlayerInfo {
	var Controller Player;
	var bool bWasSpectator;
	var TeamInfo LastTeam;
	var PlayerReplicationInfo PRI;
	var string LastName;
	var int LastScore;
	var int FlakKills;
	var int ComboKills;
	var int HeadshotKills;
	var int RunoverKills;
	var int ScoringSpree;
};

struct TCustomDisconnect {
	var Controller Player;
	var string     Reason;
};

struct TAmpRun {
	var Pawn Player;
	var float StartTime;
	var int Kills;
};


//=============================================================================
// Localization
//=============================================================================

// for reporter bot
var localized string MsgGameReset;
var localized string MsgGameRoundEnded;
var localized string MsgGameEnded;
var localized string MsgGameEvent;
var localized string MsgQuitMapChange;

var localized string MsgPlayerConnected;
var localized string MsgPlayerConnectedSpectator;
var localized string MsgPlayerDisconnected;
var localized string MsgPlayerWasKicked;
var localized string MsgPlayerChangedTeam;
var localized string MsgPlayerChangedName;
var localized string MsgPlayerChat;
var localized string MsgPlayerScoredKill;
var localized string MsgPlayerSuicided;
var localized string MsgPlayerTeamKilled;
var localized string MsgPlayerPickup;

var localized string MsgPlayerIsFlakMonkey;
var localized string MsgPlayerIsComboWhore;
var localized string MsgPlayerIsHeadHunter;
var localized string MsgPlayerIsOnRoadRampage;
var localized string MsgPlayerFinishedAmpRun;
var localized string MsgPlayerFinishedAmpRunNoKills;
var localized string MsgPlayerFinishedAmpRunOneKill;

var localized string MsgTeamScored;
var localized string MsgTeamScoredTied;
var localized string MsgTeamScoredTakesLead;
var localized string MsgTeamScoredIncreasesLead;
var localized string MsgLeadersTied;
var localized string MsgTakesLead;
//var localized string StringTeamIsBehind;

var localized string StringMsgSuffix;
var localized string StringSuffixHattrick;
var localized string StringComboKill;
var localized string StringAmpRunStopped;
var localized string StringAmpRunStoppedNoKills;
var localized string StringAmpRunStoppedOneKill;
var localized string StringPlayerIsOut;
var localized string StringSuffixWeapon;
var localized string StringSuffixWeaponAmped;
var localized string StringSuffixPush;
var localized string StringSuffixTelefrag;
var localized string StringSuffixLocation;
var localized string StringSuicide;
var localized string StringSuicideDrowned;
var localized string StringSuicideFell;
var localized string StringSuicideLava;

var localized string StringNameGame;
var localized string StringNameSpectators;
var localized string StringNameWildcardBase;

// for chat proxy
var localized string TemplateMessage;
var localized string TemplateAction;
var localized string TemplateNick;
var localized string TemplateJoin;
var localized string TemplatePart;
var localized string TemplateQuit;
var localized string TemplateKick;
var localized string TemplateWait;

// Webadmin
var localized string ReporterGroup, ChatRelayGroup;

var localized string lblEnableReporter;
var localized string lblReportServerName;
var localized string lblReportServerPort;
var localized string lblReportServerPassword;
var localized string lblReportUserNick;
var localized string lblReportUserIdent;
var localized string lblReportChannel;
var localized string lblReportChannelKey;
var localized string lblReportStripCodes;
var localized string lblSetReportChannelTopic;
var localized string lblReportChannelTopicTemplate;
var localized string lblReportChannelTopicBotPart;
var localized string lblReportChannelTopicBotIdle;
var localized string lblReportChannelTopicUserPart;
var localized string lblMaxLevelChangeDelay;
var localized string lblEnableChatbot;
var localized string lblEnableTwoWayChat;
var localized string lblChatToGameAsTeamSay;
var localized string lblChatThroughReporter;
var localized string lblChatServerName;
var localized string lblChatServerPort;
var localized string lblChatServerPassword;
var localized string lblChatUserNick;
var localized string lblChatUserIdent;
var localized string lblChatChannel;
var localized string lblChatChannelKey;
var localized string lblChatStripCodes;
var localized string lblChatTrigger;
var localized string lblSpecOnlyChatTrigger;
var localized string lblChatReceiveOnlyText;
var localized string lblColorCodeReplacements;
var localized string lblAuth;
var localized string lblChallengeAuth;
var localized string lblHideRealHost;
var localized string lblAuthNick;
var localized string lblAuthPassword;
var localized string lblFloodProtectCommandPenalty;
var localized string lblFloodProtectMessagePenalty;
var localized string lblFloodProtectMaxPenalty;
var localized string lblFloodProtectBytes;
var localized string lblFloodProtectBytesDuration;
var localized string lblMaxLenMessageQueue;
var localized string lblAutoReconnect;
var localized string lblReconnectDelay;
var localized string lblAutoRejoin;
var localized string lblConnectTimeout;
var localized string lblDebugLogFileName;
var localized string lblDebugStartMatch;
var localized string lblItems;

var localized string descEnableReporter;
var localized string descReportServerName;
var localized string descReportServerPort;
var localized string descReportServerPassword;
var localized string descReportUserNick;
var localized string descReportUserIdent;
var localized string descReportChannel;
var localized string descReportChannelKey;
var localized string descReportStripCodes;
var localized string descSetReportChannelTopic;
var localized string descReportChannelTopicTemplate;
var localized string descReportChannelTopicBotPart;
var localized string descReportChannelTopicBotIdle;
var localized string descReportChannelTopicUserPart;
var localized string descMaxLevelChangeDelay;
var localized string descEnableChatbot;
var localized string descEnableTwoWayChat;
var localized string descChatToGameAsTeamSay;
var localized string descChatThroughReporter;
var localized string descChatServerName;
var localized string descChatServerPort;
var localized string descChatServerPassword;
var localized string descChatUserNick;
var localized string descChatUserIdent;
var localized string descChatChannel;
var localized string descChatChannelKey;
var localized string descChatStripCodes;
var localized string descChatTrigger;
var localized string descSpecOnlyChatTrigger;
var localized string descChatReceiveOnlyText;
var localized string descColorCodeReplacements;
var localized string descAuth;
var localized string descChallengeAuth;
var localized string descHideRealHost;
var localized string descAuthNick;
var localized string descAuthPassword;
var localized string descFloodProtectCommandPenalty;
var localized string descFloodProtectMessagePenalty;
var localized string descFloodProtectMaxPenalty;
var localized string descFloodProtectBytes;
var localized string descFloodProtectBytesDuration;
var localized string descMaxLenMessageQueue;
var localized string descAutoReconnect;
var localized string descReconnectDelay;
var localized string descAutoRejoin;
var localized string descConnectTimeout;
var localized string descDebugLogFileName;
var localized string descDebugStartMatch;
var localized string descItems;

var localized string dataStripCodes;


//=============================================================================
// Configuration
//=============================================================================

var config bool   bEnableReporter;
var config string ReportServerName;
var config int    ReportServerPort;
var config string ReportServerPassword;
var config string ReportUserNick;
var config string ReportUserIdent;
var config string ReportChannel;
var config string ReportChannelKey;
var config byte   ReportStripCodes;
var config bool   bSetReportChannelTopic;
var config string ReportChannelTopicTemplate;
var config string ReportChannelTopicBotPart;
var config string ReportChannelTopicBotIdle;
var config string ReportChannelTopicUserPart;
var config int    MaxLevelChangeDelay;

var config bool   bEnableChatbot;
var config bool   bEnableTwoWayChat;
var config bool   bChatToGameAsTeamSay;
var config bool   bChatThroughReporter;
var config string ChatServerName;
var config int    ChatServerPort;
var config string ChatServerPassword;
var config string ChatUserNick;
var config string ChatUserIdent;
var config string ChatChannel;
var config string ChatChannelKey;
var config byte   ChatStripCodes;
var config string ChatTrigger;
var config string SpecOnlyChatTrigger;
var config bool   bChatReceiveOnlyText;
var config string ColorCodeReplacements;

var config bool   bAuth;
var config bool   bChallengeAuth;
var config bool   bHideRealHost;
var config string AuthNick;
var config string AuthPassword;

// flood protection
var config int FloodProtectCommandPenalty;
var config int FloodProtectMessagePenalty;
var config int FloodProtectMaxPenalty;
var config int FloodProtectBytes;
var config int FloodProtectBytesDuration;
var config int MaxLenMessageQueue;

// automatically restore connections
var config bool bAutoReconnect;
var config int  ReconnectDelay;
var config bool bAutoRejoin;
var config int  ConnectTimeout;

var config array<TItemName> Items;

// debug logging
var globalconfig string DebugLogFileName;
var globalconfig bool   bDebugStartMatch;


//=============================================================================
// Variables
//=============================================================================

var() const editconst string Build;

var WIR_GameRules     MyGameRules;
var WIR_IRCConnection ReportConnection;
var WIR_IRCConnection ChatConnection;
var WIR_ChatSpectator MyChatSpectator;
var WIR_GameHandler   MyGameHandler;

var array<TPickupBase>  PickupBases;
var array<Volume>       Volumes;
var array<TeamInfo>     Teams;
var array<int>          TeamScores;
var array<int>          ReportedScores;
var array<TPlayerInfo>  Players;
var array<TCustomDisconnect>  Disconnects;
var array< class<WIR_ModHandler> >  ModHandlerClasses;

var string GameEndReason;
var array<string> ChatColorCodes;

// game state
var bool bMatchStarted, bMatchEnded;
var bool bVolumesInitialized;
var bool bScoreTeamKills;
var bool bNewRound, bReportScoreboard;
var int LastNumLeaders;
var float NextScoreReportTime;
var float LevelChangeDelay;

var array<TAmpRun> AmpRuns;


//== PreBeginPlay =============================================================
/**
Update the mutators list before webadmin initializes its list of active mutators.
*/
//=============================================================================

function PreBeginPlay()
{
	local array<string> MutatorClassNames;
	local int i;
	local string MutatorsList;
	local MutWormbot OtherWormbot;
	local string tmp;
	local bool bUpdated;

	foreach AllActors(class'MutWormbot', OtherWormbot) {
		if ( OtherWormbot != Self && OtherWormbot.bUserAdded ) {
			Destroy();
			return;
		}
	}

	Super.PreBeginPlay();

	Split(GetURLOption("mutator"), ",", MutatorClassNames);
	for (i = 0; i < MutatorClassNames.Length; ++i) {
		if ( MutatorClassNames[i] ~= string(Class) )
			return; // already in the list
	}

	// for running Wormbot as ServerActor
	Level.Game.BaseMutator.AddMutator(Self);
	bUserAdded = True;

	MutatorClassNames[MutatorClassNames.Length] = string(Class);
	MutatorsList = MutatorClassNames[0];
	for (i = 1; i < MutatorClassNames.Length; ++i)
		MutatorsList $= "," $ MutatorClassNames[i];

	UpdateURL("mutator", MutatorsList, False);

	tmp = class'WIR_Util'.static.EscapeIRCCodes(ReportChannelTopicTemplate);
	if (tmp != ReportChannelTopicTemplate) {
		ReportChannelTopicTemplate = tmp;
		bUpdated = True;
	}
	tmp = class'WIR_Util'.static.EscapeIRCCodes(ReportChannelTopicBotPart);
	if (tmp != ReportChannelTopicBotPart) {
		ReportChannelTopicBotPart = tmp;
		bUpdated = True;
	}
	tmp = class'WIR_Util'.static.EscapeIRCCodes(ReportChannelTopicBotIdle);
	if (tmp != ReportChannelTopicBotIdle) {
		ReportChannelTopicBotIdle = tmp;
		bUpdated = True;
	}
	tmp = class'WIR_Util'.static.EscapeIRCCodes(ReportChannelTopicUserPart);
	if (tmp != ReportChannelTopicUserPart) {
		ReportChannelTopicUserPart = tmp;
		bUpdated = True;
	}

	if (bUpdated)
		SaveConfig();

	if (ColorCodeReplacements != "")
		Split(ColorCodeReplacements, " ", ChatColorCodes);
}


//== static GetGameHandlerClass ===============================================
/**
Returns the WIR_GameHandler class for the specified GameInfo class.
*/
//=============================================================================

static function class<WIR_GameHandler> GetGameHandlerClass(class<GameInfo> GameClass)
{
	local class<WIR_GameHandler> HandlerClass;
	local int i;
	local string HandlerName;

	if ( GameClass != None )
		for (i = 0; i < class'WIR_GameHandler'.default.GameHandler.Length; ++i)
			if ( class'WIR_GameHandler'.default.GameHandler[i].Game ~= string(GameClass)
					|| class'WIR_GameHandler'.default.GameHandler[i].Game ~= string(GameClass.Name) ) {
				HandlerName = class'WIR_GameHandler'.default.GameHandler[i].Handler;

				if ( InStr(HandlerName, ".") != -1 )
					HandlerClass = class<WIR_GameHandler>(DynamicLoadObject(HandlerName, class'Class'));
				else
					HandlerClass = class<WIR_GameHandler>(DynamicLoadObject(class'WIR_GameHandler'.Outer $ "." $ HandlerName,
							class'Class'));

				if ( HandlerClass != None )
					return HandlerClass;
			}

	return class'WIR_GameHandler_Other';
}


//== static GetModHandlerClass ===============================================
/**
Returns the WIR_ModHandler class for the specified Info class or None.
*/
//=============================================================================

static function class<WIR_ModHandler> GetModHandlerClass(class<Info> ActorClass)
{
	local class<WIR_ModHandler> HandlerClass;
	local int i;

	if ( ActorClass != None )
		for (i = 0; i < class'WIR_ModHandler'.default.ModHandler.Length; ++i)
			if ( class'WIR_ModHandler'.default.ModHandler[i].ActorClass ~= string(ActorClass)
					|| class'WIR_ModHandler'.default.ModHandler[i].ActorClass ~= string(ActorClass.Name) ) {
				HandlerClass = class<WIR_ModHandler>(DynamicLoadObject(
						class'WIR_ModHandler'.default.ModHandler[i].Handler, class'Class'));

				if ( HandlerClass != None )
					return HandlerClass;
			}

	return None;
}


//== state Init ===============================================================
/**
Initialize the mutator.
*/
//=============================================================================

auto state Init
{
	function CreateGameHandler()
	{
		MyGameHandler = Spawn(GetGameHandlerClass(Level.Game.Class), self);

		if ( MyGameHandler == None ) {
			log("Using default game handler class.", Name);
			MyGameHandler = Spawn(class'WIR_GameHandler', self);
		}

		if ( bMatchStarted )
			MyGameHandler.bMatchStarted = True;
		log("Game handler:" @ MyGameHandler.Class, Name);
	}

	function CreateModHandlers()
	{
		local Info thisInfo;
		local WIR_ModHandler ModHandler;
		local class<WIR_ModHandler> HandlerClass;

		default.ModHandlerClasses.Length = 0;

		foreach DynamicActors(class'Info', thisInfo) {
			if ( GameInfo(thisInfo) == None && WIR_ModHandler(thisInfo) == None ) {
				HandlerClass = GetModHandlerClass(thisInfo.Class);
				ModHandler = None;
				foreach DynamicActors(class'WIR_ModHandler', ModHandler)
					if ( ModHandler.Class == HandlerClass )
						break;
				if ( ModHandler == None || ModHandler.Class != HandlerClass )
					ModHandler = Spawn(HandlerClass, Self);
				if ( ModHandler != None ) {
					MyGameHandler.AddHandler(ModHandler);
					default.ModHandlerClasses[default.ModHandlerClasses.Length] = HandlerClass;
					log("Mod handler for" @ thisInfo.Class $ ":" @ ModHandler.Class, Name);
				}
			}
		}
	}

	function CreateConnections()
	{
		local class<WIR_RegistrationHandler> RegistrationHandlerClass;

		class'WIR_IRCConnection'.default.bAutoReconnect             = bAutoReconnect;
		class'WIR_IRCConnection'.default.bAutoRejoin                = bAutoRejoin;
		class'WIR_IRCConnection'.default.ConnectTimeout             = ConnectTimeout;
		class'WIR_IRCConnection'.default.ReconnectDelay             = ReconnectDelay;
		class'WIR_IRCConnection'.default.FloodProtectCommandPenalty = FloodProtectCommandPenalty;
		class'WIR_IRCConnection'.default.FloodProtectMessagePenalty = FloodProtectMessagePenalty;
		class'WIR_IRCConnection'.default.FloodProtectMaxPenalty     = FloodProtectMaxPenalty;
		class'WIR_IRCConnection'.default.FloodProtectBytes          = FloodProtectBytes;
		class'WIR_IRCConnection'.default.FloodProtectBytesDuration  = FloodProtectBytesDuration;
		class'WIR_IRCConnection'.default.MaxLenMessageQueue         = MaxLenMessageQueue;
		class'WIR_IRCConnection'.default.DebugLogFileName           = DebugLogFileName;
		class'WIR_IRCConnection'.default.bDebugStartMatch           = bDebugStartMatch;

		if ( bAuth ) {
			RegistrationHandlerClass = class'WIR_RegistrationQuakeNet';
			class'WIR_RegistrationQuakeNet'.default.bAuth           = bAuth;
			class'WIR_RegistrationQuakeNet'.default.bChallengeAuth  = bChallengeAuth;
			class'WIR_RegistrationQuakeNet'.default.bHideRealHost   = bHideRealHost;
			class'WIR_RegistrationQuakeNet'.default.AuthNick        = AuthNick;
			class'WIR_RegistrationQuakeNet'.default.AuthPassword    = AuthPassword;
		}
		else
			RegistrationHandlerClass = class'WIR_RegistrationHandler';

		if (ReportUserNick == "" || ChatUserNick == "" || ReportUserNick ~= "Wormbot" || ChatUserNick ~= "Wormbot") {
			if (ReportUserNick == "" || ReportUserNick ~= "Wormbot") {
				ReportUserNick = "RenameMe";
			}
			if (ChatUserNick == "" || ChatUserNick ~= "Wormbot") {
				ChatUserNick = "RenameMe";
			}
			SaveConfig();
		}
		if (InStr(ReportChannel, ",") != -1) {
			ReportChannel = Left(ReportChannel, InStr(ReportChannel, ","));
			log("Only a single report channel may be specified.", Name);
			SaveConfig();
		}
		if (InStr(ChatChannel, ",") != -1) {
			ChatChannel = Left(ChatChannel, InStr(ChatChannel, ","));
			log("Only a single chat channel may be specified.", Name);
			SaveConfig();
		}
		if ( bEnableReporter && ReportConnection == None && ReportChannel != "" ) {
			ReportConnection = Spawn(class'WIR_IRCConnection', Self);
			if ( ReportConnection != None ) {
				ReportConnection.SetConnection(ReportServerName, ReportServerPort, ReportServerPassword, ReportUserNick, ReportUserIdent);
				//RegistrationHandlerClass = class<WIR_RegistrationHandler>(DynamicLoadObject(ReportRegistrationHandler,
				//    class'Class'));
				ReportConnection.SetRegistrationDetails(RegistrationHandlerClass, "");
				ReportConnection.JoinChannel(ReportChannel, ReportChannelKey);
				if ( ReportStripCodes > 0 )
					ReportConnection.bNoChannelColor = True;
				if ( ReportStripCodes > 1 )
					ReportConnection.bNoChannelCodes = True;
			}
		} // if bEnableReporter

		if ( bEnableChatbot && ChatConnection == None ) {
			if ( bChatThroughReporter && ReportConnection != None )
				ChatConnection = ReportConnection;
			else if (ChatChannel != "") {
				ChatConnection = Spawn(class'WIR_IRCConnection', Self);
				if ( ChatConnection != None ) {
					ChatConnection.SetConnection(ChatServerName, ChatServerPort, ChatServerPassword, ChatUserNick, ChatUserIdent);
					//RegistrationHandlerClass = class<WIR_RegistrationHandler>(DynamicLoadObject(ChatRegistrationHandler,
					//    class'Class'));
					ChatConnection.SetRegistrationDetails(RegistrationHandlerClass, "");
					ChatConnection.JoinChannel(ChatChannel, ChatChannelKey);
					if ( ChatStripCodes > 0 )
						ChatConnection.bNoChannelColor = True;
					if ( ChatStripCodes > 1 )
						ChatConnection.bNoChannelCodes = True;
				}
			}
			if ( ChatConnection != None && bEnableTwoWayChat ) {
				ChatConnection.OnChat = ReceivedChatMessage;
				ChatConnection.OnMode = ReceivedModeMessage;
			}
		} // if bEnableChatbot
	}

	function FindTeams()
	{
		local TeamInfo T;

		if ( Level.Game.bTeamGame ) {
			foreach DynamicActors(class'TeamInfo', T)
				if ( T.TeamIndex < 4 ) {
					Teams[T.TeamIndex] = T;
					//log("Team"@T.TeamIndex$":"@T.GetHumanReadableName()@T, Name);
				}
			TeamScores.Length = Teams.Length;
			bScoreTeamKills = bool(Level.Game.GetPropertyText("bScoreTeamKills"));
		}
	}

Begin:
	if ( LifeSpan != 0 )
		Stop;

	MyGameRules = Spawn(class'WIR_GameRules', self);
	MyChatSpectator = Spawn(class'WIR_ChatSpectator', Self);

	CreateGameHandler();
	CreateModHandlers();
	CreateConnections();
	FindTeams();
}


//== state PreTravel ==========================================================
/**
The server wants to switch to the next map. Delay the map change until the final scores have been reported.
*/
//=============================================================================

state PreTravel
{
	function ReportTravel(string NextURL)
	{
		local string NextMap;
		local string NextGame;
		local int i;
		local string Msg;
		local class<GameInfo> NextGameClass;

		if ( NextURL ~= "?restart" ) {
			NextMap = string(Outer.Name);
			NextGame = string(Level.Game.Class);
		}
		else {
			i = InStr(NextURL, "?");
			if ( i > 0 ) {
				NextMap = Left(NextURL, i);
				NextURL = Mid(NextURL, i);
			}
			else if ( i == -1 && NextURL != "" )
				NextMap = NextURL;
			else
				NextMap = string(Outer.Name);

			if ( Level.Game.HasOption(NextURL, "game") )
				NextGame = Level.Game.ParseOption(NextURL, "game");
			else
				NextGame = string(Level.Game.Class);
		}

		if ( NextGame ~= string(Level.Game.Class) )
			NextGame = Level.Game.GameName;
		else {
			NextGameClass = class<GameInfo>(DynamicLoadObject(NextGame, class'Class'));
			if ( NextGameClass != None )
				NextGame = NextGameClass.default.GameName;
			else
				NextGame = GetItemName(NextGame);
		}
		Msg = Repl(MsgQuitMapChange, "%g", NextGame, True);
		Msg = Repl(Msg,              "%m", NextMap, True);

		log("Disconnecting from IRC...", Name);
		if ( ChatConnection != None ) {
			ChatConnection.Disconnect(False, Msg);
		}
		if ( ReportConnection != None && ReportConnection != ChatConnection ) {
			ReportConnection.Disconnect(False, Msg);
		}
	} // ReportTravel

	function DebugDumpMessageQueue()
	{
		local int i;

		log("-- DebugDumpMessageQueue, current timestamp:"@ReportConnection.TimeStampNow, 'DevGarbage');

		for (i = 0; i < ReportConnection.MessageQueue.Length; ++i)
			log(i @ ReportConnection.MessageQueue[i].bImportant
					@ ReportConnection.MessageQueue[i].Timestamp
					@ ReportConnection.MessageQueue[i].Message, 'DevGarbage');

		log("-- End Of Message Queue", 'DevGarbage');
	}

Begin:
	if ( bMatchEnded && ReportConnection != None && ReportConnection.IsInState('InChannel')
			&& ReportConnection.ImportantMessagesQueued() ) {
		log("Delaying Servertravel to finish reporting...", Name);
		MyChatSpectator.ServerSay(TemplateWait);
	}
	LevelChangeDelay = MaxLevelChangeDelay;

	if ( Level.NextSwitchCountdown < 2.0 )
		Level.NextSwitchCountdown = 2.0;

	while (bMatchEnded && ReportConnection != None && ReportConnection.IsInState('InChannel')
			&& ReportConnection.ImportantMessagesQueued() && LevelChangeDelay > 0 && Level.NextSwitchCountdown >= 0.5) {
		if ( Level.NextSwitchCountdown <= 1.5 ) {
			DebugDumpMessageQueue();
			Level.NextSwitchCountdown = 2.5;
		}
		Sleep(0.1);
		LevelChangeDelay -= 0.1 / Level.TimeDilation;
	}

	if ( Level.NextSwitchCountdown < 1.0 )
		Level.NextSwitchCountdown = 1.0;
	ReportTravel(Level.NextURL);
}


//== AddMutator ===============================================================
/**
Prevent self-adding.
*/
//=============================================================================

function AddMutator(Mutator M)
{
	if ( M != Self ) {
		if ( M.Class != Class ) {
			Super.AddMutator(M);
		}
		else {
			M.LifeSpan = 0.1;
		}
	}
}


//== FindLeadingTeams =========================================================
/**
Returns the teams with the highes scores.
*/
//=============================================================================

function FindLeadingTeams(out array<TeamInfo> Leaders, optional bool bLastTickLeaders)
{
	local int i;
	local int MaxScore;

	MaxScore = ~MaxInt;
	Leaders.Length = 0;
	if ( bLastTickLeaders ) {
		for (i = 0; i < Teams.Length; ++i)
			if ( TeamScores[i] > MaxScore )
				MaxScore = TeamScores[i];

		for (i = 0; i < Teams.Length; ++i)
			if ( TeamScores[i] ~= MaxScore )
				Leaders[Leaders.Length] = Teams[i];
	}
	else {
		for (i = 0; i < Teams.Length; ++i)
			if ( Teams[i].Score > MaxScore )
				MaxScore = Teams[i].Score;

		for (i = 0; i < Teams.Length; ++i)
			if ( Teams[i].Score ~= MaxScore )
				Leaders[Leaders.Length] = Teams[i];
	}
}


//== CheckTeamScores ==========================================================
/**
Check the team scores.
*/
//=============================================================================

function CheckTeamScores()
{
	local int i, j;
	local string Msg;
	local array<TeamInfo> Leaders, LastLeaders;
	local array<string> LeaderStrings;
	local bool bTeamIsLeader, bLeadersChanged;

	if ( !Level.Game.bTeamGame )
		return;

	FindLeadingTeams(Leaders);
	if ( !bScoreTeamKills ) {
		for (i = 0; i < Teams.Length; ++i) {
			if ( Teams[i] != None ) {
				if ( TeamScores[i] != Teams[i].Score ) {
					bTeamIsLeader = False;
					LeaderStrings.Length = 0;
					for (j = 0; j < Leaders.Length; ++j) {
						if ( Leaders[j] == Teams[i] )
							bTeamIsLeader = True;
						else
							LeaderStrings[LeaderStrings.Length] = class'WIR_Util'.static.FormatTeamName(Leaders[j], False);
					}
					if ( !bTeamIsLeader )
						Msg = MsgTeamScored;
					else if ( LeaderStrings.Length > 0 )
						Msg = Repl(MsgTeamScoredTied, "%l", class'WIR_Util'.static.ConcatWithSeparator(LeaderStrings), True);
					else if ( LastNumLeaders > 1 )
						Msg = MsgTeamScoredTakesLead;
					else
						Msg = MsgTeamScoredIncreasesLead;
					Msg = Repl(Msg, "%d", string(int(Teams[i].Score - TeamScores[i])), True);
					Msg = Repl(Msg, "%s", string(int(Teams[i].Score)), True);
					Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
					Msg = Repl(Msg, "%t", class'WIR_Util'.static.FormatTeamName(Teams[i], False), True);
					ReportConnection.SendMessage(Msg, True);
					if ( !MyGameHandler.bScoreEndsRound )
						NextScoreReportTime = MyGameHandler.ScoreReportDelay;
					else
						bReportScoreboard = True;
				}
			}
		} // for Teams
	}
	else if ( Leaders.Length > 0 ) {
		FindLeadingTeams(LastLeaders, True);
		if ( LastLeaders.Length != Leaders.Length )
			bLeadersChanged = True;
		else {
			for (i = 0; i < LastLeaders.Length; ++i)
				if ( LastLeaders[i] != Leaders[i] ) {
					bLeadersChanged = True;
					break;
				}
		}
		if ( bLeadersChanged ) {
			if ( Leaders.Length > 1 )
				Msg = MsgLeadersTied;
			else
				Msg = MsgTakesLead;

			for (i = 0; i < Leaders.Length; ++i)
				LeaderStrings[LeaderStrings.Length] = class'WIR_Util'.static.FormatTeamName(Leaders[i], False);

			Msg = Repl(Msg, "%t", class'WIR_Util'.static.ConcatWithSeparator(LeaderStrings), True);
			Msg = Repl(Msg, "%s", string(int(Leaders[0].Score)), True);
			Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
			ReportConnection.SendMessage(Msg);
			NextScoreReportTime = MyGameHandler.ScoreReportDelay;
		}
	}

	LastNumLeaders = Leaders.Length;
	for (i = 0; i < Teams.Length; ++i) {
		if ( Teams[i] != None )
			TeamScores[i] = Teams[i].Score;
	}

	if ( !bLeadersChanged && NextScoreReportTime <= 0 ) {
		if ( ReportedScores.Length != TeamScores.Length )
			ReportedScores.Length = TeamScores.Length;
		for (j = 0; j < ReportedScores.Length; ++j)
			if ( ReportedScores[j] != TeamScores[j] ) {
				bReportScoreboard = True;
				NextScoreReportTime = MyGameHandler.ScoreReportDelay;
				ReportedScores = TeamScores;
				break;
			}
	}
}


//== Tick =====================================================================
/**
Initialize the IRC Reporter (if neccessary) and look for new controllers.
*/
//=============================================================================

event Tick(float DeltaTime)
{
	local int i, j;
	local string Msg, Reason;
	local GameReplicationInfo GRI;
	local TeamPlayerReplicationInfo TPRI;

	GRI = Level.GRI;

	if (MyGameHandler == None)
		return;

	if ( ReportConnection != None ) {
		if ( NextScoreReportTime > 0 )
			NextScoreReportTime -= DeltaTime / Level.TimeDilation;
		CheckTeamScores();

		if ( MyGameHandler.bReportSpecial )
			for (i = 0; i < Players.Length; ++i) {
				if ( TeamPlayerReplicationInfo(Players[i].PRI) == None )
					continue;
				TPRI = TeamPlayerReplicationInfo(Players[i].PRI);
				if ( (bReportScoreboard || NextScoreReportTime <= 0)
						&& int(Players[i].PRI.Score) != Players[i].LastScore ) {
					bReportScoreboard = True;
					Players[i].LastScore = int(Players[i].PRI.Score);
				}

				if ( Players[i].FlakKills < TPRI.flakcount ) {
					Players[i].FlakKills = TPRI.flakcount;
					if ( TPRI.flakcount == 15 ) {
						Msg = Repl(MsgPlayerIsFlakMonkey, "%r", MyGameHandler.GetRemainingTime(), True);
						Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(TPRI, True), True);
						ReportConnection.SendMessage(Msg);
					}
				}

				if ( Players[i].ComboKills < TPRI.combocount ) {
					Players[i].ComboKills = TPRI.combocount;
					if ( TPRI.combocount == 15 ) {
						Msg = Repl(MsgPlayerIsComboWhore, "%r", MyGameHandler.GetRemainingTime(), True);
						Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(TPRI, True), True);
						ReportConnection.SendMessage(Msg);
					}
				}

				if ( Players[i].HeadshotKills < TPRI.headcount ) {
					Players[i].HeadshotKills = TPRI.headcount;
					if ( TPRI.headcount == 15 ) {
						Msg = Repl(MsgPlayerIsHeadHunter, "%r", MyGameHandler.GetRemainingTime(), True);
						Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(TPRI, True), True);
						ReportConnection.SendMessage(Msg);
					}
				}

				if ( Players[i].RunoverKills < TPRI.ranovercount ) {
					Players[i].RunoverKills = TPRI.ranovercount;
					if ( TPRI.ranovercount == 10 ) {
						Msg = Repl(MsgPlayerIsOnRoadRampage, "%r", MyGameHandler.GetRemainingTime(), True);
						Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(TPRI, True), True);
						ReportConnection.SendMessage(Msg);
					}
				}

				if ( Players[i].Player != None && Players[i].Player.Pawn != None ) {
					if ( Players[i].Player.Pawn.HasUDamage() ) {
						for (j = 0; j < AmpRuns.Length; j++) {
							if (AmpRuns[j].Player == Players[i].Player.Pawn)
								break;
						}
						if ( j == AmpRuns.Length ) {
							AmpRuns.Length = j + 1;
							AmpRuns[j].Player = Players[i].Player.Pawn;
							AmpRuns[j].StartTime = Level.TimeSeconds;
						}
					}
					else {
						for (j = 0; j < AmpRuns.Length; j++) {
							if (AmpRuns[j].Player == Players[i].Player.Pawn) {
								if (AmpRuns[j].Kills == 0) {
									Msg = Repl(MsgPlayerFinishedAmpRunNoKills, "%r", MyGameHandler.GetRemainingTime(), True);
								}
								else if (AmpRuns[j].Kills == 1) {
									Msg = Repl(MsgPlayerFinishedAmpRunOneKill, "%r", MyGameHandler.GetRemainingTime(), True);
								}
								else {
									Msg = Repl(MsgPlayerFinishedAmpRun, "%r", MyGameHandler.GetRemainingTime(), True);
									Msg = Repl(Msg, "%k", AmpRuns[j].Kills, True);
								}
								Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(TPRI, True), True);
								ReportConnection.SendMessage(Msg);
								AmpRuns.Remove(j--, 1);
							}
							else if ( AmpRuns[j].Player == None )
								AmpRuns.Remove(j--, 1);
						}
					}
				}
			} // for Players
	} // if ReportConnection

	if ( !bMatchEnded && Level.Game.bGameEnded ) {
		bMatchEnded = True;
		if ( ReportConnection != None && !MyGameHandler.HandleEndGame(Reason) ) {
			Msg = Repl(MsgGameEnded, "%r", MyGameHandler.GetRemainingTime(), True);
			if ( Reason != "" )
				Msg $= Repl(StringMsgSuffix, "%m", Reason, True);
			ReportConnection.SendMessage(Msg, True);
			bReportScoreboard = True;
		}
	}
	else if ( bNewRound ) {
		if ( ReportConnection != None && !MyGameHandler.HandleNewRound() )
			ReportConnection.SendMessage(Repl(MsgGameReset, "%r", MyGameHandler.GetRemainingTime(), True), True);
		bNewRound = False;
	}
	else if ( bMatchEnded && !Level.Game.bGameEnded ) {
		bMatchEnded = False;
	}

	for (i = 0; i < Players.Length; ++i) {
		if ( Players[i].Player == None ) {
			Players.Remove(i--, 1);
			continue;
		}

		if ( Players[i].PRI == None ) { // new player
			if ( Players[i].Player.PlayerReplicationInfo == None )
				continue;
			if ( !class'WIR_Util'.static.IsPlayer(Players[i].Player) ) {
				Players.Remove(i--, 1);
				continue; // ignore non-player controllers
			}
			Players[i].PRI            = Players[i].Player.PlayerReplicationInfo;
			Players[i].bWasSpectator  = Players[i].PRI.bOnlySpectator;
			Players[i].LastName       = Players[i].Player.GetHumanReadableName();
			Players[i].LastTeam       = Players[i].PRI.Team;
			Players[i].LastScore      = int(Players[i].PRI.Score);

			// report new player
			if ( Players[i].bWasSpectator )
				Msg = MsgPlayerConnectedSpectator;
			else
				Msg = MsgPlayerConnected;
			Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
			Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(Players[i].Player, True), True);
			SendMessageOnce(Msg);

		} // if new player

		if ( Players[i].LastName != Players[i].Player.GetHumanReadableName() ) {
			if ( Players[i].PRI.bBot )
				Msg = class'WIR_Util'.default.StringPrefixBot
						$ Players[i].LastName
						$ class'WIR_Util'.default.StringSuffixBot;
			else
				Msg = class'WIR_Util'.default.StringPrefixHuman
						$ Players[i].LastName
						$ class'WIR_Util'.default.StringSuffixHuman;

			if ( Players[i].PRI.bOnlySpectator || Players[i].PRI.bOutOfLives && Players[i].Player.Pawn == None )
				Msg = class'WIR_Util'.default.StringPrefixSpectator $ Msg;
			else if ( Players[i].PRI.Team != None && Players[i].PRI.Team.TeamIndex >= 0
					&& Players[i].PRI.Team.TeamIndex < ArrayCount(class'WIR_Util'.default.StringPrefixTeamIndex) )
				Msg = class'WIR_Util'.default.StringPrefixTeamIndex[Players[i].PRI.Team.TeamIndex] $ Msg;
			else
				Msg = class'WIR_Util'.default.StringPrefixNeutral $ Msg;
			Msg = Repl(MsgPlayerChangedName, "%o", Msg, True);
			Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
			Msg = Repl(Msg, "%n", MyGameHandler.FormatPlayerName(Players[i].Player, True), True);
			SendMessageOnce(Msg);

			Players[i].LastName = Players[i].Player.GetHumanReadableName();

		} // if name change

		if ( Players[i].bWasSpectator != Players[i].PRI.bOnlySpectator || Players[i].LastTeam != Players[i].PRI.Team ) {
			Msg = Repl(MsgPlayerChangedTeam, "%r", MyGameHandler.GetRemainingTime(), True);
			if ( Players[i].PRI.bOnlySpectator ) {
				// changed to spectators
				Msg = Repl(Msg, "%t", StringNameSpectators, True);
			}
			else if ( !Level.Game.bTeamGame ) {
				Msg = Repl(Msg, "%t", StringNameGame, True);
			}
			else if ( Players[i].LastTeam != Players[i].PRI.Team ) {
				Msg = Repl(Msg, "%t", class'WIR_Util'.static.FormatTeamName(Players[i].PRI.Team, False), True);
			}
			Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(Players[i].Player, True), True);
			SendMessageOnce(Msg);

			Players[i].bWasSpectator = Players[i].PRI.bOnlySpectator;
			Players[i].LastTeam = Players[i].PRI.Team;

		} // if team or spectator change
	}

	if ( bReportScoreboard ) {
		MyGameHandler.ReportScores();
		NextScoreReportTime = MyGameHandler.ScoreReportDelay;
		bReportScoreboard = False;
	}
	Tag = '';

} // Tick


//== NotifyLogin ==============================================================
/**
Report a connect.
*/
//=============================================================================

function NotifyLogin(Controller Entering)
{
	local string Msg;

	if ( Entering == None || Entering.PlayerReplicationInfo == None )
		return;

	if ( Entering.PlayerReplicationInfo.bOnlySpectator )
		Msg = MsgPlayerConnectedSpectator;
	else
		Msg = MsgPlayerConnected;

	Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
	Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(Entering, True), True);
	SendMessageOnce(Msg);
}


//== NotifyLogout =============================================================
/**
Report a disconnect.
*/
//=============================================================================

function NotifyLogout(Controller Exiting)
{
	local string Msg;
	local int i;

	Super.NotifyLogout(Exiting);

	for (i = 0; i < Disconnects.Length; ++i) {
		if ( Disconnects[i].Player == Exiting ) {
			Msg = Disconnects[i].Reason;
			Disconnects.Remove(i, 1);
			break;
		}
	}
	if ( Msg == "" )
		Msg = MsgPlayerDisconnected;
	Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
	Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(Exiting, True), True);
	SendMessageOnce(Msg);
}


//== Mutate ===================================================================
/**
Propagate Mutate commands to handlers.
*/
//=============================================================================

function Mutate(string MutateString, PlayerController Sender)
{
	local array<string> SplittedString;

	Super.Mutate(MutateString, Sender);
	if ( MyGameHandler.Mutate(MutateString, Sender) )
		return;

	if ( Sender == None ) {
		if ( Left(MutateString, 8) ~= "KickedBy" ) {
			MutateString = Mid(MutateString, 9);
			Split(MutateString, Chr(254), SplittedString);

			if ( SplittedString.Length >= 2 ) {
				Sender = PlayerController(FindPlayerByName(SplittedString[1]));
				if ( Sender != None )
					AddDisconnectReason(Sender, Repl(MsgPlayerWasKicked, "%m", SplittedString[0], True));
			}
		}
	}
}


//== FindPlayerByName =========================================================
/**
Returns the Controller of the player with the specified name.
*/
//=============================================================================

function Controller FindPlayerByName(string PlayerName)
{
	local int i;
	local GameReplicationInfo GRI;

	GRI = Level.Game.GameReplicationInfo;
	if ( GRI == None )
		return None; // can't work without GRI

	// search for exact name
	for (i = 0; i < GRI.PRIArray.Length; i++) {
		if ( GRI.PRIArray[i] != None && GRI.PRIArray[i].PlayerName ~= PlayerName
				&& class'WIR_Util'.static.IsPlayer(GRI.PRIArray[i]) )
			return Controller(GRI.PRIArray[i].Owner);
	}

	// search for the first name containing the string
	for (i = 0; i < GRI.PRIArray.Length; i++) {
		if ( GRI.PRIArray[i] != None && class'WIR_Util'.static.IsPlayer(GRI.PRIArray[i])
				&& InStr(Caps(GRI.PRIArray[i].PlayerName), Caps(PlayerName)) != -1 )
			return Controller(GRI.PRIArray[i].Owner);
	}

	return None; // no player found
}


//== AddDisconnectReason ======================================================
/**
Associates a custom disconnect text with a player.
*/
//=============================================================================

function AddDisconnectReason(Controller Exiting, string Reason)
{
	local int i;

	if ( Exiting == None )
		return;

	for (i = 0; i < Disconnects.Length; ++i) {
		if ( Disconnects[i].Player == None )
			Disconnects.Remove(i--, 1);
		else if ( Disconnects[i].Player == Exiting ) {
			if ( Reason == "" ) {
				Disconnects.Remove(i, 1);
				return;
			}
			else
				break;
		}
	}
	if ( i == Disconnects.Length )
		Disconnects.Length = i + 1;
	Disconnects[i].Player = Exiting;
	Disconnects[i].Reason = Reason;
}


//== Trigger ==================================================================
/**
Catch actual item pickups.
*/
//=============================================================================

event Trigger(Actor Other, Pawn EventInstigator)
{
	if ( Pickup(Other) != None && class'WIR_Util'.static.IsPlayer(EventInstigator) && ReportConnection != None )
		Pickup(EventInstigator.Controller, Pickup(Other));
}


//== InGameEvent ==============================================================
/**
Called when receiving ingame event messages.
*/
//=============================================================================

function InGameEvent(class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject)
{
	local string Msg;

	if ( ReportConnection != None ) {
		Msg = class'WIR_Util'.static.Trim(Message.Static.GetString(Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject));
		if ( Msg == "" )
			return; // nothing to send

		Msg = Repl(MsgGameEvent, "%m", Msg, True);
		Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
		ReportConnection.SendMessage(Msg);
	}
}


//== InGameChat ===============================================================
/**
Called when receiving an ingame chat message.
*/
//=============================================================================

function InGameChat(PlayerReplicationInfo PRI, string Message, bool bTeamSay)
{
	local string Msg;
	local int i;

	if ( ChatConnection != None ) {
		if (ChatColorCodes.Length > 0) {
			do {
				Message = Repl(Message, "^" $ i, ChatColorCodes[i]);
			} until (++i == ChatColorCodes.Length);
			Message = Repl(Message, "^r", ChatColorCodes[Rand(ChatColorCodes.Length)]);
		}
		Msg = class'WIR_Util'.static.ReplOnce(MsgPlayerChat, "%r", MyGameHandler.GetRemainingTime(), True);
		Msg = class'WIR_Util'.static.ReplOnce(Msg,           "%m", Message, True);
		Msg = class'WIR_Util'.static.ReplOnce(Msg,           "%p", MyGameHandler.FormatPlayerName(PRI, True), True);
		ChatConnection.SendMessage(Msg);
	}
}


//== ReceivedChatMessage ======================================================
/**
Called when receiving an IRC chat message.
*/
//=============================================================================

function ReceivedChatMessage(string Nick, string Message)
{
	local bool bIsAction, bSpectatorsOnly;

	if (ReportConnection != None && Nick ~= ReportConnection.UserNick) {
		return;
	}

	if (Left(Message, 8) == (Chr(1) $ "ACTION ") && Right(Message, 1) == Chr(1)) {
		Message = Mid(Message, 8, Len(Message) - 9);
		bIsAction = True;
	}
	else if (Left(Message, 1) == Chr(1))
		return;

	if (InStr(Message, ChatTrigger) == 0) {
		if (ChatTrigger != "")
			Message = Mid(Message, Len(ChatTrigger));
	}
	else if (InStr(Message, SpecOnlyChatTrigger) == 0) {
		if (SpecOnlyChatTrigger != "") {
			Message = Mid(Message, Len(SpecOnlyChatTrigger));
			bSpectatorsOnly = True;
		}
		else if (ChatTrigger != "")
			return;   // empty spec-only chat trigger should not override chat trigger
	}
	else
		return; // no trigger found

	if (bIsAction)
		Message = Repl(TemplateAction, "%m", Message, True);
	else
		Message = Repl(TemplateMessage, "%m", Message, True);

	Message = Repl(class'WIR_Util'.static.StripIRCCodes(Message), "%u", Nick, True);

	if (bChatToGameAsTeamSay || bSpectatorsOnly)
		MyChatSpectator.ServerTeamSay(Message);
	else
		MyChatSpectator.ServerSay(Message);
}


//== ReceivedModeMessage ======================================================
/**
Called when receiving a mode change.
*/
//=============================================================================

function ReceivedModeMessage(WIR_IRCConnection.EModeType Type, string Nick, string Parameters)
{
	local string S;

	if ( bChatReceiveOnlyText )
		return;

	switch (Type) {
		case MT_Join:
			if (bChatToGameAsTeamSay)
				MyChatSpectator.ServerTeamSay(Repl(TemplateJoin, "%u", Nick, True));
			else
				MyChatSpectator.ServerSay(Repl(TemplateJoin, "%u", Nick, True));
			break;
		case MT_Part:
			if (bChatToGameAsTeamSay)
				MyChatSpectator.ServerTeamSay(Repl(TemplatePart, "%u", Nick, True));
			else
				MyChatSpectator.ServerSay(Repl(TemplatePart, "%u", Nick, True));
			break;
		case MT_Quit:
			if (bChatToGameAsTeamSay)
				MyChatSpectator.ServerTeamSay(Repl(TemplateQuit, "%u", Nick, True));
			else
				MyChatSpectator.ServerSay(Repl(TemplateQuit, "%u", Nick, True));
			break;
		case MT_Kick:
			Divide(Parameters, " ", S, Parameters);
			if (bChatToGameAsTeamSay)
				MyChatSpectator.ServerTeamSay(Repl(Repl(TemplateKick, "%k", S, True), "%u", Nick, True));
			else
				MyChatSpectator.ServerSay(Repl(Repl(TemplateKick, "%k", S, True), "%u", Nick, True));
			break;
		case MT_Nick:
			if (bChatToGameAsTeamSay)
				MyChatSpectator.ServerTeamSay(Repl(Repl(TemplateNick, "%n", Parameters, True), "%u", Nick, True));
			else
				MyChatSpectator.ServerSay(Repl(Repl(TemplateNick, "%n", Parameters, True), "%u", Nick, True));
			break;
	}
}


//== SendMessageOnce ==========================================================
/**
Send a chat message to the IRC connection(s), but only to one of them if they are in the same channel.
*/
//=============================================================================

function SendMessageOnce(string Msg)
{
	if ( ReportConnection != None )
		ReportConnection.SendMessage(Msg);
	if ( ChatConnection != None && (ReportConnection == None || ChatConnection != ReportConnection
			&& (ChatConnection.ServerName != ReportConnection.ServerName
			|| ChatConnection.ChannelName != ReportConnection.ChannelName)) )
		ChatConnection.SendMessage(Msg);
}


//== CheckReplacement =========================================================
/**
Detect a Controller spawning.
*/
//=============================================================================

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	if ( Controller(Other) != None ) {
		Players.Insert(0, 1);
		Players[0].Player = Controller(Other);
	}
	return Super.CheckReplacement(Other, bSuperRelevant);
}


//== InitPickupBaseCache ======================================================
/**
Initializes the pickup base cache.
*/
//=============================================================================

function InitPickupBaseCache()
{
	local xPickupBase B;
	local string LocationName;

	PickupBases.Length = 0;
	foreach AllActors(class'xPickupBase', B)
		if ( B.PowerUp != None ) {
			LocationName = GetLocationNameFor(B);
			if ( LocationName != "" ) {
				PickupBases.Insert(0, 1);
				PickupBases[0].Base = B;
				PickupBases[0].LocationName = LocationName;
			}
		}
} // InitPickupBaseCache


//== GetLocationNameFor =======================================================
/**
Returns a location name for the specified actor.
*/
//=============================================================================

function string GetLocationNameFor(Actor A)
{
	local Volume V;
	local int i;
	local string LocName;

	if ( !bVolumesInitialized ) {
		bVolumesInitialized = True;
		MyGameHandler.UpdateLocationNames();
		Volumes.Length = 0;

		// initialize the Volumes list
		foreach AllActors(class'Volume', V) {
			if ( V.LocationName == "" || V.LocationName == class'Volume'.Default.LocationName )
				continue; // skip volumes without location name

			// find volume with highest priority lower than or equal to this volume's priority
			for (i = 0; i < Volumes.Length; ++i)
				if ( Volumes[i].LocationPriority <= V.LocationPriority )
					break;
			Volumes.Insert(i, 1);
			Volumes[i] = V;
		}
		V = None;
	}

	if ( MyGameHandler.GetLocationNameFor(A, LocName) )
		return LocName;

	for (i = 0; i < Volumes.Length; ++i)
		if ( Volumes[i].Encompasses(A) ) {
			V = Volumes[i];
			break;
		}

	if ( V != None )
		return V.LocationName;
	else if ( A.Region.Zone != None && A.Region.Zone != Level && A.Region.Zone.LocationName != "" )
		return A.Region.Zone.LocationName;

	return "";

} // GetLocationNameFor


//== GetLocationName ==========================================================
/**
Returns a location name for the specified controller's pawn.
*/
//=============================================================================

function string GetLocationName(Controller Who)
{
	local float bestDist, currDist;
	local Actor Closest;
	local string near, bestNear, where, locName, ObjName;
	local xPickupBase B;
	local int i;

	if ( Who.Pawn == None )
		return Who.PlayerReplicationInfo.StringSpectating;

	Closest = MyGameHandler.GetClosestGameObjective(Who.Pawn.Location);
	if ( Closest != None )
		bestDist = VSize(Closest.Location - Who.Pawn.Location);
	else
		bestDist = 10000.0;

	// If our closest gameobjective is more than 1024UU away, look for nearby pickup base
	if ( bestDist > 750 ) { // Look for closer objects
		if ( PickupBases.Length == 0 )
			InitPickupBaseCache();
		for (i = 0; i < PickupBases.Length; i++) {
			B = PickupBases[i].Base;
			currDist = VSize(B.Location - Who.Pawn.Location);
			if ( currDist < FMin(bestDist, 2000) ) {
				if ( B.IsA('WildCardBase') || B.IsA('MultiPickupBase') )
					near = StringNameWildcardBase;
				else if ( B.Powerup != None && B.Powerup.default.InventoryType != None )
					near = B.Powerup.default.InventoryType.static.StaticItemName();
				else if ( B.Powerup != None )
					near = GetPickupName(B.Powerup);
				else
					near = "";

				if ( near != "" ) {
					bestDist = currDist;
					bestNear = near;
					Closest = B;
				}
			}
		}
	}

	if ( Who != None && Who.Pawn != None ) {
		locName = class'WIR_Util'.static.Trim(GetLocationNameFor(Who.Pawn));
		if ( locName != "" )
			locName = "(" $ locName $ ")";
	}
	if ( Closest != None ) {
		if ( GameObjective(Closest) != None ) {
			ObjName = MyGameHandler.GetObjectiveName(GameObjective(Closest));
			if ( locName == "" || InStr(locName, ObjName) != -1 )
				return class'TeamGame'.Default.NearString @ ObjName;
			return class'TeamGame'.Default.NearString @ ObjName @ locName;
		}
		else if ( xPickupBase(Closest) != None && xPickupBase(Closest).Powerup != None ) {
			where = Level.Game.FindTeamDesignation(Level.Game.GameReplicationInfo, Closest);

			if ( locName == "" )
				return class'TeamGame'.Default.NearString @ where $ bestNear;
			return class'TeamGame'.Default.NearString @ where $ bestNear @ locName;
		}
	}
	return locName;

} // GetLocationName


//=============================================================================
// GetPickupName
//
// Returns a localized string for a pickup's name.
//=============================================================================

function string GetPickupName(class<Pickup> PickupClass)
{
	local int i;

	for (i = 0; i < Items.Length; i++) {
		if ( Items[i].ItemClass == PickupClass.Name )
			return Items[i].ItemName;
	}
	if ( PickupClass.default.InventoryType != None )
		return PickupClass.default.InventoryType.static.StaticItemName();
	return "";
}


//== GetPickupLocationName ===========================================================
/**
Returns a pickup base's location name.
*/
//=============================================================================

function string GetPickupLocationName(xPickupBase Base)
{
	local int i;

	if ( Base == None )
		return "";

	if ( PickupBases.Length == 0 )
		InitPickupBaseCache();

	for (i = 0; i < PickupBases.Length; i++) {
		if ( Base == PickupBases[i].Base && PickupBases[i].LocationName != "" ) {
			if ( Base.IsA('WildCardBase') || Base.IsA('MultiPickupBase') )
				return "(" $ StringNameWildcardBase $ "/" $ class'WIR_Util'.static.Trim(PickupBases[i].LocationName) $ ")";
			return "(" $ class'WIR_Util'.static.Trim(PickupBases[i].LocationName) $ ")";
		}
	}
	if ( Base.IsA('WildCardBase') || Base.IsA('MultiPickupBase') )
		return "(" $ StringNameWildcardBase $ ")";
	return "";
}


//== Reset ====================================================================
/**
Report a game reset.
*/
//=============================================================================

function Reset()
{
	bNewRound = True;
	bVolumesInitialized = False;  // power link setup might have changed, which involves renaming locations
}


//== ServerTraveling ==========================================================
/**
Detect an upcoming map change.
*/
//=============================================================================

function ServerTraveling(string NextURL, bool bItems)
{
	Super.ServerTraveling(NextURL, bItems);

	GotoState('PreTravel');
} // ServerTraveling


//== MatchStarting ============================================================
/**
Called when the match starts.
*/
//=============================================================================

function MatchStarting()
{
	bMatchStarted = True;
	NextScoreReportTime = MyGameHandler.ScoreReportDelay;
	if ( bSetReportChannelTopic && ReportConnection != None && ReportConnection.IsInState('InChannel') )
		ReportConnection.UpdateTopic();
}


//-----------------------------------------------------------------------------
// GameRules interface functions
//-----------------------------------------------------------------------------

//== RoundHasEnded ============================================================
/**
Report the end of a round.
*/
//=============================================================================

function RoundHasEnded()
{
	local string Msg, Reason;

	if ( ReportConnection != None && !MyGameHandler.HandleEndRound(Reason) ) {
		Msg = Repl(MsgGameRoundEnded, "%r", MyGameHandler.GetRemainingTime(), True);
		if ( Reason != "" )
			Msg $= Repl(StringMsgSuffix, "%m", Reason, True);
		ReportConnection.SendMessage(Msg, True);
		bReportScoreboard = True;
	}
}


//== ScoreKill ================================================================
/**
Report a kill.
*/
//=============================================================================

function ScoreKill(Controller Killer, Controller Killed, optional class<DamageType> DamageType)
{
	local string Msg, MsgSuffix, LocName;
	local class<Weapon> Weapon;
	local int i, AmpRunIndexKiller, AmpRunIndexKilled;

	if ( Killed != None && Killed.PlayerReplicationInfo != None && Killed.PlayerReplicationInfo.bOutOfLives )
		GameEndReason = "LastMan";

	if ( ReportConnection == None || MyGameHandler.HandleKill(Killer, Killed, DamageType, MsgSuffix) ) {
		if ( Killer == None )
			Killer = Killed;
		if ( AmpRuns.Length > 0 && Killed != None && Killer != Killed && !Killer.SameTeamAs(Killed) && Killed.bIsPlayer ) {
			AmpRunIndexKiller = -1;
			AmpRunIndexKilled = -1;
			for (i = 0; i < AmpRuns.Length; i++) {
				if (AmpRuns[i].Player == Killer.Pawn)
					AmpRunIndexKiller = i;
				if (AmpRuns[i].Player == Killed.Pawn)
					AmpRunIndexKilled = i;
			}
			if ( class<Fell>(DamageType) != None && class<DamTypeTelefragged>(DamageType) != None && AmpRunIndexKilled != AmpRunIndexKiller )
				AmpRuns[AmpRunIndexKiller].Kills++;
		}
		return;
	}
	if ( MyGameHandler.bReportWeapons && class<WeaponDamageType>(DamageType) != None && (Killer == None || Killer.Pawn == None || !Killer.Pawn.IsA('ONSMobileAssaultStation') || DamageType != class'DamTypeRocket') ) {
		// fix for Leviathan kills being reported as rocket launcher kills
		Weapon = class<WeaponDamageType>(DamageType).default.WeaponClass;
	}

	if ( Killer == None )
		Killer = Killed;
	if ( ReportConnection != None && Killed != None ) {
		if ( Killed == Killer ) {
			Msg = MsgPlayerSuicided;
			if ( class<FellLava>(DamageType) != None )
				Msg = Repl(Msg, "%s", StringSuicideLava, True);
			else if ( class<Fell>(DamageType) != None )
				Msg = Repl(Msg, "%s", StringSuicideFell, True);
			else if ( class<Drowned>(DamageType) != None )
				Msg = Repl(Msg, "%s", StringSuicideDrowned, True);
			else
				Msg = Repl(Msg, "%s", StringSuicide, True);
		}
		else if ( Killer.SameTeamAs(Killed) )
			Msg = MsgPlayerTeamKilled;
		else if ( Killed.bIsPlayer )
			Msg = MsgPlayerScoredKill;
		else return;

		AmpRunIndexKiller = -1;
		AmpRunIndexKilled = -1;
		for (i = 0; i < AmpRuns.Length; i++) {
			if (AmpRuns[i].Player == Killer.Pawn)
				AmpRunIndexKiller = i;
			if (AmpRuns[i].Player == Killed.Pawn)
				AmpRunIndexKilled = i;
		}

		if ( Weapon != None ) {
			if ( AmpRunIndexKiller != -1 ) {
				Msg $= Repl(StringSuffixWeaponAmped, "%w", Weapon.static.StaticItemName(), True);
				if ( AmpRunIndexKilled != AmpRunIndexKiller )
					AmpRuns[AmpRunIndexKiller].Kills++;
			}
			else
				Msg $= Repl(StringSuffixWeapon, "%w", Weapon.static.StaticItemName(), True);
		}
		else if ( Killer != Killed ) {
			if ( class<Fell>(DamageType) != None )
				Msg $= StringSuffixPush;
			else if ( class<DamTypeTelefragged>(DamageType) != None )
				Msg $= StringSuffixTelefrag;
			else if ( AmpRunIndexKilled != AmpRunIndexKiller )
				AmpRuns[AmpRunIndexKiller].Kills++;
		}

		if ( MyGameHandler.bReportLocations ) {
			LocName = class'WIR_Util'.static.Trim(GetLocationName(Killed));
			if ( LocName != "" )
				Msg $= Repl(StringSuffixLocation, "%l", LocName, True);
		}
		Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);

		if ( MyGameHandler.bReportSpecial && Killer != Killed ) {
			if ( class<DamTypeRoadkill>(DamageType) != None && DamageType.default.MessageClass != None ) {
				Msg $= Repl(StringMsgSuffix, "%m", DamageType.default.MessageClass.static.GetString(
						Rand(class<DamTypeRoadkill>(DamageType).default.NumMessages)
						+ class<DamTypeRoadkill>(DamageType).default.MessageSwitchBase), True);
			}
			else if ( class<DamTypeAttackCraftPlasma>(DamageType) != None
					|| class<DamTypeAttackCraftMissle>(DamageType) != None ) {
				if ( Killed != None && Killer != Killed && Vehicle(Killed.Pawn) != None && Vehicle(Killed.Pawn).bCanFly )
					Msg $= Repl(StringMsgSuffix, "%m", class'ONSVehiclekillMessage'.static.GetString(6), True);
			}
			else if ( class<DamTypeTankShell>(DamageType) != None ) {
				if ( Killed != None && Killer != Killed && Vehicle(Killed.Pawn) != None && Vehicle(Killed.Pawn).bCanFly )
					Msg $= Repl(StringMsgSuffix, "%m", class'ONSVehiclekillMessage'.static.GetString(5), True);
			}
			else if ( class<DamTypeShockCombo>(DamageType) != None ) {
				Msg $= Repl(StringMsgSuffix, "%m", StringComboKill);
			}
			else if ( DamageType != None && DamageType.default.bAlwaysSevers && DamageType.default.bSpecial ) {
				Msg $= Repl(StringMsgSuffix, "%m", class'SpecialKillMessage'.static.GetString(), True);
			}
		}
		if ( UnrealPlayer(Killer) != None && UnrealPlayer(Killer).MultiKillLevel > 0 )
			Msg $= Repl(StringMsgSuffix, "%m", class'MultiKillMessage'.static.GetString(UnrealPlayer(Killer).MultiKillLevel), True);

		Msg = Repl(Msg, "%k", MyGameHandler.FormatPlayerName(Killer,, MyGameHandler.StringScoreTemplate), True);
		Msg = Repl(Msg, "%o", MyGameHandler.FormatPlayerName(Killed,, MyGameHandler.StringScoreTemplate), True);

		if ( MsgSuffix != "" )
			Msg $= Repl(StringMsgSuffix, "%m", MsgSuffix, True);

		if ( AmpRunIndexKilled != -1 ) {
			if ( AmpRuns[AmpRunIndexKilled].Kills == 0 )
				Msg $= Repl(StringAmpRunStoppedNoKills, "%t", int(Round((Level.TimeSeconds - AmpRuns[AmpRunIndexKilled].StartTime) / Level.TimeDilation)), True);
			else if ( AmpRuns[AmpRunIndexKilled].Kills == 1 )
				Msg $= Repl(StringAmpRunStoppedOneKill, "%t", int(Round((Level.TimeSeconds - AmpRuns[AmpRunIndexKilled].StartTime) / Level.TimeDilation)), True);
			else
				Msg $= Repl(Repl(StringAmpRunStopped, "%k", AmpRuns[AmpRunIndexKilled].Kills, True), "%t", int(Round((Level.TimeSeconds - AmpRuns[AmpRunIndexKilled].StartTime) / Level.TimeDilation)), True);
			AmpRuns.Remove(AmpRunIndexKilled, 1);
		}

		if ( Killed.PlayerReplicationInfo != None && Killed.PlayerReplicationInfo.bOutOfLives && MyGameHandler.bAnnounceOutOfLives )
			Msg $= Repl(StringPlayerIsOut, "%p", MyGameHandler.FormatPlayerName(Killed, True), True);

		ReportConnection.SendMessage(Msg);
	}
} // ScoreKill


//== ScoreObjective ===========================================================
/**
Report a goal, capture, etc.
*/
//=============================================================================

function ScoreObjective(Controller Scorer, int Score)
{
	if ( MyGameHandler != None )
		MyGameHandler.ScoreObjective(Scorer, Score);
}


//== Pickup ===================================================================
/**
Report a pickup.
*/
//=============================================================================

function Pickup(Controller Other, Pickup Item)
{
	local int i;
	local string Msg;
	local bool bColor;

	if ( Other == None || Other.PlayerReplicationInfo == None || Item == None || MyGameHandler.ReportPickups == 0 )
		return;

	for (i = 0; i < Items.Length; i++)
		if ( Item.IsA(Items[i].ItemClass) && (MyGameHandler.ReportPickups > 1 || Items[i].Important) ) {
			Msg = Repl(MsgPlayerPickup, "%i", Items[i].ItemName, True);
			bColor = True;
			break;
		}
	if ( Msg == "" && Item.IsSuperItem() && MyGameHandler.ReportPickups > 1 )
		Msg = Repl(MsgPlayerPickup, "%i", Item.InventoryType.static.StaticItemName(), True);

	if ( Msg != "" ) {
		if ( bColor )
			Msg = Repl(Msg, "%c", Items[i].IRCColor, True);
		else
			Msg = Repl(Msg, "%c", "", True);
		Msg = Repl(Msg, "%r", MyGameHandler.GetRemainingTime(), True);
		if ( MyGameHandler.bReportLocations )
			Msg $= Repl(StringSuffixLocation, "%l", GetPickupLocationName(Item.PickupBase), True);
		Msg = Repl(Msg, "%p", MyGameHandler.FormatPlayerName(Other,, MyGameHandler.StringScoreTemplate), True);
		ReportConnection.SendMessage(Msg);
	}
} // Pickup


//== static FillPlayInfo ======================================================
/**
Add the configuration options to the PlayInfo.
*/
//=============================================================================

static function FillPlayInfo(PlayInfo PlayInfo)
{
	local int i;

	GetGameHandlerClass(PlayInfo.GetGameInfo()).static.FillPlayInfo(PlayInfo);
	PlayInfo.PopClass();

	class'WIR_ModHandler'.static.FillPlayInfo(PlayInfo);
	PlayInfo.PopClass();

	for (i = 0; i < default.ModHandlerClasses.Length; ++i) {
		default.ModHandlerClasses[i].static.FillPlayInfo(PlayInfo);
		PlayInfo.PopClass();
	}

	Super.FillPlayInfo(PlayInfo);

	// Reporter Bot
	PlayInfo.AddSetting(default.ReporterGroup, "bEnableReporter",            default.lblEnableReporter, 4, 10, "Check");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportServerName",           default.lblReportServerName, 4, 16, "Text", "60");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportServerPort",           default.lblReportServerPort, 4, 18, "Text", "5;1:65535");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportServerPassword",       default.lblReportServerPassword, 4, 20, "Text", "20");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportUserNick",             default.lblReportUserNick, 4, 22, "Text", "30");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportUserIdent",            default.lblReportUserIdent, 4, 24, "Text", "10");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportChannel",              default.lblReportChannel, 4, 28, "Text", "60");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportChannelKey",           default.lblReportChannelKey, 4, 29, "Text", "60");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportStripCodes",           default.lblReportStripCodes, 4, 30, "Select", default.dataStripCodes);
	PlayInfo.AddSetting(default.ReporterGroup, "bSetReportChannelTopic",     default.lblSetReportChannelTopic, 4, 31, "Check");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportChannelTopicTemplate", default.lblReportChannelTopicTemplate, 4, 32, "Text", "200");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportChannelTopicBotPart",  default.lblReportChannelTopicBotPart, 4, 33, "Text", "100");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportChannelTopicBotIdle",  default.lblReportChannelTopicBotIdle, 4, 34, "Text", "150");
	PlayInfo.AddSetting(default.ReporterGroup, "ReportChannelTopicUserPart", default.lblReportChannelTopicUserPart, 4, 35, "Text", "150");
	PlayInfo.AddSetting(default.ReporterGroup, "MaxLevelChangeDelay",        default.lblMaxLevelChangeDelay, 4, 36, "Text", "3;0:120");

	PlayInfo.AddSetting(default.ReporterGroup, "Items", default.lblItems, 4, 36, "Text");

	// Chat Relay Bot
	PlayInfo.AddSetting(default.ChatRelayGroup, "bEnableChatbot",           default.lblEnableChatbot, 4, 40, "Check");
	PlayInfo.AddSetting(default.ChatRelayGroup, "bEnableTwoWayChat",        default.lblEnableTwoWayChat, 4, 42, "Check");
	PlayInfo.AddSetting(default.ChatRelayGroup, "bChatToGameAsTeamSay",     default.lblChatToGameAsTeamSay, 4, 43, "Check");
	PlayInfo.AddSetting(default.ChatRelayGroup, "bChatThroughReporter",     default.lblChatThroughReporter, 4, 44, "Check");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatServerName",           default.lblChatServerName, 4, 46, "Text", "60");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatServerPort",           default.lblChatServerPort, 4, 48, "Text", "5;1:65535");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatServerPassword",       default.lblChatServerPassword, 4, 50, "Text", "20");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatUserNick",             default.lblChatUserNick, 4, 52, "Text", "30");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatUserIdent",            default.lblChatUserIdent, 4, 54, "Text", "10");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatChannel",              default.lblChatChannel, 4, 58, "Text", "60");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatChannelKey",           default.lblChatChannelKey, 4, 59, "Text", "60");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatStripCodes",           default.lblChatStripCodes, 4, 60, "Select", default.dataStripCodes);
	PlayInfo.AddSetting(default.ChatRelayGroup, "ChatTrigger",              default.lblChatTrigger, 4, 61, "Text", "10");
	PlayInfo.AddSetting(default.ChatRelayGroup, "SpecOnlyChatTrigger",      default.lblSpecOnlyChatTrigger, 4, 62, "Text", "10");
	PlayInfo.AddSetting(default.ChatRelayGroup, "bChatReceiveOnlyText",     default.lblChatReceiveOnlyText, 4, 63, "Check");
	PlayInfo.AddSetting(default.ChatRelayGroup, "ColorCodeReplacements",    default.lblColorCodeReplacements, 4, 64, "Text", "60");

	// Connection Settings
	PlayInfo.AddSetting(default.FriendlyName, "FloodProtectCommandPenalty", default.lblFloodProtectCommandPenalty, 4, 80, "Text", "4;0:9999");
	PlayInfo.AddSetting(default.FriendlyName, "FloodProtectMessagePenalty", default.lblFloodProtectMessagePenalty, 4, 81, "Text", "4;0:9999");
	PlayInfo.AddSetting(default.FriendlyName, "FloodProtectMaxPenalty",     default.lblFloodProtectMaxPenalty, 4, 82, "Text", "2;0:30");
	PlayInfo.AddSetting(default.FriendlyName, "FloodProtectBytes",          default.lblFloodProtectBytes, 4, 83, "Text", "4;128:1024");
	PlayInfo.AddSetting(default.FriendlyName, "FloodProtectBytesDuration",  default.lblFloodProtectBytesDuration, 4, 84, "Text", "2;0:30");
	PlayInfo.AddSetting(default.FriendlyName, "MaxLenMessageQueue",         default.lblMaxLenMessageQueue, 4, 85, "Text", "3;0:100");
	PlayInfo.AddSetting(default.FriendlyName, "bAutoReconnect",             default.lblAutoReconnect, 4, 86, "Check");
	PlayInfo.AddSetting(default.FriendlyName, "ReconnectDelay",             default.lblReconnectDelay, 4, 88, "Text", "3;1:600");
	PlayInfo.AddSetting(default.FriendlyName, "bAutoRejoin",                default.lblAutoRejoin, 4, 87, "Check");
	PlayInfo.AddSetting(default.FriendlyName, "ConnectTimeout",             default.lblConnectTimeout, 4, 88, "Text", "3;10:600");
	PlayInfo.AddSetting(default.FriendlyName, "DebugLogFileName",           default.lblDebugLogFileName, 254, 254, "Text", "100");
	PlayInfo.AddSetting(default.FriendlyName, "bDebugStartMatch",           default.lblDebugStartMatch, 4, 255, "Check");

	// Auth
	PlayInfo.AddSetting(default.FriendlyName, "bAuth",          default.lblAuth,          4, 91, "Check");
	PlayInfo.AddSetting(default.FriendlyName, "bChallengeAuth", default.lblChallengeAuth, 4, 92, "Check");
	PlayInfo.AddSetting(default.FriendlyName, "bHideRealHost",  default.lblHideRealHost,  4, 93, "Check");
	PlayInfo.AddSetting(default.FriendlyName, "AuthNick",       default.lblAuthNick,      254, 94, "Text", "15", "A");
	PlayInfo.AddSetting(default.FriendlyName, "AuthPassword",   default.lblAuthPassword,  254, 95, "Text", "15", "A");

} // FillPlayInfo


//== static GetDescriptionText ================================================
/**
Returns a description for the specified configuration option.
*/
//=============================================================================

static event string GetDescriptionText(string PropertyName)
{
	switch (PropertyName) {
		case "bEnableReporter":             return default.descEnableReporter;
		case "ReportServerName":            return default.descReportServerName;
		case "ReportServerPort":            return default.descReportServerPort;
		case "ReportServerPassword":        return default.descReportServerPassword;
		case "ReportUserNick":              return default.descReportUserNick;
		case "ReportUserIdent":             return default.descReportUserIdent;
		case "ReportChannel":               return default.descReportChannel;
		case "ReportChannelKey":            return default.descReportChannelKey;
		case "ReportStripCodes":            return default.descReportStripCodes;
		case "bSetReportChannelTopic":      return default.descSetReportChannelTopic;
		case "ReportChannelTopicTemplate":  return default.descReportChannelTopicTemplate;
		case "ReportChannelTopicBotPart":   return default.descReportChannelTopicBotPart;
		case "ReportChannelTopicBotIdle":   return default.descReportChannelTopicBotIdle;
		case "ReportChannelTopicUserPart":  return default.descReportChannelTopicUserPart;
		case "MaxLevelChangeDelay":         return default.descMaxLevelChangeDelay;

		case "bEnableChatbot":        return default.descEnableChatbot;
		case "bEnableTwoWayChat":     return default.descEnableTwoWayChat;
		case "bChatToGameAsTeamSay":  return default.descChatToGameAsTeamSay;
		case "bChatThroughReporter":  return default.descChatThroughReporter;
		case "ChatServerName":        return default.descChatServerName;
		case "ChatServerPort":        return default.descChatServerPort;
		case "ChatServerPassword":    return default.descChatServerPassword;
		case "ChatUserNick":          return default.descChatUserNick;
		case "ChatUserIdent":         return default.descChatUserIdent;
		case "ChatChannel":           return default.descChatChannel;
		case "ChatChannelKey":        return default.descChatChannelKey;
		case "ChatStripCodes":        return default.descChatStripCodes;
		case "ChatTrigger":           return default.descChatTrigger;
		case "SpecOnlyChatTrigger":   return default.descSpecOnlyChatTrigger;
		case "bChatReceiveOnlyText":  return default.descChatReceiveOnlyText;
		case "ColorCodeReplacements": return default.descColorCodeReplacements;

		case "FloodProtectCommandPenalty":  return default.descFloodProtectCommandPenalty;
		case "FloodProtectMessagePenalty":  return default.descFloodProtectMessagePenalty;
		case "FloodProtectMaxPenalty":      return default.descFloodProtectMaxPenalty;
		case "FloodProtectBytes":           return default.descFloodProtectBytes;
		case "FloodProtectBytesDuration":   return default.descFloodProtectBytesDuration;
		case "MaxLenMessageQueue":          return default.descMaxLenMessageQueue;
		case "bAutoReconnect":              return default.descAutoReconnect;
		case "ReconnectDelay":              return default.descReconnectDelay;
		case "bAutoRejoin":                 return default.descAutoRejoin;
		case "ConnectTimeout":              return default.descConnectTimeout;
		case "DebugLogFileName":            return default.descDebugLogFileName;
		case "bDebugStartMatch":            return default.descDebugStartMatch;

		case "bAuth":           return default.descAuth;
		case "bChallengeAuth":  return default.descChallengeAuth;
		case "bHideRealHost":   return default.descHideRealHost;
		case "AuthNick":        return default.descAuthNick;
		case "AuthPassword":    return default.descAuthPassword;

		case "Items":           return default.descItems;
	}

	return Super.GetDescriptionText(PropertyName);

} // GetDescriptionText


//=============================================================================
// Default properties
//=============================================================================

defaultproperties
{
	FriendlyName  = "Wormbot v3"
	GroupName     = "IRC Reporter"
	Description   = "Wormbo's IRC Reporter Bot"
	Build         = "%%%%-%%-%% %%:%%"

	bEnableReporter           = False
	ReportServerName          = "irc.quakenet.org"
	ReportServerPort          = 6667
	ReportServerPassword      = ""
	ReportUserNick            = "RenameMe"
	ReportUserIdent           = "wormbot"
	ReportChannel             = ""
	ReportChannelKey          = ""
	bSetReportChannelTopic      = False
	ReportChannelTopicTemplate  = "%%userpart%%[^O] [^B]|[^B] Reporting: %%botpart%%"
	ReportChannelTopicBotPart   = "[^B]%%game%%[^B] on [^B]%%map%%[^B]"
	ReportChannelTopicBotIdle   = "No match in progress."
	ReportChannelTopicUserPart  = "No user topic set."
	MaxLevelChangeDelay         = 60

	bEnableChatBot          = False
	bEnableTwoWayChat       = False
	bChatToGameAsTeamSay    = False
	bChatThroughReporter    = True
	ChatServerName          = "irc.quakenet.org"
	ChatServerPort          = 6667
	ChatServerPassword      = ""
	ChatUserNick            = "RenameMe"
	ChatUserIdent           = "wormbot"
	ChatChannel             = ""
	ChatChannelKey          = ""
	ChatTrigger             = ""
	SpecOnlyChatTrigger     = ""
	bChatReceiveOnlyText    = True
	ColorCodeReplacements   = "[^K]14 [^K]04 [^K]03 [^K]07 [^K]12 [^K]13 [^K]10 [^K]15"

	bAutoReconnect  = True
	ReconnectDelay  = 10
	bAutoRejoin     = True
	ConnectTimeout  = 60

	DebugLogFileName = ""
	bDebugStartMatch = False

	FloodProtectCommandPenalty  = 2000
	FloodProtectMessagePenalty  = 2750
	FloodProtectMaxPenalty      = 10
	FloodProtectBytes           = 512
	FloodProtectBytesDuration   = 10
	MaxLenMessageQueue          = 30

	bAuth           = False
	bChallengeAuth  = True
	bHideRealHost   = True
	AuthNick        = ""
	AuthPassword    = ""

	Items[0]  = (ItemClass=UDamagePack,ItemName="Double Damage",Important=True,IRCColor=13)
	Items[1]  = (ItemClass=ShieldPack,ItemName="Shield Pack",Important=False,IRCColor=7)
	Items[2]  = (ItemClass=SuperShieldPack,ItemName="Super Shield Pack",Important=True,IRCColor=7)
	Items[3]  = (ItemClass=SuperHealthPack,ItemName="Big Keg O' Health",Important=True,IRCColor=12)
	Items[4]  = (ItemClass=RedeemerPickup,ItemName="Redeemer",Important=True,IRCColor=10)
	Items[5]  = (ItemClass=PainterPickup,ItemName="Ion Painter",Important=True,IRCColor=10)
	Items[6]  = (ItemClass=GravBeltPickup,ItemName="Grav Belt",Important=True,IRCColor=14)
	Items[7]  = (ItemClass=JumpbootsPickup,ItemName="Jump Boots",Important=True,IRCColor=12)
	Items[8]  = (ItemClass=VortexPickup,ItemName="Gravity Vortex",Important=True,IRCColor=10)
	Items[9]  = (ItemClass=ChaosRelicPickup_Armor,ItemName="Chaos Relic of Protection",Important=True,IRCColor=7)
	Items[10] = (ItemClass=ChaosRelicPickup_Damage,ItemName="Chaos Relic of Strength",Important=True,IRCColor=4)
	Items[11] = (ItemClass=ChaosRelicPickup_Regen,ItemName="Chaos Relic of Regeneration",Important=True,IRCColor=3)
	Items[12] = (ItemClass=ChaosRelicPickup_Speed,ItemName="Chaos Relic of Speed",Important=True,IRCColor=12)
	Items[13] = (ItemClass=ChaosRelicPickup_Vampire,ItemName="Chaos Relic of Vampirism",Important=True,IRCColor=6)
	Items[14] = (ItemClass=ChaosRelicPickup_Vengeance,ItemName="Chaos Relic of Vengeance",Important=True,IRCColor=7)

	// templates for reporter bot
	MsgGameReset      = "[^B][%r] A new round has begun[^B]"
	MsgGameRoundEnded = "[^B][%r] The round has ended[^B]"
	MsgGameEnded      = "[^B][%r] The match has ended[^B]"
	MsgGameEvent      = "[%r] - [^B]%m[^B]"
	MsgQuitMapChange  = "Next match: [^B]%g[^B] on [^B]%m[^B]"

	MsgPlayerConnected              = "[%r] %p[^O] connected to the server"
	MsgPlayerConnectedSpectator     = "[%r] %p[^O] connected as spectator"
	MsgPlayerDisconnected           = "[%r] %p[^O] disconnected from the server"
	MsgPlayerWasKicked              = "[%r] %p[^O] was kicked from the server by %m"
	MsgPlayerChangedTeam            = "[%r] %p[^O] has joined [^B]%t[^O]"
	MsgPlayerChangedName            = "[%r] %o[^O] changed nick to %n[^O]"
	MsgPlayerChat                   = "(%r) %p[^O]: %m"
	MsgPlayerScoredKill             = "[%r] %k[^O] killed %o[^O]"
	MsgPlayerSuicided               = "[%r] %k[^O] %s"
	MsgPlayerTeamKilled             = "[%r] %k[^O] team-killed %o[^O]"
	MsgPlayerPickup                 = "[%r] %p[^O] picked up the [^K]%c[^B]%i[^O]"

	MsgPlayerIsFlakMonkey     = "[%r] - %p[^O] is a [^B]Flak Monkey[^B]"
	MsgPlayerIsComboWhore     = "[%r] - %p[^O] is a [^B]Combo Whore[^B]"
	MsgPlayerIsHeadHunter     = "[%r] - %p[^O] is a [^B]Head Hunter[^B]"
	MsgPlayerIsOnRoadRampage  = "[%r] - %p[^O] is on a [^B]Road Rampage[^B]"
	MsgPlayerFinishedAmpRun   = "[%r] - %p[^O] finished the [^B][^K]13Amp Run[^K][^B] after %k kills"
	MsgPlayerFinishedAmpRunNoKills  = "[%r] - %p[^O] wasted the [^B][^K]13Amp Run[^K][^B]"
	MsgPlayerFinishedAmpRunOneKill  = "[%r] - %p[^O] finished the [^B][^K]13Amp Run[^K][^B] after only one kill"

	MsgTeamScored               = "[^B][%r][^B] %t scored [^B]%d[^B] and now has [^B]%s[^B]"
	MsgTeamScoredTied           = "[^B][%r][^B] %t scored [^B]%d[^B] and is now tied for the lead with %l at [^B]%s[^B]"
	MsgTeamScoredTakesLead      = "[^B][%r][^B] %t scored [^B]%d[^B] and takes the lead with [^B]%s[^B]"
	MsgTeamScoredIncreasesLead  = "[^B][%r][^B] %t increases the lead by [^B]%d[^B] and now has [^B]%s[^B]"
	//MsgTeamScoredBehind         = "[^B][%r][^B] %t scored [^B]%d[^B] and now has [^B]%s[^B]"
	MsgLeadersTied              = "[^B][%r][^B] %t are tied for the lead with [^B]%s[^B]"
	MsgTakesLead                = "[^B][%r][^B] %t takes the lead with [^B]%s[^B]"

	StringMsgSuffix         = " - [^B]%m[^O]"
	StringSuffixHattrick    = "Hattrick!"
	StringComboKill         = "Combo Kill"
	StringAmpRunStopped     = " - [^B][^K]13Amp Run[^K] stopped[^B] after %t seconds (%k kills)"
	StringAmpRunStoppedOneKill  = " - [^B][^K]13Amp Run[^K] stopped[^B] after %t seconds (1 kill)"
	StringAmpRunStoppedNoKills  = " - [^B][^K]13Amp Run[^K] stopped[^B] after %t seconds (no kills)"
	StringPlayerIsOut       = " - %p[^O] is [^B]OUT[^B]"
	StringSuffixWeapon      = " with the [^B]%w[^B]"
	StringSuffixWeaponAmped = " with the [^K]13[^B]%w[^O]"
	StringSuffixPush        = " with a little push"
	StringSuffixTelefrag    = " with a [^B]telefrag[^B]"
	StringSuffixLocation    = " %l"
	StringSuicide           = "suicided"
	StringSuicideDrowned    = "drowned"
	StringSuicideFell       = "left a small crater"
	StringSuicideLava       = "crashed and burned"
	StringNameGame          = "the game"
	StringNameSpectators    = "the spectators"
	StringNameWildcardBase  = "Wildcard Pickup Base"

	// templates for chat proxy
	TemplateMessage = "<%u> %m"
	TemplateAction  = "* %u %m"
	TemplateNick    = "*** %u is now %n"
	TemplateJoin    = "*** %u joined the channel"
	TemplatePart    = "*** %u left the channel"
	TemplateQuit    = "*** %u left IRC"
	TemplateKick    = "*** %k was kicked by %u"
	TemplateWait    = "*** Waiting for the IRC reporter bot to finish..."

	// webadmin labels
	ReporterGroup   = "Wormbot Reporter"
	ChatRelayGroup  = "Wormbot Chat"

	lblEnableReporter             = "Enable IRC Reporter Bot"
	lblReportServerName           = "IRC server address"
	lblReportServerPort           = "IRC server port"
	lblReportServerPassword       = "IRC server password"
	lblReportUserNick             = "Nick"
	lblReportUserIdent            = "Ident"
	lblReportChannel              = "IRC channel"
	lblReportChannelKey           = "IRC channel key"
	lblReportStripCodes           = "Strip codes"
	lblSetReportChannelTopic      = "Set report channel topic"
	lblReportChannelTopicTemplate = "Channel topic template"
	lblReportChannelTopicBotPart  = "Channel topic (reporting)"
	lblReportChannelTopicBotIdle  = "Channel topic (idle)"
	lblReportChannelTopicUserPart = "Channel topic (no user topic)"
	lblMaxLevelChangeDelay        = "Max. Level Change Delay"

	lblEnableChatBot            = "Enable IRC Chat Bot"
	lblEnableTwoWayChat         = "Enable two-way chat"
	lblChatToGameAsTeamSay      = "Chat to game as TeamSay"
	lblChatThroughReporter      = "Chat through reporter bot"
	lblChatServerName           = "IRC server address"
	lblChatServerPort           = "IRC server port"
	lblChatServerPassword       = "IRC server password"
	lblChatUserNick             = "Nick"
	lblChatUserIdent            = "Ident"
	lblChatChannel              = "IRC channel"
	lblChatChannelKey           = "IRC channel key"
	lblChatStripCodes           = "Strip codes"
	lblChatTrigger              = "IRC trigger string"
	lblSpecOnlyChatTrigger      = "IRC spectator-only trigger string"
	lblChatReceiveOnlyText      = "Receive only text"
	lblColorCodeReplacements    = "Color code replacements"

	lblAuth           = "(Auth) Auth on Quakenet"
	lblChallengeAuth  = "(Auth) Use Challenge Auth"
	lblHideRealHost   = "(Auth) Hide real host"
	lblAuthNick       = "(Auth) Nick"
	lblAuthPassword   = "(Auth) Password"

	lblFloodProtectCommandPenalty = "(Connection) Flood protect command penalty"
	lblFloodProtectMessagePenalty = "(Connection) Flood protect message penalty"
	lblFloodProtectMaxPenalty     = "(Connection) Flood protect max. penalty"
	lblFloodProtectBytes          = "(Connection) Flood protect bytes"
	lblFloodProtectBytesDuration  = "(Connection) Flood protect bytes duration"
	lblMaxLenMessageQueue         = "(Connection) Max. message queue length"

	lblAutoReconnect  = "(Connection) Auto-reconnect"
	lblReconnectDelay = "(Connection) Reconnect Delay"
	lblConnectTimeout = "(Connection) Connect timeout"
	lblAutoRejoin     = "(Connection) Auto-rejoin"

	lblDebugLogFileName = "(Debug) Log file name"
	lblDebugStartMatch  = "(Debug) Auto-start match"

	lblItems = "(Reporter) Item names"

	// webadmin descriptions
	descEnableReporter              = "Enables the IRC event reporter bot."
	descReportServerName            = "IP address or DNS name of the reporter bot's IRC server."
	descReportServerPort            = "Port number of the reporter bot's IRC server."
	descReportServerPassword        = "Password required to connect to the reporter bot's IRC server."
	descReportUserNick              = "Nick name the reporter bot should use."
	descReportUserIdent             = "Ident the reporter bot should use."
	descReportChannel               = "Channel the reporter bot will send events to."
	descReportChannelKey            = "Key required to join the reporter bot's channel."
	descReportStripCodes            = "Whether the bot should strip colors or all codes from its messages to get around channel mode +c."
	descSetReportChannelTopic       = "The reporter bot should set the topic of the channel it reports to."
	descReportChannelTopicTemplate  = "The topic template. %%botpart%% is where the bot inserts match details, %%userpart%% is where channel ops can insert a topic."
	descReportChannelTopicBotPart   = "Template for the match details if there's a match in progress."
	descReportChannelTopicBotIdle   = "Message to insert insead of the match details if no match is in progress."
	descReportChannelTopicUserPart  = "Default text for the user part of the topic."
	descMaxLevelChangeDelay         = "Maximum number of seconds the reporter bot is allowed to delay a map change."

	descEnableChatBot           = "Enables the IRC chat relay bot."
	descEnableTwoWayChat        = "Allows players to see IRC chat."
	descChatToGameAsTeamSay     = "Display IRC chat only to spectators in team games."
	descChatThroughReporter     = "Reuse the reporter bot's IRC connection for chat, if available."
	descChatServerName          = "IP address or DNS name of the chat bot's IRC server."
	descChatServerPort          = "Port number of the chat bot's IRC server."
	descChatServerPassword      = "Password required to connect to the chat bot's IRC server."
	descChatUserNick            = "Nick name the chat bot should use."
	descChatUserIdent           = "Ident the chat bot should use."
	//descChatRegistrationHandler = "Class that will handle registering the chat bot on the IRC network."
	descChatChannel             = "Channel the chat bot will send events to."
	descChatChannelKey          = "Key required to join the chat bot's channel."
	descChatStripCodes          = "Whether the bot should strip colors or all codes from its messages to get around channel mode +c."
	descChatTrigger             = "Trigger string required if a text message should be seen in the game, e.g. '!say'."
	descSpecOnlyChatTrigger     = "Trigger string required if a text message should be seen by spectators in the game, e.g. '!say'."
	descChatReceiveOnlyText     = "The Chat Replay Bot should only send text to the game, no nick changes or users entering/leaving the channel."
	descColorCodeReplacements   = "List of replacement strings for UTComp color codes. Values are space-separated."

	descAuth          = "The bot(s) will try to auth when connecting to Quakenet."
	descChallengeAuth = "The bot(s) will use Challenge Auth so the password will never be sent in plain text."
	descHideRealHost  = "The bot(s) will set user mode +x and only join the report/chat channel(s) after they have authed."
	descAuthNick      = "The user name the bot(s) should auth with."
	descAuthPassword  = "The password associated with the auth nick."

	descFloodProtectCommandPenalty  = "How much each command increases the delay. (in milliseconds)"
	descFloodProtectMessagePenalty  = "How much each text message increases the delay. (in milliseconds)"
	descFloodProtectMaxPenalty      = "How much line delay is allowed."
	descFloodProtectBytes           = "How many bytes max should be sent in a short time interval."
	descFloodProtectBytesDuration   = "How long is the time interval for the byte count flood check."
	descMaxLenMessageQueue          = "How many messages may be in the message queue before the whole queue is dropped to catch up with gameplay."

	descAutoReconnect   = "Automatically reconnect after connection failure."
	descReconnectDelay  = "The bot will wait for this time before trying to reconnect to the IRC server."
	descConnectTimeout  = "Wait this long before considering a connection attempt to have timed out."
	descAutoRejoin      = "Automatically rejoin channel after getting kicked. Otherwise wait for invite."

	descDebugLogFileName  = "Name of the log file the raw IRC traffic is written to."
	descDebugStartMatch   = "Force-start the match once the reporter bot has joined the channel."

	descItems = "A list of pickup classes and their corresponding item names."

	dataStripCodes  = "0;None;1;Colors;2;All"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: So 14.4.2013 12:01:58.000 - Creation time: Do 14.8.2014 09:58:45.118 - Created with UnCodeX